cesium-d3kit/examples/libs/SuperMapCesium/Workers/transcodeCRNToDXT.js

95 lines
168 KiB
JavaScript
Raw Normal View History

2021-12-30 16:02:03 +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
when.js - https://github.com/cujojs/when
MIT License (c) copyright B Cavalier & J Hann
* A lightweight CommonJS Promises/A and when() implementation
* when is part of the cujo.js family of libraries (http://cujojs.com/)
*
* Licensed under the MIT License at:
* http://www.opensource.org/licenses/mit-license.php
*
* @version 1.7.1
*/
/**
* @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}}(),n=Object.defineProperties;return r&&e(n)||(n=function(e){return e}),n}),define("Core/CompressedTextureBuffer",["./defined","./defineProperties"],function(e,r){"use strict";function n(e,r,n,t){this._format=e,this._width=r,this._height=n,this._buffer=t}return r(n.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}}}),n.clone=function(r){return e(r)?new n(r._format,r._width,r._height,r._buffer):void 0},n.prototype.clone=function(){return n.clone(this)},n}),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
}catch(_){if("number"!=typeof _&&"longjmp"!==_)throw _;Module.setThrew(1,0)}}function ExitStatus(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function run(e){function r(){Module.calledRun||(Module.calledRun=!0,ABORT||(ensureInitRuntime(),preMain(),Module.onRuntimeInitialized&&Module.onRuntimeInitialized(),Module._main&&shouldRunNow&&Module.callMain(e),postRun()))}e=e||Module.arguments,null===preloadStartTime&&(preloadStartTime=Date.now()),runDependencies>0||(preRun(),runDependencies>0||Module.calledRun||(Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},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.",n="abort("+e+") at "+stackTrace()+r;throw abortDecorators&&abortDecorators.forEach(function(r){n=r(n,e)}),n}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 n=nodeFS.readFileSync(e);return r?n:n.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,n){var t=new XMLHttpRequest;t.open("GET",e,!0),t.resp
abort:abort,assert:assert,enlargeMemory:enlargeMemory,getTotalMemory:getTotalMemory,abortOnCannotGrowMemory:abortOnCannotGrowMemory,invoke_iiii:invoke_iiii,invoke_viiiii:invoke_viiiii,invoke_vi:invoke_vi,invoke_ii:invoke_ii,invoke_viii:invoke_viii,invoke_v:invoke_v,invoke_viiiiii:invoke_viiiiii,invoke_viiii:invoke_viiii,_pthread_getspecific:_pthread_getspecific,___syscall54:___syscall54,_pthread_setspecific:_pthread_setspecific,___gxx_personality_v0:___gxx_personality_v0,___syscall6:___syscall6,___setErrNo:___setErrNo,_abort:_abort,___cxa_begin_catch:___cxa_begin_catch,_pthread_once:_pthread_once,_emscripten_memcpy_big:_emscripten_memcpy_big,_pthread_key_create:_pthread_key_create,___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,n){"almost asm";function t(e){return 16777215&tn(e)||tn(e)<=16777215||tn(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),en=new $r(e),nn=new rn(e),n=e,!0)}function i(e){e=0|e;var r=0,n=0,t=0,i=0,_=0,o=0,a=0,u=0,E=0,f=0,T=0,c=0,l=0,s=0,A=0,R=0,d=0,M=0,S=0,N=0,I=0;I=an,an=an+16|0,c=I;do if(245>e>>>0){if(E=11>e>>>0?16:e+11&-8,e=E>>>3,T=0|Wr[1144],n=T>>>e,3&n|0)return r=(1&n^1)+e|0,e=4616+(r<<1<<2)|0,n=e+8|0,t=0|Wr[n>>2],i=t+8|0,_=0|Wr[i>>2],(0|e)==(0|_)?Wr[1144]=T&~(1<<r):(Wr[_+12>>2]=e,Wr[n>>2]=_),N=r<<3,Wr[t+4>>2]=3|N,N=t+N+4|0,Wr[N>>2]=1|Wr[N>>2],N=i,an=I,0|N;if(f=0|Wr[1146],E>>>0>f>>>0){if(0|n)return r=2<<e,r=n<<e&(r|0-r),r=(r&0-r)+-1|0,o=r>>>12&16,r>>>=o,n=r>>>5&8,r>>>=n,i=r>>>2&4,r>>>=i,e=r>>>1&2,r>>>=e,t=r>>>1&1,t=(n|o|i|e|t)+(r>>>t)|0,r=4616+(t<<1<<2)|0,e=r+8|0,i=0|Wr[e>>2],o=i+8|0,n=0|Wr[o>>2],(0|r)==(0|n)?(e=T&~(1<<t),Wr[1144]=e):(Wr[n+12>>2]=r,Wr[e>>2]=n,e=T),_=(t<<3)-E|0,Wr[i+4>>2]=3|E,t=i+E|0,Wr[t+4>>2]=1|_,Wr[t+_>>2]=_,0|f&&(i=0|Wr[1149],r=f>>>3,n=4616+(r<<1<<2)|0,r=1<<r,e&r?(e=n+8|0,r=0|Wr[e>>2]):(Wr[1144]=e|r,r=n,e=n+8|0),Wr[e>>2]=i,Wr[r+12>>2]=i,Wr[i+8>>2]=r,Wr[i+12>>2]=n),Wr[1146]=_,Wr[1149]=t,N=o,an=I,0|N;if(a=0|Wr[1145]){if(n=(a&0-a)+-1|0,o=n>>>12&16,n>>>=o,_=n>>>5&8,n>>>=_,u=n>>>2&4,n>>>=u,t=n>>>1&2,n>>>=t,e=n>>>1&1,e=0|Wr[4880+((_|o|u|t|e)+(n>>>e)<<2)>>2],n=(-8&Wr[e+4>>2])-E|0,t=0|Wr[e+16+((0==(0|Wr[e+16>>2])&1)<<2)>>2]){do o=(-8&Wr[t+4>>2])-E|0,u=n>>>0>o>>>0,n=u?o:n,e=u?t:e,t=0|Wr[t+16+((0==(0|Wr[t+16>>2])&1)<<2)>>2];while(0!=(0|t));u=e,_=n}else u=e,_=n;if(o=u+E|0,o>>>0>u>>>0){i=0|Wr[u+24>>2],r=0|Wr[u+12>>2];do if((0|r)==(0|u)){if(e=u+20|0,r=0|Wr[e>>2],!r&&(e=u+16|0,r=0|Wr[e>>2],!r)){n=0;break}for(;;)if(n=r+20|0,t=0|Wr[n>>2],0|t)r=t,e=n;else{if(n=r+16|0,t=0|Wr[n>>2],!t)break;r=t,e=n}Wr[e>>2]=0,n=r}else n=0|Wr[u+8>>2],Wr[n+12>>2]=r,Wr[r+8>>2]=n,n=r;while(0);do if(0|i){if(r=0|Wr[u+28>>2],e=4880+(r<<2)|0,(0|u)==(0|Wr[e>>2])){if(Wr[e>>2]=n,!n){Wr[1145]=a&~(1<<r);break}}else if(Wr[i+16+(((0|Wr[i+16>>2])!=(0|u)&1)<<2)>>2]=n,!n)break;Wr[n+24>>2]=i,r=0|Wr[u+16>>2],0|r&&(Wr[n+16>>2]=r,Wr[r+24>>2]=n),r=0|Wr[u+20>>2],0|r&&(Wr[n+20>>2]=r,Wr[r+24>>2]=n)}while(0);return 16>_>>>0?(N=_+E|0,Wr[u+4>>2]=3|N,N=u+N+4|0,Wr[N>>2]=1|Wr[N>>2]):(Wr[u+4>>2]=3|E,Wr[o+4>>2]=1|_,Wr[o+_>>2]=_,0|f&&(t=0|Wr[1149],r=f>>>3,n=4616+(r<<1<<2)|0,r=1<<r,T&r?(e=n+8|0,r=0|Wr[e>>2]):(Wr[1144]=T|r,r=n,e=n+8|0),Wr[e>>2]=t,Wr[r+12>>2]=t,Wr[t+8>>2]=r,Wr[t+12>>2]=n),Wr[1146]=_,Wr[1149]=o),N=u+8|0,an=I,0|N}T=E}else T=E}else T=E}else if(4294967231>=e>>>0)if(e=e+11|0,E=-8&e,u=0|Wr[1145]){t=0-E|0,e>>>=8,e?E>>>0>16777215?a=31:(T=(e+1048320|0)>>>16&8,S=e<<T,f=(S+520192|0)>>>16&4,S<<=f,a=(S+245760|0)>>>16&2,a=14-(f|T|a)+(S<<a>>>15)|0,a=E>>>(a+7|0)&1|a<<1):a=0,n=0|Wr[4880+(a<<2)>>2];e:do if(n)for(e=0,o=E<<(31==(0|a)?0:25-(a>>>1)|0),_=0;;){if(i=(-8&Wr[n+4>>2])-E|0,t>>>0>i>>>0){if(!i){e=n,t=0,i=n,S=61;break e}e=n,t=i}if(i=0|Wr[n+20>>2],n=0|Wr[n+16+(o>>>31<<2)>>2],_=0==(0|i)|(0|i)==(0|n)?_:i,i=0==(0|n)){n=_,S=57;break}o<<=1&(1^i)}else n=0,e=0,S=57;while(0);if(57==(0|S)){if(0==(0|n)&0==(0|e)){i
te=(0|I(D,m))+_|0,ie=te-G|0,_=ie>>31,_=_&te|ie&~_,(0|Wr[w>>2])>>>0<=_>>>0&&(Wr[$>>2]=866,Wr[$+4>>2]=910,Wr[$+8>>2]=1497,0|He(W,812,$),0|ce(W)),Wr[s+4>>2]=Wr[(0|Wr[h>>2])+(_<<2)>>2],Wr[s+8>>2]=Wr[Z+((0|zr[1547+(l<<2)+1>>0])<<2)>>2],te=(0|I(D,m))+_|0,ie=te-G|0,_=ie>>31,_=_&te|ie&~_,(0|Wr[w>>2])>>>0<=_>>>0&&(Wr[re>>2]=866,Wr[re+4>>2]=910,Wr[re+8>>2]=1497,0|He(W,812,re),0|ce(W)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2]=0,Wr[o+8>>2]=0,Wr[o+12>>2]=0,Vr[o+16>>0]=0,0|Y(u,e,r)?(l=u,an=c,0|l):(O(u),7&u?(Wr[f>>2]=866,Wr[f+4>>2]=2506,Wr[f+8>>2]=1232,0|He(a,812,f),0|ce(a),l=0,an=c,0|l):(0|_e(u,0,0,1,0),l=0,an=c,0|l))}function L(e,r,n){e=0|e,r=0|r,n=0|n;var t=0,i=0,_=0,o=0,a=0,u=0;a=an,an=an+576|0,_=a+40|0,i=a+56|0,u=a,Wr[u>>2]=40,0|G(e,r,u),t=(((0|Wr[u+4>>2])>>>n)+3|0)>>>2,r=(((0|Wr[u+8>>2])>>>n)+3|0)>>>2,n=u+32|0,e=0|Wr[n+4>>2];do switch(0|Wr[n>>2]){case 0:e?o=14:e=8;break;case 1:o=e?14:13;break;case 2:o=e?14:13;break;case 3:o=e?14:13;break;case 4:o=e?14:13;break;case 5:o=e?14:13;break;case 6:o=e?14:13;break;case 7:o=e?14:13;break;case 8:o=e?14:13;break;case 9:e?o=14:e=8;break;case 10:e?o=14:e=8;break;default:o=14}while(0);return 13==(0|o)?e=16:14==(0|o)&&(Wr[_>>2]=866,Wr[_+4>>2]=2672,Wr[_+8>>2]=1251,0|He(i,812,_),0|ce(i),e=0),u=0|ln(0|ln(r,t),e),an=a,0|u}function m(e,r){e=0|e,r=0|r;var n=0,t=0,i=0,_=0;i=an,an=an+576|0,t=i+40|0,n=i+56|0,_=i,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,an=i,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,an=i,0|_;e=14;break;case 10:if(!e)return _=8,an=i,0|_;e=14;break;default:e=14}while(0);return 13==(0|e)?(_=16,an=i,0|_):14==(0|e)?(Wr[t>>2]=866,Wr[t+4>>2]=2672,Wr[t+8>>2]=1251,0|He(n,812,t),0|ce(n),_=0,an=i,0|_):0}function F(e,r,n,t,i,_,o){e=0|e,r=0|r,n=0|n,t=0|t,i=0|i,_=0|_,o=0|o;var a=0,u=0,T=0,l=0;if(l=0|Wr[e+88>>2],u=(zr[l+12>>0]<<8|zr[l+13>>0])>>>o,T=(zr[l+14>>0]<<8|zr[l+15>>0])>>>o,u=((u>>>0>1?u:1)+3|0)>>>2,T=((T>>>0>1?T:1)+3|0)>>>2,l=l+18|0,o=0|Vr[l>>0],o=0|ln(u,o<<24>>24==0|o<<24>>24==9?8:16),_){if(!(0==(3&_|0)&_>>>0>=o>>>0))return i=0,0|i;o=_}if((0|ln(o,T))>>>0>i>>>0)return i=0,0|i;if(_=(u+1|0)>>>1,a=(T+1|0)>>>1,!n)return i=0,0|i;switch(Wr[e+92>>2]=r,Wr[e+96>>2]=r,Wr[e+104>>2]=n,Wr[e+100>>2]=r+n,Wr[e+108>>2]=0,Wr[e+112>>2]=0,0|Vr[l>>0]){case 0:if(!(0|E(e,t,i,o,u,T,_,a)))return i=0,0|i;break;case 4:case 6:case 5:case 3:case 2:if(!(0|c(e,t,i,o,u,T,_,a)))return i=0,0|i;break;case 9:if(!(0|R(e,t,i,o,u,T,_,a)))return i=0,0|i;break;case 8:case 7:if(!(0|f(e,t,i,o,u,T,_,a)))return i=0,0|i;break;default:return i=0,0|i}return i=1,0|i}function U(e,r,n){e=0|e,r=0|r,n=0|n;var t=0,i=0,_=0;if((0|n)>=8192)return 0|bn(0|e,0|r,0|n);if(_=0|e,i=e+n|0,(3&e)==(3&r)){for(;3&e;){if(!n)return 0|_;Vr[e>>0]=0|Vr[r>>0],e=e+1|0,r=r+1|0,n=n-1|0}for(n=-4&i|0,t=n-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|n)>(0|e);)Wr[e>>2]=Wr[r>>2],e=e+4|0,r=r+4|0}else for(n=i-4|0;(0|n)>(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|i)>(0|e);)Vr[e>>0]=0|Vr[r>>0],e=e+1|0,r=r+1|0;return 0|_}function p(e){e=0|e;var r=0,n=0,t=0,i=0;if(i=e+92|0,t=e+88|0,n=0|Wr[t>>2],r=(0|Wr[e+4>>2])+((0|zr[n+68>>0])<<8|(0|zr[n+67>>0])<<16|(0|zr[n+69>>0]))|0,n=(0|zr[n+65>>0])<<8|(0|zr[n+66>>0]),!n)re
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 n=e.length+1,t=[allocate(intArrayFromString(Module.thisProgram),"i8",ALLOC_NORMAL)];r();for(var i=0;n-1>i;i+=1)t.push(allocate(intArrayFromString(e[i]),"i8",ALLOC_NORMAL)),r();t.push(0),t=allocate(t,"i32",ALLOC_NORMAL);try{var _=Module._main(n,t,0);exit(_,!0)}catch(o){if(o instanceof ExitStatus)return;if("SimulateInfiniteLoop"==o)return void(Module.noExitRuntime=!0);var a=o;o&&"object"==typeof o&&o.stack&&(a=[o,o.stack]),Module.printErr("exception thrown: "+a),Module.quit(1,o)}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}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,n,t,i){return r(e).then(n,t,i)}function r(e){var r,n;return e instanceof t?r=e:a(e)?(n=o(),e.then(function(e){n.resolve(e)},function(e){n.reject(e)},function(e){n.progress(e)}),r=n.promise):r=i(e),r}function n(r){return e(r,_)}function t(e){this.then=e}function i(e){var n=new t(function(n){try{return r(n?n(e):e)}catch(t){return _(t)}});return n}function _(e){var n=new t(function(n,t){try{return t?r(t(e)):_(e)}catch(i){return _(i)}});return n}function o(){function e(e,r,n){return c(e,r,n)}function n(e){return s(e)}function i(e){return s(_(e))}function a(e){return l(e)}var u,E,f,T,c,l,s;return E=new t(e),u={then:e,resolve:n,reject:i,progress:a,promise:E,resolver:{resolve:n,reject:i,progress:a}},f=[],T=[],c=function(e,r,n){var t,i;return t=o(),i="function"==typeof n?function(e){try{t.progress(n(e))}catch(r){t.progress(r)}}:function(e){t.progress(e)},f.push(function(n){n.then(e,r).then(t.resolve,t.reject,i)}),T.push(i),t.promise},l=function(e){return A(T,e),e},s=function(e){return e=r(e),c=e.then,s=r,l=d,A(f,e),T=f=I,e},u}function a(e){return e&&"function"==typeof e.then}function u(r,n,t,i,_){return R(2,arguments),e(r,function(r){function a(e){A(e)}function u(e){s(e)}var E,f,T,c,l,s,A,R,M,S;if(M=r.length>>>0,E=Math.max(0,Math.min(n,M)),T=[],f=M-E+1,c=[],l=o(),E)for(R=l.progress,A=function(e){c.push(e),--f||(s=A=d,l.reject(c))},s=function(e){T.push(e),--E||(s=A=d,l.resolve(T))},S=0;M>S;++S)S in r&&e(r[S],u,a,R);else l.resolve(T);return l.then(t,i,_)})}function E(e,r,n,t){function i(e){return r?r(e[0]):e[0]}return u(e,1,i,n,t)}function f(e,r,n,t){return R(1,arguments),c(e,M).then(r,n,t)}function T(){return c(arguments,M)}function c(r,n){return e(r,function(r){var t,i,_,a,u,E;if(_=i=r.length>>>0,t=[],E=o(),_)for(a=function(r,i){e(r,n).then(function(e){t[i]=e,--_||E.resolve(t)},E.reject)},u=0;i>u;u++)u in r?a(r[u],u):--_;else E.resolve(t);return E.promise})}function l(r,n){var t=N.call(arguments,1);return e(r,function(r){var i;return i=r.length,t[0]=function(r,t,_){return e(r,function(r){return e(t,function(e){return n(r,e,_,i)})})},S.apply(r,t)})}function s(r,n,t){var i=arguments.length>2;return e(r,function(e){return e=i?t:e,n.resolve(e),e},function(e){return n.reject(e),_(e)},n.progress)}function A(e,r){for(var n,t=0;n=e[t++];)n(r)}function R(e,r){for(var n,t=r.length;t>e;)if(n=r[--t],null!=n&&"function"!=typeof n)throw new Error("arg "+t+" must be a function")}function d(){}function M(e){return e}var S,N,I;return e.defer=o,e.resolve=r,e.reject=n,e.join=T,e.all=f,e.map=c,e.reduce=l,e.any=E,e.some=u,e.chain=s