@mirage-engine/core 0.3.10 → 0.3.12

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 Be = Object.defineProperty, Oe = Object.defineProperties;
2
- var Fe = Object.getOwnPropertyDescriptors;
3
- var ye = Object.getOwnPropertySymbols;
1
+ var Be = Object.defineProperty, Fe = Object.defineProperties;
2
+ var Oe = Object.getOwnPropertyDescriptors;
3
+ var we = Object.getOwnPropertySymbols;
4
4
  var _e = Object.prototype.hasOwnProperty, Ne = Object.prototype.propertyIsEnumerable;
5
- var ae = (s, e, t) => e in s ? Be(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, q = (s, e) => {
5
+ var me = (s, e, t) => e in s ? Be(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, J = (s, e) => {
6
6
  for (var t in e || (e = {}))
7
- _e.call(e, t) && ae(s, t, e[t]);
8
- if (ye)
9
- for (var t of ye(e))
10
- Ne.call(e, t) && ae(s, t, e[t]);
7
+ _e.call(e, t) && me(s, t, e[t]);
8
+ if (we)
9
+ for (var t of we(e))
10
+ Ne.call(e, t) && me(s, t, e[t]);
11
11
  return s;
12
- }, be = (s, e) => Oe(s, Fe(e));
13
- var g = (s, e, t) => (ae(s, typeof e != "symbol" ? e + "" : e, t), t);
14
- var we = (s, e, t) => new Promise((r, i) => {
15
- var l = (a) => {
12
+ }, xe = (s, e) => Fe(s, Oe(e));
13
+ var g = (s, e, t) => (me(s, typeof e != "symbol" ? e + "" : e, t), t);
14
+ var Ee = (s, e, t) => new Promise((r, i) => {
15
+ var c = (a) => {
16
16
  try {
17
17
  o(t.next(a));
18
- } catch (c) {
19
- i(c);
18
+ } catch (l) {
19
+ i(l);
20
20
  }
21
21
  }, n = (a) => {
22
22
  try {
23
23
  o(t.throw(a));
24
- } catch (c) {
25
- i(c);
24
+ } catch (l) {
25
+ i(l);
26
26
  }
27
- }, o = (a) => a.done ? r(a.value) : Promise.resolve(a.value).then(l, n);
27
+ }, o = (a) => a.done ? r(a.value) : Promise.resolve(a.value).then(c, n);
28
28
  o((t = t.apply(s, e)).next());
29
29
  });
30
30
  import * as y from "three";
31
- const Re = {
31
+ const Me = {
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
- }, G = {
37
+ }, K = {
38
38
  NAME: "data-mirage-dom",
39
39
  KEY: "mirageDom",
40
40
  VALUES: {
41
41
  HIDE: "hide",
42
42
  SHOW: "show"
43
43
  }
44
- }, xe = {
44
+ }, Ce = {
45
45
  TRAVELER: "traveler",
46
46
  NATIVE: "native",
47
47
  CAPTURE_1: "1",
@@ -57,16 +57,16 @@ const Re = {
57
57
  }, O = {
58
58
  NAME: "data-mirage-travel",
59
59
  KEY: "mirageTravel",
60
- VALUES: xe,
61
- MAX_LAYERS: Object.keys(xe).length - 1
62
- }, z = {
60
+ VALUES: Ce,
61
+ MAX_LAYERS: Object.keys(Ce).length - 1
62
+ }, W = {
63
63
  NAME: "data-mirage-filter",
64
64
  KEY: "mirageFilter",
65
- VALUES: Re
66
- }, W = {
65
+ VALUES: Me
66
+ }, q = {
67
67
  NAME: "data-mirage-select",
68
68
  KEY: "mirageSelect",
69
- VALUES: Re
69
+ VALUES: Me
70
70
  }, Xe = {
71
71
  NAME: "data-mirage-shader",
72
72
  KEY: "mirageShader"
@@ -76,7 +76,7 @@ const Re = {
76
76
  VALUES: {
77
77
  FRONT: "front"
78
78
  }
79
- }, re = 0, $ = 1, Z = 2, ze = 4, ie = 8, ce = 16;
79
+ }, de = 0, Q = 1, le = 2, ze = 4, ue = 8, ve = 16;
80
80
  function Ve(s) {
81
81
  const e = s.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
82
82
  return e ? {
@@ -105,7 +105,7 @@ class We {
105
105
  g(this, "pendingStyles", /* @__PURE__ */ new Map());
106
106
  g(this, "isDomDirty", !1);
107
107
  g(this, "isRunning", !1);
108
- g(this, "pendingMask", re);
108
+ g(this, "pendingMask", de);
109
109
  g(this, "mutationTimer", null);
110
110
  g(this, "cssTimer", null);
111
111
  g(this, "resizeConfig");
@@ -120,7 +120,7 @@ class We {
120
120
  g(this, "onScrollChange", /* @__PURE__ */ new Set());
121
121
  g(this, "onRender", /* @__PURE__ */ new Set());
122
122
  g(this, "onTransitionFinished", (e) => {
123
- this.target.contains(e.target) && this.mutationTimer === null && (this.cssTimer && clearTimeout(this.cssTimer), this.pendingStyles.size == 0 && (this.pendingMask |= $ | Z, this.cssTimer = window.setTimeout(() => {
123
+ this.target.contains(e.target) && this.mutationTimer === null && (this.cssTimer && clearTimeout(this.cssTimer), this.pendingStyles.size == 0 && (this.pendingMask |= Q | le, this.cssTimer = window.setTimeout(() => {
124
124
  this.isDomDirty = !0, this.cssTimer = null;
125
125
  }, 50)));
126
126
  });
@@ -136,38 +136,38 @@ class We {
136
136
  g(this, "renderLoop", () => {
137
137
  if (!this.isRunning)
138
138
  return;
139
- this.onBeforeRender.forEach((r) => r()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((r) => r(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = re);
139
+ this.onBeforeRender.forEach((r) => r()), this.isDomDirty && (this.isDomDirty = !1, this.onLayoutChange.forEach((r) => r(this.pendingMask, this.pendingDeletions)), this.pendingDeletions.clear(), this.pendingMask = de);
140
140
  const e = window.scrollX, t = window.scrollY;
141
141
  (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(() => {
142
- this.pendingMask |= $, this.isDomDirty = !0, this.scrollTimer = null;
142
+ this.pendingMask |= Q, this.isDomDirty = !0, this.scrollTimer = null;
143
143
  }, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((r) => r(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((r) => r()), requestAnimationFrame(this.renderLoop);
144
144
  });
145
- var i, l;
145
+ var i, c;
146
146
  this.target = e;
147
147
  const r = (i = t.resizeDebounce) != null ? i : !0;
148
148
  r === !1 ? this.resizeConfig = { enabled: !1, delay: 0 } : r === !0 ? this.resizeConfig = { enabled: !0, delay: 150 } : this.resizeConfig = {
149
149
  enabled: !0,
150
- delay: (l = r.delay) != null ? l : 150,
150
+ delay: (c = r.delay) != null ? c : 150,
151
151
  onStart: r.onStart,
152
152
  onEnd: r.onEnd
153
153
  }, this.observer = new MutationObserver((n) => {
154
- let o = re;
154
+ let o = de;
155
155
  for (const a of n)
156
156
  if (a.type === "childList")
157
- o |= ie, a.removedNodes.length > 0 && a.removedNodes.forEach((c) => {
158
- c instanceof HTMLElement && this.pendingDeletions.add(c);
157
+ o |= ue, a.removedNodes.length > 0 && a.removedNodes.forEach((l) => {
158
+ l instanceof HTMLElement && this.pendingDeletions.add(l);
159
159
  });
160
160
  else if (a.type === "attributes")
161
161
  if (a.attributeName === "style") {
162
- o |= $ | Z;
163
- const c = a.target, d = Ye(c.style);
164
- this.pendingStyles.set(c, d);
162
+ o |= Q | le;
163
+ const l = a.target, d = Ye(l.style);
164
+ this.pendingStyles.set(l, d);
165
165
  } else
166
- a.attributeName === "class" ? o |= $ | Z : a.attributeName && a.attributeName.startsWith("data-") && (o |= $ | Z, a.attributeName.startsWith("data-mirage") && (o |= ie));
166
+ a.attributeName === "class" ? o |= Q | le : a.attributeName && a.attributeName.startsWith("data-") && (o |= Q | le, a.attributeName.startsWith("data-mirage") && (o |= ue));
167
167
  else
168
- a.type === "characterData" && (o |= ce | $);
169
- if (o !== re) {
170
- if (this.pendingMask |= o, o & ie) {
168
+ a.type === "characterData" && (o |= ve | Q);
169
+ if (o !== de) {
170
+ if (this.pendingMask |= o, o & ue) {
171
171
  this.clearTimers(), this.isDomDirty = !0;
172
172
  return;
173
173
  }
@@ -192,13 +192,13 @@ class We {
192
192
  this.mutationTimer && (clearTimeout(this.mutationTimer), this.mutationTimer = null), this.cssTimer && (clearTimeout(this.cssTimer), this.cssTimer = null), this.scrollTimer && (clearTimeout(this.scrollTimer), this.scrollTimer = null);
193
193
  }
194
194
  }
195
- const H = 1, K = 2, ct = 0, U = {
195
+ const P = 1, te = 2, lt = 0, U = {
196
196
  BASE: 0,
197
197
  SELECTED: 1,
198
198
  getCaptureLayer: (s) => 31 - s,
199
199
  HIDDEN: 31
200
- }, Ee = Object.values(z.VALUES);
201
- class Le {
200
+ }, Se = Object.values(W.VALUES);
201
+ class De {
202
202
  /**
203
203
  * Calculates or retrieves the exact alphabetic baseline (in pixels) for the given font.
204
204
  * @param font CSS font shorthand string (e.g., "400 16px Inter")
@@ -215,13 +215,13 @@ class Le {
215
215
  return 0;
216
216
  const t = document.createElement("div"), r = document.createElement("span"), i = document.createElement("img");
217
217
  t.style.visibility = "hidden", t.style.position = "absolute", t.style.top = "0px", t.style.left = "0px", t.style.font = e, t.style.margin = "0", t.style.padding = "0", t.style.border = "none", r.style.margin = "0", r.style.padding = "0", r.style.border = "none", r.style.lineHeight = "normal", i.width = 1, i.height = 1, i.style.verticalAlign = "baseline", r.appendChild(document.createTextNode("Hidden Text")), t.appendChild(r), t.appendChild(i), document.body.appendChild(t);
218
- const l = i.offsetTop - r.offsetTop;
219
- return document.body.removeChild(t), l;
218
+ const c = i.offsetTop - r.offsetTop;
219
+ return document.body.removeChild(t), c;
220
220
  }
221
221
  }
222
- g(Le, "cache", /* @__PURE__ */ new Map());
222
+ g(De, "cache", /* @__PURE__ */ new Map());
223
223
  class He extends y.MeshBasicMaterial {
224
- constructor(t, r, i, l, n = 2) {
224
+ constructor(t, r, i, c, n = 2) {
225
225
  super({
226
226
  transparent: !0,
227
227
  side: y.FrontSide,
@@ -232,55 +232,55 @@ class He extends y.MeshBasicMaterial {
232
232
  g(this, "qualityFactor");
233
233
  if (this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d"), !this.ctx)
234
234
  throw new Error("[Mirage] Failed to create canvas context");
235
- this.qualityFactor = n, this.map = new y.CanvasTexture(this.canvas), this.map.colorSpace = y.LinearSRGBColorSpace, this.map.minFilter = y.LinearFilter, this.map.magFilter = y.LinearFilter, this.updateText(t, r, i, l);
235
+ this.qualityFactor = n, this.map = new y.CanvasTexture(this.canvas), this.map.colorSpace = y.LinearSRGBColorSpace, this.map.minFilter = y.LinearFilter, this.map.magFilter = y.LinearFilter, this.updateText(t, r, i, c);
236
236
  }
237
237
  wrapText(t, r) {
238
238
  const i = t.split(`
239
- `), l = [];
239
+ `), c = [];
240
240
  return i.forEach((n) => {
241
241
  const o = n.match(/[^\s\-]+\-?|\-|\s+/g) || [];
242
242
  if (o.length === 0) {
243
- l.push("");
243
+ c.push("");
244
244
  return;
245
245
  }
246
246
  let a = o[0];
247
- for (let c = 1; c < o.length; c++) {
248
- const d = o[c];
249
- this.ctx.measureText(a + d).width <= r + 2 ? a += d : (a && l.push(a), a = d.trimStart());
247
+ for (let l = 1; l < o.length; l++) {
248
+ const d = o[l];
249
+ this.ctx.measureText(a + d).width <= r + 2 ? a += d : (a && c.push(a), a = d.trimStart());
250
250
  }
251
- a && l.push(a);
252
- }), l;
251
+ a && c.push(a);
252
+ }), c;
253
253
  }
254
- updateText(t, r, i, l, n) {
254
+ updateText(t, r, i, c, n) {
255
255
  n !== void 0 && (this.qualityFactor = n);
256
- const a = (window.devicePixelRatio || 1) * this.qualityFactor, c = i * a, d = l * a;
257
- this.canvas.width !== c || this.canvas.height !== d ? (this.canvas.width = c, this.canvas.height = d) : this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.setTransform(a, 0, 0, a, 0, 0), this.ctx.font = r.font, this.ctx.fillStyle = r.color, this.ctx.textBaseline = "alphabetic", this.ctx.globalAlpha = 1;
258
- const h = this.wrapText(t, i), u = r.lineHeight, p = Le.getBaseline(r.font);
256
+ const a = (window.devicePixelRatio || 1) * this.qualityFactor, l = i * a, d = c * a;
257
+ this.canvas.width !== l || this.canvas.height !== d ? (this.canvas.width = l, this.canvas.height = d) : this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.setTransform(a, 0, 0, a, 0, 0), this.ctx.font = r.font, this.ctx.fillStyle = r.color, this.ctx.textBaseline = "alphabetic", this.ctx.globalAlpha = 1;
258
+ const h = this.wrapText(t, i), u = r.lineHeight, v = De.getBaseline(r.font);
259
259
  h.forEach((f, m) => {
260
- const b = m * u + p;
261
- let R = 0;
262
- r.textAlign === "center" ? R = i / 2 : r.textAlign === "right" && (R = i), this.ctx.textAlign = r.textAlign, this.ctx.fillText(f, R, b);
260
+ const b = m * u + v;
261
+ let L = 0;
262
+ r.textAlign === "center" ? L = i / 2 : r.textAlign === "right" && (L = i), this.ctx.textAlign = r.textAlign, this.ctx.fillText(f, L, b);
263
263
  }), this.map && (this.map.needsUpdate = !0);
264
264
  }
265
265
  dispose() {
266
266
  this.map && this.map.dispose(), super.dispose();
267
267
  }
268
268
  }
269
- function J(s, e = 0) {
269
+ function re(s, e = 0) {
270
270
  if (typeof s == "number")
271
271
  return s;
272
272
  const t = parseFloat(s) || 0;
273
273
  return typeof s == "string" && s.includes("%") ? t / 100 * e : t;
274
274
  }
275
- function ee(s) {
275
+ function ce(s) {
276
276
  if (!s || s === "transparent")
277
277
  return { color: new y.Color(16777215), alpha: 0 };
278
278
  const e = s.match(
279
279
  /rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/
280
280
  );
281
281
  if (e) {
282
- const t = parseInt(e[1], 10), r = parseInt(e[2], 10), i = parseInt(e[3], 10), l = e[4] !== void 0 ? parseFloat(e[4]) : 1;
283
- return { color: new y.Color(`rgb(${t}, ${r}, ${i})`), alpha: l };
282
+ const t = parseInt(e[1], 10), r = parseInt(e[2], 10), i = parseInt(e[3], 10), c = e[4] !== void 0 ? parseFloat(e[4]) : 1;
283
+ return { color: new y.Color(`rgb(${t}, ${r}, ${i})`), alpha: c };
284
284
  }
285
285
  return { color: new y.Color(s), alpha: 1 };
286
286
  }
@@ -288,16 +288,16 @@ function Pe(s) {
288
288
  const e = [];
289
289
  let t = "", r = 0;
290
290
  for (let i = 0; i < s.length; i++) {
291
- const l = s[i];
292
- if (l === "(")
291
+ const c = s[i];
292
+ if (c === "(")
293
293
  r++;
294
- else if (l === ")")
294
+ else if (c === ")")
295
295
  r--;
296
- else if (l === "," && r === 0) {
296
+ else if (c === "," && r === 0) {
297
297
  e.push(t.trim()), t = "";
298
298
  continue;
299
299
  }
300
- t += l;
300
+ t += c;
301
301
  }
302
302
  return t && e.push(t.trim()), e;
303
303
  }
@@ -308,44 +308,44 @@ function Ge(s) {
308
308
  if (!e)
309
309
  return null;
310
310
  const t = e[1], r = Pe(t);
311
- let i = Math.PI, l = 0;
311
+ let i = Math.PI, c = 0;
312
312
  const n = r[0].trim();
313
313
  if (n.startsWith("to "))
314
- n === "to top" ? i = 0 : n === "to right" ? i = Math.PI / 2 : n === "to bottom" ? i = Math.PI : n === "to left" ? i = Math.PI * 1.5 : n === "to top right" || n === "to right top" ? i = Math.PI / 4 : n === "to bottom right" || n === "to right bottom" ? i = Math.PI * 0.75 : n === "to bottom left" || n === "to left bottom" ? i = Math.PI * 1.25 : (n === "to top left" || n === "to left top") && (i = Math.PI * 1.75), l = 1;
314
+ n === "to top" ? i = 0 : n === "to right" ? i = Math.PI / 2 : n === "to bottom" ? i = Math.PI : n === "to left" ? i = Math.PI * 1.5 : n === "to top right" || n === "to right top" ? i = Math.PI / 4 : n === "to bottom right" || n === "to right bottom" ? i = Math.PI * 0.75 : n === "to bottom left" || n === "to left bottom" ? i = Math.PI * 1.25 : (n === "to top left" || n === "to left top") && (i = Math.PI * 1.75), c = 1;
315
315
  else if (n.endsWith("deg") || n.endsWith("rad") || n.endsWith("turn")) {
316
316
  const a = parseFloat(n);
317
- n.endsWith("deg") ? i = a * (Math.PI / 180) : n.endsWith("rad") ? i = a : n.endsWith("turn") && (i = a * Math.PI * 2), l = 1;
317
+ n.endsWith("deg") ? i = a * (Math.PI / 180) : n.endsWith("rad") ? i = a : n.endsWith("turn") && (i = a * Math.PI * 2), c = 1;
318
318
  }
319
319
  const o = [];
320
- for (let a = l; a < r.length && !(o.length >= 8); a++) {
321
- const c = r[a].trim(), d = c.lastIndexOf(" ");
322
- let h = c, u = null;
323
- if (d !== -1 && !c.endsWith(")")) {
324
- const f = c.substring(d + 1);
325
- (f.endsWith("%") || f.endsWith("px") || !isNaN(parseFloat(f))) && (h = c.substring(0, d).trim(), u = f);
320
+ for (let a = c; a < r.length && !(o.length >= 8); a++) {
321
+ const l = r[a].trim(), d = l.lastIndexOf(" ");
322
+ let h = l, u = null;
323
+ if (d !== -1 && !l.endsWith(")")) {
324
+ const f = l.substring(d + 1);
325
+ (f.endsWith("%") || f.endsWith("px") || !isNaN(parseFloat(f))) && (h = l.substring(0, d).trim(), u = f);
326
326
  }
327
- const p = ee(h);
327
+ const v = ce(h);
328
328
  o.push({
329
- color: p.color,
330
- alpha: p.alpha,
329
+ color: v.color,
330
+ alpha: v.alpha,
331
331
  rawStop: u,
332
332
  stop: 0
333
333
  });
334
334
  }
335
335
  if (o.length > 0) {
336
- for (let c = 0; c < o.length; c++)
337
- o[c].rawStop !== null && (o[c].stop = parseFloat(o[c].rawStop) / 100);
336
+ for (let l = 0; l < o.length; l++)
337
+ o[l].rawStop !== null && (o[l].stop = parseFloat(o[l].rawStop) / 100);
338
338
  o[0].rawStop === null && (o[0].stop = 0), o.length > 1 && o[o.length - 1].rawStop === null && (o[o.length - 1].stop = 1);
339
339
  let a = 0;
340
- for (let c = 1; c < o.length; c++)
341
- if (o[c].rawStop !== null || c === o.length - 1) {
342
- const d = c - a;
340
+ for (let l = 1; l < o.length; l++)
341
+ if (o[l].rawStop !== null || l === o.length - 1) {
342
+ const d = l - a;
343
343
  if (d > 1) {
344
- const h = o[a].stop, p = (o[c].stop - h) / d;
344
+ const h = o[a].stop, v = (o[l].stop - h) / d;
345
345
  for (let f = 1; f < d; f++)
346
- o[a + f].stop = h + p * f;
346
+ o[a + f].stop = h + v * f;
347
347
  }
348
- a = c;
348
+ a = l;
349
349
  }
350
350
  }
351
351
  return { angle: i, stops: o };
@@ -503,17 +503,17 @@ uniform vec2 uTextureOffset;`, Ke = `vec2 screenUv = (vScreenPos.xy / vScreenPos
503
503
  vec2 resultUv = screenUv;
504
504
 
505
505
  `, Je = `vec4 texColor = texture2D(uTexture, resultUv);
506
- baseColor = blendSrcOver(baseColor, texColor);`, Ce = {
506
+ baseColor = blendSrcOver(baseColor, texColor);`, Te = {
507
507
  vertexShader: qe,
508
508
  fragmentShader: $e
509
- }, Te = {
509
+ }, Re = {
510
510
  declChunk: je,
511
511
  uvChunk: Ke,
512
512
  baseColorChunk: Je
513
513
  };
514
514
  function Qe(s, e, t, r = null, i) {
515
515
  var x;
516
- const l = r !== null || !!s.imageSrc;
516
+ const c = r !== null || !!s.imageSrc;
517
517
  let n = "";
518
518
  const o = {};
519
519
  if (i != null && i.uniforms)
@@ -524,11 +524,11 @@ function Qe(s, e, t, r = null, i) {
524
524
  `, o[C] = { value: new y.Vector3(...w) }) : w.length === 4 && (n += `uniform vec4 ${C};
525
525
  `, o[C] = { value: new y.Vector4(...w) }) : (n += `uniform float ${C};
526
526
  `, o[C] = { value: w });
527
- const a = i !== void 0, c = (l || a ? Te.declChunk : "") + `
527
+ const a = i !== void 0, l = (c || a ? Re.declChunk : "") + `
528
528
  ` + n, d = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
529
529
  `, h = s.isTraveler ? `vec2 resultUv = screenUv;
530
530
  ` : `vec2 resultUv = vUv * uTextureRepeat + uTextureOffset;
531
- `, u = l || a ? d + h + ((i == null ? void 0 : i.uvModifier) || "") : "", p = l || a ? Te.baseColorChunk : "", f = (i == null ? void 0 : i.colorModifier) || "", m = Ce.fragmentShader.replace("#INJECT_DECLARATIONS", c).replace("#INJECT_UV_MODIFIER", u).replace("#INJECT_BASE_COLOR", p).replace("#INJECT_COLOR_MODIFIER", f), b = ee(s.backgroundColor), R = ee(s.borderColor), L = {
531
+ `, u = c || a ? d + h + ((i == null ? void 0 : i.uvModifier) || "") : "", v = c || a ? Re.baseColorChunk : "", f = (i == null ? void 0 : i.colorModifier) || "", m = Te.fragmentShader.replace("#INJECT_DECLARATIONS", l).replace("#INJECT_UV_MODIFIER", u).replace("#INJECT_BASE_COLOR", v).replace("#INJECT_COLOR_MODIFIER", f), b = ce(s.backgroundColor), L = ce(s.borderColor), M = {
532
532
  uSize: { value: new y.Vector2(e, t) },
533
533
  uBgColor: {
534
534
  value: new y.Vector4(
@@ -540,14 +540,14 @@ function Qe(s, e, t, r = null, i) {
540
540
  },
541
541
  uBorderColor: {
542
542
  value: new y.Vector4(
543
- R.color.r,
544
- R.color.g,
545
- R.color.b,
546
- R.alpha
543
+ L.color.r,
544
+ L.color.g,
545
+ L.color.b,
546
+ L.alpha
547
547
  )
548
548
  },
549
549
  uBorderRadius: { value: new y.Vector4(0, 0, 0, 0) },
550
- uBorderWidth: { value: J(s.borderWidth) },
550
+ uBorderWidth: { value: re(s.borderWidth) },
551
551
  uOpacity: { value: (x = s.opacity) != null ? x : 1 },
552
552
  uTexture: { value: null },
553
553
  uTextureRepeat: { value: new y.Vector2(1, 1) },
@@ -559,24 +559,24 @@ function Qe(s, e, t, r = null, i) {
559
559
  },
560
560
  uGradientStops: { value: new Float32Array(8) }
561
561
  };
562
- Me(L.uBorderRadius.value, s.borderRadius, Math.min(e, t)), l && (L.uTexture.value = r);
563
- const T = new y.ShaderMaterial({
564
- uniforms: q(q({}, L), o),
565
- vertexShader: Ce.vertexShader,
562
+ Ae(M.uBorderRadius.value, s.borderRadius, Math.min(e, t)), c && (M.uTexture.value = r);
563
+ const S = new y.ShaderMaterial({
564
+ uniforms: J(J({}, M), o),
565
+ vertexShader: Te.vertexShader,
566
566
  fragmentShader: m,
567
567
  transparent: !0,
568
568
  side: y.FrontSide
569
569
  // for better performance
570
570
  });
571
- return s.backgroundImage && le(T, { backgroundImage: s.backgroundImage }), T;
571
+ return s.backgroundImage && ye(S, { backgroundImage: s.backgroundImage }), S;
572
572
  }
573
573
  function Ze(s, e, t, r, i) {
574
- const l = J(e.borderWidth);
575
- le(s, {
574
+ const c = re(e.borderWidth);
575
+ ye(s, {
576
576
  width: t,
577
577
  height: r,
578
578
  borderRadius: e.borderRadius,
579
- borderWidth: l,
579
+ borderWidth: c,
580
580
  backgroundColor: e.backgroundColor,
581
581
  borderColor: e.borderColor,
582
582
  opacity: e.opacity,
@@ -584,11 +584,11 @@ function Ze(s, e, t, r, i) {
584
584
  backgroundImage: e.backgroundImage
585
585
  });
586
586
  }
587
- function le(s, e) {
588
- var r, i, l;
587
+ function ye(s, e) {
588
+ var r, i, c;
589
589
  if (e.width !== void 0 && e.height !== void 0 && s.uniforms.uSize.value.set(e.width, e.height), e.borderRadius !== void 0) {
590
590
  const n = e.width !== void 0 && e.height !== void 0 ? Math.min(e.width, e.height) : Math.min(s.uniforms.uSize.value.x, s.uniforms.uSize.value.y);
591
- Me(s.uniforms.uBorderRadius.value, e.borderRadius, n);
591
+ Ae(s.uniforms.uBorderRadius.value, e.borderRadius, n);
592
592
  }
593
593
  if (e.borderWidth !== void 0 && (s.uniforms.uBorderWidth.value = e.borderWidth), e.backgroundColor !== void 0)
594
594
  if (Array.isArray(e.backgroundColor)) {
@@ -600,7 +600,7 @@ function le(s, e) {
600
600
  n
601
601
  );
602
602
  } else if (typeof e.backgroundColor == "string") {
603
- const n = ee(e.backgroundColor);
603
+ const n = ce(e.backgroundColor);
604
604
  s.uniforms.uBgColor.value.set(
605
605
  n.color.r,
606
606
  n.color.g,
@@ -626,7 +626,7 @@ function le(s, e) {
626
626
  n
627
627
  );
628
628
  } else if (typeof e.borderColor == "string") {
629
- const n = ee(e.borderColor);
629
+ const n = ce(e.borderColor);
630
630
  s.uniforms.uBorderColor.value.set(
631
631
  n.color.r,
632
632
  n.color.g,
@@ -645,9 +645,9 @@ function le(s, e) {
645
645
  e.opacity !== void 0 && (s.uniforms.uOpacity.value = e.opacity), e.bgOpacity !== void 0 && (s.uniforms.uBgColor.value.w = e.bgOpacity), e.borderOpacity !== void 0 && (s.uniforms.uBorderColor.value.w = e.borderOpacity), s.uniforms.uTexture && e.texture !== void 0 && (s.uniforms.uTexture.value = e.texture);
646
646
  const t = e.texture !== void 0 ? e.texture : (r = s.uniforms.uTexture) == null ? void 0 : r.value;
647
647
  if (t && (t.image instanceof ImageBitmap || t.image instanceof HTMLImageElement || t.image instanceof HTMLCanvasElement)) {
648
- const n = t.image.naturalWidth || t.image.videoWidth || t.image.width, o = t.image.naturalHeight || t.image.videoHeight || t.image.height, a = (i = e.width) != null ? i : s.uniforms.uSize.value.x, c = (l = e.height) != null ? l : s.uniforms.uSize.value.y;
649
- if (n && o && a && c) {
650
- const d = n / o, h = a / c;
648
+ const n = t.image.naturalWidth || t.image.videoWidth || t.image.width, o = t.image.naturalHeight || t.image.videoHeight || t.image.height, a = (i = e.width) != null ? i : s.uniforms.uSize.value.x, l = (c = e.height) != null ? c : s.uniforms.uSize.value.y;
649
+ if (n && o && a && l) {
650
+ const d = n / o, h = a / l;
651
651
  if (d > h) {
652
652
  const u = h / d;
653
653
  s.uniforms.uTextureRepeat.value.set(u, 1), s.uniforms.uTextureOffset.value.set((1 - u) / 2, 0);
@@ -679,8 +679,8 @@ function le(s, e) {
679
679
  for (const n of Object.keys(e))
680
680
  n !== "width" && n !== "height" && n !== "borderRadius" && n !== "borderWidth" && n !== "backgroundColor" && n !== "borderColor" && n !== "opacity" && n !== "bgOpacity" && n !== "borderOpacity" && n !== "texture" && n !== "backgroundImage" && s.uniforms[n] !== void 0 && (s.uniforms[n].value !== void 0 && s.uniforms[n].value !== null && typeof s.uniforms[n].value.set == "function" ? Array.isArray(e[n]) ? s.uniforms[n].value.set(...e[n]) : e[n] !== void 0 && (e[n].copy ? s.uniforms[n].value.copy(e[n]) : s.uniforms[n].value = e[n]) : s.uniforms[n].value = e[n]);
681
681
  }
682
- function Me(s, e, t = 0) {
683
- var a, c, d, h;
682
+ function Ae(s, e, t = 0) {
683
+ var a, l, d, h;
684
684
  if (e == null) {
685
685
  s.set(0, 0, 0, 0);
686
686
  return;
@@ -693,11 +693,11 @@ function Me(s, e, t = 0) {
693
693
  s.set(e[0], e[1], e[2], e[3]);
694
694
  return;
695
695
  }
696
- const r = e.split("/")[0].trim().split(/\s+/), i = J(r[0], t), l = J((a = r[1]) != null ? a : r[0], t), n = J((c = r[2]) != null ? c : r[0], t), o = J((h = (d = r[3]) != null ? d : r[1]) != null ? h : r[0], t);
697
- s.set(i, l, n, o);
696
+ const r = e.split("/")[0].trim().split(/\s+/), i = re(r[0], t), c = re((a = r[1]) != null ? a : r[0], t), n = re((l = r[2]) != null ? l : r[0], t), o = re((h = (d = r[3]) != null ? d : r[1]) != null ? h : r[0], t);
697
+ s.set(i, c, n, o);
698
698
  }
699
- const V = {
700
- create(s, e, t, r, i, l = 2, n = null, o) {
699
+ const H = {
700
+ create(s, e, t, r, i, c = 2, n = null, o) {
701
701
  return s === "BOX" ? Qe(
702
702
  e,
703
703
  r,
@@ -709,26 +709,26 @@ const V = {
709
709
  e,
710
710
  r,
711
711
  i,
712
- l
712
+ c
713
713
  ) : new y.MeshBasicMaterial({ visible: !1 });
714
714
  },
715
- update(s, e, t, r, i, l, n = 2, o) {
715
+ update(s, e, t, r, i, c, n = 2, o) {
716
716
  e === "BOX" ? Ze(
717
717
  s,
718
718
  t,
719
719
  i,
720
- l,
720
+ c,
721
721
  o
722
722
  ) : e === "TEXT" && s.updateText(
723
723
  r || "",
724
724
  t,
725
725
  i,
726
- l,
726
+ c,
727
727
  n
728
728
  );
729
729
  },
730
730
  forceUpdateUniforms(s, e) {
731
- le(s, e);
731
+ ye(s, e);
732
732
  }
733
733
  };
734
734
  class et {
@@ -741,8 +741,8 @@ class et {
741
741
  this.onUpdate = e, t && (this.observer = new IntersectionObserver(
742
742
  (r) => {
743
743
  for (const i of r) {
744
- const l = i.target;
745
- i.isIntersecting ? this.loadTexture(l) : this.disposeTexture(l);
744
+ const c = i.target;
745
+ i.isIntersecting ? this.loadTexture(c) : this.disposeTexture(c);
746
746
  }
747
747
  },
748
748
  { rootMargin: "300px" }
@@ -757,7 +757,7 @@ class et {
757
757
  e.nodeType === Node.ELEMENT_NODE && this.observer && this.observer.unobserve(e), this.disposeTexture(e), this.elementUrls.delete(e), this.loadStatus.delete(e);
758
758
  }
759
759
  loadTexture(e) {
760
- return we(this, null, function* () {
760
+ return Ee(this, null, function* () {
761
761
  if (this.loadStatus.get(e) || this.textures.has(e))
762
762
  return;
763
763
  const t = this.elementUrls.get(e);
@@ -766,9 +766,9 @@ class et {
766
766
  try {
767
767
  let r;
768
768
  if (t.startsWith("data:image/svg+xml"))
769
- r = yield new Promise((l, n) => {
769
+ r = yield new Promise((c, n) => {
770
770
  const o = new Image();
771
- o.onload = () => l(o), o.onerror = n, o.src = t;
771
+ o.onload = () => c(o), o.onerror = n, o.src = t;
772
772
  });
773
773
  else {
774
774
  const n = yield (yield fetch(t)).blob();
@@ -824,15 +824,15 @@ class tt {
824
824
  g(this, "textureManager");
825
825
  // private meshMap: Map<HTMLElement, THREE.Mesh> = new Map();
826
826
  g(this, "fixedMeshes", /* @__PURE__ */ new Set());
827
- var o, a, c, d, h;
828
- this.target = e, this.mountContainer = r, this.registry = i, this.mode = (o = t.mode) != null ? o : "overlay", this.canvasSize = (a = t.canvasSize) != null ? a : "viewport", this.clipArea = (c = t.travelerClipArea) != null ? c : 1, this.targetLayer = (d = t.layer) != null ? d : "base", this.textureManager = new et((u, p) => {
827
+ var o, a, l, d, h;
828
+ this.target = e, this.mountContainer = r, this.registry = i, this.mode = (o = t.mode) != null ? o : "overlay", this.canvasSize = (a = t.canvasSize) != null ? a : "viewport", this.clipArea = (l = t.travelerClipArea) != null ? l : 1, this.targetLayer = (d = t.layer) != null ? d : "base", this.textureManager = new et((u, v) => {
829
829
  const f = this.registry.get(u);
830
- f && f.material instanceof y.ShaderMaterial && V.forceUpdateUniforms(f.material, { texture: p });
830
+ f && f.material instanceof y.ShaderMaterial && H.forceUpdateUniforms(f.material, { texture: v });
831
831
  }, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new y.Scene(), this.targetRect = this.target.getBoundingClientRect();
832
- const l = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, n = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
832
+ const c = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, n = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
833
833
  this.camera = new y.OrthographicCamera(
834
- l / -2,
835
- l / 2,
834
+ c / -2,
835
+ c / 2,
836
836
  n / 2,
837
837
  n / -2,
838
838
  1,
@@ -843,7 +843,7 @@ class tt {
843
843
  antialias: !0
844
844
  // [new]
845
845
  // premultipliedAlpha: true
846
- }), y.ColorManagement.enabled = !1, this.renderer.outputColorSpace = y.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(l, n), this.applyTextQuality((h = t.quality) != null ? h : "medium");
846
+ }), y.ColorManagement.enabled = !1, this.renderer.outputColorSpace = y.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(c, n), this.applyTextQuality((h = t.quality) != null ? h : "medium");
847
847
  }
848
848
  get isViewport() {
849
849
  return this.mode === "overlay" && this.canvasSize === "viewport";
@@ -899,12 +899,12 @@ class tt {
899
899
  updateUniforms(e, t) {
900
900
  const r = this.registry.get(e);
901
901
  r && (r.traverse((i) => {
902
- i.isMesh && i.material && V.forceUpdateUniforms(
902
+ i.isMesh && i.material && H.forceUpdateUniforms(
903
903
  i.material,
904
904
  t
905
905
  );
906
906
  }), r.userData.nativeMesh && r.userData.nativeMesh.traverse((i) => {
907
- i.isMesh && i.material && V.forceUpdateUniforms(
907
+ i.isMesh && i.material && H.forceUpdateUniforms(
908
908
  i.material,
909
909
  t
910
910
  );
@@ -920,8 +920,8 @@ class tt {
920
920
  this.camera.left = e / -2, this.camera.right = e / 2, this.camera.top = t / 2, this.camera.bottom = t / -2, this.camera.updateProjectionMatrix();
921
921
  }
922
922
  syncScene(e, t) {
923
- const r = this.target.getBoundingClientRect(), i = this.isViewport ? window.innerWidth + this.overscan * 2 : r.width, l = this.isViewport ? window.innerHeight + this.overscan * 2 : r.height, n = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, o = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, a = Math.abs(i - n) > 0.1 || Math.abs(l - o) > 0.1, c = this.mode === "overlay" && (Math.abs(r.top - this.targetRect.top) > 0.1 || Math.abs(r.left - this.targetRect.left) > 0.1);
924
- a ? (this.targetRect = r, this.setSize(i, l), this.updateCanvasLayout()) : c ? (this.targetRect = r, this.updateCanvasLayout()) : this.targetRect = r, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((d) => {
923
+ const r = this.target.getBoundingClientRect(), i = this.isViewport ? window.innerWidth + this.overscan * 2 : r.width, c = this.isViewport ? window.innerHeight + this.overscan * 2 : r.height, n = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, o = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, a = Math.abs(i - n) > 0.1 || Math.abs(c - o) > 0.1, l = this.mode === "overlay" && (Math.abs(r.top - this.targetRect.top) > 0.1 || Math.abs(r.left - this.targetRect.left) > 0.1);
924
+ a ? (this.targetRect = r, this.setSize(i, c), this.updateCanvasLayout()) : l ? (this.targetRect = r, this.updateCanvasLayout()) : this.targetRect = r, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((d) => {
925
925
  const h = this.registry.get(d);
926
926
  if (h) {
927
927
  this.scene.remove(h);
@@ -930,7 +930,7 @@ class tt {
930
930
  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(
931
931
  (u) => u.dispose()
932
932
  ) : h.userData.nativeMesh.material.dispose(), h.userData.nativeMesh.geometry.dispose()), h.traverse((u) => {
933
- u instanceof y.Mesh && (u.geometry && u.geometry.dispose(), u.material && (Array.isArray(u.material) ? u.material.forEach((p) => p.dispose()) : u.material.dispose()));
933
+ u instanceof y.Mesh && (u.geometry && u.geometry.dispose(), u.material && (Array.isArray(u.material) ? u.material.forEach((v) => v.dispose()) : u.material.dispose()));
934
934
  }), this.registry.remove(d), this.textureManager.unregister(d);
935
935
  }
936
936
  });
@@ -940,11 +940,11 @@ class tt {
940
940
  // => 이후 activeElements를 이용하여 mesh를 정리!!!+ map에서도 삭제
941
941
  // private reconcileNode(node: SceneNode, activeElements: Set<HTMLElement>) {
942
942
  reconcileNode(e) {
943
- var i, l;
943
+ var i, c;
944
944
  let t = this.registry.get(e.element);
945
945
  const r = JSON.stringify(e.shaderHooks || null);
946
946
  if (t && t.userData.shaderHash !== r && (this.scene.remove(t), t.geometry.dispose(), t.material instanceof y.Material && t.material.dispose(), this.registry.remove(e.element), t = void 0), !t) {
947
- const n = new y.PlaneGeometry(1, 1), o = e.isTraveler ? (i = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : i.texture : this.textureManager.get(e.element), a = V.create(
947
+ const n = new y.PlaneGeometry(1, 1), o = e.isTraveler ? (i = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : i.texture : this.textureManager.get(e.element), a = H.create(
948
948
  "BOX",
949
949
  e.styles,
950
950
  "",
@@ -956,7 +956,7 @@ class tt {
956
956
  );
957
957
  t = new y.Mesh(n, a), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = a, t.userData.domElement = e.element, t.userData.shaderHash = r;
958
958
  }
959
- if ((l = e.nativeStyles) != null && l.transform ? t.userData.nativeTransform = e.nativeStyles.transform : t.userData.nativeTransform = void 0, this.updateMeshProperties(t, e), this.updateMeshLayers(t, e), e.isTraveler)
959
+ if ((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)
960
960
  for (let n = 0; n < O.MAX_LAYERS; n++)
961
961
  n === e.captureLayer - 2 ? this.travelersByLayer[n].add(t) : this.travelersByLayer[n].delete(t);
962
962
  else
@@ -973,11 +973,11 @@ class tt {
973
973
  ));
974
974
  }
975
975
  reconcileTextChild(e, t, r) {
976
- var c;
976
+ var l;
977
977
  const i = t.textLines || [
978
978
  { text: t.textContent || "", rect: t.rect }
979
- ], l = r ? t.nativeStyles : t.textStyles, n = JSON.stringify(l) + t.textContent + i.map((d) => d.text).join("|"), o = (c = e.userData) == null ? void 0 : c.textChildStyleHash;
980
- if (t.dirtyMask & ce || n !== o) {
979
+ ], c = r ? t.nativeStyles : t.textStyles, n = JSON.stringify(c) + t.textContent + i.map((d) => d.text).join("|"), o = (l = e.userData) == null ? void 0 : l.textChildStyleHash;
980
+ if (t.dirtyMask & ve || n !== o) {
981
981
  e.children.filter(
982
982
  (f) => f.name.startsWith("TEXT_CHILD")
983
983
  ).forEach((f) => {
@@ -985,46 +985,48 @@ class tt {
985
985
  const m = f;
986
986
  (b = m.material.map) == null || b.dispose(), m.geometry.dispose(), e.remove(m);
987
987
  });
988
- const h = t.rect, u = h.x + h.width / 2, p = h.y + h.height / 2;
988
+ const h = t.rect, u = h.x + h.width / 2, v = h.y + h.height / 2;
989
989
  i.forEach((f, m) => {
990
- const b = V.create(
990
+ const b = H.create(
991
991
  "TEXT",
992
- l,
992
+ c,
993
993
  f.text,
994
994
  f.rect.width,
995
995
  f.rect.height,
996
996
  this.qualityFactor
997
- ), R = new y.PlaneGeometry(1, 1), L = new y.Mesh(R, b);
998
- L.name = `TEXT_CHILD_${m}`;
999
- const T = t.rect.width === 0 ? 1 : f.rect.width / t.rect.width, x = t.rect.height === 0 ? 1 : f.rect.height / t.rect.height;
1000
- L.scale.set(T, x, 1);
1001
- const C = f.rect.x + f.rect.width / 2, w = f.rect.y + f.rect.height / 2, S = C - u, M = -(w - p);
1002
- L.position.set(
1003
- t.rect.width === 0 ? 0 : S / t.rect.width,
1004
- t.rect.height === 0 ? 0 : M / t.rect.height,
997
+ ), L = new y.PlaneGeometry(1, 1), M = new y.Mesh(L, b);
998
+ M.name = `TEXT_CHILD_${m}`;
999
+ const S = t.rect.width === 0 ? 1 : f.rect.width / t.rect.width, x = t.rect.height === 0 ? 1 : f.rect.height / t.rect.height;
1000
+ M.scale.set(S, x, 1);
1001
+ const C = f.rect.x + f.rect.width / 2, w = f.rect.y + f.rect.height / 2, T = C - u, D = -(w - v);
1002
+ M.position.set(
1003
+ t.rect.width === 0 ? 0 : T / t.rect.width,
1004
+ t.rect.height === 0 ? 0 : D / t.rect.height,
1005
1005
  5e-3
1006
- ), e.add(L);
1006
+ ), e.add(M);
1007
1007
  }), e.userData.textChildStyleHash = n;
1008
1008
  }
1009
1009
  e.children.forEach((d) => {
1010
1010
  if (!d.name.startsWith("TEXT_CHILD"))
1011
1011
  return;
1012
- const h = d, u = t.visibility & H ? U.BASE : U.HIDDEN;
1013
- if (h.layers.set(u), t.visibility & K && h.layers.enable(U.SELECTED), t.visibility & H)
1014
- if (!r && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
1015
- for (let p = t.captureLayer; p < t.nativeLayer; p++)
1016
- h.layers.enable(U.getCaptureLayer(p));
1017
- else if (r && t.nativeLayer !== void 0)
1018
- for (let p = Math.max(t.captureLayer, t.nativeLayer); p <= O.MAX_LAYERS + 1; p++)
1019
- h.layers.enable(U.getCaptureLayer(p));
1020
- else
1021
- for (let p = t.captureLayer; p <= O.MAX_LAYERS + 1; p++)
1022
- h.layers.enable(U.getCaptureLayer(p));
1012
+ const h = d;
1013
+ if (r && t.nativeLayer !== void 0)
1014
+ h.layers.set(U.HIDDEN), t.visibility & P && h.layers.enable(U.getCaptureLayer(t.nativeLayer));
1015
+ else {
1016
+ const u = t.visibility & P ? U.BASE : U.HIDDEN;
1017
+ if (h.layers.set(u), t.visibility & te && h.layers.enable(U.SELECTED), t.visibility & P)
1018
+ if (!r && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
1019
+ for (let v = t.captureLayer; v <= O.MAX_LAYERS + 1; v++)
1020
+ v !== t.nativeLayer && h.layers.enable(U.getCaptureLayer(v));
1021
+ else
1022
+ for (let v = t.captureLayer; v <= O.MAX_LAYERS + 1; v++)
1023
+ h.layers.enable(U.getCaptureLayer(v));
1024
+ }
1023
1025
  });
1024
1026
  }
1025
1027
  updateMeshProperties(e, t) {
1026
- var T, x, C;
1027
- const { rect: r, styles: i } = t, l = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / l, o = this.renderer.domElement.height / l;
1028
+ var S, x, C;
1029
+ const { rect: r, styles: i } = t, c = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / c, o = this.renderer.domElement.height / c;
1028
1030
  e.material = e.userData.baseMaterial, e.scale.set(r.width, r.height, 1), e.userData.domRect = {
1029
1031
  x: r.x,
1030
1032
  y: r.y,
@@ -1033,28 +1035,28 @@ class tt {
1033
1035
  };
1034
1036
  const a = 1e-3;
1035
1037
  this.renderOrder++;
1036
- const c = this.targetRect.left + window.scrollX, d = this.targetRect.top + window.scrollY;
1038
+ const l = this.targetRect.left + window.scrollX, d = this.targetRect.top + window.scrollY;
1037
1039
  let h, u;
1038
1040
  if (this.isViewport)
1039
1041
  h = r.x - window.innerWidth / 2 + r.width / 2, u = -r.y + window.innerHeight / 2 - r.height / 2;
1040
1042
  else {
1041
- const w = r.x - c, S = r.y - d;
1042
- h = w - n / 2 + r.width / 2, u = -S + o / 2 - r.height / 2;
1043
+ const w = r.x - l, T = r.y - d;
1044
+ h = w - n / 2 + r.width / 2, u = -T + o / 2 - r.height / 2;
1043
1045
  }
1044
1046
  e.position.set(
1045
1047
  h,
1046
1048
  u,
1047
1049
  i.zIndex + this.renderOrder * a
1048
1050
  );
1049
- const p = r.x, f = r.y;
1050
- e.userData.basePosition = { x: h, y: u }, e.userData.originalBasePosition = { x: h, y: u }, e.userData.baseSize = { width: r.width, height: r.height }, e.userData.baseDOM = { x: p, y: f }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
1051
+ const v = r.x, f = r.y;
1052
+ e.userData.basePosition = { x: h, y: u }, e.userData.originalBasePosition = { x: h, y: u }, e.userData.baseSize = { width: r.width, height: r.height }, e.userData.baseDOM = { x: v, y: f }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
1051
1053
  const m = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, b = window.getComputedStyle(m);
1052
- let R = 0, L = 0;
1054
+ let L = 0, M = 0;
1053
1055
  if (b.transform && b.transform !== "none") {
1054
1056
  const w = new DOMMatrix(b.transform);
1055
- R = w.m41, L = w.m42;
1057
+ L = w.m41, M = w.m42;
1056
1058
  }
1057
- if (e.userData.baseTransform = { x: R, y: L }, delete e.userData.originRatioX, delete e.userData.originRatioY, V.update(
1059
+ if (e.userData.baseTransform = { x: L, y: M }, delete e.userData.originRatioX, delete e.userData.originRatioY, H.update(
1058
1060
  e.userData.baseMaterial,
1059
1061
  "BOX",
1060
1062
  i,
@@ -1062,10 +1064,10 @@ class tt {
1062
1064
  r.width,
1063
1065
  r.height,
1064
1066
  this.qualityFactor,
1065
- t.isTraveler ? (T = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : T.texture : this.textureManager.get(t.element)
1067
+ t.isTraveler ? (S = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : S.texture : this.textureManager.get(t.element)
1066
1068
  ), t.nativeStyles && t.nativeRect) {
1067
1069
  if (!e.userData.nativeMesh) {
1068
- const k = V.create(
1070
+ const z = H.create(
1069
1071
  "BOX",
1070
1072
  t.nativeStyles,
1071
1073
  "",
@@ -1074,22 +1076,50 @@ class tt {
1074
1076
  this.qualityFactor,
1075
1077
  t.isTraveler ? (x = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : x.texture : this.textureManager.get(t.element),
1076
1078
  t.shaderHooks
1077
- ), _ = new y.Mesh(e.geometry, k);
1078
- t.type === "TEXT" && (_.name = "BG_MESH"), this.scene.add(_), e.userData.nativeMesh = _;
1079
+ ), N = new y.Mesh(e.geometry, z);
1080
+ t.type === "TEXT" && (N.name = "BG_MESH"), this.scene.add(N), e.userData.nativeMesh = N;
1079
1081
  }
1080
1082
  const w = e.userData.nativeMesh;
1081
- let S, M;
1083
+ let T, D;
1082
1084
  if (this.isViewport)
1083
- S = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, M = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1085
+ T = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, D = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1084
1086
  else {
1085
- const k = t.nativeRect.x - c, _ = t.nativeRect.y - d;
1086
- S = k - n / 2 + t.nativeRect.width / 2, M = -_ + o / 2 - t.nativeRect.height / 2;
1087
+ const z = t.nativeRect.x - l, N = t.nativeRect.y - d;
1088
+ T = z - n / 2 + t.nativeRect.width / 2, D = -N + o / 2 - t.nativeRect.height / 2;
1089
+ }
1090
+ let k = t.nativeRect.width, $ = t.nativeRect.height, ie = T, se = D;
1091
+ if (t.nativeStyles.transform) {
1092
+ const z = t.nativeStyles.transform, N = z.match(/scale\(([\d.]+%?)\)/);
1093
+ if (N) {
1094
+ let B = parseFloat(N[1]);
1095
+ N[1].includes("%") && (B /= 100), k *= B, $ *= B;
1096
+ }
1097
+ const Z = z.match(/translate\(([^,]+),\s*([^)]+)\)/);
1098
+ if (Z) {
1099
+ const B = Z[1].trim(), _ = Z[2].trim();
1100
+ let p = parseFloat(B);
1101
+ B.includes("%") && (p = p / 100 * t.nativeRect.width);
1102
+ let R = parseFloat(_);
1103
+ _.includes("%") && (R = R / 100 * t.nativeRect.height), ie += p, se -= R;
1104
+ }
1105
+ const ne = z.match(/translateX\(([^)]+)\)/);
1106
+ if (ne) {
1107
+ const B = ne[1].trim();
1108
+ let _ = parseFloat(B);
1109
+ B.includes("%") && (_ = _ / 100 * t.nativeRect.width), ie += _;
1110
+ }
1111
+ const oe = z.match(/translateY\(([^)]+)\)/);
1112
+ if (oe) {
1113
+ const B = oe[1].trim();
1114
+ let _ = parseFloat(B);
1115
+ B.includes("%") && (_ = _ / 100 * t.nativeRect.height), se -= _;
1116
+ }
1087
1117
  }
1088
- w.scale.set(t.nativeRect.width, t.nativeRect.height, 1), w.position.set(
1089
- S,
1090
- M,
1118
+ w.scale.set(k, $, 1), w.position.set(
1119
+ ie,
1120
+ se,
1091
1121
  t.nativeStyles.zIndex + this.renderOrder * a
1092
- ), V.update(
1122
+ ), H.update(
1093
1123
  w.material,
1094
1124
  "BOX",
1095
1125
  t.nativeStyles,
@@ -1103,34 +1133,33 @@ class tt {
1103
1133
  e.userData.nativeMesh && (this.scene.remove(e.userData.nativeMesh), e.userData.nativeMesh.material instanceof y.Material && e.userData.nativeMesh.material.dispose(), delete e.userData.nativeMesh);
1104
1134
  }
1105
1135
  updateMeshLayers(e, t) {
1106
- const r = t.visibility & H ? U.BASE : U.HIDDEN;
1107
- if (e.layers.set(r), t.visibility & K && e.layers.enable(U.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1136
+ const r = t.visibility & P ? U.BASE : U.HIDDEN;
1137
+ if (e.layers.set(r), t.visibility & te && e.layers.enable(U.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1108
1138
  const i = e.userData.nativeMesh;
1109
- if (i.layers.set(U.HIDDEN), t.visibility & H) {
1110
- for (let l = t.captureLayer; l < t.nativeLayer; l++)
1111
- e.layers.enable(U.getCaptureLayer(l));
1112
- for (let l = Math.max(t.captureLayer, t.nativeLayer); l <= O.MAX_LAYERS + 1; l++)
1113
- i.layers.enable(U.getCaptureLayer(l));
1139
+ if (i.layers.set(U.HIDDEN), t.visibility & P) {
1140
+ i.layers.enable(U.getCaptureLayer(t.nativeLayer));
1141
+ for (let c = t.captureLayer; c <= O.MAX_LAYERS + 1; c++)
1142
+ c !== t.nativeLayer && e.layers.enable(U.getCaptureLayer(c));
1114
1143
  }
1115
- } else if (t.visibility & H)
1144
+ } else if (t.visibility & P)
1116
1145
  for (let i = t.captureLayer; i <= O.MAX_LAYERS + 1; i++)
1117
1146
  e.layers.enable(U.getCaptureLayer(i));
1118
1147
  }
1119
1148
  captureRenderTarget(e, t, r) {
1120
1149
  if (e.size === 0 || !r)
1121
1150
  return;
1122
- const i = new y.Color(), l = this.renderer.getClearAlpha();
1151
+ const i = new y.Color(), c = this.renderer.getClearAlpha();
1123
1152
  this.renderer.getClearColor(i), this.renderer.setClearColor(0, 0), this.renderer.setRenderTarget(r), this.renderer.clear(), this.renderer.autoClear = !1, this.renderer.setScissorTest(!0), this.camera.layers.set(t);
1124
- const n = new y.Vector3(), o = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, a = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, c = this.renderer.getPixelRatio();
1153
+ const n = new y.Vector3(), o = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, a = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, l = this.renderer.getPixelRatio();
1125
1154
  for (const d of e) {
1126
1155
  n.setFromMatrixPosition(d.matrixWorld), n.project(this.camera);
1127
1156
  const h = (n.x + 1) / 2 * o, u = (n.y + 1) / 2 * a;
1128
- let p = 0, f = 1;
1129
- typeof this.clipArea == "number" ? f = this.clipArea : this.clipArea.endsWith("%") ? f = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (p = parseFloat(this.clipArea));
1130
- const m = d.scale.x * f + 0.5, b = d.scale.y * f + 0.5, R = h - m / 2, L = u - b / 2, T = (R * this.qualityFactor - p) / c, x = (L * this.qualityFactor - p) / c, C = (m * this.qualityFactor + p * 2) / c, w = (b * this.qualityFactor + p * 2) / c;
1131
- this.renderer.setScissor(T, x, C, w), this.renderer.render(this.scene, this.camera);
1157
+ let v = 0, f = 1;
1158
+ typeof this.clipArea == "number" ? f = this.clipArea : this.clipArea.endsWith("%") ? f = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (v = parseFloat(this.clipArea));
1159
+ const m = d.scale.x * f + 0.5, b = d.scale.y * f + 0.5, L = h - m / 2, M = u - b / 2, S = (L * this.qualityFactor - v) / l, x = (M * this.qualityFactor - v) / l, C = (m * this.qualityFactor + v * 2) / l, w = (b * this.qualityFactor + v * 2) / l;
1160
+ this.renderer.setScissor(S, x, C, w), this.renderer.render(this.scene, this.camera);
1132
1161
  }
1133
- this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(i, l);
1162
+ this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(i, c);
1134
1163
  }
1135
1164
  render() {
1136
1165
  for (let e = 0; e < O.MAX_LAYERS; e++) {
@@ -1144,7 +1173,7 @@ class tt {
1144
1173
  this.renderer.render(this.scene, this.camera);
1145
1174
  }
1146
1175
  syncMeshesByDOM() {
1147
- const e = this.targetRect.left + window.scrollX, t = this.targetRect.top + window.scrollY, r = this.renderer.getPixelRatio(), i = this.renderer.domElement.width / r, l = this.renderer.domElement.height / r;
1176
+ const e = this.targetRect.left + window.scrollX, t = this.targetRect.top + window.scrollY, r = this.renderer.getPixelRatio(), i = this.renderer.domElement.width / r, c = this.renderer.domElement.height / r;
1148
1177
  this.scene.children.forEach((n) => {
1149
1178
  const o = n;
1150
1179
  if (!o.userData || !o.userData.domElement)
@@ -1152,61 +1181,61 @@ class tt {
1152
1181
  const a = o.userData.domElement;
1153
1182
  if (!a.isConnected)
1154
1183
  return;
1155
- let c;
1184
+ let l;
1156
1185
  if (a.nodeType === Node.TEXT_NODE) {
1157
1186
  const h = document.createRange();
1158
- h.selectNode(a), c = h.getBoundingClientRect();
1187
+ h.selectNode(a), l = h.getBoundingClientRect();
1159
1188
  } else
1160
- c = a.getBoundingClientRect();
1189
+ l = a.getBoundingClientRect();
1161
1190
  const d = o.userData.domRect;
1162
- if (!d || Math.abs(c.x - d.x) > 0.5 || Math.abs(c.y - d.y) > 0.5 || Math.abs(c.width - d.width) > 0.5 || Math.abs(c.height - d.height) > 0.5) {
1191
+ if (!d || Math.abs(l.x - d.x) > 0.5 || Math.abs(l.y - d.y) > 0.5 || Math.abs(l.width - d.width) > 0.5 || Math.abs(l.height - d.height) > 0.5) {
1163
1192
  o.userData.domRect = {
1164
- x: c.x,
1165
- y: c.y,
1166
- width: c.width,
1167
- height: c.height
1193
+ x: l.x,
1194
+ y: l.y,
1195
+ width: l.width,
1196
+ height: l.height
1168
1197
  };
1169
1198
  let h, u;
1170
1199
  if (this.isViewport)
1171
- h = c.x - window.innerWidth / 2 + c.width / 2, u = -c.y + window.innerHeight / 2 - c.height / 2;
1200
+ h = l.x - window.innerWidth / 2 + l.width / 2, u = -l.y + window.innerHeight / 2 - l.height / 2;
1172
1201
  else {
1173
- const p = c.x - e, f = c.y - t;
1174
- h = p - i / 2 + c.width / 2, u = -f + l / 2 - c.height / 2;
1202
+ const v = l.x - e, f = l.y - t;
1203
+ h = v - i / 2 + l.width / 2, u = -f + c / 2 - l.height / 2;
1175
1204
  }
1176
- if (o.position.setX(h), o.position.setY(u), o.scale.set(c.width, c.height, 1), o.updateMatrixWorld(), o.material instanceof y.ShaderMaterial && V.forceUpdateUniforms(o.material, {
1177
- width: c.width,
1178
- height: c.height
1205
+ if (o.position.setX(h), o.position.setY(u), o.scale.set(l.width, l.height, 1), o.updateMatrixWorld(), o.material instanceof y.ShaderMaterial && H.forceUpdateUniforms(o.material, {
1206
+ width: l.width,
1207
+ height: l.height
1179
1208
  }), o.userData.nativeMesh) {
1180
- const p = o.userData.nativeMesh;
1181
- let f = c.width, m = c.height, b = h, R = u;
1209
+ const v = o.userData.nativeMesh;
1210
+ let f = l.width, m = l.height, b = h, L = u;
1182
1211
  if (o.userData.nativeTransform) {
1183
- const L = o.userData.nativeTransform, T = L.match(/scale\(([\d.]+%?)\)/);
1184
- if (T) {
1185
- let S = parseFloat(T[1]);
1186
- T[1].includes("%") && (S /= 100), f *= S, m *= S;
1212
+ const M = o.userData.nativeTransform, S = M.match(/scale\(([\d.]+%?)\)/);
1213
+ if (S) {
1214
+ let T = parseFloat(S[1]);
1215
+ S[1].includes("%") && (T /= 100), f *= T, m *= T;
1187
1216
  }
1188
- const x = L.match(/translate\(([^,]+),\s*([^)]+)\)/);
1217
+ const x = M.match(/translate\(([^,]+),\s*([^)]+)\)/);
1189
1218
  if (x) {
1190
- const S = x[1].trim(), M = x[2].trim();
1191
- let k = parseFloat(S);
1192
- S.includes("%") && (k = k / 100 * c.width);
1193
- let _ = parseFloat(M);
1194
- M.includes("%") && (_ = _ / 100 * c.height), b += k, R -= _;
1219
+ const T = x[1].trim(), D = x[2].trim();
1220
+ let k = parseFloat(T);
1221
+ T.includes("%") && (k = k / 100 * l.width);
1222
+ let $ = parseFloat(D);
1223
+ D.includes("%") && ($ = $ / 100 * l.height), b += k, L -= $;
1195
1224
  }
1196
- const C = L.match(/translateX\(([^)]+)\)/);
1225
+ const C = M.match(/translateX\(([^)]+)\)/);
1197
1226
  if (C) {
1198
- const S = C[1].trim();
1199
- let M = parseFloat(S);
1200
- S.includes("%") && (M = M / 100 * c.width), b += M;
1227
+ const T = C[1].trim();
1228
+ let D = parseFloat(T);
1229
+ T.includes("%") && (D = D / 100 * l.width), b += D;
1201
1230
  }
1202
- const w = L.match(/translateY\(([^)]+)\)/);
1231
+ const w = M.match(/translateY\(([^)]+)\)/);
1203
1232
  if (w) {
1204
- const S = w[1].trim();
1205
- let M = parseFloat(S);
1206
- S.includes("%") && (M = M / 100 * c.height), R -= M;
1233
+ const T = w[1].trim();
1234
+ let D = parseFloat(T);
1235
+ T.includes("%") && (D = D / 100 * l.height), L -= D;
1207
1236
  }
1208
1237
  }
1209
- p.position.setX(b), p.position.setY(R), p.scale.set(f, m, 1), p.updateMatrixWorld();
1238
+ v.position.setX(b), v.position.setY(L), v.scale.set(f, m, 1), v.updateMatrixWorld();
1210
1239
  }
1211
1240
  }
1212
1241
  });
@@ -1214,17 +1243,17 @@ class tt {
1214
1243
  }
1215
1244
  function rt(s) {
1216
1245
  const e = s.textContent || "", t = [];
1217
- let r = "", i = null, l = -1;
1218
- const n = (c, d) => {
1219
- for (let h = 0; h < c.length; h++) {
1220
- const u = c[h], p = document.createRange();
1221
- p.setStart(s, d + h), p.setEnd(s, d + h + 1);
1222
- const f = p.getBoundingClientRect();
1246
+ let r = "", i = null, c = -1;
1247
+ const n = (l, d) => {
1248
+ for (let h = 0; h < l.length; h++) {
1249
+ const u = l[h], v = document.createRange();
1250
+ v.setStart(s, d + h), v.setEnd(s, d + h + 1);
1251
+ const f = v.getBoundingClientRect();
1223
1252
  if (f.width === 0 && f.height === 0) {
1224
1253
  r += u;
1225
1254
  continue;
1226
1255
  }
1227
- l === -1 || Math.abs(f.top - l) > f.height / 2 ? (r && i && t.push({
1256
+ c === -1 || Math.abs(f.top - c) > f.height / 2 ? (r && i && t.push({
1228
1257
  text: r,
1229
1258
  rect: {
1230
1259
  left: i.left,
@@ -1237,26 +1266,26 @@ function rt(s) {
1237
1266
  top: f.top,
1238
1267
  right: f.right,
1239
1268
  bottom: f.bottom
1240
- }, l = f.top) : (r += u, i && (i.left = Math.min(i.left, f.left), i.top = Math.min(i.top, f.top), i.right = Math.max(i.right, f.right), i.bottom = Math.max(
1269
+ }, c = f.top) : (r += u, i && (i.left = Math.min(i.left, f.left), i.top = Math.min(i.top, f.top), i.right = Math.max(i.right, f.right), i.bottom = Math.max(
1241
1270
  i.bottom,
1242
1271
  f.bottom
1243
1272
  )));
1244
1273
  }
1245
1274
  }, o = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
1246
1275
  let a = 0;
1247
- for (const c of o) {
1276
+ for (const l of o) {
1248
1277
  const d = document.createRange();
1249
- d.setStart(s, a), d.setEnd(s, a + c.length);
1278
+ d.setStart(s, a), d.setEnd(s, a + l.length);
1250
1279
  const h = d.getClientRects();
1251
1280
  if (h.length > 1)
1252
- n(c, a);
1281
+ n(l, a);
1253
1282
  else {
1254
1283
  const u = h.length === 1 ? h[0] : d.getBoundingClientRect();
1255
1284
  if (u.width === 0 && u.height === 0) {
1256
- r += c, a += c.length;
1285
+ r += l, a += l.length;
1257
1286
  continue;
1258
1287
  }
1259
- l === -1 || Math.abs(u.top - l) > u.height / 2 ? (r && i && t.push({
1288
+ c === -1 || Math.abs(u.top - c) > u.height / 2 ? (r && i && t.push({
1260
1289
  text: r,
1261
1290
  rect: {
1262
1291
  left: i.left,
@@ -1264,17 +1293,17 @@ function rt(s) {
1264
1293
  width: i.right - i.left,
1265
1294
  height: i.bottom - i.top
1266
1295
  }
1267
- }), r = c, i = {
1296
+ }), r = l, i = {
1268
1297
  left: u.left,
1269
1298
  top: u.top,
1270
1299
  right: u.right,
1271
1300
  bottom: u.bottom
1272
- }, l = u.top) : (r += c, i && (i.left = Math.min(i.left, u.left), i.top = Math.min(i.top, u.top), i.right = Math.max(i.right, u.right), i.bottom = Math.max(
1301
+ }, c = u.top) : (r += l, i && (i.left = Math.min(i.left, u.left), i.top = Math.min(i.top, u.top), i.right = Math.max(i.right, u.right), i.bottom = Math.max(
1273
1302
  i.bottom,
1274
1303
  u.bottom
1275
1304
  )));
1276
1305
  }
1277
- a += c.length;
1306
+ a += l.length;
1278
1307
  }
1279
1308
  return r && i && t.push({
1280
1309
  text: r,
@@ -1285,10 +1314,10 @@ function rt(s) {
1285
1314
  height: i.bottom - i.top
1286
1315
  }
1287
1316
  }), t.filter(
1288
- (c) => c.text.trim().length > 0 && c.rect.width > 0 && c.rect.height > 0
1317
+ (l) => l.text.trim().length > 0 && l.rect.width > 0 && l.rect.height > 0
1289
1318
  );
1290
1319
  }
1291
- function Se(s) {
1320
+ function Le(s) {
1292
1321
  const e = parseFloat(s.fontSize);
1293
1322
  let t = parseFloat(s.lineHeight);
1294
1323
  isNaN(t) && (t = e * 1.2);
@@ -1304,44 +1333,44 @@ function Se(s) {
1304
1333
  letterSpacing: r
1305
1334
  };
1306
1335
  }
1307
- function De(s, e = $ | Z | ze | ce | ie, t, r = 1, i = 0, l = 2, n, o) {
1308
- var de, ue, fe, ge, pe, me;
1336
+ function Ie(s, e = Q | le | ze | ve | ue, t, r = 1, i = 0, c = 2, n, o) {
1337
+ var N, Z, ne, oe, B, _;
1309
1338
  if (s.nodeType === Node.TEXT_NODE) {
1310
- const v = s;
1311
- if (!v.textContent || !v.textContent.trim())
1339
+ const p = s;
1340
+ if (!p.textContent || !p.textContent.trim())
1312
1341
  return null;
1313
- const A = v.textContent.replace(/\s+/g, " ");
1314
- if (A.length === 0)
1342
+ const R = p.textContent.replace(/\s+/g, " ");
1343
+ if (R.length === 0)
1315
1344
  return null;
1316
- const B = rt(v);
1317
- if (B.length === 0)
1345
+ const F = rt(p);
1346
+ if (F.length === 0)
1318
1347
  return null;
1319
- const N = v.parentElement, I = N ? window.getComputedStyle(N) : null;
1348
+ const V = p.parentElement, I = V ? window.getComputedStyle(V) : null;
1320
1349
  if (!I)
1321
1350
  return null;
1322
- const Y = Math.min(...B.map((E) => E.rect.left)), F = Math.min(...B.map((E) => E.rect.top)), P = Math.max(...B.map((E) => E.rect.left + E.rect.width)), D = Math.max(...B.map((E) => E.rect.top + E.rect.height));
1351
+ const G = Math.min(...F.map((E) => E.rect.left)), X = Math.min(...F.map((E) => E.rect.top)), j = Math.max(...F.map((E) => E.rect.left + E.rect.width)), A = Math.max(...F.map((E) => E.rect.top + E.rect.height));
1323
1352
  return {
1324
1353
  id: Math.random().toString(36).substring(2, 9),
1325
1354
  type: "TEXT",
1326
- element: v,
1355
+ element: p,
1327
1356
  rect: {
1328
- x: Y + window.scrollX,
1329
- y: F + window.scrollY,
1330
- width: P - Y,
1331
- height: D - F
1357
+ x: G + window.scrollX,
1358
+ y: X + window.scrollY,
1359
+ width: j - G,
1360
+ height: A - X
1332
1361
  },
1333
1362
  styles: {
1334
1363
  backgroundColor: "transparent",
1335
1364
  backgroundImage: "",
1336
- opacity: N && N.dataset[G.KEY] === G.VALUES.HIDE ? 1 : parseFloat(I.opacity),
1365
+ opacity: V && V.dataset[K.KEY] === K.VALUES.HIDE ? 1 : parseFloat(I.opacity),
1337
1366
  zIndex: (isNaN(parseInt(I.zIndex)) ? 0 : parseInt(I.zIndex)) + i,
1338
1367
  borderRadius: "0px",
1339
1368
  borderColor: "transparent",
1340
1369
  borderWidth: "0px",
1341
1370
  isTraveler: !1
1342
1371
  },
1343
- textContent: A,
1344
- textLines: B.map((E) => ({
1372
+ textContent: R,
1373
+ textLines: F.map((E) => ({
1345
1374
  text: E.text.trim(),
1346
1375
  rect: {
1347
1376
  x: E.rect.left + window.scrollX,
@@ -1350,237 +1379,237 @@ function De(s, e = $ | Z | ze | ce | ie, t, r = 1, i = 0, l = 2, n, o) {
1350
1379
  height: E.rect.height
1351
1380
  }
1352
1381
  })),
1353
- textStyles: Se(I),
1382
+ textStyles: Le(I),
1354
1383
  dirtyMask: e,
1355
1384
  visibility: t,
1356
1385
  isTraveler: !1,
1357
1386
  captureLayer: r,
1358
1387
  isFixed: I.position === "fixed",
1359
1388
  nativeLayer: n,
1360
- nativeStyles: o ? q(q({
1389
+ nativeStyles: o ? J(J({
1361
1390
  backgroundColor: "transparent",
1362
1391
  backgroundImage: "",
1363
- opacity: N && N.dataset[G.KEY] === G.VALUES.HIDE ? 1 : parseFloat(I.opacity),
1392
+ opacity: V && V.dataset[K.KEY] === K.VALUES.HIDE ? 1 : parseFloat(I.opacity),
1364
1393
  zIndex: (isNaN(parseInt(I.zIndex)) ? 0 : parseInt(I.zIndex)) + i,
1365
1394
  borderRadius: "0px",
1366
1395
  borderColor: "transparent",
1367
1396
  borderWidth: "0px",
1368
1397
  isTraveler: !1
1369
- }, Se(I)), o) : void 0,
1398
+ }, Le(I)), o) : void 0,
1370
1399
  nativeRect: o ? {
1371
- x: Y + window.scrollX,
1372
- y: F + window.scrollY,
1373
- width: P - Y,
1374
- height: D - F
1400
+ x: G + window.scrollX,
1401
+ y: X + window.scrollY,
1402
+ width: j - G,
1403
+ height: A - X
1375
1404
  } : void 0,
1376
1405
  children: []
1377
1406
  };
1378
1407
  }
1379
1408
  if (s.nodeType !== Node.ELEMENT_NODE)
1380
1409
  return null;
1381
- const a = s, c = a.dataset[z.KEY];
1410
+ const a = s, l = a.dataset[W.KEY];
1382
1411
  let d = t, h = t;
1383
- if (c) {
1384
- const v = new Set(c.split(/\s+/));
1385
- for (const A of v)
1386
- if (!Ee.includes(A))
1412
+ if (l) {
1413
+ const p = new Set(l.split(/\s+/));
1414
+ for (const R of p)
1415
+ if (!Se.includes(R))
1387
1416
  throw new Error(
1388
- `[MirageEngine] Invalid filter token: '${A}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1417
+ `[MirageEngine] Invalid filter token: '${R}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1389
1418
  );
1390
- if (v.has(z.VALUES.END))
1419
+ if (p.has(W.VALUES.END))
1391
1420
  return null;
1392
- if (v.has(z.VALUES.INCLUDE_TREE) && v.has(z.VALUES.EXCLUDE_TREE))
1421
+ if (p.has(W.VALUES.INCLUDE_TREE) && p.has(W.VALUES.EXCLUDE_TREE))
1393
1422
  throw new Error(
1394
1423
  "[MirageEngine] Conflicting filters: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1395
1424
  );
1396
- if (v.has(z.VALUES.INCLUDE_SELF) && v.has(z.VALUES.EXCLUDE_SELF))
1425
+ if (p.has(W.VALUES.INCLUDE_SELF) && p.has(W.VALUES.EXCLUDE_SELF))
1397
1426
  throw new Error(
1398
1427
  "[MirageEngine] Conflicting filters: 'include-self' and 'exclude-self' cannot be used together on the same element."
1399
1428
  );
1400
- v.has(z.VALUES.INCLUDE_TREE) ? d = d | H : v.has(z.VALUES.EXCLUDE_TREE) && (d = d & ~H), h = d, v.has(z.VALUES.INCLUDE_SELF) ? h = h | H : v.has(z.VALUES.EXCLUDE_SELF) && (h = h & ~H);
1429
+ p.has(W.VALUES.INCLUDE_TREE) ? d = d | P : p.has(W.VALUES.EXCLUDE_TREE) && (d = d & ~P), h = d, p.has(W.VALUES.INCLUDE_SELF) ? h = h | P : p.has(W.VALUES.EXCLUDE_SELF) && (h = h & ~P);
1401
1430
  }
1402
- const u = a.dataset[W.KEY];
1431
+ const u = a.dataset[q.KEY];
1403
1432
  if (u) {
1404
- const v = new Set(u.split(/\s+/));
1405
- for (const A of v)
1406
- if (!Ee.includes(A))
1433
+ const p = new Set(u.split(/\s+/));
1434
+ for (const R of p)
1435
+ if (!Se.includes(R))
1407
1436
  throw new Error(
1408
- `[MirageEngine] Invalid select token: '${A}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1437
+ `[MirageEngine] Invalid select token: '${R}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1409
1438
  );
1410
- if (v.has(W.VALUES.END))
1439
+ if (p.has(q.VALUES.END))
1411
1440
  return null;
1412
- if (v.has(W.VALUES.INCLUDE_TREE) && v.has(W.VALUES.EXCLUDE_TREE))
1441
+ if (p.has(q.VALUES.INCLUDE_TREE) && p.has(q.VALUES.EXCLUDE_TREE))
1413
1442
  throw new Error(
1414
1443
  "[MirageEngine] Conflicting selects: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1415
1444
  );
1416
- if (v.has(W.VALUES.INCLUDE_SELF) && v.has(W.VALUES.EXCLUDE_SELF))
1445
+ if (p.has(q.VALUES.INCLUDE_SELF) && p.has(q.VALUES.EXCLUDE_SELF))
1417
1446
  throw new Error(
1418
1447
  "[MirageEngine] Conflicting selects: 'include-self' and 'exclude-self' cannot be used together on the same element."
1419
1448
  );
1420
- v.has(W.VALUES.INCLUDE_TREE) ? d = d | K : v.has(W.VALUES.EXCLUDE_TREE) && (d = d & ~K), h = d, v.has(W.VALUES.INCLUDE_SELF) ? h = h | K : v.has(W.VALUES.EXCLUDE_SELF) && (h = h & ~K);
1421
- }
1422
- const p = a.dataset[O.KEY];
1423
- let f = !1, m = o ? q({}, o) : {}, b = n;
1424
- if (p) {
1425
- let v = 1;
1426
- const A = p.indexOf("{"), B = p.lastIndexOf("}");
1427
- let N = p;
1428
- if (A !== -1 && B !== -1 && B > A) {
1429
- N = p.substring(0, A).trim();
1430
- const D = p.substring(A, B + 1);
1449
+ p.has(q.VALUES.INCLUDE_TREE) ? d = d | te : p.has(q.VALUES.EXCLUDE_TREE) && (d = d & ~te), h = d, p.has(q.VALUES.INCLUDE_SELF) ? h = h | te : p.has(q.VALUES.EXCLUDE_SELF) && (h = h & ~te);
1450
+ }
1451
+ const v = a.dataset[O.KEY];
1452
+ let f = !1, m = o ? J({}, o) : {}, b = n;
1453
+ if (v) {
1454
+ let p = 1;
1455
+ const R = v.indexOf("{"), F = v.lastIndexOf("}");
1456
+ let V = v;
1457
+ if (R !== -1 && F !== -1 && F > R) {
1458
+ V = v.substring(0, R).trim();
1459
+ const A = v.substring(R, F + 1);
1431
1460
  try {
1432
- m = new Function("return " + D)();
1461
+ m = new Function("return " + A)();
1433
1462
  } catch (E) {
1434
1463
  console.warn(
1435
- `[MirageEngine] Failed to parse travel styles JSON: ${D}`
1464
+ `[MirageEngine] Failed to parse travel styles JSON: ${A}`
1436
1465
  );
1437
1466
  }
1438
1467
  }
1439
- const I = N.split(/\s+/);
1440
- let Y = !1;
1441
- const F = I.indexOf(O.VALUES.TRAVELER);
1442
- if (F !== -1) {
1443
- f = !0, Y = !0;
1444
- const D = I[F + 1];
1445
- if (D && !isNaN(parseInt(D, 10)))
1446
- v = parseInt(D, 10);
1468
+ const I = V.split(/\s+/);
1469
+ let G = !1;
1470
+ const X = I.indexOf(O.VALUES.TRAVELER);
1471
+ if (X !== -1) {
1472
+ f = !0, G = !0;
1473
+ const A = I[X + 1];
1474
+ if (A && !isNaN(parseInt(A, 10)))
1475
+ p = parseInt(A, 10);
1447
1476
  else {
1448
- const E = I.find((j) => !isNaN(parseInt(j, 10)));
1449
- E && (v = parseInt(E, 10));
1477
+ const E = I.find((ee) => !isNaN(parseInt(ee, 10)));
1478
+ E && (p = parseInt(E, 10));
1450
1479
  }
1451
1480
  }
1452
- const P = I.indexOf(O.VALUES.NATIVE);
1453
- if (P !== -1) {
1454
- const D = I[P + 1];
1455
- if (D && !isNaN(parseInt(D, 10)))
1456
- b = parseInt(D, 10);
1481
+ const j = I.indexOf(O.VALUES.NATIVE);
1482
+ if (j !== -1) {
1483
+ const A = I[j + 1];
1484
+ if (A && !isNaN(parseInt(A, 10)))
1485
+ b = parseInt(A, 10);
1457
1486
  else if (!f) {
1458
- const E = I.find((j) => !isNaN(parseInt(j, 10)));
1487
+ const E = I.find((ee) => !isNaN(parseInt(ee, 10)));
1459
1488
  E && (b = parseInt(E, 10));
1460
1489
  }
1461
1490
  }
1462
- if (Y) {
1463
- const D = v + 1;
1464
- if (D < r)
1491
+ if (G) {
1492
+ const A = p + 1;
1493
+ if (A < r)
1465
1494
  throw new Error(
1466
- `[MirageEngine] Traveler layer (${v}) cannot be smaller than inherited capture layer (${r - 1}).`
1495
+ `[MirageEngine] Traveler layer (${p}) cannot be smaller than inherited capture layer (${r - 1}).`
1467
1496
  );
1468
- r = Math.min(D, O.MAX_LAYERS + 1);
1497
+ r = Math.min(A, O.MAX_LAYERS + 1);
1469
1498
  }
1470
1499
  }
1471
- const R = a.dataset[Xe.KEY];
1472
- let L;
1473
- R && (L = JSON.parse(R));
1474
- const T = a.getBoundingClientRect(), x = window.getComputedStyle(a);
1475
- if (T.width === 0 || T.height === 0 || x.display === "none")
1500
+ const L = a.dataset[Xe.KEY];
1501
+ let M;
1502
+ L && (M = JSON.parse(L));
1503
+ const S = a.getBoundingClientRect(), x = window.getComputedStyle(a);
1504
+ if (S.width === 0 || S.height === 0 || x.display === "none")
1476
1505
  return null;
1477
1506
  let C = a.getAttribute("data-mid");
1478
1507
  C || (C = Math.random().toString(36).substring(2, 11), a.setAttribute("data-mid", C));
1479
- const w = parseInt(x.zIndex), S = (isNaN(w) ? 0 : w) + i;
1480
- let M;
1508
+ const w = parseInt(x.zIndex), T = (isNaN(w) ? 0 : w) + i;
1509
+ let D;
1481
1510
  if (a.tagName === "IMG")
1482
- M = a.src;
1511
+ D = a.src;
1483
1512
  else if (a.tagName.toLowerCase() === "svg") {
1484
- const v = a.cloneNode(!0), A = m == null ? void 0 : m.color, B = m == null ? void 0 : m.fill, N = m == null ? void 0 : m.stroke, I = m == null ? void 0 : m.opacity, Y = (E, j) => {
1485
- const X = window.getComputedStyle(E), Q = j, ke = X.fill === X.color, Ue = X.stroke === X.color, se = B || (ke ? A : void 0) || X.fill;
1486
- se && se !== "none" && (Q.style.fill = se);
1487
- const ne = N || (Ue ? A : void 0) || X.stroke;
1488
- ne && ne !== "none" && (Q.style.stroke = ne), X.strokeWidth && X.strokeWidth !== "0px" && (Q.style.strokeWidth = X.strokeWidth);
1489
- const ve = A || X.color;
1490
- ve && (Q.style.color = ve);
1491
- const oe = I || X.opacity;
1492
- oe && oe !== "1" && (Q.style.opacity = oe);
1493
- for (let te = 0; te < E.children.length; te++)
1494
- Y(E.children[te], j.children[te]);
1513
+ const p = a.cloneNode(!0), R = m == null ? void 0 : m.color, F = m == null ? void 0 : m.fill, V = m == null ? void 0 : m.stroke, I = m == null ? void 0 : m.opacity, G = (E, ee) => {
1514
+ const Y = window.getComputedStyle(E), ae = ee, ke = Y.fill === Y.color, Ue = Y.stroke === Y.color, fe = F || (ke ? R : void 0) || Y.fill;
1515
+ fe && fe !== "none" && (ae.style.fill = fe);
1516
+ const ge = V || (Ue ? R : void 0) || Y.stroke;
1517
+ ge && ge !== "none" && (ae.style.stroke = ge), Y.strokeWidth && Y.strokeWidth !== "0px" && (ae.style.strokeWidth = Y.strokeWidth);
1518
+ const be = R || Y.color;
1519
+ be && (ae.style.color = be);
1520
+ const pe = I || Y.opacity;
1521
+ pe && pe !== "1" && (ae.style.opacity = pe);
1522
+ for (let he = 0; he < E.children.length; he++)
1523
+ G(E.children[he], ee.children[he]);
1495
1524
  };
1496
- Y(a, v);
1497
- const F = a.getBoundingClientRect(), P = window.devicePixelRatio * l;
1498
- v.hasAttribute("viewBox") || v.setAttribute("viewBox", `0 0 ${F.width} ${F.height}`), v.setAttribute("width", (F.width * P).toString()), v.setAttribute("height", (F.height * P).toString());
1499
- let D = new XMLSerializer().serializeToString(v);
1500
- D.includes("xmlns=") || (D = D.replace(
1525
+ G(a, p);
1526
+ const X = a.getBoundingClientRect(), j = window.devicePixelRatio * c;
1527
+ p.hasAttribute("viewBox") || p.setAttribute("viewBox", `0 0 ${X.width} ${X.height}`), p.setAttribute("width", (X.width * j).toString()), p.setAttribute("height", (X.height * j).toString());
1528
+ let A = new XMLSerializer().serializeToString(p);
1529
+ A.includes("xmlns=") || (A = A.replace(
1501
1530
  "<svg",
1502
1531
  '<svg xmlns="http://www.w3.org/2000/svg"'
1503
- )), M = `data:image/svg+xml;utf8,${encodeURIComponent(D)}`;
1532
+ )), D = `data:image/svg+xml;utf8,${encodeURIComponent(A)}`;
1504
1533
  } else if (x.backgroundImage && x.backgroundImage !== "none") {
1505
- const v = x.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1506
- v && (M = v[1]);
1534
+ const p = x.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1535
+ p && (D = p[1]);
1507
1536
  }
1508
1537
  const k = {
1509
1538
  backgroundColor: x.backgroundColor,
1510
1539
  backgroundImage: x.backgroundImage,
1511
- opacity: a.dataset[G.KEY] === G.VALUES.HIDE ? 1 : parseFloat(x.opacity),
1512
- zIndex: S,
1540
+ opacity: a.dataset[K.KEY] === K.VALUES.HIDE ? 1 : parseFloat(x.opacity),
1541
+ zIndex: T,
1513
1542
  borderRadius: x.borderRadius,
1514
1543
  borderColor: x.borderColor,
1515
1544
  borderWidth: x.borderWidth,
1516
- imageSrc: M,
1545
+ imageSrc: D,
1517
1546
  isTraveler: f
1518
- }, _ = k;
1519
- let Ae, Ie;
1520
- const he = [];
1521
- return a.tagName.toLowerCase() !== "svg" && Array.from(a.childNodes).forEach((v) => {
1522
- const A = v.nodeType === Node.TEXT_NODE ? h : d, B = De(
1523
- v,
1547
+ }, $ = k;
1548
+ let ie, se;
1549
+ const z = [];
1550
+ return a.tagName.toLowerCase() !== "svg" && Array.from(a.childNodes).forEach((p) => {
1551
+ const R = p.nodeType === Node.TEXT_NODE ? h : d, F = Ie(
1552
+ p,
1524
1553
  e,
1525
- A,
1554
+ R,
1526
1555
  r,
1527
- S,
1528
- l,
1529
- v.nodeType === Node.TEXT_NODE ? b : void 0,
1530
- v.nodeType === Node.TEXT_NODE && Object.keys(m).length > 0 ? m : void 0
1556
+ T,
1557
+ c,
1558
+ p.nodeType === Node.TEXT_NODE ? b : void 0,
1559
+ p.nodeType === Node.TEXT_NODE && Object.keys(m).length > 0 ? m : void 0
1531
1560
  );
1532
- B && he.push(B);
1561
+ F && z.push(F);
1533
1562
  }), {
1534
1563
  id: C,
1535
1564
  type: "BOX",
1536
1565
  element: a,
1537
1566
  rect: {
1538
- x: T.left + window.scrollX,
1539
- y: T.top + window.scrollY,
1540
- width: T.width,
1541
- height: T.height
1567
+ x: S.left + window.scrollX,
1568
+ y: S.top + window.scrollY,
1569
+ width: S.width,
1570
+ height: S.height
1542
1571
  },
1543
- styles: _,
1544
- textContent: Ae,
1545
- textStyles: Ie,
1572
+ styles: $,
1573
+ textContent: ie,
1574
+ textStyles: se,
1546
1575
  dirtyMask: e,
1547
1576
  visibility: h,
1548
1577
  isTraveler: f,
1549
1578
  captureLayer: r,
1550
1579
  nativeLayer: b,
1551
- nativeStyles: b !== void 0 ? be(q({}, k), {
1552
- backgroundColor: (de = m.backgroundColor) != null ? de : k.backgroundColor,
1553
- backgroundImage: (ue = m.backgroundImage) != null ? ue : k.backgroundImage,
1554
- opacity: (fe = m.opacity) != null ? fe : k.opacity,
1555
- zIndex: m.zIndex !== void 0 ? m.zIndex + S : k.zIndex,
1556
- borderRadius: (ge = m.borderRadius) != null ? ge : k.borderRadius,
1557
- borderColor: (pe = m.borderColor) != null ? pe : k.borderColor,
1558
- borderWidth: (me = m.borderWidth) != null ? me : k.borderWidth,
1580
+ nativeStyles: b !== void 0 ? xe(J({}, k), {
1581
+ backgroundColor: (N = m.backgroundColor) != null ? N : k.backgroundColor,
1582
+ backgroundImage: (Z = m.backgroundImage) != null ? Z : k.backgroundImage,
1583
+ opacity: (ne = m.opacity) != null ? ne : k.opacity,
1584
+ zIndex: m.zIndex !== void 0 ? m.zIndex + T : k.zIndex,
1585
+ borderRadius: (oe = m.borderRadius) != null ? oe : k.borderRadius,
1586
+ borderColor: (B = m.borderColor) != null ? B : k.borderColor,
1587
+ borderWidth: (_ = m.borderWidth) != null ? _ : k.borderWidth,
1559
1588
  isTraveler: k.isTraveler,
1560
1589
  transform: m.transform
1561
1590
  }) : void 0,
1562
1591
  nativeRect: b !== void 0 ? {
1563
- x: m.x !== void 0 ? parseFloat(m.x) : T.left + window.scrollX,
1564
- y: m.y !== void 0 ? parseFloat(m.y) : T.top + window.scrollY,
1565
- width: m.width !== void 0 ? parseFloat(m.width) : T.width,
1566
- height: m.height !== void 0 ? parseFloat(m.height) : T.height
1592
+ x: m.x !== void 0 ? parseFloat(m.x) : S.left + window.scrollX,
1593
+ y: m.y !== void 0 ? parseFloat(m.y) : S.top + window.scrollY,
1594
+ width: m.width !== void 0 ? parseFloat(m.width) : S.width,
1595
+ height: m.height !== void 0 ? parseFloat(m.height) : S.height
1567
1596
  } : void 0,
1568
1597
  isFixed: x.position === "fixed",
1569
- children: he,
1570
- shaderHooks: L
1598
+ children: z,
1599
+ shaderHooks: M
1571
1600
  };
1572
1601
  }
1573
1602
  function it(s, e) {
1574
1603
  e.size !== 0 && e.forEach((t, r) => {
1575
- var l, n, o, a;
1604
+ var c, n, o, a;
1576
1605
  const i = s.get(r);
1577
- !i || !i.userData.basePosition || (V.forceUpdateUniforms(i.material, {
1606
+ !i || !i.userData.basePosition || (H.forceUpdateUniforms(i.material, {
1578
1607
  backgroundColor: t.backgroundColor,
1579
1608
  backgroundImage: t.backgroundImage,
1580
1609
  opacity: t.opacity,
1581
- borderRadius: (n = t.borderRadius) != null ? n : (l = i.userData.baseStyles) == null ? void 0 : l.borderRadius
1610
+ borderRadius: (n = t.borderRadius) != null ? n : (c = i.userData.baseStyles) == null ? void 0 : c.borderRadius
1582
1611
  // width and height are no longer updated here, they are updated in syncMeshesByDOM
1583
- }), i.userData.nativeMesh && V.forceUpdateUniforms(i.userData.nativeMesh.material, {
1612
+ }), i.userData.nativeMesh && H.forceUpdateUniforms(i.userData.nativeMesh.material, {
1584
1613
  backgroundColor: t.backgroundColor,
1585
1614
  backgroundImage: t.backgroundImage,
1586
1615
  opacity: t.opacity,
@@ -1597,19 +1626,19 @@ class st {
1597
1626
  g(this, "tracker");
1598
1627
  this.target = e, this.renderer = t, this.registry = r, this.tracker = new We(e, {
1599
1628
  resizeDebounce: i.resizeDebounce
1600
- }), this.tracker.onLayoutChange.add((l, n) => {
1629
+ }), this.tracker.onLayoutChange.add((c, n) => {
1601
1630
  document.querySelector(`[${O.NAME}~='${O.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1602
- const a = De(
1631
+ const a = Ie(
1603
1632
  this.target,
1604
- l,
1605
- H,
1633
+ c,
1634
+ P,
1606
1635
  1,
1607
1636
  0,
1608
1637
  this.renderer.qualityFactor
1609
1638
  );
1610
1639
  a && this.renderer.syncScene(a, n);
1611
- }), this.tracker.onStyleChange.add((l) => {
1612
- it(this.registry, l);
1640
+ }), this.tracker.onStyleChange.add((c) => {
1641
+ it(this.registry, c);
1613
1642
  }), this.tracker.onRender.add(() => {
1614
1643
  this.renderer.syncMeshesByDOM(), this.renderer.render();
1615
1644
  });
@@ -1646,23 +1675,23 @@ class nt {
1646
1675
  this.store.delete(e);
1647
1676
  }
1648
1677
  }
1649
- class lt {
1678
+ class ct {
1650
1679
  constructor(e, t) {
1651
1680
  g(this, "renderer");
1652
1681
  g(this, "syncer");
1653
1682
  g(this, "target");
1654
1683
  g(this, "registry");
1655
- var i, l, n;
1684
+ var i, c, n;
1656
1685
  if (this.target = e, this.registry = new nt(), !document.getElementById("mirage-engine-styles")) {
1657
1686
  const o = document.createElement("style");
1658
1687
  o.id = "mirage-engine-styles", o.textContent = `
1659
- [${G.NAME}="${G.VALUES.HIDE}"] {
1688
+ [${K.NAME}="${K.VALUES.HIDE}"] {
1660
1689
  opacity: 0 !important;
1661
1690
  }
1662
1691
  `, document.head.appendChild(o);
1663
1692
  }
1664
1693
  let r;
1665
- if (t.mode === "duplicate" ? r = (l = (i = t.container) != null ? i : this.target.parentElement) != null ? l : void 0 : r = (n = this.target.parentElement) != null ? n : void 0, !r)
1694
+ if (t.mode === "duplicate" ? r = (c = (i = t.container) != null ? i : this.target.parentElement) != null ? c : void 0 : r = (n = this.target.parentElement) != null ? n : void 0, !r)
1666
1695
  throw new Error("[Mirage] Cannot find a container (parent or option).");
1667
1696
  this.renderer = new tt(
1668
1697
  this.target,
@@ -1701,10 +1730,10 @@ class lt {
1701
1730
  ArrowUp: !1,
1702
1731
  ArrowDown: !1
1703
1732
  };
1704
- window.addEventListener("keydown", (l) => {
1705
- t[l.key] !== void 0 && (t[l.key] = !0);
1706
- }), window.addEventListener("keyup", (l) => {
1707
- t[l.key] !== void 0 && (t[l.key] = !1);
1733
+ window.addEventListener("keydown", (c) => {
1734
+ t[c.key] !== void 0 && (t[c.key] = !0);
1735
+ }), window.addEventListener("keyup", (c) => {
1736
+ t[c.key] !== void 0 && (t[c.key] = !1);
1708
1737
  });
1709
1738
  const r = 2, i = () => {
1710
1739
  requestAnimationFrame(i), t.ArrowRight && e.position.setX(e.position.x + r), t.ArrowLeft && e.position.setX(e.position.x - r), t.ArrowUp && e.position.setY(e.position.y + r), t.ArrowDown && e.position.setY(e.position.y - r);
@@ -1713,25 +1742,25 @@ class lt {
1713
1742
  }
1714
1743
  }
1715
1744
  export {
1716
- Ee as ALLOWED_FILTERS,
1717
- G as ATTR_DOM,
1718
- z as ATTR_FILTER,
1745
+ Se as ALLOWED_FILTERS,
1746
+ K as ATTR_DOM,
1747
+ W as ATTR_FILTER,
1719
1748
  at as ATTR_SANDWICH,
1720
- W as ATTR_SELECT,
1749
+ q as ATTR_SELECT,
1721
1750
  Xe as ATTR_SHADER,
1722
1751
  O as ATTR_TRAVEL,
1723
- ce as DIRTY_CONTENT,
1724
- re as DIRTY_NONE,
1725
- $ as DIRTY_RECT,
1726
- ie as DIRTY_STRUCTURE,
1727
- Z as DIRTY_STYLE,
1752
+ ve as DIRTY_CONTENT,
1753
+ de as DIRTY_NONE,
1754
+ Q as DIRTY_RECT,
1755
+ ue as DIRTY_STRUCTURE,
1756
+ le as DIRTY_STYLE,
1728
1757
  ze as DIRTY_ZINDEX,
1729
- ct as EXCLUDED,
1730
- lt as Engine,
1731
- K as SELECT_LAYER,
1758
+ lt as EXCLUDED,
1759
+ ct as Engine,
1760
+ te as SELECT_LAYER,
1732
1761
  U as THREE_LAYERS,
1733
- xe as TRAVEL_VALUES,
1762
+ Ce as TRAVEL_VALUES,
1734
1763
  We as Tracker,
1735
- H as USER_LAYER,
1764
+ P as USER_LAYER,
1736
1765
  Ye as extractFromStyle
1737
1766
  };