@mirage-engine/core 0.3.9 → 0.3.11

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
- }, P = {
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
- }, X = {
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
- }, Y = {
65
+ VALUES: Me
66
+ }, G = {
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 W = 1, K = 2, ct = 0, A = {
195
+ const q = 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(X.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);
259
- h.forEach((f, m) => {
260
- const x = m * u + p;
261
- let S = 0;
262
- r.textAlign === "center" ? S = i / 2 : r.textAlign === "right" && (S = i), this.ctx.textAlign = r.textAlign, this.ctx.fillText(f, S, x);
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, p = De.getBaseline(r.font);
259
+ h.forEach((f, v) => {
260
+ const b = v * u + p;
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,23 +308,23 @@ 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 p = ce(h);
328
328
  o.push({
329
329
  color: p.color,
330
330
  alpha: p.alpha,
@@ -333,19 +333,19 @@ function Ge(s) {
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, p = (o[l].stop - h) / d;
345
345
  for (let f = 1; f < d; f++)
346
346
  o[a + f].stop = h + p * f;
347
347
  }
348
- a = c;
348
+ a = l;
349
349
  }
350
350
  }
351
351
  return { angle: i, stops: o };
@@ -503,52 +503,52 @@ 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
- var E;
516
- const l = r !== null || !!s.imageSrc;
515
+ var x;
516
+ const c = r !== null || !!s.imageSrc;
517
517
  let n = "";
518
518
  const o = {};
519
519
  if (i != null && i.uniforms)
520
- for (const [b, w] of Object.entries(i.uniforms))
521
- typeof w == "number" ? (n += `uniform float ${b};
522
- `, o[b] = { value: w }) : Array.isArray(w) ? w.length === 2 ? (n += `uniform vec2 ${b};
523
- `, o[b] = { value: new y.Vector2(...w) }) : w.length === 3 ? (n += `uniform vec3 ${b};
524
- `, o[b] = { value: new y.Vector3(...w) }) : w.length === 4 && (n += `uniform vec4 ${b};
525
- `, o[b] = { value: new y.Vector4(...w) }) : (n += `uniform float ${b};
526
- `, o[b] = { value: w });
527
- const a = i !== void 0, c = (l || a ? Te.declChunk : "") + `
520
+ for (const [C, w] of Object.entries(i.uniforms))
521
+ typeof w == "number" ? (n += `uniform float ${C};
522
+ `, o[C] = { value: w }) : Array.isArray(w) ? w.length === 2 ? (n += `uniform vec2 ${C};
523
+ `, o[C] = { value: new y.Vector2(...w) }) : w.length === 3 ? (n += `uniform vec3 ${C};
524
+ `, o[C] = { value: new y.Vector3(...w) }) : w.length === 4 && (n += `uniform vec4 ${C};
525
+ `, o[C] = { value: new y.Vector4(...w) }) : (n += `uniform float ${C};
526
+ `, o[C] = { value: w });
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), x = ee(s.backgroundColor), S = ee(s.borderColor), L = {
531
+ `, u = c || a ? d + h + ((i == null ? void 0 : i.uvModifier) || "") : "", p = c || a ? Re.baseColorChunk : "", f = (i == null ? void 0 : i.colorModifier) || "", v = Te.fragmentShader.replace("#INJECT_DECLARATIONS", l).replace("#INJECT_UV_MODIFIER", u).replace("#INJECT_BASE_COLOR", p).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(
535
- x.color.r,
536
- x.color.g,
537
- x.color.b,
538
- x.alpha
535
+ b.color.r,
536
+ b.color.g,
537
+ b.color.b,
538
+ b.alpha
539
539
  )
540
540
  },
541
541
  uBorderColor: {
542
542
  value: new y.Vector4(
543
- S.color.r,
544
- S.color.g,
545
- S.color.b,
546
- S.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) },
551
- uOpacity: { value: (E = s.opacity) != null ? E : 1 },
550
+ uBorderWidth: { value: re(s.borderWidth) },
551
+ uOpacity: { value: (x = s.opacity) != null ? x : 1 },
552
552
  uTexture: { value: null },
553
553
  uTextureRepeat: { value: new y.Vector2(1, 1) },
554
554
  uTextureOffset: { value: new y.Vector2(0, 0) },
@@ -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,
566
- fragmentShader: m,
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
+ fragmentShader: v,
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 z = {
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 z = {
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, p) => {
829
829
  const f = this.registry.get(u);
830
- f && f.material instanceof y.ShaderMaterial && z.forceUpdateUniforms(f.material, { texture: p });
830
+ f && f.material instanceof y.ShaderMaterial && H.forceUpdateUniforms(f.material, { texture: p });
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,13 +843,13 @@ 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";
850
850
  }
851
851
  getSceneLayer() {
852
- return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ? A.SELECTED : A.BASE;
852
+ return typeof this.targetLayer == "number" ? this.targetLayer : this.targetLayer === "selected" ? U.SELECTED : U.BASE;
853
853
  }
854
854
  createRenderTarget() {
855
855
  for (let e = 0; e < O.MAX_LAYERS; e++) {
@@ -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 && z.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 && z.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);
@@ -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 = z.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,58 +973,58 @@ 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) => {
984
- var x;
985
- const m = f;
986
- (x = m.material.map) == null || x.dispose(), m.geometry.dispose(), e.remove(m);
984
+ var b;
985
+ const v = f;
986
+ (b = v.material.map) == null || b.dispose(), v.geometry.dispose(), e.remove(v);
987
987
  });
988
988
  const h = t.rect, u = h.x + h.width / 2, p = h.y + h.height / 2;
989
- i.forEach((f, m) => {
990
- const x = z.create(
989
+ i.forEach((f, v) => {
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
- ), S = new y.PlaneGeometry(1, 1), L = new y.Mesh(S, x);
998
- L.name = `TEXT_CHILD_${m}`;
999
- const T = t.rect.width === 0 ? 1 : f.rect.width / t.rect.width, E = t.rect.height === 0 ? 1 : f.rect.height / t.rect.height;
1000
- L.scale.set(T, E, 1);
1001
- const b = f.rect.x + f.rect.width / 2, w = f.rect.y + f.rect.height / 2, I = b - u, U = -(w - p);
1002
- L.position.set(
1003
- t.rect.width === 0 ? 0 : I / t.rect.width,
1004
- t.rect.height === 0 ? 0 : U / t.rect.height,
997
+ ), L = new y.PlaneGeometry(1, 1), M = new y.Mesh(L, b);
998
+ M.name = `TEXT_CHILD_${v}`;
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 - p);
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 & W ? A.BASE : A.HIDDEN;
1013
- if (h.layers.set(u), t.visibility & K && h.layers.enable(A.SELECTED), t.visibility & W)
1012
+ const h = d, u = t.visibility & q ? U.BASE : U.HIDDEN;
1013
+ if (h.layers.set(u), t.visibility & te && h.layers.enable(U.SELECTED), t.visibility & q)
1014
1014
  if (!r && t.nativeLayer !== void 0 && t.nativeStyles !== void 0)
1015
1015
  for (let p = t.captureLayer; p < t.nativeLayer; p++)
1016
- h.layers.enable(A.getCaptureLayer(p));
1016
+ h.layers.enable(U.getCaptureLayer(p));
1017
1017
  else if (r && t.nativeLayer !== void 0)
1018
1018
  for (let p = Math.max(t.captureLayer, t.nativeLayer); p <= O.MAX_LAYERS + 1; p++)
1019
- h.layers.enable(A.getCaptureLayer(p));
1019
+ h.layers.enable(U.getCaptureLayer(p));
1020
1020
  else
1021
1021
  for (let p = t.captureLayer; p <= O.MAX_LAYERS + 1; p++)
1022
- h.layers.enable(A.getCaptureLayer(p));
1022
+ h.layers.enable(U.getCaptureLayer(p));
1023
1023
  });
1024
1024
  }
1025
1025
  updateMeshProperties(e, t) {
1026
- var T, E, b;
1027
- const { rect: r, styles: i } = t, l = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / l, o = this.renderer.domElement.height / l;
1026
+ var S, x, C;
1027
+ const { rect: r, styles: i } = t, c = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / c, o = this.renderer.domElement.height / c;
1028
1028
  e.material = e.userData.baseMaterial, e.scale.set(r.width, r.height, 1), e.userData.domRect = {
1029
1029
  x: r.x,
1030
1030
  y: r.y,
@@ -1033,13 +1033,13 @@ class tt {
1033
1033
  };
1034
1034
  const a = 1e-3;
1035
1035
  this.renderOrder++;
1036
- const c = this.targetRect.left + window.scrollX, d = this.targetRect.top + window.scrollY;
1036
+ const l = this.targetRect.left + window.scrollX, d = this.targetRect.top + window.scrollY;
1037
1037
  let h, u;
1038
1038
  if (this.isViewport)
1039
1039
  h = r.x - window.innerWidth / 2 + r.width / 2, u = -r.y + window.innerHeight / 2 - r.height / 2;
1040
1040
  else {
1041
- const w = r.x - c, I = r.y - d;
1042
- h = w - n / 2 + r.width / 2, u = -I + o / 2 - r.height / 2;
1041
+ const w = r.x - l, T = r.y - d;
1042
+ h = w - n / 2 + r.width / 2, u = -T + o / 2 - r.height / 2;
1043
1043
  }
1044
1044
  e.position.set(
1045
1045
  h,
@@ -1048,13 +1048,13 @@ class tt {
1048
1048
  );
1049
1049
  const p = r.x, f = r.y;
1050
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 m = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, x = window.getComputedStyle(m);
1052
- let S = 0, L = 0;
1053
- if (x.transform && x.transform !== "none") {
1054
- const w = new DOMMatrix(x.transform);
1055
- S = w.m41, L = w.m42;
1051
+ const v = t.element.nodeType === Node.TEXT_NODE ? t.element.parentElement : t.element, b = window.getComputedStyle(v);
1052
+ let L = 0, M = 0;
1053
+ if (b.transform && b.transform !== "none") {
1054
+ const w = new DOMMatrix(b.transform);
1055
+ L = w.m41, M = w.m42;
1056
1056
  }
1057
- if (e.userData.baseTransform = { x: S, y: L }, delete e.userData.originRatioX, delete e.userData.originRatioY, z.update(
1057
+ if (e.userData.baseTransform = { x: L, y: M }, delete e.userData.originRatioX, delete e.userData.originRatioY, H.update(
1058
1058
  e.userData.baseMaterial,
1059
1059
  "BOX",
1060
1060
  i,
@@ -1062,34 +1062,62 @@ class tt {
1062
1062
  r.width,
1063
1063
  r.height,
1064
1064
  this.qualityFactor,
1065
- t.isTraveler ? (T = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : T.texture : this.textureManager.get(t.element)
1065
+ t.isTraveler ? (S = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : S.texture : this.textureManager.get(t.element)
1066
1066
  ), t.nativeStyles && t.nativeRect) {
1067
1067
  if (!e.userData.nativeMesh) {
1068
- const B = z.create(
1068
+ const z = H.create(
1069
1069
  "BOX",
1070
1070
  t.nativeStyles,
1071
1071
  "",
1072
1072
  t.nativeRect.width,
1073
1073
  t.nativeRect.height,
1074
1074
  this.qualityFactor,
1075
- t.isTraveler ? (E = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : E.texture : this.textureManager.get(t.element),
1075
+ t.isTraveler ? (x = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : x.texture : this.textureManager.get(t.element),
1076
1076
  t.shaderHooks
1077
- ), G = new y.Mesh(e.geometry, B);
1078
- t.type === "TEXT" && (G.name = "BG_MESH"), this.scene.add(G), e.userData.nativeMesh = G;
1077
+ ), N = new y.Mesh(e.geometry, z);
1078
+ t.type === "TEXT" && (N.name = "BG_MESH"), this.scene.add(N), e.userData.nativeMesh = N;
1079
1079
  }
1080
1080
  const w = e.userData.nativeMesh;
1081
- let I, U;
1081
+ let T, D;
1082
1082
  if (this.isViewport)
1083
- I = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, U = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1083
+ T = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, D = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1084
1084
  else {
1085
- const B = t.nativeRect.x - c, G = t.nativeRect.y - d;
1086
- I = B - n / 2 + t.nativeRect.width / 2, U = -G + o / 2 - t.nativeRect.height / 2;
1085
+ const z = t.nativeRect.x - l, N = t.nativeRect.y - d;
1086
+ T = z - n / 2 + t.nativeRect.width / 2, D = -N + o / 2 - t.nativeRect.height / 2;
1087
1087
  }
1088
- w.scale.set(t.nativeRect.width, t.nativeRect.height, 1), w.position.set(
1089
- I,
1090
- U,
1088
+ let k = t.nativeRect.width, $ = t.nativeRect.height, ie = T, se = D;
1089
+ if (t.nativeStyles.transform) {
1090
+ const z = t.nativeStyles.transform, N = z.match(/scale\(([\d.]+%?)\)/);
1091
+ if (N) {
1092
+ let B = parseFloat(N[1]);
1093
+ N[1].includes("%") && (B /= 100), k *= B, $ *= B;
1094
+ }
1095
+ const Z = z.match(/translate\(([^,]+),\s*([^)]+)\)/);
1096
+ if (Z) {
1097
+ const B = Z[1].trim(), _ = Z[2].trim();
1098
+ let m = parseFloat(B);
1099
+ B.includes("%") && (m = m / 100 * t.nativeRect.width);
1100
+ let R = parseFloat(_);
1101
+ _.includes("%") && (R = R / 100 * t.nativeRect.height), ie += m, se -= R;
1102
+ }
1103
+ const ne = z.match(/translateX\(([^)]+)\)/);
1104
+ if (ne) {
1105
+ const B = ne[1].trim();
1106
+ let _ = parseFloat(B);
1107
+ B.includes("%") && (_ = _ / 100 * t.nativeRect.width), ie += _;
1108
+ }
1109
+ const oe = z.match(/translateY\(([^)]+)\)/);
1110
+ if (oe) {
1111
+ const B = oe[1].trim();
1112
+ let _ = parseFloat(B);
1113
+ B.includes("%") && (_ = _ / 100 * t.nativeRect.height), se -= _;
1114
+ }
1115
+ }
1116
+ w.scale.set(k, $, 1), w.position.set(
1117
+ ie,
1118
+ se,
1091
1119
  t.nativeStyles.zIndex + this.renderOrder * a
1092
- ), z.update(
1120
+ ), H.update(
1093
1121
  w.material,
1094
1122
  "BOX",
1095
1123
  t.nativeStyles,
@@ -1097,54 +1125,54 @@ class tt {
1097
1125
  t.nativeRect.width,
1098
1126
  t.nativeRect.height,
1099
1127
  this.qualityFactor,
1100
- t.isTraveler ? (b = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : b.texture : this.textureManager.get(t.element)
1128
+ t.isTraveler ? (C = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : C.texture : this.textureManager.get(t.element)
1101
1129
  );
1102
1130
  } else
1103
1131
  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
1132
  }
1105
1133
  updateMeshLayers(e, t) {
1106
- const r = t.visibility & W ? A.BASE : A.HIDDEN;
1107
- if (e.layers.set(r), t.visibility & K && e.layers.enable(A.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1134
+ const r = t.visibility & q ? U.BASE : U.HIDDEN;
1135
+ if (e.layers.set(r), t.visibility & te && e.layers.enable(U.SELECTED), e.userData.nativeMesh && t.nativeLayer !== void 0) {
1108
1136
  const i = e.userData.nativeMesh;
1109
- if (i.layers.set(A.HIDDEN), t.visibility & W) {
1110
- for (let l = t.captureLayer; l < t.nativeLayer; l++)
1111
- e.layers.enable(A.getCaptureLayer(l));
1112
- for (let l = Math.max(t.captureLayer, t.nativeLayer); l <= O.MAX_LAYERS + 1; l++)
1113
- i.layers.enable(A.getCaptureLayer(l));
1137
+ if (i.layers.set(U.HIDDEN), t.visibility & q) {
1138
+ for (let c = t.captureLayer; c < t.nativeLayer; c++)
1139
+ e.layers.enable(U.getCaptureLayer(c));
1140
+ for (let c = Math.max(t.captureLayer, t.nativeLayer); c <= O.MAX_LAYERS + 1; c++)
1141
+ i.layers.enable(U.getCaptureLayer(c));
1114
1142
  }
1115
- } else if (t.visibility & W)
1143
+ } else if (t.visibility & q)
1116
1144
  for (let i = t.captureLayer; i <= O.MAX_LAYERS + 1; i++)
1117
- e.layers.enable(A.getCaptureLayer(i));
1145
+ e.layers.enable(U.getCaptureLayer(i));
1118
1146
  }
1119
1147
  captureRenderTarget(e, t, r) {
1120
1148
  if (e.size === 0 || !r)
1121
1149
  return;
1122
- const i = new y.Color(), l = this.renderer.getClearAlpha();
1150
+ const i = new y.Color(), c = this.renderer.getClearAlpha();
1123
1151
  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();
1152
+ 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
1153
  for (const d of e) {
1126
1154
  n.setFromMatrixPosition(d.matrixWorld), n.project(this.camera);
1127
1155
  const h = (n.x + 1) / 2 * o, u = (n.y + 1) / 2 * a;
1128
1156
  let p = 0, f = 1;
1129
1157
  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, x = d.scale.y * f + 0.5, S = h - m / 2, L = u - x / 2, T = (S * this.qualityFactor - p) / c, E = (L * this.qualityFactor - p) / c, b = (m * this.qualityFactor + p * 2) / c, w = (x * this.qualityFactor + p * 2) / c;
1131
- this.renderer.setScissor(T, E, b, w), this.renderer.render(this.scene, this.camera);
1158
+ const v = d.scale.x * f + 0.5, b = d.scale.y * f + 0.5, L = h - v / 2, M = u - b / 2, S = (L * this.qualityFactor - p) / l, x = (M * this.qualityFactor - p) / l, C = (v * this.qualityFactor + p * 2) / l, w = (b * this.qualityFactor + p * 2) / l;
1159
+ this.renderer.setScissor(S, x, C, w), this.renderer.render(this.scene, this.camera);
1132
1160
  }
1133
- this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(i, l);
1161
+ this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(i, c);
1134
1162
  }
1135
1163
  render() {
1136
1164
  for (let e = 0; e < O.MAX_LAYERS; e++) {
1137
1165
  const t = e + 1;
1138
1166
  this.captureRenderTarget(
1139
1167
  this.travelersByLayer[e],
1140
- A.getCaptureLayer(t),
1168
+ U.getCaptureLayer(t),
1141
1169
  this.renderTargets[e]
1142
1170
  );
1143
1171
  }
1144
1172
  this.renderer.render(this.scene, this.camera);
1145
1173
  }
1146
1174
  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;
1175
+ 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
1176
  this.scene.children.forEach((n) => {
1149
1177
  const o = n;
1150
1178
  if (!o.userData || !o.userData.domElement)
@@ -1152,49 +1180,61 @@ class tt {
1152
1180
  const a = o.userData.domElement;
1153
1181
  if (!a.isConnected)
1154
1182
  return;
1155
- let c;
1183
+ let l;
1156
1184
  if (a.nodeType === Node.TEXT_NODE) {
1157
1185
  const h = document.createRange();
1158
- h.selectNode(a), c = h.getBoundingClientRect();
1186
+ h.selectNode(a), l = h.getBoundingClientRect();
1159
1187
  } else
1160
- c = a.getBoundingClientRect();
1188
+ l = a.getBoundingClientRect();
1161
1189
  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) {
1190
+ 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
1191
  o.userData.domRect = {
1164
- x: c.x,
1165
- y: c.y,
1166
- width: c.width,
1167
- height: c.height
1192
+ x: l.x,
1193
+ y: l.y,
1194
+ width: l.width,
1195
+ height: l.height
1168
1196
  };
1169
1197
  let h, u;
1170
1198
  if (this.isViewport)
1171
- h = c.x - window.innerWidth / 2 + c.width / 2, u = -c.y + window.innerHeight / 2 - c.height / 2;
1199
+ h = l.x - window.innerWidth / 2 + l.width / 2, u = -l.y + window.innerHeight / 2 - l.height / 2;
1172
1200
  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;
1201
+ const p = l.x - e, f = l.y - t;
1202
+ h = p - i / 2 + l.width / 2, u = -f + c / 2 - l.height / 2;
1175
1203
  }
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 && z.forceUpdateUniforms(o.material, {
1177
- width: c.width,
1178
- height: c.height
1204
+ 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, {
1205
+ width: l.width,
1206
+ height: l.height
1179
1207
  }), o.userData.nativeMesh) {
1180
1208
  const p = o.userData.nativeMesh;
1181
- let f = c.width, m = c.height, x = h, S = u;
1209
+ let f = l.width, v = l.height, b = h, L = u;
1182
1210
  if (o.userData.nativeTransform) {
1183
- const L = o.userData.nativeTransform, T = L.match(/scale\(([\d.]+%?)\)/);
1184
- if (T) {
1185
- let b = parseFloat(T[1]);
1186
- T[1].includes("%") && (b /= 100), f *= b, m *= b;
1211
+ const M = o.userData.nativeTransform, S = M.match(/scale\(([\d.]+%?)\)/);
1212
+ if (S) {
1213
+ let T = parseFloat(S[1]);
1214
+ S[1].includes("%") && (T /= 100), f *= T, v *= T;
1215
+ }
1216
+ const x = M.match(/translate\(([^,]+),\s*([^)]+)\)/);
1217
+ if (x) {
1218
+ const T = x[1].trim(), D = x[2].trim();
1219
+ let k = parseFloat(T);
1220
+ T.includes("%") && (k = k / 100 * l.width);
1221
+ let $ = parseFloat(D);
1222
+ D.includes("%") && ($ = $ / 100 * l.height), b += k, L -= $;
1223
+ }
1224
+ const C = M.match(/translateX\(([^)]+)\)/);
1225
+ if (C) {
1226
+ const T = C[1].trim();
1227
+ let D = parseFloat(T);
1228
+ T.includes("%") && (D = D / 100 * l.width), b += D;
1187
1229
  }
1188
- const E = L.match(/translate\(([^,]+),\s*([^)]+)\)/);
1189
- if (E) {
1190
- const b = E[1].trim(), w = E[2].trim();
1191
- let I = parseFloat(b);
1192
- b.includes("%") && (I = I / 100 * c.width);
1193
- let U = parseFloat(w);
1194
- w.includes("%") && (U = U / 100 * c.height), x += I, S -= U;
1230
+ const w = M.match(/translateY\(([^)]+)\)/);
1231
+ if (w) {
1232
+ const T = w[1].trim();
1233
+ let D = parseFloat(T);
1234
+ T.includes("%") && (D = D / 100 * l.height), L -= D;
1195
1235
  }
1196
1236
  }
1197
- p.position.setX(x), p.position.setY(S), p.scale.set(f, m, 1), p.updateMatrixWorld();
1237
+ p.position.setX(b), p.position.setY(L), p.scale.set(f, v, 1), p.updateMatrixWorld();
1198
1238
  }
1199
1239
  }
1200
1240
  });
@@ -1202,17 +1242,17 @@ class tt {
1202
1242
  }
1203
1243
  function rt(s) {
1204
1244
  const e = s.textContent || "", t = [];
1205
- let r = "", i = null, l = -1;
1206
- const n = (c, d) => {
1207
- for (let h = 0; h < c.length; h++) {
1208
- const u = c[h], p = document.createRange();
1245
+ let r = "", i = null, c = -1;
1246
+ const n = (l, d) => {
1247
+ for (let h = 0; h < l.length; h++) {
1248
+ const u = l[h], p = document.createRange();
1209
1249
  p.setStart(s, d + h), p.setEnd(s, d + h + 1);
1210
1250
  const f = p.getBoundingClientRect();
1211
1251
  if (f.width === 0 && f.height === 0) {
1212
1252
  r += u;
1213
1253
  continue;
1214
1254
  }
1215
- l === -1 || Math.abs(f.top - l) > f.height / 2 ? (r && i && t.push({
1255
+ c === -1 || Math.abs(f.top - c) > f.height / 2 ? (r && i && t.push({
1216
1256
  text: r,
1217
1257
  rect: {
1218
1258
  left: i.left,
@@ -1225,26 +1265,26 @@ function rt(s) {
1225
1265
  top: f.top,
1226
1266
  right: f.right,
1227
1267
  bottom: f.bottom
1228
- }, 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(
1268
+ }, 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(
1229
1269
  i.bottom,
1230
1270
  f.bottom
1231
1271
  )));
1232
1272
  }
1233
1273
  }, o = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
1234
1274
  let a = 0;
1235
- for (const c of o) {
1275
+ for (const l of o) {
1236
1276
  const d = document.createRange();
1237
- d.setStart(s, a), d.setEnd(s, a + c.length);
1277
+ d.setStart(s, a), d.setEnd(s, a + l.length);
1238
1278
  const h = d.getClientRects();
1239
1279
  if (h.length > 1)
1240
- n(c, a);
1280
+ n(l, a);
1241
1281
  else {
1242
1282
  const u = h.length === 1 ? h[0] : d.getBoundingClientRect();
1243
1283
  if (u.width === 0 && u.height === 0) {
1244
- r += c, a += c.length;
1284
+ r += l, a += l.length;
1245
1285
  continue;
1246
1286
  }
1247
- l === -1 || Math.abs(u.top - l) > u.height / 2 ? (r && i && t.push({
1287
+ c === -1 || Math.abs(u.top - c) > u.height / 2 ? (r && i && t.push({
1248
1288
  text: r,
1249
1289
  rect: {
1250
1290
  left: i.left,
@@ -1252,17 +1292,17 @@ function rt(s) {
1252
1292
  width: i.right - i.left,
1253
1293
  height: i.bottom - i.top
1254
1294
  }
1255
- }), r = c, i = {
1295
+ }), r = l, i = {
1256
1296
  left: u.left,
1257
1297
  top: u.top,
1258
1298
  right: u.right,
1259
1299
  bottom: u.bottom
1260
- }, 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(
1300
+ }, 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(
1261
1301
  i.bottom,
1262
1302
  u.bottom
1263
1303
  )));
1264
1304
  }
1265
- a += c.length;
1305
+ a += l.length;
1266
1306
  }
1267
1307
  return r && i && t.push({
1268
1308
  text: r,
@@ -1273,10 +1313,10 @@ function rt(s) {
1273
1313
  height: i.bottom - i.top
1274
1314
  }
1275
1315
  }), t.filter(
1276
- (c) => c.text.trim().length > 0 && c.rect.width > 0 && c.rect.height > 0
1316
+ (l) => l.text.trim().length > 0 && l.rect.width > 0 && l.rect.height > 0
1277
1317
  );
1278
1318
  }
1279
- function Se(s) {
1319
+ function Le(s) {
1280
1320
  const e = parseFloat(s.fontSize);
1281
1321
  let t = parseFloat(s.lineHeight);
1282
1322
  isNaN(t) && (t = e * 1.2);
@@ -1292,283 +1332,283 @@ function Se(s) {
1292
1332
  letterSpacing: r
1293
1333
  };
1294
1334
  }
1295
- function De(s, e = $ | Z | ze | ce | ie, t, r = 1, i = 0, l = 2, n, o) {
1296
- var de, ue, fe, ge, pe, me;
1335
+ function Ie(s, e = Q | le | ze | ve | ue, t, r = 1, i = 0, c = 2, n, o) {
1336
+ var N, Z, ne, oe, B, _;
1297
1337
  if (s.nodeType === Node.TEXT_NODE) {
1298
- const v = s;
1299
- if (!v.textContent || !v.textContent.trim())
1338
+ const m = s;
1339
+ if (!m.textContent || !m.textContent.trim())
1300
1340
  return null;
1301
- const M = v.textContent.replace(/\s+/g, " ");
1302
- if (M.length === 0)
1341
+ const R = m.textContent.replace(/\s+/g, " ");
1342
+ if (R.length === 0)
1303
1343
  return null;
1304
- const k = rt(v);
1305
- if (k.length === 0)
1344
+ const F = rt(m);
1345
+ if (F.length === 0)
1306
1346
  return null;
1307
- const _ = v.parentElement, D = _ ? window.getComputedStyle(_) : null;
1308
- if (!D)
1347
+ const V = m.parentElement, I = V ? window.getComputedStyle(V) : null;
1348
+ if (!I)
1309
1349
  return null;
1310
- const V = Math.min(...k.map((C) => C.rect.left)), F = Math.min(...k.map((C) => C.rect.top)), H = Math.max(...k.map((C) => C.rect.left + C.rect.width)), R = Math.max(...k.map((C) => C.rect.top + C.rect.height));
1350
+ const P = 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));
1311
1351
  return {
1312
1352
  id: Math.random().toString(36).substring(2, 9),
1313
1353
  type: "TEXT",
1314
- element: v,
1354
+ element: m,
1315
1355
  rect: {
1316
- x: V + window.scrollX,
1317
- y: F + window.scrollY,
1318
- width: H - V,
1319
- height: R - F
1356
+ x: P + window.scrollX,
1357
+ y: X + window.scrollY,
1358
+ width: j - P,
1359
+ height: A - X
1320
1360
  },
1321
1361
  styles: {
1322
1362
  backgroundColor: "transparent",
1323
1363
  backgroundImage: "",
1324
- opacity: _ && _.dataset[P.KEY] === P.VALUES.HIDE ? 1 : parseFloat(D.opacity),
1325
- zIndex: (isNaN(parseInt(D.zIndex)) ? 0 : parseInt(D.zIndex)) + i,
1364
+ opacity: V && V.dataset[K.KEY] === K.VALUES.HIDE ? 1 : parseFloat(I.opacity),
1365
+ zIndex: (isNaN(parseInt(I.zIndex)) ? 0 : parseInt(I.zIndex)) + i,
1326
1366
  borderRadius: "0px",
1327
1367
  borderColor: "transparent",
1328
1368
  borderWidth: "0px",
1329
1369
  isTraveler: !1
1330
1370
  },
1331
- textContent: M,
1332
- textLines: k.map((C) => ({
1333
- text: C.text.trim(),
1371
+ textContent: R,
1372
+ textLines: F.map((E) => ({
1373
+ text: E.text.trim(),
1334
1374
  rect: {
1335
- x: C.rect.left + window.scrollX,
1336
- y: C.rect.top + window.scrollY,
1337
- width: C.rect.width,
1338
- height: C.rect.height
1375
+ x: E.rect.left + window.scrollX,
1376
+ y: E.rect.top + window.scrollY,
1377
+ width: E.rect.width,
1378
+ height: E.rect.height
1339
1379
  }
1340
1380
  })),
1341
- textStyles: Se(D),
1381
+ textStyles: Le(I),
1342
1382
  dirtyMask: e,
1343
1383
  visibility: t,
1344
1384
  isTraveler: !1,
1345
1385
  captureLayer: r,
1346
- isFixed: D.position === "fixed",
1386
+ isFixed: I.position === "fixed",
1347
1387
  nativeLayer: n,
1348
- nativeStyles: o ? q(q({
1388
+ nativeStyles: o ? J(J({
1349
1389
  backgroundColor: "transparent",
1350
1390
  backgroundImage: "",
1351
- opacity: _ && _.dataset[P.KEY] === P.VALUES.HIDE ? 1 : parseFloat(D.opacity),
1352
- zIndex: (isNaN(parseInt(D.zIndex)) ? 0 : parseInt(D.zIndex)) + i,
1391
+ opacity: V && V.dataset[K.KEY] === K.VALUES.HIDE ? 1 : parseFloat(I.opacity),
1392
+ zIndex: (isNaN(parseInt(I.zIndex)) ? 0 : parseInt(I.zIndex)) + i,
1353
1393
  borderRadius: "0px",
1354
1394
  borderColor: "transparent",
1355
1395
  borderWidth: "0px",
1356
1396
  isTraveler: !1
1357
- }, Se(D)), o) : void 0,
1397
+ }, Le(I)), o) : void 0,
1358
1398
  nativeRect: o ? {
1359
- x: V + window.scrollX,
1360
- y: F + window.scrollY,
1361
- width: H - V,
1362
- height: R - F
1399
+ x: P + window.scrollX,
1400
+ y: X + window.scrollY,
1401
+ width: j - P,
1402
+ height: A - X
1363
1403
  } : void 0,
1364
1404
  children: []
1365
1405
  };
1366
1406
  }
1367
1407
  if (s.nodeType !== Node.ELEMENT_NODE)
1368
1408
  return null;
1369
- const a = s, c = a.dataset[X.KEY];
1409
+ const a = s, l = a.dataset[W.KEY];
1370
1410
  let d = t, h = t;
1371
- if (c) {
1372
- const v = new Set(c.split(/\s+/));
1373
- for (const M of v)
1374
- if (!Ee.includes(M))
1411
+ if (l) {
1412
+ const m = new Set(l.split(/\s+/));
1413
+ for (const R of m)
1414
+ if (!Se.includes(R))
1375
1415
  throw new Error(
1376
- `[MirageEngine] Invalid filter token: '${M}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1416
+ `[MirageEngine] Invalid filter token: '${R}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1377
1417
  );
1378
- if (v.has(X.VALUES.END))
1418
+ if (m.has(W.VALUES.END))
1379
1419
  return null;
1380
- if (v.has(X.VALUES.INCLUDE_TREE) && v.has(X.VALUES.EXCLUDE_TREE))
1420
+ if (m.has(W.VALUES.INCLUDE_TREE) && m.has(W.VALUES.EXCLUDE_TREE))
1381
1421
  throw new Error(
1382
1422
  "[MirageEngine] Conflicting filters: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1383
1423
  );
1384
- if (v.has(X.VALUES.INCLUDE_SELF) && v.has(X.VALUES.EXCLUDE_SELF))
1424
+ if (m.has(W.VALUES.INCLUDE_SELF) && m.has(W.VALUES.EXCLUDE_SELF))
1385
1425
  throw new Error(
1386
1426
  "[MirageEngine] Conflicting filters: 'include-self' and 'exclude-self' cannot be used together on the same element."
1387
1427
  );
1388
- v.has(X.VALUES.INCLUDE_TREE) ? d = d | W : v.has(X.VALUES.EXCLUDE_TREE) && (d = d & ~W), h = d, v.has(X.VALUES.INCLUDE_SELF) ? h = h | W : v.has(X.VALUES.EXCLUDE_SELF) && (h = h & ~W);
1428
+ m.has(W.VALUES.INCLUDE_TREE) ? d = d | q : m.has(W.VALUES.EXCLUDE_TREE) && (d = d & ~q), h = d, m.has(W.VALUES.INCLUDE_SELF) ? h = h | q : m.has(W.VALUES.EXCLUDE_SELF) && (h = h & ~q);
1389
1429
  }
1390
- const u = a.dataset[Y.KEY];
1430
+ const u = a.dataset[G.KEY];
1391
1431
  if (u) {
1392
- const v = new Set(u.split(/\s+/));
1393
- for (const M of v)
1394
- if (!Ee.includes(M))
1432
+ const m = new Set(u.split(/\s+/));
1433
+ for (const R of m)
1434
+ if (!Se.includes(R))
1395
1435
  throw new Error(
1396
- `[MirageEngine] Invalid select token: '${M}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1436
+ `[MirageEngine] Invalid select token: '${R}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1397
1437
  );
1398
- if (v.has(Y.VALUES.END))
1438
+ if (m.has(G.VALUES.END))
1399
1439
  return null;
1400
- if (v.has(Y.VALUES.INCLUDE_TREE) && v.has(Y.VALUES.EXCLUDE_TREE))
1440
+ if (m.has(G.VALUES.INCLUDE_TREE) && m.has(G.VALUES.EXCLUDE_TREE))
1401
1441
  throw new Error(
1402
1442
  "[MirageEngine] Conflicting selects: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1403
1443
  );
1404
- if (v.has(Y.VALUES.INCLUDE_SELF) && v.has(Y.VALUES.EXCLUDE_SELF))
1444
+ if (m.has(G.VALUES.INCLUDE_SELF) && m.has(G.VALUES.EXCLUDE_SELF))
1405
1445
  throw new Error(
1406
1446
  "[MirageEngine] Conflicting selects: 'include-self' and 'exclude-self' cannot be used together on the same element."
1407
1447
  );
1408
- v.has(Y.VALUES.INCLUDE_TREE) ? d = d | K : v.has(Y.VALUES.EXCLUDE_TREE) && (d = d & ~K), h = d, v.has(Y.VALUES.INCLUDE_SELF) ? h = h | K : v.has(Y.VALUES.EXCLUDE_SELF) && (h = h & ~K);
1448
+ m.has(G.VALUES.INCLUDE_TREE) ? d = d | te : m.has(G.VALUES.EXCLUDE_TREE) && (d = d & ~te), h = d, m.has(G.VALUES.INCLUDE_SELF) ? h = h | te : m.has(G.VALUES.EXCLUDE_SELF) && (h = h & ~te);
1409
1449
  }
1410
1450
  const p = a.dataset[O.KEY];
1411
- let f = !1, m = o ? q({}, o) : {}, x = n;
1451
+ let f = !1, v = o ? J({}, o) : {}, b = n;
1412
1452
  if (p) {
1413
- let v = 1;
1414
- const M = p.indexOf("{"), k = p.lastIndexOf("}");
1415
- let _ = p;
1416
- if (M !== -1 && k !== -1 && k > M) {
1417
- _ = p.substring(0, M).trim();
1418
- const R = p.substring(M, k + 1);
1453
+ let m = 1;
1454
+ const R = p.indexOf("{"), F = p.lastIndexOf("}");
1455
+ let V = p;
1456
+ if (R !== -1 && F !== -1 && F > R) {
1457
+ V = p.substring(0, R).trim();
1458
+ const A = p.substring(R, F + 1);
1419
1459
  try {
1420
- m = new Function("return " + R)();
1421
- } catch (C) {
1460
+ v = new Function("return " + A)();
1461
+ } catch (E) {
1422
1462
  console.warn(
1423
- `[MirageEngine] Failed to parse travel styles JSON: ${R}`
1463
+ `[MirageEngine] Failed to parse travel styles JSON: ${A}`
1424
1464
  );
1425
1465
  }
1426
1466
  }
1427
- const D = _.split(/\s+/);
1428
- let V = !1;
1429
- const F = D.indexOf(O.VALUES.TRAVELER);
1430
- if (F !== -1) {
1431
- f = !0, V = !0;
1432
- const R = D[F + 1];
1433
- if (R && !isNaN(parseInt(R, 10)))
1434
- v = parseInt(R, 10);
1467
+ const I = V.split(/\s+/);
1468
+ let P = !1;
1469
+ const X = I.indexOf(O.VALUES.TRAVELER);
1470
+ if (X !== -1) {
1471
+ f = !0, P = !0;
1472
+ const A = I[X + 1];
1473
+ if (A && !isNaN(parseInt(A, 10)))
1474
+ m = parseInt(A, 10);
1435
1475
  else {
1436
- const C = D.find((j) => !isNaN(parseInt(j, 10)));
1437
- C && (v = parseInt(C, 10));
1476
+ const E = I.find((ee) => !isNaN(parseInt(ee, 10)));
1477
+ E && (m = parseInt(E, 10));
1438
1478
  }
1439
1479
  }
1440
- const H = D.indexOf(O.VALUES.NATIVE);
1441
- if (H !== -1) {
1442
- const R = D[H + 1];
1443
- if (R && !isNaN(parseInt(R, 10)))
1444
- x = parseInt(R, 10);
1480
+ const j = I.indexOf(O.VALUES.NATIVE);
1481
+ if (j !== -1) {
1482
+ const A = I[j + 1];
1483
+ if (A && !isNaN(parseInt(A, 10)))
1484
+ b = parseInt(A, 10);
1445
1485
  else if (!f) {
1446
- const C = D.find((j) => !isNaN(parseInt(j, 10)));
1447
- C && (x = parseInt(C, 10));
1486
+ const E = I.find((ee) => !isNaN(parseInt(ee, 10)));
1487
+ E && (b = parseInt(E, 10));
1448
1488
  }
1449
1489
  }
1450
- if (V) {
1451
- const R = v + 1;
1452
- if (R < r)
1490
+ if (P) {
1491
+ const A = m + 1;
1492
+ if (A < r)
1453
1493
  throw new Error(
1454
- `[MirageEngine] Traveler layer (${v}) cannot be smaller than inherited capture layer (${r - 1}).`
1494
+ `[MirageEngine] Traveler layer (${m}) cannot be smaller than inherited capture layer (${r - 1}).`
1455
1495
  );
1456
- r = Math.min(R, O.MAX_LAYERS + 1);
1496
+ r = Math.min(A, O.MAX_LAYERS + 1);
1457
1497
  }
1458
1498
  }
1459
- const S = a.dataset[Xe.KEY];
1460
- let L;
1461
- S && (L = JSON.parse(S));
1462
- const T = a.getBoundingClientRect(), E = window.getComputedStyle(a);
1463
- if (T.width === 0 || T.height === 0 || E.display === "none")
1499
+ const L = a.dataset[Xe.KEY];
1500
+ let M;
1501
+ L && (M = JSON.parse(L));
1502
+ const S = a.getBoundingClientRect(), x = window.getComputedStyle(a);
1503
+ if (S.width === 0 || S.height === 0 || x.display === "none")
1464
1504
  return null;
1465
- let b = a.getAttribute("data-mid");
1466
- b || (b = Math.random().toString(36).substring(2, 11), a.setAttribute("data-mid", b));
1467
- const w = parseInt(E.zIndex), I = (isNaN(w) ? 0 : w) + i;
1468
- let U;
1505
+ let C = a.getAttribute("data-mid");
1506
+ C || (C = Math.random().toString(36).substring(2, 11), a.setAttribute("data-mid", C));
1507
+ const w = parseInt(x.zIndex), T = (isNaN(w) ? 0 : w) + i;
1508
+ let D;
1469
1509
  if (a.tagName === "IMG")
1470
- U = a.src;
1510
+ D = a.src;
1471
1511
  else if (a.tagName.toLowerCase() === "svg") {
1472
- const v = a.cloneNode(!0), M = m == null ? void 0 : m.color, k = m == null ? void 0 : m.fill, _ = m == null ? void 0 : m.stroke, D = m == null ? void 0 : m.opacity, V = (C, j) => {
1473
- const N = window.getComputedStyle(C), Q = j, ke = N.fill === N.color, Ue = N.stroke === N.color, se = k || (ke ? M : void 0) || N.fill;
1474
- se && se !== "none" && (Q.style.fill = se);
1475
- const ne = _ || (Ue ? M : void 0) || N.stroke;
1476
- ne && ne !== "none" && (Q.style.stroke = ne), N.strokeWidth && N.strokeWidth !== "0px" && (Q.style.strokeWidth = N.strokeWidth);
1477
- const ve = M || N.color;
1478
- ve && (Q.style.color = ve);
1479
- const oe = D || N.opacity;
1480
- oe && oe !== "1" && (Q.style.opacity = oe);
1481
- for (let te = 0; te < C.children.length; te++)
1482
- V(C.children[te], j.children[te]);
1512
+ const m = a.cloneNode(!0), R = v == null ? void 0 : v.color, F = v == null ? void 0 : v.fill, V = v == null ? void 0 : v.stroke, I = v == null ? void 0 : v.opacity, P = (E, ee) => {
1513
+ 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;
1514
+ fe && fe !== "none" && (ae.style.fill = fe);
1515
+ const ge = V || (Ue ? R : void 0) || Y.stroke;
1516
+ ge && ge !== "none" && (ae.style.stroke = ge), Y.strokeWidth && Y.strokeWidth !== "0px" && (ae.style.strokeWidth = Y.strokeWidth);
1517
+ const be = R || Y.color;
1518
+ be && (ae.style.color = be);
1519
+ const pe = I || Y.opacity;
1520
+ pe && pe !== "1" && (ae.style.opacity = pe);
1521
+ for (let he = 0; he < E.children.length; he++)
1522
+ P(E.children[he], ee.children[he]);
1483
1523
  };
1484
- V(a, v);
1485
- const F = a.getBoundingClientRect(), H = window.devicePixelRatio * l;
1486
- v.hasAttribute("viewBox") || v.setAttribute("viewBox", `0 0 ${F.width} ${F.height}`), v.setAttribute("width", (F.width * H).toString()), v.setAttribute("height", (F.height * H).toString());
1487
- let R = new XMLSerializer().serializeToString(v);
1488
- R.includes("xmlns=") || (R = R.replace(
1524
+ P(a, m);
1525
+ const X = a.getBoundingClientRect(), j = window.devicePixelRatio * c;
1526
+ m.hasAttribute("viewBox") || m.setAttribute("viewBox", `0 0 ${X.width} ${X.height}`), m.setAttribute("width", (X.width * j).toString()), m.setAttribute("height", (X.height * j).toString());
1527
+ let A = new XMLSerializer().serializeToString(m);
1528
+ A.includes("xmlns=") || (A = A.replace(
1489
1529
  "<svg",
1490
1530
  '<svg xmlns="http://www.w3.org/2000/svg"'
1491
- )), U = `data:image/svg+xml;utf8,${encodeURIComponent(R)}`;
1492
- } else if (E.backgroundImage && E.backgroundImage !== "none") {
1493
- const v = E.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1494
- v && (U = v[1]);
1495
- }
1496
- const B = {
1497
- backgroundColor: E.backgroundColor,
1498
- backgroundImage: E.backgroundImage,
1499
- opacity: a.dataset[P.KEY] === P.VALUES.HIDE ? 1 : parseFloat(E.opacity),
1500
- zIndex: I,
1501
- borderRadius: E.borderRadius,
1502
- borderColor: E.borderColor,
1503
- borderWidth: E.borderWidth,
1504
- imageSrc: U,
1531
+ )), D = `data:image/svg+xml;utf8,${encodeURIComponent(A)}`;
1532
+ } else if (x.backgroundImage && x.backgroundImage !== "none") {
1533
+ const m = x.backgroundImage.match(/url\(['"]?(.*?)['"]?\)/);
1534
+ m && (D = m[1]);
1535
+ }
1536
+ const k = {
1537
+ backgroundColor: x.backgroundColor,
1538
+ backgroundImage: x.backgroundImage,
1539
+ opacity: a.dataset[K.KEY] === K.VALUES.HIDE ? 1 : parseFloat(x.opacity),
1540
+ zIndex: T,
1541
+ borderRadius: x.borderRadius,
1542
+ borderColor: x.borderColor,
1543
+ borderWidth: x.borderWidth,
1544
+ imageSrc: D,
1505
1545
  isTraveler: f
1506
- }, G = B;
1507
- let Ae, Ie;
1508
- const he = [];
1509
- return a.tagName.toLowerCase() !== "svg" && Array.from(a.childNodes).forEach((v) => {
1510
- const M = v.nodeType === Node.TEXT_NODE ? h : d, k = De(
1511
- v,
1546
+ }, $ = k;
1547
+ let ie, se;
1548
+ const z = [];
1549
+ return a.tagName.toLowerCase() !== "svg" && Array.from(a.childNodes).forEach((m) => {
1550
+ const R = m.nodeType === Node.TEXT_NODE ? h : d, F = Ie(
1551
+ m,
1512
1552
  e,
1513
- M,
1553
+ R,
1514
1554
  r,
1515
- I,
1516
- l,
1517
- v.nodeType === Node.TEXT_NODE ? x : void 0,
1518
- v.nodeType === Node.TEXT_NODE && Object.keys(m).length > 0 ? m : void 0
1555
+ T,
1556
+ c,
1557
+ m.nodeType === Node.TEXT_NODE ? b : void 0,
1558
+ m.nodeType === Node.TEXT_NODE && Object.keys(v).length > 0 ? v : void 0
1519
1559
  );
1520
- k && he.push(k);
1560
+ F && z.push(F);
1521
1561
  }), {
1522
- id: b,
1562
+ id: C,
1523
1563
  type: "BOX",
1524
1564
  element: a,
1525
1565
  rect: {
1526
- x: T.left + window.scrollX,
1527
- y: T.top + window.scrollY,
1528
- width: T.width,
1529
- height: T.height
1566
+ x: S.left + window.scrollX,
1567
+ y: S.top + window.scrollY,
1568
+ width: S.width,
1569
+ height: S.height
1530
1570
  },
1531
- styles: G,
1532
- textContent: Ae,
1533
- textStyles: Ie,
1571
+ styles: $,
1572
+ textContent: ie,
1573
+ textStyles: se,
1534
1574
  dirtyMask: e,
1535
1575
  visibility: h,
1536
1576
  isTraveler: f,
1537
1577
  captureLayer: r,
1538
- nativeLayer: x,
1539
- nativeStyles: x !== void 0 ? be(q({}, B), {
1540
- backgroundColor: (de = m.backgroundColor) != null ? de : B.backgroundColor,
1541
- backgroundImage: (ue = m.backgroundImage) != null ? ue : B.backgroundImage,
1542
- opacity: (fe = m.opacity) != null ? fe : B.opacity,
1543
- zIndex: m.zIndex !== void 0 ? m.zIndex + I : B.zIndex,
1544
- borderRadius: (ge = m.borderRadius) != null ? ge : B.borderRadius,
1545
- borderColor: (pe = m.borderColor) != null ? pe : B.borderColor,
1546
- borderWidth: (me = m.borderWidth) != null ? me : B.borderWidth,
1547
- isTraveler: B.isTraveler,
1548
- transform: m.transform
1578
+ nativeLayer: b,
1579
+ nativeStyles: b !== void 0 ? xe(J({}, k), {
1580
+ backgroundColor: (N = v.backgroundColor) != null ? N : k.backgroundColor,
1581
+ backgroundImage: (Z = v.backgroundImage) != null ? Z : k.backgroundImage,
1582
+ opacity: (ne = v.opacity) != null ? ne : k.opacity,
1583
+ zIndex: v.zIndex !== void 0 ? v.zIndex + T : k.zIndex,
1584
+ borderRadius: (oe = v.borderRadius) != null ? oe : k.borderRadius,
1585
+ borderColor: (B = v.borderColor) != null ? B : k.borderColor,
1586
+ borderWidth: (_ = v.borderWidth) != null ? _ : k.borderWidth,
1587
+ isTraveler: k.isTraveler,
1588
+ transform: v.transform
1549
1589
  }) : void 0,
1550
- nativeRect: x !== void 0 ? {
1551
- x: m.x !== void 0 ? parseFloat(m.x) : T.left + window.scrollX,
1552
- y: m.y !== void 0 ? parseFloat(m.y) : T.top + window.scrollY,
1553
- width: m.width !== void 0 ? parseFloat(m.width) : T.width,
1554
- height: m.height !== void 0 ? parseFloat(m.height) : T.height
1590
+ nativeRect: b !== void 0 ? {
1591
+ x: v.x !== void 0 ? parseFloat(v.x) : S.left + window.scrollX,
1592
+ y: v.y !== void 0 ? parseFloat(v.y) : S.top + window.scrollY,
1593
+ width: v.width !== void 0 ? parseFloat(v.width) : S.width,
1594
+ height: v.height !== void 0 ? parseFloat(v.height) : S.height
1555
1595
  } : void 0,
1556
- isFixed: E.position === "fixed",
1557
- children: he,
1558
- shaderHooks: L
1596
+ isFixed: x.position === "fixed",
1597
+ children: z,
1598
+ shaderHooks: M
1559
1599
  };
1560
1600
  }
1561
1601
  function it(s, e) {
1562
1602
  e.size !== 0 && e.forEach((t, r) => {
1563
- var l, n, o, a;
1603
+ var c, n, o, a;
1564
1604
  const i = s.get(r);
1565
- !i || !i.userData.basePosition || (z.forceUpdateUniforms(i.material, {
1605
+ !i || !i.userData.basePosition || (H.forceUpdateUniforms(i.material, {
1566
1606
  backgroundColor: t.backgroundColor,
1567
1607
  backgroundImage: t.backgroundImage,
1568
1608
  opacity: t.opacity,
1569
- borderRadius: (n = t.borderRadius) != null ? n : (l = i.userData.baseStyles) == null ? void 0 : l.borderRadius
1609
+ borderRadius: (n = t.borderRadius) != null ? n : (c = i.userData.baseStyles) == null ? void 0 : c.borderRadius
1570
1610
  // width and height are no longer updated here, they are updated in syncMeshesByDOM
1571
- }), i.userData.nativeMesh && z.forceUpdateUniforms(i.userData.nativeMesh.material, {
1611
+ }), i.userData.nativeMesh && H.forceUpdateUniforms(i.userData.nativeMesh.material, {
1572
1612
  backgroundColor: t.backgroundColor,
1573
1613
  backgroundImage: t.backgroundImage,
1574
1614
  opacity: t.opacity,
@@ -1585,19 +1625,19 @@ class st {
1585
1625
  g(this, "tracker");
1586
1626
  this.target = e, this.renderer = t, this.registry = r, this.tracker = new We(e, {
1587
1627
  resizeDebounce: i.resizeDebounce
1588
- }), this.tracker.onLayoutChange.add((l, n) => {
1628
+ }), this.tracker.onLayoutChange.add((c, n) => {
1589
1629
  document.querySelector(`[${O.NAME}~='${O.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1590
- const a = De(
1630
+ const a = Ie(
1591
1631
  this.target,
1592
- l,
1593
- W,
1632
+ c,
1633
+ q,
1594
1634
  1,
1595
1635
  0,
1596
1636
  this.renderer.qualityFactor
1597
1637
  );
1598
1638
  a && this.renderer.syncScene(a, n);
1599
- }), this.tracker.onStyleChange.add((l) => {
1600
- it(this.registry, l);
1639
+ }), this.tracker.onStyleChange.add((c) => {
1640
+ it(this.registry, c);
1601
1641
  }), this.tracker.onRender.add(() => {
1602
1642
  this.renderer.syncMeshesByDOM(), this.renderer.render();
1603
1643
  });
@@ -1634,23 +1674,23 @@ class nt {
1634
1674
  this.store.delete(e);
1635
1675
  }
1636
1676
  }
1637
- class lt {
1677
+ class ct {
1638
1678
  constructor(e, t) {
1639
1679
  g(this, "renderer");
1640
1680
  g(this, "syncer");
1641
1681
  g(this, "target");
1642
1682
  g(this, "registry");
1643
- var i, l, n;
1683
+ var i, c, n;
1644
1684
  if (this.target = e, this.registry = new nt(), !document.getElementById("mirage-engine-styles")) {
1645
1685
  const o = document.createElement("style");
1646
1686
  o.id = "mirage-engine-styles", o.textContent = `
1647
- [${P.NAME}="${P.VALUES.HIDE}"] {
1687
+ [${K.NAME}="${K.VALUES.HIDE}"] {
1648
1688
  opacity: 0 !important;
1649
1689
  }
1650
1690
  `, document.head.appendChild(o);
1651
1691
  }
1652
1692
  let r;
1653
- 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)
1693
+ 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)
1654
1694
  throw new Error("[Mirage] Cannot find a container (parent or option).");
1655
1695
  this.renderer = new tt(
1656
1696
  this.target,
@@ -1689,10 +1729,10 @@ class lt {
1689
1729
  ArrowUp: !1,
1690
1730
  ArrowDown: !1
1691
1731
  };
1692
- window.addEventListener("keydown", (l) => {
1693
- t[l.key] !== void 0 && (t[l.key] = !0);
1694
- }), window.addEventListener("keyup", (l) => {
1695
- t[l.key] !== void 0 && (t[l.key] = !1);
1732
+ window.addEventListener("keydown", (c) => {
1733
+ t[c.key] !== void 0 && (t[c.key] = !0);
1734
+ }), window.addEventListener("keyup", (c) => {
1735
+ t[c.key] !== void 0 && (t[c.key] = !1);
1696
1736
  });
1697
1737
  const r = 2, i = () => {
1698
1738
  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);
@@ -1701,25 +1741,25 @@ class lt {
1701
1741
  }
1702
1742
  }
1703
1743
  export {
1704
- Ee as ALLOWED_FILTERS,
1705
- P as ATTR_DOM,
1706
- X as ATTR_FILTER,
1744
+ Se as ALLOWED_FILTERS,
1745
+ K as ATTR_DOM,
1746
+ W as ATTR_FILTER,
1707
1747
  at as ATTR_SANDWICH,
1708
- Y as ATTR_SELECT,
1748
+ G as ATTR_SELECT,
1709
1749
  Xe as ATTR_SHADER,
1710
1750
  O as ATTR_TRAVEL,
1711
- ce as DIRTY_CONTENT,
1712
- re as DIRTY_NONE,
1713
- $ as DIRTY_RECT,
1714
- ie as DIRTY_STRUCTURE,
1715
- Z as DIRTY_STYLE,
1751
+ ve as DIRTY_CONTENT,
1752
+ de as DIRTY_NONE,
1753
+ Q as DIRTY_RECT,
1754
+ ue as DIRTY_STRUCTURE,
1755
+ le as DIRTY_STYLE,
1716
1756
  ze as DIRTY_ZINDEX,
1717
- ct as EXCLUDED,
1718
- lt as Engine,
1719
- K as SELECT_LAYER,
1720
- A as THREE_LAYERS,
1721
- xe as TRAVEL_VALUES,
1757
+ lt as EXCLUDED,
1758
+ ct as Engine,
1759
+ te as SELECT_LAYER,
1760
+ U as THREE_LAYERS,
1761
+ Ce as TRAVEL_VALUES,
1722
1762
  We as Tracker,
1723
- W as USER_LAYER,
1763
+ q as USER_LAYER,
1724
1764
  Ye as extractFromStyle
1725
1765
  };