@maptoolkit/maplibre-scene3d-control 0.5.0 → 0.5.2

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.
@@ -16286,7 +16286,7 @@ function fh(e) {
16286
16286
  }
16287
16287
  //#endregion
16288
16288
  //#region src/Fill3DManager.ts
16289
- var ph = .05, mh = 3e3, hh = .4, gh = .6, _h = .5, vh = 500, yh = `
16289
+ var ph = .05, mh = 3e3, hh = 250, gh = .4, _h = .6, vh = .5, yh = 500, bh = `
16290
16290
  attribute vec4 color;
16291
16291
  // Fake AO: the height above ground (dm); the face's entry in the AO tables and
16292
16292
  // the position in its plane (units of AO_UV_UNIT_M), see innerEdges().
@@ -16333,7 +16333,7 @@ var ph = .05, mh = 3e3, hh = .4, gh = .6, _h = .5, vh = 500, yh = `
16333
16333
  v_color = vec4(lit, color.a * u_opacity);
16334
16334
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
16335
16335
  }
16336
- `, bh = `
16336
+ `, xh = `
16337
16337
  precision mediump float;
16338
16338
 
16339
16339
  uniform float u_ao_intensity;
@@ -16408,11 +16408,11 @@ var ph = .05, mh = 3e3, hh = .4, gh = .6, _h = .5, vh = 500, yh = `
16408
16408
  float corner = innerEdges();
16409
16409
  // The stronger term wins: an inner corner at the wall foot is no darker
16410
16410
  // than either alone (no doubling where edges meet).
16411
- color.rgb *= 1.0 - ao * max(${gh.toFixed(2)} * ground, ${_h.toFixed(2)} * corner);
16411
+ color.rgb *= 1.0 - ao * max(${_h.toFixed(2)} * ground, ${vh.toFixed(2)} * corner);
16412
16412
  }
16413
16413
  gl_FragColor = color;
16414
16414
  }
16415
- `, xh = "\n attribute vec2 coord; // in skirt radii: beyond a free end of the strip, out from the wall foot\n varying vec2 v_coord;\n void main() {\n v_coord = coord;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n", Sh = `
16415
+ `, Sh = "\n attribute vec2 coord; // in skirt radii: beyond a free end of the strip, out from the wall foot\n varying vec2 v_coord;\n void main() {\n v_coord = coord;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n", Ch = `
16416
16416
  precision mediump float;
16417
16417
  uniform float u_ao_intensity;
16418
16418
  uniform float u_ao_tile; // 0..1: this tile's AO fading in
@@ -16421,36 +16421,36 @@ var ph = .05, mh = 3e3, hh = .4, gh = .6, _h = .5, vh = 500, yh = `
16421
16421
  varying vec2 v_coord;
16422
16422
  void main() {
16423
16423
  float t = clamp(length(v_coord), 0.0, 1.0); // distance from the foot, in radii
16424
- float shade = 1.0 - u_ao_intensity * u_ao_tile * ${gh.toFixed(2)} * u_opacity * (1.0 - t) * (1.0 - t);
16424
+ float shade = 1.0 - u_ao_intensity * u_ao_tile * ${_h.toFixed(2)} * u_opacity * (1.0 - t) * (1.0 - t);
16425
16425
  gl_FragColor = u_mode == 0 ? vec4(vec3(shade), 1.0) : u_mode == 1 ? vec4(0.0, 0.0, 0.0, shade) : vec4(0.0, 0.0, 0.0, 1.0);
16426
16426
  }
16427
16427
  `;
16428
- function Ch(e, t) {
16428
+ function wh(e, t) {
16429
16429
  e.uniforms.u_mode.value = t === "multiply" ? 0 : t === "collect" ? 1 : 2, e.blendEquation = 100, t === "multiply" ? (e.blendSrc = 200, e.blendDst = 202, e.blendEquationAlpha = 100, e.blendSrcAlpha = 200, e.blendDstAlpha = 201) : t === "collect" ? (e.blendSrc = 200, e.blendDst = 201, e.blendEquationAlpha = 103, e.blendSrcAlpha = 201, e.blendDstAlpha = 201) : (e.blendSrc = 200, e.blendDst = 206, e.blendEquationAlpha = 100, e.blendSrcAlpha = 201, e.blendDstAlpha = 200);
16430
16430
  }
16431
- var wh = new K(), Th = new K();
16432
- function Eh(e, t) {
16431
+ var Th = new K(), Eh = new K();
16432
+ function Dh(e, t) {
16433
16433
  let n = e instanceof Uint16Array, r = new gi(e, 512, e.length / t / 512, t === 4 ? ne : ee, n ? h : _);
16434
16434
  return r.internalFormat = t === 4 ? "RGBA32UI" : n ? "R16UI" : "R32UI", r.minFilter = o, r.magFilter = o, r.generateMipmaps = !1, r.needsUpdate = !0, r;
16435
16435
  }
16436
- function Dh(e) {
16436
+ function Oh(e) {
16437
16437
  return {
16438
- faces: Eh(e.faces, 4),
16439
- cells: Eh(e.cells, 1),
16440
- lists: Eh(e.lists, 1),
16441
- edges: Eh(e.edges, 4)
16438
+ faces: Dh(e.faces, 4),
16439
+ cells: Dh(e.cells, 1),
16440
+ lists: Dh(e.lists, 1),
16441
+ edges: Dh(e.edges, 4)
16442
16442
  };
16443
16443
  }
16444
- function Oh() {
16444
+ function kh() {
16445
16445
  let e = (e) => 512 * e;
16446
- return Dh({
16446
+ return Oh({
16447
16447
  faces: new Uint32Array(e(4)),
16448
16448
  cells: new Uint32Array(e(1)),
16449
16449
  lists: new Uint16Array(e(1)),
16450
16450
  edges: new Uint32Array(e(4))
16451
16451
  });
16452
16452
  }
16453
- function kh(e, t) {
16453
+ function Ah(e, t) {
16454
16454
  return new va({
16455
16455
  uniforms: {
16456
16456
  u_lightpos: { value: new H(.288, .996, .498) },
@@ -16465,15 +16465,15 @@ function kh(e, t) {
16465
16465
  u_ao_lists: { value: t.lists },
16466
16466
  u_ao_edges: { value: t.edges }
16467
16467
  },
16468
- vertexShader: yh,
16469
- fragmentShader: bh,
16468
+ vertexShader: bh,
16469
+ fragmentShader: xh,
16470
16470
  side: 1,
16471
16471
  transparent: e,
16472
16472
  depthFunc: 3,
16473
16473
  depthWrite: !e
16474
16474
  });
16475
16475
  }
16476
- function Ah() {
16476
+ function jh() {
16477
16477
  return new va({
16478
16478
  vertexShader: "void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }",
16479
16479
  fragmentShader: "void main() {}",
@@ -16481,7 +16481,7 @@ function Ah() {
16481
16481
  colorWrite: !1
16482
16482
  });
16483
16483
  }
16484
- function jh() {
16484
+ function Mh() {
16485
16485
  return new va({
16486
16486
  uniforms: {
16487
16487
  u_ao_intensity: { value: 0 },
@@ -16489,8 +16489,8 @@ function jh() {
16489
16489
  u_opacity: { value: 1 },
16490
16490
  u_mode: { value: 0 }
16491
16491
  },
16492
- vertexShader: xh,
16493
- fragmentShader: Sh,
16492
+ vertexShader: Sh,
16493
+ fragmentShader: Ch,
16494
16494
  side: 2,
16495
16495
  transparent: !0,
16496
16496
  depthWrite: !1,
@@ -16500,7 +16500,7 @@ function jh() {
16500
16500
  polygonOffsetUnits: -8
16501
16501
  });
16502
16502
  }
16503
- var Mh = class {
16503
+ var Nh = class {
16504
16504
  origin;
16505
16505
  map;
16506
16506
  scene;
@@ -16513,11 +16513,14 @@ var Mh = class {
16513
16513
  seq = 0;
16514
16514
  tiles = new globalThis.Map();
16515
16515
  material;
16516
+ blends;
16516
16517
  depthMaterial;
16517
16518
  aoEmpty;
16518
16519
  config;
16519
16520
  onData;
16520
16521
  onMoveEnd;
16522
+ onMove;
16523
+ lastUpdate = -Infinity;
16521
16524
  onTerrain;
16522
16525
  onSourceData;
16523
16526
  unwatchGlobalState;
@@ -16528,7 +16531,7 @@ var Mh = class {
16528
16531
  minzoom;
16529
16532
  maxzoom;
16530
16533
  constructor(e, t, n, r, i, a) {
16531
- this.map = e, this.scene = t, this.elevation = r, this.terrainSourceId = i, this.config = a, this.origin = Fh(n), this.group = new On(), t.add(this.group), this.skirtGroup = new On(), t.add(this.skirtGroup), this.aoEmpty = Oh(), this.material = kh(a.transparent, this.aoEmpty), this.depthMaterial = Ah(), this.material.uniforms.u_ao_radius.value = a.ao.radius, this.skirtMaterial = jh(), this.onData = (e) => {
16534
+ this.map = e, this.scene = t, this.elevation = r, this.terrainSourceId = i, this.config = a, this.origin = Ih(n), this.group = new On(), t.add(this.group), this.skirtGroup = new On(), t.add(this.skirtGroup), this.aoEmpty = kh(), this.material = Ah(a.transparent, this.aoEmpty), this.blends = a.transparent, this.depthMaterial = jh(), this.material.uniforms.u_ao_radius.value = a.ao.radius, this.skirtMaterial = Mh(), this.onData = (e) => {
16532
16535
  let t = e;
16533
16536
  if (t.sourceId === this.terrainSourceId && t.tile) {
16534
16537
  let e = t.tile.tileID?.canonical;
@@ -16537,9 +16540,11 @@ var Mh = class {
16537
16540
  }
16538
16541
  }, this.onMoveEnd = () => {
16539
16542
  this.maybeRebase(), this.update();
16543
+ }, this.onMove = () => {
16544
+ performance.now() - this.lastUpdate < hh || (this.maybeRebase(), this.update());
16540
16545
  }, this.onTerrain = () => {
16541
16546
  this.elevation.clear(), this.rebakeAll();
16542
- }, e.on("data", this.onData), e.on("moveend", this.onMoveEnd), e.on("terrain", this.onTerrain);
16547
+ }, e.on("data", this.onData), e.on("moveend", this.onMoveEnd), e.on("move", this.onMove), e.on("terrain", this.onTerrain);
16543
16548
  let { color: o, opacity: s } = a, c = [...o.globalStateRefs, ...s.featureConstant ? [] : s.globalStateRefs];
16544
16549
  this.unwatchGlobalState = lh(e, [...c, ...s.globalStateRefs], () => {
16545
16550
  c.length ? this.scheduleRecolor() : e.triggerRepaint();
@@ -16566,6 +16571,7 @@ var Mh = class {
16566
16571
  }
16567
16572
  update() {
16568
16573
  if (this.tileTemplate == null || this.minzoom == null || this.maxzoom == null) return;
16574
+ this.lastUpdate = performance.now();
16569
16575
  let e = /* @__PURE__ */ new Set();
16570
16576
  for (let t of this.map.coveringTiles({
16571
16577
  tileSize: 512,
@@ -16677,9 +16683,11 @@ var Mh = class {
16677
16683
  let r = e.position.length / 3, i = new Float32Array(r);
16678
16684
  for (let t = 0; t < r; t++) i[t] = e.position[t * 3 + 1];
16679
16685
  let a = new Ar();
16680
- a.setAttribute("position", new hr(e.position, 3)), a.setAttribute("normal", new hr(e.normal, 3, !0)), a.setAttribute("color", this.colorAttribute(r, e.features)), e.aoh.length && (a.setAttribute("aoh", new hr(e.aoh, 1)), a.setAttribute("aoface", new hr(e.aoFace, 1)), a.setAttribute("aouv", new hr(e.aoUV, 2))), e.aoTables && (n.ao = Dh(e.aoTables)), e.aoh.length ? n.aoFade = 1 : this.aoEnabled && e.seq !== void 0 && t.ao.add(e.seq), a.setIndex(new hr(e.index, 1));
16681
- let o = new ni(a, this.material);
16682
- o.frustumCulled = !0, o.onBeforeRender = () => this.bindAo(n), this.group.add(o), e.skirt && this.addSkirt(n, e.skirt), n.state = "ready", n.tileScale = e.tileScale, n.mesh = o, n.geometry = a, n.baseY = i, n.column = e.column, n.columnXZ = e.columnXZ, n.features = e.features, n.anchors = e.anchors, this.placeMesh(n), this.bake(n), this.map.triggerRepaint();
16686
+ a.setAttribute("position", new hr(e.position, 3)), a.setAttribute("normal", new hr(e.normal, 3, !0));
16687
+ let o = this.colorAttribute(r, e.features);
16688
+ a.setAttribute("color", o.color), n.translucent = o.translucent, e.aoh.length && (a.setAttribute("aoh", new hr(e.aoh, 1)), a.setAttribute("aoface", new hr(e.aoFace, 1)), a.setAttribute("aouv", new hr(e.aoUV, 2))), e.aoTables && (n.ao = Oh(e.aoTables)), e.aoh.length ? n.aoFade = 1 : this.aoEnabled && e.seq !== void 0 && t.ao.add(e.seq), a.setIndex(new hr(e.index, 1));
16689
+ let s = new ni(a, this.material);
16690
+ s.frustumCulled = !0, s.onBeforeRender = () => this.bindAo(n), this.group.add(s), e.skirt && this.addSkirt(n, e.skirt), n.state = "ready", n.tileScale = e.tileScale, n.mesh = s, n.geometry = a, n.baseY = i, n.column = e.column, n.columnXZ = e.columnXZ, n.features = e.features, n.anchors = e.anchors, this.placeMesh(n), this.bake(n), this.map.triggerRepaint();
16683
16691
  }
16684
16692
  onAoParsed(e) {
16685
16693
  let t = this.tiles.get(e.key);
@@ -16689,35 +16697,52 @@ var Mh = class {
16689
16697
  t.aoFade === void 0 && console.warn(`Fill3DLayer: AO data of tile ${e.key} does not fit its geometry — ignored`);
16690
16698
  return;
16691
16699
  }
16692
- t.geometry.setAttribute("aoh", new hr(new Int16Array(n), 1)), t.geometry.setAttribute("aoface", new hr(e.aoFace, 1)), t.geometry.setAttribute("aouv", new hr(e.aoUV, 2)), e.aoTables && (t.ao = Dh(e.aoTables)), t.columnXZ = e.columnXZ, t.groundCache = void 0, e.skirt && this.addSkirt(t, e.skirt), t.aoSince = performance.now(), t.aoFade = 0, this.placeMesh(t), this.bake(t), this.map.triggerRepaint();
16700
+ t.geometry.setAttribute("aoh", new hr(new Int16Array(n), 1)), t.geometry.setAttribute("aoface", new hr(e.aoFace, 1)), t.geometry.setAttribute("aouv", new hr(e.aoUV, 2)), e.aoTables && (t.ao = Oh(e.aoTables)), t.columnXZ = e.columnXZ, t.groundCache = void 0, e.skirt && this.addSkirt(t, e.skirt), t.aoSince = performance.now(), t.aoFade = 0, this.placeMesh(t), this.bake(t), this.map.triggerRepaint();
16693
16701
  }
16694
16702
  colorAttribute(e, t) {
16695
- let n = this.map.getZoom(), r = ch(this.map), { color: i, opacity: a } = this.config, o = new Uint8Array(e * 4);
16703
+ let n = this.map.getZoom(), r = ch(this.map), { color: i, opacity: a } = this.config, o = new Uint8Array(e * 4), s = !1;
16696
16704
  for (let e of t) {
16697
- let [t, s, c, l] = i(n, e.properties, void 0, r), u = a.featureConstant ? l : l * a(n, e.properties, void 0, r), d = Math.round(t * 255), f = Math.round(s * 255), p = Math.round(c * 255), m = Math.round(u * 255), h = e.start + e.count;
16698
- for (let t = e.start; t < h; t++) o[t * 4] = d, o[t * 4 + 1] = f, o[t * 4 + 2] = p, o[t * 4 + 3] = m;
16705
+ let [t, c, l, u] = i(n, e.properties, void 0, r), d = a.featureConstant ? u : u * a(n, e.properties, void 0, r), f = Math.round(t * 255), p = Math.round(c * 255), m = Math.round(l * 255), h = Math.round(d * 255);
16706
+ h < 255 && (s = !0);
16707
+ let g = e.start + e.count;
16708
+ for (let t = e.start; t < g; t++) o[t * 4] = f, o[t * 4 + 1] = p, o[t * 4 + 2] = m, o[t * 4 + 3] = h;
16699
16709
  }
16700
- return new hr(o, 4, !0);
16710
+ return {
16711
+ color: new hr(o, 4, !0),
16712
+ translucent: s
16713
+ };
16701
16714
  }
16702
16715
  syncOpacity() {
16703
16716
  let { opacity: e } = this.config, t = e.featureConstant ? e(this.map.getZoom(), {}, void 0, ch(this.map)) : 1;
16704
- return this.material.uniforms.u_opacity.value = t, t;
16717
+ this.material.uniforms.u_opacity.value = t;
16718
+ let n = this.config.transparent && t < 1;
16719
+ if (this.config.transparent && !n) {
16720
+ for (let e of this.tiles.values()) if (e.translucent) {
16721
+ n = !0;
16722
+ break;
16723
+ }
16724
+ }
16725
+ return n !== this.blends && (this.blends = n, this.material.transparent = n, this.material.depthWrite = !n), t;
16705
16726
  }
16706
16727
  scheduleRecolor() {
16707
16728
  this.recolorRafId === void 0 && (this.recolorRafId = requestAnimationFrame(() => {
16708
16729
  this.recolorRafId = void 0;
16709
- for (let e of this.tiles.values()) e.state === "ready" && e.geometry && e.baseY && e.features && e.geometry.setAttribute("color", this.colorAttribute(e.baseY.length, e.features));
16730
+ for (let e of this.tiles.values()) {
16731
+ if (e.state !== "ready" || !e.geometry || !e.baseY || !e.features) continue;
16732
+ let t = this.colorAttribute(e.baseY.length, e.features);
16733
+ e.geometry.setAttribute("color", t.color), e.translucent = t.translucent;
16734
+ }
16710
16735
  this.map.triggerRepaint();
16711
16736
  }));
16712
16737
  }
16713
16738
  get depthPrepass() {
16714
- return this.config.transparent;
16739
+ return this.blends;
16715
16740
  }
16716
16741
  setPass(e) {
16717
16742
  let t = e === "skirtCollect" || e === "skirtApply";
16718
16743
  this.group.visible = !t, this.scene.overrideMaterial = e === "depth" ? this.depthMaterial : null;
16719
16744
  let n = this.material.uniforms.u_ao_intensity.value > 0;
16720
- t ? (this.skirtGroup.visible = n, Ch(this.skirtMaterial, e === "skirtCollect" ? "collect" : "apply")) : (this.skirtGroup.visible = e === "color" && n && !this.config.skirtMax, Ch(this.skirtMaterial, "multiply"));
16745
+ t ? (this.skirtGroup.visible = n, wh(this.skirtMaterial, e === "skirtCollect" ? "collect" : "apply")) : (this.skirtGroup.visible = e === "color" && n && !this.config.skirtMax, wh(this.skirtMaterial, "multiply"));
16721
16746
  }
16722
16747
  get skirtPasses() {
16723
16748
  return this.config.skirtMax && this.material.uniforms.u_ao_intensity.value > 0 && this.skirtGroup.children.length > 0;
@@ -16730,7 +16755,7 @@ var Mh = class {
16730
16755
  let e = Math.max(0, Math.min(1, this.config.ao.intensity(this.map.getZoom(), {}, void 0, ch(this.map))));
16731
16756
  this.material.uniforms.u_ao_intensity.value = e, this.skirtMaterial.uniforms.u_ao_intensity.value = e, this.skirtMaterial.uniforms.u_opacity.value = this.material.uniforms.u_opacity.value;
16732
16757
  let t = performance.now(), n = !1;
16733
- for (let e of this.tiles.values()) e.aoSince !== void 0 && (e.aoFade = Math.min(1, (t - e.aoSince) / vh), e.aoFade < 1 ? n = !0 : e.aoSince = void 0);
16758
+ for (let e of this.tiles.values()) e.aoSince !== void 0 && (e.aoFade = Math.min(1, (t - e.aoSince) / yh), e.aoFade < 1 ? n = !0 : e.aoSince = void 0);
16734
16759
  n && this.map.triggerRepaint();
16735
16760
  }
16736
16761
  syncLight() {
@@ -16744,7 +16769,7 @@ var Mh = class {
16744
16769
  [o, s] = [o * t - s * n, o * n + s * t];
16745
16770
  }
16746
16771
  let l = this.material.uniforms;
16747
- l.u_lightpos.value.set(o, c, -s), l.u_lightintensity.value = e.intensity ?? .5, wh.set(e.color ?? "#ffffff").getRGB(Th, He), l.u_lightcolor.value.set(Th.r, Th.g, Th.b);
16772
+ l.u_lightpos.value.set(o, c, -s), l.u_lightintensity.value = e.intensity ?? .5, Th.set(e.color ?? "#ffffff").getRGB(Eh, He), l.u_lightcolor.value.set(Eh.r, Eh.g, Eh.b);
16748
16773
  }
16749
16774
  placeMesh(e) {
16750
16775
  if (!e.mesh || e.tileScale === void 0) return;
@@ -16770,7 +16795,7 @@ var Mh = class {
16770
16795
  let m = (e) => {
16771
16796
  let n = p[e];
16772
16797
  return n !== n && (p[e] = n = l(t.tileMx + f[e * 2] * u, t.tileMy - f[e * 2 + 1] * u)), n;
16773
- }, h = this.aoEnabled ? this.config.ao.radius + 10 : -Infinity, g = s || !u || !t.anchors ? void 0 : Nh(t.anchors, m), _ = s && o && t.features.some((e) => e.rigid) ? Ph(t.features, d, i, f.length / 2) : void 0;
16798
+ }, h = this.aoEnabled ? this.config.ao.radius + 10 : -Infinity, g = s || !u || !t.anchors ? void 0 : Ph(t.anchors, m), _ = s && o && t.features.some((e) => e.rigid) ? Fh(t.features, d, i, f.length / 2) : void 0;
16774
16799
  for (let n of t.features) {
16775
16800
  let t = n.start + n.count;
16776
16801
  if (n.rigid) {
@@ -16796,7 +16821,7 @@ var Mh = class {
16796
16821
  }
16797
16822
  if (n.needsUpdate = !0, a && (a.needsUpdate = !0), t.geometry.computeBoundingSphere(), t.skirtGeometry && u) {
16798
16823
  let e = t.skirtGeometry.getAttribute("position"), n = e.array, r = t.skirtColumn;
16799
- for (let e = 0; e < r.length; e++) n[e * 3 + 1] = (s ? 0 : m(r[e])) + hh;
16824
+ for (let e = 0; e < r.length; e++) n[e * 3 + 1] = (s ? 0 : m(r[e])) + gh;
16800
16825
  e.needsUpdate = !0, t.skirtGeometry.computeBoundingSphere();
16801
16826
  }
16802
16827
  }
@@ -16815,11 +16840,11 @@ var Mh = class {
16815
16840
  let e = this.pendingDemRegions;
16816
16841
  if (this.pendingDemRegions = [], e.length === 0) return;
16817
16842
  let t = 0;
16818
- for (let n of this.tiles.values()) n.state === "ready" && e.some((e) => Ih(e, n.bounds)) && (this.bake(n), t++);
16843
+ for (let n of this.tiles.values()) n.state === "ready" && e.some((e) => Lh(e, n.bounds)) && (this.bake(n), t++);
16819
16844
  t && this.map.triggerRepaint();
16820
16845
  }
16821
16846
  dispose() {
16822
- this.map.off("data", this.onData), this.map.off("moveend", this.onMoveEnd), this.map.off("terrain", this.onTerrain), this.onSourceData && this.map.off("sourcedata", this.onSourceData), this.rebakeRafId !== void 0 && cancelAnimationFrame(this.rebakeRafId), this.recolorRafId !== void 0 && cancelAnimationFrame(this.recolorRafId), this.unwatchGlobalState();
16847
+ this.map.off("data", this.onData), this.map.off("moveend", this.onMoveEnd), this.map.off("move", this.onMove), this.map.off("terrain", this.onTerrain), this.onSourceData && this.map.off("sourcedata", this.onSourceData), this.rebakeRafId !== void 0 && cancelAnimationFrame(this.rebakeRafId), this.recolorRafId !== void 0 && cancelAnimationFrame(this.recolorRafId), this.unwatchGlobalState();
16823
16848
  for (let e of this.pool) e.worker.terminate();
16824
16849
  for (let e of this.tiles.values()) this.freeTile(e);
16825
16850
  this.tiles.clear(), this.scene.remove(this.group), this.scene.remove(this.skirtGroup), this.material.dispose(), this.depthMaterial.dispose();
@@ -16827,7 +16852,7 @@ var Mh = class {
16827
16852
  this.skirtMaterial.dispose();
16828
16853
  }
16829
16854
  };
16830
- function Nh(e, t) {
16855
+ function Ph(e, t) {
16831
16856
  let n = e.start.length - 1, r = new Float32Array(n), i = new Float32Array(e.column.length);
16832
16857
  for (let n = 0; n < i.length; n++) i[n] = t(e.column[n]) - e.height[n];
16833
16858
  let a = [];
@@ -16845,7 +16870,7 @@ function Nh(e, t) {
16845
16870
  }
16846
16871
  return r;
16847
16872
  }
16848
- function Ph(e, t, n, r) {
16873
+ function Fh(e, t, n, r) {
16849
16874
  let i = new Float32Array(r);
16850
16875
  for (let r of e) if (r.rigid) for (let e = r.start, a = r.start + r.count; e < a; e++) {
16851
16876
  let r = t[e];
@@ -16853,7 +16878,7 @@ function Ph(e, t, n, r) {
16853
16878
  }
16854
16879
  return i;
16855
16880
  }
16856
- function Fh(e) {
16881
+ function Ih(e) {
16857
16882
  let n = t.fromLngLat(e, 0);
16858
16883
  return {
16859
16884
  x: n.x,
@@ -16862,25 +16887,25 @@ function Fh(e) {
16862
16887
  s: n.meterInMercatorCoordinateUnits()
16863
16888
  };
16864
16889
  }
16865
- function Ih(e, t) {
16890
+ function Lh(e, t) {
16866
16891
  return e.west <= t.east && e.east >= t.west && e.south <= t.north && e.north >= t.south;
16867
16892
  }
16868
16893
  //#endregion
16869
16894
  //#region src/paint.ts
16870
- function Lh(e, t) {
16895
+ function Rh(e, t) {
16871
16896
  return nh(e, "fill-3d-color", t, 3);
16872
16897
  }
16873
- function Rh(e, t) {
16898
+ function zh(e, t) {
16874
16899
  return rh(e, "fill-3d-opacity", t, 3);
16875
16900
  }
16876
16901
  //#endregion
16877
16902
  //#region src/Fill3DLayer.ts
16878
- var zh = [
16903
+ var Bh = [
16879
16904
  1,
16880
16905
  1,
16881
16906
  1,
16882
16907
  1
16883
- ], Bh = class {
16908
+ ], Vh = class {
16884
16909
  id;
16885
16910
  type = "custom";
16886
16911
  renderingMode = "3d";
@@ -16911,7 +16936,7 @@ var zh = [
16911
16936
  let t = typeof navigator < "u" && navigator.hardwareConcurrency ? navigator.hardwareConcurrency : 4;
16912
16937
  this.workers = Math.max(1, Math.min(8, Math.floor(e.workers ?? Math.min(4, t / 2)))), this.sourceId = e.source, this.sourceLayer = e["source-layer"], this.filter = e.filter, this.visible = e.layout?.visibility !== "none";
16913
16938
  let n = e.paint ?? {};
16914
- this.colorEval = Lh(n["fill-3d-color"], zh), this.opacityEval = Rh(n["fill-3d-opacity"], 1), this.transparent = "fill-3d-opacity" in n;
16939
+ this.colorEval = Rh(n["fill-3d-color"], Bh), this.opacityEval = zh(n["fill-3d-opacity"], 1), this.transparent = "fill-3d-opacity" in n;
16915
16940
  let r = rh(n["fill-3d-ambient-occlusion-intensity"], "fill-3d-ambient-occlusion-intensity", 0);
16916
16941
  r.featureConstant || console.warn("Fill3DLayer: fill-3d-ambient-occlusion-intensity must not depend on feature data — ignored"), this.ao = {
16917
16942
  intensity: r.featureConstant ? r : rh(0, "fill-3d-ambient-occlusion-intensity", 0),
@@ -16932,7 +16957,7 @@ var zh = [
16932
16957
  canvas: t.getCanvas(),
16933
16958
  context: n,
16934
16959
  antialias: !0
16935
- }), this.renderer.autoClear = !1, this.elevation = new uu(t, r), this.manager = new Mh(t, this.scene, e.convert(t.getCenter()), this.elevation, r, {
16960
+ }), this.renderer.autoClear = !1, this.elevation = new uu(t, r), this.manager = new Nh(t, this.scene, e.convert(t.getCenter()), this.elevation, r, {
16936
16961
  color: this.colorEval,
16937
16962
  opacity: this.opacityEval,
16938
16963
  transparent: this.transparent,
@@ -16953,7 +16978,7 @@ var zh = [
16953
16978
  onRemove() {
16954
16979
  this.manager?.dispose(), this.elevation?.dispose(), this.renderer?.dispose();
16955
16980
  }
16956
- }, Vh = class extends In {
16981
+ }, Hh = class extends In {
16957
16982
  constructor() {
16958
16983
  super(), this.name = "RoomEnvironment", this.position.y = -3.5;
16959
16984
  let e = new ca();
@@ -16964,17 +16989,17 @@ var zh = [
16964
16989
  i.position.set(-.757, 13.219, .717), i.scale.set(31.713, 28.305, 28.591), this.add(i);
16965
16990
  let a = new Oi(e, n, 6), o = new Dn();
16966
16991
  o.position.set(-10.906, 2.009, 1.846), o.rotation.set(0, -.195, 0), o.scale.set(2.328, 7.905, 4.651), o.updateMatrix(), a.setMatrixAt(0, o.matrix), o.position.set(-5.607, -.754, -.758), o.rotation.set(0, .994, 0), o.scale.set(1.97, 1.534, 3.955), o.updateMatrix(), a.setMatrixAt(1, o.matrix), o.position.set(6.167, .857, 7.803), o.rotation.set(0, .561, 0), o.scale.set(3.927, 6.285, 3.687), o.updateMatrix(), a.setMatrixAt(2, o.matrix), o.position.set(-2.017, .018, 6.124), o.rotation.set(0, .333, 0), o.scale.set(2.002, 4.566, 2.064), o.updateMatrix(), a.setMatrixAt(3, o.matrix), o.position.set(2.291, -.756, -2.621), o.rotation.set(0, -.286, 0), o.scale.set(1.546, 1.552, 1.496), o.updateMatrix(), a.setMatrixAt(4, o.matrix), o.position.set(-2.193, -.369, -5.547), o.rotation.set(0, .516, 0), o.scale.set(3.875, 3.487, 2.986), o.updateMatrix(), a.setMatrixAt(5, o.matrix), this.add(a);
16967
- let s = new ni(e, Hh(50));
16992
+ let s = new ni(e, Uh(50));
16968
16993
  s.position.set(-16.116, 14.37, 8.208), s.scale.set(.1, 2.428, 2.739), this.add(s);
16969
- let c = new ni(e, Hh(50));
16994
+ let c = new ni(e, Uh(50));
16970
16995
  c.position.set(-16.109, 18.021, -8.207), c.scale.set(.1, 2.425, 2.751), this.add(c);
16971
- let l = new ni(e, Hh(17));
16996
+ let l = new ni(e, Uh(17));
16972
16997
  l.position.set(14.904, 12.198, -1.832), l.scale.set(.15, 4.265, 6.331), this.add(l);
16973
- let u = new ni(e, Hh(43));
16998
+ let u = new ni(e, Uh(43));
16974
16999
  u.position.set(-.462, 8.89, 14.52), u.scale.set(4.38, 5.441, .088), this.add(u);
16975
- let d = new ni(e, Hh(20));
17000
+ let d = new ni(e, Uh(20));
16976
17001
  d.position.set(3.235, 11.486, -12.541), d.scale.set(2.5, 2, .1), this.add(d);
16977
- let f = new ni(e, Hh(100));
17002
+ let f = new ni(e, Uh(100));
16978
17003
  f.position.set(0, 20, 0), f.scale.set(1, .1, 1), this.add(f);
16979
17004
  }
16980
17005
  dispose() {
@@ -16985,7 +17010,7 @@ var zh = [
16985
17010
  for (let t of e) t.dispose();
16986
17011
  }
16987
17012
  };
16988
- function Hh(e) {
17013
+ function Uh(e) {
16989
17014
  return new Sa({
16990
17015
  color: 0,
16991
17016
  emissive: 16777215,
@@ -16994,7 +17019,7 @@ function Hh(e) {
16994
17019
  }
16995
17020
  //#endregion
16996
17021
  //#region node_modules/three/examples/jsm/utils/BufferGeometryUtils.js
16997
- function Uh(e, t) {
17022
+ function Wh(e, t) {
16998
17023
  if (t === 0) return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), e;
16999
17024
  if (t === 2 || t === 1) {
17000
17025
  let n = e.getIndex();
@@ -17016,9 +17041,9 @@ function Uh(e, t) {
17016
17041
  }
17017
17042
  //#endregion
17018
17043
  //#region node_modules/three/examples/jsm/utils/SkeletonUtils.js
17019
- function Wh(e) {
17044
+ function Gh(e) {
17020
17045
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = e.clone();
17021
- return Gh(e, r, function(e, r) {
17046
+ return Kh(e, r, function(e, r) {
17022
17047
  t.set(r, e), n.set(e, r);
17023
17048
  }), r.traverse(function(e) {
17024
17049
  if (!e.isSkinnedMesh) return;
@@ -17028,50 +17053,50 @@ function Wh(e) {
17028
17053
  }), r.bind(r.skeleton, r.bindMatrix);
17029
17054
  }), r;
17030
17055
  }
17031
- function Gh(e, t, n) {
17056
+ function Kh(e, t, n) {
17032
17057
  n(e, t);
17033
- for (let r = 0; r < e.children.length; r++) Gh(e.children[r], t.children[r], n);
17058
+ for (let r = 0; r < e.children.length; r++) Kh(e.children[r], t.children[r], n);
17034
17059
  }
17035
17060
  //#endregion
17036
17061
  //#region node_modules/three/examples/jsm/loaders/GLTFLoader.js
17037
- var Kh = class extends Ja {
17062
+ var qh = class extends Ja {
17038
17063
  constructor(e) {
17039
17064
  super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(e) {
17040
- return new Qh(e);
17041
- }), this.register(function(e) {
17042
17065
  return new $h(e);
17043
17066
  }), this.register(function(e) {
17044
- return new cg(e);
17067
+ return new eg(e);
17045
17068
  }), this.register(function(e) {
17046
17069
  return new lg(e);
17047
17070
  }), this.register(function(e) {
17048
17071
  return new ug(e);
17049
17072
  }), this.register(function(e) {
17050
- return new tg(e);
17073
+ return new dg(e);
17051
17074
  }), this.register(function(e) {
17052
17075
  return new ng(e);
17053
17076
  }), this.register(function(e) {
17054
17077
  return new rg(e);
17055
17078
  }), this.register(function(e) {
17056
17079
  return new ig(e);
17057
- }), this.register(function(e) {
17058
- return new Zh(e);
17059
17080
  }), this.register(function(e) {
17060
17081
  return new ag(e);
17061
17082
  }), this.register(function(e) {
17062
- return new eg(e);
17063
- }), this.register(function(e) {
17064
- return new sg(e);
17083
+ return new Qh(e);
17065
17084
  }), this.register(function(e) {
17066
17085
  return new og(e);
17067
17086
  }), this.register(function(e) {
17068
- return new Yh(e);
17087
+ return new tg(e);
17088
+ }), this.register(function(e) {
17089
+ return new cg(e);
17090
+ }), this.register(function(e) {
17091
+ return new sg(e);
17092
+ }), this.register(function(e) {
17093
+ return new Xh(e);
17069
17094
  }), this.register(function(e) {
17070
- return new dg(e, $.EXT_MESHOPT_COMPRESSION);
17095
+ return new fg(e, $.EXT_MESHOPT_COMPRESSION);
17071
17096
  }), this.register(function(e) {
17072
- return new dg(e, $.KHR_MESHOPT_COMPRESSION);
17097
+ return new fg(e, $.KHR_MESHOPT_COMPRESSION);
17073
17098
  }), this.register(function(e) {
17074
- return new fg(e);
17099
+ return new pg(e);
17075
17100
  });
17076
17101
  }
17077
17102
  load(e, t, n, r) {
@@ -17114,9 +17139,9 @@ var Kh = class extends Ja {
17114
17139
  let i, a = {}, o = {}, s = new TextDecoder();
17115
17140
  if (typeof e == "string") i = JSON.parse(e);
17116
17141
  else if (e instanceof ArrayBuffer) {
17117
- if (s.decode(new Uint8Array(e, 0, 4)) === pg) {
17142
+ if (s.decode(new Uint8Array(e, 0, 4)) === mg) {
17118
17143
  try {
17119
- a[$.KHR_BINARY_GLTF] = new gg(e);
17144
+ a[$.KHR_BINARY_GLTF] = new _g(e);
17120
17145
  } catch (e) {
17121
17146
  r && r(e);
17122
17147
  return;
@@ -17128,7 +17153,7 @@ var Kh = class extends Ja {
17128
17153
  r && r(/* @__PURE__ */ Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
17129
17154
  return;
17130
17155
  }
17131
- let c = new Hg(i, {
17156
+ let c = new Ug(i, {
17132
17157
  path: t || this.resourcePath || "",
17133
17158
  crossOrigin: this.crossOrigin,
17134
17159
  requestHeader: this.requestHeader,
@@ -17145,16 +17170,16 @@ var Kh = class extends Ja {
17145
17170
  let t = i.extensionsUsed[e], n = i.extensionsRequired || [];
17146
17171
  switch (t) {
17147
17172
  case $.KHR_MATERIALS_UNLIT:
17148
- a[t] = new Xh();
17173
+ a[t] = new Zh();
17149
17174
  break;
17150
17175
  case $.KHR_DRACO_MESH_COMPRESSION:
17151
- a[t] = new _g(i, this.dracoLoader);
17176
+ a[t] = new vg(i, this.dracoLoader);
17152
17177
  break;
17153
17178
  case $.KHR_TEXTURE_TRANSFORM:
17154
- a[t] = new vg();
17179
+ a[t] = new yg();
17155
17180
  break;
17156
17181
  case $.KHR_MESH_QUANTIZATION:
17157
- a[t] = new yg();
17182
+ a[t] = new bg();
17158
17183
  break;
17159
17184
  default: n.indexOf(t) >= 0 && o[t] === void 0 && console.warn("THREE.GLTFLoader: Unknown extension \"" + t + "\".");
17160
17185
  }
@@ -17168,7 +17193,7 @@ var Kh = class extends Ja {
17168
17193
  });
17169
17194
  }
17170
17195
  };
17171
- function qh() {
17196
+ function Jh() {
17172
17197
  let e = {};
17173
17198
  return {
17174
17199
  get: function(t) {
@@ -17185,7 +17210,7 @@ function qh() {
17185
17210
  }
17186
17211
  };
17187
17212
  }
17188
- function Jh(e, t, n) {
17213
+ function Yh(e, t, n) {
17189
17214
  let r = e.json.materials[t];
17190
17215
  return r.extensions && r.extensions[n] ? r.extensions[n] : null;
17191
17216
  }
@@ -17213,7 +17238,7 @@ var $ = {
17213
17238
  EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
17214
17239
  KHR_MESHOPT_COMPRESSION: "KHR_meshopt_compression",
17215
17240
  EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
17216
- }, Yh = class {
17241
+ }, Xh = class {
17217
17242
  constructor(e) {
17218
17243
  this.parser = e, this.name = $.KHR_LIGHTS_PUNCTUAL, this.cache = {
17219
17244
  refs: {},
@@ -17245,7 +17270,7 @@ var $ = {
17245
17270
  break;
17246
17271
  default: throw Error("THREE.GLTFLoader: Unexpected light type: " + a.type);
17247
17272
  }
17248
- return o.position.set(0, 0, 0), Pg(o, a), a.intensity !== void 0 && (o.intensity = a.intensity), o.name = t.createUniqueName(a.name || "light_" + e), r = Promise.resolve(o), t.cache.add(n, r), r;
17273
+ return o.position.set(0, 0, 0), Fg(o, a), a.intensity !== void 0 && (o.intensity = a.intensity), o.name = t.createUniqueName(a.name || "light_" + e), r = Promise.resolve(o), t.cache.add(n, r), r;
17249
17274
  }
17250
17275
  getDependency(e, t) {
17251
17276
  if (e === "light") return this._loadLight(t);
@@ -17256,7 +17281,7 @@ var $ = {
17256
17281
  return n._getNodeRef(t.cache, i, e);
17257
17282
  });
17258
17283
  }
17259
- }, Xh = class {
17284
+ }, Zh = class {
17260
17285
  constructor() {
17261
17286
  this.name = $.KHR_MATERIALS_UNLIT;
17262
17287
  }
@@ -17276,23 +17301,23 @@ var $ = {
17276
17301
  }
17277
17302
  return Promise.all(r);
17278
17303
  }
17279
- }, Zh = class {
17304
+ }, Qh = class {
17280
17305
  constructor(e) {
17281
17306
  this.parser = e, this.name = $.KHR_MATERIALS_EMISSIVE_STRENGTH;
17282
17307
  }
17283
17308
  extendMaterialParams(e, t) {
17284
- let n = Jh(this.parser, e, this.name);
17309
+ let n = Yh(this.parser, e, this.name);
17285
17310
  return n === null || n.emissiveStrength !== void 0 && (t.emissiveIntensity = n.emissiveStrength), Promise.resolve();
17286
17311
  }
17287
- }, Qh = class {
17312
+ }, $h = class {
17288
17313
  constructor(e) {
17289
17314
  this.parser = e, this.name = $.KHR_MATERIALS_CLEARCOAT;
17290
17315
  }
17291
17316
  getMaterialType(e) {
17292
- return Jh(this.parser, e, this.name) === null ? null : xa;
17317
+ return Yh(this.parser, e, this.name) === null ? null : xa;
17293
17318
  }
17294
17319
  extendMaterialParams(e, t) {
17295
- let n = Jh(this.parser, e, this.name);
17320
+ let n = Yh(this.parser, e, this.name);
17296
17321
  if (n === null) return Promise.resolve();
17297
17322
  let r = [];
17298
17323
  if (n.clearcoatFactor !== void 0 && (t.clearcoat = n.clearcoatFactor), n.clearcoatTexture !== void 0 && r.push(this.parser.assignTexture(t, "clearcoatMap", n.clearcoatTexture)), n.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = n.clearcoatRoughnessFactor), n.clearcoatRoughnessTexture !== void 0 && r.push(this.parser.assignTexture(t, "clearcoatRoughnessMap", n.clearcoatRoughnessTexture)), n.clearcoatNormalTexture !== void 0 && (r.push(this.parser.assignTexture(t, "clearcoatNormalMap", n.clearcoatNormalTexture)), n.clearcoatNormalTexture.scale !== void 0)) {
@@ -17301,39 +17326,39 @@ var $ = {
17301
17326
  }
17302
17327
  return Promise.all(r);
17303
17328
  }
17304
- }, $h = class {
17329
+ }, eg = class {
17305
17330
  constructor(e) {
17306
17331
  this.parser = e, this.name = $.KHR_MATERIALS_DISPERSION;
17307
17332
  }
17308
17333
  getMaterialType(e) {
17309
- return Jh(this.parser, e, this.name) === null ? null : xa;
17334
+ return Yh(this.parser, e, this.name) === null ? null : xa;
17310
17335
  }
17311
17336
  extendMaterialParams(e, t) {
17312
- let n = Jh(this.parser, e, this.name);
17337
+ let n = Yh(this.parser, e, this.name);
17313
17338
  return n === null || (t.dispersion = n.dispersion === void 0 ? 0 : n.dispersion), Promise.resolve();
17314
17339
  }
17315
- }, eg = class {
17340
+ }, tg = class {
17316
17341
  constructor(e) {
17317
17342
  this.parser = e, this.name = $.KHR_MATERIALS_IRIDESCENCE;
17318
17343
  }
17319
17344
  getMaterialType(e) {
17320
- return Jh(this.parser, e, this.name) === null ? null : xa;
17345
+ return Yh(this.parser, e, this.name) === null ? null : xa;
17321
17346
  }
17322
17347
  extendMaterialParams(e, t) {
17323
- let n = Jh(this.parser, e, this.name);
17348
+ let n = Yh(this.parser, e, this.name);
17324
17349
  if (n === null) return Promise.resolve();
17325
17350
  let r = [];
17326
17351
  return n.iridescenceFactor !== void 0 && (t.iridescence = n.iridescenceFactor), n.iridescenceTexture !== void 0 && r.push(this.parser.assignTexture(t, "iridescenceMap", n.iridescenceTexture)), n.iridescenceIor !== void 0 && (t.iridescenceIOR = n.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), n.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = n.iridescenceThicknessMinimum), n.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = n.iridescenceThicknessMaximum), n.iridescenceThicknessTexture !== void 0 && r.push(this.parser.assignTexture(t, "iridescenceThicknessMap", n.iridescenceThicknessTexture)), Promise.all(r);
17327
17352
  }
17328
- }, tg = class {
17353
+ }, ng = class {
17329
17354
  constructor(e) {
17330
17355
  this.parser = e, this.name = $.KHR_MATERIALS_SHEEN;
17331
17356
  }
17332
17357
  getMaterialType(e) {
17333
- return Jh(this.parser, e, this.name) === null ? null : xa;
17358
+ return Yh(this.parser, e, this.name) === null ? null : xa;
17334
17359
  }
17335
17360
  extendMaterialParams(e, t) {
17336
- let n = Jh(this.parser, e, this.name);
17361
+ let n = Yh(this.parser, e, this.name);
17337
17362
  if (n === null) return Promise.resolve();
17338
17363
  let r = [];
17339
17364
  if (t.sheenColor = new K(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1, n.sheenColorFactor !== void 0) {
@@ -17342,28 +17367,28 @@ var $ = {
17342
17367
  }
17343
17368
  return n.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = n.sheenRoughnessFactor), n.sheenColorTexture !== void 0 && r.push(this.parser.assignTexture(t, "sheenColorMap", n.sheenColorTexture, He)), n.sheenRoughnessTexture !== void 0 && r.push(this.parser.assignTexture(t, "sheenRoughnessMap", n.sheenRoughnessTexture)), Promise.all(r);
17344
17369
  }
17345
- }, ng = class {
17370
+ }, rg = class {
17346
17371
  constructor(e) {
17347
17372
  this.parser = e, this.name = $.KHR_MATERIALS_TRANSMISSION;
17348
17373
  }
17349
17374
  getMaterialType(e) {
17350
- return Jh(this.parser, e, this.name) === null ? null : xa;
17375
+ return Yh(this.parser, e, this.name) === null ? null : xa;
17351
17376
  }
17352
17377
  extendMaterialParams(e, t) {
17353
- let n = Jh(this.parser, e, this.name);
17378
+ let n = Yh(this.parser, e, this.name);
17354
17379
  if (n === null) return Promise.resolve();
17355
17380
  let r = [];
17356
17381
  return n.transmissionFactor !== void 0 && (t.transmission = n.transmissionFactor), n.transmissionTexture !== void 0 && r.push(this.parser.assignTexture(t, "transmissionMap", n.transmissionTexture)), Promise.all(r);
17357
17382
  }
17358
- }, rg = class {
17383
+ }, ig = class {
17359
17384
  constructor(e) {
17360
17385
  this.parser = e, this.name = $.KHR_MATERIALS_VOLUME;
17361
17386
  }
17362
17387
  getMaterialType(e) {
17363
- return Jh(this.parser, e, this.name) === null ? null : xa;
17388
+ return Yh(this.parser, e, this.name) === null ? null : xa;
17364
17389
  }
17365
17390
  extendMaterialParams(e, t) {
17366
- let n = Jh(this.parser, e, this.name);
17391
+ let n = Yh(this.parser, e, this.name);
17367
17392
  if (n === null) return Promise.resolve();
17368
17393
  let r = [];
17369
17394
  t.thickness = n.thicknessFactor === void 0 ? 0 : n.thicknessFactor, n.thicknessTexture !== void 0 && r.push(this.parser.assignTexture(t, "thicknessMap", n.thicknessTexture)), t.attenuationDistance = n.attenuationDistance || Infinity;
@@ -17374,26 +17399,26 @@ var $ = {
17374
17399
  ];
17375
17400
  return t.attenuationColor = new K().setRGB(i[0], i[1], i[2], Ue), Promise.all(r);
17376
17401
  }
17377
- }, ig = class {
17402
+ }, ag = class {
17378
17403
  constructor(e) {
17379
17404
  this.parser = e, this.name = $.KHR_MATERIALS_IOR;
17380
17405
  }
17381
17406
  getMaterialType(e) {
17382
- return Jh(this.parser, e, this.name) === null ? null : xa;
17407
+ return Yh(this.parser, e, this.name) === null ? null : xa;
17383
17408
  }
17384
17409
  extendMaterialParams(e, t) {
17385
- let n = Jh(this.parser, e, this.name);
17410
+ let n = Yh(this.parser, e, this.name);
17386
17411
  return n === null ? Promise.resolve() : (t.ior = n.ior === void 0 ? 1.5 : n.ior, t.ior === 0 && (t.ior = 1e3), Promise.resolve());
17387
17412
  }
17388
- }, ag = class {
17413
+ }, og = class {
17389
17414
  constructor(e) {
17390
17415
  this.parser = e, this.name = $.KHR_MATERIALS_SPECULAR;
17391
17416
  }
17392
17417
  getMaterialType(e) {
17393
- return Jh(this.parser, e, this.name) === null ? null : xa;
17418
+ return Yh(this.parser, e, this.name) === null ? null : xa;
17394
17419
  }
17395
17420
  extendMaterialParams(e, t) {
17396
- let n = Jh(this.parser, e, this.name);
17421
+ let n = Yh(this.parser, e, this.name);
17397
17422
  if (n === null) return Promise.resolve();
17398
17423
  let r = [];
17399
17424
  t.specularIntensity = n.specularFactor === void 0 ? 1 : n.specularFactor, n.specularTexture !== void 0 && r.push(this.parser.assignTexture(t, "specularIntensityMap", n.specularTexture));
@@ -17404,33 +17429,33 @@ var $ = {
17404
17429
  ];
17405
17430
  return t.specularColor = new K().setRGB(i[0], i[1], i[2], Ue), n.specularColorTexture !== void 0 && r.push(this.parser.assignTexture(t, "specularColorMap", n.specularColorTexture, He)), Promise.all(r);
17406
17431
  }
17407
- }, og = class {
17432
+ }, sg = class {
17408
17433
  constructor(e) {
17409
17434
  this.parser = e, this.name = $.EXT_MATERIALS_BUMP;
17410
17435
  }
17411
17436
  getMaterialType(e) {
17412
- return Jh(this.parser, e, this.name) === null ? null : xa;
17437
+ return Yh(this.parser, e, this.name) === null ? null : xa;
17413
17438
  }
17414
17439
  extendMaterialParams(e, t) {
17415
- let n = Jh(this.parser, e, this.name);
17440
+ let n = Yh(this.parser, e, this.name);
17416
17441
  if (n === null) return Promise.resolve();
17417
17442
  let r = [];
17418
17443
  return t.bumpScale = n.bumpFactor === void 0 ? 1 : n.bumpFactor, n.bumpTexture !== void 0 && r.push(this.parser.assignTexture(t, "bumpMap", n.bumpTexture)), Promise.all(r);
17419
17444
  }
17420
- }, sg = class {
17445
+ }, cg = class {
17421
17446
  constructor(e) {
17422
17447
  this.parser = e, this.name = $.KHR_MATERIALS_ANISOTROPY;
17423
17448
  }
17424
17449
  getMaterialType(e) {
17425
- return Jh(this.parser, e, this.name) === null ? null : xa;
17450
+ return Yh(this.parser, e, this.name) === null ? null : xa;
17426
17451
  }
17427
17452
  extendMaterialParams(e, t) {
17428
- let n = Jh(this.parser, e, this.name);
17453
+ let n = Yh(this.parser, e, this.name);
17429
17454
  if (n === null) return Promise.resolve();
17430
17455
  let r = [];
17431
17456
  return n.anisotropyStrength !== void 0 && (t.anisotropy = n.anisotropyStrength), n.anisotropyRotation !== void 0 && (t.anisotropyRotation = n.anisotropyRotation), n.anisotropyTexture !== void 0 && r.push(this.parser.assignTexture(t, "anisotropyMap", n.anisotropyTexture)), Promise.all(r);
17432
17457
  }
17433
- }, cg = class {
17458
+ }, lg = class {
17434
17459
  constructor(e) {
17435
17460
  this.parser = e, this.name = $.KHR_TEXTURE_BASISU;
17436
17461
  }
@@ -17444,7 +17469,7 @@ var $ = {
17444
17469
  }
17445
17470
  return t.loadTextureImage(e, i.source, a);
17446
17471
  }
17447
- }, lg = class {
17472
+ }, ug = class {
17448
17473
  constructor(e) {
17449
17474
  this.parser = e, this.name = $.EXT_TEXTURE_WEBP;
17450
17475
  }
@@ -17458,7 +17483,7 @@ var $ = {
17458
17483
  }
17459
17484
  return n.loadTextureImage(e, a.source, s);
17460
17485
  }
17461
- }, ug = class {
17486
+ }, dg = class {
17462
17487
  constructor(e) {
17463
17488
  this.parser = e, this.name = $.EXT_TEXTURE_AVIF;
17464
17489
  }
@@ -17472,7 +17497,7 @@ var $ = {
17472
17497
  }
17473
17498
  return n.loadTextureImage(e, a.source, s);
17474
17499
  }
17475
- }, dg = class {
17500
+ }, fg = class {
17476
17501
  constructor(e, t) {
17477
17502
  this.name = t, this.parser = e;
17478
17503
  }
@@ -17496,7 +17521,7 @@ var $ = {
17496
17521
  }
17497
17522
  return null;
17498
17523
  }
17499
- }, fg = class {
17524
+ }, pg = class {
17500
17525
  constructor(e) {
17501
17526
  this.name = $.EXT_MESH_GPU_INSTANCING, this.parser = e;
17502
17527
  }
@@ -17504,7 +17529,7 @@ var $ = {
17504
17529
  let t = this.parser.json, n = t.nodes[e];
17505
17530
  if (!n.extensions || !n.extensions[this.name] || n.mesh === void 0) return null;
17506
17531
  let r = t.meshes[n.mesh];
17507
- for (let e of r.primitives) if (e.mode !== Cg.TRIANGLES && e.mode !== Cg.TRIANGLE_STRIP && e.mode !== Cg.TRIANGLE_FAN && e.mode !== void 0) return null;
17532
+ for (let e of r.primitives) if (e.mode !== wg.TRIANGLES && e.mode !== wg.TRIANGLE_STRIP && e.mode !== wg.TRIANGLE_FAN && e.mode !== void 0) return null;
17508
17533
  let i = n.extensions[this.name].attributes, a = [], o = {};
17509
17534
  for (let e in i) a.push(this.parser.getDependency("accessor", i[e]).then((t) => (o[e] = t, o[e])));
17510
17535
  return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((e) => {
@@ -17521,36 +17546,36 @@ var $ = {
17521
17546
  return t.isGroup ? (t.clear(), t.add(...i), t) : i[0];
17522
17547
  }));
17523
17548
  }
17524
- }, pg = "glTF", mg = 12, hg = {
17549
+ }, mg = "glTF", hg = 12, gg = {
17525
17550
  JSON: 1313821514,
17526
17551
  BIN: 5130562
17527
- }, gg = class {
17552
+ }, _g = class {
17528
17553
  constructor(e) {
17529
17554
  this.name = $.KHR_BINARY_GLTF, this.content = null, this.body = null;
17530
- let t = new DataView(e, 0, mg), n = new TextDecoder();
17555
+ let t = new DataView(e, 0, hg), n = new TextDecoder();
17531
17556
  if (this.header = {
17532
17557
  magic: n.decode(new Uint8Array(e.slice(0, 4))),
17533
17558
  version: t.getUint32(4, !0),
17534
17559
  length: t.getUint32(8, !0)
17535
- }, this.header.magic !== pg) throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
17560
+ }, this.header.magic !== mg) throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
17536
17561
  if (this.header.version < 2) throw Error("THREE.GLTFLoader: Legacy binary file detected.");
17537
- let r = this.header.length - mg, i = new DataView(e, mg), a = 0;
17562
+ let r = this.header.length - hg, i = new DataView(e, hg), a = 0;
17538
17563
  for (; a < r;) {
17539
17564
  let t = i.getUint32(a, !0);
17540
17565
  a += 4;
17541
17566
  let r = i.getUint32(a, !0);
17542
- if (a += 4, r === hg.JSON) {
17543
- let r = new Uint8Array(e, mg + a, t);
17567
+ if (a += 4, r === gg.JSON) {
17568
+ let r = new Uint8Array(e, hg + a, t);
17544
17569
  this.content = n.decode(r);
17545
- } else if (r === hg.BIN) {
17546
- let n = mg + a;
17570
+ } else if (r === gg.BIN) {
17571
+ let n = hg + a;
17547
17572
  this.body = e.slice(n, n + t);
17548
17573
  }
17549
17574
  a += t;
17550
17575
  }
17551
17576
  if (this.content === null) throw Error("THREE.GLTFLoader: JSON content not found.");
17552
17577
  }
17553
- }, _g = class {
17578
+ }, vg = class {
17554
17579
  constructor(e, t) {
17555
17580
  if (!t) throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
17556
17581
  this.name = $.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
@@ -17558,14 +17583,14 @@ var $ = {
17558
17583
  decodePrimitive(e, t) {
17559
17584
  let n = this.json, r = this.dracoLoader, i = e.extensions[this.name].bufferView, a = e.extensions[this.name].attributes, o = {}, s = {}, c = {};
17560
17585
  for (let e in a) {
17561
- let t = Og[e] || e.toLowerCase();
17586
+ let t = kg[e] || e.toLowerCase();
17562
17587
  o[t] = a[e];
17563
17588
  }
17564
17589
  for (let t in e.attributes) {
17565
- let r = Og[t] || t.toLowerCase();
17590
+ let r = kg[t] || t.toLowerCase();
17566
17591
  if (a[t] !== void 0) {
17567
17592
  let i = n.accessors[e.attributes[t]];
17568
- c[r] = wg[i.componentType].name, s[r] = i.normalized === !0;
17593
+ c[r] = Tg[i.componentType].name, s[r] = i.normalized === !0;
17569
17594
  }
17570
17595
  }
17571
17596
  return t.getDependency("bufferView", i).then(function(e) {
@@ -17580,18 +17605,18 @@ var $ = {
17580
17605
  });
17581
17606
  });
17582
17607
  }
17583
- }, vg = class {
17608
+ }, yg = class {
17584
17609
  constructor() {
17585
17610
  this.name = $.KHR_TEXTURE_TRANSFORM;
17586
17611
  }
17587
17612
  extendTexture(e, t) {
17588
17613
  return (t.texCoord === void 0 || t.texCoord === e.channel) && t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 ? e : (e = e.clone(), t.texCoord !== void 0 && (e.channel = t.texCoord), t.offset !== void 0 && e.offset.fromArray(t.offset), t.rotation !== void 0 && (e.rotation = t.rotation), t.scale !== void 0 && e.repeat.fromArray(t.scale), e.needsUpdate = !0, e);
17589
17614
  }
17590
- }, yg = class {
17615
+ }, bg = class {
17591
17616
  constructor() {
17592
17617
  this.name = $.KHR_MESH_QUANTIZATION;
17593
17618
  }
17594
- }, bg = class extends ka {
17619
+ }, xg = class extends ka {
17595
17620
  constructor(e, t, n, r) {
17596
17621
  super(e, t, n, r);
17597
17622
  }
@@ -17608,12 +17633,12 @@ var $ = {
17608
17633
  }
17609
17634
  return i;
17610
17635
  }
17611
- }, xg = new Mt(), Sg = class extends bg {
17636
+ }, Sg = new Mt(), Cg = class extends xg {
17612
17637
  interpolate_(e, t, n, r) {
17613
17638
  let i = super.interpolate_(e, t, n, r);
17614
- return xg.fromArray(i).normalize().toArray(i), i;
17639
+ return Sg.fromArray(i).normalize().toArray(i), i;
17615
17640
  }
17616
- }, Cg = {
17641
+ }, wg = {
17617
17642
  FLOAT: 5126,
17618
17643
  FLOAT_MAT3: 35675,
17619
17644
  FLOAT_MAT4: 35676,
@@ -17632,25 +17657,25 @@ var $ = {
17632
17657
  TRIANGLE_FAN: 6,
17633
17658
  UNSIGNED_BYTE: 5121,
17634
17659
  UNSIGNED_SHORT: 5123
17635
- }, wg = {
17660
+ }, Tg = {
17636
17661
  5120: Int8Array,
17637
17662
  5121: Uint8Array,
17638
17663
  5122: Int16Array,
17639
17664
  5123: Uint16Array,
17640
17665
  5125: Uint32Array,
17641
17666
  5126: Float32Array
17642
- }, Tg = {
17667
+ }, Eg = {
17643
17668
  9728: o,
17644
17669
  9729: l,
17645
17670
  9984: s,
17646
17671
  9985: u,
17647
17672
  9986: c,
17648
17673
  9987: d
17649
- }, Eg = {
17674
+ }, Dg = {
17650
17675
  33071: i,
17651
17676
  33648: a,
17652
17677
  10497: r
17653
- }, Dg = {
17678
+ }, Og = {
17654
17679
  SCALAR: 1,
17655
17680
  VEC2: 2,
17656
17681
  VEC3: 3,
@@ -17658,7 +17683,7 @@ var $ = {
17658
17683
  MAT2: 4,
17659
17684
  MAT3: 9,
17660
17685
  MAT4: 16
17661
- }, Og = {
17686
+ }, kg = {
17662
17687
  POSITION: "position",
17663
17688
  NORMAL: "normal",
17664
17689
  TANGENT: "tangent",
@@ -17669,21 +17694,21 @@ var $ = {
17669
17694
  COLOR_0: "color",
17670
17695
  WEIGHTS_0: "skinWeight",
17671
17696
  JOINTS_0: "skinIndex"
17672
- }, kg = {
17697
+ }, Ag = {
17673
17698
  scale: "scale",
17674
17699
  translation: "position",
17675
17700
  rotation: "quaternion",
17676
17701
  weights: "morphTargetInfluences"
17677
- }, Ag = {
17702
+ }, jg = {
17678
17703
  CUBICSPLINE: void 0,
17679
17704
  LINEAR: Le,
17680
17705
  STEP: Ie
17681
- }, jg = {
17706
+ }, Mg = {
17682
17707
  OPAQUE: "OPAQUE",
17683
17708
  MASK: "MASK",
17684
17709
  BLEND: "BLEND"
17685
17710
  };
17686
- function Mg(e) {
17711
+ function Ng(e) {
17687
17712
  return e.DefaultMaterial === void 0 && (e.DefaultMaterial = new ba({
17688
17713
  color: 16777215,
17689
17714
  emissive: 0,
@@ -17694,13 +17719,13 @@ function Mg(e) {
17694
17719
  side: 0
17695
17720
  })), e.DefaultMaterial;
17696
17721
  }
17697
- function Ng(e, t, n) {
17722
+ function Pg(e, t, n) {
17698
17723
  for (let r in n.extensions) e[r] === void 0 && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[r] = n.extensions[r]);
17699
17724
  }
17700
- function Pg(e, t) {
17725
+ function Fg(e, t) {
17701
17726
  t.extras !== void 0 && (typeof t.extras == "object" ? Object.assign(e.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras));
17702
17727
  }
17703
- function Fg(e, t, n) {
17728
+ function Ig(e, t, n) {
17704
17729
  let r = !1, i = !1, a = !1;
17705
17730
  for (let e = 0, n = t.length; e < n; e++) {
17706
17731
  let n = t[e];
@@ -17732,7 +17757,7 @@ function Fg(e, t, n) {
17732
17757
  return r && (e.morphAttributes.position = n), i && (e.morphAttributes.normal = o), a && (e.morphAttributes.color = s), e.morphTargetsRelative = !0, e;
17733
17758
  });
17734
17759
  }
17735
- function Ig(e, t) {
17760
+ function Lg(e, t) {
17736
17761
  if (e.updateMorphTargets(), t.weights !== void 0) for (let n = 0, r = t.weights.length; n < r; n++) e.morphTargetInfluences[n] = t.weights[n];
17737
17762
  if (t.extras && Array.isArray(t.extras.targetNames)) {
17738
17763
  let n = t.extras.targetNames;
@@ -17742,17 +17767,17 @@ function Ig(e, t) {
17742
17767
  } else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
17743
17768
  }
17744
17769
  }
17745
- function Lg(e) {
17770
+ function Rg(e) {
17746
17771
  let t, n = e.extensions && e.extensions[$.KHR_DRACO_MESH_COMPRESSION];
17747
- if (t = n ? "draco:" + n.bufferView + ":" + n.indices + ":" + Rg(n.attributes) : e.indices + ":" + Rg(e.attributes) + ":" + e.mode, e.targets !== void 0) for (let n = 0, r = e.targets.length; n < r; n++) t += ":" + Rg(e.targets[n]);
17772
+ if (t = n ? "draco:" + n.bufferView + ":" + n.indices + ":" + zg(n.attributes) : e.indices + ":" + zg(e.attributes) + ":" + e.mode, e.targets !== void 0) for (let n = 0, r = e.targets.length; n < r; n++) t += ":" + zg(e.targets[n]);
17748
17773
  return t;
17749
17774
  }
17750
- function Rg(e) {
17775
+ function zg(e) {
17751
17776
  let t = "", n = Object.keys(e).sort();
17752
17777
  for (let r = 0, i = n.length; r < i; r++) t += n[r] + ":" + e[n[r]] + ";";
17753
17778
  return t;
17754
17779
  }
17755
- function zg(e) {
17780
+ function Bg(e) {
17756
17781
  switch (e) {
17757
17782
  case Int8Array: return 1 / 127;
17758
17783
  case Uint8Array: return 1 / 255;
@@ -17761,12 +17786,12 @@ function zg(e) {
17761
17786
  default: throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
17762
17787
  }
17763
17788
  }
17764
- function Bg(e) {
17789
+ function Vg(e) {
17765
17790
  return e.search(/\.jpe?g($|\?)/i) > 0 || e.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : e.search(/\.webp($|\?)/i) > 0 || e.search(/^data\:image\/webp/) === 0 ? "image/webp" : e.search(/\.ktx2($|\?)/i) > 0 || e.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
17766
17791
  }
17767
- var Vg = new G(), Hg = class {
17792
+ var Hg = new G(), Ug = class {
17768
17793
  constructor(e = {}, t = {}) {
17769
- this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new qh(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = {
17794
+ this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new Jh(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = {
17770
17795
  refs: {},
17771
17796
  uses: {}
17772
17797
  }, this.cameraCache = {
@@ -17813,7 +17838,7 @@ var Vg = new G(), Hg = class {
17813
17838
  parser: n,
17814
17839
  userData: {}
17815
17840
  };
17816
- return Ng(i, a, r), Pg(a, r), Promise.all(n._invokeAll(function(e) {
17841
+ return Pg(i, a, r), Fg(a, r), Promise.all(n._invokeAll(function(e) {
17817
17842
  return e.afterRoot && e.afterRoot(a);
17818
17843
  })).then(function() {
17819
17844
  for (let e of a.scenes) e.updateMatrixWorld();
@@ -17951,18 +17976,18 @@ var Vg = new G(), Hg = class {
17951
17976
  loadAccessor(e) {
17952
17977
  let t = this, n = this.json, r = this.json.accessors[e];
17953
17978
  if (r.bufferView === void 0 && r.sparse === void 0) {
17954
- let e = Dg[r.type], t = wg[r.componentType], n = r.normalized === !0, i = new t(r.count * e);
17979
+ let e = Og[r.type], t = Tg[r.componentType], n = r.normalized === !0, i = new t(r.count * e);
17955
17980
  return Promise.resolve(new hr(i, e, n));
17956
17981
  }
17957
17982
  let i = [];
17958
17983
  return r.bufferView === void 0 ? i.push(null) : i.push(this.getDependency("bufferView", r.bufferView)), r.sparse !== void 0 && (i.push(this.getDependency("bufferView", r.sparse.indices.bufferView)), i.push(this.getDependency("bufferView", r.sparse.values.bufferView))), Promise.all(i).then(function(e) {
17959
- let i = e[0], a = Dg[r.type], o = wg[r.componentType], s = o.BYTES_PER_ELEMENT, c = s * a, l = r.byteOffset || 0, u = r.bufferView === void 0 ? void 0 : n.bufferViews[r.bufferView].byteStride, d = r.normalized === !0, f, p;
17984
+ let i = e[0], a = Og[r.type], o = Tg[r.componentType], s = o.BYTES_PER_ELEMENT, c = s * a, l = r.byteOffset || 0, u = r.bufferView === void 0 ? void 0 : n.bufferViews[r.bufferView].byteStride, d = r.normalized === !0, f, p;
17960
17985
  if (u && u !== c) {
17961
17986
  let e = Math.floor(l / u), n = "InterleavedBuffer:" + r.bufferView + ":" + r.componentType + ":" + e + ":" + r.count, c = t.cache.get(n);
17962
17987
  c || (f = new o(i, e * u, r.count * u / s), c = new jr(f, u / s), t.cache.add(n, c)), p = new Nr(c, a, l % u / s, d);
17963
17988
  } else f = i === null ? new o(r.count * a) : new o(i, l, r.count * a), p = new hr(f, a, d);
17964
17989
  if (r.sparse !== void 0) {
17965
- let t = Dg.SCALAR, n = wg[r.sparse.indices.componentType], s = r.sparse.indices.byteOffset || 0, c = r.sparse.values.byteOffset || 0, l = new n(e[1], s, r.sparse.count * t), u = new o(e[2], c, r.sparse.count * a);
17990
+ let t = Og.SCALAR, n = Tg[r.sparse.indices.componentType], s = r.sparse.indices.byteOffset || 0, c = r.sparse.values.byteOffset || 0, l = new n(e[1], s, r.sparse.count * t), u = new o(e[2], c, r.sparse.count * a);
17966
17991
  i !== null && (p = new hr(p.array.slice(), p.itemSize, p.normalized)), p.normalized = !1;
17967
17992
  for (let e = 0, t = l.length; e < t; e++) {
17968
17993
  let t = l[e];
@@ -17987,7 +18012,7 @@ var Vg = new G(), Hg = class {
17987
18012
  let c = this.loadImageSource(t, n).then(function(t) {
17988
18013
  t.flipY = !1, t.name = a.name || o.name || "", t.name === "" && typeof o.uri == "string" && o.uri.startsWith("data:image/") === !1 && (t.name = o.uri);
17989
18014
  let n = (i.samplers || {})[a.sampler] || {};
17990
- return t.magFilter = Tg[n.magFilter] || 1006, t.minFilter = Tg[n.minFilter] || 1008, t.wrapS = Eg[n.wrapS] || 1e3, t.wrapT = Eg[n.wrapT] || 1e3, t.generateMipmaps = !t.isCompressedTexture && t.minFilter !== 1003 && t.minFilter !== 1006, r.associations.set(t, { textures: e }), t;
18015
+ return t.magFilter = Eg[n.magFilter] || 1006, t.minFilter = Eg[n.minFilter] || 1008, t.wrapS = Dg[n.wrapS] || 1e3, t.wrapT = Dg[n.wrapT] || 1e3, t.generateMipmaps = !t.isCompressedTexture && t.minFilter !== 1003 && t.minFilter !== 1006, r.associations.set(t, { textures: e }), t;
17991
18016
  }).catch(function() {
17992
18017
  return null;
17993
18018
  });
@@ -18012,7 +18037,7 @@ var Vg = new G(), Hg = class {
18012
18037
  }), t.load(Co.resolveURL(e, i.path), a, void 0, r);
18013
18038
  });
18014
18039
  }).then(function(e) {
18015
- return c === !0 && o.revokeObjectURL(s), Pg(e, a), e.userData.mimeType = a.mimeType || Bg(a.uri), e;
18040
+ return c === !0 && o.revokeObjectURL(s), Fg(e, a), e.userData.mimeType = a.mimeType || Vg(a.uri), e;
18016
18041
  }).catch(function(e) {
18017
18042
  throw console.error("THREE.GLTFLoader: Couldn't load texture", s), e;
18018
18043
  });
@@ -18070,8 +18095,8 @@ var Vg = new G(), Hg = class {
18070
18095
  })));
18071
18096
  }
18072
18097
  i.doubleSided === !0 && (o.side = 2);
18073
- let l = i.alphaMode || jg.OPAQUE;
18074
- if (l === jg.BLEND ? (o.transparent = !0, o.depthWrite = !1) : (o.transparent = !1, l === jg.MASK && (o.alphaTest = i.alphaCutoff === void 0 ? .5 : i.alphaCutoff)), i.normalTexture !== void 0 && a !== Wr && (c.push(t.assignTexture(o, "normalMap", i.normalTexture)), o.normalScale = new V(1, 1), i.normalTexture.scale !== void 0)) {
18098
+ let l = i.alphaMode || Mg.OPAQUE;
18099
+ if (l === Mg.BLEND ? (o.transparent = !0, o.depthWrite = !1) : (o.transparent = !1, l === Mg.MASK && (o.alphaTest = i.alphaCutoff === void 0 ? .5 : i.alphaCutoff)), i.normalTexture !== void 0 && a !== Wr && (c.push(t.assignTexture(o, "normalMap", i.normalTexture)), o.normalScale = new V(1, 1), i.normalTexture.scale !== void 0)) {
18075
18100
  let e = i.normalTexture.scale;
18076
18101
  o.normalScale.set(e, e);
18077
18102
  }
@@ -18081,7 +18106,7 @@ var Vg = new G(), Hg = class {
18081
18106
  }
18082
18107
  return i.emissiveTexture !== void 0 && a !== Wr && c.push(t.assignTexture(o, "emissiveMap", i.emissiveTexture, He)), Promise.all(c).then(function() {
18083
18108
  let n = new a(o);
18084
- return i.name && (n.name = i.name), Pg(n, i), t.associations.set(n, { materials: e }), i.extensions && Ng(r, n, i), n;
18109
+ return i.name && (n.name = i.name), Fg(n, i), t.associations.set(n, { materials: e }), i.extensions && Pg(r, n, i), n;
18085
18110
  });
18086
18111
  }
18087
18112
  createUniqueName(e) {
@@ -18092,16 +18117,16 @@ var Vg = new G(), Hg = class {
18092
18117
  let t = this, n = this.extensions, r = this.primitiveCache;
18093
18118
  function i(e) {
18094
18119
  return n[$.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e, t).then(function(n) {
18095
- return Wg(n, e, t);
18120
+ return Gg(n, e, t);
18096
18121
  });
18097
18122
  }
18098
18123
  let a = [];
18099
18124
  for (let n = 0, o = e.length; n < o; n++) {
18100
- let o = e[n], s = Lg(o), c = r[s];
18125
+ let o = e[n], s = Rg(o), c = r[s];
18101
18126
  if (c) a.push(c.promise);
18102
18127
  else {
18103
18128
  let e;
18104
- e = o.extensions && o.extensions[$.KHR_DRACO_MESH_COMPRESSION] ? i(o) : Wg(new Ar(), o, t), r[s] = {
18129
+ e = o.extensions && o.extensions[$.KHR_DRACO_MESH_COMPRESSION] ? i(o) : Gg(new Ar(), o, t), r[s] = {
18105
18130
  primitive: o,
18106
18131
  promise: e
18107
18132
  }, a.push(e);
@@ -18112,28 +18137,28 @@ var Vg = new G(), Hg = class {
18112
18137
  loadMesh(e) {
18113
18138
  let t = this, n = this.json, r = this.extensions, i = n.meshes[e], a = i.primitives, o = [];
18114
18139
  for (let e = 0, t = a.length; e < t; e++) {
18115
- let t = a[e].material === void 0 ? Mg(this.cache) : this.getDependency("material", a[e].material);
18140
+ let t = a[e].material === void 0 ? Ng(this.cache) : this.getDependency("material", a[e].material);
18116
18141
  o.push(t);
18117
18142
  }
18118
18143
  return o.push(t.loadGeometries(a)), Promise.all(o).then(function(n) {
18119
18144
  let o = n.slice(0, n.length - 1), s = n[n.length - 1], c = [];
18120
18145
  for (let n = 0, l = s.length; n < l; n++) {
18121
18146
  let l = s[n], u = a[n], d, f = o[n];
18122
- if (u.mode === Cg.TRIANGLES || u.mode === Cg.TRIANGLE_STRIP || u.mode === Cg.TRIANGLE_FAN || u.mode === void 0) d = i.isSkinnedMesh === !0 ? new mi(l, f) : new ni(l, f), d.isSkinnedMesh === !0 && d.normalizeSkinWeights(), u.mode === Cg.TRIANGLE_STRIP ? d.geometry = Uh(d.geometry, 1) : u.mode === Cg.TRIANGLE_FAN && (d.geometry = Uh(d.geometry, 2));
18123
- else if (u.mode === Cg.LINES) d = new Yi(l, f);
18124
- else if (u.mode === Cg.LINE_STRIP) d = new Gi(l, f);
18125
- else if (u.mode === Cg.LINE_LOOP) d = new Xi(l, f);
18126
- else if (u.mode === Cg.POINTS) d = new na(l, f);
18147
+ if (u.mode === wg.TRIANGLES || u.mode === wg.TRIANGLE_STRIP || u.mode === wg.TRIANGLE_FAN || u.mode === void 0) d = i.isSkinnedMesh === !0 ? new mi(l, f) : new ni(l, f), d.isSkinnedMesh === !0 && d.normalizeSkinWeights(), u.mode === wg.TRIANGLE_STRIP ? d.geometry = Wh(d.geometry, 1) : u.mode === wg.TRIANGLE_FAN && (d.geometry = Wh(d.geometry, 2));
18148
+ else if (u.mode === wg.LINES) d = new Yi(l, f);
18149
+ else if (u.mode === wg.LINE_STRIP) d = new Gi(l, f);
18150
+ else if (u.mode === wg.LINE_LOOP) d = new Xi(l, f);
18151
+ else if (u.mode === wg.POINTS) d = new na(l, f);
18127
18152
  else throw Error("THREE.GLTFLoader: Primitive mode unsupported: " + u.mode);
18128
- Object.keys(d.geometry.morphAttributes).length > 0 && Ig(d, i), d.name = t.createUniqueName(i.name || "mesh_" + e), Pg(d, i), u.extensions && Ng(r, d, u), t.assignFinalMaterial(d), c.push(d);
18153
+ Object.keys(d.geometry.morphAttributes).length > 0 && Lg(d, i), d.name = t.createUniqueName(i.name || "mesh_" + e), Fg(d, i), u.extensions && Pg(r, d, u), t.assignFinalMaterial(d), c.push(d);
18129
18154
  }
18130
18155
  for (let n = 0, r = c.length; n < r; n++) t.associations.set(c[n], {
18131
18156
  meshes: e,
18132
18157
  primitives: n
18133
18158
  });
18134
- if (c.length === 1) return i.extensions && Ng(r, c[0], i), c[0];
18159
+ if (c.length === 1) return i.extensions && Pg(r, c[0], i), c[0];
18135
18160
  let l = new On();
18136
- i.extensions && Ng(r, l, i), t.associations.set(l, { meshes: e });
18161
+ i.extensions && Pg(r, l, i), t.associations.set(l, { meshes: e });
18137
18162
  for (let e = 0, t = c.length; e < t; e++) l.add(c[e]);
18138
18163
  return l;
18139
18164
  });
@@ -18144,7 +18169,7 @@ var Vg = new G(), Hg = class {
18144
18169
  console.warn("THREE.GLTFLoader: Missing camera parameters.");
18145
18170
  return;
18146
18171
  }
18147
- return n.type === "perspective" ? t = new ho(jt.radToDeg(r.yfov), r.aspectRatio || 1, r.znear || 1, r.zfar || 2e6) : n.type === "orthographic" && (t = new bo(-r.xmag, r.xmag, r.ymag, -r.ymag, r.znear, r.zfar)), n.name && (t.name = this.createUniqueName(n.name)), Pg(t, n), Promise.resolve(t);
18172
+ return n.type === "perspective" ? t = new ho(jt.radToDeg(r.yfov), r.aspectRatio || 1, r.znear || 1, r.zfar || 2e6) : n.type === "orthographic" && (t = new bo(-r.xmag, r.xmag, r.ymag, -r.ymag, r.znear, r.zfar)), n.name && (t.name = this.createUniqueName(n.name)), Fg(t, n), Promise.resolve(t);
18148
18173
  }
18149
18174
  loadSkin(e) {
18150
18175
  let t = this.json.skins[e], n = [];
@@ -18184,7 +18209,7 @@ var Vg = new G(), Hg = class {
18184
18209
  if (p) for (let e = 0; e < p.length; e++) l.push(p[e]);
18185
18210
  }
18186
18211
  let u = new Ha(i, void 0, l);
18187
- return Pg(u, r), u;
18212
+ return Fg(u, r), u;
18188
18213
  });
18189
18214
  }
18190
18215
  createNodeMesh(e) {
@@ -18207,7 +18232,7 @@ var Vg = new G(), Hg = class {
18207
18232
  ]).then(function(e) {
18208
18233
  let t = e[0], n = e[1], r = e[2];
18209
18234
  r !== null && t.traverse(function(e) {
18210
- e.isSkinnedMesh && e.bind(r, Vg);
18235
+ e.isSkinnedMesh && e.bind(r, Hg);
18211
18236
  });
18212
18237
  for (let e = 0, r = n.length; e < r; e++) t.add(n[e]);
18213
18238
  if (t.userData.pivot !== void 0 && n.length > 0) {
@@ -18232,7 +18257,7 @@ var Vg = new G(), Hg = class {
18232
18257
  }), this.nodeCache[e] = Promise.all(o).then(function(t) {
18233
18258
  let o;
18234
18259
  if (o = i.isBone === !0 ? new hi() : t.length > 1 ? new On() : t.length === 1 ? t[0] : new Dn(), o !== t[0]) for (let e = 0, n = t.length; e < n; e++) o.add(t[e]);
18235
- if (i.name && (o.userData.name = i.name, o.name = a), Pg(o, i), i.extensions && Ng(n, o, i), i.matrix !== void 0) {
18260
+ if (i.name && (o.userData.name = i.name, o.name = a), Fg(o, i), i.extensions && Pg(n, o, i), i.matrix !== void 0) {
18236
18261
  let e = new G();
18237
18262
  e.fromArray(i.matrix), o.applyMatrix4(e);
18238
18263
  } else i.translation !== void 0 && o.position.fromArray(i.translation), i.rotation !== void 0 && o.quaternion.fromArray(i.rotation), i.scale !== void 0 && o.scale.fromArray(i.scale);
@@ -18246,13 +18271,13 @@ var Vg = new G(), Hg = class {
18246
18271
  }
18247
18272
  loadScene(e) {
18248
18273
  let t = this.extensions, n = this.json.scenes[e], r = this, i = new On();
18249
- n.name && (i.name = r.createUniqueName(n.name)), Pg(i, n), n.extensions && Ng(t, i, n);
18274
+ n.name && (i.name = r.createUniqueName(n.name)), Fg(i, n), n.extensions && Pg(t, i, n);
18250
18275
  let a = n.nodes || [], o = [];
18251
18276
  for (let e = 0, t = a.length; e < t; e++) o.push(r.getDependency("node", a[e]));
18252
18277
  return Promise.all(o).then(function(e) {
18253
18278
  for (let t = 0, n = e.length; t < n; t++) {
18254
18279
  let n = e[t];
18255
- n.parent === null ? i.add(n) : i.add(Wh(n));
18280
+ n.parent === null ? i.add(n) : i.add(Gh(n));
18256
18281
  }
18257
18282
  return r.associations = ((e) => {
18258
18283
  let t = /* @__PURE__ */ new Map();
@@ -18269,17 +18294,17 @@ var Vg = new G(), Hg = class {
18269
18294
  function c(e) {
18270
18295
  e.morphTargetInfluences && s.push(e.name ? e.name : e.uuid);
18271
18296
  }
18272
- kg[i.path] === kg.weights ? (c(e), e.isGroup && e.children.forEach(c)) : s.push(o);
18297
+ Ag[i.path] === Ag.weights ? (c(e), e.isGroup && e.children.forEach(c)) : s.push(o);
18273
18298
  let l;
18274
- switch (kg[i.path]) {
18275
- case kg.weights:
18299
+ switch (Ag[i.path]) {
18300
+ case Ag.weights:
18276
18301
  l = La;
18277
18302
  break;
18278
- case kg.rotation:
18303
+ case Ag.rotation:
18279
18304
  l = za;
18280
18305
  break;
18281
- case kg.translation:
18282
- case kg.scale:
18306
+ case Ag.translation:
18307
+ case Ag.scale:
18283
18308
  l = Va;
18284
18309
  break;
18285
18310
  default: switch (n.itemSize) {
@@ -18289,9 +18314,9 @@ var Vg = new G(), Hg = class {
18289
18314
  default: l = Va;
18290
18315
  }
18291
18316
  }
18292
- let u = r.interpolation === void 0 ? Le : Ag[r.interpolation], d = this._getArrayFromAccessor(n);
18317
+ let u = r.interpolation === void 0 ? Le : jg[r.interpolation], d = this._getArrayFromAccessor(n);
18293
18318
  for (let e = 0, n = s.length; e < n; e++) {
18294
- let n = new l(s[e] + "." + kg[i.path], t.array, d, u);
18319
+ let n = new l(s[e] + "." + Ag[i.path], t.array, d, u);
18295
18320
  r.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(n), a.push(n);
18296
18321
  }
18297
18322
  return a;
@@ -18299,7 +18324,7 @@ var Vg = new G(), Hg = class {
18299
18324
  _getArrayFromAccessor(e) {
18300
18325
  let t = e.array;
18301
18326
  if (e.normalized) {
18302
- let e = zg(t.constructor), n = new Float32Array(t.length);
18327
+ let e = Bg(t.constructor), n = new Float32Array(t.length);
18303
18328
  for (let r = 0, i = t.length; r < i; r++) n[r] = t[r] * e;
18304
18329
  t = n;
18305
18330
  }
@@ -18307,17 +18332,17 @@ var Vg = new G(), Hg = class {
18307
18332
  }
18308
18333
  _createCubicSplineTrackInterpolant(e) {
18309
18334
  e.createInterpolant = function(e) {
18310
- return new (this instanceof za ? Sg : bg)(this.times, this.values, this.getValueSize() / 3, e);
18335
+ return new (this instanceof za ? Cg : xg)(this.times, this.values, this.getValueSize() / 3, e);
18311
18336
  }, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
18312
18337
  }
18313
18338
  };
18314
- function Ug(e, t, n) {
18339
+ function Wg(e, t, n) {
18315
18340
  let r = t.attributes, i = new Zn();
18316
18341
  if (r.POSITION !== void 0) {
18317
18342
  let e = n.json.accessors[r.POSITION], t = e.min, a = e.max;
18318
18343
  if (t !== void 0 && a !== void 0) {
18319
18344
  if (i.set(new H(t[0], t[1], t[2]), new H(a[0], a[1], a[2])), e.normalized) {
18320
- let t = zg(wg[e.componentType]);
18345
+ let t = Bg(Tg[e.componentType]);
18321
18346
  i.min.multiplyScalar(t), i.max.multiplyScalar(t);
18322
18347
  }
18323
18348
  } else {
@@ -18334,7 +18359,7 @@ function Ug(e, t, n) {
18334
18359
  let r = n.json.accessors[i.POSITION], a = r.min, o = r.max;
18335
18360
  if (a !== void 0 && o !== void 0) {
18336
18361
  if (t.setX(Math.max(Math.abs(a[0]), Math.abs(o[0]))), t.setY(Math.max(Math.abs(a[1]), Math.abs(o[1]))), t.setZ(Math.max(Math.abs(a[2]), Math.abs(o[2]))), r.normalized) {
18337
- let e = zg(wg[r.componentType]);
18362
+ let e = Bg(Tg[r.componentType]);
18338
18363
  t.multiplyScalar(e);
18339
18364
  }
18340
18365
  e.max(t);
@@ -18347,7 +18372,7 @@ function Ug(e, t, n) {
18347
18372
  let o = new Sr();
18348
18373
  i.getCenter(o.center), o.radius = i.min.distanceTo(i.max) / 2, e.boundingSphere = o;
18349
18374
  }
18350
- function Wg(e, t, n) {
18375
+ function Gg(e, t, n) {
18351
18376
  let r = t.attributes, i = [];
18352
18377
  function a(t, r) {
18353
18378
  return n.getDependency("accessor", t).then(function(t) {
@@ -18355,7 +18380,7 @@ function Wg(e, t, n) {
18355
18380
  });
18356
18381
  }
18357
18382
  for (let t in r) {
18358
- let n = Og[t] || t.toLowerCase();
18383
+ let n = kg[t] || t.toLowerCase();
18359
18384
  n in e.attributes || i.push(a(r[t], n));
18360
18385
  }
18361
18386
  if (t.indices !== void 0 && !e.index) {
@@ -18364,59 +18389,59 @@ function Wg(e, t, n) {
18364
18389
  });
18365
18390
  i.push(r);
18366
18391
  }
18367
- return W.workingColorSpace !== "srgb-linear" && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${W.workingColorSpace}" not supported.`), Pg(e, t), Ug(e, t, n), Promise.all(i).then(function() {
18368
- return t.targets === void 0 ? e : Fg(e, t.targets, n);
18392
+ return W.workingColorSpace !== "srgb-linear" && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${W.workingColorSpace}" not supported.`), Fg(e, t), Wg(e, t, n), Promise.all(i).then(function() {
18393
+ return t.targets === void 0 ? e : Ig(e, t.targets, n);
18369
18394
  });
18370
18395
  }
18371
18396
  //#endregion
18372
18397
  //#region src/placement.ts
18373
- var Gg = 6378137, Kg = Math.PI / 180, qg = 2, Jg = 134217728, Yg = (e) => Gg * e * Kg, Xg = (e) => Gg * Math.log(Math.tan(Math.PI / 4 + e * Kg / 2)), Zg = (e) => e / Gg / Kg, Qg = (e) => (2 * Math.atan(Math.exp(e / Gg)) - Math.PI / 2) / Kg, $g = (e) => .5 + e / (2 * Math.PI * Gg), e_ = (e) => .5 - e / (2 * Math.PI * Gg), t_ = (e) => (e - .5) * 2 * Math.PI * Gg, n_ = (e) => (.5 - e) * 2 * Math.PI * Gg;
18374
- function r_(e) {
18375
- return 1 / Math.cos(e * Kg);
18398
+ var Kg = 6378137, qg = Math.PI / 180, Jg = 2, Yg = 134217728, Xg = (e) => Kg * e * qg, Zg = (e) => Kg * Math.log(Math.tan(Math.PI / 4 + e * qg / 2)), Qg = (e) => e / Kg / qg, $g = (e) => (2 * Math.atan(Math.exp(e / Kg)) - Math.PI / 2) / qg, e_ = (e) => .5 + e / (2 * Math.PI * Kg), t_ = (e) => .5 - e / (2 * Math.PI * Kg), n_ = (e) => (e - .5) * 2 * Math.PI * Kg, r_ = (e) => (.5 - e) * 2 * Math.PI * Kg;
18399
+ function i_(e) {
18400
+ return 1 / Math.cos(e * qg);
18376
18401
  }
18377
- var i_ = 65536;
18378
- function a_(e, t) {
18379
- let n = Math.floor(e / i_), r = n * i_;
18402
+ var a_ = 65536;
18403
+ function o_(e, t) {
18404
+ let n = Math.floor(e / a_), r = n * a_;
18380
18405
  return {
18381
18406
  index: n,
18382
18407
  start: r,
18383
- cell: t * r_(Qg(r + i_ / 2))
18408
+ cell: t * i_($g(r + a_ / 2))
18384
18409
  };
18385
18410
  }
18386
- function o_(e) {
18411
+ function s_(e) {
18387
18412
  let t = Array(e.length * 2);
18388
- for (let n = 0; n < e.length; n++) t[n * 2] = Yg(e[n][0]), t[n * 2 + 1] = Xg(e[n][1]);
18413
+ for (let n = 0; n < e.length; n++) t[n * 2] = Xg(e[n][0]), t[n * 2 + 1] = Zg(e[n][1]);
18389
18414
  return t;
18390
18415
  }
18391
- function s_(e, t) {
18416
+ function c_(e, t) {
18392
18417
  let n = Math.imul(e | 0, 668265261) ^ Math.imul(t | 0, 374761393);
18393
18418
  return n = Math.imul(n ^ n >>> 15, 625341585), n = Math.imul(n ^ n >>> 13, 668265261), (n ^ n >>> 16) >>> 0;
18394
18419
  }
18395
- function c_(e, t) {
18396
- return Math.round(e * qg) * Jg + Math.round(t * qg);
18420
+ function l_(e, t) {
18421
+ return Math.round(e * Jg) * Yg + Math.round(t * Jg);
18397
18422
  }
18398
- function l_(e, t, n, r, i) {
18399
- let a = Math.round(e * qg), o = Math.round(t * qg), s = s_(a, o);
18423
+ function u_(e, t, n, r, i) {
18424
+ let a = Math.round(e * Jg), o = Math.round(t * Jg), s = c_(a, o);
18400
18425
  if (i && !i(e, t, s)) return !0;
18401
- let c = a * Jg + o;
18426
+ let c = a * Yg + o;
18402
18427
  return n.has(c) ? !0 : (n.add(c), r({
18403
- lng: Zg(e),
18404
- lat: Qg(t),
18428
+ lng: Qg(e),
18429
+ lat: $g(t),
18405
18430
  id: s,
18406
18431
  x: e,
18407
18432
  y: t
18408
18433
  }));
18409
18434
  }
18410
- function u_(e, t, n, r, i) {
18435
+ function d_(e, t, n, r, i) {
18411
18436
  for (let a of e) {
18412
18437
  if (a.length < 2) continue;
18413
- let e = o_(a), o = a_(e[1], t).cell, s = (s_(Math.round(e[0] / o), Math.round(e[1] / o)) & 65535) / 65536 * o, c = 0;
18438
+ let e = s_(a), o = o_(e[1], t).cell, s = (c_(Math.round(e[0] / o), Math.round(e[1] / o)) & 65535) / 65536 * o, c = 0;
18414
18439
  for (let a = 2; a < e.length; a += 2) {
18415
- let o = e[a - 2], l = e[a - 1], u = a_(l, t).cell, d = Math.hypot(e[a] - o, e[a + 1] - l);
18440
+ let o = e[a - 2], l = e[a - 1], u = o_(l, t).cell, d = Math.hypot(e[a] - o, e[a + 1] - l);
18416
18441
  if (d !== 0) {
18417
18442
  for (; s <= c + d;) {
18418
18443
  let t = (s - c) / d, f = o + (e[a] - o) * t, p = l + (e[a + 1] - l) * t;
18419
- if (f >= n.minX && f <= n.maxX && p >= n.minY && p <= n.maxY && !l_(f, p, r, i)) return !1;
18444
+ if (f >= n.minX && f <= n.maxX && p >= n.minY && p <= n.maxY && !u_(f, p, r, i)) return !1;
18420
18445
  s += u;
18421
18446
  }
18422
18447
  c += d;
@@ -18425,15 +18450,15 @@ function u_(e, t, n, r, i) {
18425
18450
  }
18426
18451
  return !0;
18427
18452
  }
18428
- function d_(e, t, n, r, i, a = 1, o, s) {
18453
+ function f_(e, t, n, r, i, a = 1, o, s) {
18429
18454
  let c = [];
18430
18455
  for (let l of e) {
18431
- let e = l.map(o_), u = Infinity, d = -Infinity;
18456
+ let e = l.map(s_), u = Infinity, d = -Infinity;
18432
18457
  for (let t of e) for (let e = 1; e < t.length; e += 2) t[e] < u && (u = t[e]), t[e] > d && (d = t[e]);
18433
18458
  if (u = Math.max(u, n.minY), d = Math.min(d, n.maxY), u > d) continue;
18434
- let f = Math.floor(u / i_), p = Math.floor(d / i_);
18459
+ let f = Math.floor(u / a_), p = Math.floor(d / a_);
18435
18460
  for (let l = f; l <= p; l++) {
18436
- let { start: f, cell: p } = a_(l * i_, t), m = Math.floor(i_ / p), h = Math.max(0, Math.ceil((u - f) / p - .5)), g = Math.min(m - 1, Math.floor((d - f) / p - .5));
18461
+ let { start: f, cell: p } = o_(l * a_, t), m = Math.floor(a_ / p), h = Math.max(0, Math.ceil((u - f) / p - .5)), g = Math.min(m - 1, Math.floor((d - f) / p - .5));
18437
18462
  for (let t = h; t <= g; t++) {
18438
18463
  let u = f + (t + .5) * p, d = o ? o(f + t * p, f + (t + 1) * p) : null;
18439
18464
  if (o && !d) continue;
@@ -18445,14 +18470,14 @@ function d_(e, t, n, r, i, a = 1, o, s) {
18445
18470
  }
18446
18471
  if (c.length < 2) continue;
18447
18472
  c.sort((e, t) => e - t);
18448
- let g = s_(l, t);
18473
+ let g = c_(l, t);
18449
18474
  for (let e = 0; e + 1 < c.length; e += 2) {
18450
18475
  let o = Math.max(c[e], n.minX, m), l = Math.min(c[e + 1], n.maxX, h);
18451
18476
  if (o > l) continue;
18452
18477
  let u = Math.floor(l / p - .5);
18453
18478
  for (let e = Math.ceil(o / p - .5); e <= u; e++) {
18454
- let n = s_(e, g);
18455
- if (!(a < 1 && s_(n, 40503) / 4294967296 >= a) && !l_((e + (n & 65535) / 65536) * p, f + (t + (n >>> 16 & 65535) / 65536) * p, r, i, s)) return !1;
18479
+ let n = c_(e, g);
18480
+ if (!(a < 1 && c_(n, 40503) / 4294967296 >= a) && !u_((e + (n & 65535) / 65536) * p, f + (t + (n >>> 16 & 65535) / 65536) * p, r, i, s)) return !1;
18456
18481
  }
18457
18482
  }
18458
18483
  }
@@ -18460,39 +18485,39 @@ function d_(e, t, n, r, i, a = 1, o, s) {
18460
18485
  }
18461
18486
  return !0;
18462
18487
  }
18463
- function f_(e) {
18488
+ function p_(e) {
18464
18489
  let t = 0;
18465
18490
  for (let n of e) for (let e = 0; e < n.length; e++) {
18466
- let r = o_(n[e]), i = 0;
18491
+ let r = s_(n[e]), i = 0;
18467
18492
  for (let e = 0, t = r.length - 2; e < r.length; t = e, e += 2) i += r[t] * r[e + 1] - r[e] * r[t + 1];
18468
18493
  t += (e === 0 ? 1 : -1) * Math.abs(i / 2);
18469
18494
  }
18470
18495
  return Math.max(0, t);
18471
18496
  }
18472
- function p_(e) {
18497
+ function m_(e) {
18473
18498
  let t = 0;
18474
18499
  for (let n of e) {
18475
- let e = o_(n);
18500
+ let e = s_(n);
18476
18501
  for (let n = 2; n < e.length; n += 2) t += Math.hypot(e[n] - e[n - 2], e[n + 1] - e[n - 1]);
18477
18502
  }
18478
18503
  return t;
18479
18504
  }
18480
18505
  //#endregion
18481
18506
  //#region src/GltfManager.ts
18482
- var m_ = Math.PI / 180, h_ = 25, g_ = (e) => e.radius < h_ && e.top - e.bottom < h_, __ = .25, v_ = .1, y_ = 16, b_ = 1, x_ = 1.2, S_ = .1, C_ = 150, w_ = 1.5, T_ = 20, E_ = (e) => `\u0000impostor:${e}`, D_ = new G().makeScale(-1, 1, 1), O_ = 128, k_ = "\n#include <map_fragment>\n#ifdef USE_MAP\n diffuseColor.rgb /= max( sampledDiffuseColor.a, 0.0001 );\n#endif\n", A_ = 20, j_ = "\nuniform vec3 mtkRight;\n#include <common>\n", M_ = "\nvec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = vec4(\n instanceMatrix[ 3 ].xyz\n + mtkRight * transformed.x * length( instanceMatrix[ 0 ].xyz )\n + vec3( 0.0, transformed.y * length( instanceMatrix[ 1 ].xyz ), 0.0 ),\n 1.0\n );\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;\n", N_ = "\n#include <color_pars_vertex>\n#ifdef MTK_INSTANCE_ALPHA\n attribute float instanceAlpha;\n varying float vInstanceAlpha;\n#endif\n", P_ = "\n#include <color_vertex>\n#ifdef MTK_INSTANCE_ALPHA\n vInstanceAlpha = instanceAlpha;\n#endif\n", F_ = "\n#include <color_pars_fragment>\n#if defined( USE_INSTANCING_COLOR ) && !defined( USE_COLOR ) && !defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#endif\n#ifdef MTK_INSTANCE_ALPHA\n varying float vInstanceAlpha;\n#endif\n#ifdef MTK_OPACITY\n uniform float mtkOpacity;\n#endif\n", I_ = "\n#ifdef MTK_INSTANCE_ALPHA\n diffuseColor.a *= vInstanceAlpha;\n#endif\n#ifdef MTK_OPACITY\n diffuseColor.a *= mtkOpacity;\n#endif\n", L_ = `
18507
+ var h_ = Math.PI / 180, g_ = 25, __ = (e) => e.radius < g_ && e.top - e.bottom < g_, v_ = .25, y_ = .1, b_ = 16, x_ = 1, S_ = 1.2, C_ = .1, w_ = 150, T_ = 500, E_ = y_ / 2, D_ = y_ / 2 * (180 / Math.PI), O_ = .07, k_ = 2, A_ = 1.5, j_ = 20, M_ = (e) => `\u0000impostor:${e}`, N_ = new G().makeScale(-1, 1, 1), P_ = 128, F_ = "\n#include <map_fragment>\n#ifdef USE_MAP\n diffuseColor.rgb /= max( sampledDiffuseColor.a, 0.0001 );\n#endif\n", I_ = 20, L_ = "\nuniform vec3 mtkRight;\n#include <common>\n", R_ = "\nvec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = vec4(\n instanceMatrix[ 3 ].xyz\n + mtkRight * transformed.x * length( instanceMatrix[ 0 ].xyz )\n + vec3( 0.0, transformed.y * length( instanceMatrix[ 1 ].xyz ), 0.0 ),\n 1.0\n );\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;\n", z_ = "\n#include <color_pars_vertex>\n#ifdef MTK_INSTANCE_ALPHA\n attribute float instanceAlpha;\n varying float vInstanceAlpha;\n#endif\n", B_ = "\n#include <color_vertex>\n#ifdef MTK_INSTANCE_ALPHA\n vInstanceAlpha = instanceAlpha;\n#endif\n", V_ = "\n#include <color_pars_fragment>\n#if defined( USE_INSTANCING_COLOR ) && !defined( USE_COLOR ) && !defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#endif\n#ifdef MTK_INSTANCE_ALPHA\n varying float vInstanceAlpha;\n#endif\n#ifdef MTK_OPACITY\n uniform float mtkOpacity;\n#endif\n", H_ = "\n#ifdef MTK_INSTANCE_ALPHA\n diffuseColor.a *= vInstanceAlpha;\n#endif\n#ifdef MTK_OPACITY\n diffuseColor.a *= mtkOpacity;\n#endif\n", U_ = `
18483
18508
  #include <color_fragment>
18484
18509
  #if defined( USE_INSTANCING_COLOR ) && !defined( USE_COLOR ) && !defined( USE_COLOR_ALPHA )
18485
18510
  diffuseColor.rgb *= vColor.rgb;
18486
18511
  #endif
18487
18512
  #ifndef MTK_ALPHA_AFTER_TEST
18488
- ${I_}
18513
+ ${H_}
18489
18514
  #endif
18490
- `, R_ = `
18515
+ `, W_ = `
18491
18516
  #include <alphatest_fragment>
18492
18517
  #ifdef MTK_ALPHA_AFTER_TEST
18493
- ${I_}
18518
+ ${H_}
18494
18519
  #endif
18495
- `, z_ = class {
18520
+ `, G_ = class {
18496
18521
  origin;
18497
18522
  map;
18498
18523
  group;
@@ -18501,7 +18526,7 @@ ${I_}
18501
18526
  config;
18502
18527
  models = new globalThis.Map();
18503
18528
  batches = new globalThis.Map();
18504
- loader = new Kh();
18529
+ loader = new qh();
18505
18530
  filter;
18506
18531
  warned = /* @__PURE__ */ new Set();
18507
18532
  patched = /* @__PURE__ */ new WeakSet();
@@ -18518,6 +18543,10 @@ ${I_}
18518
18543
  onData;
18519
18544
  onMoveEnd;
18520
18545
  unwatchGlobalState;
18546
+ lastMoveEnd = -Infinity;
18547
+ lastMoveRefresh = -Infinity;
18548
+ moveTimer;
18549
+ builtView;
18521
18550
  paintRafId;
18522
18551
  needsRead = !1;
18523
18552
  needsBuild = !1;
@@ -18533,7 +18562,7 @@ ${I_}
18533
18562
  sMat = new G();
18534
18563
  sColor = new K();
18535
18564
  constructor(e, t, n, r, i) {
18536
- this.map = e, this.scene = t, this.terrainSourceId = r, this.config = i, this.origin = q_(n), this.filter = Im(i.filter, "filter").filter, this.group = new On(), t.add(this.group);
18565
+ this.map = e, this.scene = t, this.terrainSourceId = r, this.config = i, this.origin = $_(n), this.filter = Im(i.filter, "filter").filter, this.group = new On(), t.add(this.group);
18537
18566
  let a = e.getSource(i.sourceId);
18538
18567
  a || console.error(`GltfLayer: source '${i.sourceId}' not found — add it before the layer`), this.wholeDataset = a?.type === "geojson";
18539
18568
  for (let [e, t] of Object.entries(i.models)) this.loadModel(e, t);
@@ -18543,15 +18572,27 @@ ${I_}
18543
18572
  let e = t.tile.tileID.canonical;
18544
18573
  this.pendingDemRegions.push(du(e.x, e.y, e.z)), this.schedule();
18545
18574
  } else t.sourceId === this.config.sourceId && this.refreshSoon();
18546
- }, this.onMoveEnd = () => this.wholeDataset ? this.schedule(!1, !0) : this.refresh(), e.on("data", this.onData), e.on("moveend", this.onMoveEnd);
18547
- let o = (...e) => e.flatMap((e) => e ? [...e.globalStateRefs] : []), { color: s, opacity: c } = i, l = (t) => () => {
18575
+ };
18576
+ let o = () => {
18577
+ this.lastMoveRefresh = performance.now(), this.wholeDataset ? this.schedule(!1, !0) : this.refresh();
18578
+ };
18579
+ this.onMoveEnd = () => {
18580
+ let t = performance.now(), n = t - this.lastMoveEnd < T_;
18581
+ if (this.lastMoveEnd = t, this.moveTimer !== void 0 && clearTimeout(this.moveTimer), this.moveTimer = void 0, !n) return o();
18582
+ let r = lv(e);
18583
+ if (t - this.lastMoveRefresh >= T_ && (!this.builtView || fv(this.builtView, r))) return o();
18584
+ this.moveTimer = setTimeout(() => {
18585
+ this.moveTimer = void 0, !this.disposed && (!this.builtView || !dv(this.builtView, lv(e))) && o();
18586
+ }, T_);
18587
+ }, e.on("data", this.onData), e.on("moveend", this.onMoveEnd);
18588
+ let s = (...e) => e.flatMap((e) => e ? [...e.globalStateRefs] : []), { color: c, opacity: l } = i, u = (t) => () => {
18548
18589
  e.isMoving() || t();
18549
18590
  };
18550
18591
  this.unwatchGlobalState = [
18551
- lh(e, o(s, this.instanceOpacity ? c : void 0), () => this.schedulePaint()),
18552
- lh(e, o(c), () => e.triggerRepaint()),
18553
- lh(e, o(i.modelId, i.rotation, i.scale, i.translation, i.spacing, i.thinningDistance, i.impostorDistance), l(() => this.schedule(!1, !0))),
18554
- lh(e, Im(i.filter, "filter").getGlobalStateRefs(), l(() => this.refresh()))
18592
+ lh(e, s(c, this.instanceOpacity ? l : void 0), () => this.schedulePaint()),
18593
+ lh(e, s(l), () => e.triggerRepaint()),
18594
+ lh(e, s(i.modelId, i.rotation, i.scale, i.translation, i.spacing, i.thinningDistance, i.impostorDistance), u(() => this.schedule(!1, !0))),
18595
+ lh(e, Im(i.filter, "filter").getGlobalStateRefs(), u(() => this.refresh()))
18555
18596
  ], this.refresh();
18556
18597
  }
18557
18598
  get instanceOpacity() {
@@ -18569,7 +18610,7 @@ ${I_}
18569
18610
  refreshSoon() {
18570
18611
  this.disposed || (this.settleTimer !== void 0 && clearTimeout(this.settleTimer), this.settleTimer = setTimeout(() => {
18571
18612
  this.settleTimer = void 0, this.map.isMoving() || this.refresh();
18572
- }, C_));
18613
+ }, w_));
18573
18614
  }
18574
18615
  refresh() {
18575
18616
  this.schedule(!0, !0);
@@ -18599,7 +18640,7 @@ ${I_}
18599
18640
  let e = this.pendingDemRegions;
18600
18641
  if (this.pendingDemRegions = [], e.length === 0) return;
18601
18642
  let t = 0;
18602
- for (let n of this.batches.values()) e.some((e) => uv(e, n.bounds)) && (this.writeInstances(n), t++);
18643
+ for (let n of this.batches.values()) e.some((e) => bv(e, n.bounds)) && (this.writeInstances(n), t++);
18603
18644
  t && this.map.triggerRepaint();
18604
18645
  }
18605
18646
  hidden() {
@@ -18617,7 +18658,7 @@ ${I_}
18617
18658
  return this.warnOnce("query", "GltfLayer: querySourceFeatures failed", t), e;
18618
18659
  }
18619
18660
  for (let n of t) {
18620
- let t = W_(n.geometry);
18661
+ let t = X_(n.geometry);
18621
18662
  t && e.push({
18622
18663
  geometry: n.geometry,
18623
18664
  bbox: t,
@@ -18642,10 +18683,10 @@ ${I_}
18642
18683
  zoom: this.map.getZoom(),
18643
18684
  globalState: ch(this.map)
18644
18685
  };
18645
- for (let e of G_(t)) {
18646
- let t = e.properties ?? {}, i = W_(e.geometry);
18686
+ for (let e of Z_(t)) {
18687
+ let t = e.properties ?? {}, i = X_(e.geometry);
18647
18688
  i && this.filter(r, {
18648
- type: U_(e.geometry),
18689
+ type: Y_(e.geometry),
18649
18690
  properties: t,
18650
18691
  id: e.id
18651
18692
  }) && n.push({
@@ -18658,6 +18699,7 @@ ${I_}
18658
18699
  this.features = n;
18659
18700
  }
18660
18701
  build() {
18702
+ this.builtView = lv(this.map);
18661
18703
  let e = this.map.getZoom(), n = ch(this.map), r = t.fromLngLat(this.map.getCenter(), 0);
18662
18704
  this.origin = {
18663
18705
  x: r.x,
@@ -18665,7 +18707,7 @@ ${I_}
18665
18707
  z: r.z,
18666
18708
  s: r.meterInMercatorCoordinateUnits()
18667
18709
  };
18668
- let i = Z_(this.map), a = this.config.thinningDistance(e, {}, void 0, n), o = Number.isFinite(a) && a > 0 ? cv(this.map) : void 0, s = o ? a * 7 * o.s : Infinity, c = this.config.impostorDistance(e, {}, void 0, n), l = Number.isFinite(c) ? o ?? cv(this.map) : void 0, u = this.map.getCanvas(), d = Math.hypot(u.clientWidth, u.clientHeight) / 2 * 1.1 / (512 * 2 ** e);
18710
+ let i = rv(this.map), a = this.config.thinningDistance(e, {}, void 0, n), o = Number.isFinite(a) && a > 0 ? vv(this.map) : void 0, s = o ? a * 7 * o.s : Infinity, c = this.config.impostorDistance(e, {}, void 0, n), l = Number.isFinite(c) ? o ?? vv(this.map) : void 0, u = this.map.getCanvas(), d = Math.hypot(u.clientWidth, u.clientHeight) / 2 * 1.1 / (512 * 2 ** e);
18669
18711
  if (o) {
18670
18712
  let e = new t(o.x - s, o.y - s).toLngLat(), n = new t(o.x + s, o.y + s).toLngLat();
18671
18713
  i = {
@@ -18676,17 +18718,17 @@ ${I_}
18676
18718
  };
18677
18719
  }
18678
18720
  let f = {
18679
- minX: Yg(i.west),
18680
- minY: Xg(i.south),
18681
- maxX: Yg(i.east),
18682
- maxY: Xg(i.north)
18683
- }, p = this.maxReach(e, n), m = this.features.filter((e) => uv(J_(i, p), e.bbox)), h = this.config.maxInstances, g = h * T_, { cells: _, keep: v } = this.planCells(m, e, n, i, g), y = rv(this.map, v_), b = this.viewMatrix ? X_(this.viewMatrix, v_) : void 0, x = this.map.terrain ? this.map.getCenterElevation() : 0, S = iv(this.map, v_, o, s), C = o ? Math.min(1, this.lastThinScale * w_) : 1, w = o ? (e, t, n) => $_(Math.hypot($g(e) - o.x, e_(t) - o.y) / o.s, a, n) < C : void 0, T = /* @__PURE__ */ new Set(), E = Math.round(this.config.maxInstances * x_), D = 0, O = [], k = new globalThis.Map(), A = (t, r) => {
18684
- let i = r.x === void 0 ? tv(r.lng) : $g(r.x), s = r.y === void 0 ? nv(r.lat) : e_(r.y), c = b ? this.reachOf(t, r.id, e, n) : void 0;
18721
+ minX: Xg(i.west),
18722
+ minY: Zg(i.south),
18723
+ maxX: Xg(i.east),
18724
+ maxY: Zg(i.north)
18725
+ }, p = this.maxReach(e, n), m = this.features.filter((e) => bv(ev(i, p), e.bbox)), h = this.config.maxInstances, g = h * j_, { cells: _, keep: v } = this.planCells(m, e, n, i, g), y = pv(this.map, y_), b = this.viewMatrix ? nv(this.viewMatrix, y_) : void 0, x = this.map.terrain ? this.map.getCenterElevation() : 0, S = mv(this.map, y_, o, s), C = o ? Math.min(1, this.lastThinScale * A_) : 1, w = o ? (e, t, n) => av(Math.hypot(e_(e) - o.x, t_(t) - o.y) / o.s, a, n) < C : void 0, T = /* @__PURE__ */ new Set(), E = Math.round(this.config.maxInstances * S_), D = 0, O = [], k = new globalThis.Map(), A = (t, r) => {
18726
+ let i = r.x === void 0 ? sv(r.lng) : e_(r.x), s = r.y === void 0 ? cv(r.lat) : t_(r.y), c = b ? this.reachOf(t, r.id, e, n) : void 0;
18685
18727
  if (c && b) {
18686
18728
  let e = this.origin.s;
18687
18729
  if (!b(i, s, c.radius * e, (x + c.bottom) * e, (x + c.top) * e)) return !0;
18688
18730
  } else if (y && !y(i, s)) return !0;
18689
- let l = c && o ? Math.max(0, Math.hypot(i - o.x, s - o.y) - c.radius * o.s) : 0, u = o ? $_((c ? l : Math.hypot(i - o.x, s - o.y)) / o.s, a, r.id) : 0;
18731
+ let l = c && o ? Math.max(0, Math.hypot(i - o.x, s - o.y) - c.radius * o.s) : 0, u = o ? av((c ? l : Math.hypot(i - o.x, s - o.y)) / o.s, a, r.id) : 0;
18690
18732
  return u >= C || (O.push({
18691
18733
  f: t,
18692
18734
  point: r,
@@ -18698,7 +18740,7 @@ ${I_}
18698
18740
  let o = r.id, s = this.config.modelId(e, t.props, o, n), u = this.models.get(s);
18699
18741
  if (!u) return this.warnOnce(`model:${s}`, `GltfLayer: no model '${s}' in \`models\` — feature skipped`), !0;
18700
18742
  if (u.state !== "ready") return !0;
18701
- let f = l !== void 0 && Math.hypot(i - l.x, a - l.y) / l.s >= c && Math.hypot(i - this.origin.x, a - this.origin.y) > d && this.models.get(E_(s))?.state === "ready" ? E_(s) : s, p = k.get(f);
18743
+ let f = l !== void 0 && Math.hypot(i - l.x, a - l.y) / l.s >= c && Math.hypot(i - this.origin.x, a - this.origin.y) > d && this.models.get(M_(s))?.state === "ready" ? M_(s) : s, p = k.get(f);
18702
18744
  return p || k.set(f, p = {
18703
18745
  recs: [],
18704
18746
  colors: this.config.color ? [] : void 0,
@@ -18720,8 +18762,8 @@ ${I_}
18720
18762
  let t = m[e], n = _[e];
18721
18763
  switch (this.placementFor(t)) {
18722
18764
  case "point":
18723
- for (let [e, n] of B_(t.geometry)) {
18724
- let r = c_(Yg(e), Xg(n));
18765
+ for (let [e, n] of K_(t.geometry)) {
18766
+ let r = l_(Xg(e), Zg(n));
18725
18767
  if (!T.has(r) && (T.add(r), !A(t, {
18726
18768
  lng: e,
18727
18769
  lat: n,
@@ -18730,30 +18772,30 @@ ${I_}
18730
18772
  }
18731
18773
  break;
18732
18774
  case "line":
18733
- if (!u_(V_(t.geometry), n, f, T, (e) => A(t, e))) break outer;
18775
+ if (!d_(q_(t.geometry), n, f, T, (e) => A(t, e))) break outer;
18734
18776
  break;
18735
- case "fill": if (!d_(H_(t.geometry), n, f, T, (e) => A(t, e), v, S, w)) break outer;
18777
+ case "fill": if (!f_(J_(t.geometry), n, f, T, (e) => A(t, e), v, S, w)) break outer;
18736
18778
  }
18737
18779
  }
18738
18780
  };
18739
18781
  if (te(), C < 1 && O.length <= h && (C = 1, te()), O.length) {
18740
- let e = o ? ev(O, h) : 1;
18782
+ let e = o ? ov(O, h) : 1;
18741
18783
  o && (this.lastThinScale = e);
18742
18784
  let t = o ? 1 : Math.min(1, h / O.length);
18743
18785
  t < 1 && this.warnOnce("budget", `GltfLayer: ${O.length} instances in view exceed maxInstances (${h}) — keeping ${(t * 100).toFixed(0)}% of them; raise maxInstances, use a zoom-driven model-spacing or set model-thinning-distance`);
18744
- for (let n of O) if (!(o ? n.need >= e : Q_(n.point.id) >= t) && !ee(n.f, n.point, n.x, n.y)) break;
18786
+ for (let n of O) if (!(o ? n.need >= e : iv(n.point.id) >= t) && !ee(n.f, n.point, n.x, n.y)) break;
18745
18787
  }
18746
18788
  for (let [e, t] of this.batches) k.has(e) || this.disposeBatch(e, t);
18747
18789
  this.instanceFading = [...k.values()].some((e) => e.alphas?.some((e) => e < 1)), this.setFading(this.instanceFading || this.uniformFading);
18748
18790
  for (let [e, t] of k) {
18749
18791
  let n = this.batchFor(e, t.recs.length);
18750
- n.recs = t.recs, n.bounds = lv(t.recs), this.writeInstances(n, t.colors, t.alphas);
18792
+ n.recs = t.recs, n.bounds = yv(t.recs), this.writeInstances(n, t.colors, t.alphas);
18751
18793
  }
18752
18794
  this.map.triggerRepaint();
18753
18795
  }
18754
18796
  reachOf(e, t, n, r) {
18755
18797
  let i = this.models.get(this.config.modelId(n, e.props, t, r))?.extent;
18756
- if (!i || g_(i)) return;
18798
+ if (!i || __(i)) return;
18757
18799
  let a = this.config.scale(n, e.props, t, r), o = this.config.translation(n, e.props, t, r), s = this.config.rotation(n, e.props, t, r), c = Math.max(Math.abs(a[0]), Math.abs(a[2])), l = i.bottom * a[1], u = i.top * a[1], d = i.radius * c + Math.hypot(o[0], o[1]), f = Math.min(l, u) + o[2], p = Math.max(l, u) + o[2];
18758
18800
  return (s[0] || s[1]) && (d = Math.max(d, Math.abs(f), Math.abs(p)), f = Math.min(f, -d), p = Math.max(p, d)), {
18759
18801
  radius: d,
@@ -18765,7 +18807,7 @@ ${I_}
18765
18807
  let n = 0;
18766
18808
  for (let e of this.models.values()) {
18767
18809
  let t = e.extent;
18768
- t && !g_(t) && (n = Math.max(n, Math.hypot(t.radius, Math.max(Math.abs(t.top), Math.abs(t.bottom)))));
18810
+ t && !__(t) && (n = Math.max(n, Math.hypot(t.radius, Math.max(Math.abs(t.top), Math.abs(t.bottom)))));
18769
18811
  }
18770
18812
  if (!n) return 0;
18771
18813
  let { scale: r, translation: i } = this.config, a = (a, o) => {
@@ -18796,13 +18838,13 @@ ${I_}
18796
18838
  continue;
18797
18839
  }
18798
18840
  if (c === "point") {
18799
- a[i] = 0, o += B_(s.geometry).length;
18841
+ a[i] = 0, o += K_(s.geometry).length;
18800
18842
  continue;
18801
18843
  }
18802
- let l = Math.max(b_, this.config.spacing(t, s.props, s.id, n));
18844
+ let l = Math.max(x_, this.config.spacing(t, s.props, s.id, n));
18803
18845
  a[i] = l;
18804
- let u = l * r_((s.bbox.south + s.bbox.north) / 2);
18805
- o += c === "fill" ? f_(H_(s.geometry)) / (u * u) * sv(s.bbox, r) : p_(V_(s.geometry)) / u;
18846
+ let u = l * i_((s.bbox.south + s.bbox.north) / 2);
18847
+ o += c === "fill" ? p_(J_(s.geometry)) / (u * u) * _v(s.bbox, r) : m_(q_(s.geometry)) / u;
18806
18848
  }
18807
18849
  if (o <= i) return {
18808
18850
  cells: a,
@@ -18816,9 +18858,9 @@ ${I_}
18816
18858
  }
18817
18859
  batchFor(e, t) {
18818
18860
  let n = this.batches.get(e);
18819
- if (n && t <= n.capacity && (n.capacity <= y_ || t * 4 >= n.capacity)) return n;
18861
+ if (n && t <= n.capacity && (n.capacity <= b_ || t * 4 >= n.capacity)) return n;
18820
18862
  n && this.disposeBatch(e, n);
18821
- let r = this.models.get(e), i = Math.max(y_, K_(t)), a = [], o;
18863
+ let r = this.models.get(e), i = Math.max(b_, Q_(t)), a = [], o;
18822
18864
  this.instanceOpacity && (o = new bi(new Float32Array(i), 1));
18823
18865
  for (let e of r.protos) {
18824
18866
  let t = new Oi(e.geometry, e.material, i);
@@ -18843,7 +18885,7 @@ ${I_}
18843
18885
  let r = e.recs.length, i = cu(this.map);
18844
18886
  for (let t = 0; t < r; t++) {
18845
18887
  let n = e.recs[t], r = i(n.lng, n.lat);
18846
- this.sPos.set(n.east + n.tr[0], r + n.tr[2], n.north + n.tr[1]), this.sEuler.set(n.rot[0] * m_, n.rot[2] * m_, n.rot[1] * m_, "YXZ"), this.sQuat.setFromEuler(this.sEuler), this.sScale.set(n.scl[0], n.scl[1], n.scl[2]), this.sBase.compose(this.sPos, this.sQuat, this.sScale);
18888
+ this.sPos.set(n.east + n.tr[0], r + n.tr[2], n.north + n.tr[1]), this.sEuler.set(n.rot[0] * h_, n.rot[2] * h_, n.rot[1] * h_, "YXZ"), this.sQuat.setFromEuler(this.sEuler), this.sScale.set(n.scl[0], n.scl[1], n.scl[2]), this.sBase.compose(this.sPos, this.sQuat, this.sScale);
18847
18889
  for (let n = 0; n < e.meshes.length; n++) this.sMat.multiplyMatrices(this.sBase, e.protos[n].matrix), e.meshes[n].setMatrixAt(t, this.sMat);
18848
18890
  }
18849
18891
  for (let t of e.meshes) t.count = r, t.instanceMatrix.needsUpdate = !0, t.computeBoundingSphere();
@@ -18885,7 +18927,7 @@ ${I_}
18885
18927
  protos: []
18886
18928
  };
18887
18929
  this.models.set(e, n), this.loader.load(t, (e) => {
18888
- this.disposed || (n.protos = this.flatten(e.scene), n.extent = Y_(n.protos), n.state = "ready", this.schedule(!1, !0));
18930
+ this.disposed || (n.protos = this.flatten(e.scene), n.extent = tv(n.protos), n.state = "ready", this.schedule(!1, !0));
18889
18931
  }, void 0, (r) => {
18890
18932
  n.state = "error", console.error(`GltfLayer: failed to load model '${e}' (${t})`, r);
18891
18933
  });
@@ -18905,15 +18947,15 @@ ${I_}
18905
18947
  }
18906
18948
  let i = Array.isArray(r.material) ? r.material : [r.material];
18907
18949
  for (let e of i) this.patchMaterial(e);
18908
- av(r.geometry, n), t.push({
18950
+ hv(r.geometry, n), t.push({
18909
18951
  geometry: r.geometry,
18910
18952
  material: r.material,
18911
- matrix: D_.clone().multiply(r.matrixWorld).multiply(D_)
18953
+ matrix: N_.clone().multiply(r.matrixWorld).multiply(N_)
18912
18954
  });
18913
18955
  }), this.config.doubleSided === void 0) {
18914
18956
  let e = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
18915
18957
  for (let r of t) {
18916
- let t = ov(r.geometry) <= S_;
18958
+ let t = gv(r.geometry) <= C_;
18917
18959
  for (let i of Array.isArray(r.material) ? r.material : [r.material]) n.add(i), t || e.add(i);
18918
18960
  }
18919
18961
  for (let t of n) t.side === 2 && !e.has(t) && (t.side = 0);
@@ -18933,11 +18975,11 @@ ${I_}
18933
18975
  needsImpostors() {
18934
18976
  let e = this.config.impostorDistance(this.map.getZoom(), {}, void 0, ch(this.map));
18935
18977
  if (!Number.isFinite(e)) return !1;
18936
- for (let [e, t] of this.models) if (t.state === "ready" && !e.startsWith("\0") && !this.models.has(E_(e))) return !0;
18978
+ for (let [e, t] of this.models) if (t.state === "ready" && !e.startsWith("\0") && !this.models.has(M_(e))) return !0;
18937
18979
  return !1;
18938
18980
  }
18939
18981
  bakeImpostors(e, t) {
18940
- for (let [n, r] of [...this.models]) r.state !== "ready" || n.startsWith("\0") || this.models.has(E_(n)) || this.models.set(E_(n), this.bakeImpostor(e, r, t));
18982
+ for (let [n, r] of [...this.models]) r.state !== "ready" || n.startsWith("\0") || this.models.has(M_(n)) || this.models.set(M_(n), this.bakeImpostor(e, r, t));
18941
18983
  this.schedule(!1, !0);
18942
18984
  }
18943
18985
  bakeImpostor(e, t, n) {
@@ -18951,7 +18993,7 @@ ${I_}
18951
18993
  }), n = new ni(e.geometry, Array.isArray(e.material) ? t : t[0]);
18952
18994
  n.matrixAutoUpdate = !1, n.matrix.copy(e.matrix), i.add(n), e.geometry.computeBoundingBox(), a.union(e.geometry.boundingBox.clone().applyMatrix4(e.matrix));
18953
18995
  }
18954
- let s = a.getCenter(new H()), c = Math.max(a.max.x - a.min.x, a.max.z - a.min.z) / 2 || .5, l = A_ * Math.PI / 180, u = c * 2 + (a.max.y - a.min.y) + 10, f = new bo(-1, 1, 1, -1, .1, u * 2);
18996
+ let s = a.getCenter(new H()), c = Math.max(a.max.x - a.min.x, a.max.z - a.min.z) / 2 || .5, l = I_ * Math.PI / 180, u = c * 2 + (a.max.y - a.min.y) + 10, f = new bo(-1, 1, 1, -1, .1, u * 2);
18955
18997
  f.position.set(s.x, s.y + Math.sin(l) * u, Math.cos(l) * u), f.lookAt(s.x, s.y, 0), f.updateMatrixWorld();
18956
18998
  let p = new Zn(), m = new H();
18957
18999
  for (let e of [s.x - c, s.x + c]) for (let t of [a.min.y, a.max.y]) for (let n of [-c, c]) p.expandByPoint(m.set(e, t, n).applyMatrix4(f.matrixWorldInverse));
@@ -18960,7 +19002,7 @@ ${I_}
18960
19002
  r.add(new no(n.color, 10132122, n.ambient));
18961
19003
  let v = new So(n.color, n.directional);
18962
19004
  v.position.copy(n.direction).normalize().multiplyScalar(1e3), r.add(v, v.target), r.environment = n.environment, r.environmentIntensity = n.environmentIntensity;
18963
- let y = new Zt(O_, Math.max(1, Math.round(O_ * g / h)), {
19005
+ let y = new Zt(P_, Math.max(1, Math.round(P_ * g / h)), {
18964
19006
  samples: 4,
18965
19007
  colorSpace: Ue
18966
19008
  });
@@ -18975,7 +19017,7 @@ ${I_}
18975
19017
  alphaTest: .5
18976
19018
  });
18977
19019
  return C.alphaToCoverage = !0, C.onBeforeCompile = (e) => {
18978
- e.uniforms.mtkRight = this.impostorRight, e.vertexShader = e.vertexShader.replace("#include <common>", j_).replace("#include <project_vertex>", M_), e.fragmentShader = e.fragmentShader.replace("#include <map_fragment>", k_);
19020
+ e.uniforms.mtkRight = this.impostorRight, e.vertexShader = e.vertexShader.replace("#include <common>", L_).replace("#include <project_vertex>", R_), e.fragmentShader = e.fragmentShader.replace("#include <map_fragment>", F_);
18979
19021
  }, this.patchMaterial(C), C.defines = {
18980
19022
  ...C.defines,
18981
19023
  MTK_ALPHA_AFTER_TEST: ""
@@ -19008,7 +19050,7 @@ ${I_}
19008
19050
  }, e.depthWrite = !0);
19009
19051
  let t = e.onBeforeCompile;
19010
19052
  e.onBeforeCompile = (n, r) => {
19011
- t?.call(e, n, r), this.uniformOpacity && (n.uniforms.mtkOpacity = this.opacityUniform), n.vertexShader = n.vertexShader.replace("#include <color_pars_vertex>", N_).replace("#include <color_vertex>", P_), n.fragmentShader = n.fragmentShader.replace("#include <color_pars_fragment>", F_).replace("#include <color_fragment>", L_).replace("#include <alphatest_fragment>", R_);
19053
+ t?.call(e, n, r), this.uniformOpacity && (n.uniforms.mtkOpacity = this.opacityUniform), n.vertexShader = n.vertexShader.replace("#include <color_pars_vertex>", z_).replace("#include <color_vertex>", B_), n.fragmentShader = n.fragmentShader.replace("#include <color_pars_fragment>", V_).replace("#include <color_fragment>", U_).replace("#include <alphatest_fragment>", W_);
19012
19054
  }, e.customProgramCacheKey = () => `mtk-gltf-${this.opacityKey}`, e.needsUpdate = !0;
19013
19055
  }
19014
19056
  get opacityKey() {
@@ -19020,7 +19062,7 @@ ${I_}
19020
19062
  dispose() {
19021
19063
  this.disposed = !0, this.map.off("data", this.onData), this.map.off("moveend", this.onMoveEnd), this.rafId !== void 0 && cancelAnimationFrame(this.rafId), this.paintRafId !== void 0 && cancelAnimationFrame(this.paintRafId);
19022
19064
  for (let e of this.unwatchGlobalState) e();
19023
- this.settleTimer !== void 0 && clearTimeout(this.settleTimer);
19065
+ this.settleTimer !== void 0 && clearTimeout(this.settleTimer), this.moveTimer !== void 0 && clearTimeout(this.moveTimer);
19024
19066
  for (let [e, t] of this.batches) this.disposeBatch(e, t);
19025
19067
  for (let e of this.models.values()) {
19026
19068
  for (let t of e.protos) {
@@ -19032,19 +19074,19 @@ ${I_}
19032
19074
  this.models.clear(), this.scene.remove(this.group);
19033
19075
  }
19034
19076
  };
19035
- function B_(e) {
19077
+ function K_(e) {
19036
19078
  return e.type === "Point" ? [e.coordinates] : e.coordinates;
19037
19079
  }
19038
- function V_(e) {
19080
+ function q_(e) {
19039
19081
  return e.type === "LineString" ? [e.coordinates] : e.coordinates;
19040
19082
  }
19041
- function H_(e) {
19083
+ function J_(e) {
19042
19084
  return e.type === "Polygon" ? [e.coordinates] : e.coordinates;
19043
19085
  }
19044
- function U_(e) {
19086
+ function Y_(e) {
19045
19087
  return e ? e.type === "LineString" || e.type === "MultiLineString" ? 2 : e.type === "Polygon" || e.type === "MultiPolygon" ? 3 : 1 : 1;
19046
19088
  }
19047
- function W_(e) {
19089
+ function X_(e) {
19048
19090
  if (!e) return;
19049
19091
  let t = {
19050
19092
  west: Infinity,
@@ -19075,16 +19117,16 @@ function W_(e) {
19075
19117
  }
19076
19118
  return n ? t : void 0;
19077
19119
  }
19078
- function G_(e) {
19120
+ function Z_(e) {
19079
19121
  let t = e;
19080
19122
  return t?.type === "FeatureCollection" ? t.features ?? [] : t?.type === "Feature" ? [t] : [];
19081
19123
  }
19082
- function K_(e) {
19124
+ function Q_(e) {
19083
19125
  let t = 1;
19084
19126
  for (; t < e;) t *= 2;
19085
19127
  return t;
19086
19128
  }
19087
- function q_(e) {
19129
+ function $_(e) {
19088
19130
  let n = t.fromLngLat(e, 0);
19089
19131
  return {
19090
19132
  x: n.x,
@@ -19093,7 +19135,7 @@ function q_(e) {
19093
19135
  s: n.meterInMercatorCoordinateUnits()
19094
19136
  };
19095
19137
  }
19096
- function J_(e, t) {
19138
+ function ev(e, t) {
19097
19139
  if (!(t > 0)) return e;
19098
19140
  let n = t / 111320, r = n / Math.max(.01, Math.cos((e.north + e.south) / 2 * Math.PI / 180));
19099
19141
  return {
@@ -19103,7 +19145,7 @@ function J_(e, t) {
19103
19145
  north: e.north + n
19104
19146
  };
19105
19147
  }
19106
- function Y_(e) {
19148
+ function tv(e) {
19107
19149
  let t = new Zn();
19108
19150
  for (let n of e) n.geometry.boundingBox || n.geometry.computeBoundingBox(), t.union(n.geometry.boundingBox.clone().applyMatrix4(n.matrix));
19109
19151
  if (t.isEmpty()) return;
@@ -19115,7 +19157,7 @@ function Y_(e) {
19115
19157
  top: t.max.y
19116
19158
  };
19117
19159
  }
19118
- function X_(e, t) {
19160
+ function nv(e, t) {
19119
19161
  let n = -1 - 2 * t, r = 1 + 2 * t;
19120
19162
  return (t, i, a, o, s) => {
19121
19163
  let c = Infinity, l = -Infinity, u = Infinity, d = -Infinity, f = !1, p = !1;
@@ -19132,8 +19174,8 @@ function X_(e, t) {
19132
19174
  return p ? f ? !0 : l >= n && c <= r && d >= n && u <= 1 : !1;
19133
19175
  };
19134
19176
  }
19135
- function Z_(e) {
19136
- let t = e.getBounds(), n = (t.getEast() - t.getWest()) * __, r = (t.getNorth() - t.getSouth()) * __;
19177
+ function rv(e) {
19178
+ let t = e.getBounds(), n = (t.getEast() - t.getWest()) * v_, r = (t.getNorth() - t.getSouth()) * v_;
19137
19179
  return {
19138
19180
  west: t.getWest() - n,
19139
19181
  east: t.getEast() + n,
@@ -19141,13 +19183,13 @@ function Z_(e) {
19141
19183
  north: t.getNorth() + r
19142
19184
  };
19143
19185
  }
19144
- function Q_(e) {
19145
- return s_(e | 0, 20973) / 4294967296;
19186
+ function iv(e) {
19187
+ return c_(e | 0, 20973) / 4294967296;
19146
19188
  }
19147
- function $_(e, t, n) {
19148
- return e / (t * (1 - Math.log2(Q_(n))));
19189
+ function av(e, t, n) {
19190
+ return e / (t * (1 - Math.log2(iv(n))));
19149
19191
  }
19150
- function ev(e, t) {
19192
+ function ov(e, t) {
19151
19193
  let n = 0;
19152
19194
  for (let t of e) t.need < 1 && n++;
19153
19195
  if (n <= t) return 1;
@@ -19155,13 +19197,32 @@ function ev(e, t) {
19155
19197
  for (let t = 0; t < e.length; t++) r[t] = e[t].need;
19156
19198
  return r.sort(), r[t];
19157
19199
  }
19158
- function tv(e) {
19200
+ function sv(e) {
19159
19201
  return (180 + e) / 360;
19160
19202
  }
19161
- function nv(e) {
19203
+ function cv(e) {
19162
19204
  return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + e * Math.PI / 360))) / 360;
19163
19205
  }
19164
- function rv(e, t) {
19206
+ function lv(e) {
19207
+ let n = t.fromLngLat(e.getCenter(), 0), r = e.getCanvas();
19208
+ return {
19209
+ x: n.x,
19210
+ y: n.y,
19211
+ zoom: e.getZoom(),
19212
+ bearing: e.getBearing(),
19213
+ pitch: e.getPitch(),
19214
+ width: r.clientWidth,
19215
+ height: r.clientHeight
19216
+ };
19217
+ }
19218
+ var uv = (e, t) => Math.abs((e - t + 540) % 360 - 180);
19219
+ function dv(e, t) {
19220
+ return e.x === t.x && e.y === t.y && e.zoom === t.zoom && e.bearing === t.bearing && e.pitch === t.pitch && e.width === t.width && e.height === t.height;
19221
+ }
19222
+ function fv(e, t) {
19223
+ return e.width !== t.width || e.height !== t.height || Math.abs(e.zoom - t.zoom) > O_ || Math.abs(e.pitch - t.pitch) > k_ || uv(e.bearing, t.bearing) > D_ || Math.hypot(t.x - e.x, t.y - e.y) * 512 * 2 ** e.zoom > E_ * Math.min(e.width, e.height);
19224
+ }
19225
+ function pv(e, t) {
19165
19226
  let n = e, r = n.transform ?? n._camera?.transform, i = e.terrain ? r?._pixelMatrix3D : r?._pixelMatrix;
19166
19227
  if (!r || !i || !r.worldSize) return;
19167
19228
  let a = e.terrain ? r.elevation ?? 0 : 0, o = r.worldSize, s = r.width * t, c = r.height * t;
@@ -19172,7 +19233,7 @@ function rv(e, t) {
19172
19233
  return d >= -s && d <= r.width + s && f >= 0 && f <= r.height + c;
19173
19234
  };
19174
19235
  }
19175
- function iv(e, t, n, r) {
19236
+ function mv(e, t, n, r) {
19176
19237
  let i = e, a = i.transform ?? i._camera?.transform, o = e.terrain ? a?._pixelMatrix3D : a?._pixelMatrix;
19177
19238
  if (!a || !o || !a.worldSize) return;
19178
19239
  let s = new G().fromArray(Array.from(o)).invert(), c = e.terrain ? a.elevation ?? 0 : 0, l = a.worldSize, u = new Yt(), d = new Yt(), f = (e, t) => {
@@ -19188,7 +19249,7 @@ function iv(e, t, n, r) {
19188
19249
  f(-p, 0)
19189
19250
  ];
19190
19251
  if (h.some((e) => !e)) return;
19191
- let g = h.map(([e, t]) => [t_(e), n_(t)]);
19252
+ let g = h.map(([e, t]) => [n_(e), r_(t)]);
19192
19253
  return (e, t) => {
19193
19254
  let n = Infinity, r = -Infinity;
19194
19255
  for (let i = 0; i < g.length; i++) {
@@ -19205,7 +19266,7 @@ function iv(e, t, n, r) {
19205
19266
  return n <= r ? [n, r] : null;
19206
19267
  };
19207
19268
  }
19208
- function av(e, t) {
19269
+ function hv(e, t) {
19209
19270
  let n = (e, t) => !e.has(t) && !!e.add(t);
19210
19271
  for (let r of [
19211
19272
  "position",
@@ -19227,7 +19288,7 @@ function av(e, t) {
19227
19288
  }
19228
19289
  e.boundingBox = null, e.boundingSphere = null;
19229
19290
  }
19230
- function ov(e) {
19291
+ function gv(e) {
19231
19292
  let t = e.getAttribute("position");
19232
19293
  if (!t) return 1;
19233
19294
  let n = e.getIndex(), r = n ? n.count : t.count;
@@ -19254,13 +19315,13 @@ function ov(e) {
19254
19315
  for (let e of s.values()) e !== 0 && l++;
19255
19316
  return l / s.size;
19256
19317
  }
19257
- function sv(e, t) {
19318
+ function _v(e, t) {
19258
19319
  let n = Math.min(e.east, t.east) - Math.max(e.west, t.west), r = Math.min(e.north, t.north) - Math.max(e.south, t.south);
19259
19320
  if (n <= 0 || r <= 0) return 0;
19260
19321
  let i = (e.east - e.west) * (e.north - e.south);
19261
19322
  return i > 0 ? Math.min(1, n * r / i) : 1;
19262
19323
  }
19263
- function cv(e) {
19324
+ function vv(e) {
19264
19325
  let n = e, r = (n.transform ?? n._camera?.transform)?.getCameraLngLat?.() ?? e.getCenter(), i = t.fromLngLat(r, 0);
19265
19326
  return {
19266
19327
  x: i.x,
@@ -19268,7 +19329,7 @@ function cv(e) {
19268
19329
  s: i.meterInMercatorCoordinateUnits()
19269
19330
  };
19270
19331
  }
19271
- function lv(e) {
19332
+ function yv(e) {
19272
19333
  let t = {
19273
19334
  west: 180,
19274
19335
  east: -180,
@@ -19278,16 +19339,16 @@ function lv(e) {
19278
19339
  for (let n of e) n.lng < t.west && (t.west = n.lng), n.lng > t.east && (t.east = n.lng), n.lat < t.south && (t.south = n.lat), n.lat > t.north && (t.north = n.lat);
19279
19340
  return t;
19280
19341
  }
19281
- function uv(e, t) {
19342
+ function bv(e, t) {
19282
19343
  return e.west <= t.east && e.east >= t.west && e.south <= t.north && e.north >= t.south;
19283
19344
  }
19284
19345
  //#endregion
19285
19346
  //#region src/GltfLayer.ts
19286
- var dv = 1, fv = {
19347
+ var xv = 1, Sv = {
19287
19348
  ambient: 1.5,
19288
19349
  directional: 2.5,
19289
19350
  environment: .7
19290
- }, pv = 25, mv = 2e4, hv = [
19351
+ }, Cv = 25, wv = 2e4, Tv = [
19291
19352
  "interpolate",
19292
19353
  ["exponential", .5],
19293
19354
  ["zoom"],
@@ -19295,7 +19356,7 @@ var dv = 1, fv = {
19295
19356
  4e4,
19296
19357
  20,
19297
19358
  156.25
19298
- ], gv = [
19359
+ ], Ev = [
19299
19360
  "interpolate",
19300
19361
  ["exponential", .5],
19301
19362
  ["zoom"],
@@ -19303,12 +19364,12 @@ var dv = 1, fv = {
19303
19364
  12800,
19304
19365
  20,
19305
19366
  50
19306
- ], _v = [
19367
+ ], Dv = [
19307
19368
  "auto",
19308
19369
  "point",
19309
19370
  "line",
19310
19371
  "fill"
19311
- ], vv = class {
19372
+ ], Ov = class {
19312
19373
  id;
19313
19374
  type = "custom";
19314
19375
  renderingMode = "3d";
@@ -19339,11 +19400,11 @@ var dv = 1, fv = {
19339
19400
  if (!e.source) throw Error("GltfLayer: `source` (a source id) is required");
19340
19401
  if (!e.models || Object.keys(e.models).length === 0) throw Error("GltfLayer: `models` must hold at least one { id: url } entry");
19341
19402
  this.id = e.id, this.minzoom = e.minzoom, this.maxzoom = e.maxzoom, this.options = e, this.visible = e.layout?.visibility !== "none", this.lighting = {
19342
- ...fv,
19403
+ ...Sv,
19343
19404
  ...e.lighting
19344
19405
  };
19345
19406
  let t = e.layout?.["model-placement"] ?? "auto";
19346
- if (!_v.includes(t)) throw Error(`GltfLayer: model-placement must be one of ${_v.join(", ")} — got '${t}'`);
19407
+ if (!Dv.includes(t)) throw Error(`GltfLayer: model-placement must be one of ${Dv.join(", ")} — got '${t}'`);
19347
19408
  this.placement = t;
19348
19409
  }
19349
19410
  onAdd(t, n) {
@@ -19355,42 +19416,42 @@ var dv = 1, fv = {
19355
19416
  antialias: !0
19356
19417
  }), this.renderer.autoClear = !1;
19357
19418
  let i = this.options.paint ?? {}, a = this.options.layout ?? {}, o = Object.keys(this.options.models);
19358
- this.manager = new z_(t, this.scene, e.convert(t.getCenter()), r, {
19419
+ this.manager = new G_(t, this.scene, e.convert(t.getCenter()), r, {
19359
19420
  sourceId: this.options.source,
19360
19421
  sourceLayer: this.options["source-layer"],
19361
19422
  filter: this.options.filter,
19362
19423
  minzoom: this.options.minzoom,
19363
19424
  maxzoom: this.options.maxzoom,
19364
19425
  models: this.options.models,
19365
- modelId: ih(a["model-id"], "model-id", o[0], dv),
19426
+ modelId: ih(a["model-id"], "model-id", o[0], xv),
19366
19427
  placement: this.placement,
19367
- spacing: rh(a["model-spacing"], "model-spacing", pv, dv),
19368
- thinningDistance: rh(a["model-thinning-distance"] ?? hv, "model-thinning-distance", Infinity, dv),
19369
- impostorDistance: rh(a["model-impostor-distance"] ?? gv, "model-impostor-distance", Infinity, dv),
19370
- maxInstances: this.options.maxInstances ?? mv,
19428
+ spacing: rh(a["model-spacing"], "model-spacing", Cv, xv),
19429
+ thinningDistance: rh(a["model-thinning-distance"] ?? Tv, "model-thinning-distance", Infinity, xv),
19430
+ impostorDistance: rh(a["model-impostor-distance"] ?? Ev, "model-impostor-distance", Infinity, xv),
19431
+ maxInstances: this.options.maxInstances ?? wv,
19371
19432
  doubleSided: this.options.doubleSided,
19372
19433
  rotation: ah(i["model-rotation"], "model-rotation", [
19373
19434
  0,
19374
19435
  0,
19375
19436
  0
19376
- ], dv),
19437
+ ], xv),
19377
19438
  scale: ah(i["model-scale"], "model-scale", [
19378
19439
  1,
19379
19440
  1,
19380
19441
  1
19381
- ], dv),
19442
+ ], xv),
19382
19443
  translation: ah(i["model-translation"], "model-translation", [
19383
19444
  0,
19384
19445
  0,
19385
19446
  0
19386
- ], dv),
19447
+ ], xv),
19387
19448
  color: i["model-color"] === void 0 ? void 0 : nh(i["model-color"], "model-color", [
19388
19449
  1,
19389
19450
  1,
19390
19451
  1,
19391
19452
  1
19392
- ], dv),
19393
- opacity: i["model-opacity"] === void 0 ? void 0 : rh(i["model-opacity"], "model-opacity", 1, dv)
19453
+ ], xv),
19454
+ opacity: i["model-opacity"] === void 0 ? void 0 : rh(i["model-opacity"], "model-opacity", 1, xv)
19394
19455
  });
19395
19456
  }
19396
19457
  render(e, t) {
@@ -19433,7 +19494,7 @@ var dv = 1, fv = {
19433
19494
  }
19434
19495
  buildEnvironment() {
19435
19496
  if (this.environmentDone = !0, this.lighting.environment <= 0) return;
19436
- let e = new fs(this.renderer), t = new Vh();
19497
+ let e = new fs(this.renderer), t = new Hh();
19437
19498
  this.scene.environment = e.fromScene(t, .04).texture, this.scene.environmentIntensity = this.lighting.environment, t.dispose(), e.dispose(), this.renderer.resetState();
19438
19499
  }
19439
19500
  onRemove() {
@@ -19441,4 +19502,4 @@ var dv = 1, fv = {
19441
19502
  }
19442
19503
  };
19443
19504
  //#endregion
19444
- export { Bh as Fill3DLayer, vv as GltfLayer };
19505
+ export { Vh as Fill3DLayer, Ov as GltfLayer };