pixi.js 7.3.0 → 7.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  PixiJS — The HTML5 Creation Engine
2
2
  =============
3
3
 
4
- ![pixi.js logo](https://pixijs.download/pixijs-banner-no-version.png?v=1)
4
+ ![PixiJS logo](https://files.pixijs.download/branding/pixijs-banner.png)
5
5
 
6
6
  The aim of this project is to provide a fast lightweight 2D library that works
7
7
  across all devices. The PixiJS renderer allows everyone to enjoy the power of
package/dist/pixi.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * pixi.js - v7.3.0
3
- * Compiled Mon, 18 Sep 2023 15:35:01 UTC
2
+ * pixi.js - v7.3.2
3
+ * Compiled Fri, 20 Oct 2023 15:28:31 UTC
4
4
  *
5
5
  * pixi.js is licensed under the MIT License.
6
6
  * http://www.opensource.org/licenses/mit-license
@@ -4620,7 +4620,10 @@ void main(void){
4620
4620
  if (!maxFragmentPrecision) {
4621
4621
  maxFragmentPrecision = PRECISION.MEDIUM;
4622
4622
  const gl = getTestContext();
4623
- gl && gl.getShaderPrecisionFormat && (maxFragmentPrecision = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).precision ? PRECISION.HIGH : PRECISION.MEDIUM);
4623
+ if (gl && gl.getShaderPrecisionFormat) {
4624
+ const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);
4625
+ shaderFragment && (maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM);
4626
+ }
4624
4627
  }
4625
4628
  return maxFragmentPrecision;
4626
4629
  }
@@ -8292,7 +8295,7 @@ void main(void)
8292
8295
  */
8293
8296
  run(options) {
8294
8297
  const { renderer } = this;
8295
- renderer.runners.init.emit(renderer.options), options.hello && console.log(`PixiJS 7.3.0 - ${renderer.rendererLogId} - https://pixijs.com`), renderer.resize(renderer.screen.width, renderer.screen.height);
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);
8296
8299
  }
8297
8300
  destroy() {
8298
8301
  }
@@ -10659,7 +10662,7 @@ void main(void)
10659
10662
  */
10660
10663
  _isSourcePlaying() {
10661
10664
  const source = this.source;
10662
- return !source.paused && !source.ended && this._isSourceReady();
10665
+ return !source.paused && !source.ended;
10663
10666
  }
10664
10667
  /**
10665
10668
  * Returns true if the underlying source is ready for playing.
@@ -10762,7 +10765,7 @@ void main(void)
10762
10765
  this.disposeRunner.emit(this, !1);
10763
10766
  }
10764
10767
  }
10765
- const VERSION = "7.3.0";
10768
+ const VERSION = "7.3.2";
10766
10769
  class Bounds {
10767
10770
  constructor() {
10768
10771
  this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, this.rect = null, this.updateID = -1;
@@ -11684,7 +11687,11 @@ void main(void)
11684
11687
  return;
11685
11688
  this._transformTrimmedID = this.transform._worldID, this._textureTrimmedID = this._texture._updateID;
11686
11689
  const texture = this._texture, vertexData = this.vertexTrimmedData, orig = texture.orig, anchor = this._anchor, wt = this.transform.worldTransform, a2 = wt.a, b2 = wt.b, c2 = wt.c, d2 = wt.d, tx = wt.tx, ty = wt.ty, w1 = -anchor._x * orig.width, w0 = w1 + orig.width, h1 = -anchor._y * orig.height, h0 = h1 + orig.height;
11687
- vertexData[0] = a2 * w1 + c2 * h1 + tx, vertexData[1] = d2 * h1 + b2 * w1 + ty, vertexData[2] = a2 * w0 + c2 * h1 + tx, vertexData[3] = d2 * h1 + b2 * w0 + ty, vertexData[4] = a2 * w0 + c2 * h0 + tx, vertexData[5] = d2 * h0 + b2 * w0 + ty, vertexData[6] = a2 * w1 + c2 * h0 + tx, vertexData[7] = d2 * h0 + b2 * w1 + ty;
11690
+ if (vertexData[0] = a2 * w1 + c2 * h1 + tx, vertexData[1] = d2 * h1 + b2 * w1 + ty, vertexData[2] = a2 * w0 + c2 * h1 + tx, vertexData[3] = d2 * h1 + b2 * w0 + ty, vertexData[4] = a2 * w0 + c2 * h0 + tx, vertexData[5] = d2 * h0 + b2 * w0 + ty, vertexData[6] = a2 * w1 + c2 * h0 + tx, vertexData[7] = d2 * h0 + b2 * w1 + ty, this._roundPixels) {
11691
+ const resolution = settings.RESOLUTION;
11692
+ for (let i2 = 0; i2 < vertexData.length; ++i2)
11693
+ vertexData[i2] = Math.round(vertexData[i2] * resolution) / resolution;
11694
+ }
11688
11695
  }
11689
11696
  /**
11690
11697
  *
@@ -11757,7 +11764,7 @@ void main(void)
11757
11764
  * @default false
11758
11765
  */
11759
11766
  set roundPixels(value) {
11760
- this._roundPixels !== value && (this._transformID = -1), this._roundPixels = value;
11767
+ this._roundPixels !== value && (this._transformID = -1, this._transformTrimmedID = -1), this._roundPixels = value;
11761
11768
  }
11762
11769
  get roundPixels() {
11763
11770
  return this._roundPixels;
@@ -13762,7 +13769,7 @@ void main()
13762
13769
  }
13763
13770
  }
13764
13771
  const isInteractiveMode = this._isInteractive(eventMode), isInteractiveTarget = currentTarget.isInteractive();
13765
- return isInteractiveTarget && isInteractiveTarget && this._allInteractiveElements.push(currentTarget), ignore || this._hitElements.length > 0 ? null : shouldReturn ? this._hitElements : isInteractiveMode && !pruneFn(currentTarget, location) && testFn(currentTarget, location) ? isInteractiveTarget ? [currentTarget] : [] : null;
13772
+ return isInteractiveMode && isInteractiveTarget && this._allInteractiveElements.push(currentTarget), ignore || this._hitElements.length > 0 ? null : shouldReturn ? this._hitElements : isInteractiveMode && !pruneFn(currentTarget, location) && testFn(currentTarget, location) ? isInteractiveTarget ? [currentTarget] : [] : null;
13766
13773
  }
13767
13774
  /**
13768
13775
  * Recursive implementation for {@link PIXI.EventBoundary.hitTest hitTest}.
@@ -15449,7 +15456,7 @@ void main()
15449
15456
  const tempURL = url2.split("?")[0], ext = path.extname(tempURL).toLowerCase();
15450
15457
  return Array.isArray(extension) ? extension.includes(ext) : ext === extension;
15451
15458
  }
15452
- const convertToList = (input, transform) => (Array.isArray(input) || (input = [input]), transform ? input.map((item) => typeof item == "string" ? transform(item) : item) : input), copySearchParams = (targetUrl, sourceUrl) => {
15459
+ const convertToList = (input, transform, forceTransform = !1) => (Array.isArray(input) || (input = [input]), transform ? input.map((item) => typeof item == "string" || forceTransform ? transform(item) : item) : input), copySearchParams = (targetUrl, sourceUrl) => {
15453
15460
  const searchParams = sourceUrl.split("?")[1];
15454
15461
  return searchParams && (targetUrl += `?${searchParams}`), targetUrl;
15455
15462
  };
@@ -15719,6 +15726,10 @@ ${e2}`);
15719
15726
  let fontFamilyName = nameTokens.join(" ");
15720
15727
  return valid || (fontFamilyName = `"${fontFamilyName.replace(/[\\"]/g, "\\$&")}"`), fontFamilyName;
15721
15728
  }
15729
+ const validURICharactersRegex = /^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;
15730
+ function encodeURIWhenNeeded(uri) {
15731
+ return validURICharactersRegex.test(uri) ? uri : encodeURI(uri);
15732
+ }
15722
15733
  const loadWebFont = {
15723
15734
  extension: {
15724
15735
  type: ExtensionType.LoadParser,
@@ -15734,7 +15745,7 @@ ${e2}`);
15734
15745
  if (fonts) {
15735
15746
  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 : {};
15736
15747
  for (let i2 = 0; i2 < weights.length; i2++) {
15737
- const weight = weights[i2], font = new FontFace(name, `url(${encodeURI(url2)})`, __spreadProps$2(__spreadValues$8({}, data), {
15748
+ const weight = weights[i2], font = new FontFace(name, `url(${encodeURIWhenNeeded(url2)})`, __spreadProps$2(__spreadValues$8({}, data), {
15738
15749
  weight
15739
15750
  }));
15740
15751
  await font.load(), fonts.add(font), fontFaces.push(font);
@@ -16151,6 +16162,24 @@ ${e2}`);
16151
16162
  this._defaultSearchParams = Object.keys(queryValues).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(queryValues[key])}`).join("&");
16152
16163
  }
16153
16164
  }
16165
+ /**
16166
+ * Returns the aliases for a given asset
16167
+ * @param asset - the asset to get the aliases for
16168
+ */
16169
+ getAlias(asset) {
16170
+ const { alias, name, src, srcs } = asset;
16171
+ return convertToList(
16172
+ alias || name || src || srcs,
16173
+ (value) => {
16174
+ var _a2;
16175
+ return typeof value == "string" ? value : Array.isArray(value) ? value.map((v2) => {
16176
+ var _a22, _b;
16177
+ return (_b = (_a22 = v2 == null ? void 0 : v2.src) != null ? _a22 : v2 == null ? void 0 : v2.srcs) != null ? _b : v2;
16178
+ }) : value != null && value.src || value != null && value.srcs ? (_a2 = value.src) != null ? _a2 : value.srcs : value;
16179
+ },
16180
+ !0
16181
+ );
16182
+ }
16154
16183
  /**
16155
16184
  * Add a manifest to the asset resolver. This is a nice way to add all the asset information in one go.
16156
16185
  * generally a manifest would be built using a tool.
@@ -16215,38 +16244,6 @@ ${e2}`);
16215
16244
  assetNames.push(...aliases);
16216
16245
  }), this._bundles[bundleId] = assetNames;
16217
16246
  }
16218
- /**
16219
- * Tells the resolver what keys are associated with witch asset.
16220
- * The most important thing the resolver does
16221
- * @example
16222
- * // Single key, single asset:
16223
- * resolver.add({alias: 'foo', src: 'bar.png');
16224
- * resolver.resolveUrl('foo') // => 'bar.png'
16225
- *
16226
- * // Multiple keys, single asset:
16227
- * resolver.add({alias: ['foo', 'boo'], src: 'bar.png'});
16228
- * resolver.resolveUrl('foo') // => 'bar.png'
16229
- * resolver.resolveUrl('boo') // => 'bar.png'
16230
- *
16231
- * // Multiple keys, multiple assets:
16232
- * resolver.add({alias: ['foo', 'boo'], src: ['bar.png', 'bar.webp']});
16233
- * resolver.resolveUrl('foo') // => 'bar.png'
16234
- *
16235
- * // Add custom data attached to the resolver
16236
- * Resolver.add({
16237
- * alias: 'bunnyBooBooSmooth',
16238
- * src: 'bunny{png,webp}',
16239
- * data: { scaleMode:SCALE_MODES.NEAREST }, // Base texture options
16240
- * });
16241
- *
16242
- * resolver.resolve('bunnyBooBooSmooth') // => { src: 'bunny.png', data: { scaleMode: SCALE_MODES.NEAREST } }
16243
- * @param aliases - the key or keys that you will reference when loading this asset
16244
- * @param srcs - the asset or assets that will be chosen from when loading via the specified key
16245
- * @param data - asset-specific data that will be passed to the loaders
16246
- * - Useful if you want to initiate loaded objects with specific data
16247
- * @param format - the format of the asset
16248
- * @param loadParser - the name of the load parser to use
16249
- */
16250
16247
  add(aliases, srcs, data, format2, loadParser) {
16251
16248
  const assets = [];
16252
16249
  typeof aliases == "string" || Array.isArray(aliases) && typeof aliases[0] == "string" ? (deprecation("7.2.0", `Assets.add now uses an object instead of individual parameters.
@@ -16255,10 +16252,10 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16255
16252
  keyCheck = (key) => {
16256
16253
  this.hasKey(key) && console.warn(`[Resolver] already has key: ${key} overwriting`);
16257
16254
  }, convertToList(assets).forEach((asset) => {
16258
- const { alias, name, src, srcs: srcs2 } = asset;
16255
+ const { src, srcs: srcs2 } = asset;
16259
16256
  let { data: data2, format: format22, loadParser: loadParser2 } = asset;
16260
- const srcsToUse = convertToList(src || srcs2).map((src2) => typeof src2 == "string" ? createStringVariations(src2) : Array.isArray(src2) ? src2 : [src2]), aliasesToUse = convertToList(alias || name);
16261
- Array.isArray(alias) ? alias.forEach(keyCheck) : keyCheck(alias);
16257
+ const srcsToUse = convertToList(src || srcs2).map((src2) => typeof src2 == "string" ? createStringVariations(src2) : Array.isArray(src2) ? src2 : [src2]), aliasesToUse = this.getAlias(asset);
16258
+ Array.isArray(aliasesToUse) ? aliasesToUse.forEach(keyCheck) : keyCheck(aliasesToUse);
16262
16259
  const resolvedAssets = [];
16263
16260
  srcsToUse.forEach((srcs3) => {
16264
16261
  srcs3.forEach((src2) => {
@@ -16275,6 +16272,8 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16275
16272
  }
16276
16273
  } else
16277
16274
  data2 = (_a2 = src2.data) != null ? _a2 : data2, format22 = (_b = src2.format) != null ? _b : format22, loadParser2 = (_c = src2.loadParser) != null ? _c : loadParser2, formattedAsset = __spreadValues$4(__spreadValues$4({}, formattedAsset), src2);
16275
+ if (!aliasesToUse)
16276
+ throw new Error(`[Resolver] alias is undefined for this asset: ${formattedAsset.src}`);
16278
16277
  formattedAsset = this.buildResolvedAsset(formattedAsset, {
16279
16278
  aliases: aliasesToUse,
16280
16279
  data: data2,
@@ -16282,8 +16281,8 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16282
16281
  loadParser: loadParser2
16283
16282
  }), resolvedAssets.push(formattedAsset);
16284
16283
  });
16285
- }), aliasesToUse.forEach((alias2) => {
16286
- this._assetMap[alias2] = resolvedAssets;
16284
+ }), aliasesToUse.forEach((alias) => {
16285
+ this._assetMap[alias] = resolvedAssets;
16287
16286
  });
16288
16287
  });
16289
16288
  }
@@ -16299,12 +16298,12 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16299
16298
  * name: 'load-screen',
16300
16299
  * assets: [
16301
16300
  * {
16302
- * name: 'background',
16303
- * srcs: 'sunset.png',
16301
+ * alias: 'background',
16302
+ * src: 'sunset.png',
16304
16303
  * },
16305
16304
  * {
16306
- * name: 'bar',
16307
- * srcs: 'load-bar.{png,webp}',
16305
+ * alias: 'bar',
16306
+ * src: 'load-bar.{png,webp}',
16308
16307
  * },
16309
16308
  * ],
16310
16309
  * },
@@ -16312,12 +16311,12 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16312
16311
  * name: 'game-screen',
16313
16312
  * assets: [
16314
16313
  * {
16315
- * name: 'character',
16316
- * srcs: 'robot.png',
16314
+ * alias: 'character',
16315
+ * src: 'robot.png',
16317
16316
  * },
16318
16317
  * {
16319
- * name: 'enemy',
16320
- * srcs: 'bad-guy.png',
16318
+ * alias: 'enemy',
16319
+ * src: 'bad-guy.png',
16321
16320
  * },
16322
16321
  * ],
16323
16322
  * },
@@ -16424,7 +16423,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16424
16423
  buildResolvedAsset(formattedAsset, data) {
16425
16424
  var _a2;
16426
16425
  const { aliases, data: assetData, loadParser, format: format2 } = data;
16427
- return (this._basePath || this._rootPath) && (formattedAsset.src = path.toAbsolute(formattedAsset.src, this._basePath, this._rootPath)), formattedAsset.alias = (_a2 = aliases != null ? aliases : formattedAsset.alias) != null ? _a2 : [formattedAsset.src], formattedAsset.src = this._appendDefaultSearchParams(formattedAsset.src), formattedAsset.data = __spreadValues$4(__spreadValues$4({}, assetData || {}), formattedAsset.data), formattedAsset.loadParser = loadParser != null ? loadParser : formattedAsset.loadParser, formattedAsset.format = format2 != null ? format2 : formattedAsset.src.split(".").pop(), formattedAsset.srcs = formattedAsset.src, formattedAsset.name = formattedAsset.alias, formattedAsset;
16426
+ return (this._basePath || this._rootPath) && (formattedAsset.src = path.toAbsolute(formattedAsset.src, this._basePath, this._rootPath)), formattedAsset.alias = (_a2 = aliases != null ? aliases : formattedAsset.alias) != null ? _a2 : [formattedAsset.src], formattedAsset.src = this._appendDefaultSearchParams(formattedAsset.src), formattedAsset.data = __spreadValues$4(__spreadValues$4({}, assetData || {}), formattedAsset.data), formattedAsset.loadParser = loadParser != null ? loadParser : formattedAsset.loadParser, formattedAsset.format = format2 != null ? format2 : path.extname(formattedAsset.src).slice(1), formattedAsset.srcs = formattedAsset.src, formattedAsset.name = formattedAsset.alias, formattedAsset;
16428
16427
  }
16429
16428
  }
16430
16429
  class AssetsClass {
@@ -16460,51 +16459,6 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16460
16459
  }
16461
16460
  }), options.preferences && this.setPreferences(options.preferences);
16462
16461
  }
16463
- /**
16464
- * Allows you to specify how to resolve any assets load requests.
16465
- * There are a few ways to add things here as shown below:
16466
- * @example
16467
- * import { Assets } from 'pixi.js';
16468
- *
16469
- * // Simple
16470
- * Assets.add({alias: 'bunnyBooBoo', src: 'bunny.png'});
16471
- * const bunny = await Assets.load('bunnyBooBoo');
16472
- *
16473
- * // Multiple keys:
16474
- * Assets.add({alias: ['burger', 'chicken'], src: 'bunny.png'});
16475
- *
16476
- * const bunny = await Assets.load('burger');
16477
- * const bunny2 = await Assets.load('chicken');
16478
- *
16479
- * // passing options to to the object
16480
- * Assets.add({
16481
- * alias: 'bunnyBooBooSmooth',
16482
- * src: 'bunny{png,webp}',
16483
- * data: { scaleMode: SCALE_MODES.NEAREST }, // Base texture options
16484
- * });
16485
- *
16486
- * // Multiple assets
16487
- *
16488
- * // The following all do the same thing:
16489
- *
16490
- * Assets.add({alias: 'bunnyBooBoo', src: 'bunny{png,webp}'});
16491
- *
16492
- * Assets.add({
16493
- * alias: 'bunnyBooBoo',
16494
- * src: [
16495
- * 'bunny.png',
16496
- * 'bunny.webp',
16497
- * ],
16498
- * });
16499
- *
16500
- * const bunny = await Assets.load('bunnyBooBoo'); // Will try to load WebP if available
16501
- * @param aliases - the key or keys that you will reference when loading this asset
16502
- * @param srcs - the asset or assets that will be chosen from when loading via the specified key
16503
- * @param data - asset-specific data that will be passed to the loaders
16504
- * - Useful if you want to initiate loaded objects with specific data
16505
- * @param format - the format of the asset
16506
- * @param loadParser - the name of the load parser to use
16507
- */
16508
16462
  add(aliases, srcs, data, format2, loadParser) {
16509
16463
  this.resolver.add(aliases, srcs, data, format2, loadParser);
16510
16464
  }
@@ -16512,9 +16466,8 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16512
16466
  this._initialized || await this.init();
16513
16467
  const singleAsset = isSingleItem(urls), urlArray = convertToList(urls).map((url2) => {
16514
16468
  if (typeof url2 != "string") {
16515
- this.add(url2);
16516
- const srcs = url2.src || url2.srcs, aliases = url2.alias || url2.name;
16517
- return aliases && Array.isArray(aliases) ? aliases[0] : srcs && Array.isArray(srcs) ? srcs[0] : aliases || srcs;
16469
+ const aliases = this.resolver.getAlias(url2);
16470
+ return aliases.some((alias) => !this.resolver.hasKey(alias)) && this.add(url2), Array.isArray(aliases) ? aliases[0] : aliases;
16518
16471
  }
16519
16472
  return this.resolver.hasKey(url2) || this.add({ alias: url2, src: url2 }), url2;
16520
16473
  }), resolveResults = this.resolver.resolve(urlArray), out = await this._mapLoadToResolve(resolveResults, onProgress);
@@ -16553,12 +16506,12 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16553
16506
  * name: 'load-screen',
16554
16507
  * assets: [
16555
16508
  * {
16556
- * name: 'background',
16557
- * srcs: 'sunset.png',
16509
+ * alias: 'background',
16510
+ * src: 'sunset.png',
16558
16511
  * },
16559
16512
  * {
16560
- * name: 'bar',
16561
- * srcs: 'load-bar.{png,webp}',
16513
+ * alias: 'bar',
16514
+ * src: 'load-bar.{png,webp}',
16562
16515
  * },
16563
16516
  * ],
16564
16517
  * },
@@ -16566,12 +16519,12 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16566
16519
  * name: 'game-screen',
16567
16520
  * assets: [
16568
16521
  * {
16569
- * name: 'character',
16570
- * srcs: 'robot.png',
16522
+ * alias: 'character',
16523
+ * src: 'robot.png',
16571
16524
  * },
16572
16525
  * {
16573
- * name: 'enemy',
16574
- * srcs: 'bad-guy.png',
16526
+ * alias: 'enemy',
16527
+ * src: 'bad-guy.png',
16575
16528
  * },
16576
16529
  * ],
16577
16530
  * },
@@ -16808,22 +16761,36 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16808
16761
  }
16809
16762
  };
16810
16763
  extensions$1.add(cacheTextureArray);
16811
- const detectAvif = {
16812
- extension: {
16813
- type: ExtensionType.DetectionParser,
16814
- priority: 1
16815
- },
16816
- test: async () => {
16817
- const avifData = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=";
16764
+ async function testImageFormat(imageData) {
16765
+ if ("Image" in globalThis)
16818
16766
  return new Promise((resolve2) => {
16819
- const avif = new Image();
16820
- avif.onload = () => {
16767
+ const image = new Image();
16768
+ image.onload = () => {
16821
16769
  resolve2(!0);
16822
- }, avif.onerror = () => {
16770
+ }, image.onerror = () => {
16823
16771
  resolve2(!1);
16824
- }, avif.src = avifData;
16772
+ }, image.src = imageData;
16825
16773
  });
16774
+ if ("createImageBitmap" in globalThis && "fetch" in globalThis) {
16775
+ try {
16776
+ const blob = await (await fetch(imageData)).blob();
16777
+ await createImageBitmap(blob);
16778
+ } catch (e2) {
16779
+ return !1;
16780
+ }
16781
+ return !0;
16782
+ }
16783
+ return !1;
16784
+ }
16785
+ const detectAvif = {
16786
+ extension: {
16787
+ type: ExtensionType.DetectionParser,
16788
+ priority: 1
16826
16789
  },
16790
+ test: async () => testImageFormat(
16791
+ // eslint-disable-next-line max-len
16792
+ "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="
16793
+ ),
16827
16794
  add: async (formats2) => [...formats2, "avif"],
16828
16795
  remove: async (formats2) => formats2.filter((f2) => f2 !== "avif")
16829
16796
  };
@@ -16833,17 +16800,9 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16833
16800
  type: ExtensionType.DetectionParser,
16834
16801
  priority: 0
16835
16802
  },
16836
- test: async () => {
16837
- const webpData = "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=";
16838
- return new Promise((resolve2) => {
16839
- const webp = new Image();
16840
- webp.onload = () => {
16841
- resolve2(!0);
16842
- }, webp.onerror = () => {
16843
- resolve2(!1);
16844
- }, webp.src = webpData;
16845
- });
16846
- },
16803
+ test: async () => testImageFormat(
16804
+ "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="
16805
+ ),
16847
16806
  add: async (formats2) => [...formats2, "webp"],
16848
16807
  remove: async (formats2) => formats2.filter((f2) => f2 !== "webp")
16849
16808
  };
@@ -16899,7 +16858,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16899
16858
  var _a2, _b;
16900
16859
  return {
16901
16860
  resolution: parseFloat((_b = (_a2 = settings.RETINA_PREFIX.exec(value)) == null ? void 0 : _a2[1]) != null ? _b : "1"),
16902
- format: value.split(".").pop(),
16861
+ format: path.extname(value).slice(1),
16903
16862
  src: value
16904
16863
  };
16905
16864
  }
@@ -17420,12 +17379,13 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
17420
17379
  const resolveCompressedTextureUrl = {
17421
17380
  extension: ExtensionType.ResolveParser,
17422
17381
  test: (value) => {
17423
- const extension = value.split("?")[0].split(".").pop();
17382
+ const extension = path.extname(value).slice(1);
17424
17383
  return ["basis", "ktx", "dds"].includes(extension);
17425
17384
  },
17426
17385
  parse: (value) => {
17427
17386
  var _a2, _b, _c, _d;
17428
- if (value.split("?")[0].split(".").pop() === "ktx") {
17387
+ const extension = path.extname(value).slice(1);
17388
+ if (extension === "ktx") {
17429
17389
  const extensions2 = [
17430
17390
  ".s3tc.ktx",
17431
17391
  ".s3tc_sRGB.ktx",
@@ -17444,7 +17404,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
17444
17404
  }
17445
17405
  return {
17446
17406
  resolution: parseFloat((_d = (_c = settings.RETINA_PREFIX.exec(value)) == null ? void 0 : _c[1]) != null ? _d : "1"),
17447
- format: value.split(".").pop(),
17407
+ format: extension,
17448
17408
  src: value
17449
17409
  };
17450
17410
  }