pixi.js 7.3.3 → 7.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pixi.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * pixi.js - v7.3.3
3
- * Compiled Mon, 01 Jan 2024 14:18:14 UTC
2
+ * pixi.js - v7.4.2
3
+ * Compiled Wed, 20 Mar 2024 19:55:28 UTC
4
4
  *
5
5
  * pixi.js is licensed under the MIT License.
6
6
  * http://www.opensource.org/licenses/mit-license
@@ -2023,20 +2023,20 @@ var index = {
2023
2023
  trimCanvas,
2024
2024
  uid,
2025
2025
  url
2026
- }, __defProp$d = Object.defineProperty, __defProps$4 = Object.defineProperties, __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$e = Object.getOwnPropertySymbols, __hasOwnProp$e = Object.prototype.hasOwnProperty, __propIsEnum$e = Object.prototype.propertyIsEnumerable, __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$d = (a2, b2) => {
2026
+ }, __defProp$d = Object.defineProperty, __defProps$5 = Object.defineProperties, __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$e = Object.getOwnPropertySymbols, __hasOwnProp$e = Object.prototype.hasOwnProperty, __propIsEnum$e = Object.prototype.propertyIsEnumerable, __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$d = (a2, b2) => {
2027
2027
  for (var prop in b2 || (b2 = {}))
2028
2028
  __hasOwnProp$e.call(b2, prop) && __defNormalProp$d(a2, prop, b2[prop]);
2029
2029
  if (__getOwnPropSymbols$e)
2030
2030
  for (var prop of __getOwnPropSymbols$e(b2))
2031
2031
  __propIsEnum$e.call(b2, prop) && __defNormalProp$d(a2, prop, b2[prop]);
2032
2032
  return a2;
2033
- }, __spreadProps$4 = (a2, b2) => __defProps$4(a2, __getOwnPropDescs$4(b2)), ExtensionType = /* @__PURE__ */ ((ExtensionType2) => (ExtensionType2.Renderer = "renderer", ExtensionType2.Application = "application", ExtensionType2.RendererSystem = "renderer-webgl-system", ExtensionType2.RendererPlugin = "renderer-webgl-plugin", ExtensionType2.CanvasRendererSystem = "renderer-canvas-system", ExtensionType2.CanvasRendererPlugin = "renderer-canvas-plugin", ExtensionType2.Asset = "asset", ExtensionType2.LoadParser = "load-parser", ExtensionType2.ResolveParser = "resolve-parser", ExtensionType2.CacheParser = "cache-parser", ExtensionType2.DetectionParser = "detection-parser", ExtensionType2))(ExtensionType || {});
2033
+ }, __spreadProps$5 = (a2, b2) => __defProps$5(a2, __getOwnPropDescs$5(b2)), ExtensionType = /* @__PURE__ */ ((ExtensionType2) => (ExtensionType2.Renderer = "renderer", ExtensionType2.Application = "application", ExtensionType2.RendererSystem = "renderer-webgl-system", ExtensionType2.RendererPlugin = "renderer-webgl-plugin", ExtensionType2.CanvasRendererSystem = "renderer-canvas-system", ExtensionType2.CanvasRendererPlugin = "renderer-canvas-plugin", ExtensionType2.Asset = "asset", ExtensionType2.LoadParser = "load-parser", ExtensionType2.ResolveParser = "resolve-parser", ExtensionType2.CacheParser = "cache-parser", ExtensionType2.DetectionParser = "detection-parser", ExtensionType2))(ExtensionType || {});
2034
2034
  const normalizeExtension = (ext) => {
2035
2035
  if (typeof ext == "function" || typeof ext == "object" && ext.extension) {
2036
2036
  if (!ext.extension)
2037
2037
  throw new Error("Extension class must have an extension object");
2038
2038
  const metadata = typeof ext.extension != "object" ? { type: ext.extension } : ext.extension;
2039
- ext = __spreadProps$4(__spreadValues$d({}, metadata), { ref: ext });
2039
+ ext = __spreadProps$5(__spreadValues$d({}, metadata), { ref: ext });
2040
2040
  }
2041
2041
  if (typeof ext == "object")
2042
2042
  ext = __spreadValues$d({}, ext);
@@ -2074,8 +2074,9 @@ const normalizeExtension = (ext) => {
2074
2074
  add(...extensions2) {
2075
2075
  return extensions2.map(normalizeExtension).forEach((ext) => {
2076
2076
  ext.type.forEach((type) => {
2077
+ var _a2, _b;
2077
2078
  const handlers = this._addHandlers, queue = this._queue;
2078
- handlers[type] ? handlers[type](ext) : (queue[type] = queue[type] || [], queue[type].push(ext));
2079
+ handlers[type] ? (_b = handlers[type]) == null || _b.call(handlers, ext) : (queue[type] = queue[type] || [], (_a2 = queue[type]) == null || _a2.push(ext));
2079
2080
  });
2080
2081
  }), this;
2081
2082
  },
@@ -2087,12 +2088,13 @@ const normalizeExtension = (ext) => {
2087
2088
  * @returns {PIXI.extensions} For chaining.
2088
2089
  */
2089
2090
  handle(type, onAdd, onRemove) {
2091
+ var _a2;
2090
2092
  const addHandlers = this._addHandlers, removeHandlers = this._removeHandlers;
2091
2093
  if (addHandlers[type] || removeHandlers[type])
2092
2094
  throw new Error(`Extension type ${type} already has a handler`);
2093
2095
  addHandlers[type] = onAdd, removeHandlers[type] = onRemove;
2094
2096
  const queue = this._queue;
2095
- return queue[type] && (queue[type].forEach((ext) => onAdd(ext)), delete queue[type]), this;
2097
+ return queue[type] && ((_a2 = queue[type]) == null || _a2.forEach((ext) => onAdd(ext)), delete queue[type]), this;
2096
2098
  },
2097
2099
  /**
2098
2100
  * Handle a type, but using a map by `name` property.
@@ -2104,10 +2106,10 @@ const normalizeExtension = (ext) => {
2104
2106
  return this.handle(
2105
2107
  type,
2106
2108
  (extension) => {
2107
- map2[extension.name] = extension.ref;
2109
+ extension.name && (map2[extension.name] = extension.ref);
2108
2110
  },
2109
2111
  (extension) => {
2110
- delete map2[extension.name];
2112
+ extension.name && delete map2[extension.name];
2111
2113
  }
2112
2114
  );
2113
2115
  },
@@ -2326,7 +2328,7 @@ function autoDetectResource(source, options) {
2326
2328
  }
2327
2329
  class Runner {
2328
2330
  /**
2329
- * @param name - The function name that will be executed on the listeners added to this Runner.
2331
+ * @param {string} name - The function name that will be executed on the listeners added to this Runner.
2330
2332
  */
2331
2333
  constructor(name) {
2332
2334
  this.items = [], this._name = name, this._aliasCount = 0;
@@ -2391,7 +2393,7 @@ class Runner {
2391
2393
  }
2392
2394
  /** Remove all references, don't use after this. */
2393
2395
  destroy() {
2394
- this.removeAll(), this.items = null, this._name = null;
2396
+ this.removeAll(), this.items.length = 0, this._name = "";
2395
2397
  }
2396
2398
  /**
2397
2399
  * `true` if there are no this Runner contains no listeners
@@ -2402,7 +2404,7 @@ class Runner {
2402
2404
  }
2403
2405
  /**
2404
2406
  * The name of the runner.
2405
- * @readonly
2407
+ * @type {string}
2406
2408
  */
2407
2409
  get name() {
2408
2410
  return this._name;
@@ -2592,7 +2594,7 @@ const defaultBufferOptions = {
2592
2594
  alphaMode: ALPHA_MODES.NPM
2593
2595
  }, _BaseTexture = class _BaseTexture2 extends EventEmitter {
2594
2596
  /**
2595
- * @param {PIXI.Resource|HTMLImageElement|HTMLVideoElement|ImageBitmap|ICanvas|string} [resource=null] -
2597
+ * @param {PIXI.Resource|PIXI.ImageSource|string} [resource=null] -
2596
2598
  * The current resource to use, for things that aren't Resource objects, will be converted
2597
2599
  * into a Resource.
2598
2600
  * @param options - Collection of options, default options inherited from {@link PIXI.BaseTexture.defaultOptions}.
@@ -2770,7 +2772,7 @@ const defaultBufferOptions = {
2770
2772
  * source is an image url or an image element and not in the base texture
2771
2773
  * cache, it will be created and loaded.
2772
2774
  * @static
2773
- * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas|string|string[]} source - The
2775
+ * @param {PIXI.ImageSource|string|string[]} source - The
2774
2776
  * source to create base texture from.
2775
2777
  * @param options - See {@link PIXI.BaseTexture}'s constructor for options.
2776
2778
  * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id
@@ -5560,7 +5562,8 @@ class ContextSystem {
5560
5562
  etc1: gl.getExtension("WEBGL_compressed_texture_etc1"),
5561
5563
  pvrtc: gl.getExtension("WEBGL_compressed_texture_pvrtc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
5562
5564
  atc: gl.getExtension("WEBGL_compressed_texture_atc"),
5563
- astc: gl.getExtension("WEBGL_compressed_texture_astc")
5565
+ astc: gl.getExtension("WEBGL_compressed_texture_astc"),
5566
+ bptc: gl.getExtension("EXT_texture_compression_bptc")
5564
5567
  };
5565
5568
  this.webGLVersion === 1 ? Object.assign(this.extensions, common, {
5566
5569
  drawBuffers: gl.getExtension("WEBGL_draw_buffers"),
@@ -5797,10 +5800,10 @@ class BaseRenderTexture extends BaseTexture {
5797
5800
  }
5798
5801
  class BaseImageResource extends Resource {
5799
5802
  /**
5800
- * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas} source
5803
+ * @param {PIXI.ImageSourcee} source
5801
5804
  */
5802
5805
  constructor(source) {
5803
- const sourceAny = source, width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width, height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;
5806
+ const sourceAny = source, width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.displayWidth || sourceAny.width, height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.displayHeight || sourceAny.height;
5804
5807
  super(width, height), this.source = source, this.noSubImage = !1;
5805
5808
  }
5806
5809
  /**
@@ -5817,7 +5820,7 @@ class BaseImageResource extends Resource {
5817
5820
  * @param renderer - Upload to the renderer
5818
5821
  * @param baseTexture - Reference to parent texture
5819
5822
  * @param glTexture
5820
- * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas} [source] - (optional)
5823
+ * @param {PIXI.ImageSourcee} [source] - (optional)
5821
5824
  * @returns - true is success
5822
5825
  */
5823
5826
  upload(renderer, baseTexture, glTexture, source) {
@@ -8277,7 +8280,7 @@ class StartupSystem {
8277
8280
  */
8278
8281
  run(options) {
8279
8282
  const { renderer } = this;
8280
- renderer.runners.init.emit(renderer.options), options.hello && console.log(`PixiJS 7.3.3 - ${renderer.rendererLogId} - https://pixijs.com`), renderer.resize(renderer.screen.width, renderer.screen.height);
8283
+ renderer.runners.init.emit(renderer.options), options.hello && console.log(`PixiJS 7.4.2 - ${renderer.rendererLogId} - https://pixijs.com`), renderer.resize(renderer.screen.width, renderer.screen.height);
8281
8284
  }
8282
8285
  destroy() {
8283
8286
  }
@@ -10578,6 +10581,23 @@ _SVGResource.SVG_XML = /^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m, /**
10578
10581
  */
10579
10582
  _SVGResource.SVG_SIZE = /<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;
10580
10583
  let SVGResource = _SVGResource;
10584
+ class VideoFrameResource extends BaseImageResource {
10585
+ /**
10586
+ * @param source - Image element to use
10587
+ */
10588
+ // eslint-disable-next-line @typescript-eslint/no-useless-constructor
10589
+ constructor(source) {
10590
+ super(source);
10591
+ }
10592
+ /**
10593
+ * Used to auto-detect the type of resource.
10594
+ * @param {*} source - The source object
10595
+ * @returns {boolean} `true` if source is an VideoFrame
10596
+ */
10597
+ static test(source) {
10598
+ return !!globalThis.VideoFrame && source instanceof globalThis.VideoFrame;
10599
+ }
10600
+ }
10581
10601
  const _VideoResource = class _VideoResource2 extends BaseImageResource {
10582
10602
  /**
10583
10603
  * @param {HTMLVideoElement|object|string|Array<string|object>} source - Video element to use.
@@ -10585,7 +10605,8 @@ const _VideoResource = class _VideoResource2 extends BaseImageResource {
10585
10605
  * @param {boolean} [options.autoLoad=true] - Start loading the video immediately
10586
10606
  * @param {boolean} [options.autoPlay=true] - Start playing video immediately
10587
10607
  * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.
10588
- * Leave at 0 to update at every render.
10608
+ * If 0, `requestVideoFrameCallback` is used to update the texture.
10609
+ * If `requestVideoFrameCallback` is not available, the texture is updated every render.
10589
10610
  * @param {boolean} [options.crossorigin=true] - Load image using cross origin
10590
10611
  * @param {boolean} [options.loop=false] - Loops the video
10591
10612
  * @param {boolean} [options.muted=false] - Mutes the video audio, useful for autoplay
@@ -10699,7 +10720,8 @@ const _VideoResource = class _VideoResource2 extends BaseImageResource {
10699
10720
  value !== this._autoUpdate && (this._autoUpdate = value, this._configureAutoUpdate());
10700
10721
  }
10701
10722
  /**
10702
- * How many times a second to update the texture from the video. Leave at 0 to update at every render.
10723
+ * How many times a second to update the texture from the video. If 0, `requestVideoFrameCallback` is used to
10724
+ * update the texture. If `requestVideoFrameCallback` is not available, the texture is updated every render.
10703
10725
  * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.
10704
10726
  */
10705
10727
  get updateFPS() {
@@ -10738,6 +10760,7 @@ INSTALLED.push(
10738
10760
  ImageResource,
10739
10761
  CanvasResource,
10740
10762
  VideoResource,
10763
+ VideoFrameResource,
10741
10764
  SVGResource,
10742
10765
  BufferResource,
10743
10766
  CubeResource,
@@ -10760,7 +10783,7 @@ class TransformFeedback {
10760
10783
  this.disposeRunner.emit(this, !1);
10761
10784
  }
10762
10785
  }
10763
- const VERSION = "7.3.3";
10786
+ const VERSION = "7.4.2";
10764
10787
  class Bounds {
10765
10788
  constructor() {
10766
10789
  this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, this.rect = null, this.updateID = -1;
@@ -14989,8 +15012,12 @@ const FederatedDisplayObject = {
14989
15012
  * });
14990
15013
  */
14991
15014
  addEventListener(type, listener, options) {
14992
- const capture = typeof options == "boolean" && options || typeof options == "object" && options.capture, context2 = typeof listener == "function" ? void 0 : listener;
14993
- type = capture ? `${type}capture` : type, listener = typeof listener == "function" ? listener : listener.handleEvent, this.on(type, listener, context2);
15015
+ const capture = typeof options == "boolean" && options || typeof options == "object" && options.capture, signal = typeof options == "object" ? options.signal : void 0, once = typeof options == "object" ? options.once === !0 : !1, context2 = typeof listener == "function" ? void 0 : listener;
15016
+ type = capture ? `${type}capture` : type;
15017
+ const listenerFn = typeof listener == "function" ? listener : listener.handleEvent, emitter = this;
15018
+ signal && signal.addEventListener("abort", () => {
15019
+ emitter.off(type, listenerFn, context2);
15020
+ }), once ? emitter.once(type, listenerFn, context2) : emitter.on(type, listenerFn, context2);
14994
15021
  },
14995
15022
  /**
14996
15023
  * Unlike `off` or `removeListener` which are methods from EventEmitter, `removeEventListener`
@@ -15572,14 +15599,14 @@ class CacheClass {
15572
15599
  }
15573
15600
  }
15574
15601
  const Cache = new CacheClass();
15575
- var __defProp$9 = Object.defineProperty, __defProps$3 = Object.defineProperties, __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$9 = Object.getOwnPropertySymbols, __hasOwnProp$9 = Object.prototype.hasOwnProperty, __propIsEnum$9 = Object.prototype.propertyIsEnumerable, __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$9 = (a2, b2) => {
15602
+ var __defProp$9 = Object.defineProperty, __defProps$4 = Object.defineProperties, __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$9 = Object.getOwnPropertySymbols, __hasOwnProp$9 = Object.prototype.hasOwnProperty, __propIsEnum$9 = Object.prototype.propertyIsEnumerable, __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$9 = (a2, b2) => {
15576
15603
  for (var prop in b2 || (b2 = {}))
15577
15604
  __hasOwnProp$9.call(b2, prop) && __defNormalProp$9(a2, prop, b2[prop]);
15578
15605
  if (__getOwnPropSymbols$9)
15579
15606
  for (var prop of __getOwnPropSymbols$9(b2))
15580
15607
  __propIsEnum$9.call(b2, prop) && __defNormalProp$9(a2, prop, b2[prop]);
15581
15608
  return a2;
15582
- }, __spreadProps$3 = (a2, b2) => __defProps$3(a2, __getOwnPropDescs$3(b2));
15609
+ }, __spreadProps$4 = (a2, b2) => __defProps$4(a2, __getOwnPropDescs$4(b2));
15583
15610
  class Loader {
15584
15611
  constructor() {
15585
15612
  this._parsers = [], this._parsersValidated = !1, this.parsers = new Proxy(this._parsers, {
@@ -15669,7 +15696,7 @@ ${e2}`);
15669
15696
  }
15670
15697
  /** validates our parsers, right now it only checks for name conflicts but we can add more here as required! */
15671
15698
  _validateParsers() {
15672
- this._parsersValidated = !0, this._parserHash = this._parsers.filter((parser) => parser.name).reduce((hash, parser) => (hash[parser.name] && console.warn(`[Assets] loadParser name conflict "${parser.name}"`), __spreadProps$3(__spreadValues$9({}, hash), { [parser.name]: parser })), {});
15699
+ this._parsersValidated = !0, this._parserHash = this._parsers.filter((parser) => parser.name).reduce((hash, parser) => (hash[parser.name] && console.warn(`[Assets] loadParser name conflict "${parser.name}"`), __spreadProps$4(__spreadValues$9({}, hash), { [parser.name]: parser })), {});
15673
15700
  }
15674
15701
  }
15675
15702
  var LoaderParserPriority = /* @__PURE__ */ ((LoaderParserPriority2) => (LoaderParserPriority2[LoaderParserPriority2.Low = 0] = "Low", LoaderParserPriority2[LoaderParserPriority2.Normal = 1] = "Normal", LoaderParserPriority2[LoaderParserPriority2.High = 2] = "High", LoaderParserPriority2))(LoaderParserPriority || {});
@@ -15701,14 +15728,14 @@ const validTXTExtension = ".txt", validTXTMIME = "text/plain", loadTxt = {
15701
15728
  }
15702
15729
  };
15703
15730
  extensions$1.add(loadTxt);
15704
- var __defProp$8 = Object.defineProperty, __defProps$2 = Object.defineProperties, __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$8 = Object.getOwnPropertySymbols, __hasOwnProp$8 = Object.prototype.hasOwnProperty, __propIsEnum$8 = Object.prototype.propertyIsEnumerable, __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$8 = (a2, b2) => {
15731
+ var __defProp$8 = Object.defineProperty, __defProps$3 = Object.defineProperties, __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$8 = Object.getOwnPropertySymbols, __hasOwnProp$8 = Object.prototype.hasOwnProperty, __propIsEnum$8 = Object.prototype.propertyIsEnumerable, __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$8 = (a2, b2) => {
15705
15732
  for (var prop in b2 || (b2 = {}))
15706
15733
  __hasOwnProp$8.call(b2, prop) && __defNormalProp$8(a2, prop, b2[prop]);
15707
15734
  if (__getOwnPropSymbols$8)
15708
15735
  for (var prop of __getOwnPropSymbols$8(b2))
15709
15736
  __propIsEnum$8.call(b2, prop) && __defNormalProp$8(a2, prop, b2[prop]);
15710
15737
  return a2;
15711
- }, __spreadProps$2 = (a2, b2) => __defProps$2(a2, __getOwnPropDescs$2(b2));
15738
+ }, __spreadProps$3 = (a2, b2) => __defProps$3(a2, __getOwnPropDescs$3(b2));
15712
15739
  const validWeights = [
15713
15740
  "normal",
15714
15741
  "bold",
@@ -15757,7 +15784,7 @@ const loadWebFont = {
15757
15784
  if (fonts) {
15758
15785
  const fontFaces = [], name = (_b = (_a2 = options.data) == null ? void 0 : _a2.family) != null ? _b : getFontFamilyName(url2), weights = (_e = (_d = (_c = options.data) == null ? void 0 : _c.weights) == null ? void 0 : _d.filter((weight) => validWeights.includes(weight))) != null ? _e : ["normal"], data = (_f = options.data) != null ? _f : {};
15759
15786
  for (let i2 = 0; i2 < weights.length; i2++) {
15760
- const weight = weights[i2], font = new FontFace(name, `url(${encodeURIWhenNeeded(url2)})`, __spreadProps$2(__spreadValues$8({}, data), {
15787
+ const weight = weights[i2], font = new FontFace(name, `url(${encodeURIWhenNeeded(url2)})`, __spreadProps$3(__spreadValues$8({}, data), {
15761
15788
  weight
15762
15789
  }));
15763
15790
  await font.load(), fonts.add(font), fontFaces.push(font);
@@ -15771,82 +15798,78 @@ const loadWebFont = {
15771
15798
  }
15772
15799
  };
15773
15800
  extensions$1.add(loadWebFont);
15774
- let UUID = 0, MAX_WORKERS;
15775
- const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=", checkImageBitmapCode = {
15776
- id: "checkImageBitmap",
15777
- code: `
15778
- async function checkImageBitmap()
15779
- {
15780
- try
15781
- {
15782
- if (typeof createImageBitmap !== 'function') return false;
15783
-
15784
- const response = await fetch('${WHITE_PNG}');
15785
- const imageBlob = await response.blob();
15786
- const imageBitmap = await createImageBitmap(imageBlob);
15787
-
15788
- return imageBitmap.width === 1 && imageBitmap.height === 1;
15789
- }
15790
- catch (e)
15791
- {
15792
- return false;
15793
- }
15801
+ const WORKER_CODE$1 = `(function() {
15802
+ "use strict";
15803
+ const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
15804
+ async function checkImageBitmap() {
15805
+ try {
15806
+ if (typeof createImageBitmap != "function")
15807
+ return !1;
15808
+ const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob);
15809
+ return imageBitmap.width === 1 && imageBitmap.height === 1;
15810
+ } catch (e) {
15811
+ return !1;
15794
15812
  }
15795
- checkImageBitmap().then((result) => { self.postMessage(result); });
15796
- `
15797
- }, workerCode = {
15798
- id: "loadImageBitmap",
15799
- code: `
15800
- async function loadImageBitmap(url)
15801
- {
15802
- const response = await fetch(url);
15803
-
15804
- if (!response.ok)
15805
- {
15806
- throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \`
15807
- + \`\${response.status} \${response.statusText}\`);
15808
- }
15809
-
15810
- const imageBlob = await response.blob();
15811
- const imageBitmap = await createImageBitmap(imageBlob);
15812
-
15813
- return imageBitmap;
15813
+ }
15814
+ checkImageBitmap().then((result) => {
15815
+ self.postMessage(result);
15816
+ });
15817
+ })();
15818
+ `;
15819
+ let WORKER_URL$1 = null, WorkerInstance$1 = class {
15820
+ constructor() {
15821
+ WORKER_URL$1 || (WORKER_URL$1 = URL.createObjectURL(new Blob([WORKER_CODE$1], { type: "application/javascript" }))), this.worker = new Worker(WORKER_URL$1);
15822
+ }
15823
+ };
15824
+ WorkerInstance$1.revokeObjectURL = function() {
15825
+ WORKER_URL$1 && (URL.revokeObjectURL(WORKER_URL$1), WORKER_URL$1 = null);
15826
+ };
15827
+ const WORKER_CODE = `(function() {
15828
+ "use strict";
15829
+ async function loadImageBitmap(url) {
15830
+ const response = await fetch(url);
15831
+ if (!response.ok)
15832
+ throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`);
15833
+ const imageBlob = await response.blob();
15834
+ return await createImageBitmap(imageBlob);
15835
+ }
15836
+ self.onmessage = async (event) => {
15837
+ try {
15838
+ const imageBitmap = await loadImageBitmap(event.data.data[0]);
15839
+ self.postMessage({
15840
+ data: imageBitmap,
15841
+ uuid: event.data.uuid,
15842
+ id: event.data.id
15843
+ }, [imageBitmap]);
15844
+ } catch (e) {
15845
+ self.postMessage({
15846
+ error: e,
15847
+ uuid: event.data.uuid,
15848
+ id: event.data.id
15849
+ });
15814
15850
  }
15815
- self.onmessage = async (event) =>
15816
- {
15817
- try
15818
- {
15819
- const imageBitmap = await loadImageBitmap(event.data.data[0]);
15820
-
15821
- self.postMessage({
15822
- data: imageBitmap,
15823
- uuid: event.data.uuid,
15824
- id: event.data.id,
15825
- }, [imageBitmap]);
15826
- }
15827
- catch(e)
15828
- {
15829
- self.postMessage({
15830
- error: e,
15831
- uuid: event.data.uuid,
15832
- id: event.data.id,
15833
- });
15834
- }
15835
- };`
15851
+ };
15852
+ })();
15853
+ `;
15854
+ let WORKER_URL = null;
15855
+ class WorkerInstance2 {
15856
+ constructor() {
15857
+ WORKER_URL || (WORKER_URL = URL.createObjectURL(new Blob([WORKER_CODE], { type: "application/javascript" }))), this.worker = new Worker(WORKER_URL);
15858
+ }
15859
+ }
15860
+ WorkerInstance2.revokeObjectURL = function() {
15861
+ WORKER_URL && (URL.revokeObjectURL(WORKER_URL), WORKER_URL = null);
15836
15862
  };
15837
- let workerURL;
15863
+ let UUID = 0, MAX_WORKERS;
15838
15864
  class WorkerManagerClass {
15839
15865
  constructor() {
15840
15866
  this._initialized = !1, this._createdWorkers = 0, this.workerPool = [], this.queue = [], this.resolveHash = {};
15841
15867
  }
15842
15868
  isImageBitmapSupported() {
15843
15869
  return this._isImageBitmapSupported !== void 0 ? this._isImageBitmapSupported : (this._isImageBitmapSupported = new Promise((resolve2) => {
15844
- const workerURL2 = URL.createObjectURL(new Blob(
15845
- [checkImageBitmapCode.code],
15846
- { type: "application/javascript" }
15847
- )), worker = new Worker(workerURL2);
15870
+ const { worker } = new WorkerInstance$1();
15848
15871
  worker.addEventListener("message", (event) => {
15849
- worker.terminate(), URL.revokeObjectURL(workerURL2), resolve2(event.data);
15872
+ worker.terminate(), WorkerInstance$1.revokeObjectURL(), resolve2(event.data);
15850
15873
  });
15851
15874
  }), this._isImageBitmapSupported);
15852
15875
  }
@@ -15859,7 +15882,7 @@ class WorkerManagerClass {
15859
15882
  getWorker() {
15860
15883
  MAX_WORKERS === void 0 && (MAX_WORKERS = navigator.hardwareConcurrency || 4);
15861
15884
  let worker = this.workerPool.pop();
15862
- return !worker && this._createdWorkers < MAX_WORKERS && (workerURL || (workerURL = URL.createObjectURL(new Blob([workerCode.code], { type: "application/javascript" }))), this._createdWorkers++, worker = new Worker(workerURL), worker.addEventListener("message", (event) => {
15885
+ return !worker && this._createdWorkers < MAX_WORKERS && (this._createdWorkers++, worker = new WorkerInstance2().worker, worker.addEventListener("message", (event) => {
15863
15886
  this.complete(event.data), this.returnWorker(event.target), this.next();
15864
15887
  })), worker;
15865
15888
  }
@@ -15990,14 +16013,14 @@ const validSVGExtension = ".svg", validSVGMIME = "image/svg+xml", loadSVG = {
15990
16013
  unload: loadTextures.unload
15991
16014
  };
15992
16015
  extensions$1.add(loadSVG);
15993
- var __defProp$5 = Object.defineProperty, __getOwnPropSymbols$5 = Object.getOwnPropertySymbols, __hasOwnProp$5 = Object.prototype.hasOwnProperty, __propIsEnum$5 = Object.prototype.propertyIsEnumerable, __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$5 = (a2, b2) => {
16016
+ var __defProp$5 = Object.defineProperty, __defProps$2 = Object.defineProperties, __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$5 = Object.getOwnPropertySymbols, __hasOwnProp$5 = Object.prototype.hasOwnProperty, __propIsEnum$5 = Object.prototype.propertyIsEnumerable, __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$5 = (a2, b2) => {
15994
16017
  for (var prop in b2 || (b2 = {}))
15995
16018
  __hasOwnProp$5.call(b2, prop) && __defNormalProp$5(a2, prop, b2[prop]);
15996
16019
  if (__getOwnPropSymbols$5)
15997
16020
  for (var prop of __getOwnPropSymbols$5(b2))
15998
16021
  __propIsEnum$5.call(b2, prop) && __defNormalProp$5(a2, prop, b2[prop]);
15999
16022
  return a2;
16000
- };
16023
+ }, __spreadProps$2 = (a2, b2) => __defProps$2(a2, __getOwnPropDescs$2(b2));
16001
16024
  const validVideoExtensions = [".mp4", ".m4v", ".webm", ".ogv"], validVideoMIMEs = [
16002
16025
  "video/mp4",
16003
16026
  "video/webm",
@@ -16009,7 +16032,11 @@ const validVideoExtensions = [".mp4", ".m4v", ".webm", ".ogv"], validVideoMIMEs
16009
16032
  priority: LoaderParserPriority.High
16010
16033
  },
16011
16034
  config: {
16012
- defaultAutoPlay: !0
16035
+ defaultAutoPlay: !0,
16036
+ defaultUpdateFPS: 0,
16037
+ defaultLoop: !1,
16038
+ defaultMuted: !1,
16039
+ defaultPlaysinline: !0
16013
16040
  },
16014
16041
  test(url2) {
16015
16042
  return checkDataUrl(url2, validVideoMIMEs) || checkExtension(url2, validVideoExtensions);
@@ -16019,9 +16046,15 @@ const validVideoExtensions = [".mp4", ".m4v", ".webm", ".ogv"], validVideoMIMEs
16019
16046
  let texture;
16020
16047
  const blob = await (await settings.ADAPTER.fetch(url2)).blob(), blobURL = URL.createObjectURL(blob);
16021
16048
  try {
16022
- const options = __spreadValues$5({
16023
- autoPlay: this.config.defaultAutoPlay
16024
- }, (_a2 = loadAsset == null ? void 0 : loadAsset.data) == null ? void 0 : _a2.resourceOptions), src = new VideoResource(blobURL, options);
16049
+ const options = __spreadProps$2(__spreadValues$5({
16050
+ autoPlay: this.config.defaultAutoPlay,
16051
+ updateFPS: this.config.defaultUpdateFPS,
16052
+ loop: this.config.defaultLoop,
16053
+ muted: this.config.defaultMuted,
16054
+ playsinline: this.config.defaultPlaysinline
16055
+ }, (_a2 = loadAsset == null ? void 0 : loadAsset.data) == null ? void 0 : _a2.resourceOptions), {
16056
+ autoLoad: !0
16057
+ }), src = new VideoResource(blobURL, options);
16025
16058
  await src.load();
16026
16059
  const base = new BaseTexture(src, __spreadValues$5({
16027
16060
  alphaMode: await detectVideoAlphaMode(),
@@ -16433,9 +16466,9 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16433
16466
  return `${url2}${paramConnector}${this._defaultSearchParams}`;
16434
16467
  }
16435
16468
  buildResolvedAsset(formattedAsset, data) {
16436
- var _a2;
16469
+ var _a2, _b;
16437
16470
  const { aliases, data: assetData, loadParser, format: format2 } = data;
16438
- return (this._basePath || this._rootPath) && (formattedAsset.src = path.toAbsolute(formattedAsset.src, this._basePath, this._rootPath)), formattedAsset.alias = (_a2 = aliases != null ? aliases : formattedAsset.alias) != null ? _a2 : [formattedAsset.src], formattedAsset.src = this._appendDefaultSearchParams(formattedAsset.src), formattedAsset.data = __spreadValues$4(__spreadValues$4({}, assetData || {}), formattedAsset.data), formattedAsset.loadParser = loadParser != null ? loadParser : formattedAsset.loadParser, formattedAsset.format = format2 != null ? format2 : path.extname(formattedAsset.src).slice(1), formattedAsset.srcs = formattedAsset.src, formattedAsset.name = formattedAsset.alias, formattedAsset;
16471
+ return (this._basePath || this._rootPath) && (formattedAsset.src = path.toAbsolute(formattedAsset.src, this._basePath, this._rootPath)), formattedAsset.alias = (_a2 = aliases != null ? aliases : formattedAsset.alias) != null ? _a2 : [formattedAsset.src], formattedAsset.src = this._appendDefaultSearchParams(formattedAsset.src), formattedAsset.data = __spreadValues$4(__spreadValues$4({}, assetData || {}), formattedAsset.data), formattedAsset.loadParser = loadParser != null ? loadParser : formattedAsset.loadParser, formattedAsset.format = (_b = format2 != null ? format2 : formattedAsset.format) != null ? _b : path.extname(formattedAsset.src).slice(1), formattedAsset.srcs = formattedAsset.src, formattedAsset.name = formattedAsset.alias, formattedAsset;
16439
16472
  }
16440
16473
  }
16441
16474
  class AssetsClass {
@@ -16876,7 +16909,7 @@ const resolveTextureUrl = {
16876
16909
  }
16877
16910
  };
16878
16911
  extensions$1.add(resolveTextureUrl);
16879
- var INTERNAL_FORMATS = /* @__PURE__ */ ((INTERNAL_FORMATS2) => (INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_S3TC_DXT1_EXT = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_R11_EAC = 37488] = "COMPRESSED_R11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SIGNED_R11_EAC = 37489] = "COMPRESSED_SIGNED_R11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RG11_EAC = 37490] = "COMPRESSED_RG11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SIGNED_RG11_EAC = 37491] = "COMPRESSED_SIGNED_RG11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB8_ETC2 = 37492] = "COMPRESSED_RGB8_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA8_ETC2_EAC = 37496] = "COMPRESSED_RGBA8_ETC2_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB8_ETC2 = 37493] = "COMPRESSED_SRGB8_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37497] = "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37494] = "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37495] = "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_ETC1_WEBGL = 36196] = "COMPRESSED_RGB_ETC1_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_ATC_WEBGL = 35986] = "COMPRESSED_RGB_ATC_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 35987] = "COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798] = "COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_ASTC_4x4_KHR = 37808] = "COMPRESSED_RGBA_ASTC_4x4_KHR", INTERNAL_FORMATS2))(INTERNAL_FORMATS || {});
16912
+ var INTERNAL_FORMATS = /* @__PURE__ */ ((INTERNAL_FORMATS2) => (INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_S3TC_DXT1_EXT = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_R11_EAC = 37488] = "COMPRESSED_R11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SIGNED_R11_EAC = 37489] = "COMPRESSED_SIGNED_R11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RG11_EAC = 37490] = "COMPRESSED_RG11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SIGNED_RG11_EAC = 37491] = "COMPRESSED_SIGNED_RG11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB8_ETC2 = 37492] = "COMPRESSED_RGB8_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA8_ETC2_EAC = 37496] = "COMPRESSED_RGBA8_ETC2_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB8_ETC2 = 37493] = "COMPRESSED_SRGB8_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37497] = "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37494] = "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37495] = "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_ETC1_WEBGL = 36196] = "COMPRESSED_RGB_ETC1_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_ATC_WEBGL = 35986] = "COMPRESSED_RGB_ATC_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 35987] = "COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798] = "COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_ASTC_4x4_KHR = 37808] = "COMPRESSED_RGBA_ASTC_4x4_KHR", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_BPTC_UNORM_EXT = 36492] = "COMPRESSED_RGBA_BPTC_UNORM_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 36493] = "COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 36494] = "COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 36495] = "COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT", INTERNAL_FORMATS2))(INTERNAL_FORMATS || {});
16880
16913
  const INTERNAL_FORMAT_TO_BYTES_PER_PIXEL = {
16881
16914
  // WEBGL_compressed_texture_s3tc
16882
16915
  33776: 0.5,
@@ -16916,19 +16949,26 @@ const INTERNAL_FORMAT_TO_BYTES_PER_PIXEL = {
16916
16949
  // @see https://registry.khronos.org/OpenGL/extensions/KHR/KHR_texture_compression_astc_hdr.txt
16917
16950
  // WEBGL_compressed_texture_astc
16918
16951
  /* eslint-disable-next-line camelcase */
16919
- 37808: 1
16952
+ 37808: 1,
16953
+ // @see https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_compression_bptc.txt
16954
+ // EXT_texture_compression_bptc
16955
+ 36492: 1,
16956
+ 36493: 1,
16957
+ 36494: 1,
16958
+ 36495: 1
16920
16959
  };
16921
16960
  let storedGl, extensions;
16922
16961
  function getCompressedTextureExtensions() {
16923
16962
  extensions = {
16963
+ bptc: storedGl.getExtension("EXT_texture_compression_bptc"),
16964
+ astc: storedGl.getExtension("WEBGL_compressed_texture_astc"),
16965
+ etc: storedGl.getExtension("WEBGL_compressed_texture_etc"),
16924
16966
  s3tc: storedGl.getExtension("WEBGL_compressed_texture_s3tc"),
16925
16967
  s3tc_sRGB: storedGl.getExtension("WEBGL_compressed_texture_s3tc_srgb"),
16926
16968
  /* eslint-disable-line camelcase */
16927
- etc: storedGl.getExtension("WEBGL_compressed_texture_etc"),
16928
- etc1: storedGl.getExtension("WEBGL_compressed_texture_etc1"),
16929
16969
  pvrtc: storedGl.getExtension("WEBGL_compressed_texture_pvrtc") || storedGl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
16930
- atc: storedGl.getExtension("WEBGL_compressed_texture_atc"),
16931
- astc: storedGl.getExtension("WEBGL_compressed_texture_astc")
16970
+ etc1: storedGl.getExtension("WEBGL_compressed_texture_etc1"),
16971
+ atc: storedGl.getExtension("WEBGL_compressed_texture_atc")
16932
16972
  };
16933
16973
  }
16934
16974
  const detectCompressedTextures = {
@@ -17034,15 +17074,21 @@ class CompressedTextureResource extends BlobResource {
17034
17074
  static _formatToExtension(format2) {
17035
17075
  if (format2 >= 33776 && format2 <= 33779)
17036
17076
  return "s3tc";
17077
+ if (format2 >= 35916 && format2 <= 35919)
17078
+ return "s3tc_sRGB";
17037
17079
  if (format2 >= 37488 && format2 <= 37497)
17038
17080
  return "etc";
17039
17081
  if (format2 >= 35840 && format2 <= 35843)
17040
17082
  return "pvrtc";
17041
- if (format2 >= 36196)
17083
+ if (format2 === 36196)
17042
17084
  return "etc1";
17043
- if (format2 >= 35986 && format2 <= 34798)
17085
+ if (format2 === 35986 || format2 === 35987 || format2 === 34798)
17044
17086
  return "atc";
17045
- throw new Error("Invalid (compressed) texture format given!");
17087
+ if (format2 >= 36492 && format2 <= 36495)
17088
+ return "bptc";
17089
+ if (format2 === 37808)
17090
+ return "astc";
17091
+ throw new Error(`Invalid (compressed) texture format given: ${format2}`);
17046
17092
  }
17047
17093
  /**
17048
17094
  * Pre-creates buffer views for each mipmap level
@@ -17105,7 +17151,14 @@ const DDS_MAGIC_SIZE = 4, DDS_HEADER_SIZE = 124, DDS_HEADER_PF_SIZE = 32, DDS_HE
17105
17151
  // WEBGL_compressed_texture_s3tc_srgb
17106
17152
  72: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
17107
17153
  75: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
17108
- 78: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
17154
+ 78: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
17155
+ // EXT_texture_compression_bptc
17156
+ // BC6H
17157
+ 96: INTERNAL_FORMATS.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
17158
+ 95: INTERNAL_FORMATS.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
17159
+ // BC7
17160
+ 98: INTERNAL_FORMATS.COMPRESSED_RGBA_BPTC_UNORM_EXT,
17161
+ 99: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT
17109
17162
  };
17110
17163
  function parseDDS(arrayBuffer) {
17111
17164
  const data = new Uint32Array(arrayBuffer);
@@ -17388,7 +17441,7 @@ const loadKTX = {
17388
17441
  }
17389
17442
  };
17390
17443
  extensions$1.add(loadKTX);
17391
- const resolveCompressedTextureUrl = {
17444
+ const knownFormats = ["s3tc", "s3tc_sRGB", "etc", "etc1", "pvrtc", "atc", "astc", "bptc"], resolveCompressedTextureUrl = {
17392
17445
  extension: ExtensionType.ResolveParser,
17393
17446
  test: (value) => {
17394
17447
  const extension = path.extname(value).slice(1);
@@ -17396,21 +17449,13 @@ const resolveCompressedTextureUrl = {
17396
17449
  },
17397
17450
  parse: (value) => {
17398
17451
  var _a2, _b, _c, _d;
17399
- const extension = path.extname(value).slice(1);
17400
- if (extension === "ktx") {
17401
- const extensions2 = [
17402
- ".s3tc.ktx",
17403
- ".s3tc_sRGB.ktx",
17404
- ".etc.ktx",
17405
- ".etc1.ktx",
17406
- ".pvrt.ktx",
17407
- ".atc.ktx",
17408
- ".astc.ktx"
17409
- ];
17410
- if (extensions2.some((ext) => value.endsWith(ext)))
17452
+ const parts = value.split("."), extension = parts.pop();
17453
+ if (["ktx", "dds"].includes(extension)) {
17454
+ const textureFormat = parts.pop();
17455
+ if (knownFormats.includes(textureFormat))
17411
17456
  return {
17412
17457
  resolution: parseFloat((_b = (_a2 = settings.RETINA_PREFIX.exec(value)) == null ? void 0 : _a2[1]) != null ? _b : "1"),
17413
- format: extensions2.find((ext) => value.endsWith(ext)),
17458
+ format: textureFormat,
17414
17459
  src: value
17415
17460
  };
17416
17461
  }
@@ -21892,15 +21937,11 @@ TilingSpriteRenderer.extension = {
21892
21937
  };
21893
21938
  extensions$1.add(TilingSpriteRenderer);
21894
21939
  const _Spritesheet = class _Spritesheet2 {
21895
- /**
21896
- * @param texture - Reference to the source BaseTexture object.
21897
- * @param {object} data - Spritesheet image data.
21898
- * @param resolutionFilename - The filename to consider when determining
21899
- * the resolution of the spritesheet. If not provided, the imageUrl will
21900
- * be used on the BaseTexture.
21901
- */
21902
- constructor(texture, data, resolutionFilename = null) {
21903
- this.linkedSheets = [], this._texture = texture instanceof Texture ? texture : null, this.baseTexture = texture instanceof BaseTexture ? texture : this._texture.baseTexture, this.textures = {}, this.animations = {}, this.data = data;
21940
+ /** @ignore */
21941
+ constructor(optionsOrTexture, arg1, arg2) {
21942
+ this.linkedSheets = [], (optionsOrTexture instanceof BaseTexture || optionsOrTexture instanceof Texture) && (optionsOrTexture = { texture: optionsOrTexture, data: arg1, resolutionFilename: arg2 });
21943
+ const { texture, data, resolutionFilename = null, cachePrefix = "" } = optionsOrTexture;
21944
+ this.cachePrefix = cachePrefix, this._texture = texture instanceof Texture ? texture : null, this.baseTexture = texture instanceof BaseTexture ? texture : this._texture.baseTexture, this.textures = {}, this.animations = {}, this.data = data;
21904
21945
  const resource = this.baseTexture.resource;
21905
21946
  this.resolution = this._updateResolution(resolutionFilename || (resource ? resource.url : null)), this._frames = this.data.frames, this._frameKeys = Object.keys(this._frames), this._batchIndex = 0, this._callback = null;
21906
21947
  }
@@ -21966,7 +22007,7 @@ const _Spritesheet = class _Spritesheet2 {
21966
22007
  data.rotated ? 2 : 0,
21967
22008
  data.anchor,
21968
22009
  data.borders
21969
- ), Texture.addToCache(this.textures[i2], i2.toString());
22010
+ ), Texture.addToCache(this.textures[i2], this.cachePrefix + i2.toString());
21970
22011
  }
21971
22012
  frameIndex++;
21972
22013
  }
@@ -22006,18 +22047,35 @@ const _Spritesheet = class _Spritesheet2 {
22006
22047
  };
22007
22048
  _Spritesheet.BATCH_SIZE = 1e3;
22008
22049
  let Spritesheet = _Spritesheet;
22009
- const validImages = ["jpg", "png", "jpeg", "avif", "webp"];
22050
+ const validImages = [
22051
+ "jpg",
22052
+ "png",
22053
+ "jpeg",
22054
+ "avif",
22055
+ "webp",
22056
+ "s3tc",
22057
+ "s3tc_sRGB",
22058
+ "etc",
22059
+ "etc1",
22060
+ "pvrtc",
22061
+ "atc",
22062
+ "astc",
22063
+ "bptc"
22064
+ ];
22010
22065
  function getCacheableAssets(keys, asset, ignoreMultiPack) {
22011
22066
  const out = {};
22012
22067
  if (keys.forEach((key) => {
22013
22068
  out[key] = asset;
22014
22069
  }), Object.keys(asset.textures).forEach((key) => {
22015
- out[key] = asset.textures[key];
22070
+ out[`${asset.cachePrefix}${key}`] = asset.textures[key];
22016
22071
  }), !ignoreMultiPack) {
22017
22072
  const basePath = path.dirname(keys[0]);
22018
22073
  asset.linkedSheets.forEach((item, i2) => {
22019
- const out2 = getCacheableAssets([`${basePath}/${asset.data.meta.related_multi_packs[i2]}`], item, !0);
22020
- Object.assign(out, out2);
22074
+ Object.assign(out, getCacheableAssets(
22075
+ [`${basePath}/${asset.data.meta.related_multi_packs[i2]}`],
22076
+ item,
22077
+ !0
22078
+ ));
22021
22079
  });
22022
22080
  }
22023
22081
  return out;
@@ -22062,25 +22120,39 @@ const spritesheetAsset = {
22062
22120
  return path.extname(options.src).toLowerCase() === ".json" && !!asset.frames;
22063
22121
  },
22064
22122
  async parse(asset, options, loader) {
22065
- var _a2, _b;
22123
+ var _a2, _b, _c;
22124
+ const {
22125
+ texture: imageTexture,
22126
+ // if user need to use preloaded texture
22127
+ imageFilename,
22128
+ // if user need to use custom filename (not from jsonFile.meta.image)
22129
+ cachePrefix
22130
+ // if user need to use custom cache prefix
22131
+ } = (_a2 = options == null ? void 0 : options.data) != null ? _a2 : {};
22066
22132
  let basePath = path.dirname(options.src);
22067
22133
  basePath && basePath.lastIndexOf("/") !== basePath.length - 1 && (basePath += "/");
22068
- let imagePath = basePath + asset.meta.image;
22069
- imagePath = copySearchParams(imagePath, options.src);
22070
- const texture = (await loader.load([imagePath]))[imagePath], spritesheet = new Spritesheet(
22071
- texture.baseTexture,
22072
- asset,
22073
- options.src
22074
- );
22134
+ let texture;
22135
+ if (imageTexture && imageTexture.baseTexture)
22136
+ texture = imageTexture;
22137
+ else {
22138
+ const imagePath = copySearchParams(basePath + (imageFilename != null ? imageFilename : asset.meta.image), options.src);
22139
+ texture = (await loader.load([imagePath]))[imagePath];
22140
+ }
22141
+ const spritesheet = new Spritesheet({
22142
+ texture: texture.baseTexture,
22143
+ data: asset,
22144
+ resolutionFilename: options.src,
22145
+ cachePrefix
22146
+ });
22075
22147
  await spritesheet.parse();
22076
- const multiPacks = (_a2 = asset == null ? void 0 : asset.meta) == null ? void 0 : _a2.related_multi_packs;
22148
+ const multiPacks = (_b = asset == null ? void 0 : asset.meta) == null ? void 0 : _b.related_multi_packs;
22077
22149
  if (Array.isArray(multiPacks)) {
22078
22150
  const promises = [];
22079
22151
  for (const item of multiPacks) {
22080
22152
  if (typeof item != "string")
22081
22153
  continue;
22082
22154
  let itemUrl = basePath + item;
22083
- (_b = options.data) != null && _b.ignoreMultiPack || (itemUrl = copySearchParams(itemUrl, options.src), promises.push(loader.load({
22155
+ (_c = options.data) != null && _c.ignoreMultiPack || (itemUrl = copySearchParams(itemUrl, options.src), promises.push(loader.load({
22084
22156
  src: itemUrl,
22085
22157
  data: {
22086
22158
  ignoreMultiPack: !0