forked from external-repos/squoosh
Compare commits
84 Commits
jpeg-simd
...
parallel-o
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ce1e76b72 | ||
|
|
11ada77c30 | ||
|
|
4c4f05f2e3 | ||
|
|
684b041262 | ||
|
|
fadb4c89f4 | ||
|
|
77d1e1dfe2 | ||
|
|
fdc9aac976 | ||
|
|
5ae65e3cf2 | ||
|
|
ca81096d50 | ||
|
|
7d822fa680 | ||
|
|
0e3aa54dc8 | ||
|
|
60dacff05e | ||
|
|
41e3868a13 | ||
|
|
1f50eeeb93 | ||
|
|
9c60d3286e | ||
|
|
b7ef7f92be | ||
|
|
65038c45bd | ||
|
|
6db70e5e27 | ||
|
|
8d991a256e | ||
|
|
1fd1b3041d | ||
|
|
c754016ac7 | ||
|
|
4ca7971442 | ||
|
|
42f9e4aed2 | ||
|
|
e14790f0b9 | ||
|
|
dfee848a39 | ||
|
|
a437afdf2b | ||
|
|
4768bc17ba | ||
|
|
0934c6c00f | ||
|
|
9d81a9cd57 | ||
|
|
239ffeb7a7 | ||
|
|
95570c8b3c | ||
|
|
6e52ac2a73 | ||
|
|
fd5c557065 | ||
|
|
0abb6f18ba | ||
|
|
4e5a810770 | ||
|
|
8a81792bd5 | ||
|
|
3f57f9fef1 | ||
|
|
549e1fc50a | ||
|
|
f3749a4e24 | ||
|
|
e316b0d667 | ||
|
|
8f2dcb5f48 | ||
|
|
5715fb7b1b | ||
|
|
cd33a2f759 | ||
|
|
ee561bb00e | ||
|
|
75275a5596 | ||
|
|
8cd811cafd | ||
|
|
4e090ea2f8 | ||
|
|
6b007a0235 | ||
|
|
c23d1091e7 | ||
|
|
d4f8b7f38b | ||
|
|
2c923e5239 | ||
|
|
fe52c9b307 | ||
|
|
3745a3fff1 | ||
|
|
d89e846896 | ||
|
|
db6dea846a | ||
|
|
8036579a3c | ||
|
|
0807fa4b9a | ||
|
|
3cda8285a1 | ||
|
|
0218d0aac5 | ||
|
|
cfba6e7bd5 | ||
|
|
c6015e2e8d | ||
|
|
94a2a7b32f | ||
|
|
03f33847a3 | ||
|
|
563b558204 | ||
|
|
3c92f2d531 | ||
|
|
f5ab9a9a59 | ||
|
|
7893660679 | ||
|
|
15dac42a7f | ||
|
|
53298a23ad | ||
|
|
7ffa45ba86 | ||
|
|
ee99cf6e0b | ||
|
|
2edb8cbd7e | ||
|
|
0ac3d17969 | ||
|
|
1baa823d77 | ||
|
|
368ad9505e | ||
|
|
08c267a98b | ||
|
|
0c3ef3fdf5 | ||
|
|
17dcc9c7d4 | ||
|
|
ac9a7767d2 | ||
|
|
c29006d593 | ||
|
|
e1ab43b76f | ||
|
|
409df481db | ||
|
|
02807aab32 | ||
|
|
34cb55978f |
@@ -7,3 +7,6 @@ end_of_line = lf
|
|||||||
charset = utf-8
|
charset = utf-8
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
|
|||||||
76
codecs/avif/Makefile
Normal file
76
codecs/avif/Makefile
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
CODEC_URL = https://github.com/AOMediaCodec/libavif/archive/v0.8.1.tar.gz
|
||||||
|
CODEC_PACKAGE = node_modules/libavif.tar.gz
|
||||||
|
|
||||||
|
LIBAOM_URL = https://aomedia.googlesource.com/aom/+archive/v2.0.0.tar.gz
|
||||||
|
LIBAOM_PACKAGE = node_modules/libaom.tar.gz
|
||||||
|
|
||||||
|
CODEC_ENC_DIR = node_modules/libavif-enc
|
||||||
|
CODEC_ENC_MT_DIR = node_modules/libavif-enc-mt
|
||||||
|
CODEC_DEC_DIR = node_modules/libavif-dec
|
||||||
|
LIBAOM_DIR = node_modules/libaom
|
||||||
|
|
||||||
|
OUT_ENC_JS = enc/avif_enc.js
|
||||||
|
OUT_ENC_MT_JS = enc/avif_enc_mt.js
|
||||||
|
OUT_DEC_JS = dec/avif_dec.js
|
||||||
|
|
||||||
|
OUT_ENC_CPP = enc/avif_enc.cpp
|
||||||
|
OUT_DEC_CPP = dec/avif_dec.cpp
|
||||||
|
|
||||||
|
HELPER_MAKEFLAGS := -f helper.Makefile \
|
||||||
|
LIBAOM_DIR=$(LIBAOM_DIR) \
|
||||||
|
CODEC_PACKAGE=$(CODEC_PACKAGE) \
|
||||||
|
LIBAOM_PACKAGE=$(LIBAOM_PACKAGE)
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all: $(OUT_ENC_JS) $(OUT_DEC_JS) $(OUT_ENC_MT_JS)
|
||||||
|
|
||||||
|
$(OUT_ENC_JS): $(OUT_ENC_CPP) $(CODEC_PACKAGE) $(LIBAOM_DIR)/CMakeLists.txt
|
||||||
|
$(MAKE) \
|
||||||
|
$(HELPER_MAKEFLAGS) \
|
||||||
|
CODEC_DIR=$(CODEC_ENC_DIR) \
|
||||||
|
OUT_JS=$@ \
|
||||||
|
OUT_CPP=$< \
|
||||||
|
LIBAOM_FLAGS="\
|
||||||
|
-DCONFIG_AV1_DECODER=0 \
|
||||||
|
-DCONFIG_MULTITHREAD=0 \
|
||||||
|
"
|
||||||
|
|
||||||
|
$(OUT_ENC_MT_JS): $(OUT_ENC_CPP) $(CODEC_PACKAGE) $(LIBAOM_DIR)/CMakeLists.txt
|
||||||
|
$(MAKE) \
|
||||||
|
$(HELPER_MAKEFLAGS) \
|
||||||
|
CODEC_DIR=$(CODEC_ENC_MT_DIR) \
|
||||||
|
OUT_JS=$@ \
|
||||||
|
OUT_CPP=$< \
|
||||||
|
LIBAOM_FLAGS="\
|
||||||
|
-DCONFIG_AV1_DECODER=0 \
|
||||||
|
" \
|
||||||
|
OUT_FLAGS="-pthread"
|
||||||
|
|
||||||
|
$(OUT_DEC_JS): $(OUT_DEC_CPP) $(CODEC_PACKAGE) $(LIBAOM_DIR)/CMakeLists.txt
|
||||||
|
$(MAKE) \
|
||||||
|
$(HELPER_MAKEFLAGS) \
|
||||||
|
CODEC_DIR=$(CODEC_DEC_DIR) \
|
||||||
|
OUT_JS=$@ \
|
||||||
|
OUT_CPP=$< \
|
||||||
|
LIBAOM_FLAGS="\
|
||||||
|
-DCONFIG_AV1_ENCODER=0 \
|
||||||
|
-DCONFIG_MULTITHREAD=0 \
|
||||||
|
"
|
||||||
|
|
||||||
|
$(CODEC_PACKAGE):
|
||||||
|
mkdir -p $(@D)
|
||||||
|
curl -sL $(CODEC_URL) -o $@
|
||||||
|
|
||||||
|
$(LIBAOM_PACKAGE):
|
||||||
|
mkdir -p $(@D)
|
||||||
|
curl -sL $(LIBAOM_URL) -o $@
|
||||||
|
|
||||||
|
$(LIBAOM_DIR)/CMakeLists.txt: $(LIBAOM_PACKAGE)
|
||||||
|
mkdir -p $(@D)
|
||||||
|
tar xzm -C $(@D) -f $(LIBAOM_PACKAGE)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(MAKE) $(HELPER_MAKEFLAGS) CODEC_DIR=$(CODEC_ENC_DIR) OUT_JS=$(OUT_ENC_JS) clean
|
||||||
|
$(MAKE) $(HELPER_MAKEFLAGS) CODEC_DIR=$(CODEC_ENC_MT_DIR) OUT_JS=$(OUT_ENC_MT_JS) clean
|
||||||
|
$(MAKE) $(HELPER_MAKEFLAGS) CODEC_DIR=$(CODEC_DEC_DIR) OUT_JS=$(OUT_DEC_JS) clean
|
||||||
14
codecs/avif/dec/README.md
Normal file
14
codecs/avif/dec/README.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# AVIF decoder
|
||||||
|
|
||||||
|
- Source: <https://github.com/AOMediaCodec/libavif>
|
||||||
|
- Version: v0.5.4
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
See `example.html`
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### `RawImage decode(std::string buffer)`
|
||||||
|
|
||||||
|
Decodes the given avif buffer into raw RGBA. `RawImage` is a class with 3 fields: `buffer`, `width`, and `height`.
|
||||||
50
codecs/avif/dec/avif_dec.cpp
Normal file
50
codecs/avif/dec/avif_dec.cpp
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#include <emscripten/bind.h>
|
||||||
|
#include <emscripten/val.h>
|
||||||
|
#include "avif/avif.h"
|
||||||
|
|
||||||
|
using namespace emscripten;
|
||||||
|
|
||||||
|
thread_local const val Uint8ClampedArray = val::global("Uint8ClampedArray");
|
||||||
|
thread_local const val ImageData = val::global("ImageData");
|
||||||
|
|
||||||
|
val decode(std::string avifimage) {
|
||||||
|
// point raw.data and raw.size to the contents of an .avif(s)
|
||||||
|
avifROData raw = {
|
||||||
|
.data = (uint8_t*)avifimage.c_str(),
|
||||||
|
.size = avifimage.length()
|
||||||
|
};
|
||||||
|
|
||||||
|
avifImage* image = avifImageCreateEmpty();
|
||||||
|
avifDecoder* decoder = avifDecoderCreate();
|
||||||
|
avifResult decodeResult = avifDecoderRead(decoder, image, &raw);
|
||||||
|
// image is an independent copy of decoded data, decoder may be destroyed here
|
||||||
|
avifDecoderDestroy(decoder);
|
||||||
|
|
||||||
|
val result = val::null();
|
||||||
|
|
||||||
|
if (decodeResult == AVIF_RESULT_OK) {
|
||||||
|
// Convert to interleaved RGB(A)/BGR(A) using a libavif-allocated buffer.
|
||||||
|
avifRGBImage rgb;
|
||||||
|
avifRGBImageSetDefaults(&rgb, image); // Defaults to AVIF_RGB_FORMAT_RGBA which is what we want.
|
||||||
|
rgb.depth = 8; // Does not need to match image->depth. We always want 8-bit pixels.
|
||||||
|
|
||||||
|
avifRGBImageAllocatePixels(&rgb);
|
||||||
|
avifImageYUVToRGB(image, &rgb);
|
||||||
|
|
||||||
|
// We want to create a *copy* of the decoded data to be owned by the JavaScript side.
|
||||||
|
// For that, we perform `new Uint8Array(wasmMemBuffer, wasmPtr, wasmSize).slice()`:
|
||||||
|
result = ImageData.new_(Uint8ClampedArray.new_(typed_memory_view(rgb.rowBytes * rgb.height, rgb.pixels)), rgb.width, rgb.height);
|
||||||
|
|
||||||
|
// Now we can safely free the RGB pixels:
|
||||||
|
avifRGBImageFreePixels(&rgb);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Image has been converted to RGB, we don't need the original anymore.
|
||||||
|
avifImageDestroy(image);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_BINDINGS(my_module) {
|
||||||
|
function("decode", &decode);
|
||||||
|
}
|
||||||
6
codecs/avif/dec/avif_dec.d.ts
vendored
Normal file
6
codecs/avif/dec/avif_dec.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
interface AVIFModule extends EmscriptenWasm.Module {
|
||||||
|
decode(data: BufferSource): ImageData | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<AVIFModule>;
|
||||||
|
|
||||||
72
codecs/avif/dec/avif_dec.js
Normal file
72
codecs/avif/dec/avif_dec.js
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
|
||||||
|
var avif_dec = (function() {
|
||||||
|
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||||
|
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||||
|
return (
|
||||||
|
function(avif_dec) {
|
||||||
|
avif_dec = avif_dec || {};
|
||||||
|
|
||||||
|
|
||||||
|
var d;d||(d=typeof avif_dec !== 'undefined' ? avif_dec : {});var aa,ba;d.ready=new Promise(function(a,b){aa=a;ba=b});var r={},t;for(t in d)d.hasOwnProperty(t)&&(r[t]=d[t]);var u=!1,v=!1,ca=!1,da=!1;u="object"===typeof window;v="function"===typeof importScripts;ca="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;da=!u&&!ca&&!v;var w="",x,z,ea,fa;
|
||||||
|
if(ca)w=v?require("path").dirname(w)+"/":__dirname+"/",x=function(a,b){ea||(ea=require("fs"));fa||(fa=require("path"));a=fa.normalize(a);return ea.readFileSync(a,b?null:"utf8")},z=function(a){a=x(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||A("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",A),d.inspect=function(){return"[Emscripten Module object]"};
|
||||||
|
else if(da)"undefined"!=typeof read&&(x=function(a){return read(a)}),z=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||A("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="",x=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},v&&(z=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ha=d.print||console.log.bind(console),B=d.printErr||console.warn.bind(console);for(t in r)r.hasOwnProperty(t)&&(d[t]=r[t]);r=null;var ia=0,D;d.wasmBinary&&(D=d.wasmBinary);var noExitRuntime;
|
||||||
|
d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&A("no native wasm support detected");var E,ja=new WebAssembly.Table({initial:419,maximum:419,element:"anyfunc"}),ka=!1,la="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||||
|
function ma(a,b,c){var e=b+c;for(c=b;a[c]&&!(c>=e);)++c;if(16<c-b&&a.subarray&&la)return la.decode(a.subarray(b,c));for(e="";b<c;){var f=a[b++];if(f&128){var g=a[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var h=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|h:(f&7)<<18|g<<12|h<<6|a[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}
|
||||||
|
function na(a,b,c){var e=F;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var h=a.charCodeAt(++f);g=65536+((g&1023)<<10)|h&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var oa="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||||
|
function pa(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&G[c];)++c;c<<=1;if(32<c-a&&oa)return oa.decode(F.subarray(a,c));c=0;for(e="";;){var f=H[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function qa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)H[b>>1]=a.charCodeAt(f),b+=2;H[b>>1]=0;return b-e}function ra(a){return 2*a.length}
|
||||||
|
function sa(a,b){for(var c=0,e="";!(c>=b/4);){var f=I[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function ta(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var h=a.charCodeAt(++f);g=65536+((g&1023)<<10)|h&1023}I[b>>2]=g;b+=4;if(b+4>c)break}I[b>>2]=0;return b-e}
|
||||||
|
function ua(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var J,va,F,H,G,I,K,wa,xa;function ya(a){J=a;d.HEAP8=va=new Int8Array(a);d.HEAP16=H=new Int16Array(a);d.HEAP32=I=new Int32Array(a);d.HEAPU8=F=new Uint8Array(a);d.HEAPU16=G=new Uint16Array(a);d.HEAPU32=K=new Uint32Array(a);d.HEAPF32=wa=new Float32Array(a);d.HEAPF64=xa=new Float64Array(a)}var za=d.INITIAL_MEMORY||16777216;d.wasmMemory?E=d.wasmMemory:E=new WebAssembly.Memory({initial:za/65536,maximum:32768});
|
||||||
|
E&&(J=E.buffer);za=J.byteLength;ya(J);I[153596]=5857424;function Aa(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.la;"number"===typeof c?void 0===b.ha?d.dynCall_v(c):d.dynCall_vi(c,b.ha):c(void 0===b.ha?null:b.ha)}}}var Ba=[],Ca=[],Da=[],Ea=[];function Fa(){var a=d.preRun.shift();Ba.unshift(a)}var L=0,Ga=null,N=null;d.preloadedImages={};d.preloadedAudios={};
|
||||||
|
function A(a){if(d.onAbort)d.onAbort(a);B(a);ka=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Ha(a){var b=O;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ia(){return Ha("data:application/octet-stream;base64,")}var O="avif_dec.wasm";if(!Ia()){var Ja=O;O=d.locateFile?d.locateFile(Ja,w):w+Ja}
|
||||||
|
function Ka(){try{if(D)return new Uint8Array(D);if(z)return z(O);throw"both async and sync fetching of the wasm failed";}catch(a){A(a)}}function La(){return D||!u&&!v||"function"!==typeof fetch||Ha("file://")?new Promise(function(a){a(Ka())}):fetch(O,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+O+"'";return a.arrayBuffer()}).catch(function(){return Ka()})}Ca.push({la:function(){Ma()}});function Na(){return 0<Na.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 P(a){for(var b="";F[a];)b+=Pa[F[a++]];return b}var Q={},R={},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(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.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 Ua=void 0;function T(a){throw new Ua(a);}var Va=void 0;function Wa(a,b){function c(l){l=b(l);if(l.length!==e.length)throw new Va("Mismatched type converter count");for(var k=0;k<e.length;++k)U(e[k],l[k])}var e=[];e.forEach(function(l){Qa[l]=a});var f=Array(a.length),g=[],h=0;a.forEach(function(l,k){R.hasOwnProperty(l)?f[k]=R[l]:(g.push(l),Q.hasOwnProperty(l)||(Q[l]=[]),Q[l].push(function(){f[k]=R[l];++h;h===g.length&&c(f)}))});0===g.length&&c(f)}
|
||||||
|
function U(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||T('type "'+e+'" must have a positive integer typeid pointer');if(R.hasOwnProperty(a)){if(c.ma)return;T("Cannot register type '"+e+"' twice")}R[a]=b;delete Qa[a];Q.hasOwnProperty(a)&&(b=Q[a],delete Q[a],b.forEach(function(f){f()}))}var Xa=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
|
function Ya(a){4<a&&0===--V[a].ia&&(V[a]=void 0,Xa.push(a))}function ab(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Xa.length?Xa.pop():V.length;V[b]={ia:1,value:a};return b}}function bb(a){return this.fromWireType(K[a>>2])}function cb(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(c){return this.fromWireType(wa[c>>2])};case 3:return function(c){return this.fromWireType(xa[c>>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){for(;a.length;){var b=a.pop();a.pop()(b)}}function gb(a,b){var c=d;if(void 0===c[a].fa){var e=c[a];c[a]=function(){c[a].fa.hasOwnProperty(arguments.length)||T("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].fa+")!");return c[a].fa[arguments.length].apply(this,arguments)};c[a].fa=[];c[a].fa[e.ka]=e}}
|
||||||
|
function hb(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].fa&&void 0!==d[a].fa[c])&&T("Cannot register public name '"+a+"' twice"),gb(a,a),d.hasOwnProperty(c)&&T("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].fa[c]=b):(d[a]=b,void 0!==c&&(d[a].oa=c))}function ib(a,b){for(var c=[],e=0;e<a;e++)c.push(I[(b>>2)+e]);return c}
|
||||||
|
function jb(a,b){a=P(a);var c=d["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&T("unknown function pointer with signature "+a+": "+b);return c}var kb=void 0;function lb(a){a=mb(a);var b=P(a);W(a);return b}
|
||||||
|
function nb(a,b){function c(g){f[g]||R[g]||(Qa[g]?Qa[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new kb(a+": "+e.map(lb).join([", "]));}function ob(a,b,c){switch(b){case 0:return c?function(e){return va[e]}:function(e){return F[e]};case 1:return c?function(e){return H[e>>1]}:function(e){return G[e>>1]};case 2:return c?function(e){return I[e>>2]}:function(e){return K[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var pb={};
|
||||||
|
function qb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function rb(a,b){var c=R[a];void 0===c&&T(b+" has unknown type "+lb(a));return c}for(var sb={},tb=[null,[],[]],ub=Array(256),vb=0;256>vb;++vb)ub[vb]=String.fromCharCode(vb);Pa=ub;Ua=d.BindingError=Ta("BindingError");Va=d.InternalError=Ta("InternalError");d.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};
|
||||||
|
d.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};kb=d.UnboundTypeError=Ta("UnboundTypeError");
|
||||||
|
var Db={u:function(a){return wb(a)},r:function(){},t:function(a){"uncaught_exception"in Na?Na.ja++:Na.ja=1;throw a;},D:function(a,b,c,e,f){var g=Oa(c);b=P(b);U(a,{name:b,fromWireType:function(h){return!!h},toWireType:function(h,l){return l?e:f},argPackAdvance:8,readValueFromPointer:function(h){if(1===c)var l=va;else if(2===c)l=H;else if(4===c)l=I;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(l[h>>g])},ga:null})},C:function(a,b){b=P(b);U(a,{name:b,fromWireType:function(c){var e=
|
||||||
|
V[c].value;Ya(c);return e},toWireType:function(c,e){return ab(e)},argPackAdvance:8,readValueFromPointer:bb,ga:null})},p:function(a,b,c){c=Oa(c);b=P(b);U(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+cb(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:db(b,c),ga:null})},v:function(a,b,c,e,f,g){var h=ib(b,c);a=P(a);f=jb(e,f);hb(a,function(){nb("Cannot call "+a+" due to unbound types",
|
||||||
|
h)},b-1);Wa(h,function(l){var k=[l[0],null].concat(l.slice(1)),n=l=a,p=f,q=k.length;2>q&&T("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var y=null!==k[1]&&!1,C=!1,m=1;m<k.length;++m)if(null!==k[m]&&void 0===k[m].ga){C=!0;break}var Za="void"!==k[0].name,M="",S="";for(m=0;m<q-2;++m)M+=(0!==m?", ":"")+"arg"+m,S+=(0!==m?", ":"")+"arg"+m+"Wired";n="return function "+Ra(n)+"("+M+") {\nif (arguments.length !== "+(q-2)+") {\nthrowBindingError('function "+n+" called with ' + arguments.length + ' arguments, expected "+
|
||||||
|
(q-2)+" args!');\n}\n";C&&(n+="var destructors = [];\n");var $a=C?"destructors":"null";M="throwBindingError invoker fn runDestructors retType classParam".split(" ");p=[T,p,g,fb,k[0],k[1]];y&&(n+="var thisWired = classParam.toWireType("+$a+", this);\n");for(m=0;m<q-2;++m)n+="var arg"+m+"Wired = argType"+m+".toWireType("+$a+", arg"+m+"); // "+k[m+2].name+"\n",M.push("argType"+m),p.push(k[m+2]);y&&(S="thisWired"+(0<S.length?", ":"")+S);n+=(Za?"var rv = ":"")+"invoker(fn"+(0<S.length?", ":"")+S+");\n";
|
||||||
|
if(C)n+="runDestructors(destructors);\n";else for(m=y?1:2;m<k.length;++m)q=1===m?"thisWired":"arg"+(m-2)+"Wired",null!==k[m].ga&&(n+=q+"_dtor("+q+"); // "+k[m].name+"\n",M.push(q+"_dtor"),p.push(k[m].ga));Za&&(n+="var ret = retType.fromWireType(rv);\nreturn ret;\n");M.push(n+"}\n");k=eb(M).apply(null,p);m=b-1;if(!d.hasOwnProperty(l))throw new Va("Replacing nonexistant public symbol");void 0!==d[l].fa&&void 0!==m?d[l].fa[m]=k:(d[l]=k,d[l].ka=m);return[]})},d:function(a,b,c,e,f){function g(n){return n}
|
||||||
|
b=P(b);-1===f&&(f=4294967295);var h=Oa(c);if(0===e){var l=32-8*c;g=function(n){return n<<l>>>l}}var k=-1!=b.indexOf("unsigned");U(a,{name:b,fromWireType:g,toWireType:function(n,p){if("number"!==typeof p&&"boolean"!==typeof p)throw new TypeError('Cannot convert "'+cb(p)+'" to '+this.name);if(p<e||p>f)throw new TypeError('Passing a number "'+cb(p)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return k?p>>>0:p|0},argPackAdvance:8,readValueFromPointer:ob(b,
|
||||||
|
h,0!==e),ga:null})},c:function(a,b,c){function e(g){g>>=2;var h=K;return new f(J,h[g+1],h[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=P(c);U(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{ma:!0})},q:function(a,b){b=P(b);var c="std::string"===b;U(a,{name:b,fromWireType:function(e){var f=K[e>>2];if(c)for(var g=e+4,h=0;h<=f;++h){var l=e+4+h;if(h==f||0==F[l]){g=g?ma(F,g,l-g):"";if(void 0===k)var k=g;else k+=String.fromCharCode(0),
|
||||||
|
k+=g;g=l+1}}else{k=Array(f);for(h=0;h<f;++h)k[h]=String.fromCharCode(F[e+4+h]);k=k.join("")}W(e);return k},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||T("Cannot pass non-string to std::string");var h=(c&&g?function(){for(var n=0,p=0;p<f.length;++p){var q=f.charCodeAt(p);55296<=q&&57343>=q&&(q=65536+((q&1023)<<10)|f.charCodeAt(++p)&1023);127>=q?++n:n=2047>=q?n+
|
||||||
|
2:65535>=q?n+3:n+4}return n}:function(){return f.length})(),l=wb(4+h+1);K[l>>2]=h;if(c&&g)na(f,l+4,h+1);else if(g)for(g=0;g<h;++g){var k=f.charCodeAt(g);255<k&&(W(l),T("String has UTF-16 code units that do not fit in 8 bits"));F[l+4+g]=k}else for(g=0;g<h;++g)F[l+4+g]=f[g];null!==e&&e.push(W,l);return l},argPackAdvance:8,readValueFromPointer:bb,ga:function(e){W(e)}})},j:function(a,b,c){c=P(c);if(2===b){var e=pa;var f=qa;var g=ra;var h=function(){return G};var l=1}else 4===b&&(e=sa,f=ta,g=ua,h=function(){return K},
|
||||||
|
l=2);U(a,{name:c,fromWireType:function(k){for(var n=K[k>>2],p=h(),q,y=k+4,C=0;C<=n;++C){var m=k+4+C*b;if(C==n||0==p[m>>l])y=e(y,m-y),void 0===q?q=y:(q+=String.fromCharCode(0),q+=y),y=m+b}W(k);return q},toWireType:function(k,n){"string"!==typeof n&&T("Cannot pass non-string to C++ string type "+c);var p=g(n),q=wb(4+p+b);K[q>>2]=p>>l;f(n,q+4,p+b);null!==k&&k.push(W,q);return q},argPackAdvance:8,readValueFromPointer:bb,ga:function(k){W(k)}})},E:function(a,b){b=P(b);U(a,{na:!0,name:b,argPackAdvance:0,
|
||||||
|
fromWireType:function(){},toWireType:function(){}})},n:Ya,F:function(a){if(0===a)return ab(qb());var b=pb[a];a=void 0===b?P(a):b;return ab(qb()[a])},w:function(a){4<a&&(V[a].ia+=1)},l:function(a,b,c,e){a||T("Cannot use deleted val. handle = "+a);a=V[a].value;var f=sb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var h="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)h+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
|
||||||
|
g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",h+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(rb,d,ab);sb[b]=f}return f(a,c,e)},k:function(){A()},s:function(){B("missing function: aom_codec_av1_cx");A(-1)},e:function(a,b){X(a,b||1);throw"longjmp";},A:function(a,b,c){F.copyWithin(a,b,b+c)},f:function(a){a>>>=0;var b=F.length;
|
||||||
|
if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{E.grow(Math.min(2147483648,e)-J.byteLength+65535>>>16);ya(E.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},B:function(){return 0},x:function(){},o:function(a,b,c,e){for(var f=0,g=0;g<c;g++){for(var h=I[b+8*g>>2],l=I[b+(8*g+4)>>2],k=0;k<l;k++){var n=F[h+k],p=tb[a];0===n||10===n?((1===a?ha:B)(ma(p,0)),p.length=0):p.push(n)}f+=l}I[e>>
|
||||||
|
2]=f;return 0},a:function(){return ia|0},h:xb,y:yb,z:zb,g:Ab,m:Bb,i:Cb,memory:E,b:function(a){ia=a|0},table:ja};
|
||||||
|
(function(){function a(f){d.asm=f.exports;L--;d.monitorRunDependencies&&d.monitorRunDependencies(L);0==L&&(null!==Ga&&(clearInterval(Ga),Ga=null),N&&(f=N,N=null,f()))}function b(f){a(f.instance)}function c(f){return La().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){B("failed to asynchronously prepare wasm: "+g);A(g)})}var e={a:Db};L++;d.monitorRunDependencies&&d.monitorRunDependencies(L);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return B("Module.instantiateWasm callback failed with error: "+
|
||||||
|
f),!1}(function(){if(D||"function"!==typeof WebAssembly.instantiateStreaming||Ia()||Ha("file://")||"function"!==typeof fetch)return c(b);fetch(O,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){B("wasm streaming compile failed: "+g);B("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
||||||
|
var Ma=d.___wasm_call_ctors=function(){return(Ma=d.___wasm_call_ctors=d.asm.G).apply(null,arguments)},wb=d._malloc=function(){return(wb=d._malloc=d.asm.H).apply(null,arguments)},W=d._free=function(){return(W=d._free=d.asm.I).apply(null,arguments)},mb=d.___getTypeName=function(){return(mb=d.___getTypeName=d.asm.J).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.K).apply(null,arguments)};
|
||||||
|
var X=d._setThrew=function(){return(X=d._setThrew=d.asm.L).apply(null,arguments)},Y=d.stackSave=function(){return(Y=d.stackSave=d.asm.M).apply(null,arguments)},Z=d.stackRestore=function(){return(Z=d.stackRestore=d.asm.N).apply(null,arguments)},Eb=d.dynCall_v=function(){return(Eb=d.dynCall_v=d.asm.O).apply(null,arguments)},Fb=d.dynCall_vi=function(){return(Fb=d.dynCall_vi=d.asm.P).apply(null,arguments)},Gb=d.dynCall_vii=function(){return(Gb=d.dynCall_vii=d.asm.Q).apply(null,arguments)},Hb=d.dynCall_viiii=
|
||||||
|
function(){return(Hb=d.dynCall_viiii=d.asm.R).apply(null,arguments)};d.dynCall_ii=function(){return(d.dynCall_ii=d.asm.S).apply(null,arguments)};var Ib=d.dynCall_iii=function(){return(Ib=d.dynCall_iii=d.asm.T).apply(null,arguments)};d.dynCall_iiii=function(){return(d.dynCall_iiii=d.asm.U).apply(null,arguments)};var Jb=d.dynCall_iiiii=function(){return(Jb=d.dynCall_iiiii=d.asm.V).apply(null,arguments)};d.dynCall_viiiiii=function(){return(d.dynCall_viiiiii=d.asm.W).apply(null,arguments)};
|
||||||
|
d.dynCall_viiiiiiii=function(){return(d.dynCall_viiiiiiii=d.asm.X).apply(null,arguments)};d.dynCall_viiiiiiiiiii=function(){return(d.dynCall_viiiiiiiiiii=d.asm.Y).apply(null,arguments)};d.dynCall_viii=function(){return(d.dynCall_viii=d.asm.Z).apply(null,arguments)};d.dynCall_viiiiiii=function(){return(d.dynCall_viiiiiii=d.asm._).apply(null,arguments)};d.dynCall_iiiiiii=function(){return(d.dynCall_iiiiiii=d.asm.$).apply(null,arguments)};
|
||||||
|
d.dynCall_iidiiii=function(){return(d.dynCall_iidiiii=d.asm.aa).apply(null,arguments)};d.dynCall_i=function(){return(d.dynCall_i=d.asm.ba).apply(null,arguments)};d.dynCall_viiiiiiiiii=function(){return(d.dynCall_viiiiiiiiii=d.asm.ca).apply(null,arguments)};d.dynCall_jiji=function(){return(d.dynCall_jiji=d.asm.da).apply(null,arguments)};d.dynCall_viiiii=function(){return(d.dynCall_viiiii=d.asm.ea).apply(null,arguments)};
|
||||||
|
function Bb(a,b,c){var e=Y();try{Gb(a,b,c)}catch(f){Z(e);if(f!==f+0&&"longjmp"!==f)throw f;X(1,0)}}function Cb(a,b,c,e,f){var g=Y();try{Hb(a,b,c,e,f)}catch(h){Z(g);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}function xb(a,b,c){var e=Y();try{return Ib(a,b,c)}catch(f){Z(e);if(f!==f+0&&"longjmp"!==f)throw f;X(1,0)}}function Ab(a,b){var c=Y();try{Fb(a,b)}catch(e){Z(c);if(e!==e+0&&"longjmp"!==e)throw e;X(1,0)}}function zb(a){var b=Y();try{Eb(a)}catch(c){Z(b);if(c!==c+0&&"longjmp"!==c)throw c;X(1,0)}}
|
||||||
|
function yb(a,b,c,e,f){var g=Y();try{return Jb(a,b,c,e,f)}catch(h){Z(g);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}var Kb;N=function Lb(){Kb||Mb();Kb||(N=Lb)};
|
||||||
|
function Mb(){function a(){if(!Kb&&(Kb=!0,d.calledRun=!0,!ka)){Aa(Ca);Aa(Da);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;){var b=d.postRun.shift();Ea.unshift(b)}Aa(Ea)}}if(!(0<L)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)Fa();Aa(Ba);0<L||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}
|
||||||
|
d.run=Mb;if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();noExitRuntime=!0;Mb();
|
||||||
|
|
||||||
|
|
||||||
|
return avif_dec.ready
|
||||||
|
}
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
if (typeof exports === 'object' && typeof module === 'object')
|
||||||
|
module.exports = avif_dec;
|
||||||
|
else if (typeof define === 'function' && define['amd'])
|
||||||
|
define([], function() { return avif_dec; });
|
||||||
|
else if (typeof exports === 'object')
|
||||||
|
exports["avif_dec"] = avif_dec;
|
||||||
|
|
||||||
BIN
codecs/avif/dec/avif_dec.wasm
Normal file
BIN
codecs/avif/dec/avif_dec.wasm
Normal file
Binary file not shown.
37
codecs/avif/enc/README.md
Normal file
37
codecs/avif/enc/README.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# AVIF encoder
|
||||||
|
|
||||||
|
- Source: <https://github.com/AOMediaCodec/libavif>
|
||||||
|
- Version: v0.5.4
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Run example.js
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### `Uint8Array encode(std::string image_in, int image_width, int image_height, AvifOptions opts)`
|
||||||
|
|
||||||
|
Encodes the given image with given dimension to AVIF. Options looks like this:
|
||||||
|
|
||||||
|
```c++
|
||||||
|
struct AvifOptions {
|
||||||
|
// 0 = lossless
|
||||||
|
// 63 = worst quality
|
||||||
|
int minQuantizer;
|
||||||
|
int maxQuantizer;
|
||||||
|
|
||||||
|
// [0 - 6]
|
||||||
|
// Creates 2^n tiles in that dimension
|
||||||
|
int tileRowsLog2;
|
||||||
|
int tileColsLog2;
|
||||||
|
|
||||||
|
// 0 = slowest
|
||||||
|
// 10 = fastest
|
||||||
|
int speed;
|
||||||
|
|
||||||
|
// 0 = 4:2:0
|
||||||
|
// 1 = 4:2:2
|
||||||
|
// 2 = 4:4:4
|
||||||
|
int subsample;
|
||||||
|
};
|
||||||
|
```
|
||||||
107
codecs/avif/enc/avif_enc.cpp
Normal file
107
codecs/avif/enc/avif_enc.cpp
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
#include <emscripten/bind.h>
|
||||||
|
#include <emscripten/val.h>
|
||||||
|
#include <emscripten/threading.h>
|
||||||
|
#include "avif/avif.h"
|
||||||
|
|
||||||
|
using namespace emscripten;
|
||||||
|
|
||||||
|
struct AvifOptions {
|
||||||
|
// [0 - 63]
|
||||||
|
// 0 = lossless
|
||||||
|
// 63 = worst quality
|
||||||
|
int minQuantizer;
|
||||||
|
int maxQuantizer;
|
||||||
|
int minQuantizerAlpha;
|
||||||
|
int maxQuantizerAlpha;
|
||||||
|
// [0 - 6]
|
||||||
|
// Creates 2^n tiles in that dimension
|
||||||
|
int tileRowsLog2;
|
||||||
|
int tileColsLog2;
|
||||||
|
// [0 - 10]
|
||||||
|
// 0 = slowest
|
||||||
|
// 10 = fastest
|
||||||
|
int speed;
|
||||||
|
// 0 = 4:0:0
|
||||||
|
// 1 = 4:2:0
|
||||||
|
// 2 = 4:2:2
|
||||||
|
// 3 = 4:4:4
|
||||||
|
int subsample;
|
||||||
|
};
|
||||||
|
|
||||||
|
thread_local const val Uint8Array = val::global("Uint8Array");
|
||||||
|
|
||||||
|
val encode(std::string buffer, int width, int height, AvifOptions options) {
|
||||||
|
avifRWData output = AVIF_DATA_EMPTY;
|
||||||
|
int depth = 8;
|
||||||
|
avifPixelFormat format;
|
||||||
|
switch (options.subsample) {
|
||||||
|
case 0:
|
||||||
|
format = AVIF_PIXEL_FORMAT_YUV400;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
format = AVIF_PIXEL_FORMAT_YUV420;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
format = AVIF_PIXEL_FORMAT_YUV422;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
format = AVIF_PIXEL_FORMAT_YUV444;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
avifImage* image = avifImageCreate(width, height, depth, format);
|
||||||
|
|
||||||
|
if (
|
||||||
|
options.maxQuantizer == AVIF_QUANTIZER_LOSSLESS &&
|
||||||
|
options.minQuantizer == AVIF_QUANTIZER_LOSSLESS &&
|
||||||
|
options.minQuantizerAlpha == AVIF_QUANTIZER_LOSSLESS &&
|
||||||
|
options.maxQuantizerAlpha == AVIF_QUANTIZER_LOSSLESS &&
|
||||||
|
format == AVIF_PIXEL_FORMAT_YUV444
|
||||||
|
) {
|
||||||
|
image->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_IDENTITY;
|
||||||
|
} else {
|
||||||
|
image->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_BT709;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* rgba = (uint8_t*)buffer.c_str();
|
||||||
|
|
||||||
|
avifRGBImage srcRGB;
|
||||||
|
avifRGBImageSetDefaults(&srcRGB, image);
|
||||||
|
srcRGB.pixels = rgba;
|
||||||
|
srcRGB.rowBytes = width * 4;
|
||||||
|
avifImageRGBToYUV(image, &srcRGB);
|
||||||
|
|
||||||
|
avifEncoder* encoder = avifEncoderCreate();
|
||||||
|
encoder->maxThreads = emscripten_num_logical_cores();
|
||||||
|
encoder->minQuantizer = options.minQuantizer;
|
||||||
|
encoder->maxQuantizer = options.maxQuantizer;
|
||||||
|
encoder->minQuantizerAlpha = options.minQuantizerAlpha;
|
||||||
|
encoder->maxQuantizerAlpha = options.maxQuantizerAlpha;
|
||||||
|
encoder->tileRowsLog2 = options.tileRowsLog2;
|
||||||
|
encoder->tileColsLog2 = options.tileColsLog2;
|
||||||
|
encoder->speed = options.speed;
|
||||||
|
avifResult encodeResult = avifEncoderWrite(encoder, image, &output);
|
||||||
|
auto js_result = val::null();
|
||||||
|
if (encodeResult == AVIF_RESULT_OK) {
|
||||||
|
js_result = Uint8Array.new_(typed_memory_view(output.size, output.data));
|
||||||
|
}
|
||||||
|
|
||||||
|
avifImageDestroy(image);
|
||||||
|
avifEncoderDestroy(encoder);
|
||||||
|
avifRWDataFree(&output);
|
||||||
|
return js_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_BINDINGS(my_module) {
|
||||||
|
value_object<AvifOptions>("AvifOptions")
|
||||||
|
.field("minQuantizer", &AvifOptions::minQuantizer)
|
||||||
|
.field("maxQuantizer", &AvifOptions::maxQuantizer)
|
||||||
|
.field("minQuantizerAlpha", &AvifOptions::minQuantizerAlpha)
|
||||||
|
.field("maxQuantizerAlpha", &AvifOptions::maxQuantizerAlpha)
|
||||||
|
.field("tileRowsLog2", &AvifOptions::tileRowsLog2)
|
||||||
|
.field("tileColsLog2", &AvifOptions::tileColsLog2)
|
||||||
|
.field("speed", &AvifOptions::speed)
|
||||||
|
.field("subsample", &AvifOptions::subsample);
|
||||||
|
|
||||||
|
function("encode", &encode);
|
||||||
|
}
|
||||||
7
codecs/avif/enc/avif_enc.d.ts
vendored
Normal file
7
codecs/avif/enc/avif_enc.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { EncodeOptions } from '../../../src/codecs/avif/encoder-meta';
|
||||||
|
|
||||||
|
interface AVIFModule extends EmscriptenWasm.Module {
|
||||||
|
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<AVIFModule>;
|
||||||
113
codecs/avif/enc/avif_enc.js
Normal file
113
codecs/avif/enc/avif_enc.js
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
|
||||||
|
var avif_enc = (function() {
|
||||||
|
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||||
|
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||||
|
return (
|
||||||
|
function(avif_enc) {
|
||||||
|
avif_enc = avif_enc || {};
|
||||||
|
|
||||||
|
|
||||||
|
var f;f||(f=typeof avif_enc !== 'undefined' ? avif_enc : {});var aa,ba;f.ready=new Promise(function(a,b){aa=a;ba=b});var ca={},m;for(m in f)f.hasOwnProperty(m)&&(ca[m]=f[m]);var da=!1,r=!1,ea=!1,fa=!1;da="object"===typeof window;r="function"===typeof importScripts;ea="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;fa=!da&&!ea&&!r;var u="",ha,ia,ja,ka;
|
||||||
|
if(ea)u=r?require("path").dirname(u)+"/":__dirname+"/",ha=function(a,b){ja||(ja=require("fs"));ka||(ka=require("path"));a=ka.normalize(a);return ja.readFileSync(a,b?null:"utf8")},ia=function(a){a=ha(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);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",x),f.inspect=function(){return"[Emscripten Module object]"};else if(fa)"undefined"!=
|
||||||
|
typeof read&&(ha=function(a){return read(a)}),ia=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");assert("object"===typeof a);return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(da||r)r?u=self.location.href:document.currentScript&&(u=document.currentScript.src),_scriptDir&&(u=_scriptDir),0!==u.indexOf("blob:")?u=u.substr(0,
|
||||||
|
u.lastIndexOf("/")+1):u="",ha=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},r&&(ia=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var la=f.print||console.log.bind(console),z=f.printErr||console.warn.bind(console);for(m in ca)ca.hasOwnProperty(m)&&(f[m]=ca[m]);ca=null;var ma=0,na;f.wasmBinary&&(na=f.wasmBinary);var noExitRuntime;f.noExitRuntime&&(noExitRuntime=f.noExitRuntime);
|
||||||
|
"object"!==typeof WebAssembly&&x("no native wasm support detected");var A,oa=new WebAssembly.Table({initial:901,maximum:901,element:"anyfunc"}),pa=!1;function assert(a,b){a||x("Assertion failed: "+b)}var qa="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||||
|
function B(a,b,c){var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16<c-b&&a.subarray&&qa)return qa.decode(a.subarray(b,c));for(d="";b<c;){var e=a[b++];if(e&128){var g=a[b++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|g);else{var h=a[b++]&63;e=224==(e&240)?(e&15)<<12|g<<6|h:(e&7)<<18|g<<12|h<<6|a[b++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d}
|
||||||
|
function sa(a,b,c,d){if(!(0<d))return 0;var e=c;d=c+d-1;for(var g=0;g<a.length;++g){var h=a.charCodeAt(g);if(55296<=h&&57343>=h){var k=a.charCodeAt(++g);h=65536+((h&1023)<<10)|k&1023}if(127>=h){if(c>=d)break;b[c++]=h}else{if(2047>=h){if(c+1>=d)break;b[c++]=192|h>>6}else{if(65535>=h){if(c+2>=d)break;b[c++]=224|h>>12}else{if(c+3>=d)break;b[c++]=240|h>>18;b[c++]=128|h>>12&63}b[c++]=128|h>>6&63}b[c++]=128|h&63}}b[c]=0;return c-e}
|
||||||
|
function ta(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}var ua="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function va(a,b){var c=a>>1;for(var d=c+b/2;!(c>=d)&&wa[c];)++c;c<<=1;if(32<c-a&&ua)return ua.decode(C.subarray(a,c));c=0;for(d="";;){var e=E[a+2*c>>1];if(0==e||c==b/2)return d;++c;d+=String.fromCharCode(e)}}
|
||||||
|
function xa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var e=0;e<c;++e)E[b>>1]=a.charCodeAt(e),b+=2;E[b>>1]=0;return b-d}function ya(a){return 2*a.length}function za(a,b){for(var c=0,d="";!(c>=b/4);){var e=F[a+4*c>>2];if(0==e)break;++c;65536<=e?(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023)):d+=String.fromCharCode(e)}return d}
|
||||||
|
function Aa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e<a.length;++e){var g=a.charCodeAt(e);if(55296<=g&&57343>=g){var h=a.charCodeAt(++e);g=65536+((g&1023)<<10)|h&1023}F[b>>2]=g;b+=4;if(b+4>c)break}F[b>>2]=0;return b-d}function Ba(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var G,H,C,E,wa,F,I,Ca,Da;
|
||||||
|
function Ea(a){G=a;f.HEAP8=H=new Int8Array(a);f.HEAP16=E=new Int16Array(a);f.HEAP32=F=new Int32Array(a);f.HEAPU8=C=new Uint8Array(a);f.HEAPU16=wa=new Uint16Array(a);f.HEAPU32=I=new Uint32Array(a);f.HEAPF32=Ca=new Float32Array(a);f.HEAPF64=Da=new Float64Array(a)}var Fa=f.INITIAL_MEMORY||16777216;f.wasmMemory?A=f.wasmMemory:A=new WebAssembly.Memory({initial:Fa/65536,maximum:32768});A&&(G=A.buffer);Fa=G.byteLength;Ea(G);F[219588]=6121392;
|
||||||
|
function Ga(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(f);else{var c=b.qb;"number"===typeof c?void 0===b.Ya?f.dynCall_v(c):f.dynCall_vi(c,b.Ya):c(void 0===b.Ya?null:b.Ya)}}}var Ha=[],Ia=[],Ja=[],Ka=[];function La(){var a=f.preRun.shift();Ha.unshift(a)}var Ma=Math.abs,Na=Math.ceil,Oa=Math.floor,Pa=Math.min,J=0,Qa=null,Ra=null;f.preloadedImages={};f.preloadedAudios={};
|
||||||
|
function x(a){if(f.onAbort)f.onAbort(a);z(a);pa=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Sa(a){var b=K;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ta(){return Sa("data:application/octet-stream;base64,")}var K="avif_enc.wasm";if(!Ta()){var Ua=K;K=f.locateFile?f.locateFile(Ua,u):u+Ua}
|
||||||
|
function Va(){try{if(na)return new Uint8Array(na);if(ia)return ia(K);throw"both async and sync fetching of the wasm failed";}catch(a){x(a)}}function Wa(){return na||!da&&!r||"function"!==typeof fetch||Sa("file://")?new Promise(function(a){a(Va())}):fetch(K,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+K+"'";return a.arrayBuffer()}).catch(function(){return Va()})}var Xa,Ya;Ia.push({qb:function(){Za()}});function $a(){return 0<$a.Va}
|
||||||
|
function ab(a,b){for(var c=0,d=a.length-1;0<=d;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a}function bb(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=ab(a.split("/").filter(function(d){return!!d}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a}
|
||||||
|
function cb(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function db(a){if("/"===a)return"/";var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)}
|
||||||
|
function eb(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=ab(a.split("/").filter(function(d){return!!d}),!b).join("/");return(b?"/":"")+a||"."}var fb=[];function gb(a,b){fb[a]={input:[],output:[],Ua:b};hb(a,ib)}
|
||||||
|
var ib={open:function(a){var b=fb[a.node.rdev];if(!b)throw new L(43);a.tty=b;a.seekable=!1},close:function(a){a.tty.Ua.flush(a.tty)},flush:function(a){a.tty.Ua.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.Ua.jb)throw new L(60);for(var e=0,g=0;g<d;g++){try{var h=a.tty.Ua.jb(a.tty)}catch(k){throw new L(29);}if(void 0===h&&0===e)throw new L(6);if(null===h||void 0===h)break;e++;b[c+g]=h}e&&(a.node.timestamp=Date.now());return e},write:function(a,b,c,d){if(!a.tty||!a.tty.Ua.$a)throw new L(60);
|
||||||
|
try{for(var e=0;e<d;e++)a.tty.Ua.$a(a.tty,b[c+e])}catch(g){throw new L(29);}d&&(a.node.timestamp=Date.now());return e}},jb={jb:function(a){if(!a.input.length){var b=null;if(ea){var c=Buffer.Va?Buffer.Va(256):new Buffer(256),d=0;try{d=ja.readSync(process.stdin.fd,c,0,256,null)}catch(e){if(-1!=e.toString().indexOf("EOF"))d=0;else throw e;}0<d?b=c.slice(0,d).toString("utf-8"):b=null}else"undefined"!=typeof window&&"function"==typeof window.prompt?(b=window.prompt("Input: "),null!==b&&(b+="\n")):"function"==
|
||||||
|
typeof readline&&(b=readline(),null!==b&&(b+="\n"));if(!b)return null;c=Array(ta(b)+1);b=sa(b,c,0,c.length);c.length=b;a.input=c}return a.input.shift()},$a:function(a,b){null===b||10===b?(la(B(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(la(B(a.output,0)),a.output=[])}},kb={$a:function(a,b){null===b||10===b?(z(B(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(z(B(a.output,0)),a.output=[])}},M={Ma:null,
|
||||||
|
Qa:function(){return M.createNode(null,"/",16895,0)},createNode:function(a,b,c,d){if(24576===(c&61440)||4096===(c&61440))throw new L(63);M.Ma||(M.Ma={dir:{node:{Ra:M.Ja.Ra,Oa:M.Ja.Oa,lookup:M.Ja.lookup,Wa:M.Ja.Wa,rename:M.Ja.rename,unlink:M.Ja.unlink,rmdir:M.Ja.rmdir,readdir:M.Ja.readdir,symlink:M.Ja.symlink},stream:{Ta:M.Ka.Ta}},file:{node:{Ra:M.Ja.Ra,Oa:M.Ja.Oa},stream:{Ta:M.Ka.Ta,read:M.Ka.read,write:M.Ka.write,cb:M.Ka.cb,kb:M.Ka.kb,mb:M.Ka.mb}},link:{node:{Ra:M.Ja.Ra,Oa:M.Ja.Oa,readlink:M.Ja.readlink},
|
||||||
|
stream:{}},eb:{node:{Ra:M.Ja.Ra,Oa:M.Ja.Oa},stream:lb}});c=mb(a,b,c,d);16384===(c.mode&61440)?(c.Ja=M.Ma.dir.node,c.Ka=M.Ma.dir.stream,c.Ia={}):32768===(c.mode&61440)?(c.Ja=M.Ma.file.node,c.Ka=M.Ma.file.stream,c.La=0,c.Ia=null):40960===(c.mode&61440)?(c.Ja=M.Ma.link.node,c.Ka=M.Ma.link.stream):8192===(c.mode&61440)&&(c.Ja=M.Ma.eb.node,c.Ka=M.Ma.eb.stream);c.timestamp=Date.now();a&&(a.Ia[b]=c);return c},Hb:function(a){if(a.Ia&&a.Ia.subarray){for(var b=[],c=0;c<a.La;++c)b.push(a.Ia[c]);return b}return a.Ia},
|
||||||
|
Ib:function(a){return a.Ia?a.Ia.subarray?a.Ia.subarray(0,a.La):new Uint8Array(a.Ia):new Uint8Array(0)},fb:function(a,b){var c=a.Ia?a.Ia.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.Ia,a.Ia=new Uint8Array(b),0<a.La&&a.Ia.set(c.subarray(0,a.La),0))},Ab:function(a,b){if(a.La!=b)if(0==b)a.Ia=null,a.La=0;else{if(!a.Ia||a.Ia.subarray){var c=a.Ia;a.Ia=new Uint8Array(b);c&&a.Ia.set(c.subarray(0,Math.min(b,a.La)))}else if(a.Ia||(a.Ia=[]),a.Ia.length>b)a.Ia.length=b;
|
||||||
|
else for(;a.Ia.length<b;)a.Ia.push(0);a.La=b}},Ja:{Ra:function(a){var b={};b.dev=8192===(a.mode&61440)?a.id:1;b.ino=a.id;b.mode=a.mode;b.nlink=1;b.uid=0;b.gid=0;b.rdev=a.rdev;16384===(a.mode&61440)?b.size=4096:32768===(a.mode&61440)?b.size=a.La:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.atime=new Date(a.timestamp);b.mtime=new Date(a.timestamp);b.ctime=new Date(a.timestamp);b.ob=4096;b.blocks=Math.ceil(b.size/b.ob);return b},Oa:function(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&
|
||||||
|
(a.timestamp=b.timestamp);void 0!==b.size&&M.Ab(a,b.size)},lookup:function(){throw nb[44];},Wa:function(a,b,c,d){return M.createNode(a,b,c,d)},rename:function(a,b,c){if(16384===(a.mode&61440)){try{var d=ob(b,c)}catch(g){}if(d)for(var e in d.Ia)throw new L(55);}delete a.parent.Ia[a.name];a.name=c;b.Ia[c]=a;a.parent=b},unlink:function(a,b){delete a.Ia[b]},rmdir:function(a,b){var c=ob(a,b),d;for(d in c.Ia)throw new L(55);delete a.Ia[b]},readdir:function(a){var b=[".",".."],c;for(c in a.Ia)a.Ia.hasOwnProperty(c)&&
|
||||||
|
b.push(c);return b},symlink:function(a,b,c){a=M.createNode(a,b,41471,0);a.link=c;return a},readlink:function(a){if(40960!==(a.mode&61440))throw new L(28);return a.link}},Ka:{read:function(a,b,c,d,e){var g=a.node.Ia;if(e>=a.node.La)return 0;a=Math.min(a.node.La-e,d);if(8<a&&g.subarray)b.set(g.subarray(e,e+a),c);else for(d=0;d<a;d++)b[c+d]=g[e+d];return a},write:function(a,b,c,d,e,g){b.buffer===H.buffer&&(g=!1);if(!d)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.Ia||a.Ia.subarray)){if(g)return a.Ia=
|
||||||
|
b.subarray(c,c+d),a.La=d;if(0===a.La&&0===e)return a.Ia=b.slice(c,c+d),a.La=d;if(e+d<=a.La)return a.Ia.set(b.subarray(c,c+d),e),d}M.fb(a,e+d);if(a.Ia.subarray&&b.subarray)a.Ia.set(b.subarray(c,c+d),e);else for(g=0;g<d;g++)a.Ia[e+g]=b[c+g];a.La=Math.max(a.La,e+d);return d},Ta:function(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.La);if(0>b)throw new L(28);return b},cb:function(a,b,c){M.fb(a.node,b+c);a.node.La=Math.max(a.node.La,b+c)},kb:function(a,b,c,d,e,g){assert(0===
|
||||||
|
b);if(32768!==(a.node.mode&61440))throw new L(43);a=a.node.Ia;if(g&2||a.buffer!==G){if(0<d||d+c<a.length)a.subarray?a=a.subarray(d,d+c):a=Array.prototype.slice.call(a,d,d+c);d=!0;g=16384*Math.ceil(c/16384);for(b=pb(g);c<g;)H[b+c++]=0;c=b;if(!c)throw new L(48);H.set(a,c)}else d=!1,c=a.byteOffset;return{Mb:c,Gb:d}},mb:function(a,b,c,d,e){if(32768!==(a.node.mode&61440))throw new L(43);if(e&2)return 0;M.Ka.write(a,b,0,d,c,!1);return 0}}},qb=null,rb={},sb=[],tb=1,ub=null,vb=!0,wb={},L=null,nb={};
|
||||||
|
function N(a,b){a=eb("/",a);b=b||{};if(!a)return{path:"",node:null};var c={ib:!0,ab:0},d;for(d in c)void 0===b[d]&&(b[d]=c[d]);if(8<b.ab)throw new L(32);a=ab(a.split("/").filter(function(h){return!!h}),!1);var e=qb;c="/";for(d=0;d<a.length;d++){var g=d===a.length-1;if(g&&b.parent)break;e=ob(e,a[d]);c=bb(c+"/"+a[d]);e.Xa&&(!g||g&&b.ib)&&(e=e.Xa.root);if(!g||b.hb)for(g=0;40960===(e.mode&61440);)if(e=xb(c),c=eb(cb(c),e),e=N(c,{ab:b.ab}).node,40<g++)throw new L(32);}return{path:c,node:e}}
|
||||||
|
function yb(a){for(var b;;){if(a===a.parent)return a=a.Qa.lb,b?"/"!==a[a.length-1]?a+"/"+b:a+b:a;b=b?a.name+"/"+b:a.name;a=a.parent}}function zb(a,b){for(var c=0,d=0;d<b.length;d++)c=(c<<5)-c+b.charCodeAt(d)|0;return(a+c>>>0)%ub.length}function ob(a,b){var c;if(c=(c=Ab(a,"x"))?c:a.Ja.lookup?0:2)throw new L(c,a);for(c=ub[zb(a.id,b)];c;c=c.xb){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.Ja.lookup(a,b)}
|
||||||
|
function mb(a,b,c,d){a=new Bb(a,b,c,d);b=zb(a.parent.id,a.name);a.xb=ub[b];return ub[b]=a}var Cb={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function Db(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}function Ab(a,b){if(vb)return 0;if(-1===b.indexOf("r")||a.mode&292){if(-1!==b.indexOf("w")&&!(a.mode&146)||-1!==b.indexOf("x")&&!(a.mode&73))return 2}else return 2;return 0}
|
||||||
|
function Eb(a,b){try{return ob(a,b),20}catch(c){}return Ab(a,"wx")}function Fb(a){var b=4096;for(a=a||0;a<=b;a++)if(!sb[a])return a;throw new L(33);}function Gb(a,b){Hb||(Hb=function(){},Hb.prototype={});var c=new Hb,d;for(d in a)c[d]=a[d];a=c;b=Fb(b);a.fd=b;return sb[b]=a}var lb={open:function(a){a.Ka=rb[a.node.rdev].Ka;a.Ka.open&&a.Ka.open(a)},Ta:function(){throw new L(70);}};function hb(a,b){rb[a]={Ka:b}}
|
||||||
|
function Ib(a,b){var c="/"===b,d=!b;if(c&&qb)throw new L(10);if(!c&&!d){var e=N(b,{ib:!1});b=e.path;e=e.node;if(e.Xa)throw new L(10);if(16384!==(e.mode&61440))throw new L(54);}b={type:a,Lb:{},lb:b,wb:[]};a=a.Qa(b);a.Qa=b;b.root=a;c?qb=a:e&&(e.Xa=b,e.Qa&&e.Qa.wb.push(b))}function Jb(a,b,c){var d=N(a,{parent:!0}).node;a=db(a);if(!a||"."===a||".."===a)throw new L(28);var e=Eb(d,a);if(e)throw new L(e);if(!d.Ja.Wa)throw new L(63);return d.Ja.Wa(d,a,b,c)}function O(a){Jb(a,16895,0)}
|
||||||
|
function Kb(a,b,c){"undefined"===typeof c&&(c=b,b=438);Jb(a,b|8192,c)}function Lb(a,b){if(!eb(a))throw new L(44);var c=N(b,{parent:!0}).node;if(!c)throw new L(44);b=db(b);var d=Eb(c,b);if(d)throw new L(d);if(!c.Ja.symlink)throw new L(63);c.Ja.symlink(c,b,a)}function xb(a){a=N(a).node;if(!a)throw new L(44);if(!a.Ja.readlink)throw new L(28);return eb(yb(a.parent),a.Ja.readlink(a))}
|
||||||
|
function Mb(a,b,c,d){if(""===a)throw new L(44);if("string"===typeof b){var e=Cb[b];if("undefined"===typeof e)throw Error("Unknown file open mode: "+b);b=e}c=b&64?("undefined"===typeof c?438:c)&4095|32768:0;if("object"===typeof a)var g=a;else{a=bb(a);try{g=N(a,{hb:!(b&131072)}).node}catch(k){}}e=!1;if(b&64)if(g){if(b&128)throw new L(20);}else g=Jb(a,c,0),e=!0;if(!g)throw new L(44);8192===(g.mode&61440)&&(b&=-513);if(b&65536&&16384!==(g.mode&61440))throw new L(54);if(!e&&(c=g?40960===(g.mode&61440)?
|
||||||
|
32:16384===(g.mode&61440)&&("r"!==Db(b)||b&512)?31:Ab(g,Db(b)):44))throw new L(c);if(b&512){c=g;var h;"string"===typeof c?h=N(c,{hb:!0}).node:h=c;if(!h.Ja.Oa)throw new L(63);if(16384===(h.mode&61440))throw new L(31);if(32768!==(h.mode&61440))throw new L(28);if(c=Ab(h,"w"))throw new L(c);h.Ja.Oa(h,{size:0,timestamp:Date.now()})}b&=-131713;d=Gb({node:g,path:yb(g),flags:b,seekable:!0,position:0,Ka:g.Ka,Fb:[],error:!1},d);d.Ka.open&&d.Ka.open(d);!f.logReadFiles||b&1||(Nb||(Nb={}),a in Nb||(Nb[a]=1,z("FS.trackingDelegate error on read file: "+
|
||||||
|
a)));try{wb.onOpenFile&&(g=0,1!==(b&2097155)&&(g|=1),0!==(b&2097155)&&(g|=2),wb.onOpenFile(a,g))}catch(k){z("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+k.message)}return d}function Ob(a,b,c){if(null===a.fd)throw new L(8);if(!a.seekable||!a.Ka.Ta)throw new L(70);if(0!=c&&1!=c&&2!=c)throw new L(28);a.position=a.Ka.Ta(a,b,c);a.Fb=[]}
|
||||||
|
function Pb(){L||(L=function(a,b){this.node=b;this.Bb=function(c){this.Sa=c};this.Bb(a);this.message="FS error"},L.prototype=Error(),L.prototype.constructor=L,[44].forEach(function(a){nb[a]=new L(a);nb[a].stack="<generic error, no stack>"}))}var Qb;function Rb(a,b){var c=0;a&&(c|=365);b&&(c|=146);return c}
|
||||||
|
function Sb(a,b,c){a=bb("/dev/"+a);var d=Rb(!!b,!!c);Tb||(Tb=64);var e=Tb++<<8|0;hb(e,{open:function(g){g.seekable=!1},close:function(){c&&c.buffer&&c.buffer.length&&c(10)},read:function(g,h,k,l){for(var n=0,p=0;p<l;p++){try{var t=b()}catch(v){throw new L(29);}if(void 0===t&&0===n)throw new L(6);if(null===t||void 0===t)break;n++;h[k+p]=t}n&&(g.node.timestamp=Date.now());return n},write:function(g,h,k,l){for(var n=0;n<l;n++)try{c(h[k+n])}catch(p){throw new L(29);}l&&(g.node.timestamp=Date.now());return n}});
|
||||||
|
Kb(a,d,e)}var Tb,Q={},Hb,Nb,Ub=void 0;function Vb(){Ub+=4;return F[Ub-4>>2]}function Wb(a){a=sb[a];if(!a)throw new L(8);return a}var Xb={};function Yb(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Zb(a){return this.fromWireType(I[a>>2])}var $b={},R={},ac={};function bc(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 cc(a,b){a=bc(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function dc(a){var b=Error,c=cc(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.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 ec=void 0;function fc(a,b,c){function d(k){k=c(k);if(k.length!==a.length)throw new ec("Mismatched type converter count");for(var l=0;l<a.length;++l)S(a[l],k[l])}a.forEach(function(k){ac[k]=b});var e=Array(b.length),g=[],h=0;b.forEach(function(k,l){R.hasOwnProperty(k)?e[l]=R[k]:(g.push(k),$b.hasOwnProperty(k)||($b[k]=[]),$b[k].push(function(){e[l]=R[k];++h;h===g.length&&d(e)}))});0===g.length&&d(e)}
|
||||||
|
function hc(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 ic=void 0;function T(a){for(var b="";C[a];)b+=ic[C[a++]];return b}var jc=void 0;function U(a){throw new jc(a);}
|
||||||
|
function S(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||U('type "'+d+'" must have a positive integer typeid pointer');if(R.hasOwnProperty(a)){if(c.ub)return;U("Cannot register type '"+d+"' twice")}R[a]=b;delete ac[a];$b.hasOwnProperty(a)&&(b=$b[a],delete $b[a],b.forEach(function(e){e()}))}var kc=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
|
function lc(a){4<a&&0===--V[a].bb&&(V[a]=void 0,kc.push(a))}function mc(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=kc.length?kc.pop():V.length;V[b]={bb:1,value:a};return b}}function nc(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||||
|
function oc(a,b){switch(b){case 2:return function(c){return this.fromWireType(Ca[c>>2])};case 3:return function(c){return this.fromWireType(Da[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function pc(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=cc(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||||
|
function qc(a,b){var c=f;if(void 0===c[a].Na){var d=c[a];c[a]=function(){c[a].Na.hasOwnProperty(arguments.length)||U("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].Na+")!");return c[a].Na[arguments.length].apply(this,arguments)};c[a].Na=[];c[a].Na[d.nb]=d}}
|
||||||
|
function rc(a,b,c){f.hasOwnProperty(a)?((void 0===c||void 0!==f[a].Na&&void 0!==f[a].Na[c])&&U("Cannot register public name '"+a+"' twice"),qc(a,a),f.hasOwnProperty(c)&&U("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),f[a].Na[c]=b):(f[a]=b,void 0!==c&&(f[a].Kb=c))}function sc(a,b){for(var c=[],d=0;d<a;d++)c.push(F[(b>>2)+d]);return c}
|
||||||
|
function tc(a,b){a=T(a);var c=f["dynCall_"+a];for(var d=[],e=1;e<a.length;++e)d.push("a"+e);e="return function dynCall_"+(a+"_"+b)+"("+d.join(", ")+") {\n";e+=" return dynCall(rawFunction"+(d.length?", ":"")+d.join(", ")+");\n";c=(new Function("dynCall","rawFunction",e+"};\n"))(c,b);"function"!==typeof c&&U("unknown function pointer with signature "+a+": "+b);return c}var uc=void 0;function vc(a){a=wc(a);var b=T(a);W(a);return b}
|
||||||
|
function xc(a,b){function c(g){e[g]||R[g]||(ac[g]?ac[g].forEach(c):(d.push(g),e[g]=!0))}var d=[],e={};b.forEach(c);throw new uc(a+": "+d.map(vc).join([", "]));}function yc(a,b,c){switch(b){case 0:return c?function(d){return H[d]}:function(d){return C[d]};case 1:return c?function(d){return E[d>>1]}:function(d){return wa[d>>1]};case 2:return c?function(d){return F[d>>2]}:function(d){return I[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var zc={};
|
||||||
|
function Ac(){return"object"===typeof globalThis?globalThis:Function("return this")()}function Bc(a,b){var c=R[a];void 0===c&&U(b+" has unknown type "+vc(a));return c}var Cc={};function Bb(a,b,c,d){a||(a=this);this.parent=a;this.Qa=a.Qa;this.Xa=null;this.id=tb++;this.name=b;this.mode=c;this.Ja={};this.Ka={};this.rdev=d}
|
||||||
|
Object.defineProperties(Bb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});Pb();ub=Array(4096);Ib(M,"/");O("/tmp");O("/home");O("/home/web_user");
|
||||||
|
(function(){O("/dev");hb(259,{read:function(){return 0},write:function(d,e,g,h){return h}});Kb("/dev/null",259);gb(1280,jb);gb(1536,kb);Kb("/dev/tty",1280);Kb("/dev/tty1",1536);if("object"===typeof crypto&&"function"===typeof crypto.getRandomValues){var a=new Uint8Array(1);var b=function(){crypto.getRandomValues(a);return a[0]}}else if(ea)try{var c=require("crypto");b=function(){return c.randomBytes(1)[0]}}catch(d){}b||(b=function(){x("random_device")});Sb("random",b);Sb("urandom",b);O("/dev/shm");
|
||||||
|
O("/dev/shm/tmp")})();O("/proc");O("/proc/self");O("/proc/self/fd");Ib({Qa:function(){var a=mb("/proc/self","fd",16895,73);a.Ja={lookup:function(b,c){var d=sb[+c];if(!d)throw new L(8);b={parent:null,Qa:{lb:"fake"},Ja:{readlink:function(){return d.path}}};return b.parent=b}};return a}},"/proc/self/fd");ec=f.InternalError=dc("InternalError");for(var Dc=Array(256),Ec=0;256>Ec;++Ec)Dc[Ec]=String.fromCharCode(Ec);ic=Dc;jc=f.BindingError=dc("BindingError");
|
||||||
|
f.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};f.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};uc=f.UnboundTypeError=dc("UnboundTypeError");
|
||||||
|
var Qc={w:function(a){return pb(a)},T:function(){},R:function(a){"uncaught_exception"in $a?$a.Va++:$a.Va=1;throw a;},q:function(a,b,c){Ub=c;try{var d=Wb(a);switch(b){case 0:var e=Vb();return 0>e?-28:Mb(d.path,d.flags,0,e).fd;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=Vb(),d.flags|=e,0;case 12:return e=Vb(),E[e+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return F[Fc()>>2]=28,-1;default:return-28}}catch(g){return"undefined"!==typeof Q&&g instanceof L||x(g),-g.Sa}},
|
||||||
|
K:function(a,b,c){Ub=c;try{var d=Wb(a);switch(b){case 21509:case 21505:return d.tty?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return d.tty?0:-59;case 21519:if(!d.tty)return-59;var e=Vb();return F[e>>2]=0;case 21520:return d.tty?-28:-59;case 21531:a=e=Vb();if(!d.Ka.vb)throw new L(59);return d.Ka.vb(d,b,a);case 21523:return d.tty?0:-59;case 21524:return d.tty?0:-59;default:x("bad ioctl syscall "+b)}}catch(g){return"undefined"!==typeof Q&&g instanceof L||x(g),-g.Sa}},L:function(a,
|
||||||
|
b,c){Ub=c;try{var d=a?B(C,a,void 0):"",e=Vb();return Mb(d,b,e).fd}catch(g){return"undefined"!==typeof Q&&g instanceof L||x(g),-g.Sa}},A:function(a){var b=Xb[a];delete Xb[a];var c=b.yb,d=b.zb,e=b.gb,g=e.map(function(h){return h.tb}).concat(e.map(function(h){return h.Db}));fc([a],g,function(h){var k={};e.forEach(function(l,n){var p=h[n],t=l.rb,v=l.sb,w=h[n+e.length],q=l.Cb,D=l.Eb;k[l.pb]={read:function(y){return p.fromWireType(t(v,y))},write:function(y,P){var ra=[];q(D,y,w.toWireType(ra,P));Yb(ra)}}});
|
||||||
|
return[{name:b.name,fromWireType:function(l){var n={},p;for(p in k)n[p]=k[p].read(l);d(l);return n},toWireType:function(l,n){for(var p in k)if(!(p in n))throw new TypeError('Missing field: "'+p+'"');var t=c();for(p in k)k[p].write(t,n[p]);null!==l&&l.push(d,t);return t},argPackAdvance:8,readValueFromPointer:Zb,Pa:d}]})},N:function(a,b,c,d,e){var g=hc(c);b=T(b);S(a,{name:b,fromWireType:function(h){return!!h},toWireType:function(h,k){return k?d:e},argPackAdvance:8,readValueFromPointer:function(h){if(1===
|
||||||
|
c)var k=H;else if(2===c)k=E;else if(4===c)k=F;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[h>>g])},Pa:null})},M:function(a,b){b=T(b);S(a,{name:b,fromWireType:function(c){var d=V[c].value;lc(c);return d},toWireType:function(c,d){return mc(d)},argPackAdvance:8,readValueFromPointer:Zb,Pa:null})},s:function(a,b,c){c=hc(c);b=T(b);S(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,e){if("number"!==typeof e&&"boolean"!==typeof e)throw new TypeError('Cannot convert "'+
|
||||||
|
nc(e)+'" to '+this.name);return e},argPackAdvance:8,readValueFromPointer:oc(b,c),Pa:null})},y:function(a,b,c,d,e,g){var h=sc(b,c);a=T(a);e=tc(d,e);rc(a,function(){xc("Cannot call "+a+" due to unbound types",h)},b-1);fc([],h,function(k){var l=[k[0],null].concat(k.slice(1)),n=k=a,p=e,t=l.length;2>t&&U("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var v=null!==l[1]&&!1,w=!1,q=1;q<l.length;++q)if(null!==l[q]&&void 0===l[q].Pa){w=!0;break}var D="void"!==l[0].name,
|
||||||
|
y="",P="";for(q=0;q<t-2;++q)y+=(0!==q?", ":"")+"arg"+q,P+=(0!==q?", ":"")+"arg"+q+"Wired";n="return function "+bc(n)+"("+y+") {\nif (arguments.length !== "+(t-2)+") {\nthrowBindingError('function "+n+" called with ' + arguments.length + ' arguments, expected "+(t-2)+" args!');\n}\n";w&&(n+="var destructors = [];\n");var ra=w?"destructors":"null";y="throwBindingError invoker fn runDestructors retType classParam".split(" ");p=[U,p,g,Yb,l[0],l[1]];v&&(n+="var thisWired = classParam.toWireType("+ra+", this);\n");
|
||||||
|
for(q=0;q<t-2;++q)n+="var arg"+q+"Wired = argType"+q+".toWireType("+ra+", arg"+q+"); // "+l[q+2].name+"\n",y.push("argType"+q),p.push(l[q+2]);v&&(P="thisWired"+(0<P.length?", ":"")+P);n+=(D?"var rv = ":"")+"invoker(fn"+(0<P.length?", ":"")+P+");\n";if(w)n+="runDestructors(destructors);\n";else for(q=v?1:2;q<l.length;++q)t=1===q?"thisWired":"arg"+(q-2)+"Wired",null!==l[q].Pa&&(n+=t+"_dtor("+t+"); // "+l[q].name+"\n",y.push(t+"_dtor"),p.push(l[q].Pa));D&&(n+="var ret = retType.fromWireType(rv);\nreturn ret;\n");
|
||||||
|
y.push(n+"}\n");l=pc(y).apply(null,p);q=b-1;if(!f.hasOwnProperty(k))throw new ec("Replacing nonexistant public symbol");void 0!==f[k].Na&&void 0!==q?f[k].Na[q]=l:(f[k]=l,f[k].nb=q);return[]})},i:function(a,b,c,d,e){function g(n){return n}b=T(b);-1===e&&(e=4294967295);var h=hc(c);if(0===d){var k=32-8*c;g=function(n){return n<<k>>>k}}var l=-1!=b.indexOf("unsigned");S(a,{name:b,fromWireType:g,toWireType:function(n,p){if("number"!==typeof p&&"boolean"!==typeof p)throw new TypeError('Cannot convert "'+
|
||||||
|
nc(p)+'" to '+this.name);if(p<d||p>e)throw new TypeError('Passing a number "'+nc(p)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+e+"]!");return l?p>>>0:p|0},argPackAdvance:8,readValueFromPointer:yc(b,h,0!==d),Pa:null})},f:function(a,b,c){function d(g){g>>=2;var h=I;return new e(G,h[g+1],h[g])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=T(c);S(a,{name:c,fromWireType:d,argPackAdvance:8,
|
||||||
|
readValueFromPointer:d},{ub:!0})},u:function(a,b){b=T(b);var c="std::string"===b;S(a,{name:b,fromWireType:function(d){var e=I[d>>2];if(c)for(var g=d+4,h=0;h<=e;++h){var k=d+4+h;if(h==e||0==C[k]){g=g?B(C,g,k-g):"";if(void 0===l)var l=g;else l+=String.fromCharCode(0),l+=g;g=k+1}}else{l=Array(e);for(h=0;h<e;++h)l[h]=String.fromCharCode(C[d+4+h]);l=l.join("")}W(d);return l},toWireType:function(d,e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var g="string"===typeof e;g||e instanceof Uint8Array||e instanceof
|
||||||
|
Uint8ClampedArray||e instanceof Int8Array||U("Cannot pass non-string to std::string");var h=(c&&g?function(){return ta(e)}:function(){return e.length})(),k=pb(4+h+1);I[k>>2]=h;if(c&&g)sa(e,C,k+4,h+1);else if(g)for(g=0;g<h;++g){var l=e.charCodeAt(g);255<l&&(W(k),U("String has UTF-16 code units that do not fit in 8 bits"));C[k+4+g]=l}else for(g=0;g<h;++g)C[k+4+g]=e[g];null!==d&&d.push(W,k);return k},argPackAdvance:8,readValueFromPointer:Zb,Pa:function(d){W(d)}})},n:function(a,b,c){c=T(c);if(2===b){var d=
|
||||||
|
va;var e=xa;var g=ya;var h=function(){return wa};var k=1}else 4===b&&(d=za,e=Aa,g=Ba,h=function(){return I},k=2);S(a,{name:c,fromWireType:function(l){for(var n=I[l>>2],p=h(),t,v=l+4,w=0;w<=n;++w){var q=l+4+w*b;if(w==n||0==p[q>>k])v=d(v,q-v),void 0===t?t=v:(t+=String.fromCharCode(0),t+=v),v=q+b}W(l);return t},toWireType:function(l,n){"string"!==typeof n&&U("Cannot pass non-string to C++ string type "+c);var p=g(n),t=pb(4+p+b);I[t>>2]=p>>k;e(n,t+4,p+b);null!==l&&l.push(W,t);return t},argPackAdvance:8,
|
||||||
|
readValueFromPointer:Zb,Pa:function(l){W(l)}})},G:function(a,b,c,d,e,g){Xb[a]={name:T(b),yb:tc(c,d),zb:tc(e,g),gb:[]}},z:function(a,b,c,d,e,g,h,k,l,n){Xb[a].gb.push({pb:T(b),tb:c,rb:tc(d,e),sb:g,Db:h,Cb:tc(k,l),Eb:n})},O:function(a,b){b=T(b);S(a,{Jb:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},t:lc,S:function(a){if(0===a)return mc(Ac());var b=zc[a];a=void 0===b?T(a):b;return mc(Ac()[a])},x:function(a){4<a&&(V[a].bb+=1)},H:function(a,b,c,d){a||U("Cannot use deleted val. handle = "+
|
||||||
|
a);a=V[a].value;var e=Cc[b];if(!e){e="";for(var g=0;g<b;++g)e+=(0!==g?", ":"")+"arg"+g;var h="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)h+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";e=(new Function("requireRegisteredType","Module","__emval_register",h+("var obj = new constructor("+e+");\nreturn __emval_register(obj);\n}\n")))(Bc,
|
||||||
|
f,mc);Cc[b]=e}return e(a,c,d)},v:function(){x()},P:function(){z("missing function: aom_codec_av1_dx");x(-1)},d:function(a,b){X(a,b||1);throw"longjmp";},I:function(a,b,c){C.copyWithin(a,b,b+c)},j:function(a){a>>>=0;var b=C.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(16777216,a,d);0<d%65536&&(d+=65536-d%65536);a:{try{A.grow(Math.min(2147483648,d)-G.byteLength+65535>>>16);Ea(A.buffer);var e=1;break a}catch(g){}e=void 0}if(e)return!0}return!1},
|
||||||
|
r:function(a){try{var b=Wb(a);if(null===b.fd)throw new L(8);b.Za&&(b.Za=null);try{b.Ka.close&&b.Ka.close(b)}catch(c){throw c;}finally{sb[b.fd]=null}b.fd=null;return 0}catch(c){return"undefined"!==typeof Q&&c instanceof L||x(c),c.Sa}},J:function(a,b,c,d){try{a:{for(var e=Wb(a),g=a=0;g<c;g++){var h=F[b+(8*g+4)>>2],k=e,l=F[b+8*g>>2],n=h,p=void 0,t=H;if(0>n||0>p)throw new L(28);if(null===k.fd)throw new L(8);if(1===(k.flags&2097155))throw new L(8);if(16384===(k.node.mode&61440))throw new L(31);if(!k.Ka.read)throw new L(28);
|
||||||
|
var v="undefined"!==typeof p;if(!v)p=k.position;else if(!k.seekable)throw new L(70);var w=k.Ka.read(k,t,l,n,p);v||(k.position+=w);var q=w;if(0>q){var D=-1;break a}a+=q;if(q<h)break}D=a}F[d>>2]=D;return 0}catch(y){return"undefined"!==typeof Q&&y instanceof L||x(y),y.Sa}},E:function(a,b,c,d,e){try{var g=Wb(a);a=4294967296*c+(b>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;Ob(g,a,d);Ya=[g.position>>>0,(Xa=g.position,1<=+Ma(Xa)?0<Xa?(Pa(+Oa(Xa/4294967296),4294967295)|0)>>>0:~~+Na((Xa-+(~~Xa>>>
|
||||||
|
0))/4294967296)>>>0:0)];F[e>>2]=Ya[0];F[e+4>>2]=Ya[1];g.Za&&0===a&&0===d&&(g.Za=null);return 0}catch(h){return"undefined"!==typeof Q&&h instanceof L||x(h),h.Sa}},p:function(a,b,c,d){try{a:{for(var e=Wb(a),g=a=0;g<c;g++){var h=e,k=F[b+8*g>>2],l=F[b+(8*g+4)>>2],n=void 0,p=H;if(0>l||0>n)throw new L(28);if(null===h.fd)throw new L(8);if(0===(h.flags&2097155))throw new L(8);if(16384===(h.node.mode&61440))throw new L(31);if(!h.Ka.write)throw new L(28);h.seekable&&h.flags&1024&&Ob(h,0,2);var t="undefined"!==
|
||||||
|
typeof n;if(!t)n=h.position;else if(!h.seekable)throw new L(70);var v=h.Ka.write(h,p,k,l,n,void 0);t||(h.position+=v);try{if(h.path&&wb.onWriteToFile)wb.onWriteToFile(h.path)}catch(D){z("FS.trackingDelegate['onWriteToFile']('"+h.path+"') threw an exception: "+D.message)}var w=v;if(0>w){var q=-1;break a}a+=w}q=a}F[d>>2]=q;return 0}catch(D){return"undefined"!==typeof Q&&D instanceof L||x(D),D.Sa}},b:function(){return ma|0},k:Gc,e:Hc,o:Ic,F:Jc,C:Kc,B:Lc,D:Mc,m:Nc,l:Oc,c:Pc,memory:A,g:function(a){a=+a;
|
||||||
|
return 0<=a?+Oa(a+.5):+Na(a-.5)},h:function(a){a=+a;return 0<=a?+Oa(a+.5):+Na(a-.5)},a:function(a){ma=a|0},table:oa,Q:function(a){var b=Date.now()/1E3|0;a&&(F[a>>2]=b);return b}};
|
||||||
|
(function(){function a(e){f.asm=e.exports;J--;f.monitorRunDependencies&&f.monitorRunDependencies(J);0==J&&(null!==Qa&&(clearInterval(Qa),Qa=null),Ra&&(e=Ra,Ra=null,e()))}function b(e){a(e.instance)}function c(e){return Wa().then(function(g){return WebAssembly.instantiate(g,d)}).then(e,function(g){z("failed to asynchronously prepare wasm: "+g);x(g)})}var d={a:Qc};J++;f.monitorRunDependencies&&f.monitorRunDependencies(J);if(f.instantiateWasm)try{return f.instantiateWasm(d,a)}catch(e){return z("Module.instantiateWasm callback failed with error: "+
|
||||||
|
e),!1}(function(){if(na||"function"!==typeof WebAssembly.instantiateStreaming||Ta()||Sa("file://")||"function"!==typeof fetch)return c(b);fetch(K,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,d).then(b,function(g){z("wasm streaming compile failed: "+g);z("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
||||||
|
var Za=f.___wasm_call_ctors=function(){return(Za=f.___wasm_call_ctors=f.asm.U).apply(null,arguments)},pb=f._malloc=function(){return(pb=f._malloc=f.asm.V).apply(null,arguments)},W=f._free=function(){return(W=f._free=f.asm.W).apply(null,arguments)},wc=f.___getTypeName=function(){return(wc=f.___getTypeName=f.asm.X).apply(null,arguments)};f.___embind_register_native_and_builtin_types=function(){return(f.___embind_register_native_and_builtin_types=f.asm.Y).apply(null,arguments)};
|
||||||
|
var Fc=f.___errno_location=function(){return(Fc=f.___errno_location=f.asm.Z).apply(null,arguments)},X=f._setThrew=function(){return(X=f._setThrew=f.asm._).apply(null,arguments)},Y=f.stackSave=function(){return(Y=f.stackSave=f.asm.$).apply(null,arguments)},Z=f.stackRestore=function(){return(Z=f.stackRestore=f.asm.aa).apply(null,arguments)},Rc=f.dynCall_vi=function(){return(Rc=f.dynCall_vi=f.asm.ba).apply(null,arguments)},Sc=f.dynCall_vii=function(){return(Sc=f.dynCall_vii=f.asm.ca).apply(null,arguments)};
|
||||||
|
f.dynCall_viii=function(){return(f.dynCall_viii=f.asm.da).apply(null,arguments)};var Tc=f.dynCall_viiii=function(){return(Tc=f.dynCall_viiii=f.asm.ea).apply(null,arguments)},Uc=f.dynCall_ii=function(){return(Uc=f.dynCall_ii=f.asm.fa).apply(null,arguments)},Vc=f.dynCall_iii=function(){return(Vc=f.dynCall_iii=f.asm.ga).apply(null,arguments)};f.dynCall_iiii=function(){return(f.dynCall_iiii=f.asm.ha).apply(null,arguments)};f.dynCall_iiiii=function(){return(f.dynCall_iiiii=f.asm.ia).apply(null,arguments)};
|
||||||
|
var Wc=f.dynCall_iiiiiiiii=function(){return(Wc=f.dynCall_iiiiiiiii=f.asm.ja).apply(null,arguments)},Xc=f.dynCall_iiiiiiiiii=function(){return(Xc=f.dynCall_iiiiiiiiii=f.asm.ka).apply(null,arguments)},Yc=f.dynCall_iiiijj=function(){return(Yc=f.dynCall_iiiijj=f.asm.la).apply(null,arguments)},Zc=f.dynCall_ij=function(){return(Zc=f.dynCall_ij=f.asm.ma).apply(null,arguments)},$c=f.dynCall_jjij=function(){return($c=f.dynCall_jjij=f.asm.na).apply(null,arguments)};
|
||||||
|
f.dynCall_i=function(){return(f.dynCall_i=f.asm.oa).apply(null,arguments)};f.dynCall_iiiiii=function(){return(f.dynCall_iiiiii=f.asm.pa).apply(null,arguments)};f.dynCall_viiiii=function(){return(f.dynCall_viiiii=f.asm.qa).apply(null,arguments)};f.dynCall_viiiiii=function(){return(f.dynCall_viiiiii=f.asm.ra).apply(null,arguments)};f.dynCall_viiiiiiii=function(){return(f.dynCall_viiiiiiii=f.asm.sa).apply(null,arguments)};f.dynCall_viiiiiii=function(){return(f.dynCall_viiiiiii=f.asm.ta).apply(null,arguments)};
|
||||||
|
f.dynCall_viiiiiiiiiii=function(){return(f.dynCall_viiiiiiiiiii=f.asm.ua).apply(null,arguments)};f.dynCall_jiiiiiiiii=function(){return(f.dynCall_jiiiiiiiii=f.asm.va).apply(null,arguments)};f.dynCall_iiiiiiii=function(){return(f.dynCall_iiiiiiii=f.asm.wa).apply(null,arguments)};f.dynCall_iiiiiii=function(){return(f.dynCall_iiiiiii=f.asm.xa).apply(null,arguments)};f.dynCall_iiiiiiiiiiii=function(){return(f.dynCall_iiiiiiiiiiii=f.asm.ya).apply(null,arguments)};
|
||||||
|
f.dynCall_jiji=function(){return(f.dynCall_jiji=f.asm.za).apply(null,arguments)};f.dynCall_iidiiii=function(){return(f.dynCall_iidiiii=f.asm.Aa).apply(null,arguments)};f.dynCall_viiiiiiiiii=function(){return(f.dynCall_viiiiiiiiii=f.asm.Ba).apply(null,arguments)};f.dynCall_viiiiiiiiiiiii=function(){return(f.dynCall_viiiiiiiiiiiii=f.asm.Ca).apply(null,arguments)};f.dynCall_jiiiiiiii=function(){return(f.dynCall_jiiiiiiii=f.asm.Da).apply(null,arguments)};
|
||||||
|
f.dynCall_ff=function(){return(f.dynCall_ff=f.asm.Ea).apply(null,arguments)};f.dynCall_jiiiiii=function(){return(f.dynCall_jiiiiii=f.asm.Fa).apply(null,arguments)};f.dynCall_jiiiii=function(){return(f.dynCall_jiiiii=f.asm.Ga).apply(null,arguments)};f.dynCall_iiijii=function(){return(f.dynCall_iiijii=f.asm.Ha).apply(null,arguments)};function Hc(a,b,c){var d=Y();try{return Vc(a,b,c)}catch(e){Z(d);if(e!==e+0&&"longjmp"!==e)throw e;X(1,0)}}
|
||||||
|
function Nc(a,b){var c=Y();try{Rc(a,b)}catch(d){Z(c);if(d!==d+0&&"longjmp"!==d)throw d;X(1,0)}}function Pc(a,b,c,d,e){var g=Y();try{Tc(a,b,c,d,e)}catch(h){Z(g);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}function Oc(a,b,c){var d=Y();try{Sc(a,b,c)}catch(e){Z(d);if(e!==e+0&&"longjmp"!==e)throw e;X(1,0)}}function Gc(a,b){var c=Y();try{return Uc(a,b)}catch(d){Z(c);if(d!==d+0&&"longjmp"!==d)throw d;X(1,0)}}
|
||||||
|
function Jc(a,b,c,d,e,g,h,k,l,n){var p=Y();try{return Xc(a,b,c,d,e,g,h,k,l,n)}catch(t){Z(p);if(t!==t+0&&"longjmp"!==t)throw t;X(1,0)}}function Ic(a,b,c,d,e,g,h,k,l){var n=Y();try{return Wc(a,b,c,d,e,g,h,k,l)}catch(p){Z(n);if(p!==p+0&&"longjmp"!==p)throw p;X(1,0)}}function Mc(a,b,c,d,e,g){var h=Y();try{return $c(a,b,c,d,e,g)}catch(k){Z(h);if(k!==k+0&&"longjmp"!==k)throw k;X(1,0)}}
|
||||||
|
function Kc(a,b,c,d,e,g,h,k){var l=Y();try{return Yc(a,b,c,d,e,g,h,k)}catch(n){Z(l);if(n!==n+0&&"longjmp"!==n)throw n;X(1,0)}}function Lc(a,b,c){var d=Y();try{return Zc(a,b,c)}catch(e){Z(d);if(e!==e+0&&"longjmp"!==e)throw e;X(1,0)}}var ad;Ra=function bd(){ad||cd();ad||(Ra=bd)};
|
||||||
|
function cd(){function a(){if(!ad&&(ad=!0,f.calledRun=!0,!pa)){f.noFSInit||Qb||(Qb=!0,Pb(),f.stdin=f.stdin,f.stdout=f.stdout,f.stderr=f.stderr,f.stdin?Sb("stdin",f.stdin):Lb("/dev/tty","/dev/stdin"),f.stdout?Sb("stdout",null,f.stdout):Lb("/dev/tty","/dev/stdout"),f.stderr?Sb("stderr",null,f.stderr):Lb("/dev/tty1","/dev/stderr"),Mb("/dev/stdin","r"),Mb("/dev/stdout","w"),Mb("/dev/stderr","w"));Ga(Ia);vb=!1;Ga(Ja);aa(f);if(f.onRuntimeInitialized)f.onRuntimeInitialized();if(f.postRun)for("function"==
|
||||||
|
typeof f.postRun&&(f.postRun=[f.postRun]);f.postRun.length;){var b=f.postRun.shift();Ka.unshift(b)}Ga(Ka)}}if(!(0<J)){if(f.preRun)for("function"==typeof f.preRun&&(f.preRun=[f.preRun]);f.preRun.length;)La();Ga(Ha);0<J||(f.setStatus?(f.setStatus("Running..."),setTimeout(function(){setTimeout(function(){f.setStatus("")},1);a()},1)):a())}}f.run=cd;if(f.preInit)for("function"==typeof f.preInit&&(f.preInit=[f.preInit]);0<f.preInit.length;)f.preInit.pop()();noExitRuntime=!0;cd();
|
||||||
|
|
||||||
|
|
||||||
|
return avif_enc.ready
|
||||||
|
}
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
if (typeof exports === 'object' && typeof module === 'object')
|
||||||
|
module.exports = avif_enc;
|
||||||
|
else if (typeof define === 'function' && define['amd'])
|
||||||
|
define([], function() { return avif_enc; });
|
||||||
|
else if (typeof exports === 'object')
|
||||||
|
exports["avif_enc"] = avif_enc;
|
||||||
|
|
||||||
BIN
codecs/avif/enc/avif_enc.wasm
Normal file
BIN
codecs/avif/enc/avif_enc.wasm
Normal file
Binary file not shown.
156
codecs/avif/enc/avif_enc_mt.js
Normal file
156
codecs/avif/enc/avif_enc_mt.js
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
|
||||||
|
var avif_enc_mt = (function() {
|
||||||
|
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||||
|
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||||
|
return (
|
||||||
|
function(avif_enc_mt) {
|
||||||
|
avif_enc_mt = avif_enc_mt || {};
|
||||||
|
|
||||||
|
|
||||||
|
function e(){m.buffer!=n&&p(m.buffer);return aa}function u(){m.buffer!=n&&p(m.buffer);return ba}function ca(){m.buffer!=n&&p(m.buffer);return da}function ea(){m.buffer!=n&&p(m.buffer);return fa}function w(){m.buffer!=n&&p(m.buffer);return ha}function x(){m.buffer!=n&&p(m.buffer);return ia}function ja(){m.buffer!=n&&p(m.buffer);return ka}function la(){m.buffer!=n&&p(m.buffer);return ma}var z;z||(z=typeof avif_enc_mt !== 'undefined' ? avif_enc_mt : {});var na,oa;
|
||||||
|
z.ready=new Promise(function(a,b){na=a;oa=b});var pa={},A;for(A in z)z.hasOwnProperty(A)&&(pa[A]=z[A]);var qa=!1,D=!1,E=!1,ra=!1;qa="object"===typeof window;D="function"===typeof importScripts;E="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ra=!qa&&!E&&!D;var G=z.ENVIRONMENT_IS_PTHREAD||!1;G&&(n=z.buffer,sa=z.DYNAMIC_BASE,ta=z.DYNAMICTOP_PTR);var H="";function ua(a){return z.locateFile?z.locateFile(a,H):H+a}var va,wa,I,xa;
|
||||||
|
if(E){H=D?require("path").dirname(H)+"/":__dirname+"/";va=function(a,b){I||(I=require("fs"));xa||(xa=require("path"));a=xa.normalize(a);return I.readFileSync(a,b?null:"utf8")};wa=function(a){a=va(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a};1<process.argv.length&&process.argv[1].replace(/\\/g,"/");process.argv.slice(2);process.on("uncaughtException",function(a){if(!(a instanceof ya))throw a;});process.on("unhandledRejection",J);z.inspect=function(){return"[Emscripten Module object]"};
|
||||||
|
var za;try{za=require("worker_threads")}catch(a){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),a;}global.Worker=za.Worker}else if(ra)"undefined"!=typeof read&&(va=function(a){return read(a)}),wa=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");assert("object"===typeof a);return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,
|
||||||
|
console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(qa||D)D?H=self.location.href:document.currentScript&&(H=document.currentScript.src),_scriptDir&&(H=_scriptDir),0!==H.indexOf("blob:")?H=H.substr(0,H.lastIndexOf("/")+1):H="",E?(va=function(a,b){I||(I=require("fs"));xa||(xa=require("path"));a=xa.normalize(a);return I.readFileSync(a,b?null:"utf8")},wa=function(a){a=va(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a}):(va=function(a){var b=new XMLHttpRequest;
|
||||||
|
b.open("GET",a,!1);b.send(null);return b.responseText},D&&(wa=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}));E&&"undefined"===typeof performance&&(global.performance=require("perf_hooks").performance);var Aa=z.print||console.log.bind(console),K=z.printErr||console.warn.bind(console);for(A in pa)pa.hasOwnProperty(A)&&(z[A]=pa[A]);pa=null;var Ca,Da=0,Ea;z.wasmBinary&&(Ea=z.wasmBinary);var noExitRuntime;
|
||||||
|
z.noExitRuntime&&(noExitRuntime=z.noExitRuntime);"object"!==typeof WebAssembly&&J("no native wasm support detected");var m,Fa=new WebAssembly.Table({initial:913,maximum:913,element:"anyfunc"}),Ga,threadInfoStruct=0,selfThreadId=0,Ha=!1;function assert(a,b){a||J("Assertion failed: "+b)}
|
||||||
|
function Ia(a,b,c){c=b+c;for(var d="";!(b>=c);){var f=a[b++];if(!f)break;if(f&128){var g=a[b++]&63;if(192==(f&224))d+=String.fromCharCode((f&31)<<6|g);else{var h=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|h:(f&7)<<18|g<<12|h<<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 Ja(a,b){return a?Ia(u(),a,b):""}
|
||||||
|
function Ka(a,b,c,d){if(!(0<d))return 0;var f=c;d=c+d-1;for(var g=0;g<a.length;++g){var h=a.charCodeAt(g);if(55296<=h&&57343>=h){var l=a.charCodeAt(++g);h=65536+((h&1023)<<10)|l&1023}if(127>=h){if(c>=d)break;b[c++]=h}else{if(2047>=h){if(c+1>=d)break;b[c++]=192|h>>6}else{if(65535>=h){if(c+2>=d)break;b[c++]=224|h>>12}else{if(c+3>=d)break;b[c++]=240|h>>18;b[c++]=128|h>>12&63}b[c++]=128|h>>6&63}b[c++]=128|h&63}}b[c]=0;return c-f}function La(a,b,c){Ka(a,u(),b,c)}
|
||||||
|
function Ma(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}function Na(a,b){for(var c=0,d="";;){var f=ca()[a+2*c>>1];if(0==f||c==b/2)return d;++c;d+=String.fromCharCode(f)}}function Oa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f){var g=a.charCodeAt(f);ca()[b>>1]=g;b+=2}ca()[b>>1]=0;return b-d}
|
||||||
|
function Pa(a){return 2*a.length}function Qa(a,b){for(var c=0,d="";!(c>=b/4);){var f=w()[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}function Ra(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var h=a.charCodeAt(++f);g=65536+((g&1023)<<10)|h&1023}w()[b>>2]=g;b+=4;if(b+4>c)break}w()[b>>2]=0;return b-d}
|
||||||
|
function Sa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var n,aa,ba,da,fa,ha,ia,ka,ma;function p(a){n=a;z.HEAP8=aa=new Int8Array(a);z.HEAP16=da=new Int16Array(a);z.HEAP32=ha=new Int32Array(a);z.HEAPU8=ba=new Uint8Array(a);z.HEAPU16=fa=new Uint16Array(a);z.HEAPU32=ia=new Uint32Array(a);z.HEAPF32=ka=new Float32Array(a);z.HEAPF64=ma=new Float64Array(a)}var sa=6123632,ta=879824,Ta=z.INITIAL_MEMORY||16777216;
|
||||||
|
if(G)m=z.wasmMemory,n=z.buffer;else if(z.wasmMemory)m=z.wasmMemory;else if(m=new WebAssembly.Memory({initial:Ta/65536,maximum:32768,shared:!0}),!(m.buffer instanceof SharedArrayBuffer))throw K("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),E&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),
|
||||||
|
Error("bad memory");m&&(n=m.buffer);Ta=n.byteLength;p(n);G||(w()[ta>>2]=sa);function Ua(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(z);else{var c=b.Ic;"number"===typeof c?void 0===b.Vb?z.dynCall_v(c):z.dynCall_vi(c,b.Vb):c(void 0===b.Vb?null:b.Vb)}}}var Va=[],Wa=[],Xa=[],Ya=[];function Za(){var a=z.preRun.shift();Va.unshift(a)}var $a=Math.abs,ab=Math.ceil,bb=Math.floor,cb=Math.min,db=0,eb=null,fb=null;z.preloadedImages={};z.preloadedAudios={};
|
||||||
|
function J(a){if(z.onAbort)z.onAbort(a);G&&console.error("Pthread aborting at "+Error().stack);K(a);Ha=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");oa(a);throw a;}function gb(a){var b=hb;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function ib(){return gb("data:application/octet-stream;base64,")}var hb="avif_enc_mt.wasm";ib()||(hb=ua(hb));
|
||||||
|
function jb(){try{if(Ea)return new Uint8Array(Ea);if(wa)return wa(hb);throw"both async and sync fetching of the wasm failed";}catch(a){J(a)}}function kb(){return Ea||!qa&&!D||"function"!==typeof fetch||gb("file://")?new Promise(function(a){a(jb())}):fetch(hb,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+hb+"'";return a.arrayBuffer()}).catch(function(){return jb()})}
|
||||||
|
var lb,mb,ob={576313:function(a,b){setTimeout(function(){nb(a,b)},0)},576391:function(){throw"Canceled!";}};G||Wa.push({Ic:function(){pb()}});var qb=0,rb=0,sb=0;function tb(a,b,c){qb=a|0;sb=b|0;rb=c|0}z.registerPthreadPtr=tb;
|
||||||
|
function ub(a,b){if(0>=a||a>e().length||a&1||0>b)return-28;if(0==b)return 0;2147483647<=b&&(b=Infinity);var c=Atomics.load(w(),220184),d=0;if(c==a&&Atomics.compareExchange(w(),220184,c,0)==c&&(--b,d=1,0>=b))return 1;a=Atomics.notify(w(),a>>2,b);if(0<=a)return a+d;throw"Atomics.notify returned an unexpected value "+a;}z._emscripten_futex_wake=ub;
|
||||||
|
function vb(a){if(G)throw"Internal Error! cleanupThread() can only ever be called from main application thread!";if(!a)throw"Internal Error! Null pthread_ptr in cleanupThread!";w()[a+12>>2]=0;(a=L.Jb[a])&&L.cc(a.worker)}
|
||||||
|
var L={md:1,wd:{Bc:0,Cc:0},Gb:[],Ob:[],Qc:function(){tb(L.Eb,!D,1);wb(L.Eb)},Pc:function(){for(var a=navigator.hardwareConcurrency,b=0;b<a;++b)L.nc();L.Eb=879984;for(b=0;58>b;++b)x()[L.Eb/4+b]=0;w()[L.Eb+12>>2]=L.Eb;a=L.Eb+156;w()[a>>2]=a;for(b=0;128>b;++b)x()[220056+b]=0;Atomics.store(x(),L.Eb+104>>2,880224);Atomics.store(x(),L.Eb+40>>2,L.Eb);Atomics.store(x(),L.Eb+44>>2,42)},Rc:function(){L.receiveObjectTransfer=L.Zc;L.setThreadStatus=L.bd;L.threadCancel=L.hd;L.threadExit=L.jd},Jb:{},dc:[],bd:function(){},
|
||||||
|
Ac:function(){for(;0<L.dc.length;)L.dc.pop()();G&&threadInfoStruct&&xb()},jd:function(a){var b=qb|0;b&&(Atomics.store(x(),b+4>>2,a),Atomics.store(x(),b+0>>2,1),Atomics.store(x(),b+60>>2,1),Atomics.store(x(),b+64>>2,0),L.Ac(),ub(b+0,2147483647),tb(0,0,0),threadInfoStruct=0,G&&postMessage({cmd:"exit"}))},hd:function(){L.Ac();Atomics.store(x(),threadInfoStruct+4>>2,-1);Atomics.store(x(),threadInfoStruct+0>>2,1);ub(threadInfoStruct+0,2147483647);threadInfoStruct=selfThreadId=0;tb(0,0,0);postMessage({cmd:"cancelDone"})},
|
||||||
|
Ed:function(){for(var a in L.Jb){var b=L.Jb[a];b&&b.worker&&L.cc(b.worker)}L.Jb={};for(a=0;a<L.Gb.length;++a){var c=L.Gb[a];c.terminate()}L.Gb=[];for(a=0;a<L.Ob.length;++a)c=L.Ob[a],b=c.Fb,L.hc(b),c.terminate();L.Ob=[]},hc:function(a){if(a){if(a.threadInfoStruct){var b=w()[a.threadInfoStruct+104>>2];w()[a.threadInfoStruct+104>>2]=0;M(b);M(a.threadInfoStruct)}a.threadInfoStruct=0;a.ec&&a.Rb&&M(a.Rb);a.Rb=0;a.worker&&(a.worker.Fb=null)}},cc:function(a){delete L.Jb[a.Fb.Dc];L.Gb.push(a);L.Ob.splice(L.Ob.indexOf(a),
|
||||||
|
1);L.hc(a.Fb);a.Fb=void 0},Zc:function(){},vc:function(a,b){a.onmessage=function(c){var d=c.data,f=d.cmd;a.Fb&&(L.fc=a.Fb.threadInfoStruct);if(d.targetThread&&d.targetThread!=(qb|0)){var g=L.Jb[d.Dd];g?g.worker.postMessage(c.data,d.transferList):console.error('Internal error! Worker sent a message "'+f+'" to target pthread '+d.targetThread+", but that thread no longer exists!")}else if("processQueuedMainThreadWork"===f)yb();else if("spawnThread"===f)zb(c.data);else if("cleanupThread"===f)vb(d.thread);
|
||||||
|
else if("killThread"===f){c=d.thread;if(G)throw"Internal Error! killThread() can only ever be called from main application thread!";if(!c)throw"Internal Error! Null pthread_ptr in killThread!";w()[c+12>>2]=0;c=L.Jb[c];c.worker.terminate();L.hc(c);L.Ob.splice(L.Ob.indexOf(c.worker),1);c.worker.Fb=void 0}else if("cancelThread"===f){c=d.thread;if(G)throw"Internal Error! cancelThread() can only ever be called from main application thread!";if(!c)throw"Internal Error! Null pthread_ptr in cancelThread!";
|
||||||
|
L.Jb[c].worker.postMessage({cmd:"cancel"})}else"loaded"===f?(a.loaded=!0,b&&b(a),a.Wb&&(a.Wb(),delete a.Wb)):"print"===f?Aa("Thread "+d.threadId+": "+d.text):"printErr"===f?K("Thread "+d.threadId+": "+d.text):"alert"===f?alert("Thread "+d.threadId+": "+d.text):"exit"===f?a.Fb&&Atomics.load(x(),a.Fb.Dc+68>>2)&&L.cc(a):"cancelDone"===f?L.cc(a):"objectTransfer"!==f&&("setimmediate"===c.data.target?a.postMessage(c.data):K("worker sent an unknown command "+f));L.fc=void 0};a.onerror=function(c){K("pthread sent an error! "+
|
||||||
|
c.filename+":"+c.lineno+": "+c.message)};E&&(a.on("message",function(c){a.onmessage({data:c})}),a.on("error",function(c){a.onerror(c)}),a.on("exit",function(){console.log("worker exited - TODO: update the worker queue?")}));a.postMessage({cmd:"load",urlOrBlob:z.mainScriptUrlOrBlob||_scriptDir,wasmMemory:m,wasmModule:Ga,DYNAMIC_BASE:sa,DYNAMICTOP_PTR:ta})},nc:function(){var a=ua("avif_enc_mt.worker.js");L.Gb.push(new Worker(a))},Jc:function(){0==L.Gb.length&&(L.nc(),L.vc(L.Gb[0]));return 0<L.Gb.length?
|
||||||
|
L.Gb.pop():null},od:function(a){for(a=performance.now()+a;performance.now()<a;);}};z.establishStackSpace=function(a){N(a)};z.getNoExitRuntime=function(){return noExitRuntime};var Ab;E?Ab=function(){var a=process.hrtime();return 1E3*a[0]+a[1]/1E6}:G?Ab=function(){return performance.now()-z.__performance_now_clock_drift}:"undefined"!==typeof dateNow?Ab=dateNow:Ab=function(){return performance.now()};function Bb(a,b){L.dc.push(function(){Cb(a,b)})}function Db(){return 0<Db.Xb}
|
||||||
|
function Eb(a,b){for(var c=0,d=a.length-1;0<=d;d--){var f=a[d];"."===f?a.splice(d,1):".."===f?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a}function Fb(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=Eb(a.split("/").filter(function(d){return!!d}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a}
|
||||||
|
function Gb(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function Hb(a){if("/"===a)return"/";var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)}
|
||||||
|
function Ib(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=Eb(a.split("/").filter(function(d){return!!d}),!b).join("/");return(b?"/":"")+a||"."}var Jb=[];function Kb(a,b){Jb[a]={input:[],output:[],Sb:b};Lb(a,Mb)}
|
||||||
|
var Mb={open:function(a){var b=Jb[a.node.rdev];if(!b)throw new O(43);a.tty=b;a.seekable=!1},close:function(a){a.tty.Sb.flush(a.tty)},flush:function(a){a.tty.Sb.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.Sb.uc)throw new O(60);for(var f=0,g=0;g<d;g++){try{var h=a.tty.Sb.uc(a.tty)}catch(l){throw new O(29);}if(void 0===h&&0===f)throw new O(6);if(null===h||void 0===h)break;f++;b[c+g]=h}f&&(a.node.timestamp=Date.now());return f},write:function(a,b,c,d){if(!a.tty||!a.tty.Sb.jc)throw new O(60);
|
||||||
|
try{for(var f=0;f<d;f++)a.tty.Sb.jc(a.tty,b[c+f])}catch(g){throw new O(29);}d&&(a.node.timestamp=Date.now());return f}},Nb={uc:function(a){if(!a.input.length){var b=null;if(E){var c=Buffer.Xb?Buffer.Xb(256):new Buffer(256),d=0;try{d=I.readSync(process.stdin.fd,c,0,256,null)}catch(f){if(-1!=f.toString().indexOf("EOF"))d=0;else throw f;}0<d?b=c.slice(0,d).toString("utf-8"):b=null}else"undefined"!=typeof window&&"function"==typeof window.prompt?(b=window.prompt("Input: "),null!==b&&(b+="\n")):"function"==
|
||||||
|
typeof readline&&(b=readline(),null!==b&&(b+="\n"));if(!b)return null;c=Array(Ma(b)+1);b=Ka(b,c,0,c.length);c.length=b;a.input=c}return a.input.shift()},jc:function(a,b){null===b||10===b?(Aa(Ia(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(Aa(Ia(a.output,0)),a.output=[])}},Ob={jc:function(a,b){null===b||10===b?(K(Ia(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(K(Ia(a.output,0)),a.output=[])}},
|
||||||
|
P={Hb:null,Mb:function(){return P.createNode(null,"/",16895,0)},createNode:function(a,b,c,d){if(24576===(c&61440)||4096===(c&61440))throw new O(63);P.Hb||(P.Hb={dir:{node:{Nb:P.Bb.Nb,Kb:P.Bb.Kb,lookup:P.Bb.lookup,ac:P.Bb.ac,rename:P.Bb.rename,unlink:P.Bb.unlink,rmdir:P.Bb.rmdir,readdir:P.Bb.readdir,symlink:P.Bb.symlink},stream:{Qb:P.Cb.Qb}},file:{node:{Nb:P.Bb.Nb,Kb:P.Bb.Kb},stream:{Qb:P.Cb.Qb,read:P.Cb.read,write:P.Cb.write,mc:P.Cb.mc,wc:P.Cb.wc,yc:P.Cb.yc}},link:{node:{Nb:P.Bb.Nb,Kb:P.Bb.Kb,readlink:P.Bb.readlink},
|
||||||
|
stream:{}},oc:{node:{Nb:P.Bb.Nb,Kb:P.Bb.Kb},stream:Pb}});c=Qb(a,b,c,d);16384===(c.mode&61440)?(c.Bb=P.Hb.dir.node,c.Cb=P.Hb.dir.stream,c.Ab={}):32768===(c.mode&61440)?(c.Bb=P.Hb.file.node,c.Cb=P.Hb.file.stream,c.Db=0,c.Ab=null):40960===(c.mode&61440)?(c.Bb=P.Hb.link.node,c.Cb=P.Hb.link.stream):8192===(c.mode&61440)&&(c.Bb=P.Hb.oc.node,c.Cb=P.Hb.oc.stream);c.timestamp=Date.now();a&&(a.Ab[b]=c);return c},sd:function(a){if(a.Ab&&a.Ab.subarray){for(var b=[],c=0;c<a.Db;++c)b.push(a.Ab[c]);return b}return a.Ab},
|
||||||
|
td:function(a){return a.Ab?a.Ab.subarray?a.Ab.subarray(0,a.Db):new Uint8Array(a.Ab):new Uint8Array(0)},qc:function(a,b){var c=a.Ab?a.Ab.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.Ab,a.Ab=new Uint8Array(b),0<a.Db&&a.Ab.set(c.subarray(0,a.Db),0))},$c:function(a,b){if(a.Db!=b)if(0==b)a.Ab=null,a.Db=0;else{if(!a.Ab||a.Ab.subarray){var c=a.Ab;a.Ab=new Uint8Array(b);c&&a.Ab.set(c.subarray(0,Math.min(b,a.Db)))}else if(a.Ab||(a.Ab=[]),a.Ab.length>b)a.Ab.length=b;
|
||||||
|
else for(;a.Ab.length<b;)a.Ab.push(0);a.Db=b}},Bb:{Nb:function(a){var b={};b.dev=8192===(a.mode&61440)?a.id:1;b.ino=a.id;b.mode=a.mode;b.nlink=1;b.uid=0;b.gid=0;b.rdev=a.rdev;16384===(a.mode&61440)?b.size=4096:32768===(a.mode&61440)?b.size=a.Db:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.atime=new Date(a.timestamp);b.mtime=new Date(a.timestamp);b.ctime=new Date(a.timestamp);b.Fc=4096;b.blocks=Math.ceil(b.size/b.Fc);return b},Kb:function(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&
|
||||||
|
(a.timestamp=b.timestamp);void 0!==b.size&&P.$c(a,b.size)},lookup:function(){throw Rb[44];},ac:function(a,b,c,d){return P.createNode(a,b,c,d)},rename:function(a,b,c){if(16384===(a.mode&61440)){try{var d=Sb(b,c)}catch(g){}if(d)for(var f in d.Ab)throw new O(55);}delete a.parent.Ab[a.name];a.name=c;b.Ab[c]=a;a.parent=b},unlink:function(a,b){delete a.Ab[b]},rmdir:function(a,b){var c=Sb(a,b),d;for(d in c.Ab)throw new O(55);delete a.Ab[b]},readdir:function(a){var b=[".",".."],c;for(c in a.Ab)a.Ab.hasOwnProperty(c)&&
|
||||||
|
b.push(c);return b},symlink:function(a,b,c){a=P.createNode(a,b,41471,0);a.link=c;return a},readlink:function(a){if(40960!==(a.mode&61440))throw new O(28);return a.link}},Cb:{read:function(a,b,c,d,f){var g=a.node.Ab;if(f>=a.node.Db)return 0;a=Math.min(a.node.Db-f,d);if(8<a&&g.subarray)b.set(g.subarray(f,f+a),c);else for(d=0;d<a;d++)b[c+d]=g[f+d];return a},write:function(a,b,c,d,f,g){b.buffer===e().buffer&&(g=!1);if(!d)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.Ab||a.Ab.subarray)){if(g)return a.Ab=
|
||||||
|
b.subarray(c,c+d),a.Db=d;if(0===a.Db&&0===f)return a.Ab=b.slice(c,c+d),a.Db=d;if(f+d<=a.Db)return a.Ab.set(b.subarray(c,c+d),f),d}P.qc(a,f+d);if(a.Ab.subarray&&b.subarray)a.Ab.set(b.subarray(c,c+d),f);else for(g=0;g<d;g++)a.Ab[f+g]=b[c+g];a.Db=Math.max(a.Db,f+d);return d},Qb:function(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.Db);if(0>b)throw new O(28);return b},mc:function(a,b,c){P.qc(a.node,b+c);a.node.Db=Math.max(a.node.Db,b+c)},wc:function(a,b,c,d,f,g){assert(0===
|
||||||
|
b);if(32768!==(a.node.mode&61440))throw new O(43);a=a.node.Ab;if(g&2||a.buffer!==n){if(0<d||d+c<a.length)a.subarray?a=a.subarray(d,d+c):a=Array.prototype.slice.call(a,d,d+c);d=!0;g=16384*Math.ceil(c/16384);for(b=R(g);c<g;)e()[b+c++]=0;c=b;if(!c)throw new O(48);e().set(a,c)}else d=!1,c=a.byteOffset;return{Bd:c,nd:d}},yc:function(a,b,c,d,f){if(32768!==(a.node.mode&61440))throw new O(43);if(f&2)return 0;P.Cb.write(a,b,0,d,c,!1);return 0}}},Tb=null,Ub={},Vb=[],Wb=1,Xb=null,Yb=!0,Zb={},O=null,Rb={};
|
||||||
|
function $b(a,b){a=Ib("/",a);b=b||{};if(!a)return{path:"",node:null};var c={tc:!0,kc:0},d;for(d in c)void 0===b[d]&&(b[d]=c[d]);if(8<b.kc)throw new O(32);a=Eb(a.split("/").filter(function(h){return!!h}),!1);var f=Tb;c="/";for(d=0;d<a.length;d++){var g=d===a.length-1;if(g&&b.parent)break;f=Sb(f,a[d]);c=Fb(c+"/"+a[d]);f.bc&&(!g||g&&b.tc)&&(f=f.bc.root);if(!g||b.sc)for(g=0;40960===(f.mode&61440);)if(f=ac(c),c=Ib(Gb(c),f),f=$b(c,{kc:b.kc}).node,40<g++)throw new O(32);}return{path:c,node:f}}
|
||||||
|
function bc(a){for(var b;;){if(a===a.parent)return a=a.Mb.xc,b?"/"!==a[a.length-1]?a+"/"+b:a+b:a;b=b?a.name+"/"+b:a.name;a=a.parent}}function cc(a,b){for(var c=0,d=0;d<b.length;d++)c=(c<<5)-c+b.charCodeAt(d)|0;return(a+c>>>0)%Xb.length}function Sb(a,b){var c;if(c=(c=dc(a,"x"))?c:a.Bb.lookup?0:2)throw new O(c,a);for(c=Xb[cc(a.id,b)];c;c=c.Vc){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.Bb.lookup(a,b)}
|
||||||
|
function Qb(a,b,c,d){a=new ec(a,b,c,d);b=cc(a.parent.id,a.name);a.Vc=Xb[b];return Xb[b]=a}var fc={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function hc(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}function dc(a,b){if(Yb)return 0;if(-1===b.indexOf("r")||a.mode&292){if(-1!==b.indexOf("w")&&!(a.mode&146)||-1!==b.indexOf("x")&&!(a.mode&73))return 2}else return 2;return 0}
|
||||||
|
function ic(a,b){try{return Sb(a,b),20}catch(c){}return dc(a,"wx")}function jc(a){var b=4096;for(a=a||0;a<=b;a++)if(!Vb[a])return a;throw new O(33);}function kc(a,b){lc||(lc=function(){},lc.prototype={});var c=new lc,d;for(d in a)c[d]=a[d];a=c;b=jc(b);a.fd=b;return Vb[b]=a}var Pb={open:function(a){a.Cb=Ub[a.node.rdev].Cb;a.Cb.open&&a.Cb.open(a)},Qb:function(){throw new O(70);}};function Lb(a,b){Ub[a]={Cb:b}}
|
||||||
|
function mc(a,b){var c="/"===b,d=!b;if(c&&Tb)throw new O(10);if(!c&&!d){var f=$b(b,{tc:!1});b=f.path;f=f.node;if(f.bc)throw new O(10);if(16384!==(f.mode&61440))throw new O(54);}b={type:a,zd:{},xc:b,Uc:[]};a=a.Mb(b);a.Mb=b;b.root=a;c?Tb=a:f&&(f.bc=b,f.Mb&&f.Mb.Uc.push(b))}function nc(a,b,c){var d=$b(a,{parent:!0}).node;a=Hb(a);if(!a||"."===a||".."===a)throw new O(28);var f=ic(d,a);if(f)throw new O(f);if(!d.Bb.ac)throw new O(63);return d.Bb.ac(d,a,b,c)}function S(a){nc(a,16895,0)}
|
||||||
|
function oc(a,b,c){"undefined"===typeof c&&(c=b,b=438);nc(a,b|8192,c)}function pc(a,b){if(!Ib(a))throw new O(44);var c=$b(b,{parent:!0}).node;if(!c)throw new O(44);b=Hb(b);var d=ic(c,b);if(d)throw new O(d);if(!c.Bb.symlink)throw new O(63);c.Bb.symlink(c,b,a)}function ac(a){a=$b(a).node;if(!a)throw new O(44);if(!a.Bb.readlink)throw new O(28);return Ib(bc(a.parent),a.Bb.readlink(a))}
|
||||||
|
function qc(a,b,c,d){if(""===a)throw new O(44);if("string"===typeof b){var f=fc[b];if("undefined"===typeof f)throw Error("Unknown file open mode: "+b);b=f}c=b&64?("undefined"===typeof c?438:c)&4095|32768:0;if("object"===typeof a)var g=a;else{a=Fb(a);try{g=$b(a,{sc:!(b&131072)}).node}catch(l){}}f=!1;if(b&64)if(g){if(b&128)throw new O(20);}else g=nc(a,c,0),f=!0;if(!g)throw new O(44);8192===(g.mode&61440)&&(b&=-513);if(b&65536&&16384!==(g.mode&61440))throw new O(54);if(!f&&(c=g?40960===(g.mode&61440)?
|
||||||
|
32:16384===(g.mode&61440)&&("r"!==hc(b)||b&512)?31:dc(g,hc(b)):44))throw new O(c);if(b&512){c=g;var h;"string"===typeof c?h=$b(c,{sc:!0}).node:h=c;if(!h.Bb.Kb)throw new O(63);if(16384===(h.mode&61440))throw new O(31);if(32768!==(h.mode&61440))throw new O(28);if(c=dc(h,"w"))throw new O(c);h.Bb.Kb(h,{size:0,timestamp:Date.now()})}b&=-131713;d=kc({node:g,path:bc(g),flags:b,seekable:!0,position:0,Cb:g.Cb,ld:[],error:!1},d);d.Cb.open&&d.Cb.open(d);!z.logReadFiles||b&1||(rc||(rc={}),a in rc||(rc[a]=1,K("FS.trackingDelegate error on read file: "+
|
||||||
|
a)));try{Zb.onOpenFile&&(g=0,1!==(b&2097155)&&(g|=1),0!==(b&2097155)&&(g|=2),Zb.onOpenFile(a,g))}catch(l){K("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+l.message)}return d}function sc(a,b,c){if(null===a.fd)throw new O(8);if(!a.seekable||!a.Cb.Qb)throw new O(70);if(0!=c&&1!=c&&2!=c)throw new O(28);a.position=a.Cb.Qb(a,b,c);a.ld=[]}
|
||||||
|
function tc(){O||(O=function(a,b){this.node=b;this.ad=function(c){this.Pb=c};this.ad(a);this.message="FS error"},O.prototype=Error(),O.prototype.constructor=O,[44].forEach(function(a){Rb[a]=new O(a);Rb[a].stack="<generic error, no stack>"}))}var uc;function vc(a,b){var c=0;a&&(c|=365);b&&(c|=146);return c}
|
||||||
|
function wc(a,b,c){a=Fb("/dev/"+a);var d=vc(!!b,!!c);xc||(xc=64);var f=xc++<<8|0;Lb(f,{open:function(g){g.seekable=!1},close:function(){c&&c.buffer&&c.buffer.length&&c(10)},read:function(g,h,l,k){for(var q=0,r=0;r<k;r++){try{var t=b()}catch(y){throw new O(29);}if(void 0===t&&0===q)throw new O(6);if(null===t||void 0===t)break;q++;h[l+r]=t}q&&(g.node.timestamp=Date.now());return q},write:function(g,h,l,k){for(var q=0;q<k;q++)try{c(h[l+q])}catch(r){throw new O(29);}k&&(g.node.timestamp=Date.now());return q}});
|
||||||
|
oc(a,d,f)}var xc,yc={},lc,rc,zc=void 0;function Ac(){zc+=4;return w()[zc-4>>2]}function Bc(a){a=Vb[a];if(!a)throw new O(8);return a}
|
||||||
|
function Cc(a,b,c){if(G)return T(1,1,a,b,c);zc=c;try{var d=Bc(a);switch(b){case 0:var f=Ac();return 0>f?-28:qc(d.path,d.flags,0,f).fd;case 1:case 2:return 0;case 3:return d.flags;case 4:return f=Ac(),d.flags|=f,0;case 12:return f=Ac(),ca()[f+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return w()[Dc()>>2]=28,-1;default:return-28}}catch(g){return"undefined"!==typeof yc&&g instanceof O||J(g),-g.Pb}}
|
||||||
|
function Ec(a,b,c){if(G)return T(2,1,a,b,c);zc=c;try{var d=Bc(a);switch(b){case 21509:case 21505:return d.tty?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return d.tty?0:-59;case 21519:if(!d.tty)return-59;var f=Ac();return w()[f>>2]=0;case 21520:return d.tty?-28:-59;case 21531:a=f=Ac();if(!d.Cb.Sc)throw new O(59);return d.Cb.Sc(d,b,a);case 21523:return d.tty?0:-59;case 21524:return d.tty?0:-59;default:J("bad ioctl syscall "+b)}}catch(g){return"undefined"!==typeof yc&&g instanceof
|
||||||
|
O||J(g),-g.Pb}}function Fc(a,b,c){if(G)return T(3,1,a,b,c);zc=c;try{var d=Ja(a),f=Ac();return qc(d,b,f).fd}catch(g){return"undefined"!==typeof yc&&g instanceof O||J(g),-g.Pb}}var Gc={};function Hc(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Ic(a){return this.fromWireType(x()[a>>2])}var Jc={},Kc={},Lc={};function Mc(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 Nc(a,b){a=Mc(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Oc(a){var b=Error,c=Nc(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.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 Pc=void 0;function Qc(a,b,c){function d(l){l=c(l);if(l.length!==a.length)throw new Pc("Mismatched type converter count");for(var k=0;k<a.length;++k)U(a[k],l[k])}a.forEach(function(l){Lc[l]=b});var f=Array(b.length),g=[],h=0;b.forEach(function(l,k){Kc.hasOwnProperty(l)?f[k]=Kc[l]:(g.push(l),Jc.hasOwnProperty(l)||(Jc[l]=[]),Jc[l].push(function(){f[k]=Kc[l];++h;h===g.length&&d(f)}))});0===g.length&&d(f)}
|
||||||
|
function Rc(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 Sc=void 0;function V(a){for(var b="";u()[a];)b+=Sc[u()[a++]];return b}var Tc=void 0;function W(a){throw new Tc(a);}
|
||||||
|
function U(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||W('type "'+d+'" must have a positive integer typeid pointer');if(Kc.hasOwnProperty(a)){if(c.Nc)return;W("Cannot register type '"+d+"' twice")}Kc[a]=b;delete Lc[a];Jc.hasOwnProperty(a)&&(b=Jc[a],delete Jc[a],b.forEach(function(f){f()}))}var Uc=[],X=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
|
function Vc(a){4<a&&0===--X[a].lc&&(X[a]=void 0,Uc.push(a))}function Wc(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Uc.length?Uc.pop():X.length;X[b]={lc:1,value:a};return b}}function Xc(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||||
|
function Yc(a,b){switch(b){case 2:return function(c){return this.fromWireType(ja()[c>>2])};case 3:return function(c){return this.fromWireType(la()[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Zc(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=Nc(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||||
|
function $c(a,b){var c=z;if(void 0===c[a].Ib){var d=c[a];c[a]=function(){c[a].Ib.hasOwnProperty(arguments.length)||W("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].Ib+")!");return c[a].Ib[arguments.length].apply(this,arguments)};c[a].Ib=[];c[a].Ib[d.Ec]=d}}
|
||||||
|
function ad(a,b,c){z.hasOwnProperty(a)?((void 0===c||void 0!==z[a].Ib&&void 0!==z[a].Ib[c])&&W("Cannot register public name '"+a+"' twice"),$c(a,a),z.hasOwnProperty(c)&&W("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),z[a].Ib[c]=b):(z[a]=b,void 0!==c&&(z[a].yd=c))}function bd(a,b){for(var c=[],d=0;d<a;d++)c.push(w()[(b>>2)+d]);return c}
|
||||||
|
function cd(a,b){a=V(a);var c=z["dynCall_"+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&&W("unknown function pointer with signature "+a+": "+b);return c}var dd=void 0;function ed(a){a=fd(a);var b=V(a);M(a);return b}
|
||||||
|
function gd(a,b){function c(g){f[g]||Kc[g]||(Lc[g]?Lc[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new dd(a+": "+d.map(ed).join([", "]));}function hd(a,b,c){switch(b){case 0:return c?function(d){return e()[d]}:function(d){return u()[d]};case 1:return c?function(d){return ca()[d>>1]}:function(d){return ea()[d>>1]};case 2:return c?function(d){return w()[d>>2]}:function(d){return x()[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var id={};
|
||||||
|
function jd(){return"object"===typeof globalThis?globalThis:Function("return this")()}function kd(a,b){var c=Kc[a];void 0===c&&W(b+" has unknown type "+ed(a));return c}var ld={};
|
||||||
|
function md(){E||D||(Ca||(Ca={}),Ca["Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread"]||(Ca["Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread"]=1,K("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")))}
|
||||||
|
function nd(a,b,c){if(0>=a||a>e().length||a&1)return-28;if(D){a=Atomics.wait(w(),a>>2,b,c);if("timed-out"===a)return-73;if("not-equal"===a)return-6;if("ok"===a)return 0;throw"Atomics.wait returned an unexpected value "+a;}var d=Atomics.load(w(),a>>2);if(b!=d)return-6;b=performance.now();c=b+c;Atomics.store(w(),220184,a);for(d=a;a==d;){b=performance.now();if(b>c)return-73;yb();a=Atomics.load(w(),220184)}return 0}
|
||||||
|
function T(a,b){for(var c=arguments.length-2,d=Y(),f=od(8*c),g=f>>3,h=0;h<c;h++)la()[g+h]=arguments[2+h];c=pd(a,c,f,b);N(d);return c}var qd=[],rd=[],sd=[0,"undefined"!==typeof document?document:0,"undefined"!==typeof window?window:0];function td(a){a=2<a?Ja(a):a;return sd[a]||("undefined"!==typeof document?document.querySelector(a):void 0)}
|
||||||
|
function ud(a,b,c){var d=td(a);if(!d)return-4;d.$b&&(w()[d.$b>>2]=b,w()[d.$b+4>>2]=c);if(d.zc||!d.qd)d.zc&&(d=d.zc),a=!1,d.Zb&&d.Zb.Yb&&(a=d.Zb.Yb.getParameter(2978),a=0===a[0]&&0===a[1]&&a[2]===d.width&&a[3]===d.height),d.width=b,d.height=c,a&&d.Zb.Yb.viewport(0,0,b,c);else{if(d.$b){d=w()[d.$b+8>>2];a=a?Ja(a):"";var f=Y(),g=od(12),h=0;if(a){h=Ma(a)+1;var l=R(h);La(a,l,h);h=l}w()[g>>2]=h;w()[g+4>>2]=b;w()[g+8>>2]=c;vd(0,d,657457152,0,h,g);N(f);return 1}return-4}return 0}
|
||||||
|
function wd(a,b,c){return G?T(4,1,a,b,c):ud(a,b,c)}function xd(a){var b=a.getExtension("ANGLE_instanced_arrays");b&&(a.vertexAttribDivisor=function(c,d){b.vertexAttribDivisorANGLE(c,d)},a.drawArraysInstanced=function(c,d,f,g){b.drawArraysInstancedANGLE(c,d,f,g)},a.drawElementsInstanced=function(c,d,f,g,h){b.drawElementsInstancedANGLE(c,d,f,g,h)})}
|
||||||
|
function yd(a){var b=a.getExtension("OES_vertex_array_object");b&&(a.createVertexArray=function(){return b.createVertexArrayOES()},a.deleteVertexArray=function(c){b.deleteVertexArrayOES(c)},a.bindVertexArray=function(c){b.bindVertexArrayOES(c)},a.isVertexArray=function(c){return b.isVertexArrayOES(c)})}function zd(a){var b=a.getExtension("WEBGL_draw_buffers");b&&(a.drawBuffers=function(c,d){b.drawBuffersWEBGL(c,d)})}
|
||||||
|
function Ad(a){a||(a=Bd);if(!a.Oc){a.Oc=!0;var b=a.Yb;xd(b);yd(b);zd(b);b.rd=b.getExtension("EXT_disjoint_timer_query");var c="OES_texture_float OES_texture_half_float OES_standard_derivatives OES_vertex_array_object WEBGL_compressed_texture_s3tc WEBGL_depth_texture OES_element_index_uint EXT_texture_filter_anisotropic EXT_frag_depth WEBGL_draw_buffers ANGLE_instanced_arrays OES_texture_float_linear OES_texture_half_float_linear EXT_blend_minmax EXT_shader_texture_lod EXT_texture_norm16 WEBGL_compressed_texture_pvrtc EXT_color_buffer_half_float WEBGL_color_buffer_float EXT_sRGB WEBGL_compressed_texture_etc1 EXT_disjoint_timer_query WEBGL_compressed_texture_etc WEBGL_compressed_texture_astc EXT_color_buffer_float WEBGL_compressed_texture_s3tc_srgb EXT_disjoint_timer_query_webgl2 WEBKIT_WEBGL_compressed_texture_pvrtc".split(" ");
|
||||||
|
(b.getSupportedExtensions()||[]).forEach(function(d){-1!=c.indexOf(d)&&b.getExtension(d)})}}var Bd,Cd=["default","low-power","high-performance"];function Dd(a){if(G)return T(5,1,a);try{var b=Bc(a);if(null===b.fd)throw new O(8);b.ic&&(b.ic=null);try{b.Cb.close&&b.Cb.close(b)}catch(c){throw c;}finally{Vb[b.fd]=null}b.fd=null;return 0}catch(c){return"undefined"!==typeof yc&&c instanceof O||J(c),c.Pb}}
|
||||||
|
function Ed(a,b,c,d){if(G)return T(6,1,a,b,c,d);try{a:{for(var f=Bc(a),g=a=0;g<c;g++){var h=w()[b+8*g>>2],l=w()[b+(8*g+4)>>2],k=f,q=e(),r=h,t=l,y=void 0;if(0>t||0>y)throw new O(28);if(null===k.fd)throw new O(8);if(1===(k.flags&2097155))throw new O(8);if(16384===(k.node.mode&61440))throw new O(31);if(!k.Cb.read)throw new O(28);var B="undefined"!==typeof y;if(!B)y=k.position;else if(!k.seekable)throw new O(70);var v=k.Cb.read(k,q,r,t,y);B||(k.position+=v);var Q=v;if(0>Q){var F=-1;break a}a+=Q;if(Q<
|
||||||
|
l)break}F=a}w()[d>>2]=F;return 0}catch(C){return"undefined"!==typeof yc&&C instanceof O||J(C),C.Pb}}
|
||||||
|
function Fd(a,b,c,d,f){if(G)return T(7,1,a,b,c,d,f);try{var g=Bc(a);a=4294967296*c+(b>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;sc(g,a,d);mb=[g.position>>>0,(lb=g.position,1<=+$a(lb)?0<lb?(cb(+bb(lb/4294967296),4294967295)|0)>>>0:~~+ab((lb-+(~~lb>>>0))/4294967296)>>>0:0)];w()[f>>2]=mb[0];w()[f+4>>2]=mb[1];g.ic&&0===a&&0===d&&(g.ic=null);return 0}catch(h){return"undefined"!==typeof yc&&h instanceof O||J(h),h.Pb}}
|
||||||
|
function Gd(a,b,c,d){if(G)return T(8,1,a,b,c,d);try{a:{for(var f=Bc(a),g=a=0;g<c;g++){var h=w()[b+8*g>>2],l=w()[b+(8*g+4)>>2],k=f,q=e(),r=h,t=l,y=void 0;if(0>t||0>y)throw new O(28);if(null===k.fd)throw new O(8);if(0===(k.flags&2097155))throw new O(8);if(16384===(k.node.mode&61440))throw new O(31);if(!k.Cb.write)throw new O(28);k.seekable&&k.flags&1024&&sc(k,0,2);var B="undefined"!==typeof y;if(!B)y=k.position;else if(!k.seekable)throw new O(70);var v=k.Cb.write(k,q,r,t,y,void 0);B||(k.position+=v);
|
||||||
|
try{if(k.path&&Zb.onWriteToFile)Zb.onWriteToFile(k.path)}catch(C){K("FS.trackingDelegate['onWriteToFile']('"+k.path+"') threw an exception: "+C.message)}var Q=v;if(0>Q){var F=-1;break a}a+=Q}F=a}w()[d>>2]=F;return 0}catch(C){return"undefined"!==typeof yc&&C instanceof O||J(C),C.Pb}}
|
||||||
|
function zb(a){if(G)throw"Internal Error! spawnThread() can only ever be called from main application thread!";var b=L.Jc();if(void 0!==b.Fb)throw"Internal error!";if(!a.Tb)throw"Internal error, no pthread ptr!";L.Ob.push(b);for(var c=R(512),d=0;128>d;++d)w()[c+4*d>>2]=0;var f=a.Rb+a.Ub;d=L.Jb[a.Tb]={worker:b,Rb:a.Rb,Ub:a.Ub,ec:a.ec,Dc:a.Tb,threadInfoStruct:a.Tb};var g=d.threadInfoStruct>>2;Atomics.store(x(),g,0);Atomics.store(x(),g+1,0);Atomics.store(x(),g+2,0);Atomics.store(x(),g+17,a.detached);
|
||||||
|
Atomics.store(x(),g+26,c);Atomics.store(x(),g+12,0);Atomics.store(x(),g+10,d.threadInfoStruct);Atomics.store(x(),g+11,42);Atomics.store(x(),g+27,a.Ub);Atomics.store(x(),g+21,a.Ub);Atomics.store(x(),g+20,f);Atomics.store(x(),g+29,f);Atomics.store(x(),g+30,a.detached);Atomics.store(x(),g+32,a.Bc);Atomics.store(x(),g+33,a.Cc);c=Hd()+40;Atomics.store(x(),g+44,c);b.Fb=d;var h={cmd:"run",start_routine:a.gd,arg:a.Vb,threadInfoStruct:a.Tb,selfThreadId:a.Tb,parentThreadId:a.Wc,stackBase:a.Rb,stackSize:a.Ub};
|
||||||
|
b.Wb=function(){h.time=performance.now();b.postMessage(h,a.kd)};b.loaded&&(b.Wb(),delete b.Wb)}function Id(){return qb|0}z._pthread_self=Id;
|
||||||
|
function Jd(a,b){if(!a)return K("pthread_join attempted on a null thread pointer!"),71;if(G&&selfThreadId==a)return K("PThread "+a+" is attempting to join to itself!"),16;if(!G&&L.Eb==a)return K("Main thread "+a+" is attempting to join to itself!"),16;if(w()[a+12>>2]!==a)return K("pthread_join attempted on thread "+a+", which does not point to a valid thread, or does not exist anymore!"),71;if(Atomics.load(x(),a+68>>2))return K("Attempted to join thread "+a+", which was already detached!"),28;for(md();;){var c=
|
||||||
|
Atomics.load(x(),a+0>>2);if(1==c)return c=Atomics.load(x(),a+4>>2),b&&(w()[b>>2]=c),Atomics.store(x(),a+68>>2,1),G?postMessage({cmd:"cleanupThread",thread:a}):vb(a),0;if(G&&threadInfoStruct&&!Atomics.load(x(),threadInfoStruct+60>>2)&&2==Atomics.load(x(),threadInfoStruct+0>>2))throw"Canceled!";G||yb();nd(a+0,c,G?100:1)}}G?L.Rc():L.Pc();function ec(a,b,c,d){a||(a=this);this.parent=a;this.Mb=a.Mb;this.bc=null;this.id=Wb++;this.name=b;this.mode=c;this.Bb={};this.Cb={};this.rdev=d}
|
||||||
|
Object.defineProperties(ec.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});tc();Xb=Array(4096);mc(P,"/");S("/tmp");S("/home");S("/home/web_user");
|
||||||
|
(function(){S("/dev");Lb(259,{read:function(){return 0},write:function(d,f,g,h){return h}});oc("/dev/null",259);Kb(1280,Nb);Kb(1536,Ob);oc("/dev/tty",1280);oc("/dev/tty1",1536);if("object"===typeof crypto&&"function"===typeof crypto.getRandomValues){var a=new Uint8Array(1);var b=function(){crypto.getRandomValues(a);return a[0]}}else if(E)try{var c=require("crypto");b=function(){return c.randomBytes(1)[0]}}catch(d){}b||(b=function(){J("random_device")});wc("random",b);wc("urandom",b);S("/dev/shm");
|
||||||
|
S("/dev/shm/tmp")})();S("/proc");S("/proc/self");S("/proc/self/fd");mc({Mb:function(){var a=Qb("/proc/self","fd",16895,73);a.Bb={lookup:function(b,c){var d=Vb[+c];if(!d)throw new O(8);b={parent:null,Mb:{xc:"fake"},Bb:{readlink:function(){return d.path}}};return b.parent=b}};return a}},"/proc/self/fd");Pc=z.InternalError=Oc("InternalError");for(var Kd=Array(256),Ld=0;256>Ld;++Ld)Kd[Ld]=String.fromCharCode(Ld);Sc=Kd;Tc=z.BindingError=Oc("BindingError");
|
||||||
|
z.count_emval_handles=function(){for(var a=0,b=5;b<X.length;++b)void 0!==X[b]&&++a;return a};z.get_first_emval=function(){for(var a=5;a<X.length;++a)if(void 0!==X[a])return X[a];return null};dd=z.UnboundTypeError=Oc("UnboundTypeError");
|
||||||
|
var Md=[null,Cc,Ec,Fc,wd,Dd,Ed,Fd,Gd],Zd={n:function(a,b,c,d){J("Assertion failed: "+Ja(a)+", at: "+[b?Ja(b):"unknown filename",c,d?Ja(d):"unknown function"])},ka:function(a){return R(a)},ma:function(a,b){return Bb(a,b)},ja:function(a){"uncaught_exception"in Db?Db.Xb++:Db.Xb=1;throw a;},B:Cc,aa:Ec,ba:Fc,P:function(a){var b=Gc[a];delete Gc[a];var c=b.Xc,d=b.Yc,f=b.rc,g=f.map(function(h){return h.Mc}).concat(f.map(function(h){return h.dd}));Qc([a],g,function(h){var l={};f.forEach(function(k,q){var r=
|
||||||
|
h[q],t=k.Kc,y=k.Lc,B=h[q+f.length],v=k.cd,Q=k.ed;l[k.Hc]={read:function(F){return r.fromWireType(t(y,F))},write:function(F,C){var Ba=[];v(Q,F,B.toWireType(Ba,C));Hc(Ba)}}});return[{name:b.name,fromWireType:function(k){var q={},r;for(r in l)q[r]=l[r].read(k);d(k);return q},toWireType:function(k,q){for(var r in l)if(!(r in q))throw new TypeError('Missing field: "'+r+'"');var t=c();for(r in l)l[r].write(t,q[r]);null!==k&&k.push(d,t);return t},argPackAdvance:8,readValueFromPointer:Ic,Lb:d}]})},ea:function(a,
|
||||||
|
b,c,d,f){var g=Rc(c);b=V(b);U(a,{name:b,fromWireType:function(h){return!!h},toWireType:function(h,l){return l?d:f},argPackAdvance:8,readValueFromPointer:function(h){if(1===c)var l=e();else if(2===c)l=ca();else if(4===c)l=w();else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(l[h>>g])},Lb:null})},ca:function(a,b){b=V(b);U(a,{name:b,fromWireType:function(c){var d=X[c].value;Vc(c);return d},toWireType:function(c,d){return Wc(d)},argPackAdvance:8,readValueFromPointer:Ic,
|
||||||
|
Lb:null})},D:function(a,b,c){c=Rc(c);b=V(b);U(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Xc(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Yc(b,c),Lb:null})},I:function(a,b,c,d,f,g){var h=bd(b,c);a=V(a);f=cd(d,f);ad(a,function(){gd("Cannot call "+a+" due to unbound types",h)},b-1);Qc([],h,function(l){var k=[l[0],null].concat(l.slice(1)),q=l=a,r=f,t=k.length;2>t&&W("argTypes array size mismatch! Must at least get return value and 'this' types!");
|
||||||
|
for(var y=null!==k[1]&&!1,B=!1,v=1;v<k.length;++v)if(null!==k[v]&&void 0===k[v].Lb){B=!0;break}var Q="void"!==k[0].name,F="",C="";for(v=0;v<t-2;++v)F+=(0!==v?", ":"")+"arg"+v,C+=(0!==v?", ":"")+"arg"+v+"Wired";q="return function "+Mc(q)+"("+F+") {\nif (arguments.length !== "+(t-2)+") {\nthrowBindingError('function "+q+" called with ' + arguments.length + ' arguments, expected "+(t-2)+" args!');\n}\n";B&&(q+="var destructors = [];\n");var Ba=B?"destructors":"null";F="throwBindingError invoker fn runDestructors retType classParam".split(" ");
|
||||||
|
r=[W,r,g,Hc,k[0],k[1]];y&&(q+="var thisWired = classParam.toWireType("+Ba+", this);\n");for(v=0;v<t-2;++v)q+="var arg"+v+"Wired = argType"+v+".toWireType("+Ba+", arg"+v+"); // "+k[v+2].name+"\n",F.push("argType"+v),r.push(k[v+2]);y&&(C="thisWired"+(0<C.length?", ":"")+C);q+=(Q?"var rv = ":"")+"invoker(fn"+(0<C.length?", ":"")+C+");\n";if(B)q+="runDestructors(destructors);\n";else for(v=y?1:2;v<k.length;++v)t=1===v?"thisWired":"arg"+(v-2)+"Wired",null!==k[v].Lb&&(q+=t+"_dtor("+t+"); // "+k[v].name+
|
||||||
|
"\n",F.push(t+"_dtor"),r.push(k[v].Lb));Q&&(q+="var ret = retType.fromWireType(rv);\nreturn ret;\n");F.push(q+"}\n");k=Zc(F).apply(null,r);v=b-1;if(!z.hasOwnProperty(l))throw new Pc("Replacing nonexistant public symbol");void 0!==z[l].Ib&&void 0!==v?z[l].Ib[v]=k:(z[l]=k,z[l].Ec=v);return[]})},o:function(a,b,c,d,f){function g(q){return q}b=V(b);-1===f&&(f=4294967295);var h=Rc(c);if(0===d){var l=32-8*c;g=function(q){return q<<l>>>l}}var k=-1!=b.indexOf("unsigned");U(a,{name:b,fromWireType:g,toWireType:function(q,
|
||||||
|
r){if("number"!==typeof r&&"boolean"!==typeof r)throw new TypeError('Cannot convert "'+Xc(r)+'" to '+this.name);if(r<d||r>f)throw new TypeError('Passing a number "'+Xc(r)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return k?r>>>0:r|0},argPackAdvance:8,readValueFromPointer:hd(b,h,0!==d),Lb:null})},k:function(a,b,c){function d(g){g>>=2;var h=x();return new f(n,h[g+1],h[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,
|
||||||
|
Uint32Array,Float32Array,Float64Array][b];c=V(c);U(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{Nc:!0})},E:function(a,b){b=V(b);var c="std::string"===b;U(a,{name:b,fromWireType:function(d){var f=x()[d>>2];if(c)for(var g=d+4,h=0;h<=f;++h){var l=d+4+h;if(h==f||0==u()[l]){g=Ja(g,l-g);if(void 0===k)var k=g;else k+=String.fromCharCode(0),k+=g;g=l+1}}else{k=Array(f);for(h=0;h<f;++h)k[h]=String.fromCharCode(u()[d+4+h]);k=k.join("")}M(d);return k},toWireType:function(d,f){f instanceof
|
||||||
|
ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||W("Cannot pass non-string to std::string");var h=(c&&g?function(){return Ma(f)}:function(){return f.length})(),l=R(4+h+1);x()[l>>2]=h;if(c&&g)La(f,l+4,h+1);else if(g)for(g=0;g<h;++g){var k=f.charCodeAt(g);255<k&&(M(l),W("String has UTF-16 code units that do not fit in 8 bits"));u()[l+4+g]=k}else for(g=0;g<h;++g)u()[l+4+g]=f[g];null!==d&&d.push(M,l);return l},
|
||||||
|
argPackAdvance:8,readValueFromPointer:Ic,Lb:function(d){M(d)}})},u:function(a,b,c){c=V(c);if(2===b){var d=Na;var f=Oa;var g=Pa;var h=function(){return ea()};var l=1}else 4===b&&(d=Qa,f=Ra,g=Sa,h=function(){return x()},l=2);U(a,{name:c,fromWireType:function(k){for(var q=x()[k>>2],r=h(),t,y=k+4,B=0;B<=q;++B){var v=k+4+B*b;if(B==q||0==r[v>>l])y=d(y,v-y),void 0===t?t=y:(t+=String.fromCharCode(0),t+=y),y=v+b}M(k);return t},toWireType:function(k,q){"string"!==typeof q&&W("Cannot pass non-string to C++ string type "+
|
||||||
|
c);var r=g(q),t=R(4+r+b);x()[t>>2]=r>>l;f(q,t+4,r+b);null!==k&&k.push(M,t);return t},argPackAdvance:8,readValueFromPointer:Ic,Lb:function(k){M(k)}})},Q:function(a,b,c,d,f,g){Gc[a]={name:V(b),Xc:cd(c,d),Yc:cd(f,g),rc:[]}},J:function(a,b,c,d,f,g,h,l,k,q){Gc[a].rc.push({Hc:V(b),Mc:c,Kc:cd(d,f),Lc:g,dd:h,cd:cd(l,k),ed:q})},fa:function(a,b){b=V(b);U(a,{vd:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},W:function(a,b){if(a==b)postMessage({cmd:"processQueuedMainThreadWork"});
|
||||||
|
else if(G)postMessage({targetThread:a,cmd:"processThreadQueue"});else{a=(a=L.Jb[a])&&a.worker;if(!a)return;a.postMessage({cmd:"processThreadQueue"})}return 1},A:Vc,da:function(a){if(0===a)return Wc(jd());var b=id[a];a=void 0===b?V(a):b;return Wc(jd()[a])},H:function(a){4<a&&(X[a].lc+=1)},Y:function(a,b,c,d){a||W("Cannot use deleted val. handle = "+a);a=X[a].value;var f=ld[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var h="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";
|
||||||
|
for(g=0;g<b;++g)h+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",h+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(kd,z,Wc);ld[b]=f}return f(a,c,d)},G:function(){J()},ha:function(){K("missing function: aom_codec_av1_dx");J(-1)},s:function(a,b,c){rd.length=
|
||||||
|
0;var d;for(c>>=2;d=u()[b++];)(d=105>d)&&c&1&&c++,rd.push(d?la()[c++>>1]:w()[c]),++c;return ob[a].apply(null,rd)},_:md,x:function(){},g:nd,h:ub,e:Ab,p:function(){return sb|0},X:function(){return rb|0},i:function(a,b){Z(a,b||1);throw"longjmp";},S:function(a,b,c){u().copyWithin(a,b,b+c)},la:function(){return navigator.hardwareConcurrency},T:function(a,b,c){qd.length=b;c>>=3;for(var d=0;d<b;d++)qd[d]=la()[c+d];return(0>a?ob[-a-1]:Md[a]).apply(null,qd)},q:function(a){a>>>=0;var b=u().length;if(a<=b||
|
||||||
|
2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(16777216,a,d);0<d%65536&&(d+=65536-d%65536);a:{try{m.grow(Math.min(2147483648,d)-n.byteLength+65535>>>16);p(m.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},U:function(a,b,c){return td(a)?ud(a,b,c):wd(a,b,c)},f:function(){},V:function(a,b){var c={};b>>=2;c.alpha=!!w()[b];c.depth=!!w()[b+1];c.stencil=!!w()[b+2];c.antialias=!!w()[b+3];c.premultipliedAlpha=!!w()[b+4];c.preserveDrawingBuffer=
|
||||||
|
!!w()[b+5];var d=w()[b+6];c.powerPreference=Cd[d];c.failIfMajorPerformanceCaveat=!!w()[b+7];c.Tc=w()[b+8];c.xd=w()[b+9];c.pc=w()[b+10];c.Gc=w()[b+11];c.Ad=w()[b+12];c.Cd=w()[b+13];(a=td(a))?c.Gc?c=-1:(a=a.getContext("webgl",c))?(b=R(8),w()[b+4>>2]=qb|0,d={ud:b,attributes:c,version:c.Tc,Yb:a},a.canvas&&(a.canvas.Zb=d),("undefined"===typeof c.pc||c.pc)&&Ad(d),c=b):c=0:c=-4;return c},C:Dd,$:Ed,N:Fd,z:Gd,b:function(){return Da|0},R:function(){L.Qc()},r:Nd,j:Od,v:Pd,O:Qd,L:Rd,K:Sd,M:Td,w:Ud,t:Vd,c:Wd,
|
||||||
|
memory:m||z.wasmMemory,Z:function(a){var b=L.dc.pop();a&&b()},y:Bb,F:function(a,b,c,d){if("undefined"===typeof SharedArrayBuffer)return K("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;if(!a)return K("pthread_create called with a null thread pointer!"),28;var f=[];if(G&&0===f.length)return Xd(687865856,a,b,c,d);var g=0,h=0,l=0,k=0;if(b){var q=w()[b>>2];q+=81920;g=w()[b+8>>2];h=0!==w()[b+12>>2];if(0===w()[b+16>>2]){var r=w()[b+20>>2],t=w()[b+24>>2];l=b+20;
|
||||||
|
k=b+24;var y=L.fc?L.fc:qb|0;if(l||k)if(y)if(w()[y+12>>2]!==y)K("pthread_getschedparam attempted on thread "+y+", which does not point to a valid thread, or does not exist anymore!");else{var B=Atomics.load(x(),y+108+20>>2);y=Atomics.load(x(),y+108+24>>2);l&&(w()[l>>2]=B);k&&(w()[k>>2]=y)}else K("pthread_getschedparam called with a null thread pointer!");l=w()[b+20>>2];k=w()[b+24>>2];w()[b+20>>2]=r;w()[b+24>>2]=t}else l=w()[b+20>>2],k=w()[b+24>>2]}else q=2097152;(b=0==g)?g=Yd(16,q):(g-=q,assert(0<
|
||||||
|
g));r=R(232);for(t=0;58>t;++t)x()[(r>>2)+t]=0;w()[a>>2]=r;w()[r+12>>2]=r;a=r+156;w()[a>>2]=a;c={Rb:g,Ub:q,ec:b,Bc:l,Cc:k,detached:h,gd:c,Tb:r,Wc:qb|0,Vb:d,kd:f};G?(c.pd="spawnThread",postMessage(c,f)):zb(c);return 0},ga:function(a,b){return Jd(a,b)},d:Id,l:function(a){a=+a;return 0<=a?+bb(a+.5):+ab(a-.5)},m:function(a){a=+a;return 0<=a?+bb(a+.5):+ab(a-.5)},a:function(a){Da=a|0},table:Fa,ia:function(a){var b=Date.now()/1E3|0;a&&(w()[a>>2]=b);return b}};
|
||||||
|
(function(){function a(f,g){z.asm=f.exports;Ga=g;if(!G){var h=L.Gb.length;L.Gb.forEach(function(l){L.vc(l,function(){if(!--h&&(db--,z.monitorRunDependencies&&z.monitorRunDependencies(db),0==db&&(null!==eb&&(clearInterval(eb),eb=null),fb))){var k=fb;fb=null;k()}})})}}function b(f){a(f.instance,f.module)}function c(f){return kb().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){K("failed to asynchronously prepare wasm: "+g);J(g)})}var d={a:Zd};G||(assert(!G,"addRunDependency cannot be used in a pthread worker"),
|
||||||
|
db++,z.monitorRunDependencies&&z.monitorRunDependencies(db));if(z.instantiateWasm)try{return z.instantiateWasm(d,a)}catch(f){return K("Module.instantiateWasm callback failed with error: "+f),!1}(function(){if(Ea||"function"!==typeof WebAssembly.instantiateStreaming||ib()||gb("file://")||"function"!==typeof fetch)return c(b);fetch(hb,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){K("wasm streaming compile failed: "+g);K("falling back to ArrayBuffer instantiation");
|
||||||
|
return c(b)})})})();return{}})();var pb=z.___wasm_call_ctors=function(){return(pb=z.___wasm_call_ctors=z.asm.na).apply(null,arguments)},R=z._malloc=function(){return(R=z._malloc=z.asm.oa).apply(null,arguments)},M=z._free=function(){return(M=z._free=z.asm.pa).apply(null,arguments)},fd=z.___getTypeName=function(){return(fd=z.___getTypeName=z.asm.qa).apply(null,arguments)};
|
||||||
|
z.___embind_register_native_and_builtin_types=function(){return(z.___embind_register_native_and_builtin_types=z.asm.ra).apply(null,arguments)};var Hd=z._emscripten_get_global_libc=function(){return(Hd=z._emscripten_get_global_libc=z.asm.sa).apply(null,arguments)},Dc=z.___errno_location=function(){return(Dc=z.___errno_location=z.asm.ta).apply(null,arguments)};z.___em_js__initPthreadsJS=function(){return(z.___em_js__initPthreadsJS=z.asm.ua).apply(null,arguments)};
|
||||||
|
var Z=z._setThrew=function(){return(Z=z._setThrew=z.asm.va).apply(null,arguments)},Y=z.stackSave=function(){return(Y=z.stackSave=z.asm.wa).apply(null,arguments)},N=z.stackRestore=function(){return(N=z.stackRestore=z.asm.xa).apply(null,arguments)},od=z.stackAlloc=function(){return(od=z.stackAlloc=z.asm.ya).apply(null,arguments)},Yd=z._memalign=function(){return(Yd=z._memalign=z.asm.za).apply(null,arguments)};
|
||||||
|
z._emscripten_main_browser_thread_id=function(){return(z._emscripten_main_browser_thread_id=z.asm.Aa).apply(null,arguments)};var xb=z.___pthread_tsd_run_dtors=function(){return(xb=z.___pthread_tsd_run_dtors=z.asm.Ba).apply(null,arguments)},yb=z._emscripten_main_thread_process_queued_calls=function(){return(yb=z._emscripten_main_thread_process_queued_calls=z.asm.Ca).apply(null,arguments)};
|
||||||
|
z._emscripten_current_thread_process_queued_calls=function(){return(z._emscripten_current_thread_process_queued_calls=z.asm.Da).apply(null,arguments)};var wb=z._emscripten_register_main_browser_thread_id=function(){return(wb=z._emscripten_register_main_browser_thread_id=z.asm.Ea).apply(null,arguments)},nb=z._do_emscripten_dispatch_to_thread=function(){return(nb=z._do_emscripten_dispatch_to_thread=z.asm.Fa).apply(null,arguments)};
|
||||||
|
z._emscripten_async_run_in_main_thread=function(){return(z._emscripten_async_run_in_main_thread=z.asm.Ga).apply(null,arguments)};z._emscripten_sync_run_in_main_thread=function(){return(z._emscripten_sync_run_in_main_thread=z.asm.Ha).apply(null,arguments)};z._emscripten_sync_run_in_main_thread_0=function(){return(z._emscripten_sync_run_in_main_thread_0=z.asm.Ia).apply(null,arguments)};
|
||||||
|
z._emscripten_sync_run_in_main_thread_1=function(){return(z._emscripten_sync_run_in_main_thread_1=z.asm.Ja).apply(null,arguments)};z._emscripten_sync_run_in_main_thread_2=function(){return(z._emscripten_sync_run_in_main_thread_2=z.asm.Ka).apply(null,arguments)};z._emscripten_sync_run_in_main_thread_xprintf_varargs=function(){return(z._emscripten_sync_run_in_main_thread_xprintf_varargs=z.asm.La).apply(null,arguments)};
|
||||||
|
z._emscripten_sync_run_in_main_thread_3=function(){return(z._emscripten_sync_run_in_main_thread_3=z.asm.Ma).apply(null,arguments)};var Xd=z._emscripten_sync_run_in_main_thread_4=function(){return(Xd=z._emscripten_sync_run_in_main_thread_4=z.asm.Na).apply(null,arguments)};z._emscripten_sync_run_in_main_thread_5=function(){return(z._emscripten_sync_run_in_main_thread_5=z.asm.Oa).apply(null,arguments)};
|
||||||
|
z._emscripten_sync_run_in_main_thread_6=function(){return(z._emscripten_sync_run_in_main_thread_6=z.asm.Pa).apply(null,arguments)};z._emscripten_sync_run_in_main_thread_7=function(){return(z._emscripten_sync_run_in_main_thread_7=z.asm.Qa).apply(null,arguments)};
|
||||||
|
var pd=z._emscripten_run_in_main_runtime_thread_js=function(){return(pd=z._emscripten_run_in_main_runtime_thread_js=z.asm.Ra).apply(null,arguments)},vd=z.__emscripten_call_on_thread=function(){return(vd=z.__emscripten_call_on_thread=z.asm.Sa).apply(null,arguments)};z._emscripten_tls_init=function(){return(z._emscripten_tls_init=z.asm.Ta).apply(null,arguments)};
|
||||||
|
var Cb=z.dynCall_vi=function(){return(Cb=z.dynCall_vi=z.asm.Ua).apply(null,arguments)},$d=z.dynCall_vii=function(){return($d=z.dynCall_vii=z.asm.Va).apply(null,arguments)};z.dynCall_viii=function(){return(z.dynCall_viii=z.asm.Wa).apply(null,arguments)};
|
||||||
|
var ae=z.dynCall_viiii=function(){return(ae=z.dynCall_viiii=z.asm.Xa).apply(null,arguments)},be=z.dynCall_ii=function(){return(be=z.dynCall_ii=z.asm.Ya).apply(null,arguments)},ce=z.dynCall_iii=function(){return(ce=z.dynCall_iii=z.asm.Za).apply(null,arguments)};z.dynCall_iiii=function(){return(z.dynCall_iiii=z.asm._a).apply(null,arguments)};z.dynCall_iiiii=function(){return(z.dynCall_iiiii=z.asm.$a).apply(null,arguments)};
|
||||||
|
var de=z.dynCall_iiiiiiiii=function(){return(de=z.dynCall_iiiiiiiii=z.asm.ab).apply(null,arguments)},ee=z.dynCall_iiiiiiiiii=function(){return(ee=z.dynCall_iiiiiiiiii=z.asm.bb).apply(null,arguments)},fe=z.dynCall_iiiijj=function(){return(fe=z.dynCall_iiiijj=z.asm.cb).apply(null,arguments)},ge=z.dynCall_ij=function(){return(ge=z.dynCall_ij=z.asm.db).apply(null,arguments)},he=z.dynCall_jjij=function(){return(he=z.dynCall_jjij=z.asm.eb).apply(null,arguments)};
|
||||||
|
z.dynCall_i=function(){return(z.dynCall_i=z.asm.fb).apply(null,arguments)};z.dynCall_iiiiii=function(){return(z.dynCall_iiiiii=z.asm.gb).apply(null,arguments)};z.dynCall_viiiii=function(){return(z.dynCall_viiiii=z.asm.hb).apply(null,arguments)};z.dynCall_v=function(){return(z.dynCall_v=z.asm.ib).apply(null,arguments)};z.dynCall_viiiiii=function(){return(z.dynCall_viiiiii=z.asm.jb).apply(null,arguments)};z.dynCall_viiiiiiii=function(){return(z.dynCall_viiiiiiii=z.asm.kb).apply(null,arguments)};
|
||||||
|
z.dynCall_viiiiiii=function(){return(z.dynCall_viiiiiii=z.asm.lb).apply(null,arguments)};z.dynCall_viiiiiiiiiii=function(){return(z.dynCall_viiiiiiiiiii=z.asm.mb).apply(null,arguments)};z.dynCall_jiiiiiiiii=function(){return(z.dynCall_jiiiiiiiii=z.asm.nb).apply(null,arguments)};z.dynCall_iiiiiiii=function(){return(z.dynCall_iiiiiiii=z.asm.ob).apply(null,arguments)};z.dynCall_iiiiiii=function(){return(z.dynCall_iiiiiii=z.asm.pb).apply(null,arguments)};
|
||||||
|
z.dynCall_iiiiiiiiiiii=function(){return(z.dynCall_iiiiiiiiiiii=z.asm.qb).apply(null,arguments)};z.dynCall_jiji=function(){return(z.dynCall_jiji=z.asm.rb).apply(null,arguments)};z.dynCall_iidiiii=function(){return(z.dynCall_iidiiii=z.asm.sb).apply(null,arguments)};z.dynCall_viiiiiiiiii=function(){return(z.dynCall_viiiiiiiiii=z.asm.tb).apply(null,arguments)};z.dynCall_viiiiiiiiiiiii=function(){return(z.dynCall_viiiiiiiiiiiii=z.asm.ub).apply(null,arguments)};
|
||||||
|
z.dynCall_jiiiiiiii=function(){return(z.dynCall_jiiiiiiii=z.asm.vb).apply(null,arguments)};z.dynCall_ff=function(){return(z.dynCall_ff=z.asm.wb).apply(null,arguments)};z.dynCall_jiiiiii=function(){return(z.dynCall_jiiiiii=z.asm.xb).apply(null,arguments)};z.dynCall_jiiiii=function(){return(z.dynCall_jiiiii=z.asm.yb).apply(null,arguments)};z.dynCall_iiijii=function(){return(z.dynCall_iiijii=z.asm.zb).apply(null,arguments)};
|
||||||
|
function Od(a,b,c){var d=Y();try{return ce(a,b,c)}catch(f){N(d);if(f!==f+0&&"longjmp"!==f)throw f;Z(1,0)}}function Ud(a,b){var c=Y();try{Cb(a,b)}catch(d){N(c);if(d!==d+0&&"longjmp"!==d)throw d;Z(1,0)}}function Wd(a,b,c,d,f){var g=Y();try{ae(a,b,c,d,f)}catch(h){N(g);if(h!==h+0&&"longjmp"!==h)throw h;Z(1,0)}}function Vd(a,b,c){var d=Y();try{$d(a,b,c)}catch(f){N(d);if(f!==f+0&&"longjmp"!==f)throw f;Z(1,0)}}
|
||||||
|
function Nd(a,b){var c=Y();try{return be(a,b)}catch(d){N(c);if(d!==d+0&&"longjmp"!==d)throw d;Z(1,0)}}function Qd(a,b,c,d,f,g,h,l,k,q){var r=Y();try{return ee(a,b,c,d,f,g,h,l,k,q)}catch(t){N(r);if(t!==t+0&&"longjmp"!==t)throw t;Z(1,0)}}function Pd(a,b,c,d,f,g,h,l,k){var q=Y();try{return de(a,b,c,d,f,g,h,l,k)}catch(r){N(q);if(r!==r+0&&"longjmp"!==r)throw r;Z(1,0)}}function Td(a,b,c,d,f,g){var h=Y();try{return he(a,b,c,d,f,g)}catch(l){N(h);if(l!==l+0&&"longjmp"!==l)throw l;Z(1,0)}}
|
||||||
|
function Rd(a,b,c,d,f,g,h,l){var k=Y();try{return fe(a,b,c,d,f,g,h,l)}catch(q){N(k);if(q!==q+0&&"longjmp"!==q)throw q;Z(1,0)}}function Sd(a,b,c){var d=Y();try{return ge(a,b,c)}catch(f){N(d);if(f!==f+0&&"longjmp"!==f)throw f;Z(1,0)}}z.PThread=L;z.PThread=L;z._pthread_self=Id;z.wasmMemory=m;z.ExitStatus=ya;var ie;function ya(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}fb=function je(){ie||ke();ie||(fb=je)};
|
||||||
|
function ke(){function a(){if(!ie&&(ie=!0,z.calledRun=!0,!Ha)){z.noFSInit||uc||(uc=!0,tc(),z.stdin=z.stdin,z.stdout=z.stdout,z.stderr=z.stderr,z.stdin?wc("stdin",z.stdin):pc("/dev/tty","/dev/stdin"),z.stdout?wc("stdout",null,z.stdout):pc("/dev/tty","/dev/stdout"),z.stderr?wc("stderr",null,z.stderr):pc("/dev/tty1","/dev/stderr"),qc("/dev/stdin","r"),qc("/dev/stdout","w"),qc("/dev/stderr","w"));Ua(Wa);G||(Yb=!1,Ua(Xa));na(z);if(z.onRuntimeInitialized)z.onRuntimeInitialized();if(!G){if(z.postRun)for("function"==
|
||||||
|
typeof z.postRun&&(z.postRun=[z.postRun]);z.postRun.length;){var b=z.postRun.shift();Ya.unshift(b)}Ua(Ya)}}}if(!(0<db)){if(!G){if(z.preRun)for("function"==typeof z.preRun&&(z.preRun=[z.preRun]);z.preRun.length;)Za();Ua(Va)}0<db||(z.setStatus?(z.setStatus("Running..."),setTimeout(function(){setTimeout(function(){z.setStatus("")},1);a()},1)):a())}}z.run=ke;if(z.preInit)for("function"==typeof z.preInit&&(z.preInit=[z.preInit]);0<z.preInit.length;)z.preInit.pop()();G||(noExitRuntime=!0);
|
||||||
|
G?(z.___embind_register_native_and_builtin_types(),na(z)):ke();
|
||||||
|
|
||||||
|
|
||||||
|
return avif_enc_mt.ready
|
||||||
|
}
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
if (typeof exports === 'object' && typeof module === 'object')
|
||||||
|
module.exports = avif_enc_mt;
|
||||||
|
else if (typeof define === 'function' && define['amd'])
|
||||||
|
define([], function() { return avif_enc_mt; });
|
||||||
|
else if (typeof exports === 'object')
|
||||||
|
exports["avif_enc_mt"] = avif_enc_mt;
|
||||||
|
|
||||||
BIN
codecs/avif/enc/avif_enc_mt.wasm
Normal file
BIN
codecs/avif/enc/avif_enc_mt.wasm
Normal file
Binary file not shown.
1
codecs/avif/enc/avif_enc_mt.worker.js
Normal file
1
codecs/avif/enc/avif_enc_mt.worker.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
var threadInfoStruct=0;var selfThreadId=0;var parentThreadId=0;var Module={};function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:selfThreadId})}var err=threadPrintErr;this.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);Module["wasmModule"]=null;receiveInstance(instance);return instance.exports};this.onmessage=function(e){try{if(e.data.cmd==="load"){Module["DYNAMIC_BASE"]=e.data.DYNAMIC_BASE;Module["DYNAMICTOP_PTR"]=e.data.DYNAMICTOP_PTR;Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}avif_enc_mt(Module).then(function(instance){Module=instance;postMessage({"cmd":"loaded"})})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;threadInfoStruct=e.data.threadInfoStruct;Module["registerPthreadPtr"](threadInfoStruct,/*isMainBrowserThread=*/0,/*isMainRuntimeThread=*/0);selfThreadId=e.data.selfThreadId;parentThreadId=e.data.parentThreadId;var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["_emscripten_tls_init"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].setThreadStatus(Module["_pthread_self"](),1);/*EM_THREAD_STATUS_RUNNING*/try{var result=Module["dynCall_ii"](e.data.start_routine,e.data.arg);if(!Module["getNoExitRuntime"]())Module["PThread"].threadExit(result)}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){Atomics.store(Module["HEAPU32"],(threadInfoStruct+4)>>/*C_STRUCTS.pthread.threadExitCode*/2,(ex instanceof Module["ExitStatus"])?ex.status:-2);/*A custom entry specific to Emscripten denoting that the thread crashed.*/Atomics.store(Module["HEAPU32"],(threadInfoStruct+0)>>/*C_STRUCTS.pthread.threadStatus*/2,1);Module["_emscripten_futex_wake"](threadInfoStruct+0,/*C_STRUCTS.pthread.threadStatus*/2147483647);if(!(ex instanceof Module["ExitStatus"]))throw ex}}}else if(e.data.cmd==="cancel"){if(threadInfoStruct){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(threadInfoStruct){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex.stack)err(ex.stack);throw ex}};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){self={location:{href:__filename}};var onmessage=this.onmessage;var nodeWorkerThreads=require("worker_threads");global.Worker=nodeWorkerThreads.Worker;var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");var nodeRead=function(filename){return nodeFS.readFileSync(filename,"utf8")};function globalEval(x){global.require=require;global.Module=Module;eval.call(null,x)}importScripts=function(f){globalEval(nodeRead(f))};postMessage=function(msg){parentPort.postMessage(msg)};if(typeof performance==="undefined"){performance={now:function(){return Date.now()}}}}
|
||||||
78
codecs/avif/helper.Makefile
Normal file
78
codecs/avif/helper.Makefile
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
# This is a helper Makefile for building LibAVIF + LibAOM with given params.
|
||||||
|
#
|
||||||
|
# Params that must be supplied by the caller:
|
||||||
|
# $(CODEC_DIR)
|
||||||
|
# $(LIBAOM_DIR)
|
||||||
|
# $(OUT_JS)
|
||||||
|
# $(OUT_CPP)
|
||||||
|
# $(LIBAOM_FLAGS)
|
||||||
|
# $(CODEC_PACKAGE)
|
||||||
|
# $(LIBAOM_PACKAGE)
|
||||||
|
|
||||||
|
CODEC_BUILD_DIR := $(CODEC_DIR)/build
|
||||||
|
CODEC_OUT := $(CODEC_BUILD_DIR)/libavif.a
|
||||||
|
|
||||||
|
LIBAOM_BUILD_DIR := $(CODEC_DIR)/ext/aom/build.libavif
|
||||||
|
LIBAOM_OUT := $(LIBAOM_BUILD_DIR)/libaom.a
|
||||||
|
|
||||||
|
OUT_WASM = $(OUT_JS:.js=.wasm)
|
||||||
|
OUT_WORKER=$(OUT_JS:.js=.worker.js)
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all: $(OUT_JS)
|
||||||
|
|
||||||
|
$(OUT_JS): $(OUT_CPP) $(LIBAOM_OUT) $(CODEC_OUT)
|
||||||
|
# ERROR_ON_UNDEFINED_SYMBOLS=0 is needed to separate the encoder and decoder
|
||||||
|
$(CXX) \
|
||||||
|
-I $(CODEC_DIR)/include \
|
||||||
|
$(CXXFLAGS) \
|
||||||
|
$(LDFLAGS) \
|
||||||
|
$(OUT_FLAGS) \
|
||||||
|
--bind \
|
||||||
|
--closure 1 \
|
||||||
|
-s ALLOW_MEMORY_GROWTH=1 \
|
||||||
|
-s MODULARIZE=1 \
|
||||||
|
-s ERROR_ON_UNDEFINED_SYMBOLS=0 \
|
||||||
|
-s 'EXPORT_NAME="$(basename $(@F))"' \
|
||||||
|
-o $@ \
|
||||||
|
$+
|
||||||
|
|
||||||
|
$(CODEC_OUT): $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_OUT)
|
||||||
|
emcmake cmake \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DBUILD_SHARED_LIBS=0 \
|
||||||
|
-DAVIF_CODEC_AOM=1 \
|
||||||
|
-DAVIF_LOCAL_AOM=1 \
|
||||||
|
-DAVIF_CODEC_INCLUDES=$(abspath $(LIBAOM_DIR)) \
|
||||||
|
-B $(CODEC_BUILD_DIR) \
|
||||||
|
$(CODEC_DIR) && \
|
||||||
|
$(MAKE) -C $(CODEC_BUILD_DIR)
|
||||||
|
|
||||||
|
$(LIBAOM_OUT): $(LIBAOM_DIR)/CMakeLists.txt
|
||||||
|
emcmake cmake \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DENABLE_CCACHE=0 \
|
||||||
|
-DAOM_TARGET_CPU=generic \
|
||||||
|
-DENABLE_DOCS=0 \
|
||||||
|
-DENABLE_TESTS=0 \
|
||||||
|
-DENABLE_EXAMPLES=0 \
|
||||||
|
-DENABLE_TOOLS=0 \
|
||||||
|
-DCONFIG_ACCOUNTING=1 \
|
||||||
|
-DCONFIG_INSPECTION=0 \
|
||||||
|
-DCONFIG_RUNTIME_CPU_DETECT=0 \
|
||||||
|
-DCONFIG_WEBM_IO=0 \
|
||||||
|
-DCONFIG_AV1_HIGHBITDEPTH=0 \
|
||||||
|
$(LIBAOM_FLAGS) \
|
||||||
|
-B $(LIBAOM_BUILD_DIR) \
|
||||||
|
$(LIBAOM_DIR) && \
|
||||||
|
$(MAKE) -C $(LIBAOM_BUILD_DIR)
|
||||||
|
|
||||||
|
$(CODEC_DIR)/CMakeLists.txt: $(CODEC_PACKAGE)
|
||||||
|
mkdir -p $(@D)
|
||||||
|
tar xzm --strip 1 -C $(@D) -f $(CODEC_PACKAGE)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(OUT_JS) $(OUT_WASM) $(OUT_WORKER)
|
||||||
|
$(MAKE) -C $(CODEC_BUILD_DIR) clean
|
||||||
|
$(MAKE) -C $(LIBAOM_BUILD_DIR) clean
|
||||||
6
codecs/avif/package.json
Normal file
6
codecs/avif/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "avif",
|
||||||
|
"scripts": {
|
||||||
|
"build": "../build-cpp.sh"
|
||||||
|
}
|
||||||
|
}
|
||||||
4
codecs/build-rust-nightly.sh
Normal file
4
codecs/build-rust-nightly.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
set -e
|
||||||
|
|
||||||
|
docker build -t squoosh-rust-nightly --build-arg RUST_IMG=rustlang/rust:nightly - < ../rust.Dockerfile
|
||||||
|
docker run --rm -v $PWD:/src squoosh-rust-nightly "$@"
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
FROM emscripten/emsdk:1.39.19
|
FROM emscripten/emsdk:1.40.0
|
||||||
RUN apt-get update && apt-get install -qqy autoconf libtool pkg-config
|
RUN apt-get update && apt-get install -qqy autoconf libtool pkg-config
|
||||||
ENV CFLAGS "-Os -flto"
|
ENV CFLAGS "-Os -flto"
|
||||||
ENV CXXFLAGS "${CFLAGS} -std=c++17"
|
ENV CXXFLAGS "${CFLAGS} -std=c++17"
|
||||||
ENV LDFLAGS "${CFLAGS}"
|
ENV LDFLAGS "${CFLAGS} -s PTHREAD_POOL_SIZE=navigator.hardwareConcurrency"
|
||||||
# Build and cache standard libraries with these flags
|
# Build and cache standard libraries with these flags
|
||||||
RUN emcc ${CXXFLAGS} --bind -xc++ /dev/null -o /dev/null
|
RUN emcc ${CXXFLAGS} --bind -xc++ /dev/null -o /dev/null
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|||||||
201
codecs/hqx/LICENSE.codec.md
Normal file
201
codecs/hqx/LICENSE.codec.md
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
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.
|
||||||
5
codecs/hqx/README.md
Normal file
5
codecs/hqx/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# HQX
|
||||||
|
|
||||||
|
- Source: <https://github.com/CryZe/wasmboy-rs>
|
||||||
|
- Version: v0.1.2
|
||||||
|
- License: Apache 2.0
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "============================================="
|
|
||||||
echo "Compiling wasm"
|
|
||||||
echo "============================================="
|
|
||||||
(
|
|
||||||
wasm-pack build -- --verbose --locked
|
|
||||||
rm pkg/.gitignore
|
|
||||||
)
|
|
||||||
echo "============================================="
|
|
||||||
echo "Compiling wasm done"
|
|
||||||
echo "============================================="
|
|
||||||
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo "Did you update your docker image?"
|
|
||||||
echo "Run \`docker pull ubuntu\`"
|
|
||||||
echo "Run \`docker pull rust\`"
|
|
||||||
echo "Run \`docker build -t squoosh-hqx .\`"
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
||||||
641
codecs/imagequant/LICENSE.codec.md
Normal file
641
codecs/imagequant/LICENSE.codec.md
Normal file
@@ -0,0 +1,641 @@
|
|||||||
|
|
||||||
|
libimagequant is derived from code by Jef Poskanzer and Greg Roelofs
|
||||||
|
licensed under pngquant's original license (at the end of this file),
|
||||||
|
and contains extensive changes and additions by Kornel Lesiński
|
||||||
|
licensed under GPL v3 or later.
|
||||||
|
|
||||||
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
libimagequant © 2009-2018 by Kornel Lesiński.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
© 1989, 1991 by Jef Poskanzer.
|
||||||
|
© 1997, 2000, 2002 by Greg Roelofs.
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and distribute this software and its
|
||||||
|
documentation for any purpose and without fee is hereby granted, provided
|
||||||
|
that the above copyright notice appear in all copies and that both that
|
||||||
|
copyright notice and this permission notice appear in supporting
|
||||||
|
documentation. This software is provided "as is" without express or
|
||||||
|
implied warranty.
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
- Source: <https://github.com/ImageOptim/libimagequant>
|
- Source: <https://github.com/ImageOptim/libimagequant>
|
||||||
- Version: v2.12.1
|
- Version: v2.12.1
|
||||||
|
- License: GPL3
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
const rawImage = Module.zx_quantize(image.data, image.width, image.height, 1.0);
|
const rawImage = Module.zx_quantize(image.data, image.width, image.height, 1.0);
|
||||||
console.log('done');
|
console.log('done');
|
||||||
|
|
||||||
const imageData = new ImageData(new Uint8ClampedArray(rawImage.buffer), rawImage.width, rawImage.height);
|
const imageData = new ImageData(new Uint8ClampedArray(rawImage.buffer), image.width, image.height);
|
||||||
const canvas = document.createElement('canvas');
|
const canvas = document.createElement('canvas');
|
||||||
canvas.width = image.width;
|
canvas.width = image.width;
|
||||||
canvas.height = image.height;
|
canvas.height = image.height;
|
||||||
|
|||||||
2
codecs/imagequant/imagequant.d.ts
vendored
2
codecs/imagequant/imagequant.d.ts
vendored
@@ -3,4 +3,4 @@ interface QuantizerModule extends EmscriptenWasm.Module {
|
|||||||
zx_quantize(data: BufferSource, width: number, height: number, dither: number): Uint8ClampedArray;
|
zx_quantize(data: BufferSource, width: number, height: number, dither: number): Uint8ClampedArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function(opts: EmscriptenWasm.ModuleOpts): QuantizerModule;
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<QuantizerModule>;
|
||||||
|
|||||||
132
codecs/mozjpeg_enc/LICENSE.codec.md
Normal file
132
codecs/mozjpeg_enc/LICENSE.codec.md
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
libjpeg-turbo Licenses
|
||||||
|
======================
|
||||||
|
|
||||||
|
libjpeg-turbo is covered by three compatible BSD-style open source licenses:
|
||||||
|
|
||||||
|
- The IJG (Independent JPEG Group) License, which is listed in
|
||||||
|
[README.ijg](README.ijg)
|
||||||
|
|
||||||
|
This license applies to the libjpeg API library and associated programs
|
||||||
|
(any code inherited from libjpeg, and any modifications to that code.)
|
||||||
|
|
||||||
|
- The Modified (3-clause) BSD License, which is listed below
|
||||||
|
|
||||||
|
This license covers the TurboJPEG API library and associated programs, as
|
||||||
|
well as the build system.
|
||||||
|
|
||||||
|
- The [zlib License](https://opensource.org/licenses/Zlib)
|
||||||
|
|
||||||
|
This license is a subset of the other two, and it covers the libjpeg-turbo
|
||||||
|
SIMD extensions.
|
||||||
|
|
||||||
|
|
||||||
|
Complying with the libjpeg-turbo Licenses
|
||||||
|
=========================================
|
||||||
|
|
||||||
|
This section provides a roll-up of the libjpeg-turbo licensing terms, to the
|
||||||
|
best of our understanding.
|
||||||
|
|
||||||
|
1. If you are distributing a modified version of the libjpeg-turbo source,
|
||||||
|
then:
|
||||||
|
|
||||||
|
1. You cannot alter or remove any existing copyright or license notices
|
||||||
|
from the source.
|
||||||
|
|
||||||
|
**Origin**
|
||||||
|
- Clause 1 of the IJG License
|
||||||
|
- Clause 1 of the Modified BSD License
|
||||||
|
- Clauses 1 and 3 of the zlib License
|
||||||
|
|
||||||
|
2. You must add your own copyright notice to the header of each source
|
||||||
|
file you modified, so others can tell that you modified that file (if
|
||||||
|
there is not an existing copyright header in that file, then you can
|
||||||
|
simply add a notice stating that you modified the file.)
|
||||||
|
|
||||||
|
**Origin**
|
||||||
|
- Clause 1 of the IJG License
|
||||||
|
- Clause 2 of the zlib License
|
||||||
|
|
||||||
|
3. You must include the IJG README file, and you must not alter any of the
|
||||||
|
copyright or license text in that file.
|
||||||
|
|
||||||
|
**Origin**
|
||||||
|
- Clause 1 of the IJG License
|
||||||
|
|
||||||
|
2. If you are distributing only libjpeg-turbo binaries without the source, or
|
||||||
|
if you are distributing an application that statically links with
|
||||||
|
libjpeg-turbo, then:
|
||||||
|
|
||||||
|
1. Your product documentation must include a message stating:
|
||||||
|
|
||||||
|
This software is based in part on the work of the Independent JPEG
|
||||||
|
Group.
|
||||||
|
|
||||||
|
**Origin**
|
||||||
|
- Clause 2 of the IJG license
|
||||||
|
|
||||||
|
2. If your binary distribution includes or uses the TurboJPEG API, then
|
||||||
|
your product documentation must include the text of the Modified BSD
|
||||||
|
License (see below.)
|
||||||
|
|
||||||
|
**Origin**
|
||||||
|
- Clause 2 of the Modified BSD License
|
||||||
|
|
||||||
|
3. You cannot use the name of the IJG or The libjpeg-turbo Project or the
|
||||||
|
contributors thereof in advertising, publicity, etc.
|
||||||
|
|
||||||
|
**Origin**
|
||||||
|
- IJG License
|
||||||
|
- Clause 3 of the Modified BSD License
|
||||||
|
|
||||||
|
4. The IJG and The libjpeg-turbo Project do not warrant libjpeg-turbo to be
|
||||||
|
free of defects, nor do we accept any liability for undesirable
|
||||||
|
consequences resulting from your use of the software.
|
||||||
|
|
||||||
|
**Origin**
|
||||||
|
- IJG License
|
||||||
|
- Modified BSD License
|
||||||
|
- zlib License
|
||||||
|
|
||||||
|
|
||||||
|
The Modified (3-clause) BSD License
|
||||||
|
===================================
|
||||||
|
|
||||||
|
Copyright (C)2009-2020 D. R. Commander. All Rights Reserved.
|
||||||
|
Copyright (C)2015 Viktor Szathmáry. 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.
|
||||||
|
- Neither the name of the libjpeg-turbo Project nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from this
|
||||||
|
software without specific prior written permission.
|
||||||
|
|
||||||
|
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 HOLDERS 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.
|
||||||
|
|
||||||
|
|
||||||
|
Why Three Licenses?
|
||||||
|
===================
|
||||||
|
|
||||||
|
The zlib License could have been used instead of the Modified (3-clause) BSD
|
||||||
|
License, and since the IJG License effectively subsumes the distribution
|
||||||
|
conditions of the zlib License, this would have effectively placed
|
||||||
|
libjpeg-turbo binary distributions under the IJG License. However, the IJG
|
||||||
|
License specifically refers to the Independent JPEG Group and does not extend
|
||||||
|
attribution and endorsement protections to other entities. Thus, it was
|
||||||
|
desirable to choose a license that granted us the same protections for new code
|
||||||
|
that were granted to the IJG for code derived from their software.
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
- Source: <https://github.com/mozilla/mozjpeg>
|
- Source: <https://github.com/mozilla/mozjpeg>
|
||||||
- Version: v3.3.1
|
- Version: v3.3.1
|
||||||
|
- License: BSD
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
|
|||||||
2
codecs/mozjpeg_enc/mozjpeg_enc.d.ts
vendored
2
codecs/mozjpeg_enc/mozjpeg_enc.d.ts
vendored
@@ -4,4 +4,4 @@ interface MozJPEGModule extends EmscriptenWasm.Module {
|
|||||||
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array;
|
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function(opts: EmscriptenWasm.ModuleOpts): MozJPEGModule;
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<MozJPEGModule>;
|
||||||
|
|||||||
198
codecs/oxipng/Cargo.lock
generated
198
codecs/oxipng/Cargo.lock
generated
@@ -1,16 +1,22 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "adler32"
|
name = "adler"
|
||||||
version = "1.1.0"
|
version = "0.2.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d"
|
checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "adler32"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
|
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bit-vec"
|
name = "bit-vec"
|
||||||
@@ -38,9 +44,9 @@ checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytemuck"
|
name = "bytemuck"
|
||||||
version = "1.2.0"
|
version = "1.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "37fa13df2292ecb479ec23aa06f4507928bef07839be9ef15281411076629431"
|
checksum = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
@@ -50,9 +56,9 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.58"
|
version = "1.0.60"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518"
|
checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
@@ -96,6 +102,16 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crossbeam-channel"
|
||||||
|
version = "0.4.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
|
||||||
|
dependencies = [
|
||||||
|
"crossbeam-utils",
|
||||||
|
"maybe-uninit",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-deque"
|
name = "crossbeam-deque"
|
||||||
version = "0.7.3"
|
version = "0.7.3"
|
||||||
@@ -122,17 +138,6 @@ dependencies = [
|
|||||||
"scopeguard",
|
"scopeguard",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crossbeam-queue"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"crossbeam-utils",
|
|
||||||
"maybe-uninit",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-utils"
|
name = "crossbeam-utils"
|
||||||
version = "0.7.2"
|
version = "0.7.2"
|
||||||
@@ -156,24 +161,30 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
version = "1.5.3"
|
version = "1.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
|
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.1.15"
|
version = "0.1.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9"
|
checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "image"
|
name = "image"
|
||||||
version = "0.23.7"
|
version = "0.23.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a2397fc43bd5648b7117aabb3c5e62d0e62c194826ec77b0b4d0c41e62744635"
|
checksum = "974e194911d1f7efe3cd8a8f9db3b767e43536327e899e8bc9a12ef5711b74d2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
@@ -185,11 +196,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.4.0"
|
version = "1.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe"
|
checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
|
"hashbrown",
|
||||||
"rayon",
|
"rayon",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -210,24 +222,33 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.72"
|
version = "0.2.77"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701"
|
checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libdeflater"
|
name = "libdeflate-sys"
|
||||||
version = "0.2.0"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "66dca08b13369865b2f6dca1dd05f833985cbe6c12a676b04d55f78b85e80246"
|
checksum = "21e39efa87b84db3e13ff4e2dfac1e57220abcbd7fe8ec44d238f7f4f787cc1f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "libdeflater"
|
||||||
version = "0.4.8"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
checksum = "a4810980d791f26d470e2d7d91a3d4d22aa3a4b709fb7e9c5e43ee54f83a01f2"
|
||||||
|
dependencies = [
|
||||||
|
"libdeflate-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
@@ -240,9 +261,9 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memoffset"
|
name = "memoffset"
|
||||||
version = "0.5.5"
|
version = "0.5.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f"
|
checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
@@ -256,6 +277,16 @@ dependencies = [
|
|||||||
"adler32",
|
"adler32",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "miniz_oxide"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c60c0dfe32c10b43a144bad8fc83538c52f58302c92300ea7ec7bf7b38d5a7b9"
|
||||||
|
dependencies = [
|
||||||
|
"adler",
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-integer"
|
name = "num-integer"
|
||||||
version = "0.1.43"
|
version = "0.1.43"
|
||||||
@@ -308,42 +339,50 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "oxipng"
|
name = "once_cell"
|
||||||
version = "3.0.0"
|
version = "1.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d5fd695858078338d73862ff3755f820eff0bf4f3304e4b52f22aba53463183a"
|
checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "oxipng"
|
||||||
|
version = "3.0.1"
|
||||||
|
source = "git+https://github.com/RReverser/oxipng?branch=crossbeam#d0f86d2e84eb55b423b8ad194a176e71ba3aa2c3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bit-vec",
|
"bit-vec",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"cloudflare-zlib",
|
"cloudflare-zlib",
|
||||||
"crc",
|
"crc",
|
||||||
|
"crossbeam-channel",
|
||||||
"image",
|
"image",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"itertools",
|
"itertools",
|
||||||
"libdeflater",
|
"libdeflater",
|
||||||
"log",
|
"log",
|
||||||
"miniz_oxide",
|
"miniz_oxide 0.4.2",
|
||||||
|
"rayon",
|
||||||
"rgb",
|
"rgb",
|
||||||
|
"rustc_version",
|
||||||
"zopfli",
|
"zopfli",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "png"
|
name = "png"
|
||||||
version = "0.16.6"
|
version = "0.16.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c150bf7479fafe3dd8740dbe48cc33b2a3efb7b0fe3483aced8bbc39f6d0238d"
|
checksum = "dfe7f9f1c730833200b134370e1d5098964231af8450bce9b78ee3ab5278b970"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"deflate",
|
"deflate",
|
||||||
"miniz_oxide",
|
"miniz_oxide 0.3.7",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.18"
|
version = "1.0.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
|
checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
@@ -359,9 +398,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rayon"
|
name = "rayon"
|
||||||
version = "1.3.1"
|
version = "1.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080"
|
checksum = "cfd016f0c045ad38b5251be2c9c0ab806917f82da4d36b2a327e5166adad9270"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"crossbeam-deque",
|
"crossbeam-deque",
|
||||||
@@ -371,12 +410,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rayon-core"
|
name = "rayon-core"
|
||||||
version = "1.7.1"
|
version = "1.8.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280"
|
checksum = "e8c4fec834fb6e6d2dd5eece3c7b432a52f0ba887cf40e595190c4107edc08bf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"crossbeam-channel",
|
||||||
"crossbeam-deque",
|
"crossbeam-deque",
|
||||||
"crossbeam-queue",
|
|
||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
@@ -384,33 +423,60 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rgb"
|
name = "rgb"
|
||||||
version = "0.8.20"
|
version = "0.8.25"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "90ef54b45ae131327a88597e2463fee4098ad6c88ba7b6af4b3987db8aad4098"
|
checksum = "287f3c3f8236abb92d8b7e36797f19159df4b58f0a658cc3fb6dd3004b1f3bd3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc_version"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||||
|
dependencies = [
|
||||||
|
"semver",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "scopeguard"
|
name = "scopeguard"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "semver"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||||
|
dependencies = [
|
||||||
|
"semver-parser",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "semver-parser"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "squoosh-oxipng"
|
name = "squoosh-oxipng"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"crossbeam-channel",
|
||||||
"log",
|
"log",
|
||||||
|
"once_cell",
|
||||||
"oxipng",
|
"oxipng",
|
||||||
|
"rayon",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.34"
|
version = "1.0.41"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b"
|
checksum = "6690e3e9f692504b941dc6c3b188fd28df054f7fb8469ab40680df52fdcc842b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -431,9 +497,9 @@ checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen"
|
name = "wasm-bindgen"
|
||||||
version = "0.2.64"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6a634620115e4a229108b71bde263bb4220c483b3f07f5ba514ee8d15064c4c2"
|
checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"wasm-bindgen-macro",
|
"wasm-bindgen-macro",
|
||||||
@@ -441,9 +507,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-backend"
|
name = "wasm-bindgen-backend"
|
||||||
version = "0.2.64"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3e53963b583d18a5aa3aaae4b4c1cb535218246131ba22a71f05b518098571df"
|
checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@@ -456,9 +522,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro"
|
name = "wasm-bindgen-macro"
|
||||||
version = "0.2.64"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3fcfd5ef6eec85623b4c6e844293d4516470d8f19cd72d0d12246017eb9060b8"
|
checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"wasm-bindgen-macro-support",
|
"wasm-bindgen-macro-support",
|
||||||
@@ -466,9 +532,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro-support"
|
name = "wasm-bindgen-macro-support"
|
||||||
version = "0.2.64"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9adff9ee0e94b926ca81b57f57f86d5545cdcb1d259e21ec9bdd95b901754c75"
|
checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -479,9 +545,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-shared"
|
name = "wasm-bindgen-shared"
|
||||||
version = "0.2.64"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7f7b90ea6c632dd06fd765d44542e234d5e63d9bb917ecd64d79778a13bd79ae"
|
checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zopfli"
|
name = "zopfli"
|
||||||
|
|||||||
@@ -12,7 +12,19 @@ crate-type = ["cdylib"]
|
|||||||
oxipng = { version = "3.0.0", default-features = false }
|
oxipng = { version = "3.0.0", default-features = false }
|
||||||
wasm-bindgen = "0.2.64"
|
wasm-bindgen = "0.2.64"
|
||||||
log = { version = "0.4", features = ["release_max_level_off"] }
|
log = { version = "0.4", features = ["release_max_level_off"] }
|
||||||
|
rayon = { version = "1.3.0", optional = true }
|
||||||
|
once_cell = { version = "1.3.1", optional = true }
|
||||||
|
crossbeam-channel = { version = "0.4.2", optional = true }
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
oxipng = { git = "https://github.com/RReverser/oxipng", branch = "crossbeam" }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
opt-level = "s"
|
opt-level = "s"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
parallel = ["oxipng/parallel", "rayon", "crossbeam-channel", "once_cell"]
|
||||||
|
|
||||||
|
[package.metadata.wasm-pack.profile.release]
|
||||||
|
wasm-opt = ["-O", "--no-validation"]
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
FROM rust
|
|
||||||
RUN rustup target add wasm32-unknown-unknown
|
|
||||||
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
||||||
|
|
||||||
RUN mkdir /opt/wabt && \
|
|
||||||
curl -L https://github.com/WebAssembly/wabt/releases/download/1.0.17/wabt-1.0.17-ubuntu.tar.gz | tar -xzf - -C /opt/wabt --strip 1
|
|
||||||
|
|
||||||
RUN mkdir /opt/wasi-sdk && \
|
|
||||||
curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-11/wasi-sdk-11.0-linux.tar.gz | tar -xzf - -C /opt/wasi-sdk --strip 1
|
|
||||||
|
|
||||||
ENV PATH="/opt/wabt/bin:/opt/wasi-sdk/bin:${PATH}"
|
|
||||||
WORKDIR /src
|
|
||||||
20
codecs/oxipng/LICENSE.codec.md
Normal file
20
codecs/oxipng/LICENSE.codec.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
Copyright (c) 2016 Joshua Holmer
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
5
codecs/oxipng/README.md
Normal file
5
codecs/oxipng/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# OxiPNG
|
||||||
|
|
||||||
|
- Source: <https://github.com/shssoichiro/oxipng>
|
||||||
|
- Version: v3.0.0
|
||||||
|
- License: MIT
|
||||||
9
codecs/oxipng/build.sh
Normal file
9
codecs/oxipng/build.sh
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
rm -rf pkg,{-parallel}
|
||||||
|
wasm-pack build
|
||||||
|
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory' wasm-pack build -t web -d pkg-parallel -- -Z build-std=panic_abort,std --features=parallel
|
||||||
|
sed -i "s|input = import.meta.url.replace(/\\\.js$/, '_bg.wasm');||" pkg{,-parallel}/squoosh_oxipng.js
|
||||||
|
rm pkg{,-parallel}/.gitignore
|
||||||
10
codecs/oxipng/index.ts
Normal file
10
codecs/oxipng/index.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { threads } from 'wasm-feature-detect';
|
||||||
|
|
||||||
|
async function init() {
|
||||||
|
if (await threads()) {
|
||||||
|
return (await import('./spawn')).default;
|
||||||
|
}
|
||||||
|
return import('./pkg');
|
||||||
|
}
|
||||||
|
|
||||||
|
export default init();
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "oxipng",
|
"name": "oxipng",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "../build-rust.sh"
|
"build": "../build-rust-nightly.sh ./build.sh"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
codecs/oxipng/pkg-parallel/README.md
Normal file
5
codecs/oxipng/pkg-parallel/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# OxiPNG
|
||||||
|
|
||||||
|
- Source: <https://github.com/shssoichiro/oxipng>
|
||||||
|
- Version: v3.0.0
|
||||||
|
- License: MIT
|
||||||
15
codecs/oxipng/pkg-parallel/package.json
Normal file
15
codecs/oxipng/pkg-parallel/package.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "squoosh-oxipng",
|
||||||
|
"collaborators": [
|
||||||
|
"Ingvar Stepanyan <me@rreverser.com>"
|
||||||
|
],
|
||||||
|
"version": "0.1.0",
|
||||||
|
"files": [
|
||||||
|
"squoosh_oxipng_bg.wasm",
|
||||||
|
"squoosh_oxipng.js",
|
||||||
|
"squoosh_oxipng.d.ts"
|
||||||
|
],
|
||||||
|
"module": "squoosh_oxipng.js",
|
||||||
|
"types": "squoosh_oxipng.d.ts",
|
||||||
|
"sideEffects": false
|
||||||
|
}
|
||||||
46
codecs/oxipng/pkg-parallel/squoosh_oxipng.d.ts
vendored
Normal file
46
codecs/oxipng/pkg-parallel/squoosh_oxipng.d.ts
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* @param {number} num
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
export function worker_initializer(num: number): any;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function start_main_thread(): void;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function start_worker_thread(): void;
|
||||||
|
/**
|
||||||
|
* @param {Uint8Array} data
|
||||||
|
* @param {number} level
|
||||||
|
* @returns {Uint8Array}
|
||||||
|
*/
|
||||||
|
export function optimise(data: Uint8Array, level: number): Uint8Array;
|
||||||
|
|
||||||
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
||||||
|
|
||||||
|
export interface InitOutput {
|
||||||
|
readonly malloc: (a: number) => number;
|
||||||
|
readonly free: (a: number) => void;
|
||||||
|
readonly worker_initializer: (a: number) => number;
|
||||||
|
readonly start_main_thread: () => void;
|
||||||
|
readonly start_worker_thread: () => void;
|
||||||
|
readonly optimise: (a: number, b: number, c: number, d: number) => void;
|
||||||
|
readonly __wbindgen_export_0: WebAssembly.Memory;
|
||||||
|
readonly __wbindgen_malloc: (a: number) => number;
|
||||||
|
readonly __wbindgen_free: (a: number, b: number) => void;
|
||||||
|
readonly __wbindgen_start: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
||||||
|
* for everything else, calls `WebAssembly.instantiate` directly.
|
||||||
|
*
|
||||||
|
* @param {InitInput | Promise<InitInput>} module_or_path
|
||||||
|
* @param {WebAssembly.Memory} maybe_memory
|
||||||
|
*
|
||||||
|
* @returns {Promise<InitOutput>}
|
||||||
|
*/
|
||||||
|
export default function init (module_or_path?: InitInput | Promise<InitInput>, maybe_memory: WebAssembly.Memory): Promise<InitOutput>;
|
||||||
|
|
||||||
180
codecs/oxipng/pkg-parallel/squoosh_oxipng.js
Normal file
180
codecs/oxipng/pkg-parallel/squoosh_oxipng.js
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
|
||||||
|
let wasm;
|
||||||
|
let memory;
|
||||||
|
|
||||||
|
const heap = new Array(32).fill(undefined);
|
||||||
|
|
||||||
|
heap.push(undefined, null, true, false);
|
||||||
|
|
||||||
|
let heap_next = heap.length;
|
||||||
|
|
||||||
|
function addHeapObject(obj) {
|
||||||
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
||||||
|
const idx = heap_next;
|
||||||
|
heap_next = heap[idx];
|
||||||
|
|
||||||
|
heap[idx] = obj;
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
||||||
|
|
||||||
|
cachedTextDecoder.decode();
|
||||||
|
|
||||||
|
let cachegetUint8Memory0 = null;
|
||||||
|
function getUint8Memory0() {
|
||||||
|
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.__wbindgen_export_0.buffer) {
|
||||||
|
cachegetUint8Memory0 = new Uint8Array(wasm.__wbindgen_export_0.buffer);
|
||||||
|
}
|
||||||
|
return cachegetUint8Memory0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStringFromWasm0(ptr, len) {
|
||||||
|
return cachedTextDecoder.decode(getUint8Memory0().slice(ptr, ptr + len));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getObject(idx) { return heap[idx]; }
|
||||||
|
|
||||||
|
function dropObject(idx) {
|
||||||
|
if (idx < 36) return;
|
||||||
|
heap[idx] = heap_next;
|
||||||
|
heap_next = idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
function takeObject(idx) {
|
||||||
|
const ret = getObject(idx);
|
||||||
|
dropObject(idx);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param {number} num
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
export function worker_initializer(num) {
|
||||||
|
var ret = wasm.worker_initializer(num);
|
||||||
|
return takeObject(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function start_main_thread() {
|
||||||
|
wasm.start_main_thread();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function start_worker_thread() {
|
||||||
|
wasm.start_worker_thread();
|
||||||
|
}
|
||||||
|
|
||||||
|
let WASM_VECTOR_LEN = 0;
|
||||||
|
|
||||||
|
function passArray8ToWasm0(arg, malloc) {
|
||||||
|
const ptr = malloc(arg.length * 1);
|
||||||
|
getUint8Memory0().set(arg, ptr / 1);
|
||||||
|
WASM_VECTOR_LEN = arg.length;
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
let cachegetInt32Memory0 = null;
|
||||||
|
function getInt32Memory0() {
|
||||||
|
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.__wbindgen_export_0.buffer) {
|
||||||
|
cachegetInt32Memory0 = new Int32Array(wasm.__wbindgen_export_0.buffer);
|
||||||
|
}
|
||||||
|
return cachegetInt32Memory0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getArrayU8FromWasm0(ptr, len) {
|
||||||
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param {Uint8Array} data
|
||||||
|
* @param {number} level
|
||||||
|
* @returns {Uint8Array}
|
||||||
|
*/
|
||||||
|
export function optimise(data, level) {
|
||||||
|
try {
|
||||||
|
const retptr = wasm.__wbindgen_export_1.value - 16;
|
||||||
|
wasm.__wbindgen_export_1.value = retptr;
|
||||||
|
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
||||||
|
var len0 = WASM_VECTOR_LEN;
|
||||||
|
wasm.optimise(retptr, ptr0, len0, level);
|
||||||
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||||
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||||
|
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
||||||
|
wasm.__wbindgen_free(r0, r1 * 1);
|
||||||
|
return v1;
|
||||||
|
} finally {
|
||||||
|
wasm.__wbindgen_export_1.value += 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function load(module, imports, maybe_memory) {
|
||||||
|
if (typeof Response === 'function' && module instanceof Response) {
|
||||||
|
memory = imports.wbg.memory = new WebAssembly.Memory({initial:17,maximum:16384,shared:true});
|
||||||
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
||||||
|
try {
|
||||||
|
return await WebAssembly.instantiateStreaming(module, imports);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
if (module.headers.get('Content-Type') != 'application/wasm') {
|
||||||
|
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const bytes = await module.arrayBuffer();
|
||||||
|
return await WebAssembly.instantiate(bytes, imports);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
memory = imports.wbg.memory = maybe_memory;
|
||||||
|
const instance = await WebAssembly.instantiate(module, imports);
|
||||||
|
|
||||||
|
if (instance instanceof WebAssembly.Instance) {
|
||||||
|
return { instance, module };
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function init(input, maybe_memory) {
|
||||||
|
if (typeof input === 'undefined') {
|
||||||
|
|
||||||
|
}
|
||||||
|
const imports = {};
|
||||||
|
imports.wbg = {};
|
||||||
|
imports.wbg.__wbindgen_module = function() {
|
||||||
|
var ret = init.__wbindgen_wasm_module;
|
||||||
|
return addHeapObject(ret);
|
||||||
|
};
|
||||||
|
imports.wbg.__wbindgen_memory = function() {
|
||||||
|
var ret = wasm.__wbindgen_export_0;
|
||||||
|
return addHeapObject(ret);
|
||||||
|
};
|
||||||
|
imports.wbg.__wbg_of_6510501edc06d65e = function(arg0, arg1) {
|
||||||
|
var ret = Array.of(takeObject(arg0), takeObject(arg1));
|
||||||
|
return addHeapObject(ret);
|
||||||
|
};
|
||||||
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
||||||
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
||||||
|
};
|
||||||
|
|
||||||
|
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
||||||
|
input = fetch(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { instance, module } = await load(await input, imports, maybe_memory);
|
||||||
|
|
||||||
|
wasm = instance.exports;
|
||||||
|
init.__wbindgen_wasm_module = module;
|
||||||
|
wasm.__wbindgen_start();
|
||||||
|
return wasm;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default init;
|
||||||
|
|
||||||
BIN
codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm
Normal file
BIN
codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm
Normal file
Binary file not shown.
12
codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm.d.ts
vendored
Normal file
12
codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
export function malloc(a: number): number;
|
||||||
|
export function free(a: number): void;
|
||||||
|
export function worker_initializer(a: number): number;
|
||||||
|
export function start_main_thread(): void;
|
||||||
|
export function start_worker_thread(): void;
|
||||||
|
export function optimise(a: number, b: number, c: number, d: number): void;
|
||||||
|
export const __wbindgen_export_0: WebAssembly.Memory;
|
||||||
|
export function __wbindgen_malloc(a: number): number;
|
||||||
|
export function __wbindgen_free(a: number, b: number): void;
|
||||||
|
export function __wbindgen_start(): void;
|
||||||
5
codecs/oxipng/pkg/README.md
Normal file
5
codecs/oxipng/pkg/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# OxiPNG
|
||||||
|
|
||||||
|
- Source: <https://github.com/shssoichiro/oxipng>
|
||||||
|
- Version: v3.0.0
|
||||||
|
- License: MIT
|
||||||
@@ -44,14 +44,20 @@ function getArrayU8FromWasm0(ptr, len) {
|
|||||||
* @returns {Uint8Array}
|
* @returns {Uint8Array}
|
||||||
*/
|
*/
|
||||||
export function optimise(data, level) {
|
export function optimise(data, level) {
|
||||||
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
try {
|
||||||
var len0 = WASM_VECTOR_LEN;
|
const retptr = wasm.__wbindgen_export_0.value - 16;
|
||||||
wasm.optimise(8, ptr0, len0, level);
|
wasm.__wbindgen_export_0.value = retptr;
|
||||||
var r0 = getInt32Memory0()[8 / 4 + 0];
|
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
||||||
var r1 = getInt32Memory0()[8 / 4 + 1];
|
var len0 = WASM_VECTOR_LEN;
|
||||||
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
wasm.optimise(retptr, ptr0, len0, level);
|
||||||
wasm.__wbindgen_free(r0, r1 * 1);
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||||
return v1;
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||||
|
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
||||||
|
wasm.__wbindgen_free(r0, r1 * 1);
|
||||||
|
return v1;
|
||||||
|
} finally {
|
||||||
|
wasm.__wbindgen_export_0.value += 16;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const __wbindgen_throw = function(arg0, arg1) {
|
export const __wbindgen_throw = function(arg0, arg1) {
|
||||||
|
|||||||
Binary file not shown.
1
codecs/oxipng/rust-toolchain
Normal file
1
codecs/oxipng/rust-toolchain
Normal file
@@ -0,0 +1 @@
|
|||||||
|
nightly
|
||||||
65
codecs/oxipng/spawn.ts
Normal file
65
codecs/oxipng/spawn.ts
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
import initOxiPNG, {
|
||||||
|
worker_initializer,
|
||||||
|
start_main_thread,
|
||||||
|
optimise,
|
||||||
|
} from './pkg-parallel';
|
||||||
|
// @ts-ignore
|
||||||
|
import wasmUrl from './pkg-parallel/squoosh_oxipng_bg.wasm';
|
||||||
|
import { WorkerInit } from './worker';
|
||||||
|
|
||||||
|
function initWorker(worker: Worker, workerInit: WorkerInit) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
worker.postMessage(workerInit);
|
||||||
|
worker.addEventListener('message', () => resolve(), { once: true });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function startMainThread() {
|
||||||
|
const num = navigator.hardwareConcurrency;
|
||||||
|
|
||||||
|
// First, let browser fetch and spawn Workers for our pool in the background.
|
||||||
|
// This is fairly expensive, so we want to start it as early as possible.
|
||||||
|
const workers = Array.from({ length: num }, () => new Promise<Worker>((resolve) => {
|
||||||
|
const w = new Worker('./worker', { type: 'module' });
|
||||||
|
w.addEventListener('message', () => resolve(w), { once: true });
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Meanwhile, asynchronously compile, instantiate and initialise Wasm on our main thread.
|
||||||
|
await initOxiPNG(fetch(wasmUrl), undefined as any);
|
||||||
|
|
||||||
|
// Get module+memory from the Wasm instance.
|
||||||
|
//
|
||||||
|
// Ideally we wouldn't go via Wasm bindings here, since both are just JS variables, but memory is
|
||||||
|
// currently not exposed on the Wasm instance correctly by wasm-bindgen.
|
||||||
|
const workerInit: WorkerInit = worker_initializer(num);
|
||||||
|
|
||||||
|
// Once done, we want to send module+memory to each Worker so that they instantiate Wasm too.
|
||||||
|
// While doing so, we need to wait for Workers to acknowledge that they have received our message.
|
||||||
|
// Ideally this shouldn't be necessary, but Chromium currently doesn't conform to the spec:
|
||||||
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1075645
|
||||||
|
//
|
||||||
|
// If we didn't do this ping-pong game, the `start_main_thread` below would block the current
|
||||||
|
// thread on an atomic before even *sending* the `postMessage` containing memory,
|
||||||
|
// so Workers would never be able to unblock us back.
|
||||||
|
|
||||||
|
// TODO: remove this line.
|
||||||
|
// It waits for all workers to be created just to repro a possible V8 bug.
|
||||||
|
const resolvedWorkers = await Promise.all(workers);
|
||||||
|
|
||||||
|
await Promise.all(resolvedWorkers.map(worker => initWorker(worker, workerInit)));
|
||||||
|
|
||||||
|
// Finally, instantiate rayon pool - this will use shared Wasm memory to send tasks to the
|
||||||
|
// Workers and then block until they're all ready.
|
||||||
|
start_main_thread();
|
||||||
|
|
||||||
|
return {
|
||||||
|
optimise,
|
||||||
|
freeWorkers: () => {
|
||||||
|
for (const worker of resolvedWorkers) {
|
||||||
|
worker.terminate();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default () => startMainThread();
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
mod malloc_shim;
|
|
||||||
|
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
use oxipng::AlphaOptim;
|
use oxipng::AlphaOptim;
|
||||||
|
|
||||||
#[wasm_bindgen(catch)]
|
mod malloc_shim;
|
||||||
|
|
||||||
|
#[cfg(feature = "parallel")]
|
||||||
|
pub mod parallel;
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
pub fn optimise(data: &[u8], level: u8) -> Vec<u8> {
|
pub fn optimise(data: &[u8], level: u8) -> Vec<u8> {
|
||||||
let mut options = oxipng::Options::from_preset(level);
|
let mut options = oxipng::Options::from_preset(level);
|
||||||
options.alphas.insert(AlphaOptim::Black);
|
options.alphas.insert(AlphaOptim::Black);
|
||||||
|
|||||||
61
codecs/oxipng/src/parallel.rs
Normal file
61
codecs/oxipng/src/parallel.rs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
use crossbeam_channel::{Sender, Receiver, bounded};
|
||||||
|
use once_cell::sync::OnceCell;
|
||||||
|
use wasm_bindgen::prelude::*;
|
||||||
|
use wasm_bindgen::JsValue;
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
extern "C" {
|
||||||
|
#[wasm_bindgen(js_namespace = Array, js_name = of)]
|
||||||
|
fn array_of_2(a: JsValue, b: JsValue) -> JsValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is one of the parts that work around Chromium incorrectly implementing postMessage:
|
||||||
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1075645
|
||||||
|
//
|
||||||
|
// rayon::ThreadPoolBuilder (used below) executes spawn handler to populate the worker pool,
|
||||||
|
// and then blocks the current thread until each worker unblocks its (opaque) lock.
|
||||||
|
//
|
||||||
|
// Normally, we could use postMessage directly inside the spawn handler to
|
||||||
|
// post module + memory + threadPtr to each worker, and the block the current thread.
|
||||||
|
//
|
||||||
|
// However, that bug means that postMessage is currently delayed until the next event loop,
|
||||||
|
// which will never spin since we block the current thread, and so the other workers will
|
||||||
|
// never be able to unblock us.
|
||||||
|
//
|
||||||
|
// To work around this problem, we:
|
||||||
|
// 1) Expose `worker_initializer` that returns module + memory pair (without threadPtr)
|
||||||
|
// that workers can be initialised with to become native threads.
|
||||||
|
// JavaScript can postMessage this pair in advance, and asynchronously wait for workers
|
||||||
|
// to acknowledge the receipt.
|
||||||
|
// 2) Create a global communication channel on the Rust side using crossbeam.
|
||||||
|
// It will be used to send threadPtr to the pre-initialised workers
|
||||||
|
// instead of postMessage.
|
||||||
|
// 3) Provide a separate `start_main_thread` that expects all workers to be ready,
|
||||||
|
// and just uses the provided channel to send `threadPtr`s using the
|
||||||
|
// shared memory and blocks the current thread until they're all grabbed.
|
||||||
|
// 4) Provide a `worker_initializer` that is expected to be invoked from various workers,
|
||||||
|
// reads one `threadPtr` from the shared channel and starts running it.
|
||||||
|
static CHANNEL: OnceCell<(Sender<rayon::ThreadBuilder>, Receiver<rayon::ThreadBuilder>)> = OnceCell::new();
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn worker_initializer(num: usize) -> JsValue {
|
||||||
|
CHANNEL.get_or_init(|| bounded(num));
|
||||||
|
array_of_2(wasm_bindgen::module(), wasm_bindgen::memory())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn start_main_thread() {
|
||||||
|
let (sender, _) = CHANNEL.get().unwrap();
|
||||||
|
|
||||||
|
rayon::ThreadPoolBuilder::new()
|
||||||
|
.num_threads(sender.capacity().unwrap())
|
||||||
|
.spawn_handler(|thread| Ok(sender.send(thread).unwrap_throw()))
|
||||||
|
.build_global()
|
||||||
|
.unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn start_worker_thread() {
|
||||||
|
let (_, receiver) = CHANNEL.get().unwrap();
|
||||||
|
receiver.recv().unwrap_throw().run()
|
||||||
|
}
|
||||||
28
codecs/oxipng/worker.ts
Normal file
28
codecs/oxipng/worker.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/// <reference lib="webworker" />
|
||||||
|
|
||||||
|
import initOxiPNG, { start_worker_thread } from './pkg-parallel';
|
||||||
|
|
||||||
|
export type WorkerInit = [WebAssembly.Module, WebAssembly.Memory];
|
||||||
|
|
||||||
|
// TODO: remove this line.
|
||||||
|
// It allows main thread to wait for a Worker to be created just to repro a possible V8 bug.
|
||||||
|
postMessage(null);
|
||||||
|
|
||||||
|
addEventListener(
|
||||||
|
'message',
|
||||||
|
async (event) => {
|
||||||
|
// Tell the "main" thread that we've received the message.
|
||||||
|
//
|
||||||
|
// At this point, the "main" thread can run Wasm that
|
||||||
|
// will synchronously block waiting on other atomics.
|
||||||
|
//
|
||||||
|
// Note that we don't need to wait for Wasm instantiation here - it's
|
||||||
|
// better to start main thread as early as possible, and then it blocks
|
||||||
|
// on a shared atomic anyway until Worker is fully ready.
|
||||||
|
postMessage(null);
|
||||||
|
|
||||||
|
await initOxiPNG(...(event.data as WorkerInit));
|
||||||
|
start_worker_thread();
|
||||||
|
},
|
||||||
|
{ once: true },
|
||||||
|
);
|
||||||
21
codecs/resize/LICENSE.codec.md
Normal file
21
codecs/resize/LICENSE.codec.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 PistonDevelopers
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
5
codecs/resize/README.md
Normal file
5
codecs/resize/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Resize
|
||||||
|
|
||||||
|
- Source: <https://github.com/PistonDevelopers/resize>
|
||||||
|
- Version: v0.3.0
|
||||||
|
- License: MIT
|
||||||
@@ -1,9 +1,13 @@
|
|||||||
|
ARG RUST_IMG=rust:1.44-stretch
|
||||||
|
|
||||||
FROM emscripten/emsdk:1.39.19 AS wasm-tools
|
FROM emscripten/emsdk:1.39.19 AS wasm-tools
|
||||||
WORKDIR /opt/wasm-tools
|
WORKDIR /opt/wasm-tools
|
||||||
RUN wget -qO- https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1/wasm-pack-v0.9.1-x86_64-unknown-linux-musl.tar.gz | tar -xzf - --strip 1
|
RUN wget -qO- https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1/wasm-pack-v0.9.1-x86_64-unknown-linux-musl.tar.gz | tar -xzf - --strip 1
|
||||||
|
|
||||||
FROM rust:1.44-stretch AS rust
|
FROM $RUST_IMG AS rust
|
||||||
|
ARG RUST_IMG
|
||||||
RUN rustup target add wasm32-unknown-unknown
|
RUN rustup target add wasm32-unknown-unknown
|
||||||
|
RUN if [ "$RUST_IMG" = "rustlang/rust:nightly" ] ; then rustup component add rust-src ; fi
|
||||||
COPY --from=wasm-tools /emsdk/upstream/bin/wasm-opt /emsdk/upstream/bin/clang /usr/local/bin/
|
COPY --from=wasm-tools /emsdk/upstream/bin/wasm-opt /emsdk/upstream/bin/clang /usr/local/bin/
|
||||||
COPY --from=wasm-tools /emsdk/upstream/lib/ /usr/local/lib/
|
COPY --from=wasm-tools /emsdk/upstream/lib/ /usr/local/lib/
|
||||||
COPY --from=wasm-tools /emsdk/upstream/emscripten/system/include/libc/ /wasm32/include/
|
COPY --from=wasm-tools /emsdk/upstream/emscripten/system/include/libc/ /wasm32/include/
|
||||||
|
|||||||
29
codecs/webp/LICENSE.codec.md
Normal file
29
codecs/webp/LICENSE.codec.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Copyright (c) 2010, Google Inc. 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.
|
||||||
|
|
||||||
|
* Neither the name of Google nor the names of its contributors may
|
||||||
|
be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
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.
|
||||||
5
codecs/webp/README.md
Normal file
5
codecs/webp/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# WebP
|
||||||
|
|
||||||
|
- Source: https://github.com/webmproject/libwebp
|
||||||
|
- Version: v1.0.2
|
||||||
|
- License: BSD
|
||||||
@@ -17,7 +17,7 @@ val decode(std::string buffer) {
|
|||||||
int width, height;
|
int width, height;
|
||||||
std::unique_ptr<uint8_t[]> rgba(
|
std::unique_ptr<uint8_t[]> rgba(
|
||||||
WebPDecodeRGBA((const uint8_t*)buffer.c_str(), buffer.size(), &width, &height));
|
WebPDecodeRGBA((const uint8_t*)buffer.c_str(), buffer.size(), &width, &height));
|
||||||
return ImageData.new_(Uint8ClampedArray.new_(typed_memory_view(width * height * 4, rgba.get())), width, height);
|
return rgba ? ImageData.new_(Uint8ClampedArray.new_(typed_memory_view(width * height * 4, rgba.get())), width, height) : val::null();
|
||||||
}
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_BINDINGS(my_module) {
|
EMSCRIPTEN_BINDINGS(my_module) {
|
||||||
|
|||||||
4
codecs/webp/dec/webp_dec.d.ts
vendored
4
codecs/webp/dec/webp_dec.d.ts
vendored
@@ -1,5 +1,5 @@
|
|||||||
interface WebPModule extends EmscriptenWasm.Module {
|
interface WebPModule extends EmscriptenWasm.Module {
|
||||||
decode(data: BufferSource): ImageData;
|
decode(data: BufferSource): ImageData | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function(opts: EmscriptenWasm.ModuleOpts): WebPModule;
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<WebPModule>;
|
||||||
|
|||||||
@@ -7,23 +7,23 @@ function(webp_dec) {
|
|||||||
webp_dec = webp_dec || {};
|
webp_dec = webp_dec || {};
|
||||||
|
|
||||||
|
|
||||||
var d;d||(d=typeof webp_dec !== 'undefined' ? webp_dec : {});var aa;d.ready=new Promise(function(a){aa=a});var t={},u;for(u in d)d.hasOwnProperty(u)&&(t[u]=d[u]);var v=!1,w=!1,ba=!1,ca=!1;v="object"===typeof window;w="function"===typeof importScripts;ba="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ca=!v&&!ba&&!w;var x="",z,A,da,ea;
|
var d;d||(d=typeof webp_dec !== 'undefined' ? webp_dec : {});var aa,ba;d.ready=new Promise(function(a,b){aa=a;ba=b});var t={},u;for(u in d)d.hasOwnProperty(u)&&(t[u]=d[u]);var v=!1,w=!1,ca=!1,da=!1;v="object"===typeof window;w="function"===typeof importScripts;ca="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;da=!v&&!ca&&!w;var x="",z,A,ea,fa;
|
||||||
if(ba)x=w?require("path").dirname(x)+"/":__dirname+"/",z=function(a,b){da||(da=require("fs"));ea||(ea=require("path"));a=ea.normalize(a);return da.readFileSync(a,b?null:"utf8")},A=function(a){a=z(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||B("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",B),d.inspect=function(){return"[Emscripten Module object]"};
|
if(ca)x=w?require("path").dirname(x)+"/":__dirname+"/",z=function(a,b){ea||(ea=require("fs"));fa||(fa=require("path"));a=fa.normalize(a);return ea.readFileSync(a,b?null:"utf8")},A=function(a){a=z(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||B("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",B),d.inspect=function(){return"[Emscripten Module object]"};
|
||||||
else if(ca)"undefined"!=typeof read&&(z=function(a){return read(a)}),A=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||B("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(v||w)w?x=self.location.href:document.currentScript&&(x=document.currentScript.src),_scriptDir&&
|
else if(da)"undefined"!=typeof read&&(z=function(a){return read(a)}),A=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||B("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(v||w)w?x=self.location.href:document.currentScript&&(x=document.currentScript.src),_scriptDir&&
|
||||||
(x=_scriptDir),0!==x.indexOf("blob:")?x=x.substr(0,x.lastIndexOf("/")+1):x="",z=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},w&&(A=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var fa=d.print||console.log.bind(console),C=d.printErr||console.warn.bind(console);for(u in t)t.hasOwnProperty(u)&&(d[u]=t[u]);t=null;var D;d.wasmBinary&&(D=d.wasmBinary);var noExitRuntime;
|
(x=_scriptDir),0!==x.indexOf("blob:")?x=x.substr(0,x.lastIndexOf("/")+1):x="",z=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},w&&(A=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});d.print||console.log.bind(console);var C=d.printErr||console.warn.bind(console);for(u in t)t.hasOwnProperty(u)&&(d[u]=t[u]);t=null;var D;d.wasmBinary&&(D=d.wasmBinary);var noExitRuntime;
|
||||||
d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&B("no native wasm support detected");var E,ha=new WebAssembly.Table({initial:130,maximum:130,element:"anyfunc"}),ia=!1,ja="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&B("no native wasm support detected");var E,ha=new WebAssembly.Table({initial:130,maximum:130,element:"anyfunc"}),ia=!1,ja="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||||
function ka(a,b,c){var e=F;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var la="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
function ka(a,b,c){var e=F;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var la="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||||
function ma(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&G[c];)++c;c<<=1;if(32<c-a&&la)return la.decode(F.subarray(a,c));c=0;for(e="";;){var f=H[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function na(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)H[b>>1]=a.charCodeAt(f),b+=2;H[b>>1]=0;return b-e}function oa(a){return 2*a.length}
|
function ma(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&G[c];)++c;c<<=1;if(32<c-a&&la)return la.decode(F.subarray(a,c));c=0;for(e="";;){var f=H[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function na(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)H[b>>1]=a.charCodeAt(f),b+=2;H[b>>1]=0;return b-e}function oa(a){return 2*a.length}
|
||||||
function pa(a,b){for(var c=0,e="";!(c>=b/4);){var f=I[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function qa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}I[b>>2]=g;b+=4;if(b+4>c)break}I[b>>2]=0;return b-e}
|
function pa(a,b){for(var c=0,e="";!(c>=b/4);){var f=I[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function qa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}I[b>>2]=g;b+=4;if(b+4>c)break}I[b>>2]=0;return b-e}
|
||||||
function ra(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var J,sa,F,H,G,I,L,ta,ua;function va(a){J=a;d.HEAP8=sa=new Int8Array(a);d.HEAP16=H=new Int16Array(a);d.HEAP32=I=new Int32Array(a);d.HEAPU8=F=new Uint8Array(a);d.HEAPU16=G=new Uint16Array(a);d.HEAPU32=L=new Uint32Array(a);d.HEAPF32=ta=new Float32Array(a);d.HEAPF64=ua=new Float64Array(a)}var wa=d.INITIAL_MEMORY||16777216;d.wasmMemory?E=d.wasmMemory:E=new WebAssembly.Memory({initial:wa/65536,maximum:32768});
|
function ra(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var J,sa,F,H,G,I,L,ta,ua;function va(a){J=a;d.HEAP8=sa=new Int8Array(a);d.HEAP16=H=new Int16Array(a);d.HEAP32=I=new Int32Array(a);d.HEAPU8=F=new Uint8Array(a);d.HEAPU16=G=new Uint16Array(a);d.HEAPU32=L=new Uint32Array(a);d.HEAPF32=ta=new Float32Array(a);d.HEAPF64=ua=new Float64Array(a)}var wa=d.INITIAL_MEMORY||16777216;d.wasmMemory?E=d.wasmMemory:E=new WebAssembly.Memory({initial:wa/65536,maximum:32768});
|
||||||
E&&(J=E.buffer);wa=J.byteLength;va(J);I[3260]=5256080;function M(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.P;"number"===typeof c?void 0===b.L?d.dynCall_v(c):d.dynCall_vi(c,b.L):c(void 0===b.L?null:b.L)}}}var xa=[],ya=[],za=[],Aa=[];function Ba(){var a=d.preRun.shift();xa.unshift(a)}var N=0,Ca=null,P=null;d.preloadedImages={};d.preloadedAudios={};
|
E&&(J=E.buffer);wa=J.byteLength;va(J);I[3260]=5256080;function M(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.P;"number"===typeof c?void 0===b.L?d.dynCall_v(c):d.dynCall_vi(c,b.L):c(void 0===b.L?null:b.L)}}}var xa=[],ya=[],za=[],Aa=[];function Ba(){var a=d.preRun.shift();xa.unshift(a)}var N=0,Ca=null,P=null;d.preloadedImages={};d.preloadedAudios={};
|
||||||
function B(a){if(d.onAbort)d.onAbort(a);fa(a);C(a);ia=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function Da(a){var b=Q;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ea(){return Da("data:application/octet-stream;base64,")}var Q="webp_dec.wasm";if(!Ea()){var Fa=Q;Q=d.locateFile?d.locateFile(Fa,x):x+Fa}
|
function B(a){if(d.onAbort)d.onAbort(a);C(a);ia=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Da(a){var b=Q;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ea(){return Da("data:application/octet-stream;base64,")}var Q="webp_dec.wasm";if(!Ea()){var Fa=Q;Q=d.locateFile?d.locateFile(Fa,x):x+Fa}
|
||||||
function Ga(){try{if(D)return new Uint8Array(D);if(A)return A(Q);throw"both async and sync fetching of the wasm failed";}catch(a){B(a)}}function Ha(){return D||!v&&!w||"function"!==typeof fetch||Da("file://")?new Promise(function(a){a(Ga())}):fetch(Q,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Q+"'";return a.arrayBuffer()}).catch(function(){return Ga()})}ya.push({P:function(){Ia()}});function R(){return 0<R.N}
|
function Ga(){try{if(D)return new Uint8Array(D);if(A)return A(Q);throw"both async and sync fetching of the wasm failed";}catch(a){B(a)}}function Ha(){return D||!v&&!w||"function"!==typeof fetch||Da("file://")?new Promise(function(a){a(Ga())}):fetch(Q,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Q+"'";return a.arrayBuffer()}).catch(function(){return Ga()})}ya.push({P:function(){Ia()}});function R(){return 0<R.N}
|
||||||
function Ja(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 Ka=void 0;function S(a){for(var b="";F[a];)b+=Ka[F[a++]];return b}var T={},U={},V={};function La(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 Ja(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 Ka=void 0;function S(a){for(var b="";F[a];)b+=Ka[F[a++]];return b}var T={},U={},V={};function La(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 Ma(a,b){a=La(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Na(a){var b=Error,c=Ma(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.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}
|
function Ma(a,b){a=La(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Na(a){var b=Error,c=Ma(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.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 Oa=void 0;function W(a){throw new Oa(a);}var Pa=void 0;function Qa(a,b){function c(k){k=b(k);if(k.length!==e.length)throw new Pa("Mismatched type converter count");for(var h=0;h<e.length;++h)X(e[h],k[h])}var e=[];e.forEach(function(k){V[k]=a});var f=Array(a.length),g=[],n=0;a.forEach(function(k,h){U.hasOwnProperty(k)?f[h]=U[k]:(g.push(k),T.hasOwnProperty(k)||(T[k]=[]),T[k].push(function(){f[h]=U[k];++n;n===g.length&&c(f)}))});0===g.length&&c(f)}
|
var Oa=void 0;function W(a){throw new Oa(a);}var Pa=void 0;function Qa(a,b){function c(k){k=b(k);if(k.length!==e.length)throw new Pa("Mismatched type converter count");for(var h=0;h<e.length;++h)X(e[h],k[h])}var e=[];e.forEach(function(k){V[k]=a});var f=Array(a.length),g=[],n=0;a.forEach(function(k,h){U.hasOwnProperty(k)?f[h]=U[k]:(g.push(k),T.hasOwnProperty(k)||(T[k]=[]),T[k].push(function(){f[h]=U[k];++n;n===g.length&&c(f)}))});0===g.length&&c(f)}
|
||||||
function X(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||W('type "'+e+'" must have a positive integer typeid pointer');if(U.hasOwnProperty(a)){if(c.R)return;W("Cannot register type '"+e+"' twice")}U[a]=b;delete V[a];T.hasOwnProperty(a)&&(b=T[a],delete T[a],b.forEach(function(f){f()}))}var Ra=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
function X(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||W('type "'+e+'" must have a positive integer typeid pointer');if(U.hasOwnProperty(a)){if(c.R)return;W("Cannot register type '"+e+"' twice")}U[a]=b;delete V[a];T.hasOwnProperty(a)&&(b=T[a],delete T[a],b.forEach(function(f){f()}))}var Ra=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
function Sa(a){4<a&&0===--Y[a].M&&(Y[a]=void 0,Ra.push(a))}function Va(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Ra.length?Ra.pop():Y.length;Y[b]={M:1,value:a};return b}}function Wa(a){return this.fromWireType(L[a>>2])}function Xa(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
function Sa(a){4<a&&0===--Y[a].M&&(Y[a]=void 0,Ra.push(a))}function Ta(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Ra.length?Ra.pop():Y.length;Y[b]={M:1,value:a};return b}}function Wa(a){return this.fromWireType(L[a>>2])}function Xa(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||||
function Ya(a,b){switch(b){case 2:return function(c){return this.fromWireType(ta[c>>2])};case 3:return function(c){return this.fromWireType(ua[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Za(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=Ma(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
function Ya(a,b){switch(b){case 2:return function(c){return this.fromWireType(ta[c>>2])};case 3:return function(c){return this.fromWireType(ua[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Za(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=Ma(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||||
function $a(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function ab(a,b){var c=d;if(void 0===c[a].J){var e=c[a];c[a]=function(){c[a].J.hasOwnProperty(arguments.length)||W("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].J+")!");return c[a].J[arguments.length].apply(this,arguments)};c[a].J=[];c[a].J[e.O]=e}}
|
function $a(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function ab(a,b){var c=d;if(void 0===c[a].J){var e=c[a];c[a]=function(){c[a].J.hasOwnProperty(arguments.length)||W("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].J+")!");return c[a].J[arguments.length].apply(this,arguments)};c[a].J=[];c[a].J[e.O]=e}}
|
||||||
function bb(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].J&&void 0!==d[a].J[c])&&W("Cannot register public name '"+a+"' twice"),ab(a,a),d.hasOwnProperty(c)&&W("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].J[c]=b):(d[a]=b,void 0!==c&&(d[a].T=c))}function cb(a,b){for(var c=[],e=0;e<a;e++)c.push(I[(b>>2)+e]);return c}
|
function bb(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].J&&void 0!==d[a].J[c])&&W("Cannot register public name '"+a+"' twice"),ab(a,a),d.hasOwnProperty(c)&&W("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].J[c]=b):(d[a]=b,void 0!==c&&(d[a].T=c))}function cb(a,b){for(var c=[],e=0;e<a;e++)c.push(I[(b>>2)+e]);return c}
|
||||||
@@ -32,18 +32,18 @@ function hb(a,b){function c(g){f[g]||U[g]||(V[g]?V[g].forEach(c):(e.push(g),f[g]
|
|||||||
function kb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function lb(a,b){var c=U[a];void 0===c&&W(b+" has unknown type "+fb(a));return c}for(var mb={},nb=Array(256),ob=0;256>ob;++ob)nb[ob]=String.fromCharCode(ob);Ka=nb;Oa=d.BindingError=Na("BindingError");Pa=d.InternalError=Na("InternalError");d.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};
|
function kb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function lb(a,b){var c=U[a];void 0===c&&W(b+" has unknown type "+fb(a));return c}for(var mb={},nb=Array(256),ob=0;256>ob;++ob)nb[ob]=String.fromCharCode(ob);Ka=nb;Oa=d.BindingError=Na("BindingError");Pa=d.InternalError=Na("InternalError");d.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};
|
||||||
d.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};eb=d.UnboundTypeError=Na("UnboundTypeError");
|
d.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};eb=d.UnboundTypeError=Na("UnboundTypeError");
|
||||||
var qb={m:function(a){return pb(a)},i:function(){},l:function(a){"uncaught_exception"in R?R.N++:R.N=1;throw a;},j:function(a,b,c,e,f){var g=Ja(c);b=S(b);X(a,{name:b,fromWireType:function(n){return!!n},toWireType:function(n,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(n){if(1===c)var k=sa;else if(2===c)k=H;else if(4===c)k=I;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[n>>g])},K:null})},r:function(a,b){b=S(b);X(a,{name:b,fromWireType:function(c){var e=
|
var qb={m:function(a){return pb(a)},i:function(){},l:function(a){"uncaught_exception"in R?R.N++:R.N=1;throw a;},j:function(a,b,c,e,f){var g=Ja(c);b=S(b);X(a,{name:b,fromWireType:function(n){return!!n},toWireType:function(n,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(n){if(1===c)var k=sa;else if(2===c)k=H;else if(4===c)k=I;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[n>>g])},K:null})},r:function(a,b){b=S(b);X(a,{name:b,fromWireType:function(c){var e=
|
||||||
Y[c].value;Sa(c);return e},toWireType:function(c,e){return Va(e)},argPackAdvance:8,readValueFromPointer:Wa,K:null})},g:function(a,b,c){c=Ja(c);b=S(b);X(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Xa(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Ya(b,c),K:null})},e:function(a,b,c,e,f,g){var n=cb(b,c);a=S(a);f=db(e,f);bb(a,function(){hb("Cannot call "+a+" due to unbound types",
|
Y[c].value;Sa(c);return e},toWireType:function(c,e){return Ta(e)},argPackAdvance:8,readValueFromPointer:Wa,K:null})},g:function(a,b,c){c=Ja(c);b=S(b);X(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Xa(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Ya(b,c),K:null})},e:function(a,b,c,e,f,g){var n=cb(b,c);a=S(a);f=db(e,f);bb(a,function(){hb("Cannot call "+a+" due to unbound types",
|
||||||
n)},b-1);Qa(n,function(k){var h=[k[0],null].concat(k.slice(1)),p=k=a,q=f,m=h.length;2>m&&W("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var r=null!==h[1]&&!1,y=!1,l=1;l<h.length;++l)if(null!==h[l]&&void 0===h[l].K){y=!0;break}var Ta="void"!==h[0].name,K="",O="";for(l=0;l<m-2;++l)K+=(0!==l?", ":"")+"arg"+l,O+=(0!==l?", ":"")+"arg"+l+"Wired";p="return function "+La(p)+"("+K+") {\nif (arguments.length !== "+(m-2)+") {\nthrowBindingError('function "+p+" called with ' + arguments.length + ' arguments, expected "+
|
n)},b-1);Qa(n,function(k){var h=[k[0],null].concat(k.slice(1)),p=k=a,q=f,m=h.length;2>m&&W("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var r=null!==h[1]&&!1,y=!1,l=1;l<h.length;++l)if(null!==h[l]&&void 0===h[l].K){y=!0;break}var Ua="void"!==h[0].name,K="",O="";for(l=0;l<m-2;++l)K+=(0!==l?", ":"")+"arg"+l,O+=(0!==l?", ":"")+"arg"+l+"Wired";p="return function "+La(p)+"("+K+") {\nif (arguments.length !== "+(m-2)+") {\nthrowBindingError('function "+p+" called with ' + arguments.length + ' arguments, expected "+
|
||||||
(m-2)+" args!');\n}\n";y&&(p+="var destructors = [];\n");var Ua=y?"destructors":"null";K="throwBindingError invoker fn runDestructors retType classParam".split(" ");q=[W,q,g,$a,h[0],h[1]];r&&(p+="var thisWired = classParam.toWireType("+Ua+", this);\n");for(l=0;l<m-2;++l)p+="var arg"+l+"Wired = argType"+l+".toWireType("+Ua+", arg"+l+"); // "+h[l+2].name+"\n",K.push("argType"+l),q.push(h[l+2]);r&&(O="thisWired"+(0<O.length?", ":"")+O);p+=(Ta?"var rv = ":"")+"invoker(fn"+(0<O.length?", ":"")+O+");\n";
|
(m-2)+" args!');\n}\n";y&&(p+="var destructors = [];\n");var Va=y?"destructors":"null";K="throwBindingError invoker fn runDestructors retType classParam".split(" ");q=[W,q,g,$a,h[0],h[1]];r&&(p+="var thisWired = classParam.toWireType("+Va+", this);\n");for(l=0;l<m-2;++l)p+="var arg"+l+"Wired = argType"+l+".toWireType("+Va+", arg"+l+"); // "+h[l+2].name+"\n",K.push("argType"+l),q.push(h[l+2]);r&&(O="thisWired"+(0<O.length?", ":"")+O);p+=(Ua?"var rv = ":"")+"invoker(fn"+(0<O.length?", ":"")+O+");\n";
|
||||||
if(y)p+="runDestructors(destructors);\n";else for(l=r?1:2;l<h.length;++l)m=1===l?"thisWired":"arg"+(l-2)+"Wired",null!==h[l].K&&(p+=m+"_dtor("+m+"); // "+h[l].name+"\n",K.push(m+"_dtor"),q.push(h[l].K));Ta&&(p+="var ret = retType.fromWireType(rv);\nreturn ret;\n");K.push(p+"}\n");h=Za(K).apply(null,q);l=b-1;if(!d.hasOwnProperty(k))throw new Pa("Replacing nonexistant public symbol");void 0!==d[k].J&&void 0!==l?d[k].J[l]=h:(d[k]=h,d[k].O=l);return[]})},b:function(a,b,c,e,f){function g(p){return p}b=
|
if(y)p+="runDestructors(destructors);\n";else for(l=r?1:2;l<h.length;++l)m=1===l?"thisWired":"arg"+(l-2)+"Wired",null!==h[l].K&&(p+=m+"_dtor("+m+"); // "+h[l].name+"\n",K.push(m+"_dtor"),q.push(h[l].K));Ua&&(p+="var ret = retType.fromWireType(rv);\nreturn ret;\n");K.push(p+"}\n");h=Za(K).apply(null,q);l=b-1;if(!d.hasOwnProperty(k))throw new Pa("Replacing nonexistant public symbol");void 0!==d[k].J&&void 0!==l?d[k].J[l]=h:(d[k]=h,d[k].O=l);return[]})},b:function(a,b,c,e,f){function g(p){return p}b=
|
||||||
S(b);-1===f&&(f=4294967295);var n=Ja(c);if(0===e){var k=32-8*c;g=function(p){return p<<k>>>k}}var h=-1!=b.indexOf("unsigned");X(a,{name:b,fromWireType:g,toWireType:function(p,q){if("number"!==typeof q&&"boolean"!==typeof q)throw new TypeError('Cannot convert "'+Xa(q)+'" to '+this.name);if(q<e||q>f)throw new TypeError('Passing a number "'+Xa(q)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return h?q>>>0:q|0},argPackAdvance:8,readValueFromPointer:ib(b,
|
S(b);-1===f&&(f=4294967295);var n=Ja(c);if(0===e){var k=32-8*c;g=function(p){return p<<k>>>k}}var h=-1!=b.indexOf("unsigned");X(a,{name:b,fromWireType:g,toWireType:function(p,q){if("number"!==typeof q&&"boolean"!==typeof q)throw new TypeError('Cannot convert "'+Xa(q)+'" to '+this.name);if(q<e||q>f)throw new TypeError('Passing a number "'+Xa(q)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return h?q>>>0:q|0},argPackAdvance:8,readValueFromPointer:ib(b,
|
||||||
n,0!==e),K:null})},a:function(a,b,c){function e(g){g>>=2;var n=L;return new f(J,n[g+1],n[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=S(c);X(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{R:!0})},h:function(a,b){b=S(b);var c="std::string"===b;X(a,{name:b,fromWireType:function(e){var f=L[e>>2];if(c)for(var g=e+4,n=0;n<=f;++n){var k=e+4+n;if(0==F[k]||n==f){if(g){var h=g;var p=F,q=h+(k-g);for(g=h;p[g]&&!(g>=q);)++g;
|
n,0!==e),K:null})},a:function(a,b,c){function e(g){g>>=2;var n=L;return new f(J,n[g+1],n[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=S(c);X(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{R:!0})},h:function(a,b){b=S(b);var c="std::string"===b;X(a,{name:b,fromWireType:function(e){var f=L[e>>2];if(c)for(var g=e+4,n=0;n<=f;++n){var k=e+4+n;if(n==f||0==F[k]){if(g){var h=g;var p=F,q=h+(k-g);for(g=h;p[g]&&!(g>=q);)++g;
|
||||||
if(16<g-h&&p.subarray&&ja)h=ja.decode(p.subarray(h,g));else{for(q="";h<g;){var m=p[h++];if(m&128){var r=p[h++]&63;if(192==(m&224))q+=String.fromCharCode((m&31)<<6|r);else{var y=p[h++]&63;m=224==(m&240)?(m&15)<<12|r<<6|y:(m&7)<<18|r<<12|y<<6|p[h++]&63;65536>m?q+=String.fromCharCode(m):(m-=65536,q+=String.fromCharCode(55296|m>>10,56320|m&1023))}}else q+=String.fromCharCode(m)}h=q}}else h="";if(void 0===l)var l=h;else l+=String.fromCharCode(0),l+=h;g=k+1}}else{l=Array(f);for(n=0;n<f;++n)l[n]=String.fromCharCode(F[e+
|
if(16<g-h&&p.subarray&&ja)h=ja.decode(p.subarray(h,g));else{for(q="";h<g;){var m=p[h++];if(m&128){var r=p[h++]&63;if(192==(m&224))q+=String.fromCharCode((m&31)<<6|r);else{var y=p[h++]&63;m=224==(m&240)?(m&15)<<12|r<<6|y:(m&7)<<18|r<<12|y<<6|p[h++]&63;65536>m?q+=String.fromCharCode(m):(m-=65536,q+=String.fromCharCode(55296|m>>10,56320|m&1023))}}else q+=String.fromCharCode(m)}h=q}}else h="";if(void 0===l)var l=h;else l+=String.fromCharCode(0),l+=h;g=k+1}}else{l=Array(f);for(n=0;n<f;++n)l[n]=String.fromCharCode(F[e+
|
||||||
4+n]);l=l.join("")}Z(e);return l},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||W("Cannot pass non-string to std::string");var n=(c&&g?function(){for(var p=0,q=0;q<f.length;++q){var m=f.charCodeAt(q);55296<=m&&57343>=m&&(m=65536+((m&1023)<<10)|f.charCodeAt(++q)&1023);127>=m?++p:p=2047>=m?p+2:65535>=m?p+3:p+4}return p}:function(){return f.length})(),k=pb(4+n+1);L[k>>
|
4+n]);l=l.join("")}Z(e);return l},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||W("Cannot pass non-string to std::string");var n=(c&&g?function(){for(var p=0,q=0;q<f.length;++q){var m=f.charCodeAt(q);55296<=m&&57343>=m&&(m=65536+((m&1023)<<10)|f.charCodeAt(++q)&1023);127>=m?++p:p=2047>=m?p+2:65535>=m?p+3:p+4}return p}:function(){return f.length})(),k=pb(4+n+1);L[k>>
|
||||||
2]=n;if(c&&g)ka(f,k+4,n+1);else if(g)for(g=0;g<n;++g){var h=f.charCodeAt(g);255<h&&(Z(k),W("String has UTF-16 code units that do not fit in 8 bits"));F[k+4+g]=h}else for(g=0;g<n;++g)F[k+4+g]=f[g];null!==e&&e.push(Z,k);return k},argPackAdvance:8,readValueFromPointer:Wa,K:function(e){Z(e)}})},d:function(a,b,c){c=S(c);if(2===b){var e=ma;var f=na;var g=oa;var n=function(){return G};var k=1}else 4===b&&(e=pa,f=qa,g=ra,n=function(){return L},k=2);X(a,{name:c,fromWireType:function(h){for(var p=L[h>>2],q=
|
2]=n;if(c&&g)ka(f,k+4,n+1);else if(g)for(g=0;g<n;++g){var h=f.charCodeAt(g);255<h&&(Z(k),W("String has UTF-16 code units that do not fit in 8 bits"));F[k+4+g]=h}else for(g=0;g<n;++g)F[k+4+g]=f[g];null!==e&&e.push(Z,k);return k},argPackAdvance:8,readValueFromPointer:Wa,K:function(e){Z(e)}})},d:function(a,b,c){c=S(c);if(2===b){var e=ma;var f=na;var g=oa;var n=function(){return G};var k=1}else 4===b&&(e=pa,f=qa,g=ra,n=function(){return L},k=2);X(a,{name:c,fromWireType:function(h){for(var p=L[h>>2],q=
|
||||||
n(),m,r=h+4,y=0;y<=p;++y){var l=h+4+y*b;if(0==q[l>>k]||y==p)r=e(r,l-r),void 0===m?m=r:(m+=String.fromCharCode(0),m+=r),r=l+b}Z(h);return m},toWireType:function(h,p){"string"!==typeof p&&W("Cannot pass non-string to C++ string type "+c);var q=g(p),m=pb(4+q+b);L[m>>2]=q>>k;f(p,m+4,q+b);null!==h&&h.push(Z,m);return m},argPackAdvance:8,readValueFromPointer:Wa,K:function(h){Z(h)}})},k:function(a,b){b=S(b);X(a,{S:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},o:Sa,s:function(a){if(0===
|
n(),m,r=h+4,y=0;y<=p;++y){var l=h+4+y*b;if(y==p||0==q[l>>k])r=e(r,l-r),void 0===m?m=r:(m+=String.fromCharCode(0),m+=r),r=l+b}Z(h);return m},toWireType:function(h,p){"string"!==typeof p&&W("Cannot pass non-string to C++ string type "+c);var q=g(p),m=pb(4+q+b);L[m>>2]=q>>k;f(p,m+4,q+b);null!==h&&h.push(Z,m);return m},argPackAdvance:8,readValueFromPointer:Wa,K:function(h){Z(h)}})},k:function(a,b){b=S(b);X(a,{S:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},o:Sa,s:function(a){if(0===
|
||||||
a)return Va(kb());var b=jb[a];a=void 0===b?S(a):b;return Va(kb()[a])},n:function(a){4<a&&(Y[a].M+=1)},f:function(a,b,c,e){a||W("Cannot use deleted val. handle = "+a);a=Y[a].value;var f=mb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var n="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)n+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+
|
a)return Ta(kb());var b=jb[a];a=void 0===b?S(a):b;return Ta(kb()[a])},n:function(a){4<a&&(Y[a].M+=1)},f:function(a,b,c,e){a||W("Cannot use deleted val. handle = "+a);a=Y[a].value;var f=mb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var n="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)n+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+
|
||||||
g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",n+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(lb,d,Va);mb[b]=f}return f(a,c,e)},q:function(){B()},p:function(a,b,c){F.copyWithin(a,b,b+c)},c:function(a){a>>>=0;var b=F.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{E.grow(Math.min(2147483648,e)-J.byteLength+65535>>>
|
g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",n+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(lb,d,Ta);mb[b]=f}return f(a,c,e)},q:function(){B()},p:function(a,b,c){F.copyWithin(a,b,b+c)},c:function(a){a>>>=0;var b=F.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{E.grow(Math.min(2147483648,e)-J.byteLength+65535>>>
|
||||||
16);va(E.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},memory:E,table:ha};
|
16);va(E.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},memory:E,table:ha};
|
||||||
(function(){function a(f){d.asm=f.exports;N--;d.monitorRunDependencies&&d.monitorRunDependencies(N);0==N&&(null!==Ca&&(clearInterval(Ca),Ca=null),P&&(f=P,P=null,f()))}function b(f){a(f.instance)}function c(f){return Ha().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){C("failed to asynchronously prepare wasm: "+g);B(g)})}var e={a:qb};N++;d.monitorRunDependencies&&d.monitorRunDependencies(N);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return C("Module.instantiateWasm callback failed with error: "+
|
(function(){function a(f){d.asm=f.exports;N--;d.monitorRunDependencies&&d.monitorRunDependencies(N);0==N&&(null!==Ca&&(clearInterval(Ca),Ca=null),P&&(f=P,P=null,f()))}function b(f){a(f.instance)}function c(f){return Ha().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){C("failed to asynchronously prepare wasm: "+g);B(g)})}var e={a:qb};N++;d.monitorRunDependencies&&d.monitorRunDependencies(N);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return C("Module.instantiateWasm callback failed with error: "+
|
||||||
f),!1}(function(){if(D||"function"!==typeof WebAssembly.instantiateStreaming||Ea()||Da("file://")||"function"!==typeof fetch)return c(b);fetch(Q,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){C("wasm streaming compile failed: "+g);C("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
f),!1}(function(){if(D||"function"!==typeof WebAssembly.instantiateStreaming||Ea()||Da("file://")||"function"!==typeof fetch)return c(b);fetch(Q,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){C("wasm streaming compile failed: "+g);C("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
||||||
|
|||||||
Binary file not shown.
@@ -14,7 +14,7 @@ int version() {
|
|||||||
thread_local const val Uint8Array = val::global("Uint8Array");
|
thread_local const val Uint8Array = val::global("Uint8Array");
|
||||||
|
|
||||||
val encode(std::string img, int width, int height, WebPConfig config) {
|
val encode(std::string img, int width, int height, WebPConfig config) {
|
||||||
uint8_t* img_in = (uint8_t*)img.c_str();
|
auto img_in = (uint8_t*)img.c_str();
|
||||||
|
|
||||||
// A lot of this is duplicated from Encode in picture_enc.c
|
// A lot of this is duplicated from Encode in picture_enc.c
|
||||||
WebPPicture pic;
|
WebPPicture pic;
|
||||||
@@ -23,7 +23,7 @@ val encode(std::string img, int width, int height, WebPConfig config) {
|
|||||||
|
|
||||||
if (!WebPPictureInit(&pic)) {
|
if (!WebPPictureInit(&pic)) {
|
||||||
// shouldn't happen, except if system installation is broken
|
// shouldn't happen, except if system installation is broken
|
||||||
throw std::runtime_error("Unexpected error");
|
return val::null();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only use use_argb if we really need it, as it's slower.
|
// Only use use_argb if we really need it, as it's slower.
|
||||||
@@ -35,15 +35,10 @@ val encode(std::string img, int width, int height, WebPConfig config) {
|
|||||||
|
|
||||||
WebPMemoryWriterInit(&wrt);
|
WebPMemoryWriterInit(&wrt);
|
||||||
|
|
||||||
ok = WebPPictureImportRGBA(&pic, (uint8_t*)img_in, width * 4) && WebPEncode(&config, &pic);
|
ok = WebPPictureImportRGBA(&pic, img_in, width * 4) && WebPEncode(&config, &pic);
|
||||||
WebPPictureFree(&pic);
|
WebPPictureFree(&pic);
|
||||||
if (!ok) {
|
val js_result = ok ? Uint8Array.new_(typed_memory_view(wrt.size, wrt.mem)) : val::null();
|
||||||
WebPMemoryWriterClear(&wrt);
|
WebPMemoryWriterClear(&wrt);
|
||||||
throw std::runtime_error("Encode failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
val js_result = Uint8Array.new_(typed_memory_view(wrt.size, wrt.mem));
|
|
||||||
WebPFree(wrt.mem);
|
|
||||||
return js_result;
|
return js_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
codecs/webp/enc/webp_enc.d.ts
vendored
4
codecs/webp/enc/webp_enc.d.ts
vendored
@@ -1,7 +1,7 @@
|
|||||||
import { EncodeOptions } from '../../../src/codecs/webp/encoder-meta';
|
import { EncodeOptions } from '../../../src/codecs/webp/encoder-meta';
|
||||||
|
|
||||||
interface WebPModule extends EmscriptenWasm.Module {
|
interface WebPModule extends EmscriptenWasm.Module {
|
||||||
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array;
|
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function(opts: EmscriptenWasm.ModuleOpts): WebPModule;
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<WebPModule>;
|
||||||
|
|||||||
@@ -7,17 +7,17 @@ function(webp_enc) {
|
|||||||
webp_enc = webp_enc || {};
|
webp_enc = webp_enc || {};
|
||||||
|
|
||||||
|
|
||||||
var d;d||(d=typeof webp_enc !== 'undefined' ? webp_enc : {});var aa;d.ready=new Promise(function(a){aa=a});var r={},u;for(u in d)d.hasOwnProperty(u)&&(r[u]=d[u]);var w=!1,x=!1,ba=!1,ca=!1;w="object"===typeof window;x="function"===typeof importScripts;ba="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ca=!w&&!ba&&!x;var y="",A,B,da,ea;
|
var d;d||(d=typeof webp_enc !== 'undefined' ? webp_enc : {});var aa,ba;d.ready=new Promise(function(a,b){aa=a;ba=b});var r={},u;for(u in d)d.hasOwnProperty(u)&&(r[u]=d[u]);var w=!1,x=!1,ca=!1,da=!1;w="object"===typeof window;x="function"===typeof importScripts;ca="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;da=!w&&!ca&&!x;var y="",A,B,ea,fa;
|
||||||
if(ba)y=x?require("path").dirname(y)+"/":__dirname+"/",A=function(a,b){da||(da=require("fs"));ea||(ea=require("path"));a=ea.normalize(a);return da.readFileSync(a,b?null:"utf8")},B=function(a){a=A(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||C("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",C),d.inspect=function(){return"[Emscripten Module object]"};
|
if(ca)y=x?require("path").dirname(y)+"/":__dirname+"/",A=function(a,b){ea||(ea=require("fs"));fa||(fa=require("path"));a=fa.normalize(a);return ea.readFileSync(a,b?null:"utf8")},B=function(a){a=A(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||C("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",C),d.inspect=function(){return"[Emscripten Module object]"};
|
||||||
else if(ca)"undefined"!=typeof read&&(A=function(a){return read(a)}),B=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||C("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(w||x)x?y=self.location.href:document.currentScript&&(y=document.currentScript.src),_scriptDir&&
|
else if(da)"undefined"!=typeof read&&(A=function(a){return read(a)}),B=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||C("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(w||x)x?y=self.location.href:document.currentScript&&(y=document.currentScript.src),_scriptDir&&
|
||||||
(y=_scriptDir),0!==y.indexOf("blob:")?y=y.substr(0,y.lastIndexOf("/")+1):y="",A=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},x&&(B=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var fa=d.print||console.log.bind(console),D=d.printErr||console.warn.bind(console);for(u in r)r.hasOwnProperty(u)&&(d[u]=r[u]);r=null;var E;d.wasmBinary&&(E=d.wasmBinary);var noExitRuntime;
|
(y=_scriptDir),0!==y.indexOf("blob:")?y=y.substr(0,y.lastIndexOf("/")+1):y="",A=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},x&&(B=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});d.print||console.log.bind(console);var D=d.printErr||console.warn.bind(console);for(u in r)r.hasOwnProperty(u)&&(d[u]=r[u]);r=null;var E;d.wasmBinary&&(E=d.wasmBinary);var noExitRuntime;
|
||||||
d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&C("no native wasm support detected");var G,ha=new WebAssembly.Table({initial:128,maximum:128,element:"anyfunc"}),ia=!1,ja="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&C("no native wasm support detected");var G,ha=new WebAssembly.Table({initial:125,maximum:125,element:"anyfunc"}),ia=!1,ja="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||||
function la(a,b,c){var e=H;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var ma="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
function la(a,b,c){var e=H;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var ma="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||||
function na(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&I[c];)++c;c<<=1;if(32<c-a&&ma)return ma.decode(H.subarray(a,c));c=0;for(e="";;){var f=J[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function oa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)J[b>>1]=a.charCodeAt(f),b+=2;J[b>>1]=0;return b-e}function pa(a){return 2*a.length}
|
function na(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&I[c];)++c;c<<=1;if(32<c-a&&ma)return ma.decode(H.subarray(a,c));c=0;for(e="";;){var f=J[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function oa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)J[b>>1]=a.charCodeAt(f),b+=2;J[b>>1]=0;return b-e}function pa(a){return 2*a.length}
|
||||||
function qa(a,b){for(var c=0,e="";!(c>=b/4);){var f=K[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function ra(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}K[b>>2]=g;b+=4;if(b+4>c)break}K[b>>2]=0;return b-e}
|
function qa(a,b){for(var c=0,e="";!(c>=b/4);){var f=K[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function ra(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}K[b>>2]=g;b+=4;if(b+4>c)break}K[b>>2]=0;return b-e}
|
||||||
function sa(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var L,M,H,J,I,K,N,ta,ua;function va(a){L=a;d.HEAP8=M=new Int8Array(a);d.HEAP16=J=new Int16Array(a);d.HEAP32=K=new Int32Array(a);d.HEAPU8=H=new Uint8Array(a);d.HEAPU16=I=new Uint16Array(a);d.HEAPU32=N=new Uint32Array(a);d.HEAPF32=ta=new Float32Array(a);d.HEAPF64=ua=new Float64Array(a)}var wa=d.INITIAL_MEMORY||16777216;d.wasmMemory?G=d.wasmMemory:G=new WebAssembly.Memory({initial:wa/65536,maximum:32768});
|
function sa(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var L,M,H,J,I,K,N,ta,ua;function va(a){L=a;d.HEAP8=M=new Int8Array(a);d.HEAP16=J=new Int16Array(a);d.HEAP32=K=new Int32Array(a);d.HEAPU8=H=new Uint8Array(a);d.HEAPU16=I=new Uint16Array(a);d.HEAPU32=N=new Uint32Array(a);d.HEAPF32=ta=new Float32Array(a);d.HEAPF64=ua=new Float64Array(a)}var wa=d.INITIAL_MEMORY||16777216;d.wasmMemory?G=d.wasmMemory:G=new WebAssembly.Memory({initial:wa/65536,maximum:32768});
|
||||||
G&&(L=G.buffer);wa=L.byteLength;va(L);K[8668]=5277712;function xa(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.Z;"number"===typeof c?void 0===b.T?d.dynCall_v(c):d.dynCall_vi(c,b.T):c(void 0===b.T?null:b.T)}}}var ya=[],za=[],Aa=[],Ba=[];function Ca(){var a=d.preRun.shift();ya.unshift(a)}var O=0,Da=null,P=null;d.preloadedImages={};d.preloadedAudios={};
|
G&&(L=G.buffer);wa=L.byteLength;va(L);K[8648]=5277632;function xa(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.Z;"number"===typeof c?void 0===b.T?d.dynCall_v(c):d.dynCall_vi(c,b.T):c(void 0===b.T?null:b.T)}}}var ya=[],za=[],Aa=[],Ba=[];function Ca(){var a=d.preRun.shift();ya.unshift(a)}var O=0,Da=null,P=null;d.preloadedImages={};d.preloadedAudios={};
|
||||||
function C(a){if(d.onAbort)d.onAbort(a);fa(a);D(a);ia=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function Ea(a){var b=Q;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Fa(){return Ea("data:application/octet-stream;base64,")}var Q="webp_enc.wasm";if(!Fa()){var Ga=Q;Q=d.locateFile?d.locateFile(Ga,y):y+Ga}
|
function C(a){if(d.onAbort)d.onAbort(a);D(a);ia=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Ea(a){var b=Q;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Fa(){return Ea("data:application/octet-stream;base64,")}var Q="webp_enc.wasm";if(!Fa()){var Ga=Q;Q=d.locateFile?d.locateFile(Ga,y):y+Ga}
|
||||||
function Ha(){try{if(E)return new Uint8Array(E);if(B)return B(Q);throw"both async and sync fetching of the wasm failed";}catch(a){C(a)}}function Ia(){return E||!w&&!x||"function"!==typeof fetch||Ea("file://")?new Promise(function(a){a(Ha())}):fetch(Q,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Q+"'";return a.arrayBuffer()}).catch(function(){return Ha()})}za.push({Z:function(){Ja()}});function Ka(){return 0<Ka.V}var La={};
|
function Ha(){try{if(E)return new Uint8Array(E);if(B)return B(Q);throw"both async and sync fetching of the wasm failed";}catch(a){C(a)}}function Ia(){return E||!w&&!x||"function"!==typeof fetch||Ea("file://")?new Promise(function(a){a(Ha())}):fetch(Q,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Q+"'";return a.arrayBuffer()}).catch(function(){return Ha()})}za.push({Z:function(){Ja()}});function Ka(){return 0<Ka.V}var La={};
|
||||||
function Ma(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Na(a){return this.fromWireType(N[a>>2])}var R={},S={},Oa={};function Pa(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 Qa(a,b){a=Pa(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
function Ma(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Na(a){return this.fromWireType(N[a>>2])}var R={},S={},Oa={};function Pa(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 Qa(a,b){a=Pa(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||||
function Ra(a){var b=Error,c=Qa(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.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 Sa=void 0;
|
function Ra(a){var b=Error,c=Qa(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.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 Sa=void 0;
|
||||||
@@ -33,22 +33,22 @@ function hb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("n
|
|||||||
function Z(a,b){a=U(a);var c=d["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&V("unknown function pointer with signature "+a+": "+b);return c}var jb=void 0;
|
function Z(a,b){a=U(a);var c=d["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&V("unknown function pointer with signature "+a+": "+b);return c}var jb=void 0;
|
||||||
function kb(a,b){function c(g){f[g]||S[g]||(Oa[g]?Oa[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new jb(a+": "+e.map(cb).join([", "]));}function lb(a,b,c){switch(b){case 0:return c?function(e){return M[e]}:function(e){return H[e]};case 1:return c?function(e){return J[e>>1]}:function(e){return I[e>>1]};case 2:return c?function(e){return K[e>>2]}:function(e){return N[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var mb={};
|
function kb(a,b){function c(g){f[g]||S[g]||(Oa[g]?Oa[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new jb(a+": "+e.map(cb).join([", "]));}function lb(a,b,c){switch(b){case 0:return c?function(e){return M[e]}:function(e){return H[e]};case 1:return c?function(e){return J[e>>1]}:function(e){return I[e>>1]};case 2:return c?function(e){return K[e>>2]}:function(e){return N[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var mb={};
|
||||||
function nb(){return"object"===typeof globalThis?globalThis:Function("return this")()}var ob={};Sa=d.InternalError=Ra("InternalError");for(var pb=Array(256),qb=0;256>qb;++qb)pb[qb]=String.fromCharCode(qb);Va=pb;Wa=d.BindingError=Ra("BindingError");d.count_emval_handles=function(){for(var a=0,b=5;b<X.length;++b)void 0!==X[b]&&++a;return a};d.get_first_emval=function(){for(var a=5;a<X.length;++a)if(void 0!==X[a])return X[a];return null};jb=d.UnboundTypeError=Ra("UnboundTypeError");
|
function nb(){return"object"===typeof globalThis?globalThis:Function("return this")()}var ob={};Sa=d.InternalError=Ra("InternalError");for(var pb=Array(256),qb=0;256>qb;++qb)pb[qb]=String.fromCharCode(qb);Va=pb;Wa=d.BindingError=Ra("BindingError");d.count_emval_handles=function(){for(var a=0,b=5;b<X.length;++b)void 0!==X[b]&&++a;return a};d.get_first_emval=function(){for(var a=5;a<X.length;++a)if(void 0!==X[a])return X[a];return null};jb=d.UnboundTypeError=Ra("UnboundTypeError");
|
||||||
var sb={j:function(a){return rb(a)},x:function(){},f:function(a){"uncaught_exception"in Ka?Ka.V++:Ka.V=1;throw a;},k:function(a){var b=La[a];delete La[a];var c=b.ea,e=b.fa,f=b.W,g=f.map(function(l){return l.ba}).concat(f.map(function(l){return l.ha}));Ta([a],g,function(l){var k={};f.forEach(function(h,m){var q=l[m],n=h.$,t=h.aa,v=l[m+f.length],p=h.ga,ka=h.ia;k[h.Y]={read:function(z){return q.fromWireType(n(t,z))},write:function(z,F){var W=[];p(ka,z,v.toWireType(W,F));Ma(W)}}});return[{name:b.name,
|
var sb={u:function(a){return rb(a)},x:function(){},t:function(a){"uncaught_exception"in Ka?Ka.V++:Ka.V=1;throw a;},i:function(a){var b=La[a];delete La[a];var c=b.ea,e=b.fa,f=b.W,g=f.map(function(l){return l.ba}).concat(f.map(function(l){return l.ha}));Ta([a],g,function(l){var k={};f.forEach(function(h,m){var q=l[m],n=h.$,t=h.aa,v=l[m+f.length],p=h.ga,ka=h.ia;k[h.Y]={read:function(z){return q.fromWireType(n(t,z))},write:function(z,F){var W=[];p(ka,z,v.toWireType(W,F));Ma(W)}}});return[{name:b.name,
|
||||||
fromWireType:function(h){var m={},q;for(q in k)m[q]=k[q].read(h);e(h);return m},toWireType:function(h,m){for(var q in k)if(!(q in m))throw new TypeError('Missing field: "'+q+'"');var n=c();for(q in k)k[q].write(n,m[q]);null!==h&&h.push(e,n);return n},argPackAdvance:8,readValueFromPointer:Na,R:e}]})},u:function(a,b,c,e,f){var g=Ua(c);b=U(b);T(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=M;else if(2===
|
fromWireType:function(h){var m={},q;for(q in k)m[q]=k[q].read(h);e(h);return m},toWireType:function(h,m){for(var q in k)if(!(q in m))throw new TypeError('Missing field: "'+q+'"');var n=c();for(q in k)k[q].write(n,m[q]);null!==h&&h.push(e,n);return n},argPackAdvance:8,readValueFromPointer:Na,R:e}]})},r:function(a,b,c,e,f){var g=Ua(c);b=U(b);T(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=M;else if(2===
|
||||||
c)k=J;else if(4===c)k=K;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>g])},R:null})},t:function(a,b){b=U(b);T(a,{name:b,fromWireType:function(c){var e=X[c].value;Ya(c);return e},toWireType:function(c,e){return Za(e)},argPackAdvance:8,readValueFromPointer:Na,R:null})},n:function(a,b,c,e){function f(){}c=Ua(c);b=U(b);f.values={};T(a,{name:b,constructor:f,fromWireType:function(g){return this.constructor.values[g]},toWireType:function(g,l){return l.value},argPackAdvance:8,
|
c)k=J;else if(4===c)k=K;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>g])},R:null})},q:function(a,b){b=U(b);T(a,{name:b,fromWireType:function(c){var e=X[c].value;Ya(c);return e},toWireType:function(c,e){return Za(e)},argPackAdvance:8,readValueFromPointer:Na,R:null})},l:function(a,b,c,e){function f(){}c=Ua(c);b=U(b);f.values={};T(a,{name:b,constructor:f,fromWireType:function(g){return this.constructor.values[g]},toWireType:function(g,l){return l.value},argPackAdvance:8,
|
||||||
readValueFromPointer:bb(b,c,e),R:null});ab(b,f)},m:function(a,b,c){var e=eb(a,"enum");b=U(b);a=e.constructor;e=Object.create(e.constructor.prototype,{value:{value:c},constructor:{value:Qa(e.name+"_"+b,function(){})}});a.values[c]=e;a[b]=e},g:function(a,b,c){c=Ua(c);b=U(b);T(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+fb(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:gb(b,
|
readValueFromPointer:bb(b,c,e),R:null});ab(b,f)},k:function(a,b,c){var e=eb(a,"enum");b=U(b);a=e.constructor;e=Object.create(e.constructor.prototype,{value:{value:c},constructor:{value:Qa(e.name+"_"+b,function(){})}});a.values[c]=e;a[b]=e},g:function(a,b,c){c=Ua(c);b=U(b);T(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+fb(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:gb(b,
|
||||||
c),R:null})},i:function(a,b,c,e,f,g){var l=ib(b,c);a=U(a);f=Z(e,f);ab(a,function(){kb("Cannot call "+a+" due to unbound types",l)},b-1);Ta([],l,function(k){var h=[k[0],null].concat(k.slice(1)),m=k=a,q=f,n=h.length;2>n&&V("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var t=null!==h[1]&&!1,v=!1,p=1;p<h.length;++p)if(null!==h[p]&&void 0===h[p].R){v=!0;break}var ka="void"!==h[0].name,z="",F="";for(p=0;p<n-2;++p)z+=(0!==p?", ":"")+"arg"+p,F+=(0!==p?", ":"")+"arg"+
|
c),R:null})},f:function(a,b,c,e,f,g){var l=ib(b,c);a=U(a);f=Z(e,f);ab(a,function(){kb("Cannot call "+a+" due to unbound types",l)},b-1);Ta([],l,function(k){var h=[k[0],null].concat(k.slice(1)),m=k=a,q=f,n=h.length;2>n&&V("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var t=null!==h[1]&&!1,v=!1,p=1;p<h.length;++p)if(null!==h[p]&&void 0===h[p].R){v=!0;break}var ka="void"!==h[0].name,z="",F="";for(p=0;p<n-2;++p)z+=(0!==p?", ":"")+"arg"+p,F+=(0!==p?", ":"")+"arg"+
|
||||||
p+"Wired";m="return function "+Pa(m)+"("+z+") {\nif (arguments.length !== "+(n-2)+") {\nthrowBindingError('function "+m+" called with ' + arguments.length + ' arguments, expected "+(n-2)+" args!');\n}\n";v&&(m+="var destructors = [];\n");var W=v?"destructors":"null";z="throwBindingError invoker fn runDestructors retType classParam".split(" ");q=[V,q,g,Ma,h[0],h[1]];t&&(m+="var thisWired = classParam.toWireType("+W+", this);\n");for(p=0;p<n-2;++p)m+="var arg"+p+"Wired = argType"+p+".toWireType("+W+
|
p+"Wired";m="return function "+Pa(m)+"("+z+") {\nif (arguments.length !== "+(n-2)+") {\nthrowBindingError('function "+m+" called with ' + arguments.length + ' arguments, expected "+(n-2)+" args!');\n}\n";v&&(m+="var destructors = [];\n");var W=v?"destructors":"null";z="throwBindingError invoker fn runDestructors retType classParam".split(" ");q=[V,q,g,Ma,h[0],h[1]];t&&(m+="var thisWired = classParam.toWireType("+W+", this);\n");for(p=0;p<n-2;++p)m+="var arg"+p+"Wired = argType"+p+".toWireType("+W+
|
||||||
", arg"+p+"); // "+h[p+2].name+"\n",z.push("argType"+p),q.push(h[p+2]);t&&(F="thisWired"+(0<F.length?", ":"")+F);m+=(ka?"var rv = ":"")+"invoker(fn"+(0<F.length?", ":"")+F+");\n";if(v)m+="runDestructors(destructors);\n";else for(p=t?1:2;p<h.length;++p)n=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==h[p].R&&(m+=n+"_dtor("+n+"); // "+h[p].name+"\n",z.push(n+"_dtor"),q.push(h[p].R));ka&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");z.push(m+"}\n");h=hb(z).apply(null,q);p=b-1;if(!d.hasOwnProperty(k))throw new Sa("Replacing nonexistant public symbol");
|
", arg"+p+"); // "+h[p+2].name+"\n",z.push("argType"+p),q.push(h[p+2]);t&&(F="thisWired"+(0<F.length?", ":"")+F);m+=(ka?"var rv = ":"")+"invoker(fn"+(0<F.length?", ":"")+F+");\n";if(v)m+="runDestructors(destructors);\n";else for(p=t?1:2;p<h.length;++p)n=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==h[p].R&&(m+=n+"_dtor("+n+"); // "+h[p].name+"\n",z.push(n+"_dtor"),q.push(h[p].R));ka&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");z.push(m+"}\n");h=hb(z).apply(null,q);p=b-1;if(!d.hasOwnProperty(k))throw new Sa("Replacing nonexistant public symbol");
|
||||||
void 0!==d[k].S&&void 0!==p?d[k].S[p]=h:(d[k]=h,d[k].X=p);return[]})},b:function(a,b,c,e,f){function g(m){return m}b=U(b);-1===f&&(f=4294967295);var l=Ua(c);if(0===e){var k=32-8*c;g=function(m){return m<<k>>>k}}var h=-1!=b.indexOf("unsigned");T(a,{name:b,fromWireType:g,toWireType:function(m,q){if("number"!==typeof q&&"boolean"!==typeof q)throw new TypeError('Cannot convert "'+fb(q)+'" to '+this.name);if(q<e||q>f)throw new TypeError('Passing a number "'+fb(q)+'" from JS side to C/C++ side to an argument of type "'+
|
void 0!==d[k].S&&void 0!==p?d[k].S[p]=h:(d[k]=h,d[k].X=p);return[]})},b:function(a,b,c,e,f){function g(m){return m}b=U(b);-1===f&&(f=4294967295);var l=Ua(c);if(0===e){var k=32-8*c;g=function(m){return m<<k>>>k}}var h=-1!=b.indexOf("unsigned");T(a,{name:b,fromWireType:g,toWireType:function(m,q){if("number"!==typeof q&&"boolean"!==typeof q)throw new TypeError('Cannot convert "'+fb(q)+'" to '+this.name);if(q<e||q>f)throw new TypeError('Passing a number "'+fb(q)+'" from JS side to C/C++ side to an argument of type "'+
|
||||||
b+'", which is outside the valid range ['+e+", "+f+"]!");return h?q>>>0:q|0},argPackAdvance:8,readValueFromPointer:lb(b,l,0!==e),R:null})},a:function(a,b,c){function e(g){g>>=2;var l=N;return new f(L,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=U(c);T(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{da:!0})},h:function(a,b){b=U(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(e){var f=N[e>>2];if(c)for(var g=
|
b+'", which is outside the valid range ['+e+", "+f+"]!");return h?q>>>0:q|0},argPackAdvance:8,readValueFromPointer:lb(b,l,0!==e),R:null})},a:function(a,b,c){function e(g){g>>=2;var l=N;return new f(L,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=U(c);T(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{da:!0})},h:function(a,b){b=U(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(e){var f=N[e>>2];if(c)for(var g=
|
||||||
e+4,l=0;l<=f;++l){var k=e+4+l;if(0==H[k]||l==f){if(g){var h=g;var m=H,q=h+(k-g);for(g=h;m[g]&&!(g>=q);)++g;if(16<g-h&&m.subarray&&ja)h=ja.decode(m.subarray(h,g));else{for(q="";h<g;){var n=m[h++];if(n&128){var t=m[h++]&63;if(192==(n&224))q+=String.fromCharCode((n&31)<<6|t);else{var v=m[h++]&63;n=224==(n&240)?(n&15)<<12|t<<6|v:(n&7)<<18|t<<12|v<<6|m[h++]&63;65536>n?q+=String.fromCharCode(n):(n-=65536,q+=String.fromCharCode(55296|n>>10,56320|n&1023))}}else q+=String.fromCharCode(n)}h=q}}else h="";if(void 0===
|
e+4,l=0;l<=f;++l){var k=e+4+l;if(l==f||0==H[k]){if(g){var h=g;var m=H,q=h+(k-g);for(g=h;m[g]&&!(g>=q);)++g;if(16<g-h&&m.subarray&&ja)h=ja.decode(m.subarray(h,g));else{for(q="";h<g;){var n=m[h++];if(n&128){var t=m[h++]&63;if(192==(n&224))q+=String.fromCharCode((n&31)<<6|t);else{var v=m[h++]&63;n=224==(n&240)?(n&15)<<12|t<<6|v:(n&7)<<18|t<<12|v<<6|m[h++]&63;65536>n?q+=String.fromCharCode(n):(n-=65536,q+=String.fromCharCode(55296|n>>10,56320|n&1023))}}else q+=String.fromCharCode(n)}h=q}}else h="";if(void 0===
|
||||||
p)var p=h;else p+=String.fromCharCode(0),p+=h;g=k+1}}else{p=Array(f);for(l=0;l<f;++l)p[l]=String.fromCharCode(H[e+4+l]);p=p.join("")}Y(e);return p},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||V("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var m=0,q=0;q<f.length;++q){var n=f.charCodeAt(q);55296<=n&&57343>=n&&(n=65536+((n&1023)<<10)|f.charCodeAt(++q)&
|
p)var p=h;else p+=String.fromCharCode(0),p+=h;g=k+1}}else{p=Array(f);for(l=0;l<f;++l)p[l]=String.fromCharCode(H[e+4+l]);p=p.join("")}Y(e);return p},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||V("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var m=0,q=0;q<f.length;++q){var n=f.charCodeAt(q);55296<=n&&57343>=n&&(n=65536+((n&1023)<<10)|f.charCodeAt(++q)&
|
||||||
1023);127>=n?++m:m=2047>=n?m+2:65535>=n?m+3:m+4}return m}:function(){return f.length})(),k=rb(4+l+1);N[k>>2]=l;if(c&&g)la(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var h=f.charCodeAt(g);255<h&&(Y(k),V("String has UTF-16 code units that do not fit in 8 bits"));H[k+4+g]=h}else for(g=0;g<l;++g)H[k+4+g]=f[g];null!==e&&e.push(Y,k);return k},argPackAdvance:8,readValueFromPointer:Na,R:function(e){Y(e)}})},d:function(a,b,c){c=U(c);if(2===b){var e=na;var f=oa;var g=pa;var l=function(){return I};var k=1}else 4===
|
1023);127>=n?++m:m=2047>=n?m+2:65535>=n?m+3:m+4}return m}:function(){return f.length})(),k=rb(4+l+1);N[k>>2]=l;if(c&&g)la(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var h=f.charCodeAt(g);255<h&&(Y(k),V("String has UTF-16 code units that do not fit in 8 bits"));H[k+4+g]=h}else for(g=0;g<l;++g)H[k+4+g]=f[g];null!==e&&e.push(Y,k);return k},argPackAdvance:8,readValueFromPointer:Na,R:function(e){Y(e)}})},e:function(a,b,c){c=U(c);if(2===b){var e=na;var f=oa;var g=pa;var l=function(){return I};var k=1}else 4===
|
||||||
b&&(e=qa,f=ra,g=sa,l=function(){return N},k=2);T(a,{name:c,fromWireType:function(h){for(var m=N[h>>2],q=l(),n,t=h+4,v=0;v<=m;++v){var p=h+4+v*b;if(0==q[p>>k]||v==m)t=e(t,p-t),void 0===n?n=t:(n+=String.fromCharCode(0),n+=t),t=p+b}Y(h);return n},toWireType:function(h,m){"string"!==typeof m&&V("Cannot pass non-string to C++ string type "+c);var q=g(m),n=rb(4+q+b);N[n>>2]=q>>k;f(m,n+4,q+b);null!==h&&h.push(Y,n);return n},argPackAdvance:8,readValueFromPointer:Na,R:function(h){Y(h)}})},l:function(a,b,c,
|
b&&(e=qa,f=ra,g=sa,l=function(){return N},k=2);T(a,{name:c,fromWireType:function(h){for(var m=N[h>>2],q=l(),n,t=h+4,v=0;v<=m;++v){var p=h+4+v*b;if(v==m||0==q[p>>k])t=e(t,p-t),void 0===n?n=t:(n+=String.fromCharCode(0),n+=t),t=p+b}Y(h);return n},toWireType:function(h,m){"string"!==typeof m&&V("Cannot pass non-string to C++ string type "+c);var q=g(m),n=rb(4+q+b);N[n>>2]=q>>k;f(m,n+4,q+b);null!==h&&h.push(Y,n);return n},argPackAdvance:8,readValueFromPointer:Na,R:function(h){Y(h)}})},j:function(a,b,c,
|
||||||
e,f,g){La[a]={name:U(b),ea:Z(c,e),fa:Z(f,g),W:[]}},e:function(a,b,c,e,f,g,l,k,h,m){La[a].W.push({Y:U(b),ba:c,$:Z(e,f),aa:g,ha:l,ga:Z(k,h),ia:m})},v:function(a,b){b=U(b);T(a,{ja:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},p:Ya,q:function(a){if(0===a)return Za(nb());var b=mb[a];a=void 0===b?U(a):b;return Za(nb()[a])},w:function(a){4<a&&(X[a].U+=1)},o:function(a,b,c,e){a||V("Cannot use deleted val. handle = "+a);a=X[a].value;var f=ob[b];if(!f){f="";for(var g=0;g<b;++g)f+=
|
e,f,g){La[a]={name:U(b),ea:Z(c,e),fa:Z(f,g),W:[]}},d:function(a,b,c,e,f,g,l,k,h,m){La[a].W.push({Y:U(b),ba:c,$:Z(e,f),aa:g,ha:l,ga:Z(k,h),ia:m})},s:function(a,b){b=U(b);T(a,{ja:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},p:Ya,w:function(a){if(0===a)return Za(nb());var b=mb[a];a=void 0===b?U(a):b;return Za(nb()[a])},v:function(a){4<a&&(X[a].U+=1)},m:function(a,b,c,e){a||V("Cannot use deleted val. handle = "+a);a=X[a].value;var f=ob[b];if(!f){f="";for(var g=0;g<b;++g)f+=
|
||||||
(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(eb,d,Za);ob[b]=f}return f(a,
|
(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(eb,d,Za);ob[b]=f}return f(a,
|
||||||
c,e)},s:function(){C()},r:function(a,b,c){H.copyWithin(a,b,b+c)},c:function(a){a>>>=0;var b=H.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{G.grow(Math.min(2147483648,e)-L.byteLength+65535>>>16);va(G.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},memory:G,table:ha};
|
c,e)},o:function(){C()},n:function(a,b,c){H.copyWithin(a,b,b+c)},c:function(a){a>>>=0;var b=H.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{G.grow(Math.min(2147483648,e)-L.byteLength+65535>>>16);va(G.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},memory:G,table:ha};
|
||||||
(function(){function a(f){d.asm=f.exports;O--;d.monitorRunDependencies&&d.monitorRunDependencies(O);0==O&&(null!==Da&&(clearInterval(Da),Da=null),P&&(f=P,P=null,f()))}function b(f){a(f.instance)}function c(f){return Ia().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){D("failed to asynchronously prepare wasm: "+g);C(g)})}var e={a:sb};O++;d.monitorRunDependencies&&d.monitorRunDependencies(O);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return D("Module.instantiateWasm callback failed with error: "+
|
(function(){function a(f){d.asm=f.exports;O--;d.monitorRunDependencies&&d.monitorRunDependencies(O);0==O&&(null!==Da&&(clearInterval(Da),Da=null),P&&(f=P,P=null,f()))}function b(f){a(f.instance)}function c(f){return Ia().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){D("failed to asynchronously prepare wasm: "+g);C(g)})}var e={a:sb};O++;d.monitorRunDependencies&&d.monitorRunDependencies(O);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return D("Module.instantiateWasm callback failed with error: "+
|
||||||
f),!1}(function(){if(E||"function"!==typeof WebAssembly.instantiateStreaming||Fa()||Ea("file://")||"function"!==typeof fetch)return c(b);fetch(Q,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){D("wasm streaming compile failed: "+g);D("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
f),!1}(function(){if(E||"function"!==typeof WebAssembly.instantiateStreaming||Fa()||Ea("file://")||"function"!==typeof fetch)return c(b);fetch(Q,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){D("wasm streaming compile failed: "+g);D("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
||||||
var Ja=d.___wasm_call_ctors=function(){return(Ja=d.___wasm_call_ctors=d.asm.y).apply(null,arguments)},rb=d._malloc=function(){return(rb=d._malloc=d.asm.z).apply(null,arguments)},Y=d._free=function(){return(Y=d._free=d.asm.A).apply(null,arguments)},db=d.___getTypeName=function(){return(db=d.___getTypeName=d.asm.B).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.C).apply(null,arguments)};
|
var Ja=d.___wasm_call_ctors=function(){return(Ja=d.___wasm_call_ctors=d.asm.y).apply(null,arguments)},rb=d._malloc=function(){return(rb=d._malloc=d.asm.z).apply(null,arguments)},Y=d._free=function(){return(Y=d._free=d.asm.A).apply(null,arguments)},db=d.___getTypeName=function(){return(db=d.___getTypeName=d.asm.B).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.C).apply(null,arguments)};
|
||||||
|
|||||||
Binary file not shown.
1
emscripten-wasm.d.ts
vendored
1
emscripten-wasm.d.ts
vendored
@@ -6,6 +6,7 @@ declare namespace EmscriptenWasm {
|
|||||||
// Options object for modularized Emscripten files. Shoe-horned by @surma.
|
// Options object for modularized Emscripten files. Shoe-horned by @surma.
|
||||||
// FIXME: This an incomplete definition!
|
// FIXME: This an incomplete definition!
|
||||||
interface ModuleOpts {
|
interface ModuleOpts {
|
||||||
|
mainScriptUrlOrBlob?: string;
|
||||||
noInitialRun?: boolean;
|
noInitialRun?: boolean;
|
||||||
locateFile?: (url: string) => string;
|
locateFile?: (url: string) => string;
|
||||||
onRuntimeInitialized?: () => void;
|
onRuntimeInitialized?: () => void;
|
||||||
|
|||||||
253
package-lock.json
generated
253
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "squoosh",
|
"name": "squoosh",
|
||||||
"version": "1.11.4",
|
"version": "1.12.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -4639,6 +4639,12 @@
|
|||||||
"minimalistic-crypto-utils": "^1.0.0"
|
"minimalistic-crypto-utils": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"emoji-regex": {
|
||||||
|
"version": "7.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
||||||
|
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"emojis-list": {
|
"emojis-list": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",
|
||||||
@@ -6392,22 +6398,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"globule": {
|
"globule": {
|
||||||
"version": "1.3.1",
|
"version": "1.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/globule/-/globule-1.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/globule/-/globule-1.3.2.tgz",
|
||||||
"integrity": "sha512-OVyWOHgw29yosRHCHo7NncwR1hW5ew0W/UrvtwvjefVJeQ26q4/8r8FmPsSF1hJ93IgWkyv16pCTz6WblMzm/g==",
|
"integrity": "sha512-7IDTQTIu2xzXkT+6mlluidnWo+BypnbSoEVVQCGfzqnl5Ik8d3e1d4wycb8Rj9tWW+Z39uPWsdlquqiqPCd/pA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"glob": "~7.1.1",
|
"glob": "~7.1.1",
|
||||||
"lodash": "~4.17.12",
|
"lodash": "~4.17.10",
|
||||||
"minimatch": "~3.0.2"
|
"minimatch": "~3.0.2"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"lodash": {
|
|
||||||
"version": "4.17.15",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
|
||||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"got": {
|
"got": {
|
||||||
@@ -7451,7 +7449,7 @@
|
|||||||
},
|
},
|
||||||
"is-obj": {
|
"is-obj": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
|
||||||
"integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=",
|
"integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
@@ -8603,9 +8601,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"js-base64": {
|
"js-base64": {
|
||||||
"version": "2.5.2",
|
"version": "2.6.4",
|
||||||
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz",
|
||||||
"integrity": "sha512-Vg8czh0Q7sFBSUMWWArX/miJeBWYBPpdU/3M/DKSaekLMqrqVPaedp+5mZhie/r0lgrcaYBfwXatEew6gwgiQQ==",
|
"integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"js-levenshtein": {
|
"js-levenshtein": {
|
||||||
@@ -9785,9 +9783,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node-sass": {
|
"node-sass": {
|
||||||
"version": "4.13.0",
|
"version": "4.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.13.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz",
|
||||||
"integrity": "sha512-W1XBrvoJ1dy7VsvTAS5q1V45lREbTlZQqFbiHb3R3OTTCma0XBtuG6xZ6Z4506nR4lmHPTqVRwxT6KgtWC97CA==",
|
"integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"async-foreach": "^0.1.3",
|
"async-foreach": "^0.1.3",
|
||||||
@@ -9804,15 +9802,15 @@
|
|||||||
"node-gyp": "^3.8.0",
|
"node-gyp": "^3.8.0",
|
||||||
"npmlog": "^4.0.0",
|
"npmlog": "^4.0.0",
|
||||||
"request": "^2.88.0",
|
"request": "^2.88.0",
|
||||||
"sass-graph": "^2.2.4",
|
"sass-graph": "2.2.5",
|
||||||
"stdout-stream": "^1.4.0",
|
"stdout-stream": "^1.4.0",
|
||||||
"true-case-path": "^1.0.2"
|
"true-case-path": "^1.0.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ajv": {
|
"ajv": {
|
||||||
"version": "6.12.0",
|
"version": "6.12.5",
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz",
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz",
|
||||||
"integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==",
|
"integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"fast-deep-equal": "^3.1.1",
|
"fast-deep-equal": "^3.1.1",
|
||||||
@@ -9857,9 +9855,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"fast-deep-equal": {
|
"fast-deep-equal": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||||
"integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==",
|
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"get-stdin": {
|
"get-stdin": {
|
||||||
@@ -9869,25 +9867,25 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"har-validator": {
|
"har-validator": {
|
||||||
"version": "5.1.3",
|
"version": "5.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz",
|
||||||
"integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==",
|
"integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ajv": "^6.5.5",
|
"ajv": "^6.12.3",
|
||||||
"har-schema": "^2.0.0"
|
"har-schema": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lodash": {
|
"lodash": {
|
||||||
"version": "4.17.15",
|
"version": "4.17.20",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
|
||||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"nan": {
|
"nan": {
|
||||||
"version": "2.14.0",
|
"version": "2.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
|
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
|
||||||
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==",
|
"integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"oauth-sign": {
|
"oauth-sign": {
|
||||||
@@ -10246,15 +10244,6 @@
|
|||||||
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
|
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"os-locale": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
|
|
||||||
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"lcid": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"os-tmpdir": {
|
"os-tmpdir": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
||||||
@@ -12884,15 +12873,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sass-graph": {
|
"sass-graph": {
|
||||||
"version": "2.2.4",
|
"version": "2.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.5.tgz",
|
||||||
"integrity": "sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k=",
|
"integrity": "sha512-VFWDAHOe6mRuT4mZRd4eKE+d8Uedrk6Xnh7Sh9b4NGufQLQjOrvf/MQoOdx+0s92L89FeyUUNfU597j/3uNpag==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"glob": "^7.0.0",
|
"glob": "^7.0.0",
|
||||||
"lodash": "^4.0.0",
|
"lodash": "^4.0.0",
|
||||||
"scss-tokenizer": "^0.2.3",
|
"scss-tokenizer": "^0.2.3",
|
||||||
"yargs": "^7.0.0"
|
"yargs": "^13.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sass-loader": {
|
"sass-loader": {
|
||||||
@@ -15354,6 +15343,11 @@
|
|||||||
"makeerror": "1.0.x"
|
"makeerror": "1.0.x"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"wasm-feature-detect": {
|
||||||
|
"version": "1.2.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/wasm-feature-detect/-/wasm-feature-detect-1.2.6.tgz",
|
||||||
|
"integrity": "sha512-r255tPhr5k7vet9zKQch0alB7ZduiXoQGC3Cn58CLgbSyp/KIb7fFpcg4pMulQDxIjeFqCxLdln4ubCGGBPicg=="
|
||||||
|
},
|
||||||
"watchpack": {
|
"watchpack": {
|
||||||
"version": "1.6.0",
|
"version": "1.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz",
|
||||||
@@ -16159,9 +16153,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"which-module": {
|
"which-module": {
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
|
||||||
"integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=",
|
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"wide-align": {
|
"wide-align": {
|
||||||
@@ -16289,53 +16283,148 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"yargs": {
|
"yargs": {
|
||||||
"version": "7.1.0",
|
"version": "13.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
|
||||||
"integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=",
|
"integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"camelcase": "^3.0.0",
|
"cliui": "^5.0.0",
|
||||||
"cliui": "^3.2.0",
|
"find-up": "^3.0.0",
|
||||||
"decamelize": "^1.1.1",
|
"get-caller-file": "^2.0.1",
|
||||||
"get-caller-file": "^1.0.1",
|
|
||||||
"os-locale": "^1.4.0",
|
|
||||||
"read-pkg-up": "^1.0.1",
|
|
||||||
"require-directory": "^2.1.1",
|
"require-directory": "^2.1.1",
|
||||||
"require-main-filename": "^1.0.1",
|
"require-main-filename": "^2.0.0",
|
||||||
"set-blocking": "^2.0.0",
|
"set-blocking": "^2.0.0",
|
||||||
"string-width": "^1.0.2",
|
"string-width": "^3.0.0",
|
||||||
"which-module": "^1.0.0",
|
"which-module": "^2.0.0",
|
||||||
"y18n": "^3.2.1",
|
"y18n": "^4.0.0",
|
||||||
"yargs-parser": "^5.0.0"
|
"yargs-parser": "^13.1.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"camelcase": {
|
"ansi-regex": {
|
||||||
"version": "3.0.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||||
"integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=",
|
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"y18n": {
|
"cliui": {
|
||||||
"version": "3.2.1",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
|
||||||
"integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=",
|
"integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"string-width": "^3.1.0",
|
||||||
|
"strip-ansi": "^5.2.0",
|
||||||
|
"wrap-ansi": "^5.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"find-up": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"locate-path": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"get-caller-file": {
|
||||||
|
"version": "2.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||||
|
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
|
},
|
||||||
|
"is-fullwidth-code-point": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"locate-path": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"p-locate": "^3.0.0",
|
||||||
|
"path-exists": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-limit": {
|
||||||
|
"version": "2.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
||||||
|
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"p-try": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-locate": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"p-limit": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-try": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"require-main-filename": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"string-width": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"emoji-regex": "^7.0.1",
|
||||||
|
"is-fullwidth-code-point": "^2.0.0",
|
||||||
|
"strip-ansi": "^5.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strip-ansi": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
||||||
|
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ansi-regex": "^4.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"wrap-ansi": {
|
||||||
|
"version": "5.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
|
||||||
|
"integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ansi-styles": "^3.2.0",
|
||||||
|
"string-width": "^3.0.0",
|
||||||
|
"strip-ansi": "^5.0.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"yargs-parser": {
|
"yargs-parser": {
|
||||||
"version": "5.0.0",
|
"version": "13.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
|
||||||
"integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=",
|
"integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"camelcase": "^3.0.0"
|
"camelcase": "^5.0.0",
|
||||||
|
"decamelize": "^1.2.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"camelcase": {
|
"camelcase": {
|
||||||
"version": "3.0.0",
|
"version": "5.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||||
"integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=",
|
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "squoosh",
|
"name": "squoosh",
|
||||||
"version": "1.11.4",
|
"version": "1.12.0",
|
||||||
"license": "apache-2.0",
|
"license": "apache-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "webpack-dev-server --host 0.0.0.0 --hot",
|
"start": "webpack-dev-server --host 0.0.0.0 --hot",
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
"mini-css-extract-plugin": "0.8.0",
|
"mini-css-extract-plugin": "0.8.0",
|
||||||
"minimatch": "3.0.4",
|
"minimatch": "3.0.4",
|
||||||
"node-fetch": "2.6.0",
|
"node-fetch": "2.6.0",
|
||||||
"node-sass": "4.13.0",
|
"node-sass": "4.14.1",
|
||||||
"normalize-path": "^3.0.0",
|
"normalize-path": "^3.0.0",
|
||||||
"optimize-css-assets-webpack-plugin": "5.0.1",
|
"optimize-css-assets-webpack-plugin": "5.0.1",
|
||||||
"pointer-tracker": "2.0.3",
|
"pointer-tracker": "2.0.3",
|
||||||
@@ -73,5 +73,8 @@
|
|||||||
"webpack-cli": "3.3.4",
|
"webpack-cli": "3.3.4",
|
||||||
"webpack-dev-server": "3.8.0",
|
"webpack-dev-server": "3.8.0",
|
||||||
"worker-plugin": "3.1.0"
|
"worker-plugin": "3.1.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"wasm-feature-detect": "^1.2.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
7
src/codecs/avif/decoder-meta.ts
Normal file
7
src/codecs/avif/decoder-meta.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export const name = 'WASM AVIF Decoder';
|
||||||
|
|
||||||
|
const supportedMimeTypes = ['image/avif'];
|
||||||
|
|
||||||
|
export function canHandleMimeType(mimeType: string): boolean {
|
||||||
|
return supportedMimeTypes.includes(mimeType);
|
||||||
|
}
|
||||||
16
src/codecs/avif/decoder.ts
Normal file
16
src/codecs/avif/decoder.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import avif_dec, { AVIFModule } from '../../../codecs/avif/dec/avif_dec';
|
||||||
|
import wasmUrl from '../../../codecs/avif/dec/avif_dec.wasm';
|
||||||
|
import { initEmscriptenModule } from '../util';
|
||||||
|
|
||||||
|
let emscriptenModule: Promise<AVIFModule>;
|
||||||
|
|
||||||
|
export async function decode(data: ArrayBuffer): Promise<ImageData> {
|
||||||
|
if (!emscriptenModule) emscriptenModule = initEmscriptenModule(avif_dec, wasmUrl);
|
||||||
|
|
||||||
|
const module = await emscriptenModule;
|
||||||
|
const result = module.decode(data);
|
||||||
|
if (!result) {
|
||||||
|
throw new Error('Decoding error');
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
27
src/codecs/avif/encoder-meta.ts
Normal file
27
src/codecs/avif/encoder-meta.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
export interface EncodeOptions {
|
||||||
|
minQuantizer: number;
|
||||||
|
maxQuantizer: number;
|
||||||
|
minQuantizerAlpha: number;
|
||||||
|
maxQuantizerAlpha: number;
|
||||||
|
tileRowsLog2: number;
|
||||||
|
tileColsLog2: number;
|
||||||
|
speed: number;
|
||||||
|
subsample: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const type = 'avif';
|
||||||
|
export const label = 'AVIF';
|
||||||
|
export const mimeType = 'image/avif';
|
||||||
|
export const extension = 'avif';
|
||||||
|
export const defaultOptions: EncodeOptions = {
|
||||||
|
minQuantizer: 33,
|
||||||
|
maxQuantizer: 63,
|
||||||
|
minQuantizerAlpha: 33,
|
||||||
|
maxQuantizerAlpha: 63,
|
||||||
|
tileColsLog2: 0,
|
||||||
|
tileRowsLog2: 0,
|
||||||
|
speed: 8,
|
||||||
|
subsample: 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface EncoderState { type: typeof type; options: EncodeOptions; }
|
||||||
42
src/codecs/avif/encoder.ts
Normal file
42
src/codecs/avif/encoder.ts
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import mainUrlWithMT from 'file-loader!../../../codecs/avif/enc/avif_enc_mt.js';
|
||||||
|
import { AVIFModule } from '../../../codecs/avif/enc/avif_enc.js';
|
||||||
|
import wasmUrlWithoutMT from '../../../codecs/avif/enc/avif_enc.wasm';
|
||||||
|
import wasmUrlWithMT from '../../../codecs/avif/enc/avif_enc_mt.wasm';
|
||||||
|
import workerUrl from '../../../codecs/avif/enc/avif_enc_mt.worker.js';
|
||||||
|
import { EncodeOptions } from './encoder-meta';
|
||||||
|
import { initEmscriptenModule, ModuleFactory } from '../util';
|
||||||
|
import { threads } from 'wasm-feature-detect';
|
||||||
|
|
||||||
|
declare const avif_enc_mt: ModuleFactory<AVIFModule>;
|
||||||
|
|
||||||
|
let emscriptenModule: Promise<AVIFModule>;
|
||||||
|
|
||||||
|
async function init() {
|
||||||
|
if (await threads()) {
|
||||||
|
importScripts(mainUrlWithMT);
|
||||||
|
return initEmscriptenModule<AVIFModule>(
|
||||||
|
avif_enc_mt,
|
||||||
|
wasmUrlWithMT,
|
||||||
|
workerUrl,
|
||||||
|
mainUrlWithMT,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return initEmscriptenModule(
|
||||||
|
(await import('../../../codecs/avif/enc/avif_enc.js')).default,
|
||||||
|
wasmUrlWithoutMT,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function encode(data: ImageData, options: EncodeOptions): Promise<ArrayBuffer> {
|
||||||
|
if (!emscriptenModule) emscriptenModule = init();
|
||||||
|
|
||||||
|
const module = await emscriptenModule;
|
||||||
|
const result = module.encode(data.data, data.width, data.height, options);
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
throw new Error('Encoding error');
|
||||||
|
}
|
||||||
|
|
||||||
|
// wasm can’t run on SharedArrayBuffers, so we hard-cast to ArrayBuffer.
|
||||||
|
return result.buffer as ArrayBuffer;
|
||||||
|
}
|
||||||
310
src/codecs/avif/options.tsx
Normal file
310
src/codecs/avif/options.tsx
Normal file
@@ -0,0 +1,310 @@
|
|||||||
|
import { h, Component } from 'preact';
|
||||||
|
import { preventDefault, shallowEqual } from '../../lib/util';
|
||||||
|
import { EncodeOptions, defaultOptions } from './encoder-meta';
|
||||||
|
import * as style from '../../components/Options/style.scss';
|
||||||
|
import Checkbox from '../../components/checkbox';
|
||||||
|
import Expander from '../../components/expander';
|
||||||
|
import Select from '../../components/select';
|
||||||
|
import Range from '../../components/range';
|
||||||
|
import linkState from 'linkstate';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
options: EncodeOptions;
|
||||||
|
onChange(newOptions: EncodeOptions): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface State {
|
||||||
|
options: EncodeOptions;
|
||||||
|
lossless: boolean;
|
||||||
|
maxQuality: number;
|
||||||
|
minQuality: number;
|
||||||
|
separateAlpha: boolean;
|
||||||
|
losslessAlpha: boolean;
|
||||||
|
maxAlphaQuality: number;
|
||||||
|
minAlphaQuality: number;
|
||||||
|
showAdvanced: boolean;
|
||||||
|
grayscale: boolean;
|
||||||
|
subsample: number;
|
||||||
|
tileRows: number;
|
||||||
|
tileCols: number;
|
||||||
|
effort: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const maxQuant = 63;
|
||||||
|
const maxSpeed = 10;
|
||||||
|
|
||||||
|
export default class AVIFEncoderOptions extends Component<Props, State> {
|
||||||
|
static getDerivedStateFromProps(props: Props, state: State): Partial<State> | undefined {
|
||||||
|
if (state.options && shallowEqual(state.options, props.options)) return;
|
||||||
|
const { options } = props;
|
||||||
|
|
||||||
|
const lossless = options.maxQuantizer === 0 && options.minQuantizer === 0;
|
||||||
|
const minQuantizerValue = lossless ? defaultOptions.minQuantizer : options.minQuantizer;
|
||||||
|
const maxQuantizerValue = lossless ? defaultOptions.maxQuantizer : options.maxQuantizer;
|
||||||
|
const losslessAlpha = options.maxQuantizerAlpha === 0 && options.minQuantizerAlpha === 0;
|
||||||
|
const minQuantizerAlphaValue = losslessAlpha ?
|
||||||
|
defaultOptions.minQuantizerAlpha : options.minQuantizerAlpha;
|
||||||
|
const maxQuantizerAlphaValue = losslessAlpha ?
|
||||||
|
defaultOptions.maxQuantizerAlpha : options.maxQuantizerAlpha;
|
||||||
|
|
||||||
|
// Create default form state from options
|
||||||
|
return {
|
||||||
|
options,
|
||||||
|
lossless,
|
||||||
|
losslessAlpha,
|
||||||
|
maxQuality: maxQuant - minQuantizerValue,
|
||||||
|
minQuality: maxQuant - maxQuantizerValue,
|
||||||
|
separateAlpha: options.maxQuantizer !== options.maxQuantizerAlpha ||
|
||||||
|
options.minQuantizer !== options.minQuantizerAlpha,
|
||||||
|
maxAlphaQuality: maxQuant - minQuantizerAlphaValue,
|
||||||
|
minAlphaQuality: maxQuant - maxQuantizerAlphaValue,
|
||||||
|
grayscale: options.subsample === 0,
|
||||||
|
subsample: options.subsample === 0 || lossless ? defaultOptions.subsample : options.subsample,
|
||||||
|
tileRows: options.tileRowsLog2,
|
||||||
|
tileCols: options.tileColsLog2,
|
||||||
|
effort: maxSpeed - options.speed,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// The rest of the defaults are set in getDerivedStateFromProps
|
||||||
|
state: State = {
|
||||||
|
showAdvanced: false,
|
||||||
|
} as State;
|
||||||
|
|
||||||
|
private _inputChangeCallbacks = new Map<string, (event: Event) => void>();
|
||||||
|
|
||||||
|
private _inputChange = (prop: keyof State, type: 'number' | 'boolean') => {
|
||||||
|
// Cache the callback for performance
|
||||||
|
if (!this._inputChangeCallbacks.has(prop)) {
|
||||||
|
this._inputChangeCallbacks.set(prop, (event: Event) => {
|
||||||
|
const formEl = event.target as HTMLInputElement | HTMLSelectElement;
|
||||||
|
const newVal = type === 'boolean' ?
|
||||||
|
'checked' in formEl ? formEl.checked : !!formEl.value :
|
||||||
|
Number(formEl.value);
|
||||||
|
|
||||||
|
const newState: Partial<State> = {
|
||||||
|
[prop]: newVal,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Ensure that min cannot be greater than max
|
||||||
|
switch (prop) {
|
||||||
|
case 'maxQuality':
|
||||||
|
if (newVal < this.state.minQuality) {
|
||||||
|
newState.minQuality = newVal as number;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'minQuality':
|
||||||
|
if (newVal > this.state.maxQuality) {
|
||||||
|
newState.maxQuality = newVal as number;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'maxAlphaQuality':
|
||||||
|
if (newVal < this.state.minAlphaQuality) {
|
||||||
|
newState.minAlphaQuality = newVal as number;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'minAlphaQuality':
|
||||||
|
if (newVal > this.state.maxAlphaQuality) {
|
||||||
|
newState.maxAlphaQuality = newVal as number;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const optionState = {
|
||||||
|
...this.state,
|
||||||
|
...newState,
|
||||||
|
};
|
||||||
|
|
||||||
|
const maxQuantizer = optionState.lossless ? 0 : (maxQuant - optionState.minQuality);
|
||||||
|
const minQuantizer = optionState.lossless ? 0 : (maxQuant - optionState.maxQuality);
|
||||||
|
|
||||||
|
const newOptions: EncodeOptions = {
|
||||||
|
maxQuantizer,
|
||||||
|
minQuantizer,
|
||||||
|
maxQuantizerAlpha: optionState.separateAlpha ?
|
||||||
|
(optionState.losslessAlpha ? 0 : (maxQuant - optionState.minAlphaQuality)) :
|
||||||
|
maxQuantizer,
|
||||||
|
minQuantizerAlpha: optionState.separateAlpha ?
|
||||||
|
(optionState.losslessAlpha ? 0 : (maxQuant - optionState.maxAlphaQuality)) :
|
||||||
|
minQuantizer,
|
||||||
|
// Always set to 4:4:4 if lossless
|
||||||
|
subsample: optionState.grayscale ? 0 : optionState.lossless ? 3 : optionState.subsample,
|
||||||
|
tileColsLog2: optionState.tileCols,
|
||||||
|
tileRowsLog2: optionState.tileRows,
|
||||||
|
speed: maxSpeed - optionState.effort,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Updating options, so we don't recalculate in getDerivedStateFromProps.
|
||||||
|
newState.options = newOptions;
|
||||||
|
|
||||||
|
this.setState(
|
||||||
|
// It isn't clear to me why I have to cast this :)
|
||||||
|
newState as State,
|
||||||
|
);
|
||||||
|
|
||||||
|
this.props.onChange(newOptions);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._inputChangeCallbacks.get(prop)!;
|
||||||
|
}
|
||||||
|
|
||||||
|
render(
|
||||||
|
_: Props,
|
||||||
|
{
|
||||||
|
effort, grayscale, lossless, losslessAlpha, maxAlphaQuality, maxQuality, minAlphaQuality,
|
||||||
|
minQuality, separateAlpha, showAdvanced, subsample, tileCols, tileRows,
|
||||||
|
}: State,
|
||||||
|
) {
|
||||||
|
return (
|
||||||
|
<form class={style.optionsSection} onSubmit={preventDefault}>
|
||||||
|
<label class={style.optionInputFirst}>
|
||||||
|
<Checkbox
|
||||||
|
checked={lossless}
|
||||||
|
onChange={this._inputChange('lossless', 'boolean')}
|
||||||
|
/>
|
||||||
|
Lossless
|
||||||
|
</label>
|
||||||
|
<Expander>
|
||||||
|
{!lossless && (
|
||||||
|
<div>
|
||||||
|
<div class={style.optionOneCell}>
|
||||||
|
<Range
|
||||||
|
min="0"
|
||||||
|
max="62"
|
||||||
|
value={maxQuality}
|
||||||
|
onInput={this._inputChange('maxQuality', 'number')}
|
||||||
|
>
|
||||||
|
Max quality:
|
||||||
|
</Range>
|
||||||
|
</div>
|
||||||
|
<div class={style.optionOneCell}>
|
||||||
|
<Range
|
||||||
|
min="0"
|
||||||
|
max="62"
|
||||||
|
value={minQuality}
|
||||||
|
onInput={this._inputChange('minQuality', 'number')}
|
||||||
|
>
|
||||||
|
Min quality:
|
||||||
|
</Range>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</Expander>
|
||||||
|
<label class={style.optionInputFirst}>
|
||||||
|
<Checkbox
|
||||||
|
checked={separateAlpha}
|
||||||
|
onChange={this._inputChange('separateAlpha', 'boolean')}
|
||||||
|
/>
|
||||||
|
Separate alpha quality
|
||||||
|
</label>
|
||||||
|
<Expander>
|
||||||
|
{separateAlpha && (
|
||||||
|
<div>
|
||||||
|
<label class={style.optionInputFirst}>
|
||||||
|
<Checkbox
|
||||||
|
checked={losslessAlpha}
|
||||||
|
onChange={this._inputChange('losslessAlpha', 'boolean')}
|
||||||
|
/>
|
||||||
|
Lossless alpha
|
||||||
|
</label>
|
||||||
|
<Expander>
|
||||||
|
{!losslessAlpha &&
|
||||||
|
<div>
|
||||||
|
<div class={style.optionOneCell}>
|
||||||
|
<Range
|
||||||
|
min="0"
|
||||||
|
max="62"
|
||||||
|
value={maxAlphaQuality}
|
||||||
|
onInput={this._inputChange('maxAlphaQuality', 'number')}
|
||||||
|
>
|
||||||
|
Max alpha quality:
|
||||||
|
</Range>
|
||||||
|
</div>
|
||||||
|
<div class={style.optionOneCell}>
|
||||||
|
<Range
|
||||||
|
min="0"
|
||||||
|
max="62"
|
||||||
|
value={minAlphaQuality}
|
||||||
|
onInput={this._inputChange('minAlphaQuality', 'number')}
|
||||||
|
>
|
||||||
|
Min alpha quality:
|
||||||
|
</Range>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</Expander>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</Expander>
|
||||||
|
<label class={style.optionInputFirst}>
|
||||||
|
<Checkbox
|
||||||
|
checked={showAdvanced}
|
||||||
|
onChange={linkState(this, 'showAdvanced')}
|
||||||
|
/>
|
||||||
|
Show advanced settings
|
||||||
|
</label>
|
||||||
|
<Expander>
|
||||||
|
{showAdvanced &&
|
||||||
|
<div>
|
||||||
|
{/*<label class={style.optionInputFirst}>
|
||||||
|
<Checkbox
|
||||||
|
data-set-state="grayscale"
|
||||||
|
checked={grayscale}
|
||||||
|
onChange={this._inputChange('grayscale', 'boolean')}
|
||||||
|
/>
|
||||||
|
Grayscale
|
||||||
|
</label>*/}
|
||||||
|
<Expander>
|
||||||
|
{!grayscale && !lossless &&
|
||||||
|
<label class={style.optionTextFirst}>
|
||||||
|
Subsample chroma:
|
||||||
|
<Select
|
||||||
|
data-set-state="subsample"
|
||||||
|
value={subsample}
|
||||||
|
onChange={this._inputChange('subsample', 'number')}
|
||||||
|
>
|
||||||
|
<option value="1">4:2:0</option>
|
||||||
|
{/*<option value="2">4:2:2</option>*/}
|
||||||
|
<option value="3">4:4:4</option>
|
||||||
|
</Select>
|
||||||
|
</label>
|
||||||
|
}
|
||||||
|
</Expander>
|
||||||
|
<div class={style.optionOneCell}>
|
||||||
|
<Range
|
||||||
|
min="0"
|
||||||
|
max="6"
|
||||||
|
value={tileRows}
|
||||||
|
onInput={this._inputChange('tileRows', 'number')}
|
||||||
|
>
|
||||||
|
Log2 of tile rows:
|
||||||
|
</Range>
|
||||||
|
</div>
|
||||||
|
<div class={style.optionOneCell}>
|
||||||
|
<Range
|
||||||
|
min="0"
|
||||||
|
max="6"
|
||||||
|
value={tileCols}
|
||||||
|
onInput={this._inputChange('tileCols', 'number')}
|
||||||
|
>
|
||||||
|
Log2 of tile cols:
|
||||||
|
</Range>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</Expander>
|
||||||
|
<div class={style.optionOneCell}>
|
||||||
|
<Range
|
||||||
|
min="0"
|
||||||
|
max="10"
|
||||||
|
value={effort}
|
||||||
|
onInput={this._inputChange('effort', 'number')}
|
||||||
|
>
|
||||||
|
Effort:
|
||||||
|
</Range>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,18 +1,16 @@
|
|||||||
import { builtinDecode, sniffMimeType, canDecodeImage } from '../lib/util';
|
import { builtinDecode, sniffMimeType, canDecodeImageType } from '../lib/util';
|
||||||
import Processor from './processor';
|
import Processor from './processor';
|
||||||
import webpDataUrl from 'url-loader!./tiny.webp';
|
|
||||||
|
|
||||||
const webPSupported = canDecodeImage(webpDataUrl);
|
|
||||||
|
|
||||||
export async function decodeImage(blob: Blob, processor: Processor): Promise<ImageData> {
|
export async function decodeImage(blob: Blob, processor: Processor): Promise<ImageData> {
|
||||||
const mimeType = await sniffMimeType(blob);
|
const mimeType = await sniffMimeType(blob);
|
||||||
|
const canDecode = await canDecodeImageType(mimeType);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (mimeType === 'image/webp' && !(await webPSupported)) {
|
if (!canDecode) {
|
||||||
return await processor.webpDecode(blob);
|
if (mimeType === 'image/avif') return await processor.avifDecode(blob);
|
||||||
|
if (mimeType === 'image/webp') return await processor.webpDecode(blob);
|
||||||
|
// If it's not one of those types, fall through and try built-in decoding for a laugh.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, just throw it at the browser's decoder.
|
|
||||||
return await builtinDecode(blob);
|
return await builtinDecode(blob);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw Error("Couldn't decode image");
|
throw Error("Couldn't decode image");
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import * as identity from './identity/encoder-meta';
|
|||||||
import * as oxiPNG from './oxipng/encoder-meta';
|
import * as oxiPNG from './oxipng/encoder-meta';
|
||||||
import * as mozJPEG from './mozjpeg/encoder-meta';
|
import * as mozJPEG from './mozjpeg/encoder-meta';
|
||||||
import * as webP from './webp/encoder-meta';
|
import * as webP from './webp/encoder-meta';
|
||||||
|
import * as avif from './avif/encoder-meta';
|
||||||
import * as browserPNG from './browser-png/encoder-meta';
|
import * as browserPNG from './browser-png/encoder-meta';
|
||||||
import * as browserJPEG from './browser-jpeg/encoder-meta';
|
import * as browserJPEG from './browser-jpeg/encoder-meta';
|
||||||
import * as browserWebP from './browser-webp/encoder-meta';
|
import * as browserWebP from './browser-webp/encoder-meta';
|
||||||
@@ -20,6 +21,7 @@ export type EncoderState =
|
|||||||
oxiPNG.EncoderState |
|
oxiPNG.EncoderState |
|
||||||
mozJPEG.EncoderState |
|
mozJPEG.EncoderState |
|
||||||
webP.EncoderState |
|
webP.EncoderState |
|
||||||
|
avif.EncoderState |
|
||||||
browserPNG.EncoderState |
|
browserPNG.EncoderState |
|
||||||
browserJPEG.EncoderState |
|
browserJPEG.EncoderState |
|
||||||
browserWebP.EncoderState |
|
browserWebP.EncoderState |
|
||||||
@@ -34,6 +36,7 @@ export type EncoderOptions =
|
|||||||
oxiPNG.EncodeOptions |
|
oxiPNG.EncodeOptions |
|
||||||
mozJPEG.EncodeOptions |
|
mozJPEG.EncodeOptions |
|
||||||
webP.EncodeOptions |
|
webP.EncodeOptions |
|
||||||
|
avif.EncodeOptions |
|
||||||
browserPNG.EncodeOptions |
|
browserPNG.EncodeOptions |
|
||||||
browserJPEG.EncodeOptions |
|
browserJPEG.EncodeOptions |
|
||||||
browserWebP.EncodeOptions |
|
browserWebP.EncodeOptions |
|
||||||
@@ -50,6 +53,7 @@ export const encoderMap = {
|
|||||||
[oxiPNG.type]: oxiPNG,
|
[oxiPNG.type]: oxiPNG,
|
||||||
[mozJPEG.type]: mozJPEG,
|
[mozJPEG.type]: mozJPEG,
|
||||||
[webP.type]: webP,
|
[webP.type]: webP,
|
||||||
|
[avif.type]: avif,
|
||||||
[browserPNG.type]: browserPNG,
|
[browserPNG.type]: browserPNG,
|
||||||
[browserJPEG.type]: browserJPEG,
|
[browserJPEG.type]: browserJPEG,
|
||||||
[browserWebP.type]: browserWebP,
|
[browserWebP.type]: browserWebP,
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
import { optimise } from '../../../codecs/oxipng/pkg';
|
// @ts-ignore
|
||||||
|
import init from '../../../codecs/oxipng/spawn';
|
||||||
import { EncodeOptions } from './encoder-meta';
|
import { EncodeOptions } from './encoder-meta';
|
||||||
|
|
||||||
export async function compress(data: ArrayBuffer, options: EncodeOptions): Promise<ArrayBuffer> {
|
export async function compress(data: ArrayBuffer, options: EncodeOptions): Promise<ArrayBuffer> {
|
||||||
return optimise(new Uint8Array(data), options.level).buffer;
|
for (let i = 0; i < 100; i += 1) {
|
||||||
|
const optimiser = await init();
|
||||||
|
console.log(`Run #${i}: ${optimiser.optimise(new Uint8Array(data), options.level).buffer.byteLength} bytes`);
|
||||||
|
optimiser.freeWorkers();
|
||||||
|
}
|
||||||
|
return (await init()).optimise(new Uint8Array(data), options.level).buffer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,22 @@ async function webpDecode(data: ArrayBuffer): Promise<ImageData> {
|
|||||||
return timed('webpDecode', () => decode(data));
|
return timed('webpDecode', () => decode(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function avifEncode(
|
||||||
|
data: ImageData, options: import('../avif/encoder-meta').EncodeOptions,
|
||||||
|
): Promise<ArrayBuffer> {
|
||||||
|
const { encode } = await import(
|
||||||
|
/* webpackChunkName: "process-avif-enc" */
|
||||||
|
'../avif/encoder');
|
||||||
|
return timed('avifEncode', () => encode(data, options));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function avifDecode(data: ArrayBuffer): Promise<ImageData> {
|
||||||
|
const { decode } = await import(
|
||||||
|
/* webpackChunkName: "process-avif-dec" */
|
||||||
|
'../avif/decoder');
|
||||||
|
return timed('avifDencode', () => decode(data));
|
||||||
|
}
|
||||||
|
|
||||||
const exports = {
|
const exports = {
|
||||||
mozjpegEncode,
|
mozjpegEncode,
|
||||||
quantize,
|
quantize,
|
||||||
@@ -90,6 +106,8 @@ const exports = {
|
|||||||
oxiPngEncode,
|
oxiPngEncode,
|
||||||
webpEncode,
|
webpEncode,
|
||||||
webpDecode,
|
webpDecode,
|
||||||
|
avifEncode,
|
||||||
|
avifDecode,
|
||||||
};
|
};
|
||||||
export type ProcessorWorkerApi = typeof exports;
|
export type ProcessorWorkerApi = typeof exports;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { canvasEncode, blobToArrayBuffer } from '../lib/util';
|
|||||||
import { EncodeOptions as MozJPEGEncoderOptions } from './mozjpeg/encoder-meta';
|
import { EncodeOptions as MozJPEGEncoderOptions } from './mozjpeg/encoder-meta';
|
||||||
import { EncodeOptions as OxiPNGEncoderOptions } from './oxipng/encoder-meta';
|
import { EncodeOptions as OxiPNGEncoderOptions } from './oxipng/encoder-meta';
|
||||||
import { EncodeOptions as WebPEncoderOptions } from './webp/encoder-meta';
|
import { EncodeOptions as WebPEncoderOptions } from './webp/encoder-meta';
|
||||||
|
import { EncodeOptions as AvifEncoderOptions } from './avif/encoder-meta';
|
||||||
import { EncodeOptions as BrowserJPEGOptions } from './browser-jpeg/encoder-meta';
|
import { EncodeOptions as BrowserJPEGOptions } from './browser-jpeg/encoder-meta';
|
||||||
import { EncodeOptions as BrowserWebpEncodeOptions } from './browser-webp/encoder-meta';
|
import { EncodeOptions as BrowserWebpEncodeOptions } from './browser-webp/encoder-meta';
|
||||||
import { BrowserResizeOptions, VectorResizeOptions } from './resize/processor-meta';
|
import { BrowserResizeOptions, VectorResizeOptions } from './resize/processor-meta';
|
||||||
@@ -163,6 +164,17 @@ export default class Processor {
|
|||||||
return this._workerApi!.webpDecode(data);
|
return this._workerApi!.webpDecode(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Processor._processingJob({ needsWorker: true })
|
||||||
|
async avifDecode(blob: Blob): Promise<ImageData> {
|
||||||
|
const data = await blobToArrayBuffer(blob);
|
||||||
|
return this._workerApi!.avifDecode(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Processor._processingJob({ needsWorker: true })
|
||||||
|
avifEncode(data: ImageData, opts: AvifEncoderOptions): Promise<ArrayBuffer> {
|
||||||
|
return this._workerApi!.avifEncode(data, opts);
|
||||||
|
}
|
||||||
|
|
||||||
// Not-worker jobs:
|
// Not-worker jobs:
|
||||||
|
|
||||||
@Processor._processingJob()
|
@Processor._processingJob()
|
||||||
|
|||||||
@@ -1,28 +1,23 @@
|
|||||||
type ModuleFactory<M extends EmscriptenWasm.Module> = (
|
export type ModuleFactory<M extends EmscriptenWasm.Module> = (
|
||||||
opts: EmscriptenWasm.ModuleOpts,
|
opts: EmscriptenWasm.ModuleOpts,
|
||||||
) => M;
|
) => Promise<M>;
|
||||||
|
|
||||||
export function initEmscriptenModule<T extends EmscriptenWasm.Module>(
|
export function initEmscriptenModule<T extends EmscriptenWasm.Module>(
|
||||||
moduleFactory: ModuleFactory<T>,
|
moduleFactory: ModuleFactory<T>,
|
||||||
wasmUrl: string,
|
wasmUrl: string,
|
||||||
|
workerUrl?: string,
|
||||||
|
mainUrl?: string,
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
return new Promise((resolve) => {
|
return moduleFactory({
|
||||||
const module = moduleFactory({
|
// Just to be safe, don't automatically invoke any wasm functions
|
||||||
// Just to be safe, don't automatically invoke any wasm functions
|
mainScriptUrlOrBlob: mainUrl,
|
||||||
noInitialRun: true,
|
noInitialRun: true,
|
||||||
locateFile(url: string): string {
|
locateFile(url: string): string {
|
||||||
// Redirect the request for the wasm binary to whatever webpack gave us.
|
// Redirect the request for the wasm binary to whatever webpack gave us.
|
||||||
if (url.endsWith('.wasm')) return wasmUrl;
|
if (url.endsWith('.wasm')) return wasmUrl;
|
||||||
return url;
|
if (url.endsWith('.worker.js')) return workerUrl!;
|
||||||
},
|
return url;
|
||||||
onRuntimeInitialized() {
|
},
|
||||||
// An Emscripten is a then-able that resolves with itself, causing an infite loop when you
|
|
||||||
// wrap it in a real promise. Delete the `then` prop solves this for now.
|
|
||||||
// https://github.com/kripken/emscripten/issues/5820
|
|
||||||
delete (module as any).then;
|
|
||||||
resolve(module);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,5 +8,9 @@ export async function decode(data: ArrayBuffer): Promise<ImageData> {
|
|||||||
if (!emscriptenModule) emscriptenModule = initEmscriptenModule(webp_dec, wasmUrl);
|
if (!emscriptenModule) emscriptenModule = initEmscriptenModule(webp_dec, wasmUrl);
|
||||||
|
|
||||||
const module = await emscriptenModule;
|
const module = await emscriptenModule;
|
||||||
return module.decode(data);
|
const result = module.decode(data);
|
||||||
|
if (!result) {
|
||||||
|
throw new Error('Decoding error');
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ export async function encode(data: ImageData, options: EncodeOptions): Promise<A
|
|||||||
|
|
||||||
const module = await emscriptenModule;
|
const module = await emscriptenModule;
|
||||||
const result = module.encode(data.data, data.width, data.height, options);
|
const result = module.encode(data.data, data.width, data.height, options);
|
||||||
|
if (!result) {
|
||||||
|
throw new Error('Encoding error.');
|
||||||
|
}
|
||||||
// wasm can’t run on SharedArrayBuffers, so we hard-cast to ArrayBuffer.
|
// wasm can’t run on SharedArrayBuffers, so we hard-cast to ArrayBuffer.
|
||||||
return result.buffer as ArrayBuffer;
|
return result.buffer as ArrayBuffer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export default class App extends Component<Props, State> {
|
|||||||
// really breaks things on Squoosh, as you can easily end up zooming the UI when you mean to
|
// really breaks things on Squoosh, as you can easily end up zooming the UI when you mean to
|
||||||
// zoom the image. Once you've done this, it's really difficult to undo. Anyway, this seems to
|
// zoom the image. Once you've done this, it's really difficult to undo. Anyway, this seems to
|
||||||
// prevent it.
|
// prevent it.
|
||||||
document.body.addEventListener('gesturestart', (event) => {
|
document.body.addEventListener('gesturestart', (event: any) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import OxiPNGEncoderOptions from '../../codecs/oxipng/options';
|
|||||||
import MozJpegEncoderOptions from '../../codecs/mozjpeg/options';
|
import MozJpegEncoderOptions from '../../codecs/mozjpeg/options';
|
||||||
import BrowserJPEGEncoderOptions from '../../codecs/browser-jpeg/options';
|
import BrowserJPEGEncoderOptions from '../../codecs/browser-jpeg/options';
|
||||||
import WebPEncoderOptions from '../../codecs/webp/options';
|
import WebPEncoderOptions from '../../codecs/webp/options';
|
||||||
|
import AvifEncoderOptions from '../../codecs/avif/options';
|
||||||
import BrowserWebPEncoderOptions from '../../codecs/browser-webp/options';
|
import BrowserWebPEncoderOptions from '../../codecs/browser-webp/options';
|
||||||
|
|
||||||
import QuantizerOptionsComponent from '../../codecs/imagequant/options';
|
import QuantizerOptionsComponent from '../../codecs/imagequant/options';
|
||||||
@@ -16,6 +17,7 @@ import * as identity from '../../codecs/identity/encoder-meta';
|
|||||||
import * as oxiPNG from '../../codecs/oxipng/encoder-meta';
|
import * as oxiPNG from '../../codecs/oxipng/encoder-meta';
|
||||||
import * as mozJPEG from '../../codecs/mozjpeg/encoder-meta';
|
import * as mozJPEG from '../../codecs/mozjpeg/encoder-meta';
|
||||||
import * as webP from '../../codecs/webp/encoder-meta';
|
import * as webP from '../../codecs/webp/encoder-meta';
|
||||||
|
import * as avif from '../../codecs/avif/encoder-meta';
|
||||||
import * as browserPNG from '../../codecs/browser-png/encoder-meta';
|
import * as browserPNG from '../../codecs/browser-png/encoder-meta';
|
||||||
import * as browserJPEG from '../../codecs/browser-jpeg/encoder-meta';
|
import * as browserJPEG from '../../codecs/browser-jpeg/encoder-meta';
|
||||||
import * as browserWebP from '../../codecs/browser-webp/encoder-meta';
|
import * as browserWebP from '../../codecs/browser-webp/encoder-meta';
|
||||||
@@ -47,6 +49,7 @@ const encoderOptionsComponentMap: {
|
|||||||
[oxiPNG.type]: OxiPNGEncoderOptions,
|
[oxiPNG.type]: OxiPNGEncoderOptions,
|
||||||
[mozJPEG.type]: MozJpegEncoderOptions,
|
[mozJPEG.type]: MozJpegEncoderOptions,
|
||||||
[webP.type]: WebPEncoderOptions,
|
[webP.type]: WebPEncoderOptions,
|
||||||
|
[avif.type]: AvifEncoderOptions,
|
||||||
[browserPNG.type]: undefined,
|
[browserPNG.type]: undefined,
|
||||||
[browserJPEG.type]: BrowserJPEGEncoderOptions,
|
[browserJPEG.type]: BrowserJPEGEncoderOptions,
|
||||||
[browserWebP.type]: BrowserWebPEncoderOptions,
|
[browserWebP.type]: BrowserWebPEncoderOptions,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import * as identity from '../../codecs/identity/encoder-meta';
|
|||||||
import * as oxiPNG from '../../codecs/oxipng/encoder-meta';
|
import * as oxiPNG from '../../codecs/oxipng/encoder-meta';
|
||||||
import * as mozJPEG from '../../codecs/mozjpeg/encoder-meta';
|
import * as mozJPEG from '../../codecs/mozjpeg/encoder-meta';
|
||||||
import * as webP from '../../codecs/webp/encoder-meta';
|
import * as webP from '../../codecs/webp/encoder-meta';
|
||||||
|
import * as avif from '../../codecs/avif/encoder-meta';
|
||||||
import * as browserPNG from '../../codecs/browser-png/encoder-meta';
|
import * as browserPNG from '../../codecs/browser-png/encoder-meta';
|
||||||
import * as browserJPEG from '../../codecs/browser-jpeg/encoder-meta';
|
import * as browserJPEG from '../../codecs/browser-jpeg/encoder-meta';
|
||||||
import * as browserWebP from '../../codecs/browser-webp/encoder-meta';
|
import * as browserWebP from '../../codecs/browser-webp/encoder-meta';
|
||||||
@@ -136,6 +137,7 @@ async function compressImage(
|
|||||||
case oxiPNG.type: return processor.oxiPngEncode(image, encodeData.options);
|
case oxiPNG.type: return processor.oxiPngEncode(image, encodeData.options);
|
||||||
case mozJPEG.type: return processor.mozjpegEncode(image, encodeData.options);
|
case mozJPEG.type: return processor.mozjpegEncode(image, encodeData.options);
|
||||||
case webP.type: return processor.webpEncode(image, encodeData.options);
|
case webP.type: return processor.webpEncode(image, encodeData.options);
|
||||||
|
case avif.type: return processor.avifEncode(image, encodeData.options);
|
||||||
case browserPNG.type: return processor.browserPngEncode(image);
|
case browserPNG.type: return processor.browserPngEncode(image);
|
||||||
case browserJPEG.type: return processor.browserJpegEncode(image, encodeData.options);
|
case browserJPEG.type: return processor.browserJpegEncode(image, encodeData.options);
|
||||||
case browserWebP.type: return processor.browserWebpEncode(image, encodeData.options);
|
case browserWebP.type: return processor.browserWebpEncode(image, encodeData.options);
|
||||||
@@ -230,7 +232,7 @@ export default class Compress extends Component<Props, State> {
|
|||||||
{
|
{
|
||||||
latestSettings: {
|
latestSettings: {
|
||||||
preprocessorState: defaultPreprocessorState,
|
preprocessorState: defaultPreprocessorState,
|
||||||
encoderState: { type: mozJPEG.type, options: mozJPEG.defaultOptions },
|
encoderState: { type: oxiPNG.type, options: oxiPNG.defaultOptions },
|
||||||
},
|
},
|
||||||
loadingCounter: 0,
|
loadingCounter: 0,
|
||||||
loadedCounter: 0,
|
loadedCounter: 0,
|
||||||
|
|||||||
@@ -78,11 +78,36 @@ async function decodeImage(url: string): Promise<HTMLImageElement> {
|
|||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Caches results from canDecodeImageType */
|
||||||
|
const canDecodeCache = new Map<string, Promise<boolean>>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to load the given URL as an image.
|
* Tests whether the browser supports a particular image mime type.
|
||||||
|
*
|
||||||
|
* @param type Mimetype
|
||||||
|
* @example await canDecodeImageType('image/avif')
|
||||||
*/
|
*/
|
||||||
export function canDecodeImage(url: string): Promise<boolean> {
|
export function canDecodeImageType(type: string): Promise<boolean> {
|
||||||
return decodeImage(url).then(() => true, () => false);
|
if (!canDecodeCache.has(type)) {
|
||||||
|
const resultPromise = (async () => {
|
||||||
|
const picture = document.createElement('picture');
|
||||||
|
const img = document.createElement('img');
|
||||||
|
const source = document.createElement('source');
|
||||||
|
source.srcset = 'data:,x';
|
||||||
|
source.type = type;
|
||||||
|
picture.append(source, img);
|
||||||
|
|
||||||
|
// Wait a single microtick just for the `img.currentSrc` to get populated.
|
||||||
|
await 0;
|
||||||
|
// At this point `img.currentSrc` will contain "data:,x" if format is supported and ""
|
||||||
|
// otherwise.
|
||||||
|
return !!img.currentSrc;
|
||||||
|
})();
|
||||||
|
|
||||||
|
canDecodeCache.set(type, resultPromise);
|
||||||
|
}
|
||||||
|
|
||||||
|
return canDecodeCache.get(type)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function blobToArrayBuffer(blob: Blob): Promise<ArrayBuffer> {
|
export function blobToArrayBuffer(blob: Blob): Promise<ArrayBuffer> {
|
||||||
@@ -104,6 +129,7 @@ const magicNumberToMimeType = new Map<RegExp, string>([
|
|||||||
[/^II*/, 'image/tiff'],
|
[/^II*/, 'image/tiff'],
|
||||||
[/^MM\x00*/, 'image/tiff'],
|
[/^MM\x00*/, 'image/tiff'],
|
||||||
[/^RIFF....WEBPVP8[LX ]/, 'image/webp'],
|
[/^RIFF....WEBPVP8[LX ]/, 'image/webp'],
|
||||||
|
[/^\x00\x00\x00 ftypavif\x00\x00\x00\x00/, 'image/avif'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export async function sniffMimeType(blob: Blob): Promise<string> {
|
export async function sniffMimeType(blob: Blob): Promise<string> {
|
||||||
|
|||||||
14
src/missing-types.d.ts
vendored
14
src/missing-types.d.ts
vendored
@@ -33,6 +33,20 @@ declare module 'url-loader!*' {
|
|||||||
export default value;
|
export default value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare module 'file-loader!*' {
|
||||||
|
const value: string;
|
||||||
|
export default value;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '*.worker.js' {
|
||||||
|
const value: string;
|
||||||
|
export default value;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'wasm-feature-detect' {
|
||||||
|
export const threads: () => Promise<boolean>;
|
||||||
|
}
|
||||||
|
|
||||||
declare var VERSION: string;
|
declare var VERSION: string;
|
||||||
|
|
||||||
declare var ga: {
|
declare var ga: {
|
||||||
|
|||||||
BIN
src/sw/tiny.avif
Normal file
BIN
src/sw/tiny.avif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 303 B |
|
Before Width: | Height: | Size: 38 B After Width: | Height: | Size: 38 B |
@@ -1,4 +1,5 @@
|
|||||||
import webpDataUrl from 'url-loader!../codecs/tiny.webp';
|
import webpDataUrl from 'url-loader!./tiny.webp';
|
||||||
|
import avifDataUrl from 'url-loader!./tiny.avif';
|
||||||
|
|
||||||
// Give TypeScript the correct global.
|
// Give TypeScript the correct global.
|
||||||
declare var self: ServiceWorkerGlobalScope;
|
declare var self: ServiceWorkerGlobalScope;
|
||||||
@@ -109,17 +110,20 @@ export async function cacheAdditionalProcessors(cacheName: string, buildAssets:
|
|||||||
|
|
||||||
toCache.push(...prefixMatches, ...wasm);
|
toCache.push(...prefixMatches, ...wasm);
|
||||||
|
|
||||||
const supportsWebP = await (async () => {
|
const [supportsWebP, supportsAvif] = await Promise.all(
|
||||||
if (!self.createImageBitmap) return false;
|
[webpDataUrl, avifDataUrl].map(async (dataUrl) => {
|
||||||
const response = await fetch(webpDataUrl);
|
if (!self.createImageBitmap) return false;
|
||||||
const blob = await response.blob();
|
const response = await fetch(dataUrl);
|
||||||
return createImageBitmap(blob).then(() => true, () => false);
|
const blob = await response.blob();
|
||||||
})();
|
return createImageBitmap(blob).then(() => true, () => false);
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
// No point caching the WebP decoder if the browser supports it:
|
// No point caching decoders the browser already supports:
|
||||||
if (supportsWebP) {
|
toCache = toCache.filter(asset =>
|
||||||
toCache = toCache.filter(asset => !/webp[\-_]dec/.test(asset));
|
(supportsWebP ? !/webp[\-_]dec/.test(asset) : true) &&
|
||||||
}
|
(supportsAvif ? !/avif[\-_]dec/.test(asset) : true),
|
||||||
|
);
|
||||||
|
|
||||||
const cache = await caches.open(cacheName);
|
const cache = await caches.open(cacheName);
|
||||||
await cache.addAll(toCache);
|
await cache.addAll(toCache);
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ module.exports = async function(_, env) {
|
|||||||
{
|
{
|
||||||
// Emscripten modules don't work with Webpack's Wasm loader.
|
// Emscripten modules don't work with Webpack's Wasm loader.
|
||||||
test: /\.wasm$/,
|
test: /\.wasm$/,
|
||||||
exclude: /_bg\.wasm$/,
|
exclude: /(?<!\bpkg-parallel[\\/]squoosh_oxipng)_bg\.wasm$/,
|
||||||
// This is needed to make webpack NOT process wasm files.
|
// This is needed to make webpack NOT process wasm files.
|
||||||
// See https://github.com/webpack/webpack/issues/6725
|
// See https://github.com/webpack/webpack/issues/6725
|
||||||
type: 'javascript/auto',
|
type: 'javascript/auto',
|
||||||
@@ -160,11 +160,11 @@ module.exports = async function(_, env) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Wasm modules generated by Rust + wasm-pack work great with Webpack.
|
// Wasm modules generated by Rust + wasm-pack work great with Webpack.
|
||||||
test: /_bg\.wasm$/,
|
test: /(?<!\bpkg-parallel[\\/]squoosh_oxipng)_bg\.wasm$/,
|
||||||
type: 'webassembly/experimental',
|
type: 'webassembly/experimental',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(png|svg|jpg|gif)$/,
|
test: /\.(png|svg|jpg|gif|worker\.js)$/,
|
||||||
loader: 'file-loader',
|
loader: 'file-loader',
|
||||||
options: {
|
options: {
|
||||||
name: '[name].[hash:5].[ext]',
|
name: '[name].[hash:5].[ext]',
|
||||||
@@ -174,8 +174,7 @@ module.exports = async function(_, env) {
|
|||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.IgnorePlugin(
|
new webpack.IgnorePlugin(
|
||||||
/(fs|crypto|path)/,
|
/^(fs|crypto|path|perf_hooks|worker_threads)$/
|
||||||
/[/\\]codecs[/\\]/
|
|
||||||
),
|
),
|
||||||
|
|
||||||
// Pretty progressbar showing build progress:
|
// Pretty progressbar showing build progress:
|
||||||
|
|||||||
Reference in New Issue
Block a user