@maptalks/3dtiles 0.12.2 → 0.12.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,30 @@
1
1
  /*!
2
- * @maptalks/3dtiles v0.12.2
2
+ * @maptalks/3dtiles v0.12.6
3
3
  * LICENSE : UNLICENSED
4
4
  * (c) 2016-2022 maptalks.com
5
5
  */
6
+ /*!
7
+ * Cesium - https://github.com/AnalyticalGraphicsInc/cesium
8
+ *
9
+ * Copyright 2011-2017 Cesium Contributors
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ *
23
+ * Columbus View (Pat. Pend.)
24
+ *
25
+ * Portions licensed separately.
26
+ * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
27
+ */
6
28
  !function(t, e) {
7
29
  "object" == typeof exports && "undefined" != typeof module ? e(require("maptalks"), require("@maptalks/gl")) : "function" == typeof define && define.amd ? define([ "maptalks", "@maptalks/gl" ], e) : e((t = "undefined" != typeof globalThis ? globalThis : t || self).maptalks, t.maptalksgl);
8
30
  }(this, (function(t, e) {
@@ -124,7 +146,7 @@
124
146
  s(), o(1, 0, 0), o(0, 1, 0), g(), g(), A = new e(9), e != Float32Array && (A[1] = 0,
125
147
  A[2] = 0, A[3] = 0, A[5] = 0, A[6] = 0, A[7] = 0), A[0] = 1, A[4] = 1, A[8] = 1;
126
148
  /*!
127
- * @maptalks/gltf-loader v0.25.2
149
+ * @maptalks/gltf-loader v0.25.3
128
150
  * LICENSE : UNLICENSED
129
151
  * (c) 2016-2022 maptalks.org
130
152
  */
@@ -233,23 +255,29 @@
233
255
  getArrayBuffer: (t, e = {}) => (e || (e = {}), e.responseType = "arraybuffer", z.get(t, e)),
234
256
  getJSON: function(t, e = {}) {
235
257
  return e && e.jsonp ? z.jsonp(t) : ((e = e || {}).responseType = "json", z.get(t, e));
236
- },
237
- jsonp: function(t) {
238
- const e = "_maptalks_jsonp_" + v++;
239
- t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
240
- let n = document.createElement("script");
241
- return n.type = "text/javascript", n.src = t, new Promise(t => {
242
- window[e] = function(r) {
243
- document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
244
- t(r);
245
- }, document.getElementsByTagName("head")[0].appendChild(n);
246
- });
247
258
  }
248
259
  };
260
+ z.jsonp = function(t) {
261
+ const e = "_maptalks_jsonp_" + v++;
262
+ t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
263
+ let n = document.createElement("script");
264
+ return n.type = "text/javascript", n.src = t, new Promise(t => {
265
+ window[e] = function(r) {
266
+ document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
267
+ t(r);
268
+ }, document.getElementsByTagName("head")[0].appendChild(n);
269
+ });
270
+ };
249
271
  class j {
250
272
  constructor(t, e, n) {
251
273
  this.i = t, this.decoders = e, this.o = n, this.images = {}, this.h = {};
252
274
  }
275
+ abortRequests() {
276
+ for (const t in this.h) {
277
+ const e = this.h[t];
278
+ e && e.xhr && e.xhr.abort();
279
+ }
280
+ }
253
281
  requestImageFromBufferURI(t, e, n) {
254
282
  if (this.buffers[t.id]) {
255
283
  const r = this.buffers[t.id], s = this.u(e, r);
@@ -286,7 +314,8 @@
286
314
  requestExternalImage(t) {
287
315
  if (this.images[t.id]) return Promise.resolve(this.images[t.id]);
288
316
  const e = 0 === t.uri.indexOf("data:image/") ? t.uri : this.rootPath + "/" + t.uri;
289
- return this.h[t.id] ? this.h[t.id].then(() => this.images[t.id]) : this.h[t.id] = this.l(t.id, e);
317
+ if (this.h[t.id]) return this.h[t.id].then(() => this.images[t.id]);
318
+ return this.h[t.id] = this.l(t.id, e);
290
319
  }
291
320
  l(t, e) {
292
321
  return new Promise((n, r) => {
@@ -349,7 +378,8 @@
349
378
  });
350
379
  }
351
380
  g(t, e, n, r = 0) {
352
- const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h = I(i.componentType), u = o.byteStride || 0, f = {
381
+ const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h = I(i.componentType), u = o.byteStride || 0;
382
+ const f = {
353
383
  array: void 0,
354
384
  name: t,
355
385
  accessorName: e,
@@ -459,7 +489,7 @@
459
489
  r.instanceTechnique && r.instanceTechnique.values ? (s = r.instanceTechnique, i = s.values.diffuse) : (s = r,
460
490
  i = s.values.tex || s.values.diffuseTex || s.values.diffuse);
461
491
  const o = {
462
- baseColorTexture: {
492
+ "baseColorTexture": {
463
493
  index: i
464
494
  }
465
495
  };
@@ -580,7 +610,8 @@
580
610
  N(t, e) {
581
611
  const n = new Array(t.byteLength);
582
612
  for (let e = 0; e < t.byteLength; e++) n[e] = String.fromCharCode(t[e]);
583
- return n.join(""), "data:" + (e = e || "image/png") + ";base64," + function(t) {
613
+ n.join("");
614
+ return "data:" + (e = e || "image/png") + ";base64," + function(t) {
584
615
  return "undefined" != typeof self ? self.btoa(t) : window.btoa(t);
585
616
  }(unescape(encodeURIComponent(n)));
586
617
  }
@@ -604,19 +635,19 @@
604
635
  });
605
636
  }
606
637
  }
607
- const $ = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
608
- class J {
638
+ const $ = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null, J = 1313821514, K = 5130562;
639
+ class X {
609
640
  static read(t, e = 0, n = 0) {
610
641
  n || (n = t.byteLength);
611
642
  const r = new DataView(t, e, n), s = r.getUint32(4, !0);
612
- if (1 === s) return J.readV1(r, e);
613
- if (2 === s) return J.readV2(t, e);
643
+ if (1 === s) return X.readV1(r, e);
644
+ if (2 === s) return X.readV2(t, e);
614
645
  throw new Error("Unsupported glb version : " + s);
615
646
  }
616
647
  static readV1(t, e) {
617
648
  const n = t.getUint32(8, !0), r = t.getUint32(12, !0);
618
649
  if (n !== t.byteLength) throw new Error("Length in GLB header is inconsistent with glb's byte length.");
619
- const s = K(t.buffer, 20 + e, r);
650
+ const s = W(t.buffer, 20 + e, r);
620
651
  return {
621
652
  json: JSON.parse(s),
622
653
  glbBuffer: {
@@ -634,7 +665,7 @@
634
665
  const a = i.getUint32(o, !0);
635
666
  o += 4;
636
667
  const c = i.getUint32(o, !0);
637
- if (o += 4, 1313821514 === c) n = K(t, e + 12 + o, a); else if (5130562 === c) {
668
+ if (o += 4, c === J) n = W(t, e + 12 + o, a); else if (c === K) {
638
669
  s = e + 12 + o, r = a;
639
670
  break;
640
671
  }
@@ -650,7 +681,7 @@
650
681
  };
651
682
  }
652
683
  }
653
- function K(t, e, n) {
684
+ function W(t, e, n) {
654
685
  if ($) {
655
686
  const r = new Uint8Array(t, e, n);
656
687
  return $.decode(r);
@@ -661,7 +692,7 @@
661
692
  for (let r = 0; r < e; ) {
662
693
  let s = t[r++];
663
694
  if (128 & s) {
664
- let n = X[s >> 3 & 7];
695
+ let n = Z[s >> 3 & 7];
665
696
  if (!(64 & s) || !n || r + n > e) return null;
666
697
  for (s &= 63 >> n; n > 0; n -= 1) {
667
698
  const e = t[r++];
@@ -674,17 +705,18 @@
674
705
  return n;
675
706
  }(new Uint8Array(t, e, n));
676
707
  }
677
- const X = [ 1, 1, 1, 1, 2, 2, 3, 0 ], W = [ 0, 0, 0 ], Z = [ 0, 0, 0, 1 ], Y = [ 1, 1, 1 ], Q = {
708
+ const Z = [ 1, 1, 1, 1, 2, 2, 3, 0 ];
709
+ const Q = [ 0, 0, 0 ], Y = [ 0, 0, 0, 1 ], tt = [ 1, 1, 1 ], et = {
678
710
  TRANSLATION: [ 0, 0, 0 ],
679
711
  ROTATION: [ 0, 0, 0, 1 ],
680
712
  SCALE: [ 1, 1, 1 ]
681
- }, tt = {
713
+ }, nt = {
682
714
  PREVIOUS: null,
683
715
  NEXT: null,
684
716
  PREINDEX: null,
685
717
  NEXTINDEX: null,
686
718
  INTERPOLATION: null
687
- }, et = {
719
+ }, rt = {
688
720
  P(t, e, n, r, s, i, o, c) {
689
721
  const h = S(t) ? e.animations : [ e.animations[0] ], u = {};
690
722
  for (let e = 0; e < h.length; e++) {
@@ -693,9 +725,9 @@
693
725
  const l = f.channelsMap[n];
694
726
  if (l) for (let t = 0; t < l.length; t++) {
695
727
  const e = l[t];
696
- "translation" === e.target.path ? (this.L(s, f.samplers[e.sampler], r, 1), u.translation = a(W, s)) : "rotation" === e.target.path ? (this.B(i, f.samplers[e.sampler], r, 1),
697
- u.rotation = O(Z, i)) : "scale" === e.target.path ? (this.L(o, f.samplers[e.sampler], r, 1),
698
- u.scale = a(Y, o)) : "weights" === e.target.path && c && (this.L(c, f.samplers[e.sampler], r, c.length),
728
+ "translation" === e.target.path ? (this.L(s, f.samplers[e.sampler], r, 1), u.translation = a(Q, s)) : "rotation" === e.target.path ? (this.B(i, f.samplers[e.sampler], r, 1),
729
+ u.rotation = O(Y, i)) : "scale" === e.target.path ? (this.L(o, f.samplers[e.sampler], r, 1),
730
+ u.scale = a(tt, o)) : "weights" === e.target.path && c && (this.L(c, f.samplers[e.sampler], r, c.length),
699
731
  u.weights = c);
700
732
  }
701
733
  }
@@ -705,7 +737,7 @@
705
737
  switch (e.interpolation) {
706
738
  case "LINEAR":
707
739
  {
708
- const s = this.U(tt, e, n, 1 * r);
740
+ const s = this.U(nt, e, n, 1 * r);
709
741
  s && (t = function(t, e, n, r) {
710
742
  for (let s = 0; s < t.length; s++) t[s] = e[s] + r * (n[s] - e[s]);
711
743
  return t;
@@ -715,7 +747,7 @@
715
747
 
716
748
  case "STEP":
717
749
  {
718
- const s = this.U(tt, e, n, 1 * r);
750
+ const s = this.U(nt, e, n, 1 * r);
719
751
  s && (t = function(t, e) {
720
752
  for (let n = 0; n < t.length; n++) t[n] = e[n];
721
753
  return t;
@@ -725,7 +757,7 @@
725
757
 
726
758
  case "CUBICSPLINE":
727
759
  {
728
- const s = this.U(tt, e, n, 3 * r);
760
+ const s = this.U(nt, e, n, 3 * r);
729
761
  s && (t = this.C(t, s, e.input.array, 3 * r));
730
762
  break;
731
763
  }
@@ -736,21 +768,21 @@
736
768
  switch (e.interpolation) {
737
769
  case "LINEAR":
738
770
  {
739
- const r = this.U(tt, e, n, 1);
771
+ const r = this.U(nt, e, n, 1);
740
772
  r && T(t, r.PREVIOUS, r.NEXT, r.INTERPOLATION);
741
773
  break;
742
774
  }
743
775
 
744
776
  case "STEP":
745
777
  {
746
- const r = this.U(tt, e, n, 1);
778
+ const r = this.U(nt, e, n, 1);
747
779
  r && (t = _(t, ...r.PREVIOUS));
748
780
  break;
749
781
  }
750
782
 
751
783
  case "CUBICSPLINE":
752
784
  {
753
- const r = this.U(tt, e, n, 3);
785
+ const r = this.U(nt, e, n, 3);
754
786
  if (r) {
755
787
  for (let t = 0; t < r.PREVIOUS.length; t++) r.PREVIOUS[t] = Math.acos(r.PREVIOUS[t]),
756
788
  r.NEXT[t] = Math.acos(r.NEXT[t]);
@@ -801,7 +833,8 @@
801
833
  },
802
834
  getAnimationClip(t, e, n, r) {
803
835
  const s = t.nodes[e] && t.nodes[e].weights;
804
- return c(W, ...Q.TRANSLATION), _(Z, ...Q.ROTATION), c(Y, ...Q.SCALE), this.P(r, t, e, n, W, Z, Y, s);
836
+ c(Q, ...et.TRANSLATION), _(Y, ...et.ROTATION), c(tt, ...et.SCALE);
837
+ return this.P(r, t, e, n, Q, Y, tt, s);
805
838
  },
806
839
  getTimeSpan(t) {
807
840
  if (!t.animations) return null;
@@ -826,24 +859,27 @@
826
859
  return n ? S(e) ? n[e] : n[Object.keys(n)[0]] : null;
827
860
  }
828
861
  };
829
- let nt = !1;
862
+ let st = !1;
830
863
  if ("undefined" != typeof OffscreenCanvas) {
831
864
  let t;
832
865
  try {
833
866
  t = new OffscreenCanvas(2, 2).getContext("2d");
834
- } catch (Wt) {}
835
- t && "undefined" != typeof createImageBitmap && (nt = !0);
867
+ } catch (t) {}
868
+ t && "undefined" != typeof createImageBitmap && (st = !0);
836
869
  }
837
- const rt = "undefined" == typeof document ? null : document.createElement("canvas");
838
- class st {
870
+ const it = "undefined" == typeof document ? null : document.createElement("canvas");
871
+ class ot {
839
872
  constructor(t, e, n) {
840
873
  if (this.options = n || {}, this.options.decoders || (this.options.decoders = {}),
841
874
  e.buffer instanceof ArrayBuffer) {
842
- const {json: n, glbBuffer: r} = J.read(e.buffer, e.byteOffset, e.byteLength);
875
+ const {json: n, glbBuffer: r} = X.read(e.buffer, e.byteOffset, e.byteLength);
843
876
  this.F(t, n, r);
844
877
  } else this.F(t, e);
845
878
  this.D = new G(this.rootPath, this.gltf, this.glbBuffer), this.k();
846
879
  }
880
+ abort() {
881
+ this.adapter && this.adapter.abortRequests();
882
+ }
847
883
  k() {
848
884
  const t = this.gltf.extensionsRequired;
849
885
  if (t) {
@@ -890,10 +926,10 @@
890
926
  return t;
891
927
  }
892
928
  static getAnimationClip(t, e, n, r) {
893
- return et.getAnimationClip(t, e, n, r);
929
+ return rt.getAnimationClip(t, e, n, r);
894
930
  }
895
931
  static getAnimationTimeSpan(t, e) {
896
- return et.getTimeSpanByName(t, e);
932
+ return rt.getTimeSpanByName(t, e);
897
933
  }
898
934
  static getTypedArrayCtor(t) {
899
935
  return I(t);
@@ -903,7 +939,7 @@
903
939
  }
904
940
  F(t, e, n) {
905
941
  this.gltf = e, this.glbBuffer = n, this.version = e.asset ? +e.asset.version : 1,
906
- this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = nt ? ct : this.options.requestImage || it,
942
+ this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = st ? ut : this.options.requestImage || at,
907
943
  this.options.transferable && (this.transferables = []), 2 === this.version ? (this.adapter = new q(t, e, n, this.options.requestImage, this.options.decoders || {}, this.options.supportedFormats || {}),
908
944
  this.adapter.iterate((t, e, n) => {
909
945
  e.id = "buffer_" + n;
@@ -920,7 +956,7 @@
920
956
  }
921
957
  q(t, e) {
922
958
  if (t.children && t.children.length > 0) {
923
- if (!("number" == typeof (n = t.children[0]) && isFinite(n) || function(t) {
959
+ if (!(n = t.children[0], "number" == typeof n && isFinite(n) || function(t) {
924
960
  return !M(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String);
925
961
  }(t.children[0]))) return t;
926
962
  const r = t.children.map(t => {
@@ -1085,12 +1121,12 @@
1085
1121
  });
1086
1122
  }
1087
1123
  }
1088
- function it(t, e) {
1124
+ function at(t, e) {
1089
1125
  const n = new Image;
1090
1126
  n.crossOrigin = "", n.onload = () => {
1091
- if (!rt) return void e(new Error("There is no canvas to draw image!"));
1092
- rt.width = n.width, rt.height = n.height;
1093
- const t = rt.getContext("2d");
1127
+ if (!it) return void e(new Error("There is no canvas to draw image!"));
1128
+ it.width = n.width, it.height = n.height;
1129
+ const t = it.getContext("2d");
1094
1130
  t.drawImage(n, 0, 0, n.width, n.height);
1095
1131
  const r = t.getImageData(0, 0, n.width, n.height), s = {
1096
1132
  width: n.width,
@@ -1102,32 +1138,35 @@
1102
1138
  e(t);
1103
1139
  }, n.src = t;
1104
1140
  }
1105
- let ot, at;
1106
- function ct(t, e) {
1107
- ot || (ot = new OffscreenCanvas(2, 2), at = ot.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
1108
- ot.width = t.width, ot.height = t.height, at.drawImage(t, 0, 0);
1109
- const n = at.getImageData(0, 0, ot.width, ot.height);
1141
+ let ct, ht;
1142
+ function ut(t, e) {
1143
+ ct || (ct = new OffscreenCanvas(2, 2), ht = ct.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
1144
+ const {width: n, height: r} = t;
1145
+ ct.width = n, ct.height = r, ht.drawImage(t, 0, 0), t.close();
1146
+ const s = ht.getImageData(0, 0, n, r);
1110
1147
  e(null, {
1111
- width: t.width,
1112
- height: t.height,
1113
- data: new Uint8Array(n.data)
1148
+ width: n,
1149
+ height: r,
1150
+ data: new Uint8Array(s.data)
1114
1151
  });
1152
+ }).catch(t => {
1153
+ console.warn(t), e(t);
1115
1154
  });
1116
1155
  }
1117
- function ht(t) {
1156
+ function ft(t) {
1118
1157
  return t / Math.PI * 180;
1119
1158
  }
1120
- function ut(t) {
1159
+ function lt(t) {
1121
1160
  return Math.sign ? Math.sign(t) : 0 === (t = +t) || isNaN(t) ? Number(t) : t > 0 ? 1 : -1;
1122
1161
  }
1123
- const ft = [ 1, 1, 1, 1, 2, 2, 3, 0 ];
1124
- function lt(t) {
1162
+ const dt = [ 1, 1, 1, 1, 2, 2, 3, 0 ];
1163
+ function mt(t) {
1125
1164
  const e = t.length;
1126
1165
  let n = "";
1127
1166
  for (let r = 0; r < e; ) {
1128
1167
  let s = t[r++];
1129
1168
  if (128 & s) {
1130
- let n = ft[s >> 3 & 7];
1169
+ let n = dt[s >> 3 & 7];
1131
1170
  if (!(64 & s) || !n || r + n > e) return null;
1132
1171
  for (s &= 63 >> n; n > 0; n -= 1) {
1133
1172
  const e = t[r++];
@@ -1140,14 +1179,14 @@
1140
1179
  return n;
1141
1180
  }
1142
1181
  new Array(3), new Array(3);
1143
- const dt = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], mt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], yt = new Array(3), bt = new Array(3), pt = new Array(3);
1144
- function wt(t, e) {
1145
- const n = mt, r = function(t, e, n, r, s) {
1146
- const i = e[0], o = e[1], a = e[2], c = n[0], h = n[1], u = n[2], l = i * i * c * c, d = o * o * h * h, m = a * a * u * u, y = l + d + m, b = Math.sqrt(1 / y), p = f(_t, e, b);
1182
+ const yt = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], bt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], pt = new Array(3), wt = new Array(3), _t = new Array(3);
1183
+ function gt(t, e) {
1184
+ const n = bt, r = function(t, e, n, r, s) {
1185
+ const i = e[0], o = e[1], a = e[2], c = n[0], h = n[1], u = n[2], l = i * i * c * c, d = o * o * h * h, m = a * a * u * u, y = l + d + m, b = Math.sqrt(1 / y), p = f(Tt, e, b);
1147
1186
  if (y < s) return isFinite(b) ? p : void 0;
1148
- const w = r[0], _ = r[1], g = r[2], T = gt;
1187
+ const w = r[0], _ = r[1], g = r[2], T = At;
1149
1188
  T[0] = p[0] * w * 2, T[1] = p[1] * _ * 2, T[2] = p[2] * g * 2;
1150
- let A, O, v, M, S, x, I, N, E, P, L, B = (1 - b) * Tt(e) / (.5 * Tt(T)), U = 0;
1189
+ let A, O, v, M, S, x, I, N, E, P, L, B = (1 - b) * Ot(e) / (.5 * Ot(T)), U = 0;
1151
1190
  do {
1152
1191
  B -= U, v = 1 / (1 + B * w), M = 1 / (1 + B * _), S = 1 / (1 + B * g), x = v * v,
1153
1192
  I = M * M, N = S * S, E = x * v, P = I * M, L = N * S, A = l * x + d * I + m * N - 1,
@@ -1155,22 +1194,22 @@
1155
1194
  U = A / (-2 * O);
1156
1195
  } while (Math.abs(A) > 1e-12);
1157
1196
  return t[0] = i * v, t[1] = o * M, t[2] = a * S, t;
1158
- }(yt, e, dt, n, .1);
1159
- let s = p(bt, r, n);
1197
+ }(pt, e, yt, n, .1);
1198
+ let s = p(wt, r, n);
1160
1199
  s = function(t, e) {
1161
1200
  const n = e[0], r = e[1], s = e[2];
1162
1201
  let i = n * n + r * r + s * s;
1163
1202
  i > 0 && (i = Math.sqrt(i), t[0] = e[0] / i, t[1] = e[1] / i, t[2] = e[2] / i);
1164
1203
  return t;
1165
1204
  }(s, s);
1166
- const i = b(pt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = ut(d(i, e)) * Tt(i);
1167
- return t[0] = ht(o), t[1] = ht(a), t[2] = c, t;
1205
+ const i = b(_t, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = lt(d(i, e)) * Ot(i);
1206
+ return t[0] = ft(o), t[1] = ft(a), t[2] = c, t;
1168
1207
  }
1169
- const _t = new Array(3), gt = new Array(3);
1170
- function Tt(t) {
1208
+ const Tt = new Array(3), At = new Array(3);
1209
+ function Ot(t) {
1171
1210
  return i(t);
1172
1211
  }
1173
- function At(t, e) {
1212
+ function vt(t, e) {
1174
1213
  let n = "";
1175
1214
  for (let r = 0; r < 4; r++) {
1176
1215
  const s = t.getUint8(e + r);
@@ -1178,27 +1217,27 @@
1178
1217
  }
1179
1218
  return n;
1180
1219
  }
1181
- const Ot = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
1182
- function vt(t, e, n) {
1220
+ const Mt = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
1221
+ function St(t, e, n) {
1183
1222
  const r = new Uint8Array(t, e, n);
1184
- return Ot ? JSON.parse(Ot.decode(r)) : JSON.parse(lt(r));
1223
+ return Mt ? JSON.parse(Mt.decode(r)) : JSON.parse(mt(r));
1185
1224
  }
1186
- function Mt(t, e, n) {
1225
+ function xt(t, e, n) {
1187
1226
  const r = new Uint8Array(t, e, n);
1188
- return Ot ? JSON.parse(Ot.decode(r)) : JSON.parse(lt(r));
1227
+ return Mt ? JSON.parse(Mt.decode(r)) : JSON.parse(mt(r));
1189
1228
  }
1190
- function St(t, e, n) {
1229
+ function It(t, e, n) {
1191
1230
  return {
1192
1231
  offset: e,
1193
1232
  byteLength: n
1194
1233
  };
1195
1234
  }
1196
- function xt(t, e, n, r) {
1235
+ function Nt(t, e, n, r) {
1197
1236
  const {byteOffset: s, componentType: i, type: o} = t, {ctor: a, type: c} = function(t) {
1198
- return Et[t];
1237
+ return Lt[t];
1199
1238
  }(i), h = function(t) {
1200
1239
  if (!t) return 1;
1201
- return Nt[t];
1240
+ return Pt[t];
1202
1241
  }(o);
1203
1242
  return {
1204
1243
  byteStride: 0,
@@ -1209,19 +1248,19 @@
1209
1248
  array: new a(e, n + s, r * h)
1210
1249
  };
1211
1250
  }
1212
- function It(t, e, n, r) {
1251
+ function Et(t, e, n, r) {
1213
1252
  t.componentType || (t.componentType = "UNSIGNED_SHORT");
1214
- const s = xt(t, e, n, r);
1253
+ const s = Nt(t, e, n, r);
1215
1254
  return s.array.buffer.byteLength !== e.byteLength && (s.array = s.array.slice()),
1216
1255
  s;
1217
1256
  }
1218
- const Nt = {
1257
+ const Pt = {
1219
1258
  "SCALAR": 1,
1220
1259
  "VEC2": 2,
1221
1260
  "VEC3": 3,
1222
1261
  "VEC4": 4
1223
1262
  };
1224
- const Et = {
1263
+ const Lt = {
1225
1264
  "BYTE": {
1226
1265
  ctor: Int8Array,
1227
1266
  type: 5120,
@@ -1263,27 +1302,27 @@
1263
1302
  name: "Float64Array"
1264
1303
  }
1265
1304
  };
1266
- function Pt(t) {
1267
- for (let e in Et) if (t === Et[e].ctor) return Et[e].type;
1305
+ function Bt(t) {
1306
+ for (let e in Lt) if (t === Lt[e].ctor) return Lt[e].type;
1268
1307
  throw new Error("unrecognized ctor:" + t);
1269
1308
  }
1270
- function Lt(t, e, n, r) {
1309
+ function Ut(t, e, n, r) {
1271
1310
  const s = t, i = e.length / 3;
1272
1311
  for (let t = 0; t < i; t++) s[3 * t] = e[3 * t] / 65535 * r[0] + n[0], s[3 * t + 1] = e[3 * t + 1] / 65535 * r[1] + n[1],
1273
1312
  s[3 * t + 2] = e[3 * t + 2] / 65535 * r[2] + n[2];
1274
1313
  return s;
1275
1314
  }
1276
- function Bt(t, e, n) {
1315
+ function Ct(t, e, n) {
1277
1316
  let r = t.getUint32(12, !0), s = t.getUint32(16, !0), i = t.getUint32(20, !0), o = t.getUint32(24, !0);
1278
1317
  const a = t.buffer;
1279
1318
  let c, h, u = {}, f = {};
1280
- r > 0 && (u = vt(a, e, r), e += r), s > 0 && (c = function(t, e, n) {
1319
+ r > 0 && (u = St(a, e, r), e += r), s > 0 && (c = function(t, e, n) {
1281
1320
  return {
1282
1321
  offset: e,
1283
1322
  byteLength: n
1284
1323
  };
1285
- }(0, e, s), e += s), i > 0 && (f = Mt(a, e, i), e += i);
1286
- const l = St(0, e, o);
1324
+ }(0, e, s), e += s), i > 0 && (f = xt(a, e, i), e += i);
1325
+ const l = It(0, e, o);
1287
1326
  return h = a.slice(l.offset, l.offset + l.byteLength), n.push(h), {
1288
1327
  featureTable: u,
1289
1328
  featureTableBin: c,
@@ -1291,28 +1330,28 @@
1291
1330
  batchTableBin: h
1292
1331
  };
1293
1332
  }
1294
- var Ut = {
1333
+ var Rt = {
1295
1334
  north: [ -1, 0, 0 ],
1296
1335
  east: [ 0, 1, 0 ],
1297
1336
  up: [ 0, 0, 1 ],
1298
1337
  south: [ 1, 0, 0 ],
1299
1338
  west: [ 0, -1, 0 ],
1300
1339
  down: [ 0, 0, -1 ]
1301
- }, Ct = {}, Rt = {
1340
+ }, Ft = {}, Dt = {
1302
1341
  east: [],
1303
1342
  north: [],
1304
1343
  up: [],
1305
1344
  west: [],
1306
1345
  south: [],
1307
1346
  down: []
1308
- }, Ft = [], Dt = [], kt = [];
1309
- const zt = [ 0, 0, 0 ];
1310
- function jt(t, e, n, r) {
1347
+ }, kt = [], zt = [], jt = [];
1348
+ const Vt = [ 0, 0, 0 ];
1349
+ function Gt(t, e, n, r) {
1311
1350
  n = n || 0, r = r || n;
1312
1351
  var s = Math.abs(t - e);
1313
1352
  return s <= r || s <= n * Math.max(Math.abs(t), Math.abs(e));
1314
1353
  }
1315
- const Vt = ($t = {
1354
+ const Ht = (Kt = {
1316
1355
  up: {
1317
1356
  south: "east",
1318
1357
  north: "west",
@@ -1349,54 +1388,53 @@
1349
1388
  north: "up",
1350
1389
  south: "down"
1351
1390
  }
1352
- }[Gt = "east"][Ht = "north"], Ct[Jt = Gt + Ht] ? qt = Ct[Jt] : (qt = function(t, e, n) {
1353
- if (function(t, e) {
1354
- var n = t[0], r = t[1], s = t[2], i = e[0], o = e[1], a = e[2];
1355
- return Math.abs(n - i) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(i)) && Math.abs(r - o) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(o)) && Math.abs(s - a) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(a));
1356
- }(t, zt)) a(Ft, Ut[Gt]), a(Dt, Ut[Ht]), a(kt, Ut[$t]); else if (jt(t[0], 0, 1e-14) && jt(t[1], 0, 1e-14)) {
1357
- var r = ut(t[2]);
1358
- a(Ft, Ut[Gt]), "east" !== Gt && "west" !== Gt && f(Ft, Ft, r), a(Dt, Ut[Ht]), "east" !== Ht && "west" !== Ht && f(Dt, Dt, r),
1359
- a(kt, Ut[$t]), "east" !== $t && "west" !== $t && f(kt, kt, r);
1391
+ }[qt = "east"][$t = "north"], Ft[Xt = qt + $t] ? Jt = Ft[Xt] : (Jt = function(t, e, n) {
1392
+ if (c = Vt, h = (o = t)[0], d = o[1], y = o[2], b = c[0], p = c[1], w = c[2], Math.abs(h - b) <= 1e-6 * Math.max(1, Math.abs(h), Math.abs(b)) && Math.abs(d - p) <= 1e-6 * Math.max(1, Math.abs(d), Math.abs(p)) && Math.abs(y - w) <= 1e-6 * Math.max(1, Math.abs(y), Math.abs(w))) a(kt, Rt[qt]),
1393
+ a(zt, Rt[$t]), a(jt, Rt[Kt]); else if (Gt(t[0], 0, 1e-14) && Gt(t[1], 0, 1e-14)) {
1394
+ var r = lt(t[2]);
1395
+ a(kt, Rt[qt]), "east" !== qt && "west" !== qt && f(kt, kt, r), a(zt, Rt[$t]), "east" !== $t && "west" !== $t && f(zt, zt, r),
1396
+ a(jt, Rt[Kt]), "east" !== Kt && "west" !== Kt && f(jt, jt, r);
1360
1397
  } else {
1361
1398
  !function(t, e) {
1362
- u(e, t, mt), l(e, e);
1363
- }(t, Rt.up);
1364
- var s = Rt.up, i = Rt.east;
1365
- i[0] = -t[1], i[1] = t[0], i[2] = 0, l(Rt.east, i), m(Rt.north, s, i), f(Rt.down, Rt.up, -1),
1366
- f(Rt.west, Rt.east, -1), f(Rt.south, Rt.north, -1), Ft = Rt[Gt], Dt = Rt[Ht], kt = Rt[$t];
1367
- }
1368
- return n[0] = Ft[0], n[1] = Ft[1], n[2] = Ft[2], n[3] = 0, n[4] = Dt[0], n[5] = Dt[1],
1369
- n[6] = Dt[2], n[7] = 0, n[8] = kt[0], n[9] = kt[1], n[10] = kt[2], n[11] = 0, n[12] = t[0],
1399
+ u(e, t, bt), l(e, e);
1400
+ }(t, Dt.up);
1401
+ var s = Dt.up, i = Dt.east;
1402
+ i[0] = -t[1], i[1] = t[0], i[2] = 0, l(Dt.east, i), m(Dt.north, s, i), f(Dt.down, Dt.up, -1),
1403
+ f(Dt.west, Dt.east, -1), f(Dt.south, Dt.north, -1), kt = Dt[qt], zt = Dt[$t], jt = Dt[Kt];
1404
+ }
1405
+ var o, c, h, d, y, b, p, w;
1406
+ return n[0] = kt[0], n[1] = kt[1], n[2] = kt[2], n[3] = 0, n[4] = zt[0], n[5] = zt[1],
1407
+ n[6] = zt[2], n[7] = 0, n[8] = jt[0], n[9] = jt[1], n[10] = jt[2], n[11] = 0, n[12] = t[0],
1370
1408
  n[13] = t[1], n[14] = t[2], n[15] = 1, n;
1371
- }, Ct[Jt] = qt), qt);
1409
+ }, Ft[Xt] = Jt), Jt);
1372
1410
  /*!
1373
1411
  * @maptalks/gl v0.65.0
1374
1412
  * LICENSE : UNLICENSED
1375
1413
  * (c) 2016-2022 maptalks.com
1376
- */ var Gt, Ht, qt, $t, Jt;
1377
- const Kt = function() {
1414
+ */ var qt, $t, Jt, Kt, Xt;
1415
+ const Wt = function() {
1378
1416
  if ("undefined" != typeof self) return self;
1379
1417
  if ("undefined" != typeof window) return window;
1380
1418
  if ("undefined" != typeof global) return global;
1381
1419
  throw new Error("unable to locate global object");
1382
- }, Xt = Kt(), Wt = Xt.gl_trans__coders = Xt.gl_trans__coders || {};
1383
- Wt.inject = function(t) {
1384
- const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s = Xt.gl_trans__coders = Xt.gl_trans__coders || {};
1385
- let i = `${r}\n const _____getGlobal = ${Kt.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
1420
+ }, Zt = Wt(), Qt = Zt.gl_trans__coders = Zt.gl_trans__coders || {};
1421
+ Qt.inject = function(t) {
1422
+ const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s = Zt.gl_trans__coders = Zt.gl_trans__coders || {};
1423
+ let i = `${r}\n const _____getGlobal = ${Wt.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
1386
1424
  for (const t in s) "inject" !== t && "getTranscoder" !== t && "registerTranscoder" !== t && (i += 'tran_____scoders["' + t + '"] =' + s[t].toString() + "\n;");
1387
1425
  return i += "\n" + e.substring(r.length), i;
1388
- }, Wt.registerTranscoder = function(t, e) {
1389
- Wt[t] = e;
1390
- }, Wt.getTranscoder = function(t) {
1391
- return Wt[t];
1426
+ }, Qt.registerTranscoder = function(t, e) {
1427
+ Qt[t] = e;
1428
+ }, Qt.getTranscoder = function(t) {
1429
+ return Qt[t];
1392
1430
  };
1393
- class Zt {
1431
+ class Yt {
1394
1432
  constructor(t, e, n) {
1395
- this.i = t, this.Y = e || st, this.o = n, this.tt = {
1396
- "image/crn": Wt.crn && Wt.crn(),
1397
- "image/ktx2": Wt.ktx2 && Wt.ktx2(),
1398
- "image/cttf": Wt.ktx2 && Wt.ktx2(),
1399
- "draco": Wt.draco && Wt.draco()
1433
+ this.i = t, this.Y = e || ot, this.o = n, this.tt = {
1434
+ "image/crn": Qt.crn && Qt.crn(),
1435
+ "image/ktx2": Qt.ktx2 && Qt.ktx2(),
1436
+ "image/cttf": Qt.ktx2 && Qt.ktx2(),
1437
+ "draco": Qt.draco && Qt.draco()
1400
1438
  };
1401
1439
  }
1402
1440
  static createEmptyB3DM() {
@@ -1455,15 +1493,15 @@
1455
1493
  o = h, h = a, u = c, a = 0, c = 0);
1456
1494
  const l = [ t ];
1457
1495
  let d, m, y;
1458
- if (a > 0 ? (d = vt(t, f, a), f += a, o = d.BATCH_LENGTH) : d = {
1496
+ if (a > 0 ? (d = St(t, f, a), f += a, o = d.BATCH_LENGTH) : d = {
1459
1497
  "BATCH_LENGTH": o
1460
- }, c > 0 && (f += c), h > 0 && (m = Mt(t, f, h), f += h, u > 0)) {
1461
- const e = St(0, f, u);
1498
+ }, c > 0 && (f += c), h > 0 && (m = xt(t, f, h), f += h, u > 0)) {
1499
+ const e = It(0, f, u);
1462
1500
  y = t.slice(e.offset, e.offset + e.byteLength), f += u, l.push(y);
1463
1501
  }
1464
1502
  const b = d.BATCH_LENGTH, p = {};
1465
1503
  if (d && d.BATCH_ID) {
1466
- p.BATCH_ID = It(d.BATCH_ID, t, (void 0).offset, b);
1504
+ p.BATCH_ID = Et(d.BATCH_ID, t, (void 0).offset, b);
1467
1505
  const e = p.BATCH_ID.array && p.BATCH_ID.array.buffer;
1468
1506
  e && l.indexOf(e) < 0 && l.push(e);
1469
1507
  }
@@ -1485,13 +1523,13 @@
1485
1523
  return null;
1486
1524
  }
1487
1525
  }
1488
- class Yt {
1526
+ class te {
1489
1527
  constructor(t, e, n) {
1490
- this.i = t, this.Y = e || st, this.o = n, this.tt = {
1491
- "image/crn": Wt.crn && Wt.crn(),
1492
- "image/ktx2": Wt.ktx2 && Wt.ktx2(),
1493
- "image/cttf": Wt.ktx2 && Wt.ktx2(),
1494
- "draco": Wt.draco && Wt.draco()
1528
+ this.i = t, this.Y = e || ot, this.o = n, this.tt = {
1529
+ "image/crn": Qt.crn && Qt.crn(),
1530
+ "image/ktx2": Qt.ktx2 && Qt.ktx2(),
1531
+ "image/cttf": Qt.ktx2 && Qt.ktx2(),
1532
+ "draco": Qt.draco && Qt.draco()
1495
1533
  };
1496
1534
  }
1497
1535
  load(t, e, n = 0, r = 0) {
@@ -1525,7 +1563,7 @@
1525
1563
  supportedFormats: this.o
1526
1564
  }, i = new DataView(e, n, r), o = 32 + i.getUint32(12, !0) + i.getUint32(16, !0) + i.getUint32(20, !0) + i.getUint32(24, !0);
1527
1565
  if (0 === i.getUint32(28, !0)) {
1528
- let r = lt(new Uint8Array(e, o + n, i.byteLength - o));
1566
+ let r = mt(new Uint8Array(e, o + n, i.byteLength - o));
1529
1567
  -1 == r.indexOf("://") && (r = t.substring(0, t.lastIndexOf("/")) + "/" + r);
1530
1568
  return r.indexOf(".glb") > 0 ? z.getArrayBuffer(r, {}).then(t => this.ot(r, {
1531
1569
  buffer: t.data,
@@ -1568,7 +1606,7 @@
1568
1606
  error: t
1569
1607
  };
1570
1608
  }
1571
- const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = Bt(s, 32 + e, o), f = {}, l = a.INSTANCES_LENGTH;
1609
+ const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = Ct(s, 32 + e, o), f = {}, l = a.INSTANCES_LENGTH;
1572
1610
  if (a.POSITION) {
1573
1611
  const {byteOffset: e} = a.POSITION;
1574
1612
  f.POSITION = {
@@ -1591,7 +1629,7 @@
1591
1629
  }, o.push(f.POSITION.array.buffer);
1592
1630
  }
1593
1631
  if (a.BATCH_ID) {
1594
- f.BATCH_ID = It(a.BATCH_ID, t, c.offset, l);
1632
+ f.BATCH_ID = Et(a.BATCH_ID, t, c.offset, l);
1595
1633
  const e = f.BATCH_ID.array && f.BATCH_ID.array.buffer;
1596
1634
  e && o.indexOf(e) < 0 && o.push(e);
1597
1635
  }
@@ -1662,26 +1700,26 @@
1662
1700
  }
1663
1701
  ct(t) {
1664
1702
  const e = t.length / 2, n = new Float32Array(3 * e), r = [];
1665
- for (let s = 0; s < e; s++) Qt(r, t[2 * s], t[2 * s + 1], 65535), n[3 * s] = r[0],
1703
+ for (let s = 0; s < e; s++) ee(r, t[2 * s], t[2 * s + 1], 65535), n[3 * s] = r[0],
1666
1704
  n[3 * s + 1] = r[1], n[3 * s + 2] = r[2];
1667
1705
  return n;
1668
1706
  }
1669
1707
  at(t, e, n) {
1670
- return Lt(new Float32Array(t.length), t, e, n);
1708
+ return Ut(new Float32Array(t.length), t, e, n);
1671
1709
  }
1672
1710
  rt() {
1673
1711
  return null;
1674
1712
  }
1675
1713
  }
1676
- function Qt(t, e, n, r) {
1677
- if (t[0] = te(e, r), t[1] = te(n, r), t[2] = 1 - (Math.abs(t[0]) + Math.abs(t[1])),
1714
+ function ee(t, e, n, r) {
1715
+ if (t[0] = ne(e, r), t[1] = ne(n, r), t[2] = 1 - (Math.abs(t[0]) + Math.abs(t[1])),
1678
1716
  t[2] < 0) {
1679
1717
  const e = t[0];
1680
- t[0] = (1 - Math.abs(t[1])) * ee(e), t[1] = (1 - Math.abs(e)) * ee(t[1]);
1718
+ t[0] = (1 - Math.abs(t[1])) * re(e), t[1] = (1 - Math.abs(e)) * re(t[1]);
1681
1719
  }
1682
1720
  return l(t, t);
1683
1721
  }
1684
- function te(t, e) {
1722
+ function ne(t, e) {
1685
1723
  return function(t, e, n) {
1686
1724
  return t < e ? e : t > n ? n : t;
1687
1725
  }(t, 0, e = function(t, e) {
@@ -1689,10 +1727,10 @@
1689
1727
  return e;
1690
1728
  }(e, 255)) / e * 2 - 1;
1691
1729
  }
1692
- function ee(t) {
1730
+ function re(t) {
1693
1731
  return t < 0 ? -1 : 1;
1694
1732
  }
1695
- class ne {
1733
+ class se {
1696
1734
  constructor() {}
1697
1735
  load(t, e, n = 0, r = 0) {
1698
1736
  return e ? (r || (r = e.byteLength), this.et(t, e, n, r)) : z.getArrayBuffer(t, {}).then(e => {
@@ -1725,7 +1763,7 @@
1725
1763
  error: t
1726
1764
  };
1727
1765
  }
1728
- const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = Bt(s, e + 28, o), f = a.QUANTIZED_VOLUME_OFFSET, l = a.QUANTIZED_VOLUME_SCALE, d = a.POINTS_LENGTH;
1766
+ const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = Ct(s, e + 28, o), f = a.QUANTIZED_VOLUME_OFFSET, l = a.QUANTIZED_VOLUME_SCALE, d = a.POINTS_LENGTH;
1729
1767
  let m, y = {};
1730
1768
  if (a.extensions && a.extensions["3DTILES_draco_point_compression"]) {
1731
1769
  y = a.extensions["3DTILES_draco_point_compression"], m = new DataView(t, y.byteOffset + c.offset, y.byteLength);
@@ -1733,7 +1771,7 @@
1733
1771
  attributes: y.properties,
1734
1772
  useUniqueIDs: !1
1735
1773
  };
1736
- return this.ut || (this.ut = Wt.draco()), this.ut(m, e).then(e => {
1774
+ return this.ut || (this.ut = Qt.draco()), this.ut(m, e).then(e => {
1737
1775
  const n = e.attributes;
1738
1776
  !a.POSITION && !a.POSITION_QUANTIZED || n.POSITION || n.POSITION_QUANTIZED || (n.POSITION = a.POSITION,
1739
1777
  n.POSITION_QUANTIZED = a.POSITION_QUANTIZED), !(a.RGB || a.RGBA || a.RGB565) || n.RGB || n.RGBA || n.RGB565 || (n.RGB = a.RGB,
@@ -1747,11 +1785,11 @@
1747
1785
  byteOffset: 0,
1748
1786
  itemSize: 1,
1749
1787
  count: t.length,
1750
- componentType: Pt(t.constructor),
1788
+ componentType: Bt(t.constructor),
1751
1789
  array: t
1752
1790
  }, o.push(t.buffer);
1753
1791
  } else if (a.BATCH_ID || Object.keys(h).length) {
1754
- a.BATCH_ID ? r.BATCH_ID = It(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID = re(d);
1792
+ a.BATCH_ID ? r.BATCH_ID = Et(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID = ie(d);
1755
1793
  const e = r.BATCH_ID.array && r.BATCH_ID.array.buffer;
1756
1794
  e && o.indexOf(e) < 0 && o.push(e);
1757
1795
  }
@@ -1767,7 +1805,7 @@
1767
1805
  }
1768
1806
  const b = this.ft(t, a, c.offset, d, o, f, l);
1769
1807
  if (a.BATCH_ID || Object.keys(h).length) {
1770
- a.BATCH_ID ? b.BATCH_ID = It(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID = re(d);
1808
+ a.BATCH_ID ? b.BATCH_ID = Et(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID = ie(d);
1771
1809
  const e = b.BATCH_ID.array && b.BATCH_ID.array.buffer;
1772
1810
  e && o.indexOf(e) < 0 && o.push(e);
1773
1811
  }
@@ -1896,13 +1934,13 @@
1896
1934
  return a;
1897
1935
  }
1898
1936
  at(t, e, n) {
1899
- return Lt(new Float32Array(t.length), t, e, n);
1937
+ return Ut(new Float32Array(t.length), t, e, n);
1900
1938
  }
1901
1939
  rt() {
1902
1940
  return null;
1903
1941
  }
1904
1942
  }
1905
- function re(t) {
1943
+ function ie(t) {
1906
1944
  const e = (n = t) < 256 ? Uint8Array : n < 65536 ? Uint16Array : Uint32Array;
1907
1945
  var n;
1908
1946
  const r = new e(t);
@@ -1912,13 +1950,13 @@
1912
1950
  byteOffset: 0,
1913
1951
  itemSize: 1,
1914
1952
  count: t,
1915
- componentType: Pt(e),
1953
+ componentType: Bt(e),
1916
1954
  array: r
1917
1955
  };
1918
1956
  }
1919
- class se {
1957
+ class oe {
1920
1958
  constructor(t, e) {
1921
- this.i = t, this.Y = e || st;
1959
+ this.i = t, this.Y = e || ot;
1922
1960
  }
1923
1961
  load(t, e, n = 0, r = 0) {
1924
1962
  return e ? this.et(t, e, n, r) : z.getArrayBuffer(t, {}).then(e => {
@@ -1931,12 +1969,12 @@
1931
1969
  const s = this.lt(e, t, n, r), i = [];
1932
1970
  for (let n = 0; n < s.length; n++) {
1933
1971
  let r;
1934
- if ("b3dm" === s[n].magic) r = new Zt(this.i, this.Y); else if ("i3dm" === s[n].magic) r = new Yt(this.i, this.Y); else if ("pnts" === s[n].magic) r = new ne; else {
1972
+ if ("b3dm" === s[n].magic) r = new Yt(this.i, this.Y); else if ("i3dm" === s[n].magic) r = new te(this.i, this.Y); else if ("pnts" === s[n].magic) r = new se; else {
1935
1973
  if ("cmpt" !== s[n].magic) {
1936
1974
  console.warn("Unsupported magic in CMPT tile:", s[n].magic);
1937
1975
  continue;
1938
1976
  }
1939
- r = new se(this.i, this.Y);
1977
+ r = new oe(this.i, this.Y);
1940
1978
  }
1941
1979
  i.push(r.load(t, e, s[n].offset, s[n].byteLength).then(t => t));
1942
1980
  }
@@ -1957,7 +1995,7 @@
1957
1995
  const o = [], a = s.getUint32(12, !0);
1958
1996
  let c = 16;
1959
1997
  for (let e = 0; e < a; e++) {
1960
- const e = At(s, c), r = s.getUint32(c + 8, !0);
1998
+ const e = vt(s, c), r = s.getUint32(c + 8, !0);
1961
1999
  o.push({
1962
2000
  magic: e,
1963
2001
  buffer: t,
@@ -1968,17 +2006,17 @@
1968
2006
  return o;
1969
2007
  }
1970
2008
  }
1971
- function ie(t, e) {
2009
+ function ae(t, e) {
1972
2010
  if (t.scenes && t.scenes.length) for (let n = 0, r = t.scenes.length; n < r; n++) {
1973
2011
  const r = t.scenes[n].nodes;
1974
2012
  for (let n = 0, s = r.length; n < s; n++) {
1975
2013
  const s = [];
1976
- oe(r[n], s, t, e);
2014
+ ce(r[n], s, t, e);
1977
2015
  }
1978
2016
  }
1979
2017
  }
1980
- function oe(t, e, n, r) {
1981
- if (t.matrix && e.push(t.matrix), t.children && t.children.length) for (let s = 0, i = t.children.length; s < i; s++) oe(t.children[s], e, n, r);
2018
+ function ce(t, e, n, r) {
2019
+ if (t.matrix && e.push(t.matrix), t.children && t.children.length) for (let s = 0, i = t.children.length; s < i; s++) ce(t.children[s], e, n, r);
1982
2020
  if (void 0 !== t.mesh) {
1983
2021
  const s = t.mesh, i = n.meshes[s];
1984
2022
  if (i) {
@@ -1990,9 +2028,9 @@
1990
2028
  }
1991
2029
  }
1992
2030
  }
1993
- function ae(t, e) {
2031
+ function he(t, e) {
1994
2032
  let {componentType: n, byteOffset: r, byteStride: s, count: i, itemSize: o} = t;
1995
- const a = t.array.buffer, c = n ? st.getTypedArrayCtor(n) : t.array.constructor;
2033
+ const a = t.array.buffer, c = n ? ot.getTypedArrayCtor(n) : t.array.constructor;
1996
2034
  if (r = void 0 === r ? t.array.byteOffset : r, s = s || 0, i = i || t.array.length / o,
1997
2035
  (!s || s === o * c.BYTES_PER_ELEMENT) && r % c.BYTES_PER_ELEMENT == 0) {
1998
2036
  const t = new c(a, r, i * o);
@@ -2009,27 +2047,27 @@
2009
2047
  e(new c(h.buffer), t), n.set(h);
2010
2048
  }
2011
2049
  }
2012
- const ce = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], he = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], ue = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
2013
- let fe, le = !1;
2050
+ const ue = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], fe = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], le = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
2051
+ let de, me = !1;
2014
2052
  if ("undefined" != typeof OffscreenCanvas) {
2015
2053
  try {
2016
- fe = new OffscreenCanvas(2, 2).getContext("2d");
2054
+ de = new OffscreenCanvas(2, 2).getContext("2d");
2017
2055
  } catch (t) {}
2018
- fe && "undefined" != typeof createImageBitmap && (le = !0);
2056
+ de && "undefined" != typeof createImageBitmap && (me = !0);
2019
2057
  }
2020
- const de = n([]), me = [ 0, 0, 0 ], ye = [], be = [];
2021
- class pe {
2058
+ const ye = n([]), be = [ 0, 0, 0 ], pe = [], we = [];
2059
+ class _e {
2022
2060
  constructor(t, e, n, r) {
2023
2061
  this.id = t, this.options = e, this.dt = this.requestImage.bind(this), this.yt = n,
2024
2062
  this.bt = {}, r(null, {}, []);
2025
2063
  }
2026
2064
  pt(t) {
2027
- this.wt || (this._t = new ne, this.wt = new Zt(this.dt, st, t), this.gt = new Yt(this.dt, st, t));
2065
+ this.wt || (this._t = new se, this.wt = new Yt(this.dt, ot, t), this.gt = new te(this.dt, ot, t));
2028
2066
  }
2029
2067
  requestImage(t, e) {
2030
- le ? fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
2031
- (void 0).width = t.width, (void 0).height = t.height, fe.drawImage(t, 0, 0);
2032
- const n = fe.getImageData(0, 0, (void 0).width, (void 0).height);
2068
+ me ? fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
2069
+ (void 0).width = t.width, (void 0).height = t.height, de.drawImage(t, 0, 0);
2070
+ const n = de.getImageData(0, 0, (void 0).width, (void 0).height);
2033
2071
  e(null, {
2034
2072
  width: t.width,
2035
2073
  height: t.height,
@@ -2044,14 +2082,14 @@
2044
2082
  const n = t.url, r = t.arraybuffer;
2045
2083
  if (r) {
2046
2084
  delete this.bt[n];
2047
- const s = At(new DataView(r), 0);
2085
+ const s = vt(new DataView(r), 0);
2048
2086
  if ("{" === s[0] || " " === s[0]) {
2049
2087
  const t = function(t, e, n) {
2050
- if (ue) {
2088
+ if (le) {
2051
2089
  const r = new Uint8Array(t, e, n);
2052
- return ue.decode(r);
2090
+ return le.decode(r);
2053
2091
  }
2054
- return lt(new Uint8Array(t, e, n));
2092
+ return mt(new Uint8Array(t, e, n));
2055
2093
  }(r, 0, r.byteLength), n = JSON.parse(t);
2056
2094
  e(null, n);
2057
2095
  } else if ("b3dm" === s) {
@@ -2075,7 +2113,7 @@
2075
2113
  e(null, r, i);
2076
2114
  });
2077
2115
  } else if ("cmpt" === s) {
2078
- new se(this.dt, st).load(n, r).then(n => {
2116
+ new oe(this.dt, ot).load(n, r).then(n => {
2079
2117
  const {content: r, transferables: s} = this.Ot(n, t);
2080
2118
  e(null, r, s);
2081
2119
  }).catch(t => {
@@ -2104,13 +2142,13 @@
2104
2142
  const {magic: i} = n[t];
2105
2143
  if ("b3dm" === i) {
2106
2144
  const {content: i, transferables: o} = this.Tt(n[t], e);
2107
- ge(s, o), r.content.push(i);
2145
+ Ae(s, o), r.content.push(i);
2108
2146
  } else if ("i3dm" === i || "pnts" === i) {
2109
2147
  const {transform: i, rootIdx: o} = e, {content: a, transferables: c} = this.At(n[t], i, o);
2110
- ge(s, c), r.content.push(a);
2148
+ Ae(s, c), r.content.push(a);
2111
2149
  } else if ("cmpt" === i) {
2112
2150
  const {content: i, transferables: o} = this.Ot(n[t], e);
2113
- ge(s, o), r.content.push(i);
2151
+ Ae(s, o), r.content.push(i);
2114
2152
  }
2115
2153
  }
2116
2154
  return {
@@ -2131,8 +2169,8 @@
2131
2169
  let i = r && r.RTC_CENTER || [ 0, 0, 0 ];
2132
2170
  if (r.EAST_NORTH_UP && !s.NORMAL_UP && !s.NORMAL_UP_OCT32P) {
2133
2171
  const e = new Float32Array(3 * s.POSITION.array.length), n = [], r = [], o = [];
2134
- ae(s.POSITION, (t, s) => {
2135
- h(o, t, i), Vt(o, null, n), function(t, e) {
2172
+ he(s.POSITION, (t, s) => {
2173
+ h(o, t, i), Ht(o, null, n), function(t, e) {
2136
2174
  t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[4], t[4] = e[5], t[5] = e[6], t[6] = e[8],
2137
2175
  t[7] = e[9], t[8] = e[10];
2138
2176
  }(r, n);
@@ -2156,17 +2194,19 @@
2156
2194
  hmin: 1 / 0,
2157
2195
  hmax: -1 / 0
2158
2196
  };
2159
- we(s.POSITION.array, 3, i, de, o);
2160
- const c = _e(o), u = a([], c);
2161
- ae(s.POSITION, t => {
2162
- t[0] = t[0] + i[0] - u[0], t[1] = t[1] + i[1] - u[1], t[2] = t[2] + i[2] - u[2];
2163
- }), e && y(c, c, e);
2164
- const f = this.Mt(c);
2165
- t.rtcCenter = u, t.rtcCoord = f, t.rootIdx = n;
2166
- const l = t.transferables;
2197
+ ge(s.POSITION.array, 3, i, ye, o);
2198
+ const c = Te(o), u = a([], c), f = [ 1 / 0, 1 / 0, 1 / 0 ], l = [ -1 / 0, -1 / 0, -1 / 0 ];
2199
+ he(s.POSITION, t => {
2200
+ t[0] = t[0] + i[0] - u[0], t[1] = t[1] + i[1] - u[1], t[2] = t[2] + i[2] - u[2],
2201
+ t[0] < f[0] && (f[0] = t[0]), t[1] < f[1] && (f[1] = t[1]), t[2] < f[2] && (f[2] = t[2]),
2202
+ t[0] > l[0] && (l[0] = t[0]), t[1] > l[1] && (l[1] = t[1]), t[2] > l[2] && (l[2] = t[2]);
2203
+ }), s.POSITION.min = f, s.POSITION.max = l, e && y(c, c, e);
2204
+ const d = this.Mt(c);
2205
+ t.rtcCenter = u, t.rtcCoord = d, t.rootIdx = n;
2206
+ const m = t.transferables;
2167
2207
  return delete t.transferables, {
2168
2208
  content: t,
2169
- transferables: l
2209
+ transferables: m
2170
2210
  };
2171
2211
  }
2172
2212
  vt(t) {
@@ -2190,8 +2230,8 @@
2190
2230
  n && n.abort(), delete this.bt[t.url], e(null);
2191
2231
  }
2192
2232
  convertCoordinates(t, e, s, i) {
2193
- let o = e && e.RTC_CENTER || t.extensions && t.extensions.CESIUM_RTC && t.extensions.CESIUM_RTC.center, c = ce;
2194
- "X" === (s = s && s.toUpperCase()) ? c = he : "Z" === s && (c = de), t.extensions = t.extensions || {},
2233
+ let o = e && e.RTC_CENTER || t.extensions && t.extensions.CESIUM_RTC && t.extensions.CESIUM_RTC.center, c = ue;
2234
+ "X" === (s = s && s.toUpperCase()) ? c = fe : "Z" === s && (c = ye), t.extensions = t.extensions || {},
2195
2235
  t.extensions.CESIUM_RTC || (t.extensions.CESIUM_RTC = {}), o && (t.extensions.CESIUM_RTC.center = o);
2196
2236
  const h = {
2197
2237
  xmin: 1 / 0,
@@ -2201,19 +2241,19 @@
2201
2241
  hmin: 1 / 0,
2202
2242
  hmax: -1 / 0
2203
2243
  };
2204
- ie(t, t => {
2244
+ ae(t, t => {
2205
2245
  if (!(t.attributes && t.attributes.POSITION)) return;
2206
- const e = n(ye);
2246
+ const e = n(pe);
2207
2247
  if (t.matrices) for (let n = t.matrices.length - 1; n >= 0; n--) r(e, e, t.matrices[n]);
2208
2248
  const s = t.attributes.POSITION.array, i = t.attributes.POSITION.itemSize;
2209
- r(e, c, e), we(s, i, o || me, e, h);
2249
+ r(e, c, e), ge(s, i, o || be, e, h);
2210
2250
  });
2211
- const u = _e(h), f = a([], u);
2212
- i && y(u, u, i), t.extensions.CESIUM_RTC.coord = this.Mt(u), o || (ie(t, t => {
2251
+ const u = Te(h), f = a([], u);
2252
+ i && y(u, u, i), t.extensions.CESIUM_RTC.coord = this.Mt(u), o || (ae(t, t => {
2213
2253
  if (t.attributes && t.attributes.POSITION) {
2214
2254
  const e = t.attributes.POSITION;
2215
2255
  if (e.array.buffer.projected && e.array.buffer.projected[e.byteOffset]) return;
2216
- const s = n(ye);
2256
+ const s = n(pe);
2217
2257
  if (t.matrices) for (let e = t.matrices.length - 1; e >= 0; e--) r(s, s, t.matrices[e]);
2218
2258
  r(s, c, s);
2219
2259
  const i = function(t, e) {
@@ -2224,19 +2264,22 @@
2224
2264
  t[8] = (o * I - a * S + h * v) * E, t[9] = (r * S - n * I - i * v) * E, t[10] = (m * A - y * g + p * w) * E,
2225
2265
  t[11] = (f * g - u * A - d * w) * E, t[12] = (a * M - o * x - c * v) * E, t[13] = (n * x - r * M + s * v) * E,
2226
2266
  t[14] = (y * _ - m * T - b * w) * E, t[15] = (u * T - f * _ + l * w) * E, t) : null;
2227
- }(be, s);
2228
- ae(e, t => {
2229
- y(t, t, s), t[0] = t[0] - f[0], t[1] = t[1] - f[1], t[2] = t[2] - f[2], y(t, t, i);
2230
- }), e.array.buffer.projected || (e.array.buffer.projected = {}), e.array.buffer.projected[e.byteOffset] = 1;
2267
+ }(we, s), o = [ 1 / 0, 1 / 0, 1 / 0 ], a = [ -1 / 0, -1 / 0, -1 / 0 ];
2268
+ he(e, t => {
2269
+ y(t, t, s), t[0] = t[0] - f[0], t[1] = t[1] - f[1], t[2] = t[2] - f[2], y(t, t, i),
2270
+ t[0] < o[0] && (o[0] = t[0]), t[1] < o[1] && (o[1] = t[1]), t[2] < o[2] && (o[2] = t[2]),
2271
+ t[0] > a[0] && (a[0] = t[0]), t[1] > a[1] && (a[1] = t[1]), t[2] > a[2] && (a[2] = t[2]);
2272
+ }), e.min = o, e.max = a, e.array.buffer.projected || (e.array.buffer.projected = {}),
2273
+ e.array.buffer.projected[e.byteOffset] = 1;
2231
2274
  }
2232
2275
  }), t.extensions.CESIUM_RTC.center = f);
2233
2276
  }
2234
2277
  Mt(t) {
2235
- return 0 === w(t) ? c([], 0, 0, -6378137) : wt([], t);
2278
+ return 0 === w(t) ? c([], 0, 0, -6378137) : gt([], t);
2236
2279
  }
2237
2280
  onRemove() {}
2238
2281
  }
2239
- function we(t, e, n, r, s) {
2282
+ function ge(t, e, n, r, s) {
2240
2283
  const i = [];
2241
2284
  for (let o = 0, a = t.length; o < a; o += e) {
2242
2285
  const {xmin: a, ymin: u, xmax: f, ymax: l, hmin: d, hmax: m} = s;
@@ -2246,23 +2289,23 @@
2246
2289
  b[1] > l && (s.ymax = b[1]), e > 2 && (b[2] < d && (s.hmin = b[2]), b[2] > m && (s.hmax = b[2]));
2247
2290
  }
2248
2291
  }
2249
- function _e(t) {
2292
+ function Te(t) {
2250
2293
  const {xmax: e, ymax: n, xmin: r, ymin: s, hmin: i, hmax: o} = t, a = [ (r + e) / 2, (s + n) / 2, (i + o) / 2 ];
2251
2294
  return e === -1 / 0 && (a[0] = 0), n === -1 / 0 && (a[1] = 0), o === -1 / 0 && (a[2] = 0),
2252
2295
  isNaN(a[2]) && (a[2] = 0), a;
2253
2296
  }
2254
- function ge(t, e) {
2297
+ function Ae(t, e) {
2255
2298
  for (let n = 0; n < e.length; n++) t.indexOf(e[n]) < 0 && t.push(e[n]);
2256
2299
  }
2257
- let Te = 0;
2258
- class Ae {
2300
+ let Oe = 0;
2301
+ class ve {
2259
2302
  constructor(t) {
2260
2303
  this.workerId = t, this.workers = {}, this.St = {};
2261
2304
  }
2262
2305
  addLayer({actorId: t, mapId: e, layerId: n, params: r}, s) {
2263
2306
  if (this.xt(e, n)) return;
2264
2307
  const i = this.It(e, n), o = r.options, a = this.send.bind(this, t);
2265
- this.workers[i] = new pe(n, o, a, s);
2308
+ this.workers[i] = new _e(n, o, a, s);
2266
2309
  }
2267
2310
  removeLayer({mapId: t, layerId: e}, n) {
2268
2311
  const r = this.xt(t, e), s = this.It(t, e);
@@ -2281,7 +2324,7 @@
2281
2324
  delete this.St[e], n && t.error ? n(new Error(t.error)) : n && n(null, t.data);
2282
2325
  }
2283
2326
  send(t, e, n, r, s) {
2284
- const i = s ? `${t}-${Te++}` : null;
2327
+ const i = s ? `${t}-${Oe++}` : null;
2285
2328
  s && (this.St[i] = s), postMessage({
2286
2329
  type: "<request>",
2287
2330
  workerId: this.workerId,
@@ -2301,7 +2344,7 @@
2301
2344
  }
2302
2345
  t.initialize = function() {}, t.onmessage = function(t, e) {
2303
2346
  const n = t.data;
2304
- this.dispatcher || (this.dispatcher = new Ae(t.workerId)), "<response>" === t.type ? this.dispatcher.workerId === t.workerId && this.dispatcher.receive(t) : this.dispatcher[n.command]({
2347
+ this.dispatcher || (this.dispatcher = new ve(t.workerId)), "<response>" === t.type ? this.dispatcher.workerId === t.workerId && this.dispatcher.receive(t) : this.dispatcher[n.command]({
2305
2348
  actorId: n.actorId,
2306
2349
  mapId: n.mapId,
2307
2350
  layerId: n.layerId,
@@ -2513,7 +2556,7 @@
2513
2556
  E(), L(1, 0, 0), L(0, 1, 0), q(), q(), J = new I(9), I != Float32Array && (J[1] = 0,
2514
2557
  J[2] = 0, J[3] = 0, J[5] = 0, J[6] = 0, J[7] = 0), J[0] = 1, J[4] = 1, J[8] = 1;
2515
2558
  /*!
2516
- * @maptalks/gltf-loader v0.25.2
2559
+ * @maptalks/gltf-loader v0.25.3
2517
2560
  * LICENSE : UNLICENSED
2518
2561
  * (c) 2016-2022 maptalks.org
2519
2562
  */
@@ -2524,14 +2567,14 @@
2524
2567
  function Z(t) {
2525
2568
  return !W(t);
2526
2569
  }
2527
- function Y(t) {
2570
+ function Q(t) {
2528
2571
  for (let e = 1; e < arguments.length; e++) {
2529
2572
  const n = arguments[e];
2530
2573
  for (const e in n) t[e] = n[e];
2531
2574
  }
2532
2575
  return t;
2533
2576
  }
2534
- function Q(t) {
2577
+ function Y(t) {
2535
2578
  switch (t) {
2536
2579
  case 5120:
2537
2580
  return Int8Array;
@@ -2570,7 +2613,7 @@
2570
2613
  return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t;
2571
2614
  }([]), at = [ 1, 1, 1 ];
2572
2615
  function ct(t, e, n, r, s, i, o) {
2573
- const a = Q(o);
2616
+ const a = Y(o);
2574
2617
  if ((0 === s || s === r * a.BYTES_PER_ELEMENT) && i % a.BYTES_PER_ELEMENT == 0) {
2575
2618
  const s = new a(e, i, n * r);
2576
2619
  return t.set(s), t;
@@ -2622,23 +2665,29 @@
2622
2665
  getArrayBuffer: (t, e = {}) => (e || (e = {}), e.responseType = "arraybuffer", ft.get(t, e)),
2623
2666
  getJSON: function(t, e = {}) {
2624
2667
  return e && e.jsonp ? ft.jsonp(t) : ((e = e || {}).responseType = "json", ft.get(t, e));
2625
- },
2626
- jsonp: function(t) {
2627
- const e = "_maptalks_jsonp_" + X++;
2628
- t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
2629
- let n = document.createElement("script");
2630
- return n.type = "text/javascript", n.src = t, new Promise(t => {
2631
- window[e] = function(r) {
2632
- document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
2633
- t(r);
2634
- }, document.getElementsByTagName("head")[0].appendChild(n);
2635
- });
2636
2668
  }
2637
2669
  };
2670
+ ft.jsonp = function(t) {
2671
+ const e = "_maptalks_jsonp_" + X++;
2672
+ t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
2673
+ let n = document.createElement("script");
2674
+ return n.type = "text/javascript", n.src = t, new Promise(t => {
2675
+ window[e] = function(r) {
2676
+ document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
2677
+ t(r);
2678
+ }, document.getElementsByTagName("head")[0].appendChild(n);
2679
+ });
2680
+ };
2638
2681
  class lt {
2639
2682
  constructor(t, e, n) {
2640
2683
  this.i = t, this.decoders = e, this.o = n, this.images = {}, this.h = {};
2641
2684
  }
2685
+ abortRequests() {
2686
+ for (const t in this.h) {
2687
+ const e = this.h[t];
2688
+ e && e.xhr && e.xhr.abort();
2689
+ }
2690
+ }
2642
2691
  requestImageFromBufferURI(t, e, n) {
2643
2692
  if (this.buffers[t.id]) {
2644
2693
  const r = this.buffers[t.id], s = this.u(e, r);
@@ -2675,7 +2724,8 @@
2675
2724
  requestExternalImage(t) {
2676
2725
  if (this.images[t.id]) return Promise.resolve(this.images[t.id]);
2677
2726
  const e = 0 === t.uri.indexOf("data:image/") ? t.uri : this.rootPath + "/" + t.uri;
2678
- return this.h[t.id] ? this.h[t.id].then(() => this.images[t.id]) : this.h[t.id] = this.l(t.id, e);
2727
+ if (this.h[t.id]) return this.h[t.id].then(() => this.images[t.id]);
2728
+ return this.h[t.id] = this.l(t.id, e);
2679
2729
  }
2680
2730
  l(t, e) {
2681
2731
  return new Promise((n, r) => {
@@ -2738,7 +2788,8 @@
2738
2788
  });
2739
2789
  }
2740
2790
  g(t, e, n, r = 0) {
2741
- const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h = Q(i.componentType), u = o.byteStride || 0, f = {
2791
+ const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h = Y(i.componentType), u = o.byteStride || 0;
2792
+ const f = {
2742
2793
  array: void 0,
2743
2794
  name: t,
2744
2795
  accessorName: e,
@@ -2852,7 +2903,7 @@
2852
2903
  r.instanceTechnique && r.instanceTechnique.values ? (s = r.instanceTechnique, i = s.values.diffuse) : (s = r,
2853
2904
  i = s.values.tex || s.values.diffuseTex || s.values.diffuse);
2854
2905
  const o = {
2855
- baseColorTexture: {
2906
+ "baseColorTexture": {
2856
2907
  index: i
2857
2908
  }
2858
2909
  };
@@ -2925,7 +2976,7 @@
2925
2976
  }
2926
2977
  createNode(t) {
2927
2978
  const e = {};
2928
- return Y(e, t), !Z(t.weights) && this.gltf.meshes && Z(e.mesh) ? e.weights = this.gltf.meshes[e.mesh].weights : t.weights && (e.weights = t.weights),
2979
+ return Q(e, t), !Z(t.weights) && this.gltf.meshes && Z(e.mesh) ? e.weights = this.gltf.meshes[e.mesh].weights : t.weights && (e.weights = t.weights),
2929
2980
  e;
2930
2981
  }
2931
2982
  S(t) {
@@ -2947,7 +2998,7 @@
2947
2998
  extras: n.extras
2948
2999
  }
2949
3000
  };
2950
- Y(r, e);
3001
+ Q(r, e);
2951
3002
  const s = Z(e.sampler) ? this.gltf.samplers[e.sampler] : void 0;
2952
3003
  return s && (r.sampler = s), t.format && (r.format = t.format), r;
2953
3004
  });
@@ -2973,7 +3024,8 @@
2973
3024
  N(t, e) {
2974
3025
  const n = new Array(t.byteLength);
2975
3026
  for (let e = 0; e < t.byteLength; e++) n[e] = String.fromCharCode(t[e]);
2976
- return n.join(""), "data:" + (e = e || "image/png") + ";base64," + function(t) {
3027
+ n.join("");
3028
+ return "data:" + (e = e || "image/png") + ";base64," + function(t) {
2977
3029
  return "undefined" != typeof self ? self.btoa(t) : window.btoa(t);
2978
3030
  }(unescape(encodeURIComponent(n)));
2979
3031
  }
@@ -2997,19 +3049,19 @@
2997
3049
  });
2998
3050
  }
2999
3051
  }
3000
- const pt = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
3001
- class wt {
3052
+ const pt = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null, wt = 1313821514, _t = 5130562;
3053
+ class gt {
3002
3054
  static read(t, e = 0, n = 0) {
3003
3055
  n || (n = t.byteLength);
3004
3056
  const r = new DataView(t, e, n), s = r.getUint32(4, !0);
3005
- if (1 === s) return wt.readV1(r, e);
3006
- if (2 === s) return wt.readV2(t, e);
3057
+ if (1 === s) return gt.readV1(r, e);
3058
+ if (2 === s) return gt.readV2(t, e);
3007
3059
  throw new Error("Unsupported glb version : " + s);
3008
3060
  }
3009
3061
  static readV1(t, e) {
3010
3062
  const n = t.getUint32(8, !0), r = t.getUint32(12, !0);
3011
3063
  if (n !== t.byteLength) throw new Error("Length in GLB header is inconsistent with glb's byte length.");
3012
- const s = _t(t.buffer, 20 + e, r);
3064
+ const s = Tt(t.buffer, 20 + e, r);
3013
3065
  return {
3014
3066
  json: JSON.parse(s),
3015
3067
  glbBuffer: {
@@ -3027,7 +3079,7 @@
3027
3079
  const a = i.getUint32(o, !0);
3028
3080
  o += 4;
3029
3081
  const c = i.getUint32(o, !0);
3030
- if (o += 4, 1313821514 === c) n = _t(t, e + 12 + o, a); else if (5130562 === c) {
3082
+ if (o += 4, c === wt) n = Tt(t, e + 12 + o, a); else if (c === _t) {
3031
3083
  s = e + 12 + o, r = a;
3032
3084
  break;
3033
3085
  }
@@ -3043,7 +3095,7 @@
3043
3095
  };
3044
3096
  }
3045
3097
  }
3046
- function _t(t, e, n) {
3098
+ function Tt(t, e, n) {
3047
3099
  if (pt) {
3048
3100
  const r = new Uint8Array(t, e, n);
3049
3101
  return pt.decode(r);
@@ -3054,7 +3106,7 @@
3054
3106
  for (let r = 0; r < e; ) {
3055
3107
  let s = t[r++];
3056
3108
  if (128 & s) {
3057
- let n = gt[s >> 3 & 7];
3109
+ let n = At[s >> 3 & 7];
3058
3110
  if (!(64 & s) || !n || r + n > e) return null;
3059
3111
  for (s &= 63 >> n; n > 0; n -= 1) {
3060
3112
  const e = t[r++];
@@ -3067,17 +3119,18 @@
3067
3119
  return n;
3068
3120
  }(new Uint8Array(t, e, n));
3069
3121
  }
3070
- const gt = [ 1, 1, 1, 1, 2, 2, 3, 0 ], Tt = [ 0, 0, 0 ], At = [ 0, 0, 0, 1 ], Ot = [ 1, 1, 1 ], vt = {
3122
+ const At = [ 1, 1, 1, 1, 2, 2, 3, 0 ];
3123
+ const Ot = [ 0, 0, 0 ], vt = [ 0, 0, 0, 1 ], Mt = [ 1, 1, 1 ], St = {
3071
3124
  TRANSLATION: [ 0, 0, 0 ],
3072
3125
  ROTATION: [ 0, 0, 0, 1 ],
3073
3126
  SCALE: [ 1, 1, 1 ]
3074
- }, Mt = {
3127
+ }, xt = {
3075
3128
  PREVIOUS: null,
3076
3129
  NEXT: null,
3077
3130
  PREINDEX: null,
3078
3131
  NEXTINDEX: null,
3079
3132
  INTERPOLATION: null
3080
- }, St = {
3133
+ }, It = {
3081
3134
  P(t, e, n, r, s, i, o, a) {
3082
3135
  const c = Z(t) ? e.animations : [ e.animations[0] ], h = {};
3083
3136
  for (let e = 0; e < c.length; e++) {
@@ -3086,9 +3139,9 @@
3086
3139
  const f = u.channelsMap[n];
3087
3140
  if (f) for (let t = 0; t < f.length; t++) {
3088
3141
  const e = f[t];
3089
- "translation" === e.target.path ? (this.L(s, u.samplers[e.sampler], r, 1), h.translation = B(Tt, s)) : "rotation" === e.target.path ? (this.B(i, u.samplers[e.sampler], r, 1),
3090
- h.rotation = K(At, i)) : "scale" === e.target.path ? (this.L(o, u.samplers[e.sampler], r, 1),
3091
- h.scale = B(Ot, o)) : "weights" === e.target.path && a && (this.L(a, u.samplers[e.sampler], r, a.length),
3142
+ "translation" === e.target.path ? (this.L(s, u.samplers[e.sampler], r, 1), h.translation = B(Ot, s)) : "rotation" === e.target.path ? (this.B(i, u.samplers[e.sampler], r, 1),
3143
+ h.rotation = K(vt, i)) : "scale" === e.target.path ? (this.L(o, u.samplers[e.sampler], r, 1),
3144
+ h.scale = B(Mt, o)) : "weights" === e.target.path && a && (this.L(a, u.samplers[e.sampler], r, a.length),
3092
3145
  h.weights = a);
3093
3146
  }
3094
3147
  }
@@ -3098,7 +3151,7 @@
3098
3151
  switch (e.interpolation) {
3099
3152
  case "LINEAR":
3100
3153
  {
3101
- const s = this.U(Mt, e, n, 1 * r);
3154
+ const s = this.U(xt, e, n, 1 * r);
3102
3155
  s && (t = function(t, e, n, r) {
3103
3156
  for (let s = 0; s < t.length; s++) t[s] = e[s] + r * (n[s] - e[s]);
3104
3157
  return t;
@@ -3108,7 +3161,7 @@
3108
3161
 
3109
3162
  case "STEP":
3110
3163
  {
3111
- const s = this.U(Mt, e, n, 1 * r);
3164
+ const s = this.U(xt, e, n, 1 * r);
3112
3165
  s && (t = function(t, e) {
3113
3166
  for (let n = 0; n < t.length; n++) t[n] = e[n];
3114
3167
  return t;
@@ -3118,7 +3171,7 @@
3118
3171
 
3119
3172
  case "CUBICSPLINE":
3120
3173
  {
3121
- const s = this.U(Mt, e, n, 3 * r);
3174
+ const s = this.U(xt, e, n, 3 * r);
3122
3175
  s && (t = this.C(t, s, e.input.array, 3 * r));
3123
3176
  break;
3124
3177
  }
@@ -3129,21 +3182,21 @@
3129
3182
  switch (e.interpolation) {
3130
3183
  case "LINEAR":
3131
3184
  {
3132
- const r = this.U(Mt, e, n, 1);
3185
+ const r = this.U(xt, e, n, 1);
3133
3186
  r && $(t, r.PREVIOUS, r.NEXT, r.INTERPOLATION);
3134
3187
  break;
3135
3188
  }
3136
3189
 
3137
3190
  case "STEP":
3138
3191
  {
3139
- const r = this.U(Mt, e, n, 1);
3192
+ const r = this.U(xt, e, n, 1);
3140
3193
  r && (t = H(t, ...r.PREVIOUS));
3141
3194
  break;
3142
3195
  }
3143
3196
 
3144
3197
  case "CUBICSPLINE":
3145
3198
  {
3146
- const r = this.U(Mt, e, n, 3);
3199
+ const r = this.U(xt, e, n, 3);
3147
3200
  if (r) {
3148
3201
  for (let t = 0; t < r.PREVIOUS.length; t++) r.PREVIOUS[t] = Math.acos(r.PREVIOUS[t]),
3149
3202
  r.NEXT[t] = Math.acos(r.NEXT[t]);
@@ -3194,7 +3247,8 @@
3194
3247
  },
3195
3248
  getAnimationClip(t, e, n, r) {
3196
3249
  const s = t.nodes[e] && t.nodes[e].weights;
3197
- return U(Tt, ...vt.TRANSLATION), H(At, ...vt.ROTATION), U(Ot, ...vt.SCALE), this.P(r, t, e, n, Tt, At, Ot, s);
3250
+ U(Ot, ...St.TRANSLATION), H(vt, ...St.ROTATION), U(Mt, ...St.SCALE);
3251
+ return this.P(r, t, e, n, Ot, vt, Mt, s);
3198
3252
  },
3199
3253
  getTimeSpan(t) {
3200
3254
  if (!t.animations) return null;
@@ -3219,24 +3273,27 @@
3219
3273
  return n ? Z(e) ? n[e] : n[Object.keys(n)[0]] : null;
3220
3274
  }
3221
3275
  };
3222
- let xt = !1;
3276
+ let Nt = !1;
3223
3277
  if ("undefined" != typeof OffscreenCanvas) {
3224
3278
  let t;
3225
3279
  try {
3226
3280
  t = new OffscreenCanvas(2, 2).getContext("2d");
3227
- } catch (zn) {}
3228
- t && "undefined" != typeof createImageBitmap && (xt = !0);
3281
+ } catch (t) {}
3282
+ t && "undefined" != typeof createImageBitmap && (Nt = !0);
3229
3283
  }
3230
- const It = "undefined" == typeof document ? null : document.createElement("canvas");
3231
- class Nt {
3284
+ const Et = "undefined" == typeof document ? null : document.createElement("canvas");
3285
+ class Pt {
3232
3286
  constructor(t, e, n) {
3233
3287
  if (this.options = n || {}, this.options.decoders || (this.options.decoders = {}),
3234
3288
  e.buffer instanceof ArrayBuffer) {
3235
- const {json: n, glbBuffer: r} = wt.read(e.buffer, e.byteOffset, e.byteLength);
3289
+ const {json: n, glbBuffer: r} = gt.read(e.buffer, e.byteOffset, e.byteLength);
3236
3290
  this.F(t, n, r);
3237
3291
  } else this.F(t, e);
3238
3292
  this.D = new mt(this.rootPath, this.gltf, this.glbBuffer), this.k();
3239
3293
  }
3294
+ abort() {
3295
+ this.adapter && this.adapter.abortRequests();
3296
+ }
3240
3297
  k() {
3241
3298
  const t = this.gltf.extensionsRequired;
3242
3299
  if (t) {
@@ -3283,20 +3340,20 @@
3283
3340
  return t;
3284
3341
  }
3285
3342
  static getAnimationClip(t, e, n, r) {
3286
- return St.getAnimationClip(t, e, n, r);
3343
+ return It.getAnimationClip(t, e, n, r);
3287
3344
  }
3288
3345
  static getAnimationTimeSpan(t, e) {
3289
- return St.getTimeSpanByName(t, e);
3346
+ return It.getTimeSpanByName(t, e);
3290
3347
  }
3291
3348
  static getTypedArrayCtor(t) {
3292
- return Q(t);
3349
+ return Y(t);
3293
3350
  }
3294
3351
  static readInterleavedArray(t, e, n, r, s, i, o) {
3295
3352
  return ct(t, e, n, r, s, i, o);
3296
3353
  }
3297
3354
  F(t, e, n) {
3298
3355
  this.gltf = e, this.glbBuffer = n, this.version = e.asset ? +e.asset.version : 1,
3299
- this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = xt ? Bt : this.options.requestImage || Et,
3356
+ this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = Nt ? Ct : this.options.requestImage || Lt,
3300
3357
  this.options.transferable && (this.transferables = []), 2 === this.version ? (this.adapter = new bt(t, e, n, this.options.requestImage, this.options.decoders || {}, this.options.supportedFormats || {}),
3301
3358
  this.adapter.iterate((t, e, n) => {
3302
3359
  e.id = "buffer_" + n;
@@ -3313,7 +3370,7 @@
3313
3370
  }
3314
3371
  q(t, e) {
3315
3372
  if (t.children && t.children.length > 0) {
3316
- if (!("number" == typeof (n = t.children[0]) && isFinite(n) || function(t) {
3373
+ if (!(n = t.children[0], "number" == typeof n && isFinite(n) || function(t) {
3317
3374
  return !W(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String);
3318
3375
  }(t.children[0]))) return t;
3319
3376
  const r = t.children.map(t => {
@@ -3392,7 +3449,7 @@
3392
3449
  const n = t.primitives.map(t => this.Z(t, e)).filter(t => !!t);
3393
3450
  return Promise.all(n).then(e => {
3394
3451
  const n = {};
3395
- return Y(n, t), n.primitives = e, n;
3452
+ return Q(n, t), n.primitives = e, n;
3396
3453
  });
3397
3454
  }
3398
3455
  H() {
@@ -3478,12 +3535,12 @@
3478
3535
  });
3479
3536
  }
3480
3537
  }
3481
- function Et(t, e) {
3538
+ function Lt(t, e) {
3482
3539
  const n = new Image;
3483
3540
  n.crossOrigin = "", n.onload = () => {
3484
- if (!It) return void e(new Error("There is no canvas to draw image!"));
3485
- It.width = n.width, It.height = n.height;
3486
- const t = It.getContext("2d");
3541
+ if (!Et) return void e(new Error("There is no canvas to draw image!"));
3542
+ Et.width = n.width, Et.height = n.height;
3543
+ const t = Et.getContext("2d");
3487
3544
  t.drawImage(n, 0, 0, n.width, n.height);
3488
3545
  const r = t.getImageData(0, 0, n.width, n.height), s = {
3489
3546
  width: n.width,
@@ -3495,20 +3552,23 @@
3495
3552
  e(t);
3496
3553
  }, n.src = t;
3497
3554
  }
3498
- let Pt, Lt;
3499
- function Bt(t, e) {
3500
- Pt || (Pt = new OffscreenCanvas(2, 2), Lt = Pt.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
3501
- Pt.width = t.width, Pt.height = t.height, Lt.drawImage(t, 0, 0);
3502
- const n = Lt.getImageData(0, 0, Pt.width, Pt.height);
3555
+ let Bt, Ut;
3556
+ function Ct(t, e) {
3557
+ Bt || (Bt = new OffscreenCanvas(2, 2), Ut = Bt.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
3558
+ const {width: n, height: r} = t;
3559
+ Bt.width = n, Bt.height = r, Ut.drawImage(t, 0, 0), t.close();
3560
+ const s = Ut.getImageData(0, 0, n, r);
3503
3561
  e(null, {
3504
- width: t.width,
3505
- height: t.height,
3506
- data: new Uint8Array(n.data)
3562
+ width: n,
3563
+ height: r,
3564
+ data: new Uint8Array(s.data)
3507
3565
  });
3566
+ }).catch(t => {
3567
+ console.warn(t), e(t);
3508
3568
  });
3509
3569
  }
3510
- const Ut = "undefined" == typeof document ? null : document.createElement("canvas");
3511
- class Ct extends s.worker.Actor {
3570
+ const Rt = "undefined" == typeof document ? null : document.createElement("canvas");
3571
+ class Ft extends s.worker.Actor {
3512
3572
  constructor(t, e) {
3513
3573
  super(t), this.mapId = e;
3514
3574
  }
@@ -3561,20 +3621,20 @@
3561
3621
  const n = new Image;
3562
3622
  n.onload = () => {
3563
3623
  if (!this.isActive()) return;
3564
- if (!Ut) return void e(new Error("There is no canvas to draw image!"));
3624
+ if (!Rt) return void e(new Error("There is no canvas to draw image!"));
3565
3625
  const t = function(t) {
3566
- if (Rt(t.width) && Rt(t.height)) return t;
3626
+ if (Dt(t.width) && Dt(t.height)) return t;
3567
3627
  let e = t.width, n = t.height;
3568
- Rt(e) || (e = Ft(e));
3569
- Rt(n) || (n = Ft(n));
3628
+ Dt(e) || (e = kt(e));
3629
+ Dt(n) || (n = kt(n));
3570
3630
  const r = document.createElement("canvas");
3571
3631
  r.width = e, r.height = n, r.getContext("2d").drawImage(t, 0, 0, e, n);
3572
3632
  const s = t.src, i = s.lastIndexOf("/") + 1, o = s.substring(i);
3573
3633
  return console.warn(`Texture(${o})'s size is not power of two, resize from (${t.width}, ${t.height}) to (${e}, ${n})`),
3574
3634
  r;
3575
3635
  }(n);
3576
- Ut.width = t.width, Ut.height = t.height;
3577
- const r = Ut.getContext("2d");
3636
+ Rt.width = t.width, Rt.height = t.height;
3637
+ const r = Rt.getContext("2d");
3578
3638
  r.drawImage(t, 0, 0, t.width, t.height);
3579
3639
  const s = r.getImageData(0, 0, t.width, t.height), i = {
3580
3640
  width: t.width,
@@ -3587,13 +3647,13 @@
3587
3647
  }, n.src = t;
3588
3648
  }
3589
3649
  }
3590
- function Rt(t) {
3650
+ function Dt(t) {
3591
3651
  return 0 == (t & t - 1) && 0 !== t;
3592
3652
  }
3593
- function Ft(t) {
3653
+ function kt(t) {
3594
3654
  return Math.pow(2, Math.floor(Math.log(t) / Math.LN2));
3595
3655
  }
3596
- class Dt {
3656
+ class zt {
3597
3657
  constructor(t, e) {
3598
3658
  this.max = t, this.currentSize = 0, this.onRemove = e, this.reset();
3599
3659
  }
@@ -3673,17 +3733,17 @@
3673
3733
  for (const n of e) n.current = t;
3674
3734
  }
3675
3735
  }
3676
- function kt(t, e) {
3736
+ function jt(t, e) {
3677
3737
  if (t.scenes && t.scenes.length) for (let n = 0, r = t.scenes.length; n < r; n++) {
3678
3738
  const r = t.scenes[n].nodes;
3679
3739
  for (let n = 0, s = r.length; n < s; n++) {
3680
3740
  const s = [];
3681
- zt(r[n], s, t, e);
3741
+ Vt(r[n], s, t, e);
3682
3742
  }
3683
3743
  }
3684
3744
  }
3685
- function zt(t, e, n, r) {
3686
- if (t.matrix && e.push(t.matrix), t.children && t.children.length) for (let s = 0, i = t.children.length; s < i; s++) zt(t.children[s], e, n, r);
3745
+ function Vt(t, e, n, r) {
3746
+ if (t.matrix && e.push(t.matrix), t.children && t.children.length) for (let s = 0, i = t.children.length; s < i; s++) Vt(t.children[s], e, n, r);
3687
3747
  if (void 0 !== t.mesh) {
3688
3748
  const s = t.mesh, i = n.meshes[s];
3689
3749
  if (i) {
@@ -3695,9 +3755,9 @@
3695
3755
  }
3696
3756
  }
3697
3757
  }
3698
- function jt(t, e, n) {
3758
+ function Gt(t, e, n) {
3699
3759
  let {componentType: r, byteOffset: s, byteStride: i, itemSize: o} = e;
3700
- const a = e.array.buffer, c = r ? Nt.getTypedArrayCtor(r) : e.array.constructor;
3760
+ const a = e.array.buffer, c = r ? Pt.getTypedArrayCtor(r) : e.array.constructor;
3701
3761
  if (s = void 0 === s ? e.array.byteOffset : s, i = i || 0, !i || i === o * c.BYTES_PER_ELEMENT && s % c.BYTES_PER_ELEMENT == 0) {
3702
3762
  const e = new c(a, s + n * o * c.BYTES_PER_ELEMENT, o);
3703
3763
  return t.set(e), t;
@@ -3706,29 +3766,29 @@
3706
3766
  const h = new Uint8Array(a, i * n + s, o * c.BYTES_PER_ELEMENT);
3707
3767
  return new Uint8Array(t.buffer).set(h), t;
3708
3768
  }
3709
- function Vt(t, e, n, r) {
3769
+ function Ht(t, e, n, r) {
3710
3770
  t[4 * e] = n[r], t[4 * e + 1] = n[r + 4], t[4 * e + 2] = n[r + 8], t[4 * e + 3] = n[r + 12];
3711
3771
  }
3712
- const Gt = new Array(3), Ht = new Array(3), qt = [ 40680631590769, 40680631590769, 40408299984661.445 ];
3713
- function $t(t, e, n, r) {
3714
- const s = qt, i = Math.cos(n);
3715
- Gt[0] = i * Math.cos(e), Gt[1] = i * Math.sin(e), Gt[2] = Math.sin(n), ne(Gt, Gt),
3716
- R(Ht, s, Gt);
3717
- const o = Math.sqrt(k(Gt, Ht));
3772
+ const qt = new Array(3), $t = new Array(3), Jt = [ 40680631590769, 40680631590769, 40408299984661.445 ];
3773
+ function Kt(t, e, n, r) {
3774
+ const s = Jt, i = Math.cos(n);
3775
+ qt[0] = i * Math.cos(e), qt[1] = i * Math.sin(e), qt[2] = Math.sin(n), se(qt, qt),
3776
+ R($t, s, qt);
3777
+ const o = Math.sqrt(k(qt, $t));
3718
3778
  var a, c, h;
3719
- return c = Ht, h = o, (a = Ht)[0] = c[0] / h, a[1] = c[1] / h, a[2] = c[2] / h,
3720
- F(Gt, Gt, r), function(t, e, n) {
3779
+ return c = $t, h = o, (a = $t)[0] = c[0] / h, a[1] = c[1] / h, a[2] = c[2] / h,
3780
+ F(qt, qt, r), function(t, e, n) {
3721
3781
  return t[0] = e[0] + n[0], t[1] = e[1] + n[1], t[2] = e[2] + n[2], t;
3722
- }(t, Ht, Gt);
3782
+ }(t, $t, qt);
3723
3783
  }
3724
- const Jt = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], Kt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], Xt = new Array(3), Wt = new Array(3), Zt = new Array(3);
3725
- function Yt(t, e) {
3726
- const n = Kt, r = function(t, e, n, r, s) {
3727
- const i = e[0], o = e[1], a = e[2], c = n[0], h = n[1], u = n[2], f = i * i * c * c, l = o * o * h * h, d = a * a * u * u, m = f + l + d, y = Math.sqrt(1 / m), b = F(Qt, e, y);
3784
+ const Xt = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], Wt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], Zt = new Array(3), Qt = new Array(3), Yt = new Array(3);
3785
+ function te(t, e) {
3786
+ const n = Wt, r = function(t, e, n, r, s) {
3787
+ const i = e[0], o = e[1], a = e[2], c = n[0], h = n[1], u = n[2], f = i * i * c * c, l = o * o * h * h, d = a * a * u * u, m = f + l + d, y = Math.sqrt(1 / m), b = F(ee, e, y);
3728
3788
  if (m < s) return isFinite(y) ? b : void 0;
3729
- const p = r[0], w = r[1], _ = r[2], g = te;
3789
+ const p = r[0], w = r[1], _ = r[2], g = ne;
3730
3790
  g[0] = b[0] * p * 2, g[1] = b[1] * w * 2, g[2] = b[2] * _ * 2;
3731
- let T, A, O, v, M, S, x, I, N, E, P, L = (1 - y) * ee(e) / (.5 * ee(g)), B = 0;
3791
+ let T, A, O, v, M, S, x, I, N, E, P, L = (1 - y) * re(e) / (.5 * re(g)), B = 0;
3732
3792
  do {
3733
3793
  L -= B, O = 1 / (1 + L * p), v = 1 / (1 + L * w), M = 1 / (1 + L * _), S = O * O,
3734
3794
  x = v * v, I = M * M, N = S * O, E = x * v, P = I * M, T = f * S + l * x + d * I - 1,
@@ -3736,33 +3796,33 @@
3736
3796
  B = T / (-2 * A);
3737
3797
  } while (Math.abs(T) > 1e-12);
3738
3798
  return t[0] = i * O, t[1] = o * v, t[2] = a * M, t;
3739
- }(Xt, e, Jt, n, .1);
3740
- let s = V(Wt, r, n);
3741
- s = ne(s, s);
3742
- const i = j(Zt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = _(k(i, e)) * ee(i);
3799
+ }(Zt, e, Xt, n, .1);
3800
+ let s = V(Qt, r, n);
3801
+ s = se(s, s);
3802
+ const i = j(Yt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = _(k(i, e)) * re(i);
3743
3803
  return t[0] = p(o), t[1] = p(a), t[2] = c, t;
3744
3804
  }
3745
- const Qt = new Array(3), te = new Array(3);
3746
- function ee(t) {
3805
+ const ee = new Array(3), ne = new Array(3);
3806
+ function re(t) {
3747
3807
  return P(t);
3748
3808
  }
3749
- function ne(t, e) {
3809
+ function se(t, e) {
3750
3810
  const n = e[0], r = e[1], s = e[2];
3751
3811
  let i = n * n + r * r + s * s;
3752
3812
  return i > 0 && (i = Math.sqrt(i), t[0] = e[0] / i, t[1] = e[1] / i, t[2] = e[2] / i),
3753
3813
  t;
3754
3814
  }
3755
- function re(t, e) {
3756
- return R(e, t, Kt), D(e, e);
3815
+ function ie(t, e) {
3816
+ return R(e, t, Wt), D(e, e);
3757
3817
  }
3758
- var se = Object.freeze({
3818
+ var oe = Object.freeze({
3759
3819
  __proto__: null,
3760
- radianToCartesian3: $t,
3761
- cartesian3ToDegree: Yt,
3762
- normalizeCartesian: ne,
3763
- geodeticSurfaceNormal: re
3820
+ radianToCartesian3: Kt,
3821
+ cartesian3ToDegree: te,
3822
+ normalizeCartesian: se,
3823
+ geodeticSurfaceNormal: ie
3764
3824
  });
3765
- function ie(t, e) {
3825
+ function ae(t, e) {
3766
3826
  let n = "";
3767
3827
  for (let r = 0; r < 4; r++) {
3768
3828
  const s = t.getUint8(e + r);
@@ -3770,27 +3830,27 @@
3770
3830
  }
3771
3831
  return n;
3772
3832
  }
3773
- const oe = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
3774
- function ae(t, e, n) {
3833
+ const ce = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
3834
+ function he(t, e, n) {
3775
3835
  const r = new Uint8Array(t, e, n);
3776
- return oe ? JSON.parse(oe.decode(r)) : JSON.parse(T(r));
3836
+ return ce ? JSON.parse(ce.decode(r)) : JSON.parse(T(r));
3777
3837
  }
3778
- function ce(t, e, n) {
3838
+ function ue(t, e, n) {
3779
3839
  const r = new Uint8Array(t, e, n);
3780
- return oe ? JSON.parse(oe.decode(r)) : JSON.parse(T(r));
3840
+ return ce ? JSON.parse(ce.decode(r)) : JSON.parse(T(r));
3781
3841
  }
3782
- function he(t, e, n) {
3842
+ function fe(t, e, n) {
3783
3843
  return {
3784
3844
  offset: e,
3785
3845
  byteLength: n
3786
3846
  };
3787
3847
  }
3788
- function ue(t, e, n, r) {
3848
+ function le(t, e, n, r) {
3789
3849
  const {byteOffset: s, componentType: i, type: o} = t, {ctor: a, type: c} = function(t) {
3790
- return de[t];
3850
+ return ye[t];
3791
3851
  }(i), h = function(t) {
3792
3852
  if (!t) return 1;
3793
- return le[t];
3853
+ return me[t];
3794
3854
  }(o);
3795
3855
  return {
3796
3856
  byteStride: 0,
@@ -3801,19 +3861,19 @@
3801
3861
  array: new a(e, n + s, r * h)
3802
3862
  };
3803
3863
  }
3804
- function fe(t, e, n, r) {
3864
+ function de(t, e, n, r) {
3805
3865
  t.componentType || (t.componentType = "UNSIGNED_SHORT");
3806
- const s = ue(t, e, n, r);
3866
+ const s = le(t, e, n, r);
3807
3867
  return s.array.buffer.byteLength !== e.byteLength && (s.array = s.array.slice()),
3808
3868
  s;
3809
3869
  }
3810
- const le = {
3870
+ const me = {
3811
3871
  "SCALAR": 1,
3812
3872
  "VEC2": 2,
3813
3873
  "VEC3": 3,
3814
3874
  "VEC4": 4
3815
3875
  };
3816
- const de = {
3876
+ const ye = {
3817
3877
  "BYTE": {
3818
3878
  ctor: Int8Array,
3819
3879
  type: 5120,
@@ -3855,27 +3915,27 @@
3855
3915
  name: "Float64Array"
3856
3916
  }
3857
3917
  };
3858
- function me(t) {
3859
- for (let e in de) if (t === de[e].ctor) return de[e].type;
3918
+ function be(t) {
3919
+ for (let e in ye) if (t === ye[e].ctor) return ye[e].type;
3860
3920
  throw new Error("unrecognized ctor:" + t);
3861
3921
  }
3862
- function ye(t, e, n, r) {
3922
+ function pe(t, e, n, r) {
3863
3923
  const s = t, i = e.length / 3;
3864
3924
  for (let t = 0; t < i; t++) s[3 * t] = e[3 * t] / 65535 * r[0] + n[0], s[3 * t + 1] = e[3 * t + 1] / 65535 * r[1] + n[1],
3865
3925
  s[3 * t + 2] = e[3 * t + 2] / 65535 * r[2] + n[2];
3866
3926
  return s;
3867
3927
  }
3868
- function be(t, e, n) {
3928
+ function we(t, e, n) {
3869
3929
  let r = t.getUint32(12, !0), s = t.getUint32(16, !0), i = t.getUint32(20, !0), o = t.getUint32(24, !0);
3870
3930
  const a = t.buffer;
3871
3931
  let c, h, u = {}, f = {};
3872
- r > 0 && (u = ae(a, e, r), e += r), s > 0 && (c = function(t, e, n) {
3932
+ r > 0 && (u = he(a, e, r), e += r), s > 0 && (c = function(t, e, n) {
3873
3933
  return {
3874
3934
  offset: e,
3875
3935
  byteLength: n
3876
3936
  };
3877
- }(0, e, s), e += s), i > 0 && (f = ce(a, e, i), e += i);
3878
- const l = he(0, e, o);
3937
+ }(0, e, s), e += s), i > 0 && (f = ue(a, e, i), e += i);
3938
+ const l = fe(0, e, o);
3879
3939
  return h = a.slice(l.offset, l.offset + l.byteLength), n.push(h), {
3880
3940
  featureTable: u,
3881
3941
  featureTableBin: c,
@@ -3883,33 +3943,33 @@
3883
3943
  batchTableBin: h
3884
3944
  };
3885
3945
  }
3886
- var pe = {
3946
+ var _e = {
3887
3947
  north: [ -1, 0, 0 ],
3888
3948
  east: [ 0, 1, 0 ],
3889
3949
  up: [ 0, 0, 1 ],
3890
3950
  south: [ 1, 0, 0 ],
3891
3951
  west: [ 0, -1, 0 ],
3892
3952
  down: [ 0, 0, -1 ]
3893
- }, we = {}, _e = {
3953
+ }, ge = {}, Te = {
3894
3954
  east: [],
3895
3955
  north: [],
3896
3956
  up: [],
3897
3957
  west: [],
3898
3958
  south: [],
3899
3959
  down: []
3900
- }, ge = [], Te = [], Ae = [];
3901
- const Oe = [ 0, 0, 0 ];
3902
- function ve(t, e, n, r) {
3960
+ }, Ae = [], Oe = [], ve = [];
3961
+ const Me = [ 0, 0, 0 ];
3962
+ function Se(t, e, n, r) {
3903
3963
  n = n || 0, r = r || n;
3904
3964
  var s = Math.abs(t - e);
3905
3965
  return s <= r || s <= n * Math.max(Math.abs(t), Math.abs(e));
3906
3966
  }
3907
- function Me(t, e, n) {
3967
+ function xe(t, e, n) {
3908
3968
  return n[0] = t[0], n[1] = t[1], n[2] = t[2], n[3] = t[3], n[4] = t[4], n[5] = t[5],
3909
3969
  n[6] = t[6], n[7] = t[7], n[8] = t[8], n[9] = t[9], n[10] = t[10], n[11] = t[11],
3910
3970
  n[12] = e[0], n[13] = e[1], n[14] = e[2], n[15] = t[15], n;
3911
3971
  }
3912
- const Se = (Ee = {
3972
+ const Ie = (Le = {
3913
3973
  up: {
3914
3974
  south: "east",
3915
3975
  north: "west",
@@ -3946,39 +4006,38 @@
3946
4006
  north: "up",
3947
4007
  south: "down"
3948
4008
  }
3949
- }[xe = "east"][Ie = "north"], we[Pe = xe + Ie] ? Ne = we[Pe] : (Ne = function(t, e, n) {
3950
- if (function(t, e) {
3951
- var n = t[0], r = t[1], s = t[2], i = e[0], o = e[1], a = e[2];
3952
- return Math.abs(n - i) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(i)) && Math.abs(r - o) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(o)) && Math.abs(s - a) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(a));
3953
- }(t, Oe)) B(ge, pe[xe]), B(Te, pe[Ie]), B(Ae, pe[Ee]); else if (ve(t[0], 0, 1e-14) && ve(t[1], 0, 1e-14)) {
4009
+ }[Ne = "east"][Ee = "north"], ge[Be = Ne + Ee] ? Pe = ge[Be] : (Pe = function(t, e, n) {
4010
+ if (a = Me, c = (o = t)[0], h = o[1], u = o[2], f = a[0], l = a[1], d = a[2], Math.abs(c - f) <= 1e-6 * Math.max(1, Math.abs(c), Math.abs(f)) && Math.abs(h - l) <= 1e-6 * Math.max(1, Math.abs(h), Math.abs(l)) && Math.abs(u - d) <= 1e-6 * Math.max(1, Math.abs(u), Math.abs(d))) B(Ae, _e[Ne]),
4011
+ B(Oe, _e[Ee]), B(ve, _e[Le]); else if (Se(t[0], 0, 1e-14) && Se(t[1], 0, 1e-14)) {
3954
4012
  var r = _(t[2]);
3955
- B(ge, pe[xe]), "east" !== xe && "west" !== xe && F(ge, ge, r), B(Te, pe[Ie]), "east" !== Ie && "west" !== Ie && F(Te, Te, r),
3956
- B(Ae, pe[Ee]), "east" !== Ee && "west" !== Ee && F(Ae, Ae, r);
4013
+ B(Ae, _e[Ne]), "east" !== Ne && "west" !== Ne && F(Ae, Ae, r), B(Oe, _e[Ee]), "east" !== Ee && "west" !== Ee && F(Oe, Oe, r),
4014
+ B(ve, _e[Le]), "east" !== Le && "west" !== Le && F(ve, ve, r);
3957
4015
  } else {
3958
- re(t, _e.up);
3959
- var s = _e.up, i = _e.east;
3960
- i[0] = -t[1], i[1] = t[0], i[2] = 0, D(_e.east, i), z(_e.north, s, i), F(_e.down, _e.up, -1),
3961
- F(_e.west, _e.east, -1), F(_e.south, _e.north, -1), ge = _e[xe], Te = _e[Ie], Ae = _e[Ee];
3962
- }
3963
- return n[0] = ge[0], n[1] = ge[1], n[2] = ge[2], n[3] = 0, n[4] = Te[0], n[5] = Te[1],
3964
- n[6] = Te[2], n[7] = 0, n[8] = Ae[0], n[9] = Ae[1], n[10] = Ae[2], n[11] = 0, n[12] = t[0],
4016
+ ie(t, Te.up);
4017
+ var s = Te.up, i = Te.east;
4018
+ i[0] = -t[1], i[1] = t[0], i[2] = 0, D(Te.east, i), z(Te.north, s, i), F(Te.down, Te.up, -1),
4019
+ F(Te.west, Te.east, -1), F(Te.south, Te.north, -1), Ae = Te[Ne], Oe = Te[Ee], ve = Te[Le];
4020
+ }
4021
+ var o, a, c, h, u, f, l, d;
4022
+ return n[0] = Ae[0], n[1] = Ae[1], n[2] = Ae[2], n[3] = 0, n[4] = Oe[0], n[5] = Oe[1],
4023
+ n[6] = Oe[2], n[7] = 0, n[8] = ve[0], n[9] = ve[1], n[10] = ve[2], n[11] = 0, n[12] = t[0],
3965
4024
  n[13] = t[1], n[14] = t[2], n[15] = 1, n;
3966
- }, we[Pe] = Ne), Ne);
3967
- var xe, Ie, Ne, Ee, Pe;
3968
- const Le = [], Be = [], Ue = [], Ce = [], Re = [], Fe = [], De = [], ke = {
4025
+ }, ge[Be] = Pe), Pe);
4026
+ var Ne, Ee, Pe, Le, Be;
4027
+ const Ue = [], Ce = [], Re = [], Fe = [], De = [], ke = [], ze = [], je = {
3969
4028
  x: 0,
3970
4029
  y: 0
3971
- }, ze = {
4030
+ }, Ve = {
3972
4031
  x: 0,
3973
4032
  y: 0
3974
- }, je = Math.PI / 180;
3975
- const {getTextureMagFilter: Ve, getTextureMinFilter: Ge, getTextureWrap: He, getMaterialType: qe, getMaterialFormat: $e, getPrimitive: Je, getUniqueREGLBuffer: Ke} = n.reshader.REGLHelper, Xe = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], We = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], {loginIBLResOnCanvas: Ze, logoutIBLResOnCanvas: Ye, getIBLResOnCanvas: Qe, getPBRUniforms: tn} = n.reshader.pbr.PBRUtils, en = {
4033
+ }, Ge = Math.PI / 180;
4034
+ const {getTextureMagFilter: He, getTextureMinFilter: qe, getTextureWrap: $e, getMaterialType: Je, getMaterialFormat: Ke, getPrimitive: Xe, getUniqueREGLBuffer: We} = n.reshader.REGLHelper, Ze = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], Qe = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], {loginIBLResOnCanvas: Ye, logoutIBLResOnCanvas: tn, getIBLResOnCanvas: en, getPBRUniforms: nn} = n.reshader.pbr.PBRUtils, rn = {
3976
4035
  factor: 0,
3977
4036
  units: 0
3978
- }, nn = {
4037
+ }, sn = {
3979
4038
  specularStrength: 0,
3980
4039
  materialShininess: 1
3981
- }, rn = [ 1, 1, 1 ], sn = n.mat4.identity([]), on = t => t.material instanceof n.reshader.PhongMaterial, an = t => t.material instanceof n.reshader.pbr.StandardMaterial, cn = [ !0, !0, !0, !0 ], hn = [], un = new s.Coordinate(0, 0), fn = [], ln = [], dn = {
4040
+ }, on = [ 1, 1, 1 ], an = n.mat4.identity([]), cn = t => t.material instanceof n.reshader.PhongMaterial, hn = t => t.material instanceof n.reshader.pbr.StandardMaterial, un = [ !0, !0, !0, !0 ], fn = [], ln = new s.Coordinate(0, 0), dn = [], mn = [], yn = {
3982
4041
  "POSITION": "POSITION",
3983
4042
  "NORMAL": "NORMAL",
3984
4043
  "TEXCOORD_0": "TEXCOORD_0",
@@ -3986,7 +4045,7 @@
3986
4045
  "COLOR_0": "COLOR_0",
3987
4046
  "TANGENT": "TANGENT"
3988
4047
  };
3989
- class mn {
4048
+ class bn {
3990
4049
  constructor(t, e) {
3991
4050
  this.Nt = e, this.Et = e.getRenderer().canvas, this.Pt = new s.SpatialReference,
3992
4051
  this.Lt = t, this.Bt = new n.reshader.Renderer(t), this.Ut = {}, this.Ct = {}, this.Rt = {},
@@ -4012,16 +4071,16 @@
4012
4071
  paint(t, e, n, r) {
4013
4072
  const s = this.getMap();
4014
4073
  if (!t.length || !s) return;
4015
- const i = this.Yt(), o = s.projViewMatrix, a = this.Nt.options.services, h = [];
4074
+ const i = this.Qt(), o = s.projViewMatrix, a = this.Nt.options.services, h = [];
4016
4075
  let u = [];
4017
4076
  for (let n = 0, r = t.length; n < r; n++) {
4018
- let r = this.Qt(t[n].data.node);
4077
+ let r = this.Yt(t[n].data.node);
4019
4078
  if (!r) {
4020
4079
  if (r = this.kt[t[n].data.node.id], !r) continue;
4021
4080
  r = O(r);
4022
4081
  }
4023
4082
  const s = t[n].node;
4024
- let f = a[s.te].polygonOffset || en;
4083
+ let f = a[s.te].polygonOffset || rn;
4025
4084
  y(f) && (f = f());
4026
4085
  const l = a[s.te].ambientLight;
4027
4086
  for (let a = 0, d = r.length; a < d; a++) "b3dm" === r[a].properties.magic && (r[a].getBoundingBox && !c(o, r[a].getBoundingBox()) || (r[a].properties.level = t[n].selectionDepth,
@@ -4034,9 +4093,9 @@
4034
4093
  }
4035
4094
  let f = 0;
4036
4095
  const l = this.Wt.getExcludeFilter();
4037
- f += this.ne(this.re, i, [ n, on, l ], r, h, u), f += this.ne(this.se, i, [ n, an, l ], r, h, u),
4096
+ f += this.ne(this.re, i, [ n, cn, l ], r, h, u), f += this.ne(this.se, i, [ n, hn, l ], r, h, u),
4038
4097
  this.Wt.forEachShader((t, e, s) => {
4039
- const i = this.Yt(s);
4098
+ const i = this.Qt(s);
4040
4099
  f += this.ne(t, i, [ n, e ], r, h, u);
4041
4100
  });
4042
4101
  const d = [];
@@ -4047,7 +4106,7 @@
4047
4106
  }
4048
4107
  ne(t, e, n, r, s, i) {
4049
4108
  t.filter = n.filter(t => !!t), e.debug = !1, this.jt.setMeshes(s), e.stencilEnable = !1,
4050
- e.debug = !1, e.cullFace = "back", e.colorMask = cn;
4109
+ e.debug = !1, e.cullFace = "back", e.colorMask = un;
4051
4110
  let o = 0;
4052
4111
  this.jt.setMeshes(i), o += this.Bt.render(t, e, this.jt, r && r.fbo), e.stencilEnable = !1;
4053
4112
  const a = [];
@@ -4102,7 +4161,7 @@
4102
4161
  }
4103
4162
  remove() {
4104
4163
  const t = this.Nt;
4105
- Ye(t.getRenderer().canvas, t.getMap());
4164
+ tn(t.getRenderer().canvas, t.getMap());
4106
4165
  for (const t in this.kt) this.de(t);
4107
4166
  this.kt = {};
4108
4167
  for (const t in this.Rt) this.le(t);
@@ -4136,11 +4195,11 @@
4136
4195
  return l.setLocalTransform(n.mat4.translate(d, d, [ o.x, o.y, 0 ])), this.Ct[t.id] = l,
4137
4196
  l;
4138
4197
  }
4139
- Qt(t) {
4198
+ Yt(t) {
4140
4199
  return this.Rt[t.id];
4141
4200
  }
4142
4201
  has(t) {
4143
- return this.Qt(t) || this.Ft[t.id] || this.Dt[t.id] || this.kt[t.id] || this.Ut[t.id];
4202
+ return this.Yt(t) || this.Ft[t.id] || this.Dt[t.id] || this.kt[t.id] || this.Ut[t.id];
4144
4203
  }
4145
4204
  createPntsMesh(t, e, r, s) {
4146
4205
  if (this.Ft[e]) {
@@ -4200,7 +4259,7 @@
4200
4259
  }, M = new Float32Array(3), S = new Float32Array(3), x = [], I = new Float32Array(1), N = new Float32Array(3), E = [], P = [], L = [], B = [], U = new Float32Array(9);
4201
4260
  !function(t, e) {
4202
4261
  let {componentType: n, byteOffset: r, byteStride: s, count: i, itemSize: o} = t;
4203
- const a = t.array.buffer, c = n ? Nt.getTypedArrayCtor(n) : t.array.constructor;
4262
+ const a = t.array.buffer, c = n ? Pt.getTypedArrayCtor(n) : t.array.constructor;
4204
4263
  if (r = void 0 === r ? t.array.byteOffset : r, s = s || 0, i = i || t.array.length / o,
4205
4264
  (!s || s === o * c.BYTES_PER_ELEMENT) && r % c.BYTES_PER_ELEMENT == 0) {
4206
4265
  const t = new c(a, r, i * o);
@@ -4217,11 +4276,11 @@
4217
4276
  e(new c(h.buffer), t), n.set(h);
4218
4277
  }
4219
4278
  }(p, (t, e) => {
4220
- w ? (jt(S, _, e), jt(M, w, e), n.vec3.cross(x, S, M), n.vec3.normalize(x, x), A(E, S, 0),
4221
- A(E, M, 1), A(E, x, 2), n.quat.fromMat3(P, E)) : O ? (jt(U, O, e), n.quat.fromMat3(P, U)) : n.quat.identity(P),
4222
- g ? (jt(I, g, e), n.vec3.set(L, I[0], I[0], I[0])) : T ? (jt(N, T, e), n.vec3.set(L, ...N)) : n.vec3.set(L, 1, 1, 1),
4223
- n.mat4.fromRotationTranslationScale(B, P, t, L), Vt(v.instance_vectorA, e, B, 0),
4224
- Vt(v.instance_vectorB, e, B, 1), Vt(v.instance_vectorC, e, B, 2);
4279
+ w ? (Gt(S, _, e), Gt(M, w, e), n.vec3.cross(x, S, M), n.vec3.normalize(x, x), A(E, S, 0),
4280
+ A(E, M, 1), A(E, x, 2), n.quat.fromMat3(P, E)) : O ? (Gt(U, O, e), n.quat.fromMat3(P, U)) : n.quat.identity(P),
4281
+ g ? (Gt(I, g, e), n.vec3.set(L, I[0], I[0], I[0])) : T ? (Gt(N, T, e), n.vec3.set(L, ...N)) : n.vec3.set(L, 1, 1, 1),
4282
+ n.mat4.fromRotationTranslationScale(B, P, t, L), Ht(v.instance_vectorA, e, B, 0),
4283
+ Ht(v.instance_vectorB, e, B, 1), Ht(v.instance_vectorC, e, B, 2);
4225
4284
  });
4226
4285
  const C = {};
4227
4286
  for (const t in v) C[t] = {
@@ -4234,7 +4293,7 @@
4234
4293
  const R = this.Nt.options.services[r.te].shader || "phong";
4235
4294
  let F = 0, D = !0;
4236
4295
  const k = [];
4237
- return kt(c, (t, s, o, a) => {
4296
+ return jt(c, (t, s, o, a) => {
4238
4297
  let {geometry: c, material: d} = this.Ae(t, s, o, a, r, !0, R);
4239
4298
  d && !d.isReady() && (D = !1, F++);
4240
4299
  const m = new n.reshader.InstancedMesh(C, l, c, d);
@@ -4272,7 +4331,7 @@
4272
4331
  f && (u[2] += f);
4273
4332
  const l = this.we(u, r.te), d = this.Nt.options.services[r.te].shader || "phong", m = [];
4274
4333
  let y = 0, b = !0;
4275
- return kt(c, (s, i, c, f) => {
4334
+ return jt(c, (s, i, c, f) => {
4276
4335
  let {geometry: p, material: w} = this.Ae(s, i, c, f, r, !1, d);
4277
4336
  w && !w.isReady() && (b = !1, y++);
4278
4337
  const _ = new n.reshader.Mesh(p, w);
@@ -4297,18 +4356,18 @@
4297
4356
  const i = this.getMap(), o = this.Nt.options.services[t.te].heightOffset || 0, a = new s.Coordinate(r), c = i.distanceToPointAtRes(100, 0, i.getGLRes(), a).x / 100;
4298
4357
  let h = t.matrix ? n.mat4.copy([], t.matrix) : n.mat4.identity([]);
4299
4358
  if (e) {
4300
- Me(h, n.vec3.transformMat4(hn, e, h), h);
4359
+ xe(h, n.vec3.transformMat4(fn, e, h), h);
4301
4360
  }
4302
4361
  const u = function(t, e, n, r, s, i, o) {
4303
- e = B(Le, e);
4304
- const a = $t(Le, e[0] * je, e[1] * je, e[2]), c = function(t, e) {
4362
+ e = B(Ue, e);
4363
+ const a = Kt(Ue, e[0] * Ge, e[1] * Ge, e[2]), c = function(t, e) {
4305
4364
  return t[0] = e[12], t[1] = e[13], t[2] = e[14], t;
4306
- }(Be, n), h = r.ellipsoid;
4365
+ }(Ce, n), h = r.ellipsoid;
4307
4366
  var u;
4308
- u = 0 === G(c) ? U(Ue, 0, 0, -6378137) : Yt(Ue, c), ke.x = u[0], ke.y = u[1];
4309
- const f = r.project(ke, ze);
4310
- Ce[0] = f.x / s, Ce[1] = f.y / s, Ce[2] = (u[2] + o) * i;
4311
- const l = Se(a, h, Re), d = function(t, e, n) {
4367
+ u = 0 === G(c) ? U(Re, 0, 0, -6378137) : te(Re, c), je.x = u[0], je.y = u[1];
4368
+ const f = r.project(je, Ve);
4369
+ Fe[0] = f.x / s, Fe[1] = f.y / s, Fe[2] = (u[2] + o) * i;
4370
+ const l = Ie(a, h, De), d = function(t, e, n) {
4312
4371
  var r = t[0], s = t[1], i = t[2], o = t[4], a = t[5], c = t[6], h = t[8], u = t[9], f = t[10], l = e[0], d = e[1], m = e[2], y = e[3], b = e[4], p = e[5], w = e[6], _ = e[7], g = e[8], T = r * l + o * d + h * m, A = s * l + a * d + u * m, O = i * l + c * d + f * m, v = r * y + o * b + h * p, M = s * y + a * b + u * p, S = i * y + c * b + f * p, x = r * w + o * _ + h * g, I = s * w + a * _ + u * g, N = i * w + c * _ + f * g;
4313
4372
  return n[0] = T, n[1] = A, n[2] = O, n[3] = 0, n[4] = v, n[5] = M, n[6] = S, n[7] = 0,
4314
4373
  n[8] = x, n[9] = I, n[10] = N, n[11] = 0, n[12] = t[12], n[13] = t[13], n[14] = t[14],
@@ -4321,19 +4380,19 @@
4321
4380
  t[8] = (o * I - a * S + h * v) * E, t[9] = (r * S - n * I - i * v) * E, t[10] = (m * A - y * g + p * w) * E,
4322
4381
  t[11] = (f * g - u * A - d * w) * E, t[12] = (a * M - o * x - c * v) * E, t[13] = (n * x - r * M + s * v) * E,
4323
4382
  t[14] = (y * _ - m * T - b * w) * E, t[15] = (u * T - f * _ + l * w) * E, t) : null;
4324
- }(Fe, l), function(t, e) {
4383
+ }(ke, l), function(t, e) {
4325
4384
  return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[4], t[4] = e[5], t[5] = e[6],
4326
4385
  t[6] = e[8], t[7] = e[9], t[8] = e[10], t;
4327
- }(De, n), t);
4328
- return Me(t, Ce, d), t;
4386
+ }(ze, n), t);
4387
+ return xe(t, Fe, d), t;
4329
4388
  }(h, r, h, i.getProjection(), i.getGLRes(), c, o), f = function(t, e) {
4330
4389
  return U(t, e[12], e[13], e[14]), t;
4331
- }(ln, u);
4390
+ }(mn, u);
4332
4391
  let l = this.Nt.options.offset;
4333
4392
  if (y(l)) {
4334
4393
  l = l(this.Nt.Me(t.id).center);
4335
4394
  }
4336
- return n.vec3.set(fn, l[0], l[1], 0), n.vec3.sub(f, f, fn), Me(u, f, u), u;
4395
+ return n.vec3.set(dn, l[0], l[1], 0), n.vec3.sub(f, f, dn), xe(u, f, u), u;
4337
4396
  }
4338
4397
  createCMPTMesh(t, e, n, r) {
4339
4398
  if (this.kt[e]) {
@@ -4373,9 +4432,9 @@
4373
4432
  const e = this.Se(t, r, i);
4374
4433
  c = e.material, h = e.geometry;
4375
4434
  } else {
4376
- h = this.xe(t, i, dn);
4435
+ h = this.xe(t, i, yn);
4377
4436
  const e = this.Nt.options.services[s.te].material;
4378
- c = this.Ie(t.material, r, o, e || nn);
4437
+ c = this.Ie(t.material, r, o, e || sn);
4379
4438
  }
4380
4439
  c && !c.isReady() ? c.Ne = s.id : c || (c = this.Kt);
4381
4440
  const f = {
@@ -4401,7 +4460,7 @@
4401
4460
  }
4402
4461
  const o = {};
4403
4462
  for (const t in s) {
4404
- const e = Ke(this.Lt, s[t], {
4463
+ const e = We(this.Lt, s[t], {
4405
4464
  dimension: s[t].itemSize
4406
4465
  }), n = r[t] || t;
4407
4466
  o[n] = {
@@ -4416,7 +4475,7 @@
4416
4475
  uv1Attribute: r.TEXCOORD_1,
4417
4476
  color0Attribute: r.COLOR_0,
4418
4477
  tangentAttribute: r.TANGENT,
4419
- primitive: void 0 === t.mode ? "triangles" : Je(t.mode)
4478
+ primitive: void 0 === t.mode ? "triangles" : Xe(t.mode)
4420
4479
  });
4421
4480
  return a.generateBuffers(this.Lt, {
4422
4481
  excludeElementsInVAO: e
@@ -4424,8 +4483,8 @@
4424
4483
  }
4425
4484
  we(t) {
4426
4485
  const e = n.mat4.identity([]), r = this.getMap(), s = this.Ee();
4427
- un.x = t[0], un.y = t[1];
4428
- const i = r.distanceToPointAtRes(100, 100, r.getGLRes(), un);
4486
+ ln.x = t[0], ln.y = t[1];
4487
+ const i = r.distanceToPointAtRes(100, 100, r.getGLRes(), ln);
4429
4488
  return n.vec3.set(s, i.x / 100 * 1.01, i.y / 100 * 1.01, i.y / 100), n.mat4.scale(e, e, s),
4430
4489
  e;
4431
4490
  }
@@ -4485,7 +4544,7 @@
4485
4544
  extraCommandProps: s
4486
4545
  });
4487
4546
  const i = this.Nt;
4488
- Ze(i.getRenderer().canvas, this.Lt, i.getMap());
4547
+ Ye(i.getRenderer().canvas, this.Lt, i.getMap());
4489
4548
  }
4490
4549
  Zt() {
4491
4550
  return {
@@ -4495,7 +4554,7 @@
4495
4554
  width: () => this.Et ? this.Et.width : 1,
4496
4555
  height: () => this.Et ? this.Et.height : 1
4497
4556
  },
4498
- colorMask: (t, e) => e.colorMask || cn,
4557
+ colorMask: (t, e) => e.colorMask || un,
4499
4558
  cull: {
4500
4559
  enable: !0,
4501
4560
  face: (t, e) => e.cullFace
@@ -4545,8 +4604,8 @@
4545
4604
  lightDir: n.vec3.normalize(s, s)
4546
4605
  };
4547
4606
  }
4548
- Yt() {
4549
- const t = this.getMap(), e = this.Nt.getRenderer().canvas, {iblTexes: n, dfgLUT: r} = Qe(e), s = tn(t, n, r);
4607
+ Qt() {
4608
+ const t = this.getMap(), e = this.Nt.getRenderer().canvas, {iblTexes: n, dfgLUT: r} = en(e), s = nn(t, n, r);
4550
4609
  return m(s, {
4551
4610
  lightSpecular: [ 1, 1, 1 ],
4552
4611
  viewMatrix: t.viewMatrix,
@@ -4599,15 +4658,15 @@
4599
4658
  }
4600
4659
  S(t) {
4601
4660
  const e = {
4602
- type: t.type ? qe(t.type) : "uint8",
4603
- format: t.format ? $e(t.format) : "rgba",
4661
+ type: t.type ? Je(t.type) : "uint8",
4662
+ format: t.format ? Ke(t.format) : "rgba",
4604
4663
  flipY: !1
4605
4664
  }, r = t.image;
4606
4665
  r.array ? e.data = r.array : r.mipmap && (e.mipmap = r.mipmap), e.width = r.width,
4607
4666
  e.height = r.height;
4608
4667
  const s = t.sampler || t.texture.sampler;
4609
- return s && (s.magFilter && (e.mag = Ve(s.magFilter)), s.minFilter && (e.min = Ge(s.minFilter)),
4610
- s.wrapS && (e.wrapS = He(s.wrapS)), s.wrapT && (e.wrapT = He(s.wrapT))), new n.reshader.Texture2D(e, this.qt);
4668
+ return s && (s.magFilter && (e.mag = He(s.magFilter)), s.minFilter && (e.min = qe(s.minFilter)),
4669
+ s.wrapS && (e.wrapS = $e(s.wrapS)), s.wrapT && (e.wrapT = $e(s.wrapT))), new n.reshader.Texture2D(e, this.qt);
4611
4670
  }
4612
4671
  Pe(t) {
4613
4672
  const e = t.image, n = window.URL || window.webkitURL, r = new Blob([ e.array ], {
@@ -4628,7 +4687,7 @@
4628
4687
  }
4629
4688
  }
4630
4689
  Ee() {
4631
- return rn;
4690
+ return on;
4632
4691
  }
4633
4692
  ye(t) {
4634
4693
  return this.Nt.ye(t);
@@ -4646,16 +4705,16 @@
4646
4705
  return e.getGLZoom ? e._prjToPoint(t, e.getGLZoom()) : e._prjToPointAtRes(t, e.getGLRes());
4647
4706
  }
4648
4707
  ge(t) {
4649
- return "Y" === t ? Xe : "X" === t ? We : sn;
4708
+ return "Y" === t ? Ze : "X" === t ? Qe : an;
4650
4709
  }
4651
4710
  }
4652
- class yn extends s.renderer.CanvasRenderer {
4711
+ class pn extends s.renderer.CanvasRenderer {
4653
4712
  constructor(t) {
4654
- super(t), this.prepareWorker(), this.tilesLoading = {}, this.tileCache = new Dt(1024 * t.options.maxGPUMemory * 1024, this.deleteTile.bind(this)),
4655
- this.bt = {};
4713
+ super(t), this.prepareWorker(), this.tilesLoading = {}, this.tileCache = new zt(1024 * t.options.maxGPUMemory * 1024, this.deleteTile.bind(this)),
4714
+ this.bt = {}, this.Le = [];
4656
4715
  }
4657
4716
  needToRedraw() {
4658
- return !!this.getMap().isInteracting() || super.needToRedraw();
4717
+ return !!this.getMap().isInteracting() || (!!this.Le.length || super.needToRedraw());
4659
4718
  }
4660
4719
  drawOnInteracting(t, e, n) {
4661
4720
  this.draw(e, n);
@@ -4663,32 +4722,33 @@
4663
4722
  draw(t, e) {
4664
4723
  const n = this.prepareCanvas();
4665
4724
  if (n && !n.intersects(this.canvasExtent2D)) return void this.completeRender();
4666
- const {root: r, tiles: s} = this.layer.getTiles(), i = s ? Object.keys(s).length : 0;
4725
+ const {root: r, tiles: s} = this.layer.getTiles(), i = s.length;
4667
4726
  if (!s || !i) return void this.completeRender();
4668
- const {selectedTiles: o, leaves: a, requests: c} = this.Le(r, s);
4669
- this.Be(o, a, e), this.Ue(), c.length ? this.loadTiles(c) : this.completeRender();
4727
+ this.Be();
4728
+ const {selectedTiles: o, leaves: a, requests: c} = this.Ue(r, s);
4729
+ c.length && this.loadTiles(c), this.Ce(o, a, e), this.Re(), c.length || this.completeRender();
4670
4730
  }
4671
- Le(t, e) {
4731
+ Ue(t, e) {
4672
4732
  let n = [];
4673
- this.Ce();
4733
+ this.Fe();
4674
4734
  let r = 0;
4675
- const s = this.Re(), i = {};
4735
+ const s = this.De(), i = {};
4676
4736
  let o = !1, a = !1;
4677
- for (const t in e) {
4737
+ for (let t = 0; t < e.length; t++) {
4678
4738
  const s = e[t], c = s.node;
4679
4739
  if (i[c.id]) continue;
4680
4740
  i[c.id] = 1;
4681
4741
  let h = !1;
4682
- const u = this.Fe(c.id);
4683
- if (this.De(c.id) ? (r++, h = a = !0, this.tilesLoading[c.id].current = !0) : u ? (this.getTileOpacity(u) < 1 && (h = a = !0),
4742
+ const u = this.ke(c.id);
4743
+ if (this.ze(c.id) ? (r++, h = a = !0, this.tilesLoading[c.id].current = !0) : u ? (this.getTileOpacity(u) < 1 && (h = a = !0),
4684
4744
  o = !0, s.selected = !0, s.data = u) : this.painter.has(c) || (h = a = !0, n.push(c)),
4685
4745
  !h) continue;
4686
- if (this.ke(s)) o = !0; else {
4687
- this.ze(s).length && (o = !0);
4746
+ if (this.je(s)) o = !0; else {
4747
+ this.Ve(s).length && (o = !0);
4688
4748
  }
4689
4749
  }
4690
4750
  let c = [], h = {};
4691
- if (o && ({selectedTiles: c, leaves: h} = this.je(t)), n.length > 1 && (n.sort(pn),
4751
+ if (o && ({selectedTiles: c, leaves: h} = this.Ge(t)), n.length > 1 && (n.sort(wn),
4692
4752
  s)) {
4693
4753
  const t = s - r;
4694
4754
  n = t > 0 ? n.slice(0, t) : [];
@@ -4700,14 +4760,14 @@
4700
4760
  leaves: h
4701
4761
  };
4702
4762
  }
4703
- je(t) {
4763
+ Ge(t) {
4704
4764
  const e = [], n = {};
4705
4765
  let r;
4706
4766
  const s = [ t ], i = [];
4707
4767
  for (;s.length > 0 || i.length > 0; ) {
4708
4768
  if (i.length > 0) {
4709
4769
  const t = i[i.length - 1];
4710
- if (t.Ve === s.length) {
4770
+ if (t.He === s.length) {
4711
4771
  i.pop(), t === r && (t.leave = !0, n[t.node.id] = 1), e.push(t);
4712
4772
  continue;
4713
4773
  }
@@ -4719,9 +4779,8 @@
4719
4779
  t.leave = !0, n[t.node.id] = 1, e.push(t);
4720
4780
  continue;
4721
4781
  }
4722
- i.push(t), t.Ve = s.length;
4782
+ i.push(t), t.He = s.length;
4723
4783
  }
4724
- o.length > 1 && o.sort(bn);
4725
4784
  for (let t = 0; t < o.length; t++) s.push(o[t]);
4726
4785
  }
4727
4786
  return {
@@ -4729,7 +4788,7 @@
4729
4788
  leaves: n
4730
4789
  };
4731
4790
  }
4732
- ke(t) {
4791
+ je(t) {
4733
4792
  if (!t.parent) return null;
4734
4793
  let e = t.parent;
4735
4794
  for (;e && e.level >= 0; ) {
@@ -4740,27 +4799,27 @@
4740
4799
  }
4741
4800
  return null;
4742
4801
  }
4743
- ze(t) {
4802
+ Ve(t) {
4744
4803
  const e = [];
4745
4804
  if (!t.node.children || !t.node.children.length) return e;
4746
- const n = t.Ge + 1, r = [ t.node ];
4805
+ const n = t.qe + 1, r = [ t.node ];
4747
4806
  for (;r.length > 0; ) {
4748
4807
  const s = r.pop().children;
4749
4808
  for (let i = 0, o = s.length; i < o; i++) {
4750
- if (!this.layer.He(s[i]) && s[i].children && s[i].children.length) {
4809
+ if ((!s[i].content || !s[i].content.url) && s[i].children && s[i].children.length) {
4751
4810
  r.push(s[i]);
4752
4811
  continue;
4753
4812
  }
4754
4813
  const o = s[i].id;
4755
4814
  if (this.tileCache.has(o)) {
4756
- const n = this.layer.qe(s[i], t);
4815
+ const n = this.layer.$e(s[i], t);
4757
4816
  n.selected = !0, n.data = this.tileCache.get(o), t.children.push(n), e.push(n);
4758
- } else s[i].Ge <= n && r.push(s[i]);
4817
+ } else s[i].qe <= n && r.push(s[i]);
4759
4818
  }
4760
4819
  }
4761
4820
  return e;
4762
4821
  }
4763
- Be(t, e, n) {
4822
+ Ce(t, e, n) {
4764
4823
  this.tileCache.markAll(!1);
4765
4824
  for (let e = 0, n = t.length; e < n; e++) {
4766
4825
  const n = t[e].data;
@@ -4794,7 +4853,7 @@
4794
4853
  let e = t.content.url;
4795
4854
  if (M(e)) {
4796
4855
  const n = S(e);
4797
- return void this.$e(e, n, t);
4856
+ return void this.Je(e, n, t);
4798
4857
  }
4799
4858
  t && -1 === e.indexOf("http://") && -1 === e.indexOf("https://") && (e = t.baseUrl + e);
4800
4859
  const n = this.layer.options.services[t.te];
@@ -4804,13 +4863,13 @@
4804
4863
  let s = ft.getArrayBuffer(e + (r || ""), n.ajaxOptions);
4805
4864
  const i = s.xhr;
4806
4865
  s = s.then(n => {
4807
- delete this.bt[e], n ? this.$e(e, n.data, t) : this.onTileError(null, t);
4866
+ delete this.bt[e], n ? this.Je(e, n.data, t) : this.onTileError(null, t);
4808
4867
  }).catch(n => {
4809
4868
  delete this.bt[e], this.onTileError(n, t);
4810
4869
  }), this.bt[e] = i;
4811
- } else this.$e(e, null, t);
4870
+ } else this.Je(e, null, t);
4812
4871
  }
4813
- $e(t, e, r) {
4872
+ Je(t, e, r) {
4814
4873
  let s = this.o;
4815
4874
  s || (s = n.reshader.Util.getSupportedFormats(this.gl.gl || this.gl), this.o = s),
4816
4875
  this.workerConn.loadTile(this.layer.getId(), {
@@ -4823,30 +4882,41 @@
4823
4882
  }, (e, n) => {
4824
4883
  if (e) return void this.onTileError(e, r);
4825
4884
  const {magic: s} = n;
4826
- "b3dm" === s ? this.painter.createB3DMMesh(n, r.id, r, (t, {mesh: e}) => {
4827
- this.Je(n, r, t, e);
4828
- }) : "pnts" === s ? this.painter.createPntsMesh(n, r.id, r, (t, {mesh: e}) => {
4829
- this.Je(n, r, t, e);
4830
- }) : "i3dm" === s ? this.painter.createI3DMMesh(n, r.id, r, (t, {mesh: e}) => {
4831
- this.Je(n, r, t, e);
4832
- }) : "cmpt" === s ? this.painter.createCMPTMesh(n, r.id, r, (t, {mesh: e}) => {
4833
- this.Je(n, r, t, e);
4885
+ "b3dm" === s || "pnts" === s || "i3dm" === s || "cmpt" === s ? this.Le.push({
4886
+ data: n,
4887
+ tile: r
4834
4888
  }) : this.onTilesetLoad(n, r, t);
4835
4889
  });
4836
4890
  }
4837
- Je(t, e, n, r) {
4891
+ Be() {
4892
+ const t = this.getMap(), e = this.layer.options.meshLimitPerFrame;
4893
+ let n = 0;
4894
+ for (;this.Le.length && (n < e || !t.isInteracting()); ) {
4895
+ const {data: t, tile: e} = this.Le.shift(), {magic: r} = t;
4896
+ "b3dm" === r ? this.painter.createB3DMMesh(t, e.id, e, (n, {mesh: r}) => {
4897
+ this.Ke(t, e, n, r);
4898
+ }) : "pnts" === r ? this.painter.createPntsMesh(t, e.id, e, (n, {mesh: r}) => {
4899
+ this.Ke(t, e, n, r);
4900
+ }) : "i3dm" === r ? this.painter.createI3DMMesh(t, e.id, e, (n, {mesh: r}) => {
4901
+ this.Ke(t, e, n, r);
4902
+ }) : "cmpt" === r && this.painter.createCMPTMesh(t, e.id, e, (n, {mesh: r}) => {
4903
+ this.Ke(t, e, n, r);
4904
+ }), n++;
4905
+ }
4906
+ }
4907
+ Ke(t, e, n, r) {
4838
4908
  if (n) this.onTileError(n, e); else {
4839
- const n = this.Ke(r);
4909
+ const n = this.Xe(r);
4840
4910
  e.memorySize = n, this.onTileLoad(t, e);
4841
4911
  }
4842
4912
  }
4843
- Ke(t) {
4913
+ Xe(t) {
4844
4914
  let e = 0;
4845
- if (Array.isArray(t)) for (let n = 0; n < t.length; n++) t[n] && (e += this.Ke(t[n])); else t && (e += t.getMemorySize());
4915
+ if (Array.isArray(t)) for (let n = 0; n < t.length; n++) t[n] && (e += this.Xe(t[n])); else t && (e += t.getMemorySize());
4846
4916
  return e;
4847
4917
  }
4848
4918
  onTileLoad(t, e) {
4849
- this.layer && (delete this.tilesLoading[e.id], this.Xe(e), this.setToRedraw(), this.layer.fire("tileload", {
4919
+ this.layer && (delete this.tilesLoading[e.id], this.We(e), this.setToRedraw(), this.layer.fire("tileload", {
4850
4920
  node: e
4851
4921
  }));
4852
4922
  }
@@ -4857,15 +4927,15 @@
4857
4927
  if (!this.layer) return;
4858
4928
  const n = e.content.url;
4859
4929
  console.warn("failed to load 3d tile: " + n), console.warn(t), delete this.tilesLoading[e.id],
4860
- this.Xe(e), this.setToRedraw(), this.layer.fire("tileerror", {
4930
+ this.We(e), this.setToRedraw(), this.layer.fire("tileerror", {
4861
4931
  node: e,
4862
4932
  error: t
4863
4933
  });
4864
4934
  }
4865
- Fe(t) {
4935
+ ke(t) {
4866
4936
  return this.tileCache.get(t);
4867
4937
  }
4868
- Xe(t) {
4938
+ We(t) {
4869
4939
  const e = {
4870
4940
  loadTime: s.Util.now(),
4871
4941
  current: !0,
@@ -4882,7 +4952,7 @@
4882
4952
  } else this.workerConn.abortTileLoading(this.layer.getId(), e);
4883
4953
  delete this.bt[e];
4884
4954
  }
4885
- Ce() {
4955
+ Fe() {
4886
4956
  if (this.tilesLoading) for (const t in this.tilesLoading) this.tilesLoading[t].current = !1;
4887
4957
  }
4888
4958
  deleteTile(t) {
@@ -4897,16 +4967,16 @@
4897
4967
  antialias: t.options.antialias
4898
4968
  };
4899
4969
  this.canvas.gl && this.canvas.gl.wrap ? (this.gl = this.canvas.gl.wrap(), this.regl = this.canvas.gl.regl) : (this.glOptions = e,
4900
- this.gl = this.We(this.canvas, e)), this.regl = this.regl || n.createREGL({
4970
+ this.gl = this.Ze(this.canvas, e)), this.regl = this.regl || n.createREGL({
4901
4971
  gl: this.gl,
4902
4972
  attributes: e,
4903
4973
  extensions: [ "OES_element_index_uint", "WEBGL_compressed_texture_s3tc" ],
4904
4974
  optionalExtensions: t.options.optionalExtensions || []
4905
- }), this.painter = new mn(this.regl, t);
4975
+ }), this.painter = new bn(this.regl, t);
4906
4976
  }
4907
4977
  prepareWorker() {
4908
4978
  const t = this.getMap();
4909
- this.workerConn || (this.workerConn = new Ct("@maptalks/3dtiles", t.id));
4979
+ this.workerConn || (this.workerConn = new Ft("@maptalks/3dtiles", t.id));
4910
4980
  const e = this.workerConn;
4911
4981
  if (!e.isActive()) return;
4912
4982
  let n = this.layer.options || {};
@@ -4924,7 +4994,7 @@
4924
4994
  super.onRemove();
4925
4995
  }
4926
4996
  clear() {
4927
- this.Ue(!0), this.tileCache.reset(), this.tilesLoading = {}, super.clear();
4997
+ this.Re(!0), this.tileCache.reset(), this.tilesLoading = {}, super.clear();
4928
4998
  }
4929
4999
  clearCanvas() {
4930
5000
  this.regl && this.regl.clear({
@@ -4939,22 +5009,21 @@
4939
5009
  getStencilValue() {
4940
5010
  return 0;
4941
5011
  }
4942
- Ue(t) {
4943
- this.Ze || (this.Ze = Date.now());
5012
+ Re(t) {
5013
+ this.Qe || (this.Qe = Date.now());
4944
5014
  const e = Date.now();
4945
- if (t || !(e - this.Ze < this.layer.options.retireInterval)) {
4946
- this.Ze = e;
5015
+ if (t || !(e - this.Qe < this.layer.options.retireInterval)) {
5016
+ this.Qe = e;
4947
5017
  for (const e in this.tilesLoading) {
4948
5018
  const n = this.tilesLoading[e];
4949
- !t && n.current || (this.abortTileLoading(n), this.painter.has(n) && this.painter.deleteTile(n),
4950
- delete this.tilesLoading[e]);
5019
+ !t && n.current || this.abortTileLoading(n);
4951
5020
  }
4952
5021
  }
4953
5022
  }
4954
- Re() {
5023
+ De() {
4955
5024
  return this.getMap().isInteracting() ? this.layer.options.loadingLimitOnInteracting : this.layer.options.loadingLimit;
4956
5025
  }
4957
- We(t, e) {
5026
+ Ze(t, e) {
4958
5027
  const n = [ "webgl", "experimental-webgl" ];
4959
5028
  let r = null;
4960
5029
  for (let s = 0; s < n.length; ++s) {
@@ -4965,7 +5034,7 @@
4965
5034
  }
4966
5035
  return r;
4967
5036
  }
4968
- De(t) {
5037
+ ze(t) {
4969
5038
  return !!this.tilesLoading[t];
4970
5039
  }
4971
5040
  getI3DMMeshes() {
@@ -4978,23 +5047,20 @@
4978
5047
  return this.painter.getB3DMMeshes();
4979
5048
  }
4980
5049
  readBatchData(t, e, n) {
4981
- return ue(t, e, 0, n);
5050
+ return le(t, e, 0, n);
4982
5051
  }
4983
5052
  }
4984
- function bn(t, e) {
4985
- return 0 === t.node.ce && 0 === e.node.ce ? e.node.Ye - t.node.Ye : e.node.ce - t.node.ce;
4986
- }
4987
- function pn(t, e) {
5053
+ function wn(t, e) {
4988
5054
  return 0 === t.ce && 0 === e.ce ? t.Ye - e.Ye : t.ce - e.ce;
4989
5055
  }
4990
- function wn(t, e, n) {
5056
+ function _n(t, e, n) {
4991
5057
  return t[0] = e[n], t[1] = e[n + 3], t[2] = e[n + 6], t;
4992
5058
  }
4993
- function _n(t, e, n) {
5059
+ function gn(t, e, n) {
4994
5060
  return Math.sqrt(function(t, e, n) {
4995
- var r = C(gn, n, t), s = wn(Tn, e, 0), i = wn(An, e, 1), o = wn(On, e, 2), a = G(s), c = G(i), h = G(o);
5061
+ var r = C(Tn, n, t), s = _n(An, e, 0), i = _n(On, e, 1), o = _n(vn, e, 2), a = G(s), c = G(i), h = G(o);
4996
5062
  D(s, s), D(i, i), D(o, o);
4997
- var u = vn;
5063
+ var u = Mn;
4998
5064
  u.x = k(r, s), u.y = k(r, i), u.z = k(r, o);
4999
5065
  var f, l = 0;
5000
5066
  u.x < -a ? (f = u.x + a, l += f * f) : u.x > a && (f = u.x - a, l += f * f);
@@ -5003,15 +5069,15 @@
5003
5069
  return l;
5004
5070
  }(t, e, n));
5005
5071
  }
5006
- const gn = [], Tn = [], An = [], On = [], vn = [];
5007
- const Mn = s.projection.EPSG3857, Sn = new s.Extent(0, 0, 0, 0), xn = [], In = [], Nn = [], En = new s.Coordinate(0, 0), Pn = n.mat4.identity([]);
5008
- class Ln extends s.Layer {
5072
+ const Tn = [], An = [], On = [], vn = [], Mn = [];
5073
+ const Sn = s.projection.EPSG3857, xn = new s.Extent(0, 0, 0, 0), In = new s.Extent(0, 0, 0, 0), Nn = [], En = [], Pn = [], Ln = [], Bn = new s.Point(0, 0), Un = [], Cn = new s.Coordinate(0, 0), Rn = n.mat4.identity([]);
5074
+ class Fn extends s.Layer {
5009
5075
  constructor(t, e) {
5010
- super(t, e), this.Qe(), this.bt = {}, this.tn = {};
5076
+ super(t, e), this.tn(), this.bt = {}, this.en = {};
5011
5077
  }
5012
- Qe() {
5078
+ tn() {
5013
5079
  let t = this.options.services.map(t => t.url);
5014
- this.en = t.map((t, e) => function(t, e) {
5080
+ this.nn = t.map((t, e) => function(t, e) {
5015
5081
  t = w(t);
5016
5082
  return {
5017
5083
  baseUrl: t.substring(0, t.lastIndexOf("/")) + "/",
@@ -5021,35 +5087,35 @@
5021
5087
  refine: "replace",
5022
5088
  matrix: n.mat4.identity([]),
5023
5089
  te: e,
5024
- Ge: 0
5090
+ qe: 0
5025
5091
  };
5026
5092
  }(t, e)), this.fire("rootready", {
5027
- roots: this.en.slice(0)
5093
+ roots: this.nn.slice(0)
5028
5094
  });
5029
5095
  }
5030
5096
  getExtent(t) {
5031
5097
  if (!t && 0 !== t) {
5032
5098
  const t = new s.Extent;
5033
- for (let e = 0; e < this.en.length; e++) if (this.en[e].boundingVolume) {
5034
- const n = this.boundingVolumeToExtent(this.en[e]);
5099
+ for (let e = 0; e < this.nn.length; e++) if (this.nn[e].boundingVolume) {
5100
+ const n = this.boundingVolumeToExtent(this.nn[e]);
5035
5101
  t._combine(n);
5036
5102
  }
5037
5103
  return t;
5038
5104
  }
5039
- return this.en[t] && this.en[t].boundingVolume ? this.boundingVolumeToExtent(this.en[t]) : null;
5105
+ return this.nn[t] && this.nn[t].boundingVolume ? this.boundingVolumeToExtent(this.nn[t]) : null;
5040
5106
  }
5041
5107
  boundingVolumeToExtent(t) {
5042
- const e = t.boundingVolume.nn ? Pn : t.matrix, r = this.getMap();
5108
+ const e = t.boundingVolume.rn ? Rn : t.matrix, r = this.getMap();
5043
5109
  if (t.boundingVolume.region) {
5044
5110
  const e = t.boundingVolume.region;
5045
5111
  return new s.Extent(p(e[0]), p(e[1]), p(e[2]), p(e[3]));
5046
5112
  }
5047
5113
  if (t.boundingVolume.sphere) {
5048
- const i = t.boundingVolume.sphere, o = Yt([], n.vec3.transformMat4([], i, e)), a = i[3], c = r.locate(o, -a, a), h = r.locate(o, a, -a);
5114
+ const i = t.boundingVolume.sphere, o = te([], n.vec3.transformMat4([], i, e)), a = i[3], c = r.locate(o, -a, a), h = r.locate(o, a, -a);
5049
5115
  return new s.Extent(c, h);
5050
5116
  }
5051
5117
  if (t.boundingVolume.box) {
5052
- const i = t.boundingVolume.box, o = n.vec3.transformMat4([], i, e), a = new s.Coordinate(Yt([], o)), c = i.slice(3);
5118
+ const i = t.boundingVolume.box, o = n.vec3.transformMat4([], i, e), a = new s.Coordinate(te([], o)), c = i.slice(3);
5053
5119
  n.mat3.multiply(c, n.mat3.fromMat4([], t.matrix), c);
5054
5120
  const h = n.vec3.length(c.slice(0, 3)), u = n.vec3.length(c.slice(3, 6)), f = n.vec3.length(c.slice(6, 9)), l = Math.max(h, u, f), d = r.locate(a, -l, l), m = r.locate(a, l, -l);
5055
5121
  return new s.Extent(d, m);
@@ -5057,57 +5123,58 @@
5057
5123
  return null;
5058
5124
  }
5059
5125
  getRootTiles() {
5060
- return this.en;
5126
+ return this.nn;
5061
5127
  }
5062
5128
  getTiles() {
5063
- return this.getRenderer().ready ? this.rn() : (this.sn(), {
5064
- tiles: null
5129
+ return this.getRenderer().ready ? this.sn() : (this.in(), {
5130
+ tiles: Ln
5065
5131
  });
5066
5132
  }
5067
- rn() {
5133
+ sn() {
5068
5134
  const t = this.getMap(), e = t.cameraPosition;
5069
5135
  let r, s;
5070
- if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()), En.set(e[0], e[1]),
5071
- r = t.pointToCoord(En, t.getGLZoom()); else {
5136
+ if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()), Cn.set(e[0], e[1]),
5137
+ r = t.pointToCoord(Cn, t.getGLZoom()); else {
5072
5138
  const n = t.getGLRes();
5073
- s = t.pointAtResToDistance(e[2], 0, n), En.set(e[0], e[1]), r = t.pointAtResToCoord(En, n);
5139
+ s = t.pointAtResToDistance(e[2], 0, n), Cn.set(e[0], e[1]), r = t.pointAtResToCoord(Cn, n);
5074
5140
  }
5075
- this.in = this.in || [], n.vec3.set(this.in, b(r.x), b(r.y), s), this.an = $t(this.an || [], this.in[0], this.in[1], this.in[2]),
5076
- this.cn = 2 * Math.tan(.5 * b(t.getFov())), this.hn = Mn.project(r).toArray();
5141
+ this.an = this.an || [], n.vec3.set(this.an, b(r.x), b(r.y), s), this.cn = Kt(this.cn || [], this.an[0], this.an[1], this.an[2]),
5142
+ this.hn = 2 * Math.tan(.5 * b(t.getFov())), this.un = Sn.project(r).toArray();
5077
5143
  const i = t.projViewMatrix, o = {
5078
5144
  children: [],
5079
5145
  level: -1
5080
5146
  };
5081
5147
  let a = o;
5082
- const c = {};
5083
- for (let t = 0; t < this.en.length; t++) {
5148
+ const c = [];
5149
+ for (let t = 0; t < this.nn.length; t++) {
5084
5150
  let e = 1 / 0;
5085
- const n = [ this.en[t] ], r = this.un(t);
5151
+ const n = [ this.nn[t] ], r = this.ln(t);
5086
5152
  for (;n.length > 0; ) {
5087
5153
  const t = n.pop();
5088
- for (this.ln(t); a.level >= t.Ge; ) a = a.parent;
5089
- const s = this.dn(t, r, i);
5154
+ for (t.id || this.dn(t); a.level >= t.qe; ) a = a.parent;
5155
+ const s = this.mn(t, r, i);
5090
5156
  if (s < 1) {
5091
5157
  let n = a;
5092
5158
  for (;n && !n.content; ) n = n.parent;
5093
- 0 === s && n && n.content && (t.mn = n, this.yn(c, n));
5159
+ 0 === s && n && n.content && this.yn(c, n);
5094
5160
  if (!1 === this.options.services[t.te].alwaysShow) continue;
5095
- if (!(0 === s && t.Ge <= e)) continue;
5096
- t.content && (e = t.Ge);
5161
+ if (!(0 === s && t.qe <= e)) continue;
5162
+ t.content && (e = t.qe);
5097
5163
  }
5098
5164
  t.ce < 1 / 0 && this.bn(t);
5099
- const o = this.qe(t, a);
5165
+ const o = this.$e(t, a);
5100
5166
  a.children.push(o);
5101
5167
  const h = t.children, u = h && h.length, f = o.content;
5102
5168
  if (!u && f && this.yn(c, o), u) {
5103
5169
  f && "add" === t.refine && this.yn(c, o), a = o;
5104
- for (let e = 0, r = h.length; e < r; e++) {
5105
- if (!h[e].parent) {
5106
- h[e].parent = t, h[e].Te = t.Te, h[e].baseUrl = t.baseUrl;
5107
- const n = h[e].content && (h[e].content.url || h[e].content.uri);
5108
- n && (M(n) ? h[e].baseUrl = t.baseUrl : -1 === n.indexOf("http://") && -1 === n.indexOf("https://") ? h[e].content.url = t.baseUrl + n : h[e].baseUrl = n.substring(0, n.lastIndexOf("/") + 1));
5170
+ const e = h[0].parent;
5171
+ for (let r = 0, s = h.length; r < s; r++) {
5172
+ if (!e) {
5173
+ h[r].parent = t, h[r].Te = t.Te, h[r].baseUrl = t.baseUrl;
5174
+ const e = h[r].content && (h[r].content.url || h[r].content.uri);
5175
+ e && (M(e) ? h[r].baseUrl = t.baseUrl : -1 === e.indexOf("http://") && -1 === e.indexOf("https://") ? h[r].content.url = t.baseUrl + e : h[r].baseUrl = e.substring(0, e.lastIndexOf("/") + 1));
5109
5176
  }
5110
- n.push(h[e]);
5177
+ n.push(h[r]);
5111
5178
  }
5112
5179
  }
5113
5180
  }
@@ -5118,13 +5185,14 @@
5118
5185
  };
5119
5186
  }
5120
5187
  yn(t, e) {
5121
- e.node.viewerRequestVolume && !function(t, e, n) {
5188
+ const {viewerRequestVolume: n} = e.node;
5189
+ n && !function(t, e, n) {
5122
5190
  if (n.region) {
5123
5191
  const e = n.region;
5124
5192
  if (t[0] >= e[0] && t[0] <= e[2] && t[1] >= e[1] && t[1] <= e[3]) return !0;
5125
5193
  } else {
5126
- if (n.sphere) return Bn(n, e);
5127
- if (n.box) return 0 === Un(n, e);
5194
+ if (n.sphere) return Dn(n, e);
5195
+ if (n.box) return 0 === kn(n, e);
5128
5196
  }
5129
5197
  return !1;
5130
5198
  }
@@ -5132,30 +5200,30 @@
5132
5200
  * @maptalks/gl v0.65.0
5133
5201
  * LICENSE : UNLICENSED
5134
5202
  * (c) 2016-2022 maptalks.com
5135
- */ (this.in, this.an, e.node.viewerRequestVolume) || (t[e.node.id] = e);
5203
+ */ (this.an, this.cn, n) || t.push(e);
5136
5204
  }
5137
- qe(t, e) {
5205
+ $e(t, e) {
5138
5206
  return {
5139
5207
  id: t.id,
5140
5208
  node: t,
5141
5209
  children: [],
5142
- level: t.Ge,
5210
+ level: t.qe,
5143
5211
  parent: e,
5144
- content: this.He(t)
5212
+ content: t.content && t.content.url
5145
5213
  };
5146
5214
  }
5147
- ln(t) {
5148
- void 0 === t.id && (t.id = s.Util.GUID(), t.matrix = t.transform || n.mat4.identity([]),
5149
- t.pn = this.wn(t), t.parent && (t.matrix = n.mat4.multiply(t.matrix, t.parent.matrix, t.matrix),
5150
- t.te = t.parent.te, void 0 === t.Ge && (t.Ge = t.parent.Ge + 1), t.maxExtent = t.parent.maxExtent),
5215
+ dn(t) {
5216
+ t.id = s.Util.GUID(), t.matrix = t.transform || n.mat4.identity([]), t.pn = this.wn(t),
5217
+ t.parent && (t.matrix = n.mat4.multiply(t.matrix, t.parent.matrix, t.matrix), t.te = t.parent.te,
5218
+ void 0 === t.qe && (t.qe = t.parent.qe + 1), t.maxExtent = t.parent.maxExtent),
5151
5219
  t.refine = t.refine && t.refine.toLowerCase() || "replace", t.content && !t.content.url && t.content.uri && (t.content.url = t.content.uri),
5152
- this._n(t));
5220
+ this._n(t);
5153
5221
  }
5154
5222
  _n(t) {
5155
5223
  const e = t.boundingVolume;
5156
- if (!e || e.nn) return;
5224
+ if (!e || e.rn) return;
5157
5225
  const r = this.options.services[t.te].heightOffset || 0, s = this.options.offset, i = y(s) || s[0] || s[1];
5158
- if (!t.boundingVolume || !r && n.mat4.exactEquals(t.matrix, Pn) && !i) return;
5226
+ if (!t.boundingVolume || !r && n.mat4.exactEquals(t.matrix, Rn) && !i) return;
5159
5227
  const {region: o, box: a, sphere: c} = e;
5160
5228
  if (o) {
5161
5229
  const t = this.gn([ p(o[0]), p(o[1]) ]);
@@ -5163,17 +5231,14 @@
5163
5231
  const e = this.gn([ p(o[2]), p(o[3]) ]);
5164
5232
  o[2] = b(e.x), o[3] = b(e.y), o[4] += r, o[5] += r;
5165
5233
  } else if (a || c) {
5166
- const e = a || c, s = n.vec3.transformMat4(xn, e, t.matrix), i = Yt(In, s), o = this.gn([ i[0], i[1] ]);
5167
- i[0] = o.x, i[1] = o.y, i[2] += r, $t(e, b(i[0]), b(i[1]), i[2]);
5234
+ const e = a || c, s = n.vec3.transformMat4(Nn, e, t.matrix), i = te(En, s), o = this.gn([ i[0], i[1] ]);
5235
+ i[0] = o.x, i[1] = o.y, i[2] += r, Kt(e, b(i[0]), b(i[1]), i[2]);
5168
5236
  }
5169
- e.nn = !0;
5237
+ e.rn = !0;
5170
5238
  }
5171
5239
  wn(t) {
5172
5240
  return void 0 === t.geometricError || !t.boundingVolume;
5173
5241
  }
5174
- He(t) {
5175
- return t.content && t.content.url;
5176
- }
5177
5242
  bn(t) {
5178
5243
  let e = t.parent;
5179
5244
  for (;e && e.pn && !(e.ce <= t.ce && e.Ye <= t.Ye); ) e.ce = t.ce, e.Ye = t.Ye,
@@ -5187,73 +5252,74 @@
5187
5252
  m(e, t.root), e.refine = e.refine && e.refine.toLowerCase() || "replace", r && (e.boundingVolume = r);
5188
5253
  const s = t.root.transform;
5189
5254
  s && (e.parent ? e.matrix = n.mat4.multiply([], e.parent.matrix, s) : e.matrix = s),
5190
- this._n(e), e.children && e.children.length && (e.Tn = e.content, delete e.content,
5191
- t.root.content && (e.content = t.root.content)), e.pn = this.wn(e);
5255
+ this._n(e), e.Tn = e.content, delete e.content, t.root.content && (e.content = t.root.content),
5256
+ e.pn = this.wn(e);
5192
5257
  const i = e.content && (e.content.url || e.content.uri);
5193
5258
  i && e.content.uri && (e.content.url = e.content.uri, delete e.content.uri), i && !M(i) && -1 === i.indexOf("http://") && -1 === i.indexOf("https://") && (e.content.url = e.baseUrl + i);
5194
5259
  }
5195
- this.sn(), this.fire("loadtileset", {
5260
+ this.in(), this.fire("loadtileset", {
5196
5261
  tileset: t,
5197
5262
  index: e.te,
5198
5263
  url: r
5199
5264
  });
5200
5265
  }
5201
- dn(t, e, n) {
5202
- if (t.ce = 1 / 0, 0 === t.Ge || t.pn) return 1;
5203
- if (t.An = 1 / 0, !this.On(t, e, n)) return -1;
5266
+ mn(t, e, n) {
5267
+ if (t.ce = 1 / 0, 0 === t.qe || t.pn) return 1;
5268
+ if (!this.An(t, e, n)) return -1;
5204
5269
  if (0 === t.geometricError) return 1;
5205
5270
  let r = this.options.services[t.te].maximumScreenSpaceError;
5206
5271
  null == r && (r = 8);
5207
- let s = this.vn(t);
5208
- return 0 === s && t.parent && (s = .5 * (t.parent.An || 0)), s >= r ? 1 : 0;
5272
+ let s = this.On(t);
5273
+ return 0 === s && t.parent && (s = .5 * (t.parent.vn || 0)), s >= r ? 1 : 0;
5209
5274
  }
5210
- ye(t) {
5211
- const e = this.getMap();
5212
- return e.getGLZoom ? e.coordToPoint(t, e.getGLZoom()) : e.coordToPointAtRes(t, e.getGLRes());
5275
+ ye(t, e) {
5276
+ e || (e = new s.Point(0, 0));
5277
+ const n = this.getMap();
5278
+ return n.getGLZoom ? n.coordToPoint(t, n.getGLZoom(), e) : n.coordToPointAtRes(t, n.getGLRes(), e);
5213
5279
  }
5214
- On(t, e, r) {
5280
+ An(t, e, r) {
5215
5281
  if (!this.getMap()) return !1;
5216
5282
  const o = t.id;
5217
- let a = this.tn[o];
5218
- if (!t.boundingVolume) return !1;
5219
- if (!a && t.boundingVolume && !a) {
5283
+ let a = this.en[o];
5284
+ const {boundingVolume: f} = t;
5285
+ if (!f) return !1;
5286
+ const {sphere: d, region: m, box: y} = f;
5287
+ if (!a) {
5220
5288
  let e, r, i;
5221
- if (t.boundingVolume.region) {
5222
- const n = t.boundingVolume.region;
5223
- e = new s.Extent(p(n[0]), p(n[1]), p(n[2]), p(n[3]));
5224
- const c = e.getCenter(), h = this.Mn(c);
5225
- e = e.convertTo(t => this.ye(t)), i = n[4], r = n[5], a = this.tn[o] = [ [ e.xmin, e.ymin, i * h ], [ e.xmax, e.ymax, r * h ] ],
5226
- a.center = c;
5227
- } else if (t.boundingVolume.sphere) {
5228
- const e = t.boundingVolume.sphere, n = Yt([], e), r = new s.Coordinate(n), i = this.ye(r).toArray(), c = this.Mn(r);
5229
- i.push(n[2] * c[2]), a = this.tn[o] = [ i, e[3] * c ], a.center = new s.Coordinate(n);
5230
- } else if (t.boundingVolume.box) {
5231
- const e = t.boundingVolume.box, r = Yt([], e), i = new s.Coordinate(r), c = this.ye(i).toArray(), h = this.Mn(i);
5232
- c.push(r[2] * h[2]);
5233
- const u = e.slice(3);
5234
- n.mat4.exactEquals(t.matrix, Pn) || n.mat3.multiply(u, n.mat3.fromMat4([], t.matrix), u);
5235
- for (let t = 0; t < u.length; t++) u[t] *= h[t % 3], e[3 + t] = u[t];
5236
- a = this.tn[o] = [ ...c, ...u ], a.center = new s.Coordinate(r);
5289
+ if (m) {
5290
+ e = xn.set(p(m[0]), p(m[1]), p(m[2]), p(m[3]));
5291
+ const t = e.getCenter(), n = this.Mn(t);
5292
+ e = e.convertTo(t => this.ye(t, Bn), In), i = m[4], r = m[5], a = this.en[o] = [ [ e.xmin, e.ymin, i * n[2] ], [ e.xmax, e.ymax, r * n[2] ] ],
5293
+ a.center = t;
5294
+ } else if (d) {
5295
+ const t = te(Nn, d), e = new s.Coordinate(t), n = this.ye(e, Bn).toArray(), r = this.Mn(e);
5296
+ n.push(t[2] * r[2]), a = this.en[o] = [ n, d[3] * r[2] ], a.center = e;
5297
+ } else if (y) {
5298
+ const e = te(Nn, y), r = new s.Coordinate(e), i = this.ye(r, Bn).toArray(), c = this.Mn(r);
5299
+ i.push(e[2] * c[2]);
5300
+ const h = y.slice(3);
5301
+ n.mat4.exactEquals(t.matrix, Rn) || n.mat3.multiply(h, n.mat3.fromMat4(Un, t.matrix), h);
5302
+ for (let t = 0; t < h.length; t++) h[t] *= c[t % 3], y[3 + t] = h[t];
5303
+ a = this.en[o] = [ ...i, ...h ], a.center = r;
5237
5304
  }
5238
5305
  }
5239
5306
  if (e) {
5240
- if (t.boundingVolume.region) Sn.xmin = a[0][0], Sn.ymin = a[0][1], Sn.xmax = a[1][0],
5241
- Sn.ymax = a[1][1]; else if (t.boundingVolume.sphere) {
5307
+ if (m) xn.xmin = a[0][0], xn.ymin = a[0][1], xn.xmax = a[1][0], xn.ymax = a[1][1]; else if (d) {
5242
5308
  const t = a[2];
5243
- Sn.xmin = a[0][0] - t, Sn.ymin = a[0][1] - t, Sn.xmax = a[0][0] + t, Sn.ymax = a[0][1] + t;
5244
- } else if (t.boundingVolume.box) {
5309
+ xn.xmin = a[0][0] - t, xn.ymin = a[0][1] - t, xn.xmax = a[0][0] + t, xn.ymax = a[0][1] + t;
5310
+ } else if (y) {
5245
5311
  const t = a[1], e = a[2];
5246
- Sn.xmin = a[0][0] - t, Sn.ymin = a[0][1] - e, Sn.xmax = a[0][0] + t, Sn.ymax = a[0][1] + e;
5312
+ xn.xmin = a[0][0] - t, xn.ymin = a[0][1] - e, xn.xmax = a[0][0] + t, xn.ymax = a[0][1] + e;
5247
5313
  }
5248
- if (!e.intersects(Sn)) return !1;
5314
+ if (!e.intersects(xn)) return !1;
5249
5315
  }
5250
- return t.boundingVolume.region ? c(r, a) : t.boundingVolume.sphere ? function(t, e, n) {
5316
+ return m ? c(r, a) : d ? function(t, e, n) {
5251
5317
  u(t);
5252
5318
  for (var r = e[0], s = -e[1], o = 0; o < 6; o++) {
5253
5319
  if (!n || "0" !== n.charAt(o)) if (l(i[o], r) < s) return !1;
5254
5320
  }
5255
5321
  return !0;
5256
- }(r, a) : !!t.boundingVolume.box && function(t, e, n) {
5322
+ }(r, a) : !!y && function(t, e, n) {
5257
5323
  u(t);
5258
5324
  for (var r = 0; r < 6; r++) {
5259
5325
  if (!n || "0" !== n.charAt(r)) if (!h(i[r], e)) return !1;
@@ -5263,7 +5329,7 @@
5263
5329
  }
5264
5330
  Mn(t) {
5265
5331
  const e = this.getMap(), r = e.distanceToPointAtRes(100, 100, e.getGLRes(), t);
5266
- return n.vec3.set(Nn, r.x / 100 * 1.01, r.y / 100 * 1.01, r.y / 100), Nn;
5332
+ return n.vec3.set(Pn, r.x / 100 * 1.01, r.y / 100 * 1.01, r.y / 100), Pn;
5267
5333
  }
5268
5334
  gn(t) {
5269
5335
  Array.isArray(t) && (t = new s.Coordinate(t));
@@ -5274,24 +5340,24 @@
5274
5340
  }
5275
5341
  return t;
5276
5342
  }
5277
- un(t) {
5343
+ ln(t) {
5278
5344
  const e = this.options.services[t].maxExtent;
5279
5345
  if (!e) return null;
5280
- const n = this.en[t];
5346
+ const n = this.nn[t];
5281
5347
  return n.maxExtent || (n.maxExtent = new s.Extent(e).convertTo(t => this.ye(t))),
5282
5348
  n.maxExtent;
5283
5349
  }
5284
- vn(t) {
5285
- const e = this.cn, r = t.geometricError;
5350
+ On(t) {
5351
+ const e = this.hn, r = t.geometricError;
5286
5352
  if (0 === r) return 0;
5287
5353
  const s = this.getMap();
5288
5354
  let i, o;
5289
5355
  if (t.boundingVolume.region) {
5290
- const e = this.tn[t.id].center, r = (s.getGLZoom ? s.distanceToPoint(100, 0, s.getGLZoom(), e) : s.distanceToPointAtRes(100, 0, s.getGLRes(), e)).x / 100;
5356
+ const e = this.en[t.id].center, r = (s.getGLZoom ? s.distanceToPoint(100, 0, s.getGLZoom(), e) : s.distanceToPointAtRes(100, 0, s.getGLRes(), e)).x / 100;
5291
5357
  i = function(t, e, n, r) {
5292
5358
  const s = t.boundingVolume.region;
5293
5359
  let i = t.Sn;
5294
- i || (i = t.Sn = [ Fn(s[0], s[1]), Fn(s[0], s[3]), Fn(s[2], s[1]), Fn(s[2], s[3]), Fn(s[0], s[1]), Fn(s[0], s[3]), Fn(s[2], s[1]), Fn(s[2], s[3]) ],
5360
+ i || (i = t.Sn = [ Vn(s[0], s[1]), Vn(s[0], s[3]), Vn(s[2], s[1]), Vn(s[2], s[3]), Vn(s[0], s[1]), Vn(s[0], s[3]), Vn(s[2], s[1]), Vn(s[2], s[3]) ],
5295
5361
  t.xn = [ Math.min.apply(Math, i.map(t => t[0])), Math.min.apply(Math, i.map(t => t[1])) ],
5296
5362
  t.In = [ Math.max.apply(Math, i.map(t => t[0])), Math.max.apply(Math, i.map(t => t[1])) ]);
5297
5363
  if (n[0] >= s[0] && n[0] <= s[2] && n[1] >= s[1] && n[1] <= s[3]) return n[2] <= s[5] ? 0 : n[2] - s[5];
@@ -5301,37 +5367,37 @@
5301
5367
  let l = 0;
5302
5368
  n[2] > s[5] && (l = n[2] - s[5]);
5303
5369
  return Math.sqrt(o * o + l * l);
5304
- }(t, this.hn, this.in, r), o = function(t, e) {
5305
- const r = t.boundingVolume.region, s = $t(Cn, r[0], r[1], r[4]), i = $t(Rn, r[2], r[3], r[5]), o = n.vec3.scale(s, n.vec3.add(s, s, i), .5);
5370
+ }(t, this.un, this.an, r), o = function(t, e) {
5371
+ const r = t.boundingVolume.region, s = Kt(zn, r[0], r[1], r[4]), i = Kt(jn, r[2], r[3], r[5]), o = n.vec3.scale(s, n.vec3.add(s, s, i), .5);
5306
5372
  return n.vec3.dist(o, e);
5307
- }(t, this.an);
5308
- } else t.boundingVolume.sphere ? (i = Bn(t.boundingVolume, this.an), o = function(t, e) {
5373
+ }(t, this.cn);
5374
+ } else t.boundingVolume.sphere ? (i = Dn(t.boundingVolume, this.cn), o = function(t, e) {
5309
5375
  const r = t.boundingVolume.sphere;
5310
5376
  return n.vec3.dist(r, e);
5311
- }(t, this.an)) : t.boundingVolume.box && (i = Un(t.boundingVolume, this.an), o = function(t, e) {
5377
+ }(t, this.cn)) : t.boundingVolume.box && (i = kn(t.boundingVolume, this.cn), o = function(t, e) {
5312
5378
  const r = t.boundingVolume.box;
5313
5379
  return n.vec3.dist(r, e);
5314
- }(t, this.an));
5380
+ }(t, this.cn));
5315
5381
  const a = Math.max(Math.abs(i), 1e-7), c = r * s.height / (a * e);
5316
- return t.ce = i, t.Ye = o, t.An = c, c;
5382
+ return t.ce = i, t.Ye = o, t.vn = c, c;
5317
5383
  }
5318
- sn() {
5384
+ in() {
5319
5385
  const t = this.getRenderer();
5320
5386
  t && t.setToRedraw();
5321
5387
  }
5322
5388
  Me(t) {
5323
- return this.tn[t];
5389
+ return this.en[t];
5324
5390
  }
5325
5391
  }
5326
- function Bn(t, e) {
5392
+ function Dn(t, e) {
5327
5393
  const r = t.sphere, s = n.vec3.dist(r, e), i = t.sphere[3];
5328
5394
  return s < i ? 0 : s - i;
5329
5395
  }
5330
- function Un(t, e) {
5396
+ function kn(t, e) {
5331
5397
  const n = t.box;
5332
- return _n(n.slice(0, 3), n.slice(3), e);
5398
+ return gn(n.slice(0, 3), n.slice(3), e);
5333
5399
  }
5334
- Ln.mergeOptions({
5400
+ Fn.mergeOptions({
5335
5401
  "maxGPUMemory": 512,
5336
5402
  "retireInterval": 2e3,
5337
5403
  "loadingLimitOnInteracting": 5,
@@ -5342,39 +5408,40 @@
5342
5408
  "forceRenderOnMoving": !0,
5343
5409
  "debug": !1,
5344
5410
  "debugOutline": [ 0, 1, 0 ],
5411
+ "meshLimitPerFrame": 1,
5345
5412
  "antialias": !1,
5346
5413
  "sRGBTolinear": !1,
5347
5414
  "optionalExtensions": [ "ANGLE_instanced_arrays", "OES_element_index_uint", "OES_standard_derivatives", "OES_vertex_array_object", "OES_texture_half_float", "OES_texture_half_float_linear", "OES_texture_float", "OES_texture_float_linear", "WEBGL_depth_texture", "EXT_shader_texture_lod", "WEBGL_compressed_texture_astc", "WEBGL_compressed_texture_etc", "WEBGL_compressed_texture_etc1", "WEBGL_compressed_texture_pvrtc", "WEBGL_compressed_texture_s3tc", "WEBGL_compressed_texture_s3tc_srgb" ],
5348
5415
  "offset": [ 0, 0 ]
5349
- }), Ln.registerRenderer("gl", yn);
5350
- const Cn = [], Rn = [];
5351
- function Fn(t, e) {
5416
+ }), Fn.registerRenderer("gl", pn);
5417
+ const zn = [], jn = [];
5418
+ function Vn(t, e) {
5352
5419
  const n = new s.Coordinate(p(t), p(e));
5353
- return Mn.project(n).toArray();
5420
+ return Sn.project(n).toArray();
5354
5421
  }
5355
- const Dn = function() {
5422
+ const Gn = function() {
5356
5423
  if ("undefined" != typeof self) return self;
5357
5424
  if ("undefined" != typeof window) return window;
5358
5425
  if ("undefined" != typeof global) return global;
5359
5426
  throw new Error("unable to locate global object");
5360
- }, kn = Dn(), zn = kn.gl_trans__coders = kn.gl_trans__coders || {};
5361
- zn.inject = function(t) {
5362
- const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s = kn.gl_trans__coders = kn.gl_trans__coders || {};
5363
- let i = `${r}\n const _____getGlobal = ${Dn.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
5427
+ }, Hn = Gn(), qn = Hn.gl_trans__coders = Hn.gl_trans__coders || {};
5428
+ qn.inject = function(t) {
5429
+ const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s = Hn.gl_trans__coders = Hn.gl_trans__coders || {};
5430
+ let i = `${r}\n const _____getGlobal = ${Gn.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
5364
5431
  for (const t in s) "inject" !== t && "getTranscoder" !== t && "registerTranscoder" !== t && (i += 'tran_____scoders["' + t + '"] =' + s[t].toString() + "\n;");
5365
5432
  return i += "\n" + e.substring(r.length), i;
5366
- }, zn.registerTranscoder = function(t, e) {
5367
- zn[t] = e;
5368
- }, zn.getTranscoder = function(t) {
5369
- return zn[t];
5433
+ }, qn.registerTranscoder = function(t, e) {
5434
+ qn[t] = e;
5435
+ }, qn.getTranscoder = function(t) {
5436
+ return qn[t];
5370
5437
  };
5371
- class jn {
5438
+ class $n {
5372
5439
  constructor(t, e, n) {
5373
- this.i = t, this.Y = e || Nt, this.o = n, this.tt = {
5374
- "image/crn": zn.crn && zn.crn(),
5375
- "image/ktx2": zn.ktx2 && zn.ktx2(),
5376
- "image/cttf": zn.ktx2 && zn.ktx2(),
5377
- "draco": zn.draco && zn.draco()
5440
+ this.i = t, this.Y = e || Pt, this.o = n, this.tt = {
5441
+ "image/crn": qn.crn && qn.crn(),
5442
+ "image/ktx2": qn.ktx2 && qn.ktx2(),
5443
+ "image/cttf": qn.ktx2 && qn.ktx2(),
5444
+ "draco": qn.draco && qn.draco()
5378
5445
  };
5379
5446
  }
5380
5447
  static createEmptyB3DM() {
@@ -5433,15 +5500,15 @@
5433
5500
  o = h, h = a, u = c, a = 0, c = 0);
5434
5501
  const l = [ t ];
5435
5502
  let d, m, y;
5436
- if (a > 0 ? (d = ae(t, f, a), f += a, o = d.BATCH_LENGTH) : d = {
5503
+ if (a > 0 ? (d = he(t, f, a), f += a, o = d.BATCH_LENGTH) : d = {
5437
5504
  "BATCH_LENGTH": o
5438
- }, c > 0 && (f += c), h > 0 && (m = ce(t, f, h), f += h, u > 0)) {
5439
- const e = he(0, f, u);
5505
+ }, c > 0 && (f += c), h > 0 && (m = ue(t, f, h), f += h, u > 0)) {
5506
+ const e = fe(0, f, u);
5440
5507
  y = t.slice(e.offset, e.offset + e.byteLength), f += u, l.push(y);
5441
5508
  }
5442
5509
  const b = d.BATCH_LENGTH, p = {};
5443
5510
  if (d && d.BATCH_ID) {
5444
- p.BATCH_ID = fe(d.BATCH_ID, t, (void 0).offset, b);
5511
+ p.BATCH_ID = de(d.BATCH_ID, t, (void 0).offset, b);
5445
5512
  const e = p.BATCH_ID.array && p.BATCH_ID.array.buffer;
5446
5513
  e && l.indexOf(e) < 0 && l.push(e);
5447
5514
  }
@@ -5463,13 +5530,13 @@
5463
5530
  return null;
5464
5531
  }
5465
5532
  }
5466
- class Vn {
5533
+ class Jn {
5467
5534
  constructor(t, e, n) {
5468
- this.i = t, this.Y = e || Nt, this.o = n, this.tt = {
5469
- "image/crn": zn.crn && zn.crn(),
5470
- "image/ktx2": zn.ktx2 && zn.ktx2(),
5471
- "image/cttf": zn.ktx2 && zn.ktx2(),
5472
- "draco": zn.draco && zn.draco()
5535
+ this.i = t, this.Y = e || Pt, this.o = n, this.tt = {
5536
+ "image/crn": qn.crn && qn.crn(),
5537
+ "image/ktx2": qn.ktx2 && qn.ktx2(),
5538
+ "image/cttf": qn.ktx2 && qn.ktx2(),
5539
+ "draco": qn.draco && qn.draco()
5473
5540
  };
5474
5541
  }
5475
5542
  load(t, e, n = 0, r = 0) {
@@ -5546,7 +5613,7 @@
5546
5613
  error: t
5547
5614
  };
5548
5615
  }
5549
- const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = be(s, 32 + e, o), f = {}, l = a.INSTANCES_LENGTH;
5616
+ const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = we(s, 32 + e, o), f = {}, l = a.INSTANCES_LENGTH;
5550
5617
  if (a.POSITION) {
5551
5618
  const {byteOffset: e} = a.POSITION;
5552
5619
  f.POSITION = {
@@ -5569,7 +5636,7 @@
5569
5636
  }, o.push(f.POSITION.array.buffer);
5570
5637
  }
5571
5638
  if (a.BATCH_ID) {
5572
- f.BATCH_ID = fe(a.BATCH_ID, t, c.offset, l);
5639
+ f.BATCH_ID = de(a.BATCH_ID, t, c.offset, l);
5573
5640
  const e = f.BATCH_ID.array && f.BATCH_ID.array.buffer;
5574
5641
  e && o.indexOf(e) < 0 && o.push(e);
5575
5642
  }
@@ -5640,26 +5707,26 @@
5640
5707
  }
5641
5708
  ct(t) {
5642
5709
  const e = t.length / 2, n = new Float32Array(3 * e), r = [];
5643
- for (let s = 0; s < e; s++) Gn(r, t[2 * s], t[2 * s + 1], 65535), n[3 * s] = r[0],
5710
+ for (let s = 0; s < e; s++) Kn(r, t[2 * s], t[2 * s + 1], 65535), n[3 * s] = r[0],
5644
5711
  n[3 * s + 1] = r[1], n[3 * s + 2] = r[2];
5645
5712
  return n;
5646
5713
  }
5647
5714
  at(t, e, n) {
5648
- return ye(new Float32Array(t.length), t, e, n);
5715
+ return pe(new Float32Array(t.length), t, e, n);
5649
5716
  }
5650
5717
  rt() {
5651
5718
  return null;
5652
5719
  }
5653
5720
  }
5654
- function Gn(t, e, n, r) {
5655
- if (t[0] = Hn(e, r), t[1] = Hn(n, r), t[2] = 1 - (Math.abs(t[0]) + Math.abs(t[1])),
5721
+ function Kn(t, e, n, r) {
5722
+ if (t[0] = Xn(e, r), t[1] = Xn(n, r), t[2] = 1 - (Math.abs(t[0]) + Math.abs(t[1])),
5656
5723
  t[2] < 0) {
5657
5724
  const e = t[0];
5658
- t[0] = (1 - Math.abs(t[1])) * qn(e), t[1] = (1 - Math.abs(e)) * qn(t[1]);
5725
+ t[0] = (1 - Math.abs(t[1])) * Wn(e), t[1] = (1 - Math.abs(e)) * Wn(t[1]);
5659
5726
  }
5660
5727
  return D(t, t);
5661
5728
  }
5662
- function Hn(t, e) {
5729
+ function Xn(t, e) {
5663
5730
  return function(t, e, n) {
5664
5731
  return t < e ? e : t > n ? n : t;
5665
5732
  }(t, 0, e = function(t, e) {
@@ -5667,10 +5734,10 @@
5667
5734
  return e;
5668
5735
  }(e, 255)) / e * 2 - 1;
5669
5736
  }
5670
- function qn(t) {
5737
+ function Wn(t) {
5671
5738
  return t < 0 ? -1 : 1;
5672
5739
  }
5673
- class $n {
5740
+ class Zn {
5674
5741
  constructor() {}
5675
5742
  load(t, e, n = 0, r = 0) {
5676
5743
  return e ? (r || (r = e.byteLength), this.et(t, e, n, r)) : ft.getArrayBuffer(t, {}).then(e => {
@@ -5703,7 +5770,7 @@
5703
5770
  error: t
5704
5771
  };
5705
5772
  }
5706
- const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = be(s, e + 28, o), f = a.QUANTIZED_VOLUME_OFFSET, l = a.QUANTIZED_VOLUME_SCALE, d = a.POINTS_LENGTH;
5773
+ const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = we(s, e + 28, o), f = a.QUANTIZED_VOLUME_OFFSET, l = a.QUANTIZED_VOLUME_SCALE, d = a.POINTS_LENGTH;
5707
5774
  let m, y = {};
5708
5775
  if (a.extensions && a.extensions["3DTILES_draco_point_compression"]) {
5709
5776
  y = a.extensions["3DTILES_draco_point_compression"], m = new DataView(t, y.byteOffset + c.offset, y.byteLength);
@@ -5711,7 +5778,7 @@
5711
5778
  attributes: y.properties,
5712
5779
  useUniqueIDs: !1
5713
5780
  };
5714
- return this.ut || (this.ut = zn.draco()), this.ut(m, e).then(e => {
5781
+ return this.ut || (this.ut = qn.draco()), this.ut(m, e).then(e => {
5715
5782
  const n = e.attributes;
5716
5783
  !a.POSITION && !a.POSITION_QUANTIZED || n.POSITION || n.POSITION_QUANTIZED || (n.POSITION = a.POSITION,
5717
5784
  n.POSITION_QUANTIZED = a.POSITION_QUANTIZED), !(a.RGB || a.RGBA || a.RGB565) || n.RGB || n.RGBA || n.RGB565 || (n.RGB = a.RGB,
@@ -5725,11 +5792,11 @@
5725
5792
  byteOffset: 0,
5726
5793
  itemSize: 1,
5727
5794
  count: t.length,
5728
- componentType: me(t.constructor),
5795
+ componentType: be(t.constructor),
5729
5796
  array: t
5730
5797
  }, o.push(t.buffer);
5731
5798
  } else if (a.BATCH_ID || Object.keys(h).length) {
5732
- a.BATCH_ID ? r.BATCH_ID = fe(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID = Jn(d);
5799
+ a.BATCH_ID ? r.BATCH_ID = de(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID = Qn(d);
5733
5800
  const e = r.BATCH_ID.array && r.BATCH_ID.array.buffer;
5734
5801
  e && o.indexOf(e) < 0 && o.push(e);
5735
5802
  }
@@ -5745,7 +5812,7 @@
5745
5812
  }
5746
5813
  const b = this.ft(t, a, c.offset, d, o, f, l);
5747
5814
  if (a.BATCH_ID || Object.keys(h).length) {
5748
- a.BATCH_ID ? b.BATCH_ID = fe(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID = Jn(d);
5815
+ a.BATCH_ID ? b.BATCH_ID = de(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID = Qn(d);
5749
5816
  const e = b.BATCH_ID.array && b.BATCH_ID.array.buffer;
5750
5817
  e && o.indexOf(e) < 0 && o.push(e);
5751
5818
  }
@@ -5874,13 +5941,13 @@
5874
5941
  return a;
5875
5942
  }
5876
5943
  at(t, e, n) {
5877
- return ye(new Float32Array(t.length), t, e, n);
5944
+ return pe(new Float32Array(t.length), t, e, n);
5878
5945
  }
5879
5946
  rt() {
5880
5947
  return null;
5881
5948
  }
5882
5949
  }
5883
- function Jn(t) {
5950
+ function Qn(t) {
5884
5951
  const e = v(t), n = new e(t);
5885
5952
  for (let e = 0; e < t; e++) n[e] = e;
5886
5953
  return {
@@ -5888,13 +5955,13 @@
5888
5955
  byteOffset: 0,
5889
5956
  itemSize: 1,
5890
5957
  count: t,
5891
- componentType: me(e),
5958
+ componentType: be(e),
5892
5959
  array: n
5893
5960
  };
5894
5961
  }
5895
- class Kn {
5962
+ class Yn {
5896
5963
  constructor(t, e) {
5897
- this.i = t, this.Y = e || Nt;
5964
+ this.i = t, this.Y = e || Pt;
5898
5965
  }
5899
5966
  load(t, e, n = 0, r = 0) {
5900
5967
  return e ? this.et(t, e, n, r) : ft.getArrayBuffer(t, {}).then(e => {
@@ -5907,12 +5974,12 @@
5907
5974
  const s = this.lt(e, t, n, r), i = [];
5908
5975
  for (let n = 0; n < s.length; n++) {
5909
5976
  let r;
5910
- if ("b3dm" === s[n].magic) r = new jn(this.i, this.Y); else if ("i3dm" === s[n].magic) r = new Vn(this.i, this.Y); else if ("pnts" === s[n].magic) r = new $n; else {
5977
+ if ("b3dm" === s[n].magic) r = new $n(this.i, this.Y); else if ("i3dm" === s[n].magic) r = new Jn(this.i, this.Y); else if ("pnts" === s[n].magic) r = new Zn; else {
5911
5978
  if ("cmpt" !== s[n].magic) {
5912
5979
  console.warn("Unsupported magic in CMPT tile:", s[n].magic);
5913
5980
  continue;
5914
5981
  }
5915
- r = new Kn(this.i, this.Y);
5982
+ r = new Yn(this.i, this.Y);
5916
5983
  }
5917
5984
  i.push(r.load(t, e, s[n].offset, s[n].byteLength).then(t => t));
5918
5985
  }
@@ -5933,7 +6000,7 @@
5933
6000
  const o = [], a = s.getUint32(12, !0);
5934
6001
  let c = 16;
5935
6002
  for (let e = 0; e < a; e++) {
5936
- const e = ie(s, c), r = s.getUint32(c + 8, !0);
6003
+ const e = ae(s, c), r = s.getUint32(c + 8, !0);
5937
6004
  o.push({
5938
6005
  magic: e,
5939
6006
  buffer: t,
@@ -5944,9 +6011,9 @@
5944
6011
  return o;
5945
6012
  }
5946
6013
  }
5947
- t.B3DMLoader = jn, t.CMPTLoader = Kn, t.Geo3DTilesLayer = Ln, t.Geo3DTilesUtil = x,
5948
- t.Geo3DTransform = se, Object.defineProperty(t, "t", {
6014
+ t.B3DMLoader = $n, t.CMPTLoader = Yn, t.Geo3DTilesLayer = Fn, t.Geo3DTilesUtil = x,
6015
+ t.Geo3DTransform = oe, Object.defineProperty(t, "t", {
5949
6016
  value: !0
5950
6017
  });
5951
- })), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.12.2");
6018
+ })), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.12.6");
5952
6019
  }));