@mapvx/web-js 3.5.0-dev.2 → 3.5.0-dev.3

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 +1 @@
1
- {"version":3,"file":"three.js","sourceRoot":"","sources":["../../../src/utils/three.ts"],"names":[],"mappings":"AAmDA,IAAI,YAA8C,CAAA;AAClD,IAAI,WAA4C,CAAA;AAEhD;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,YAAY,aAAZ,YAAY,cAAZ,YAAY,IAAZ,YAAY,GAAK,OAAO,CAAC,GAAG,CAAC;QAC3B,MAAM,CAAC,OAAO,CAAC;QACf,MAAM,CAAC,oCAAoC,CAAC;QAC5C,MAAM,CAAC,qCAAqC,CAAC;QAC7C,MAAM,CAAC,oCAAoC,CAAC;QAC5C,MAAM,CAAC,6CAA6C,CAAC;KACtD,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;QAChD,KAAK,EAAE,KAAK;QACZ,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,cAAc,EAAE,OAAO,CAAC,cAAc;KACvC,CAAC,CAAC,EAAA;IACH,OAAO,YAAY,CAAA;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ;IACtB,WAAW,aAAX,WAAW,cAAX,WAAW,IAAX,WAAW,GAAK,OAAO,CAAC,GAAG,CAAC;QAC1B,MAAM,CAAC,iBAAiB,CAAC;QACzB,MAAM,CAAC,qBAAqB,CAAC;QAC7B,MAAM,CAAC,iBAAiB,CAAC;KAC1B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QACxC,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,CAAC,CAAC,EAAA;IACH,OAAO,WAAW,CAAA;AACpB,CAAC"}
1
+ {"version":3,"file":"three.js","sourceRoot":"","sources":["../../../src/utils/three.ts"],"names":[],"mappings":"AA6CA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,aAAa,CAAI,IAAsB;IACrD,IAAI,MAA8B,CAAA;IAClC,OAAO,GAAG,EAAE;QACV,MAAM,aAAN,MAAM,cAAN,MAAM,IAAN,MAAM,GAAK,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YACzC,wFAAwF;YACxF,iFAAiF;YACjF,MAAM,GAAG,SAAS,CAAA;YAClB,MAAM,KAAK,CAAA;QACb,CAAC,CAAC,EAAA;QACF,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAA+B,aAAa,CAAC,GAAG,EAAE,CACtE,OAAO,CAAC,GAAG,CAAC;IACV,MAAM,CAAC,OAAO,CAAC;IACf,MAAM,CAAC,oCAAoC,CAAC;IAC5C,MAAM,CAAC,qCAAqC,CAAC;IAC7C,MAAM,CAAC,oCAAoC,CAAC;CAC7C,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IACvC,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE,IAAI,CAAC,UAAU;IAC3B,WAAW,EAAE,KAAK,CAAC,WAAW;IAC9B,UAAU,EAAE,IAAI,CAAC,UAAU;CAC5B,CAAC,CAAC,CACJ,CAAA;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAyC,aAAa,CAAC,GAAG,EAAE,CACzF,MAAM,CAAC,6CAA6C,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,CAChG,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA8B,aAAa,CAAC,GAAG,EAAE,CACpE,OAAO,CAAC,GAAG,CAAC;IACV,MAAM,CAAC,iBAAiB,CAAC;IACzB,MAAM,CAAC,qBAAqB,CAAC;IAC7B,MAAM,CAAC,iBAAiB,CAAC;CAC1B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;IACxC,aAAa,EAAE,MAAM,CAAC,aAAa;IACnC,QAAQ,EAAE,SAAS,CAAC,QAAQ;IAC5B,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;CAC5B,CAAC,CAAC,CACJ,CAAA"}
package/dist/umd/index.js CHANGED
@@ -11249,7 +11249,7 @@ const extractSafariExtensionDetails = (func, filename) => {
11249
11249
  // exists only for the type-checker, so in the ES/CJS builds the identifier is
11250
11250
  // genuinely absent and a direct comparison throws ReferenceError at module load.
11251
11251
  // `typeof` is the only safe way to probe a possibly-undeclared global.
11252
- var sentry_SDK_VERSION = false ? 0 : "3.5.0-dev.2";
11252
+ var sentry_SDK_VERSION = false ? 0 : "3.5.0-dev.3";
11253
11253
  var DSN = false ? 0 : "https://872f598f020e3cd73a0933b562d24c81@sentry.mapvx.app/5";
11254
11254
 
11255
11255
  /**
@@ -19709,37 +19709,83 @@ function three_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
19709
19709
 
19710
19710
  /** Runtime handle to the deck.gl classes used by the 3D scene. */
19711
19711
 
19712
- var threePromise;
19713
- var deckPromise;
19712
+ /**
19713
+ * Memoizes a dynamic-import chain, caching only a FULFILLED result.
19714
+ *
19715
+ * A plain `cached ??= import(...)` also memoizes a *rejection*, so one transient chunk-fetch
19716
+ * failure (a dropped connection, a cache-busted deploy mid-session) permanently disables the
19717
+ * feature for the rest of the page's life: every retry receives the same rejected promise and
19718
+ * fails identically. The 3D scene retries on its own — `reloadScene3DModelsForLod` reloads GLB
19719
+ * templates on every zoom-in past the LOD threshold — so a sticky rejection turns a blip into
19720
+ * models that never come back until the user reloads.
19721
+ *
19722
+ * Concurrent callers still share one in-flight import (that is the point of the cache); only the
19723
+ * rejected promise is evicted, and the error is re-thrown so every current caller still sees it.
19724
+ *
19725
+ * Exported only so the eviction behaviour can be tested directly — the loaders below wrap real
19726
+ * dynamic `import()` calls, which a unit test cannot fail on demand.
19727
+ *
19728
+ * @param load Builds the import promise. Called again on the first retry after a failure.
19729
+ * @returns An accessor that imports at most once per successful load.
19730
+ * @internal
19731
+ */
19732
+ function memoizeImport(load) {
19733
+ var cached;
19734
+ return function () {
19735
+ cached !== null && cached !== void 0 ? cached : cached = load()["catch"](function (error) {
19736
+ // Evict BEFORE re-throwing so the next call starts a fresh import. Safe to assign here:
19737
+ // a promise never settles synchronously, so `cached` is already assigned by now.
19738
+ cached = undefined;
19739
+ throw error;
19740
+ });
19741
+ return cached;
19742
+ };
19743
+ }
19714
19744
 
19715
19745
  /**
19716
19746
  * Dynamically imports Three.js and the GLTF/DRACO/KTX2 loaders once and caches the result.
19717
19747
  * Subsequent calls return the same promise, so a single Three.js instance is shared.
19748
+ * A failed import is not cached — see {@link memoizeImport}.
19718
19749
  */
19719
- function loadThree() {
19720
- threePromise !== null && threePromise !== void 0 ? threePromise : threePromise = Promise.all([Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 912, 23)), Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 833, 23)), Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 303, 23)), Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 373, 23)), Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 502, 23))]).then(function (_ref) {
19721
- var _ref2 = three_slicedToArray(_ref, 5),
19750
+ var loadThree = memoizeImport(function () {
19751
+ return Promise.all([Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 912, 23)), Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 833, 23)), Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 303, 23)), Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 373, 23))]).then(function (_ref) {
19752
+ var _ref2 = three_slicedToArray(_ref, 4),
19722
19753
  three = _ref2[0],
19723
19754
  gltf = _ref2[1],
19724
19755
  draco = _ref2[2],
19725
- ktx2 = _ref2[3],
19726
- meshopt = _ref2[4];
19756
+ ktx2 = _ref2[3];
19727
19757
  return {
19728
19758
  THREE: three,
19729
19759
  GLTFLoader: gltf.GLTFLoader,
19730
19760
  DRACOLoader: draco.DRACOLoader,
19731
- KTX2Loader: ktx2.KTX2Loader,
19732
- MeshoptDecoder: meshopt.MeshoptDecoder
19761
+ KTX2Loader: ktx2.KTX2Loader
19733
19762
  };
19734
19763
  });
19735
- return threePromise;
19736
- }
19764
+ });
19765
+
19766
+ /**
19767
+ * Dynamically imports the singleton meshopt decoder once and caches the result.
19768
+ *
19769
+ * Deliberately NOT part of {@link loadThree}'s import chain: only GLBs compressed with
19770
+ * `EXT_meshopt_compression` need it, so keeping it out of the eager `Promise.all` keeps the
19771
+ * decoder module (and its WASM instantiation) off the critical path of the first 3D frame.
19772
+ * It is fetched on the first meshopt buffer decode instead — see the lazy wrapper in
19773
+ * `loadGlb.ts`. That moves the fetch inside `parse()`, competing with hundreds of MB of GLB
19774
+ * downloads, so not caching a failed import (see {@link memoizeImport}) matters more here than
19775
+ * for the eager loaders.
19776
+ */
19777
+ var loadMeshoptDecoder = memoizeImport(function () {
19778
+ return Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 502, 23)).then(function (meshopt) {
19779
+ return meshopt.MeshoptDecoder;
19780
+ });
19781
+ });
19737
19782
 
19738
19783
  /**
19739
19784
  * Dynamically imports the deck.gl overlay and layer classes once and caches the result.
19785
+ * A failed import is not cached — see {@link memoizeImport}.
19740
19786
  */
19741
- function loadDeck() {
19742
- deckPromise !== null && deckPromise !== void 0 ? deckPromise : deckPromise = Promise.all([Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 452, 23)), Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 741, 23)), Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 589, 23))]).then(function (_ref3) {
19787
+ var loadDeck = memoizeImport(function () {
19788
+ return Promise.all([Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 452, 23)), Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 741, 23)), Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 589, 23))]).then(function (_ref3) {
19743
19789
  var _ref4 = three_slicedToArray(_ref3, 3),
19744
19790
  mapbox = _ref4[0],
19745
19791
  geoLayers = _ref4[1],
@@ -19752,31 +19798,104 @@ function loadDeck() {
19752
19798
  TextLayer: layers.TextLayer
19753
19799
  };
19754
19800
  });
19755
- return deckPromise;
19756
- }
19801
+ });
19757
19802
  ;// ./src/utils/loadGlb.ts
19758
- function loadGlb_regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return loadGlb_regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (loadGlb_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, loadGlb_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, loadGlb_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), loadGlb_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", loadGlb_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), loadGlb_regeneratorDefine2(u), loadGlb_regeneratorDefine2(u, o, "Generator"), loadGlb_regeneratorDefine2(u, n, function () { return this; }), loadGlb_regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (loadGlb_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
19759
- function loadGlb_regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } loadGlb_regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { loadGlb_regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, loadGlb_regeneratorDefine2(e, r, n, t); }
19760
19803
  function loadGlb_slicedToArray(r, e) { return loadGlb_arrayWithHoles(r) || loadGlb_iterableToArrayLimit(r, e) || loadGlb_unsupportedIterableToArray(r, e) || loadGlb_nonIterableRest(); }
19761
19804
  function loadGlb_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19762
19805
  function loadGlb_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return loadGlb_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? loadGlb_arrayLikeToArray(r, a) : void 0; } }
19763
19806
  function loadGlb_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
19764
19807
  function loadGlb_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
19765
19808
  function loadGlb_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
19809
+ function loadGlb_regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return loadGlb_regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (loadGlb_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, loadGlb_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, loadGlb_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), loadGlb_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", loadGlb_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), loadGlb_regeneratorDefine2(u), loadGlb_regeneratorDefine2(u, o, "Generator"), loadGlb_regeneratorDefine2(u, n, function () { return this; }), loadGlb_regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (loadGlb_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
19810
+ function loadGlb_regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } loadGlb_regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { loadGlb_regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, loadGlb_regeneratorDefine2(e, r, n, t); }
19766
19811
  function loadGlb_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
19767
19812
  function loadGlb_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { loadGlb_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { loadGlb_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
19813
+ function loadGlb_typeof(o) { "@babel/helpers - typeof"; return loadGlb_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, loadGlb_typeof(o); }
19768
19814
 
19769
19815
 
19770
19816
 
19817
+ /**
19818
+ * The subset of the meshopt decoder contract `GLTFLoader` actually exercises when
19819
+ * `decodeGltfBufferAsync` is present: it checks `supported`, then calls `decodeGltfBufferAsync`
19820
+ * for each `EXT_meshopt_compression` buffer view (never touching `ready`/`decodeGltfBuffer`).
19821
+ *
19822
+ * The signature is derived from the module type again, now that
19823
+ * `src/types/three-addons.d.ts` declares the decoder's shape directly instead of forwarding to
19824
+ * `@types/three`'s unresolvable `export * from "meshoptimizer/decoder"` — which `skipLibCheck`
19825
+ * swallowed, collapsing the lookup to `any`. Deriving keeps this interface and the delegation
19826
+ * call in `createLazyMeshoptDecoder` checked against a single definition; hand-writing it here
19827
+ * left the delegation itself unchecked, because the value it delegates to was still `any`.
19828
+ *
19829
+ * That definition is transcribed from three's JS, so it is an assertion about that file rather
19830
+ * than a derivation from it: a three.js change needs the `.d.ts` updated by hand. What is
19831
+ * compiler-enforced is that this shim and its consumers agree with it.
19832
+ * @internal
19833
+ */
19834
+
19835
+ /**
19836
+ * Builds a stand-in meshopt decoder that defers importing the real module (and instantiating its
19837
+ * WASM) until the first `EXT_meshopt_compression` buffer actually needs decoding. GLBs without the
19838
+ * extension never trigger the import, so the decoder stays off the critical path of the first 3D
19839
+ * frame — it used to be part of the eager three.js import chain, delaying every scene load.
19840
+ *
19841
+ * `supported` mirrors the real module's own gate — it returns a bare `{ supported: false }` when
19842
+ * `typeof WebAssembly !== "object"` — so the answer is reproduced synchronously here without
19843
+ * importing anything. Reporting a flat `true` instead would break the platforms it claims to
19844
+ * support: `GLTFLoader` reads `supported` before deciding to decode, and on `false` with meshopt
19845
+ * merely OPTIONAL it returns `null` and falls back to the GLB's uncompressed buffer
19846
+ * (`GLTFLoader.js` `GLTFMeshoptCompression.loadBufferView`). Claiming support on a WASM-less
19847
+ * platform discards that fallback and fails the whole asset with a `TypeError` from this shim,
19848
+ * since `decodeGltfBufferAsync` does not exist on the real module there.
19849
+ *
19850
+ * @param load Injectable module loader, for tests. Defaults to the cached {@link loadMeshoptDecoder}.
19851
+ * @internal
19852
+ */
19853
+ function createLazyMeshoptDecoder() {
19854
+ var load = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : loadMeshoptDecoder;
19855
+ return {
19856
+ // Same condition the real decoder uses, evaluated without loading it.
19857
+ supported: (typeof WebAssembly === "undefined" ? "undefined" : loadGlb_typeof(WebAssembly)) === "object",
19858
+ decodeGltfBufferAsync: function () {
19859
+ var _decodeGltfBufferAsync = loadGlb_asyncToGenerator(/*#__PURE__*/loadGlb_regenerator().m(function _callee(count, size, source, mode, filter) {
19860
+ var decoder;
19861
+ return loadGlb_regenerator().w(function (_context) {
19862
+ while (1) switch (_context.n) {
19863
+ case 0:
19864
+ _context.n = 1;
19865
+ return load();
19866
+ case 1:
19867
+ decoder = _context.v;
19868
+ _context.n = 2;
19869
+ return decoder.ready;
19870
+ case 2:
19871
+ return _context.a(2, decoder.decodeGltfBufferAsync(count, size, source, mode, filter));
19872
+ }
19873
+ }, _callee);
19874
+ }));
19875
+ function decodeGltfBufferAsync(_x, _x2, _x3, _x4, _x5) {
19876
+ return _decodeGltfBufferAsync.apply(this, arguments);
19877
+ }
19878
+ return decodeGltfBufferAsync;
19879
+ }()
19880
+ };
19881
+ }
19882
+
19771
19883
  /**
19772
19884
  * Lazily-initialized, cached GLTF loader configured with Draco + KTX2 support.
19773
19885
  *
19774
19886
  * The loaders (and their WebGLRenderer for KTX2 support detection) are heavy and pull in Three.js,
19775
19887
  * so they are created on first use inside the dynamic-import boundary rather than at module load.
19776
- */
19777
- var gltfLoaderPromise;
19778
- function getGltfLoader() {
19779
- gltfLoaderPromise !== null && gltfLoaderPromise !== void 0 ? gltfLoaderPromise : gltfLoaderPromise = loadThree().then(function (mod) {
19888
+ *
19889
+ * Memoized through {@link memoizeImport} for the same reason the loaders in `three.ts` are: a plain
19890
+ * `cached ??=` also caches a rejection. Fixing the three loaders was not enough, because this is a
19891
+ * SECOND cache wrapped around `loadThree()` — so a transient failure was evicted there and then
19892
+ * replayed from here forever, and `loadGlbRoot` awaits both, meaning every GLB kept failing with
19893
+ * the stale error long after `loadThree()` had recovered. Not only network: the `.then` below
19894
+ * constructs a `WebGLRenderer` for KTX2 support detection, and a failed context creation was
19895
+ * cached just the same.
19896
+ */
19897
+ var getGltfLoader = memoizeImport(function () {
19898
+ return loadThree().then(function (mod) {
19780
19899
  var dracoLoader = new mod.DRACOLoader();
19781
19900
  dracoLoader.setDecoderPath(DEFAULT_DRACO_DECODER_PATH);
19782
19901
  var gltfLoader = new mod.GLTFLoader();
@@ -19788,15 +19907,15 @@ function getGltfLoader() {
19788
19907
  antialias: true
19789
19908
  }));
19790
19909
 
19791
- // Enable EXT_meshopt_compression so meshopt-compressed GLBs decode. The decoder is a WASM
19792
- // singleton; GLTFLoader awaits its `.ready` promise internally before parsing. Assets that
19793
- // don't use the extension are unaffected. This lets the offline pipeline pick meshopt (often
19794
- // smaller than Draco for the scene's meshes) without a runtime change.
19795
- gltfLoader.setMeshoptDecoder(mod.MeshoptDecoder);
19910
+ // Enable EXT_meshopt_compression so meshopt-compressed GLBs decode, without paying for the
19911
+ // decoder module up front: the lazy stand-in imports it (and instantiates its WASM) only when
19912
+ // the first meshopt-compressed buffer is actually decoded. Assets that don't use the extension
19913
+ // never load it. The cast is safe — with `decodeGltfBufferAsync` present, GLTFLoader touches
19914
+ // only `supported` and `decodeGltfBufferAsync` (see LazyMeshoptDecoder).
19915
+ gltfLoader.setMeshoptDecoder(createLazyMeshoptDecoder());
19796
19916
  return gltfLoader;
19797
19917
  });
19798
- return gltfLoaderPromise;
19799
- }
19918
+ });
19800
19919
 
19801
19920
  /**
19802
19921
  * Default per-asset timeout for {@link loadGlbRoot}.
@@ -19861,11 +19980,11 @@ function assertGlbBufferComplete(buffer, url) {
19861
19980
  * @returns Root `THREE.Group` from the loaded glTF scene
19862
19981
  * @group Utils
19863
19982
  */
19864
- function loadGlbRoot(_x) {
19983
+ function loadGlbRoot(_x6) {
19865
19984
  return _loadGlbRoot.apply(this, arguments);
19866
19985
  }
19867
19986
  function _loadGlbRoot() {
19868
- _loadGlbRoot = loadGlb_asyncToGenerator(/*#__PURE__*/loadGlb_regenerator().m(function _callee(url) {
19987
+ _loadGlbRoot = loadGlb_asyncToGenerator(/*#__PURE__*/loadGlb_regenerator().m(function _callee2(url) {
19869
19988
  var options,
19870
19989
  _options$timeoutMs,
19871
19990
  timeoutMs,
@@ -19879,16 +19998,16 @@ function _loadGlbRoot() {
19879
19998
  load,
19880
19999
  timer,
19881
20000
  timeout,
19882
- _args = arguments;
19883
- return loadGlb_regenerator().w(function (_context) {
19884
- while (1) switch (_context.p = _context.n) {
20001
+ _args2 = arguments;
20002
+ return loadGlb_regenerator().w(function (_context2) {
20003
+ while (1) switch (_context2.p = _context2.n) {
19885
20004
  case 0:
19886
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
20005
+ options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
19887
20006
  _options$timeoutMs = options.timeoutMs, timeoutMs = _options$timeoutMs === void 0 ? DEFAULT_GLB_LOAD_TIMEOUT_MS : _options$timeoutMs, onProgress = options.onProgress;
19888
- _context.n = 1;
20007
+ _context2.n = 1;
19889
20008
  return Promise.all([getGltfLoader(), loadThree()]);
19890
20009
  case 1:
19891
- _yield$Promise$all = _context.v;
20010
+ _yield$Promise$all = _context2.v;
19892
20011
  _yield$Promise$all2 = loadGlb_slicedToArray(_yield$Promise$all, 2);
19893
20012
  gltfLoader = _yield$Promise$all2[0];
19894
20013
  three = _yield$Promise$all2[1].THREE;
@@ -19922,31 +20041,31 @@ function _loadGlbRoot() {
19922
20041
  }, onError);
19923
20042
  });
19924
20043
  if (!(!Number.isFinite(timeoutMs) || timeoutMs <= 0)) {
19925
- _context.n = 5;
20044
+ _context2.n = 5;
19926
20045
  break;
19927
20046
  }
19928
- _context.p = 2;
19929
- _context.n = 3;
20047
+ _context2.p = 2;
20048
+ _context2.n = 3;
19930
20049
  return load;
19931
20050
  case 3:
19932
- return _context.a(2, _context.v);
20051
+ return _context2.a(2, _context2.v);
19933
20052
  case 4:
19934
- _context.p = 4;
20053
+ _context2.p = 4;
19935
20054
  settled = true;
19936
- return _context.f(4);
20055
+ return _context2.f(4);
19937
20056
  case 5:
19938
20057
  timeout = new Promise(function (_resolve, reject) {
19939
20058
  timer = setTimeout(function () {
19940
20059
  return reject(new Error("Timed out loading GLB after ".concat(timeoutMs, "ms: ").concat(url)));
19941
20060
  }, timeoutMs);
19942
20061
  });
19943
- _context.p = 6;
19944
- _context.n = 7;
20062
+ _context2.p = 6;
20063
+ _context2.n = 7;
19945
20064
  return Promise.race([load, timeout]);
19946
20065
  case 7:
19947
- return _context.a(2, _context.v);
20066
+ return _context2.a(2, _context2.v);
19948
20067
  case 8:
19949
- _context.p = 8;
20068
+ _context2.p = 8;
19950
20069
  settled = true;
19951
20070
  clearTimeout(timer);
19952
20071
  // Cancels the underlying fetch (and, by never delivering its buffer, the Draco/KTX2 decode)
@@ -19954,11 +20073,11 @@ function _loadGlbRoot() {
19954
20073
  // unattended — otherwise GLB_LOAD_CONCURRENCY only bounds how many loads the caller awaits,
19955
20074
  // not how many are truly in flight. A no-op if `load` already won the race.
19956
20075
  fileLoader.abort();
19957
- return _context.f(8);
20076
+ return _context2.f(8);
19958
20077
  case 9:
19959
- return _context.a(2);
20078
+ return _context2.a(2);
19960
20079
  }
19961
- }, _callee, null, [[6,, 8, 9], [2,, 4, 5]]);
20080
+ }, _callee2, null, [[6,, 8, 9], [2,, 4, 5]]);
19962
20081
  }));
19963
20082
  return _loadGlbRoot.apply(this, arguments);
19964
20083
  }