mirage-engine 0.3.18 → 0.3.19

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,31 +1,31 @@
1
1
  var Xe = Object.defineProperty, Ve = Object.defineProperties;
2
2
  var Ye = Object.getOwnPropertyDescriptors;
3
3
  var Ee = Object.getOwnPropertySymbols;
4
- var Pe = Object.prototype.hasOwnProperty, We = Object.prototype.propertyIsEnumerable;
4
+ var We = Object.prototype.hasOwnProperty, He = Object.prototype.propertyIsEnumerable;
5
5
  var ye = (s, e, t) => e in s ? Xe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, te = (s, e) => {
6
6
  for (var t in e || (e = {}))
7
- Pe.call(e, t) && ye(s, t, e[t]);
7
+ We.call(e, t) && ye(s, t, e[t]);
8
8
  if (Ee)
9
9
  for (var t of Ee(e))
10
- We.call(e, t) && ye(s, t, e[t]);
10
+ He.call(e, t) && ye(s, t, e[t]);
11
11
  return s;
12
12
  }, Ce = (s, e) => Ve(s, Ye(e));
13
13
  var u = (s, e, t) => (ye(s, typeof e != "symbol" ? e + "" : e, t), t);
14
14
  var Te = (s, e, t) => new Promise((i, r) => {
15
- var l = (c) => {
15
+ var c = (l) => {
16
16
  try {
17
- o(t.next(c));
18
- } catch (a) {
19
- r(a);
17
+ a(t.next(l));
18
+ } catch (o) {
19
+ r(o);
20
20
  }
21
- }, n = (c) => {
21
+ }, n = (l) => {
22
22
  try {
23
- o(t.throw(c));
24
- } catch (a) {
25
- r(a);
23
+ a(t.throw(l));
24
+ } catch (o) {
25
+ r(o);
26
26
  }
27
- }, o = (c) => c.done ? i(c.value) : Promise.resolve(c.value).then(l, n);
28
- o((t = t.apply(s, e)).next());
27
+ }, a = (l) => l.done ? i(l.value) : Promise.resolve(l.value).then(c, n);
28
+ a((t = t.apply(s, e)).next());
29
29
  });
30
30
  import * as w from "three";
31
31
  const Ie = {
@@ -59,7 +59,7 @@ const Ie = {
59
59
  KEY: "mirageTravel",
60
60
  VALUES: Re,
61
61
  MAX_LAYERS: Object.keys(Re).length - 1
62
- }, H = {
62
+ }, P = {
63
63
  NAME: "data-mirage-filter",
64
64
  KEY: "mirageFilter",
65
65
  VALUES: Ie
@@ -67,7 +67,7 @@ const Ie = {
67
67
  NAME: "data-mirage-select",
68
68
  KEY: "mirageSelect",
69
69
  VALUES: Ie
70
- }, He = {
70
+ }, Pe = {
71
71
  NAME: "data-mirage-shader",
72
72
  KEY: "mirageShader"
73
73
  }, Le = {
@@ -143,32 +143,32 @@ class Be {
143
143
  this.pendingMask |= re, this.isDomDirty = !0, this.scrollTimer = null;
144
144
  }, 150)), this.pendingStyles.size > 0 && (this.onStyleChange.forEach((i) => i(this.pendingStyles)), this.pendingStyles.clear()), this.onRender.forEach((i) => i()), requestAnimationFrame(this.renderLoop);
145
145
  });
146
- var r, l;
146
+ var r, c;
147
147
  this.target = e;
148
148
  const i = (r = t.resizeDebounce) != null ? r : !0;
149
149
  i === !1 ? this.resizeConfig = { enabled: !1, delay: 0 } : i === !0 ? this.resizeConfig = { enabled: !0, delay: 150 } : this.resizeConfig = {
150
150
  enabled: !0,
151
- delay: (l = i.delay) != null ? l : 150,
151
+ delay: (c = i.delay) != null ? c : 150,
152
152
  onStart: i.onStart,
153
153
  onEnd: i.onEnd
154
154
  }, this.observer = new MutationObserver((n) => {
155
- let o = ge;
156
- for (const c of n)
157
- if (c.type === "childList")
158
- o |= pe, c.removedNodes.length > 0 && c.removedNodes.forEach((a) => {
159
- a instanceof HTMLElement && this.pendingDeletions.add(a);
155
+ let a = ge;
156
+ for (const l of n)
157
+ if (l.type === "childList")
158
+ a |= pe, l.removedNodes.length > 0 && l.removedNodes.forEach((o) => {
159
+ o instanceof HTMLElement && this.pendingDeletions.add(o);
160
160
  });
161
- else if (c.type === "attributes")
162
- if (c.attributeName === "style") {
163
- o |= re | ue;
164
- const a = c.target, f = qe(a.style);
165
- this.pendingStyles.set(a, f);
161
+ else if (l.type === "attributes")
162
+ if (l.attributeName === "style") {
163
+ a |= re | ue;
164
+ const o = l.target, f = qe(o.style);
165
+ this.pendingStyles.set(o, f);
166
166
  } else
167
- c.attributeName === "class" ? o |= re | ue : c.attributeName && c.attributeName.startsWith("data-") && (o |= re | ue, c.attributeName.startsWith("data-mirage") && (o |= pe));
167
+ l.attributeName === "class" ? a |= re | ue : l.attributeName && l.attributeName.startsWith("data-") && (a |= re | ue, l.attributeName.startsWith("data-mirage") && (a |= pe));
168
168
  else
169
- c.type === "characterData" && (o |= be | re);
170
- if (o !== ge) {
171
- if (this.pendingMask |= o, o & pe) {
169
+ l.type === "characterData" && (a |= be | re);
170
+ if (a !== ge) {
171
+ if (this.pendingMask |= a, a & pe) {
172
172
  this.clearTimers(), this.isDomDirty = !0;
173
173
  return;
174
174
  }
@@ -198,7 +198,7 @@ const G = 1, ae = 2, O = {
198
198
  SELECTED: 1,
199
199
  getCaptureLayer: (s) => 31 - s,
200
200
  HIDDEN: 31
201
- }, Me = Object.values(H.VALUES);
201
+ }, Me = Object.values(P.VALUES);
202
202
  class Ue {
203
203
  /**
204
204
  * Calculates or retrieves the exact alphabetic baseline (in pixels) for the given font.
@@ -216,13 +216,13 @@ class Ue {
216
216
  return 0;
217
217
  const t = document.createElement("div"), i = document.createElement("span"), r = document.createElement("img");
218
218
  t.style.visibility = "hidden", t.style.position = "absolute", t.style.top = "0px", t.style.left = "0px", t.style.font = e, t.style.margin = "0", t.style.padding = "0", t.style.border = "none", i.style.margin = "0", i.style.padding = "0", i.style.border = "none", i.style.lineHeight = "normal", r.width = 1, r.height = 1, r.style.verticalAlign = "baseline", i.appendChild(document.createTextNode("Hidden Text")), t.appendChild(i), t.appendChild(r), document.body.appendChild(t);
219
- const l = r.offsetTop - i.offsetTop;
220
- return document.body.removeChild(t), l;
219
+ const c = r.offsetTop - i.offsetTop;
220
+ return document.body.removeChild(t), c;
221
221
  }
222
222
  }
223
223
  u(Ue, "cache", /* @__PURE__ */ new Map());
224
224
  class je extends w.MeshBasicMaterial {
225
- constructor(t, i, r, l, n = 2) {
225
+ constructor(t, i, r, c, n = 2) {
226
226
  super({
227
227
  transparent: !0,
228
228
  side: w.FrontSide,
@@ -233,29 +233,29 @@ class je extends w.MeshBasicMaterial {
233
233
  u(this, "qualityFactor");
234
234
  if (this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d"), !this.ctx)
235
235
  throw new Error("[Mirage] Failed to create canvas context");
236
- this.qualityFactor = n, this.map = new w.CanvasTexture(this.canvas), this.map.colorSpace = w.LinearSRGBColorSpace, this.map.minFilter = w.LinearFilter, this.map.magFilter = w.LinearFilter, this.updateText(t, i, r, l);
236
+ this.qualityFactor = n, this.map = new w.CanvasTexture(this.canvas), this.map.colorSpace = w.LinearSRGBColorSpace, this.map.minFilter = w.LinearFilter, this.map.magFilter = w.LinearFilter, this.updateText(t, i, r, c);
237
237
  }
238
238
  wrapText(t, i) {
239
239
  const r = t.split(`
240
- `), l = [];
240
+ `), c = [];
241
241
  return r.forEach((n) => {
242
- const o = n.match(/[^\s\-]+\-?|\-|\s+/g) || [];
243
- if (o.length === 0) {
244
- l.push("");
242
+ const a = n.match(/[^\s\-]+\-?|\-|\s+/g) || [];
243
+ if (a.length === 0) {
244
+ c.push("");
245
245
  return;
246
246
  }
247
- let c = o[0];
248
- for (let a = 1; a < o.length; a++) {
249
- const f = o[a];
250
- this.ctx.measureText(c + f).width <= i + 2 ? c += f : (c && l.push(c), c = f.trimStart());
247
+ let l = a[0];
248
+ for (let o = 1; o < a.length; o++) {
249
+ const f = a[o];
250
+ this.ctx.measureText(l + f).width <= i + 2 ? l += f : (l && c.push(l), l = f.trimStart());
251
251
  }
252
- c && l.push(c);
253
- }), l;
252
+ l && c.push(l);
253
+ }), c;
254
254
  }
255
- updateText(t, i, r, l, n) {
255
+ updateText(t, i, r, c, n) {
256
256
  n !== void 0 && (this.qualityFactor = n);
257
- const c = (window.devicePixelRatio || 1) * this.qualityFactor, a = r * c, f = l * c;
258
- this.canvas.width !== a || this.canvas.height !== f ? (this.canvas.width = a, this.canvas.height = f) : this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.setTransform(c, 0, 0, c, 0, 0), this.ctx.font = i.font, this.ctx.fillStyle = i.color, this.ctx.textBaseline = "alphabetic", this.ctx.globalAlpha = 1;
257
+ const l = (window.devicePixelRatio || 1) * this.qualityFactor, o = r * l, f = c * l;
258
+ this.canvas.width !== o || this.canvas.height !== f ? (this.canvas.width = o, this.canvas.height = f) : this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.setTransform(l, 0, 0, l, 0, 0), this.ctx.font = i.font, this.ctx.fillStyle = i.color, this.ctx.textBaseline = "alphabetic", this.ctx.globalAlpha = 1;
259
259
  const h = this.wrapText(t, r), d = i.lineHeight, p = Ue.getBaseline(i.font);
260
260
  h.forEach((g, M) => {
261
261
  const m = M * d + p;
@@ -267,21 +267,21 @@ class je extends w.MeshBasicMaterial {
267
267
  this.map && this.map.dispose(), super.dispose();
268
268
  }
269
269
  }
270
- function ce(s, e = 0) {
270
+ function le(s, e = 0) {
271
271
  if (typeof s == "number")
272
272
  return s;
273
273
  const t = parseFloat(s) || 0;
274
274
  return typeof s == "string" && s.includes("%") ? t / 100 * e : t;
275
275
  }
276
- function le(s) {
276
+ function ce(s) {
277
277
  if (!s || s === "transparent")
278
278
  return { color: new w.Color(16777215), alpha: 0 };
279
279
  const e = s.match(
280
280
  /rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/
281
281
  );
282
282
  if (e) {
283
- const t = parseInt(e[1], 10), i = parseInt(e[2], 10), r = parseInt(e[3], 10), l = e[4] !== void 0 ? parseFloat(e[4]) : 1;
284
- return { color: new w.Color(`rgb(${t}, ${i}, ${r})`), alpha: l };
283
+ const t = parseInt(e[1], 10), i = parseInt(e[2], 10), r = parseInt(e[3], 10), c = e[4] !== void 0 ? parseFloat(e[4]) : 1;
284
+ return { color: new w.Color(`rgb(${t}, ${i}, ${r})`), alpha: c };
285
285
  }
286
286
  return { color: new w.Color(s), alpha: 1 };
287
287
  }
@@ -289,16 +289,16 @@ function Oe(s) {
289
289
  const e = [];
290
290
  let t = "", i = 0;
291
291
  for (let r = 0; r < s.length; r++) {
292
- const l = s[r];
293
- if (l === "(")
292
+ const c = s[r];
293
+ if (c === "(")
294
294
  i++;
295
- else if (l === ")")
295
+ else if (c === ")")
296
296
  i--;
297
- else if (l === "," && i === 0) {
297
+ else if (c === "," && i === 0) {
298
298
  e.push(t.trim()), t = "";
299
299
  continue;
300
300
  }
301
- t += l;
301
+ t += c;
302
302
  }
303
303
  return t && e.push(t.trim()), e;
304
304
  }
@@ -309,47 +309,47 @@ function Ke(s) {
309
309
  if (!e)
310
310
  return null;
311
311
  const t = e[1], i = Oe(t);
312
- let r = Math.PI, l = 0;
312
+ let r = Math.PI, c = 0;
313
313
  const n = i[0].trim();
314
314
  if (n.startsWith("to "))
315
- n === "to top" ? r = 0 : n === "to right" ? r = Math.PI / 2 : n === "to bottom" ? r = Math.PI : n === "to left" ? r = Math.PI * 1.5 : n === "to top right" || n === "to right top" ? r = Math.PI / 4 : n === "to bottom right" || n === "to right bottom" ? r = Math.PI * 0.75 : n === "to bottom left" || n === "to left bottom" ? r = Math.PI * 1.25 : (n === "to top left" || n === "to left top") && (r = Math.PI * 1.75), l = 1;
315
+ n === "to top" ? r = 0 : n === "to right" ? r = Math.PI / 2 : n === "to bottom" ? r = Math.PI : n === "to left" ? r = Math.PI * 1.5 : n === "to top right" || n === "to right top" ? r = Math.PI / 4 : n === "to bottom right" || n === "to right bottom" ? r = Math.PI * 0.75 : n === "to bottom left" || n === "to left bottom" ? r = Math.PI * 1.25 : (n === "to top left" || n === "to left top") && (r = Math.PI * 1.75), c = 1;
316
316
  else if (n.endsWith("deg") || n.endsWith("rad") || n.endsWith("turn")) {
317
- const c = parseFloat(n);
318
- n.endsWith("deg") ? r = c * (Math.PI / 180) : n.endsWith("rad") ? r = c : n.endsWith("turn") && (r = c * Math.PI * 2), l = 1;
319
- }
320
- const o = [];
321
- for (let c = l; c < i.length && !(o.length >= 8); c++) {
322
- const a = i[c].trim(), f = a.lastIndexOf(" ");
323
- let h = a, d = null;
324
- if (f !== -1 && !a.endsWith(")")) {
325
- const g = a.substring(f + 1);
326
- (g.endsWith("%") || g.endsWith("px") || !isNaN(parseFloat(g))) && (h = a.substring(0, f).trim(), d = g);
317
+ const l = parseFloat(n);
318
+ n.endsWith("deg") ? r = l * (Math.PI / 180) : n.endsWith("rad") ? r = l : n.endsWith("turn") && (r = l * Math.PI * 2), c = 1;
319
+ }
320
+ const a = [];
321
+ for (let l = c; l < i.length && !(a.length >= 8); l++) {
322
+ const o = i[l].trim(), f = o.lastIndexOf(" ");
323
+ let h = o, d = null;
324
+ if (f !== -1 && !o.endsWith(")")) {
325
+ const g = o.substring(f + 1);
326
+ (g.endsWith("%") || g.endsWith("px") || !isNaN(parseFloat(g))) && (h = o.substring(0, f).trim(), d = g);
327
327
  }
328
- const p = le(h);
329
- o.push({
328
+ const p = ce(h);
329
+ a.push({
330
330
  color: p.color,
331
331
  alpha: p.alpha,
332
332
  rawStop: d,
333
333
  stop: 0
334
334
  });
335
335
  }
336
- if (o.length > 0) {
337
- for (let a = 0; a < o.length; a++)
338
- o[a].rawStop !== null && (o[a].stop = parseFloat(o[a].rawStop) / 100);
339
- o[0].rawStop === null && (o[0].stop = 0), o.length > 1 && o[o.length - 1].rawStop === null && (o[o.length - 1].stop = 1);
340
- let c = 0;
341
- for (let a = 1; a < o.length; a++)
342
- if (o[a].rawStop !== null || a === o.length - 1) {
343
- const f = a - c;
336
+ if (a.length > 0) {
337
+ for (let o = 0; o < a.length; o++)
338
+ a[o].rawStop !== null && (a[o].stop = parseFloat(a[o].rawStop) / 100);
339
+ a[0].rawStop === null && (a[0].stop = 0), a.length > 1 && a[a.length - 1].rawStop === null && (a[a.length - 1].stop = 1);
340
+ let l = 0;
341
+ for (let o = 1; o < a.length; o++)
342
+ if (a[o].rawStop !== null || o === a.length - 1) {
343
+ const f = o - l;
344
344
  if (f > 1) {
345
- const h = o[c].stop, p = (o[a].stop - h) / f;
345
+ const h = a[l].stop, p = (a[o].stop - h) / f;
346
346
  for (let g = 1; g < f; g++)
347
- o[c + g].stop = h + p * g;
347
+ a[l + g].stop = h + p * g;
348
348
  }
349
- c = a;
349
+ l = o;
350
350
  }
351
351
  }
352
- return { angle: r, stops: o };
352
+ return { angle: r, stops: a };
353
353
  }
354
354
  function Je(s) {
355
355
  if (!s || s === "none")
@@ -358,14 +358,14 @@ function Je(s) {
358
358
  if (e.length === 0)
359
359
  return null;
360
360
  const t = e[0].trim(), i = /(rgba?\([^)]+\)|#[0-9a-fA-F]+|[a-zA-Z]+)/, r = t.match(i);
361
- let l = "transparent", n = t;
361
+ let c = "transparent", n = t;
362
362
  if (r && r[1] !== "inset") {
363
363
  const p = r[1];
364
- (p.startsWith("rgb") || p.startsWith("#") || p === "black" || p === "white" || p === "transparent") && (l = p, n = t.replace(p, "").trim());
364
+ (p.startsWith("rgb") || p.startsWith("#") || p === "black" || p === "white" || p === "transparent") && (c = p, n = t.replace(p, "").trim());
365
365
  }
366
366
  n = n.replace("inset", "").trim();
367
- const o = n.split(/\s+/).map((p) => parseFloat(p) || 0), c = o[0] || 0, a = o[1] || 0, f = o[2] || 0, h = o[3] || 0, d = le(l);
368
- return { offsetX: c, offsetY: a, blurRadius: f, spreadRadius: h, color: d.color, alpha: d.alpha };
367
+ const a = n.split(/\s+/).map((p) => parseFloat(p) || 0), l = a[0] || 0, o = a[1] || 0, f = a[2] || 0, h = a[3] || 0, d = ce(c);
368
+ return { offsetX: l, offsetY: o, blurRadius: f, spreadRadius: h, color: d.color, alpha: d.alpha };
369
369
  }
370
370
  const Ze = `varying vec2 vUv;
371
371
  varying vec4 vScreenPos;
@@ -549,23 +549,23 @@ baseColor = blendSrcOver(baseColor, texColor);`, De = {
549
549
  };
550
550
  function it(s, e, t, i = null, r) {
551
551
  var C;
552
- const l = i !== null || !!s.imageSrc;
552
+ const c = i !== null || !!s.imageSrc;
553
553
  let n = "";
554
- const o = {};
554
+ const a = {};
555
555
  if (r != null && r.uniforms)
556
556
  for (const [b, S] of Object.entries(r.uniforms))
557
557
  typeof S == "number" ? (n += `uniform float ${b};
558
- `, o[b] = { value: S }) : Array.isArray(S) ? S.length === 2 ? (n += `uniform vec2 ${b};
559
- `, o[b] = { value: new w.Vector2(...S) }) : S.length === 3 ? (n += `uniform vec3 ${b};
560
- `, o[b] = { value: new w.Vector3(...S) }) : S.length === 4 && (n += `uniform vec4 ${b};
561
- `, o[b] = { value: new w.Vector4(...S) }) : (n += `uniform float ${b};
562
- `, o[b] = { value: S });
563
- const c = r !== void 0, a = (l || c ? Ae.declChunk : "") + `
558
+ `, a[b] = { value: S }) : Array.isArray(S) ? S.length === 2 ? (n += `uniform vec2 ${b};
559
+ `, a[b] = { value: new w.Vector2(...S) }) : S.length === 3 ? (n += `uniform vec3 ${b};
560
+ `, a[b] = { value: new w.Vector3(...S) }) : S.length === 4 && (n += `uniform vec4 ${b};
561
+ `, a[b] = { value: new w.Vector4(...S) }) : (n += `uniform float ${b};
562
+ `, a[b] = { value: S });
563
+ const l = r !== void 0, o = (c || l ? Ae.declChunk : "") + `
564
564
  ` + n, f = `vec2 screenUv = (vScreenPos.xy / vScreenPos.w) * 0.5 + 0.5;
565
565
  `, h = s.isTraveler ? `vec2 resultUv = screenUv;
566
566
  ` : `vec2 localUv = (p / uSize) + 0.5;
567
567
  vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
568
- `, d = l || c ? f + h + ((r == null ? void 0 : r.uvModifier) || "") : "", p = l || c ? Ae.baseColorChunk : "", g = (r == null ? void 0 : r.colorModifier) || "", M = De.fragmentShader.replace("#INJECT_DECLARATIONS", a).replace("#INJECT_UV_MODIFIER", d).replace("#INJECT_BASE_COLOR", p).replace("#INJECT_COLOR_MODIFIER", g), m = le(s.backgroundColor), y = le(s.borderColor), E = {
568
+ `, d = c || l ? f + h + ((r == null ? void 0 : r.uvModifier) || "") : "", p = c || l ? Ae.baseColorChunk : "", g = (r == null ? void 0 : r.colorModifier) || "", M = De.fragmentShader.replace("#INJECT_DECLARATIONS", o).replace("#INJECT_UV_MODIFIER", d).replace("#INJECT_BASE_COLOR", p).replace("#INJECT_COLOR_MODIFIER", g), m = ce(s.backgroundColor), y = ce(s.borderColor), E = {
569
569
  uSize: { value: new w.Vector2(e, t) },
570
570
  uMeshSize: { value: new w.Vector2(e, t) },
571
571
  uShadowColor: { value: new w.Vector4(0, 0, 0, 0) },
@@ -589,7 +589,7 @@ vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
589
589
  )
590
590
  },
591
591
  uBorderRadius: { value: new w.Vector4(0, 0, 0, 0) },
592
- uBorderWidth: { value: ce(s.borderWidth) },
592
+ uBorderWidth: { value: le(s.borderWidth) },
593
593
  uOpacity: { value: (C = s.opacity) != null ? C : 1 },
594
594
  uTexture: { value: null },
595
595
  uTextureRepeat: { value: new w.Vector2(1, 1) },
@@ -601,9 +601,9 @@ vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
601
601
  },
602
602
  uGradientStops: { value: new Float32Array(8) }
603
603
  };
604
- _e(E.uBorderRadius.value, s.borderRadius, Math.min(e, t)), l && (E.uTexture.value = i);
604
+ _e(E.uBorderRadius.value, s.borderRadius, Math.min(e, t)), c && (E.uTexture.value = i);
605
605
  const A = new w.ShaderMaterial({
606
- uniforms: te(te({}, E), o),
606
+ uniforms: te(te({}, E), a),
607
607
  vertexShader: De.vertexShader,
608
608
  fragmentShader: M,
609
609
  transparent: !0,
@@ -613,12 +613,12 @@ vec2 resultUv = localUv * uTextureRepeat + uTextureOffset;
613
613
  return s.backgroundImage && xe(A, { backgroundImage: s.backgroundImage }), A;
614
614
  }
615
615
  function st(s, e, t, i, r) {
616
- const l = ce(e.borderWidth);
616
+ const c = le(e.borderWidth);
617
617
  xe(s, {
618
618
  width: t,
619
619
  height: i,
620
620
  borderRadius: e.borderRadius,
621
- borderWidth: l,
621
+ borderWidth: c,
622
622
  backgroundColor: e.backgroundColor,
623
623
  borderColor: e.borderColor,
624
624
  opacity: e.opacity,
@@ -628,14 +628,14 @@ function st(s, e, t, i, r) {
628
628
  });
629
629
  }
630
630
  function xe(s, e) {
631
- var i, r, l;
631
+ var i, r, c;
632
632
  if (e.boxShadow !== void 0) {
633
633
  const n = Je(e.boxShadow);
634
634
  n ? (s.uniforms.uShadowColor.value.set(n.color.r, n.color.g, n.color.b, n.alpha), s.uniforms.uShadowOffset.value.set(n.offsetX, n.offsetY), s.uniforms.uShadowBlur.value = n.blurRadius, s.uniforms.uShadowSpread.value = n.spreadRadius, s.userData.shadowPadding = n.blurRadius + n.spreadRadius + Math.max(Math.abs(n.offsetX), Math.abs(n.offsetY))) : (s.uniforms.uShadowColor.value.w = 0, s.userData.shadowPadding = 0);
635
635
  }
636
636
  if (e.width !== void 0 && e.height !== void 0 && s.uniforms.uSize.value.set(e.width, e.height), s.uniforms.uMeshSize) {
637
- const n = s.userData.shadowPadding || 0, o = e.width !== void 0 ? e.width : s.uniforms.uSize.value.x, c = e.height !== void 0 ? e.height : s.uniforms.uSize.value.y;
638
- s.uniforms.uMeshSize.value.set(o + n * 2, c + n * 2);
637
+ const n = s.userData.shadowPadding || 0, a = e.width !== void 0 ? e.width : s.uniforms.uSize.value.x, l = e.height !== void 0 ? e.height : s.uniforms.uSize.value.y;
638
+ s.uniforms.uMeshSize.value.set(a + n * 2, l + n * 2);
639
639
  }
640
640
  if (e.borderRadius !== void 0) {
641
641
  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);
@@ -651,7 +651,7 @@ function xe(s, e) {
651
651
  n
652
652
  );
653
653
  } else if (typeof e.backgroundColor == "string") {
654
- const n = le(e.backgroundColor);
654
+ const n = ce(e.backgroundColor);
655
655
  s.uniforms.uBgColor.value.set(
656
656
  n.color.r,
657
657
  n.color.g,
@@ -677,7 +677,7 @@ function xe(s, e) {
677
677
  n
678
678
  );
679
679
  } else if (typeof e.borderColor == "string") {
680
- const n = le(e.borderColor);
680
+ const n = ce(e.borderColor);
681
681
  s.uniforms.uBorderColor.value.set(
682
682
  n.color.r,
683
683
  n.color.g,
@@ -696,9 +696,9 @@ function xe(s, e) {
696
696
  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);
697
697
  const t = e.texture !== void 0 ? e.texture : (i = s.uniforms.uTexture) == null ? void 0 : i.value;
698
698
  if (t && (t.image instanceof ImageBitmap || t.image instanceof HTMLImageElement || t.image instanceof HTMLCanvasElement)) {
699
- const n = t.image.naturalWidth || t.image.videoWidth || t.image.width, o = t.image.naturalHeight || t.image.videoHeight || t.image.height, c = (r = e.width) != null ? r : s.uniforms.uSize.value.x, a = (l = e.height) != null ? l : s.uniforms.uSize.value.y;
700
- if (n && o && c && a) {
701
- const f = n / o, h = c / a;
699
+ const n = t.image.naturalWidth || t.image.videoWidth || t.image.width, a = t.image.naturalHeight || t.image.videoHeight || t.image.height, l = (r = e.width) != null ? r : s.uniforms.uSize.value.x, o = (c = e.height) != null ? c : s.uniforms.uSize.value.y;
700
+ if (n && a && l && o) {
701
+ const f = n / a, h = l / o;
702
702
  if (f > h) {
703
703
  const d = h / f;
704
704
  s.uniforms.uTextureRepeat.value.set(d, 1), s.uniforms.uTextureOffset.value.set((1 - d) / 2, 0);
@@ -713,17 +713,17 @@ function xe(s, e) {
713
713
  const n = Ke(e.backgroundImage);
714
714
  if (n) {
715
715
  s.uniforms.uGradientCount.value = n.stops.length, s.uniforms.uGradientAngle.value = n.angle;
716
- for (let o = 0; o < 8; o++)
717
- if (o < n.stops.length) {
718
- const c = n.stops[o];
719
- s.uniforms.uGradientColors.value[o].set(
720
- c.color.r,
721
- c.color.g,
722
- c.color.b,
723
- c.alpha
724
- ), s.uniforms.uGradientStops.value[o] = c.stop;
716
+ for (let a = 0; a < 8; a++)
717
+ if (a < n.stops.length) {
718
+ const l = n.stops[a];
719
+ s.uniforms.uGradientColors.value[a].set(
720
+ l.color.r,
721
+ l.color.g,
722
+ l.color.b,
723
+ l.alpha
724
+ ), s.uniforms.uGradientStops.value[a] = l.stop;
725
725
  } else
726
- s.uniforms.uGradientColors.value[o].set(0, 0, 0, 0), s.uniforms.uGradientStops.value[o] = 1;
726
+ s.uniforms.uGradientColors.value[a].set(0, 0, 0, 0), s.uniforms.uGradientStops.value[a] = 1;
727
727
  } else
728
728
  s.uniforms.uGradientCount.value = 0;
729
729
  }
@@ -731,7 +731,7 @@ function xe(s, e) {
731
731
  n !== "width" && n !== "height" && n !== "borderRadius" && n !== "borderWidth" && n !== "backgroundColor" && n !== "borderColor" && n !== "opacity" && n !== "bgOpacity" && n !== "borderOpacity" && n !== "texture" && n !== "backgroundImage" && n !== "boxShadow" && 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]);
732
732
  }
733
733
  function _e(s, e, t = 0) {
734
- var c, a, f, h;
734
+ var l, o, f, h;
735
735
  if (e == null) {
736
736
  s.set(0, 0, 0, 0);
737
737
  return;
@@ -744,37 +744,37 @@ function _e(s, e, t = 0) {
744
744
  s.set(e[0], e[1], e[2], e[3]);
745
745
  return;
746
746
  }
747
- const i = e.split("/")[0].trim().split(/\s+/), r = ce(i[0], t), l = ce((c = i[1]) != null ? c : i[0], t), n = ce((a = i[2]) != null ? a : i[0], t), o = ce((h = (f = i[3]) != null ? f : i[1]) != null ? h : i[0], t);
748
- s.set(r, l, n, o);
747
+ const i = e.split("/")[0].trim().split(/\s+/), r = le(i[0], t), c = le((l = i[1]) != null ? l : i[0], t), n = le((o = i[2]) != null ? o : i[0], t), a = le((h = (f = i[3]) != null ? f : i[1]) != null ? h : i[0], t);
748
+ s.set(r, c, n, a);
749
749
  }
750
- const P = {
751
- create(s, e, t, i, r, l = 2, n = null, o) {
750
+ const W = {
751
+ create(s, e, t, i, r, c = 2, n = null, a) {
752
752
  return s === "BOX" ? it(
753
753
  e,
754
754
  i,
755
755
  r,
756
756
  n,
757
- o
757
+ a
758
758
  ) : s === "TEXT" ? new je(
759
759
  t || "",
760
760
  e,
761
761
  i,
762
762
  r,
763
- l
763
+ c
764
764
  ) : new w.MeshBasicMaterial({ visible: !1 });
765
765
  },
766
- update(s, e, t, i, r, l, n = 2, o) {
766
+ update(s, e, t, i, r, c, n = 2, a) {
767
767
  e === "BOX" ? st(
768
768
  s,
769
769
  t,
770
770
  r,
771
- l,
772
- o
771
+ c,
772
+ a
773
773
  ) : e === "TEXT" && s.updateText(
774
774
  i || "",
775
775
  t,
776
776
  r,
777
- l,
777
+ c,
778
778
  n
779
779
  );
780
780
  },
@@ -792,8 +792,8 @@ class nt {
792
792
  this.onUpdate = e, t && (this.observer = new IntersectionObserver(
793
793
  (i) => {
794
794
  for (const r of i) {
795
- const l = r.target;
796
- r.isIntersecting ? this.loadTexture(l) : this.disposeTexture(l);
795
+ const c = r.target;
796
+ r.isIntersecting ? this.loadTexture(c) : this.disposeTexture(c);
797
797
  }
798
798
  },
799
799
  { rootMargin: "300px" }
@@ -817,9 +817,9 @@ class nt {
817
817
  try {
818
818
  let i;
819
819
  if (t.startsWith("data:image/svg+xml"))
820
- i = yield new Promise((l, n) => {
821
- const o = new Image();
822
- o.onload = () => l(o), o.onerror = n, o.src = t;
820
+ i = yield new Promise((c, n) => {
821
+ const a = new Image();
822
+ a.onload = () => c(a), a.onerror = n, a.src = t;
823
823
  });
824
824
  else {
825
825
  const n = yield (yield fetch(t)).blob();
@@ -875,15 +875,15 @@ class ot {
875
875
  u(this, "textureManager");
876
876
  // private meshMap: Map<HTMLElement, THREE.Mesh> = new Map();
877
877
  u(this, "fixedMeshes", /* @__PURE__ */ new Set());
878
- var o, c, a, f, h;
879
- this.target = e, this.mountContainer = i, this.registry = r, this.mode = (o = t.mode) != null ? o : "overlay", this.canvasSize = (c = t.canvasSize) != null ? c : "viewport", this.clipArea = (a = t.travelerClipArea) != null ? a : 1, this.targetLayer = (f = t.layer) != null ? f : "base", this.textureManager = new nt((d, p) => {
878
+ var a, l, o, f, h;
879
+ this.target = e, this.mountContainer = i, this.registry = r, this.mode = (a = t.mode) != null ? a : "overlay", this.canvasSize = (l = t.canvasSize) != null ? l : "viewport", this.clipArea = (o = t.travelerClipArea) != null ? o : 1, this.targetLayer = (f = t.layer) != null ? f : "base", this.textureManager = new nt((d, p) => {
880
880
  const g = this.registry.get(d);
881
- g && g.material instanceof w.ShaderMaterial && P.forceUpdateUniforms(g.material, { texture: p });
881
+ g && g.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(g.material, { texture: p });
882
882
  }, this.isViewport), this.canvas = document.createElement("canvas"), this.scene = new w.Scene(), this.targetRect = this.target.getBoundingClientRect();
883
- const l = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, n = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
883
+ const c = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, n = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height;
884
884
  this.camera = new w.OrthographicCamera(
885
- l / -2,
886
- l / 2,
885
+ c / -2,
886
+ c / 2,
887
887
  n / 2,
888
888
  n / -2,
889
889
  1,
@@ -894,7 +894,7 @@ class ot {
894
894
  antialias: !0
895
895
  // [new]
896
896
  // premultipliedAlpha: true
897
- }), w.ColorManagement.enabled = !1, this.renderer.outputColorSpace = w.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(l, n), this.applyTextQuality((h = t.quality) != null ? h : "medium");
897
+ }), w.ColorManagement.enabled = !1, this.renderer.outputColorSpace = w.LinearSRGBColorSpace, this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(c, n), this.applyTextQuality((h = t.quality) != null ? h : "medium");
898
898
  }
899
899
  get isViewport() {
900
900
  return this.mode === "overlay" && this.canvasSize === "viewport";
@@ -950,12 +950,12 @@ class ot {
950
950
  updateUniforms(e, t) {
951
951
  const i = this.registry.get(e);
952
952
  i && (i.traverse((r) => {
953
- r.isMesh && r.material && P.forceUpdateUniforms(
953
+ r.isMesh && r.material && W.forceUpdateUniforms(
954
954
  r.material,
955
955
  t
956
956
  );
957
957
  }), i.userData.nativeMesh && i.userData.nativeMesh.traverse((r) => {
958
- r.isMesh && r.material && P.forceUpdateUniforms(
958
+ r.isMesh && r.material && W.forceUpdateUniforms(
959
959
  r.material,
960
960
  t
961
961
  );
@@ -971,8 +971,8 @@ class ot {
971
971
  this.camera.left = e / -2, this.camera.right = e / 2, this.camera.top = t / 2, this.camera.bottom = t / -2, this.camera.updateProjectionMatrix();
972
972
  }
973
973
  syncScene(e, t) {
974
- const i = this.target.getBoundingClientRect(), r = this.isViewport ? window.innerWidth + this.overscan * 2 : i.width, l = this.isViewport ? window.innerHeight + this.overscan * 2 : i.height, n = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, o = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, c = Math.abs(r - n) > 0.1 || Math.abs(l - o) > 0.1, a = this.mode === "overlay" && (Math.abs(i.top - this.targetRect.top) > 0.1 || Math.abs(i.left - this.targetRect.left) > 0.1);
975
- c ? (this.targetRect = i, this.setSize(r, l), this.updateCanvasLayout()) : a ? (this.targetRect = i, this.updateCanvasLayout()) : this.targetRect = i, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((f) => {
974
+ const i = this.target.getBoundingClientRect(), r = this.isViewport ? window.innerWidth + this.overscan * 2 : i.width, c = this.isViewport ? window.innerHeight + this.overscan * 2 : i.height, n = this.isViewport ? this.canvas.clientWidth : this.targetRect.width, a = this.isViewport ? this.canvas.clientHeight : this.targetRect.height, l = Math.abs(r - n) > 0.1 || Math.abs(c - a) > 0.1, o = this.mode === "overlay" && (Math.abs(i.top - this.targetRect.top) > 0.1 || Math.abs(i.left - this.targetRect.left) > 0.1);
975
+ l ? (this.targetRect = i, this.setSize(r, c), this.updateCanvasLayout()) : o ? (this.targetRect = i, this.updateCanvasLayout()) : this.targetRect = i, this.renderOrder = 0, this.reconcileNode(e), t.size > 0 && t.forEach((f) => {
976
976
  const h = this.registry.get(f);
977
977
  if (h) {
978
978
  this.scene.remove(h);
@@ -991,23 +991,23 @@ class ot {
991
991
  // => 이후 activeElements를 이용하여 mesh를 정리!!!+ map에서도 삭제
992
992
  // private reconcileNode(node: SceneNode, activeElements: Set<HTMLElement>) {
993
993
  reconcileNode(e) {
994
- var r, l;
994
+ var r, c;
995
995
  let t = this.registry.get(e.element);
996
996
  const i = JSON.stringify(e.shaderHooks || null);
997
997
  if (t && t.userData.shaderHash !== i && (this.scene.remove(t), t.geometry.dispose(), t.material instanceof w.Material && t.material.dispose(), this.registry.remove(e.element), t = void 0), !t) {
998
- const n = new w.PlaneGeometry(1, 1), o = e.isTraveler ? (r = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : r.texture : this.textureManager.get(e.element), c = P.create(
998
+ const n = new w.PlaneGeometry(1, 1), a = e.isTraveler ? (r = this.renderTargets[e.captureLayer - 2]) == null ? void 0 : r.texture : this.textureManager.get(e.element), l = W.create(
999
999
  "BOX",
1000
1000
  e.styles,
1001
1001
  "",
1002
1002
  e.rect.width,
1003
1003
  e.rect.height,
1004
1004
  this.qualityFactor,
1005
- o,
1005
+ a,
1006
1006
  e.shaderHooks
1007
1007
  );
1008
- t = new w.Mesh(n, c), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = c, t.userData.domElement = e.element, t.userData.shaderHash = i;
1008
+ t = new w.Mesh(n, l), e.type === "TEXT" && (t.name = "BG_MESH"), this.scene.add(t), this.registry.register(e.element, t), t.userData.baseMaterial = l, t.userData.domElement = e.element, t.userData.shaderHash = i;
1009
1009
  }
1010
- if (t.userData.clipElements = e.clipElements, (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)
1010
+ if (t.userData.clipElements = e.clipElements, (c = e.nativeStyles) != null && c.transform ? t.userData.nativeTransform = e.nativeStyles.transform : t.userData.nativeTransform = void 0, this.updateMeshProperties(t, e), this.updateMeshLayers(t, e), e.isTraveler)
1011
1011
  for (let n = 0; n < N.MAX_LAYERS; n++)
1012
1012
  n === e.captureLayer - 2 ? this.travelersByLayer[n].add(t) : this.travelersByLayer[n].delete(t);
1013
1013
  else
@@ -1024,11 +1024,11 @@ class ot {
1024
1024
  ));
1025
1025
  }
1026
1026
  reconcileTextChild(e, t, i) {
1027
- var a;
1027
+ var o;
1028
1028
  const r = t.textLines || [
1029
1029
  { text: t.textContent || "", rect: t.rect }
1030
- ], l = i ? t.nativeStyles : t.textStyles, n = JSON.stringify(l) + t.textContent + r.map((f) => f.text).join("|"), o = (a = e.userData) == null ? void 0 : a.textChildStyleHash;
1031
- if (t.dirtyMask & be || n !== o) {
1030
+ ], c = i ? t.nativeStyles : t.textStyles, n = JSON.stringify(c) + t.textContent + r.map((f) => f.text).join("|"), a = (o = e.userData) == null ? void 0 : o.textChildStyleHash;
1031
+ if (t.dirtyMask & be || n !== a) {
1032
1032
  e.children.filter(
1033
1033
  (g) => g.name.startsWith("TEXT_CHILD")
1034
1034
  ).forEach((g) => {
@@ -1038,9 +1038,9 @@ class ot {
1038
1038
  });
1039
1039
  const h = t.rect, d = h.x + h.width / 2, p = h.y + h.height / 2;
1040
1040
  r.forEach((g, M) => {
1041
- const m = P.create(
1041
+ const m = W.create(
1042
1042
  "TEXT",
1043
- l,
1043
+ c,
1044
1044
  g.text,
1045
1045
  g.rect.width,
1046
1046
  g.rect.height,
@@ -1077,16 +1077,16 @@ class ot {
1077
1077
  }
1078
1078
  updateMeshProperties(e, t) {
1079
1079
  var C, b, S, z, X;
1080
- const { rect: i, styles: r } = t, l = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / l, o = this.renderer.domElement.height / l;
1080
+ const { rect: i, styles: r } = t, c = this.renderer.getPixelRatio(), n = this.renderer.domElement.width / c, a = this.renderer.domElement.height / c;
1081
1081
  e.material = e.userData.baseMaterial;
1082
- let c = ((C = e.material.userData) == null ? void 0 : C.shadowPadding) || 0;
1083
- e.scale.set(i.width + c * 2, i.height + c * 2, 1), e.userData.domRect = {
1082
+ let l = ((C = e.material.userData) == null ? void 0 : C.shadowPadding) || 0;
1083
+ e.scale.set(i.width + l * 2, i.height + l * 2, 1), e.userData.domRect = {
1084
1084
  x: i.x,
1085
1085
  y: i.y,
1086
1086
  width: i.width,
1087
1087
  height: i.height
1088
1088
  };
1089
- const a = 1e-3;
1089
+ const o = 1e-3;
1090
1090
  this.renderOrder++;
1091
1091
  const f = this.targetRect.left + window.scrollX, h = this.targetRect.top + window.scrollY;
1092
1092
  let d, p;
@@ -1094,12 +1094,12 @@ class ot {
1094
1094
  d = i.x - window.innerWidth / 2 + i.width / 2, p = -i.y + window.innerHeight / 2 - i.height / 2;
1095
1095
  else {
1096
1096
  const B = i.x - f, k = i.y - h;
1097
- d = B - n / 2 + i.width / 2, p = -k + o / 2 - i.height / 2;
1097
+ d = B - n / 2 + i.width / 2, p = -k + a / 2 - i.height / 2;
1098
1098
  }
1099
1099
  e.position.set(
1100
1100
  d,
1101
1101
  p,
1102
- r.zIndex + this.renderOrder * a
1102
+ r.zIndex + this.renderOrder * o
1103
1103
  );
1104
1104
  const g = i.x, M = i.y;
1105
1105
  e.userData.basePosition = { x: d, y: p }, e.userData.originalBasePosition = { x: d, y: p }, e.userData.baseSize = { width: i.width, height: i.height }, e.userData.baseDOM = { x: g, y: M }, e.userData.isFixed = t.isFixed, e.userData.initialScroll = { x: window.scrollX, y: window.scrollY };
@@ -1109,7 +1109,7 @@ class ot {
1109
1109
  const B = new DOMMatrix(y.transform);
1110
1110
  E = B.m41, A = B.m42;
1111
1111
  }
1112
- if (e.userData.baseTransform = { x: E, y: A }, delete e.userData.originRatioX, delete e.userData.originRatioY, P.update(
1112
+ if (e.userData.baseTransform = { x: E, y: A }, delete e.userData.originRatioX, delete e.userData.originRatioY, W.update(
1113
1113
  e.userData.baseMaterial,
1114
1114
  "BOX",
1115
1115
  r,
@@ -1120,7 +1120,7 @@ class ot {
1120
1120
  t.isTraveler ? (b = this.renderTargets[t.captureLayer - 2]) == null ? void 0 : b.texture : this.textureManager.get(t.element)
1121
1121
  ), t.nativeStyles && t.nativeRect) {
1122
1122
  if (!e.userData.nativeMesh) {
1123
- const U = P.create(
1123
+ const U = W.create(
1124
1124
  "BOX",
1125
1125
  t.nativeStyles,
1126
1126
  "",
@@ -1138,7 +1138,7 @@ class ot {
1138
1138
  k = t.nativeRect.x - window.innerWidth / 2 + t.nativeRect.width / 2, j = -t.nativeRect.y + window.innerHeight / 2 - t.nativeRect.height / 2;
1139
1139
  else {
1140
1140
  const U = t.nativeRect.x - f, V = t.nativeRect.y - h;
1141
- k = U - n / 2 + t.nativeRect.width / 2, j = -V + o / 2 - t.nativeRect.height / 2;
1141
+ k = U - n / 2 + t.nativeRect.width / 2, j = -V + a / 2 - t.nativeRect.height / 2;
1142
1142
  }
1143
1143
  let J = t.nativeRect.width, Z = t.nativeRect.height, L = k, _ = j;
1144
1144
  if (t.nativeStyles.transform) {
@@ -1182,8 +1182,8 @@ class ot {
1182
1182
  B.scale.set(J + K * 2, Z + K * 2, 1), B.position.set(
1183
1183
  L,
1184
1184
  _,
1185
- t.nativeStyles.zIndex + this.renderOrder * a
1186
- ), P.update(
1185
+ t.nativeStyles.zIndex + this.renderOrder * o
1186
+ ), W.update(
1187
1187
  B.material,
1188
1188
  "BOX",
1189
1189
  t.nativeStyles,
@@ -1202,8 +1202,8 @@ class ot {
1202
1202
  const r = e.userData.nativeMesh;
1203
1203
  if (r.layers.set(O.HIDDEN), t.visibility & G) {
1204
1204
  r.layers.enable(O.getCaptureLayer(t.nativeLayer));
1205
- for (let l = t.captureLayer; l <= N.MAX_LAYERS + 1; l++)
1206
- l !== t.nativeLayer && e.layers.enable(O.getCaptureLayer(l));
1205
+ for (let c = t.captureLayer; c <= N.MAX_LAYERS + 1; c++)
1206
+ c !== t.nativeLayer && e.layers.enable(O.getCaptureLayer(c));
1207
1207
  }
1208
1208
  } else if (t.visibility & G)
1209
1209
  for (let r = t.captureLayer; r <= N.MAX_LAYERS + 1; r++)
@@ -1212,104 +1212,107 @@ class ot {
1212
1212
  captureRenderTarget(e, t, i) {
1213
1213
  if (e.size === 0 || !i)
1214
1214
  return;
1215
- const r = new w.Color(), l = this.renderer.getClearAlpha();
1215
+ const r = new w.Color(), c = this.renderer.getClearAlpha();
1216
1216
  this.renderer.getClearColor(r), this.renderer.setClearColor(0, 0), this.renderer.setRenderTarget(i), this.renderer.clear(), this.renderer.autoClear = !1, this.renderer.setScissorTest(!0), this.camera.layers.set(t);
1217
- const n = new w.Vector3(), o = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, c = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, a = this.renderer.getPixelRatio();
1217
+ const n = new w.Vector3(), a = this.isViewport ? window.innerWidth + this.overscan * 2 : this.targetRect.width, l = this.isViewport ? window.innerHeight + this.overscan * 2 : this.targetRect.height, o = this.renderer.getPixelRatio();
1218
1218
  for (const f of e) {
1219
1219
  n.setFromMatrixPosition(f.matrixWorld), n.project(this.camera);
1220
- const h = (n.x + 1) / 2 * o, d = (n.y + 1) / 2 * c;
1220
+ const h = (n.x + 1) / 2 * a, d = (n.y + 1) / 2 * l;
1221
1221
  let p = 0, g = 1;
1222
1222
  typeof this.clipArea == "number" ? g = this.clipArea : this.clipArea.endsWith("%") ? g = parseFloat(this.clipArea) / 100 : this.clipArea.endsWith("px") && (p = parseFloat(this.clipArea));
1223
- const M = f.scale.x * g + 0.5, m = f.scale.y * g + 0.5, y = h - M / 2, E = d - m / 2, A = (y * this.qualityFactor - p) / a, C = (E * this.qualityFactor - p) / a, b = (M * this.qualityFactor + p * 2) / a, S = (m * this.qualityFactor + p * 2) / a;
1223
+ const M = f.scale.x * g + 0.5, m = f.scale.y * g + 0.5, y = h - M / 2, E = d - m / 2, A = (y * this.qualityFactor - p) / o, C = (E * this.qualityFactor - p) / o, b = (M * this.qualityFactor + p * 2) / o, S = (m * this.qualityFactor + p * 2) / o;
1224
1224
  this.renderer.setScissor(A, C, b, S), this.renderer.render(this.scene, this.camera);
1225
1225
  }
1226
- this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(r, l);
1226
+ this.renderer.setScissorTest(!1), this.renderer.autoClear = !0, this.renderer.setRenderTarget(null), this.camera.layers.set(this.getSceneLayer()), this.renderer.setClearColor(r, c);
1227
1227
  }
1228
1228
  render() {
1229
- for (let o = 0; o < N.MAX_LAYERS; o++) {
1230
- const c = o + 1;
1229
+ for (let l = 0; l < N.MAX_LAYERS; l++) {
1230
+ const o = l + 1;
1231
1231
  this.captureRenderTarget(
1232
- this.travelersByLayer[o],
1233
- O.getCaptureLayer(c),
1234
- this.renderTargets[o]
1232
+ this.travelersByLayer[l],
1233
+ O.getCaptureLayer(o),
1234
+ this.renderTargets[l]
1235
1235
  );
1236
1236
  }
1237
- const e = this.renderer.getContext(), t = this.renderer.getPixelRatio(), i = this.renderer.domElement.height / t, r = this.renderer.domElement, l = r.getBoundingClientRect().top, n = r.getBoundingClientRect().left;
1238
- this.scene.children.forEach((o) => {
1239
- var f;
1240
- const c = o, a = (f = c.userData) == null ? void 0 : f.scissorRect;
1241
- if (a && a.width > 0 && a.height > 0) {
1242
- const h = Math.floor((a.x - n) * t), d = Math.floor(
1243
- (i - (a.y - l + a.height)) * t
1244
- ), p = Math.ceil(a.width * t), g = Math.ceil(a.height * t);
1245
- c.onBeforeRender = () => {
1246
- e.enable(e.SCISSOR_TEST), e.scissor(h, d, p, g);
1247
- }, c.onAfterRender = () => {
1237
+ const e = this.renderer.getContext(), t = this.renderer.getPixelRatio(), i = this.renderer.domElement.height / t, r = this.renderer.domElement, c = r.getBoundingClientRect().top, n = r.getBoundingClientRect().left, a = (l, o) => {
1238
+ if (o && o.width > 0 && o.height > 0) {
1239
+ const f = Math.floor((o.x - n) * t), h = Math.floor(
1240
+ (i - (o.y - c + o.height)) * t
1241
+ ), d = Math.ceil(o.width * t), p = Math.ceil(o.height * t);
1242
+ l.onBeforeRender = () => {
1243
+ e.enable(e.SCISSOR_TEST), e.scissor(f, h, d, p);
1244
+ }, l.onAfterRender = () => {
1248
1245
  e.disable(e.SCISSOR_TEST);
1249
- };
1246
+ }, l.__hasScissorHook = !0;
1250
1247
  } else
1251
- c.onBeforeRender && c.__hasScissorHook && (c.onBeforeRender = () => {
1252
- }, c.onAfterRender = () => {
1253
- }, c.__hasScissorHook = !1);
1254
- a && (c.__hasScissorHook = !0);
1248
+ l.__hasScissorHook && (l.onBeforeRender = () => {
1249
+ }, l.onAfterRender = () => {
1250
+ }, l.__hasScissorHook = !1);
1251
+ };
1252
+ this.scene.children.forEach((l) => {
1253
+ var h;
1254
+ const o = l, f = (h = o.userData) == null ? void 0 : h.scissorRect;
1255
+ a(o, f), o.children.forEach((d) => {
1256
+ d.name.startsWith("TEXT_CHILD") && a(d, f);
1257
+ });
1255
1258
  }), this.renderer.render(this.scene, this.camera);
1256
1259
  }
1257
1260
  syncMeshesByDOM() {
1258
- const e = this.targetRect.left + window.scrollX, t = this.targetRect.top + window.scrollY, i = this.renderer.getPixelRatio(), r = this.renderer.domElement.width / i, l = this.renderer.domElement.height / i;
1261
+ const e = this.targetRect.left + window.scrollX, t = this.targetRect.top + window.scrollY, i = this.renderer.getPixelRatio(), r = this.renderer.domElement.width / i, c = this.renderer.domElement.height / i;
1259
1262
  this.scene.children.forEach((n) => {
1260
1263
  var h, d;
1261
- const o = n;
1262
- if (!o.userData || !o.userData.domElement)
1264
+ const a = n;
1265
+ if (!a.userData || !a.userData.domElement)
1263
1266
  return;
1264
- const c = o.userData.domElement;
1265
- if (!c.isConnected)
1267
+ const l = a.userData.domElement;
1268
+ if (!l.isConnected)
1266
1269
  return;
1267
- let a;
1268
- if (c.nodeType === Node.TEXT_NODE) {
1270
+ let o;
1271
+ if (l.nodeType === Node.TEXT_NODE) {
1269
1272
  const p = document.createRange();
1270
- p.selectNode(c), a = p.getBoundingClientRect();
1273
+ p.selectNode(l), o = p.getBoundingClientRect();
1271
1274
  } else
1272
- a = c.getBoundingClientRect();
1273
- const f = o.userData.domRect;
1274
- if (!f || Math.abs(a.x - f.x) > 0.5 || Math.abs(a.y - f.y) > 0.5 || Math.abs(a.width - f.width) > 0.5 || Math.abs(a.height - f.height) > 0.5) {
1275
- o.userData.domRect = {
1276
- x: a.x,
1277
- y: a.y,
1278
- width: a.width,
1279
- height: a.height
1275
+ o = l.getBoundingClientRect();
1276
+ const f = a.userData.domRect;
1277
+ if (!f || Math.abs(o.x - f.x) > 0.5 || Math.abs(o.y - f.y) > 0.5 || Math.abs(o.width - f.width) > 0.5 || Math.abs(o.height - f.height) > 0.5) {
1278
+ a.userData.domRect = {
1279
+ x: o.x,
1280
+ y: o.y,
1281
+ width: o.width,
1282
+ height: o.height
1280
1283
  };
1281
- const p = o.userData.clipElements;
1284
+ const p = a.userData.clipElements;
1282
1285
  if (p && p.length > 0) {
1283
1286
  let y = -1 / 0, E = -1 / 0, A = 1 / 0, C = 1 / 0;
1284
1287
  for (const b of p) {
1285
1288
  const S = b.getBoundingClientRect();
1286
1289
  y = Math.max(y, S.left), E = Math.max(E, S.top), A = Math.min(A, S.right), C = Math.min(C, S.bottom);
1287
1290
  }
1288
- o.userData.scissorRect = {
1291
+ a.userData.scissorRect = {
1289
1292
  x: y,
1290
1293
  y: E,
1291
1294
  width: Math.max(0, A - y),
1292
1295
  height: Math.max(0, C - E)
1293
1296
  };
1294
1297
  } else
1295
- o.userData.scissorRect = void 0;
1298
+ a.userData.scissorRect = void 0;
1296
1299
  let g, M;
1297
1300
  if (this.isViewport)
1298
- g = a.x - window.innerWidth / 2 + a.width / 2, M = -a.y + window.innerHeight / 2 - a.height / 2;
1301
+ g = o.x - window.innerWidth / 2 + o.width / 2, M = -o.y + window.innerHeight / 2 - o.height / 2;
1299
1302
  else {
1300
- const y = a.x - e, E = a.y - t;
1301
- g = y - r / 2 + a.width / 2, M = -E + l / 2 - a.height / 2;
1303
+ const y = o.x - e, E = o.y - t;
1304
+ g = y - r / 2 + o.width / 2, M = -E + c / 2 - o.height / 2;
1302
1305
  }
1303
- o.position.setX(g), o.position.setY(M);
1304
- let m = ((h = o.material.userData) == null ? void 0 : h.shadowPadding) || 0;
1305
- if (o.scale.set(a.width + m * 2, a.height + m * 2, 1), o.updateMatrixWorld(), o.material instanceof w.ShaderMaterial && P.forceUpdateUniforms(o.material, {
1306
- width: a.width,
1307
- height: a.height
1308
- }), o.userData.nativeMesh) {
1309
- const y = o.userData.nativeMesh;
1310
- let E = a.width, A = a.height, C = g, b = M;
1311
- if (o.userData.nativeTransform) {
1312
- const z = o.userData.nativeTransform, X = z.match(/scale\(([\d.]+%?)\)/);
1306
+ a.position.setX(g), a.position.setY(M);
1307
+ let m = ((h = a.material.userData) == null ? void 0 : h.shadowPadding) || 0;
1308
+ if (a.scale.set(o.width + m * 2, o.height + m * 2, 1), a.updateMatrixWorld(), a.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(a.material, {
1309
+ width: o.width,
1310
+ height: o.height
1311
+ }), a.userData.nativeMesh) {
1312
+ const y = a.userData.nativeMesh;
1313
+ let E = o.width, A = o.height, C = g, b = M;
1314
+ if (a.userData.nativeTransform) {
1315
+ const z = a.userData.nativeTransform, X = z.match(/scale\(([\d.]+%?)\)/);
1313
1316
  if (X) {
1314
1317
  let L = parseFloat(X[1]);
1315
1318
  X[1].includes("%") && (L /= 100), E *= L, A *= L;
@@ -1328,25 +1331,25 @@ class ot {
1328
1331
  if (j) {
1329
1332
  const L = j[1].trim(), _ = j[2].trim();
1330
1333
  let K = parseFloat(L);
1331
- L.includes("%") && (K = K / 100 * a.width);
1334
+ L.includes("%") && (K = K / 100 * o.width);
1332
1335
  let U = parseFloat(_);
1333
- _.includes("%") && (U = U / 100 * a.height), C += K, b -= U;
1336
+ _.includes("%") && (U = U / 100 * o.height), C += K, b -= U;
1334
1337
  }
1335
1338
  const J = z.match(/translateX\(([^)]+)\)/);
1336
1339
  if (J) {
1337
1340
  const L = J[1].trim();
1338
1341
  let _ = parseFloat(L);
1339
- L.includes("%") && (_ = _ / 100 * a.width), C += _;
1342
+ L.includes("%") && (_ = _ / 100 * o.width), C += _;
1340
1343
  }
1341
1344
  const Z = z.match(/translateY\(([^)]+)\)/);
1342
1345
  if (Z) {
1343
1346
  const L = Z[1].trim();
1344
1347
  let _ = parseFloat(L);
1345
- L.includes("%") && (_ = _ / 100 * a.height), b -= _;
1348
+ L.includes("%") && (_ = _ / 100 * o.height), b -= _;
1346
1349
  }
1347
1350
  }
1348
1351
  let S = ((d = y.material.userData) == null ? void 0 : d.shadowPadding) || 0;
1349
- y.position.setX(C), y.position.setY(b), y.scale.set(E + S * 2, A + S * 2, 1), y.updateMatrixWorld(), y.material instanceof w.ShaderMaterial && P.forceUpdateUniforms(y.material, {
1352
+ y.position.setX(C), y.position.setY(b), y.scale.set(E + S * 2, A + S * 2, 1), y.updateMatrixWorld(), y.material instanceof w.ShaderMaterial && W.forceUpdateUniforms(y.material, {
1350
1353
  width: E,
1351
1354
  height: A
1352
1355
  });
@@ -1357,17 +1360,17 @@ class ot {
1357
1360
  }
1358
1361
  function at(s) {
1359
1362
  const e = s.textContent || "", t = [];
1360
- let i = "", r = null, l = -1;
1361
- const n = (a, f) => {
1362
- for (let h = 0; h < a.length; h++) {
1363
- const d = a[h], p = document.createRange();
1363
+ let i = "", r = null, c = -1;
1364
+ const n = (o, f) => {
1365
+ for (let h = 0; h < o.length; h++) {
1366
+ const d = o[h], p = document.createRange();
1364
1367
  p.setStart(s, f + h), p.setEnd(s, f + h + 1);
1365
1368
  const g = p.getBoundingClientRect();
1366
1369
  if (g.width === 0 && g.height === 0) {
1367
1370
  i += d;
1368
1371
  continue;
1369
1372
  }
1370
- l === -1 || Math.abs(g.top - l) > g.height / 2 ? (i && r && t.push({
1373
+ c === -1 || Math.abs(g.top - c) > g.height / 2 ? (i && r && t.push({
1371
1374
  text: i,
1372
1375
  rect: {
1373
1376
  left: r.left,
@@ -1380,26 +1383,26 @@ function at(s) {
1380
1383
  top: g.top,
1381
1384
  right: g.right,
1382
1385
  bottom: g.bottom
1383
- }, l = g.top) : (i += d, r && (r.left = Math.min(r.left, g.left), r.top = Math.min(r.top, g.top), r.right = Math.max(r.right, g.right), r.bottom = Math.max(
1386
+ }, c = g.top) : (i += d, r && (r.left = Math.min(r.left, g.left), r.top = Math.min(r.top, g.top), r.right = Math.max(r.right, g.right), r.bottom = Math.max(
1384
1387
  r.bottom,
1385
1388
  g.bottom
1386
1389
  )));
1387
1390
  }
1388
- }, o = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
1389
- let c = 0;
1390
- for (const a of o) {
1391
+ }, a = e.match(/[^\s\-]+\-?|\-|\s+/g) || [];
1392
+ let l = 0;
1393
+ for (const o of a) {
1391
1394
  const f = document.createRange();
1392
- f.setStart(s, c), f.setEnd(s, c + a.length);
1395
+ f.setStart(s, l), f.setEnd(s, l + o.length);
1393
1396
  const h = f.getClientRects();
1394
1397
  if (h.length > 1)
1395
- n(a, c);
1398
+ n(o, l);
1396
1399
  else {
1397
1400
  const d = h.length === 1 ? h[0] : f.getBoundingClientRect();
1398
1401
  if (d.width === 0 && d.height === 0) {
1399
- i += a, c += a.length;
1402
+ i += o, l += o.length;
1400
1403
  continue;
1401
1404
  }
1402
- l === -1 || Math.abs(d.top - l) > d.height / 2 ? (i && r && t.push({
1405
+ c === -1 || Math.abs(d.top - c) > d.height / 2 ? (i && r && t.push({
1403
1406
  text: i,
1404
1407
  rect: {
1405
1408
  left: r.left,
@@ -1407,17 +1410,17 @@ function at(s) {
1407
1410
  width: r.right - r.left,
1408
1411
  height: r.bottom - r.top
1409
1412
  }
1410
- }), i = a, r = {
1413
+ }), i = o, r = {
1411
1414
  left: d.left,
1412
1415
  top: d.top,
1413
1416
  right: d.right,
1414
1417
  bottom: d.bottom
1415
- }, l = d.top) : (i += a, r && (r.left = Math.min(r.left, d.left), r.top = Math.min(r.top, d.top), r.right = Math.max(r.right, d.right), r.bottom = Math.max(
1418
+ }, c = d.top) : (i += o, r && (r.left = Math.min(r.left, d.left), r.top = Math.min(r.top, d.top), r.right = Math.max(r.right, d.right), r.bottom = Math.max(
1416
1419
  r.bottom,
1417
1420
  d.bottom
1418
1421
  )));
1419
1422
  }
1420
- c += a.length;
1423
+ l += o.length;
1421
1424
  }
1422
1425
  return i && r && t.push({
1423
1426
  text: i,
@@ -1428,7 +1431,7 @@ function at(s) {
1428
1431
  height: r.bottom - r.top
1429
1432
  }
1430
1433
  }), t.filter(
1431
- (a) => a.text.trim().length > 0 && a.rect.width > 0 && a.rect.height > 0
1434
+ (o) => o.text.trim().length > 0 && o.rect.width > 0 && o.rect.height > 0
1432
1435
  );
1433
1436
  }
1434
1437
  function ke(s) {
@@ -1447,7 +1450,7 @@ function ke(s) {
1447
1450
  letterSpacing: i
1448
1451
  };
1449
1452
  }
1450
- function Fe(s, e = re | ue | Ge | be | pe, t, i = 1, r = 0, l = 2, n, o, c) {
1453
+ function Fe(s, e = re | ue | Ge | be | pe, t, i = 1, r = 0, c = 2, n, a, l) {
1451
1454
  var K, U, V, ie, se, ne, he;
1452
1455
  if (s.nodeType === Node.TEXT_NODE) {
1453
1456
  const v = s;
@@ -1500,7 +1503,7 @@ function Fe(s, e = re | ue | Ge | be | pe, t, i = 1, r = 0, l = 2, n, o, c) {
1500
1503
  captureLayer: i,
1501
1504
  isFixed: D.position === "fixed",
1502
1505
  nativeLayer: n,
1503
- nativeStyles: o ? te(te({
1506
+ nativeStyles: a ? te(te({
1504
1507
  backgroundColor: "transparent",
1505
1508
  backgroundImage: "",
1506
1509
  opacity: F && F.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(D.opacity),
@@ -1509,20 +1512,20 @@ function Fe(s, e = re | ue | Ge | be | pe, t, i = 1, r = 0, l = 2, n, o, c) {
1509
1512
  borderColor: "transparent",
1510
1513
  borderWidth: "0px",
1511
1514
  isTraveler: !1
1512
- }, ke(D)), o) : void 0,
1513
- nativeRect: o ? {
1515
+ }, ke(D)), a) : void 0,
1516
+ nativeRect: a ? {
1514
1517
  x: $ + window.scrollX,
1515
1518
  y: Y + window.scrollY,
1516
1519
  width: Q - $,
1517
1520
  height: I - Y
1518
1521
  } : void 0,
1519
- clipElements: c,
1522
+ clipElements: l,
1520
1523
  children: []
1521
1524
  };
1522
1525
  }
1523
1526
  if (s.nodeType !== Node.ELEMENT_NODE)
1524
1527
  return null;
1525
- const a = s, f = a.dataset[H.KEY];
1528
+ const o = s, f = o.dataset[P.KEY];
1526
1529
  let h = t, d = t;
1527
1530
  if (f) {
1528
1531
  const v = new Set(f.split(/\s+/));
@@ -1531,19 +1534,19 @@ function Fe(s, e = re | ue | Ge | be | pe, t, i = 1, r = 0, l = 2, n, o, c) {
1531
1534
  throw new Error(
1532
1535
  `[MirageEngine] Invalid filter token: '${x}'. Expected one of: 'include-tree', 'exclude-tree', 'include-self', 'exclude-self', 'end'.`
1533
1536
  );
1534
- if (v.has(H.VALUES.END))
1537
+ if (v.has(P.VALUES.END))
1535
1538
  return null;
1536
- if (v.has(H.VALUES.INCLUDE_TREE) && v.has(H.VALUES.EXCLUDE_TREE))
1539
+ if (v.has(P.VALUES.INCLUDE_TREE) && v.has(P.VALUES.EXCLUDE_TREE))
1537
1540
  throw new Error(
1538
1541
  "[MirageEngine] Conflicting filters: 'include-tree' and 'exclude-tree' cannot be used together on the same element."
1539
1542
  );
1540
- if (v.has(H.VALUES.INCLUDE_SELF) && v.has(H.VALUES.EXCLUDE_SELF))
1543
+ if (v.has(P.VALUES.INCLUDE_SELF) && v.has(P.VALUES.EXCLUDE_SELF))
1541
1544
  throw new Error(
1542
1545
  "[MirageEngine] Conflicting filters: 'include-self' and 'exclude-self' cannot be used together on the same element."
1543
1546
  );
1544
- v.has(H.VALUES.INCLUDE_TREE) ? h = h | G : v.has(H.VALUES.EXCLUDE_TREE) && (h = h & ~G), d = h, v.has(H.VALUES.INCLUDE_SELF) ? d = d | G : v.has(H.VALUES.EXCLUDE_SELF) && (d = d & ~G);
1547
+ v.has(P.VALUES.INCLUDE_TREE) ? h = h | G : v.has(P.VALUES.EXCLUDE_TREE) && (h = h & ~G), d = h, v.has(P.VALUES.INCLUDE_SELF) ? d = d | G : v.has(P.VALUES.EXCLUDE_SELF) && (d = d & ~G);
1545
1548
  }
1546
- const p = a.dataset[q.KEY];
1549
+ const p = o.dataset[q.KEY];
1547
1550
  if (p) {
1548
1551
  const v = new Set(p.split(/\s+/));
1549
1552
  for (const x of v)
@@ -1563,8 +1566,8 @@ function Fe(s, e = re | ue | Ge | be | pe, t, i = 1, r = 0, l = 2, n, o, c) {
1563
1566
  );
1564
1567
  v.has(q.VALUES.INCLUDE_TREE) ? h = h | ae : v.has(q.VALUES.EXCLUDE_TREE) && (h = h & ~ae), d = h, v.has(q.VALUES.INCLUDE_SELF) ? d = d | ae : v.has(q.VALUES.EXCLUDE_SELF) && (d = d & ~ae);
1565
1568
  }
1566
- const g = a.dataset[N.KEY];
1567
- let M = !1, m = o ? te({}, o) : {}, y = n;
1569
+ const g = o.dataset[N.KEY];
1570
+ let M = !1, m = a ? te({}, a) : {}, y = n;
1568
1571
  if (g) {
1569
1572
  let v = 1;
1570
1573
  const x = g.indexOf("{"), T = g.lastIndexOf("}");
@@ -1612,33 +1615,33 @@ function Fe(s, e = re | ue | Ge | be | pe, t, i = 1, r = 0, l = 2, n, o, c) {
1612
1615
  i = Math.min(I, N.MAX_LAYERS + 1);
1613
1616
  }
1614
1617
  }
1615
- const E = a.dataset[He.KEY];
1618
+ const E = o.dataset[Pe.KEY];
1616
1619
  let A;
1617
1620
  E && (A = JSON.parse(E));
1618
- const C = a.getBoundingClientRect(), b = window.getComputedStyle(a);
1621
+ const C = o.getBoundingClientRect(), b = window.getComputedStyle(o);
1619
1622
  if (C.width === 0 || C.height === 0 || b.display === "none")
1620
1623
  return null;
1621
- let S = a.getAttribute("data-mid");
1622
- S || (S = Math.random().toString(36).substring(2, 11), a.setAttribute("data-mid", S));
1624
+ let S = o.getAttribute("data-mid");
1625
+ S || (S = Math.random().toString(36).substring(2, 11), o.setAttribute("data-mid", S));
1623
1626
  const z = parseInt(b.zIndex), X = (isNaN(z) ? 0 : z) + r;
1624
1627
  let B;
1625
- if (a.tagName === "IMG")
1626
- B = a.src;
1627
- else if (a.tagName.toLowerCase() === "svg") {
1628
- const v = a.cloneNode(!0), x = m == null ? void 0 : m.color, T = m == null ? void 0 : m.fill, F = m == null ? void 0 : m.stroke, D = m == null ? void 0 : m.opacity, $ = (R, oe) => {
1629
- const W = window.getComputedStyle(R), de = oe, ze = W.fill === W.color, Ne = W.stroke === W.color, me = T || (ze ? x : void 0) || W.fill;
1628
+ if (o.tagName === "IMG")
1629
+ B = o.src;
1630
+ else if (o.tagName.toLowerCase() === "svg") {
1631
+ const v = o.cloneNode(!0), x = m == null ? void 0 : m.color, T = m == null ? void 0 : m.fill, F = m == null ? void 0 : m.stroke, D = m == null ? void 0 : m.opacity, $ = (R, oe) => {
1632
+ const H = window.getComputedStyle(R), de = oe, ze = H.fill === H.color, Ne = H.stroke === H.color, me = T || (ze ? x : void 0) || H.fill;
1630
1633
  me && me !== "none" && (de.style.fill = me);
1631
- const ve = F || (Ne ? x : void 0) || W.stroke;
1632
- ve && ve !== "none" && (de.style.stroke = ve), W.strokeWidth && W.strokeWidth !== "0px" && (de.style.strokeWidth = W.strokeWidth);
1633
- const Se = x || W.color;
1634
+ const ve = F || (Ne ? x : void 0) || H.stroke;
1635
+ ve && ve !== "none" && (de.style.stroke = ve), H.strokeWidth && H.strokeWidth !== "0px" && (de.style.strokeWidth = H.strokeWidth);
1636
+ const Se = x || H.color;
1634
1637
  Se && (de.style.color = Se);
1635
- const we = D || W.opacity;
1638
+ const we = D || H.opacity;
1636
1639
  we && we !== "1" && (de.style.opacity = we);
1637
1640
  for (let fe = 0; fe < R.children.length; fe++)
1638
1641
  $(R.children[fe], oe.children[fe]);
1639
1642
  };
1640
- $(a, v);
1641
- const Y = a.getBoundingClientRect(), Q = window.devicePixelRatio * l;
1643
+ $(o, v);
1644
+ const Y = o.getBoundingClientRect(), Q = window.devicePixelRatio * c;
1642
1645
  v.hasAttribute("viewBox") || v.setAttribute("viewBox", `0 0 ${Y.width} ${Y.height}`), v.setAttribute("width", (Y.width * Q).toString()), v.setAttribute("height", (Y.height * Q).toString());
1643
1646
  let I = new XMLSerializer().serializeToString(v);
1644
1647
  I.includes("xmlns=") || (I = I.replace(
@@ -1652,7 +1655,7 @@ function Fe(s, e = re | ue | Ge | be | pe, t, i = 1, r = 0, l = 2, n, o, c) {
1652
1655
  const k = {
1653
1656
  backgroundColor: b.backgroundColor,
1654
1657
  backgroundImage: b.backgroundImage,
1655
- opacity: a.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(b.opacity),
1658
+ opacity: o.dataset[ee.KEY] === ee.VALUES.HIDE ? 1 : parseFloat(b.opacity),
1656
1659
  zIndex: X,
1657
1660
  borderRadius: b.borderRadius,
1658
1661
  borderColor: b.borderColor,
@@ -1662,15 +1665,15 @@ function Fe(s, e = re | ue | Ge | be | pe, t, i = 1, r = 0, l = 2, n, o, c) {
1662
1665
  isTraveler: M
1663
1666
  }, j = k;
1664
1667
  let J, Z;
1665
- const L = [], _ = b.overflow === "hidden" ? [...c || [], a] : c;
1666
- return a.tagName.toLowerCase() !== "svg" && Array.from(a.childNodes).forEach((v) => {
1668
+ const L = [], _ = b.overflow === "hidden" ? [...l || [], o] : l;
1669
+ return o.tagName.toLowerCase() !== "svg" && Array.from(o.childNodes).forEach((v) => {
1667
1670
  const x = v.nodeType === Node.TEXT_NODE ? d : h, T = Fe(
1668
1671
  v,
1669
1672
  e,
1670
1673
  x,
1671
1674
  i,
1672
1675
  X,
1673
- l,
1676
+ c,
1674
1677
  v.nodeType === Node.TEXT_NODE ? y : void 0,
1675
1678
  v.nodeType === Node.TEXT_NODE && Object.keys(m).length > 0 ? m : void 0,
1676
1679
  _
@@ -1679,7 +1682,7 @@ function Fe(s, e = re | ue | Ge | be | pe, t, i = 1, r = 0, l = 2, n, o, c) {
1679
1682
  }), {
1680
1683
  id: S,
1681
1684
  type: "BOX",
1682
- element: a,
1685
+ element: o,
1683
1686
  rect: {
1684
1687
  x: C.left + window.scrollX,
1685
1688
  y: C.top + window.scrollY,
@@ -1713,32 +1716,32 @@ function Fe(s, e = re | ue | Ge | be | pe, t, i = 1, r = 0, l = 2, n, o, c) {
1713
1716
  height: m.height !== void 0 ? parseFloat(m.height) : C.height
1714
1717
  } : void 0,
1715
1718
  isFixed: b.position === "fixed",
1716
- clipElements: c,
1719
+ clipElements: l,
1717
1720
  children: L,
1718
1721
  shaderHooks: A
1719
1722
  };
1720
1723
  }
1721
- function ct(s, e) {
1724
+ function lt(s, e) {
1722
1725
  e.size !== 0 && e.forEach((t, i) => {
1723
- var l, n, o, c;
1726
+ var c, n, a, l;
1724
1727
  const r = s.get(i);
1725
- !r || !r.userData.basePosition || (P.forceUpdateUniforms(r.material, {
1728
+ !r || !r.userData.basePosition || (W.forceUpdateUniforms(r.material, {
1726
1729
  backgroundColor: t.backgroundColor,
1727
1730
  backgroundImage: t.backgroundImage,
1728
1731
  boxShadow: t.boxShadow,
1729
1732
  opacity: t.opacity,
1730
- borderRadius: (n = t.borderRadius) != null ? n : (l = r.userData.baseStyles) == null ? void 0 : l.borderRadius
1733
+ borderRadius: (n = t.borderRadius) != null ? n : (c = r.userData.baseStyles) == null ? void 0 : c.borderRadius
1731
1734
  // width and height are no longer updated here, they are updated in syncMeshesByDOM
1732
- }), r.userData.nativeMesh && P.forceUpdateUniforms(r.userData.nativeMesh.material, {
1735
+ }), r.userData.nativeMesh && W.forceUpdateUniforms(r.userData.nativeMesh.material, {
1733
1736
  backgroundColor: t.backgroundColor,
1734
1737
  backgroundImage: t.backgroundImage,
1735
1738
  boxShadow: t.boxShadow,
1736
1739
  opacity: t.opacity,
1737
- borderRadius: (c = t.borderRadius) != null ? c : (o = r.userData.baseStyles) == null ? void 0 : o.borderRadius
1740
+ borderRadius: (l = t.borderRadius) != null ? l : (a = r.userData.baseStyles) == null ? void 0 : a.borderRadius
1738
1741
  }));
1739
1742
  });
1740
1743
  }
1741
- class lt {
1744
+ class ct {
1742
1745
  constructor(e, t, i, r) {
1743
1746
  u(this, "target");
1744
1747
  u(this, "renderer");
@@ -1747,19 +1750,19 @@ class lt {
1747
1750
  u(this, "tracker");
1748
1751
  this.target = e, this.renderer = t, this.registry = i, this.tracker = new Be(e, {
1749
1752
  resizeDebounce: r.resizeDebounce
1750
- }), this.tracker.onLayoutChange.add((l, n) => {
1753
+ }), this.tracker.onLayoutChange.add((c, n) => {
1751
1754
  document.querySelector(`[${N.NAME}~='${N.VALUES.TRAVELER}']`) !== null && !this.isTravelEnabled && (this.isTravelEnabled = !0, this.renderer.createRenderTarget());
1752
- const c = Fe(
1755
+ const l = Fe(
1753
1756
  this.target,
1754
- l,
1757
+ c,
1755
1758
  G,
1756
1759
  1,
1757
1760
  0,
1758
1761
  this.renderer.qualityFactor
1759
1762
  );
1760
- c && this.renderer.syncScene(c, n);
1761
- }), this.tracker.onStyleChange.add((l) => {
1762
- ct(this.registry, l);
1763
+ l && this.renderer.syncScene(l, n);
1764
+ }), this.tracker.onStyleChange.add((c) => {
1765
+ lt(this.registry, c);
1763
1766
  }), this.tracker.onRender.add(() => {
1764
1767
  this.renderer.syncMeshesByDOM(), this.renderer.render();
1765
1768
  });
@@ -1802,24 +1805,24 @@ class dt {
1802
1805
  u(this, "syncer");
1803
1806
  u(this, "target");
1804
1807
  u(this, "registry");
1805
- var r, l, n;
1808
+ var r, c, n;
1806
1809
  if (this.target = e, this.registry = new ht(), !document.getElementById("mirage-engine-styles")) {
1807
- const o = document.createElement("style");
1808
- o.id = "mirage-engine-styles", o.textContent = `
1810
+ const a = document.createElement("style");
1811
+ a.id = "mirage-engine-styles", a.textContent = `
1809
1812
  [${ee.NAME}="${ee.VALUES.HIDE}"] {
1810
1813
  opacity: 0 !important;
1811
1814
  }
1812
- `, document.head.appendChild(o);
1815
+ `, document.head.appendChild(a);
1813
1816
  }
1814
1817
  let i;
1815
- if (t.mode === "duplicate" ? i = (l = (r = t.container) != null ? r : this.target.parentElement) != null ? l : void 0 : i = (n = this.target.parentElement) != null ? n : void 0, !i)
1818
+ if (t.mode === "duplicate" ? i = (c = (r = t.container) != null ? r : this.target.parentElement) != null ? c : void 0 : i = (n = this.target.parentElement) != null ? n : void 0, !i)
1816
1819
  throw new Error("[Mirage] Cannot find a container (parent or option).");
1817
1820
  this.renderer = new ot(
1818
1821
  this.target,
1819
1822
  t,
1820
1823
  i,
1821
1824
  this.registry
1822
- ), this.renderer.mount(), this.syncer = new lt(this.target, this.renderer, this.registry, t);
1825
+ ), this.renderer.mount(), this.syncer = new ct(this.target, this.renderer, this.registry, t);
1823
1826
  }
1824
1827
  start() {
1825
1828
  this.syncer.start();
@@ -1851,10 +1854,10 @@ class dt {
1851
1854
  ArrowUp: !1,
1852
1855
  ArrowDown: !1
1853
1856
  };
1854
- window.addEventListener("keydown", (l) => {
1855
- t[l.key] !== void 0 && (t[l.key] = !0);
1856
- }), window.addEventListener("keyup", (l) => {
1857
- t[l.key] !== void 0 && (t[l.key] = !1);
1857
+ window.addEventListener("keydown", (c) => {
1858
+ t[c.key] !== void 0 && (t[c.key] = !0);
1859
+ }), window.addEventListener("keyup", (c) => {
1860
+ t[c.key] !== void 0 && (t[c.key] = !1);
1858
1861
  });
1859
1862
  const i = 2, r = () => {
1860
1863
  requestAnimationFrame(r), t.ArrowRight && e.position.setX(e.position.x + i), t.ArrowLeft && e.position.setX(e.position.x - i), t.ArrowUp && e.position.setY(e.position.y + i), t.ArrowDown && e.position.setY(e.position.y - i);
@@ -1901,8 +1904,8 @@ class ut {
1901
1904
  const e = document.querySelectorAll(this.frontSelector);
1902
1905
  this.frontLayer && e.forEach((t) => {
1903
1906
  var n;
1904
- const i = t.getBoundingClientRect(), r = window.getComputedStyle(t), l = document.createElement("div");
1905
- l.className = "sand-placeholder", Object.assign(l.style, {
1907
+ const i = t.getBoundingClientRect(), r = window.getComputedStyle(t), c = document.createElement("div");
1908
+ c.className = "sand-placeholder", Object.assign(c.style, {
1906
1909
  display: r.display === "inline" ? "inline-block" : r.display,
1907
1910
  width: `${i.width}px`,
1908
1911
  height: `${i.height}px`,
@@ -1913,14 +1916,14 @@ class ut {
1913
1916
  marginRight: r.marginRight,
1914
1917
  visibility: "hidden",
1915
1918
  pointerEvents: "none"
1916
- }), (n = t.parentNode) == null || n.insertBefore(l, t), this.frontLayer.appendChild(t), Object.assign(t.style, {
1919
+ }), (n = t.parentNode) == null || n.insertBefore(c, t), this.frontLayer.appendChild(t), Object.assign(t.style, {
1917
1920
  position: "fixed",
1918
1921
  margin: "0",
1919
1922
  boxSizing: "border-box",
1920
1923
  width: `${i.width}px`,
1921
1924
  height: `${i.height}px`,
1922
1925
  pointerEvents: "auto"
1923
- }), this.items.push({ placeholder: l, original: t });
1926
+ }), this.items.push({ placeholder: c, original: t });
1924
1927
  });
1925
1928
  }
1926
1929
  setupHooks() {