@monogrid/gainmap-js 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v1.1.1
2
+ * @monogrid/gainmap-js v2.0.1
3
3
  * With ❤️, by MONOGRID <hello@mono-grid.com>
4
4
  */
5
5
 
@@ -114,6 +114,74 @@
114
114
  return dataTexture;
115
115
  };
116
116
 
117
+ const getBufferForType = (type, width, height) => {
118
+ let out;
119
+ switch (type) {
120
+ case three.UnsignedByteType:
121
+ out = new Uint8ClampedArray(width * height * 4);
122
+ break;
123
+ case three.HalfFloatType:
124
+ out = new Uint16Array(width * height * 4);
125
+ break;
126
+ case three.UnsignedIntType:
127
+ out = new Uint32Array(width * height * 4);
128
+ break;
129
+ case three.ByteType:
130
+ out = new Int8Array(width * height * 4);
131
+ break;
132
+ case three.ShortType:
133
+ out = new Int16Array(width * height * 4);
134
+ break;
135
+ case three.IntType:
136
+ out = new Int32Array(width * height * 4);
137
+ break;
138
+ case three.FloatType:
139
+ out = new Float32Array(width * height * 4);
140
+ break;
141
+ default:
142
+ throw new Error('Unsupported data type');
143
+ }
144
+ return out;
145
+ };
146
+ let _canReadPixelsResult;
147
+ /**
148
+ * Test if this browser implementation can correctly read pixels from the specified
149
+ * Render target type.
150
+ *
151
+ * Runs only once
152
+ *
153
+ * @param type
154
+ * @param renderer
155
+ * @param camera
156
+ * @returns
157
+ */
158
+ const canReadPixels = (type, renderer, camera) => {
159
+ if (_canReadPixelsResult !== undefined)
160
+ return _canReadPixelsResult;
161
+ const testRT = new three.WebGLRenderTarget(1, 1, {
162
+ type,
163
+ colorSpace: three.NoColorSpace,
164
+ format: three.RGBAFormat,
165
+ magFilter: three.LinearFilter,
166
+ minFilter: three.LinearFilter,
167
+ wrapS: three.RepeatWrapping,
168
+ wrapT: three.RepeatWrapping,
169
+ depthBuffer: false,
170
+ stencilBuffer: false,
171
+ generateMipmaps: true
172
+ });
173
+ renderer.setRenderTarget(testRT);
174
+ const mesh = new three.Mesh(new three.PlaneGeometry(), new three.MeshBasicMaterial({ color: 0xffffff }));
175
+ renderer.render(mesh, camera);
176
+ renderer.setRenderTarget(null);
177
+ const out = getBufferForType(type, testRT.width, testRT.height);
178
+ renderer.readRenderTargetPixels(testRT, 0, 0, testRT.width, testRT.height, out);
179
+ testRT.dispose();
180
+ mesh.geometry.dispose();
181
+ mesh.material.dispose();
182
+ _canReadPixelsResult = out[0] !== 0;
183
+ return _canReadPixelsResult;
184
+ };
117
185
  /**
118
186
  * Utility structure used for rendering a texture with a material
119
187
  *
@@ -128,6 +196,7 @@
128
196
  */
129
197
  constructor(width, height, type, colorSpace, material, renderer) {
130
198
  this._rendererIsDisposable = false;
199
+ this._supportsReadPixels = true;
131
200
  /**
132
201
  * Renders the input texture using the specified material
133
202
  */
@@ -146,9 +215,6 @@
146
215
  this._height = height;
147
216
  this._type = type;
148
217
  this._colorSpace = colorSpace;
149
- if (type === three.HalfFloatType && navigator.userAgent.toLowerCase().includes('firefox')) {
150
- this._type = three.FloatType;
151
- }
152
218
  this._material = material;
153
219
  if (renderer) {
154
220
  this._renderer = renderer;
@@ -165,6 +231,22 @@
165
231
  this._camera.top = 0.5;
166
232
  this._camera.bottom = -0.5;
167
233
  this._camera.updateProjectionMatrix();
234
+ if (!canReadPixels(this._type, this._renderer, this._camera)) {
235
+ let alternativeType;
236
+ switch (this._type) {
237
+ case three.HalfFloatType:
238
+ alternativeType = this._renderer.extensions.has('EXT_color_buffer_float') ? three.FloatType : undefined;
239
+ break;
240
+ }
241
+ if (alternativeType !== undefined) {
242
+ console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${three.FloatType}`);
243
+ this._type = alternativeType;
244
+ }
245
+ else {
246
+ this._supportsReadPixels = false;
247
+ console.warn('This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown');
248
+ }
249
+ }
168
250
  this._quad = new three.Mesh(new three.PlaneGeometry(), this._material);
169
251
  this._quad.geometry.computeBoundingBox();
170
252
  this._scene.add(this._quad);
@@ -198,35 +280,13 @@
198
280
  /**
199
281
  * Obtains a Buffer containing the rendered texture.
200
282
  *
201
- * @returns
283
+ * @throws Error if the browser cannot read pixels from this RenderTarget type.
284
+ * @returns a TypedArray containing RGBA values from this renderer
202
285
  */
203
286
  toArray() {
204
- let out;
205
- switch (this._type) {
206
- case three.UnsignedByteType:
207
- out = new Uint8ClampedArray(this._width * this._height * 4);
208
- break;
209
- case three.HalfFloatType:
210
- out = new Uint16Array(this._width * this._height * 4);
211
- break;
212
- case three.UnsignedIntType:
213
- out = new Uint32Array(this._width * this._height * 4);
214
- break;
215
- case three.ByteType:
216
- out = new Int8Array(this._width * this._height * 4);
217
- break;
218
- case three.ShortType:
219
- out = new Int16Array(this._width * this._height * 4);
220
- break;
221
- case three.IntType:
222
- out = new Int32Array(this._width * this._height * 4);
223
- break;
224
- case three.FloatType:
225
- out = new Float32Array(this._width * this._height * 4);
226
- break;
227
- default:
228
- throw new Error('Unsupported data type');
229
- }
287
+ if (!this._supportsReadPixels)
288
+ throw new Error('Can\'t read pixels in this browser');
289
+ const out = getBufferForType(this._type, this._width, this._height);
230
290
  this._renderer.readRenderTargetPixels(this._renderTarget, 0, 0, this._width, this._height, out);
231
291
  return out;
232
292
  }
Binary file
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v1.1.1
2
+ * @monogrid/gainmap-js v2.0.1
3
3
  * With ❤️, by MONOGRID <hello@mono-grid.com>
4
4
  */
5
5
 
@@ -31,7 +31,7 @@ Module['ready'] = new Promise((resolve, reject) => {
31
31
  readyPromiseResolve = resolve;
32
32
  readyPromiseReject = reject;
33
33
  });
34
- ["_main","_memory","___indirect_function_table","_fflush","onRuntimeInitialized"].forEach((prop) => {
34
+ ["_main","_memory","___indirect_function_table","__embind_initialize_bindings","_fflush","onRuntimeInitialized"].forEach((prop) => {
35
35
  if (!Object.getOwnPropertyDescriptor(Module['ready'], prop)) {
36
36
  Object.defineProperty(Module['ready'], prop, {
37
37
  get: () => abort('You are getting ' + prop + ' on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js'),
@@ -349,7 +349,7 @@ assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at bui
349
349
  // An online HTML version (which may be of a different version of Emscripten)
350
350
  // is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
351
351
 
352
- var wasmBinary;
352
+ var wasmBinary;
353
353
  if (Module['wasmBinary']) wasmBinary = Module['wasmBinary'];legacyModuleProp('wasmBinary', 'wasmBinary');
354
354
 
355
355
  if (typeof WebAssembly != 'object') {
@@ -373,10 +373,6 @@ var ABORT = false;
373
373
  // but only when noExitRuntime is false.
374
374
  var EXITSTATUS;
375
375
 
376
- // In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we
377
- // don't define it at all in release modes. This matches the behaviour of
378
- // MINIMAL_RUNTIME.
379
- // TODO(sbc): Make this the default even without STRICT enabled.
380
376
  /** @type {function(*, string=)} */
381
377
  function assert(condition, text) {
382
378
  if (!condition) {
@@ -1171,7 +1167,10 @@ function unexportedRuntimeSymbol(sym) {
1171
1167
  var setter = field.setter;
1172
1168
  var setterContext = field.setterContext;
1173
1169
  fields[fieldName] = {
1174
- read: (ptr) => getterReturnType['fromWireType'](getter(getterContext, ptr)),
1170
+ read: (ptr) => {
1171
+ return getterReturnType['fromWireType'](
1172
+ getter(getterContext, ptr));
1173
+ },
1175
1174
  write: (ptr, o) => {
1176
1175
  var destructors = [];
1177
1176
  setter(setterContext, ptr, setterArgumentType['toWireType'](destructors, o));
@@ -1437,12 +1436,33 @@ function unexportedRuntimeSymbol(sym) {
1437
1436
  });
1438
1437
  };
1439
1438
 
1440
- var createNamedFunction = (name, body) => Object.defineProperty(body, 'name', {
1441
- value: name
1442
- });
1439
+ var char_0 = 48;
1443
1440
 
1441
+ var char_9 = 57;
1442
+ var makeLegalFunctionName = (name) => {
1443
+ if (undefined === name) {
1444
+ return '_unknown';
1445
+ }
1446
+ name = name.replace(/[^a-zA-Z0-9_]/g, '$');
1447
+ var f = name.charCodeAt(0);
1448
+ if (f >= char_0 && f <= char_9) {
1449
+ return `_${name}`;
1450
+ }
1451
+ return name;
1452
+ };
1444
1453
 
1445
1454
 
1455
+
1456
+ function createNamedFunction(name, body) {
1457
+ name = makeLegalFunctionName(name);
1458
+ // Use an abject with a computed property name to create a new function with
1459
+ // a name specified at runtime, but without using `new Function` or `eval`.
1460
+ return {
1461
+ [name]: function() {
1462
+ return body.apply(this, arguments);
1463
+ }
1464
+ }[name];
1465
+ }
1446
1466
  function newFunc(constructor, argumentList) {
1447
1467
  if (!(constructor instanceof Function)) {
1448
1468
  throw new TypeError(`new_ called with constructor type ${typeof(constructor)} which is not a function`);
@@ -1511,7 +1531,7 @@ function unexportedRuntimeSymbol(sym) {
1511
1531
  }
1512
1532
 
1513
1533
  var invokerFnBody = `
1514
- return function (${argsList}) {
1534
+ return function ${makeLegalFunctionName(humanName)}(${argsList}) {
1515
1535
  if (arguments.length !== ${argCount - 2}) {
1516
1536
  throwBindingError('function ${humanName} called with ' + arguments.length + ' arguments, expected ${argCount - 2}');
1517
1537
  }`;
@@ -1563,8 +1583,7 @@ function unexportedRuntimeSymbol(sym) {
1563
1583
 
1564
1584
  args1.push(invokerFnBody);
1565
1585
 
1566
- var invokerFn = newFunc(Function, args1).apply(null, args2);
1567
- return createNamedFunction(humanName, invokerFn);
1586
+ return newFunc(Function, args1).apply(null, args2);
1568
1587
  }
1569
1588
 
1570
1589
  var ensureOverloadTable = (proto, methodName, humanName) => {
@@ -1896,7 +1915,7 @@ function unexportedRuntimeSymbol(sym) {
1896
1915
 
1897
1916
 
1898
1917
  var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
1899
- assert(typeof str === 'string', `stringToUTF8Array expects a string (got ${typeof str})`);
1918
+ assert(typeof str === 'string');
1900
1919
  // Parameter maxBytesToWrite is not optional. Negative values, 0, null,
1901
1920
  // undefined and false each don't write out any bytes.
1902
1921
  if (!(maxBytesToWrite > 0))
@@ -2040,7 +2059,7 @@ function unexportedRuntimeSymbol(sym) {
2040
2059
  * @return {string}
2041
2060
  */
2042
2061
  var UTF8ToString = (ptr, maxBytesToRead) => {
2043
- assert(typeof ptr == 'number', `UTF8ToString expects a number (got ${typeof ptr})`);
2062
+ assert(typeof ptr == 'number');
2044
2063
  return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';
2045
2064
  };
2046
2065
  var __embind_register_std_string = (rawType, name) => {
@@ -2413,7 +2432,9 @@ function unexportedRuntimeSymbol(sym) {
2413
2432
  return symbol;
2414
2433
  };
2415
2434
 
2416
- var __emval_new_cstring = (v) => Emval.toHandle(getStringOrSymbol(v));
2435
+ var __emval_new_cstring = (v) => {
2436
+ return Emval.toHandle(getStringOrSymbol(v));
2437
+ };
2417
2438
 
2418
2439
 
2419
2440
 
@@ -2628,7 +2649,9 @@ function unexportedRuntimeSymbol(sym) {
2628
2649
  var paths = Array.prototype.slice.call(arguments);
2629
2650
  return PATH.normalize(paths.join('/'));
2630
2651
  },
2631
- join2:(l, r) => PATH.normalize(l + '/' + r),
2652
+ join2:(l, r) => {
2653
+ return PATH.normalize(l + '/' + r);
2654
+ },
2632
2655
  };
2633
2656
 
2634
2657
  var initRandomFill = () => {
@@ -3285,7 +3308,7 @@ function unexportedRuntimeSymbol(sym) {
3285
3308
 
3286
3309
 
3287
3310
  var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => {
3288
- FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn);
3311
+ return FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn);
3289
3312
  };
3290
3313
 
3291
3314
  var preloadPlugins = Module['preloadPlugins'] || [];
@@ -3482,128 +3505,7 @@ function unexportedRuntimeSymbol(sym) {
3482
3505
  };
3483
3506
 
3484
3507
  var ERRNO_CODES = {
3485
- 'EPERM': 63,
3486
- 'ENOENT': 44,
3487
- 'ESRCH': 71,
3488
- 'EINTR': 27,
3489
- 'EIO': 29,
3490
- 'ENXIO': 60,
3491
- 'E2BIG': 1,
3492
- 'ENOEXEC': 45,
3493
- 'EBADF': 8,
3494
- 'ECHILD': 12,
3495
- 'EAGAIN': 6,
3496
- 'EWOULDBLOCK': 6,
3497
- 'ENOMEM': 48,
3498
- 'EACCES': 2,
3499
- 'EFAULT': 21,
3500
- 'ENOTBLK': 105,
3501
- 'EBUSY': 10,
3502
- 'EEXIST': 20,
3503
- 'EXDEV': 75,
3504
- 'ENODEV': 43,
3505
- 'ENOTDIR': 54,
3506
- 'EISDIR': 31,
3507
- 'EINVAL': 28,
3508
- 'ENFILE': 41,
3509
- 'EMFILE': 33,
3510
- 'ENOTTY': 59,
3511
- 'ETXTBSY': 74,
3512
- 'EFBIG': 22,
3513
- 'ENOSPC': 51,
3514
- 'ESPIPE': 70,
3515
- 'EROFS': 69,
3516
- 'EMLINK': 34,
3517
- 'EPIPE': 64,
3518
- 'EDOM': 18,
3519
- 'ERANGE': 68,
3520
- 'ENOMSG': 49,
3521
- 'EIDRM': 24,
3522
- 'ECHRNG': 106,
3523
- 'EL2NSYNC': 156,
3524
- 'EL3HLT': 107,
3525
- 'EL3RST': 108,
3526
- 'ELNRNG': 109,
3527
- 'EUNATCH': 110,
3528
- 'ENOCSI': 111,
3529
- 'EL2HLT': 112,
3530
- 'EDEADLK': 16,
3531
- 'ENOLCK': 46,
3532
- 'EBADE': 113,
3533
- 'EBADR': 114,
3534
- 'EXFULL': 115,
3535
- 'ENOANO': 104,
3536
- 'EBADRQC': 103,
3537
- 'EBADSLT': 102,
3538
- 'EDEADLOCK': 16,
3539
- 'EBFONT': 101,
3540
- 'ENOSTR': 100,
3541
- 'ENODATA': 116,
3542
- 'ETIME': 117,
3543
- 'ENOSR': 118,
3544
- 'ENONET': 119,
3545
- 'ENOPKG': 120,
3546
- 'EREMOTE': 121,
3547
- 'ENOLINK': 47,
3548
- 'EADV': 122,
3549
- 'ESRMNT': 123,
3550
- 'ECOMM': 124,
3551
- 'EPROTO': 65,
3552
- 'EMULTIHOP': 36,
3553
- 'EDOTDOT': 125,
3554
- 'EBADMSG': 9,
3555
- 'ENOTUNIQ': 126,
3556
- 'EBADFD': 127,
3557
- 'EREMCHG': 128,
3558
- 'ELIBACC': 129,
3559
- 'ELIBBAD': 130,
3560
- 'ELIBSCN': 131,
3561
- 'ELIBMAX': 132,
3562
- 'ELIBEXEC': 133,
3563
- 'ENOSYS': 52,
3564
- 'ENOTEMPTY': 55,
3565
- 'ENAMETOOLONG': 37,
3566
- 'ELOOP': 32,
3567
- 'EOPNOTSUPP': 138,
3568
- 'EPFNOSUPPORT': 139,
3569
- 'ECONNRESET': 15,
3570
- 'ENOBUFS': 42,
3571
- 'EAFNOSUPPORT': 5,
3572
- 'EPROTOTYPE': 67,
3573
- 'ENOTSOCK': 57,
3574
- 'ENOPROTOOPT': 50,
3575
- 'ESHUTDOWN': 140,
3576
- 'ECONNREFUSED': 14,
3577
- 'EADDRINUSE': 3,
3578
- 'ECONNABORTED': 13,
3579
- 'ENETUNREACH': 40,
3580
- 'ENETDOWN': 38,
3581
- 'ETIMEDOUT': 73,
3582
- 'EHOSTDOWN': 142,
3583
- 'EHOSTUNREACH': 23,
3584
- 'EINPROGRESS': 26,
3585
- 'EALREADY': 7,
3586
- 'EDESTADDRREQ': 17,
3587
- 'EMSGSIZE': 35,
3588
- 'EPROTONOSUPPORT': 66,
3589
- 'ESOCKTNOSUPPORT': 137,
3590
- 'EADDRNOTAVAIL': 4,
3591
- 'ENETRESET': 39,
3592
- 'EISCONN': 30,
3593
- 'ENOTCONN': 53,
3594
- 'ETOOMANYREFS': 141,
3595
- 'EUSERS': 136,
3596
- 'EDQUOT': 19,
3597
- 'ESTALE': 72,
3598
- 'ENOTSUP': 138,
3599
- 'ENOMEDIUM': 148,
3600
- 'EILSEQ': 25,
3601
- 'EOVERFLOW': 61,
3602
- 'ECANCELED': 11,
3603
- 'ENOTRECOVERABLE': 56,
3604
- 'EOWNERDEAD': 62,
3605
- 'ESTRPIPE': 135,
3606
- };
3508
+ };
3607
3509
 
3608
3510
  var demangle = (func) => {
3609
3511
  warnOnce('warning: build with -sDEMANGLE_SUPPORT to link in libcxxabi demangling');
@@ -4942,6 +4844,7 @@ function unexportedRuntimeSymbol(sym) {
4942
4844
  FS.close(stream);
4943
4845
  FS.chmod(node, mode);
4944
4846
  }
4847
+ return node;
4945
4848
  },
4946
4849
  createDevice(parent, name, input, output) {
4947
4850
  var path = PATH.join2(typeof parent == 'string' ? parent : FS.getPath(parent), name);
@@ -5240,19 +5143,19 @@ function unexportedRuntimeSymbol(sym) {
5240
5143
  HEAP32[(((buf)+(12))>>2)] = stat.uid;
5241
5144
  HEAP32[(((buf)+(16))>>2)] = stat.gid;
5242
5145
  HEAP32[(((buf)+(20))>>2)] = stat.rdev;
5243
- (tempI64 = [stat.size>>>0,(tempDouble = stat.size,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(24))>>2)] = tempI64[0],HEAP32[(((buf)+(28))>>2)] = tempI64[1]);
5146
+ (tempI64 = [stat.size>>>0,(tempDouble=stat.size,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(24))>>2)] = tempI64[0],HEAP32[(((buf)+(28))>>2)] = tempI64[1]);
5244
5147
  HEAP32[(((buf)+(32))>>2)] = 4096;
5245
5148
  HEAP32[(((buf)+(36))>>2)] = stat.blocks;
5246
5149
  var atime = stat.atime.getTime();
5247
5150
  var mtime = stat.mtime.getTime();
5248
5151
  var ctime = stat.ctime.getTime();
5249
- (tempI64 = [Math.floor(atime / 1000)>>>0,(tempDouble = Math.floor(atime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(40))>>2)] = tempI64[0],HEAP32[(((buf)+(44))>>2)] = tempI64[1]);
5152
+ (tempI64 = [Math.floor(atime / 1000)>>>0,(tempDouble=Math.floor(atime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(40))>>2)] = tempI64[0],HEAP32[(((buf)+(44))>>2)] = tempI64[1]);
5250
5153
  HEAPU32[(((buf)+(48))>>2)] = (atime % 1000) * 1000;
5251
- (tempI64 = [Math.floor(mtime / 1000)>>>0,(tempDouble = Math.floor(mtime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(56))>>2)] = tempI64[0],HEAP32[(((buf)+(60))>>2)] = tempI64[1]);
5154
+ (tempI64 = [Math.floor(mtime / 1000)>>>0,(tempDouble=Math.floor(mtime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(56))>>2)] = tempI64[0],HEAP32[(((buf)+(60))>>2)] = tempI64[1]);
5252
5155
  HEAPU32[(((buf)+(64))>>2)] = (mtime % 1000) * 1000;
5253
- (tempI64 = [Math.floor(ctime / 1000)>>>0,(tempDouble = Math.floor(ctime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(72))>>2)] = tempI64[0],HEAP32[(((buf)+(76))>>2)] = tempI64[1]);
5156
+ (tempI64 = [Math.floor(ctime / 1000)>>>0,(tempDouble=Math.floor(ctime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(72))>>2)] = tempI64[0],HEAP32[(((buf)+(76))>>2)] = tempI64[1]);
5254
5157
  HEAPU32[(((buf)+(80))>>2)] = (ctime % 1000) * 1000;
5255
- (tempI64 = [stat.ino>>>0,(tempDouble = stat.ino,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(88))>>2)] = tempI64[0],HEAP32[(((buf)+(92))>>2)] = tempI64[1]);
5158
+ (tempI64 = [stat.ino>>>0,(tempDouble=stat.ino,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(88))>>2)] = tempI64[0],HEAP32[(((buf)+(92))>>2)] = tempI64[1]);
5256
5159
  return 0;
5257
5160
  },
5258
5161
  doMsync(addr, stream, len, flags, offset) {
@@ -5393,7 +5296,7 @@ function unexportedRuntimeSymbol(sym) {
5393
5296
  if (isNaN(offset)) return 61;
5394
5297
  var stream = SYSCALLS.getStreamFromFD(fd);
5395
5298
  FS.llseek(stream, offset, whence);
5396
- (tempI64 = [stream.position>>>0,(tempDouble = stream.position,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[((newOffset)>>2)] = tempI64[0],HEAP32[(((newOffset)+(4))>>2)] = tempI64[1]);
5299
+ (tempI64 = [stream.position>>>0,(tempDouble=stream.position,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[((newOffset)>>2)] = tempI64[0],HEAP32[(((newOffset)+(4))>>2)] = tempI64[1]);
5397
5300
  if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; // reset readdir state
5398
5301
  return 0;
5399
5302
  } catch (e) {
@@ -5432,7 +5335,9 @@ function unexportedRuntimeSymbol(sym) {
5432
5335
  }
5433
5336
  }
5434
5337
 
5435
- var isLeapYear = (year) => year%4 === 0 && (year%100 !== 0 || year%400 === 0);
5338
+ var isLeapYear = (year) => {
5339
+ return year%4 === 0 && (year%100 !== 0 || year%400 === 0);
5340
+ };
5436
5341
 
5437
5342
  var arraySum = (array, index) => {
5438
5343
  var sum = 0;
@@ -5804,7 +5709,129 @@ init_emval();UnboundTypeError = Module['UnboundTypeError'] = extendError(Error,
5804
5709
  });
5805
5710
  FS.FSNode = FSNode;
5806
5711
  FS.createPreloadedFile = FS_createPreloadedFile;
5807
- FS.staticInit();function checkIncomingModuleAPI() {
5712
+ FS.staticInit();ERRNO_CODES = {
5713
+ 'EPERM': 63,
5714
+ 'ENOENT': 44,
5715
+ 'ESRCH': 71,
5716
+ 'EINTR': 27,
5717
+ 'EIO': 29,
5718
+ 'ENXIO': 60,
5719
+ 'E2BIG': 1,
5720
+ 'ENOEXEC': 45,
5721
+ 'EBADF': 8,
5722
+ 'ECHILD': 12,
5723
+ 'EAGAIN': 6,
5724
+ 'EWOULDBLOCK': 6,
5725
+ 'ENOMEM': 48,
5726
+ 'EACCES': 2,
5727
+ 'EFAULT': 21,
5728
+ 'ENOTBLK': 105,
5729
+ 'EBUSY': 10,
5730
+ 'EEXIST': 20,
5731
+ 'EXDEV': 75,
5732
+ 'ENODEV': 43,
5733
+ 'ENOTDIR': 54,
5734
+ 'EISDIR': 31,
5735
+ 'EINVAL': 28,
5736
+ 'ENFILE': 41,
5737
+ 'EMFILE': 33,
5738
+ 'ENOTTY': 59,
5739
+ 'ETXTBSY': 74,
5740
+ 'EFBIG': 22,
5741
+ 'ENOSPC': 51,
5742
+ 'ESPIPE': 70,
5743
+ 'EROFS': 69,
5744
+ 'EMLINK': 34,
5745
+ 'EPIPE': 64,
5746
+ 'EDOM': 18,
5747
+ 'ERANGE': 68,
5748
+ 'ENOMSG': 49,
5749
+ 'EIDRM': 24,
5750
+ 'ECHRNG': 106,
5751
+ 'EL2NSYNC': 156,
5752
+ 'EL3HLT': 107,
5753
+ 'EL3RST': 108,
5754
+ 'ELNRNG': 109,
5755
+ 'EUNATCH': 110,
5756
+ 'ENOCSI': 111,
5757
+ 'EL2HLT': 112,
5758
+ 'EDEADLK': 16,
5759
+ 'ENOLCK': 46,
5760
+ 'EBADE': 113,
5761
+ 'EBADR': 114,
5762
+ 'EXFULL': 115,
5763
+ 'ENOANO': 104,
5764
+ 'EBADRQC': 103,
5765
+ 'EBADSLT': 102,
5766
+ 'EDEADLOCK': 16,
5767
+ 'EBFONT': 101,
5768
+ 'ENOSTR': 100,
5769
+ 'ENODATA': 116,
5770
+ 'ETIME': 117,
5771
+ 'ENOSR': 118,
5772
+ 'ENONET': 119,
5773
+ 'ENOPKG': 120,
5774
+ 'EREMOTE': 121,
5775
+ 'ENOLINK': 47,
5776
+ 'EADV': 122,
5777
+ 'ESRMNT': 123,
5778
+ 'ECOMM': 124,
5779
+ 'EPROTO': 65,
5780
+ 'EMULTIHOP': 36,
5781
+ 'EDOTDOT': 125,
5782
+ 'EBADMSG': 9,
5783
+ 'ENOTUNIQ': 126,
5784
+ 'EBADFD': 127,
5785
+ 'EREMCHG': 128,
5786
+ 'ELIBACC': 129,
5787
+ 'ELIBBAD': 130,
5788
+ 'ELIBSCN': 131,
5789
+ 'ELIBMAX': 132,
5790
+ 'ELIBEXEC': 133,
5791
+ 'ENOSYS': 52,
5792
+ 'ENOTEMPTY': 55,
5793
+ 'ENAMETOOLONG': 37,
5794
+ 'ELOOP': 32,
5795
+ 'EOPNOTSUPP': 138,
5796
+ 'EPFNOSUPPORT': 139,
5797
+ 'ECONNRESET': 15,
5798
+ 'ENOBUFS': 42,
5799
+ 'EAFNOSUPPORT': 5,
5800
+ 'EPROTOTYPE': 67,
5801
+ 'ENOTSOCK': 57,
5802
+ 'ENOPROTOOPT': 50,
5803
+ 'ESHUTDOWN': 140,
5804
+ 'ECONNREFUSED': 14,
5805
+ 'EADDRINUSE': 3,
5806
+ 'ECONNABORTED': 13,
5807
+ 'ENETUNREACH': 40,
5808
+ 'ENETDOWN': 38,
5809
+ 'ETIMEDOUT': 73,
5810
+ 'EHOSTDOWN': 142,
5811
+ 'EHOSTUNREACH': 23,
5812
+ 'EINPROGRESS': 26,
5813
+ 'EALREADY': 7,
5814
+ 'EDESTADDRREQ': 17,
5815
+ 'EMSGSIZE': 35,
5816
+ 'EPROTONOSUPPORT': 66,
5817
+ 'ESOCKTNOSUPPORT': 137,
5818
+ 'EADDRNOTAVAIL': 4,
5819
+ 'ENETRESET': 39,
5820
+ 'EISCONN': 30,
5821
+ 'ENOTCONN': 53,
5822
+ 'ETOOMANYREFS': 141,
5823
+ 'EUSERS': 136,
5824
+ 'EDQUOT': 19,
5825
+ 'ESTALE': 72,
5826
+ 'ENOTSUP': 138,
5827
+ 'ENOMEDIUM': 148,
5828
+ 'EILSEQ': 25,
5829
+ 'EOVERFLOW': 61,
5830
+ 'ECANCELED': 11,
5831
+ 'ENOTRECOVERABLE': 56,
5832
+ 'EOWNERDEAD': 62,
5833
+ 'ESTRPIPE': 135,
5834
+ };function checkIncomingModuleAPI() {
5808
5835
  ignoredModuleProp('fetchSettings');
5809
5836
  }
5810
5837
  var wasmImports = {
@@ -5886,6 +5913,7 @@ var _malloc = createExportWrapper('malloc');
5886
5913
  var _main = Module['_main'] = createExportWrapper('main');
5887
5914
  var _free = createExportWrapper('free');
5888
5915
  var ___getTypeName = createExportWrapper('__getTypeName');
5916
+ Module['__embind_initialize_bindings'] = createExportWrapper('_embind_initialize_bindings');
5889
5917
  var _fflush = Module['_fflush'] = createExportWrapper('fflush');
5890
5918
  var _setThrew = createExportWrapper('setThrew');
5891
5919
  var _emscripten_stack_init = () => (_emscripten_stack_init = wasmExports['emscripten_stack_init'])();
@@ -6149,11 +6177,8 @@ var missingLibrarySymbols = [
6149
6177
  'downcastPointer',
6150
6178
  'upcastPointer',
6151
6179
  'validateThis',
6152
- 'char_0',
6153
- 'char_9',
6154
- 'makeLegalFunctionName',
6180
+ 'craftEmvalAllocator',
6155
6181
  'emval_get_global',
6156
- 'emval_returnValue',
6157
6182
  'emval_lookupTypes',
6158
6183
  'emval_addMethodCaller',
6159
6184
  ];
@@ -6334,14 +6359,17 @@ var unexportedSymbols = [
6334
6359
  'detachFinalizer_deps',
6335
6360
  'deletionQueue',
6336
6361
  'delayFunction',
6362
+ 'char_0',
6363
+ 'char_9',
6364
+ 'makeLegalFunctionName',
6337
6365
  'emval_handles',
6338
6366
  'emval_symbols',
6339
6367
  'init_emval',
6340
6368
  'count_emval_handles',
6341
6369
  'getStringOrSymbol',
6342
6370
  'Emval',
6371
+ 'emval_newers',
6343
6372
  'emval_methodCallers',
6344
- 'reflectConstruct',
6345
6373
  ];
6346
6374
  unexportedSymbols.forEach(unexportedRuntimeSymbol);
6347
6375
 
@@ -6496,6 +6524,7 @@ run();
6496
6524
 
6497
6525
  return moduleArg.ready
6498
6526
  }
6527
+
6499
6528
  );
6500
6529
  })();
6501
6530
  var libultrahdr = Module;