@liquidcars/atlas 0.1.30 → 0.1.32

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.
@@ -66,30 +66,30 @@ function ne(e, t) {
66
66
  function re(e, t) {
67
67
  return e + Math.random() * (t - e);
68
68
  }
69
- function R(e) {
69
+ function ie(e) {
70
70
  return e * (.5 - Math.random());
71
71
  }
72
- function z(e) {
72
+ function R(e) {
73
73
  e !== void 0 && (D = e);
74
74
  let t = D += 1831565813;
75
75
  return t = Math.imul(t ^ t >>> 15, t | 1), t ^= t + Math.imul(t ^ t >>> 7, t | 61), ((t ^ t >>> 14) >>> 0) / 4294967296;
76
76
  }
77
- function B(e) {
77
+ function z(e) {
78
78
  return e * O;
79
79
  }
80
- function ie(e) {
80
+ function ae(e) {
81
81
  return e * k;
82
82
  }
83
- function ae(e) {
83
+ function oe(e) {
84
84
  return !(e & e - 1) && e !== 0;
85
85
  }
86
- function oe(e) {
86
+ function se(e) {
87
87
  return 2 ** Math.ceil(Math.log(e) / Math.LN2);
88
88
  }
89
- function se(e) {
89
+ function ce(e) {
90
90
  return 2 ** Math.floor(Math.log(e) / Math.LN2);
91
91
  }
92
- function ce(e, t, n, r, i) {
92
+ function le(e, t, n, r, i) {
93
93
  let a = Math.cos, o = Math.sin, s = a(n / 2), c = o(n / 2), l = a((t + r) / 2), u = o((t + r) / 2), d = a((t - r) / 2), f = o((t - r) / 2), p = a((r - t) / 2), m = o((r - t) / 2);
94
94
  switch (i) {
95
95
  case "XYX":
@@ -113,7 +113,7 @@ function ce(e, t, n, r, i) {
113
113
  default: console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + i);
114
114
  }
115
115
  }
116
- function le(e, t) {
116
+ function ue(e, t) {
117
117
  switch (t.constructor) {
118
118
  case Float32Array: return e;
119
119
  case Uint32Array: return e / 4294967295;
@@ -125,7 +125,7 @@ function le(e, t) {
125
125
  default: throw Error("Invalid component type.");
126
126
  }
127
127
  }
128
- function ue(e, t) {
128
+ function B(e, t) {
129
129
  switch (t.constructor) {
130
130
  case Float32Array: return e;
131
131
  case Uint32Array: return Math.round(e * 4294967295);
@@ -152,16 +152,16 @@ var de = {
152
152
  smootherstep: L,
153
153
  randInt: ne,
154
154
  randFloat: re,
155
- randFloatSpread: R,
156
- seededRandom: z,
157
- degToRad: B,
158
- radToDeg: ie,
159
- isPowerOfTwo: ae,
160
- ceilPowerOfTwo: oe,
161
- floorPowerOfTwo: se,
162
- setQuaternionFromProperEuler: ce,
163
- normalize: ue,
164
- denormalize: le
155
+ randFloatSpread: ie,
156
+ seededRandom: R,
157
+ degToRad: z,
158
+ radToDeg: ae,
159
+ isPowerOfTwo: oe,
160
+ ceilPowerOfTwo: se,
161
+ floorPowerOfTwo: ce,
162
+ setQuaternionFromProperEuler: le,
163
+ normalize: B,
164
+ denormalize: ue
165
165
  }, V = class e {
166
166
  constructor(t = 0, n = 0) {
167
167
  e.prototype.isVector2 = !0, this.x = t, this.y = n;
@@ -3020,47 +3020,47 @@ var tn = 0, nn = class extends T {
3020
3020
  }
3021
3021
  getComponent(e, t) {
3022
3022
  let n = this.array[e * this.itemSize + t];
3023
- return this.normalized && (n = le(n, this.array)), n;
3023
+ return this.normalized && (n = ue(n, this.array)), n;
3024
3024
  }
3025
3025
  setComponent(e, t, n) {
3026
- return this.normalized && (n = ue(n, this.array)), this.array[e * this.itemSize + t] = n, this;
3026
+ return this.normalized && (n = B(n, this.array)), this.array[e * this.itemSize + t] = n, this;
3027
3027
  }
3028
3028
  getX(e) {
3029
3029
  let t = this.array[e * this.itemSize];
3030
- return this.normalized && (t = le(t, this.array)), t;
3030
+ return this.normalized && (t = ue(t, this.array)), t;
3031
3031
  }
3032
3032
  setX(e, t) {
3033
- return this.normalized && (t = ue(t, this.array)), this.array[e * this.itemSize] = t, this;
3033
+ return this.normalized && (t = B(t, this.array)), this.array[e * this.itemSize] = t, this;
3034
3034
  }
3035
3035
  getY(e) {
3036
3036
  let t = this.array[e * this.itemSize + 1];
3037
- return this.normalized && (t = le(t, this.array)), t;
3037
+ return this.normalized && (t = ue(t, this.array)), t;
3038
3038
  }
3039
3039
  setY(e, t) {
3040
- return this.normalized && (t = ue(t, this.array)), this.array[e * this.itemSize + 1] = t, this;
3040
+ return this.normalized && (t = B(t, this.array)), this.array[e * this.itemSize + 1] = t, this;
3041
3041
  }
3042
3042
  getZ(e) {
3043
3043
  let t = this.array[e * this.itemSize + 2];
3044
- return this.normalized && (t = le(t, this.array)), t;
3044
+ return this.normalized && (t = ue(t, this.array)), t;
3045
3045
  }
3046
3046
  setZ(e, t) {
3047
- return this.normalized && (t = ue(t, this.array)), this.array[e * this.itemSize + 2] = t, this;
3047
+ return this.normalized && (t = B(t, this.array)), this.array[e * this.itemSize + 2] = t, this;
3048
3048
  }
3049
3049
  getW(e) {
3050
3050
  let t = this.array[e * this.itemSize + 3];
3051
- return this.normalized && (t = le(t, this.array)), t;
3051
+ return this.normalized && (t = ue(t, this.array)), t;
3052
3052
  }
3053
3053
  setW(e, t) {
3054
- return this.normalized && (t = ue(t, this.array)), this.array[e * this.itemSize + 3] = t, this;
3054
+ return this.normalized && (t = B(t, this.array)), this.array[e * this.itemSize + 3] = t, this;
3055
3055
  }
3056
3056
  setXY(e, t, n) {
3057
- return e *= this.itemSize, this.normalized && (t = ue(t, this.array), n = ue(n, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this;
3057
+ return e *= this.itemSize, this.normalized && (t = B(t, this.array), n = B(n, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this;
3058
3058
  }
3059
3059
  setXYZ(e, t, n, r) {
3060
- return e *= this.itemSize, this.normalized && (t = ue(t, this.array), n = ue(n, this.array), r = ue(r, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = r, this;
3060
+ return e *= this.itemSize, this.normalized && (t = B(t, this.array), n = B(n, this.array), r = B(r, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = r, this;
3061
3061
  }
3062
3062
  setXYZW(e, t, n, r, i) {
3063
- return e *= this.itemSize, this.normalized && (t = ue(t, this.array), n = ue(n, this.array), r = ue(r, this.array), i = ue(i, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = r, this.array[e + 3] = i, this;
3063
+ return e *= this.itemSize, this.normalized && (t = B(t, this.array), n = B(n, this.array), r = B(r, this.array), i = B(i, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = r, this.array[e + 3] = i, this;
3064
3064
  }
3065
3065
  onUpload(e) {
3066
3066
  return this.onUploadCallback = e, this;
@@ -5447,21 +5447,21 @@ var Ji = class e extends vn {
5447
5447
  let e = 0, t = k * e;
5448
5448
  for (let e = 0; e < I; e++) {
5449
5449
  let n = F[e];
5450
- R(n[2] + t, n[1] + t, n[0] + t);
5450
+ ie(n[2] + t, n[1] + t, n[0] + t);
5451
5451
  }
5452
5452
  e = s + p * 2, t = k * e;
5453
5453
  for (let e = 0; e < I; e++) {
5454
5454
  let n = F[e];
5455
- R(n[0] + t, n[1] + t, n[2] + t);
5455
+ ie(n[0] + t, n[1] + t, n[2] + t);
5456
5456
  }
5457
5457
  } else {
5458
5458
  for (let e = 0; e < I; e++) {
5459
5459
  let t = F[e];
5460
- R(t[2], t[1], t[0]);
5460
+ ie(t[2], t[1], t[0]);
5461
5461
  }
5462
5462
  for (let e = 0; e < I; e++) {
5463
5463
  let t = F[e];
5464
- R(t[0] + k * s, t[1] + k * s, t[2] + k * s);
5464
+ ie(t[0] + k * s, t[1] + k * s, t[2] + k * s);
5465
5465
  }
5466
5466
  }
5467
5467
  n.addGroup(e, r.length / 3 - e, 0);
@@ -5482,27 +5482,27 @@ var Ji = class e extends vn {
5482
5482
  i < 0 && (i = e.length - 1);
5483
5483
  for (let e = 0, n = s + p * 2; e < n; e++) {
5484
5484
  let n = k * e, a = k * (e + 1);
5485
- z(t + r + n, t + i + n, t + i + a, t + r + a);
5485
+ R(t + r + n, t + i + n, t + i + a, t + r + a);
5486
5486
  }
5487
5487
  }
5488
5488
  }
5489
5489
  function re(e, t, n) {
5490
5490
  a.push(e), a.push(t), a.push(n);
5491
5491
  }
5492
- function R(e, t, i) {
5493
- B(e), B(t), B(i);
5492
+ function ie(e, t, i) {
5493
+ z(e), z(t), z(i);
5494
5494
  let a = r.length / 3, o = h.generateTopUV(n, r, a - 3, a - 2, a - 1);
5495
- ie(o[0]), ie(o[1]), ie(o[2]);
5495
+ ae(o[0]), ae(o[1]), ae(o[2]);
5496
5496
  }
5497
- function z(e, t, i, a) {
5498
- B(e), B(t), B(a), B(t), B(i), B(a);
5497
+ function R(e, t, i, a) {
5498
+ z(e), z(t), z(a), z(t), z(i), z(a);
5499
5499
  let o = r.length / 3, s = h.generateSideWallUV(n, r, o - 6, o - 3, o - 2, o - 1);
5500
- ie(s[0]), ie(s[1]), ie(s[3]), ie(s[1]), ie(s[2]), ie(s[3]);
5500
+ ae(s[0]), ae(s[1]), ae(s[3]), ae(s[1]), ae(s[2]), ae(s[3]);
5501
5501
  }
5502
- function B(e) {
5502
+ function z(e) {
5503
5503
  r.push(a[e * 3 + 0]), r.push(a[e * 3 + 1]), r.push(a[e * 3 + 2]);
5504
5504
  }
5505
- function ie(e) {
5505
+ function ae(e) {
5506
5506
  i.push(e.x), i.push(e.y);
5507
5507
  }
5508
5508
  }
@@ -9243,7 +9243,7 @@ function Cc(e, t, n, r, i, a, o) {
9243
9243
  let e = Za[w];
9244
9244
  O = e.vertexShader, k = e.fragmentShader;
9245
9245
  } else O = a.vertexShader, k = a.fragmentShader, c.update(a), A = c.getVertexShaderID(a), j = c.getFragmentShaderID(a);
9246
- let M = e.getRenderTarget(), N = e.state.buffers.depth.getReversed(), P = _.isInstancedMesh === !0, F = _.isBatchedMesh === !0, I = !!a.map, ee = !!a.matcap, te = !!S, L = !!a.aoMap, ne = !!a.lightMap, re = !!a.bumpMap, R = !!a.normalMap, z = !!a.displacementMap, B = !!a.emissiveMap, ie = !!a.metalnessMap, ae = !!a.roughnessMap, oe = a.anisotropy > 0, se = a.clearcoat > 0, ce = a.dispersion > 0, le = a.iridescence > 0, ue = a.sheen > 0, de = a.transmission > 0, V = oe && !!a.anisotropyMap, H = se && !!a.clearcoatMap, U = se && !!a.clearcoatNormalMap, fe = se && !!a.clearcoatRoughnessMap, W = le && !!a.iridescenceMap, G = le && !!a.iridescenceThicknessMap, K = ue && !!a.sheenColorMap, pe = ue && !!a.sheenRoughnessMap, q = !!a.specularMap, me = !!a.specularColorMap, J = !!a.specularIntensityMap, he = de && !!a.transmissionMap, ge = de && !!a.thicknessMap, _e = !!a.gradientMap, ve = !!a.alphaMap, ye = a.alphaTest > 0, be = !!a.alphaHash, xe = !!a.extensions, Se = 0;
9246
+ let M = e.getRenderTarget(), N = e.state.buffers.depth.getReversed(), P = _.isInstancedMesh === !0, F = _.isBatchedMesh === !0, I = !!a.map, ee = !!a.matcap, te = !!S, L = !!a.aoMap, ne = !!a.lightMap, re = !!a.bumpMap, ie = !!a.normalMap, R = !!a.displacementMap, z = !!a.emissiveMap, ae = !!a.metalnessMap, oe = !!a.roughnessMap, se = a.anisotropy > 0, ce = a.clearcoat > 0, le = a.dispersion > 0, ue = a.iridescence > 0, B = a.sheen > 0, de = a.transmission > 0, V = se && !!a.anisotropyMap, H = ce && !!a.clearcoatMap, U = ce && !!a.clearcoatNormalMap, fe = ce && !!a.clearcoatRoughnessMap, W = ue && !!a.iridescenceMap, G = ue && !!a.iridescenceThicknessMap, K = B && !!a.sheenColorMap, pe = B && !!a.sheenRoughnessMap, q = !!a.specularMap, me = !!a.specularColorMap, J = !!a.specularIntensityMap, he = de && !!a.transmissionMap, ge = de && !!a.thicknessMap, _e = !!a.gradientMap, ve = !!a.alphaMap, ye = a.alphaTest > 0, be = !!a.alphaHash, xe = !!a.extensions, Se = 0;
9247
9247
  a.toneMapped && (M === null || M.isXRRenderTarget === !0) && (Se = e.toneMapping);
9248
9248
  let Ce = {
9249
9249
  shaderID: w,
@@ -9273,24 +9273,24 @@ function Cc(e, t, n, r, i, a, o) {
9273
9273
  aoMap: L,
9274
9274
  lightMap: ne,
9275
9275
  bumpMap: re,
9276
- normalMap: R,
9277
- displacementMap: f && z,
9278
- emissiveMap: B,
9279
- normalMapObjectSpace: R && a.normalMapType === 1,
9280
- normalMapTangentSpace: R && a.normalMapType === 0,
9281
- metalnessMap: ie,
9282
- roughnessMap: ae,
9283
- anisotropy: oe,
9276
+ normalMap: ie,
9277
+ displacementMap: f && R,
9278
+ emissiveMap: z,
9279
+ normalMapObjectSpace: ie && a.normalMapType === 1,
9280
+ normalMapTangentSpace: ie && a.normalMapType === 0,
9281
+ metalnessMap: ae,
9282
+ roughnessMap: oe,
9283
+ anisotropy: se,
9284
9284
  anisotropyMap: V,
9285
- clearcoat: se,
9285
+ clearcoat: ce,
9286
9286
  clearcoatMap: H,
9287
9287
  clearcoatNormalMap: U,
9288
9288
  clearcoatRoughnessMap: fe,
9289
- dispersion: ce,
9290
- iridescence: le,
9289
+ dispersion: le,
9290
+ iridescence: ue,
9291
9291
  iridescenceMap: W,
9292
9292
  iridescenceThicknessMap: G,
9293
- sheen: ue,
9293
+ sheen: B,
9294
9294
  sheenColorMap: K,
9295
9295
  sheenRoughnessMap: pe,
9296
9296
  specularMap: q,
@@ -9309,11 +9309,11 @@ function Cc(e, t, n, r, i, a, o) {
9309
9309
  aoMapUv: L && h(a.aoMap.channel),
9310
9310
  lightMapUv: ne && h(a.lightMap.channel),
9311
9311
  bumpMapUv: re && h(a.bumpMap.channel),
9312
- normalMapUv: R && h(a.normalMap.channel),
9313
- displacementMapUv: z && h(a.displacementMap.channel),
9314
- emissiveMapUv: B && h(a.emissiveMap.channel),
9315
- metalnessMapUv: ie && h(a.metalnessMap.channel),
9316
- roughnessMapUv: ae && h(a.roughnessMap.channel),
9312
+ normalMapUv: ie && h(a.normalMap.channel),
9313
+ displacementMapUv: R && h(a.displacementMap.channel),
9314
+ emissiveMapUv: z && h(a.emissiveMap.channel),
9315
+ metalnessMapUv: ae && h(a.metalnessMap.channel),
9316
+ roughnessMapUv: oe && h(a.roughnessMap.channel),
9317
9317
  anisotropyMapUv: V && h(a.anisotropyMap.channel),
9318
9318
  clearcoatMapUv: H && h(a.clearcoatMap.channel),
9319
9319
  clearcoatNormalMapUv: U && h(a.clearcoatNormalMap.channel),
@@ -9328,7 +9328,7 @@ function Cc(e, t, n, r, i, a, o) {
9328
9328
  transmissionMapUv: he && h(a.transmissionMap.channel),
9329
9329
  thicknessMapUv: ge && h(a.thicknessMap.channel),
9330
9330
  alphaMapUv: ve && h(a.alphaMap.channel),
9331
- vertexTangents: !!y.attributes.tangent && (R || oe),
9331
+ vertexTangents: !!y.attributes.tangent && (ie || se),
9332
9332
  vertexColors: a.vertexColors,
9333
9333
  vertexAlphas: a.vertexColors === !0 && !!y.attributes.color && y.attributes.color.itemSize === 4,
9334
9334
  pointsUvs: _.isPoints === !0 && !!y.attributes.uv && (I || ve),
@@ -9363,7 +9363,7 @@ function Cc(e, t, n, r, i, a, o) {
9363
9363
  shadowMapType: e.shadowMap.type,
9364
9364
  toneMapping: Se,
9365
9365
  decodeVideoTexture: I && a.map.isVideoTexture === !0 && Y.getTransfer(a.map.colorSpace) === "srgb",
9366
- decodeVideoTextureEmissive: B && a.emissiveMap.isVideoTexture === !0 && Y.getTransfer(a.emissiveMap.colorSpace) === "srgb",
9366
+ decodeVideoTextureEmissive: z && a.emissiveMap.isVideoTexture === !0 && Y.getTransfer(a.emissiveMap.colorSpace) === "srgb",
9367
9367
  premultipliedAlpha: a.premultipliedAlpha,
9368
9368
  doubleSided: a.side === 2,
9369
9369
  flipSided: a.side === 1,
@@ -9931,7 +9931,7 @@ function Bc(e, t) {
9931
9931
  return r;
9932
9932
  },
9933
9933
  setTest: function(t) {
9934
- t ? z(e.DEPTH_TEST) : B(e.DEPTH_TEST);
9934
+ t ? R(e.DEPTH_TEST) : z(e.DEPTH_TEST);
9935
9935
  },
9936
9936
  setMask: function(t) {
9937
9937
  i !== t && !n && (e.depthMask(t), i = t);
@@ -9983,7 +9983,7 @@ function Bc(e, t) {
9983
9983
  let t = !1, n = null, r = null, i = null, a = null, o = null, s = null, c = null, l = null;
9984
9984
  return {
9985
9985
  setTest: function(n) {
9986
- t || (n ? z(e.STENCIL_TEST) : B(e.STENCIL_TEST));
9986
+ t || (n ? R(e.STENCIL_TEST) : z(e.STENCIL_TEST));
9987
9987
  },
9988
9988
  setMask: function(r) {
9989
9989
  n !== r && !t && (e.stencilMask(r), n = r);
@@ -10014,18 +10014,18 @@ function Bc(e, t) {
10014
10014
  for (let o = 0; o < r; o++) t === e.TEXTURE_3D || t === e.TEXTURE_2D_ARRAY ? e.texImage3D(n, 0, e.RGBA, 1, 1, i, 0, e.RGBA, e.UNSIGNED_BYTE, a) : e.texImage2D(n + o, 0, e.RGBA, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, a);
10015
10015
  return o;
10016
10016
  }
10017
- let R = {};
10018
- R[e.TEXTURE_2D] = re(e.TEXTURE_2D, e.TEXTURE_2D, 1), R[e.TEXTURE_CUBE_MAP] = re(e.TEXTURE_CUBE_MAP, e.TEXTURE_CUBE_MAP_POSITIVE_X, 6), R[e.TEXTURE_2D_ARRAY] = re(e.TEXTURE_2D_ARRAY, e.TEXTURE_2D_ARRAY, 1, 1), R[e.TEXTURE_3D] = re(e.TEXTURE_3D, e.TEXTURE_3D, 1, 1), a.setClear(0, 0, 0, 1), o.setClear(1), s.setClear(0), z(e.DEPTH_TEST), o.setFunc(3), de(!1), V(1), z(e.CULL_FACE), le(0);
10019
- function z(t) {
10017
+ let ie = {};
10018
+ ie[e.TEXTURE_2D] = re(e.TEXTURE_2D, e.TEXTURE_2D, 1), ie[e.TEXTURE_CUBE_MAP] = re(e.TEXTURE_CUBE_MAP, e.TEXTURE_CUBE_MAP_POSITIVE_X, 6), ie[e.TEXTURE_2D_ARRAY] = re(e.TEXTURE_2D_ARRAY, e.TEXTURE_2D_ARRAY, 1, 1), ie[e.TEXTURE_3D] = re(e.TEXTURE_3D, e.TEXTURE_3D, 1, 1), a.setClear(0, 0, 0, 1), o.setClear(1), s.setClear(0), R(e.DEPTH_TEST), o.setFunc(3), de(!1), V(1), R(e.CULL_FACE), ue(0);
10019
+ function R(t) {
10020
10020
  u[t] !== !0 && (e.enable(t), u[t] = !0);
10021
10021
  }
10022
- function B(t) {
10022
+ function z(t) {
10023
10023
  u[t] !== !1 && (e.disable(t), u[t] = !1);
10024
10024
  }
10025
- function ie(t, n) {
10025
+ function ae(t, n) {
10026
10026
  return d[t] !== n && (e.bindFramebuffer(t, n), d[t] = n, t === e.DRAW_FRAMEBUFFER && (d[e.FRAMEBUFFER] = n), t === e.FRAMEBUFFER && (d[e.DRAW_FRAMEBUFFER] = n), !0);
10027
10027
  }
10028
- function ae(t, n) {
10028
+ function oe(t, n) {
10029
10029
  let r = p, i = !1;
10030
10030
  if (t) {
10031
10031
  r = f.get(n), r === void 0 && (r = [], f.set(n, r));
@@ -10037,16 +10037,16 @@ function Bc(e, t) {
10037
10037
  } else r[0] !== e.BACK && (r[0] = e.BACK, i = !0);
10038
10038
  i && e.drawBuffers(r);
10039
10039
  }
10040
- function oe(t) {
10040
+ function se(t) {
10041
10041
  return m !== t && (e.useProgram(t), m = t, !0);
10042
10042
  }
10043
- let se = {
10043
+ let ce = {
10044
10044
  100: e.FUNC_ADD,
10045
10045
  101: e.FUNC_SUBTRACT,
10046
10046
  102: e.FUNC_REVERSE_SUBTRACT
10047
10047
  };
10048
- se[103] = e.MIN, se[104] = e.MAX;
10049
- let ce = {
10048
+ ce[103] = e.MIN, ce[104] = e.MAX;
10049
+ let le = {
10050
10050
  200: e.ZERO,
10051
10051
  201: e.ONE,
10052
10052
  202: e.SRC_COLOR,
@@ -10063,12 +10063,12 @@ function Bc(e, t) {
10063
10063
  213: e.CONSTANT_ALPHA,
10064
10064
  214: e.ONE_MINUS_CONSTANT_ALPHA
10065
10065
  };
10066
- function le(t, n, r, i, a, o, s, c, l, u) {
10066
+ function ue(t, n, r, i, a, o, s, c, l, u) {
10067
10067
  if (t === 0) {
10068
- h === !0 && (B(e.BLEND), h = !1);
10068
+ h === !0 && (z(e.BLEND), h = !1);
10069
10069
  return;
10070
10070
  }
10071
- if (h === !1 && (z(e.BLEND), h = !0), t !== 5) {
10071
+ if (h === !1 && (R(e.BLEND), h = !0), t !== 5) {
10072
10072
  if (t !== g || u !== T) {
10073
10073
  if ((_ !== 100 || b !== 100) && (e.blendEquation(e.FUNC_ADD), _ = 100, b = 100), u) switch (t) {
10074
10074
  case 1:
@@ -10104,29 +10104,29 @@ function Bc(e, t) {
10104
10104
  }
10105
10105
  return;
10106
10106
  }
10107
- a ||= n, o ||= r, s ||= i, (n !== _ || a !== b) && (e.blendEquationSeparate(se[n], se[a]), _ = n, b = a), (r !== v || i !== y || o !== x || s !== S) && (e.blendFuncSeparate(ce[r], ce[i], ce[o], ce[s]), v = r, y = i, x = o, S = s), (c.equals(C) === !1 || l !== w) && (e.blendColor(c.r, c.g, c.b, l), C.copy(c), w = l), g = t, T = !1;
10107
+ a ||= n, o ||= r, s ||= i, (n !== _ || a !== b) && (e.blendEquationSeparate(ce[n], ce[a]), _ = n, b = a), (r !== v || i !== y || o !== x || s !== S) && (e.blendFuncSeparate(le[r], le[i], le[o], le[s]), v = r, y = i, x = o, S = s), (c.equals(C) === !1 || l !== w) && (e.blendColor(c.r, c.g, c.b, l), C.copy(c), w = l), g = t, T = !1;
10108
10108
  }
10109
- function ue(t, n) {
10110
- t.side === 2 ? B(e.CULL_FACE) : z(e.CULL_FACE);
10109
+ function B(t, n) {
10110
+ t.side === 2 ? z(e.CULL_FACE) : R(e.CULL_FACE);
10111
10111
  let r = t.side === 1;
10112
- n && (r = !r), de(r), t.blending === 1 && t.transparent === !1 ? le(0) : le(t.blending, t.blendEquation, t.blendSrc, t.blendDst, t.blendEquationAlpha, t.blendSrcAlpha, t.blendDstAlpha, t.blendColor, t.blendAlpha, t.premultipliedAlpha), o.setFunc(t.depthFunc), o.setTest(t.depthTest), o.setMask(t.depthWrite), a.setMask(t.colorWrite);
10112
+ n && (r = !r), de(r), t.blending === 1 && t.transparent === !1 ? ue(0) : ue(t.blending, t.blendEquation, t.blendSrc, t.blendDst, t.blendEquationAlpha, t.blendSrcAlpha, t.blendDstAlpha, t.blendColor, t.blendAlpha, t.premultipliedAlpha), o.setFunc(t.depthFunc), o.setTest(t.depthTest), o.setMask(t.depthWrite), a.setMask(t.colorWrite);
10113
10113
  let i = t.stencilWrite;
10114
- s.setTest(i), i && (s.setMask(t.stencilWriteMask), s.setFunc(t.stencilFunc, t.stencilRef, t.stencilFuncMask), s.setOp(t.stencilFail, t.stencilZFail, t.stencilZPass)), U(t.polygonOffset, t.polygonOffsetFactor, t.polygonOffsetUnits), t.alphaToCoverage === !0 ? z(e.SAMPLE_ALPHA_TO_COVERAGE) : B(e.SAMPLE_ALPHA_TO_COVERAGE);
10114
+ s.setTest(i), i && (s.setMask(t.stencilWriteMask), s.setFunc(t.stencilFunc, t.stencilRef, t.stencilFuncMask), s.setOp(t.stencilFail, t.stencilZFail, t.stencilZPass)), U(t.polygonOffset, t.polygonOffsetFactor, t.polygonOffsetUnits), t.alphaToCoverage === !0 ? R(e.SAMPLE_ALPHA_TO_COVERAGE) : z(e.SAMPLE_ALPHA_TO_COVERAGE);
10115
10115
  }
10116
10116
  function de(t) {
10117
10117
  E !== t && (t ? e.frontFace(e.CW) : e.frontFace(e.CCW), E = t);
10118
10118
  }
10119
10119
  function V(t) {
10120
- t === 0 ? B(e.CULL_FACE) : (z(e.CULL_FACE), t !== D && (t === 1 ? e.cullFace(e.BACK) : t === 2 ? e.cullFace(e.FRONT) : e.cullFace(e.FRONT_AND_BACK))), D = t;
10120
+ t === 0 ? z(e.CULL_FACE) : (R(e.CULL_FACE), t !== D && (t === 1 ? e.cullFace(e.BACK) : t === 2 ? e.cullFace(e.FRONT) : e.cullFace(e.FRONT_AND_BACK))), D = t;
10121
10121
  }
10122
10122
  function H(t) {
10123
10123
  t !== O && (M && e.lineWidth(t), O = t);
10124
10124
  }
10125
10125
  function U(t, n, r) {
10126
- t ? (z(e.POLYGON_OFFSET_FILL), (k !== n || A !== r) && (e.polygonOffset(n, r), k = n, A = r)) : B(e.POLYGON_OFFSET_FILL);
10126
+ t ? (R(e.POLYGON_OFFSET_FILL), (k !== n || A !== r) && (e.polygonOffset(n, r), k = n, A = r)) : z(e.POLYGON_OFFSET_FILL);
10127
10127
  }
10128
10128
  function fe(t) {
10129
- t ? z(e.SCISSOR_TEST) : B(e.SCISSOR_TEST);
10129
+ t ? R(e.SCISSOR_TEST) : z(e.SCISSOR_TEST);
10130
10130
  }
10131
10131
  function W(t) {
10132
10132
  t === void 0 && (t = e.TEXTURE0 + j - 1), F !== t && (e.activeTexture(t), F = t);
@@ -10137,7 +10137,7 @@ function Bc(e, t) {
10137
10137
  i === void 0 && (i = {
10138
10138
  type: void 0,
10139
10139
  texture: void 0
10140
- }, I[r] = i), (i.type !== t || i.texture !== n) && (F !== r && (e.activeTexture(r), F = r), e.bindTexture(t, n || R[t]), i.type = t, i.texture = n);
10140
+ }, I[r] = i), (i.type !== t || i.texture !== n) && (F !== r && (e.activeTexture(r), F = r), e.bindTexture(t, n || ie[t]), i.type = t, i.texture = n);
10141
10141
  }
10142
10142
  function K() {
10143
10143
  let t = I[F];
@@ -10238,13 +10238,13 @@ function Bc(e, t) {
10238
10238
  depth: o,
10239
10239
  stencil: s
10240
10240
  },
10241
- enable: z,
10242
- disable: B,
10243
- bindFramebuffer: ie,
10244
- drawBuffers: ae,
10245
- useProgram: oe,
10246
- setBlending: le,
10247
- setMaterial: ue,
10241
+ enable: R,
10242
+ disable: z,
10243
+ bindFramebuffer: ae,
10244
+ drawBuffers: oe,
10245
+ useProgram: se,
10246
+ setBlending: ue,
10247
+ setMaterial: B,
10248
10248
  setFlipSided: de,
10249
10249
  setCullFace: V,
10250
10250
  setLineWidth: H,
@@ -10382,7 +10382,7 @@ function Vc(o, s, c, l, u, d, p) {
10382
10382
  if (r === null) console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");
10383
10383
  else if (r.complete === !1) console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");
10384
10384
  else {
10385
- le(n, e, t);
10385
+ ue(n, e, t);
10386
10386
  return;
10387
10387
  }
10388
10388
  } else e.isExternalTexture && (n.__webglTexture = e.sourceTexture ? e.sourceTexture : null);
@@ -10391,7 +10391,7 @@ function Vc(o, s, c, l, u, d, p) {
10391
10391
  function ne(e, t) {
10392
10392
  let n = l.get(e);
10393
10393
  if (e.isRenderTargetTexture === !1 && e.version > 0 && n.__version !== e.version) {
10394
- le(n, e, t);
10394
+ ue(n, e, t);
10395
10395
  return;
10396
10396
  }
10397
10397
  c.bindTexture(o.TEXTURE_2D_ARRAY, n.__webglTexture, o.TEXTURE0 + t);
@@ -10399,31 +10399,31 @@ function Vc(o, s, c, l, u, d, p) {
10399
10399
  function re(e, t) {
10400
10400
  let n = l.get(e);
10401
10401
  if (e.isRenderTargetTexture === !1 && e.version > 0 && n.__version !== e.version) {
10402
- le(n, e, t);
10402
+ ue(n, e, t);
10403
10403
  return;
10404
10404
  }
10405
10405
  c.bindTexture(o.TEXTURE_3D, n.__webglTexture, o.TEXTURE0 + t);
10406
10406
  }
10407
- function R(e, t) {
10407
+ function ie(e, t) {
10408
10408
  let n = l.get(e);
10409
10409
  if (e.version > 0 && n.__version !== e.version) {
10410
- ue(n, e, t);
10410
+ B(n, e, t);
10411
10411
  return;
10412
10412
  }
10413
10413
  c.bindTexture(o.TEXTURE_CUBE_MAP, n.__webglTexture, o.TEXTURE0 + t);
10414
10414
  }
10415
- let z = {
10415
+ let R = {
10416
10416
  [e]: o.REPEAT,
10417
10417
  [t]: o.CLAMP_TO_EDGE,
10418
10418
  [n]: o.MIRRORED_REPEAT
10419
- }, B = {
10419
+ }, z = {
10420
10420
  [r]: o.NEAREST,
10421
10421
  1004: o.NEAREST_MIPMAP_NEAREST,
10422
10422
  1005: o.NEAREST_MIPMAP_LINEAR,
10423
10423
  [i]: o.LINEAR,
10424
10424
  1007: o.LINEAR_MIPMAP_NEAREST,
10425
10425
  [a]: o.LINEAR_MIPMAP_LINEAR
10426
- }, ie = {
10426
+ }, ae = {
10427
10427
  512: o.NEVER,
10428
10428
  519: o.ALWAYS,
10429
10429
  513: o.LESS,
@@ -10433,8 +10433,8 @@ function Vc(o, s, c, l, u, d, p) {
10433
10433
  516: o.GREATER,
10434
10434
  517: o.NOTEQUAL
10435
10435
  };
10436
- function ae(e, t) {
10437
- if (t.type === 1015 && s.has("OES_texture_float_linear") === !1 && (t.magFilter === 1006 || t.magFilter === 1007 || t.magFilter === 1005 || t.magFilter === 1008 || t.minFilter === 1006 || t.minFilter === 1007 || t.minFilter === 1005 || t.minFilter === 1008) && console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."), o.texParameteri(e, o.TEXTURE_WRAP_S, z[t.wrapS]), o.texParameteri(e, o.TEXTURE_WRAP_T, z[t.wrapT]), (e === o.TEXTURE_3D || e === o.TEXTURE_2D_ARRAY) && o.texParameteri(e, o.TEXTURE_WRAP_R, z[t.wrapR]), o.texParameteri(e, o.TEXTURE_MAG_FILTER, B[t.magFilter]), o.texParameteri(e, o.TEXTURE_MIN_FILTER, B[t.minFilter]), t.compareFunction && (o.texParameteri(e, o.TEXTURE_COMPARE_MODE, o.COMPARE_REF_TO_TEXTURE), o.texParameteri(e, o.TEXTURE_COMPARE_FUNC, ie[t.compareFunction])), s.has("EXT_texture_filter_anisotropic") === !0) {
10436
+ function oe(e, t) {
10437
+ if (t.type === 1015 && s.has("OES_texture_float_linear") === !1 && (t.magFilter === 1006 || t.magFilter === 1007 || t.magFilter === 1005 || t.magFilter === 1008 || t.minFilter === 1006 || t.minFilter === 1007 || t.minFilter === 1005 || t.minFilter === 1008) && console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."), o.texParameteri(e, o.TEXTURE_WRAP_S, R[t.wrapS]), o.texParameteri(e, o.TEXTURE_WRAP_T, R[t.wrapT]), (e === o.TEXTURE_3D || e === o.TEXTURE_2D_ARRAY) && o.texParameteri(e, o.TEXTURE_WRAP_R, R[t.wrapR]), o.texParameteri(e, o.TEXTURE_MAG_FILTER, z[t.magFilter]), o.texParameteri(e, o.TEXTURE_MIN_FILTER, z[t.minFilter]), t.compareFunction && (o.texParameteri(e, o.TEXTURE_COMPARE_MODE, o.COMPARE_REF_TO_TEXTURE), o.texParameteri(e, o.TEXTURE_COMPARE_FUNC, ae[t.compareFunction])), s.has("EXT_texture_filter_anisotropic") === !0) {
10438
10438
  if (t.magFilter === 1003 || t.minFilter !== 1005 && t.minFilter !== 1008 || t.type === 1015 && s.has("OES_texture_float_linear") === !1) return;
10439
10439
  if (t.anisotropy > 1 || l.get(t).__currentAnisotropy) {
10440
10440
  let n = s.get("EXT_texture_filter_anisotropic");
@@ -10442,7 +10442,7 @@ function Vc(o, s, c, l, u, d, p) {
10442
10442
  }
10443
10443
  }
10444
10444
  }
10445
- function oe(e, t) {
10445
+ function se(e, t) {
10446
10446
  let n = !1;
10447
10447
  e.__webglInit === void 0 && (e.__webglInit = !0, t.addEventListener("dispose", A));
10448
10448
  let r = t.source, i = y.get(r);
@@ -10458,18 +10458,18 @@ function Vc(o, s, c, l, u, d, p) {
10458
10458
  }
10459
10459
  return n;
10460
10460
  }
10461
- function se(e, t, n) {
10461
+ function ce(e, t, n) {
10462
10462
  return Math.floor(Math.floor(e / n) / t);
10463
10463
  }
10464
- function ce(e, t, n, r) {
10464
+ function le(e, t, n, r) {
10465
10465
  let i = e.updateRanges;
10466
10466
  if (i.length === 0) c.texSubImage2D(o.TEXTURE_2D, 0, 0, 0, t.width, t.height, n, r, t.data);
10467
10467
  else {
10468
10468
  i.sort((e, t) => e.start - t.start);
10469
10469
  let a = 0;
10470
10470
  for (let e = 1; e < i.length; e++) {
10471
- let n = i[a], r = i[e], o = n.start + n.count, s = se(r.start, t.width, 4), c = se(n.start, t.width, 4);
10472
- r.start <= o + 1 && s === c && se(r.start + r.count - 1, t.width, 4) === s ? n.count = Math.max(n.count, r.start + r.count - n.start) : (++a, i[a] = r);
10471
+ let n = i[a], r = i[e], o = n.start + n.count, s = ce(r.start, t.width, 4), c = ce(n.start, t.width, 4);
10472
+ r.start <= o + 1 && s === c && ce(r.start + r.count - 1, t.width, 4) === s ? n.count = Math.max(n.count, r.start + r.count - n.start) : (++a, i[a] = r);
10473
10473
  }
10474
10474
  i.length = a + 1;
10475
10475
  let s = o.getParameter(o.UNPACK_ROW_LENGTH), l = o.getParameter(o.UNPACK_SKIP_PIXELS), u = o.getParameter(o.UNPACK_SKIP_ROWS);
@@ -10481,10 +10481,10 @@ function Vc(o, s, c, l, u, d, p) {
10481
10481
  e.clearUpdateRanges(), o.pixelStorei(o.UNPACK_ROW_LENGTH, s), o.pixelStorei(o.UNPACK_SKIP_PIXELS, l), o.pixelStorei(o.UNPACK_SKIP_ROWS, u);
10482
10482
  }
10483
10483
  }
10484
- function le(e, t, n) {
10484
+ function ue(e, t, n) {
10485
10485
  let r = o.TEXTURE_2D;
10486
10486
  (t.isDataArrayTexture || t.isCompressedArrayTexture) && (r = o.TEXTURE_2D_ARRAY), t.isData3DTexture && (r = o.TEXTURE_3D);
10487
- let i = oe(e, t), a = t.source;
10487
+ let i = se(e, t), a = t.source;
10488
10488
  c.bindTexture(r, e.__webglTexture, o.TEXTURE0 + n);
10489
10489
  let s = l.get(a);
10490
10490
  if (a.version !== s.__version || i === !0) {
@@ -10494,7 +10494,7 @@ function Vc(o, s, c, l, u, d, p) {
10494
10494
  let m = C(t.image, !1, u.maxTextureSize);
10495
10495
  m = ve(t, m);
10496
10496
  let h = d.convert(t.format, t.colorSpace), g = d.convert(t.type), _ = D(t.internalFormat, h, g, t.colorSpace, t.isVideoTexture);
10497
- ae(r, t);
10497
+ oe(r, t);
10498
10498
  let v, y = t.mipmaps, b = t.isVideoTexture !== !0, x = s.__version === void 0 || i === !0, S = a.dataReady, E = k(t, m);
10499
10499
  if (t.isDepthTexture) _ = O(t.format === f, t.type), x && (b ? c.texStorage2D(o.TEXTURE_2D, 1, _, m.width, m.height) : c.texImage2D(o.TEXTURE_2D, 0, _, m.width, m.height, 0, h, g, null));
10500
10500
  else if (t.isDataTexture) {
@@ -10502,7 +10502,7 @@ function Vc(o, s, c, l, u, d, p) {
10502
10502
  b && x && c.texStorage2D(o.TEXTURE_2D, E, _, y[0].width, y[0].height);
10503
10503
  for (let e = 0, t = y.length; e < t; e++) v = y[e], b ? S && c.texSubImage2D(o.TEXTURE_2D, e, 0, 0, v.width, v.height, h, g, v.data) : c.texImage2D(o.TEXTURE_2D, e, _, v.width, v.height, 0, h, g, v.data);
10504
10504
  t.generateMipmaps = !1;
10505
- } else b ? (x && c.texStorage2D(o.TEXTURE_2D, E, _, m.width, m.height), S && ce(t, m, h, g)) : c.texImage2D(o.TEXTURE_2D, 0, _, m.width, m.height, 0, h, g, m.data);
10505
+ } else b ? (x && c.texStorage2D(o.TEXTURE_2D, E, _, m.width, m.height), S && le(t, m, h, g)) : c.texImage2D(o.TEXTURE_2D, 0, _, m.width, m.height, 0, h, g, m.data);
10506
10506
  } else if (t.isCompressedTexture) {
10507
10507
  if (t.isCompressedArrayTexture) {
10508
10508
  b && x && c.texStorage3D(o.TEXTURE_2D_ARRAY, E, _, y[0].width, y[0].height, m.depth);
@@ -10566,9 +10566,9 @@ function Vc(o, s, c, l, u, d, p) {
10566
10566
  }
10567
10567
  e.__version = t.version;
10568
10568
  }
10569
- function ue(e, t, n) {
10569
+ function B(e, t, n) {
10570
10570
  if (t.image.length !== 6) return;
10571
- let r = oe(e, t), i = t.source;
10571
+ let r = se(e, t), i = t.source;
10572
10572
  c.bindTexture(o.TEXTURE_CUBE_MAP, e.__webglTexture, o.TEXTURE0 + n);
10573
10573
  let a = l.get(i);
10574
10574
  if (i.version !== a.__version || r === !0) {
@@ -10578,7 +10578,7 @@ function Vc(o, s, c, l, u, d, p) {
10578
10578
  let f = t.isCompressedTexture || t.image[0].isCompressedTexture, p = t.image[0] && t.image[0].isDataTexture, m = [];
10579
10579
  for (let e = 0; e < 6; e++) !f && !p ? m[e] = C(t.image[e], !0, u.maxCubemapSize) : m[e] = p ? t.image[e].image : t.image[e], m[e] = ve(t, m[e]);
10580
10580
  let h = m[0], g = d.convert(t.format, t.colorSpace), _ = d.convert(t.type), v = D(t.internalFormat, g, _, t.colorSpace), y = t.isVideoTexture !== !0, b = a.__version === void 0 || r === !0, x = i.dataReady, S = k(t, h);
10581
- ae(o.TEXTURE_CUBE_MAP, t);
10581
+ oe(o.TEXTURE_CUBE_MAP, t);
10582
10582
  let E;
10583
10583
  if (f) {
10584
10584
  y && b && c.texStorage2D(o.TEXTURE_CUBE_MAP, S, v, h.width, h.height);
@@ -10712,19 +10712,19 @@ function Vc(o, s, c, l, u, d, p) {
10712
10712
  }
10713
10713
  }
10714
10714
  if (a) {
10715
- c.bindTexture(o.TEXTURE_CUBE_MAP, r.__webglTexture), ae(o.TEXTURE_CUBE_MAP, t);
10715
+ c.bindTexture(o.TEXTURE_CUBE_MAP, r.__webglTexture), oe(o.TEXTURE_CUBE_MAP, t);
10716
10716
  for (let r = 0; r < 6; r++) if (t.mipmaps && t.mipmaps.length > 0) for (let i = 0; i < t.mipmaps.length; i++) de(n.__webglFramebuffer[r][i], e, t, o.COLOR_ATTACHMENT0, o.TEXTURE_CUBE_MAP_POSITIVE_X + r, i);
10717
10717
  else de(n.__webglFramebuffer[r], e, t, o.COLOR_ATTACHMENT0, o.TEXTURE_CUBE_MAP_POSITIVE_X + r, 0);
10718
10718
  w(t) && T(o.TEXTURE_CUBE_MAP), c.unbindTexture();
10719
10719
  } else if (s) {
10720
10720
  for (let t = 0, r = i.length; t < r; t++) {
10721
10721
  let r = i[t], a = l.get(r), s = o.TEXTURE_2D;
10722
- (e.isWebGL3DRenderTarget || e.isWebGLArrayRenderTarget) && (s = e.isWebGL3DRenderTarget ? o.TEXTURE_3D : o.TEXTURE_2D_ARRAY), c.bindTexture(s, a.__webglTexture), ae(s, r), de(n.__webglFramebuffer, e, r, o.COLOR_ATTACHMENT0 + t, s, 0), w(r) && T(s);
10722
+ (e.isWebGL3DRenderTarget || e.isWebGLArrayRenderTarget) && (s = e.isWebGL3DRenderTarget ? o.TEXTURE_3D : o.TEXTURE_2D_ARRAY), c.bindTexture(s, a.__webglTexture), oe(s, r), de(n.__webglFramebuffer, e, r, o.COLOR_ATTACHMENT0 + t, s, 0), w(r) && T(s);
10723
10723
  }
10724
10724
  c.unbindTexture();
10725
10725
  } else {
10726
10726
  let i = o.TEXTURE_2D;
10727
- if ((e.isWebGL3DRenderTarget || e.isWebGLArrayRenderTarget) && (i = e.isWebGL3DRenderTarget ? o.TEXTURE_3D : o.TEXTURE_2D_ARRAY), c.bindTexture(i, r.__webglTexture), ae(i, t), t.mipmaps && t.mipmaps.length > 0) for (let r = 0; r < t.mipmaps.length; r++) de(n.__webglFramebuffer[r], e, t, o.COLOR_ATTACHMENT0, i, r);
10727
+ if ((e.isWebGL3DRenderTarget || e.isWebGLArrayRenderTarget) && (i = e.isWebGL3DRenderTarget ? o.TEXTURE_3D : o.TEXTURE_2D_ARRAY), c.bindTexture(i, r.__webglTexture), oe(i, t), t.mipmaps && t.mipmaps.length > 0) for (let r = 0; r < t.mipmaps.length; r++) de(n.__webglFramebuffer[r], e, t, o.COLOR_ATTACHMENT0, i, r);
10728
10728
  else de(n.__webglFramebuffer, e, t, o.COLOR_ATTACHMENT0, i, 0);
10729
10729
  w(t) && T(i), c.unbindTexture();
10730
10730
  }
@@ -10787,7 +10787,7 @@ function Vc(o, s, c, l, u, d, p) {
10787
10787
  function ye(e) {
10788
10788
  return typeof HTMLImageElement < "u" && e instanceof HTMLImageElement ? (g.width = e.naturalWidth || e.width, g.height = e.naturalHeight || e.height) : typeof VideoFrame < "u" && e instanceof VideoFrame ? (g.width = e.displayWidth, g.height = e.displayHeight) : (g.width = e.width, g.height = e.height), g;
10789
10789
  }
10790
- this.allocateTextureUnit = ee, this.resetTextureUnits = I, this.setTexture2D = L, this.setTexture2DArray = ne, this.setTexture3D = re, this.setTextureCube = R, this.rebindTextures = W, this.setupRenderTarget = G, this.updateRenderTargetMipmap = K, this.updateMultisampleRenderTarget = J, this.setupDepthRenderbuffer = fe, this.setupFrameBufferTexture = de, this.useMultisampledRTT = ge;
10790
+ this.allocateTextureUnit = ee, this.resetTextureUnits = I, this.setTexture2D = L, this.setTexture2DArray = ne, this.setTexture3D = re, this.setTextureCube = ie, this.rebindTextures = W, this.setupRenderTarget = G, this.updateRenderTargetMipmap = K, this.updateMultisampleRenderTarget = J, this.setupDepthRenderbuffer = fe, this.setupFrameBufferTexture = de, this.useMultisampledRTT = ge;
10791
10791
  }
10792
10792
  function Hc(e, t) {
10793
10793
  function n(n, r = "") {
@@ -10946,7 +10946,7 @@ var Uc = "\nvoid main() {\n\n gl_Position = vec4( position, 1.0 );\n\n}", Wc = "
10946
10946
  }
10947
10947
  P = null, F = null, b.reset();
10948
10948
  for (let e in x) delete x[e];
10949
- e.setRenderTarget(C), _ = null, g = null, h = null, r = null, w = null, ae.stop(), n.isPresenting = !1, e.setPixelRatio(O), e.setSize(D.width, D.height, !1), n.dispatchEvent({ type: "sessionend" });
10949
+ e.setRenderTarget(C), _ = null, g = null, h = null, r = null, w = null, oe.stop(), n.isPresenting = !1, e.setPixelRatio(O), e.setSize(D.width, D.height, !1), n.dispatchEvent({ type: "sessionend" });
10950
10950
  }
10951
10951
  this.setFramebufferScaleFactor = function(e) {
10952
10952
  i = e, n.isPresenting === !0 && console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.");
@@ -11001,7 +11001,7 @@ var Uc = "\nvoid main() {\n\n gl_Position = vec4( position, 1.0 );\n\n}", Wc = "
11001
11001
  resolveStencilBuffer: _.ignoreDepthValues === !1
11002
11002
  });
11003
11003
  }
11004
- w.isXRRenderTarget = !0, this.setFoveation(l), p = null, a = await r.requestReferenceSpace(c), ae.setContext(r), ae.start(), n.isPresenting = !0, n.dispatchEvent({ type: "sessionstart" });
11004
+ w.isXRRenderTarget = !0, this.setFoveation(l), p = null, a = await r.requestReferenceSpace(c), oe.setContext(r), oe.start(), n.isPresenting = !0, n.dispatchEvent({ type: "sessionstart" });
11005
11005
  }
11006
11006
  }, this.getEnvironmentBlendMode = function() {
11007
11007
  if (r !== null) return r.environmentBlendMode;
@@ -11039,7 +11039,7 @@ var Uc = "\nvoid main() {\n\n gl_Position = vec4( position, 1.0 );\n\n}", Wc = "
11039
11039
  e.projectionMatrix.makePerspective(i, a, u, d, t, n), e.projectionMatrixInverse.copy(e.projectionMatrix).invert();
11040
11040
  }
11041
11041
  }
11042
- function R(e, t) {
11042
+ function ie(e, t) {
11043
11043
  t === null ? e.matrixWorld.copy(e.matrix) : e.matrixWorld.multiplyMatrices(t.matrixWorld, e.matrix), e.matrixWorldInverse.copy(e.matrixWorld).invert();
11044
11044
  }
11045
11045
  this.updateCamera = function(e) {
@@ -11050,11 +11050,11 @@ var Uc = "\nvoid main() {\n\n gl_Position = vec4( position, 1.0 );\n\n}", Wc = "
11050
11050
  depthFar: N.far
11051
11051
  }), P = N.near, F = N.far), N.layers.mask = e.layers.mask | 6, A.layers.mask = N.layers.mask & 3, j.layers.mask = N.layers.mask & 5;
11052
11052
  let i = e.parent, a = N.cameras;
11053
- R(N, i);
11054
- for (let e = 0; e < a.length; e++) R(a[e], i);
11055
- a.length === 2 ? re(N, A, j) : N.projectionMatrix.copy(A.projectionMatrix), z(e, N, i);
11053
+ ie(N, i);
11054
+ for (let e = 0; e < a.length; e++) ie(a[e], i);
11055
+ a.length === 2 ? re(N, A, j) : N.projectionMatrix.copy(A.projectionMatrix), R(e, N, i);
11056
11056
  };
11057
- function z(e, t, n) {
11057
+ function R(e, t, n) {
11058
11058
  n === null ? e.matrix.copy(t.matrixWorld) : (e.matrix.copy(n.matrixWorld), e.matrix.invert(), e.matrix.multiply(t.matrixWorld)), e.matrix.decompose(e.position, e.quaternion, e.scale), e.updateMatrixWorld(!0), e.projectionMatrix.copy(t.projectionMatrix), e.projectionMatrixInverse.copy(t.projectionMatrixInverse), e.isPerspectiveCamera && (e.fov = k * 2 * Math.atan(1 / e.projectionMatrix.elements[5]), e.zoom = 1);
11059
11059
  }
11060
11060
  this.getCamera = function() {
@@ -11070,8 +11070,8 @@ var Uc = "\nvoid main() {\n\n gl_Position = vec4( position, 1.0 );\n\n}", Wc = "
11070
11070
  }, this.getCameraTexture = function(e) {
11071
11071
  return x[e];
11072
11072
  };
11073
- let B = null;
11074
- function ie(t, i) {
11073
+ let z = null;
11074
+ function ae(t, i) {
11075
11075
  if (m = i.getViewerPose(p || a), v = i, m !== null) {
11076
11076
  let t = m.views;
11077
11077
  _ !== null && (e.setRenderTargetFramebuffer(w, _.framebuffer), e.setRenderTarget(w));
@@ -11110,14 +11110,14 @@ var Uc = "\nvoid main() {\n\n gl_Position = vec4( position, 1.0 );\n\n}", Wc = "
11110
11110
  let t = E[e], n = T[e];
11111
11111
  t !== null && n !== void 0 && n.update(t, i, p || a);
11112
11112
  }
11113
- B && B(t, i), i.detectedPlanes && n.dispatchEvent({
11113
+ z && z(t, i), i.detectedPlanes && n.dispatchEvent({
11114
11114
  type: "planesdetected",
11115
11115
  data: i
11116
11116
  }), v = null;
11117
11117
  }
11118
- let ae = new Ya();
11119
- ae.setAnimationLoop(ie), this.setAnimationLoop = function(e) {
11120
- B = e;
11118
+ let oe = new Ya();
11119
+ oe.setAnimationLoop(ae), this.setAnimationLoop = function(e) {
11120
+ z = e;
11121
11121
  }, this.dispose = function() {};
11122
11122
  }
11123
11123
  }, qc = /*@__PURE__*/ new vt(), Jc = /*@__PURE__*/ new ct();
@@ -11280,7 +11280,7 @@ var Zc = class {
11280
11280
  }, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.clippingPlanes = [], this.localClippingEnabled = !1, this.toneMapping = 0, this.toneMappingExposure = 1, this.transmissionResolutionScale = 1;
11281
11281
  let T = this, E = !1;
11282
11282
  this._outputColorSpace = y;
11283
- let D = 0, O = 0, k = null, A = -1, j = null, M = new Ae(), N = new Ae(), P = null, F = new X(0), I = 0, ee = t.width, te = t.height, L = 1, ne = null, re = null, R = new Ae(0, 0, ee, te), z = new Ae(0, 0, ee, te), B = !1, ie = new lr(), ae = !1, oe = !1, se = new ct(), ce = new U(), le = new Ae(), ue = {
11283
+ let D = 0, O = 0, k = null, A = -1, j = null, M = new Ae(), N = new Ae(), P = null, F = new X(0), I = 0, ee = t.width, te = t.height, L = 1, ne = null, re = null, ie = new Ae(0, 0, ee, te), R = new Ae(0, 0, ee, te), z = !1, ae = new lr(), oe = !1, se = !1, ce = new ct(), le = new U(), ue = new Ae(), B = {
11284
11284
  background: null,
11285
11285
  fog: null,
11286
11286
  environment: null,
@@ -11347,17 +11347,17 @@ var Zc = class {
11347
11347
  }, this.getCurrentViewport = function(e) {
11348
11348
  return e.copy(M);
11349
11349
  }, this.getViewport = function(e) {
11350
- return e.copy(R);
11350
+ return e.copy(ie);
11351
11351
  }, this.setViewport = function(e, t, n, r) {
11352
- e.isVector4 ? R.set(e.x, e.y, e.z, e.w) : R.set(e, t, n, r), K.viewport(M.copy(R).multiplyScalar(L).round());
11352
+ e.isVector4 ? ie.set(e.x, e.y, e.z, e.w) : ie.set(e, t, n, r), K.viewport(M.copy(ie).multiplyScalar(L).round());
11353
11353
  }, this.getScissor = function(e) {
11354
- return e.copy(z);
11354
+ return e.copy(R);
11355
11355
  }, this.setScissor = function(e, t, n, r) {
11356
- e.isVector4 ? z.set(e.x, e.y, e.z, e.w) : z.set(e, t, n, r), K.scissor(N.copy(z).multiplyScalar(L).round());
11356
+ e.isVector4 ? R.set(e.x, e.y, e.z, e.w) : R.set(e, t, n, r), K.scissor(N.copy(R).multiplyScalar(L).round());
11357
11357
  }, this.getScissorTest = function() {
11358
- return B;
11358
+ return z;
11359
11359
  }, this.setScissorTest = function(e) {
11360
- K.setScissorTest(B = e);
11360
+ K.setScissorTest(z = e);
11361
11361
  }, this.setOpaqueSort = function(e) {
11362
11362
  ne = e;
11363
11363
  }, this.setTransparentSort = function(e) {
@@ -11418,7 +11418,7 @@ var Zc = class {
11418
11418
  }), e.isShaderMaterial && Se.releaseShaderCache(e));
11419
11419
  }
11420
11420
  this.renderBufferDirect = function(e, t, n, r, i, a) {
11421
- t === null && (t = ue);
11421
+ t === null && (t = B);
11422
11422
  let o = i.isMesh && i.matrixWorld.determinant() < 0, s = at(e, t, n, r, i);
11423
11423
  K.setMaterial(r, o);
11424
11424
  let c = n.index, l = 1;
@@ -11505,13 +11505,13 @@ var Zc = class {
11505
11505
  return;
11506
11506
  }
11507
11507
  if (E === !0) return;
11508
- if (e.matrixWorldAutoUpdate === !0 && e.updateMatrixWorld(), t.parent === null && t.matrixWorldAutoUpdate === !0 && t.updateMatrixWorld(), Re.enabled === !0 && Re.isPresenting === !0 && (Re.cameraAutoUpdate === !0 && Re.updateCamera(t), t = Re.getCamera()), e.isScene === !0 && e.onBeforeRender(T, e, t, k), x = Te.get(e, C.length), x.init(t), C.push(x), se.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), ie.setFromProjectionMatrix(se, w, t.reversedDepth), oe = this.localClippingEnabled, ae = Ee.init(this.clippingPlanes, oe), v = we.get(e, S.length), v.init(), S.push(v), Re.enabled === !0 && Re.isPresenting === !0) {
11508
+ if (e.matrixWorldAutoUpdate === !0 && e.updateMatrixWorld(), t.parent === null && t.matrixWorldAutoUpdate === !0 && t.updateMatrixWorld(), Re.enabled === !0 && Re.isPresenting === !0 && (Re.cameraAutoUpdate === !0 && Re.updateCamera(t), t = Re.getCamera()), e.isScene === !0 && e.onBeforeRender(T, e, t, k), x = Te.get(e, C.length), x.init(t), C.push(x), ce.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), ae.setFromProjectionMatrix(ce, w, t.reversedDepth), se = this.localClippingEnabled, oe = Ee.init(this.clippingPlanes, se), v = we.get(e, S.length), v.init(), S.push(v), Re.enabled === !0 && Re.isPresenting === !0) {
11509
11509
  let e = T.xr.getDepthSensingMesh();
11510
11510
  e !== null && Ze(e, t, -Infinity, T.sortObjects);
11511
11511
  }
11512
- Ze(e, t, 0, T.sortObjects), v.finish(), T.sortObjects === !0 && v.sort(ne, re), de = Re.enabled === !1 || Re.isPresenting === !1 || Re.hasDepthSensing() === !1, de && Oe.addToRenderList(v, e), this.info.render.frame++, ae === !0 && Ee.beginShadows();
11512
+ Ze(e, t, 0, T.sortObjects), v.finish(), T.sortObjects === !0 && v.sort(ne, re), de = Re.enabled === !1 || Re.isPresenting === !1 || Re.hasDepthSensing() === !1, de && Oe.addToRenderList(v, e), this.info.render.frame++, oe === !0 && Ee.beginShadows();
11513
11513
  let n = x.state.shadowsArray;
11514
- De.render(n, e, t), ae === !0 && Ee.endShadows(), this.info.autoReset === !0 && this.info.reset();
11514
+ De.render(n, e, t), oe === !0 && Ee.endShadows(), this.info.autoReset === !0 && this.info.reset();
11515
11515
  let r = v.opaque, i = v.transmissive;
11516
11516
  if (x.setupLights(), t.isArrayCamera) {
11517
11517
  let n = t.cameras;
@@ -11525,7 +11525,7 @@ var Zc = class {
11525
11525
  Qe(v, e, r, r.viewport);
11526
11526
  }
11527
11527
  } else i.length > 0 && $e(r, i, e, t), de && Oe.render(e), Qe(v, e, t);
11528
- k !== null && O === 0 && (J.updateMultisampleRenderTarget(k), J.updateRenderTargetMipmap(k)), e.isScene === !0 && e.onAfterRender(T, e, t), Fe.resetDefaultState(), A = -1, j = null, C.pop(), C.length > 0 ? (x = C[C.length - 1], ae === !0 && Ee.setGlobalState(T.clippingPlanes, x.state.camera)) : x = null, S.pop(), v = S.length > 0 ? S[S.length - 1] : null;
11528
+ k !== null && O === 0 && (J.updateMultisampleRenderTarget(k), J.updateRenderTargetMipmap(k)), e.isScene === !0 && e.onAfterRender(T, e, t), Fe.resetDefaultState(), A = -1, j = null, C.pop(), C.length > 0 ? (x = C[C.length - 1], oe === !0 && Ee.setGlobalState(T.clippingPlanes, x.state.camera)) : x = null, S.pop(), v = S.length > 0 ? S[S.length - 1] : null;
11529
11529
  };
11530
11530
  function Ze(e, t, n, r) {
11531
11531
  if (e.visible === !1) return;
@@ -11534,20 +11534,20 @@ var Zc = class {
11534
11534
  else if (e.isLOD) e.autoUpdate === !0 && e.update(t);
11535
11535
  else if (e.isLight) x.pushLight(e), e.castShadow && x.pushShadow(e);
11536
11536
  else if (e.isSprite) {
11537
- if (!e.frustumCulled || ie.intersectsSprite(e)) {
11538
- r && le.setFromMatrixPosition(e.matrixWorld).applyMatrix4(se);
11537
+ if (!e.frustumCulled || ae.intersectsSprite(e)) {
11538
+ r && ue.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ce);
11539
11539
  let t = xe.update(e), i = e.material;
11540
- i.visible && v.push(e, t, i, n, le.z, null);
11540
+ i.visible && v.push(e, t, i, n, ue.z, null);
11541
11541
  }
11542
- } else if ((e.isMesh || e.isLine || e.isPoints) && (!e.frustumCulled || ie.intersectsObject(e))) {
11542
+ } else if ((e.isMesh || e.isLine || e.isPoints) && (!e.frustumCulled || ae.intersectsObject(e))) {
11543
11543
  let t = xe.update(e), i = e.material;
11544
- if (r && (e.boundingSphere === void 0 ? (t.boundingSphere === null && t.computeBoundingSphere(), le.copy(t.boundingSphere.center)) : (e.boundingSphere === null && e.computeBoundingSphere(), le.copy(e.boundingSphere.center)), le.applyMatrix4(e.matrixWorld).applyMatrix4(se)), Array.isArray(i)) {
11544
+ if (r && (e.boundingSphere === void 0 ? (t.boundingSphere === null && t.computeBoundingSphere(), ue.copy(t.boundingSphere.center)) : (e.boundingSphere === null && e.computeBoundingSphere(), ue.copy(e.boundingSphere.center)), ue.applyMatrix4(e.matrixWorld).applyMatrix4(ce)), Array.isArray(i)) {
11545
11545
  let r = t.groups;
11546
11546
  for (let a = 0, o = r.length; a < o; a++) {
11547
11547
  let o = r[a], s = i[o.materialIndex];
11548
- s && s.visible && v.push(e, t, s, n, le.z, o);
11548
+ s && s.visible && v.push(e, t, s, n, ue.z, o);
11549
11549
  }
11550
- } else i.visible && v.push(e, t, i, n, le.z, null);
11550
+ } else i.visible && v.push(e, t, i, n, ue.z, null);
11551
11551
  }
11552
11552
  }
11553
11553
  let i = e.children;
@@ -11555,7 +11555,7 @@ var Zc = class {
11555
11555
  }
11556
11556
  function Qe(e, t, n, r) {
11557
11557
  let i = e.opaque, a = e.transmissive, o = e.transparent;
11558
- x.setupLightsView(n), ae === !0 && Ee.setGlobalState(T.clippingPlanes, n), r && K.viewport(M.copy(r)), i.length > 0 && et(i, t, n), a.length > 0 && et(a, t, n), o.length > 0 && et(o, t, n), K.buffers.depth.setTest(!0), K.buffers.depth.setMask(!0), K.buffers.color.setMask(!0), K.setPolygonOffset(!1);
11558
+ x.setupLightsView(n), oe === !0 && Ee.setGlobalState(T.clippingPlanes, n), r && K.viewport(M.copy(r)), i.length > 0 && et(i, t, n), a.length > 0 && et(a, t, n), o.length > 0 && et(o, t, n), K.buffers.depth.setTest(!0), K.buffers.depth.setMask(!0), K.buffers.color.setMask(!0), K.setPolygonOffset(!1);
11559
11559
  }
11560
11560
  function $e(e, t, n, r) {
11561
11561
  if ((n.isScene === !0 ? n.overrideMaterial : null) !== null) return;
@@ -11576,7 +11576,7 @@ var Zc = class {
11576
11576
  let p = T.toneMapping;
11577
11577
  T.toneMapping = 0;
11578
11578
  let m = r.viewport;
11579
- if (r.viewport !== void 0 && (r.viewport = void 0), x.setupLightsView(r), ae === !0 && Ee.setGlobalState(T.clippingPlanes, r), et(e, n, r), J.updateMultisampleRenderTarget(s), J.updateRenderTargetMipmap(s), W.has("WEBGL_multisampled_render_to_texture") === !1) {
11579
+ if (r.viewport !== void 0 && (r.viewport = void 0), x.setupLightsView(r), oe === !0 && Ee.setGlobalState(T.clippingPlanes, r), et(e, n, r), J.updateMultisampleRenderTarget(s), J.updateRenderTargetMipmap(s), W.has("WEBGL_multisampled_render_to_texture") === !1) {
11580
11580
  let e = !1;
11581
11581
  for (let i = 0, a = t.length; i < a; i++) {
11582
11582
  let a = t[i], o = a.object, s = a.geometry, c = a.material, l = a.group;
@@ -11600,7 +11600,7 @@ var Zc = class {
11600
11600
  e.onBeforeRender(T, t, n, r, i, a), e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse, e.matrixWorld), e.normalMatrix.getNormalMatrix(e.modelViewMatrix), i.onBeforeRender(T, t, n, r, e, a), i.transparent === !0 && i.side === 2 && i.forceSinglePass === !1 ? (i.side = 1, i.needsUpdate = !0, T.renderBufferDirect(n, t, r, i, e, a), i.side = 0, i.needsUpdate = !0, T.renderBufferDirect(n, t, r, i, e, a), i.side = 2) : T.renderBufferDirect(n, t, r, i, e, a), e.onAfterRender(T, t, n, r, i, a);
11601
11601
  }
11602
11602
  function nt(e, t, n) {
11603
- t.isScene !== !0 && (t = ue);
11603
+ t.isScene !== !0 && (t = B);
11604
11604
  let r = q.get(e), i = x.state.lights, a = x.state.shadowsArray, o = i.state.version, s = Se.getParameters(e, i.state, a, t, n), c = Se.getProgramCacheKey(s), l = r.programs;
11605
11605
  r.environment = e.isMeshStandardMaterial ? t.environment : null, r.fog = t.fog, r.envMap = (e.isMeshStandardMaterial ? ve : _e).get(e.envMap || r.environment), r.envMapRotation = r.environment !== null && e.envMap === null ? t.environmentRotation : e.envMapRotation, l === void 0 && (e.addEventListener("dispose", He), l = /* @__PURE__ */ new Map(), r.programs = l);
11606
11606
  let u = l.get(c);
@@ -11622,11 +11622,11 @@ var Zc = class {
11622
11622
  n.outputColorSpace = t.outputColorSpace, n.batching = t.batching, n.batchingColor = t.batchingColor, n.instancing = t.instancing, n.instancingColor = t.instancingColor, n.instancingMorph = t.instancingMorph, n.skinning = t.skinning, n.morphTargets = t.morphTargets, n.morphNormals = t.morphNormals, n.morphColors = t.morphColors, n.morphTargetsCount = t.morphTargetsCount, n.numClippingPlanes = t.numClippingPlanes, n.numIntersection = t.numClipIntersection, n.vertexAlphas = t.vertexAlphas, n.vertexTangents = t.vertexTangents, n.toneMapping = t.toneMapping;
11623
11623
  }
11624
11624
  function at(e, t, n, r, i) {
11625
- t.isScene !== !0 && (t = ue), J.resetTextureUnits();
11625
+ t.isScene !== !0 && (t = B), J.resetTextureUnits();
11626
11626
  let a = t.fog, o = r.isMeshStandardMaterial ? t.environment : null, s = k === null ? T.outputColorSpace : k.isXRRenderTarget === !0 ? k.texture.colorSpace : b, c = (r.isMeshStandardMaterial ? ve : _e).get(r.envMap || o), l = r.vertexColors === !0 && !!n.attributes.color && n.attributes.color.itemSize === 4, u = !!n.attributes.tangent && (!!r.normalMap || r.anisotropy > 0), d = !!n.morphAttributes.position, f = !!n.morphAttributes.normal, p = !!n.morphAttributes.color, m = 0;
11627
11627
  r.toneMapped && (k === null || k.isXRRenderTarget === !0) && (m = T.toneMapping);
11628
11628
  let h = n.morphAttributes.position || n.morphAttributes.normal || n.morphAttributes.color, g = h === void 0 ? 0 : h.length, _ = q.get(r), v = x.state.lights;
11629
- if (ae === !0 && (oe === !0 || e !== j)) {
11629
+ if (oe === !0 && (se === !0 || e !== j)) {
11630
11630
  let t = e === j && r.id === A;
11631
11631
  Ee.setState(r, e, t);
11632
11632
  }
@@ -11638,7 +11638,7 @@ var Zc = class {
11638
11638
  if (K.useProgram(S.program) && (C = !0, w = !0, E = !0), r.id !== A && (A = r.id, w = !0), C || j !== e) {
11639
11639
  K.buffers.depth.getReversed() && e.reversedDepth !== !0 && (e._reversedDepth = !0, e.updateProjectionMatrix()), D.setValue(H, "projectionMatrix", e.projectionMatrix), D.setValue(H, "viewMatrix", e.matrixWorldInverse);
11640
11640
  let t = D.map.cameraPosition;
11641
- t !== void 0 && t.setValue(H, ce.setFromMatrixPosition(e.matrixWorld)), G.logarithmicDepthBuffer && D.setValue(H, "logDepthBufFC", 2 / (Math.log(e.far + 1) / Math.LN2)), (r.isMeshPhongMaterial || r.isMeshToonMaterial || r.isMeshLambertMaterial || r.isMeshBasicMaterial || r.isMeshStandardMaterial || r.isShaderMaterial) && D.setValue(H, "isOrthographic", e.isOrthographicCamera === !0), j !== e && (j = e, w = !0, E = !0);
11641
+ t !== void 0 && t.setValue(H, le.setFromMatrixPosition(e.matrixWorld)), G.logarithmicDepthBuffer && D.setValue(H, "logDepthBufFC", 2 / (Math.log(e.far + 1) / Math.LN2)), (r.isMeshPhongMaterial || r.isMeshToonMaterial || r.isMeshLambertMaterial || r.isMeshBasicMaterial || r.isMeshStandardMaterial || r.isShaderMaterial) && D.setValue(H, "isOrthographic", e.isOrthographicCamera === !0), j !== e && (j = e, w = !0, E = !0);
11642
11642
  }
11643
11643
  if (i.isSkinnedMesh) {
11644
11644
  D.setOptional(H, i, "bindMatrix"), D.setOptional(H, i, "bindMatrixInverse");
@@ -11695,7 +11695,7 @@ var Zc = class {
11695
11695
  (c.isData3DTexture || c.isDataArrayTexture || c.isCompressedArrayTexture) && (o = !0);
11696
11696
  let l = q.get(e).__webglFramebuffer;
11697
11697
  e.isWebGLCubeRenderTarget ? (i = Array.isArray(l[t]) ? l[t][n] : l[t], a = !0) : i = e.samples > 0 && J.useMultisampledRTT(e) === !1 ? q.get(e).__webglMultisampledFramebuffer : Array.isArray(l) ? l[n] : l, M.copy(e.viewport), N.copy(e.scissor), P = e.scissorTest;
11698
- } else M.copy(R).multiplyScalar(L).floor(), N.copy(z).multiplyScalar(L).floor(), P = B;
11698
+ } else M.copy(ie).multiplyScalar(L).floor(), N.copy(R).multiplyScalar(L).floor(), P = z;
11699
11699
  if (n !== 0 && (i = lt), K.bindFramebuffer(H.FRAMEBUFFER, i) && r && K.drawBuffers(e, i), K.viewport(M), K.scissor(N), K.setScissorTest(P), a) {
11700
11700
  let r = q.get(e.texture);
11701
11701
  H.framebufferTexture2D(H.FRAMEBUFFER, H.COLOR_ATTACHMENT0, H.TEXTURE_CUBE_MAP_POSITIVE_X + t, r.__webglTexture, n);
@@ -11805,8 +11805,8 @@ var Zc = class {
11805
11805
  }, Qc = {
11806
11806
  component: "#8ae4d0",
11807
11807
  connection: "#f4edba"
11808
- }, $c = .05, el = /* @__PURE__ */ new Map(), tl = /* @__PURE__ */ new Map();
11809
- function nl(e) {
11808
+ }, $c = .05, el = 15, tl = /* @__PURE__ */ new Map(), nl = /* @__PURE__ */ new Map();
11809
+ function rl(e) {
11810
11810
  let { create: t, ...n } = e;
11811
11811
  return {
11812
11812
  ...n,
@@ -11816,7 +11816,7 @@ function nl(e) {
11816
11816
  anchors: { ...e.anchors }
11817
11817
  };
11818
11818
  }
11819
- function rl(e) {
11819
+ function il(e) {
11820
11820
  if (!e || typeof e != "object") throw TypeError("A geometry pack must be an object.");
11821
11821
  let t = String(e.namespace || "").trim();
11822
11822
  if (!/^[a-z][a-z0-9-]*$/i.test(t)) throw TypeError("A geometry pack requires a valid namespace.");
@@ -11847,8 +11847,8 @@ function rl(e) {
11847
11847
  ...r.anchors || {}
11848
11848
  }
11849
11849
  };
11850
- el.set(a, o), tl.set(a, a);
11851
- for (let e of r.aliases || []) tl.set(String(e), a);
11850
+ tl.set(a, o), nl.set(a, a);
11851
+ for (let e of r.aliases || []) nl.set(String(e), a);
11852
11852
  n.push(a);
11853
11853
  }
11854
11854
  return typeof globalThis.dispatchEvent == "function" && typeof CustomEvent == "function" && globalThis.dispatchEvent(new CustomEvent("lc-geometry-registry-change", { detail: {
@@ -11859,23 +11859,35 @@ function rl(e) {
11859
11859
  geometries: n
11860
11860
  };
11861
11861
  }
11862
- function il(e) {
11862
+ function al(e) {
11863
11863
  let t = [];
11864
- for (let [n, r] of el) r.namespace === e && (el.delete(n), t.push(n));
11865
- for (let [e, n] of tl) t.includes(n) && tl.delete(e);
11864
+ for (let [n, r] of tl) r.namespace === e && (tl.delete(n), t.push(n));
11865
+ for (let [e, n] of nl) t.includes(n) && nl.delete(e);
11866
11866
  return t;
11867
11867
  }
11868
- function al() {
11869
- return [...el.values()].map(nl);
11870
- }
11871
- function ol(e) {
11872
- let t = tl.get(e) || e;
11873
- return el.get(t) || null;
11868
+ function ol() {
11869
+ return [...tl.values()].map(rl);
11874
11870
  }
11875
11871
  function sl(e) {
11872
+ let t = nl.get(e) || e;
11873
+ return tl.get(t) || null;
11874
+ }
11875
+ function cl(e) {
11876
11876
  return e === "container" || e === "shell";
11877
11877
  }
11878
- rl({
11878
+ function ll(e = {}) {
11879
+ let t = e && typeof e == "object" ? e : {}, n = Number(t.opacity);
11880
+ return {
11881
+ mode: t.mode === "connected" ? "connected" : "all",
11882
+ effect: t.effect === "hide" ? "hide" : "dim",
11883
+ layout: t.layout === "reflow" ? "reflow" : "preserve",
11884
+ opacity: Number.isFinite(n) ? Math.max(.02, Math.min(.8, n)) : .12
11885
+ };
11886
+ }
11887
+ function ul(e, t) {
11888
+ e && e.transparent !== t && (e.transparent = t, e.needsUpdate = !0);
11889
+ }
11890
+ il({
11879
11891
  namespace: "geo",
11880
11892
  name: "Geometric primitives",
11881
11893
  version: "1",
@@ -11922,7 +11934,7 @@ rl({
11922
11934
  } } : {}
11923
11935
  }))
11924
11936
  });
11925
- var cl = {
11937
+ var dl = {
11926
11938
  background: {
11927
11939
  color: "#0a111a",
11928
11940
  glow: "#1c2b39",
@@ -11967,17 +11979,17 @@ var cl = {
11967
11979
  hint: !0
11968
11980
  }
11969
11981
  };
11970
- function ll(e, t) {
11982
+ function fl(e, t) {
11971
11983
  let n = { ...e };
11972
11984
  if (!t || typeof t != "object") return n;
11973
- for (let [r, i] of Object.entries(t)) n[r] = i && typeof i == "object" && !Array.isArray(i) ? ll(e?.[r] || {}, i) : i;
11985
+ for (let [r, i] of Object.entries(t)) n[r] = i && typeof i == "object" && !Array.isArray(i) ? fl(e?.[r] || {}, i) : i;
11974
11986
  return n;
11975
11987
  }
11976
- function ul(e) {
11988
+ function pl(e) {
11977
11989
  let t = e && typeof e == "object" ? { ...e } : {};
11978
- return typeof e == "string" ? t.background = { color: e } : typeof t.background == "string" && (t.background = { color: t.background }), ll(cl, t);
11990
+ return typeof e == "string" ? t.background = { color: e } : typeof t.background == "string" && (t.background = { color: t.background }), fl(dl, t);
11979
11991
  }
11980
- function dl(e) {
11992
+ function ml(e) {
11981
11993
  if (!e || typeof e != "object") return "directed";
11982
11994
  let t = String(e.mode || e.visual || e.render || e.type || e.direction || "").trim().toLowerCase().replace(/[_\s]+/g, "-");
11983
11995
  return e.bidirectional === !0 || [
@@ -11992,8 +12004,17 @@ function dl(e) {
11992
12004
  "failed"
11993
12005
  ].includes(t) ? "broken" : "directed";
11994
12006
  }
11995
- var fl = [":host{display:block;position:relative;height:var(--lc-height,680px);min-height:420px;color:var(--lc-panel-title,#e9f0f5);font:14px Inter,system-ui,-apple-system,sans-serif;background:var(--lc-bg,#0a111a);border:1px solid #294252;border-radius:12px;overflow:hidden;contain:content}", "*{box-sizing:border-box}.atlas{display:grid;grid-template-columns:minmax(0,1fr) 300px;height:100%}.atlas[data-panel=hidden]{grid-template-columns:1fr}.viewport{position:relative;min-width:0;overflow:hidden;background:radial-gradient(ellipse at 50% 45%,var(--lc-bg-glow,#1c2b39),var(--lc-bg-fade,#0a111a) 82%)}canvas{display:block;width:100%;height:100%;cursor:grab;touch-action:none}.toolbar{position:absolute;z-index:10;bottom:28px;left:50%;transform:translateX(-50%);display:flex;gap:3px;padding:6px;background:var(--lc-toolbar-bg,#15232fe8);border:1px solid var(--lc-toolbar-border,#3a5062);border-radius:8px;white-space:nowrap}.toolbar[data-hidden=true],.toolbar[hidden],.panel[data-hidden=true],.panel[hidden],.crumbs[data-hidden=true],.crumbs[hidden],.hint[data-hidden=true],.hint[hidden]{display:none!important}.toolbar button{height:30px;padding:0 9px;border:0;border-radius:5px;background:none;color:var(--lc-toolbar-text,#dbe7ec);cursor:pointer}.toolbar button:hover,.toolbar button.active{background:var(--lc-toolbar-active,#1f3d4b);color:var(--lc-toolbar-active-text,#c5f2e9)}.toolbar i{display:block;width:1px;margin:2px 3px;background:#38515f}.hint{position:absolute;z-index:9;top:8px;bottom:auto;left:0;right:0;text-align:center;padding:2px 8px;font-size:11px;line-height:16px;color:var(--lc-hint,#8da6b8);pointer-events:none}.panel{overflow:auto;padding:24px 20px;background:var(--lc-panel-bg,linear-gradient(140deg,#182633,#0e1925 65%));border-left:1px solid var(--lc-panel-border,#2a3a48)}.panel h2{font-size:26px;line-height:1.12;font-weight:470;margin:12px 0;color:var(--lc-panel-title,#e9f0f5)}.panel h3{font-size:11px;letter-spacing:1.4px;color:#91aabd;margin:24px 0 10px}.panel p{font-size:14px;line-height:1.55;color:var(--lc-panel-text,#b5c6d2)}.panel .eyebrow{font-size:11px;letter-spacing:1.7px;color:#6ad7c0}.panel .sub{font-size:13px;color:#8fa8bd;margin-bottom:16px}.panel button{display:block;width:100%;padding:10px 0;text-align:left;background:none;border:0;border-bottom:1px solid var(--lc-panel-border,#2a3a48);color:#d9e7eb;cursor:pointer}.panel button:hover{color:#6ad7c0}.panel .relation{padding:10px 0;border-bottom:1px solid var(--lc-panel-border,#2a3a48)}.panel .relation strong{display:block;font-weight:550}.panel .relation small{display:block;color:#86a6b9;font-size:12px;margin-top:4px}.panel .back{color:#9db7c8;font-size:13px}.panel .crumbs{display:flex;flex-wrap:wrap;gap:5px;align-items:center;margin:0 0 12px}.panel .crumbs button{display:inline;width:auto;padding:3px 7px;border:0;border-radius:4px;background:var(--lc-crumb-bg,#142733);color:var(--lc-crumb-text,#91b6c7);font-size:12px}.panel .crumbs button.current{background:var(--lc-crumb-active,#1c4a4d);color:var(--lc-crumb-active-text,#c5f2e9)}.panel .note{border-top:1px solid var(--lc-panel-border,#2a3a48);padding-top:16px;margin-top:22px;font-size:12px;color:#7692a6}.error{position:absolute;inset:20%;padding:18px;background:#172b3b;border:1px solid #7896a9;line-height:1.5;z-index:4}@media(max-width:900px){.toolbar{gap:0}.toolbar button{padding:0 6px;font-size:12px}}@media(max-width:760px){:host{height:680px}.atlas{grid-template-columns:1fr;grid-template-rows:minmax(420px,1fr) auto}.panel{max-height:250px;border-left:0;border-top:1px solid var(--lc-panel-border,#2a3a48);padding:18px}.toolbar{bottom:24px}.hint{top:8px;bottom:auto;display:block}}"].join("");
11996
- function pl(e) {
12007
+ var hl = [":host{display:block;position:relative;height:var(--lc-height,680px);min-height:420px;color:var(--lc-panel-title,#e9f0f5);font:14px Inter,system-ui,-apple-system,sans-serif;background:var(--lc-bg,#0a111a);border:1px solid #294252;border-radius:12px;overflow:hidden;contain:content}", "*{box-sizing:border-box}.atlas{display:grid;grid-template-columns:minmax(0,1fr) 300px;height:100%}.atlas[data-panel=hidden]{grid-template-columns:1fr}.viewport{position:relative;min-width:0;overflow:hidden;background:radial-gradient(ellipse at 50% 45%,var(--lc-bg-glow,#1c2b39),var(--lc-bg-fade,#0a111a) 82%)}canvas{display:block;width:100%;height:100%;cursor:grab;touch-action:none}.toolbar{position:absolute;z-index:10;bottom:28px;left:50%;transform:translateX(-50%);display:flex;gap:3px;padding:6px;background:var(--lc-toolbar-bg,#15232fe8);border:1px solid var(--lc-toolbar-border,#3a5062);border-radius:8px;white-space:nowrap}.toolbar[data-hidden=true],.toolbar[hidden],.panel[data-hidden=true],.panel[hidden],.crumbs[data-hidden=true],.crumbs[hidden],.hint[data-hidden=true],.hint[hidden]{display:none!important}.toolbar button{height:30px;padding:0 9px;border:0;border-radius:5px;background:none;color:var(--lc-toolbar-text,#dbe7ec);cursor:pointer}.toolbar button:hover,.toolbar button.active{background:var(--lc-toolbar-active,#1f3d4b);color:var(--lc-toolbar-active-text,#c5f2e9)}.toolbar i{display:block;width:1px;margin:2px 3px;background:#38515f}.hint{position:absolute;z-index:9;top:8px;bottom:auto;left:0;right:0;text-align:center;padding:2px 8px;font-size:11px;line-height:16px;color:var(--lc-hint,#8da6b8);pointer-events:none}.panel{overflow:auto;padding:24px 20px;background:var(--lc-panel-bg,linear-gradient(140deg,#182633,#0e1925 65%));border-left:1px solid var(--lc-panel-border,#2a3a48)}.panel h2{font-size:26px;line-height:1.12;font-weight:470;margin:12px 0;color:var(--lc-panel-title,#e9f0f5)}.panel h3{font-size:11px;letter-spacing:1.4px;color:#91aabd;margin:24px 0 10px}.panel p{font-size:14px;line-height:1.55;color:var(--lc-panel-text,#b5c6d2)}.panel .eyebrow{font-size:11px;letter-spacing:1.7px;color:#6ad7c0}.panel .sub{font-size:13px;color:#8fa8bd;margin-bottom:16px}.panel .external-link{display:inline-flex;align-items:center;gap:6px;margin:2px 0 12px;color:#6ad7c0;font-size:13px;font-weight:600;text-decoration:none}.panel .external-link:hover{text-decoration:underline}.panel button{display:block;width:100%;padding:10px 0;text-align:left;background:none;border:0;border-bottom:1px solid var(--lc-panel-border,#2a3a48);color:#d9e7eb;cursor:pointer}.panel button:hover{color:#6ad7c0}.panel .relation{padding:10px 0;border-bottom:1px solid var(--lc-panel-border,#2a3a48)}.panel .relation strong{display:block;font-weight:550}.panel .relation small{display:block;color:#86a6b9;font-size:12px;margin-top:4px}.panel .back{color:#9db7c8;font-size:13px}.panel .crumbs{display:flex;flex-wrap:wrap;gap:5px;align-items:center;margin:0 0 12px}.panel .crumbs button{display:inline;width:auto;padding:3px 7px;border:0;border-radius:4px;background:var(--lc-crumb-bg,#142733);color:var(--lc-crumb-text,#91b6c7);font-size:12px}.panel .crumbs button.current{background:var(--lc-crumb-active,#1c4a4d);color:var(--lc-crumb-active-text,#c5f2e9)}.panel .note{border-top:1px solid var(--lc-panel-border,#2a3a48);padding-top:16px;margin-top:22px;font-size:12px;color:#7692a6}.error{position:absolute;inset:20%;padding:18px;background:#172b3b;border:1px solid #7896a9;line-height:1.5;z-index:4}@media(max-width:900px){.toolbar{gap:0}.toolbar button{padding:0 6px;font-size:12px}}@media(max-width:760px){:host{height:680px}.atlas{grid-template-columns:1fr;grid-template-rows:minmax(420px,1fr) auto}.panel{max-height:250px;border-left:0;border-top:1px solid var(--lc-panel-border,#2a3a48);padding:18px}.toolbar{bottom:24px}.hint{top:8px;bottom:auto;display:block}}"].join(""), gl = (e, t = "0 0 24 24") => `<svg viewBox="${t}" aria-hidden="true">${e}</svg>`, _l = {
12008
+ minus: gl("<path d=\"M6 12h12\"/>"),
12009
+ plus: gl("<path d=\"M12 6v12M6 12h12\"/>"),
12010
+ fit: gl("<path d=\"M9 4H4v5M15 4h5v5M20 15v5h-5M4 15v5h5\"/><circle cx=\"12\" cy=\"12\" r=\"2.5\"/>"),
12011
+ front: gl("<rect x=\"4\" y=\"5\" width=\"16\" height=\"14\" rx=\"1.5\"/><path d=\"M8 16h8\"/>"),
12012
+ view: gl("<path d=\"M2.5 12s3.5-5 9.5-5 9.5 5 9.5 5-3.5 5-9.5 5-9.5-5-9.5-5Z\"/><circle cx=\"12\" cy=\"12\" r=\"2.5\"/>"),
12013
+ relations: gl("<circle cx=\"5\" cy=\"6\" r=\"2\"/><circle cx=\"19\" cy=\"7\" r=\"2\"/><circle cx=\"12\" cy=\"18\" r=\"2\"/><path d=\"m6.8 6.3 10.2.5M6.2 7.7l4.6 8.6m6.8-7.5-4.4 7.5\"/>"),
12014
+ focus: gl("<circle cx=\"12\" cy=\"12\" r=\"7\"/><circle cx=\"12\" cy=\"12\" r=\"2.5\"/><path d=\"M12 2v3M12 19v3M2 12h3M19 12h3\"/>"),
12015
+ chevron: gl("<path d=\"m8 10 4 4 4-4\"/>")
12016
+ }, vl = (e, t, n = !1) => `<button class="toolbar-option${n ? " active" : ""}" data-action="${e}" aria-pressed="${n}"><span>${t}</span><span class="toolbar-option-check" aria-hidden="true">✓</span></button>`, yl = (e, t, n, r, i) => `<details class="toolbar-menu" data-toolbar-menu="${e}"><summary aria-label="${n}" title="${n}">${t}<span class="toolbar-menu-status" data-toolbar-status="${e}">${r}</span>${_l.chevron}</summary><div class="toolbar-popover" role="menu"><div class="toolbar-popover-title">${n}</div>${i}</div></details>`, bl = `<div class="atlas"><section class="viewport"><canvas tabindex="0" aria-label="Modelo 3D interactivo"></canvas><div class="toolbar" role="toolbar" aria-label="Controles de la vista"><div class="toolbar-group" data-toolbar-group="camera"><button class="toolbar-icon" data-action="minus" aria-label="Alejar" title="Alejar">${_l.minus}</button><button class="toolbar-icon" data-action="plus" aria-label="Acercar" title="Acercar">${_l.plus}</button><button class="toolbar-icon" data-action="fit" aria-label="Encuadrar todo el modelo" title="Encuadrar todo el modelo">${_l.fit}</button><button class="toolbar-icon" data-action="front" aria-label="Vista frontal" title="Vista frontal">${_l.front}</button></div><div class="toolbar-group" data-toolbar-group="view">${yl("view", _l.view, "Vista", "Vista", vl("labels", "Etiquetas", !0) + vl("panel", "Información", !0) + "<div class=\"toolbar-option-separator\"></div>" + vl("open-all", "Abrir todos") + vl("close-all", "Cerrar todos"))}</div><div class="toolbar-group" data-toolbar-group="relations">${yl("relations", _l.relations, "Relaciones", "Selección", vl("relations-all", "Todas") + vl("relations-selected", "Selección", !0) + vl("relations-none", "Ocultar"))}</div><div class="toolbar-group" data-toolbar-group="focus">${yl("focus", _l.focus, "Foco", "Todo", vl("focus-all", "Todo", !0) + vl("focus-dim", "Conectados") + vl("focus-hide", "Aislar") + "<div class=\"toolbar-option-separator\"></div>" + vl("focus-layout", "Reorganizar visibles"))}</div></div><div class="hint">Gira: arrastra · Pan: ⇧+arrastra / 2 dedos · Zoom: rueda o pellizco · Selecciona: clic</div></section><aside class="panel" aria-live="polite"></aside></div>`;
12017
+ function xl(e) {
11997
12018
  return String(e ?? "").replace(/[&<>"']/g, (e) => ({
11998
12019
  "&": "&amp;",
11999
12020
  "<": "&lt;",
@@ -12002,7 +12023,17 @@ function pl(e) {
12002
12023
  "'": "&#39;"
12003
12024
  })[e]);
12004
12025
  }
12005
- function ml(e) {
12026
+ function Sl(e) {
12027
+ let t = String(e ?? "").trim();
12028
+ if (!t) return "";
12029
+ try {
12030
+ let e = new URL(t, globalThis.location?.href);
12031
+ return ["http:", "https:"].includes(e.protocol) ? "<a class=\"external-link\" href=\"" + xl(e.href) + "\" target=\"_blank\" rel=\"noopener noreferrer\">Open documentation ↗</a>" : "";
12032
+ } catch {
12033
+ return "";
12034
+ }
12035
+ }
12036
+ function Cl(e) {
12006
12037
  let t = e && typeof e == "object" ? e : {}, n = Array.isArray(t.entities) ? t.entities.map((e) => ({
12007
12038
  ...e,
12008
12039
  p: Array.isArray(e.p) ? e.p : [
@@ -12019,14 +12050,14 @@ function ml(e) {
12019
12050
  from: e[0],
12020
12051
  to: e[1],
12021
12052
  label: e[2] || "",
12022
- mode: dl({ mode: e[3] }),
12053
+ mode: ml({ mode: e[3] }),
12023
12054
  index: t
12024
12055
  } : {
12025
12056
  ...e,
12026
12057
  from: e.from,
12027
12058
  to: e.to,
12028
12059
  label: e.label || "",
12029
- mode: dl(e),
12060
+ mode: ml(e),
12030
12061
  index: t
12031
12062
  }) : [];
12032
12063
  return {
@@ -12035,12 +12066,12 @@ function ml(e) {
12035
12066
  ...Qc,
12036
12067
  ...t.palette || {}
12037
12068
  },
12038
- theme: ul(t.theme || t.styles),
12069
+ theme: pl(t.theme || t.styles),
12039
12070
  entities: n,
12040
12071
  relations: r
12041
12072
  };
12042
12073
  }
12043
- function hl(e, t, n = [
12074
+ function wl(e, t, n = [
12044
12075
  1,
12045
12076
  1,
12046
12077
  1
@@ -12059,7 +12090,7 @@ function hl(e, t, n = [
12059
12090
  });
12060
12091
  return s.center(), s;
12061
12092
  }
12062
- function gl(e, t, n) {
12093
+ function Tl(e, t, n) {
12063
12094
  let r = new ui();
12064
12095
  for (let t = 0; t < e; t++) {
12065
12096
  let n = Math.PI / 2 + t * Math.PI * 2 / e, i = new V(Math.cos(n) * .5, Math.sin(n) * .5);
@@ -12076,7 +12107,7 @@ function gl(e, t, n) {
12076
12107
  });
12077
12108
  return i.rotateX(Math.PI / 2), i.center(), i;
12078
12109
  }
12079
- function _l(e, t, n, r) {
12110
+ function El(e, t, n, r) {
12080
12111
  let i = Math.min(.22, Math.max(0, Number(n) || 0));
12081
12112
  if (!i) return new Er(t, e, 1, 32);
12082
12113
  let a = [new V(0, -.5)];
@@ -12093,7 +12124,7 @@ function _l(e, t, n, r) {
12093
12124
  }
12094
12125
  return a.push(new V(0, .5)), new Qi(a, 32);
12095
12126
  }
12096
- function vl(e, t) {
12127
+ function Dl(e, t) {
12097
12128
  if (!t) return e;
12098
12129
  let n = Math.min(.72, Math.max(0, Number(t) * 3)), r = e.attributes.position;
12099
12130
  for (let e = 0; e < r.count; e++) {
@@ -12102,36 +12133,36 @@ function vl(e, t) {
12102
12133
  }
12103
12134
  return r.needsUpdate = !0, e.computeVertexNormals(), e;
12104
12135
  }
12105
- function yl(e, t = 0, n = 4, r = [
12136
+ function Ol(e, t = 0, n = 4, r = [
12106
12137
  1,
12107
12138
  1,
12108
12139
  1
12109
12140
  ]) {
12110
12141
  let i = Number(t) || 0, a = Math.max(2, Math.round(Number(n) || 4));
12111
12142
  switch (e) {
12112
- case "cylinder": return i ? _l(.5, .5, i, a) : new Er(.5, .5, 1, 32);
12113
- case "cone": return i ? _l(0, .5, i, a) : new Dr(.5, 1, 32);
12143
+ case "cylinder": return i ? El(.5, .5, i, a) : new Er(.5, .5, 1, 32);
12144
+ case "cone": return i ? El(0, .5, i, a) : new Dr(.5, 1, 32);
12114
12145
  case "frustum-cone":
12115
- case "truncated-cone": return i ? _l(.28, .5, i, a) : new Er(.28, .5, 1, 32);
12146
+ case "truncated-cone": return i ? El(.28, .5, i, a) : new Er(.28, .5, 1, 32);
12116
12147
  case "frustum-pyramid":
12117
12148
  case "truncated-pyramid": return new Er(.28, .5, 1, 4);
12118
12149
  case "frustum-triangle": return new Er(.28, .5, 1, 3);
12119
- case "prism": return i ? gl(6, i, a) : new Er(.5, .5, 1, 6);
12120
- case "pyramid-square": return i ? vl(new Dr(.5, 1, 4), i) : new Dr(.5, 1, 4);
12121
- case "pyramid-triangle": return i ? vl(new Dr(.5, 1, 3), i) : new Dr(.5, 1, 3);
12150
+ case "prism": return i ? Tl(6, i, a) : new Er(.5, .5, 1, 6);
12151
+ case "pyramid-square": return i ? Dl(new Dr(.5, 1, 4), i) : new Dr(.5, 1, 4);
12152
+ case "pyramid-triangle": return i ? Dl(new Dr(.5, 1, 3), i) : new Dr(.5, 1, 3);
12122
12153
  case "sphere": return new ta(.5, 24, 16);
12123
- case "octahedron": return vl(new $i(.5), i);
12124
- case "dodecahedron": return vl(new kr(.5), i);
12125
- case "icosahedron": return vl(new Zi(.5), i);
12126
- default: return i ? hl(i, a, r) : new Nn(1, 1, 1);
12154
+ case "octahedron": return Dl(new $i(.5), i);
12155
+ case "dodecahedron": return Dl(new kr(.5), i);
12156
+ case "icosahedron": return Dl(new Zi(.5), i);
12157
+ default: return i ? wl(i, a, r) : new Nn(1, 1, 1);
12127
12158
  }
12128
12159
  }
12129
- function bl(e) {
12160
+ function kl(e) {
12130
12161
  e.computeBoundingBox();
12131
12162
  let t = e.boundingBox?.getSize(new U());
12132
12163
  return !t || !t.x || !t.y || !t.z ? e : (e.scale(1 / t.x, 1 / t.y, 1 / t.z), e.computeBoundingBox(), e);
12133
12164
  }
12134
- function xl(e, t) {
12165
+ function Al(e, t) {
12135
12166
  let n = e.geometryOptions || e.geometry_options || e.parameters || {}, r = {};
12136
12167
  for (let [e, n] of Object.entries(t?.parameters || {})) n && Object.hasOwn(n, "default") && (r[e] = n.default);
12137
12168
  return {
@@ -12139,10 +12170,10 @@ function xl(e, t) {
12139
12170
  ...n && typeof n == "object" ? n : {}
12140
12171
  };
12141
12172
  }
12142
- function Sl(e, t, n) {
12173
+ function jl(e, t, n) {
12143
12174
  return typeof e != "string" || !e ? n : t[e] || e;
12144
12175
  }
12145
- function Cl(e, t = "#ffffff", n = "transparent") {
12176
+ function Ml(e, t = "#ffffff", n = "transparent") {
12146
12177
  let r = document.createElement("canvas");
12147
12178
  r.width = 256, r.height = 256;
12148
12179
  let i = r.getContext("2d");
@@ -12150,11 +12181,11 @@ function Cl(e, t = "#ffffff", n = "transparent") {
12150
12181
  let a = new Cr(r);
12151
12182
  return a.colorSpace = y, a;
12152
12183
  }
12153
- function wl(e) {
12154
- return e.shape === "plane" ? new ea(1, 1) : yl(e.shape || e.geometry || "box", e.radius, e.segments, e.size);
12184
+ function Nl(e) {
12185
+ return e.shape === "plane" ? new ea(1, 1) : Ol(e.shape || e.geometry || "box", e.radius, e.segments, e.size);
12155
12186
  }
12156
- function Tl(e, t, n, r, i) {
12157
- let a = xl(t, e), o = {
12187
+ function Pl(e, t, n, r, i) {
12188
+ let a = Al(t, e), o = {
12158
12189
  ...n,
12159
12190
  ...e.palette || {},
12160
12191
  ...t.geometryPalette || t.geometry_palette || {}
@@ -12168,9 +12199,9 @@ function Tl(e, t, n, r, i) {
12168
12199
  if (!c.length) throw Error(`Geometry '${e.id}' did not produce any parts.`);
12169
12200
  let l = new Qn(), u = [], d = [];
12170
12201
  for (let a of c) {
12171
- let s = wl(a);
12172
- bl(s);
12173
- let c = a.color || "component", f = Sl(c, o, n.component || Qc.component), p = new ia({
12202
+ let s = Nl(a);
12203
+ kl(s);
12204
+ let c = a.color || "component", f = jl(c, o, n.component || Qc.component), p = new ia({
12174
12205
  color: f,
12175
12206
  roughness: Number.isFinite(Number(a.roughness)) ? Number(a.roughness) : .72,
12176
12207
  metalness: Number.isFinite(Number(a.metalness)) ? Number(a.metalness) : .06,
@@ -12241,7 +12272,7 @@ function Tl(e, t, n, r, i) {
12241
12272
  n.src = g;
12242
12273
  }
12243
12274
  })(), p.map.colorSpace = y, p.needsUpdate = !0;
12244
- } else h != null && h !== "" && (p.map = Cl(h, Sl(a.iconColor || "#ffffff", o, "#ffffff"), Sl(a.iconBackground || "transparent", o, "transparent")), p.transparent = !0, p.needsUpdate = !0);
12275
+ } else h != null && h !== "" && (p.map = Ml(h, jl(a.iconColor || "#ffffff", o, "#ffffff"), jl(a.iconBackground || "transparent", o, "transparent")), p.transparent = !0, p.needsUpdate = !0);
12245
12276
  if (m = new An(s, p), m.position.fromArray(Array.isArray(a.position) ? a.position : [
12246
12277
  0,
12247
12278
  0,
@@ -12277,7 +12308,7 @@ function Tl(e, t, n, r, i) {
12277
12308
  descriptor: s
12278
12309
  };
12279
12310
  }
12280
- function El(e, t, n, r = "", i = !0) {
12311
+ function Fl(e, t, n, r = "", i = !0) {
12281
12312
  let a = document.createElement("canvas"), o = a.getContext("2d"), s = n.x * .88, c = Math.min(.82, n.y * .64);
12282
12313
  a.width = Math.ceil(s * 320), a.height = Math.ceil(c * 320), o.imageSmoothingEnabled = !0, o.imageSmoothingQuality = "high", o.clearRect(0, 0, a.width, a.height);
12283
12314
  let l = a.height * .62;
@@ -12314,7 +12345,7 @@ function El(e, t, n, r = "", i = !0) {
12314
12345
  let C = new An(b, v);
12315
12346
  C.rotation.y = Math.PI, C.position.set(0, n.y / 2 - .09 - c / 2, -n.z / 2 - .012);
12316
12347
  let w = new An(b, v.clone());
12317
- w.rotation.x = -Math.PI / 2, w.position.set(0, n.y / 2 + .012, 0), w.visible = sl(r), x.add(S, C, w);
12348
+ w.rotation.x = -Math.PI / 2, w.position.set(0, n.y / 2 + .012, 0), w.visible = cl(r), x.add(S, C, w);
12318
12349
  for (let e of [
12319
12350
  S,
12320
12351
  C,
@@ -12322,29 +12353,37 @@ function El(e, t, n, r = "", i = !0) {
12322
12353
  ]) e.renderOrder = 20, e.frustumCulled = !1, e.material.depthTest = !0, e.material.depthWrite = !1, e.material.transparent = !0;
12323
12354
  return x.renderOrder = 20, x.frustumCulled = !1, x.userData.front = S, x.userData.back = C, x.userData.top = w, x.userData.height = c, x.userData.width = s, x.userData.textOffsetX = h, x.userData.textOffsetY = g, x.userData.nodeLabel = !0, x;
12324
12355
  }
12325
- var Dl = class extends HTMLElement {
12356
+ var Il = class extends HTMLElement {
12326
12357
  static get observedAttributes() {
12327
12358
  return [
12328
12359
  "height",
12329
12360
  "relation-mode",
12330
12361
  "selection-mode",
12331
12362
  "shell-labels",
12332
- "toolbar"
12363
+ "toolbar",
12364
+ "panel",
12365
+ "focus-mode",
12366
+ "focus-effect",
12367
+ "focus-layout"
12333
12368
  ];
12334
12369
  }
12335
12370
  static registerGeometryPack(e) {
12336
- return rl(e);
12371
+ return il(e);
12337
12372
  }
12338
12373
  static unregisterGeometryPack(e) {
12339
- return il(e);
12374
+ return al(e);
12340
12375
  }
12341
12376
  static getGeometryCatalog() {
12342
- return al();
12377
+ return ol();
12343
12378
  }
12344
12379
  constructor() {
12345
- super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = "<style>" + fl + "</style><div class=\"atlas\"><section class=\"viewport\"><canvas tabindex=\"0\" aria-label=\"Modelo 3D interactivo\"></canvas><div class=\"toolbar\"><button data-action=\"minus\" aria-label=\"Alejar\">−</button><button data-action=\"plus\" aria-label=\"Acercar\">+</button><i></i><button data-action=\"fit\">⌖ Encuadrar</button><button data-action=\"front\">▱ Frontal</button><button data-action=\"labels\" class=\"active\" aria-pressed=\"true\">▧ Etiquetas</button><i></i><button data-action=\"relations-all\" aria-pressed=\"false\">Todas</button><button data-action=\"relations-selected\" class=\"active\" aria-pressed=\"true\">Selección</button><button data-action=\"relations-none\" aria-pressed=\"false\">Ocultar</button></div><div class=\"hint\">Gira: arrastra · Pan: ⇧+arrastra / 2 dedos · Zoom: rueda o pellizco · Selecciona: clic</div></section><aside class=\"panel\" aria-live=\"polite\"></aside></div>", this.canvas = this.shadowRoot.querySelector("canvas"), this.panel = this.shadowRoot.querySelector(".panel"), this.scene = new tr(), this.camera = new Kn(30, 1, .1, 2e3), this.cameraPosition = new U(), this.cameraTarget = new U(), this.raycaster = new Wa(), this.pointer = new V(), this.nodes = /* @__PURE__ */ new Map(), this.open = /* @__PURE__ */ new Set(), this.selected = null, this.selectedRelationIndex = null, this.modelData = null, this._loading = !1, this._pendingSelection = null, this.theme = ul(), this.relationMode = this.getAttribute("relation-mode") || "selected", this.selectionMode = ["internal", "event"].includes(this.getAttribute("selection-mode")) ? this.getAttribute("selection-mode") : "internal", this.showShellLabels = this.getAttribute("shell-labels") !== "false", this.yaw = .37, this.pitch = .22, this.zoom = 1, this.targetZoom = 1, this.focus = new U(), this.targetFocus = new U(), this.drag = null, this.pointers = /* @__PURE__ */ new Map(), this.relationGroup = new Qn(), this.scene.add(this.relationGroup), this.relations = [], this.animationFrame = 0, this.ready = !1, this._toolbarVisible = this.getAttribute("toolbar") !== "off", this.toolbar = this.shadowRoot.querySelector(".toolbar"), this._geometryRegistryListener = () => {
12380
+ super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = "<style>" + hl + ".toolbar{max-width:calc(100% - 16px);overflow:visible}.toolbar-group{display:flex;align-items:center;gap:2px}.toolbar-group+.toolbar-group{padding-left:6px;border-left:1px solid #38515f}.toolbar .toolbar-icon{display:grid;width:30px;padding:0;place-items:center}.toolbar-icon svg,.toolbar-menu>summary svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.toolbar-menu{position:relative}.toolbar-menu>summary{display:flex;align-items:center;height:30px;padding:0 8px;gap:6px;border-radius:5px;color:var(--lc-toolbar-text,#dbe7ec);cursor:pointer;list-style:none;user-select:none}.toolbar-menu>summary::-webkit-details-marker{display:none}.toolbar-menu>summary:hover,.toolbar-menu[open]>summary{background:var(--lc-toolbar-active,#1f3d4b);color:var(--lc-toolbar-active-text,#c5f2e9)}.toolbar-menu-status{max-width:92px;overflow:hidden;font-size:11px;text-overflow:ellipsis;white-space:nowrap}.toolbar-menu-chevron{width:10px;height:10px!important;transition:transform .16s ease}.toolbar-menu[open] .toolbar-menu-chevron{transform:rotate(180deg)}.toolbar-popover{position:absolute;right:0;bottom:calc(100% + 8px);display:grid;min-width:218px;padding:6px;border:1px solid var(--lc-toolbar-border,#3a5062);border-radius:9px;background:var(--lc-toolbar-bg,#15232ff7);box-shadow:0 14px 36px #0009}.toolbar-popover-title{padding:7px 9px 5px;color:var(--lc-hint,#8da6b8);font-size:9px;font-weight:700;letter-spacing:.1em;text-transform:uppercase}.toolbar .toolbar-option{display:grid;grid-template-columns:minmax(0,1fr) 18px;align-items:center;width:100%;height:auto;min-height:34px;padding:7px 9px;text-align:left}.toolbar-option span:first-child{overflow:hidden;text-overflow:ellipsis}.toolbar-option-check{color:var(--lc-toolbar-active-text,#c5f2e9);font-weight:700;text-align:center;visibility:hidden}.toolbar-option.active .toolbar-option-check{visibility:visible}.toolbar-option-separator{height:1px;margin:5px 7px;background:#38515f}.toolbar button[disabled]{opacity:.42;cursor:not-allowed}@media(max-width:620px){.toolbar-menu-status{display:none}.toolbar-menu>summary{width:30px;padding:0;justify-content:center}.toolbar-menu-chevron{display:none}.toolbar-group+.toolbar-group{padding-left:3px}.toolbar-popover{right:-4px}}</style>" + bl, this.canvas = this.shadowRoot.querySelector("canvas"), this.panel = this.shadowRoot.querySelector(".panel"), this.scene = new tr(), this.camera = new Kn(30, 1, .1, 2e3), this.cameraPosition = new U(), this.cameraTarget = new U(), this.raycaster = new Wa(), this.pointer = new V(), this.nodes = /* @__PURE__ */ new Map(), this.open = /* @__PURE__ */ new Set(), this.selected = null, this.selectedRelationIndex = null, this.modelData = null, this._loading = !1, this._pendingSelection = null, this.theme = pl(), this.relationMode = this.getAttribute("relation-mode") || "selected", this.focusFilter = ll({
12381
+ mode: this.getAttribute("focus-mode"),
12382
+ effect: this.getAttribute("focus-effect"),
12383
+ layout: this.getAttribute("focus-layout")
12384
+ }), this.selectionMode = ["internal", "event"].includes(this.getAttribute("selection-mode")) ? this.getAttribute("selection-mode") : "internal", this.showShellLabels = this.getAttribute("shell-labels") !== "false", this.yaw = .37, this.pitch = .22, this.zoom = 1, this.targetZoom = 1, this.focus = new U(), this.targetFocus = new U(), this.drag = null, this.pointers = /* @__PURE__ */ new Map(), this.relationGroup = new Qn(), this.scene.add(this.relationGroup), this.relations = [], this.animationFrame = 0, this.ready = !1, this._toolbarVisible = this.getAttribute("toolbar") !== "off", this._panelVisible = this.getAttribute("panel") !== "off", this.toolbar = this.shadowRoot.querySelector(".toolbar"), this._geometryRegistryListener = () => {
12346
12385
  this.ready && this.modelData && this._build();
12347
- }, this._bindControls(), this.resizeObserver = new ResizeObserver(() => this.resize()), this.resizeObserver.observe(this.canvas);
12386
+ }, this._bindControls(), this._syncFocusToolbar(), this._syncRelationToolbar(), this._syncLabelsToolbar(), this._syncPanelToolbar(), this.resizeObserver = new ResizeObserver(() => this.resize()), this.resizeObserver.observe(this.canvas);
12348
12387
  }
12349
12388
  connectedCallback() {
12350
12389
  globalThis.addEventListener?.("lc-geometry-registry-change", this._geometryRegistryListener), this.resizeObserver.observe(this.canvas), this.hasAttribute("height") && this.style.setProperty("--lc-height", this.getAttribute("height")), this._loadInitial();
@@ -12354,14 +12393,14 @@ var Dl = class extends HTMLElement {
12354
12393
  }
12355
12394
  attributeChangedCallback(e, t, n) {
12356
12395
  if (t !== n) {
12357
- if (e === "height" && this.style.setProperty("--lc-height", n || "680px"), e === "relation-mode" && this.ready && this.setRelationMode(n || "selected"), e === "selection-mode" && this.setSelectionMode(n || "internal"), e === "shell-labels" && this.ready) {
12396
+ if (e === "height" && this.style.setProperty("--lc-height", n || "680px"), e === "relation-mode" && this.ready && this.setRelationMode(n || "selected"), e === "selection-mode" && this.setSelectionMode(n || "internal"), e === "focus-mode" && n !== this.focusFilter.mode && this.setFocusFilter({ mode: n }), e === "focus-effect" && n !== this.focusFilter.effect && this.setFocusFilter({ effect: n }), e === "focus-layout" && n !== this.focusFilter.layout && this.setFocusFilter({ layout: n }), e === "shell-labels" && this.ready) {
12358
12397
  let e = n !== "false";
12359
12398
  e !== this.showShellLabels && (this.showShellLabels = e, this._build({
12360
12399
  preserveSelection: this.selected?.id,
12361
12400
  preserveRelation: this.selectedRelationIndex
12362
12401
  }));
12363
12402
  }
12364
- e === "toolbar" && (this._toolbarVisible = n !== "off", this.ready && this._applyTheme());
12403
+ e === "toolbar" && (this._toolbarVisible = n !== "off", this.ready && this._applyTheme()), e === "panel" && (this._panelVisible = n !== "off", this._syncPanelToolbar(), this.ready && this._applyTheme());
12365
12404
  }
12366
12405
  }
12367
12406
  get model() {
@@ -12397,13 +12436,18 @@ var Dl = class extends HTMLElement {
12397
12436
  this.setPalette(e);
12398
12437
  }
12399
12438
  getRenderStats() {
12400
- let e = this.renderer?.info;
12439
+ let e = this.renderer?.info, t = this._focusedEntityIds();
12401
12440
  return {
12402
12441
  ready: this.ready,
12403
12442
  nodes: this.nodes.size,
12404
12443
  relations: this.relations.length,
12405
12444
  relationObjects: this.relationGroup.children.length,
12406
12445
  animatedRelationObjects: this.relationGroup.children.filter((e) => e.userData?.start).length,
12446
+ focus: {
12447
+ ...this.focusFilter,
12448
+ active: !!t,
12449
+ entities: t?.size ?? this.nodes.size
12450
+ },
12407
12451
  memory: {
12408
12452
  geometries: e?.memory?.geometries || 0,
12409
12453
  textures: e?.memory?.textures || 0,
@@ -12433,6 +12477,12 @@ var Dl = class extends HTMLElement {
12433
12477
  setToolbarVisible(e) {
12434
12478
  return this._toolbarVisible = !!e, this.setAttribute("toolbar", e ? "on" : "off"), this._applyTheme(), this;
12435
12479
  }
12480
+ get panelVisible() {
12481
+ return this.hasAttribute("panel") ? this._panelVisible : this.modelData?.render?.ui?.panel !== !1 && this.theme.ui.panel !== !1;
12482
+ }
12483
+ setPanelVisible(e) {
12484
+ return this._panelVisible = !!e, this.setAttribute("panel", e ? "on" : "off"), this._syncPanelToolbar(), this._applyTheme(), this;
12485
+ }
12436
12486
  get clickBehavior() {
12437
12487
  return this.selectionMode;
12438
12488
  }
@@ -12442,13 +12492,111 @@ var Dl = class extends HTMLElement {
12442
12492
  setSelectionMode(e = "internal") {
12443
12493
  return this.selectionMode = e === "event" || e === "external" ? "event" : "internal", this.setAttribute("selection-mode", this.selectionMode), this;
12444
12494
  }
12495
+ _descendantIds(e, t) {
12496
+ for (let n of this.nodes.values()) n.parent !== e || t.has(n.id) || (t.add(n.id), this._descendantIds(n.id, t));
12497
+ }
12498
+ _focusedEntityIds() {
12499
+ if (this.focusFilter.mode !== "connected") return null;
12500
+ let e = /* @__PURE__ */ new Set();
12501
+ if (this.selected) e.add(this.selected.id);
12502
+ else if (this.selectedRelationIndex !== null) {
12503
+ let t = this.relations[this.selectedRelationIndex];
12504
+ t && (e.add(t.from), e.add(t.to));
12505
+ }
12506
+ if (!e.size) return null;
12507
+ for (let t of [...e]) {
12508
+ let n = this.nodes.get(t);
12509
+ n && cl(n.type) && this._descendantIds(t, e);
12510
+ }
12511
+ let t = new Set(e);
12512
+ for (let n of this.relations) (t.has(n.from) || t.has(n.to)) && (e.add(n.from), e.add(n.to));
12513
+ for (let t of [...e]) {
12514
+ let n = this.nodes.get(t);
12515
+ n && cl(n.type) && this._descendantIds(t, e);
12516
+ }
12517
+ for (let t of [...e]) {
12518
+ let n = this.nodes.get(t)?.parent ? this.nodes.get(this.nodes.get(t).parent) : null;
12519
+ for (; n;) e.add(n.id), n = n.parent ? this.nodes.get(n.parent) : null;
12520
+ }
12521
+ return e;
12522
+ }
12523
+ getFocusedIds() {
12524
+ let e = this._focusedEntityIds();
12525
+ return e ? [...e] : [...this.nodes.keys()];
12526
+ }
12527
+ _emitFocusChange(e = "api") {
12528
+ let t = this._focusedEntityIds();
12529
+ this._emit("lc-focus-change", {
12530
+ filter: { ...this.focusFilter },
12531
+ active: !!t,
12532
+ ids: t ? [...t] : [...this.nodes.keys()],
12533
+ source: e
12534
+ });
12535
+ }
12536
+ _syncFocusToolbar() {
12537
+ let e = this.focusFilter.mode === "all" ? "all" : this.focusFilter.effect;
12538
+ for (let t of [
12539
+ "all",
12540
+ "dim",
12541
+ "hide"
12542
+ ]) {
12543
+ let n = this.shadowRoot.querySelector(`[data-action="focus-${t}"]`);
12544
+ n && (n.classList.toggle("active", t === e), n.setAttribute("aria-pressed", String(t === e)));
12545
+ }
12546
+ let t = this.shadowRoot.querySelector("[data-action=\"focus-layout\"]");
12547
+ if (t) {
12548
+ let e = this.focusFilter.layout === "reflow";
12549
+ t.classList.toggle("active", e), t.setAttribute("aria-pressed", String(e)), t.disabled = this.focusFilter.mode === "all";
12550
+ }
12551
+ let n = this.shadowRoot.querySelector("[data-toolbar-status=\"focus\"]");
12552
+ n && (n.textContent = e === "all" ? "Todo" : e === "dim" ? "Conectados" : "Aislar");
12553
+ }
12554
+ _syncRelationToolbar() {
12555
+ for (let e of [
12556
+ "all",
12557
+ "selected",
12558
+ "none"
12559
+ ]) {
12560
+ let t = this.shadowRoot.querySelector(`[data-action="relations-${e}"]`);
12561
+ if (!t) continue;
12562
+ let n = e === this.relationMode;
12563
+ t.classList.toggle("active", n), t.setAttribute("aria-pressed", String(n));
12564
+ }
12565
+ let e = this.shadowRoot.querySelector("[data-toolbar-status=\"relations\"]");
12566
+ e && (e.textContent = this.relationMode === "all" ? "Todas" : this.relationMode === "none" ? "Ocultar" : "Selección");
12567
+ }
12568
+ _syncPanelToolbar() {
12569
+ let e = this.shadowRoot?.querySelector("[data-action=\"panel\"]");
12570
+ if (!e) return;
12571
+ let t = this.panelVisible;
12572
+ e.classList.toggle("active", t), e.setAttribute("aria-pressed", String(t));
12573
+ }
12574
+ _syncLabelsToolbar() {
12575
+ let e = this.shadowRoot?.querySelector("[data-action=\"labels\"]");
12576
+ e && (e.classList.toggle("active", this.showShellLabels), e.setAttribute("aria-pressed", String(this.showShellLabels)));
12577
+ }
12578
+ _closeToolbarMenus(e = null) {
12579
+ this.toolbar?.querySelectorAll(".toolbar-menu[open]").forEach((t) => {
12580
+ t !== e && t.removeAttribute("open");
12581
+ });
12582
+ }
12583
+ setFocusFilter(e = {}, t = {}) {
12584
+ let n = ll({
12585
+ ...this.focusFilter,
12586
+ ...e || {}
12587
+ }), r = JSON.stringify(n) !== JSON.stringify(this.focusFilter);
12588
+ return this.focusFilter = n, this._syncFocusToolbar(), this.getAttribute("focus-mode") !== n.mode && this.setAttribute("focus-mode", n.mode), this.getAttribute("focus-effect") !== n.effect && this.setAttribute("focus-effect", n.effect), this.getAttribute("focus-layout") !== n.layout && this.setAttribute("focus-layout", n.layout), r && (this._rebuildRelations(), this.invalidate()), t.emit !== !1 && this._emitFocusChange(t.source || "api"), this;
12589
+ }
12590
+ clearFocusFilter(e = {}) {
12591
+ return this.setFocusFilter({ mode: "all" }, e);
12592
+ }
12445
12593
  _applyModelRenderOptions() {
12446
12594
  let e = this.modelData?.render;
12447
12595
  return !e || typeof e != "object" ? this : ([
12448
12596
  "all",
12449
12597
  "selected",
12450
12598
  "none"
12451
- ].includes(e.relationMode) && e.relationMode !== this.relationMode && this.setRelationMode(e.relationMode), Object.hasOwn(e, "selectionMode") && e.selectionMode !== this.selectionMode && this.setSelectionMode(e.selectionMode), Object.hasOwn(e, "toolbar") && e.toolbar !== !1 !== this.toolbarVisible && this.setToolbarVisible(e.toolbar !== !1), Object.hasOwn(e, "shellLabels") && e.shellLabels !== !1 !== this.showShellLabels && this.setShellLabels(e.shellLabels !== !1), this);
12599
+ ].includes(e.relationMode) && e.relationMode !== this.relationMode && this.setRelationMode(e.relationMode), Object.hasOwn(e, "selectionMode") && e.selectionMode !== this.selectionMode && this.setSelectionMode(e.selectionMode), Object.hasOwn(e, "toolbar") && e.toolbar !== !1 !== this.toolbarVisible && this.setToolbarVisible(e.toolbar !== !1), Object.hasOwn(e, "shellLabels") && e.shellLabels !== !1 !== this.showShellLabels && this.setShellLabels(e.shellLabels !== !1), e.focus && this.setFocusFilter(e.focus, { emit: !1 }), this);
12452
12600
  }
12453
12601
  _emit(e, t = {}) {
12454
12602
  this.dispatchEvent(new CustomEvent(e, {
@@ -12485,7 +12633,7 @@ var Dl = class extends HTMLElement {
12485
12633
  }
12486
12634
  _commitModelChange(e, t = {}, n = {}) {
12487
12635
  let r = n.preserveSelection === !1 ? null : this.selected?.id, i = n.preserveSelection === !1 ? null : this._publicRelation(this.selectedRelationIndex), a = i?.id ?? i?.index ?? null;
12488
- return this.modelData = ml(this.modelData), this._build({
12636
+ return this.modelData = Cl(this.modelData), this._build({
12489
12637
  preserveSelection: r,
12490
12638
  preserveRelation: a
12491
12639
  }), this._emit("lc-model-change", {
@@ -12496,7 +12644,7 @@ var Dl = class extends HTMLElement {
12496
12644
  }
12497
12645
  updateModel(e = {}, t = {}) {
12498
12646
  if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("El parche del modelo debe ser un objeto.");
12499
- let n = this.modelData || ml({}), r = JSON.stringify(n.render?.camera || null), i = {
12647
+ let n = this.modelData || Cl({}), r = JSON.stringify(n.render?.camera || null), i = {
12500
12648
  ...n,
12501
12649
  ...e,
12502
12650
  palette: e.palette ? {
@@ -12507,11 +12655,11 @@ var Dl = class extends HTMLElement {
12507
12655
  entities: Array.isArray(e.entities) ? e.entities : n.entities,
12508
12656
  relations: Array.isArray(e.relations) ? e.relations : n.relations
12509
12657
  };
12510
- return this.modelData = ml(i), this.theme = this.modelData.theme, this._commitModelChange("model-update", { patch: e }, t), this._applyModelRenderOptions(), JSON.stringify(this.modelData.render?.camera || null) !== r && this.modelData.render?.camera && this.setCameraView(this.modelData.render.camera, { animate: t.animateCamera !== !1 }), this;
12658
+ return this.modelData = Cl(i), this.theme = this.modelData.theme, this._commitModelChange("model-update", { patch: e }, t), this._applyModelRenderOptions(), JSON.stringify(this.modelData.render?.camera || null) !== r && this.modelData.render?.camera && this.setCameraView(this.modelData.render.camera, { animate: t.animateCamera !== !1 }), this;
12511
12659
  }
12512
12660
  addEntity(e, t = {}) {
12513
12661
  if (!e || typeof e != "object" || !e.id) throw TypeError("La entidad debe incluir un id.");
12514
- if (this.modelData ||= ml({}), this.modelData.entities.some((t) => t.id === e.id)) throw Error(`Ya existe una entidad con id "${e.id}".`);
12662
+ if (this.modelData ||= Cl({}), this.modelData.entities.some((t) => t.id === e.id)) throw Error(`Ya existe una entidad con id "${e.id}".`);
12515
12663
  if (e.parent && !this.modelData.entities.some((t) => t.id === e.parent)) throw Error(`No existe el contenedor padre "${e.parent}".`);
12516
12664
  return this.modelData.entities = [...this.modelData.entities, { ...e }], this._commitModelChange("entity-add", { entity: this._publicEntity(e.id) }, t);
12517
12665
  }
@@ -12650,9 +12798,7 @@ var Dl = class extends HTMLElement {
12650
12798
  }
12651
12799
  setShellLabels(e) {
12652
12800
  let t = !!e, n = t !== this.showShellLabels;
12653
- this.showShellLabels = t, this.setAttribute("shell-labels", this.showShellLabels ? "on" : "false");
12654
- let r = this.shadowRoot.querySelector("[data-action=\"labels\"]");
12655
- return r && (r.classList.toggle("active", this.showShellLabels), r.setAttribute("aria-pressed", String(this.showShellLabels))), n && this.ready ? this._build({
12801
+ return this.showShellLabels = t, this.setAttribute("shell-labels", this.showShellLabels ? "on" : "false"), this._syncLabelsToolbar(), n && this.ready ? this._build({
12656
12802
  preserveSelection: this.selected?.id,
12657
12803
  preserveRelation: this.selectedRelationIndex
12658
12804
  }) : this.invalidate(), this;
@@ -12661,7 +12807,7 @@ var Dl = class extends HTMLElement {
12661
12807
  return this.setShellLabels(!this.showShellLabels);
12662
12808
  }
12663
12809
  openAllContainers() {
12664
- for (let e of this.nodes.values()) sl(e.type) && this.open.add(e.id);
12810
+ for (let e of this.nodes.values()) cl(e.type) && this.open.add(e.id);
12665
12811
  return this._renderPanel(), this._rebuildRelations(), this.invalidate(), this;
12666
12812
  }
12667
12813
  closeAllContainers() {
@@ -12674,21 +12820,21 @@ var Dl = class extends HTMLElement {
12674
12820
  this.setTheme(e);
12675
12821
  }
12676
12822
  get theme() {
12677
- return this._theme || ul();
12823
+ return this._theme || pl();
12678
12824
  }
12679
12825
  set theme(e) {
12680
- this._theme = ul(e), this.shadowRoot && this._applyTheme();
12826
+ this._theme = pl(e), this.shadowRoot && this._applyTheme();
12681
12827
  }
12682
12828
  setTheme(e = {}) {
12683
- return this.theme = ll(this.theme, e), this.modelData && (this.modelData.theme = this.theme), this._applyLighting(), this.invalidate(), this;
12829
+ return this.theme = fl(this.theme, e), this.modelData && (this.modelData.theme = this.theme), this._applyLighting(), this.invalidate(), this;
12684
12830
  }
12685
12831
  _applyTheme() {
12686
12832
  let e = this.theme, t = this.style;
12687
12833
  t.setProperty("--lc-bg", e.background.color), t.setProperty("--lc-bg-glow", e.background.glow), t.setProperty("--lc-bg-fade", e.background.fade), t.setProperty("--lc-panel-bg", e.panel.background), t.setProperty("--lc-panel-border", e.panel.border), t.setProperty("--lc-panel-text", e.panel.text), t.setProperty("--lc-panel-title", e.panel.title), t.setProperty("--lc-toolbar-bg", e.toolbar.background), t.setProperty("--lc-toolbar-border", e.toolbar.border), t.setProperty("--lc-toolbar-text", e.toolbar.text), t.setProperty("--lc-toolbar-active", e.toolbar.active), t.setProperty("--lc-toolbar-active-text", e.toolbar.activeText), t.setProperty("--lc-crumb-bg", e.breadcrumbs.background), t.setProperty("--lc-crumb-text", e.breadcrumbs.text), t.setProperty("--lc-crumb-active", e.breadcrumbs.active), t.setProperty("--lc-crumb-active-text", e.breadcrumbs.activeText), t.setProperty("--lc-hint", e.hint);
12688
12834
  let n = this.shadowRoot.querySelector(".atlas"), r = this.shadowRoot.querySelector(".toolbar"), i = this.shadowRoot.querySelector(".panel"), a = this.shadowRoot.querySelector(".hint");
12689
- n && (n.dataset.panel = e.ui.panel === !1 ? "hidden" : "visible");
12690
- let o = this.toolbarVisible, s = e.ui.panel !== !1, c = e.ui.hint !== !1;
12691
- r && (r.dataset.hidden = String(!o), r.hidden = !o, r.style.setProperty("display", o ? "flex" : "none", "important")), i && (i.dataset.hidden = String(!s), i.hidden = !s), a && (a.dataset.hidden = String(!c), a.hidden = !c), this.shadowRoot.querySelectorAll(".crumbs").forEach((t) => {
12835
+ n && (n.dataset.panel = this.panelVisible ? "visible" : "hidden");
12836
+ let o = this.toolbarVisible, s = this.panelVisible, c = e.ui.hint !== !1;
12837
+ r && (r.dataset.hidden = String(!o), r.hidden = !o, r.style.setProperty("display", o ? "flex" : "none", "important")), i && (i.dataset.hidden = String(!s), i.hidden = !s), this._syncPanelToolbar(), a && (a.dataset.hidden = String(!c), a.hidden = !c), this.shadowRoot.querySelectorAll(".crumbs").forEach((t) => {
12692
12838
  t.dataset.hidden = String(e.ui.breadcrumbs === !1), t.hidden = e.ui.breadcrumbs === !1;
12693
12839
  });
12694
12840
  }
@@ -12711,7 +12857,7 @@ var Dl = class extends HTMLElement {
12711
12857
  this._loading = !0, this._pendingSelection = null;
12712
12858
  try {
12713
12859
  let t = typeof e == "string" ? await fetch(e).then((e) => e.json()) : e;
12714
- this.modelData = ml(t), this.selected = null, this.selectedRelationIndex = null, this.open.clear(), this._pendingPalette &&= (this.modelData.palette = {
12860
+ this.modelData = Cl(t), this.selected = null, this.selectedRelationIndex = null, this.open.clear(), this._pendingPalette &&= (this.modelData.palette = {
12715
12861
  ...this.modelData.palette,
12716
12862
  ...this._pendingPalette
12717
12863
  }, null), this.theme = this.modelData.theme, this._applyTheme(), this._build(), this._applyModelRenderOptions(), this.modelData.render?.camera && this.setCameraView(this.modelData.render.camera, { animate: !1 }), this.dispatchEvent(new CustomEvent("lc-ready", { detail: { model: this.modelData } })), this.dispatchEvent(new CustomEvent("lc-model-change", { detail: { model: this.modelData } }));
@@ -12738,9 +12884,9 @@ var Dl = class extends HTMLElement {
12738
12884
  }
12739
12885
  _applyLighting() {
12740
12886
  if (!this.ambientLight || !this.directionalLight) return;
12741
- let e = this.theme?.lighting || cl.lighting;
12887
+ let e = this.theme?.lighting || dl.lighting;
12742
12888
  this.ambientLight.color.set(e.ambientSky), this.ambientLight.groundColor.set(e.ambientGround), this.ambientLight.intensity = Number(e.ambient) || 0, this.directionalLight.color.set(e.directionalColor), this.directionalLight.intensity = Number(e.directional) || 0;
12743
- let t = Array.isArray(e.directionalPosition) ? e.directionalPosition : cl.lighting.directionalPosition;
12889
+ let t = Array.isArray(e.directionalPosition) ? e.directionalPosition : dl.lighting.directionalPosition;
12744
12890
  this.directionalLight.position.fromArray(t);
12745
12891
  }
12746
12892
  _worldPosition(e, t = /* @__PURE__ */ new Set()) {
@@ -12777,7 +12923,7 @@ var Dl = class extends HTMLElement {
12777
12923
  ...e.geometryPalette || {},
12778
12924
  ...e.geometryPaletteOverrides || {}
12779
12925
  };
12780
- n.material.color.set(Sl(n.value, r, t));
12926
+ n.material.color.set(jl(n.value, r, t));
12781
12927
  }
12782
12928
  }
12783
12929
  }
@@ -12790,19 +12936,19 @@ var Dl = class extends HTMLElement {
12790
12936
  for (let e of this.modelData.entities) {
12791
12937
  let t = this.nodes.get(e.id);
12792
12938
  t.group = new Qn(), t.group.position.copy(this._worldPosition(t));
12793
- let n = e.geometry || "box", r = ol(n), i = !r && n.includes("."), a = i ? "#ed8f98" : this.modelData.palette[e.c] || e.c || this.modelData.palette.component;
12939
+ let n = e.geometry || "box", r = sl(n), i = !r && n.includes("."), a = i ? "#ed8f98" : this.modelData.palette[e.c] || e.c || this.modelData.palette.component;
12794
12940
  i && this.dispatchEvent(new CustomEvent("lc-warning", { detail: {
12795
12941
  code: "GEOMETRY_NOT_REGISTERED",
12796
12942
  geometry: n,
12797
12943
  entityId: e.id
12798
12944
  } }));
12799
- let o = r?.primitive || n, s = r && !r.primitive && !sl(e.type);
12945
+ let o = r?.primitive || n, s = r && !r.primitive && !cl(e.type);
12800
12946
  if (t.geometryDefinition = r || null, t.geometryMissing = i, t.geometryPalette = r?.palette || {}, t.geometryPaletteOverrides = e.geometryPalette || e.geometry_palette || {}, t.ports = {
12801
12947
  ...r?.anchors || {},
12802
12948
  ...e.ports || {}
12803
12949
  }, s) {
12804
12950
  try {
12805
- let n = Tl(r, e, this.modelData.palette, () => this.invalidate(), (e) => this.dispatchEvent(new CustomEvent("lc-warning", { detail: e })));
12951
+ let n = Pl(r, e, this.modelData.palette, () => this.invalidate(), (e) => this.dispatchEvent(new CustomEvent("lc-warning", { detail: e })));
12806
12952
  n.root.scale.multiply(new U().fromArray(e.s)), t.appearanceMaterials = [], n.root.traverse((e) => {
12807
12953
  if (!(e.isMesh || e.isLine || e.isLineSegments || e.isSprite)) return;
12808
12954
  e.userData.node = t;
@@ -12823,7 +12969,7 @@ var Dl = class extends HTMLElement {
12823
12969
  entityId: e.id,
12824
12970
  error: r
12825
12971
  } }));
12826
- let i = bl(yl("box"));
12972
+ let i = kl(Ol("box"));
12827
12973
  t.material = new ia({
12828
12974
  color: "#ed8f98",
12829
12975
  roughness: .72,
@@ -12832,13 +12978,13 @@ var Dl = class extends HTMLElement {
12832
12978
  }
12833
12979
  t.labelSize = new U().fromArray(e.s);
12834
12980
  } else {
12835
- let n = o === "box" && Number(e.radius) > 0, r = yl(o, e.radius, e.segments, e.s);
12836
- n || bl(r), t.material = new ia({
12981
+ let n = o === "box" && Number(e.radius) > 0, r = Ol(o, e.radius, e.segments, e.s);
12982
+ n || kl(r), t.material = new ia({
12837
12983
  color: a,
12838
12984
  roughness: .72,
12839
12985
  metalness: .06,
12840
12986
  transparent: !0,
12841
- opacity: sl(e.type) ? .96 : 1
12987
+ opacity: cl(e.type) ? .96 : 1
12842
12988
  }), t.mesh = new An(r, t.material), t.mesh.scale.fromArray(n ? [
12843
12989
  1,
12844
12990
  1,
@@ -12853,7 +12999,7 @@ var Dl = class extends HTMLElement {
12853
12999
  1
12854
13000
  ] : e.s), t.group.add(t.edge);
12855
13001
  }
12856
- t.label = El(e.name, a, t.labelSize, e.type, this.showShellLabels), t.label.userData.node = t, t.label.traverse((e) => {
13002
+ t.label = Fl(e.name, a, t.labelSize, e.type, this.showShellLabels), t.label.userData.node = t, t.label.traverse((e) => {
12857
13003
  e.userData.node = t;
12858
13004
  }), t.group.add(t.label), this.scene.add(t.group);
12859
13005
  }
@@ -12869,6 +13015,9 @@ var Dl = class extends HTMLElement {
12869
13015
  }
12870
13016
  return !0;
12871
13017
  }
13018
+ _focusAlpha(e, t = this._focusedEntityIds()) {
13019
+ return !t || t.has(e.id) ? 1 : this.focusFilter.effect === "hide" ? 0 : this.focusFilter.opacity;
13020
+ }
12872
13021
  _endpoint(e, t, n = !1, r = null) {
12873
13022
  let i = this._worldPosition(e), a = e.anchor || "center", o = r?.[n ? "fromAnchor" : "toAnchor"] || r?.[n ? "from_anchor" : "to_anchor"];
12874
13023
  if (a === "port" || o) {
@@ -12889,23 +13038,26 @@ var Dl = class extends HTMLElement {
12889
13038
  }
12890
13039
  _rebuildRelations() {
12891
13040
  this._clearRelationGroup();
12892
- let e = this._activeRelationIndexes(), t = new X(this.modelData?.palette.connection || Qc.connection);
12893
- for (let n of e) {
12894
- let e = this.relations[n], r = this.nodes.get(e.from), i = this.nodes.get(e.to);
12895
- if (!r || !i) continue;
12896
- let a = this._endpoint(r, i, !0, e), o = this._endpoint(i, r, !1, e), s = o.clone().sub(a);
12897
- if (s.lengthSq() < .01) continue;
12898
- let c = dl(e), l = n === this.selectedRelationIndex, u = (e, t = .055, n = .88) => {
13041
+ let e = this._activeRelationIndexes(), t = this._focusedEntityIds(), n = new X(this.modelData?.palette.connection || Qc.connection);
13042
+ for (let r of e) {
13043
+ let e = this.relations[r], i = this.nodes.get(e.from), a = this.nodes.get(e.to);
13044
+ if (!i || !a) continue;
13045
+ let o = !t || t.has(e.from) && t.has(e.to);
13046
+ if (!o && this.focusFilter.effect === "hide") continue;
13047
+ let s = o ? 1 : this.focusFilter.opacity, c = this._endpoint(i, a, !0, e), l = this._endpoint(a, i, !1, e), u = l.clone().sub(c);
13048
+ if (u.lengthSq() < .01) continue;
13049
+ let d = ml(e), f = r === this.selectedRelationIndex, p = (e, t = .055, n = .88) => {
12899
13050
  let r = new rn({
12900
13051
  color: e,
12901
13052
  transparent: !0,
12902
- opacity: n,
13053
+ opacity: n * s,
13054
+ depthTest: !0,
12903
13055
  depthWrite: !1
12904
13056
  });
12905
- l && (r.color.lerp(new X(16777215), .28), r.opacity = 1);
12906
- let i = new An(new ra(new ri(a, o), 10, l ? t * 1.45 : t, 6, !1), r);
12907
- return this.relationGroup.add(i), i;
12908
- }, d = new An(new ra(new ri(a, o), 10, .16, 6, !1), new rn({
13057
+ f && (r.color.lerp(new X(16777215), .28), r.opacity = 1);
13058
+ let i = new An(new ra(new ri(c, l), 10, f ? t * 1.45 : t, 6, !1), r);
13059
+ return i.renderOrder = el, this.relationGroup.add(i), i;
13060
+ }, m = new An(new ra(new ri(c, l), 10, .16, 6, !1), new rn({
12909
13061
  transparent: !0,
12910
13062
  opacity: 0,
12911
13063
  colorWrite: !1,
@@ -12913,30 +13065,30 @@ var Dl = class extends HTMLElement {
12913
13065
  depthWrite: !1,
12914
13066
  side: 2
12915
13067
  }));
12916
- if (d.userData.relationIndex = n, d.userData.relationPick = !0, d.frustumCulled = !1, this.relationGroup.add(d), c === "broken") {
12917
- u(14965603);
12918
- let e = s.clone().normalize(), t = Math.min(.18, Math.max(.07, s.length() * .018));
12919
- for (let r = 0; r < 3; r++) {
12920
- let i = a.clone().lerp(o, (r + 1) / 4), s = new An(new na(.068, .018, 8, 20), new rn({
13068
+ if (m.userData.relationIndex = r, m.userData.relationPick = !0, m.frustumCulled = !1, this.relationGroup.add(m), d === "broken") {
13069
+ p(14965603);
13070
+ let e = u.clone().normalize(), t = Math.min(.18, Math.max(.07, u.length() * .018));
13071
+ for (let n = 0; n < 3; n++) {
13072
+ let i = c.clone().lerp(l, (n + 1) / 4), a = new An(new na(.068, .018, 8, 20), new rn({
12921
13073
  color: 14965603,
12922
13074
  transparent: !0,
12923
- opacity: l ? 1 : .9,
13075
+ opacity: (f ? 1 : .9) * s,
12924
13076
  depthWrite: !1
12925
13077
  }));
12926
- s.userData.relationIndex = n, s.userData.phase = r / 3, s.userData.oscillate = !0, s.userData.start = i.clone().sub(e.clone().multiplyScalar(t)), s.userData.end = i.clone().add(e.clone().multiplyScalar(t)), s.quaternion.setFromUnitVectors(new U(0, 0, 1), e), this.relationGroup.add(s);
13078
+ a.userData.relationIndex = r, a.userData.phase = n / 3, a.userData.oscillate = !0, a.userData.start = i.clone().sub(e.clone().multiplyScalar(t)), a.userData.end = i.clone().add(e.clone().multiplyScalar(t)), a.quaternion.setFromUnitVectors(new U(0, 0, 1), e), a.renderOrder = el, this.relationGroup.add(a);
12927
13079
  }
12928
13080
  continue;
12929
13081
  }
12930
- u(t);
12931
- let f = s.clone().normalize();
13082
+ p(n);
13083
+ let h = u.clone().normalize();
12932
13084
  for (let e = 0; e < 4; e++) {
12933
- let r = new An(new na(.068, .018, 8, 20), new rn({
12934
- color: t,
13085
+ let t = new An(new na(.068, .018, 8, 20), new rn({
13086
+ color: n,
12935
13087
  transparent: !0,
12936
- opacity: l ? 1 : .9,
13088
+ opacity: (f ? 1 : .9) * s,
12937
13089
  depthWrite: !1
12938
13090
  }));
12939
- r.userData.relationIndex = n, r.userData.phase = e / 4, r.userData.direction = c === "bidirectional" && e % 2 ? -1 : 1, r.userData.start = a.clone(), r.userData.end = o.clone(), r.quaternion.setFromUnitVectors(new U(0, 0, 1), f), this.relationGroup.add(r);
13091
+ t.userData.relationIndex = r, t.userData.phase = e / 4, t.userData.direction = d === "bidirectional" && e % 2 ? -1 : 1, t.userData.start = c.clone(), t.userData.end = l.clone(), t.quaternion.setFromUnitVectors(new U(0, 0, 1), h), t.renderOrder = el, this.relationGroup.add(t);
12940
13092
  }
12941
13093
  }
12942
13094
  }
@@ -12944,8 +13096,8 @@ var Dl = class extends HTMLElement {
12944
13096
  if (!this.modelData) return;
12945
13097
  let e = this.selectedRelationIndex === null ? null : this.relations[this.selectedRelationIndex];
12946
13098
  if (e) {
12947
- let t = dl(e);
12948
- this.panel.innerHTML = "<button class=\"back\" data-action=\"overview\">← Vista de conjunto</button><div class=\"eyebrow\">RELACIÓN</div><h2>" + pl(e.label || `${e.from} → ${e.to}`) + "</h2><p>" + pl(e.from) + " → " + pl(e.to) + "</p><h3>MODO</h3><p>" + pl(t) + "</p>", this.panel.querySelector("[data-action=\"overview\"]")?.addEventListener("click", () => this.reset()), this._applyTheme();
13099
+ let t = ml(e), n = e.text ? "<p>" + xl(e.text) + "</p>" : "", r = Sl(e.url);
13100
+ this.panel.innerHTML = "<button class=\"back\" data-action=\"overview\">← Vista de conjunto</button><div class=\"eyebrow\">RELACIÓN</div><h2>" + xl(e.label || `${e.from} → ${e.to}`) + "</h2><div class=\"sub\">" + xl(e.from) + " → " + xl(e.to) + "</div>" + n + r + "<h3>MODO</h3><p>" + xl(t) + "</p>", this.panel.querySelector("[data-action=\"overview\"]")?.addEventListener("click", () => this.reset()), this._applyTheme();
12949
13101
  return;
12950
13102
  }
12951
13103
  let t = this.selected;
@@ -12955,8 +13107,11 @@ var Dl = class extends HTMLElement {
12955
13107
  }
12956
13108
  let n = this.relations.filter((e) => e.from === t.id || e.to === t.id), r = this.modelData.entities.filter((e) => e.parent === t.id), i = [], a = /* @__PURE__ */ new Set(), o = t;
12957
13109
  for (; o && !a.has(o.id);) a.add(o.id), i.unshift(o), o = o.parent ? this.nodes.get(o.parent) : null;
12958
- let s = "<nav class=\"crumbs\" aria-label=\"Ruta del modelo\"><button data-action=\"overview\">Modelo</button>" + i.map((e, t) => "<span>/</span><button data-action=\"path\" data-id=\"" + pl(e.id) + "\" class=\"" + (t === i.length - 1 ? "current" : "") + "\">" + pl(e.name) + "</button>").join("") + "</nav>", c = n.map((e) => "<div class=\"relation\"><strong>" + pl(e.from === t.id ? e.to : e.from) + "</strong><small>" + pl(e.from) + " → " + pl(e.label) + " → " + pl(e.to) + "</small></div>").join("");
12959
- this.panel.innerHTML = "<button class=\"back\" data-action=\"overview\">← Vista de conjunto</button>" + s + "<div class=\"eyebrow\">" + pl(sl(t.type) ? "CONTENEDOR" : t.type === "actor" ? "ACTOR EXTERNO" : "COMPONENTE") + "</div><h2>" + pl(t.name) + "</h2><div class=\"sub\">" + pl(t.sub || "") + "</div><p>" + pl(t.text || "") + "</p>" + (sl(t.type) ? "<button data-action=\"toggle-shell\">" + (this.open.has(t.id) ? "Cerrar bloque" : "Abrir bloque") + "</button>" : "") + (r.length ? "<h3>CONTIENE</h3><p>" + r.length + " pieza(s) interna(s).</p>" : "") + "<h3>RELACIONES</h3>" + (c || "<p>No hay relaciones directas.</p>"), this.panel.querySelectorAll("[data-action=\"overview\"]").forEach((e) => e.addEventListener("click", () => this.reset())), this.panel.querySelectorAll("[data-action=\"path\"]").forEach((e) => e.addEventListener("click", () => this.select(e.dataset.id))), this.panel.querySelector("[data-action=\"toggle-shell\"]")?.addEventListener("click", () => {
13110
+ let s = "<nav class=\"crumbs\" aria-label=\"Ruta del modelo\"><button data-action=\"overview\">Modelo</button>" + i.map((e, t) => "<span>/</span><button data-action=\"path\" data-id=\"" + xl(e.id) + "\" class=\"" + (t === i.length - 1 ? "current" : "") + "\">" + xl(e.name) + "</button>").join("") + "</nav>", c = n.map((e) => {
13111
+ let n = this.relations.indexOf(e), r = e.text ? "<small>" + xl(e.text) + "</small>" : "";
13112
+ return "<button class=\"relation\" data-action=\"relation\" data-relation-index=\"" + n + "\"><strong>" + xl(e.label || (e.from === t.id ? e.to : e.from)) + "</strong><small>" + xl(e.from) + " → " + xl(e.to) + "</small>" + r + "</button>";
13113
+ }).join("");
13114
+ this.panel.innerHTML = "<button class=\"back\" data-action=\"overview\">← Vista de conjunto</button>" + s + "<div class=\"eyebrow\">" + xl(cl(t.type) ? "CONTENEDOR" : t.type === "actor" ? "ACTOR EXTERNO" : "COMPONENTE") + "</div><h2>" + xl(t.name) + "</h2><div class=\"sub\">" + xl(t.sub || "") + "</div><p>" + xl(t.text || "") + "</p>" + Sl(t.url) + (cl(t.type) ? "<button data-action=\"toggle-shell\">" + (this.open.has(t.id) ? "Cerrar bloque" : "Abrir bloque") + "</button>" : "") + (r.length ? "<h3>CONTIENE</h3><p>" + r.length + " pieza(s) interna(s).</p>" : "") + "<h3>RELACIONES</h3>" + (c || "<p>No hay relaciones directas.</p>"), this.panel.querySelectorAll("[data-action=\"overview\"]").forEach((e) => e.addEventListener("click", () => this.reset())), this.panel.querySelectorAll("[data-action=\"path\"]").forEach((e) => e.addEventListener("click", () => this.select(e.dataset.id))), this.panel.querySelectorAll("[data-action=\"relation\"]").forEach((e) => e.addEventListener("click", () => this.selectRelation(Number(e.dataset.relationIndex), { source: "panel" }))), this.panel.querySelector("[data-action=\"toggle-shell\"]")?.addEventListener("click", () => {
12960
13115
  if (this.open.has(t.id)) {
12961
13116
  this.open.delete(t.id);
12962
13117
  for (let e of this.nodes.values()) {
@@ -12978,7 +13133,7 @@ var Dl = class extends HTMLElement {
12978
13133
  if (!n) return this;
12979
13134
  let r = n.parent ? this.nodes.get(n.parent) : null;
12980
13135
  for (; r;) this.open.add(r.id), r = r.parent ? this.nodes.get(r.parent) : null;
12981
- return this.selected = n, this.selectedRelationIndex = null, sl(n.type) && this.open.add(n.id), this.targetFocus.copy(this._worldPosition(n)), this.targetZoom = n.parent ? 1.35 : 1.1, this._renderPanel(), this._rebuildRelations(), this.invalidate(), t.emit !== !1 && this._emit("lc-select", {
13136
+ return this.selected = n, this.selectedRelationIndex = null, cl(n.type) && this.open.add(n.id), this.targetFocus.copy(this._worldPosition(n)), this.targetZoom = n.parent ? 1.35 : 1.1, this._renderPanel(), this._rebuildRelations(), this.invalidate(), t.focusEvent !== !1 && this._emitFocusChange(t.source || "api"), t.emit !== !1 && this._emit("lc-select", {
12982
13137
  kind: "entity",
12983
13138
  id: e,
12984
13139
  index: null,
@@ -12996,7 +13151,7 @@ var Dl = class extends HTMLElement {
12996
13151
  for (; t;) this.open.add(t.id), t = t.parent ? this.nodes.get(t.parent) : null;
12997
13152
  }
12998
13153
  let i = this.nodes.get(r.from), a = this.nodes.get(r.to);
12999
- return i && a && this.targetFocus.copy(this._worldPosition(i).add(this._worldPosition(a)).multiplyScalar(.5)), this.targetZoom = 1.22, this._renderPanel(), this._rebuildRelations(), this.invalidate(), t.emit !== !1 && this._emit("lc-select", {
13154
+ return i && a && this.targetFocus.copy(this._worldPosition(i).add(this._worldPosition(a)).multiplyScalar(.5)), this.targetZoom = 1.22, this._renderPanel(), this._rebuildRelations(), this.invalidate(), t.focusEvent !== !1 && this._emitFocusChange(t.source || "api"), t.emit !== !1 && this._emit("lc-select", {
13000
13155
  kind: "relation",
13001
13156
  id: r.id || null,
13002
13157
  index: n,
@@ -13010,34 +13165,10 @@ var Dl = class extends HTMLElement {
13010
13165
  "all",
13011
13166
  "selected",
13012
13167
  "none"
13013
- ].includes(e) ? e : "selected", this.setAttribute("relation-mode", this.relationMode);
13014
- for (let e of [
13015
- "all",
13016
- "selected",
13017
- "none"
13018
- ]) {
13019
- let t = this.shadowRoot.querySelector(`[data-action="relations-${e}"]`);
13020
- if (t) {
13021
- let n = e === this.relationMode;
13022
- t.classList.toggle("active", n), t.setAttribute("aria-pressed", String(n));
13023
- }
13024
- }
13025
- this._rebuildRelations(), this.invalidate(), this.dispatchEvent(new CustomEvent("lc-relation-mode", { detail: { mode: this.relationMode } }));
13168
+ ].includes(e) ? e : "selected", this.setAttribute("relation-mode", this.relationMode), this._syncRelationToolbar(), this._rebuildRelations(), this.invalidate(), this.dispatchEvent(new CustomEvent("lc-relation-mode", { detail: { mode: this.relationMode } }));
13026
13169
  }
13027
13170
  reset() {
13028
- this.selected = null, this.selectedRelationIndex = null, this.open.clear(), this.relationMode = "selected", this.setAttribute("relation-mode", "selected");
13029
- for (let e of [
13030
- "all",
13031
- "selected",
13032
- "none"
13033
- ]) {
13034
- let t = this.shadowRoot.querySelector(`[data-action="relations-${e}"]`);
13035
- if (t) {
13036
- let n = e === "selected";
13037
- t.classList.toggle("active", n), t.setAttribute("aria-pressed", String(n));
13038
- }
13039
- }
13040
- this.restoreInitialCamera({ animate: !1 }), this._renderPanel(), this._rebuildRelations(), this.invalidate();
13171
+ this.selected = null, this.selectedRelationIndex = null, this.open.clear(), this.relationMode = "selected", this.setAttribute("relation-mode", "selected"), this._syncRelationToolbar(), this.restoreInitialCamera({ animate: !1 }), this._renderPanel(), this._rebuildRelations(), this.invalidate(), this._emitFocusChange("reset");
13041
13172
  }
13042
13173
  resize() {
13043
13174
  if (!this.renderer) return;
@@ -13053,28 +13184,29 @@ var Dl = class extends HTMLElement {
13053
13184
  this.zoom += (this.targetZoom - this.zoom) * .12, this.focus.lerp(this.targetFocus, .12);
13054
13185
  let r = this._baseCameraDistance() / this.zoom;
13055
13186
  this.cameraTarget.set(this.focus.x, this.focus.y, this.focus.z), this.cameraPosition.set(Math.sin(this.yaw) * Math.cos(this.pitch), Math.sin(this.pitch), Math.cos(this.yaw) * Math.cos(this.pitch)).multiplyScalar(r).add(this.cameraTarget), this.camera.position.copy(this.cameraPosition), this.camera.lookAt(this.cameraTarget);
13187
+ let i = this._focusedEntityIds();
13056
13188
  for (let e of this.nodes.values()) {
13057
- let t = this._isVisible(e);
13058
- e.group.visible = t;
13059
- let n = sl(e.type) && this.open.has(e.id) ? .12 : 1, r = n < .999;
13060
- if (e.mesh.renderOrder = r ? 10 - !!e.parent : 0, e.material) e.material.opacity = n, e.material.depthWrite = !r, e.material.emissive?.set(e === this.selected ? e.material.color : 0), e.material.emissiveIntensity = e === this.selected ? .15 : 0;
13061
- else if (e._appearanceSelected !== (e === this.selected)) {
13062
- for (let t of e.appearanceMaterials || []) t.emissive?.set(e === this.selected ? t.color : 0), t.emissiveIntensity = e === this.selected ? .15 : 0;
13189
+ let t = this._focusAlpha(e, i), n = this._isVisible(e) && t > 0;
13190
+ e.group.visible = n;
13191
+ let r = cl(e.type) && this.open.has(e.id), a = (r ? .12 : 1) * t;
13192
+ if (e.mesh.renderOrder = r ? 10 - !!e.parent : 0, e.material) ul(e.material, !0), e.material.opacity = a, e.material.depthWrite = !r, e.material.emissive?.set(e === this.selected ? e.material.color : 0), e.material.emissiveIntensity = e === this.selected ? .15 : 0;
13193
+ else {
13194
+ for (let n of e.appearanceMaterials || []) Object.hasOwn(n.userData, "atlasBaseOpacity") || (n.userData.atlasBaseOpacity = n.opacity ?? 1), Object.hasOwn(n.userData, "atlasBaseTransparent") || (n.userData.atlasBaseTransparent = n.transparent), Object.hasOwn(n.userData, "atlasBaseDepthWrite") || (n.userData.atlasBaseDepthWrite = n.depthWrite), ul(n, n.userData.atlasBaseTransparent || t < 1), n.depthWrite = n.userData.atlasBaseDepthWrite, n.opacity = n.userData.atlasBaseOpacity * t, n.emissive?.set(e === this.selected ? n.color : 0), n.emissiveIntensity = e === this.selected ? .15 : 0;
13063
13195
  e._appearanceSelected = e === this.selected;
13064
13196
  }
13065
- e.edge?.material && (e.edge.material.opacity = e === this.selected ? 1 : .65);
13066
- let i = sl(e.type) && this.open.has(e.id), a = sl(e.type) && (i || n < .65), o = a, s = e.label.userData.front, c = e.label.userData.back, l = e.label.userData.top, u = e.label.userData.height, d = e.label.userData.width, f = e.label.userData.textOffsetX || 0;
13197
+ e.edge?.material && (e.edge.material.opacity = (e === this.selected ? 1 : .65) * t);
13198
+ let o = cl(e.type) && r, s = o, c = e.label.userData.front, l = e.label.userData.back, u = e.label.userData.top, d = e.label.userData.height, f = e.label.userData.width, p = e.label.userData.textOffsetX || 0;
13067
13199
  e.label.userData.textOffsetY;
13068
- let p = e.labelSize || new U().fromArray(e.s);
13069
- e.label.visible = this._isVisible(e);
13070
- let m = this._worldPosition(e), h = this.camera.position.z >= m.z, g = this.camera.position.y > m.y + .25;
13071
- if (sl(e.type)) {
13072
- s.visible = h && (!a || o), c.visible = !h && (!a || o), l.visible = o && g;
13073
- let e = o ? .52 : 1;
13074
- s.scale.setScalar(e), s.position.x = o ? -p.x / 2 + .18 + d * e / 2 - f * e : 0;
13075
- let t = .18;
13076
- s.position.y = o ? p.y / 2 - t - u * e / 2 : p.y / 2 - .09 - u / 2, s.position.z = o ? p.z / 2 + .025 : p.z / 2 + .012, c.position.y = o ? p.y / 2 - t - u * e / 2 : p.y / 2 - .09 - u / 2, c.position.z = o ? -p.z / 2 - .025 : -p.z / 2 - .012, s.material.color.set(o ? 10793147 : 15923964), s.material.opacity = o ? .82 : 1, c.material.color.set(o ? 10793147 : 15923964), c.material.opacity = o ? .82 : 1, l.scale.setScalar(o ? .55 : 1), l.position.x = o ? -p.x / 2 + .12 + d * .55 / 2 - f * .55 : 0, l.position.z = o ? -p.z / 2 + .12 + u * .55 / 2 : 0, l.material.color.set(o ? 10793147 : 15923964), l.material.opacity = o ? .82 : 1;
13077
- } else s.visible = h && !i, c.visible = !h && !i, l.visible = !1, s.scale.setScalar(1), s.position.x = 0, s.position.y = p.y / 2 - .09 - u / 2, s.material.color.set(15923964), s.material.opacity = 1;
13200
+ let m = e.labelSize || new U().fromArray(e.s);
13201
+ e.label.visible = n;
13202
+ let h = this._worldPosition(e), g = this.camera.position.z >= h.z, _ = this.camera.position.y > h.y + .25;
13203
+ if (cl(e.type)) {
13204
+ c.visible = g && (!o || s), l.visible = !g && (!o || s), u.visible = s && _;
13205
+ let e = s ? .52 : 1;
13206
+ c.scale.setScalar(e), c.position.x = s ? -m.x / 2 + .18 + f * e / 2 - p * e : 0;
13207
+ let n = .18;
13208
+ c.position.y = s ? m.y / 2 - n - d * e / 2 : m.y / 2 - .09 - d / 2, c.position.z = s ? m.z / 2 + .025 : m.z / 2 + .012, l.position.y = s ? m.y / 2 - n - d * e / 2 : m.y / 2 - .09 - d / 2, l.position.z = s ? -m.z / 2 - .025 : -m.z / 2 - .012, c.material.color.set(s ? 10793147 : 15923964), c.material.opacity = (s ? .82 : 1) * t, l.material.color.set(s ? 10793147 : 15923964), l.material.opacity = (s ? .82 : 1) * t, u.scale.setScalar(s ? .55 : 1), u.position.x = s ? -m.x / 2 + .12 + f * .55 / 2 - p * .55 : 0, u.position.z = s ? -m.z / 2 + .12 + d * .55 / 2 : 0, u.material.color.set(s ? 10793147 : 15923964), u.material.opacity = (s ? .82 : 1) * t;
13209
+ } else c.visible = g && !r, l.visible = !g && !r, u.visible = !1, c.scale.setScalar(1), c.position.x = 0, c.position.y = m.y / 2 - .09 - d / 2, c.material.color.set(15923964), c.material.opacity = t, l.material.opacity = t;
13078
13210
  }
13079
13211
  for (let t of this.relationGroup.children) {
13080
13212
  if (!t.userData.start) continue;
@@ -13087,7 +13219,7 @@ var Dl = class extends HTMLElement {
13087
13219
  let t = this.canvas.getBoundingClientRect();
13088
13220
  this.pointer.set((e.clientX - t.left) / t.width * 2 - 1, -(e.clientY - t.top) / t.height * 2 + 1), this.raycaster.setFromCamera(this.pointer, this.camera);
13089
13221
  let n = [];
13090
- for (let e of this.nodes.values()) e.group.visible && (sl(e.type) && this.open.has(e.id) || n.push(e.pickMesh || e.mesh), e.label?.visible && n.push(...e.label.children.filter((e) => e.visible)));
13222
+ for (let e of this.nodes.values()) e.group.visible && (cl(e.type) && this.open.has(e.id) || n.push(e.pickMesh || e.mesh), e.label?.visible && n.push(...e.label.children.filter((e) => e.visible)));
13091
13223
  let r = this.raycaster.intersectObjects(n, !0)[0] || null, i = this.relationMode === "none" ? [] : this.relationGroup.children.filter((e) => e.userData?.relationPick), a = this.raycaster.intersectObjects(i, !1)[0] || null;
13092
13224
  if (r && (!a || r.distance <= a.distance + .12)) {
13093
13225
  let e = r.object;
@@ -13108,9 +13240,21 @@ var Dl = class extends HTMLElement {
13108
13240
  } : null;
13109
13241
  }
13110
13242
  _bindControls() {
13111
- this.shadowRoot.addEventListener("click", (e) => {
13112
- let t = e.target.closest?.("[data-action]")?.dataset.action;
13113
- t === "minus" && this.zoomOut(), t === "plus" && this.zoomIn(), t === "fit" && this.fit(), t === "front" && this.frontView(), t === "labels" && this.toggleShellLabels(), t === "relations-all" && this.setRelationMode("all"), t === "relations-selected" && this.setRelationMode("selected"), t === "relations-none" && this.setRelationMode("none"), t && this.invalidate();
13243
+ this.toolbar?.querySelectorAll(".toolbar-menu").forEach((e) => e.addEventListener("toggle", () => {
13244
+ e.open && this._closeToolbarMenus(e);
13245
+ })), this.toolbar?.addEventListener("focusout", () => queueMicrotask(() => {
13246
+ this.toolbar?.matches(":focus-within") || this._closeToolbarMenus();
13247
+ })), this.shadowRoot.addEventListener("keydown", (e) => {
13248
+ e.key === "Escape" && (this._closeToolbarMenus(), this.canvas.focus({ preventScroll: !0 }));
13249
+ }), this.shadowRoot.addEventListener("click", (e) => {
13250
+ let t = e.target.closest?.("[data-action]"), n = t?.dataset.action;
13251
+ e.target.closest?.(".toolbar-menu") || this._closeToolbarMenus(), n === "minus" && this.zoomOut(), n === "plus" && this.zoomIn(), n === "fit" && this.fit(), n === "front" && this.frontView(), n === "labels" && this.toggleShellLabels(), n === "panel" && this.setPanelVisible(!this.panelVisible), n === "open-all" && this.openAllContainers(), n === "close-all" && this.closeAllContainers(), n === "relations-all" && this.setRelationMode("all"), n === "relations-selected" && this.setRelationMode("selected"), n === "relations-none" && this.setRelationMode("none"), n === "focus-all" && this.setFocusFilter({ mode: "all" }, { source: "toolbar" }), n === "focus-dim" && this.setFocusFilter({
13252
+ mode: "connected",
13253
+ effect: "dim"
13254
+ }, { source: "toolbar" }), n === "focus-hide" && this.setFocusFilter({
13255
+ mode: "connected",
13256
+ effect: "hide"
13257
+ }, { source: "toolbar" }), n === "focus-layout" && this.setFocusFilter({ layout: this.focusFilter.layout === "reflow" ? "preserve" : "reflow" }, { source: "toolbar" }), t?.closest?.(".toolbar-popover") && this._closeToolbarMenus(), n && this.invalidate();
13114
13258
  }), this.canvas.addEventListener("contextmenu", (e) => e.preventDefault()), this.canvas.addEventListener("pointerdown", (e) => {
13115
13259
  if (e.pointerType !== "touch" && ![
13116
13260
  0,
@@ -13214,11 +13358,11 @@ var Dl = class extends HTMLElement {
13214
13358
  }
13215
13359
  _showError(e) {
13216
13360
  let t = this.shadowRoot.querySelector(".viewport"), n = t.querySelector(".error");
13217
- n ? n.textContent = e : t.insertAdjacentHTML("beforeend", "<div class=\"error\" role=\"alert\">" + pl(e) + "</div>");
13361
+ n ? n.textContent = e : t.insertAdjacentHTML("beforeend", "<div class=\"error\" role=\"alert\">" + xl(e) + "</div>");
13218
13362
  }
13219
13363
  };
13220
- customElements.get("liquidcars-atlas") || customElements.define("liquidcars-atlas", Dl);
13364
+ customElements.get("liquidcars-atlas") || customElements.define("liquidcars-atlas", Il);
13221
13365
  //#endregion
13222
- export { Dl as LiquidCarsAtlas, al as getGeometryCatalog, ml as normalizeModel, rl as registerGeometryPack, il as unregisterGeometryPack };
13366
+ export { Il as LiquidCarsAtlas, ol as getGeometryCatalog, Cl as normalizeModel, il as registerGeometryPack, al as unregisterGeometryPack };
13223
13367
 
13224
13368
  //# sourceMappingURL=liquidcars-atlas.js.map