Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/compressed-textures

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/compressed-textures - npm Package Compare versions

Comparing version 5.4.0-rc.2 to 5.4.0-rc.3

6

dist/browser/compressed-textures.min.js
/*!
* @pixi/compressed-textures - v5.4.0-rc.2
* Compiled Tue, 17 Nov 2020 01:47:11 UTC
* @pixi/compressed-textures - v5.4.0-rc.3
* Compiled Thu, 10 Dec 2020 03:22:17 UTC
*

@@ -8,3 +8,3 @@ * @pixi/compressed-textures is licensed under the MIT License.

*/
this.PIXI=this.PIXI||{};var _pixi_compressed_textures=function(_,R,T,e){"use strict";var A,E;(E=_.INTERNAL_FORMATS||(_.INTERNAL_FORMATS={}))[E.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",E[E.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",E[E.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",E[E.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",E[E.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",E[E.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",E[E.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",E[E.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",E[E.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",E[E.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",E[E.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",E[E.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",E[E.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",E[E.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",E[E.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",E[E.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",E[E.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",E[E.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",E[E.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",E[E.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",E[E.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",E[E.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",E[E.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL";var O=((A={})[_.INTERNAL_FORMATS.COMPRESSED_RGB_S3TC_DXT1_EXT]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT]=1,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT]=1,A[_.INTERNAL_FORMATS.COMPRESSED_SRGB_S3TC_DXT1_EXT]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=1,A[_.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=1,A[_.INTERNAL_FORMATS.COMPRESSED_R11_EAC]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_SIGNED_R11_EAC]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RG11_EAC]=1,A[_.INTERNAL_FORMATS.COMPRESSED_SIGNED_RG11_EAC]=1,A[_.INTERNAL_FORMATS.COMPRESSED_RGB8_ETC2]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA8_ETC2_EAC]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_SRGB8_ETC2]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=.25,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=.25,A[_.INTERNAL_FORMATS.COMPRESSED_RGB_ETC1_WEBGL]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGB_ATC_WEBGL]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=1,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=1,A),S=function(_,R){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,R){_.__proto__=R}||function(_,R){for(var T in R)R.hasOwnProperty(T)&&(_[T]=R[T])})(_,R)};function G(_,R){function T(){this.constructor=_}S(_,R),_.prototype=null===R?Object.create(R):(T.prototype=R.prototype,new T)}function M(_,R){var T,e,A,E,O={label:0,sent:function(){if(1&A[0])throw A[1];return A[1]},trys:[],ops:[]};return E={next:S(0),throw:S(1),return:S(2)},"function"==typeof Symbol&&(E[Symbol.iterator]=function(){return this}),E;function S(E){return function(S){return function(E){if(T)throw new TypeError("Generator is already executing.");for(;O;)try{if(T=1,e&&(A=2&E[0]?e.return:E[0]?e.throw||((A=e.return)&&A.call(e),0):e.next)&&!(A=A.call(e,E[1])).done)return A;switch(e=0,A&&(E=[2&E[0],A.value]),E[0]){case 0:case 1:A=E;break;case 4:return O.label++,{value:E[1],done:!1};case 5:O.label++,e=E[1],E=[0];continue;case 7:E=O.ops.pop(),O.trys.pop();continue;default:if(!(A=(A=O.trys).length>0&&A[A.length-1])&&(6===E[0]||2===E[0])){O=0;continue}if(3===E[0]&&(!A||E[1]>A[0]&&E[1]<A[3])){O.label=E[1];break}if(6===E[0]&&O.label<A[1]){O.label=A[1],A=E;break}if(A&&O.label<A[2]){O.label=A[2],O.ops.push(E);break}A[2]&&O.ops.pop(),O.trys.pop();continue}E=R.call(_,O)}catch(_){E=[6,_],e=0}finally{T=A=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}([E,S])}}}var t,r,D=function(_){function T(T,e){void 0===e&&(e={width:1,height:1,autoLoad:!0});var A,E,O=this;return"string"==typeof T?(A=T,E=new Uint8Array):(A=null,E=T),(O=_.call(this,E,e)||this).origin=A,O.buffer=E?new R.ViewableBuffer(E):null,O.origin&&!1!==e.autoLoad&&O.load(),E&&E.length&&(O.loaded=!0,O.onBlobLoaded(O.buffer.rawBinaryData)),O}return G(T,_),T.prototype.onBlobLoaded=function(_){},T.prototype.load=function(){return _=this,T=void 0,e=Promise,A=function(){var _;return M(this,function(T){switch(T.label){case 0:return[4,fetch(this.origin)];case 1:return[4,T.sent().blob()];case 2:return[4,T.sent().arrayBuffer()];case 3:return _=T.sent(),this.data=new Uint32Array(_),this.buffer=new R.ViewableBuffer(_),this.loaded=!0,this.onBlobLoaded(_),this.update(),[2,this]}})},new(e||(e=Promise))(function(R,E){function O(_){try{G(A.next(_))}catch(_){E(_)}}function S(_){try{G(A.throw(_))}catch(_){E(_)}}function G(_){_.done?R(_.value):new e(function(R){R(_.value)}).then(O,S)}G((A=A.apply(_,T||[])).next())});var _,T,e,A},T}(R.BufferResource),I=function(_){function R(T,e){var A=_.call(this,T,e)||this;return A.format=e.format,A.levels=e.levels||1,A._width=e.width,A._height=e.height,A._extension=R._formatToExtension(A.format),(e.levelBuffers||A.buffer)&&(A._levelBuffers=e.levelBuffers||R._createLevelBuffers(T instanceof Uint8Array?T:A.buffer.uint8View,A.format,A.levels,4,4,A.width,A.height)),A}return G(R,_),R.prototype.upload=function(_,R,T){var e=_.gl;if(!_.context.extensions[this._extension])throw new Error(this._extension+" textures are not supported on the current machine");if(!this._levelBuffers)return!1;for(var A=0,E=this.levels;A<E;A++){var O=this._levelBuffers[A],S=O.levelWidth,G=O.levelHeight,M=O.levelBuffer;e.compressedTexImage2D(e.TEXTURE_2D,0,this.format,S,G,0,M)}return!0},R.prototype.onBlobLoaded=function(){this._levelBuffers=R._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)},R._formatToExtension=function(_){if(_>=33776&&_<=33779)return"s3tc";if(_>=37488&&_<=37497)return"etc";if(_>=35840&&_<=35843)return"pvrtc";if(_>=36196)return"etc1";if(_>=35986&&_<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},R._createLevelBuffers=function(_,R,T,e,A,E,S){for(var G=new Array(T),M=_.byteOffset,t=E,r=S,D=t+e-1&~(e-1),I=r+A-1&~(A-1),X=D*I*O[R],n=0;n<T;n++)G[n]={levelWidth:T>1?t:D,levelHeight:T>1?r:I,levelBuffer:new Uint8Array(_.buffer,M,X)},M+=X,X=(D=(t=t>>1||1)+e-1&~(e-1))*(I=(r=r>>1||1)+A-1&~(A-1))*O[R];return G},R}(D),X=function(){function _(){}return _.use=function(R,e){var A=R.data;if(_.textureExtensions||_.autoDetectExtensions(),R.type===T.LoaderResource.TYPE.JSON&&A&&A.cacheID&&A.textures){for(var E=A.textures,O=void 0,S=void 0,G=0,M=E.length;G<M;G++){var t=E[G],r=t.src,D=t.format;if(D||(S=r),_.textureFormats[D]){O=r;break}}if(!(O=O||S))throw new Error("Cannot load compressed-textures in "+R.url+", make sure you provide a fallback");if(O===R.url)throw new Error("URL of compressed texture cannot be the same as the manifest's URL");var I={crossOrigin:R.crossOrigin,metadata:R.metadata.imageMetadata,parentResource:R};this.add(A.cacheID,O,I,function(){e()})}else e()},_.autoDetectExtensions=function(R){if(!R){var T=document.createElement("canvas").getContext("webgl");if(!T)return void console.error("WebGL not available for compressed textures. Silently failing.");R={s3tc:T.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:T.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:T.getExtension("WEBGL_compressed_texture_etc"),etc1:T.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:T.getExtension("WEBGL_compressed_texture_pvrtc")||T.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:T.getExtension("WEBGL_compressed_texture_atc"),astc:T.getExtension("WEBGL_compressed_texture_astc")}}for(var e in _.textureExtensions=R,_.textureFormats={},R){var A=R[e];A&&Object.assign(_.textureFormats,Object.getPrototypeOf(A))}},_}();function n(_,T){T&&T.forEach(function(T,A){var E=new R.BaseTexture(T,{mipmap:e.MIPMAP_MODES.OFF,alphaMode:e.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA}),O=_+"-"+(A+1);R.BaseTexture.addToCache(E,O),R.Texture.addToCache(new R.Texture(E),O),0===A&&(R.BaseTexture.addToCache(E,_),R.Texture.addToCache(new R.Texture(E),_))})}T.LoaderResource.setExtensionXhrType("dds",T.LoaderResource.XHR_RESPONSE_TYPE.BUFFER);var F,o,B=3,a=4,N=7,P=19,i=2,C=0,s=1,u=2,L=3;!function(_){_[_.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",_[_.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",_[_.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",_[_.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",_[_.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",_[_.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",_[_.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",_[_.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",_[_.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",_[_.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",_[_.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",_[_.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",_[_.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",_[_.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",_[_.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",_[_.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",_[_.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",_[_.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",_[_.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",_[_.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",_[_.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",_[_.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",_[_.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",_[_.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",_[_.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",_[_.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",_[_.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",_[_.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",_[_.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",_[_.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",_[_.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",_[_.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",_[_.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",_[_.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",_[_.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",_[_.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",_[_.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",_[_.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",_[_.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",_[_.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",_[_.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",_[_.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",_[_.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",_[_.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",_[_.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",_[_.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",_[_.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",_[_.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",_[_.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",_[_.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",_[_.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",_[_.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",_[_.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",_[_.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",_[_.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",_[_.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",_[_.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",_[_.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",_[_.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",_[_.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",_[_.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",_[_.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",_[_.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",_[_.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",_[_.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",_[_.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",_[_.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",_[_.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",_[_.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",_[_.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",_[_.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",_[_.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",_[_.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",_[_.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",_[_.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",_[_.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",_[_.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",_[_.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",_[_.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",_[_.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",_[_.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",_[_.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",_[_.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",_[_.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",_[_.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",_[_.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",_[_.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",_[_.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",_[_.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",_[_.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",_[_.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",_[_.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",_[_.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",_[_.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",_[_.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",_[_.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",_[_.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",_[_.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",_[_.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",_[_.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",_[_.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",_[_.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",_[_.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",_[_.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",_[_.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",_[_.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",_[_.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",_[_.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",_[_.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",_[_.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",_[_.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",_[_.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",_[_.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",_[_.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",_[_.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",_[_.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",_[_.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",_[_.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",_[_.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",_[_.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",_[_.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",_[_.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT"}(F||(F={})),function(_){_[_.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",_[_.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",_[_.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D"}(o||(o={}));var f,U,c,l=((t={})[827611204]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,t[861165636]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,t[894720068]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,t),d=((r={})[F.DXGI_FORMAT_BC1_TYPELESS]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,r[F.DXGI_FORMAT_BC1_UNORM]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,r[F.DXGI_FORMAT_BC2_TYPELESS]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,r[F.DXGI_FORMAT_BC2_UNORM]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,r[F.DXGI_FORMAT_BC3_TYPELESS]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,r[F.DXGI_FORMAT_BC3_UNORM]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,r[F.DXGI_FORMAT_BC1_UNORM_SRGB]=_.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,r[F.DXGI_FORMAT_BC2_UNORM_SRGB]=_.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,r[F.DXGI_FORMAT_BC3_UNORM_SRGB]=_.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,r),h=function(){function _(){}return _.use=function(R,T){"dds"===R.extension&&R.data&&n(R.name||R.url,_.parse(R.data)),T()},_.parse=function(_){var R=new Uint32Array(_);if(542327876!==R[0])throw new Error("Invalid DDS file magic word");var T=new Uint32Array(_,0,124/Uint32Array.BYTES_PER_ELEMENT),e=T[B],A=T[a],E=T[N],S=new Uint32Array(_,P*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),G=S[1];if(4&G){var M=S[i];if(808540228!==M){var t=l[M],r=new Uint8Array(_,128);return[new I(r,{format:t,width:A,height:e,levels:E})]}var D=new Uint32Array(R.buffer,128,20/Uint32Array.BYTES_PER_ELEMENT),X=D[C],n=D[s],F=D[u],f=D[L],U=d[X];if(void 0===U)throw new Error("DDSLoader cannot parse texture data with DXGI format "+X);if(4===F)throw new Error("DDSLoader does not support cubemap textures");if(n===o.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSLoader does not supported 3D texture data");var c=new Array;if(1===f)c.push(new Uint8Array(_,148));else{for(var h=O[U],p=0,v=A,w=e,Y=0;Y<E;Y++){p+=Math.max(1,v+3&-4)*Math.max(1,w+3&-4)*h,v>>>=1,w>>>=1}var x=148;for(Y=0;Y<f;Y++)c.push(new Uint8Array(_,x,p)),x+=p}return c.map(function(_){return new I(_,{format:U,width:A,height:e,levels:E})})}if(64&G)throw new Error("DDSLoader does not support uncompressed texture data.");if(512&G)throw new Error("DDSLoader does not supported YUV uncompressed texture data.");if(131072&G)throw new Error("DDSLoader does not support single-channel (lumninance) texture data!");if(2&G)throw new Error("DDSLoader does not support single-channel (alpha) texture data!");throw new Error("DDSLoader failed to load a texture file due to an unknown reason!")},_}();T.LoaderResource.setExtensionXhrType("ktx",T.LoaderResource.XHR_RESPONSE_TYPE.BUFFER);var p=[171,75,84,88,32,49,49,187,13,10,26,10],v=12,w=16,Y=24,x=28,H=36,m=40,g=44,y=48,b=52,V=56,W=60,k=((f={})[e.TYPES.UNSIGNED_BYTE]=1,f[e.TYPES.UNSIGNED_SHORT]=2,f[e.TYPES.FLOAT]=4,f[e.TYPES.HALF_FLOAT]=8,f),K=((U={})[e.FORMATS.RGBA]=4,U[e.FORMATS.RGB]=3,U[e.FORMATS.LUMINANCE]=1,U[e.FORMATS.LUMINANCE_ALPHA]=2,U[e.FORMATS.ALPHA]=1,U),Q=((c={})[e.TYPES.UNSIGNED_SHORT_4_4_4_4]=2,c[e.TYPES.UNSIGNED_SHORT_5_5_5_1]=2,c[e.TYPES.UNSIGNED_SHORT_5_6_5]=2,c),j=function(){function _(){}return _.use=function(R,T){"ktx"===R.extension&&R.data&&_.parse(R.name||R.url,R.data),T()},_.parse=function(R,T){var e=new DataView(T);if(_.validate(R,e)){var A=67305985===e.getUint32(v,!0),E=e.getUint32(w,A),S=e.getUint32(Y,A),G=e.getUint32(x,A),M=e.getUint32(H,A),t=e.getUint32(m,A)||1,r=e.getUint32(g,A)||1,D=e.getUint32(y,A)||1,X=e.getUint32(b,A),F=e.getUint32(V,A),o=e.getUint32(W,A);if(0===t||1!==r)throw new Error("Only 2D textures are supported");if(1!==X)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(1!==D)throw new Error("WebGL does not support array textures");var B,a=M+3&-4,N=t+3&-4,P=new Array(D),i=M*t;if(0===E&&(i=a*N),void 0===(B=0!==E?k[E]?k[E]*K[S]:Q[E]:O[G]))throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");for(var C=i*B,s=M,u=t,L=a,f=N,U=64+o,c=0;c<F;c++){for(var l=e.getUint32(U,A),d=U+4,h=0;h<D;h++){var p=P[h];p||(p=P[h]=new Array(F)),p[c]={levelWidth:F>1?s:L,levelHeight:F>1?u:f,levelBuffer:new Uint8Array(T,d,C)},d+=C}U=(U+=l+4)%4!=0?U+4-U%4:U,C=(L=(s=s>>1||1)+4-1&-4)*(f=(u=u>>1||1)+4-1&-4)*B}if(0!==E)throw new Error("TODO: Uncompressed");n(R,P.map(function(_){return new I(null,{format:G,width:M,height:t,levels:F,levelBuffers:_})}))}},_.validate=function(_,R){for(var T=0;T<p.length;T++)if(R.getUint8(T)!==p[T])return console.error(_+" is not a valid *.ktx file!"),!1;return!0},_}();return _.BlobResource=D,_.CompressedTextureLoader=X,_.CompressedTextureResource=I,_.DDSLoader=h,_.FORMATS_TO_COMPONENTS=K,_.INTERNAL_FORMAT_TO_BYTES_PER_PIXEL=O,_.KTXLoader=j,_.TYPES_TO_BYTES_PER_COMPONENT=k,_.TYPES_TO_BYTES_PER_PIXEL=Q,_}({},PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_compressed_textures);
this.PIXI=this.PIXI||{};var _pixi_compressed_textures=function(_,R,T,e){"use strict";var A,E;(E=_.INTERNAL_FORMATS||(_.INTERNAL_FORMATS={}))[E.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",E[E.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",E[E.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",E[E.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",E[E.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",E[E.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",E[E.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",E[E.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",E[E.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",E[E.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",E[E.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",E[E.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",E[E.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",E[E.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",E[E.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",E[E.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",E[E.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",E[E.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",E[E.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",E[E.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",E[E.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",E[E.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",E[E.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",E[E.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL";var O=((A={})[_.INTERNAL_FORMATS.COMPRESSED_RGB_S3TC_DXT1_EXT]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT]=1,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT]=1,A[_.INTERNAL_FORMATS.COMPRESSED_SRGB_S3TC_DXT1_EXT]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=1,A[_.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=1,A[_.INTERNAL_FORMATS.COMPRESSED_R11_EAC]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_SIGNED_R11_EAC]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RG11_EAC]=1,A[_.INTERNAL_FORMATS.COMPRESSED_SIGNED_RG11_EAC]=1,A[_.INTERNAL_FORMATS.COMPRESSED_RGB8_ETC2]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA8_ETC2_EAC]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_SRGB8_ETC2]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=.25,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=.25,A[_.INTERNAL_FORMATS.COMPRESSED_RGB_ETC1_WEBGL]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGB_ATC_WEBGL]=.5,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=1,A[_.INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=1,A),S=function(_,R){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,R){_.__proto__=R}||function(_,R){for(var T in R)R.hasOwnProperty(T)&&(_[T]=R[T])})(_,R)};function G(_,R){function T(){this.constructor=_}S(_,R),_.prototype=null===R?Object.create(R):(T.prototype=R.prototype,new T)}function M(_,R){var T,e,A,E,O={label:0,sent:function(){if(1&A[0])throw A[1];return A[1]},trys:[],ops:[]};return E={next:S(0),throw:S(1),return:S(2)},"function"==typeof Symbol&&(E[Symbol.iterator]=function(){return this}),E;function S(E){return function(S){return function(E){if(T)throw new TypeError("Generator is already executing.");for(;O;)try{if(T=1,e&&(A=2&E[0]?e.return:E[0]?e.throw||((A=e.return)&&A.call(e),0):e.next)&&!(A=A.call(e,E[1])).done)return A;switch(e=0,A&&(E=[2&E[0],A.value]),E[0]){case 0:case 1:A=E;break;case 4:return O.label++,{value:E[1],done:!1};case 5:O.label++,e=E[1],E=[0];continue;case 7:E=O.ops.pop(),O.trys.pop();continue;default:if(!(A=(A=O.trys).length>0&&A[A.length-1])&&(6===E[0]||2===E[0])){O=0;continue}if(3===E[0]&&(!A||E[1]>A[0]&&E[1]<A[3])){O.label=E[1];break}if(6===E[0]&&O.label<A[1]){O.label=A[1],A=E;break}if(A&&O.label<A[2]){O.label=A[2],O.ops.push(E);break}A[2]&&O.ops.pop(),O.trys.pop();continue}E=R.call(_,O)}catch(_){E=[6,_],e=0}finally{T=A=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}([E,S])}}}var t,r,D=function(_){function T(T,e){void 0===e&&(e={width:1,height:1,autoLoad:!0});var A,E,O=this;return"string"==typeof T?(A=T,E=new Uint8Array):(A=null,E=T),(O=_.call(this,E,e)||this).origin=A,O.buffer=E?new R.ViewableBuffer(E):null,O.origin&&!1!==e.autoLoad&&O.load(),E&&E.length&&(O.loaded=!0,O.onBlobLoaded(O.buffer.rawBinaryData)),O}return G(T,_),T.prototype.onBlobLoaded=function(_){},T.prototype.load=function(){return _=this,T=void 0,e=Promise,A=function(){var _;return M(this,function(T){switch(T.label){case 0:return[4,fetch(this.origin)];case 1:return[4,T.sent().blob()];case 2:return[4,T.sent().arrayBuffer()];case 3:return _=T.sent(),this.data=new Uint32Array(_),this.buffer=new R.ViewableBuffer(_),this.loaded=!0,this.onBlobLoaded(_),this.update(),[2,this]}})},new(e||(e=Promise))(function(R,E){function O(_){try{G(A.next(_))}catch(_){E(_)}}function S(_){try{G(A.throw(_))}catch(_){E(_)}}function G(_){_.done?R(_.value):new e(function(R){R(_.value)}).then(O,S)}G((A=A.apply(_,T||[])).next())});var _,T,e,A},T}(R.BufferResource),I=function(_){function R(T,e){var A=_.call(this,T,e)||this;return A.format=e.format,A.levels=e.levels||1,A._width=e.width,A._height=e.height,A._extension=R._formatToExtension(A.format),(e.levelBuffers||A.buffer)&&(A._levelBuffers=e.levelBuffers||R._createLevelBuffers(T instanceof Uint8Array?T:A.buffer.uint8View,A.format,A.levels,4,4,A.width,A.height)),A}return G(R,_),R.prototype.upload=function(_,R,T){var e=_.gl;if(!_.context.extensions[this._extension])throw new Error(this._extension+" textures are not supported on the current machine");if(!this._levelBuffers)return!1;for(var A=0,E=this.levels;A<E;A++){var O=this._levelBuffers[A],S=O.levelID,G=O.levelWidth,M=O.levelHeight,t=O.levelBuffer;e.compressedTexImage2D(e.TEXTURE_2D,S,this.format,G,M,0,t)}return!0},R.prototype.onBlobLoaded=function(){this._levelBuffers=R._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)},R._formatToExtension=function(_){if(_>=33776&&_<=33779)return"s3tc";if(_>=37488&&_<=37497)return"etc";if(_>=35840&&_<=35843)return"pvrtc";if(_>=36196)return"etc1";if(_>=35986&&_<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},R._createLevelBuffers=function(_,R,T,e,A,E,S){for(var G=new Array(T),M=_.byteOffset,t=E,r=S,D=t+e-1&~(e-1),I=r+A-1&~(A-1),X=D*I*O[R],n=0;n<T;n++)G[n]={levelID:n,levelWidth:T>1?t:D,levelHeight:T>1?r:I,levelBuffer:new Uint8Array(_.buffer,M,X)},M+=X,X=(D=(t=t>>1||1)+e-1&~(e-1))*(I=(r=r>>1||1)+A-1&~(A-1))*O[R];return G},R}(D),X=function(){function _(){}return _.use=function(R,e){var A=R.data;if(_.textureExtensions||_.autoDetectExtensions(),R.type===T.LoaderResource.TYPE.JSON&&A&&A.cacheID&&A.textures){for(var E=A.textures,O=void 0,S=void 0,G=0,M=E.length;G<M;G++){var t=E[G],r=t.src,D=t.format;if(D||(S=r),_.textureFormats[D]){O=r;break}}if(!(O=O||S))throw new Error("Cannot load compressed-textures in "+R.url+", make sure you provide a fallback");if(O===R.url)throw new Error("URL of compressed texture cannot be the same as the manifest's URL");var I={crossOrigin:R.crossOrigin,metadata:R.metadata.imageMetadata,parentResource:R};this.add(A.cacheID,O,I,function(){e()})}else e()},_.autoDetectExtensions=function(R){if(!R){var T=document.createElement("canvas").getContext("webgl");if(!T)return void console.error("WebGL not available for compressed textures. Silently failing.");R={s3tc:T.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:T.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:T.getExtension("WEBGL_compressed_texture_etc"),etc1:T.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:T.getExtension("WEBGL_compressed_texture_pvrtc")||T.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:T.getExtension("WEBGL_compressed_texture_atc"),astc:T.getExtension("WEBGL_compressed_texture_astc")}}for(var e in _.textureExtensions=R,_.textureFormats={},R){var A=R[e];A&&Object.assign(_.textureFormats,Object.getPrototypeOf(A))}},_}();function n(_,T){T&&T.forEach(function(T,A){var E=new R.BaseTexture(T,{mipmap:e.MIPMAP_MODES.OFF,alphaMode:e.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA}),O=_+"-"+(A+1);R.BaseTexture.addToCache(E,O),R.Texture.addToCache(new R.Texture(E),O),0===A&&(R.BaseTexture.addToCache(E,_),R.Texture.addToCache(new R.Texture(E),_))})}T.LoaderResource.setExtensionXhrType("dds",T.LoaderResource.XHR_RESPONSE_TYPE.BUFFER);var F,o,B=3,a=4,N=7,P=19,i=2,C=0,s=1,u=2,L=3;!function(_){_[_.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",_[_.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",_[_.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",_[_.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",_[_.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",_[_.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",_[_.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",_[_.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",_[_.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",_[_.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",_[_.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",_[_.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",_[_.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",_[_.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",_[_.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",_[_.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",_[_.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",_[_.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",_[_.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",_[_.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",_[_.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",_[_.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",_[_.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",_[_.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",_[_.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",_[_.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",_[_.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",_[_.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",_[_.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",_[_.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",_[_.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",_[_.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",_[_.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",_[_.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",_[_.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",_[_.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",_[_.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",_[_.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",_[_.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",_[_.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",_[_.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",_[_.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",_[_.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",_[_.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",_[_.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",_[_.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",_[_.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",_[_.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",_[_.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",_[_.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",_[_.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",_[_.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",_[_.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",_[_.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",_[_.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",_[_.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",_[_.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",_[_.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",_[_.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",_[_.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",_[_.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",_[_.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",_[_.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",_[_.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",_[_.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",_[_.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",_[_.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",_[_.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",_[_.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",_[_.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",_[_.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",_[_.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",_[_.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",_[_.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",_[_.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",_[_.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",_[_.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",_[_.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",_[_.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",_[_.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",_[_.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",_[_.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",_[_.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",_[_.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",_[_.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",_[_.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",_[_.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",_[_.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",_[_.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",_[_.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",_[_.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",_[_.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",_[_.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",_[_.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",_[_.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",_[_.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",_[_.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",_[_.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",_[_.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",_[_.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",_[_.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",_[_.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",_[_.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",_[_.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",_[_.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",_[_.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",_[_.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",_[_.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",_[_.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",_[_.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",_[_.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",_[_.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",_[_.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",_[_.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",_[_.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",_[_.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",_[_.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",_[_.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",_[_.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",_[_.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",_[_.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",_[_.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT"}(F||(F={})),function(_){_[_.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",_[_.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",_[_.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D"}(o||(o={}));var f,U,c,l=((t={})[827611204]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,t[861165636]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,t[894720068]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,t),d=((r={})[F.DXGI_FORMAT_BC1_TYPELESS]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,r[F.DXGI_FORMAT_BC1_UNORM]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,r[F.DXGI_FORMAT_BC2_TYPELESS]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,r[F.DXGI_FORMAT_BC2_UNORM]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,r[F.DXGI_FORMAT_BC3_TYPELESS]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,r[F.DXGI_FORMAT_BC3_UNORM]=_.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,r[F.DXGI_FORMAT_BC1_UNORM_SRGB]=_.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,r[F.DXGI_FORMAT_BC2_UNORM_SRGB]=_.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,r[F.DXGI_FORMAT_BC3_UNORM_SRGB]=_.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,r),h=function(){function _(){}return _.use=function(R,T){"dds"===R.extension&&R.data&&n(R.name||R.url,_.parse(R.data)),T()},_.parse=function(_){var R=new Uint32Array(_);if(542327876!==R[0])throw new Error("Invalid DDS file magic word");var T=new Uint32Array(_,0,124/Uint32Array.BYTES_PER_ELEMENT),e=T[B],A=T[a],E=T[N],S=new Uint32Array(_,P*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),G=S[1];if(4&G){var M=S[i];if(808540228!==M){var t=l[M],r=new Uint8Array(_,128);return[new I(r,{format:t,width:A,height:e,levels:E})]}var D=new Uint32Array(R.buffer,128,20/Uint32Array.BYTES_PER_ELEMENT),X=D[C],n=D[s],F=D[u],f=D[L],U=d[X];if(void 0===U)throw new Error("DDSLoader cannot parse texture data with DXGI format "+X);if(4===F)throw new Error("DDSLoader does not support cubemap textures");if(n===o.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSLoader does not supported 3D texture data");var c=new Array;if(1===f)c.push(new Uint8Array(_,148));else{for(var h=O[U],p=0,v=A,w=e,Y=0;Y<E;Y++){p+=Math.max(1,v+3&-4)*Math.max(1,w+3&-4)*h,v>>>=1,w>>>=1}var x=148;for(Y=0;Y<f;Y++)c.push(new Uint8Array(_,x,p)),x+=p}return c.map(function(_){return new I(_,{format:U,width:A,height:e,levels:E})})}if(64&G)throw new Error("DDSLoader does not support uncompressed texture data.");if(512&G)throw new Error("DDSLoader does not supported YUV uncompressed texture data.");if(131072&G)throw new Error("DDSLoader does not support single-channel (lumninance) texture data!");if(2&G)throw new Error("DDSLoader does not support single-channel (alpha) texture data!");throw new Error("DDSLoader failed to load a texture file due to an unknown reason!")},_}();T.LoaderResource.setExtensionXhrType("ktx",T.LoaderResource.XHR_RESPONSE_TYPE.BUFFER);var p=[171,75,84,88,32,49,49,187,13,10,26,10],v=12,w=16,Y=24,x=28,H=36,m=40,g=44,y=48,b=52,V=56,W=60,k=((f={})[e.TYPES.UNSIGNED_BYTE]=1,f[e.TYPES.UNSIGNED_SHORT]=2,f[e.TYPES.FLOAT]=4,f[e.TYPES.HALF_FLOAT]=8,f),K=((U={})[e.FORMATS.RGBA]=4,U[e.FORMATS.RGB]=3,U[e.FORMATS.LUMINANCE]=1,U[e.FORMATS.LUMINANCE_ALPHA]=2,U[e.FORMATS.ALPHA]=1,U),Q=((c={})[e.TYPES.UNSIGNED_SHORT_4_4_4_4]=2,c[e.TYPES.UNSIGNED_SHORT_5_5_5_1]=2,c[e.TYPES.UNSIGNED_SHORT_5_6_5]=2,c),j=function(){function _(){}return _.use=function(R,T){"ktx"===R.extension&&R.data&&_.parse(R.name||R.url,R.data),T()},_.parse=function(R,T){var e=new DataView(T);if(_.validate(R,e)){var A=67305985===e.getUint32(v,!0),E=e.getUint32(w,A),S=e.getUint32(Y,A),G=e.getUint32(x,A),M=e.getUint32(H,A),t=e.getUint32(m,A)||1,r=e.getUint32(g,A)||1,D=e.getUint32(y,A)||1,X=e.getUint32(b,A),F=e.getUint32(V,A),o=e.getUint32(W,A);if(0===t||1!==r)throw new Error("Only 2D textures are supported");if(1!==X)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(1!==D)throw new Error("WebGL does not support array textures");var B,a=M+3&-4,N=t+3&-4,P=new Array(D),i=M*t;if(0===E&&(i=a*N),void 0===(B=0!==E?k[E]?k[E]*K[S]:Q[E]:O[G]))throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");for(var C=i*B,s=M,u=t,L=a,f=N,U=64+o,c=0;c<F;c++){for(var l=e.getUint32(U,A),d=U+4,h=0;h<D;h++){var p=P[h];p||(p=P[h]=new Array(F)),p[c]={levelID:c,levelWidth:F>1?s:L,levelHeight:F>1?u:f,levelBuffer:new Uint8Array(T,d,C)},d+=C}U=(U+=l+4)%4!=0?U+4-U%4:U,C=(L=(s=s>>1||1)+4-1&-4)*(f=(u=u>>1||1)+4-1&-4)*B}if(0!==E)throw new Error("TODO: Uncompressed");n(R,P.map(function(_){return new I(null,{format:G,width:M,height:t,levels:F,levelBuffers:_})}))}},_.validate=function(_,R){for(var T=0;T<p.length;T++)if(R.getUint8(T)!==p[T])return console.error(_+" is not a valid *.ktx file!"),!1;return!0},_}();return _.BlobResource=D,_.CompressedTextureLoader=X,_.CompressedTextureResource=I,_.DDSLoader=h,_.FORMATS_TO_COMPONENTS=K,_.INTERNAL_FORMAT_TO_BYTES_PER_PIXEL=O,_.KTXLoader=j,_.TYPES_TO_BYTES_PER_COMPONENT=k,_.TYPES_TO_BYTES_PER_PIXEL=Q,_}({},PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_compressed_textures);
//# sourceMappingURL=compressed-textures.min.js.map
/*!
* @pixi/compressed-textures - v5.4.0-rc.2
* Compiled Tue, 17 Nov 2020 01:47:11 UTC
* @pixi/compressed-textures - v5.4.0-rc.3
* Compiled Thu, 10 Dec 2020 03:22:17 UTC
*

@@ -344,4 +344,4 @@ * @pixi/compressed-textures is licensed under the MIT License.

for (var i = 0, j = this.levels; i < j; i++) {
var _a = this._levelBuffers[i], levelWidth = _a.levelWidth, levelHeight = _a.levelHeight, levelBuffer = _a.levelBuffer;
gl.compressedTexImage2D(gl.TEXTURE_2D, 0, this.format, levelWidth, levelHeight, 0, levelBuffer);
var _a = this._levelBuffers[i], levelID = _a.levelID, levelWidth = _a.levelWidth, levelHeight = _a.levelHeight, levelBuffer = _a.levelBuffer;
gl.compressedTexImage2D(gl.TEXTURE_2D, levelID, this.format, levelWidth, levelHeight, 0, levelBuffer);
}

@@ -405,2 +405,3 @@ return true;

buffers[i] = {
levelID: i,
levelWidth: levels > 1 ? levelWidth : alignedLevelWidth,

@@ -1128,2 +1129,3 @@ levelHeight: levels > 1 ? levelHeight : alignedLevelHeight,

mips[mipmapLevel] = {
levelID: mipmapLevel,
levelWidth: numberOfMipmapLevels > 1 ? mipWidth : alignedMipWidth,

@@ -1130,0 +1132,0 @@ levelHeight: numberOfMipmapLevels > 1 ? mipHeight : alignedMipHeight,

/*!
* @pixi/compressed-textures - v5.4.0-rc.2
* Compiled Tue, 17 Nov 2020 01:47:11 UTC
* @pixi/compressed-textures - v5.4.0-rc.3
* Compiled Thu, 10 Dec 2020 03:22:17 UTC
*

@@ -8,3 +8,3 @@ * @pixi/compressed-textures is licensed under the MIT License.

*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _a,core=require("@pixi/core"),loaders=require("@pixi/loaders"),constants=require("@pixi/constants");!function(_){_[_.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",_[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",_[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",_[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",_[_.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",_[_.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",_[_.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",_[_.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",_[_.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",_[_.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",_[_.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",_[_.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",_[_.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",_[_.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",_[_.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",_[_.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",_[_.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",_[_.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",_[_.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",_[_.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",_[_.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",_[_.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",_[_.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL"}(exports.INTERNAL_FORMATS||(exports.INTERNAL_FORMATS={}));var INTERNAL_FORMAT_TO_BYTES_PER_PIXEL=((_a={})[exports.INTERNAL_FORMATS.COMPRESSED_RGB_S3TC_DXT1_EXT]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT]=1,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT]=1,_a[exports.INTERNAL_FORMATS.COMPRESSED_SRGB_S3TC_DXT1_EXT]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=1,_a[exports.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=1,_a[exports.INTERNAL_FORMATS.COMPRESSED_R11_EAC]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_SIGNED_R11_EAC]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RG11_EAC]=1,_a[exports.INTERNAL_FORMATS.COMPRESSED_SIGNED_RG11_EAC]=1,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGB8_ETC2]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA8_ETC2_EAC]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_SRGB8_ETC2]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=.25,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=.25,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGB_ETC1_WEBGL]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGB_ATC_WEBGL]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=1,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=1,_a),extendStatics=function(_,R){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,R){_.__proto__=R}||function(_,R){for(var T in R)R.hasOwnProperty(T)&&(_[T]=R[T])})(_,R)};function __extends(_,R){function T(){this.constructor=_}extendStatics(_,R),_.prototype=null===R?Object.create(R):(T.prototype=R.prototype,new T)}function __awaiter(_,R,T,E){return new(T||(T=Promise))(function(e,A){function S(_){try{D(E.next(_))}catch(_){A(_)}}function O(_){try{D(E.throw(_))}catch(_){A(_)}}function D(_){_.done?e(_.value):new T(function(R){R(_.value)}).then(S,O)}D((E=E.apply(_,R||[])).next())})}function __generator(_,R){var T,E,e,A,S={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]};return A={next:O(0),throw:O(1),return:O(2)},"function"==typeof Symbol&&(A[Symbol.iterator]=function(){return this}),A;function O(A){return function(O){return function(A){if(T)throw new TypeError("Generator is already executing.");for(;S;)try{if(T=1,E&&(e=2&A[0]?E.return:A[0]?E.throw||((e=E.return)&&e.call(E),0):E.next)&&!(e=e.call(E,A[1])).done)return e;switch(E=0,e&&(A=[2&A[0],e.value]),A[0]){case 0:case 1:e=A;break;case 4:return S.label++,{value:A[1],done:!1};case 5:S.label++,E=A[1],A=[0];continue;case 7:A=S.ops.pop(),S.trys.pop();continue;default:if(!(e=(e=S.trys).length>0&&e[e.length-1])&&(6===A[0]||2===A[0])){S=0;continue}if(3===A[0]&&(!e||A[1]>e[0]&&A[1]<e[3])){S.label=A[1];break}if(6===A[0]&&S.label<e[1]){S.label=e[1],e=A;break}if(e&&S.label<e[2]){S.label=e[2],S.ops.push(A);break}e[2]&&S.ops.pop(),S.trys.pop();continue}A=R.call(_,S)}catch(_){A=[6,_],E=0}finally{T=e=0}if(5&A[0])throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}([A,O])}}}var _a$1,_b,BlobResource=function(_){function R(R,T){void 0===T&&(T={width:1,height:1,autoLoad:!0});var E,e,A=this;return"string"==typeof R?(E=R,e=new Uint8Array):(E=null,e=R),(A=_.call(this,e,T)||this).origin=E,A.buffer=e?new core.ViewableBuffer(e):null,A.origin&&!1!==T.autoLoad&&A.load(),e&&e.length&&(A.loaded=!0,A.onBlobLoaded(A.buffer.rawBinaryData)),A}return __extends(R,_),R.prototype.onBlobLoaded=function(_){},R.prototype.load=function(){return __awaiter(this,void 0,Promise,function(){var _;return __generator(this,function(R){switch(R.label){case 0:return[4,fetch(this.origin)];case 1:return[4,R.sent().blob()];case 2:return[4,R.sent().arrayBuffer()];case 3:return _=R.sent(),this.data=new Uint32Array(_),this.buffer=new core.ViewableBuffer(_),this.loaded=!0,this.onBlobLoaded(_),this.update(),[2,this]}})})},R}(core.BufferResource),CompressedTextureResource=function(_){function R(T,E){var e=_.call(this,T,E)||this;return e.format=E.format,e.levels=E.levels||1,e._width=E.width,e._height=E.height,e._extension=R._formatToExtension(e.format),(E.levelBuffers||e.buffer)&&(e._levelBuffers=E.levelBuffers||R._createLevelBuffers(T instanceof Uint8Array?T:e.buffer.uint8View,e.format,e.levels,4,4,e.width,e.height)),e}return __extends(R,_),R.prototype.upload=function(_,R,T){var E=_.gl;if(!_.context.extensions[this._extension])throw new Error(this._extension+" textures are not supported on the current machine");if(!this._levelBuffers)return!1;for(var e=0,A=this.levels;e<A;e++){var S=this._levelBuffers[e],O=S.levelWidth,D=S.levelHeight,t=S.levelBuffer;E.compressedTexImage2D(E.TEXTURE_2D,0,this.format,O,D,0,t)}return!0},R.prototype.onBlobLoaded=function(){this._levelBuffers=R._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)},R._formatToExtension=function(_){if(_>=33776&&_<=33779)return"s3tc";if(_>=37488&&_<=37497)return"etc";if(_>=35840&&_<=35843)return"pvrtc";if(_>=36196)return"etc1";if(_>=35986&&_<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},R._createLevelBuffers=function(_,R,T,E,e,A,S){for(var O=new Array(T),D=_.byteOffset,t=A,r=S,M=t+E-1&~(E-1),G=r+e-1&~(e-1),I=M*G*INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[R],F=0;F<T;F++)O[F]={levelWidth:T>1?t:M,levelHeight:T>1?r:G,levelBuffer:new Uint8Array(_.buffer,D,I)},D+=I,I=(M=(t=t>>1||1)+E-1&~(E-1))*(G=(r=r>>1||1)+e-1&~(e-1))*INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[R];return O},R}(BlobResource),CompressedTextureLoader=function(){function _(){}return _.use=function(R,T){var E=R.data;if(_.textureExtensions||_.autoDetectExtensions(),R.type===loaders.LoaderResource.TYPE.JSON&&E&&E.cacheID&&E.textures){for(var e=E.textures,A=void 0,S=void 0,O=0,D=e.length;O<D;O++){var t=e[O],r=t.src,M=t.format;if(M||(S=r),_.textureFormats[M]){A=r;break}}if(!(A=A||S))throw new Error("Cannot load compressed-textures in "+R.url+", make sure you provide a fallback");if(A===R.url)throw new Error("URL of compressed texture cannot be the same as the manifest's URL");var G={crossOrigin:R.crossOrigin,metadata:R.metadata.imageMetadata,parentResource:R};this.add(E.cacheID,A,G,function(){T()})}else T()},_.autoDetectExtensions=function(R){if(!R){var T=document.createElement("canvas").getContext("webgl");if(!T)return void console.error("WebGL not available for compressed textures. Silently failing.");R={s3tc:T.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:T.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:T.getExtension("WEBGL_compressed_texture_etc"),etc1:T.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:T.getExtension("WEBGL_compressed_texture_pvrtc")||T.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:T.getExtension("WEBGL_compressed_texture_atc"),astc:T.getExtension("WEBGL_compressed_texture_astc")}}for(var E in _.textureExtensions=R,_.textureFormats={},R){var e=R[E];e&&Object.assign(_.textureFormats,Object.getPrototypeOf(e))}},_}();function registerCompressedTextures(_,R){R&&R.forEach(function(R,T){var E=new core.BaseTexture(R,{mipmap:constants.MIPMAP_MODES.OFF,alphaMode:constants.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA}),e=_+"-"+(T+1);core.BaseTexture.addToCache(E,e),core.Texture.addToCache(new core.Texture(E),e),0===T&&(core.BaseTexture.addToCache(E,_),core.Texture.addToCache(new core.Texture(E),_))})}loaders.LoaderResource.setExtensionXhrType("dds",loaders.LoaderResource.XHR_RESPONSE_TYPE.BUFFER);var DXGI_FORMAT,D3D10_RESOURCE_DIMENSION,DDS_MAGIC_SIZE=4,DDS_HEADER_SIZE=124,DDS_HEADER_PF_SIZE=32,DDS_HEADER_DX10_SIZE=20,DDS_MAGIC=542327876,DDS_FIELDS={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},DDS_PF_FIELDS={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},DDS_DX10_FIELDS={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4};!function(_){_[_.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",_[_.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",_[_.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",_[_.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",_[_.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",_[_.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",_[_.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",_[_.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",_[_.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",_[_.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",_[_.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",_[_.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",_[_.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",_[_.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",_[_.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",_[_.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",_[_.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",_[_.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",_[_.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",_[_.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",_[_.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",_[_.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",_[_.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",_[_.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",_[_.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",_[_.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",_[_.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",_[_.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",_[_.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",_[_.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",_[_.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",_[_.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",_[_.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",_[_.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",_[_.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",_[_.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",_[_.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",_[_.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",_[_.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",_[_.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",_[_.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",_[_.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",_[_.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",_[_.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",_[_.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",_[_.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",_[_.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",_[_.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",_[_.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",_[_.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",_[_.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",_[_.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",_[_.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",_[_.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",_[_.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",_[_.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",_[_.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",_[_.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",_[_.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",_[_.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",_[_.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",_[_.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",_[_.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",_[_.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",_[_.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",_[_.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",_[_.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",_[_.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",_[_.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",_[_.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",_[_.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",_[_.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",_[_.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",_[_.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",_[_.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",_[_.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",_[_.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",_[_.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",_[_.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",_[_.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",_[_.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",_[_.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",_[_.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",_[_.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",_[_.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",_[_.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",_[_.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",_[_.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",_[_.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",_[_.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",_[_.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",_[_.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",_[_.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",_[_.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",_[_.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",_[_.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",_[_.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",_[_.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",_[_.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",_[_.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",_[_.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",_[_.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",_[_.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",_[_.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",_[_.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",_[_.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",_[_.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",_[_.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",_[_.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",_[_.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",_[_.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",_[_.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",_[_.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",_[_.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",_[_.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",_[_.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",_[_.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",_[_.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",_[_.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",_[_.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",_[_.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",_[_.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT"}(DXGI_FORMAT||(DXGI_FORMAT={})),function(_){_[_.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",_[_.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",_[_.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D"}(D3D10_RESOURCE_DIMENSION||(D3D10_RESOURCE_DIMENSION={}));var _a$2,_b$1,_c,PF_FLAGS=1,DDPF_ALPHA=2,DDPF_FOURCC=4,DDPF_RGB=64,DDPF_YUV=512,DDPF_LUMINANCE=131072,FOURCC_DXT1=827611204,FOURCC_DXT3=861165636,FOURCC_DXT5=894720068,FOURCC_DX10=808540228,DDS_RESOURCE_MISC_TEXTURECUBE=4,FOURCC_TO_FORMAT=((_a$1={})[FOURCC_DXT1]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,_a$1[FOURCC_DXT3]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,_a$1[FOURCC_DXT5]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,_a$1),DXGI_TO_FORMAT=((_b={})[DXGI_FORMAT.DXGI_FORMAT_BC1_TYPELESS]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC2_TYPELESS]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC3_TYPELESS]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM_SRGB]=exports.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM_SRGB]=exports.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM_SRGB]=exports.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,_b),DDSLoader=function(){function _(){}return _.use=function(R,T){"dds"===R.extension&&R.data&&registerCompressedTextures(R.name||R.url,_.parse(R.data)),T()},_.parse=function(_){var R=new Uint32Array(_);if(R[0]!==DDS_MAGIC)throw new Error("Invalid DDS file magic word");var T=new Uint32Array(_,0,DDS_HEADER_SIZE/Uint32Array.BYTES_PER_ELEMENT),E=T[DDS_FIELDS.HEIGHT],e=T[DDS_FIELDS.WIDTH],A=T[DDS_FIELDS.MIPMAP_COUNT],S=new Uint32Array(_,DDS_FIELDS.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,DDS_HEADER_PF_SIZE/Uint32Array.BYTES_PER_ELEMENT),O=S[PF_FLAGS];if(O&DDPF_FOURCC){var D=S[DDS_PF_FIELDS.FOURCC];if(D!==FOURCC_DX10){var t=FOURCC_TO_FORMAT[D],r=new Uint8Array(_,DDS_MAGIC_SIZE+DDS_HEADER_SIZE);return[new CompressedTextureResource(r,{format:t,width:e,height:E,levels:A})]}var M=DDS_MAGIC_SIZE+DDS_HEADER_SIZE,G=new Uint32Array(R.buffer,M,DDS_HEADER_DX10_SIZE/Uint32Array.BYTES_PER_ELEMENT),I=G[DDS_DX10_FIELDS.DXGI_FORMAT],F=G[DDS_DX10_FIELDS.RESOURCE_DIMENSION],o=G[DDS_DX10_FIELDS.MISC_FLAG],X=G[DDS_DX10_FIELDS.ARRAY_SIZE],n=DXGI_TO_FORMAT[I];if(void 0===n)throw new Error("DDSLoader cannot parse texture data with DXGI format "+I);if(o===DDS_RESOURCE_MISC_TEXTURECUBE)throw new Error("DDSLoader does not support cubemap textures");if(F===D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSLoader does not supported 3D texture data");var a=new Array,N=DDS_MAGIC_SIZE+DDS_HEADER_SIZE+DDS_HEADER_DX10_SIZE;if(1===X)a.push(new Uint8Array(_,N));else{for(var s=INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[n],P=0,C=e,B=E,L=0;L<A;L++){P+=Math.max(1,C+3&-4)*Math.max(1,B+3&-4)*s,C>>>=1,B>>>=1}var i=N;for(L=0;L<X;L++)a.push(new Uint8Array(_,i,P)),i+=P}return a.map(function(_){return new CompressedTextureResource(_,{format:n,width:e,height:E,levels:A})})}if(O&DDPF_RGB)throw new Error("DDSLoader does not support uncompressed texture data.");if(O&DDPF_YUV)throw new Error("DDSLoader does not supported YUV uncompressed texture data.");if(O&DDPF_LUMINANCE)throw new Error("DDSLoader does not support single-channel (lumninance) texture data!");if(O&DDPF_ALPHA)throw new Error("DDSLoader does not support single-channel (alpha) texture data!");throw new Error("DDSLoader failed to load a texture file due to an unknown reason!")},_}();loaders.LoaderResource.setExtensionXhrType("ktx",loaders.LoaderResource.XHR_RESPONSE_TYPE.BUFFER);var FILE_IDENTIFIER=[171,75,84,88,32,49,49,187,13,10,26,10],ENDIANNESS=67305985,KTX_FIELDS={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},FILE_HEADER_SIZE=64,TYPES_TO_BYTES_PER_COMPONENT=((_a$2={})[constants.TYPES.UNSIGNED_BYTE]=1,_a$2[constants.TYPES.UNSIGNED_SHORT]=2,_a$2[constants.TYPES.FLOAT]=4,_a$2[constants.TYPES.HALF_FLOAT]=8,_a$2),FORMATS_TO_COMPONENTS=((_b$1={})[constants.FORMATS.RGBA]=4,_b$1[constants.FORMATS.RGB]=3,_b$1[constants.FORMATS.LUMINANCE]=1,_b$1[constants.FORMATS.LUMINANCE_ALPHA]=2,_b$1[constants.FORMATS.ALPHA]=1,_b$1),TYPES_TO_BYTES_PER_PIXEL=((_c={})[constants.TYPES.UNSIGNED_SHORT_4_4_4_4]=2,_c[constants.TYPES.UNSIGNED_SHORT_5_5_5_1]=2,_c[constants.TYPES.UNSIGNED_SHORT_5_6_5]=2,_c),KTXLoader=function(){function _(){}return _.use=function(R,T){"ktx"===R.extension&&R.data&&_.parse(R.name||R.url,R.data),T()},_.parse=function(R,T){var E=new DataView(T);if(_.validate(R,E)){var e=E.getUint32(KTX_FIELDS.ENDIANNESS,!0)===ENDIANNESS,A=E.getUint32(KTX_FIELDS.GL_TYPE,e),S=E.getUint32(KTX_FIELDS.GL_FORMAT,e),O=E.getUint32(KTX_FIELDS.GL_INTERNAL_FORMAT,e),D=E.getUint32(KTX_FIELDS.PIXEL_WIDTH,e),t=E.getUint32(KTX_FIELDS.PIXEL_HEIGHT,e)||1,r=E.getUint32(KTX_FIELDS.PIXEL_DEPTH,e)||1,M=E.getUint32(KTX_FIELDS.NUMBER_OF_ARRAY_ELEMENTS,e)||1,G=E.getUint32(KTX_FIELDS.NUMBER_OF_FACES,e),I=E.getUint32(KTX_FIELDS.NUMBER_OF_MIPMAP_LEVELS,e),F=E.getUint32(KTX_FIELDS.BYTES_OF_KEY_VALUE_DATA,e);if(0===t||1!==r)throw new Error("Only 2D textures are supported");if(1!==G)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(1!==M)throw new Error("WebGL does not support array textures");var o,X=D+3&-4,n=t+3&-4,a=new Array(M),N=D*t;if(0===A&&(N=X*n),void 0===(o=0!==A?TYPES_TO_BYTES_PER_COMPONENT[A]?TYPES_TO_BYTES_PER_COMPONENT[A]*FORMATS_TO_COMPONENTS[S]:TYPES_TO_BYTES_PER_PIXEL[A]:INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[O]))throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");for(var s=N*o,P=D,C=t,B=X,L=n,i=FILE_HEADER_SIZE+F,u=0;u<I;u++){for(var U=E.getUint32(i,e),c=i+4,f=0;f<M;f++){var l=a[f];l||(l=a[f]=new Array(I)),l[u]={levelWidth:I>1?P:B,levelHeight:I>1?C:L,levelBuffer:new Uint8Array(T,c,s)},c+=s}i=(i+=U+4)%4!=0?i+4-i%4:i,s=(B=(P=P>>1||1)+4-1&-4)*(L=(C=C>>1||1)+4-1&-4)*o}if(0!==A)throw new Error("TODO: Uncompressed");registerCompressedTextures(R,a.map(function(_){return new CompressedTextureResource(null,{format:O,width:D,height:t,levels:I,levelBuffers:_})}))}},_.validate=function(_,R){for(var T=0;T<FILE_IDENTIFIER.length;T++)if(R.getUint8(T)!==FILE_IDENTIFIER[T])return console.error(_+" is not a valid *.ktx file!"),!1;return!0},_}();exports.BlobResource=BlobResource,exports.CompressedTextureLoader=CompressedTextureLoader,exports.CompressedTextureResource=CompressedTextureResource,exports.DDSLoader=DDSLoader,exports.FORMATS_TO_COMPONENTS=FORMATS_TO_COMPONENTS,exports.INTERNAL_FORMAT_TO_BYTES_PER_PIXEL=INTERNAL_FORMAT_TO_BYTES_PER_PIXEL,exports.KTXLoader=KTXLoader,exports.TYPES_TO_BYTES_PER_COMPONENT=TYPES_TO_BYTES_PER_COMPONENT,exports.TYPES_TO_BYTES_PER_PIXEL=TYPES_TO_BYTES_PER_PIXEL;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _a,core=require("@pixi/core"),loaders=require("@pixi/loaders"),constants=require("@pixi/constants");!function(_){_[_.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",_[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",_[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",_[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",_[_.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",_[_.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",_[_.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",_[_.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",_[_.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",_[_.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",_[_.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",_[_.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",_[_.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",_[_.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",_[_.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",_[_.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",_[_.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",_[_.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",_[_.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",_[_.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",_[_.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",_[_.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",_[_.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL"}(exports.INTERNAL_FORMATS||(exports.INTERNAL_FORMATS={}));var INTERNAL_FORMAT_TO_BYTES_PER_PIXEL=((_a={})[exports.INTERNAL_FORMATS.COMPRESSED_RGB_S3TC_DXT1_EXT]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT]=1,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT]=1,_a[exports.INTERNAL_FORMATS.COMPRESSED_SRGB_S3TC_DXT1_EXT]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=1,_a[exports.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=1,_a[exports.INTERNAL_FORMATS.COMPRESSED_R11_EAC]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_SIGNED_R11_EAC]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RG11_EAC]=1,_a[exports.INTERNAL_FORMATS.COMPRESSED_SIGNED_RG11_EAC]=1,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGB8_ETC2]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA8_ETC2_EAC]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_SRGB8_ETC2]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=.25,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=.25,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGB_ETC1_WEBGL]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGB_ATC_WEBGL]=.5,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=1,_a[exports.INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=1,_a),extendStatics=function(_,R){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,R){_.__proto__=R}||function(_,R){for(var T in R)R.hasOwnProperty(T)&&(_[T]=R[T])})(_,R)};function __extends(_,R){function T(){this.constructor=_}extendStatics(_,R),_.prototype=null===R?Object.create(R):(T.prototype=R.prototype,new T)}function __awaiter(_,R,T,E){return new(T||(T=Promise))(function(e,A){function S(_){try{D(E.next(_))}catch(_){A(_)}}function O(_){try{D(E.throw(_))}catch(_){A(_)}}function D(_){_.done?e(_.value):new T(function(R){R(_.value)}).then(S,O)}D((E=E.apply(_,R||[])).next())})}function __generator(_,R){var T,E,e,A,S={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]};return A={next:O(0),throw:O(1),return:O(2)},"function"==typeof Symbol&&(A[Symbol.iterator]=function(){return this}),A;function O(A){return function(O){return function(A){if(T)throw new TypeError("Generator is already executing.");for(;S;)try{if(T=1,E&&(e=2&A[0]?E.return:A[0]?E.throw||((e=E.return)&&e.call(E),0):E.next)&&!(e=e.call(E,A[1])).done)return e;switch(E=0,e&&(A=[2&A[0],e.value]),A[0]){case 0:case 1:e=A;break;case 4:return S.label++,{value:A[1],done:!1};case 5:S.label++,E=A[1],A=[0];continue;case 7:A=S.ops.pop(),S.trys.pop();continue;default:if(!(e=(e=S.trys).length>0&&e[e.length-1])&&(6===A[0]||2===A[0])){S=0;continue}if(3===A[0]&&(!e||A[1]>e[0]&&A[1]<e[3])){S.label=A[1];break}if(6===A[0]&&S.label<e[1]){S.label=e[1],e=A;break}if(e&&S.label<e[2]){S.label=e[2],S.ops.push(A);break}e[2]&&S.ops.pop(),S.trys.pop();continue}A=R.call(_,S)}catch(_){A=[6,_],E=0}finally{T=e=0}if(5&A[0])throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}([A,O])}}}var _a$1,_b,BlobResource=function(_){function R(R,T){void 0===T&&(T={width:1,height:1,autoLoad:!0});var E,e,A=this;return"string"==typeof R?(E=R,e=new Uint8Array):(E=null,e=R),(A=_.call(this,e,T)||this).origin=E,A.buffer=e?new core.ViewableBuffer(e):null,A.origin&&!1!==T.autoLoad&&A.load(),e&&e.length&&(A.loaded=!0,A.onBlobLoaded(A.buffer.rawBinaryData)),A}return __extends(R,_),R.prototype.onBlobLoaded=function(_){},R.prototype.load=function(){return __awaiter(this,void 0,Promise,function(){var _;return __generator(this,function(R){switch(R.label){case 0:return[4,fetch(this.origin)];case 1:return[4,R.sent().blob()];case 2:return[4,R.sent().arrayBuffer()];case 3:return _=R.sent(),this.data=new Uint32Array(_),this.buffer=new core.ViewableBuffer(_),this.loaded=!0,this.onBlobLoaded(_),this.update(),[2,this]}})})},R}(core.BufferResource),CompressedTextureResource=function(_){function R(T,E){var e=_.call(this,T,E)||this;return e.format=E.format,e.levels=E.levels||1,e._width=E.width,e._height=E.height,e._extension=R._formatToExtension(e.format),(E.levelBuffers||e.buffer)&&(e._levelBuffers=E.levelBuffers||R._createLevelBuffers(T instanceof Uint8Array?T:e.buffer.uint8View,e.format,e.levels,4,4,e.width,e.height)),e}return __extends(R,_),R.prototype.upload=function(_,R,T){var E=_.gl;if(!_.context.extensions[this._extension])throw new Error(this._extension+" textures are not supported on the current machine");if(!this._levelBuffers)return!1;for(var e=0,A=this.levels;e<A;e++){var S=this._levelBuffers[e],O=S.levelID,D=S.levelWidth,t=S.levelHeight,r=S.levelBuffer;E.compressedTexImage2D(E.TEXTURE_2D,O,this.format,D,t,0,r)}return!0},R.prototype.onBlobLoaded=function(){this._levelBuffers=R._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)},R._formatToExtension=function(_){if(_>=33776&&_<=33779)return"s3tc";if(_>=37488&&_<=37497)return"etc";if(_>=35840&&_<=35843)return"pvrtc";if(_>=36196)return"etc1";if(_>=35986&&_<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},R._createLevelBuffers=function(_,R,T,E,e,A,S){for(var O=new Array(T),D=_.byteOffset,t=A,r=S,M=t+E-1&~(E-1),I=r+e-1&~(e-1),G=M*I*INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[R],F=0;F<T;F++)O[F]={levelID:F,levelWidth:T>1?t:M,levelHeight:T>1?r:I,levelBuffer:new Uint8Array(_.buffer,D,G)},D+=G,G=(M=(t=t>>1||1)+E-1&~(E-1))*(I=(r=r>>1||1)+e-1&~(e-1))*INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[R];return O},R}(BlobResource),CompressedTextureLoader=function(){function _(){}return _.use=function(R,T){var E=R.data;if(_.textureExtensions||_.autoDetectExtensions(),R.type===loaders.LoaderResource.TYPE.JSON&&E&&E.cacheID&&E.textures){for(var e=E.textures,A=void 0,S=void 0,O=0,D=e.length;O<D;O++){var t=e[O],r=t.src,M=t.format;if(M||(S=r),_.textureFormats[M]){A=r;break}}if(!(A=A||S))throw new Error("Cannot load compressed-textures in "+R.url+", make sure you provide a fallback");if(A===R.url)throw new Error("URL of compressed texture cannot be the same as the manifest's URL");var I={crossOrigin:R.crossOrigin,metadata:R.metadata.imageMetadata,parentResource:R};this.add(E.cacheID,A,I,function(){T()})}else T()},_.autoDetectExtensions=function(R){if(!R){var T=document.createElement("canvas").getContext("webgl");if(!T)return void console.error("WebGL not available for compressed textures. Silently failing.");R={s3tc:T.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:T.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:T.getExtension("WEBGL_compressed_texture_etc"),etc1:T.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:T.getExtension("WEBGL_compressed_texture_pvrtc")||T.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:T.getExtension("WEBGL_compressed_texture_atc"),astc:T.getExtension("WEBGL_compressed_texture_astc")}}for(var E in _.textureExtensions=R,_.textureFormats={},R){var e=R[E];e&&Object.assign(_.textureFormats,Object.getPrototypeOf(e))}},_}();function registerCompressedTextures(_,R){R&&R.forEach(function(R,T){var E=new core.BaseTexture(R,{mipmap:constants.MIPMAP_MODES.OFF,alphaMode:constants.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA}),e=_+"-"+(T+1);core.BaseTexture.addToCache(E,e),core.Texture.addToCache(new core.Texture(E),e),0===T&&(core.BaseTexture.addToCache(E,_),core.Texture.addToCache(new core.Texture(E),_))})}loaders.LoaderResource.setExtensionXhrType("dds",loaders.LoaderResource.XHR_RESPONSE_TYPE.BUFFER);var DXGI_FORMAT,D3D10_RESOURCE_DIMENSION,DDS_MAGIC_SIZE=4,DDS_HEADER_SIZE=124,DDS_HEADER_PF_SIZE=32,DDS_HEADER_DX10_SIZE=20,DDS_MAGIC=542327876,DDS_FIELDS={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},DDS_PF_FIELDS={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},DDS_DX10_FIELDS={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4};!function(_){_[_.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",_[_.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",_[_.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",_[_.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",_[_.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",_[_.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",_[_.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",_[_.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",_[_.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",_[_.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",_[_.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",_[_.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",_[_.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",_[_.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",_[_.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",_[_.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",_[_.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",_[_.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",_[_.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",_[_.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",_[_.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",_[_.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",_[_.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",_[_.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",_[_.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",_[_.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",_[_.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",_[_.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",_[_.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",_[_.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",_[_.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",_[_.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",_[_.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",_[_.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",_[_.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",_[_.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",_[_.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",_[_.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",_[_.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",_[_.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",_[_.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",_[_.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",_[_.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",_[_.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",_[_.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",_[_.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",_[_.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",_[_.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",_[_.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",_[_.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",_[_.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",_[_.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",_[_.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",_[_.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",_[_.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",_[_.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",_[_.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",_[_.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",_[_.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",_[_.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",_[_.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",_[_.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",_[_.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",_[_.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",_[_.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",_[_.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",_[_.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",_[_.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",_[_.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",_[_.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",_[_.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",_[_.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",_[_.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",_[_.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",_[_.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",_[_.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",_[_.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",_[_.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",_[_.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",_[_.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",_[_.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",_[_.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",_[_.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",_[_.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",_[_.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",_[_.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",_[_.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",_[_.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",_[_.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",_[_.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",_[_.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",_[_.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",_[_.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",_[_.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",_[_.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",_[_.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",_[_.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",_[_.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",_[_.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",_[_.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",_[_.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",_[_.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",_[_.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",_[_.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",_[_.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",_[_.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",_[_.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",_[_.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",_[_.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",_[_.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",_[_.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",_[_.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",_[_.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",_[_.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",_[_.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",_[_.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",_[_.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",_[_.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",_[_.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",_[_.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",_[_.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",_[_.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT"}(DXGI_FORMAT||(DXGI_FORMAT={})),function(_){_[_.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",_[_.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",_[_.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D"}(D3D10_RESOURCE_DIMENSION||(D3D10_RESOURCE_DIMENSION={}));var _a$2,_b$1,_c,PF_FLAGS=1,DDPF_ALPHA=2,DDPF_FOURCC=4,DDPF_RGB=64,DDPF_YUV=512,DDPF_LUMINANCE=131072,FOURCC_DXT1=827611204,FOURCC_DXT3=861165636,FOURCC_DXT5=894720068,FOURCC_DX10=808540228,DDS_RESOURCE_MISC_TEXTURECUBE=4,FOURCC_TO_FORMAT=((_a$1={})[FOURCC_DXT1]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,_a$1[FOURCC_DXT3]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,_a$1[FOURCC_DXT5]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,_a$1),DXGI_TO_FORMAT=((_b={})[DXGI_FORMAT.DXGI_FORMAT_BC1_TYPELESS]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC2_TYPELESS]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC3_TYPELESS]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM]=exports.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM_SRGB]=exports.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM_SRGB]=exports.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,_b[DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM_SRGB]=exports.INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,_b),DDSLoader=function(){function _(){}return _.use=function(R,T){"dds"===R.extension&&R.data&&registerCompressedTextures(R.name||R.url,_.parse(R.data)),T()},_.parse=function(_){var R=new Uint32Array(_);if(R[0]!==DDS_MAGIC)throw new Error("Invalid DDS file magic word");var T=new Uint32Array(_,0,DDS_HEADER_SIZE/Uint32Array.BYTES_PER_ELEMENT),E=T[DDS_FIELDS.HEIGHT],e=T[DDS_FIELDS.WIDTH],A=T[DDS_FIELDS.MIPMAP_COUNT],S=new Uint32Array(_,DDS_FIELDS.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,DDS_HEADER_PF_SIZE/Uint32Array.BYTES_PER_ELEMENT),O=S[PF_FLAGS];if(O&DDPF_FOURCC){var D=S[DDS_PF_FIELDS.FOURCC];if(D!==FOURCC_DX10){var t=FOURCC_TO_FORMAT[D],r=new Uint8Array(_,DDS_MAGIC_SIZE+DDS_HEADER_SIZE);return[new CompressedTextureResource(r,{format:t,width:e,height:E,levels:A})]}var M=DDS_MAGIC_SIZE+DDS_HEADER_SIZE,I=new Uint32Array(R.buffer,M,DDS_HEADER_DX10_SIZE/Uint32Array.BYTES_PER_ELEMENT),G=I[DDS_DX10_FIELDS.DXGI_FORMAT],F=I[DDS_DX10_FIELDS.RESOURCE_DIMENSION],o=I[DDS_DX10_FIELDS.MISC_FLAG],X=I[DDS_DX10_FIELDS.ARRAY_SIZE],n=DXGI_TO_FORMAT[G];if(void 0===n)throw new Error("DDSLoader cannot parse texture data with DXGI format "+G);if(o===DDS_RESOURCE_MISC_TEXTURECUBE)throw new Error("DDSLoader does not support cubemap textures");if(F===D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSLoader does not supported 3D texture data");var a=new Array,N=DDS_MAGIC_SIZE+DDS_HEADER_SIZE+DDS_HEADER_DX10_SIZE;if(1===X)a.push(new Uint8Array(_,N));else{for(var s=INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[n],P=0,C=e,B=E,L=0;L<A;L++){P+=Math.max(1,C+3&-4)*Math.max(1,B+3&-4)*s,C>>>=1,B>>>=1}var i=N;for(L=0;L<X;L++)a.push(new Uint8Array(_,i,P)),i+=P}return a.map(function(_){return new CompressedTextureResource(_,{format:n,width:e,height:E,levels:A})})}if(O&DDPF_RGB)throw new Error("DDSLoader does not support uncompressed texture data.");if(O&DDPF_YUV)throw new Error("DDSLoader does not supported YUV uncompressed texture data.");if(O&DDPF_LUMINANCE)throw new Error("DDSLoader does not support single-channel (lumninance) texture data!");if(O&DDPF_ALPHA)throw new Error("DDSLoader does not support single-channel (alpha) texture data!");throw new Error("DDSLoader failed to load a texture file due to an unknown reason!")},_}();loaders.LoaderResource.setExtensionXhrType("ktx",loaders.LoaderResource.XHR_RESPONSE_TYPE.BUFFER);var FILE_IDENTIFIER=[171,75,84,88,32,49,49,187,13,10,26,10],ENDIANNESS=67305985,KTX_FIELDS={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},FILE_HEADER_SIZE=64,TYPES_TO_BYTES_PER_COMPONENT=((_a$2={})[constants.TYPES.UNSIGNED_BYTE]=1,_a$2[constants.TYPES.UNSIGNED_SHORT]=2,_a$2[constants.TYPES.FLOAT]=4,_a$2[constants.TYPES.HALF_FLOAT]=8,_a$2),FORMATS_TO_COMPONENTS=((_b$1={})[constants.FORMATS.RGBA]=4,_b$1[constants.FORMATS.RGB]=3,_b$1[constants.FORMATS.LUMINANCE]=1,_b$1[constants.FORMATS.LUMINANCE_ALPHA]=2,_b$1[constants.FORMATS.ALPHA]=1,_b$1),TYPES_TO_BYTES_PER_PIXEL=((_c={})[constants.TYPES.UNSIGNED_SHORT_4_4_4_4]=2,_c[constants.TYPES.UNSIGNED_SHORT_5_5_5_1]=2,_c[constants.TYPES.UNSIGNED_SHORT_5_6_5]=2,_c),KTXLoader=function(){function _(){}return _.use=function(R,T){"ktx"===R.extension&&R.data&&_.parse(R.name||R.url,R.data),T()},_.parse=function(R,T){var E=new DataView(T);if(_.validate(R,E)){var e=E.getUint32(KTX_FIELDS.ENDIANNESS,!0)===ENDIANNESS,A=E.getUint32(KTX_FIELDS.GL_TYPE,e),S=E.getUint32(KTX_FIELDS.GL_FORMAT,e),O=E.getUint32(KTX_FIELDS.GL_INTERNAL_FORMAT,e),D=E.getUint32(KTX_FIELDS.PIXEL_WIDTH,e),t=E.getUint32(KTX_FIELDS.PIXEL_HEIGHT,e)||1,r=E.getUint32(KTX_FIELDS.PIXEL_DEPTH,e)||1,M=E.getUint32(KTX_FIELDS.NUMBER_OF_ARRAY_ELEMENTS,e)||1,I=E.getUint32(KTX_FIELDS.NUMBER_OF_FACES,e),G=E.getUint32(KTX_FIELDS.NUMBER_OF_MIPMAP_LEVELS,e),F=E.getUint32(KTX_FIELDS.BYTES_OF_KEY_VALUE_DATA,e);if(0===t||1!==r)throw new Error("Only 2D textures are supported");if(1!==I)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(1!==M)throw new Error("WebGL does not support array textures");var o,X=D+3&-4,n=t+3&-4,a=new Array(M),N=D*t;if(0===A&&(N=X*n),void 0===(o=0!==A?TYPES_TO_BYTES_PER_COMPONENT[A]?TYPES_TO_BYTES_PER_COMPONENT[A]*FORMATS_TO_COMPONENTS[S]:TYPES_TO_BYTES_PER_PIXEL[A]:INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[O]))throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");for(var s=N*o,P=D,C=t,B=X,L=n,i=FILE_HEADER_SIZE+F,u=0;u<G;u++){for(var U=E.getUint32(i,e),c=i+4,f=0;f<M;f++){var l=a[f];l||(l=a[f]=new Array(G)),l[u]={levelID:u,levelWidth:G>1?P:B,levelHeight:G>1?C:L,levelBuffer:new Uint8Array(T,c,s)},c+=s}i=(i+=U+4)%4!=0?i+4-i%4:i,s=(B=(P=P>>1||1)+4-1&-4)*(L=(C=C>>1||1)+4-1&-4)*o}if(0!==A)throw new Error("TODO: Uncompressed");registerCompressedTextures(R,a.map(function(_){return new CompressedTextureResource(null,{format:O,width:D,height:t,levels:G,levelBuffers:_})}))}},_.validate=function(_,R){for(var T=0;T<FILE_IDENTIFIER.length;T++)if(R.getUint8(T)!==FILE_IDENTIFIER[T])return console.error(_+" is not a valid *.ktx file!"),!1;return!0},_}();exports.BlobResource=BlobResource,exports.CompressedTextureLoader=CompressedTextureLoader,exports.CompressedTextureResource=CompressedTextureResource,exports.DDSLoader=DDSLoader,exports.FORMATS_TO_COMPONENTS=FORMATS_TO_COMPONENTS,exports.INTERNAL_FORMAT_TO_BYTES_PER_PIXEL=INTERNAL_FORMAT_TO_BYTES_PER_PIXEL,exports.KTXLoader=KTXLoader,exports.TYPES_TO_BYTES_PER_COMPONENT=TYPES_TO_BYTES_PER_COMPONENT,exports.TYPES_TO_BYTES_PER_PIXEL=TYPES_TO_BYTES_PER_PIXEL;
//# sourceMappingURL=compressed-textures.min.js.map
/*!
* @pixi/compressed-textures - v5.4.0-rc.2
* Compiled Tue, 17 Nov 2020 01:47:11 UTC
* @pixi/compressed-textures - v5.4.0-rc.3
* Compiled Thu, 10 Dec 2020 03:22:17 UTC
*

@@ -375,4 +375,4 @@ * @pixi/compressed-textures is licensed under the MIT License.

for (var i = 0, j = this.levels; i < j; i++) {
var _a = this._levelBuffers[i], levelWidth = _a.levelWidth, levelHeight = _a.levelHeight, levelBuffer = _a.levelBuffer;
gl.compressedTexImage2D(gl.TEXTURE_2D, 0, this.format, levelWidth, levelHeight, 0, levelBuffer);
var _a = this._levelBuffers[i], levelID = _a.levelID, levelWidth = _a.levelWidth, levelHeight = _a.levelHeight, levelBuffer = _a.levelBuffer;
gl.compressedTexImage2D(gl.TEXTURE_2D, levelID, this.format, levelWidth, levelHeight, 0, levelBuffer);
}

@@ -436,2 +436,3 @@ return true;

buffers[i] = {
levelID: i,
levelWidth: levels > 1 ? levelWidth : alignedLevelWidth,

@@ -1159,2 +1160,3 @@ levelHeight: levels > 1 ? levelHeight : alignedLevelHeight,

mips[mipmapLevel] = {
levelID: mipmapLevel,
levelWidth: numberOfMipmapLevels > 1 ? mipWidth : alignedMipWidth,

@@ -1161,0 +1163,0 @@ levelHeight: numberOfMipmapLevels > 1 ? mipHeight : alignedMipHeight,

/*!
* @pixi/compressed-textures - v5.4.0-rc.2
* Compiled Tue, 17 Nov 2020 01:47:11 UTC
* @pixi/compressed-textures - v5.4.0-rc.3
* Compiled Thu, 10 Dec 2020 03:22:17 UTC
*

@@ -8,3 +8,3 @@ * @pixi/compressed-textures is licensed under the MIT License.

*/
import{ViewableBuffer as _,BufferResource as R,BaseTexture as T,Texture as e}from"@pixi/core";import{LoaderResource as E}from"@pixi/loaders";import{MIPMAP_MODES as G,ALPHA_MODES as t,TYPES as O,FORMATS as A}from"@pixi/constants";var M,S;!function(_){_[_.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",_[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",_[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",_[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",_[_.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",_[_.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",_[_.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",_[_.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",_[_.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",_[_.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",_[_.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",_[_.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",_[_.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",_[_.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",_[_.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",_[_.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",_[_.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",_[_.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",_[_.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",_[_.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",_[_.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",_[_.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",_[_.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL"}(S||(S={}));var D=((M={})[S.COMPRESSED_RGB_S3TC_DXT1_EXT]=.5,M[S.COMPRESSED_RGBA_S3TC_DXT1_EXT]=.5,M[S.COMPRESSED_RGBA_S3TC_DXT3_EXT]=1,M[S.COMPRESSED_RGBA_S3TC_DXT5_EXT]=1,M[S.COMPRESSED_SRGB_S3TC_DXT1_EXT]=.5,M[S.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=.5,M[S.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=1,M[S.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=1,M[S.COMPRESSED_R11_EAC]=.5,M[S.COMPRESSED_SIGNED_R11_EAC]=.5,M[S.COMPRESSED_RG11_EAC]=1,M[S.COMPRESSED_SIGNED_RG11_EAC]=1,M[S.COMPRESSED_RGB8_ETC2]=.5,M[S.COMPRESSED_RGBA8_ETC2_EAC]=.5,M[S.COMPRESSED_SRGB8_ETC2]=.5,M[S.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=.5,M[S.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,M[S.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,M[S.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=.5,M[S.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=.5,M[S.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=.25,M[S.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=.25,M[S.COMPRESSED_RGB_ETC1_WEBGL]=.5,M[S.COMPRESSED_RGB_ATC_WEBGL]=.5,M[S.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=1,M[S.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=1,M),r=function(_,R){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,R){_.__proto__=R}||function(_,R){for(var T in R)R.hasOwnProperty(T)&&(_[T]=R[T])})(_,R)};function I(_,R){function T(){this.constructor=_}r(_,R),_.prototype=null===R?Object.create(R):(T.prototype=R.prototype,new T)}function n(_,R){var T,e,E,G,t={label:0,sent:function(){if(1&E[0])throw E[1];return E[1]},trys:[],ops:[]};return G={next:O(0),throw:O(1),return:O(2)},"function"==typeof Symbol&&(G[Symbol.iterator]=function(){return this}),G;function O(G){return function(O){return function(G){if(T)throw new TypeError("Generator is already executing.");for(;t;)try{if(T=1,e&&(E=2&G[0]?e.return:G[0]?e.throw||((E=e.return)&&E.call(e),0):e.next)&&!(E=E.call(e,G[1])).done)return E;switch(e=0,E&&(G=[2&G[0],E.value]),G[0]){case 0:case 1:E=G;break;case 4:return t.label++,{value:G[1],done:!1};case 5:t.label++,e=G[1],G=[0];continue;case 7:G=t.ops.pop(),t.trys.pop();continue;default:if(!(E=(E=t.trys).length>0&&E[E.length-1])&&(6===G[0]||2===G[0])){t=0;continue}if(3===G[0]&&(!E||G[1]>E[0]&&G[1]<E[3])){t.label=G[1];break}if(6===G[0]&&t.label<E[1]){t.label=E[1],E=G;break}if(E&&t.label<E[2]){t.label=E[2],t.ops.push(G);break}E[2]&&t.ops.pop(),t.trys.pop();continue}G=R.call(_,t)}catch(_){G=[6,_],e=0}finally{T=E=0}if(5&G[0])throw G[1];return{value:G[0]?G[1]:void 0,done:!0}}([G,O])}}}var X,o,F=function(R){function T(T,e){void 0===e&&(e={width:1,height:1,autoLoad:!0});var E,G,t=this;return"string"==typeof T?(E=T,G=new Uint8Array):(E=null,G=T),(t=R.call(this,G,e)||this).origin=E,t.buffer=G?new _(G):null,t.origin&&!1!==e.autoLoad&&t.load(),G&&G.length&&(t.loaded=!0,t.onBlobLoaded(t.buffer.rawBinaryData)),t}return I(T,R),T.prototype.onBlobLoaded=function(_){},T.prototype.load=function(){return R=this,T=void 0,e=Promise,E=function(){var R;return n(this,function(T){switch(T.label){case 0:return[4,fetch(this.origin)];case 1:return[4,T.sent().blob()];case 2:return[4,T.sent().arrayBuffer()];case 3:return R=T.sent(),this.data=new Uint32Array(R),this.buffer=new _(R),this.loaded=!0,this.onBlobLoaded(R),this.update(),[2,this]}})},new(e||(e=Promise))(function(_,G){function t(_){try{A(E.next(_))}catch(_){G(_)}}function O(_){try{A(E.throw(_))}catch(_){G(_)}}function A(R){R.done?_(R.value):new e(function(_){_(R.value)}).then(t,O)}A((E=E.apply(R,T||[])).next())});var R,T,e,E},T}(R),B=function(_){function R(T,e){var E=_.call(this,T,e)||this;return E.format=e.format,E.levels=e.levels||1,E._width=e.width,E._height=e.height,E._extension=R._formatToExtension(E.format),(e.levelBuffers||E.buffer)&&(E._levelBuffers=e.levelBuffers||R._createLevelBuffers(T instanceof Uint8Array?T:E.buffer.uint8View,E.format,E.levels,4,4,E.width,E.height)),E}return I(R,_),R.prototype.upload=function(_,R,T){var e=_.gl;if(!_.context.extensions[this._extension])throw new Error(this._extension+" textures are not supported on the current machine");if(!this._levelBuffers)return!1;for(var E=0,G=this.levels;E<G;E++){var t=this._levelBuffers[E],O=t.levelWidth,A=t.levelHeight,M=t.levelBuffer;e.compressedTexImage2D(e.TEXTURE_2D,0,this.format,O,A,0,M)}return!0},R.prototype.onBlobLoaded=function(){this._levelBuffers=R._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)},R._formatToExtension=function(_){if(_>=33776&&_<=33779)return"s3tc";if(_>=37488&&_<=37497)return"etc";if(_>=35840&&_<=35843)return"pvrtc";if(_>=36196)return"etc1";if(_>=35986&&_<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},R._createLevelBuffers=function(_,R,T,e,E,G,t){for(var O=new Array(T),A=_.byteOffset,M=G,S=t,r=M+e-1&~(e-1),I=S+E-1&~(E-1),n=r*I*D[R],X=0;X<T;X++)O[X]={levelWidth:T>1?M:r,levelHeight:T>1?S:I,levelBuffer:new Uint8Array(_.buffer,A,n)},A+=n,n=(r=(M=M>>1||1)+e-1&~(e-1))*(I=(S=S>>1||1)+E-1&~(E-1))*D[R];return O},R}(F),a=function(){function _(){}return _.use=function(R,T){var e=R.data;if(_.textureExtensions||_.autoDetectExtensions(),R.type===E.TYPE.JSON&&e&&e.cacheID&&e.textures){for(var G=e.textures,t=void 0,O=void 0,A=0,M=G.length;A<M;A++){var S=G[A],D=S.src,r=S.format;if(r||(O=D),_.textureFormats[r]){t=D;break}}if(!(t=t||O))throw new Error("Cannot load compressed-textures in "+R.url+", make sure you provide a fallback");if(t===R.url)throw new Error("URL of compressed texture cannot be the same as the manifest's URL");var I={crossOrigin:R.crossOrigin,metadata:R.metadata.imageMetadata,parentResource:R};this.add(e.cacheID,t,I,function(){T()})}else T()},_.autoDetectExtensions=function(R){if(!R){var T=document.createElement("canvas").getContext("webgl");if(!T)return void console.error("WebGL not available for compressed textures. Silently failing.");R={s3tc:T.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:T.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:T.getExtension("WEBGL_compressed_texture_etc"),etc1:T.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:T.getExtension("WEBGL_compressed_texture_pvrtc")||T.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:T.getExtension("WEBGL_compressed_texture_atc"),astc:T.getExtension("WEBGL_compressed_texture_astc")}}for(var e in _.textureExtensions=R,_.textureFormats={},R){var E=R[e];E&&Object.assign(_.textureFormats,Object.getPrototypeOf(E))}},_}();function i(_,R){R&&R.forEach(function(R,E){var O=new T(R,{mipmap:G.OFF,alphaMode:t.NO_PREMULTIPLIED_ALPHA}),A=_+"-"+(E+1);T.addToCache(O,A),e.addToCache(new e(O),A),0===E&&(T.addToCache(O,_),e.addToCache(new e(O),_))})}E.setExtensionXhrType("dds",E.XHR_RESPONSE_TYPE.BUFFER);var P,C,s=3,N=4,u=7,f=19,U=2,L=0,c=1,l=2,d=3;!function(_){_[_.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",_[_.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",_[_.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",_[_.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",_[_.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",_[_.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",_[_.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",_[_.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",_[_.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",_[_.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",_[_.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",_[_.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",_[_.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",_[_.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",_[_.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",_[_.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",_[_.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",_[_.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",_[_.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",_[_.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",_[_.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",_[_.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",_[_.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",_[_.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",_[_.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",_[_.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",_[_.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",_[_.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",_[_.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",_[_.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",_[_.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",_[_.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",_[_.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",_[_.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",_[_.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",_[_.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",_[_.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",_[_.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",_[_.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",_[_.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",_[_.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",_[_.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",_[_.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",_[_.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",_[_.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",_[_.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",_[_.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",_[_.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",_[_.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",_[_.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",_[_.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",_[_.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",_[_.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",_[_.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",_[_.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",_[_.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",_[_.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",_[_.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",_[_.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",_[_.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",_[_.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",_[_.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",_[_.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",_[_.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",_[_.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",_[_.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",_[_.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",_[_.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",_[_.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",_[_.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",_[_.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",_[_.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",_[_.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",_[_.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",_[_.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",_[_.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",_[_.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",_[_.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",_[_.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",_[_.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",_[_.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",_[_.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",_[_.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",_[_.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",_[_.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",_[_.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",_[_.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",_[_.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",_[_.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",_[_.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",_[_.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",_[_.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",_[_.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",_[_.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",_[_.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",_[_.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",_[_.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",_[_.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",_[_.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",_[_.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",_[_.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",_[_.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",_[_.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",_[_.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",_[_.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",_[_.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",_[_.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",_[_.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",_[_.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",_[_.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",_[_.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",_[_.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",_[_.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",_[_.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",_[_.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",_[_.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",_[_.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",_[_.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",_[_.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",_[_.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",_[_.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",_[_.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT"}(P||(P={})),function(_){_[_.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",_[_.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",_[_.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D"}(C||(C={}));var h,p,v,w=((X={})[827611204]=S.COMPRESSED_RGBA_S3TC_DXT1_EXT,X[861165636]=S.COMPRESSED_RGBA_S3TC_DXT3_EXT,X[894720068]=S.COMPRESSED_RGBA_S3TC_DXT5_EXT,X),Y=((o={})[P.DXGI_FORMAT_BC1_TYPELESS]=S.COMPRESSED_RGBA_S3TC_DXT1_EXT,o[P.DXGI_FORMAT_BC1_UNORM]=S.COMPRESSED_RGBA_S3TC_DXT1_EXT,o[P.DXGI_FORMAT_BC2_TYPELESS]=S.COMPRESSED_RGBA_S3TC_DXT3_EXT,o[P.DXGI_FORMAT_BC2_UNORM]=S.COMPRESSED_RGBA_S3TC_DXT3_EXT,o[P.DXGI_FORMAT_BC3_TYPELESS]=S.COMPRESSED_RGBA_S3TC_DXT5_EXT,o[P.DXGI_FORMAT_BC3_UNORM]=S.COMPRESSED_RGBA_S3TC_DXT5_EXT,o[P.DXGI_FORMAT_BC1_UNORM_SRGB]=S.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,o[P.DXGI_FORMAT_BC2_UNORM_SRGB]=S.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,o[P.DXGI_FORMAT_BC3_UNORM_SRGB]=S.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,o),x=function(){function _(){}return _.use=function(R,T){"dds"===R.extension&&R.data&&i(R.name||R.url,_.parse(R.data)),T()},_.parse=function(_){var R=new Uint32Array(_);if(542327876!==R[0])throw new Error("Invalid DDS file magic word");var T=new Uint32Array(_,0,124/Uint32Array.BYTES_PER_ELEMENT),e=T[s],E=T[N],G=T[u],t=new Uint32Array(_,f*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),O=t[1];if(4&O){var A=t[U];if(808540228!==A){var M=w[A],S=new Uint8Array(_,128);return[new B(S,{format:M,width:E,height:e,levels:G})]}var r=new Uint32Array(R.buffer,128,20/Uint32Array.BYTES_PER_ELEMENT),I=r[L],n=r[c],X=r[l],o=r[d],F=Y[I];if(void 0===F)throw new Error("DDSLoader cannot parse texture data with DXGI format "+I);if(4===X)throw new Error("DDSLoader does not support cubemap textures");if(n===C.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSLoader does not supported 3D texture data");var a=new Array;if(1===o)a.push(new Uint8Array(_,148));else{for(var i=D[F],P=0,h=E,p=e,v=0;v<G;v++){P+=Math.max(1,h+3&-4)*Math.max(1,p+3&-4)*i,h>>>=1,p>>>=1}var x=148;for(v=0;v<o;v++)a.push(new Uint8Array(_,x,P)),x+=P}return a.map(function(_){return new B(_,{format:F,width:E,height:e,levels:G})})}if(64&O)throw new Error("DDSLoader does not support uncompressed texture data.");if(512&O)throw new Error("DDSLoader does not supported YUV uncompressed texture data.");if(131072&O)throw new Error("DDSLoader does not support single-channel (lumninance) texture data!");if(2&O)throw new Error("DDSLoader does not support single-channel (alpha) texture data!");throw new Error("DDSLoader failed to load a texture file due to an unknown reason!")},_}();E.setExtensionXhrType("ktx",E.XHR_RESPONSE_TYPE.BUFFER);var H=[171,75,84,88,32,49,49,187,13,10,26,10],m=12,y=16,g=24,b=28,V=36,W=40,k=44,K=48,Q=52,j=56,J=60,q=((h={})[O.UNSIGNED_BYTE]=1,h[O.UNSIGNED_SHORT]=2,h[O.FLOAT]=4,h[O.HALF_FLOAT]=8,h),z=((p={})[A.RGBA]=4,p[A.RGB]=3,p[A.LUMINANCE]=1,p[A.LUMINANCE_ALPHA]=2,p[A.ALPHA]=1,p),Z=((v={})[O.UNSIGNED_SHORT_4_4_4_4]=2,v[O.UNSIGNED_SHORT_5_5_5_1]=2,v[O.UNSIGNED_SHORT_5_6_5]=2,v),$=function(){function _(){}return _.use=function(R,T){"ktx"===R.extension&&R.data&&_.parse(R.name||R.url,R.data),T()},_.parse=function(R,T){var e=new DataView(T);if(_.validate(R,e)){var E=67305985===e.getUint32(m,!0),G=e.getUint32(y,E),t=e.getUint32(g,E),O=e.getUint32(b,E),A=e.getUint32(V,E),M=e.getUint32(W,E)||1,S=e.getUint32(k,E)||1,r=e.getUint32(K,E)||1,I=e.getUint32(Q,E),n=e.getUint32(j,E),X=e.getUint32(J,E);if(0===M||1!==S)throw new Error("Only 2D textures are supported");if(1!==I)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(1!==r)throw new Error("WebGL does not support array textures");var o,F=A+3&-4,a=M+3&-4,P=new Array(r),C=A*M;if(0===G&&(C=F*a),void 0===(o=0!==G?q[G]?q[G]*z[t]:Z[G]:D[O]))throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");for(var s=C*o,N=A,u=M,f=F,U=a,L=64+X,c=0;c<n;c++){for(var l=e.getUint32(L,E),d=L+4,h=0;h<r;h++){var p=P[h];p||(p=P[h]=new Array(n)),p[c]={levelWidth:n>1?N:f,levelHeight:n>1?u:U,levelBuffer:new Uint8Array(T,d,s)},d+=s}L=(L+=l+4)%4!=0?L+4-L%4:L,s=(f=(N=N>>1||1)+4-1&-4)*(U=(u=u>>1||1)+4-1&-4)*o}if(0!==G)throw new Error("TODO: Uncompressed");i(R,P.map(function(_){return new B(null,{format:O,width:A,height:M,levels:n,levelBuffers:_})}))}},_.validate=function(_,R){for(var T=0;T<H.length;T++)if(R.getUint8(T)!==H[T])return console.error(_+" is not a valid *.ktx file!"),!1;return!0},_}();export{F as BlobResource,a as CompressedTextureLoader,B as CompressedTextureResource,x as DDSLoader,z as FORMATS_TO_COMPONENTS,S as INTERNAL_FORMATS,D as INTERNAL_FORMAT_TO_BYTES_PER_PIXEL,$ as KTXLoader,q as TYPES_TO_BYTES_PER_COMPONENT,Z as TYPES_TO_BYTES_PER_PIXEL};
import{ViewableBuffer as _,BufferResource as R,BaseTexture as T,Texture as e}from"@pixi/core";import{LoaderResource as E}from"@pixi/loaders";import{MIPMAP_MODES as G,ALPHA_MODES as t,TYPES as O,FORMATS as A}from"@pixi/constants";var D,M;!function(_){_[_.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",_[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",_[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",_[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",_[_.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",_[_.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",_[_.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",_[_.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",_[_.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",_[_.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",_[_.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",_[_.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",_[_.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",_[_.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",_[_.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",_[_.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",_[_.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",_[_.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",_[_.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",_[_.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",_[_.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",_[_.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",_[_.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL"}(M||(M={}));var S=((D={})[M.COMPRESSED_RGB_S3TC_DXT1_EXT]=.5,D[M.COMPRESSED_RGBA_S3TC_DXT1_EXT]=.5,D[M.COMPRESSED_RGBA_S3TC_DXT3_EXT]=1,D[M.COMPRESSED_RGBA_S3TC_DXT5_EXT]=1,D[M.COMPRESSED_SRGB_S3TC_DXT1_EXT]=.5,D[M.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=.5,D[M.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=1,D[M.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=1,D[M.COMPRESSED_R11_EAC]=.5,D[M.COMPRESSED_SIGNED_R11_EAC]=.5,D[M.COMPRESSED_RG11_EAC]=1,D[M.COMPRESSED_SIGNED_RG11_EAC]=1,D[M.COMPRESSED_RGB8_ETC2]=.5,D[M.COMPRESSED_RGBA8_ETC2_EAC]=.5,D[M.COMPRESSED_SRGB8_ETC2]=.5,D[M.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=.5,D[M.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,D[M.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,D[M.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=.5,D[M.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=.5,D[M.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=.25,D[M.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=.25,D[M.COMPRESSED_RGB_ETC1_WEBGL]=.5,D[M.COMPRESSED_RGB_ATC_WEBGL]=.5,D[M.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=1,D[M.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=1,D),r=function(_,R){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,R){_.__proto__=R}||function(_,R){for(var T in R)R.hasOwnProperty(T)&&(_[T]=R[T])})(_,R)};function I(_,R){function T(){this.constructor=_}r(_,R),_.prototype=null===R?Object.create(R):(T.prototype=R.prototype,new T)}function n(_,R){var T,e,E,G,t={label:0,sent:function(){if(1&E[0])throw E[1];return E[1]},trys:[],ops:[]};return G={next:O(0),throw:O(1),return:O(2)},"function"==typeof Symbol&&(G[Symbol.iterator]=function(){return this}),G;function O(G){return function(O){return function(G){if(T)throw new TypeError("Generator is already executing.");for(;t;)try{if(T=1,e&&(E=2&G[0]?e.return:G[0]?e.throw||((E=e.return)&&E.call(e),0):e.next)&&!(E=E.call(e,G[1])).done)return E;switch(e=0,E&&(G=[2&G[0],E.value]),G[0]){case 0:case 1:E=G;break;case 4:return t.label++,{value:G[1],done:!1};case 5:t.label++,e=G[1],G=[0];continue;case 7:G=t.ops.pop(),t.trys.pop();continue;default:if(!(E=(E=t.trys).length>0&&E[E.length-1])&&(6===G[0]||2===G[0])){t=0;continue}if(3===G[0]&&(!E||G[1]>E[0]&&G[1]<E[3])){t.label=G[1];break}if(6===G[0]&&t.label<E[1]){t.label=E[1],E=G;break}if(E&&t.label<E[2]){t.label=E[2],t.ops.push(G);break}E[2]&&t.ops.pop(),t.trys.pop();continue}G=R.call(_,t)}catch(_){G=[6,_],e=0}finally{T=E=0}if(5&G[0])throw G[1];return{value:G[0]?G[1]:void 0,done:!0}}([G,O])}}}var X,o,F=function(R){function T(T,e){void 0===e&&(e={width:1,height:1,autoLoad:!0});var E,G,t=this;return"string"==typeof T?(E=T,G=new Uint8Array):(E=null,G=T),(t=R.call(this,G,e)||this).origin=E,t.buffer=G?new _(G):null,t.origin&&!1!==e.autoLoad&&t.load(),G&&G.length&&(t.loaded=!0,t.onBlobLoaded(t.buffer.rawBinaryData)),t}return I(T,R),T.prototype.onBlobLoaded=function(_){},T.prototype.load=function(){return R=this,T=void 0,e=Promise,E=function(){var R;return n(this,function(T){switch(T.label){case 0:return[4,fetch(this.origin)];case 1:return[4,T.sent().blob()];case 2:return[4,T.sent().arrayBuffer()];case 3:return R=T.sent(),this.data=new Uint32Array(R),this.buffer=new _(R),this.loaded=!0,this.onBlobLoaded(R),this.update(),[2,this]}})},new(e||(e=Promise))(function(_,G){function t(_){try{A(E.next(_))}catch(_){G(_)}}function O(_){try{A(E.throw(_))}catch(_){G(_)}}function A(R){R.done?_(R.value):new e(function(_){_(R.value)}).then(t,O)}A((E=E.apply(R,T||[])).next())});var R,T,e,E},T}(R),B=function(_){function R(T,e){var E=_.call(this,T,e)||this;return E.format=e.format,E.levels=e.levels||1,E._width=e.width,E._height=e.height,E._extension=R._formatToExtension(E.format),(e.levelBuffers||E.buffer)&&(E._levelBuffers=e.levelBuffers||R._createLevelBuffers(T instanceof Uint8Array?T:E.buffer.uint8View,E.format,E.levels,4,4,E.width,E.height)),E}return I(R,_),R.prototype.upload=function(_,R,T){var e=_.gl;if(!_.context.extensions[this._extension])throw new Error(this._extension+" textures are not supported on the current machine");if(!this._levelBuffers)return!1;for(var E=0,G=this.levels;E<G;E++){var t=this._levelBuffers[E],O=t.levelID,A=t.levelWidth,D=t.levelHeight,M=t.levelBuffer;e.compressedTexImage2D(e.TEXTURE_2D,O,this.format,A,D,0,M)}return!0},R.prototype.onBlobLoaded=function(){this._levelBuffers=R._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)},R._formatToExtension=function(_){if(_>=33776&&_<=33779)return"s3tc";if(_>=37488&&_<=37497)return"etc";if(_>=35840&&_<=35843)return"pvrtc";if(_>=36196)return"etc1";if(_>=35986&&_<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},R._createLevelBuffers=function(_,R,T,e,E,G,t){for(var O=new Array(T),A=_.byteOffset,D=G,M=t,r=D+e-1&~(e-1),I=M+E-1&~(E-1),n=r*I*S[R],X=0;X<T;X++)O[X]={levelID:X,levelWidth:T>1?D:r,levelHeight:T>1?M:I,levelBuffer:new Uint8Array(_.buffer,A,n)},A+=n,n=(r=(D=D>>1||1)+e-1&~(e-1))*(I=(M=M>>1||1)+E-1&~(E-1))*S[R];return O},R}(F),a=function(){function _(){}return _.use=function(R,T){var e=R.data;if(_.textureExtensions||_.autoDetectExtensions(),R.type===E.TYPE.JSON&&e&&e.cacheID&&e.textures){for(var G=e.textures,t=void 0,O=void 0,A=0,D=G.length;A<D;A++){var M=G[A],S=M.src,r=M.format;if(r||(O=S),_.textureFormats[r]){t=S;break}}if(!(t=t||O))throw new Error("Cannot load compressed-textures in "+R.url+", make sure you provide a fallback");if(t===R.url)throw new Error("URL of compressed texture cannot be the same as the manifest's URL");var I={crossOrigin:R.crossOrigin,metadata:R.metadata.imageMetadata,parentResource:R};this.add(e.cacheID,t,I,function(){T()})}else T()},_.autoDetectExtensions=function(R){if(!R){var T=document.createElement("canvas").getContext("webgl");if(!T)return void console.error("WebGL not available for compressed textures. Silently failing.");R={s3tc:T.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:T.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:T.getExtension("WEBGL_compressed_texture_etc"),etc1:T.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:T.getExtension("WEBGL_compressed_texture_pvrtc")||T.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:T.getExtension("WEBGL_compressed_texture_atc"),astc:T.getExtension("WEBGL_compressed_texture_astc")}}for(var e in _.textureExtensions=R,_.textureFormats={},R){var E=R[e];E&&Object.assign(_.textureFormats,Object.getPrototypeOf(E))}},_}();function i(_,R){R&&R.forEach(function(R,E){var O=new T(R,{mipmap:G.OFF,alphaMode:t.NO_PREMULTIPLIED_ALPHA}),A=_+"-"+(E+1);T.addToCache(O,A),e.addToCache(new e(O),A),0===E&&(T.addToCache(O,_),e.addToCache(new e(O),_))})}E.setExtensionXhrType("dds",E.XHR_RESPONSE_TYPE.BUFFER);var P,C,s=3,N=4,u=7,f=19,U=2,L=0,l=1,c=2,d=3;!function(_){_[_.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",_[_.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",_[_.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",_[_.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",_[_.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",_[_.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",_[_.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",_[_.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",_[_.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",_[_.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",_[_.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",_[_.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",_[_.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",_[_.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",_[_.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",_[_.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",_[_.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",_[_.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",_[_.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",_[_.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",_[_.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",_[_.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",_[_.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",_[_.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",_[_.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",_[_.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",_[_.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",_[_.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",_[_.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",_[_.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",_[_.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",_[_.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",_[_.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",_[_.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",_[_.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",_[_.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",_[_.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",_[_.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",_[_.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",_[_.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",_[_.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",_[_.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",_[_.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",_[_.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",_[_.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",_[_.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",_[_.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",_[_.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",_[_.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",_[_.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",_[_.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",_[_.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",_[_.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",_[_.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",_[_.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",_[_.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",_[_.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",_[_.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",_[_.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",_[_.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",_[_.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",_[_.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",_[_.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",_[_.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",_[_.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",_[_.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",_[_.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",_[_.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",_[_.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",_[_.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",_[_.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",_[_.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",_[_.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",_[_.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",_[_.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",_[_.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",_[_.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",_[_.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",_[_.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",_[_.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",_[_.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",_[_.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",_[_.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",_[_.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",_[_.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",_[_.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",_[_.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",_[_.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",_[_.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",_[_.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",_[_.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",_[_.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",_[_.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",_[_.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",_[_.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",_[_.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",_[_.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",_[_.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",_[_.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",_[_.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",_[_.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",_[_.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",_[_.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",_[_.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",_[_.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",_[_.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",_[_.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",_[_.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",_[_.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",_[_.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",_[_.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",_[_.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",_[_.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",_[_.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",_[_.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",_[_.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",_[_.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",_[_.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",_[_.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",_[_.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",_[_.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",_[_.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT"}(P||(P={})),function(_){_[_.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",_[_.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",_[_.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D"}(C||(C={}));var h,p,v,w=((X={})[827611204]=M.COMPRESSED_RGBA_S3TC_DXT1_EXT,X[861165636]=M.COMPRESSED_RGBA_S3TC_DXT3_EXT,X[894720068]=M.COMPRESSED_RGBA_S3TC_DXT5_EXT,X),Y=((o={})[P.DXGI_FORMAT_BC1_TYPELESS]=M.COMPRESSED_RGBA_S3TC_DXT1_EXT,o[P.DXGI_FORMAT_BC1_UNORM]=M.COMPRESSED_RGBA_S3TC_DXT1_EXT,o[P.DXGI_FORMAT_BC2_TYPELESS]=M.COMPRESSED_RGBA_S3TC_DXT3_EXT,o[P.DXGI_FORMAT_BC2_UNORM]=M.COMPRESSED_RGBA_S3TC_DXT3_EXT,o[P.DXGI_FORMAT_BC3_TYPELESS]=M.COMPRESSED_RGBA_S3TC_DXT5_EXT,o[P.DXGI_FORMAT_BC3_UNORM]=M.COMPRESSED_RGBA_S3TC_DXT5_EXT,o[P.DXGI_FORMAT_BC1_UNORM_SRGB]=M.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,o[P.DXGI_FORMAT_BC2_UNORM_SRGB]=M.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,o[P.DXGI_FORMAT_BC3_UNORM_SRGB]=M.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,o),x=function(){function _(){}return _.use=function(R,T){"dds"===R.extension&&R.data&&i(R.name||R.url,_.parse(R.data)),T()},_.parse=function(_){var R=new Uint32Array(_);if(542327876!==R[0])throw new Error("Invalid DDS file magic word");var T=new Uint32Array(_,0,124/Uint32Array.BYTES_PER_ELEMENT),e=T[s],E=T[N],G=T[u],t=new Uint32Array(_,f*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),O=t[1];if(4&O){var A=t[U];if(808540228!==A){var D=w[A],M=new Uint8Array(_,128);return[new B(M,{format:D,width:E,height:e,levels:G})]}var r=new Uint32Array(R.buffer,128,20/Uint32Array.BYTES_PER_ELEMENT),I=r[L],n=r[l],X=r[c],o=r[d],F=Y[I];if(void 0===F)throw new Error("DDSLoader cannot parse texture data with DXGI format "+I);if(4===X)throw new Error("DDSLoader does not support cubemap textures");if(n===C.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSLoader does not supported 3D texture data");var a=new Array;if(1===o)a.push(new Uint8Array(_,148));else{for(var i=S[F],P=0,h=E,p=e,v=0;v<G;v++){P+=Math.max(1,h+3&-4)*Math.max(1,p+3&-4)*i,h>>>=1,p>>>=1}var x=148;for(v=0;v<o;v++)a.push(new Uint8Array(_,x,P)),x+=P}return a.map(function(_){return new B(_,{format:F,width:E,height:e,levels:G})})}if(64&O)throw new Error("DDSLoader does not support uncompressed texture data.");if(512&O)throw new Error("DDSLoader does not supported YUV uncompressed texture data.");if(131072&O)throw new Error("DDSLoader does not support single-channel (lumninance) texture data!");if(2&O)throw new Error("DDSLoader does not support single-channel (alpha) texture data!");throw new Error("DDSLoader failed to load a texture file due to an unknown reason!")},_}();E.setExtensionXhrType("ktx",E.XHR_RESPONSE_TYPE.BUFFER);var H=[171,75,84,88,32,49,49,187,13,10,26,10],m=12,y=16,g=24,b=28,V=36,W=40,k=44,K=48,Q=52,j=56,J=60,q=((h={})[O.UNSIGNED_BYTE]=1,h[O.UNSIGNED_SHORT]=2,h[O.FLOAT]=4,h[O.HALF_FLOAT]=8,h),z=((p={})[A.RGBA]=4,p[A.RGB]=3,p[A.LUMINANCE]=1,p[A.LUMINANCE_ALPHA]=2,p[A.ALPHA]=1,p),Z=((v={})[O.UNSIGNED_SHORT_4_4_4_4]=2,v[O.UNSIGNED_SHORT_5_5_5_1]=2,v[O.UNSIGNED_SHORT_5_6_5]=2,v),$=function(){function _(){}return _.use=function(R,T){"ktx"===R.extension&&R.data&&_.parse(R.name||R.url,R.data),T()},_.parse=function(R,T){var e=new DataView(T);if(_.validate(R,e)){var E=67305985===e.getUint32(m,!0),G=e.getUint32(y,E),t=e.getUint32(g,E),O=e.getUint32(b,E),A=e.getUint32(V,E),D=e.getUint32(W,E)||1,M=e.getUint32(k,E)||1,r=e.getUint32(K,E)||1,I=e.getUint32(Q,E),n=e.getUint32(j,E),X=e.getUint32(J,E);if(0===D||1!==M)throw new Error("Only 2D textures are supported");if(1!==I)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(1!==r)throw new Error("WebGL does not support array textures");var o,F=A+3&-4,a=D+3&-4,P=new Array(r),C=A*D;if(0===G&&(C=F*a),void 0===(o=0!==G?q[G]?q[G]*z[t]:Z[G]:S[O]))throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");for(var s=C*o,N=A,u=D,f=F,U=a,L=64+X,l=0;l<n;l++){for(var c=e.getUint32(L,E),d=L+4,h=0;h<r;h++){var p=P[h];p||(p=P[h]=new Array(n)),p[l]={levelID:l,levelWidth:n>1?N:f,levelHeight:n>1?u:U,levelBuffer:new Uint8Array(T,d,s)},d+=s}L=(L+=c+4)%4!=0?L+4-L%4:L,s=(f=(N=N>>1||1)+4-1&-4)*(U=(u=u>>1||1)+4-1&-4)*o}if(0!==G)throw new Error("TODO: Uncompressed");i(R,P.map(function(_){return new B(null,{format:O,width:A,height:D,levels:n,levelBuffers:_})}))}},_.validate=function(_,R){for(var T=0;T<H.length;T++)if(R.getUint8(T)!==H[T])return console.error(_+" is not a valid *.ktx file!"),!1;return!0},_}();export{F as BlobResource,a as CompressedTextureLoader,B as CompressedTextureResource,x as DDSLoader,z as FORMATS_TO_COMPONENTS,M as INTERNAL_FORMATS,S as INTERNAL_FORMAT_TO_BYTES_PER_PIXEL,$ as KTXLoader,q as TYPES_TO_BYTES_PER_COMPONENT,Z as TYPES_TO_BYTES_PER_PIXEL};
//# sourceMappingURL=compressed-textures.min.js.map

@@ -37,2 +37,3 @@ import { BaseTexture } from '@pixi/core';

export declare type CompressedLevelBuffer = {
levelID: number;
levelWidth: number;

@@ -39,0 +40,0 @@ levelHeight: number;

{
"name": "@pixi/compressed-textures",
"version": "5.4.0-rc.2",
"version": "5.4.0-rc.3",
"description": "Loaders for compressed texture file formats",

@@ -38,7 +38,7 @@ "keywords": [

"dependencies": {
"@pixi/constants": "5.4.0-rc.2",
"@pixi/core": "5.4.0-rc.2",
"@pixi/loaders": "5.4.0-rc.2"
"@pixi/constants": "5.4.0-rc.3",
"@pixi/core": "5.4.0-rc.3",
"@pixi/loaders": "5.4.0-rc.3"
},
"gitHead": "fc4ca303a8f03eee754e12e0e769c263d8b19465"
"gitHead": "0c48db94f0521d85cc226fc4b15f69c30d53c765"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc