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.mjs 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
@@ -1077,7 +1077,7 @@ const path = {
1077
1077
  joined = arg;
1078
1078
  else {
1079
1079
  const prevArg = (_a2 = segments[i2 - 1]) != null ? _a2 : "";
1080
- this.extname(prevArg) ? joined += `/../${arg}` : joined += `/${arg}`;
1080
+ this.joinExtensions.includes(this.extname(prevArg).toLowerCase()) ? joined += `/../${arg}` : joined += `/${arg}`;
1081
1081
  }
1082
1082
  }
1083
1083
  return joined === void 0 ? "." : this.normalize(joined);
@@ -1203,7 +1203,8 @@ const path = {
1203
1203
  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;
1204
1204
  },
1205
1205
  sep: "/",
1206
- delimiter: ":"
1206
+ delimiter: ":",
1207
+ joinExtensions: [".html"]
1207
1208
  };
1208
1209
  let promise;
1209
1210
  async function detectVideoAlphaMode() {
@@ -2022,20 +2023,20 @@ var index = {
2022
2023
  trimCanvas,
2023
2024
  uid,
2024
2025
  url
2025
- }, __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) => {
2026
2027
  for (var prop in b2 || (b2 = {}))
2027
2028
  __hasOwnProp$e.call(b2, prop) && __defNormalProp$d(a2, prop, b2[prop]);
2028
2029
  if (__getOwnPropSymbols$e)
2029
2030
  for (var prop of __getOwnPropSymbols$e(b2))
2030
2031
  __propIsEnum$e.call(b2, prop) && __defNormalProp$d(a2, prop, b2[prop]);
2031
2032
  return a2;
2032
- }, __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 || {});
2033
2034
  const normalizeExtension = (ext) => {
2034
2035
  if (typeof ext == "function" || typeof ext == "object" && ext.extension) {
2035
2036
  if (!ext.extension)
2036
2037
  throw new Error("Extension class must have an extension object");
2037
2038
  const metadata = typeof ext.extension != "object" ? { type: ext.extension } : ext.extension;
2038
- ext = __spreadProps$4(__spreadValues$d({}, metadata), { ref: ext });
2039
+ ext = __spreadProps$5(__spreadValues$d({}, metadata), { ref: ext });
2039
2040
  }
2040
2041
  if (typeof ext == "object")
2041
2042
  ext = __spreadValues$d({}, ext);
@@ -2073,8 +2074,9 @@ const normalizeExtension = (ext) => {
2073
2074
  add(...extensions2) {
2074
2075
  return extensions2.map(normalizeExtension).forEach((ext) => {
2075
2076
  ext.type.forEach((type) => {
2077
+ var _a2, _b;
2076
2078
  const handlers = this._addHandlers, queue = this._queue;
2077
- 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));
2078
2080
  });
2079
2081
  }), this;
2080
2082
  },
@@ -2086,12 +2088,13 @@ const normalizeExtension = (ext) => {
2086
2088
  * @returns {PIXI.extensions} For chaining.
2087
2089
  */
2088
2090
  handle(type, onAdd, onRemove) {
2091
+ var _a2;
2089
2092
  const addHandlers = this._addHandlers, removeHandlers = this._removeHandlers;
2090
2093
  if (addHandlers[type] || removeHandlers[type])
2091
2094
  throw new Error(`Extension type ${type} already has a handler`);
2092
2095
  addHandlers[type] = onAdd, removeHandlers[type] = onRemove;
2093
2096
  const queue = this._queue;
2094
- 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;
2095
2098
  },
2096
2099
  /**
2097
2100
  * Handle a type, but using a map by `name` property.
@@ -2103,10 +2106,10 @@ const normalizeExtension = (ext) => {
2103
2106
  return this.handle(
2104
2107
  type,
2105
2108
  (extension) => {
2106
- map2[extension.name] = extension.ref;
2109
+ extension.name && (map2[extension.name] = extension.ref);
2107
2110
  },
2108
2111
  (extension) => {
2109
- delete map2[extension.name];
2112
+ extension.name && delete map2[extension.name];
2110
2113
  }
2111
2114
  );
2112
2115
  },
@@ -2325,7 +2328,7 @@ function autoDetectResource(source, options) {
2325
2328
  }
2326
2329
  class Runner {
2327
2330
  /**
2328
- * @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.
2329
2332
  */
2330
2333
  constructor(name) {
2331
2334
  this.items = [], this._name = name, this._aliasCount = 0;
@@ -2390,7 +2393,7 @@ class Runner {
2390
2393
  }
2391
2394
  /** Remove all references, don't use after this. */
2392
2395
  destroy() {
2393
- this.removeAll(), this.items = null, this._name = null;
2396
+ this.removeAll(), this.items.length = 0, this._name = "";
2394
2397
  }
2395
2398
  /**
2396
2399
  * `true` if there are no this Runner contains no listeners
@@ -2401,7 +2404,7 @@ class Runner {
2401
2404
  }
2402
2405
  /**
2403
2406
  * The name of the runner.
2404
- * @readonly
2407
+ * @type {string}
2405
2408
  */
2406
2409
  get name() {
2407
2410
  return this._name;
@@ -2591,7 +2594,7 @@ const defaultBufferOptions = {
2591
2594
  alphaMode: ALPHA_MODES.NPM
2592
2595
  }, _BaseTexture = class _BaseTexture2 extends EventEmitter {
2593
2596
  /**
2594
- * @param {PIXI.Resource|HTMLImageElement|HTMLVideoElement|ImageBitmap|ICanvas|string} [resource=null] -
2597
+ * @param {PIXI.Resource|PIXI.ImageSource|string} [resource=null] -
2595
2598
  * The current resource to use, for things that aren't Resource objects, will be converted
2596
2599
  * into a Resource.
2597
2600
  * @param options - Collection of options, default options inherited from {@link PIXI.BaseTexture.defaultOptions}.
@@ -2769,7 +2772,7 @@ const defaultBufferOptions = {
2769
2772
  * source is an image url or an image element and not in the base texture
2770
2773
  * cache, it will be created and loaded.
2771
2774
  * @static
2772
- * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas|string|string[]} source - The
2775
+ * @param {PIXI.ImageSource|string|string[]} source - The
2773
2776
  * source to create base texture from.
2774
2777
  * @param options - See {@link PIXI.BaseTexture}'s constructor for options.
2775
2778
  * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id
@@ -5559,7 +5562,8 @@ class ContextSystem {
5559
5562
  etc1: gl.getExtension("WEBGL_compressed_texture_etc1"),
5560
5563
  pvrtc: gl.getExtension("WEBGL_compressed_texture_pvrtc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
5561
5564
  atc: gl.getExtension("WEBGL_compressed_texture_atc"),
5562
- astc: gl.getExtension("WEBGL_compressed_texture_astc")
5565
+ astc: gl.getExtension("WEBGL_compressed_texture_astc"),
5566
+ bptc: gl.getExtension("EXT_texture_compression_bptc")
5563
5567
  };
5564
5568
  this.webGLVersion === 1 ? Object.assign(this.extensions, common, {
5565
5569
  drawBuffers: gl.getExtension("WEBGL_draw_buffers"),
@@ -5796,10 +5800,10 @@ class BaseRenderTexture extends BaseTexture {
5796
5800
  }
5797
5801
  class BaseImageResource extends Resource {
5798
5802
  /**
5799
- * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas} source
5803
+ * @param {PIXI.ImageSourcee} source
5800
5804
  */
5801
5805
  constructor(source) {
5802
- 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;
5803
5807
  super(width, height), this.source = source, this.noSubImage = !1;
5804
5808
  }
5805
5809
  /**
@@ -5816,7 +5820,7 @@ class BaseImageResource extends Resource {
5816
5820
  * @param renderer - Upload to the renderer
5817
5821
  * @param baseTexture - Reference to parent texture
5818
5822
  * @param glTexture
5819
- * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas} [source] - (optional)
5823
+ * @param {PIXI.ImageSourcee} [source] - (optional)
5820
5824
  * @returns - true is success
5821
5825
  */
5822
5826
  upload(renderer, baseTexture, glTexture, source) {
@@ -8276,7 +8280,7 @@ class StartupSystem {
8276
8280
  */
8277
8281
  run(options) {
8278
8282
  const { renderer } = this;
8279
- 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);
8283
+ 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);
8280
8284
  }
8281
8285
  destroy() {
8282
8286
  }
@@ -10577,6 +10581,23 @@ _SVGResource.SVG_XML = /^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m, /**
10577
10581
  */
10578
10582
  _SVGResource.SVG_SIZE = /<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;
10579
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
+ }
10580
10601
  const _VideoResource = class _VideoResource2 extends BaseImageResource {
10581
10602
  /**
10582
10603
  * @param {HTMLVideoElement|object|string|Array<string|object>} source - Video element to use.
@@ -10584,7 +10605,8 @@ const _VideoResource = class _VideoResource2 extends BaseImageResource {
10584
10605
  * @param {boolean} [options.autoLoad=true] - Start loading the video immediately
10585
10606
  * @param {boolean} [options.autoPlay=true] - Start playing video immediately
10586
10607
  * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.
10587
- * 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.
10588
10610
  * @param {boolean} [options.crossorigin=true] - Load image using cross origin
10589
10611
  * @param {boolean} [options.loop=false] - Loops the video
10590
10612
  * @param {boolean} [options.muted=false] - Mutes the video audio, useful for autoplay
@@ -10698,7 +10720,8 @@ const _VideoResource = class _VideoResource2 extends BaseImageResource {
10698
10720
  value !== this._autoUpdate && (this._autoUpdate = value, this._configureAutoUpdate());
10699
10721
  }
10700
10722
  /**
10701
- * 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.
10702
10725
  * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.
10703
10726
  */
10704
10727
  get updateFPS() {
@@ -10737,6 +10760,7 @@ INSTALLED.push(
10737
10760
  ImageResource,
10738
10761
  CanvasResource,
10739
10762
  VideoResource,
10763
+ VideoFrameResource,
10740
10764
  SVGResource,
10741
10765
  BufferResource,
10742
10766
  CubeResource,
@@ -10759,7 +10783,7 @@ class TransformFeedback {
10759
10783
  this.disposeRunner.emit(this, !1);
10760
10784
  }
10761
10785
  }
10762
- const VERSION = "7.3.2";
10786
+ const VERSION = "7.4.0";
10763
10787
  class Bounds {
10764
10788
  constructor() {
10765
10789
  this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, this.rect = null, this.updateID = -1;
@@ -11240,7 +11264,7 @@ class DisplayObject extends EventEmitter {
11240
11264
  return this._zIndex;
11241
11265
  }
11242
11266
  set zIndex(value) {
11243
- this._zIndex = value, this.parent && (this.parent.sortDirty = !0);
11267
+ this._zIndex !== value && (this._zIndex = value, this.parent && (this.parent.sortDirty = !0));
11244
11268
  }
11245
11269
  /**
11246
11270
  * Indicates if the object is globally visible.
@@ -13415,7 +13439,7 @@ class EventsTickerClass {
13415
13439
  }));
13416
13440
  }
13417
13441
  /**
13418
- * Updates the state of interactive objects if at least {@link interactionFrequency}
13442
+ * Updates the state of interactive objects if at least {@link PIXI.EventsTicker#interactionFrequency}
13419
13443
  * milliseconds have passed since the last invocation.
13420
13444
  *
13421
13445
  * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}.
@@ -14988,8 +15012,12 @@ const FederatedDisplayObject = {
14988
15012
  * });
14989
15013
  */
14990
15014
  addEventListener(type, listener, options) {
14991
- const capture = typeof options == "boolean" && options || typeof options == "object" && options.capture, context2 = typeof listener == "function" ? void 0 : listener;
14992
- 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);
14993
15021
  },
14994
15022
  /**
14995
15023
  * Unlike `off` or `removeListener` which are methods from EventEmitter, `removeEventListener`
@@ -15571,14 +15599,14 @@ class CacheClass {
15571
15599
  }
15572
15600
  }
15573
15601
  const Cache = new CacheClass();
15574
- 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) => {
15575
15603
  for (var prop in b2 || (b2 = {}))
15576
15604
  __hasOwnProp$9.call(b2, prop) && __defNormalProp$9(a2, prop, b2[prop]);
15577
15605
  if (__getOwnPropSymbols$9)
15578
15606
  for (var prop of __getOwnPropSymbols$9(b2))
15579
15607
  __propIsEnum$9.call(b2, prop) && __defNormalProp$9(a2, prop, b2[prop]);
15580
15608
  return a2;
15581
- }, __spreadProps$3 = (a2, b2) => __defProps$3(a2, __getOwnPropDescs$3(b2));
15609
+ }, __spreadProps$4 = (a2, b2) => __defProps$4(a2, __getOwnPropDescs$4(b2));
15582
15610
  class Loader {
15583
15611
  constructor() {
15584
15612
  this._parsers = [], this._parsersValidated = !1, this.parsers = new Proxy(this._parsers, {
@@ -15668,7 +15696,7 @@ ${e2}`);
15668
15696
  }
15669
15697
  /** validates our parsers, right now it only checks for name conflicts but we can add more here as required! */
15670
15698
  _validateParsers() {
15671
- 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 })), {});
15672
15700
  }
15673
15701
  }
15674
15702
  var LoaderParserPriority = /* @__PURE__ */ ((LoaderParserPriority2) => (LoaderParserPriority2[LoaderParserPriority2.Low = 0] = "Low", LoaderParserPriority2[LoaderParserPriority2.Normal = 1] = "Normal", LoaderParserPriority2[LoaderParserPriority2.High = 2] = "High", LoaderParserPriority2))(LoaderParserPriority || {});
@@ -15700,14 +15728,14 @@ const validTXTExtension = ".txt", validTXTMIME = "text/plain", loadTxt = {
15700
15728
  }
15701
15729
  };
15702
15730
  extensions$1.add(loadTxt);
15703
- 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) => {
15704
15732
  for (var prop in b2 || (b2 = {}))
15705
15733
  __hasOwnProp$8.call(b2, prop) && __defNormalProp$8(a2, prop, b2[prop]);
15706
15734
  if (__getOwnPropSymbols$8)
15707
15735
  for (var prop of __getOwnPropSymbols$8(b2))
15708
15736
  __propIsEnum$8.call(b2, prop) && __defNormalProp$8(a2, prop, b2[prop]);
15709
15737
  return a2;
15710
- }, __spreadProps$2 = (a2, b2) => __defProps$2(a2, __getOwnPropDescs$2(b2));
15738
+ }, __spreadProps$3 = (a2, b2) => __defProps$3(a2, __getOwnPropDescs$3(b2));
15711
15739
  const validWeights = [
15712
15740
  "normal",
15713
15741
  "bold",
@@ -15756,7 +15784,7 @@ const loadWebFont = {
15756
15784
  if (fonts) {
15757
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 : {};
15758
15786
  for (let i2 = 0; i2 < weights.length; i2++) {
15759
- 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), {
15760
15788
  weight
15761
15789
  }));
15762
15790
  await font.load(), fonts.add(font), fontFaces.push(font);
@@ -15770,82 +15798,78 @@ const loadWebFont = {
15770
15798
  }
15771
15799
  };
15772
15800
  extensions$1.add(loadWebFont);
15773
- let UUID = 0, MAX_WORKERS;
15774
- const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=", checkImageBitmapCode = {
15775
- id: "checkImageBitmap",
15776
- code: `
15777
- async function checkImageBitmap()
15778
- {
15779
- try
15780
- {
15781
- if (typeof createImageBitmap !== 'function') return false;
15782
-
15783
- const response = await fetch('${WHITE_PNG}');
15784
- const imageBlob = await response.blob();
15785
- const imageBitmap = await createImageBitmap(imageBlob);
15786
-
15787
- return imageBitmap.width === 1 && imageBitmap.height === 1;
15788
- }
15789
- catch (e)
15790
- {
15791
- return false;
15792
- }
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;
15793
15812
  }
15794
- checkImageBitmap().then((result) => { self.postMessage(result); });
15795
- `
15796
- }, workerCode = {
15797
- id: "loadImageBitmap",
15798
- code: `
15799
- async function loadImageBitmap(url)
15800
- {
15801
- const response = await fetch(url);
15802
-
15803
- if (!response.ok)
15804
- {
15805
- throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \`
15806
- + \`\${response.status} \${response.statusText}\`);
15807
- }
15808
-
15809
- const imageBlob = await response.blob();
15810
- const imageBitmap = await createImageBitmap(imageBlob);
15811
-
15812
- return imageBitmap;
15813
+ }
15814
+ checkImageBitmap().then((result) => {
15815
+ self.postMessage(result);
15816
+ });
15817
+ })();
15818
+ `;
15819
+ let WORKER_URL$1 = null, WorkerInstance$1 = class extends Worker {
15820
+ constructor() {
15821
+ WORKER_URL$1 || (WORKER_URL$1 = URL.createObjectURL(new Blob([WORKER_CODE$1], { type: "application/javascript" }))), super(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
+ });
15813
15850
  }
15814
- self.onmessage = async (event) =>
15815
- {
15816
- try
15817
- {
15818
- const imageBitmap = await loadImageBitmap(event.data.data[0]);
15819
-
15820
- self.postMessage({
15821
- data: imageBitmap,
15822
- uuid: event.data.uuid,
15823
- id: event.data.id,
15824
- }, [imageBitmap]);
15825
- }
15826
- catch(e)
15827
- {
15828
- self.postMessage({
15829
- error: e,
15830
- uuid: event.data.uuid,
15831
- id: event.data.id,
15832
- });
15833
- }
15834
- };`
15851
+ };
15852
+ })();
15853
+ `;
15854
+ let WORKER_URL = null;
15855
+ class WorkerInstance2 extends Worker {
15856
+ constructor() {
15857
+ WORKER_URL || (WORKER_URL = URL.createObjectURL(new Blob([WORKER_CODE], { type: "application/javascript" }))), super(WORKER_URL);
15858
+ }
15859
+ }
15860
+ WorkerInstance2.revokeObjectURL = function() {
15861
+ WORKER_URL && (URL.revokeObjectURL(WORKER_URL), WORKER_URL = null);
15835
15862
  };
15836
- let workerURL;
15863
+ let UUID = 0, MAX_WORKERS;
15837
15864
  class WorkerManagerClass {
15838
15865
  constructor() {
15839
15866
  this._initialized = !1, this._createdWorkers = 0, this.workerPool = [], this.queue = [], this.resolveHash = {};
15840
15867
  }
15841
15868
  isImageBitmapSupported() {
15842
15869
  return this._isImageBitmapSupported !== void 0 ? this._isImageBitmapSupported : (this._isImageBitmapSupported = new Promise((resolve2) => {
15843
- const workerURL2 = URL.createObjectURL(new Blob(
15844
- [checkImageBitmapCode.code],
15845
- { type: "application/javascript" }
15846
- )), worker = new Worker(workerURL2);
15870
+ const worker = new WorkerInstance$1();
15847
15871
  worker.addEventListener("message", (event) => {
15848
- worker.terminate(), URL.revokeObjectURL(workerURL2), resolve2(event.data);
15872
+ worker.terminate(), WorkerInstance$1.revokeObjectURL(), resolve2(event.data);
15849
15873
  });
15850
15874
  }), this._isImageBitmapSupported);
15851
15875
  }
@@ -15858,7 +15882,7 @@ class WorkerManagerClass {
15858
15882
  getWorker() {
15859
15883
  MAX_WORKERS === void 0 && (MAX_WORKERS = navigator.hardwareConcurrency || 4);
15860
15884
  let worker = this.workerPool.pop();
15861
- 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.addEventListener("message", (event) => {
15862
15886
  this.complete(event.data), this.returnWorker(event.target), this.next();
15863
15887
  })), worker;
15864
15888
  }
@@ -15989,14 +16013,14 @@ const validSVGExtension = ".svg", validSVGMIME = "image/svg+xml", loadSVG = {
15989
16013
  unload: loadTextures.unload
15990
16014
  };
15991
16015
  extensions$1.add(loadSVG);
15992
- 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) => {
15993
16017
  for (var prop in b2 || (b2 = {}))
15994
16018
  __hasOwnProp$5.call(b2, prop) && __defNormalProp$5(a2, prop, b2[prop]);
15995
16019
  if (__getOwnPropSymbols$5)
15996
16020
  for (var prop of __getOwnPropSymbols$5(b2))
15997
16021
  __propIsEnum$5.call(b2, prop) && __defNormalProp$5(a2, prop, b2[prop]);
15998
16022
  return a2;
15999
- };
16023
+ }, __spreadProps$2 = (a2, b2) => __defProps$2(a2, __getOwnPropDescs$2(b2));
16000
16024
  const validVideoExtensions = [".mp4", ".m4v", ".webm", ".ogv"], validVideoMIMEs = [
16001
16025
  "video/mp4",
16002
16026
  "video/webm",
@@ -16008,7 +16032,11 @@ const validVideoExtensions = [".mp4", ".m4v", ".webm", ".ogv"], validVideoMIMEs
16008
16032
  priority: LoaderParserPriority.High
16009
16033
  },
16010
16034
  config: {
16011
- defaultAutoPlay: !0
16035
+ defaultAutoPlay: !0,
16036
+ defaultUpdateFPS: 0,
16037
+ defaultLoop: !1,
16038
+ defaultMuted: !1,
16039
+ defaultPlaysinline: !0
16012
16040
  },
16013
16041
  test(url2) {
16014
16042
  return checkDataUrl(url2, validVideoMIMEs) || checkExtension(url2, validVideoExtensions);
@@ -16018,9 +16046,15 @@ const validVideoExtensions = [".mp4", ".m4v", ".webm", ".ogv"], validVideoMIMEs
16018
16046
  let texture;
16019
16047
  const blob = await (await settings.ADAPTER.fetch(url2)).blob(), blobURL = URL.createObjectURL(blob);
16020
16048
  try {
16021
- const options = __spreadValues$5({
16022
- autoPlay: this.config.defaultAutoPlay
16023
- }, (_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);
16024
16058
  await src.load();
16025
16059
  const base = new BaseTexture(src, __spreadValues$5({
16026
16060
  alphaMode: await detectVideoAlphaMode(),
@@ -16451,7 +16485,7 @@ class AssetsClass {
16451
16485
  async init(options = {}) {
16452
16486
  var _a2, _b, _c;
16453
16487
  if (this._initialized) {
16454
- console.warn("[Assets]AssetManager already initialized, did you load before calling this Asset.init()?");
16488
+ console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");
16455
16489
  return;
16456
16490
  }
16457
16491
  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) {
@@ -16542,7 +16576,7 @@ class AssetsClass {
16542
16576
  * ]
16543
16577
  * };
16544
16578
  *
16545
- * await Asset.init({ manifest });
16579
+ * await Assets.init({ manifest });
16546
16580
  *
16547
16581
  * // Load a bundle...
16548
16582
  * loadScreenAssets = await Assets.loadBundle('load-screen');
@@ -16875,7 +16909,7 @@ const resolveTextureUrl = {
16875
16909
  }
16876
16910
  };
16877
16911
  extensions$1.add(resolveTextureUrl);
16878
- 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 || {});
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 || {});
16879
16913
  const INTERNAL_FORMAT_TO_BYTES_PER_PIXEL = {
16880
16914
  // WEBGL_compressed_texture_s3tc
16881
16915
  33776: 0.5,
@@ -16910,12 +16944,18 @@ const INTERNAL_FORMAT_TO_BYTES_PER_PIXEL = {
16910
16944
  // @see https://www.khronos.org/registry/OpenGL/extensions/AMD/AMD_compressed_ATC_texture.txt
16911
16945
  // WEBGL_compressed_texture_atc
16912
16946
  35986: 0.5,
16913
- 35986: 1,
16947
+ 35987: 1,
16914
16948
  34798: 1,
16915
16949
  // @see https://registry.khronos.org/OpenGL/extensions/KHR/KHR_texture_compression_astc_hdr.txt
16916
16950
  // WEBGL_compressed_texture_astc
16917
16951
  /* eslint-disable-next-line camelcase */
16918
- 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
16919
16959
  };
16920
16960
  let storedGl, extensions;
16921
16961
  function getCompressedTextureExtensions() {
@@ -16927,7 +16967,8 @@ function getCompressedTextureExtensions() {
16927
16967
  etc1: storedGl.getExtension("WEBGL_compressed_texture_etc1"),
16928
16968
  pvrtc: storedGl.getExtension("WEBGL_compressed_texture_pvrtc") || storedGl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
16929
16969
  atc: storedGl.getExtension("WEBGL_compressed_texture_atc"),
16930
- astc: storedGl.getExtension("WEBGL_compressed_texture_astc")
16970
+ astc: storedGl.getExtension("WEBGL_compressed_texture_astc"),
16971
+ bptc: storedGl.getExtension("EXT_texture_compression_bptc")
16931
16972
  };
16932
16973
  }
16933
16974
  const detectCompressedTextures = {
@@ -17033,15 +17074,21 @@ class CompressedTextureResource extends BlobResource {
17033
17074
  static _formatToExtension(format2) {
17034
17075
  if (format2 >= 33776 && format2 <= 33779)
17035
17076
  return "s3tc";
17077
+ if (format2 >= 35916 && format2 <= 35919)
17078
+ return "s3tc_sRGB";
17036
17079
  if (format2 >= 37488 && format2 <= 37497)
17037
17080
  return "etc";
17038
17081
  if (format2 >= 35840 && format2 <= 35843)
17039
17082
  return "pvrtc";
17040
- if (format2 >= 36196)
17083
+ if (format2 === 36196)
17041
17084
  return "etc1";
17042
- if (format2 >= 35986 && format2 <= 34798)
17085
+ if (format2 === 35986 || format2 === 35987 || format2 === 34798)
17043
17086
  return "atc";
17044
- 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}`);
17045
17092
  }
17046
17093
  /**
17047
17094
  * Pre-creates buffer views for each mipmap level
@@ -17104,7 +17151,14 @@ const DDS_MAGIC_SIZE = 4, DDS_HEADER_SIZE = 124, DDS_HEADER_PF_SIZE = 32, DDS_HE
17104
17151
  // WEBGL_compressed_texture_s3tc_srgb
17105
17152
  72: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
17106
17153
  75: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
17107
- 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
17108
17162
  };
17109
17163
  function parseDDS(arrayBuffer) {
17110
17164
  const data = new Uint32Array(arrayBuffer);
@@ -17404,7 +17458,8 @@ const resolveCompressedTextureUrl = {
17404
17458
  ".etc1.ktx",
17405
17459
  ".pvrt.ktx",
17406
17460
  ".atc.ktx",
17407
- ".astc.ktx"
17461
+ ".astc.ktx",
17462
+ ".bptc.ktx"
17408
17463
  ];
17409
17464
  if (extensions2.some((ext) => value.endsWith(ext)))
17410
17465
  return {
@@ -21891,15 +21946,11 @@ TilingSpriteRenderer.extension = {
21891
21946
  };
21892
21947
  extensions$1.add(TilingSpriteRenderer);
21893
21948
  const _Spritesheet = class _Spritesheet2 {
21894
- /**
21895
- * @param texture - Reference to the source BaseTexture object.
21896
- * @param {object} data - Spritesheet image data.
21897
- * @param resolutionFilename - The filename to consider when determining
21898
- * the resolution of the spritesheet. If not provided, the imageUrl will
21899
- * be used on the BaseTexture.
21900
- */
21901
- constructor(texture, data, resolutionFilename = null) {
21902
- 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;
21949
+ /** @ignore */
21950
+ constructor(optionsOrTexture, arg1, arg2) {
21951
+ this.linkedSheets = [], (optionsOrTexture instanceof BaseTexture || optionsOrTexture instanceof Texture) && (optionsOrTexture = { texture: optionsOrTexture, data: arg1, resolutionFilename: arg2 });
21952
+ const { texture, data, resolutionFilename = null, cachePrefix = "" } = optionsOrTexture;
21953
+ 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;
21903
21954
  const resource = this.baseTexture.resource;
21904
21955
  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;
21905
21956
  }
@@ -21913,7 +21964,7 @@ const _Spritesheet = class _Spritesheet2 {
21913
21964
  _updateResolution(resolutionFilename = null) {
21914
21965
  const { scale } = this.data.meta;
21915
21966
  let resolution = getResolutionOfUrl(resolutionFilename, null);
21916
- return resolution === null && (resolution = parseFloat(scale != null ? scale : "1")), resolution !== 1 && this.baseTexture.setResolution(resolution), resolution;
21967
+ return resolution === null && (resolution = typeof scale == "number" ? scale : parseFloat(scale != null ? scale : "1")), resolution !== 1 && this.baseTexture.setResolution(resolution), resolution;
21917
21968
  }
21918
21969
  /**
21919
21970
  * Parser spritesheet from loaded data. This is done asynchronously
@@ -21965,7 +22016,7 @@ const _Spritesheet = class _Spritesheet2 {
21965
22016
  data.rotated ? 2 : 0,
21966
22017
  data.anchor,
21967
22018
  data.borders
21968
- ), Texture.addToCache(this.textures[i2], i2.toString());
22019
+ ), Texture.addToCache(this.textures[i2], this.cachePrefix + i2.toString());
21969
22020
  }
21970
22021
  frameIndex++;
21971
22022
  }
@@ -22011,12 +22062,15 @@ function getCacheableAssets(keys, asset, ignoreMultiPack) {
22011
22062
  if (keys.forEach((key) => {
22012
22063
  out[key] = asset;
22013
22064
  }), Object.keys(asset.textures).forEach((key) => {
22014
- out[key] = asset.textures[key];
22065
+ out[`${asset.cachePrefix}${key}`] = asset.textures[key];
22015
22066
  }), !ignoreMultiPack) {
22016
22067
  const basePath = path.dirname(keys[0]);
22017
22068
  asset.linkedSheets.forEach((item, i2) => {
22018
- const out2 = getCacheableAssets([`${basePath}/${asset.data.meta.related_multi_packs[i2]}`], item, !0);
22019
- Object.assign(out, out2);
22069
+ Object.assign(out, getCacheableAssets(
22070
+ [`${basePath}/${asset.data.meta.related_multi_packs[i2]}`],
22071
+ item,
22072
+ !0
22073
+ ));
22020
22074
  });
22021
22075
  }
22022
22076
  return out;
@@ -22061,25 +22115,39 @@ const spritesheetAsset = {
22061
22115
  return path.extname(options.src).toLowerCase() === ".json" && !!asset.frames;
22062
22116
  },
22063
22117
  async parse(asset, options, loader) {
22064
- var _a2, _b;
22118
+ var _a2, _b, _c;
22119
+ const {
22120
+ texture: imageTexture,
22121
+ // if user need to use preloaded texture
22122
+ imageFilename,
22123
+ // if user need to use custom filename (not from jsonFile.meta.image)
22124
+ cachePrefix
22125
+ // if user need to use custom cache prefix
22126
+ } = (_a2 = options == null ? void 0 : options.data) != null ? _a2 : {};
22065
22127
  let basePath = path.dirname(options.src);
22066
22128
  basePath && basePath.lastIndexOf("/") !== basePath.length - 1 && (basePath += "/");
22067
- let imagePath = basePath + asset.meta.image;
22068
- imagePath = copySearchParams(imagePath, options.src);
22069
- const texture = (await loader.load([imagePath]))[imagePath], spritesheet = new Spritesheet(
22070
- texture.baseTexture,
22071
- asset,
22072
- options.src
22073
- );
22129
+ let texture;
22130
+ if (imageTexture && imageTexture.baseTexture)
22131
+ texture = imageTexture;
22132
+ else {
22133
+ const imagePath = copySearchParams(basePath + (imageFilename != null ? imageFilename : asset.meta.image), options.src);
22134
+ texture = (await loader.load([imagePath]))[imagePath];
22135
+ }
22136
+ const spritesheet = new Spritesheet({
22137
+ texture: texture.baseTexture,
22138
+ data: asset,
22139
+ resolutionFilename: options.src,
22140
+ cachePrefix
22141
+ });
22074
22142
  await spritesheet.parse();
22075
- const multiPacks = (_a2 = asset == null ? void 0 : asset.meta) == null ? void 0 : _a2.related_multi_packs;
22143
+ const multiPacks = (_b = asset == null ? void 0 : asset.meta) == null ? void 0 : _b.related_multi_packs;
22076
22144
  if (Array.isArray(multiPacks)) {
22077
22145
  const promises = [];
22078
22146
  for (const item of multiPacks) {
22079
22147
  if (typeof item != "string")
22080
22148
  continue;
22081
22149
  let itemUrl = basePath + item;
22082
- (_b = options.data) != null && _b.ignoreMultiPack || (itemUrl = copySearchParams(itemUrl, options.src), promises.push(loader.load({
22150
+ (_c = options.data) != null && _c.ignoreMultiPack || (itemUrl = copySearchParams(itemUrl, options.src), promises.push(loader.load({
22083
22151
  src: itemUrl,
22084
22152
  data: {
22085
22153
  ignoreMultiPack: !0