hi-ucs/front/public/leaflet/libs/iClientfor3D/Workers/transcodeCRNToDXT.js

80 lines
164 KiB
Vue
Raw Normal View History

2022-06-14 09:32:49 +08:00
/**
* Cesium - https://github.com/AnalyticalGraphicsInc/cesium
*
* Copyright 2011-2017 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
*/
/**
* @licence
* crunch/crnlib uses the ZLIB license:
* http://opensource.org/licenses/Zlib
*
* Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source distribution.
*/
/**
* @license
*
* Copyright (c) 2014, Brandon Jones. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
!function(){define("Core/defined",[],function(){"use strict";function e(e){return void 0!==e&&null!==e}return e}),define("Core/defineProperties",["./defined"],function(e){"use strict";var r=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),i=Object.defineProperties;return r&&e(i)||(i=function(e){return e}),i}),define("Core/CompressedTextureBuffer",["./defined","./defineProperties"],function(e,r){"use strict";function i(e,r,i,t){this._format=e,this._width=r,this._height=i,this._buffer=t}return r(i.prototype,{internalFormat:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}},bufferView:{get:function(){return this._buffer}}}),i.clone=function(r){return e(r)?new i(r._format,r._width,r._height,r._buffer):void 0},i.prototype.clone=function(){return i.clone(this)},i}),define("Core/freezeObject",["./defined"],function(e){"use strict";var r=Object.freeze;return e(r)||(r=function(e){return e}),r}),define("Core/WebGLConstants",["./freezeObject"],function(e){"use strict";var r={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:357
},1),r()},1)):r()))}function exit(e,r){r&&Module.noExitRuntime||(Module.noExitRuntime||(ABORT=!0,EXITSTATUS=e,STACKTOP=initialStackTop,exitRuntime(),Module.onExit&&Module.onExit(e)),ENVIRONMENT_IS_NODE&&process.exit(e),Module.quit(e,new ExitStatus(e)))}function abort(e){Module.onAbort&&Module.onAbort(e),void 0!==e?(Module.print(e),Module.printErr(e),e=JSON.stringify(e)):e="",ABORT=!0,EXITSTATUS=1;var r="\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.",i="abort("+e+") at "+stackTrace()+r;throw abortDecorators&&abortDecorators.forEach(function(r){i=r(i,e)}),i}var Module;Module||(Module=("undefined"!=typeof Module?Module:null)||{});var moduleOverrides={};for(var key in Module)Module.hasOwnProperty(key)&&(moduleOverrides[key]=Module[key]);var ENVIRONMENT_IS_WEB=!1,ENVIRONMENT_IS_WORKER=!1,ENVIRONMENT_IS_NODE=!1,ENVIRONMENT_IS_SHELL=!1;if(Module.ENVIRONMENT)if("WEB"===Module.ENVIRONMENT)ENVIRONMENT_IS_WEB=!0;else if("WORKER"===Module.ENVIRONMENT)ENVIRONMENT_IS_WORKER=!0;else if("NODE"===Module.ENVIRONMENT)ENVIRONMENT_IS_NODE=!0;else{if("SHELL"!==Module.ENVIRONMENT)throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.");ENVIRONMENT_IS_SHELL=!0}else ENVIRONMENT_IS_WEB="object"==typeof window,ENVIRONMENT_IS_WORKER="function"==typeof importScripts,ENVIRONMENT_IS_NODE="object"==typeof process&&"function"==typeof require&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER,ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){Module.print||(Module.print=console.log),Module.printErr||(Module.printErr=console.warn);var nodeFS,nodePath;Module.read=function(e,r){nodeFS||(nodeFS=require("fs")),nodePath||(nodePath=require("path")),e=nodePath.normalize(e);var i=nodeFS.readFileSync(e);return r?i:i.toString()},Module.readBinary=function(e){var r=Module.read(e,!0);return r.buffer||(r=new Uint8Array(r)),assert(r.buffer),r},Module.load=function(e){globalEval(read(e))},Module.thisProgram||(process.argv.length>1?Module.thisProgram=process.argv[1].replace(/\\/g,"/"):Module.thisProgram="unknown-program"),Module.arguments=process.argv.slice(2),"undefined"!=typeof module&&(module.exports=Module),process.on("uncaughtException",function(e){if(!(e instanceof ExitStatus))throw e}),Module.inspect=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL)Module.print||(Module.print=print),"undefined"!=typeof printErr&&(Module.printErr=printErr),"undefined"!=typeof read?Module.read=read:Module.read=function(){throw"no read() available"},Module.readBinary=function(e){if("function"==typeof readbuffer)return new Uint8Array(readbuffer(e));var r=read(e,"binary");return assert("object"==typeof r),r},"undefined"!=typeof scriptArgs?Module.arguments=scriptArgs:"undefined"!=typeof arguments&&(Module.arguments=arguments),"function"==typeof quit&&(Module.quit=function(e,r){quit(e)});else{if(!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER)throw"Unknown runtime environment. Where are we?";if(Module.read=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},ENVIRONMENT_IS_WORKER&&(Module.readBinary=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Module.readAsync=function(e,r,i){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="arraybuffer",t.onload=function(){200==t.status||0==t.status&&t.response?r(t.response):i()},t.onerror=i,t.send(null)},"undefined"!=typeof arguments&&(Module.arguments=arguments),"undefined"!=typeof console)Module.print||(Module.print=function(e){console.log(e)}),Module.printErr||(Module.printErr=function(e){console.warn(e)});else{var TRY_USE_DUMP=!1;Module.print||(Module.print=TRY_USE_DUMP&&"undefined"!=typeof dump?function(e){dump(e)}:function(e){})}ENVIRONMENT_IS_WORKER&&(Module.load=importScripts),"undefined"==typeof Module.setWindowTitle&&(Module.setWindowTitle=function(e){document.title=e})}!Module.load&&Module.read&&(Module.load=function(e){globa
___syscall140:___syscall140,___resumeException:___resumeException,___cxa_find_matching_catch:___cxa_find_matching_catch,___syscall146:___syscall146,__ZSt18uncaught_exceptionv:__ZSt18uncaught_exceptionv,DYNAMICTOP_PTR:DYNAMICTOP_PTR,tempDoublePtr:tempDoublePtr,ABORT:ABORT,STACKTOP:STACKTOP,STACK_MAX:STACK_MAX,cttz_i8:cttz_i8};var asm=function(e,r,i){"almost asm";function t(e){return 16777215&ti(e)||ti(e)<=16777215||ti(e)>2147483648?!1:(Vr=new Xr(e),xr=new Yr(e),Wr=new Kr(e),zr=new Zr(e),Jr=new jr(e),qr=new Qr(e),ei=new $r(e),ii=new ri(e),i=e,!0)}function n(e){e=0|e;var r=0,i=0,t=0,n=0,_=0,a=0,o=0,E=0,u=0,f=0,T=0,l=0,c=0,A=0,R=0,s=0,d=0,M=0,S=0,N=0,I=0;I=ai,ai=ai+16|0,l=I;do if(245>e>>>0){if(u=11>e>>>0?16:e+11&-8,e=u>>>3,T=0|Wr[1144],i=T>>>e,3&i|0)return r=(1&i^1)+e|0,e=4616+(r<<1<<2)|0,i=e+8|0,t=0|Wr[i>>2],n=t+8|0,_=0|Wr[n>>2],(0|e)==(0|_)?Wr[1144]=T&~(1<<r):(Wr[_+12>>2]=e,Wr[i>>2]=_),N=r<<3,Wr[t+4>>2]=3|N,N=t+N+4|0,Wr[N>>2]=1|Wr[N>>2],N=n,ai=I,0|N;if(f=0|W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0|t)r=t,e=i;else{if(i=r+16|0,t=0|Wr[i>>2],!t)break;r=t,e=i}Wr[e>>2]=0,i=r}else i=0|Wr[E+8>>2],Wr[i+12>>2]=r,Wr[r+8>>2]=i,i=r;while(0);do if(0|n){if(r=0|Wr[E+28>>2],e=4880+(r<<2)|0,(0|E)==(0|Wr[e>>2])){if(Wr[e>>2]=i,!i){Wr[1145]=o&~(1<<r);break}}else if(Wr[n+16+(((0|Wr[n+16>>2])!=(0|E)&1)<<2)>>2]=i,!i)break;Wr[i+24>>2]=n,r=0|Wr[E+16>>2],0|r&&(Wr[i+16>>2]=r,Wr[r+24>>2]=i),r=0|Wr[E+20>>2],0|r&&(Wr[i+20>>2]=r,Wr[r+24>>2]=i)}while(0);return 16>_>>>0?(N=_+u|0,Wr[E+4>>2]=3|N,N=E+N+4|0,Wr[N>>2]=1|Wr[N>>2]):(Wr[E+4>>2]=3|u,Wr[a+4>>2]=1|_,Wr[a+_>>2]=_,0|f&&(t=0|Wr[1149],r=f>>>3,i=4616+(r<<1<<2)|0,r=1<<r,T&r?(e=i+8|0,r=0|Wr[e>>2]):(Wr[1144]=T|r,r=i,e=i+8|0),Wr[e>>2]=t,Wr[r+12>>2]=t,Wr[t+8>>2]=r,Wr[t+12>>2]=i),Wr[1146]=_,Wr[1149]=a),N=E+8|0,ai=I,0|N}T=u}else T=u}else T=u}else if(4294967231>=e>>>0)if(e=e+11|0,u=-8&e,E=0|Wr[1145]){t=0-u|0,e>>>=8,e?u>>>0>16777215?o=31:(T=(e+1048320|0)>>>16&8,S=e<<T,f=(S+520192|0)>>>16&4,S<<=f,o=(S+245760|0)>>>16&2,o=14-(f|T|o)+(S<<o>>>15)|0,o=u>>>(o+7|0)&1|o<<1):o=0,i=0|Wr[4880+(o<<2)>>2];e:do if(i)for(e=0,a=u<<(31==(0|o)?0:25-(o>>>1)|0),_=0;;){if(n=(-8&Wr[i+4>>2])-u|0,t>>>0>n>>>0){if(!n){e=i,t=0,n=i,S=61;break e}e=i,t=n}if(n=0|Wr[i+20>>2],i=0|Wr[i+16+(a>>>31<<2)>>2],_=0==(0|n)|(0|n)==(0|i)?_:n,n=0==(0|i)){i=_,S=57;break}a<<=1&(1^n)}else i=0,e=0,S=57;while(0);if(57==(0|S)){if(0==(0|i)&0==(0|e)){if(e=2<<o,e=E&(e|0-e),!e){T=u;break}T=(e&0-e)+-1|0,a=T>>>12&16,T>>>=a,_=T>>>5&8,T>>>=_,o=T>>>2&4,T>>>=o,f=T>>>1&2,T>>>=f,i=T>>>1&1,e=0,i=0|Wr[4880+((_|a|o|f|i)+(T>>>i)<<2)>>2]}i?(n=i,S=61):(o=e,a=t)}if(61==(0|S))for(;;){if(S=0,i=(-8&Wr[n+4>>2])-u|0,T=t>>>0>i>>>0,i=T?i:t,e=T?n:e,n=0|Wr[n+16+((0==(0|Wr[n+16>>2])&1)<<2)>>2],!n){o=e,a=i;break}t=i,S=61}if(0!=(0|o)?a>>>0<((0|Wr[1146])-u|0)>>>0:0){if(_=o+u|0,o>>>0>=_>>>0)return N=0,ai=I,0|N;n=0|Wr[o+24>>2],r=0|Wr[o+12>>2];do if((0|r)==(0|o)){if(e=o+20|0,r=0|Wr[e>>2],!r&&(e=o+16|0,r=0|Wr[e>>2],!r)){r=0;break}for(;;)if(i=r+20|0,t=0|Wr[i>>2],0|t)r=t,e=i;else{if(i=r+16|0,t=0|Wr[i>>2],!t)break;r=t,e=i}Wr[e>>2]=0}else N=0|Wr[o+8>>2],Wr[N+12>>2]=
Wr[A+(b<<2)>>2]=Wr[Z+((0|zr[1547+(c<<2)+3>>0])<<2)>>2],te=(0|I(k,U))+_|0,ne=te-G|0,_=ne>>31,_=_&te|ne&~_,(0|Wr[w>>2])>>>0<=_>>>0&&(Wr[J>>2]=866,Wr[J+4>>2]=910,Wr[J+8>>2]=1497,0|He(W,812,J),0|le(W)),Wr[A+(L<<2)>>2]=Wr[(0|Wr[P>>2])+(_<<2)>>2];if(E=M+E|0,(0|E)==(0|s))break;A=A+d|0}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>>31,e=e&A|M&~e,0!=(0|R)|S||(A=0|zr[d>>0],T=3*n|0,f=0|Wr[p>>2],T>>>0>=f>>>0&&(Wr[ie>>2]=866,Wr[ie+4>>2]=910,Wr[ie+8>>2]=1497,0|He(q,812,ie),0|le(q),f=0|Wr[p>>2]),l=0|Wr[B>>2],T=l+(T<<1)|0,c=3*e|0,f>>>0>c>>>0?f=l:(Wr[te>>2]=866,Wr[te+4>>2]=910,Wr[te+8>>2]=1497,0|He(q,812,te),0|le(q),f=0|Wr[B>>2]),M=f+(c<<1)|0,Wr[s>>2]=(0|Jr[T>>1])<<16|Wr[$+(A<<2)>>2],Wr[s+4>>2]=(0|Jr[T+4>>1])<<16|(0|Jr[T+2>>1]),Wr[s+8>>2]=(0|Jr[M>>1])<<16|Wr[g+(A<<2)>>2],Wr[s+12>>2]=(0|Jr[M+4>>1])<<16|(0|Jr[M+2>>1])),R=R+1|0,2==(0|R))break;s=s+16|0}if(N=N+1|0,2==(0|N))break;O=O+t|0}if(u=F+u|0,(0|u)==(0|b))break;h=h+U|0}if(m=m+1|0,(0|m)==(0|o))break;D=D+W|0}k=k+1|0}while((0|k)!=(0|X));return ai=ae,1}function T(e){e=0|e;var r=0,i=0,t=0,n=0,_=0,a=0,o=0,E=0;if(e){i=e+-8|0,n=0|Wr[1148],e=0|Wr[e+-4>>2],r=-8&e,E=i+r|0;do if(1&e)o=i,a=i;else{if(t=0|Wr[i>>2],!(3&e))return;if(a=i+(0-t)|0,_=t+r|0,n>>>0>a>>>0)return;if((0|a)==(0|Wr[1149])){if(e=E+4|0,r=0|Wr[e>>2],3!=(3&r|0)){o=a,r=_;break}return Wr[1146]=_,Wr[e>>2]=-2&r,Wr[a+4>>2]=1|_,void(Wr[a+_>>2]=_)}if(i=t>>>3,256>t>>>0){if(e=0|Wr[a+8>>2],r=0|Wr[a+12>>2],(0|r)==(0|e)){Wr[1144]=Wr[1144]&~(1<<i),o=a,r=_;break}Wr[e+12>>2]=r,Wr[r+8>>2]=e,o=a,r=_;break}n=0|Wr[a+24>>2],e=0|Wr[a+12>>2];do if((0|e)==(0|a)){if(i=a+16|0,r=i+4|0,e=0|Wr[r>>2],!e){if(e=0|Wr[i>>2],!e){e=0;break}r=i}for(;;)if(i=e+20|0,t=0|Wr[i>>2],0|t)e=t,r=i;else{if(i=e+16|0,t=0|Wr[i>>2],!t)break;e=t,r=i}Wr[r>>2]=0}else o=0|Wr[a+8>>2],Wr[o+12>>2]=e,Wr[e+8>>2]=o;while(0);if(n){if(r=0|Wr[a+28>>2],i=4880+(r<<2)|0,(0|a)==(0|Wr[i>>2])){if(Wr[i>>2]=e,!e){Wr[1145]=Wr[1145]&~(1<<r),o=a,r=_;break}}else if(Wr[n+
Wr[_+12>>2]=0,Wr[_+16>>2]=0,Vr[_+20>>0]=0,Wr[a>>2]=0,Wr[a+4>>2]=0,Wr[a+8>>2]=0,Wr[a+12>>2]=0,Vr[a+16>>0]=0,0|Y(E,e,r)?(c=E,ai=l,0|c):(O(E),7&E?(Wr[f>>2]=866,Wr[f+4>>2]=2506,Wr[f+8>>2]=1232,0|He(o,812,f),0|le(o),c=0,ai=l,0|c):(0|_e(E,0,0,1,0),c=0,ai=l,0|c))}function L(e,r,i){e=0|e,r=0|r,i=0|i;var t=0,n=0,_=0,a=0,o=0,E=0;o=ai,ai=ai+576|0,_=o+40|0,n=o+56|0,E=o,Wr[E>>2]=40,0|G(e,r,E),t=(((0|Wr[E+4>>2])>>>i)+3|0)>>>2,r=(((0|Wr[E+8>>2])>>>i)+3|0)>>>2,i=E+32|0,e=0|Wr[i+4>>2];do switch(0|Wr[i>>2]){case 0:e?a=14:e=8;break;case 1:a=e?14:13;break;case 2:a=e?14:13;break;case 3:a=e?14:13;break;case 4:a=e?14:13;break;case 5:a=e?14:13;break;case 6:a=e?14:13;break;case 7:a=e?14:13;break;case 8:a=e?14:13;break;case 9:e?a=14:e=8;break;case 10:e?a=14:e=8;break;default:a=14}while(0);return 13==(0|a)?e=16:14==(0|a)&&(Wr[_>>2]=866,Wr[_+4>>2]=2672,Wr[_+8>>2]=1251,0|He(n,812,_),0|le(n),e=0),E=0|li(0|li(r,t),e),ai=o,0|E}function U(e,r){e=0|e,r=0|r;var i=0,t=0,n=0,_=0;n=ai,ai=ai+576|0,t=n+40|0,i=n+56|0,_=n,Wr[_>>2]=40,0|G(e,r,_),r=_+32|0,e=0|Wr[r+4>>2];do switch(0|Wr[r>>2]){case 0:if(!e)return _=8,ai=n,0|_;e=14;break;case 1:e=e?14:13;break;case 2:e=e?14:13;break;case 3:e=e?14:13;break;case 4:e=e?14:13;break;case 5:e=e?14:13;break;case 6:e=e?14:13;break;case 7:e=e?14:13;break;case 8:e=e?14:13;break;case 9:if(!e)return _=8,ai=n,0|_;e=14;break;case 10:if(!e)return _=8,ai=n,0|_;e=14;break;default:e=14}while(0);return 13==(0|e)?(_=16,ai=n,0|_):14==(0|e)?(Wr[t>>2]=866,Wr[t+4>>2]=2672,Wr[t+8>>2]=1251,0|He(i,812,t),0|le(i),_=0,ai=n,0|_):0}function F(e,r,i,t,n,_,a){e=0|e,r=0|r,i=0|i,t=0|t,n=0|n,_=0|_,a=0|a;var o=0,E=0,T=0,c=0;if(c=0|Wr[e+88>>2],E=(zr[c+12>>0]<<8|zr[c+13>>0])>>>a,T=(zr[c+14>>0]<<8|zr[c+15>>0])>>>a,E=((E>>>0>1?E:1)+3|0)>>>2,T=((T>>>0>1?T:1)+3|0)>>>2,c=c+18|0,a=0|Vr[c>>0],a=0|li(E,a<<24>>24==0|a<<24>>24==9?8:16),_){if(!(0==(3&_|0)&_>>>0>=a>>>0))return n=0,0|n;a=_}if((0|li(a,T))>>>0>n>>>0)return n=0,0|n;if(_=(E+1|0)>>>1,o=(T+1|0)>>>1,!i)return n=0,0|n;switch(Wr[e+92>>2]=r,Wr[e+96>>2]=r,Wr[e+104>>2]=i,Wr[e+100>>2]=r+i,Wr[e+108>>2]=0,Wr[e+112>>2]=0,0|Vr[c>>0]){case 0:if(!(0|u(e,t,n,a,E,T,_,o)))return n=0,0|n;break;case 4:case 6:case 5:case 3:case 2:if(!(0|l(e,t,n,a,E,T,_,o)))return n=0,0|n;break;case 9:if(!(0|s(e,t,n,a,E,T,_,o)))return n=0,0|n;break;case 8:case 7:if(!(0|f(e,t,n,a,E,T,_,o)))return n=0,0|n;break;default:return n=0,0|n}return n=1,0|n}function D(e,r,i){e=0|e,r=0|r,i=0|i;var t=0,n=0,_=0;if((0|i)>=8192)return 0|hi(0|e,0|r,0|i);if(_=0|e,n=e+i|0,(3&e)==(3&r)){for(;3&e;){if(!i)return 0|_;Vr[e>>0]=0|Vr[r>>0],e=e+1|0,r=r+1|0,i=i-1|0}for(i=-4&n|0,t=i-64|0;(0|t)>=(0|e);)Wr[e>>2]=Wr[r>>2],Wr[e+4>>2]=Wr[r+4>>2],Wr[e+8>>2]=Wr[r+8>>2],Wr[e+12>>2]=Wr[r+12>>2],Wr[e+16>>2]=Wr[r+16>>2],Wr[e+20>>2]=Wr[r+20>>2],Wr[e+24>>2]=Wr[r+24>>2],Wr[e+28>>2]=Wr[r+28>>2],Wr[e+32>>2]=Wr[r+32>>2],Wr[e+36>>2]=Wr[r+36>>2],Wr[e+40>>2]=Wr[r+40>>2],Wr[e+44>>2]=Wr[r+44>>2],Wr[e+48>>2]=Wr[r+48>>2],Wr[e+52>>2]=Wr[r+52>>2],Wr[e+56>>2]=Wr[r+56>>2],Wr[e+60>>2]=Wr[r+60>>2],e=e+64|0,r=r+64|0;for(;(0|i)>(0|e);)Wr[e>>2]=Wr[r>>2],e=e+4|0,r=r+4|0}else for(i=n-4|0;(0|i)>(0|e);)Vr[e>>0]=0|Vr[r>>0],Vr[e+1>>0]=0|Vr[r+1>>0],Vr[e+2>>0]=0|Vr[r+2>>0],Vr[e+3>>0]=0|Vr[r+3>>0],e=e+4|0,r=r+4|0;for(;(0|n)>(0|e);)Vr[e>>0]=0|Vr[r>>0],e=e+1|0,r=r+1|0;return 0|_}function m(e){e=0|e;var r=0,i=0,t=0,n=0;if(n=e+92|0,t=e+88|0,i=0|Wr[t>>2],r=(0|Wr[e+4>>2])+((0|zr[i+68>>0])<<8|(0|zr[i+67>>0])<<16|(0|zr[i+69>>0]))|0,i=(0|zr[i+65>>0])<<8|(0|zr[i+66>>0]),!i)return n=0,0|n;if(Wr[n>>2]=r,Wr[e+96>>2]=r,Wr[e+104>>2]=i,Wr[e+100>>2]=r+i,Wr[e+108>>2]=0,Wr[e+112>>2]=0,!(0|o(n,e+116|0)))return n=0,0|n;r=0|Wr[t>>2];do{if((0|zr[r+39>>0])<<8|(0|zr[r+40>>0])){if(!(0|o(n,e+140|0)))return n=0,0|n;if(0|o(n,e+188|0)){r=0|Wr[t>>2];break}return n=0,0|n}if(!((0|zr[r+55>>0])<<8|(0|zr[r+56>>0])))return n=0,0|n}while(0);if((0|zr[r+55>>0])<<8|(0|zr[r+56>>0])|0){if(!(0|o(n,e+164|0)))return n=0,0|n;if(!(0|o(n,e+212|0)))return n=0,0|n}return n=1,0|n}function k(e,r,i){e=0|e,r=0|r,i=0|i;var t=0,n=0,_=0,a=0,o=0,E=0,u=0,f=0,T=0,l=0,c=0;T=ai,ai=ai+48|0,u=T+16|0,_=T,n=T+32|0,o=e+28|0,t=0|Wr[o>>2],Wr[n>>2]=t,E=e+20|0,t=(0|Wr[E>>2])-t|0,Wr[
Runtime.stackAlloc=Module.stackAlloc,Runtime.stackSave=Module.stackSave,Runtime.stackRestore=Module.stackRestore,Runtime.establishStackSpace=Module.establishStackSpace,Runtime.setTempRet0=Module.setTempRet0,Runtime.getTempRet0=Module.getTempRet0,Module.asm=asm,ExitStatus.prototype=new Error,ExitStatus.prototype.constructor=ExitStatus;var initialStackTop,preloadStartTime=null,calledMain=!1;dependenciesFulfilled=function e(){Module.calledRun||run(),Module.calledRun||(dependenciesFulfilled=e)},Module.callMain=Module.callMain=function(e){function r(){for(var e=0;3>e;e++)t.push(0)}e=e||[],ensureInitRuntime();var i=e.length+1,t=[allocate(intArrayFromString(Module.thisProgram),"i8",ALLOC_NORMAL)];r();for(var n=0;i-1>n;n+=1)t.push(allocate(intArrayFromString(e[n]),"i8",ALLOC_NORMAL)),r();t.push(0),t=allocate(t,"i32",ALLOC_NORMAL);try{var _=Module._main(i,t,0);exit(_,!0)}catch(a){if(a instanceof ExitStatus)return;if("SimulateInfiniteLoop"==a)return void(Module.noExitRuntime=!0);var o=a;a&&"object"==typeof a&&a.stack&&(o=[a,a.stack]),Module.printErr("exception thrown: "+o),Module.quit(1,a)}finally{calledMain=!0}},Module.run=Module.run=run,Module.exit=Module.exit=exit;var abortDecorators=[];if(Module.abort=Module.abort=abort,Module.preInit)for("function"==typeof Module.preInit&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var shouldRunNow=!0;return Module.noInitialRun&&(shouldRunNow=!1),Module.noExitRuntime=!0,run(),Module}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";function r(e,r){return void 0!==e&&null!==e?e:r}return r.EMPTY_OBJECT=e({}),r}),define("Core/formatError",["./defined"],function(e){"use strict";function r(r){var i,t=r.name,n=r.message;i=e(t)&&e(n)?t+": "+n:r.toString();var _=r.stack;return e(_)&&(i+="\n"+_),i}return r}),define("Workers/createTaskProcessorWorker",["../Core/defaultValue","../Core/defined","../Core/formatError"],function(e,r,i){"use strict";function t(t){var n,_=[],a={id:void 0,result:void 0,error:void 0};return function(o){var E=o.data;_.length=0,a.id=E.id,a.error=void 0,a.result=void 0;try{a.result=t(E.parameters,_)}catch(u){u instanceof Error?a.error={name:u.name,message:u.message,stack:u.stack}:a.error=u}r(n)||(n=e(self.webkitPostMessage,self.postMessage)),E.canTransferArrayBuffer||(_.length=0);try{n(a,_)}catch(u){a.result=void 0,a.error="postMessage failed with error: "+i(u)+"\n with responseMessage: "+JSON.stringify(a),n(a)}}}return t}),define("Workers/transcodeCRNToDXT",["../Core/CompressedTextureBuffer","../Core/defined","../Core/PixelFormat","../Core/RuntimeError","../ThirdParty/crunch","./createTaskProcessorWorker"],function(e,r,i,t,n,_){"use strict";function a(e,r,i,t){var n,_=i/4,a=t%4,o=new Uint32Array(e.buffer,0,(t-a)/4),E=new Uint32Array(r.buffer);for(n=0;n<o.length;n++)E[_+n]=o[n];for(n=t-a;t>n;n++)r[i+n]=e[n]}function o(_,o){var E=_.byteLength,c=new Uint8Array(_),A=n._malloc(E);a(c,n.HEAPU8,A,E);var R=n._crn_get_dxt_format(A,E),s=u[R];if(!r(s))throw new t("Unsupported compressed format.");var d,M=n._crn_get_levels(A,E),S=n._crn_get_width(A,E),N=n._crn_get_height(A,E),I=0;for(d=0;M>d;++d)I+=i.compressedTextureSizeInBytes(s,S>>d,N>>d);I>l&&(r(f)&&n._free(f),f=n._malloc(I),T=new Uint8Array(n.HEAPU8.buffer,f,I),l=I),n._crn_decompress(A,E,f,I,0,M),n._free(A);var O=i.compressedTextureSizeInBytes(s,S,N),C=T.subarray(0,O),P=new Uint8Array(O);return P.set(C,0),o.push(P.buffer),new e(s,S,N,P)}var E={cCRNFmtInvalid:-1,cCRNFmtDXT1:0,cCRNFmtDXT3:1,cCRNFmtDXT5:2},u={};u[E.cCRNFmtDXT1]=i.RGB_DXT1,u[E.cCRNFmtDXT3]=i.RGBA_DXT3,u[E.cCRNFmtDXT5]=i.RGBA_DXT5;var f,T,l=0;return _(o)})}();