pixi.js 7.3.2 → 7.4.0

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * pixi.js - v7.3.2
3
- * Compiled Fri, 20 Oct 2023 15:28:31 UTC
2
+ * pixi.js - v7.4.0
3
+ * Compiled Sat, 27 Jan 2024 00:20:54 UTC
4
4
  *
5
5
  * pixi.js is licensed under the MIT License.
6
6
  * http://www.opensource.org/licenses/mit-license
@@ -1106,7 +1106,7 @@ Deprecated since v${version}`), console.warn(stack))), warnings[message] = !0;
1106
1106
  joined = arg;
1107
1107
  else {
1108
1108
  const prevArg = (_a2 = segments[i2 - 1]) != null ? _a2 : "";
1109
- this.extname(prevArg) ? joined += `/../${arg}` : joined += `/${arg}`;
1109
+ this.joinExtensions.includes(this.extname(prevArg).toLowerCase()) ? joined += `/../${arg}` : joined += `/${arg}`;
1110
1110
  }
1111
1111
  }
1112
1112
  return joined === void 0 ? "." : this.normalize(joined);
@@ -1232,7 +1232,8 @@ Deprecated since v${version}`), console.warn(stack))), warnings[message] = !0;
1232
1232
  return startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1 ? end !== -1 && (startPart === 0 && isAbsolute ? ret.base = ret.name = path2.slice(1, end) : ret.base = ret.name = path2.slice(startPart, end)) : (startPart === 0 && isAbsolute ? (ret.name = path2.slice(1, startDot), ret.base = path2.slice(1, end)) : (ret.name = path2.slice(startPart, startDot), ret.base = path2.slice(startPart, end)), ret.ext = path2.slice(startDot, end)), ret.dir = this.dirname(path2), protocol && (ret.dir = protocol + ret.dir), ret;
1233
1233
  },
1234
1234
  sep: "/",
1235
- delimiter: ":"
1235
+ delimiter: ":",
1236
+ joinExtensions: [".html"]
1236
1237
  };
1237
1238
  let promise;
1238
1239
  async function detectVideoAlphaMode() {
@@ -2054,20 +2055,20 @@ Deprecated since v${version}`), console.warn(stack))), warnings[message] = !0;
2054
2055
  trimCanvas,
2055
2056
  uid,
2056
2057
  url
2057
- }, __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) => {
2058
+ }, __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) => {
2058
2059
  for (var prop in b2 || (b2 = {}))
2059
2060
  __hasOwnProp$e.call(b2, prop) && __defNormalProp$d(a2, prop, b2[prop]);
2060
2061
  if (__getOwnPropSymbols$e)
2061
2062
  for (var prop of __getOwnPropSymbols$e(b2))
2062
2063
  __propIsEnum$e.call(b2, prop) && __defNormalProp$d(a2, prop, b2[prop]);
2063
2064
  return a2;
2064
- }, __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 || {});
2065
+ }, __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 || {});
2065
2066
  const normalizeExtension = (ext) => {
2066
2067
  if (typeof ext == "function" || typeof ext == "object" && ext.extension) {
2067
2068
  if (!ext.extension)
2068
2069
  throw new Error("Extension class must have an extension object");
2069
2070
  const metadata = typeof ext.extension != "object" ? { type: ext.extension } : ext.extension;
2070
- ext = __spreadProps$4(__spreadValues$d({}, metadata), { ref: ext });
2071
+ ext = __spreadProps$5(__spreadValues$d({}, metadata), { ref: ext });
2071
2072
  }
2072
2073
  if (typeof ext == "object")
2073
2074
  ext = __spreadValues$d({}, ext);
@@ -2105,8 +2106,9 @@ Deprecated since v${version}`), console.warn(stack))), warnings[message] = !0;
2105
2106
  add(...extensions2) {
2106
2107
  return extensions2.map(normalizeExtension).forEach((ext) => {
2107
2108
  ext.type.forEach((type) => {
2109
+ var _a2, _b;
2108
2110
  const handlers = this._addHandlers, queue = this._queue;
2109
- handlers[type] ? handlers[type](ext) : (queue[type] = queue[type] || [], queue[type].push(ext));
2111
+ handlers[type] ? (_b = handlers[type]) == null || _b.call(handlers, ext) : (queue[type] = queue[type] || [], (_a2 = queue[type]) == null || _a2.push(ext));
2110
2112
  });
2111
2113
  }), this;
2112
2114
  },
@@ -2118,12 +2120,13 @@ Deprecated since v${version}`), console.warn(stack))), warnings[message] = !0;
2118
2120
  * @returns {PIXI.extensions} For chaining.
2119
2121
  */
2120
2122
  handle(type, onAdd, onRemove) {
2123
+ var _a2;
2121
2124
  const addHandlers = this._addHandlers, removeHandlers = this._removeHandlers;
2122
2125
  if (addHandlers[type] || removeHandlers[type])
2123
2126
  throw new Error(`Extension type ${type} already has a handler`);
2124
2127
  addHandlers[type] = onAdd, removeHandlers[type] = onRemove;
2125
2128
  const queue = this._queue;
2126
- return queue[type] && (queue[type].forEach((ext) => onAdd(ext)), delete queue[type]), this;
2129
+ return queue[type] && ((_a2 = queue[type]) == null || _a2.forEach((ext) => onAdd(ext)), delete queue[type]), this;
2127
2130
  },
2128
2131
  /**
2129
2132
  * Handle a type, but using a map by `name` property.
@@ -2135,10 +2138,10 @@ Deprecated since v${version}`), console.warn(stack))), warnings[message] = !0;
2135
2138
  return this.handle(
2136
2139
  type,
2137
2140
  (extension) => {
2138
- map2[extension.name] = extension.ref;
2141
+ extension.name && (map2[extension.name] = extension.ref);
2139
2142
  },
2140
2143
  (extension) => {
2141
- delete map2[extension.name];
2144
+ extension.name && delete map2[extension.name];
2142
2145
  }
2143
2146
  );
2144
2147
  },
@@ -2357,7 +2360,7 @@ else `), i2 < maxIfs - 1 && (src += `if(test == ${i2}.0){}`);
2357
2360
  }
2358
2361
  class Runner {
2359
2362
  /**
2360
- * @param name - The function name that will be executed on the listeners added to this Runner.
2363
+ * @param {string} name - The function name that will be executed on the listeners added to this Runner.
2361
2364
  */
2362
2365
  constructor(name) {
2363
2366
  this.items = [], this._name = name, this._aliasCount = 0;
@@ -2422,7 +2425,7 @@ else `), i2 < maxIfs - 1 && (src += `if(test == ${i2}.0){}`);
2422
2425
  }
2423
2426
  /** Remove all references, don't use after this. */
2424
2427
  destroy() {
2425
- this.removeAll(), this.items = null, this._name = null;
2428
+ this.removeAll(), this.items.length = 0, this._name = "";
2426
2429
  }
2427
2430
  /**
2428
2431
  * `true` if there are no this Runner contains no listeners
@@ -2433,7 +2436,7 @@ else `), i2 < maxIfs - 1 && (src += `if(test == ${i2}.0){}`);
2433
2436
  }
2434
2437
  /**
2435
2438
  * The name of the runner.
2436
- * @readonly
2439
+ * @type {string}
2437
2440
  */
2438
2441
  get name() {
2439
2442
  return this._name;
@@ -2623,7 +2626,7 @@ else `), i2 < maxIfs - 1 && (src += `if(test == ${i2}.0){}`);
2623
2626
  alphaMode: ALPHA_MODES.NPM
2624
2627
  }, _BaseTexture = class _BaseTexture2 extends EventEmitter {
2625
2628
  /**
2626
- * @param {PIXI.Resource|HTMLImageElement|HTMLVideoElement|ImageBitmap|ICanvas|string} [resource=null] -
2629
+ * @param {PIXI.Resource|PIXI.ImageSource|string} [resource=null] -
2627
2630
  * The current resource to use, for things that aren't Resource objects, will be converted
2628
2631
  * into a Resource.
2629
2632
  * @param options - Collection of options, default options inherited from {@link PIXI.BaseTexture.defaultOptions}.
@@ -2801,7 +2804,7 @@ else `), i2 < maxIfs - 1 && (src += `if(test == ${i2}.0){}`);
2801
2804
  * source is an image url or an image element and not in the base texture
2802
2805
  * cache, it will be created and loaded.
2803
2806
  * @static
2804
- * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas|string|string[]} source - The
2807
+ * @param {PIXI.ImageSource|string|string[]} source - The
2805
2808
  * source to create base texture from.
2806
2809
  * @param options - See {@link PIXI.BaseTexture}'s constructor for options.
2807
2810
  * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id
@@ -5589,7 +5592,8 @@ void main(void)
5589
5592
  etc1: gl.getExtension("WEBGL_compressed_texture_etc1"),
5590
5593
  pvrtc: gl.getExtension("WEBGL_compressed_texture_pvrtc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
5591
5594
  atc: gl.getExtension("WEBGL_compressed_texture_atc"),
5592
- astc: gl.getExtension("WEBGL_compressed_texture_astc")
5595
+ astc: gl.getExtension("WEBGL_compressed_texture_astc"),
5596
+ bptc: gl.getExtension("EXT_texture_compression_bptc")
5593
5597
  };
5594
5598
  this.webGLVersion === 1 ? Object.assign(this.extensions, common, {
5595
5599
  drawBuffers: gl.getExtension("WEBGL_draw_buffers"),
@@ -5825,10 +5829,10 @@ void main(void)
5825
5829
  }
5826
5830
  class BaseImageResource extends Resource {
5827
5831
  /**
5828
- * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas} source
5832
+ * @param {PIXI.ImageSourcee} source
5829
5833
  */
5830
5834
  constructor(source) {
5831
- const sourceAny = source, width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width, height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;
5835
+ const sourceAny = source, width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.displayWidth || sourceAny.width, height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.displayHeight || sourceAny.height;
5832
5836
  super(width, height), this.source = source, this.noSubImage = !1;
5833
5837
  }
5834
5838
  /**
@@ -5845,7 +5849,7 @@ void main(void)
5845
5849
  * @param renderer - Upload to the renderer
5846
5850
  * @param baseTexture - Reference to parent texture
5847
5851
  * @param glTexture
5848
- * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas} [source] - (optional)
5852
+ * @param {PIXI.ImageSourcee} [source] - (optional)
5849
5853
  * @returns - true is success
5850
5854
  */
5851
5855
  upload(renderer, baseTexture, glTexture, source) {
@@ -8295,7 +8299,7 @@ void main(void)
8295
8299
  */
8296
8300
  run(options) {
8297
8301
  const { renderer } = this;
8298
- renderer.runners.init.emit(renderer.options), options.hello && console.log(`PixiJS 7.3.2 - ${renderer.rendererLogId} - https://pixijs.com`), renderer.resize(renderer.screen.width, renderer.screen.height);
8302
+ renderer.runners.init.emit(renderer.options), options.hello && console.log(`PixiJS 7.4.0 - ${renderer.rendererLogId} - https://pixijs.com`), renderer.resize(renderer.screen.width, renderer.screen.height);
8299
8303
  }
8300
8304
  destroy() {
8301
8305
  }
@@ -10583,6 +10587,23 @@ void main(void)
10583
10587
  */
10584
10588
  _SVGResource.SVG_SIZE = /<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;
10585
10589
  let SVGResource = _SVGResource;
10590
+ class VideoFrameResource extends BaseImageResource {
10591
+ /**
10592
+ * @param source - Image element to use
10593
+ */
10594
+ // eslint-disable-next-line @typescript-eslint/no-useless-constructor
10595
+ constructor(source) {
10596
+ super(source);
10597
+ }
10598
+ /**
10599
+ * Used to auto-detect the type of resource.
10600
+ * @param {*} source - The source object
10601
+ * @returns {boolean} `true` if source is an VideoFrame
10602
+ */
10603
+ static test(source) {
10604
+ return !!globalThis.VideoFrame && source instanceof globalThis.VideoFrame;
10605
+ }
10606
+ }
10586
10607
  const _VideoResource = class _VideoResource2 extends BaseImageResource {
10587
10608
  /**
10588
10609
  * @param {HTMLVideoElement|object|string|Array<string|object>} source - Video element to use.
@@ -10590,7 +10611,8 @@ void main(void)
10590
10611
  * @param {boolean} [options.autoLoad=true] - Start loading the video immediately
10591
10612
  * @param {boolean} [options.autoPlay=true] - Start playing video immediately
10592
10613
  * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.
10593
- * Leave at 0 to update at every render.
10614
+ * If 0, `requestVideoFrameCallback` is used to update the texture.
10615
+ * If `requestVideoFrameCallback` is not available, the texture is updated every render.
10594
10616
  * @param {boolean} [options.crossorigin=true] - Load image using cross origin
10595
10617
  * @param {boolean} [options.loop=false] - Loops the video
10596
10618
  * @param {boolean} [options.muted=false] - Mutes the video audio, useful for autoplay
@@ -10704,7 +10726,8 @@ void main(void)
10704
10726
  value !== this._autoUpdate && (this._autoUpdate = value, this._configureAutoUpdate());
10705
10727
  }
10706
10728
  /**
10707
- * How many times a second to update the texture from the video. Leave at 0 to update at every render.
10729
+ * How many times a second to update the texture from the video. If 0, `requestVideoFrameCallback` is used to
10730
+ * update the texture. If `requestVideoFrameCallback` is not available, the texture is updated every render.
10708
10731
  * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.
10709
10732
  */
10710
10733
  get updateFPS() {
@@ -10743,6 +10766,7 @@ void main(void)
10743
10766
  ImageResource,
10744
10767
  CanvasResource,
10745
10768
  VideoResource,
10769
+ VideoFrameResource,
10746
10770
  SVGResource,
10747
10771
  BufferResource,
10748
10772
  CubeResource,
@@ -10765,7 +10789,7 @@ void main(void)
10765
10789
  this.disposeRunner.emit(this, !1);
10766
10790
  }
10767
10791
  }
10768
- const VERSION = "7.3.2";
10792
+ const VERSION = "7.4.0";
10769
10793
  class Bounds {
10770
10794
  constructor() {
10771
10795
  this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, this.rect = null, this.updateID = -1;
@@ -11246,7 +11270,7 @@ void main(void)
11246
11270
  return this._zIndex;
11247
11271
  }
11248
11272
  set zIndex(value) {
11249
- this._zIndex = value, this.parent && (this.parent.sortDirty = !0);
11273
+ this._zIndex !== value && (this._zIndex = value, this.parent && (this.parent.sortDirty = !0));
11250
11274
  }
11251
11275
  /**
11252
11276
  * Indicates if the object is globally visible.
@@ -13406,7 +13430,7 @@ void main()
13406
13430
  }));
13407
13431
  }
13408
13432
  /**
13409
- * Updates the state of interactive objects if at least {@link interactionFrequency}
13433
+ * Updates the state of interactive objects if at least {@link PIXI.EventsTicker#interactionFrequency}
13410
13434
  * milliseconds have passed since the last invocation.
13411
13435
  *
13412
13436
  * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}.
@@ -14979,8 +15003,12 @@ void main()
14979
15003
  * });
14980
15004
  */
14981
15005
  addEventListener(type, listener, options) {
14982
- const capture = typeof options == "boolean" && options || typeof options == "object" && options.capture, context2 = typeof listener == "function" ? void 0 : listener;
14983
- type = capture ? `${type}capture` : type, listener = typeof listener == "function" ? listener : listener.handleEvent, this.on(type, listener, context2);
15006
+ 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;
15007
+ type = capture ? `${type}capture` : type;
15008
+ const listenerFn = typeof listener == "function" ? listener : listener.handleEvent, emitter = this;
15009
+ signal && signal.addEventListener("abort", () => {
15010
+ emitter.off(type, listenerFn, context2);
15011
+ }), once ? emitter.once(type, listenerFn, context2) : emitter.on(type, listenerFn, context2);
14984
15012
  },
14985
15013
  /**
14986
15014
  * Unlike `off` or `removeListener` which are methods from EventEmitter, `removeEventListener`
@@ -15560,14 +15588,14 @@ void main()
15560
15588
  }
15561
15589
  }
15562
15590
  const Cache = new CacheClass();
15563
- 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) => {
15591
+ 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) => {
15564
15592
  for (var prop in b2 || (b2 = {}))
15565
15593
  __hasOwnProp$9.call(b2, prop) && __defNormalProp$9(a2, prop, b2[prop]);
15566
15594
  if (__getOwnPropSymbols$9)
15567
15595
  for (var prop of __getOwnPropSymbols$9(b2))
15568
15596
  __propIsEnum$9.call(b2, prop) && __defNormalProp$9(a2, prop, b2[prop]);
15569
15597
  return a2;
15570
- }, __spreadProps$3 = (a2, b2) => __defProps$3(a2, __getOwnPropDescs$3(b2));
15598
+ }, __spreadProps$4 = (a2, b2) => __defProps$4(a2, __getOwnPropDescs$4(b2));
15571
15599
  class Loader {
15572
15600
  constructor() {
15573
15601
  this._parsers = [], this._parsersValidated = !1, this.parsers = new Proxy(this._parsers, {
@@ -15657,7 +15685,7 @@ ${e2}`);
15657
15685
  }
15658
15686
  /** validates our parsers, right now it only checks for name conflicts but we can add more here as required! */
15659
15687
  _validateParsers() {
15660
- 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 })), {});
15688
+ 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 })), {});
15661
15689
  }
15662
15690
  }
15663
15691
  var LoaderParserPriority = /* @__PURE__ */ ((LoaderParserPriority2) => (LoaderParserPriority2[LoaderParserPriority2.Low = 0] = "Low", LoaderParserPriority2[LoaderParserPriority2.Normal = 1] = "Normal", LoaderParserPriority2[LoaderParserPriority2.High = 2] = "High", LoaderParserPriority2))(LoaderParserPriority || {});
@@ -15689,14 +15717,14 @@ ${e2}`);
15689
15717
  }
15690
15718
  };
15691
15719
  extensions$1.add(loadTxt);
15692
- 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) => {
15720
+ 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) => {
15693
15721
  for (var prop in b2 || (b2 = {}))
15694
15722
  __hasOwnProp$8.call(b2, prop) && __defNormalProp$8(a2, prop, b2[prop]);
15695
15723
  if (__getOwnPropSymbols$8)
15696
15724
  for (var prop of __getOwnPropSymbols$8(b2))
15697
15725
  __propIsEnum$8.call(b2, prop) && __defNormalProp$8(a2, prop, b2[prop]);
15698
15726
  return a2;
15699
- }, __spreadProps$2 = (a2, b2) => __defProps$2(a2, __getOwnPropDescs$2(b2));
15727
+ }, __spreadProps$3 = (a2, b2) => __defProps$3(a2, __getOwnPropDescs$3(b2));
15700
15728
  const validWeights = [
15701
15729
  "normal",
15702
15730
  "bold",
@@ -15745,7 +15773,7 @@ ${e2}`);
15745
15773
  if (fonts) {
15746
15774
  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 : {};
15747
15775
  for (let i2 = 0; i2 < weights.length; i2++) {
15748
- const weight = weights[i2], font = new FontFace(name, `url(${encodeURIWhenNeeded(url2)})`, __spreadProps$2(__spreadValues$8({}, data), {
15776
+ const weight = weights[i2], font = new FontFace(name, `url(${encodeURIWhenNeeded(url2)})`, __spreadProps$3(__spreadValues$8({}, data), {
15749
15777
  weight
15750
15778
  }));
15751
15779
  await font.load(), fonts.add(font), fontFaces.push(font);
@@ -15759,82 +15787,78 @@ ${e2}`);
15759
15787
  }
15760
15788
  };
15761
15789
  extensions$1.add(loadWebFont);
15762
- let UUID = 0, MAX_WORKERS;
15763
- const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=", checkImageBitmapCode = {
15764
- id: "checkImageBitmap",
15765
- code: `
15766
- async function checkImageBitmap()
15767
- {
15768
- try
15769
- {
15770
- if (typeof createImageBitmap !== 'function') return false;
15771
-
15772
- const response = await fetch('${WHITE_PNG}');
15773
- const imageBlob = await response.blob();
15774
- const imageBitmap = await createImageBitmap(imageBlob);
15775
-
15776
- return imageBitmap.width === 1 && imageBitmap.height === 1;
15777
- }
15778
- catch (e)
15779
- {
15780
- return false;
15781
- }
15790
+ const WORKER_CODE$1 = `(function() {
15791
+ "use strict";
15792
+ const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
15793
+ async function checkImageBitmap() {
15794
+ try {
15795
+ if (typeof createImageBitmap != "function")
15796
+ return !1;
15797
+ const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob);
15798
+ return imageBitmap.width === 1 && imageBitmap.height === 1;
15799
+ } catch (e) {
15800
+ return !1;
15782
15801
  }
15783
- checkImageBitmap().then((result) => { self.postMessage(result); });
15784
- `
15785
- }, workerCode = {
15786
- id: "loadImageBitmap",
15787
- code: `
15788
- async function loadImageBitmap(url)
15789
- {
15790
- const response = await fetch(url);
15791
-
15792
- if (!response.ok)
15793
- {
15794
- throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \`
15795
- + \`\${response.status} \${response.statusText}\`);
15796
- }
15797
-
15798
- const imageBlob = await response.blob();
15799
- const imageBitmap = await createImageBitmap(imageBlob);
15800
-
15801
- return imageBitmap;
15802
+ }
15803
+ checkImageBitmap().then((result) => {
15804
+ self.postMessage(result);
15805
+ });
15806
+ })();
15807
+ `;
15808
+ let WORKER_URL$1 = null, WorkerInstance$1 = class extends Worker {
15809
+ constructor() {
15810
+ WORKER_URL$1 || (WORKER_URL$1 = URL.createObjectURL(new Blob([WORKER_CODE$1], { type: "application/javascript" }))), super(WORKER_URL$1);
15802
15811
  }
15803
- self.onmessage = async (event) =>
15804
- {
15805
- try
15806
- {
15807
- const imageBitmap = await loadImageBitmap(event.data.data[0]);
15808
-
15809
- self.postMessage({
15810
- data: imageBitmap,
15811
- uuid: event.data.uuid,
15812
- id: event.data.id,
15813
- }, [imageBitmap]);
15814
- }
15815
- catch(e)
15816
- {
15817
- self.postMessage({
15818
- error: e,
15819
- uuid: event.data.uuid,
15820
- id: event.data.id,
15821
- });
15822
- }
15823
- };`
15824
15812
  };
15825
- let workerURL;
15813
+ WorkerInstance$1.revokeObjectURL = function() {
15814
+ WORKER_URL$1 && (URL.revokeObjectURL(WORKER_URL$1), WORKER_URL$1 = null);
15815
+ };
15816
+ const WORKER_CODE = `(function() {
15817
+ "use strict";
15818
+ async function loadImageBitmap(url) {
15819
+ const response = await fetch(url);
15820
+ if (!response.ok)
15821
+ throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`);
15822
+ const imageBlob = await response.blob();
15823
+ return await createImageBitmap(imageBlob);
15824
+ }
15825
+ self.onmessage = async (event) => {
15826
+ try {
15827
+ const imageBitmap = await loadImageBitmap(event.data.data[0]);
15828
+ self.postMessage({
15829
+ data: imageBitmap,
15830
+ uuid: event.data.uuid,
15831
+ id: event.data.id
15832
+ }, [imageBitmap]);
15833
+ } catch (e) {
15834
+ self.postMessage({
15835
+ error: e,
15836
+ uuid: event.data.uuid,
15837
+ id: event.data.id
15838
+ });
15839
+ }
15840
+ };
15841
+ })();
15842
+ `;
15843
+ let WORKER_URL = null;
15844
+ class WorkerInstance extends Worker {
15845
+ constructor() {
15846
+ WORKER_URL || (WORKER_URL = URL.createObjectURL(new Blob([WORKER_CODE], { type: "application/javascript" }))), super(WORKER_URL);
15847
+ }
15848
+ }
15849
+ WorkerInstance.revokeObjectURL = function() {
15850
+ WORKER_URL && (URL.revokeObjectURL(WORKER_URL), WORKER_URL = null);
15851
+ };
15852
+ let UUID = 0, MAX_WORKERS;
15826
15853
  class WorkerManagerClass {
15827
15854
  constructor() {
15828
15855
  this._initialized = !1, this._createdWorkers = 0, this.workerPool = [], this.queue = [], this.resolveHash = {};
15829
15856
  }
15830
15857
  isImageBitmapSupported() {
15831
15858
  return this._isImageBitmapSupported !== void 0 ? this._isImageBitmapSupported : (this._isImageBitmapSupported = new Promise((resolve2) => {
15832
- const workerURL2 = URL.createObjectURL(new Blob(
15833
- [checkImageBitmapCode.code],
15834
- { type: "application/javascript" }
15835
- )), worker = new Worker(workerURL2);
15859
+ const worker = new WorkerInstance$1();
15836
15860
  worker.addEventListener("message", (event) => {
15837
- worker.terminate(), URL.revokeObjectURL(workerURL2), resolve2(event.data);
15861
+ worker.terminate(), WorkerInstance$1.revokeObjectURL(), resolve2(event.data);
15838
15862
  });
15839
15863
  }), this._isImageBitmapSupported);
15840
15864
  }
@@ -15847,7 +15871,7 @@ ${e2}`);
15847
15871
  getWorker() {
15848
15872
  MAX_WORKERS === void 0 && (MAX_WORKERS = navigator.hardwareConcurrency || 4);
15849
15873
  let worker = this.workerPool.pop();
15850
- 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) => {
15874
+ return !worker && this._createdWorkers < MAX_WORKERS && (this._createdWorkers++, worker = new WorkerInstance(), worker.addEventListener("message", (event) => {
15851
15875
  this.complete(event.data), this.returnWorker(event.target), this.next();
15852
15876
  })), worker;
15853
15877
  }
@@ -15978,14 +16002,14 @@ ${e2}`);
15978
16002
  unload: loadTextures.unload
15979
16003
  };
15980
16004
  extensions$1.add(loadSVG);
15981
- 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) => {
16005
+ 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) => {
15982
16006
  for (var prop in b2 || (b2 = {}))
15983
16007
  __hasOwnProp$5.call(b2, prop) && __defNormalProp$5(a2, prop, b2[prop]);
15984
16008
  if (__getOwnPropSymbols$5)
15985
16009
  for (var prop of __getOwnPropSymbols$5(b2))
15986
16010
  __propIsEnum$5.call(b2, prop) && __defNormalProp$5(a2, prop, b2[prop]);
15987
16011
  return a2;
15988
- };
16012
+ }, __spreadProps$2 = (a2, b2) => __defProps$2(a2, __getOwnPropDescs$2(b2));
15989
16013
  const validVideoExtensions = [".mp4", ".m4v", ".webm", ".ogv"], validVideoMIMEs = [
15990
16014
  "video/mp4",
15991
16015
  "video/webm",
@@ -15997,7 +16021,11 @@ ${e2}`);
15997
16021
  priority: LoaderParserPriority.High
15998
16022
  },
15999
16023
  config: {
16000
- defaultAutoPlay: !0
16024
+ defaultAutoPlay: !0,
16025
+ defaultUpdateFPS: 0,
16026
+ defaultLoop: !1,
16027
+ defaultMuted: !1,
16028
+ defaultPlaysinline: !0
16001
16029
  },
16002
16030
  test(url2) {
16003
16031
  return checkDataUrl(url2, validVideoMIMEs) || checkExtension(url2, validVideoExtensions);
@@ -16007,9 +16035,15 @@ ${e2}`);
16007
16035
  let texture;
16008
16036
  const blob = await (await settings.ADAPTER.fetch(url2)).blob(), blobURL = URL.createObjectURL(blob);
16009
16037
  try {
16010
- const options = __spreadValues$5({
16011
- autoPlay: this.config.defaultAutoPlay
16012
- }, (_a2 = loadAsset == null ? void 0 : loadAsset.data) == null ? void 0 : _a2.resourceOptions), src = new VideoResource(blobURL, options);
16038
+ const options = __spreadProps$2(__spreadValues$5({
16039
+ autoPlay: this.config.defaultAutoPlay,
16040
+ updateFPS: this.config.defaultUpdateFPS,
16041
+ loop: this.config.defaultLoop,
16042
+ muted: this.config.defaultMuted,
16043
+ playsinline: this.config.defaultPlaysinline
16044
+ }, (_a2 = loadAsset == null ? void 0 : loadAsset.data) == null ? void 0 : _a2.resourceOptions), {
16045
+ autoLoad: !0
16046
+ }), src = new VideoResource(blobURL, options);
16013
16047
  await src.load();
16014
16048
  const base = new BaseTexture(src, __spreadValues$5({
16015
16049
  alphaMode: await detectVideoAlphaMode(),
@@ -16440,7 +16474,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16440
16474
  async init(options = {}) {
16441
16475
  var _a2, _b, _c;
16442
16476
  if (this._initialized) {
16443
- console.warn("[Assets]AssetManager already initialized, did you load before calling this Asset.init()?");
16477
+ console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");
16444
16478
  return;
16445
16479
  }
16446
16480
  if (this._initialized = !0, options.defaultSearchParams && this.resolver.setDefaultSearchParams(options.defaultSearchParams), options.basePath && (this.resolver.basePath = options.basePath), options.bundleIdentifier && this.resolver.setBundleIdentifier(options.bundleIdentifier), options.manifest) {
@@ -16531,7 +16565,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16531
16565
  * ]
16532
16566
  * };
16533
16567
  *
16534
- * await Asset.init({ manifest });
16568
+ * await Assets.init({ manifest });
16535
16569
  *
16536
16570
  * // Load a bundle...
16537
16571
  * loadScreenAssets = await Assets.loadBundle('load-screen');
@@ -16864,7 +16898,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16864
16898
  }
16865
16899
  };
16866
16900
  extensions$1.add(resolveTextureUrl);
16867
- 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 = 35986] = "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 || {});
16901
+ 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 || {});
16868
16902
  const INTERNAL_FORMAT_TO_BYTES_PER_PIXEL = {
16869
16903
  // WEBGL_compressed_texture_s3tc
16870
16904
  33776: 0.5,
@@ -16899,12 +16933,18 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16899
16933
  // @see https://www.khronos.org/registry/OpenGL/extensions/AMD/AMD_compressed_ATC_texture.txt
16900
16934
  // WEBGL_compressed_texture_atc
16901
16935
  35986: 0.5,
16902
- 35986: 1,
16936
+ 35987: 1,
16903
16937
  34798: 1,
16904
16938
  // @see https://registry.khronos.org/OpenGL/extensions/KHR/KHR_texture_compression_astc_hdr.txt
16905
16939
  // WEBGL_compressed_texture_astc
16906
16940
  /* eslint-disable-next-line camelcase */
16907
- 37808: 1
16941
+ 37808: 1,
16942
+ // @see https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_compression_bptc.txt
16943
+ // EXT_texture_compression_bptc
16944
+ 36492: 1,
16945
+ 36493: 1,
16946
+ 36494: 1,
16947
+ 36495: 1
16908
16948
  };
16909
16949
  let storedGl, extensions;
16910
16950
  function getCompressedTextureExtensions() {
@@ -16916,7 +16956,8 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16916
16956
  etc1: storedGl.getExtension("WEBGL_compressed_texture_etc1"),
16917
16957
  pvrtc: storedGl.getExtension("WEBGL_compressed_texture_pvrtc") || storedGl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
16918
16958
  atc: storedGl.getExtension("WEBGL_compressed_texture_atc"),
16919
- astc: storedGl.getExtension("WEBGL_compressed_texture_astc")
16959
+ astc: storedGl.getExtension("WEBGL_compressed_texture_astc"),
16960
+ bptc: storedGl.getExtension("EXT_texture_compression_bptc")
16920
16961
  };
16921
16962
  }
16922
16963
  const detectCompressedTextures = {
@@ -17022,15 +17063,21 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
17022
17063
  static _formatToExtension(format2) {
17023
17064
  if (format2 >= 33776 && format2 <= 33779)
17024
17065
  return "s3tc";
17066
+ if (format2 >= 35916 && format2 <= 35919)
17067
+ return "s3tc_sRGB";
17025
17068
  if (format2 >= 37488 && format2 <= 37497)
17026
17069
  return "etc";
17027
17070
  if (format2 >= 35840 && format2 <= 35843)
17028
17071
  return "pvrtc";
17029
- if (format2 >= 36196)
17072
+ if (format2 === 36196)
17030
17073
  return "etc1";
17031
- if (format2 >= 35986 && format2 <= 34798)
17074
+ if (format2 === 35986 || format2 === 35987 || format2 === 34798)
17032
17075
  return "atc";
17033
- throw new Error("Invalid (compressed) texture format given!");
17076
+ if (format2 >= 36492 && format2 <= 36495)
17077
+ return "bptc";
17078
+ if (format2 === 37808)
17079
+ return "astc";
17080
+ throw new Error(`Invalid (compressed) texture format given: ${format2}`);
17034
17081
  }
17035
17082
  /**
17036
17083
  * Pre-creates buffer views for each mipmap level
@@ -17093,7 +17140,14 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
17093
17140
  // WEBGL_compressed_texture_s3tc_srgb
17094
17141
  72: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
17095
17142
  75: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
17096
- 78: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
17143
+ 78: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
17144
+ // EXT_texture_compression_bptc
17145
+ // BC6H
17146
+ 96: INTERNAL_FORMATS.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
17147
+ 95: INTERNAL_FORMATS.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
17148
+ // BC7
17149
+ 98: INTERNAL_FORMATS.COMPRESSED_RGBA_BPTC_UNORM_EXT,
17150
+ 99: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT
17097
17151
  };
17098
17152
  function parseDDS(arrayBuffer) {
17099
17153
  const data = new Uint32Array(arrayBuffer);
@@ -17393,7 +17447,8 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
17393
17447
  ".etc1.ktx",
17394
17448
  ".pvrt.ktx",
17395
17449
  ".atc.ktx",
17396
- ".astc.ktx"
17450
+ ".astc.ktx",
17451
+ ".bptc.ktx"
17397
17452
  ];
17398
17453
  if (extensions2.some((ext) => value.endsWith(ext)))
17399
17454
  return {
@@ -21877,15 +21932,11 @@ void main(void)
21877
21932
  type: ExtensionType.RendererPlugin
21878
21933
  }, extensions$1.add(TilingSpriteRenderer);
21879
21934
  const _Spritesheet = class _Spritesheet2 {
21880
- /**
21881
- * @param texture - Reference to the source BaseTexture object.
21882
- * @param {object} data - Spritesheet image data.
21883
- * @param resolutionFilename - The filename to consider when determining
21884
- * the resolution of the spritesheet. If not provided, the imageUrl will
21885
- * be used on the BaseTexture.
21886
- */
21887
- constructor(texture, data, resolutionFilename = null) {
21888
- 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;
21935
+ /** @ignore */
21936
+ constructor(optionsOrTexture, arg1, arg2) {
21937
+ this.linkedSheets = [], (optionsOrTexture instanceof BaseTexture || optionsOrTexture instanceof Texture) && (optionsOrTexture = { texture: optionsOrTexture, data: arg1, resolutionFilename: arg2 });
21938
+ const { texture, data, resolutionFilename = null, cachePrefix = "" } = optionsOrTexture;
21939
+ 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;
21889
21940
  const resource = this.baseTexture.resource;
21890
21941
  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;
21891
21942
  }
@@ -21899,7 +21950,7 @@ void main(void)
21899
21950
  _updateResolution(resolutionFilename = null) {
21900
21951
  const { scale } = this.data.meta;
21901
21952
  let resolution = getResolutionOfUrl(resolutionFilename, null);
21902
- return resolution === null && (resolution = parseFloat(scale != null ? scale : "1")), resolution !== 1 && this.baseTexture.setResolution(resolution), resolution;
21953
+ return resolution === null && (resolution = typeof scale == "number" ? scale : parseFloat(scale != null ? scale : "1")), resolution !== 1 && this.baseTexture.setResolution(resolution), resolution;
21903
21954
  }
21904
21955
  /**
21905
21956
  * Parser spritesheet from loaded data. This is done asynchronously
@@ -21951,7 +22002,7 @@ void main(void)
21951
22002
  data.rotated ? 2 : 0,
21952
22003
  data.anchor,
21953
22004
  data.borders
21954
- ), Texture.addToCache(this.textures[i2], i2.toString());
22005
+ ), Texture.addToCache(this.textures[i2], this.cachePrefix + i2.toString());
21955
22006
  }
21956
22007
  frameIndex++;
21957
22008
  }
@@ -21997,12 +22048,15 @@ void main(void)
21997
22048
  if (keys.forEach((key) => {
21998
22049
  out[key] = asset;
21999
22050
  }), Object.keys(asset.textures).forEach((key) => {
22000
- out[key] = asset.textures[key];
22051
+ out[`${asset.cachePrefix}${key}`] = asset.textures[key];
22001
22052
  }), !ignoreMultiPack) {
22002
22053
  const basePath = path.dirname(keys[0]);
22003
22054
  asset.linkedSheets.forEach((item, i2) => {
22004
- const out2 = getCacheableAssets([`${basePath}/${asset.data.meta.related_multi_packs[i2]}`], item, !0);
22005
- Object.assign(out, out2);
22055
+ Object.assign(out, getCacheableAssets(
22056
+ [`${basePath}/${asset.data.meta.related_multi_packs[i2]}`],
22057
+ item,
22058
+ !0
22059
+ ));
22006
22060
  });
22007
22061
  }
22008
22062
  return out;
@@ -22047,25 +22101,39 @@ void main(void)
22047
22101
  return path.extname(options.src).toLowerCase() === ".json" && !!asset.frames;
22048
22102
  },
22049
22103
  async parse(asset, options, loader) {
22050
- var _a2, _b;
22104
+ var _a2, _b, _c;
22105
+ const {
22106
+ texture: imageTexture,
22107
+ // if user need to use preloaded texture
22108
+ imageFilename,
22109
+ // if user need to use custom filename (not from jsonFile.meta.image)
22110
+ cachePrefix
22111
+ // if user need to use custom cache prefix
22112
+ } = (_a2 = options == null ? void 0 : options.data) != null ? _a2 : {};
22051
22113
  let basePath = path.dirname(options.src);
22052
22114
  basePath && basePath.lastIndexOf("/") !== basePath.length - 1 && (basePath += "/");
22053
- let imagePath = basePath + asset.meta.image;
22054
- imagePath = copySearchParams(imagePath, options.src);
22055
- const texture = (await loader.load([imagePath]))[imagePath], spritesheet = new Spritesheet(
22056
- texture.baseTexture,
22057
- asset,
22058
- options.src
22059
- );
22115
+ let texture;
22116
+ if (imageTexture && imageTexture.baseTexture)
22117
+ texture = imageTexture;
22118
+ else {
22119
+ const imagePath = copySearchParams(basePath + (imageFilename != null ? imageFilename : asset.meta.image), options.src);
22120
+ texture = (await loader.load([imagePath]))[imagePath];
22121
+ }
22122
+ const spritesheet = new Spritesheet({
22123
+ texture: texture.baseTexture,
22124
+ data: asset,
22125
+ resolutionFilename: options.src,
22126
+ cachePrefix
22127
+ });
22060
22128
  await spritesheet.parse();
22061
- const multiPacks = (_a2 = asset == null ? void 0 : asset.meta) == null ? void 0 : _a2.related_multi_packs;
22129
+ const multiPacks = (_b = asset == null ? void 0 : asset.meta) == null ? void 0 : _b.related_multi_packs;
22062
22130
  if (Array.isArray(multiPacks)) {
22063
22131
  const promises = [];
22064
22132
  for (const item of multiPacks) {
22065
22133
  if (typeof item != "string")
22066
22134
  continue;
22067
22135
  let itemUrl = basePath + item;
22068
- (_b = options.data) != null && _b.ignoreMultiPack || (itemUrl = copySearchParams(itemUrl, options.src), promises.push(loader.load({
22136
+ (_c = options.data) != null && _c.ignoreMultiPack || (itemUrl = copySearchParams(itemUrl, options.src), promises.push(loader.load({
22069
22137
  src: itemUrl,
22070
22138
  data: {
22071
22139
  ignoreMultiPack: !0