forked from external-repos/squoosh
81 lines
26 KiB
JavaScript
81 lines
26 KiB
JavaScript
|
|
var imagequant = (function() {
|
|
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
|
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
|
return (
|
|
function(imagequant) {
|
|
imagequant = imagequant || {};
|
|
|
|
var e;e||(e=typeof imagequant !== 'undefined' ? imagequant : {});var m={},r;for(r in e)e.hasOwnProperty(r)&&(m[r]=e[r]);var u=!1,v=!1,aa=!1,ba=!1,ca=!1;u="object"===typeof window;v="function"===typeof importScripts;aa=(ba="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)&&!u&&!v;ca=!u&&!aa&&!v;var w="",da,x,ea,fa;
|
|
if(aa)w=__dirname+"/",da=function(a,b){ea||(ea=require("fs"));fa||(fa=require("path"));a=fa.normalize(a);return ea.readFileSync(a,b?null:"utf8")},x=function(a){a=da(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||y("Assertion failed: undefined");return a},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",y),e.inspect=function(){return"[Emscripten Module object]"};else if(ca)"undefined"!=
|
|
typeof read&&(da=function(a){return read(a)}),x=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||y("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(u||v)v?w=self.location.href:document.currentScript&&(w=document.currentScript.src),_scriptDir&&(w=_scriptDir),0!==w.indexOf("blob:")?
|
|
w=w.substr(0,w.lastIndexOf("/")+1):w="",da=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},v&&(x=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ha=e.print||console.log.bind(console),z=e.printErr||console.warn.bind(console);for(r in m)m.hasOwnProperty(r)&&(e[r]=m[r]);m=null;var ia={"f64-rem":function(a,b){return a%b},"debugger":function(){}},A;e.wasmBinary&&(A=e.wasmBinary);
|
|
"object"!==typeof WebAssembly&&z("no native wasm support detected");var B,ja=new WebAssembly.Table({initial:79,maximum:79,element:"anyfunc"}),ka=!1,la="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
|
function ma(a,b,c){var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16<c-b&&a.subarray&&la)return la.decode(a.subarray(b,c));for(d="";b<c;){var f=a[b++];if(f&128){var h=a[b++]&63;if(192==(f&224))d+=String.fromCharCode((f&31)<<6|h);else{var g=a[b++]&63;f=224==(f&240)?(f&15)<<12|h<<6|g:(f&7)<<18|h<<12|g<<6|a[b++]&63;65536>f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d}function na(a){return a?ma(C,a,void 0):""}
|
|
function oa(a,b,c){var d=C;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var h=a.charCodeAt(f);if(55296<=h&&57343>=h){var g=a.charCodeAt(++f);h=65536+((h&1023)<<10)|g&1023}if(127>=h){if(b>=c)break;d[b++]=h}else{if(2047>=h){if(b+1>=c)break;d[b++]=192|h>>6}else{if(65535>=h){if(b+2>=c)break;d[b++]=224|h>>12}else{if(b+3>=c)break;d[b++]=240|h>>18;d[b++]=128|h>>12&63}d[b++]=128|h>>6&63}d[b++]=128|h&63}}d[b]=0}}"undefined"!==typeof TextDecoder&&new TextDecoder("utf-16le");
|
|
function pa(a){0<a%65536&&(a+=65536-a%65536);return a}var buffer,qa,C,ra,sa,D,E,ta,ua;function va(a){buffer=a;e.HEAP8=qa=new Int8Array(a);e.HEAP16=ra=new Int16Array(a);e.HEAP32=D=new Int32Array(a);e.HEAPU8=C=new Uint8Array(a);e.HEAPU16=sa=new Uint16Array(a);e.HEAPU32=E=new Uint32Array(a);e.HEAPF32=ta=new Float32Array(a);e.HEAPF64=ua=new Float64Array(a)}var wa=e.TOTAL_MEMORY||16777216;e.wasmMemory?B=e.wasmMemory:B=new WebAssembly.Memory({initial:wa/65536});B&&(buffer=B.buffer);wa=buffer.byteLength;
|
|
va(buffer);D[2092]=5251440;function xa(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b();else{var c=b.Aa;"number"===typeof c?void 0===b.ra?e.dynCall_v(c):e.dynCall_vi(c,b.ra):c(void 0===b.ra?null:b.ra)}}}var ya=[],za=[],Aa=[],Ba=[];function Ca(){var a=e.preRun.shift();ya.unshift(a)}var G=0,Da=null,H=null;e.preloadedImages={};e.preloadedAudios={};
|
|
function y(a){if(e.onAbort)e.onAbort(a);ha(a);z(a);ka=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function Ea(){var a=I;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var I="imagequant.wasm";if(!Ea()){var Fa=I;I=e.locateFile?e.locateFile(Fa,w):w+Fa}
|
|
function Ga(){try{if(A)return new Uint8Array(A);if(x)return x(I);throw"both async and sync fetching of the wasm failed";}catch(a){y(a)}}function Ha(){return A||!u&&!v||"function"!==typeof fetch?new Promise(function(a){a(Ga())}):fetch(I,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+I+"'";return a.arrayBuffer()}).catch(function(){return Ga()})}
|
|
e.asm=function(){function a(a){e.asm=a.exports;G--;e.monitorRunDependencies&&e.monitorRunDependencies(G);0==G&&(null!==Da&&(clearInterval(Da),Da=null),H&&(a=H,H=null,a()))}function b(b){a(b.instance)}function c(a){return Ha().then(function(a){return WebAssembly.instantiate(a,d)}).then(a,function(a){z("failed to asynchronously prepare wasm: "+a);y(a)})}var d={env:Ia,wasi_unstable:Ia,global:{NaN:NaN,Infinity:Infinity},"global.Math":Math,asm2wasm:ia};G++;e.monitorRunDependencies&&e.monitorRunDependencies(G);
|
|
if(e.instantiateWasm)try{return e.instantiateWasm(d,a)}catch(f){return z("Module.instantiateWasm callback failed with error: "+f),!1}(function(){if(A||"function"!==typeof WebAssembly.instantiateStreaming||Ea()||"function"!==typeof fetch)return c(b);fetch(I,{credentials:"same-origin"}).then(function(a){return WebAssembly.instantiateStreaming(a,d).then(b,function(a){z("wasm streaming compile failed: "+a);z("falling back to ArrayBuffer instantiation");c(b)})})})();return{}};za.push({Aa:function(){Ja()}});
|
|
var Ka=[null,[],[]];function La(){return 0}function Ma(){return 0}function Na(a,b,c,d){try{for(var f=0,h=0;h<c;h++){for(var g=D[b+8*h>>2],k=D[b+(8*h+4)>>2],p=0;p<k;p++){var q=C[g+p],l=Ka[a];0===q||10===q?((1===a?ha:z)(ma(l,0)),l.length=0):l.push(q)}f+=k}D[d>>2]=f;return 0}catch(t){return"undefined"!==typeof FS&&t instanceof FS.Ia||y(t),t.Ja}}function Oa(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Pa=void 0;
|
|
function J(a){for(var b="";C[a];)b+=Pa[C[a++]];return b}var K={},L={},Qa={};function Ra(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Sa(a,b){a=Ra(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
|
function Ta(a){var b=Error,c=Sa(a,function(b){this.name=a;this.message=b;b=Error(b).stack;void 0!==b&&(this.stack=this.toString()+"\n"+b.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var M=void 0;function N(a){throw new M(a);}var Ua=void 0;function Va(a){throw new Ua(a);}
|
|
function Wa(a,b,c){function d(b){b=c(b);b.length!==a.length&&Va("Mismatched type converter count");for(var d=0;d<a.length;++d)Q(a[d],b[d])}a.forEach(function(a){Qa[a]=b});var f=Array(b.length),h=[],g=0;b.forEach(function(a,b){L.hasOwnProperty(a)?f[b]=L[a]:(h.push(a),K.hasOwnProperty(a)||(K[a]=[]),K[a].push(function(){f[b]=L[a];++g;g===h.length&&d(f)}))});0===h.length&&d(f)}
|
|
function Q(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||N('type "'+d+'" must have a positive integer typeid pointer');if(L.hasOwnProperty(a)){if(c.Da)return;N("Cannot register type '"+d+"' twice")}L[a]=b;delete Qa[a];K.hasOwnProperty(a)&&(b=K[a],delete K[a],b.forEach(function(a){a()}))}function Xa(a){return{count:a.count,la:a.la,na:a.na,aa:a.aa,da:a.da,ea:a.ea,fa:a.fa}}
|
|
function Ya(a){N(a.$.da.ba.name+" instance already deleted")}var Za=!1;function $a(){}function ab(a){--a.count.value;0===a.count.value&&(a.ea?a.fa.ka(a.ea):a.da.ba.ka(a.aa))}
|
|
function R(a){if("undefined"===typeof FinalizationGroup)return R=function(a){return a},a;Za=new FinalizationGroup(function(a){for(var b=a.next();!b.done;b=a.next())b=b.value,b.aa?ab(b):console.warn("object already deleted: "+b.aa)});R=function(a){Za.register(a,a.$,a.$);return a};$a=function(a){Za.unregister(a.$)};return R(a)}var bb=void 0,cb=[];function db(){for(;cb.length;){var a=cb.pop();a.$.la=!1;a["delete"]()}}function T(){}var eb={};
|
|
function fb(a,b){var c=e;if(void 0===c[a].ha){var d=c[a];c[a]=function(){c[a].ha.hasOwnProperty(arguments.length)||N("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].ha+")!");return c[a].ha[arguments.length].apply(this,arguments)};c[a].ha=[];c[a].ha[d.xa]=d}}
|
|
function gb(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].ha&&void 0!==e[a].ha[c])&&N("Cannot register public name '"+a+"' twice"),fb(a,a),e.hasOwnProperty(c)&&N("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].ha[c]=b):(e[a]=b,void 0!==c&&(e[a].La=c))}function hb(a,b,c,d,f,h,g,k){this.name=a;this.constructor=b;this.ja=c;this.ka=d;this.ga=f;this.Ba=h;this.oa=g;this.za=k}
|
|
function ib(a,b,c){for(;b!==c;)b.oa||N("Expected null or instance of "+c.name+", got an instance of "+b.name),a=b.oa(a),b=b.ga;return a}function jb(a,b){if(null===b)return this.sa&&N("null is not a valid "+this.name),0;b.$||N('Cannot pass "'+U(b)+'" as a '+this.name);b.$.aa||N("Cannot pass deleted object as a pointer of type "+this.name);return ib(b.$.aa,b.$.da.ba,this.ba)}
|
|
function kb(a,b){if(null===b){this.sa&&N("null is not a valid "+this.name);if(this.qa){var c=this.Fa();null!==a&&a.push(this.ka,c);return c}return 0}b.$||N('Cannot pass "'+U(b)+'" as a '+this.name);b.$.aa||N("Cannot pass deleted object as a pointer of type "+this.name);!this.pa&&b.$.da.pa&&N("Cannot convert argument of type "+(b.$.fa?b.$.fa.name:b.$.da.name)+" to parameter type "+this.name);c=ib(b.$.aa,b.$.da.ba,this.ba);if(this.qa)switch(void 0===b.$.ea&&N("Passing raw pointer to smart pointer is illegal"),
|
|
this.Ha){case 0:b.$.fa===this?c=b.$.ea:N("Cannot convert argument of type "+(b.$.fa?b.$.fa.name:b.$.da.name)+" to parameter type "+this.name);break;case 1:c=b.$.ea;break;case 2:if(b.$.fa===this)c=b.$.ea;else{var d=b.clone();c=this.Ga(c,lb(function(){d["delete"]()}));null!==a&&a.push(this.ka,c)}break;default:N("Unsupporting sharing policy")}return c}
|
|
function ob(a,b){if(null===b)return this.sa&&N("null is not a valid "+this.name),0;b.$||N('Cannot pass "'+U(b)+'" as a '+this.name);b.$.aa||N("Cannot pass deleted object as a pointer of type "+this.name);b.$.da.pa&&N("Cannot convert argument of type "+b.$.da.name+" to parameter type "+this.name);return ib(b.$.aa,b.$.da.ba,this.ba)}function pb(a){return this.fromWireType(E[a>>2])}function qb(a,b,c){if(b===c)return a;if(void 0===c.ga)return null;a=qb(a,b,c.ga);return null===a?null:c.za(a)}var rb={};
|
|
function sb(a,b){for(void 0===b&&N("ptr should not be undefined");a.ga;)b=a.oa(b),a=a.ga;return rb[b]}function tb(a,b){b.da&&b.aa||Va("makeClassHandle requires ptr and ptrType");!!b.fa!==!!b.ea&&Va("Both smartPtrType and smartPtr must be specified");b.count={value:1};return R(Object.create(a,{$:{value:b}}))}
|
|
function V(a,b,c,d){this.name=a;this.ba=b;this.sa=c;this.pa=d;this.qa=!1;this.ka=this.Ga=this.Fa=this.wa=this.Ha=this.Ea=void 0;void 0!==b.ga?this.toWireType=kb:(this.toWireType=d?jb:ob,this.ia=null)}function ub(a,b,c){e.hasOwnProperty(a)||Va("Replacing nonexistant public symbol");void 0!==e[a].ha&&void 0!==c?e[a].ha[c]=b:(e[a]=b,e[a].xa=c)}
|
|
function W(a,b){a=J(a);if(void 0!==e["FUNCTION_TABLE_"+a])var c=e["FUNCTION_TABLE_"+a][b];else if("undefined"!==typeof FUNCTION_TABLE)c=FUNCTION_TABLE[b];else{c=e["dynCall_"+a];void 0===c&&(c=e["dynCall_"+a.replace(/f/g,"d")],void 0===c&&N("No dynCall invoker for signature: "+a));for(var d=[],f=1;f<a.length;++f)d.push("a"+f);f="return function "+("dynCall_"+a+"_"+b)+"("+d.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(d.length?", ":"")+d.join(", ")+");\n";c=(new Function("dynCall","rawFunction",
|
|
f+"};\n"))(c,b)}"function"!==typeof c&&N("unknown function pointer with signature "+a+": "+b);return c}var vb=void 0;function wb(a){a=xb(a);var b=J(a);X(a);return b}function yb(a,b){function c(a){f[a]||L[a]||(Qa[a]?Qa[a].forEach(c):(d.push(a),f[a]=!0))}var d=[],f={};b.forEach(c);throw new vb(a+": "+d.map(wb).join([", "]));}function zb(a){for(;a.length;){var b=a.pop();a.pop()(b)}}
|
|
function Ab(a,b,c){a instanceof Object||N(c+' with invalid "this": '+a);a instanceof b.ba.constructor||N(c+' incompatible with "this" of type '+a.constructor.name);a.$.aa||N("cannot call emscripten binding method "+c+" on deleted object");return ib(a.$.aa,a.$.da.ba,b.ba)}var Bb=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Cb(a){4<a&&0===--Y[a].ta&&(Y[a]=void 0,Bb.push(a))}
|
|
function lb(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Bb.length?Bb.pop():Y.length;Y[b]={ta:1,value:a};return b}}function U(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}function Db(a,b){switch(b){case 2:return function(a){return this.fromWireType(ta[a>>2])};case 3:return function(a){return this.fromWireType(ua[a>>3])};default:throw new TypeError("Unknown float type: "+a);}}
|
|
function Eb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Sa(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}function Fb(a,b){for(var c=[],d=0;d<a;d++)c.push(D[(b>>2)+d]);return c}
|
|
function Gb(a,b,c){switch(b){case 0:return c?function(a){return qa[a]}:function(a){return C[a]};case 1:return c?function(a){return ra[a>>1]}:function(a){return sa[a>>1]};case 2:return c?function(a){return D[a>>2]}:function(a){return E[a>>2]};default:throw new TypeError("Unknown integer type: "+a);}}function Hb(){return qa.length}function Z(){Z.ma||(Z.ma=[]);Z.ma.push(Ib());return Z.ma.length-1}for(var Jb=Array(256),Kb=0;256>Kb;++Kb)Jb[Kb]=String.fromCharCode(Kb);Pa=Jb;M=e.BindingError=Ta("BindingError");
|
|
Ua=e.InternalError=Ta("InternalError");T.prototype.isAliasOf=function(a){if(!(this instanceof T&&a instanceof T))return!1;var b=this.$.da.ba,c=this.$.aa,d=a.$.da.ba;for(a=a.$.aa;b.ga;)c=b.oa(c),b=b.ga;for(;d.ga;)a=d.oa(a),d=d.ga;return b===d&&c===a};T.prototype.clone=function(){this.$.aa||Ya(this);if(this.$.na)return this.$.count.value+=1,this;var a=R(Object.create(Object.getPrototypeOf(this),{$:{value:Xa(this.$)}}));a.$.count.value+=1;a.$.la=!1;return a};
|
|
T.prototype["delete"]=function(){this.$.aa||Ya(this);this.$.la&&!this.$.na&&N("Object already scheduled for deletion");$a(this);ab(this.$);this.$.na||(this.$.ea=void 0,this.$.aa=void 0)};T.prototype.isDeleted=function(){return!this.$.aa};T.prototype.deleteLater=function(){this.$.aa||Ya(this);this.$.la&&!this.$.na&&N("Object already scheduled for deletion");cb.push(this);1===cb.length&&bb&&bb(db);this.$.la=!0;return this};V.prototype.Ca=function(a){this.wa&&(a=this.wa(a));return a};
|
|
V.prototype.va=function(a){this.ka&&this.ka(a)};V.prototype.argPackAdvance=8;V.prototype.readValueFromPointer=pb;V.prototype.deleteObject=function(a){if(null!==a)a["delete"]()};
|
|
V.prototype.fromWireType=function(a){function b(){return this.qa?tb(this.ba.ja,{da:this.Ea,aa:c,fa:this,ea:a}):tb(this.ba.ja,{da:this,aa:a})}var c=this.Ca(a);if(!c)return this.va(a),null;var d=sb(this.ba,c);if(void 0!==d){if(0===d.$.count.value)return d.$.aa=c,d.$.ea=a,d.clone();d=d.clone();this.va(a);return d}d=this.ba.Ba(c);d=eb[d];if(!d)return b.call(this);d=this.pa?d.ya:d.pointerType;var f=qb(c,this.ba,d.ba);return null===f?b.call(this):this.qa?tb(d.ba.ja,{da:d,aa:f,fa:this,ea:a}):tb(d.ba.ja,
|
|
{da:d,aa:f})};e.getInheritedInstanceCount=function(){return Object.keys(rb).length};e.getLiveInheritedInstances=function(){var a=[],b;for(b in rb)rb.hasOwnProperty(b)&&a.push(rb[b]);return a};e.flushPendingDeletes=db;e.setDelayFunction=function(a){bb=a;cb.length&&bb&&bb(db)};vb=e.UnboundTypeError=Ta("UnboundTypeError");e.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};e.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};
|
|
var Ia={c:function(a,b,c,d){y("Assertion failed: "+na(a)+", at: "+[b?na(b):"unknown filename",c,d?na(d):"unknown function"])},v:function(){return La.apply(null,arguments)},r:function(){return Ma.apply(null,arguments)},q:function(){return Na.apply(null,arguments)},p:function(a,b,c,d,f){var h=Oa(c);b=J(b);Q(a,{name:b,fromWireType:function(a){return!!a},toWireType:function(a,b){return b?d:f},argPackAdvance:8,readValueFromPointer:function(a){if(1===c)var d=qa;else if(2===c)d=ra;else if(4===c)d=D;else throw new TypeError("Unknown boolean type size: "+
|
|
b);return this.fromWireType(d[a>>h])},ia:null})},o:function(a,b,c,d,f,h,g,k,p,q,l,t,O){l=J(l);h=W(f,h);k&&(k=W(g,k));q&&(q=W(p,q));O=W(t,O);var F=Ra(l);gb(F,function(){yb("Cannot construct "+l+" due to unbound types",[d])});Wa([a,b,c],d?[d]:[],function(b){b=b[0];if(d){var c=b.ba;var f=c.ja}else f=T.prototype;b=Sa(F,function(){if(Object.getPrototypeOf(this)!==p)throw new M("Use 'new' to construct "+l);if(void 0===g.ua)throw new M(l+" has no accessible constructor");var a=g.ua[arguments.length];if(void 0===
|
|
a)throw new M("Tried to invoke ctor of "+l+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(g.ua).toString()+") parameters instead!");return a.apply(this,arguments)});var p=Object.create(f,{constructor:{value:b}});b.prototype=p;var g=new hb(l,b,p,O,c,h,k,q);c=new V(l,g,!0,!1);f=new V(l+"*",g,!1,!1);var t=new V(l+" const*",g,!1,!0);eb[a]={pointerType:f,ya:t};ub(F,b);return[c,f,t]})},h:function(a,b,c,d,f,h,g,k,p,q){b=J(b);f=W(d,f);Wa([],[a],function(a){a=a[0];var d=
|
|
a.name+"."+b,l={get:function(){yb("Cannot access "+d+" due to unbound types",[c,g])},enumerable:!0,configurable:!0};p?l.set=function(){yb("Cannot access "+d+" due to unbound types",[c,g])}:l.set=function(){N(d+" is a read-only property")};Object.defineProperty(a.ba.ja,b,l);Wa([],p?[c,g]:[c],function(c){var g=c[0],l={get:function(){var b=Ab(this,a,d+" getter");return g.fromWireType(f(h,b))},enumerable:!0};if(p){p=W(k,p);var t=c[1];l.set=function(b){var c=Ab(this,a,d+" setter"),f=[];p(q,c,t.toWireType(f,
|
|
b));zb(f)}}Object.defineProperty(a.ba.ja,b,l);return[]});return[]})},n:function(a,b){b=J(b);Q(a,{name:b,fromWireType:function(a){var b=Y[a].value;Cb(a);return b},toWireType:function(a,b){return lb(b)},argPackAdvance:8,readValueFromPointer:pb,ia:null})},j:function(a,b,c){c=Oa(c);b=J(b);Q(a,{name:b,fromWireType:function(a){return a},toWireType:function(a,b){if("number"!==typeof b&&"boolean"!==typeof b)throw new TypeError('Cannot convert "'+U(b)+'" to '+this.name);return b},argPackAdvance:8,readValueFromPointer:Db(b,
|
|
c),ia:null})},e:function(a,b,c,d,f,h){var g=Fb(b,c);a=J(a);f=W(d,f);gb(a,function(){yb("Cannot call "+a+" due to unbound types",g)},b-1);Wa([],g,function(c){var d=[c[0],null].concat(c.slice(1)),g=c=a,l=f,k=d.length;2>k&&N("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var O=null!==d[1]&&!1,F=!1,n=1;n<d.length;++n)if(null!==d[n]&&void 0===d[n].ia){F=!0;break}var mb="void"!==d[0].name,P="",S="";for(n=0;n<k-2;++n)P+=(0!==n?", ":"")+"arg"+n,S+=(0!==n?", ":"")+"arg"+
|
|
n+"Wired";g="return function "+Ra(g)+"("+P+") {\nif (arguments.length !== "+(k-2)+") {\nthrowBindingError('function "+g+" called with ' + arguments.length + ' arguments, expected "+(k-2)+" args!');\n}\n";F&&(g+="var destructors = [];\n");var nb=F?"destructors":"null";P="throwBindingError invoker fn runDestructors retType classParam".split(" ");l=[N,l,h,zb,d[0],d[1]];O&&(g+="var thisWired = classParam.toWireType("+nb+", this);\n");for(n=0;n<k-2;++n)g+="var arg"+n+"Wired = argType"+n+".toWireType("+
|
|
nb+", arg"+n+"); // "+d[n+2].name+"\n",P.push("argType"+n),l.push(d[n+2]);O&&(S="thisWired"+(0<S.length?", ":"")+S);g+=(mb?"var rv = ":"")+"invoker(fn"+(0<S.length?", ":"")+S+");\n";if(F)g+="runDestructors(destructors);\n";else for(n=O?1:2;n<d.length;++n)k=1===n?"thisWired":"arg"+(n-2)+"Wired",null!==d[n].ia&&(g+=k+"_dtor("+k+"); // "+d[n].name+"\n",P.push(k+"_dtor"),l.push(d[n].ia));mb&&(g+="var ret = retType.fromWireType(rv);\nreturn ret;\n");P.push(g+"}\n");d=Eb(P).apply(null,l);ub(c,d,b-1);return[]})},
|
|
d:function(a,b,c,d,f){function h(a){return a}b=J(b);-1===f&&(f=4294967295);var g=Oa(c);if(0===d){var k=32-8*c;h=function(a){return a<<k>>>k}}var p=-1!=b.indexOf("unsigned");Q(a,{name:b,fromWireType:h,toWireType:function(a,c){if("number"!==typeof c&&"boolean"!==typeof c)throw new TypeError('Cannot convert "'+U(c)+'" to '+this.name);if(c<d||c>f)throw new TypeError('Passing a number "'+U(c)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");
|
|
return p?c>>>0:c|0},argPackAdvance:8,readValueFromPointer:Gb(b,g,0!==d),ia:null})},b:function(a,b,c){function d(a){a>>=2;var b=E;return new f(b.buffer,b[a+1],b[a])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=J(c);Q(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{Da:!0})},m:function(a,b){b=J(b);var c="std::string"===b;Q(a,{name:b,fromWireType:function(a){var b=E[a>>2];if(c){var d=C[a+4+b],g=0;0!=d&&(g=d,C[a+4+b]=0);var k=
|
|
a+4;for(d=0;d<=b;++d){var p=a+4+d;if(0==C[p]){k=na(k);if(void 0===q)var q=k;else q+=String.fromCharCode(0),q+=k;k=p+1}}0!=g&&(C[a+4+b]=g)}else{q=Array(b);for(d=0;d<b;++d)q[d]=String.fromCharCode(C[a+4+d]);q=q.join("")}X(a);return q},toWireType:function(a,b){b instanceof ArrayBuffer&&(b=new Uint8Array(b));var d="string"===typeof b;d||b instanceof Uint8Array||b instanceof Uint8ClampedArray||b instanceof Int8Array||N("Cannot pass non-string to std::string");var f=(c&&d?function(){for(var a=0,c=0;c<b.length;++c){var d=
|
|
b.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|b.charCodeAt(++c)&1023);127>=d?++a:a=2047>=d?a+2:65535>=d?a+3:a+4}return a}:function(){return b.length})(),k=Lb(4+f+1);E[k>>2]=f;if(c&&d)oa(b,k+4,f+1);else if(d)for(d=0;d<f;++d){var p=b.charCodeAt(d);255<p&&(X(k),N("String has UTF-16 code units that do not fit in 8 bits"));C[k+4+d]=p}else for(d=0;d<f;++d)C[k+4+d]=b[d];null!==a&&a.push(X,k);return k},argPackAdvance:8,readValueFromPointer:pb,ia:function(a){X(a)}})},z:function(a,b,c){c=J(c);
|
|
if(2===b){var d=function(){return sa};var f=1}else 4===b&&(d=function(){return E},f=2);Q(a,{name:c,fromWireType:function(a){for(var b=d(),c=E[a>>2],h=Array(c),q=a+4>>f,l=0;l<c;++l)h[l]=String.fromCharCode(b[q+l]);X(a);return h.join("")},toWireType:function(a,c){var h=c.length,g=Lb(4+h*b),q=d();E[g>>2]=h;for(var l=g+4>>f,t=0;t<h;++t)q[l+t]=c.charCodeAt(t);null!==a&&a.push(X,g);return g},argPackAdvance:8,readValueFromPointer:pb,ia:function(a){X(a)}})},y:function(a,b){b=J(b);Q(a,{Ka:!0,name:b,argPackAdvance:0,
|
|
fromWireType:function(){},toWireType:function(){}})},l:Cb,x:function(a){4<a&&(Y[a].ta+=1)},k:function(a,b){var c=L[a];void 0===c&&N("_emval_take_value has unknown type "+wb(a));a=c.readValueFromPointer(b);return lb(a)},__memory_base:1024,__table_base:0,i:function(){y()},w:Hb,u:function(a,b,c){C.set(C.subarray(b,b+c),a)},t:function(a){if(2147418112<a)return!1;for(var b=Math.max(Hb(),16777216);b<a;)536870912>=b?b=pa(2*b):b=Math.min(pa((3*b+2147483648)/4),2147418112);a:{try{B.grow(b-buffer.byteLength+
|
|
65535>>16);va(B.buffer);var c=1;break a}catch(d){}c=void 0}return c?!0:!1},g:function(a){var b=Z.ma[a];Z.ma.splice(a,1);Mb(b)},f:Z,a:y,memory:B,s:function(){},table:ja},Nb=e.asm({},Ia,buffer);e.asm=Nb;e.___embind_register_native_and_builtin_types=function(){return e.asm.A.apply(null,arguments)};
|
|
var xb=e.___getTypeName=function(){return e.asm.B.apply(null,arguments)},X=e._free=function(){return e.asm.C.apply(null,arguments)},Lb=e._malloc=function(){return e.asm.D.apply(null,arguments)},Ja=e.globalCtors=function(){return e.asm.X.apply(null,arguments)},Mb=e.stackRestore=function(){return e.asm.Y.apply(null,arguments)},Ib=e.stackSave=function(){return e.asm.Z.apply(null,arguments)};e.dynCall_i=function(){return e.asm.E.apply(null,arguments)};
|
|
e.dynCall_ifi=function(){return e.asm.F.apply(null,arguments)};e.dynCall_ii=function(){return e.asm.G.apply(null,arguments)};e.dynCall_iidiiii=function(){return e.asm.H.apply(null,arguments)};e.dynCall_iii=function(){return e.asm.I.apply(null,arguments)};e.dynCall_iiii=function(){return e.asm.J.apply(null,arguments)};e.dynCall_iiiiif=function(){return e.asm.K.apply(null,arguments)};e.dynCall_iiiiiif=function(){return e.asm.L.apply(null,arguments)};
|
|
e.dynCall_jiji=function(){return e.asm.M.apply(null,arguments)};e.dynCall_v=function(){return e.asm.N.apply(null,arguments)};e.dynCall_vi=function(){return e.asm.O.apply(null,arguments)};e.dynCall_vif=function(){return e.asm.P.apply(null,arguments)};e.dynCall_vii=function(){return e.asm.Q.apply(null,arguments)};e.dynCall_viii=function(){return e.asm.R.apply(null,arguments)};e.dynCall_viiii=function(){return e.asm.S.apply(null,arguments)};e.dynCall_viiiif=function(){return e.asm.T.apply(null,arguments)};
|
|
e.dynCall_viiiii=function(){return e.asm.U.apply(null,arguments)};e.dynCall_viiiiif=function(){return e.asm.V.apply(null,arguments)};e.dynCall_viiiiii=function(){return e.asm.W.apply(null,arguments)};e.asm=Nb;var Ob;e.then=function(a){if(Ob)a(e);else{var b=e.onRuntimeInitialized;e.onRuntimeInitialized=function(){b&&b();a(e)}}return e};H=function Pb(){Ob||Qb();Ob||(H=Pb)};
|
|
function Qb(){function a(){if(!Ob&&(Ob=!0,!ka)){xa(za);xa(Aa);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var a=e.postRun.shift();Ba.unshift(a)}xa(Ba)}}if(!(0<G)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)Ca();xa(ya);0<G||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}e.run=Qb;
|
|
if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();Qb();
|
|
|
|
|
|
return imagequant
|
|
}
|
|
);
|
|
})();
|
|
if (typeof exports === 'object' && typeof module === 'object')
|
|
module.exports = imagequant;
|
|
else if (typeof define === 'function' && define['amd'])
|
|
define([], function() { return imagequant; });
|
|
else if (typeof exports === 'object')
|
|
exports["imagequant"] = imagequant;
|
|
|