@fxi/zartigl 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/dist/zartigl.js +214 -214
  2. package/package.json +4 -1
package/dist/zartigl.js CHANGED
@@ -69,8 +69,8 @@ function RI(g, I) {
69
69
  const A = I ?? Vg, B = document.createElement("canvas");
70
70
  B.width = 256, B.height = 1;
71
71
  const y = B.getContext("2d"), Q = y.createLinearGradient(0, 0, 256, 0);
72
- for (const [s, o] of Object.entries(A))
73
- Q.addColorStop(Number(s), o);
72
+ for (const [s, a] of Object.entries(A))
73
+ Q.addColorStop(Number(s), a);
74
74
  y.fillStyle = Q, y.fillRect(0, 0, 256, 1);
75
75
  const G = g.createTexture();
76
76
  if (!G) throw new Error("Failed to create color ramp texture");
@@ -349,8 +349,8 @@ class $g {
349
349
  const B = new Uint8Array(this.numParticles * 4);
350
350
  for (let D = 0; D < B.length; D++)
351
351
  B[D] = Math.floor(Math.random() * 256);
352
- const y = this.particleStateRes, Q = cA(I, I.NEAREST, B, y, y), G = cA(I, I.NEAREST, B, y, y), s = KA(I, Q), o = KA(I, G);
353
- this.particleStateTextures = [Q, G], this.particleFramebuffers = [s, o];
352
+ const y = this.particleStateRes, Q = cA(I, I.NEAREST, B, y, y), G = cA(I, I.NEAREST, B, y, y), s = KA(I, Q), a = KA(I, G);
353
+ this.particleStateTextures = [Q, G], this.particleFramebuffers = [s, a];
354
354
  const E = new Float32Array(this.numParticles);
355
355
  for (let D = 0; D < this.numParticles; D++) E[D] = D;
356
356
  this.particleIndexBuffer = I.createBuffer(), I.bindBuffer(I.ARRAY_BUFFER, this.particleIndexBuffer), I.bufferData(I.ARRAY_BUFFER, E, I.STATIC_DRAW);
@@ -362,74 +362,74 @@ class $g {
362
362
  if (I === this.screenWidth && A === this.screenHeight) return;
363
363
  const B = this.gl;
364
364
  this.screenWidth = I, this.screenHeight = A, this.screenTextures && (B.deleteTexture(this.screenTextures[0]), B.deleteTexture(this.screenTextures[1]), B.deleteFramebuffer(this.screenFramebuffers[0]), B.deleteFramebuffer(this.screenFramebuffers[1]));
365
- const y = new Uint8Array(I * A * 4), Q = cA(B, B.NEAREST, y, I, A), G = cA(B, B.NEAREST, y, I, A), s = KA(B, Q), o = KA(B, G);
366
- this.screenTextures = [Q, G], this.screenFramebuffers = [s, o];
365
+ const y = new Uint8Array(I * A * 4), Q = cA(B, B.NEAREST, y, I, A), G = cA(B, B.NEAREST, y, I, A), s = KA(B, Q), a = KA(B, G);
366
+ this.screenTextures = [Q, G], this.screenFramebuffers = [s, a];
367
367
  }
368
368
  /**
369
369
  * Run one simulation step: update positions, fade trails, draw particles.
370
370
  * Must be called within the MapLibre render callback.
371
371
  */
372
372
  render(I, A, B, y, Q, G, s) {
373
- const o = this.gl;
373
+ const a = this.gl;
374
374
  if (this.screenWidth === 0 || this.screenHeight === 0) return;
375
- const E = o.getParameter(o.FRAMEBUFFER_BINDING);
376
- o.disable(o.BLEND), o.useProgram(this.updateProgram), o.viewport(0, 0, this.particleStateRes, this.particleStateRes), GA(o, this.particleStateTextures[0], 0), o.uniform1i(this.updateLocs.u_particles, 0), o.uniform1i(this.updateLocs.u_velocity, I), o.uniform2f(
375
+ const E = a.getParameter(a.FRAMEBUFFER_BINDING);
376
+ a.disable(a.BLEND), a.useProgram(this.updateProgram), a.viewport(0, 0, this.particleStateRes, this.particleStateRes), GA(a, this.particleStateTextures[0], 0), a.uniform1i(this.updateLocs.u_particles, 0), a.uniform1i(this.updateLocs.u_velocity, I), a.uniform2f(
377
377
  this.updateLocs.u_velocity_min,
378
378
  A[0],
379
379
  A[1]
380
- ), o.uniform2f(
380
+ ), a.uniform2f(
381
381
  this.updateLocs.u_velocity_max,
382
382
  B[0],
383
383
  B[1]
384
- ), o.uniform1f(this.updateLocs.u_speed_factor, this.params.speedFactor), o.uniform1f(this.updateLocs.u_rand_seed, Math.random()), o.uniform1f(this.updateLocs.u_drop_rate, this.params.dropRate), o.uniform1f(this.updateLocs.u_drop_rate_bump, this.params.dropRateBump), o.uniform4f(
384
+ ), a.uniform1f(this.updateLocs.u_speed_factor, this.params.speedFactor), a.uniform1f(this.updateLocs.u_rand_seed, Math.random()), a.uniform1f(this.updateLocs.u_drop_rate, this.params.dropRate), a.uniform1f(this.updateLocs.u_drop_rate_bump, this.params.dropRateBump), a.uniform4f(
385
385
  this.updateLocs.u_bounds,
386
386
  Q.minX,
387
387
  Q.minY,
388
388
  Q.maxX,
389
389
  Q.maxY
390
- ), s && o.uniform4f(
390
+ ), s && a.uniform4f(
391
391
  this.updateLocs.u_geo_bounds,
392
392
  s.west,
393
393
  s.south,
394
394
  s.east,
395
395
  s.north
396
- ), o.bindFramebuffer(o.FRAMEBUFFER, this.particleFramebuffers[1]), this.drawQuad(), o.viewport(0, 0, this.screenWidth, this.screenHeight), o.bindFramebuffer(o.FRAMEBUFFER, this.screenFramebuffers[1]), o.useProgram(this.fadeProgram), o.disable(o.BLEND), GA(o, this.screenTextures[0], 0), o.uniform1i(this.fadeLocs.u_screen, 0), o.uniform1f(this.fadeLocs.u_opacity, this.params.fadeOpacity), this.drawQuad(), o.useProgram(this.drawProgram), o.enable(o.BLEND), o.blendFunc(o.SRC_ALPHA, o.ONE_MINUS_SRC_ALPHA), GA(o, this.particleStateTextures[1], 0), o.uniform1i(this.drawLocs.u_particles, 0), o.uniform1i(this.drawLocs.u_velocity, I), o.uniform2f(
396
+ ), a.bindFramebuffer(a.FRAMEBUFFER, this.particleFramebuffers[1]), this.drawQuad(), a.viewport(0, 0, this.screenWidth, this.screenHeight), a.bindFramebuffer(a.FRAMEBUFFER, this.screenFramebuffers[1]), a.useProgram(this.fadeProgram), a.disable(a.BLEND), GA(a, this.screenTextures[0], 0), a.uniform1i(this.fadeLocs.u_screen, 0), a.uniform1f(this.fadeLocs.u_opacity, this.params.fadeOpacity), this.drawQuad(), a.useProgram(this.drawProgram), a.enable(a.BLEND), a.blendFunc(a.SRC_ALPHA, a.ONE_MINUS_SRC_ALPHA), GA(a, this.particleStateTextures[1], 0), a.uniform1i(this.drawLocs.u_particles, 0), a.uniform1i(this.drawLocs.u_velocity, I), a.uniform2f(
397
397
  this.drawLocs.u_velocity_min,
398
398
  A[0],
399
399
  A[1]
400
- ), o.uniform2f(
400
+ ), a.uniform2f(
401
401
  this.drawLocs.u_velocity_max,
402
402
  B[0],
403
403
  B[1]
404
- ), s && o.uniform4f(
404
+ ), s && a.uniform4f(
405
405
  this.drawLocs.u_geo_bounds,
406
406
  s.west,
407
407
  s.south,
408
408
  s.east,
409
409
  s.north
410
- ), o.uniform1f(
410
+ ), a.uniform1f(
411
411
  this.drawLocs.u_particles_res,
412
412
  this.particleStateRes
413
- ), o.uniform1f(this.drawLocs.u_world_size, G), o.uniform1f(this.drawLocs.u_point_size, this.params.pointSize), GA(o, this.colorRampTexture, 2), o.uniform1i(this.drawLocs.u_color_ramp, 2), o.uniformMatrix4fv(
413
+ ), a.uniform1f(this.drawLocs.u_world_size, G), a.uniform1f(this.drawLocs.u_point_size, this.params.pointSize), GA(a, this.colorRampTexture, 2), a.uniform1i(this.drawLocs.u_color_ramp, 2), a.uniformMatrix4fv(
414
414
  this.drawLocs.u_matrix,
415
415
  !1,
416
416
  y instanceof Float32Array ? y : new Float32Array(Array.from(y))
417
417
  );
418
- const D = o.getAttribLocation(this.drawProgram, "a_index");
419
- if (o.bindBuffer(o.ARRAY_BUFFER, this.particleIndexBuffer), o.enableVertexAttribArray(D), o.vertexAttribPointer(D, 1, o.FLOAT, !1, 0, 0), o.drawArrays(o.POINTS, 0, this.numParticles), o.disableVertexAttribArray(D), !this._debugDone) {
418
+ const D = a.getAttribLocation(this.drawProgram, "a_index");
419
+ if (a.bindBuffer(a.ARRAY_BUFFER, this.particleIndexBuffer), a.enableVertexAttribArray(D), a.vertexAttribPointer(D, 1, a.FLOAT, !1, 0, 0), a.drawArrays(a.POINTS, 0, this.numParticles), a.disableVertexAttribArray(D), !this._debugDone) {
420
420
  this._debugDone = !0;
421
421
  const R = new Uint8Array(4);
422
- o.readPixels(
422
+ a.readPixels(
423
423
  Math.floor(this.screenWidth / 2),
424
424
  Math.floor(this.screenHeight / 2),
425
425
  1,
426
426
  1,
427
- o.RGBA,
428
- o.UNSIGNED_BYTE,
427
+ a.RGBA,
428
+ a.UNSIGNED_BYTE,
429
429
  R
430
- ), console.log("[zartigl] screen FBO center pixel after draw:", R), o.bindFramebuffer(o.FRAMEBUFFER, this.particleFramebuffers[1]);
430
+ ), console.log("[zartigl] screen FBO center pixel after draw:", R), a.bindFramebuffer(a.FRAMEBUFFER, this.particleFramebuffers[1]);
431
431
  const N = new Uint8Array(4);
432
- o.readPixels(0, 0, 1, 1, o.RGBA, o.UNSIGNED_BYTE, N);
432
+ a.readPixels(0, 0, 1, 1, a.RGBA, a.UNSIGNED_BYTE, N);
433
433
  const F = N[0] + N[1] / 256, t = N[2] + N[3] / 256;
434
434
  console.log(
435
435
  "[zartigl] particle 0 state RGBA:",
@@ -437,9 +437,9 @@ class $g {
437
437
  "=> mercator pos:",
438
438
  F.toFixed(4),
439
439
  t.toFixed(4)
440
- ), o.bindFramebuffer(o.FRAMEBUFFER, this.screenFramebuffers[1]);
440
+ ), a.bindFramebuffer(a.FRAMEBUFFER, this.screenFramebuffers[1]);
441
441
  }
442
- o.disable(o.BLEND), o.bindFramebuffer(o.FRAMEBUFFER, E), o.viewport(0, 0, this.screenWidth, this.screenHeight), o.useProgram(this.fadeProgram), GA(o, this.screenTextures[1], 0), o.uniform1i(this.fadeLocs.u_screen, 0), o.uniform1f(this.fadeLocs.u_opacity, 1), o.enable(o.BLEND), o.blendFunc(o.SRC_ALPHA, o.ONE_MINUS_SRC_ALPHA), this.drawQuad(), o.disable(o.BLEND), this.particleStateTextures.reverse(), this.particleFramebuffers.reverse(), this.screenTextures.reverse(), this.screenFramebuffers.reverse();
442
+ a.disable(a.BLEND), a.bindFramebuffer(a.FRAMEBUFFER, E), a.viewport(0, 0, this.screenWidth, this.screenHeight), a.useProgram(this.fadeProgram), GA(a, this.screenTextures[1], 0), a.uniform1i(this.fadeLocs.u_screen, 0), a.uniform1f(this.fadeLocs.u_opacity, 1), a.enable(a.BLEND), a.blendFunc(a.SRC_ALPHA, a.ONE_MINUS_SRC_ALPHA), this.drawQuad(), a.disable(a.BLEND), this.particleStateTextures.reverse(), this.particleFramebuffers.reverse(), this.screenTextures.reverse(), this.screenFramebuffers.reverse();
443
443
  }
444
444
  drawQuad() {
445
445
  const I = this.gl, A = I.getAttribLocation(
@@ -526,9 +526,9 @@ class AB {
526
526
  * Stored normalized to [0,1] using uMin/uMax/vMin/vMax.
527
527
  */
528
528
  update(I) {
529
- const A = this.gl, { u: B, v: y, width: Q, height: G, uMin: s, uMax: o, vMin: E, vMax: D } = I;
530
- this.width = Q, this.height = G, this.uMin = s, this.uMax = o, this.vMin = E, this.vMax = D, this.geoBounds = I.bounds;
531
- const R = o - s || 1, N = D - E || 1, F = new Uint8Array(Q * G * 4);
529
+ const A = this.gl, { u: B, v: y, width: Q, height: G, uMin: s, uMax: a, vMin: E, vMax: D } = I;
530
+ this.width = Q, this.height = G, this.uMin = s, this.uMax = a, this.vMin = E, this.vMax = D, this.geoBounds = I.bounds;
531
+ const R = a - s || 1, N = D - E || 1, F = new Uint8Array(Q * G * 4);
532
532
  for (let U = 0; U < Q * G; U++) {
533
533
  const c = B[U], e = y[U];
534
534
  isNaN(c) || isNaN(e) ? (F[U * 4] = 0, F[U * 4 + 1] = 0, F[U * 4 + 2] = 0, F[U * 4 + 3] = 0) : (F[U * 4] = Math.round(
@@ -541,7 +541,7 @@ class AB {
541
541
  for (let U = 0; U < Q * G; U++)
542
542
  F[U * 4 + 3] === 255 ? t++ : H++;
543
543
  console.log(
544
- `[zartigl] Velocity texture: ${Q}x${G}, valid=${t} (${(100 * t / (Q * G)).toFixed(1)}%), nodata=${H}, uRange=[${s.toFixed(4)}, ${o.toFixed(4)}], vRange=[${E.toFixed(4)}, ${D.toFixed(4)}]`
544
+ `[zartigl] Velocity texture: ${Q}x${G}, valid=${t} (${(100 * t / (Q * G)).toFixed(1)}%), nodata=${H}, uRange=[${s.toFixed(4)}, ${a.toFixed(4)}], vRange=[${E.toFixed(4)}, ${D.toFixed(4)}]`
545
545
  ), this.texture || (this.texture = A.createTexture()), A.bindTexture(A.TEXTURE_2D, this.texture), A.texParameteri(A.TEXTURE_2D, A.TEXTURE_WRAP_S, A.CLAMP_TO_EDGE), A.texParameteri(A.TEXTURE_2D, A.TEXTURE_WRAP_T, A.CLAMP_TO_EDGE), A.texParameteri(A.TEXTURE_2D, A.TEXTURE_MIN_FILTER, A.LINEAR), A.texParameteri(A.TEXTURE_2D, A.TEXTURE_MAG_FILTER, A.LINEAR), A.texImage2D(
546
546
  A.TEXTURE_2D,
547
547
  0,
@@ -578,16 +578,16 @@ function IB(g, I, A, B, y) {
578
578
  const t = N * R.lonSize + F, H = (R.latStart + N) * B + (R.lonStart + F);
579
579
  G[H] = R.data[t];
580
580
  }
581
- let s = 1 / 0, o = -1 / 0, E = 1 / 0, D = -1 / 0;
581
+ let s = 1 / 0, a = -1 / 0, E = 1 / 0, D = -1 / 0;
582
582
  for (let R = 0; R < Q.length; R++)
583
- isNaN(Q[R]) || (Q[R] < s && (s = Q[R]), Q[R] > o && (o = Q[R])), isNaN(G[R]) || (G[R] < E && (E = G[R]), G[R] > D && (D = G[R]));
584
- return isFinite(s) || (s = -1), isFinite(o) || (o = 1), isFinite(E) || (E = -1), isFinite(D) || (D = 1), {
583
+ isNaN(Q[R]) || (Q[R] < s && (s = Q[R]), Q[R] > a && (a = Q[R])), isNaN(G[R]) || (G[R] < E && (E = G[R]), G[R] > D && (D = G[R]));
584
+ return isFinite(s) || (s = -1), isFinite(a) || (a = 1), isFinite(E) || (E = -1), isFinite(D) || (D = 1), {
585
585
  u: Q,
586
586
  v: G,
587
587
  width: B,
588
588
  height: A,
589
589
  uMin: s,
590
- uMax: o,
590
+ uMax: a,
591
591
  vMin: E,
592
592
  vMax: D,
593
593
  bounds: y ?? { west: -180, south: -90, east: 180, north: 90 }
@@ -775,9 +775,9 @@ function tB() {
775
775
  var cB = tB;
776
776
  const MA = 16209, KB = 16191;
777
777
  var MB = function(I, A) {
778
- let B, y, Q, G, s, o, E, D, R, N, F, t, H, U, c, e, d, S, f, l, J, Y, r, q;
778
+ let B, y, Q, G, s, a, E, D, R, N, F, t, H, U, c, e, d, S, f, l, J, Y, r, q;
779
779
  const n = I.state;
780
- B = I.next_in, r = I.input, y = B + (I.avail_in - 5), Q = I.next_out, q = I.output, G = Q - (A - I.avail_out), s = Q + (I.avail_out - 257), o = n.dmax, E = n.wsize, D = n.whave, R = n.wnext, N = n.window, F = n.hold, t = n.bits, H = n.lencode, U = n.distcode, c = (1 << n.lenbits) - 1, e = (1 << n.distbits) - 1;
780
+ B = I.next_in, r = I.input, y = B + (I.avail_in - 5), Q = I.next_out, q = I.output, G = Q - (A - I.avail_out), s = Q + (I.avail_out - 257), a = n.dmax, E = n.wsize, D = n.whave, R = n.wnext, N = n.window, F = n.hold, t = n.bits, H = n.lencode, U = n.distcode, c = (1 << n.lenbits) - 1, e = (1 << n.distbits) - 1;
781
781
  A:
782
782
  do {
783
783
  t < 15 && (F += r[B++] << t, t += 8, F += r[B++] << t, t += 8), d = H[F & c];
@@ -790,7 +790,7 @@ var MB = function(I, A) {
790
790
  g:
791
791
  for (; ; ) {
792
792
  if (S = d >>> 24, F >>>= S, t -= S, S = d >>> 16 & 255, S & 16) {
793
- if (l = d & 65535, S &= 15, t < S && (F += r[B++] << t, t += 8, t < S && (F += r[B++] << t, t += 8)), l += F & (1 << S) - 1, l > o) {
793
+ if (l = d & 65535, S &= 15, t < S && (F += r[B++] << t, t += 8, t < S && (F += r[B++] << t, t += 8)), l += F & (1 << S) - 1, l > a) {
794
794
  I.msg = "invalid distance too far back", n.mode = MA;
795
795
  break A;
796
796
  }
@@ -997,7 +997,7 @@ const FA = 15, LI = 852, JI = 592, kI = 0, ZA = 1, tI = 2, qB = new Uint16Array(
997
997
  64,
998
998
  64
999
999
  ]), dB = (g, I, A, B, y, Q, G, s) => {
1000
- const o = s.bits;
1000
+ const a = s.bits;
1001
1001
  let E = 0, D = 0, R = 0, N = 0, F = 0, t = 0, H = 0, U = 0, c = 0, e = 0, d, S, f, l, J, Y = null, r;
1002
1002
  const q = new Uint16Array(FA + 1), n = new Uint16Array(FA + 1);
1003
1003
  let j = null, V, O, z;
@@ -1005,7 +1005,7 @@ const FA = 15, LI = 852, JI = 592, kI = 0, ZA = 1, tI = 2, qB = new Uint16Array(
1005
1005
  q[E] = 0;
1006
1006
  for (D = 0; D < B; D++)
1007
1007
  q[I[A + D]]++;
1008
- for (F = o, N = FA; N >= 1 && q[N] === 0; N--)
1008
+ for (F = a, N = FA; N >= 1 && q[N] === 0; N--)
1009
1009
  ;
1010
1010
  if (F > N && (F = N), N === 0)
1011
1011
  return y[Q++] = 1 << 24 | 64 << 16 | 0, y[Q++] = 1 << 24 | 64 << 16 | 0, s.bits = 1, 0;
@@ -1113,7 +1113,7 @@ const PB = (g) => {
1113
1113
  const Q = g.state;
1114
1114
  return Q.window === null && (Q.wsize = 1 << Q.wbits, Q.wnext = 0, Q.whave = 0, Q.window = new Uint8Array(Q.wsize)), B >= Q.wsize ? (Q.window.set(I.subarray(A - Q.wsize, A), 0), Q.wnext = 0, Q.whave = Q.wsize) : (y = Q.wsize - Q.wnext, y > B && (y = B), Q.window.set(I.subarray(A - B, A - B + y), Q.wnext), B -= y, B ? (Q.window.set(I.subarray(A - B, A), 0), Q.wnext = B, Q.whave = Q.wsize) : (Q.wnext += y, Q.wnext === Q.wsize && (Q.wnext = 0), Q.whave < Q.wsize && (Q.whave += y))), 0;
1115
1115
  }, VB = (g, I) => {
1116
- let A, B, y, Q, G, s, o, E, D, R, N, F, t, H, U = 0, c, e, d, S, f, l, J, Y;
1116
+ let A, B, y, Q, G, s, a, E, D, R, N, F, t, H, U = 0, c, e, d, S, f, l, J, Y;
1117
1117
  const r = new Uint8Array(4);
1118
1118
  let q, n;
1119
1119
  const j = (
@@ -1122,7 +1122,7 @@ const PB = (g) => {
1122
1122
  );
1123
1123
  if (DA(g) || !g.output || !g.input && g.avail_in !== 0)
1124
1124
  return v;
1125
- A = g.state, A.mode === CA && (A.mode = bA), G = g.next_out, y = g.output, o = g.avail_out, Q = g.next_in, B = g.input, s = g.avail_in, E = A.hold, D = A.bits, R = s, N = o, Y = iA;
1125
+ A = g.state, A.mode === CA && (A.mode = bA), G = g.next_out, y = g.output, a = g.avail_out, Q = g.next_in, B = g.input, s = g.avail_in, E = A.hold, D = A.bits, R = s, N = a, Y = iA;
1126
1126
  A:
1127
1127
  for (; ; )
1128
1128
  switch (A.mode) {
@@ -1263,7 +1263,7 @@ const PB = (g) => {
1263
1263
  /* falls through */
1264
1264
  case rA:
1265
1265
  if (A.havedict === 0)
1266
- return g.next_out = G, g.avail_out = o, g.next_in = Q, g.avail_in = s, A.hold = E, A.bits = D, WB;
1266
+ return g.next_out = G, g.avail_out = a, g.next_in = Q, g.avail_in = s, A.hold = E, A.bits = D, WB;
1267
1267
  g.adler = A.check = 1, A.mode = CA;
1268
1268
  /* falls through */
1269
1269
  case CA:
@@ -1316,9 +1316,9 @@ const PB = (g) => {
1316
1316
  /* falls through */
1317
1317
  case mI:
1318
1318
  if (F = A.length, F) {
1319
- if (F > s && (F = s), F > o && (F = o), F === 0)
1319
+ if (F > s && (F = s), F > a && (F = a), F === 0)
1320
1320
  break A;
1321
- y.set(B.subarray(Q, Q + F), G), s -= F, Q += F, o -= F, G += F, A.length -= F;
1321
+ y.set(B.subarray(Q, Q + F), G), s -= F, Q += F, a -= F, G += F, A.length -= F;
1322
1322
  break;
1323
1323
  }
1324
1324
  A.mode = CA;
@@ -1417,8 +1417,8 @@ const PB = (g) => {
1417
1417
  A.mode = HA;
1418
1418
  /* falls through */
1419
1419
  case HA:
1420
- if (s >= 6 && o >= 258) {
1421
- g.next_out = G, g.avail_out = o, g.next_in = Q, g.avail_in = s, A.hold = E, A.bits = D, MB(g, N), G = g.next_out, y = g.output, o = g.avail_out, Q = g.next_in, B = g.input, s = g.avail_in, E = A.hold, D = A.bits, A.mode === CA && (A.back = -1);
1420
+ if (s >= 6 && a >= 258) {
1421
+ g.next_out = G, g.avail_out = a, g.next_in = Q, g.avail_in = s, A.hold = E, A.bits = D, MB(g, N), G = g.next_out, y = g.output, a = g.avail_out, Q = g.next_in, B = g.input, s = g.avail_in, E = A.hold, D = A.bits, A.mode === CA && (A.back = -1);
1422
1422
  break;
1423
1423
  }
1424
1424
  for (A.back = 0; U = A.lencode[E & (1 << A.lenbits) - 1], c = U >>> 24, e = U >>> 16 & 255, d = U & 65535, !(c <= D); ) {
@@ -1495,9 +1495,9 @@ const PB = (g) => {
1495
1495
  A.mode = PI;
1496
1496
  /* falls through */
1497
1497
  case PI:
1498
- if (o === 0)
1498
+ if (a === 0)
1499
1499
  break A;
1500
- if (F = N - o, A.offset > F) {
1500
+ if (F = N - a, A.offset > F) {
1501
1501
  if (F = A.offset - F, F > A.whave && A.sane) {
1502
1502
  g.msg = "invalid distance too far back", A.mode = p;
1503
1503
  break;
@@ -1505,16 +1505,16 @@ const PB = (g) => {
1505
1505
  F > A.wnext ? (F -= A.wnext, t = A.wsize - F) : t = A.wnext - F, F > A.length && (F = A.length), H = A.window;
1506
1506
  } else
1507
1507
  H = y, t = G - A.offset, F = A.length;
1508
- F > o && (F = o), o -= F, A.length -= F;
1508
+ F > a && (F = a), a -= F, A.length -= F;
1509
1509
  do
1510
1510
  y[G++] = H[t++];
1511
1511
  while (--F);
1512
1512
  A.length === 0 && (A.mode = HA);
1513
1513
  break;
1514
1514
  case VI:
1515
- if (o === 0)
1515
+ if (a === 0)
1516
1516
  break A;
1517
- y[G++] = A.length, o--, A.mode = HA;
1517
+ y[G++] = A.length, a--, A.mode = HA;
1518
1518
  break;
1519
1519
  case VA:
1520
1520
  if (A.wrap) {
@@ -1523,8 +1523,8 @@ const PB = (g) => {
1523
1523
  break A;
1524
1524
  s--, E |= B[Q++] << D, D += 8;
1525
1525
  }
1526
- if (N -= o, g.total_out += N, A.total += N, A.wrap & 4 && N && (g.adler = A.check = /*UPDATE_CHECK(state.check, put - _out, _out);*/
1527
- A.flags ? $(A.check, y, N, G - N) : zA(A.check, y, N, G - N)), N = o, A.wrap & 4 && (A.flags ? E : vI(E)) !== A.check) {
1526
+ if (N -= a, g.total_out += N, A.total += N, A.wrap & 4 && N && (g.adler = A.check = /*UPDATE_CHECK(state.check, put - _out, _out);*/
1527
+ A.flags ? $(A.check, y, N, G - N) : zA(A.check, y, N, G - N)), N = a, A.wrap & 4 && (A.flags ? E : vI(E)) !== A.check) {
1528
1528
  g.msg = "incorrect data check", A.mode = p;
1529
1529
  break;
1530
1530
  }
@@ -1560,7 +1560,7 @@ const PB = (g) => {
1560
1560
  default:
1561
1561
  return v;
1562
1562
  }
1563
- return g.next_out = G, g.avail_out = o, g.next_in = Q, g.avail_in = s, A.hold = E, A.bits = D, (A.wsize || N !== g.avail_out && A.mode < p && (A.mode < VA || I !== cI)) && Ng(g, g.output, g.next_out, N - g.avail_out), R -= g.avail_in, N -= g.avail_out, g.total_in += R, g.total_out += N, A.total += N, A.wrap & 4 && N && (g.adler = A.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/
1563
+ return g.next_out = G, g.avail_out = a, g.next_in = Q, g.avail_in = s, A.hold = E, A.bits = D, (A.wsize || N !== g.avail_out && A.mode < p && (A.mode < VA || I !== cI)) && Ng(g, g.output, g.next_out, N - g.avail_out), R -= g.avail_in, N -= g.avail_out, g.total_in += R, g.total_out += N, A.total += N, A.wrap & 4 && N && (g.adler = A.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/
1564
1564
  A.flags ? $(A.check, y, N, g.next_out - N) : zA(A.check, y, N, g.next_out - N)), g.data_type = A.bits + (A.last ? 64 : 0) + (A.mode === CA ? 128 : 0) + (A.mode === YA || A.mode === PA ? 256 : 0), (R === 0 && N === 0 || I === cI) && Y === iA && (Y = mB), Y;
1565
1565
  }, OB = (g) => {
1566
1566
  if (DA(g))
@@ -1636,8 +1636,8 @@ eA.prototype.push = function(g, I) {
1636
1636
  }
1637
1637
  if (s = A.avail_out, A.next_out && (A.avail_out === 0 || Q === vA))
1638
1638
  if (this.options.to === "string") {
1639
- let o = _A.utf8border(A.output, A.next_out), E = A.next_out - o, D = _A.buf2string(A.output, o);
1640
- A.next_out = E, A.avail_out = B - E, E && A.output.set(A.output.subarray(o, o + E), 0), this.onData(D);
1639
+ let a = _A.utf8border(A.output, A.next_out), E = A.next_out - a, D = _A.buf2string(A.output, a);
1640
+ A.next_out = E, A.avail_out = B - E, E && A.output.set(A.output.subarray(a, a + E), 0), this.onData(D);
1641
1641
  } else
1642
1642
  this.onData(A.output.length === A.next_out ? A.output : A.output.subarray(0, A.next_out));
1643
1643
  if (!(Q === UA && s === 0)) {
@@ -1668,8 +1668,8 @@ var GC = hC, wC = /* @__PURE__ */ (() => {
1668
1668
  g[I < 26 ? I + 65 : I < 52 ? I + 71 : I < 62 ? I - 4 : I * 4 - 205] = I;
1669
1669
  return (A) => {
1670
1670
  for (var B = A.length, y = new Uint8Array((B - (A[B - 1] == "=") - (A[B - 2] == "=")) * 3 / 4 | 0), Q = 0, G = 0; Q < B; ) {
1671
- var s = g[A.charCodeAt(Q++)], o = g[A.charCodeAt(Q++)], E = g[A.charCodeAt(Q++)], D = g[A.charCodeAt(Q++)];
1672
- y[G++] = s << 2 | o >> 4, y[G++] = o << 4 | E >> 2, y[G++] = E << 6 | D;
1671
+ var s = g[A.charCodeAt(Q++)], a = g[A.charCodeAt(Q++)], E = g[A.charCodeAt(Q++)], D = g[A.charCodeAt(Q++)];
1672
+ y[G++] = s << 2 | a >> 4, y[G++] = a << 4 | E >> 2, y[G++] = E << 6 | D;
1673
1673
  }
1674
1674
  return y;
1675
1675
  };
@@ -1680,8 +1680,8 @@ var GC = hC, wC = /* @__PURE__ */ (() => {
1680
1680
  });
1681
1681
  var y = Object.assign({}, I), Q = "./this.program", G = I.print || console.log.bind(console), s = I.printErr || console.error.bind(console);
1682
1682
  Object.assign(I, y), y = null, I.thisProgram && (Q = I.thisProgram);
1683
- var o;
1684
- I.wasmBinary && (o = I.wasmBinary), typeof WebAssembly != "object" && q("no native wasm support detected");
1683
+ var a;
1684
+ I.wasmBinary && (a = I.wasmBinary), typeof WebAssembly != "object" && q("no native wasm support detected");
1685
1685
  var E, D = !1, R, N, F, t, H, U, c, e;
1686
1686
  function d() {
1687
1687
  var C = E.buffer;
@@ -1703,22 +1703,22 @@ var GC = hC, wC = /* @__PURE__ */ (() => {
1703
1703
  }
1704
1704
  function z(C) {
1705
1705
  return Promise.resolve().then(() => {
1706
- if (C == V && o)
1707
- var i = new Uint8Array(o);
1706
+ if (C == V && a)
1707
+ var i = new Uint8Array(a);
1708
1708
  else
1709
1709
  throw "both async and sync fetching of the wasm failed";
1710
1710
  return i;
1711
1711
  });
1712
1712
  }
1713
- function oA(C, i, a) {
1714
- return z(C).then((h) => WebAssembly.instantiate(h, i)).then((h) => h).then(a, (h) => {
1713
+ function oA(C, i, o) {
1714
+ return z(C).then((h) => WebAssembly.instantiate(h, i)).then((h) => h).then(o, (h) => {
1715
1715
  s(`failed to asynchronously prepare wasm: ${h}`), q(h);
1716
1716
  });
1717
1717
  }
1718
1718
  function NA(C, i) {
1719
- var a = V;
1720
- return o || typeof WebAssembly.instantiateStreaming != "function" || n(a) || j(a) || typeof fetch != "function" ? oA(a, C, i) : fetch(a, { credentials: "same-origin" }).then((h) => WebAssembly.instantiateStreaming(h, C).then(i, function(w) {
1721
- return s(`wasm streaming compile failed: ${w}`), s("falling back to ArrayBuffer instantiation"), oA(a, C, i);
1719
+ var o = V;
1720
+ return a || typeof WebAssembly.instantiateStreaming != "function" || n(o) || j(o) || typeof fetch != "function" ? oA(o, C, i) : fetch(o, { credentials: "same-origin" }).then((h) => WebAssembly.instantiateStreaming(h, C).then(i, function(w) {
1721
+ return s(`wasm streaming compile failed: ${w}`), s("falling back to ArrayBuffer instantiation"), oA(o, C, i);
1722
1722
  }));
1723
1723
  }
1724
1724
  var aA = (C) => {
@@ -1730,8 +1730,8 @@ var GC = hC, wC = /* @__PURE__ */ (() => {
1730
1730
  U[this.H + 4 >> 2] = i;
1731
1731
  }, this.M = function(i) {
1732
1732
  U[this.H + 8 >> 2] = i;
1733
- }, this.I = function(i, a) {
1734
- this.J(), this.N(i), this.M(a);
1733
+ }, this.I = function(i, o) {
1734
+ this.J(), this.N(i), this.M(o);
1735
1735
  }, this.J = function() {
1736
1736
  U[this.H + 16 >> 2] = 0;
1737
1737
  };
@@ -1743,7 +1743,7 @@ var GC = hC, wC = /* @__PURE__ */ (() => {
1743
1743
  }, yA = {}, EA = {}, JA = {}, Z, Ug = (C) => {
1744
1744
  throw new Z(C);
1745
1745
  }, nA, Lg = (C, i) => {
1746
- function a(M) {
1746
+ function o(M) {
1747
1747
  if (M = i(M), M.length !== h.length)
1748
1748
  throw new nA("Mismatched type converter count");
1749
1749
  for (var L = 0; L < h.length; ++L)
@@ -1756,25 +1756,25 @@ var GC = hC, wC = /* @__PURE__ */ (() => {
1756
1756
  var w = Array(C.length), k = [], K = 0;
1757
1757
  C.forEach((M, L) => {
1758
1758
  EA.hasOwnProperty(M) ? w[L] = EA[M] : (k.push(M), yA.hasOwnProperty(M) || (yA[M] = []), yA[M].push(() => {
1759
- w[L] = EA[M], ++K, K === k.length && a(w);
1759
+ w[L] = EA[M], ++K, K === k.length && o(w);
1760
1760
  }));
1761
- }), k.length === 0 && a(w);
1761
+ }), k.length === 0 && o(w);
1762
1762
  };
1763
- function Jg(C, i, a = {}) {
1763
+ function Jg(C, i, o = {}) {
1764
1764
  var h = i.name;
1765
1765
  if (!C)
1766
1766
  throw new Z(`type "${h}" must have a positive integer typeid pointer`);
1767
1767
  if (EA.hasOwnProperty(C)) {
1768
- if (a.P)
1768
+ if (o.P)
1769
1769
  return;
1770
1770
  throw new Z(`Cannot register type '${h}' twice`);
1771
1771
  }
1772
1772
  EA[C] = i, delete JA[C], yA.hasOwnProperty(C) && (i = yA[C], delete yA[C], i.forEach((w) => w()));
1773
1773
  }
1774
- function AA(C, i, a = {}) {
1774
+ function AA(C, i, o = {}) {
1775
1775
  if (!("argPackAdvance" in i))
1776
1776
  throw new TypeError("registerType registeredInstance requires argPackAdvance");
1777
- Jg(C, i, a);
1777
+ Jg(C, i, o);
1778
1778
  }
1779
1779
  function II() {
1780
1780
  this.F = [void 0], this.K = [];
@@ -1801,12 +1801,12 @@ var GC = hC, wC = /* @__PURE__ */ (() => {
1801
1801
  var kg = (C, i) => {
1802
1802
  switch (i) {
1803
1803
  case 4:
1804
- return function(a) {
1805
- return this.fromWireType(c[a >> 2]);
1804
+ return function(o) {
1805
+ return this.fromWireType(c[o >> 2]);
1806
1806
  };
1807
1807
  case 8:
1808
- return function(a) {
1809
- return this.fromWireType(e[a >> 3]);
1808
+ return function(o) {
1809
+ return this.fromWireType(e[o >> 3]);
1810
1810
  };
1811
1811
  default:
1812
1812
  throw new TypeError(`invalid float width (${i}): ${C}`);
@@ -1827,70 +1827,70 @@ var GC = hC, wC = /* @__PURE__ */ (() => {
1827
1827
  var i = Function;
1828
1828
  if (!(i instanceof Function))
1829
1829
  throw new TypeError(`new_ called with constructor type ${typeof i} which is not a function`);
1830
- var a = fA(i.name || "unknownFunctionName", function() {
1830
+ var o = fA(i.name || "unknownFunctionName", function() {
1831
1831
  });
1832
- return a.prototype = i.prototype, a = new a(), C = i.apply(a, C), C instanceof Object ? C : a;
1832
+ return o.prototype = i.prototype, o = new o(), C = i.apply(o, C), C instanceof Object ? C : o;
1833
1833
  }
1834
1834
  var Kg = (C, i) => {
1835
1835
  if (I[C].C === void 0) {
1836
- var a = I[C];
1836
+ var o = I[C];
1837
1837
  I[C] = function() {
1838
1838
  if (!I[C].C.hasOwnProperty(arguments.length))
1839
1839
  throw new Z(`Function '${i}' called with an invalid number of arguments (${arguments.length}) - expects one of (${I[C].C})!`);
1840
1840
  return I[C].C[arguments.length].apply(this, arguments);
1841
- }, I[C].C = [], I[C].C[a.O] = a;
1841
+ }, I[C].C = [], I[C].C[o.O] = o;
1842
1842
  }
1843
- }, Mg = (C, i, a) => {
1843
+ }, Mg = (C, i, o) => {
1844
1844
  if (I.hasOwnProperty(C)) {
1845
- if (a === void 0 || I[C].C !== void 0 && I[C].C[a] !== void 0)
1845
+ if (o === void 0 || I[C].C !== void 0 && I[C].C[o] !== void 0)
1846
1846
  throw new Z(`Cannot register public name '${C}' twice`);
1847
- if (Kg(C, C), I.hasOwnProperty(a))
1848
- throw new Z(`Cannot register multiple overloads of a function with the same number of arguments (${a})!`);
1849
- I[C].C[a] = i;
1847
+ if (Kg(C, C), I.hasOwnProperty(o))
1848
+ throw new Z(`Cannot register multiple overloads of a function with the same number of arguments (${o})!`);
1849
+ I[C].C[o] = i;
1850
1850
  } else
1851
- I[C] = i, a !== void 0 && (I[C].S = a);
1851
+ I[C] = i, o !== void 0 && (I[C].S = o);
1852
1852
  }, qg = (C, i) => {
1853
- for (var a = [], h = 0; h < C; h++)
1854
- a.push(U[i + 4 * h >> 2]);
1855
- return a;
1853
+ for (var o = [], h = 0; h < C; h++)
1854
+ o.push(U[i + 4 * h >> 2]);
1855
+ return o;
1856
1856
  }, WA, Yg = (C, i) => {
1857
- var a = [];
1857
+ var o = [];
1858
1858
  return function() {
1859
- if (a.length = 0, Object.assign(a, arguments), C.includes("j")) {
1859
+ if (o.length = 0, Object.assign(o, arguments), C.includes("j")) {
1860
1860
  var h = I["dynCall_" + C];
1861
- h = a && a.length ? h.apply(null, [i].concat(a)) : h.call(null, i);
1861
+ h = o && o.length ? h.apply(null, [i].concat(o)) : h.call(null, i);
1862
1862
  } else
1863
- h = WA.get(i).apply(null, a);
1863
+ h = WA.get(i).apply(null, o);
1864
1864
  return h;
1865
1865
  };
1866
1866
  }, Hg = (C, i) => {
1867
1867
  C = X(C);
1868
- var a = C.includes("j") ? Yg(C, i) : WA.get(i);
1869
- if (typeof a != "function")
1868
+ var o = C.includes("j") ? Yg(C, i) : WA.get(i);
1869
+ if (typeof o != "function")
1870
1870
  throw new Z(`unknown function pointer with signature ${C}: ${i}`);
1871
- return a;
1871
+ return o;
1872
1872
  }, EI, iI = (C) => {
1873
1873
  C = FI(C);
1874
1874
  var i = X(C);
1875
1875
  return gA(C), i;
1876
1876
  }, rg = (C, i) => {
1877
- function a(k) {
1878
- w[k] || EA[k] || (JA[k] ? JA[k].forEach(a) : (h.push(k), w[k] = !0));
1877
+ function o(k) {
1878
+ w[k] || EA[k] || (JA[k] ? JA[k].forEach(o) : (h.push(k), w[k] = !0));
1879
1879
  }
1880
1880
  var h = [], w = {};
1881
- throw i.forEach(a), new EI(`${C}: ` + h.map(iI).join([", "]));
1881
+ throw i.forEach(o), new EI(`${C}: ` + h.map(iI).join([", "]));
1882
1882
  }, dg = (C) => {
1883
1883
  C = C.trim();
1884
1884
  const i = C.indexOf("(");
1885
1885
  return i !== -1 ? C.substr(0, i) : C;
1886
- }, eg = (C, i, a) => {
1886
+ }, eg = (C, i, o) => {
1887
1887
  switch (i) {
1888
1888
  case 1:
1889
- return a ? (h) => R[h >> 0] : (h) => N[h >> 0];
1889
+ return o ? (h) => R[h >> 0] : (h) => N[h >> 0];
1890
1890
  case 2:
1891
- return a ? (h) => F[h >> 1] : (h) => t[h >> 1];
1891
+ return o ? (h) => F[h >> 1] : (h) => t[h >> 1];
1892
1892
  case 4:
1893
- return a ? (h) => H[h >> 2] : (h) => U[h >> 2];
1893
+ return o ? (h) => H[h >> 2] : (h) => U[h >> 2];
1894
1894
  default:
1895
1895
  throw new TypeError(`invalid integer width (${i}): ${C}`);
1896
1896
  }
@@ -1898,13 +1898,13 @@ var GC = hC, wC = /* @__PURE__ */ (() => {
1898
1898
  function ng(C) {
1899
1899
  return this.fromWireType(U[C >> 2]);
1900
1900
  }
1901
- for (var DI = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0, oI = (C, i, a) => {
1902
- var h = i + a;
1903
- for (a = i; C[a] && !(a >= h); )
1904
- ++a;
1905
- if (16 < a - i && C.buffer && DI)
1906
- return DI.decode(C.subarray(i, a));
1907
- for (h = ""; i < a; ) {
1901
+ for (var DI = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0, oI = (C, i, o) => {
1902
+ var h = i + o;
1903
+ for (o = i; C[o] && !(o >= h); )
1904
+ ++o;
1905
+ if (16 < o - i && C.buffer && DI)
1906
+ return DI.decode(C.subarray(i, o));
1907
+ for (h = ""; i < o; ) {
1908
1908
  var w = C[i++];
1909
1909
  if (w & 128) {
1910
1910
  var k = C[i++] & 63;
@@ -1919,53 +1919,53 @@ var GC = hC, wC = /* @__PURE__ */ (() => {
1919
1919
  }
1920
1920
  return h;
1921
1921
  }, aI = typeof TextDecoder < "u" ? new TextDecoder("utf-16le") : void 0, fg = (C, i) => {
1922
- for (var a = C >> 1, h = a + i / 2; !(a >= h) && t[a]; )
1923
- ++a;
1924
- if (a <<= 1, 32 < a - C && aI)
1925
- return aI.decode(N.subarray(C, a));
1926
- for (a = "", h = 0; !(h >= i / 2); ++h) {
1922
+ for (var o = C >> 1, h = o + i / 2; !(o >= h) && t[o]; )
1923
+ ++o;
1924
+ if (o <<= 1, 32 < o - C && aI)
1925
+ return aI.decode(N.subarray(C, o));
1926
+ for (o = "", h = 0; !(h >= i / 2); ++h) {
1927
1927
  var w = F[C + 2 * h >> 1];
1928
1928
  if (w == 0)
1929
1929
  break;
1930
- a += String.fromCharCode(w);
1930
+ o += String.fromCharCode(w);
1931
1931
  }
1932
- return a;
1933
- }, Wg = (C, i, a) => {
1934
- if (a ??= 2147483647, 2 > a)
1932
+ return o;
1933
+ }, Wg = (C, i, o) => {
1934
+ if (o ??= 2147483647, 2 > o)
1935
1935
  return 0;
1936
- a -= 2;
1936
+ o -= 2;
1937
1937
  var h = i;
1938
- a = a < 2 * C.length ? a / 2 : C.length;
1939
- for (var w = 0; w < a; ++w)
1938
+ o = o < 2 * C.length ? o / 2 : C.length;
1939
+ for (var w = 0; w < o; ++w)
1940
1940
  F[i >> 1] = C.charCodeAt(w), i += 2;
1941
1941
  return F[i >> 1] = 0, i - h;
1942
1942
  }, mg = (C) => 2 * C.length, Tg = (C, i) => {
1943
- for (var a = 0, h = ""; !(a >= i / 4); ) {
1944
- var w = H[C + 4 * a >> 2];
1943
+ for (var o = 0, h = ""; !(o >= i / 4); ) {
1944
+ var w = H[C + 4 * o >> 2];
1945
1945
  if (w == 0)
1946
1946
  break;
1947
- ++a, 65536 <= w ? (w -= 65536, h += String.fromCharCode(55296 | w >> 10, 56320 | w & 1023)) : h += String.fromCharCode(w);
1947
+ ++o, 65536 <= w ? (w -= 65536, h += String.fromCharCode(55296 | w >> 10, 56320 | w & 1023)) : h += String.fromCharCode(w);
1948
1948
  }
1949
1949
  return h;
1950
- }, lg = (C, i, a) => {
1951
- if (a ??= 2147483647, 4 > a)
1950
+ }, lg = (C, i, o) => {
1951
+ if (o ??= 2147483647, 4 > o)
1952
1952
  return 0;
1953
1953
  var h = i;
1954
- a = h + a - 4;
1954
+ o = h + o - 4;
1955
1955
  for (var w = 0; w < C.length; ++w) {
1956
1956
  var k = C.charCodeAt(w);
1957
1957
  if (55296 <= k && 57343 >= k) {
1958
1958
  var K = C.charCodeAt(++w);
1959
1959
  k = 65536 + ((k & 1023) << 10) | K & 1023;
1960
1960
  }
1961
- if (H[i >> 2] = k, i += 4, i + 4 > a)
1961
+ if (H[i >> 2] = k, i += 4, i + 4 > o)
1962
1962
  break;
1963
1963
  }
1964
1964
  return H[i >> 2] = 0, i - h;
1965
1965
  }, pg = (C) => {
1966
- for (var i = 0, a = 0; a < C.length; ++a) {
1967
- var h = C.charCodeAt(a);
1968
- 55296 <= h && 57343 >= h && ++a, i += 4;
1966
+ for (var i = 0, o = 0; o < C.length; ++o) {
1967
+ var h = C.charCodeAt(o);
1968
+ 55296 <= h && 57343 >= h && ++o, i += 4;
1969
1969
  }
1970
1970
  return i;
1971
1971
  }, mA = {}, yI = () => {
@@ -1981,10 +1981,10 @@ var GC = hC, wC = /* @__PURE__ */ (() => {
1981
1981
  }, i;
1982
1982
  for (i in mA)
1983
1983
  mA[i] === void 0 ? delete C[i] : C[i] = mA[i];
1984
- var a = [];
1984
+ var o = [];
1985
1985
  for (i in C)
1986
- a.push(`${i}=${C[i]}`);
1987
- TA = a;
1986
+ o.push(`${i}=${C[i]}`);
1987
+ TA = o;
1988
1988
  }
1989
1989
  return TA;
1990
1990
  }, TA, xg = [null, [], []], sI = Array(256), kA = 0; 256 > kA; ++kA)
@@ -2011,42 +2011,42 @@ var GC = hC, wC = /* @__PURE__ */ (() => {
2011
2011
  u.F[i] !== void 0 && ++C;
2012
2012
  return C;
2013
2013
  }, EI = I.UnboundTypeError = ((C, i) => {
2014
- var a = fA(i, function(h) {
2014
+ var o = fA(i, function(h) {
2015
2015
  this.name = i, this.message = h, h = Error(h).stack, h !== void 0 && (this.stack = this.toString() + `
2016
2016
  ` + h.replace(/^Error(:[^\n]*)?\n/, ""));
2017
2017
  });
2018
- return a.prototype = Object.create(C.prototype), a.prototype.constructor = a, a.prototype.toString = function() {
2018
+ return o.prototype = Object.create(C.prototype), o.prototype.constructor = o, o.prototype.toString = function() {
2019
2019
  return this.message === void 0 ? this.name : `${this.name}: ${this.message}`;
2020
- }, a;
2020
+ }, o;
2021
2021
  })(Error, "UnboundTypeError");
2022
2022
  var Zg = {
2023
- p: (C, i, a) => {
2024
- throw new LA(C).I(i, a), $A = C, $A;
2023
+ p: (C, i, o) => {
2024
+ throw new LA(C).I(i, o), $A = C, $A;
2025
2025
  },
2026
2026
  o: () => {
2027
2027
  },
2028
- l: (C, i, a, h) => {
2028
+ l: (C, i, o, h) => {
2029
2029
  i = X(i), AA(C, { name: i, fromWireType: function(w) {
2030
2030
  return !!w;
2031
2031
  }, toWireType: function(w, k) {
2032
- return k ? a : h;
2032
+ return k ? o : h;
2033
2033
  }, argPackAdvance: 8, readValueFromPointer: function(w) {
2034
2034
  return this.fromWireType(N[w]);
2035
2035
  }, G: null });
2036
2036
  },
2037
2037
  k: (C, i) => {
2038
- i = X(i), AA(C, { name: i, fromWireType: (a) => {
2039
- if (!a)
2040
- throw new Z("Cannot use deleted val. handle = " + a);
2041
- var h = u.get(a).value;
2042
- return gI(a), h;
2043
- }, toWireType: (a, h) => BI(h), argPackAdvance: 8, readValueFromPointer: CI, G: null });
2038
+ i = X(i), AA(C, { name: i, fromWireType: (o) => {
2039
+ if (!o)
2040
+ throw new Z("Cannot use deleted val. handle = " + o);
2041
+ var h = u.get(o).value;
2042
+ return gI(o), h;
2043
+ }, toWireType: (o, h) => BI(h), argPackAdvance: 8, readValueFromPointer: CI, G: null });
2044
2044
  },
2045
- i: (C, i, a) => {
2046
- i = X(i), AA(C, { name: i, fromWireType: (h) => h, toWireType: (h, w) => w, argPackAdvance: 8, readValueFromPointer: kg(i, a), G: null });
2045
+ i: (C, i, o) => {
2046
+ i = X(i), AA(C, { name: i, fromWireType: (h) => h, toWireType: (h, w) => w, argPackAdvance: 8, readValueFromPointer: kg(i, o), G: null });
2047
2047
  },
2048
- d: (C, i, a, h, w, k, K) => {
2049
- var M = qg(i, a);
2048
+ d: (C, i, o, h, w, k, K) => {
2049
+ var M = qg(i, o);
2050
2050
  C = X(C), C = dg(C), w = Hg(h, w), Mg(C, function() {
2051
2051
  rg(`Cannot call ${C} due to unbound types`, M);
2052
2052
  }, i - 1), Lg(M, function(L) {
@@ -2095,9 +2095,9 @@ return ret;
2095
2095
  return I[W].C !== void 0 && L !== void 0 ? I[W].C[L] = T : (I[W] = T, I[W].O = L), [];
2096
2096
  });
2097
2097
  },
2098
- b: (C, i, a, h, w) => {
2098
+ b: (C, i, o, h, w) => {
2099
2099
  if (i = X(i), w === -1 && (w = 4294967295), w = (M) => M, h === 0) {
2100
- var k = 32 - 8 * a;
2100
+ var k = 32 - 8 * o;
2101
2101
  w = (M) => M << k >>> k;
2102
2102
  }
2103
2103
  var K = i.includes("unsigned") ? function(M, L) {
@@ -2110,23 +2110,23 @@ return ret;
2110
2110
  fromWireType: w,
2111
2111
  toWireType: K,
2112
2112
  argPackAdvance: 8,
2113
- readValueFromPointer: eg(i, a, h !== 0),
2113
+ readValueFromPointer: eg(i, o, h !== 0),
2114
2114
  G: null
2115
2115
  });
2116
2116
  },
2117
- a: (C, i, a) => {
2117
+ a: (C, i, o) => {
2118
2118
  function h(k) {
2119
2119
  return new w(R.buffer, U[k + 4 >> 2], U[k >> 2]);
2120
2120
  }
2121
2121
  var w = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array][i];
2122
- a = X(a), AA(C, { name: a, fromWireType: h, argPackAdvance: 8, readValueFromPointer: h }, { P: !0 });
2122
+ o = X(o), AA(C, { name: o, fromWireType: h, argPackAdvance: 8, readValueFromPointer: h }, { P: !0 });
2123
2123
  },
2124
2124
  e: (C, i) => {
2125
2125
  i = X(i);
2126
- var a = i === "std::string";
2126
+ var o = i === "std::string";
2127
2127
  AA(C, { name: i, fromWireType: function(h) {
2128
2128
  var w = U[h >> 2], k = h + 4;
2129
- if (a)
2129
+ if (o)
2130
2130
  for (var K = k, M = 0; M <= w; ++M) {
2131
2131
  var L = k + M;
2132
2132
  if (M == w || N[L] == 0) {
@@ -2149,14 +2149,14 @@ return ret;
2149
2149
  if (!(K || w instanceof Uint8Array || w instanceof Uint8ClampedArray || w instanceof Int8Array))
2150
2150
  throw new Z("Cannot pass non-string to std::string");
2151
2151
  var M;
2152
- if (a && K)
2152
+ if (o && K)
2153
2153
  for (k = M = 0; k < w.length; ++k) {
2154
2154
  var L = w.charCodeAt(k);
2155
2155
  127 >= L ? M++ : 2047 >= L ? M += 2 : 55296 <= L && 57343 >= L ? (M += 4, ++k) : M += 3;
2156
2156
  }
2157
2157
  else
2158
2158
  M = w.length;
2159
- if (k = M, M = lA(4 + k + 1), L = M + 4, U[M >> 2] = k, a && K) {
2159
+ if (k = M, M = lA(4 + k + 1), L = M + 4, U[M >> 2] = k, o && K) {
2160
2160
  if (K = L, L = k + 1, k = N, 0 < L) {
2161
2161
  L = K + L - 1;
2162
2162
  for (var W = 0; W < w.length; ++W) {
@@ -2205,12 +2205,12 @@ return ret;
2205
2205
  gA(h);
2206
2206
  } });
2207
2207
  },
2208
- c: (C, i, a) => {
2209
- if (a = X(a), i === 2)
2208
+ c: (C, i, o) => {
2209
+ if (o = X(o), i === 2)
2210
2210
  var h = fg, w = Wg, k = mg, K = () => t, M = 1;
2211
2211
  else
2212
2212
  i === 4 && (h = Tg, w = lg, k = pg, K = () => U, M = 2);
2213
- AA(C, { name: a, fromWireType: (L) => {
2213
+ AA(C, { name: o, fromWireType: (L) => {
2214
2214
  for (var W = U[L >> 2], T = K(), x, m = L + 4, b = 0; b <= W; ++b) {
2215
2215
  var BA = L + 4 + b * i;
2216
2216
  (b == W || T[BA >> M] == 0) && (m = h(m, BA - m), x === void 0 ? x = m : (x += "\0", x += m), m = BA + i);
@@ -2218,7 +2218,7 @@ return ret;
2218
2218
  return gA(L), x;
2219
2219
  }, toWireType: (L, W) => {
2220
2220
  if (typeof W != "string")
2221
- throw new Z(`Cannot pass non-string to C++ string type ${a}`);
2221
+ throw new Z(`Cannot pass non-string to C++ string type ${o}`);
2222
2222
  var T = k(W), x = lA(4 + T + i);
2223
2223
  return U[x >> 2] = T >> M, w(W, x + 4, T + i), L !== null && L.push(gA, x), x;
2224
2224
  }, argPackAdvance: 8, readValueFromPointer: CI, G(L) {
@@ -2235,21 +2235,21 @@ return ret;
2235
2235
  4 < C && (u.get(C).L += 1);
2236
2236
  },
2237
2237
  f: (C, i) => {
2238
- var a = EA[C];
2239
- if (a === void 0)
2238
+ var o = EA[C];
2239
+ if (o === void 0)
2240
2240
  throw C = "_emval_take_value has unknown type " + iI(C), new Z(C);
2241
- return C = a, C = C.readValueFromPointer(i), BI(C);
2241
+ return C = o, C = C.readValueFromPointer(i), BI(C);
2242
2242
  },
2243
2243
  h: () => {
2244
2244
  q("");
2245
2245
  },
2246
- v: (C, i, a) => N.copyWithin(C, i, i + a),
2246
+ v: (C, i, o) => N.copyWithin(C, i, i + o),
2247
2247
  q: (C) => {
2248
2248
  var i = N.length;
2249
2249
  if (C >>>= 0, 2147483648 < C)
2250
2250
  return !1;
2251
- for (var a = 1; 4 >= a; a *= 2) {
2252
- var h = i * (1 + 0.2 / a);
2251
+ for (var o = 1; 4 >= o; o *= 2) {
2252
+ var h = i * (1 + 0.2 / o);
2253
2253
  h = Math.min(h, C + 100663296);
2254
2254
  var w = Math;
2255
2255
  h = Math.max(C, h);
@@ -2269,26 +2269,26 @@ return ret;
2269
2269
  return !1;
2270
2270
  },
2271
2271
  t: (C, i) => {
2272
- var a = 0;
2272
+ var o = 0;
2273
2273
  return yI().forEach((h, w) => {
2274
- var k = i + a;
2274
+ var k = i + o;
2275
2275
  for (w = U[C + 4 * w >> 2] = k, k = 0; k < h.length; ++k)
2276
2276
  R[w++ >> 0] = h.charCodeAt(k);
2277
- R[w >> 0] = 0, a += h.length + 1;
2277
+ R[w >> 0] = 0, o += h.length + 1;
2278
2278
  }), 0;
2279
2279
  },
2280
2280
  u: (C, i) => {
2281
- var a = yI();
2282
- U[C >> 2] = a.length;
2281
+ var o = yI();
2282
+ U[C >> 2] = o.length;
2283
2283
  var h = 0;
2284
- return a.forEach((w) => h += w.length + 1), U[i >> 2] = h, 0;
2284
+ return o.forEach((w) => h += w.length + 1), U[i >> 2] = h, 0;
2285
2285
  },
2286
2286
  s: () => 52,
2287
2287
  n: function() {
2288
2288
  return 70;
2289
2289
  },
2290
- r: (C, i, a, h) => {
2291
- for (var w = 0, k = 0; k < a; k++) {
2290
+ r: (C, i, o, h) => {
2291
+ for (var w = 0, k = 0; k < o; k++) {
2292
2292
  var K = U[i >> 2], M = U[i + 4 >> 2];
2293
2293
  i += 8;
2294
2294
  for (var L = 0; L < M; L++) {
@@ -2300,8 +2300,8 @@ return ret;
2300
2300
  return U[h >> 2] = w, 0;
2301
2301
  }
2302
2302
  }, IA = (function() {
2303
- function C(a) {
2304
- return IA = a.exports, E = IA.w, d(), WA = IA.A, f.unshift(IA.x), Y--, I.monitorRunDependencies?.(Y), Y == 0 && r && (a = r, r = null, a()), IA;
2303
+ function C(o) {
2304
+ return IA = o.exports, E = IA.w, d(), WA = IA.A, f.unshift(IA.x), Y--, I.monitorRunDependencies?.(Y), Y == 0 && r && (o = r, r = null, o()), IA;
2305
2305
  }
2306
2306
  var i = { a: Zg };
2307
2307
  if (Y++, I.monitorRunDependencies?.(Y), I.instantiateWasm)
@@ -2310,14 +2310,14 @@ return ret;
2310
2310
  i,
2311
2311
  C
2312
2312
  );
2313
- } catch (a) {
2314
- s(`Module.instantiateWasm callback failed with error: ${a}`), B(a);
2313
+ } catch (o) {
2314
+ s(`Module.instantiateWasm callback failed with error: ${o}`), B(o);
2315
2315
  }
2316
- return NA(i, function(a) {
2317
- C(a.instance);
2316
+ return NA(i, function(o) {
2317
+ C(o.instance);
2318
2318
  }).catch(B), {};
2319
2319
  })(), lA = (C) => (lA = IA.y)(C), gA = (C) => (gA = IA.z)(C), FI = (C) => (FI = IA.B)(C);
2320
- I.dynCall_jiji = (C, i, a, h, w) => (I.dynCall_jiji = IA.D)(C, i, a, h, w);
2320
+ I.dynCall_jiji = (C, i, o, h, w) => (I.dynCall_jiji = IA.D)(C, i, o, h, w);
2321
2321
  var tA;
2322
2322
  r = function C() {
2323
2323
  tA || hI(), tA || (r = C);
@@ -2464,7 +2464,7 @@ class JC {
2464
2464
  * Get chunk indices that intersect a geographic bounding box.
2465
2465
  */
2466
2466
  getChunksForBounds(I, A, B, y) {
2467
- const Q = this.getCoords(), G = this.getChunkShape(I), s = this.getDimensions(I), o = s.indexOf("latitude"), E = s.indexOf("longitude"), D = G[o], R = G[E], N = Q.latitude, F = Q.longitude, t = this.findNearestIndex(N, y.north), H = this.findNearestIndex(N, y.south), U = this.findNearestIndex(F, y.west), c = this.findNearestIndex(F, y.east), e = Math.min(t, H), d = Math.max(t, H), S = Math.min(U, c), f = Math.max(U, c), l = Math.floor(e / D), J = Math.floor(d / D), Y = Math.floor(S / R), r = Math.floor(f / R), q = this.getShape(I), n = q[o], j = q[E], V = [];
2467
+ const Q = this.getCoords(), G = this.getChunkShape(I), s = this.getDimensions(I), a = s.indexOf("latitude"), E = s.indexOf("longitude"), D = G[a], R = G[E], N = Q.latitude, F = Q.longitude, t = this.findNearestIndex(N, y.north), H = this.findNearestIndex(N, y.south), U = this.findNearestIndex(F, y.west), c = this.findNearestIndex(F, y.east), e = Math.min(t, H), d = Math.max(t, H), S = Math.min(U, c), f = Math.max(U, c), l = Math.floor(e / D), J = Math.floor(d / D), Y = Math.floor(S / R), r = Math.floor(f / R), q = this.getShape(I), n = q[a], j = q[E], V = [];
2468
2468
  for (let O = l; O <= J; O++)
2469
2469
  for (let z = Y; z <= r; z++) {
2470
2470
  const oA = O * D, NA = z * R, aA = Math.min(D, n - oA), LA = Math.min(R, j - NA);
@@ -2488,10 +2488,10 @@ class JC {
2488
2488
  this.abortControllers.get(Q)?.abort();
2489
2489
  const G = new AbortController();
2490
2490
  this.abortControllers.set(Q, G);
2491
- const s = `${this.root}/${I}/${y}`, o = await fetch(s, { signal: G.signal });
2492
- if (!o.ok)
2493
- throw new Error(`Chunk fetch failed: ${o.status} ${s}`);
2494
- const E = new Uint8Array(await o.arrayBuffer()), D = this.getArrayMeta(I), R = await this.decompress(E, D);
2491
+ const s = `${this.root}/${I}/${y}`, a = await fetch(s, { signal: G.signal });
2492
+ if (!a.ok)
2493
+ throw new Error(`Chunk fetch failed: ${a.status} ${s}`);
2494
+ const E = new Uint8Array(await a.arrayBuffer()), D = this.getArrayMeta(I), R = await this.decompress(E, D);
2495
2495
  if (this.cache.size >= this.maxCacheSize) {
2496
2496
  const N = this.cache.keys().next().value;
2497
2497
  N !== void 0 && this.cache.delete(N);
@@ -2558,26 +2558,26 @@ class JC {
2558
2558
  B.buffer,
2559
2559
  B.byteOffset,
2560
2560
  B.byteLength
2561
- ), o = B.byteLength / 8;
2562
- y = new Float32Array(o);
2563
- for (let E = 0; E < o; E++)
2561
+ ), a = B.byteLength / 8;
2562
+ y = new Float32Array(a);
2563
+ for (let E = 0; E < a; E++)
2564
2564
  y[E] = Number(s.getBigInt64(E * 8, !0));
2565
2565
  } else
2566
2566
  throw new Error(`Unsupported dtype: ${Q}`);
2567
2567
  const G = A.fill_value;
2568
2568
  if (G != null && typeof G == "number" && !isNaN(G)) {
2569
2569
  const s = Math.fround(G);
2570
- for (let o = 0; o < y.length; o++)
2571
- y[o] === s && (y[o] = NaN);
2570
+ for (let a = 0; a < y.length; a++)
2571
+ y[a] === s && (y[a] = NaN);
2572
2572
  }
2573
2573
  return y;
2574
2574
  }
2575
2575
  async loadCoordinates() {
2576
- const I = async (o) => {
2577
- const E = this.getArrayMeta(o), D = Math.ceil(E.shape[0] / E.chunks[0]), R = [];
2576
+ const I = async (a) => {
2577
+ const E = this.getArrayMeta(a), D = Math.ceil(E.shape[0] / E.chunks[0]), R = [];
2578
2578
  for (let H = 0; H < D; H++) {
2579
- const U = `${this.root}/${o}/${H}`, c = await fetch(U);
2580
- if (!c.ok) throw new Error(`Failed to fetch coord ${o}/${H}`);
2579
+ const U = `${this.root}/${a}/${H}`, c = await fetch(U);
2580
+ if (!c.ok) throw new Error(`Failed to fetch coord ${a}/${H}`);
2581
2581
  const e = new Uint8Array(await c.arrayBuffer());
2582
2582
  R.push(await this.decompress(e, E));
2583
2583
  }
@@ -2589,10 +2589,10 @@ class JC {
2589
2589
  return F;
2590
2590
  };
2591
2591
  let A = null;
2592
- for (const o of $I) {
2593
- const E = `${o}/.zarray`;
2592
+ for (const a of $I) {
2593
+ const E = `${a}/.zarray`;
2594
2594
  if (this.meta.metadata[E] && "dtype" in this.meta.metadata[E]) {
2595
- A = o;
2595
+ A = a;
2596
2596
  break;
2597
2597
  }
2598
2598
  }
@@ -2610,8 +2610,8 @@ class JC {
2610
2610
  let s = y;
2611
2611
  if (s.length > 0 && s[0] < 0) {
2612
2612
  s = new Float32Array(s.length);
2613
- for (let o = 0; o < y.length; o++)
2614
- s[o] = -y[o];
2613
+ for (let a = 0; a < y.length; a++)
2614
+ s[a] = -y[a];
2615
2615
  }
2616
2616
  this.coords = {
2617
2617
  time: B,
@@ -2675,9 +2675,9 @@ class kC {
2675
2675
  B,
2676
2676
  y,
2677
2677
  A
2678
- ), s = this.zarrSource.getDimensions(this.opts.variableU), o = s.indexOf("time"), E = this.zarrSource.getVerticalDimName(), D = s.indexOf(E), R = s.indexOf("latitude"), N = s.indexOf("longitude"), F = G.map(async (J) => {
2678
+ ), s = this.zarrSource.getDimensions(this.opts.variableU), a = s.indexOf("time"), E = this.zarrSource.getVerticalDimName(), D = s.indexOf(E), R = s.indexOf("latitude"), N = s.indexOf("longitude"), F = G.map(async (J) => {
2679
2679
  const Y = [];
2680
- return Y[o] = J.timeIdx, Y[D] = J.depthIdx, Y[R] = J.latIdx, Y[N] = J.lonIdx, {
2680
+ return Y[a] = J.timeIdx, Y[D] = J.depthIdx, Y[R] = J.latIdx, Y[N] = J.lonIdx, {
2681
2681
  data: await this.zarrSource.fetchChunk(
2682
2682
  this.opts.variableU,
2683
2683
  Y
@@ -2689,7 +2689,7 @@ class kC {
2689
2689
  };
2690
2690
  }), t = G.map(async (J) => {
2691
2691
  const Y = [];
2692
- return Y[o] = J.timeIdx, Y[D] = J.depthIdx, Y[R] = J.latIdx, Y[N] = J.lonIdx, {
2692
+ return Y[a] = J.timeIdx, Y[D] = J.depthIdx, Y[R] = J.latIdx, Y[N] = J.lonIdx, {
2693
2693
  data: await this.zarrSource.fetchChunk(
2694
2694
  this.opts.variableV,
2695
2695
  Y
@@ -2736,14 +2736,14 @@ class kC {
2736
2736
  maxY: Ag(Math.max(G.getSouth(), -85))
2737
2737
  };
2738
2738
  I.disable(I.DEPTH_TEST), I.disable(I.STENCIL_TEST);
2739
- const o = 512 * Math.pow(2, this.map.getZoom());
2739
+ const E = Array.isArray(A) ? 1 : 512 * Math.pow(2, this.map.getZoom());
2740
2740
  this.simulation.render(
2741
2741
  this.velocityTexUnit,
2742
2742
  [this.velocityField.uMin, this.velocityField.vMin],
2743
2743
  [this.velocityField.uMax, this.velocityField.vMax],
2744
2744
  B,
2745
2745
  s,
2746
- o,
2746
+ E,
2747
2747
  this.velocityField.geoBounds
2748
2748
  );
2749
2749
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fxi/zartigl",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "MapLibre GL JS plugin for animated particle flow from Zarr ocean current data",
5
5
  "type": "module",
6
6
  "main": "./dist/zartigl.js",
@@ -17,7 +17,9 @@
17
17
  ],
18
18
  "scripts": {
19
19
  "dev": "vite",
20
+ "dev:mapbox": "vite --config vite.config.demo-mapbox.ts",
20
21
  "build": "vite build",
22
+ "build:mapbox": "vite build --config vite.config.demo-mapbox.ts",
21
23
  "build:lib": "vite build --config vite.config.lib.ts",
22
24
  "preview": "vite preview",
23
25
  "prepublishOnly": "npm run build:lib"
@@ -41,6 +43,7 @@
41
43
  "devDependencies": {
42
44
  "@tweakpane/core": "^2.0.5",
43
45
  "@types/pako": "^2.0.4",
46
+ "mapbox-gl": "^2.15.0",
44
47
  "maplibre-gl": "^5.17.0",
45
48
  "numcodecs": "^0.3.2",
46
49
  "pako": "^2.1.0",