@navaramap/worker 0.0.6 → 0.0.8

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.
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ var b = Object.create, x = Object.defineProperty, S = Object.getOwnPropertyDescr
7
7
  enumerable: !(r = S(t, s)) || r.enumerable
8
8
  });
9
9
  return e;
10
- }, te = (e, t, n) => (n = e == null ? {} : b(w(e)), ee(t || !e || !e.__esModule ? x(n, "default", {
10
+ }, te = (e, t, n) => (n = e == null ? {} : b(w(e)), ee(t || !e || !e.__esModule || !T.call(e, "default") ? x(n, "default", {
11
11
  value: e,
12
12
  enumerable: !0
13
13
  }) : n, e)), ne = "Invariant failed";
@@ -185,7 +185,8 @@ var D = /* @__PURE__ */ E(((e, t) => {
185
185
  if (!window.URL || typeof window.URL.createObjectURL != "function") throw Error("URL.createObjectURL not supported by the browser");
186
186
  var e = new Blob([se()], { type: "text/javascript" });
187
187
  return window.URL.createObjectURL(e);
188
- } else return __dirname + "/worker.js";
188
+ }
189
+ return __dirname + "/worker.js";
189
190
  }
190
191
  function m(e, t) {
191
192
  if (t.workerType === "web") return d(), h(e, t.workerOpts, Worker);
@@ -255,17 +256,19 @@ var D = /* @__PURE__ */ E(((e, t) => {
255
256
  }), this.worker.on("stderr", function(e) {
256
257
  b(n, { stderr: e.toString() });
257
258
  }), this.worker.on("message", function(e) {
258
- if (!n.terminated) if (typeof e == "string" && e === "ready") n.worker.ready = !0, a();
259
- else {
260
- var t = e.id, r = n.processing[t];
261
- if (r !== void 0) e.isEvent ? r.options && typeof r.options.on == "function" && r.options.on(e.payload) : (delete n.processing[t], n.terminating === !0 && n.terminate(), e.error ? r.resolver.reject(y(e.error)) : r.resolver.resolve(e.result));
259
+ if (!n.terminated) {
260
+ if (typeof e == "string" && e === "ready") n.worker.ready = !0, a();
262
261
  else {
263
- var r = n.tracking[t];
264
- r !== void 0 && e.isEvent && r.options && typeof r.options.on == "function" && r.options.on(e.payload);
265
- }
266
- if (e.method === l) {
267
- var i = n.tracking[e.id];
268
- i !== void 0 && (e.error ? (clearTimeout(i.timeoutId), i.resolver.reject(y(e.error))) : (n.tracking && clearTimeout(i.timeoutId), i.resolver.reject(new S(i.error)))), delete n.tracking[t];
262
+ var t = e.id, r = n.processing[t];
263
+ if (r !== void 0) e.isEvent ? r.options && typeof r.options.on == "function" && r.options.on(e.payload) : (delete n.processing[t], n.terminating === !0 && n.terminate(), e.error ? r.resolver.reject(y(e.error)) : r.resolver.resolve(e.result));
264
+ else {
265
+ var r = n.tracking[t];
266
+ r !== void 0 && e.isEvent && r.options && typeof r.options.on == "function" && r.options.on(e.payload);
267
+ }
268
+ if (e.method === l) {
269
+ var i = n.tracking[e.id];
270
+ i !== void 0 && (e.error ? (clearTimeout(i.timeoutId), i.resolver.reject(y(e.error))) : (n.tracking && clearTimeout(i.timeoutId), i.resolver.reject(new S(i.error)))), delete n.tracking[t];
271
+ }
269
272
  }
270
273
  }
271
274
  });
@@ -340,20 +343,23 @@ var D = /* @__PURE__ */ E(((e, t) => {
340
343
  if (n.terminated = !0, n.cleaning = !1, n.worker != null && n.worker.removeAllListeners && n.worker.removeAllListeners("message"), n.worker = null, n.terminating = !1, n.terminationHandler) n.terminationHandler(e, n);
341
344
  else if (e) throw e;
342
345
  };
343
- if (this.worker) if (typeof this.worker.kill == "function") {
344
- if (this.worker.killed) {
345
- a(/* @__PURE__ */ Error("worker already killed!"));
346
+ if (this.worker) {
347
+ if (typeof this.worker.kill == "function") {
348
+ if (this.worker.killed) {
349
+ a(/* @__PURE__ */ Error("worker already killed!"));
350
+ return;
351
+ }
352
+ var o = setTimeout(function() {
353
+ n.worker && n.worker.kill();
354
+ }, this.workerTerminateTimeout);
355
+ this.worker.once("exit", function() {
356
+ clearTimeout(o), n.worker && (n.worker.killed = !0), a();
357
+ }), this.worker.ready ? this.worker.send(c) : this.requestQueue.push({ message: c }), this.cleaning = !0;
346
358
  return;
347
359
  }
348
- var o = setTimeout(function() {
349
- n.worker && n.worker.kill();
350
- }, this.workerTerminateTimeout);
351
- this.worker.once("exit", function() {
352
- clearTimeout(o), n.worker && (n.worker.killed = !0), a();
353
- }), this.worker.ready ? this.worker.send(c) : this.requestQueue.push({ message: c }), this.cleaning = !0;
354
- return;
355
- } else if (typeof this.worker.terminate == "function") this.worker.terminate(), this.worker.killed = !0;
356
- else throw Error("Failed to terminate worker");
360
+ if (typeof this.worker.terminate == "function") this.worker.terminate(), this.worker.killed = !0;
361
+ else throw Error("Failed to terminate worker");
362
+ }
357
363
  a();
358
364
  }
359
365
  }, x.prototype.terminateAndNotify = function(e, t) {
@@ -437,8 +443,9 @@ var D = /* @__PURE__ */ E(((e, t) => {
437
443
  return i.promise.timeout = function(e) {
438
444
  return s.contains(a) ? (a.timeout = e, i.promise) : o.call(i.promise, e);
439
445
  }, this._next(), i.promise;
440
- } else if (typeof e == "function") return this.exec("run", [String(e), t], r);
441
- else throw TypeError("Function or string expected as argument \"method\"");
446
+ }
447
+ if (typeof e == "function") return this.exec("run", [String(e), t], r);
448
+ throw TypeError("Function or string expected as argument \"method\"");
442
449
  }, c.prototype.proxy = function() {
443
450
  if (arguments.length > 0) throw Error("No arguments expected");
444
451
  var e = this;
@@ -957,6 +964,10 @@ var be = class {
957
964
  rtc_translation;
958
965
  outline_position;
959
966
  outline_position_size;
967
+ outline_position_3d_high;
968
+ outline_position_3d_high_size;
969
+ outline_position_3d_low;
970
+ outline_position_3d_low_size;
960
971
  outline_scale_normal_and_cap;
961
972
  outline_scale_normal_and_cap_size;
962
973
  outline_skip_indices;
@@ -966,7 +977,7 @@ var be = class {
966
977
  let t = e.extent;
967
978
  this.extent = t ? new Se(t) : void 0, this.position_3d_high = e.position_3d_high()?.slice(), this.position_3d_high_size = e.position_3d_high_size(), this.position_3d_low = e.position_3d_low()?.slice(), this.position_3d_low_size = e.position_3d_low_size(), this.position = e.position()?.slice(), this.position_size = e.position_size(), this.normal = e.normal()?.slice(), this.normal_size = e.normal_size(), this.scale_normal_and_cap = e.scale_normal_and_cap()?.slice(), this.scale_normal_and_cap_size = e.scale_normal_and_cap_size(), this.batch_id = e.batch_id()?.slice(), this.batch_id_size = e.batch_id_size(), this.batch_index = e.batch_index()?.slice(), this.batch_index_size = e.batch_index_size(), this.indices = e.indices().slice(), this.rtc_translation = e.rtc_translation ? new be(e.rtc_translation) : void 0;
968
979
  let n = e.outline();
969
- n && (this.outline_position = n.position()?.slice(), this.outline_position_size = n.position_size(), this.outline_scale_normal_and_cap = n.scale_normal_and_cap()?.slice(), this.outline_scale_normal_and_cap_size = n.scale_normal_and_cap_size(), this.outline_skip_indices = n.skip_indices()?.slice(), this.outline_batch_index = n.batch_index()?.slice(), this.outline_batch_index_size = n.batch_index_size(), n.free());
980
+ n && (this.outline_position = n.position()?.slice(), this.outline_position_size = n.position_size(), this.outline_position_3d_high = n.position_3d_high()?.slice(), this.outline_position_3d_high_size = n.position_3d_high_size(), this.outline_position_3d_low = n.position_3d_low()?.slice(), this.outline_position_3d_low_size = n.position_3d_low_size(), this.outline_scale_normal_and_cap = n.scale_normal_and_cap()?.slice(), this.outline_scale_normal_and_cap_size = n.scale_normal_and_cap_size(), this.outline_skip_indices = n.skip_indices()?.slice(), this.outline_batch_index = n.batch_index()?.slice(), this.outline_batch_index_size = n.batch_index_size(), n.free());
970
981
  }
971
982
  }, we = class {
972
983
  extent;
@@ -2555,7 +2566,7 @@ function Xi(e) {
2555
2566
  return this.tween(t, Yi(e));
2556
2567
  }
2557
2568
  function Zi() {
2558
- for (var e = this._name, t = this._id, n = ta(), r = this._groups, i = r.length, a = 0; a < i; ++a) for (var o = r[a], s = o.length, c, l = 0; l < s; ++l) if (c = o[l]) {
2569
+ for (var e = this._name, t = this._id, n = ea(), r = this._groups, i = r.length, a = 0; a < i; ++a) for (var o = r[a], s = o.length, c, l = 0; l < s; ++l) if (c = o[l]) {
2559
2570
  var u = q(c, t);
2560
2571
  qr(c, e, n, l, o, {
2561
2572
  time: u.time + u.delay + u.duration,
@@ -2582,14 +2593,11 @@ var $i = 0;
2582
2593
  function J(e, t, n, r) {
2583
2594
  this._groups = e, this._parents = t, this._name = n, this._id = r;
2584
2595
  }
2585
- function ea(e) {
2586
- return A().transition(e);
2587
- }
2588
- function ta() {
2596
+ function ea() {
2589
2597
  return ++$i;
2590
2598
  }
2591
2599
  var Y = A.prototype;
2592
- J.prototype = ea.prototype = {
2600
+ J.prototype = {
2593
2601
  constructor: J,
2594
2602
  select: Mi,
2595
2603
  selectAll: Ni,
@@ -2621,28 +2629,28 @@ J.prototype = ea.prototype = {
2621
2629
  end: Qi,
2622
2630
  [Symbol.iterator]: Y[Symbol.iterator]
2623
2631
  };
2624
- function na(e) {
2632
+ function ta(e) {
2625
2633
  return ((e *= 2) <= 1 ? e * e * e : (e -= 2) * e * e + 2) / 2;
2626
2634
  }
2627
- var ra = {
2635
+ var na = {
2628
2636
  time: null,
2629
2637
  delay: 0,
2630
2638
  duration: 250,
2631
- ease: na
2639
+ ease: ta
2632
2640
  };
2633
- function ia(e, t) {
2641
+ function ra(e, t) {
2634
2642
  for (var n; !(n = e.__transition) || !(n = n[t]);) if (!(e = e.parentNode)) throw Error(`transition ${t} not found`);
2635
2643
  return n;
2636
2644
  }
2637
- function aa(e) {
2645
+ function ia(e) {
2638
2646
  var t, n;
2639
- e instanceof J ? (t = e._id, e = e._name) : (t = ta(), (n = ra).time = Fr(), e = e == null ? null : e + "");
2640
- for (var r = this._groups, i = r.length, a = 0; a < i; ++a) for (var o = r[a], s = o.length, c, l = 0; l < s; ++l) (c = o[l]) && qr(c, e, t, l, o, n || ia(c, t));
2647
+ e instanceof J ? (t = e._id, e = e._name) : (t = ea(), (n = na).time = Fr(), e = e == null ? null : e + "");
2648
+ for (var r = this._groups, i = r.length, a = 0; a < i; ++a) for (var o = r[a], s = o.length, c, l = 0; l < s; ++l) (c = o[l]) && qr(c, e, t, l, o, n || ra(c, t));
2641
2649
  return new J(r, this._parents, e, t);
2642
2650
  }
2643
- A.prototype.interrupt = Zr, A.prototype.transition = aa;
2644
- var { abs: oa, max: sa, min: ca } = Math;
2645
- ["w", "e"].map(la), ["n", "s"].map(la), [
2651
+ A.prototype.interrupt = Zr, A.prototype.transition = ia;
2652
+ var { abs: aa, max: oa, min: sa } = Math;
2653
+ ["w", "e"].map(ca), ["n", "s"].map(ca), [
2646
2654
  "n",
2647
2655
  "w",
2648
2656
  "e",
@@ -2651,39 +2659,39 @@ var { abs: oa, max: sa, min: ca } = Math;
2651
2659
  "ne",
2652
2660
  "sw",
2653
2661
  "se"
2654
- ].map(la);
2655
- function la(e) {
2662
+ ].map(ca);
2663
+ function ca(e) {
2656
2664
  return { type: e };
2657
2665
  }
2658
- function ua(e) {
2666
+ function la(e) {
2659
2667
  return Math.abs(e = Math.round(e)) >= 1e21 ? e.toLocaleString("en").replace(/,/g, "") : e.toString(10);
2660
2668
  }
2661
- function da(e, t) {
2669
+ function ua(e, t) {
2662
2670
  if (!isFinite(e) || e === 0) return null;
2663
2671
  var n = (e = t ? e.toExponential(t - 1) : e.toExponential()).indexOf("e"), r = e.slice(0, n);
2664
2672
  return [r.length > 1 ? r[0] + r.slice(2) : r, +e.slice(n + 1)];
2665
2673
  }
2666
- function fa(e) {
2667
- return e = da(Math.abs(e)), e ? e[1] : NaN;
2674
+ function da(e) {
2675
+ return e = ua(Math.abs(e)), e ? e[1] : NaN;
2668
2676
  }
2669
- function pa(e, t) {
2677
+ function fa(e, t) {
2670
2678
  return function(n, r) {
2671
2679
  for (var i = n.length, a = [], o = 0, s = e[0], c = 0; i > 0 && s > 0 && (c + s + 1 > r && (s = Math.max(1, r - c)), a.push(n.substring(i -= s, i + s)), !((c += s + 1) > r));) s = e[o = (o + 1) % e.length];
2672
2680
  return a.reverse().join(t);
2673
2681
  };
2674
2682
  }
2675
- function ma(e) {
2683
+ function pa(e) {
2676
2684
  return function(t) {
2677
2685
  return t.replace(/[0-9]/g, function(t) {
2678
2686
  return e[+t];
2679
2687
  });
2680
2688
  };
2681
2689
  }
2682
- var ha = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
2683
- function ga(e) {
2684
- if (!(t = ha.exec(e))) throw Error("invalid format: " + e);
2690
+ var ma = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
2691
+ function ha(e) {
2692
+ if (!(t = ma.exec(e))) throw Error("invalid format: " + e);
2685
2693
  var t;
2686
- return new _a({
2694
+ return new ga({
2687
2695
  fill: t[1],
2688
2696
  align: t[2],
2689
2697
  sign: t[3],
@@ -2696,14 +2704,14 @@ function ga(e) {
2696
2704
  type: t[10]
2697
2705
  });
2698
2706
  }
2699
- ga.prototype = _a.prototype;
2700
- function _a(e) {
2707
+ ha.prototype = ga.prototype;
2708
+ function ga(e) {
2701
2709
  this.fill = e.fill === void 0 ? " " : e.fill + "", this.align = e.align === void 0 ? ">" : e.align + "", this.sign = e.sign === void 0 ? "-" : e.sign + "", this.symbol = e.symbol === void 0 ? "" : e.symbol + "", this.zero = !!e.zero, this.width = e.width === void 0 ? void 0 : +e.width, this.comma = !!e.comma, this.precision = e.precision === void 0 ? void 0 : +e.precision, this.trim = !!e.trim, this.type = e.type === void 0 ? "" : e.type + "";
2702
2710
  }
2703
- _a.prototype.toString = function() {
2711
+ ga.prototype.toString = function() {
2704
2712
  return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
2705
2713
  };
2706
- function va(e) {
2714
+ function _a(e) {
2707
2715
  out: for (var t = e.length, n = 1, r = -1, i; n < t; ++n) switch (e[n]) {
2708
2716
  case ".":
2709
2717
  r = i = n;
@@ -2714,42 +2722,41 @@ function va(e) {
2714
2722
  default:
2715
2723
  if (!+e[n]) break out;
2716
2724
  r > 0 && (r = 0);
2717
- break;
2718
2725
  }
2719
2726
  return r > 0 ? e.slice(0, r) + e.slice(i + 1) : e;
2720
2727
  }
2721
- var ya;
2722
- function ba(e, t) {
2723
- var n = da(e, t);
2724
- if (!n) return ya = void 0, e.toPrecision(t);
2725
- var r = n[0], i = n[1], a = i - (ya = Math.max(-8, Math.min(8, Math.floor(i / 3))) * 3) + 1, o = r.length;
2726
- return a === o ? r : a > o ? r + Array(a - o + 1).join("0") : a > 0 ? r.slice(0, a) + "." + r.slice(a) : "0." + Array(1 - a).join("0") + da(e, Math.max(0, t + a - 1))[0];
2728
+ var va;
2729
+ function ya(e, t) {
2730
+ var n = ua(e, t);
2731
+ if (!n) return va = void 0, e.toPrecision(t);
2732
+ var r = n[0], i = n[1], a = i - (va = Math.max(-8, Math.min(8, Math.floor(i / 3))) * 3) + 1, o = r.length;
2733
+ return a === o ? r : a > o ? r + Array(a - o + 1).join("0") : a > 0 ? r.slice(0, a) + "." + r.slice(a) : "0." + Array(1 - a).join("0") + ua(e, Math.max(0, t + a - 1))[0];
2727
2734
  }
2728
- function xa(e, t) {
2729
- var n = da(e, t);
2735
+ function ba(e, t) {
2736
+ var n = ua(e, t);
2730
2737
  if (!n) return e + "";
2731
2738
  var r = n[0], i = n[1];
2732
2739
  return i < 0 ? "0." + Array(-i).join("0") + r : r.length > i + 1 ? r.slice(0, i + 1) + "." + r.slice(i + 1) : r + Array(i - r.length + 2).join("0");
2733
2740
  }
2734
- var Sa = {
2741
+ var xa = {
2735
2742
  "%": (e, t) => (e * 100).toFixed(t),
2736
2743
  b: (e) => Math.round(e).toString(2),
2737
2744
  c: (e) => e + "",
2738
- d: ua,
2745
+ d: la,
2739
2746
  e: (e, t) => e.toExponential(t),
2740
2747
  f: (e, t) => e.toFixed(t),
2741
2748
  g: (e, t) => e.toPrecision(t),
2742
2749
  o: (e) => Math.round(e).toString(8),
2743
- p: (e, t) => xa(e * 100, t),
2744
- r: xa,
2745
- s: ba,
2750
+ p: (e, t) => ba(e * 100, t),
2751
+ r: ba,
2752
+ s: ya,
2746
2753
  X: (e) => Math.round(e).toString(16).toUpperCase(),
2747
2754
  x: (e) => Math.round(e).toString(16)
2748
2755
  };
2749
- function Ca(e) {
2756
+ function Sa(e) {
2750
2757
  return e;
2751
2758
  }
2752
- var wa = Array.prototype.map, Ta = [
2759
+ var Ca = Array.prototype.map, wa = [
2753
2760
  "y",
2754
2761
  "z",
2755
2762
  "a",
@@ -2768,13 +2775,13 @@ var wa = Array.prototype.map, Ta = [
2768
2775
  "Z",
2769
2776
  "Y"
2770
2777
  ];
2771
- function Ea(e) {
2772
- var t = e.grouping === void 0 || e.thousands === void 0 ? Ca : pa(wa.call(e.grouping, Number), e.thousands + ""), n = e.currency === void 0 ? "" : e.currency[0] + "", r = e.currency === void 0 ? "" : e.currency[1] + "", i = e.decimal === void 0 ? "." : e.decimal + "", a = e.numerals === void 0 ? Ca : ma(wa.call(e.numerals, String)), o = e.percent === void 0 ? "%" : e.percent + "", s = e.minus === void 0 ? "−" : e.minus + "", c = e.nan === void 0 ? "NaN" : e.nan + "";
2778
+ function Ta(e) {
2779
+ var t = e.grouping === void 0 || e.thousands === void 0 ? Sa : fa(Ca.call(e.grouping, Number), e.thousands + ""), n = e.currency === void 0 ? "" : e.currency[0] + "", r = e.currency === void 0 ? "" : e.currency[1] + "", i = e.decimal === void 0 ? "." : e.decimal + "", a = e.numerals === void 0 ? Sa : pa(Ca.call(e.numerals, String)), o = e.percent === void 0 ? "%" : e.percent + "", s = e.minus === void 0 ? "−" : e.minus + "", c = e.nan === void 0 ? "NaN" : e.nan + "";
2773
2780
  function l(e, l) {
2774
- e = ga(e);
2781
+ e = ha(e);
2775
2782
  var u = e.fill, d = e.align, f = e.sign, p = e.symbol, m = e.zero, h = e.width, g = e.comma, _ = e.precision, v = e.trim, y = e.type;
2776
- y === "n" ? (g = !0, y = "g") : Sa[y] || (_ === void 0 && (_ = 12), v = !0, y = "g"), (m || u === "0" && d === "=") && (m = !0, u = "0", d = "=");
2777
- var b = (l && l.prefix !== void 0 ? l.prefix : "") + (p === "$" ? n : p === "#" && /[boxX]/.test(y) ? "0" + y.toLowerCase() : ""), x = (p === "$" ? r : /[%p]/.test(y) ? o : "") + (l && l.suffix !== void 0 ? l.suffix : ""), S = Sa[y], C = /[defgprs%]/.test(y);
2783
+ y === "n" ? (g = !0, y = "g") : xa[y] || (_ === void 0 && (_ = 12), v = !0, y = "g"), (m || u === "0" && d === "=") && (m = !0, u = "0", d = "=");
2784
+ var b = (l && l.prefix !== void 0 ? l.prefix : "") + (p === "$" ? n : p === "#" && /[boxX]/.test(y) ? "0" + y.toLowerCase() : ""), x = (p === "$" ? r : /[%p]/.test(y) ? o : "") + (l && l.suffix !== void 0 ? l.suffix : ""), S = xa[y], C = /[defgprs%]/.test(y);
2778
2785
  _ = _ === void 0 ? 6 : /[gprs]/.test(y) ? Math.max(1, Math.min(21, _)) : Math.max(0, Math.min(20, _));
2779
2786
  function w(e) {
2780
2787
  var n = b, r = x, o, l, p;
@@ -2782,7 +2789,7 @@ function Ea(e) {
2782
2789
  else {
2783
2790
  e = +e;
2784
2791
  var w = e < 0 || 1 / e < 0;
2785
- if (e = isNaN(e) ? c : S(Math.abs(e), _), v && (e = va(e)), w && +e == 0 && f !== "+" && (w = !1), n = (w ? f === "(" ? f : s : f === "-" || f === "(" ? "" : f) + n, r = (y === "s" && !isNaN(e) && ya !== void 0 ? Ta[8 + ya / 3] : "") + r + (w && f === "(" ? ")" : ""), C) {
2792
+ if (e = isNaN(e) ? c : S(Math.abs(e), _), v && (e = _a(e)), w && +e == 0 && f !== "+" && (w = !1), n = (w ? f === "(" ? f : s : f === "-" || f === "(" ? "" : f) + n, r = (y === "s" && !isNaN(e) && va !== void 0 ? wa[8 + va / 3] : "") + r + (w && f === "(" ? ")" : ""), C) {
2786
2793
  for (o = -1, l = e.length; ++o < l;) if (p = e.charCodeAt(o), 48 > p || p > 57) {
2787
2794
  r = (p === 46 ? i + e.slice(o + 1) : e.slice(o)) + r, e = e.slice(0, o);
2788
2795
  break;
@@ -2801,9 +2808,7 @@ function Ea(e) {
2801
2808
  case "^":
2802
2809
  e = E.slice(0, T = E.length >> 1) + n + e + r + E.slice(T);
2803
2810
  break;
2804
- default:
2805
- e = E + n + e + r;
2806
- break;
2811
+ default: e = E + n + e + r;
2807
2812
  }
2808
2813
  return a(e);
2809
2814
  }
@@ -2812,7 +2817,7 @@ function Ea(e) {
2812
2817
  }, w;
2813
2818
  }
2814
2819
  function u(e, t) {
2815
- var n = Math.max(-8, Math.min(8, Math.floor(fa(t) / 3))) * 3, r = 10 ** -n, i = l((e = ga(e), e.type = "f", e), { suffix: Ta[8 + n / 3] });
2820
+ var n = Math.max(-8, Math.min(8, Math.floor(da(t) / 3))) * 3, r = 10 ** -n, i = l((e = ha(e), e.type = "f", e), { suffix: wa[8 + n / 3] });
2816
2821
  return function(e) {
2817
2822
  return i(r * e);
2818
2823
  };
@@ -2822,14 +2827,14 @@ function Ea(e) {
2822
2827
  formatPrefix: u
2823
2828
  };
2824
2829
  }
2825
- var Da;
2826
- Oa({
2830
+ var Ea;
2831
+ Da({
2827
2832
  thousands: ",",
2828
2833
  grouping: [3],
2829
2834
  currency: ["$", ""]
2830
2835
  });
2831
- function Oa(e) {
2832
- return Da = Ea(e), Da.format, Da.formatPrefix, Da;
2836
+ function Da(e) {
2837
+ return Ea = Ta(e), Ea.format, Ea.formatPrefix, Ea;
2833
2838
  }
2834
2839
  function X(e, t, n) {
2835
2840
  this.k = e, this.x = t, this.y = n;
@@ -2870,15 +2875,15 @@ X.prototype = {
2870
2875
  return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
2871
2876
  }
2872
2877
  };
2873
- var ka = new X(1, 0, 0);
2874
- Aa.prototype = X.prototype;
2875
- function Aa(e) {
2876
- for (; !e.__zoom;) if (!(e = e.parentNode)) return ka;
2878
+ var Oa = new X(1, 0, 0);
2879
+ ka.prototype = X.prototype;
2880
+ function ka(e) {
2881
+ for (; !e.__zoom;) if (!(e = e.parentNode)) return Oa;
2877
2882
  return e.__zoom;
2878
2883
  }
2879
2884
  //#endregion
2880
2885
  //#region src/helpers/transferConstructedPolygonGeometry.ts
2881
- function ja(e) {
2886
+ function Aa(e) {
2882
2887
  let t = new Ce(e);
2883
2888
  return {
2884
2889
  result: t,
@@ -2892,6 +2897,8 @@ function ja(e) {
2892
2897
  t.scale_normal_and_cap?.buffer,
2893
2898
  t.indices.buffer,
2894
2899
  t.outline_position?.buffer,
2900
+ t.outline_position_3d_high?.buffer,
2901
+ t.outline_position_3d_low?.buffer,
2895
2902
  t.outline_scale_normal_and_cap?.buffer,
2896
2903
  t.outline_skip_indices?.buffer,
2897
2904
  t.outline_batch_index?.buffer
@@ -2901,32 +2908,32 @@ function ja(e) {
2901
2908
  //#endregion
2902
2909
  //#region src/utils/toTransferableTileLike.ts
2903
2910
  function Z(e) {
2904
- return new d(Ma(e.coords), e.max_height, e.min_height, e.cached_mesh_handle ? Na(e.cached_mesh_handle) : void 0);
2911
+ return new d(ja(e.coords), e.max_height, e.min_height, e.cached_mesh_handle ? Ma(e.cached_mesh_handle) : void 0);
2905
2912
  }
2906
- function Ma(e) {
2913
+ function ja(e) {
2907
2914
  return new o(e.x, e.y, e.z);
2908
2915
  }
2909
- function Na(e) {
2916
+ function Ma(e) {
2910
2917
  return new t(e.vertices, e.indices, e.uvs, e.heights);
2911
2918
  }
2912
2919
  //#endregion
2913
2920
  //#region src/utils/toUpsamplableTerrainGeometryLike.ts
2914
- function Pa(e) {
2921
+ function Na(e) {
2915
2922
  return new f(e.uvs, e.indices, e.heights, e.normals, e.watermask);
2916
2923
  }
2917
2924
  //#endregion
2918
2925
  //#region src/utils/toExtentRadianF32Like.ts
2919
- function Fa(e) {
2926
+ function Pa(e) {
2920
2927
  return new r(e.west, e.south, e.east, e.north);
2921
2928
  }
2922
2929
  //#endregion
2923
2930
  //#region src/utils/toPolygonMaterialLike.ts
2924
- function Ia(e) {
2931
+ function Fa(e) {
2925
2932
  return new i(e.show, e.castShadow, e.receiveShadow, e.color, e.clampToGround, e.tiled, e.height, e.extrudedHeight, e.wireframe, e.outline, e.perPositionHeight, e.__internal__);
2926
2933
  }
2927
2934
  //#endregion
2928
2935
  //#region src/utils/toTransferablePolygonBatchedFeatureLike.ts
2929
- function La(e) {
2936
+ function Ia(e) {
2930
2937
  let t = new c(e.crs, e.length);
2931
2938
  return t.setOuterRing(e.outer_ring.length, (t) => {
2932
2939
  t.set(e.outer_ring);
@@ -2950,27 +2957,27 @@ function La(e) {
2950
2957
  }
2951
2958
  //#endregion
2952
2959
  //#region src/tasks/waitWasm.ts
2953
- var Ra;
2960
+ var La;
2954
2961
  async function Q() {
2955
- return Ra ??= e(), Ra;
2962
+ return La ??= e(), La;
2956
2963
  }
2957
- async function za() {
2958
- if (!Ra) return 0;
2959
- let { memory: e } = await Ra;
2964
+ async function Ra() {
2965
+ if (!La) return 0;
2966
+ let { memory: e } = await La;
2960
2967
  return e.buffer.byteLength;
2961
2968
  }
2962
2969
  //#endregion
2963
2970
  //#region src/tasks/constructPolygonBatchedFeature.ts
2964
- async function Ba(e, t, n, r) {
2971
+ async function za(e, t, n, r) {
2965
2972
  await Q();
2966
- let i = p(La(e), Ia(t), n, r ? Fa(r) : void 0);
2973
+ let i = p(Ia(e), Fa(t), n, r ? Pa(r) : void 0);
2967
2974
  if (!i) return;
2968
- let { result: a, transfers: o } = ja(i);
2975
+ let { result: a, transfers: o } = Aa(i);
2969
2976
  return i.free(), $(a, o);
2970
2977
  }
2971
2978
  //#endregion
2972
2979
  //#region src/helpers/transferConstructedPolylineGeometry.ts
2973
- function Va(e) {
2980
+ function Ba(e) {
2974
2981
  let t = new we(e);
2975
2982
  return {
2976
2983
  result: t,
@@ -2995,12 +3002,12 @@ function Va(e) {
2995
3002
  }
2996
3003
  //#endregion
2997
3004
  //#region src/utils/toPolylineMaterialLike.ts
2998
- function Ha(e) {
3005
+ function Va(e) {
2999
3006
  return new a(e.show, e.castShadow, e.receiveShadow, e.color, e.clampToGround, e.tiled, e.height, e.width, e.maxWidth, e.__internal__);
3000
3007
  }
3001
3008
  //#endregion
3002
3009
  //#region src/utils/toTransferablePolylineBatchedFeatureLike.ts
3003
- function Ua(e) {
3010
+ function Ha(e) {
3004
3011
  let t = new l(e.crs, e.length);
3005
3012
  return t.setPoints(e.points.length, (t) => {
3006
3013
  t.set(e.points);
@@ -3014,16 +3021,16 @@ function Ua(e) {
3014
3021
  }
3015
3022
  //#endregion
3016
3023
  //#region src/tasks/constructPolylineBatchedFeature.ts
3017
- async function Wa(e, t, n) {
3024
+ async function Ua(e, t, n) {
3018
3025
  await Q();
3019
- let r = m(Ua(e), Ha(t), n);
3026
+ let r = m(Ha(e), Va(t), n);
3020
3027
  if (!r) return;
3021
- let { result: i, transfers: a } = Va(r);
3028
+ let { result: i, transfers: a } = Ba(r);
3022
3029
  return r.free(), $(i, a);
3023
3030
  }
3024
3031
  //#endregion
3025
3032
  //#region src/helpers/transferReturnedConstructedTerrainMesh.ts
3026
- function Ga(e) {
3033
+ function Wa(e) {
3027
3034
  let t = new xe(e), n = [
3028
3035
  t.vertices.buffer,
3029
3036
  t.uvs.buffer,
@@ -3037,26 +3044,26 @@ function Ga(e) {
3037
3044
  }
3038
3045
  //#endregion
3039
3046
  //#region src/tasks/constructQuantizedMeshTerrainMesh.ts
3040
- async function Ka(e, t, n, r, i, a) {
3047
+ async function Ga(e, t, n, r, i, a) {
3041
3048
  await Q();
3042
- let o = h(e, Z(t), n, r, i, a), { result: s, transfers: c } = Ga(o);
3049
+ let o = h(e, Z(t), n, r, i, a), { result: s, transfers: c } = Wa(o);
3043
3050
  return o.free(), $({ result: s }, [...c]);
3044
3051
  }
3045
3052
  //#endregion
3046
3053
  //#region src/utils/toTransferableRasterDEMDataLike.ts
3047
- function qa(e) {
3054
+ function Ka(e) {
3048
3055
  return new u(new n(e.decoder.r_scaler, e.decoder.g_scaler, e.decoder.b_scaler, e.decoder.offset, e.decoder.max_offset, e.decoder.min_offset, e.decoder.boundary, e.decoder.epsilon));
3049
3056
  }
3050
3057
  //#endregion
3051
3058
  //#region src/tasks/constructTerrainMesh.ts
3052
- async function Ja(e, t, n, r, i, a) {
3059
+ async function qa(e, t, n, r, i, a) {
3053
3060
  await Q();
3054
- let o = r + 1, c = s.fromSize(o), l = g(e, Z(t), qa(n), c, i, a), { result: u, transfers: d } = Ga(l);
3061
+ let o = r + 1, c = s.fromSize(o), l = g(e, Z(t), Ka(n), c, i, a), { result: u, transfers: d } = Wa(l);
3055
3062
  return l.free(), $({ result: u }, [...d]);
3056
3063
  }
3057
3064
  //#endregion
3058
3065
  //#region src/tasks/getImageDataFromBlob.ts
3059
- async function Ya(e) {
3066
+ async function Ja(e) {
3060
3067
  let t = await createImageBitmap(e);
3061
3068
  try {
3062
3069
  let e = new OffscreenCanvas(t.width, t.height).getContext("2d");
@@ -3070,7 +3077,7 @@ async function Ya(e) {
3070
3077
  }
3071
3078
  //#endregion
3072
3079
  //#region src/tasks/getImageDataFromImageBitmap.ts
3073
- async function Xa(e, t) {
3080
+ async function Ya(e, t) {
3074
3081
  try {
3075
3082
  let n = t.getContext("2d");
3076
3083
  if (n === null) throw Error("failed to get context of canvas");
@@ -3081,9 +3088,9 @@ async function Xa(e, t) {
3081
3088
  }
3082
3089
  //#endregion
3083
3090
  //#region src/tasks/parseMvtTile.ts
3084
- async function Za(e, t, n, r, i, a, o) {
3091
+ async function Xa(e, t, n, r, i, a, o) {
3085
3092
  await Q();
3086
- let s = _(e, t, n, r, i ? Fa(i) : void 0, a, o), c, l, u, d, f;
3093
+ let s = _(e, t, n, r, i ? Pa(i) : void 0, a, o), c, l, u, d, f;
3087
3094
  try {
3088
3095
  c = s.f64_stream(), l = s.f32_stream(), u = s.u32_stream(), d = s.u8_stream(), f = s.meta();
3089
3096
  } finally {
@@ -3104,42 +3111,42 @@ async function Za(e, t, n, r, i, a, o) {
3104
3111
  }
3105
3112
  //#endregion
3106
3113
  //#region src/tasks/upsampleQuantizedMeshTerrainMesh.ts
3107
- async function Qa(e, t, n, r, i, a, o) {
3114
+ async function Za(e, t, n, r, i, a, o) {
3108
3115
  await Q();
3109
- let s = v(Z(e), Z(t), Pa(n), r, i, a, o), { result: c, transfers: l } = Ga(s);
3116
+ let s = v(Z(e), Z(t), Na(n), r, i, a, o), { result: c, transfers: l } = Wa(s);
3110
3117
  return s.free(), $(c, l);
3111
3118
  }
3112
3119
  //#endregion
3113
3120
  //#region src/tasks/upsampleTerrainMesh.ts
3114
- async function $a(e, t, n, r, i, a, o) {
3121
+ async function Qa(e, t, n, r, i, a, o) {
3115
3122
  await Q();
3116
- let s = y(Z(e), Z(t), qa(n), Pa(r), i, a, o), { result: c, transfers: l } = Ga(s);
3123
+ let s = y(Z(e), Z(t), Ka(n), Na(r), i, a, o), { result: c, transfers: l } = Wa(s);
3117
3124
  return s.free(), $(c, l);
3118
3125
  }
3119
3126
  //#endregion
3120
3127
  //#region src/tasks/index.ts
3121
- async function eo() {
3128
+ async function $a() {
3122
3129
  await Q();
3123
3130
  }
3124
- var to = {
3125
- constructTerrainMesh: Ja,
3126
- constructQuantizedMeshTerrainMesh: Ka,
3127
- upsampleTerrainMesh: $a,
3128
- upsampleQuantizedMeshTerrainMesh: Qa,
3129
- getImageDataFromImageBitmap: Xa,
3130
- getImageDataFromBlob: Ya,
3131
- constructPolygonBatchedFeature: Ba,
3132
- constructPolylineBatchedFeature: Wa,
3133
- parseMvtTile: Za,
3134
- warmUp: eo,
3135
- getWasmMemoryUsage: za
3136
- }, $ = (e, t) => new me.Transfer(e, t), no = !1, ro = (...e) => (no ||= (me.worker(to), io(), !0), me.worker(...e));
3137
- function io() {
3138
- to.warmUp.worker?.addAbortListener(async () => {});
3131
+ var eo = {
3132
+ constructTerrainMesh: qa,
3133
+ constructQuantizedMeshTerrainMesh: Ga,
3134
+ upsampleTerrainMesh: Qa,
3135
+ upsampleQuantizedMeshTerrainMesh: Za,
3136
+ getImageDataFromImageBitmap: Ya,
3137
+ getImageDataFromBlob: Ja,
3138
+ constructPolygonBatchedFeature: za,
3139
+ constructPolylineBatchedFeature: Ua,
3140
+ parseMvtTile: Xa,
3141
+ warmUp: $a,
3142
+ getWasmMemoryUsage: Ra
3143
+ }, $ = (e, t) => new me.Transfer(e, t), to = !1, no = (...e) => (to ||= (me.worker(eo), ro(), !0), me.worker(...e));
3144
+ function ro() {
3145
+ eo.warmUp.worker?.addAbortListener(async () => {});
3139
3146
  }
3140
3147
  //#endregion
3141
3148
  //#region src/pool.ts
3142
- var { initializeWorkerPool: ao, terminateWorkerPool: oo, warmUpWorkerPool: so, worker: co, workerPoolStats: lo, workerPoolHeapStats: uo, probeWorkerPoolHeap: fo } = (() => {
3149
+ var { initializeWorkerPool: io, terminateWorkerPool: ao, warmUpWorkerPool: oo, worker: so, workerPoolStats: co, workerPoolHeapStats: lo, probeWorkerPoolHeap: uo } = (() => {
3143
3150
  let e;
3144
3151
  return {
3145
3152
  initializeWorkerPool: (t, n, r) => {
@@ -3161,12 +3168,12 @@ var { initializeWorkerPool: ao, terminateWorkerPool: oo, warmUpWorkerPool: so, w
3161
3168
  workerPoolHeapStats: () => e?.pool.heapStats(),
3162
3169
  probeWorkerPoolHeap: () => e?.pool.probeHeap()
3163
3170
  };
3164
- })(), po = () => {
3165
- let { pool: e, manager: t } = co();
3171
+ })(), fo = () => {
3172
+ let { pool: e, manager: t } = so();
3166
3173
  return t.canIncrement() && e.canAcceptTasks();
3167
3174
  };
3168
- function mo(e, t, n) {
3169
- let { pool: r, manager: i } = co();
3175
+ function po(e, t, n) {
3176
+ let { pool: r, manager: i } = so();
3170
3177
  i.increment();
3171
3178
  try {
3172
3179
  return r.exec(e, t, n).then((e) => (i.decrement(), e)).catch((e) => {
@@ -3178,7 +3185,7 @@ function mo(e, t, n) {
3178
3185
  }
3179
3186
  //#endregion
3180
3187
  //#region src/manager.ts
3181
- var ho = (e) => {
3188
+ var mo = (e) => {
3182
3189
  let t = 0, n = () => t !== e, r = () => t !== 0;
3183
3190
  return {
3184
3191
  total: e,
@@ -3198,4 +3205,4 @@ var ho = (e) => {
3198
3205
  };
3199
3206
  };
3200
3207
  //#endregion
3201
- export { po as canWorkerProcessImmediately, ho as createConcurrencyManager, ao as initializeWorkerPool, fo as probeWorkerPoolHeap, mo as queueTask, ro as registerTasks, oo as terminateWorkerPool, $ as transfer, so as warmUpWorkerPool, uo as workerPoolHeapStats, lo as workerPoolStats };
3208
+ export { fo as canWorkerProcessImmediately, mo as createConcurrencyManager, io as initializeWorkerPool, uo as probeWorkerPoolHeap, po as queueTask, no as registerTasks, ao as terminateWorkerPool, $ as transfer, oo as warmUpWorkerPool, lo as workerPoolHeapStats, co as workerPoolStats };
@@ -1,6 +1,6 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@navaramap/engine"),require("@navaramap/engine-worker")):typeof define==`function`&&define.amd?define([`exports`,`@navaramap/engine`,`@navaramap/engine-worker`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.NavaraWorker={},e._navaramap_engine,e._navaramap_engine_worker))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e));n=d(n,1);var f=`Invariant failed`;function p(e,t){if(!e)throw Error(f)}var m=l(((e,t)=>{t.exports={}})),h=l(((e,t)=>{var n=function(e){return e!==void 0&&e.versions!=null&&e.versions.node!=null&&e+``==`[object process]`};t.exports.isNode=n,t.exports.platform=typeof process<`u`&&n(process)?`node`:`browser`;var r=t.exports.platform===`node`&&m();t.exports.isMainThread=t.exports.platform===`node`?(!r||r.isMainThread)&&!process.connected:typeof Window<`u`,t.exports.cpus=t.exports.platform===`browser`?self.navigator.hardwareConcurrency:m().cpus().length})),g=l((e=>{function t(e,a){var o=this;if(!(this instanceof t))throw SyntaxError(`Constructor must be called with the new operator`);if(typeof e!=`function`)throw SyntaxError(`Function parameter handler(resolve, reject) missing`);var s=[],c=[];this.resolved=!1,this.rejected=!1,this.pending=!0,this[Symbol.toStringTag]=`Promise`;var l=function(e,t){s.push(e),c.push(t)};this.then=function(e,r){return new t(function(t,i){var a=e?n(e,t,i):t,o=r?n(r,t,i):i;l(a,o)},o)};var u=function(e){return o.resolved=!0,o.rejected=!1,o.pending=!1,s.forEach(function(t){t(e)}),l=function(t,n){t(e)},u=d=function(){},o},d=function(e){return o.resolved=!1,o.rejected=!0,o.pending=!1,c.forEach(function(t){t(e)}),l=function(t,n){n(e)},u=d=function(){},o};this.cancel=function(){return a?a.cancel():d(new r),o},this.timeout=function(e){if(a)a.timeout(e);else{var t=setTimeout(function(){d(new i(`Promise timed out after `+e+` ms`))},e);o.always(function(){clearTimeout(t)})}return o},e(function(e){u(e)},function(e){d(e)})}function n(e,t,n){return function(r){try{var i=e(r);i&&typeof i.then==`function`&&typeof i.catch==`function`?i.then(t,n):t(i)}catch(e){n(e)}}}t.prototype.catch=function(e){return this.then(null,e)},t.prototype.always=function(e){return this.then(e,e)},t.prototype.finally=function(e){let n=this,r=function(){return new t(e=>e()).then(e).then(()=>n)};return this.then(r,r)},t.all=function(e){return new t(function(t,n){var r=e.length,i=[];r?e.forEach(function(e,a){e.then(function(e){i[a]=e,r--,r==0&&t(i)},function(e){r=0,n(e)})}):t(i)})},t.defer=function(){var e={};return e.promise=new t(function(t,n){e.resolve=t,e.reject=n}),e};function r(e){this.message=e||`promise cancelled`,this.stack=Error().stack}r.prototype=Error(),r.prototype.constructor=Error,r.prototype.name=`CancellationError`,t.CancellationError=r;function i(e){this.message=e||`timeout exceeded`,this.stack=Error().stack}i.prototype=Error(),i.prototype.constructor=Error,i.prototype.name=`TimeoutError`,t.TimeoutError=i,e.Promise=t})),_=l((e=>{e.validateOptions=function(e,t,n){if(e){var r=e?Object.keys(e):[],i=r.find(e=>!t.includes(e));if(i)throw Error(`Object "`+n+`" contains an unknown option "`+i+`"`);var a=t.find(e=>Object.prototype[e]&&!r.includes(e));if(a)throw Error(`Object "`+n+`" contains an inherited option "`+a+`" which is not defined in the object itself but in its prototype. Only plain objects are allowed. Please remove the option from the prototype or override it with a value "undefined".`);return e}},e.workerOptsNames=[`credentials`,`name`,`type`],e.forkOptsNames=[`cwd`,`detached`,`env`,`execPath`,`execArgv`,`gid`,`serialization`,`signal`,`killSignal`,`silent`,`stdio`,`uid`,`windowsVerbatimArguments`,`timeout`],e.workerThreadOptsNames=[`argv`,`env`,`eval`,`execArgv`,`stdin`,`stdout`,`stderr`,`workerData`,`trackUnmanagedFds`,`transferList`,`resourceLimits`,`name`]})),v=l(((e,t)=>{t.exports=`!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).worker=n()}(this,function(){"use strict";function e(n){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(n)}function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t={};var r=function(e,n){this.message=e,this.transfer=n},o={};function i(e,n){var t=this;if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if("function"!=typeof e)throw new SyntaxError("Function parameter handler(resolve, reject) missing");var r=[],o=[];this.resolved=!1,this.rejected=!1,this.pending=!0,this[Symbol.toStringTag]="Promise";var a=function(e,n){r.push(e),o.push(n)};this.then=function(e,n){return new i(function(t,r){var o=e?s(e,t,r):t,i=n?s(n,t,r):r;a(o,i)},t)};var f=function(e){return t.resolved=!0,t.rejected=!1,t.pending=!1,r.forEach(function(n){n(e)}),a=function(n,t){n(e)},f=d=function(){},t},d=function(e){return t.resolved=!1,t.rejected=!0,t.pending=!1,o.forEach(function(n){n(e)}),a=function(n,t){t(e)},f=d=function(){},t};this.cancel=function(){return n?n.cancel():d(new u),t},this.timeout=function(e){if(n)n.timeout(e);else{var r=setTimeout(function(){d(new c("Promise timed out after "+e+" ms"))},e);t.always(function(){clearTimeout(r)})}return t},e(function(e){f(e)},function(e){d(e)})}function s(e,n,t){return function(r){try{var o=e(r);o&&"function"==typeof o.then&&"function"==typeof o.catch?o.then(n,t):n(o)}catch(e){t(e)}}}function u(e){this.message=e||"promise cancelled",this.stack=(new Error).stack}function c(e){this.message=e||"timeout exceeded",this.stack=(new Error).stack}return i.prototype.catch=function(e){return this.then(null,e)},i.prototype.always=function(e){return this.then(e,e)},i.prototype.finally=function(e){var n=this,t=function(){return new i(function(e){return e()}).then(e).then(function(){return n})};return this.then(t,t)},i.all=function(e){return new i(function(n,t){var r=e.length,o=[];r?e.forEach(function(e,i){e.then(function(e){o[i]=e,0==--r&&n(o)},function(e){r=0,t(e)})}):n(o)})},i.defer=function(){var e={};return e.promise=new i(function(n,t){e.resolve=n,e.reject=t}),e},u.prototype=new Error,u.prototype.constructor=Error,u.prototype.name="CancellationError",i.CancellationError=u,c.prototype=new Error,c.prototype.constructor=Error,c.prototype.name="TimeoutError",i.TimeoutError=c,o.Promise=i,function(n){var t=r,i=o.Promise,s="__workerpool-cleanup__",u={exit:function(){}},c={addAbortListener:function(e){u.abortListeners.push(e)},emit:u.emit};if("undefined"!=typeof self&&"function"==typeof postMessage&&"function"==typeof addEventListener)u.on=function(e,n){addEventListener(e,function(e){n(e.data)})},u.send=function(e,n){n?postMessage(e,n):postMessage(e)};else{if("undefined"==typeof process)throw new Error("Script must be executed as a worker");var a;try{a=require("worker_threads")}catch(n){if("object"!==e(n)||null===n||"MODULE_NOT_FOUND"!==n.code)throw n}if(a&&null!==a.parentPort){var f=a.parentPort;u.send=f.postMessage.bind(f),u.on=f.on.bind(f),u.exit=process.exit.bind(process)}else u.on=process.on.bind(process),u.send=function(e){process.send(e)},u.on("disconnect",function(){process.exit(1)}),u.exit=process.exit.bind(process)}function d(e){return e&&e.toJSON?JSON.parse(JSON.stringify(e)):JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)))}function l(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}u.methods={},u.methods.run=function(e,n){var t=new Function("return ("+e+").apply(this, arguments);");return t.worker=c,t.apply(t,n)},u.methods.methods=function(){return Object.keys(u.methods)},u.terminationHandler=void 0,u.abortListenerTimeout=1e3,u.abortListeners=[],u.terminateAndExit=function(e){var n=function(){u.exit(e)};if(!u.terminationHandler)return n();var t=u.terminationHandler(e);return l(t)?(t.then(n,n),t):(n(),new i(function(e,n){n(new Error("Worker terminating"))}))},u.cleanup=function(e){if(!u.abortListeners.length)return u.send({id:e,method:s,error:d(new Error("Worker terminating"))}),new i(function(e){e()});var n,t=u.abortListeners.map(function(e){return e()}),r=new i(function(e,t){n=setTimeout(function(){t(new Error("Timeout occurred waiting for abort handler, killing worker"))},u.abortListenerTimeout)}),o=i.all(t).then(function(){clearTimeout(n),u.abortListeners.length&&(u.abortListeners=[])},function(){clearTimeout(n),u.exit()});return new i(function(e,n){o.then(e,n),r.then(e,n)}).then(function(){u.send({id:e,method:s,error:null})},function(n){u.send({id:e,method:s,error:n?d(n):null})})};var p=null;u.on("message",function(e){if("__workerpool-terminate__"===e)return u.terminateAndExit(0);if(e.method===s)return u.cleanup(e.id);try{var n=u.methods[e.method];if(!n)throw new Error('Unknown method "'+e.method+'"');p=e.id;var r=n.apply(n,e.params);l(r)?r.then(function(n){n instanceof t?u.send({id:e.id,result:n.message,error:null},n.transfer):u.send({id:e.id,result:n,error:null}),p=null}).catch(function(n){u.send({id:e.id,result:null,error:d(n)}),p=null}):(r instanceof t?u.send({id:e.id,result:r.message,error:null},r.transfer):u.send({id:e.id,result:r,error:null}),p=null)}catch(n){u.send({id:e.id,result:null,error:d(n)})}}),u.register=function(e,n){if(e)for(var t in e)e.hasOwnProperty(t)&&(u.methods[t]=e[t],u.methods[t].worker=c);n&&(u.terminationHandler=n.onTerminate,u.abortListenerTimeout=n.abortListenerTimeout||1e3),u.send("ready")},u.emit=function(e){if(p){if(e instanceof t)return void u.send({id:p,isEvent:!0,payload:e.message},e.transfer);u.send({id:p,isEvent:!0,payload:e})}},n.add=u.register,n.emit=u.emit}(t),n(t)});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@navaramap/engine"),require("@navaramap/engine-worker")):typeof define==`function`&&define.amd?define([`exports`,`@navaramap/engine`,`@navaramap/engine-worker`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.NavaraWorker={},e._navaramap_engine,e._navaramap_engine_worker))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule||!c.call(e,`default`)?i(n,`default`,{value:e,enumerable:!0}):n,e));n=d(n,1);var f=`Invariant failed`;function p(e,t){if(!e)throw Error(f)}var m=l(((e,t)=>{t.exports={}})),h=l(((e,t)=>{var n=function(e){return e!==void 0&&e.versions!=null&&e.versions.node!=null&&e+``==`[object process]`};t.exports.isNode=n,t.exports.platform=typeof process<`u`&&n(process)?`node`:`browser`;var r=t.exports.platform===`node`&&m();t.exports.isMainThread=t.exports.platform===`node`?(!r||r.isMainThread)&&!process.connected:typeof Window<`u`,t.exports.cpus=t.exports.platform===`browser`?self.navigator.hardwareConcurrency:m().cpus().length})),g=l((e=>{function t(e,a){var o=this;if(!(this instanceof t))throw SyntaxError(`Constructor must be called with the new operator`);if(typeof e!=`function`)throw SyntaxError(`Function parameter handler(resolve, reject) missing`);var s=[],c=[];this.resolved=!1,this.rejected=!1,this.pending=!0,this[Symbol.toStringTag]=`Promise`;var l=function(e,t){s.push(e),c.push(t)};this.then=function(e,r){return new t(function(t,i){var a=e?n(e,t,i):t,o=r?n(r,t,i):i;l(a,o)},o)};var u=function(e){return o.resolved=!0,o.rejected=!1,o.pending=!1,s.forEach(function(t){t(e)}),l=function(t,n){t(e)},u=d=function(){},o},d=function(e){return o.resolved=!1,o.rejected=!0,o.pending=!1,c.forEach(function(t){t(e)}),l=function(t,n){n(e)},u=d=function(){},o};this.cancel=function(){return a?a.cancel():d(new r),o},this.timeout=function(e){if(a)a.timeout(e);else{var t=setTimeout(function(){d(new i(`Promise timed out after `+e+` ms`))},e);o.always(function(){clearTimeout(t)})}return o},e(function(e){u(e)},function(e){d(e)})}function n(e,t,n){return function(r){try{var i=e(r);i&&typeof i.then==`function`&&typeof i.catch==`function`?i.then(t,n):t(i)}catch(e){n(e)}}}t.prototype.catch=function(e){return this.then(null,e)},t.prototype.always=function(e){return this.then(e,e)},t.prototype.finally=function(e){let n=this,r=function(){return new t(e=>e()).then(e).then(()=>n)};return this.then(r,r)},t.all=function(e){return new t(function(t,n){var r=e.length,i=[];r?e.forEach(function(e,a){e.then(function(e){i[a]=e,r--,r==0&&t(i)},function(e){r=0,n(e)})}):t(i)})},t.defer=function(){var e={};return e.promise=new t(function(t,n){e.resolve=t,e.reject=n}),e};function r(e){this.message=e||`promise cancelled`,this.stack=Error().stack}r.prototype=Error(),r.prototype.constructor=Error,r.prototype.name=`CancellationError`,t.CancellationError=r;function i(e){this.message=e||`timeout exceeded`,this.stack=Error().stack}i.prototype=Error(),i.prototype.constructor=Error,i.prototype.name=`TimeoutError`,t.TimeoutError=i,e.Promise=t})),_=l((e=>{e.validateOptions=function(e,t,n){if(e){var r=e?Object.keys(e):[],i=r.find(e=>!t.includes(e));if(i)throw Error(`Object "`+n+`" contains an unknown option "`+i+`"`);var a=t.find(e=>Object.prototype[e]&&!r.includes(e));if(a)throw Error(`Object "`+n+`" contains an inherited option "`+a+`" which is not defined in the object itself but in its prototype. Only plain objects are allowed. Please remove the option from the prototype or override it with a value "undefined".`);return e}},e.workerOptsNames=[`credentials`,`name`,`type`],e.forkOptsNames=[`cwd`,`detached`,`env`,`execPath`,`execArgv`,`gid`,`serialization`,`signal`,`killSignal`,`silent`,`stdio`,`uid`,`windowsVerbatimArguments`,`timeout`],e.workerThreadOptsNames=[`argv`,`env`,`eval`,`execArgv`,`stdin`,`stdout`,`stderr`,`workerData`,`trackUnmanagedFds`,`transferList`,`resourceLimits`,`name`]})),v=l(((e,t)=>{t.exports=`!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).worker=n()}(this,function(){"use strict";function e(n){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(n)}function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t={};var r=function(e,n){this.message=e,this.transfer=n},o={};function i(e,n){var t=this;if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if("function"!=typeof e)throw new SyntaxError("Function parameter handler(resolve, reject) missing");var r=[],o=[];this.resolved=!1,this.rejected=!1,this.pending=!0,this[Symbol.toStringTag]="Promise";var a=function(e,n){r.push(e),o.push(n)};this.then=function(e,n){return new i(function(t,r){var o=e?s(e,t,r):t,i=n?s(n,t,r):r;a(o,i)},t)};var f=function(e){return t.resolved=!0,t.rejected=!1,t.pending=!1,r.forEach(function(n){n(e)}),a=function(n,t){n(e)},f=d=function(){},t},d=function(e){return t.resolved=!1,t.rejected=!0,t.pending=!1,o.forEach(function(n){n(e)}),a=function(n,t){t(e)},f=d=function(){},t};this.cancel=function(){return n?n.cancel():d(new u),t},this.timeout=function(e){if(n)n.timeout(e);else{var r=setTimeout(function(){d(new c("Promise timed out after "+e+" ms"))},e);t.always(function(){clearTimeout(r)})}return t},e(function(e){f(e)},function(e){d(e)})}function s(e,n,t){return function(r){try{var o=e(r);o&&"function"==typeof o.then&&"function"==typeof o.catch?o.then(n,t):n(o)}catch(e){t(e)}}}function u(e){this.message=e||"promise cancelled",this.stack=(new Error).stack}function c(e){this.message=e||"timeout exceeded",this.stack=(new Error).stack}return i.prototype.catch=function(e){return this.then(null,e)},i.prototype.always=function(e){return this.then(e,e)},i.prototype.finally=function(e){var n=this,t=function(){return new i(function(e){return e()}).then(e).then(function(){return n})};return this.then(t,t)},i.all=function(e){return new i(function(n,t){var r=e.length,o=[];r?e.forEach(function(e,i){e.then(function(e){o[i]=e,0==--r&&n(o)},function(e){r=0,t(e)})}):n(o)})},i.defer=function(){var e={};return e.promise=new i(function(n,t){e.resolve=n,e.reject=t}),e},u.prototype=new Error,u.prototype.constructor=Error,u.prototype.name="CancellationError",i.CancellationError=u,c.prototype=new Error,c.prototype.constructor=Error,c.prototype.name="TimeoutError",i.TimeoutError=c,o.Promise=i,function(n){var t=r,i=o.Promise,s="__workerpool-cleanup__",u={exit:function(){}},c={addAbortListener:function(e){u.abortListeners.push(e)},emit:u.emit};if("undefined"!=typeof self&&"function"==typeof postMessage&&"function"==typeof addEventListener)u.on=function(e,n){addEventListener(e,function(e){n(e.data)})},u.send=function(e,n){n?postMessage(e,n):postMessage(e)};else{if("undefined"==typeof process)throw new Error("Script must be executed as a worker");var a;try{a=require("worker_threads")}catch(n){if("object"!==e(n)||null===n||"MODULE_NOT_FOUND"!==n.code)throw n}if(a&&null!==a.parentPort){var f=a.parentPort;u.send=f.postMessage.bind(f),u.on=f.on.bind(f),u.exit=process.exit.bind(process)}else u.on=process.on.bind(process),u.send=function(e){process.send(e)},u.on("disconnect",function(){process.exit(1)}),u.exit=process.exit.bind(process)}function d(e){return e&&e.toJSON?JSON.parse(JSON.stringify(e)):JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)))}function l(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}u.methods={},u.methods.run=function(e,n){var t=new Function("return ("+e+").apply(this, arguments);");return t.worker=c,t.apply(t,n)},u.methods.methods=function(){return Object.keys(u.methods)},u.terminationHandler=void 0,u.abortListenerTimeout=1e3,u.abortListeners=[],u.terminateAndExit=function(e){var n=function(){u.exit(e)};if(!u.terminationHandler)return n();var t=u.terminationHandler(e);return l(t)?(t.then(n,n),t):(n(),new i(function(e,n){n(new Error("Worker terminating"))}))},u.cleanup=function(e){if(!u.abortListeners.length)return u.send({id:e,method:s,error:d(new Error("Worker terminating"))}),new i(function(e){e()});var n,t=u.abortListeners.map(function(e){return e()}),r=new i(function(e,t){n=setTimeout(function(){t(new Error("Timeout occurred waiting for abort handler, killing worker"))},u.abortListenerTimeout)}),o=i.all(t).then(function(){clearTimeout(n),u.abortListeners.length&&(u.abortListeners=[])},function(){clearTimeout(n),u.exit()});return new i(function(e,n){o.then(e,n),r.then(e,n)}).then(function(){u.send({id:e,method:s,error:null})},function(n){u.send({id:e,method:s,error:n?d(n):null})})};var p=null;u.on("message",function(e){if("__workerpool-terminate__"===e)return u.terminateAndExit(0);if(e.method===s)return u.cleanup(e.id);try{var n=u.methods[e.method];if(!n)throw new Error('Unknown method "'+e.method+'"');p=e.id;var r=n.apply(n,e.params);l(r)?r.then(function(n){n instanceof t?u.send({id:e.id,result:n.message,error:null},n.transfer):u.send({id:e.id,result:n,error:null}),p=null}).catch(function(n){u.send({id:e.id,result:null,error:d(n)}),p=null}):(r instanceof t?u.send({id:e.id,result:r.message,error:null},r.transfer):u.send({id:e.id,result:r,error:null}),p=null)}catch(n){u.send({id:e.id,result:null,error:d(n)})}}),u.register=function(e,n){if(e)for(var t in e)e.hasOwnProperty(t)&&(u.methods[t]=e[t],u.methods[t].worker=c);n&&(u.terminationHandler=n.onTerminate,u.abortListenerTimeout=n.abortListenerTimeout||1e3),u.send("ready")},u.emit=function(e){if(p){if(e instanceof t)return void u.send({id:p,isEvent:!0,payload:e.message},e.transfer);u.send({id:p,isEvent:!0,payload:e})}},n.add=u.register,n.emit=u.emit}(t),n(t)});
2
2
  //# sourceMappingURL=worker.min.js.map
3
- `})),y=l(((e,t)=>{var{Promise:n}=g(),r=h(),{validateOptions:i,forkOptsNames:a,workerThreadOptsNames:o,workerOptsNames:s}=_(),c=`__workerpool-terminate__`,l=`__workerpool-cleanup__`;function u(){var e=f();if(!e)throw Error(`WorkerPool: workerType = 'thread' is not supported, Node >= 11.7.0 required`);return e}function d(){if(typeof Worker!=`function`&&(typeof Worker!=`object`||typeof Worker.prototype.constructor!=`function`))throw Error(`WorkerPool: Web Workers not supported`)}function f(){try{return m()}catch(e){if(typeof e==`object`&&e&&e.code===`MODULE_NOT_FOUND`)return null;throw e}}function p(){if(r.platform===`browser`){if(typeof Blob>`u`)throw Error(`Blob not supported by the browser`);if(!window.URL||typeof window.URL.createObjectURL!=`function`)throw Error(`URL.createObjectURL not supported by the browser`);var e=new Blob([v()],{type:`text/javascript`});return window.URL.createObjectURL(e)}else return __dirname+`/worker.js`}function y(e,t){if(t.workerType===`web`)return d(),b(e,t.workerOpts,Worker);if(t.workerType===`thread`)return n=u(),x(e,n,t);if(t.workerType===`process`||!t.workerType)return S(e,C(t),m());if(r.platform===`browser`)return d(),b(e,t.workerOpts,Worker);var n=f();return n?x(e,n,t):S(e,C(t),m())}function b(e,t,n){i(t,s,`workerOpts`);var r=new n(e,t);return r.isBrowserWorker=!0,r.on=function(e,t){this.addEventListener(e,function(e){t(e.data)})},r.send=function(e,t){this.postMessage(e,t)},r}function x(e,t,n){i(n?.workerThreadOpts,o,`workerThreadOpts`);var r=new t.Worker(e,{stdout:n?.emitStdStreams??!1,stderr:n?.emitStdStreams??!1,...n?.workerThreadOpts});return r.isWorkerThread=!0,r.send=function(e,t){this.postMessage(e,t)},r.kill=function(){return this.terminate(),!0},r.disconnect=function(){this.terminate()},n?.emitStdStreams&&(r.stdout.on(`data`,e=>r.emit(`stdout`,e)),r.stderr.on(`data`,e=>r.emit(`stderr`,e))),r}function S(e,t,n){i(t.forkOpts,a,`forkOpts`);var r=n.fork(e,t.forkArgs,t.forkOpts),o=r.send;return r.send=function(e){return o.call(r,e)},t.emitStdStreams&&(r.stdout.on(`data`,e=>r.emit(`stdout`,e)),r.stderr.on(`data`,e=>r.emit(`stderr`,e))),r.isChildProcess=!0,r}function C(e){e||={};var t=process.execArgv.join(` `),n=t.indexOf(`--inspect`)!==-1,r=t.indexOf(`--debug-brk`)!==-1,i=[];return n&&(i.push(`--inspect=`+e.debugPort),r&&i.push(`--debug-brk`)),process.execArgv.forEach(function(e){e.indexOf(`--max-old-space-size`)>-1&&i.push(e)}),Object.assign({},e,{forkArgs:e.forkArgs,forkOpts:Object.assign({},e.forkOpts,{execArgv:(e.forkOpts&&e.forkOpts.execArgv||[]).concat(i),stdio:e.emitStdStreams?`pipe`:void 0})})}function w(e){for(var t=Error(``),n=Object.keys(e),r=0;r<n.length;r++)t[n[r]]=e[n[r]];return t}function T(e,t){Object.values(e.processing).forEach(e=>e?.options?.on(t)),Object.values(e.tracking).forEach(e=>e?.options?.on(t))}function E(e,t){var n=this,r=t||{};this.script=e||p(),this.worker=y(this.script,r),this.debugPort=r.debugPort,this.forkOpts=r.forkOpts,this.forkArgs=r.forkArgs,this.workerOpts=r.workerOpts,this.workerThreadOpts=r.workerThreadOpts,this.workerTerminateTimeout=r.workerTerminateTimeout,e||(this.worker.ready=!0),this.requestQueue=[],this.worker.on(`stdout`,function(e){T(n,{stdout:e.toString()})}),this.worker.on(`stderr`,function(e){T(n,{stderr:e.toString()})}),this.worker.on(`message`,function(e){if(!n.terminated)if(typeof e==`string`&&e===`ready`)n.worker.ready=!0,a();else{var t=e.id,r=n.processing[t];if(r!==void 0)e.isEvent?r.options&&typeof r.options.on==`function`&&r.options.on(e.payload):(delete n.processing[t],n.terminating===!0&&n.terminate(),e.error?r.resolver.reject(w(e.error)):r.resolver.resolve(e.result));else{var r=n.tracking[t];r!==void 0&&e.isEvent&&r.options&&typeof r.options.on==`function`&&r.options.on(e.payload)}if(e.method===l){var i=n.tracking[e.id];i!==void 0&&(e.error?(clearTimeout(i.timeoutId),i.resolver.reject(w(e.error))):(n.tracking&&clearTimeout(i.timeoutId),i.resolver.reject(new ee(i.error)))),delete n.tracking[t]}}});function i(e){for(var t in n.terminated=!0,n.processing)n.processing[t]!==void 0&&n.processing[t].resolver.reject(e);n.processing=Object.create(null)}function a(){for(let e of n.requestQueue.splice(0))n.worker.send(e.message,e.transfer)}var o=this.worker;this.worker.on(`error`,function(e){i(new D(`Workerpool Worker error: `+(e&&e.message?e.message:String(e||`Unknown worker error`)),e))}),this.worker.on(`exit`,function(e,t){var r=`Workerpool Worker terminated Unexpectedly
3
+ `})),y=l(((e,t)=>{var{Promise:n}=g(),r=h(),{validateOptions:i,forkOptsNames:a,workerThreadOptsNames:o,workerOptsNames:s}=_(),c=`__workerpool-terminate__`,l=`__workerpool-cleanup__`;function u(){var e=f();if(!e)throw Error(`WorkerPool: workerType = 'thread' is not supported, Node >= 11.7.0 required`);return e}function d(){if(typeof Worker!=`function`&&(typeof Worker!=`object`||typeof Worker.prototype.constructor!=`function`))throw Error(`WorkerPool: Web Workers not supported`)}function f(){try{return m()}catch(e){if(typeof e==`object`&&e&&e.code===`MODULE_NOT_FOUND`)return null;throw e}}function p(){if(r.platform===`browser`){if(typeof Blob>`u`)throw Error(`Blob not supported by the browser`);if(!window.URL||typeof window.URL.createObjectURL!=`function`)throw Error(`URL.createObjectURL not supported by the browser`);var e=new Blob([v()],{type:`text/javascript`});return window.URL.createObjectURL(e)}return __dirname+`/worker.js`}function y(e,t){if(t.workerType===`web`)return d(),b(e,t.workerOpts,Worker);if(t.workerType===`thread`)return n=u(),x(e,n,t);if(t.workerType===`process`||!t.workerType)return S(e,C(t),m());if(r.platform===`browser`)return d(),b(e,t.workerOpts,Worker);var n=f();return n?x(e,n,t):S(e,C(t),m())}function b(e,t,n){i(t,s,`workerOpts`);var r=new n(e,t);return r.isBrowserWorker=!0,r.on=function(e,t){this.addEventListener(e,function(e){t(e.data)})},r.send=function(e,t){this.postMessage(e,t)},r}function x(e,t,n){i(n?.workerThreadOpts,o,`workerThreadOpts`);var r=new t.Worker(e,{stdout:n?.emitStdStreams??!1,stderr:n?.emitStdStreams??!1,...n?.workerThreadOpts});return r.isWorkerThread=!0,r.send=function(e,t){this.postMessage(e,t)},r.kill=function(){return this.terminate(),!0},r.disconnect=function(){this.terminate()},n?.emitStdStreams&&(r.stdout.on(`data`,e=>r.emit(`stdout`,e)),r.stderr.on(`data`,e=>r.emit(`stderr`,e))),r}function S(e,t,n){i(t.forkOpts,a,`forkOpts`);var r=n.fork(e,t.forkArgs,t.forkOpts),o=r.send;return r.send=function(e){return o.call(r,e)},t.emitStdStreams&&(r.stdout.on(`data`,e=>r.emit(`stdout`,e)),r.stderr.on(`data`,e=>r.emit(`stderr`,e))),r.isChildProcess=!0,r}function C(e){e||={};var t=process.execArgv.join(` `),n=t.indexOf(`--inspect`)!==-1,r=t.indexOf(`--debug-brk`)!==-1,i=[];return n&&(i.push(`--inspect=`+e.debugPort),r&&i.push(`--debug-brk`)),process.execArgv.forEach(function(e){e.indexOf(`--max-old-space-size`)>-1&&i.push(e)}),Object.assign({},e,{forkArgs:e.forkArgs,forkOpts:Object.assign({},e.forkOpts,{execArgv:(e.forkOpts&&e.forkOpts.execArgv||[]).concat(i),stdio:e.emitStdStreams?`pipe`:void 0})})}function w(e){for(var t=Error(``),n=Object.keys(e),r=0;r<n.length;r++)t[n[r]]=e[n[r]];return t}function T(e,t){Object.values(e.processing).forEach(e=>e?.options?.on(t)),Object.values(e.tracking).forEach(e=>e?.options?.on(t))}function E(e,t){var n=this,r=t||{};this.script=e||p(),this.worker=y(this.script,r),this.debugPort=r.debugPort,this.forkOpts=r.forkOpts,this.forkArgs=r.forkArgs,this.workerOpts=r.workerOpts,this.workerThreadOpts=r.workerThreadOpts,this.workerTerminateTimeout=r.workerTerminateTimeout,e||(this.worker.ready=!0),this.requestQueue=[],this.worker.on(`stdout`,function(e){T(n,{stdout:e.toString()})}),this.worker.on(`stderr`,function(e){T(n,{stderr:e.toString()})}),this.worker.on(`message`,function(e){if(!n.terminated){if(typeof e==`string`&&e===`ready`)n.worker.ready=!0,a();else{var t=e.id,r=n.processing[t];if(r!==void 0)e.isEvent?r.options&&typeof r.options.on==`function`&&r.options.on(e.payload):(delete n.processing[t],n.terminating===!0&&n.terminate(),e.error?r.resolver.reject(w(e.error)):r.resolver.resolve(e.result));else{var r=n.tracking[t];r!==void 0&&e.isEvent&&r.options&&typeof r.options.on==`function`&&r.options.on(e.payload)}if(e.method===l){var i=n.tracking[e.id];i!==void 0&&(e.error?(clearTimeout(i.timeoutId),i.resolver.reject(w(e.error))):(n.tracking&&clearTimeout(i.timeoutId),i.resolver.reject(new ee(i.error)))),delete n.tracking[t]}}}});function i(e){for(var t in n.terminated=!0,n.processing)n.processing[t]!==void 0&&n.processing[t].resolver.reject(e);n.processing=Object.create(null)}function a(){for(let e of n.requestQueue.splice(0))n.worker.send(e.message,e.transfer)}var o=this.worker;this.worker.on(`error`,function(e){i(new D(`Workerpool Worker error: `+(e&&e.message?e.message:String(e||`Unknown worker error`)),e))}),this.worker.on(`exit`,function(e,t){var r=`Workerpool Worker terminated Unexpectedly
4
4
  `;r+=" exitCode: `"+e+`\`
5
5
  `,r+=" signalCode: `"+t+`\`
6
6
  `,r+=" workerpool.script: `"+n.script+`\`
@@ -8,4 +8,4 @@
8
8
  `,r+=" spawnfile: `"+o.spawnfile+`\`
9
9
  `,r+=" stdout: `"+o.stdout+`\`
10
10
  `,r+=" stderr: `"+o.stderr+`\`
11
- `,i(new D(r))}),this.processing=Object.create(null),this.tracking=Object.create(null),this.terminating=!1,this.terminated=!1,this.cleaning=!1,this.terminationHandler=null,this.lastId=0}E.prototype.methods=function(){return this.exec(`methods`)},E.prototype.exec=function(e,t,r,i){r||=n.defer();var a=++this.lastId;this.processing[a]={id:a,resolver:r,options:i};var o={message:{id:a,method:e,params:t},transfer:i&&i.transfer};this.terminated?r.reject(new D(`Worker is terminated`)):this.worker.ready?this.worker.send(o.message,o.transfer):this.requestQueue.push(o);var s=this;return r.promise.catch(function(e){if(e instanceof n.CancellationError||e instanceof n.TimeoutError)return s.tracking[a]={id:a,resolver:n.defer(),options:i,error:e},delete s.processing[a],s.tracking[a].resolver.promise=s.tracking[a].resolver.promise.catch(function(e){if(delete s.tracking[a],e instanceof ee)throw e.error;return s.terminateAndNotify(!0).then(function(){throw e},function(e){throw e})}),s.worker.send({id:a,method:l}),s.tracking[a].timeoutId=setTimeout(function(){s.tracking[a].resolver.reject(e)},s.workerTerminateTimeout),s.tracking[a].resolver.promise;throw e})},E.prototype.busy=function(){return this.cleaning||Object.keys(this.processing).length>0||Object.keys(this.tracking).length>0},E.prototype.terminate=function(e,t){var n=this;if(e){for(var r in this.processing)this.processing[r]!==void 0&&this.processing[r].resolver.reject(Error(`Worker terminated`));this.processing=Object.create(null)}for(var i of Object.values(n.tracking))clearTimeout(i.timeoutId),i.resolver.reject(Error(`Worker Terminating`));if(n.tracking=Object.create(null),typeof t==`function`&&(this.terminationHandler=t),this.busy())this.terminating=!0;else{var a=function(e){if(n.terminated=!0,n.cleaning=!1,n.worker!=null&&n.worker.removeAllListeners&&n.worker.removeAllListeners(`message`),n.worker=null,n.terminating=!1,n.terminationHandler)n.terminationHandler(e,n);else if(e)throw e};if(this.worker)if(typeof this.worker.kill==`function`){if(this.worker.killed){a(Error(`worker already killed!`));return}var o=setTimeout(function(){n.worker&&n.worker.kill()},this.workerTerminateTimeout);this.worker.once(`exit`,function(){clearTimeout(o),n.worker&&(n.worker.killed=!0),a()}),this.worker.ready?this.worker.send(c):this.requestQueue.push({message:c}),this.cleaning=!0;return}else if(typeof this.worker.terminate==`function`)this.worker.terminate(),this.worker.killed=!0;else throw Error(`Failed to terminate worker`);a()}},E.prototype.terminateAndNotify=function(e,t){var r=n.defer();return t&&r.promise.timeout(t),this.terminate(e,function(e,t){e?r.reject(e):r.resolve(t)}),r.promise};function ee(e){this.error=e,this.stack=Error().stack}var D=class extends Error{constructor(e,t){super(e||`worker terminated`),this.cause=t}};t.exports=E,t.exports._tryRequireWorkerThreads=f,t.exports._setupProcessWorker=S,t.exports._setupBrowserWorker=b,t.exports._setupWorkerThreadWorker=x,t.exports.ensureWorkerThreads=u,t.exports.TerminateError=D})),b=l(((e,t)=>{function n(){this.tasks=[]}n.prototype.push=function(e){this.tasks.push(e)},n.prototype.pop=function(){return this.tasks.shift()},n.prototype.size=function(){return this.tasks.length},n.prototype.contains=function(e){return this.tasks.includes(e)},n.prototype.clear=function(){this.tasks.length=0};function r(){this.tasks=[]}r.prototype.push=function(e){this.tasks.push(e)},r.prototype.pop=function(){return this.tasks.pop()},r.prototype.size=function(){return this.tasks.length},r.prototype.contains=function(e){return this.tasks.includes(e)},r.prototype.clear=function(){this.tasks.length=0},t.exports={FIFOQueue:n,LIFOQueue:r}})),x=l(((e,t)=>{t.exports=n;function n(){this.ports=Object.create(null),this.length=0}n.prototype.nextAvailableStartingAt=function(e){for(;this.ports[e]===!0;)e++;if(e>=65535)throw Error(`WorkerPool debug port limit reached: `+e+`>= 65535`);return this.ports[e]=!0,this.length++,e},n.prototype.releasePort=function(e){delete this.ports[e],this.length--}})),S=l(((e,t)=>{var{Promise:n}=g(),r=y(),i=h(),{FIFOQueue:a,LIFOQueue:o}=b(),s=new(x());function c(e,t){typeof e==`string`?this.script=e||null:(this.script=null,t=e),this.workers=[],this.taskQueue=this._createQueue(t&&t.queueStrategy||`fifo`),t||={},this.forkArgs=Object.freeze(t.forkArgs||[]),this.forkOpts=Object.freeze(t.forkOpts||{}),this.workerOpts=Object.freeze(t.workerOpts||{}),this.workerThreadOpts=Object.freeze(t.workerThreadOpts||{}),this.debugPortStart=t.debugPortStart||43210,this.nodeWorker=t.nodeWorker,this.workerType=t.workerType||t.nodeWorker||`auto`,this.maxQueueSize=t.maxQueueSize||1/0,this.workerTerminateTimeout=t.workerTerminateTimeout||1e3,this.onCreateWorker=t.onCreateWorker||(()=>null),this.onTerminateWorker=t.onTerminateWorker||(()=>null),this.emitStdStreams=t.emitStdStreams||!1,t&&`maxWorkers`in t?(l(t.maxWorkers),this.maxWorkers=t.maxWorkers):this.maxWorkers=Math.max((i.cpus||4)-1,1),t&&`minWorkers`in t&&(t.minWorkers===`max`?this.minWorkers=this.maxWorkers:(u(t.minWorkers),this.minWorkers=t.minWorkers,this.maxWorkers=Math.max(this.minWorkers,this.maxWorkers)),this._ensureMinWorkers()),this._boundNext=this._next.bind(this),this.workerType===`thread`&&r.ensureWorkerThreads()}c.prototype.exec=function(e,t,r){if(t&&!Array.isArray(t))throw TypeError(`Array expected as argument "params"`);if(typeof e==`string`){var i=n.defer();if(this.taskQueue.size()>=this.maxQueueSize)throw Error(`Max queue size of `+this.maxQueueSize+` reached`);var a={method:e,params:t,resolver:i,timeout:null,options:r};this.taskQueue.push(a);var o=i.promise.timeout,s=this.taskQueue;return i.promise.timeout=function(e){return s.contains(a)?(a.timeout=e,i.promise):o.call(i.promise,e)},this._next(),i.promise}else if(typeof e==`function`)return this.exec(`run`,[String(e),t],r);else throw TypeError(`Function or string expected as argument "method"`)},c.prototype.proxy=function(){if(arguments.length>0)throw Error(`No arguments expected`);var e=this;return this.exec(`methods`).then(function(t){var n={};return t.forEach(function(t){n[t]=function(){return e.exec(t,Array.prototype.slice.call(arguments))}}),n})},c.prototype._next=function(){if(this.taskQueue.size()>0){var e=this._getWorker();if(e){var t=this,n=this.taskQueue.pop();if(n.resolver.promise.pending){var r=e.exec(n.method,n.params,n.resolver,n.options).then(t._boundNext).catch(function(){if(e.terminated)return t._removeWorker(e)}).then(function(){t._next()});typeof n.timeout==`number`&&r.timeout(n.timeout)}else t._next()}}},c.prototype._getWorker=function(){for(var e=this.workers,t=0;t<e.length;t++){var n=e[t];if(n.busy()===!1)return n}return e.length<this.maxWorkers?(n=this._createWorkerHandler(),e.push(n),n):null},c.prototype._removeWorker=function(e){var t=this;return s.releasePort(e.debugPort),this._removeWorkerFromList(e),this._ensureMinWorkers(),new n(function(n,r){e.terminate(!1,function(i){t.onTerminateWorker({forkArgs:e.forkArgs,forkOpts:e.forkOpts,workerThreadOpts:e.workerThreadOpts,script:e.script}),i?r(i):n(e)})})},c.prototype._removeWorkerFromList=function(e){var t=this.workers.indexOf(e);t!==-1&&this.workers.splice(t,1)},c.prototype.terminate=function(e,t){for(var r=this,i=this.taskQueue;i.size()>0;){var a=i.pop();if(a)a.resolver.reject(Error(`Pool terminated`));else break}i.clear();var o=function(e){s.releasePort(e.debugPort),this._removeWorkerFromList(e)}.bind(this),c=[];return this.workers.slice().forEach(function(n){var i=n.terminateAndNotify(e,t).then(o).always(function(){r.onTerminateWorker({forkArgs:n.forkArgs,forkOpts:n.forkOpts,workerThreadOpts:n.workerThreadOpts,script:n.script})});c.push(i)}),n.all(c)},c.prototype.stats=function(){var e=this.workers.length,t=this.workers.filter(function(e){return e.busy()}).length;return{totalWorkers:e,busyWorkers:t,idleWorkers:e-t,pendingTasks:this.taskQueue.size(),activeTasks:t}},c.prototype._ensureMinWorkers=function(){if(this.minWorkers)for(var e=this.workers.length;e<this.minWorkers;e++)this.workers.push(this._createWorkerHandler())},c.prototype._createWorkerHandler=function(){let e=this.onCreateWorker({forkArgs:this.forkArgs,forkOpts:this.forkOpts,workerOpts:this.workerOpts,workerThreadOpts:this.workerThreadOpts,script:this.script})||{};return new r(e.script||this.script,{forkArgs:e.forkArgs||this.forkArgs,forkOpts:e.forkOpts||this.forkOpts,workerOpts:e.workerOpts||this.workerOpts,workerThreadOpts:e.workerThreadOpts||this.workerThreadOpts,debugPort:s.nextAvailableStartingAt(this.debugPortStart),workerType:this.workerType,workerTerminateTimeout:this.workerTerminateTimeout,emitStdStreams:this.emitStdStreams})},c.prototype._createQueue=function(e){if(typeof e==`string`)switch(e){case`fifo`:return new a;case`lifo`:return new o;default:throw Error(`Unknown queue strategy: `+e)}if(!e)throw Error(`Queue strategy cannot be null or undefined`);for(var t=[`push`,`pop`,`size`,`contains`,`clear`],n=0;n<t.length;n++){var r=t[n];if(typeof e[r]!=`function`)throw Error(`Queue strategy must implement method: `+r)}return e};function l(e){if(!d(e)||!f(e)||e<1)throw TypeError(`Option maxWorkers must be an integer number >= 1`)}function u(e){if(!d(e)||!f(e)||e<0)throw TypeError(`Option minWorkers must be an integer number >= 0`)}function d(e){return typeof e==`number`}function f(e){return Math.round(e)==e}t.exports=c})),C=l(((e,t)=>{function n(e,t){this.message=e,this.transfer=t}t.exports=n})),w=l((e=>{var t=C(),n=g().Promise,r=`__workerpool-terminate__`,i=`__workerpool-cleanup__`,a=1e3,o={exit:function(){}},s={addAbortListener:function(e){o.abortListeners.push(e)},emit:o.emit};if(typeof self<`u`&&typeof postMessage==`function`&&typeof addEventListener==`function`)o.on=function(e,t){addEventListener(e,function(e){t(e.data)})},o.send=function(e,t){t?postMessage(e,t):postMessage(e)};else if(typeof process<`u`){var c;try{c=m()}catch(e){if(!(typeof e==`object`&&e&&e.code===`MODULE_NOT_FOUND`))throw e}if(c&&c.parentPort!==null){var l=c.parentPort;o.send=l.postMessage.bind(l),o.on=l.on.bind(l),o.exit=process.exit.bind(process)}else o.on=process.on.bind(process),o.send=function(e){process.send(e)},o.on(`disconnect`,function(){process.exit(1)}),o.exit=process.exit.bind(process)}else throw Error(`Script must be executed as a worker`);function u(e){return e&&e.toJSON?JSON.parse(JSON.stringify(e)):JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)))}function d(e){return e&&typeof e.then==`function`&&typeof e.catch==`function`}o.methods={},o.methods.run=function(e,t){var n=Function(`return (`+e+`).apply(this, arguments);`);return n.worker=s,n.apply(n,t)},o.methods.methods=function(){return Object.keys(o.methods)},o.terminationHandler=void 0,o.abortListenerTimeout=a,o.abortListeners=[],o.terminateAndExit=function(e){var t=function(){o.exit(e)};if(!o.terminationHandler)return t();var r=o.terminationHandler(e);return d(r)?(r.then(t,t),r):(t(),new n(function(e,t){t(Error(`Worker terminating`))}))},o.cleanup=function(e){if(!o.abortListeners.length)return o.send({id:e,method:i,error:u(Error(`Worker terminating`))}),new n(function(e){e()});var t=function(){o.exit()},r=function(){o.abortListeners.length&&(o.abortListeners=[])};let a=o.abortListeners.map(e=>e()),s,c=new n((e,t)=>{s=setTimeout(function(){t(Error(`Timeout occurred waiting for abort handler, killing worker`))},o.abortListenerTimeout)}),l=n.all(a).then(function(){clearTimeout(s),r()},function(){clearTimeout(s),t()});return new n(function(e,t){l.then(e,t),c.then(e,t)}).then(function(){o.send({id:e,method:i,error:null})},function(t){o.send({id:e,method:i,error:t?u(t):null})})};var f=null;o.on(`message`,function(e){if(e===r)return o.terminateAndExit(0);if(e.method===i)return o.cleanup(e.id);try{var n=o.methods[e.method];if(n){f=e.id;var a=n.apply(n,e.params);d(a)?a.then(function(n){n instanceof t?o.send({id:e.id,result:n.message,error:null},n.transfer):o.send({id:e.id,result:n,error:null}),f=null}).catch(function(t){o.send({id:e.id,result:null,error:u(t)}),f=null}):(a instanceof t?o.send({id:e.id,result:a.message,error:null},a.transfer):o.send({id:e.id,result:a,error:null}),f=null)}else throw Error(`Unknown method "`+e.method+`"`)}catch(t){o.send({id:e.id,result:null,error:u(t)})}}),o.register=function(e,t){if(e)for(var n in e)e.hasOwnProperty(n)&&(o.methods[n]=e[n],o.methods[n].worker=s);t&&(o.terminationHandler=t.onTerminate,o.abortListenerTimeout=t.abortListenerTimeout||a),o.send(`ready`)},o.emit=function(e){if(f){if(e instanceof t){o.send({id:f,isEvent:!0,payload:e.message},e.transfer);return}o.send({id:f,isEvent:!0,payload:e})}},e!==void 0&&(e.add=o.register,e.emit=o.emit)})),T=d(l((e=>{var{platform:t,isMainThread:n,cpus:r}=h(),{TerminateError:i}=y();function a(e,t){return new(S())(e,t)}e.pool=a;function o(e,t){w().add(e,t)}e.worker=o;var{Promise:s}=g();e.Transfer=C()}))(),1),E=5e3,ee=3e4,D=e=>T.pool(e,{maxWorkers:1,minWorkers:0,workerTerminateTimeout:ee,workerOpts:{type:void 0}}),te=class{url;maxWorkerHeapBytes;slots;idleSweepTimer;terminated=!1;constructor(e,t,n){p(t>0,`maxWorkers must be a positive number.`),this.url=e,this.maxWorkerHeapBytes=n?.maxWorkerHeapBytes??268435456,this.slots=Array.from({length:t},()=>({pool:D(e),tasksSinceSpawn:0,inflight:0,draining:!1,probing:!1,lastHeapBytes:void 0}))}exec(e,t,n){let r=this.pickSlot();r.inflight++;try{return r.pool.exec(e,t,n).then(e=>(this.onSettled(r),e)).catch(e=>{throw this.onSettled(r),e})}catch(e){throw this.onSettled(r),e}}warmUp(){let[e,...t]=this.slots;return this.warmSlot(e).then(()=>{for(let e of t)this.warmSlot(e).catch(()=>void 0)},e=>{if(t.length===0)throw e;return Promise.any(t.map(e=>this.warmSlot(e))).then(()=>void 0)})}canAcceptTasks(){return this.slots.some(e=>!e.draining)}stats(){let e={totalWorkers:0,busyWorkers:0,idleWorkers:0,pendingTasks:0,activeTasks:0,tasksSinceSpawn:0};for(let t of this.slots){let n=t.pool.stats();e.totalWorkers+=n.totalWorkers,e.busyWorkers+=n.busyWorkers,e.idleWorkers+=n.idleWorkers,e.pendingTasks+=n.pendingTasks,e.activeTasks+=n.activeTasks,e.tasksSinceSpawn+=t.tasksSinceSpawn}return e}heapStats(){let e=this.slots.map(e=>e.lastHeapBytes);return{perSlot:e,totalBytes:e.reduce((e,t)=>e+(t??0),0),maxWorkerHeapBytes:this.maxWorkerHeapBytes}}probeHeap(){if(!this.terminated)for(let e of this.slots)e.draining||this.probeSlot(e)}terminate(){this.idleSweepTimer!==void 0&&(clearTimeout(this.idleSweepTimer),this.idleSweepTimer=void 0),this.terminated=!0;for(let e of this.slots)e.pool.terminate()}pickSlot(){let e=this.slots.filter(e=>!e.draining);return(e.length>0?e:this.slots).reduce((e,t)=>t.inflight<e.inflight?t:e)}onSettled(e){e.inflight--,!this.terminated&&(e.tasksSinceSpawn++,e.tasksSinceSpawn>=128&&(e.draining=!0),e.draining&&e.inflight===0?this.recycleSlot(e):e.draining||this.probeSlot(e),this.armIdleSweep())}recycleSlot(e){e.pool.terminate(),e.pool=D(this.url),e.tasksSinceSpawn=0,e.draining=!1,e.lastHeapBytes=void 0,this.warmSlot(e).catch(()=>void 0)}warmSlot(e){e.inflight++;let t=()=>{e.inflight--,!this.terminated&&e.draining&&e.inflight===0&&this.recycleSlot(e)};return new Promise((n,r)=>{try{e.pool.exec(`warmUp`).then(()=>{t(),n()}).catch(e=>{t(),r(e)})}catch(e){t(),r(e)}})}probeSlot(e){if(e.probing)return;e.probing=!0,e.inflight++;let t=t=>{e.probing=!1,e.inflight--,!this.terminated&&(t&&(e.draining=!0),e.draining&&e.inflight===0&&this.recycleSlot(e))};try{e.pool.exec(`getWasmMemoryUsage`).then(n=>{typeof n==`number`&&(e.lastHeapBytes=n),t(typeof n==`number`&&n>=this.maxWorkerHeapBytes)}).catch(()=>{t(!0)})}catch{t(!0)}}armIdleSweep(){this.idleSweepTimer!==void 0&&clearTimeout(this.idleSweepTimer),this.idleSweepTimer=setTimeout(()=>{this.idleSweepTimer=void 0;for(let e of this.slots)e.tasksSinceSpawn>0&&e.inflight===0&&this.recycleSlot(e)},E)}};function ne(e){return e!=null}var re=class{x;y;z;constructor(e){this.x=e.x,this.y=e.y,this.z=e.z}},ie=class{vertices;uvs;indices;heights;max_height;min_height;rtc_translation;normals;skirt_vertices;skirt_uvs;skirt_indices;skirt_normals;watermask;constructor(e){this.vertices=e.transferVertices(),this.uvs=e.transferUvs(),this.indices=e.transferIndices(),this.heights=e.transferHeights(),this.max_height=e.max_height,this.min_height=e.min_height,this.rtc_translation=e.rtc_translation?new re(e.rtc_translation):void 0,e.hasNormals()&&(this.normals=e.transferNormals()),e.hasSkirt()&&(this.skirt_vertices=e.transferSkirtVertices(),this.skirt_uvs=e.transferSkirtUvs(),this.skirt_indices=e.transferSkirtIndices(),this.skirt_normals=e.transferSkirtNormals()),e.hasWatermask()&&(this.watermask=e.transferWatermask())}transferVertices(){throw Error()}transferUvs(){throw Error()}transferIndices(){throw Error()}transferHeights(){throw Error()}transferNormals(){throw Error()}transferSkirtVertices(){throw Error()}transferSkirtUvs(){throw Error()}transferSkirtIndices(){throw Error()}transferSkirtNormals(){throw Error()}transferWatermask(){throw Error()}hasSkirt(){return this.skirt_vertices!==void 0&&this.skirt_uvs!==void 0&&this.skirt_indices!==void 0}hasNormals(){return this.normals!==void 0}hasWatermask(){return this.watermask!==void 0}},ae=class{east;north;south;west;constructor(e){this.east=e.east,this.north=e.north,this.south=e.south,this.west=e.west}},oe=class{extent;position_3d_high;position_3d_high_size;position_3d_low;position_3d_low_size;position;position_size;normal;normal_size;scale_normal_and_cap;scale_normal_and_cap_size;batch_id;batch_id_size;batch_index;batch_index_size;indices;rtc_translation;outline_position;outline_position_size;outline_scale_normal_and_cap;outline_scale_normal_and_cap_size;outline_skip_indices;outline_batch_index;outline_batch_index_size;constructor(e){let t=e.extent;this.extent=t?new ae(t):void 0,this.position_3d_high=e.position_3d_high()?.slice(),this.position_3d_high_size=e.position_3d_high_size(),this.position_3d_low=e.position_3d_low()?.slice(),this.position_3d_low_size=e.position_3d_low_size(),this.position=e.position()?.slice(),this.position_size=e.position_size(),this.normal=e.normal()?.slice(),this.normal_size=e.normal_size(),this.scale_normal_and_cap=e.scale_normal_and_cap()?.slice(),this.scale_normal_and_cap_size=e.scale_normal_and_cap_size(),this.batch_id=e.batch_id()?.slice(),this.batch_id_size=e.batch_id_size(),this.batch_index=e.batch_index()?.slice(),this.batch_index_size=e.batch_index_size(),this.indices=e.indices().slice(),this.rtc_translation=e.rtc_translation?new re(e.rtc_translation):void 0;let n=e.outline();n&&(this.outline_position=n.position()?.slice(),this.outline_position_size=n.position_size(),this.outline_scale_normal_and_cap=n.scale_normal_and_cap()?.slice(),this.outline_scale_normal_and_cap_size=n.scale_normal_and_cap_size(),this.outline_skip_indices=n.skip_indices()?.slice(),this.outline_batch_index=n.batch_index()?.slice(),this.outline_batch_index_size=n.batch_index_size(),n.free())}},se=class{extent;position;position_size;position_high;position_high_size;position_low;position_low_size;start;start_size;start_high;start_high_size;start_low;start_low_size;forward_offset;forward_offset_size;end_high;end_high_size;end_low;end_low_size;start_normals;start_normals_size;end_normal_and_texture_coordinate_normalization_x;end_normal_and_texture_coordinate_normalization_x_size;right_normal_and_texture_coordinate_normalization_y;right_normal_and_texture_coordinate_normalization_y_size;batch_id;batch_id_size;batch_index;batch_index_size;indices;constructor(e){let t=e.extent;this.extent=t?new ae(t):void 0,this.position=e.position().slice(),this.position_size=e.position_size(),this.position_high=e.position_high()?.slice(),this.position_high_size=e.position_high_size(),this.position_low=e.position_low()?.slice(),this.position_low_size=e.position_low_size(),this.start=e.start()?.slice(),this.start_size=e.start_size(),this.start_high=e.start_high()?.slice(),this.start_high_size=e.start_high_size(),this.start_low=e.start_low()?.slice(),this.start_low_size=e.start_low_size(),this.forward_offset=e.forward_offset()?.slice(),this.forward_offset_size=e.forward_offset_size(),this.end_high=e.end_high()?.slice(),this.end_high_size=e.end_high_size(),this.end_low=e.end_low()?.slice(),this.end_low_size=e.end_low_size(),this.start_normals=e.start_normals()?.slice(),this.start_normals_size=e.start_normals_size(),this.end_normal_and_texture_coordinate_normalization_x=e.end_normal_and_texture_coordinate_normalization_x()?.slice(),this.end_normal_and_texture_coordinate_normalization_x_size=e.end_normal_and_texture_coordinate_normalization_x_size(),this.right_normal_and_texture_coordinate_normalization_y=e.right_normal_and_texture_coordinate_normalization_y().slice(),this.right_normal_and_texture_coordinate_normalization_y_size=e.right_normal_and_texture_coordinate_normalization_y_size(),this.batch_id=e.batch_id()?.slice(),this.batch_id_size=e.batch_id_size(),this.batch_index=e.batch_index()?.slice(),this.batch_index_size=e.batch_index_size(),this.indices=e.indices().slice()}};function ce(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function le(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ue(e){let t,n,r;e.length===2?(t=e===ce||e===le?e:de,n=e,r=e):(t=ce,n=(t,n)=>ce(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function de(){return 0}function fe(e){return e===null?NaN:+e}var pe=ue(ce);pe.right,pe.left,ue(fe).center;var me={value:()=>{}};function he(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new ge(n)}function ge(e){this._=e}function _e(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}ge.prototype=he.prototype={constructor:ge,on:function(e,t){var n=this._,r=_e(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=ve(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=ye(n[i],e.name,t);else if(t==null)for(i in n)n[i]=ye(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ge(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function ve(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function ye(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=me,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var be={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function xe(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),be.hasOwnProperty(t)?{space:be[t],local:e}:e}function Se(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function Ce(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function we(e){var t=xe(e);return(t.local?Ce:Se)(t)}function Te(){}function Ee(e){return e==null?Te:function(){return this.querySelector(e)}}function De(e){typeof e!=`function`&&(e=Ee(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new k(r,this._parents)}function Oe(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ke(){return[]}function Ae(e){return e==null?ke:function(){return this.querySelectorAll(e)}}function je(e){return function(){return Oe(e.apply(this,arguments))}}function Me(e){e=typeof e==`function`?je(e):Ae(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new k(r,i)}function Ne(e){return function(){return this.matches(e)}}function Pe(e){return function(t){return t.matches(e)}}var Fe=Array.prototype.find;function Ie(e){return function(){return Fe.call(this.children,e)}}function Le(){return this.firstElementChild}function Re(e){return this.select(e==null?Le:Ie(typeof e==`function`?e:Pe(e)))}var ze=Array.prototype.filter;function Be(){return Array.from(this.children)}function Ve(e){return function(){return ze.call(this.children,e)}}function He(e){return this.selectAll(e==null?Be:Ve(typeof e==`function`?e:Pe(e)))}function Ue(e){typeof e!=`function`&&(e=Ne(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new k(r,this._parents)}function We(e){return Array(e.length)}function Ge(){return new k(this._enter||this._groups.map(We),this._parents)}function Ke(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ke.prototype={constructor:Ke,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function qe(e){return function(){return e}}function Je(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Ke(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Ye(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Ke(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Xe(e){return e.__data__}function Ze(e,t){if(!arguments.length)return Array.from(this,Xe);var n=t?Ye:Je,r=this._parents,i=this._groups;typeof e!=`function`&&(e=qe(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=Qe(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new k(o,r),o._enter=s,o._exit=c,o}function Qe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function $e(){return new k(this._exit||this._groups.map(We),this._parents)}function et(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function tt(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new k(s,this._parents)}function nt(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function rt(e){e||=it;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new k(i,this._parents).order()}function it(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function at(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ot(){return Array.from(this)}function st(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function ct(){let e=0;for(let t of this)++e;return e}function lt(){return!this.node()}function ut(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function dt(e){return function(){this.removeAttribute(e)}}function ft(e){return function(){this.removeAttributeNS(e.space,e.local)}}function pt(e,t){return function(){this.setAttribute(e,t)}}function mt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ht(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function gt(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function _t(e,t){var n=xe(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?ft:dt:typeof t==`function`?n.local?gt:ht:n.local?mt:pt)(n,t))}function vt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function yt(e){return function(){this.style.removeProperty(e)}}function bt(e,t,n){return function(){this.style.setProperty(e,t,n)}}function xt(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function St(e,t,n){return arguments.length>1?this.each((t==null?yt:typeof t==`function`?xt:bt)(e,t,n??``)):O(this.node(),e)}function O(e,t){return e.style.getPropertyValue(t)||vt(e).getComputedStyle(e,null).getPropertyValue(t)}function Ct(e){return function(){delete this[e]}}function wt(e,t){return function(){this[e]=t}}function Tt(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Et(e,t){return arguments.length>1?this.each((t==null?Ct:typeof t==`function`?Tt:wt)(e,t)):this.node()[e]}function Dt(e){return e.trim().split(/^|\s+/)}function Ot(e){return e.classList||new kt(e)}function kt(e){this._node=e,this._names=Dt(e.getAttribute(`class`)||``)}kt.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function At(e,t){for(var n=Ot(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function jt(e,t){for(var n=Ot(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Mt(e){return function(){At(this,e)}}function Nt(e){return function(){jt(this,e)}}function Pt(e,t){return function(){(t.apply(this,arguments)?At:jt)(this,e)}}function Ft(e,t){var n=Dt(e+``);if(arguments.length<2){for(var r=Ot(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Pt:t?Mt:Nt)(n,t))}function It(){this.textContent=``}function Lt(e){return function(){this.textContent=e}}function Rt(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function zt(e){return arguments.length?this.each(e==null?It:(typeof e==`function`?Rt:Lt)(e)):this.node().textContent}function Bt(){this.innerHTML=``}function Vt(e){return function(){this.innerHTML=e}}function Ht(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Ut(e){return arguments.length?this.each(e==null?Bt:(typeof e==`function`?Ht:Vt)(e)):this.node().innerHTML}function Wt(){this.nextSibling&&this.parentNode.appendChild(this)}function Gt(){return this.each(Wt)}function Kt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function qt(){return this.each(Kt)}function Jt(e){var t=typeof e==`function`?e:we(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Yt(){return null}function Xt(e,t){var n=typeof e==`function`?e:we(e),r=t==null?Yt:typeof t==`function`?t:Ee(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Zt(){var e=this.parentNode;e&&e.removeChild(this)}function Qt(){return this.each(Zt)}function $t(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function en(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function tn(e){return this.select(e?en:$t)}function nn(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function rn(e){return function(t){e.call(this,t,this.__data__)}}function an(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function on(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function sn(e,t,n){return function(){var r=this.__on,i,a=rn(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function cn(e,t,n){var r=an(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?sn:on,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function ln(e,t,n){var r=vt(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function un(e,t){return function(){return ln(this,e,t)}}function dn(e,t){return function(){return ln(this,e,t.apply(this,arguments))}}function fn(e,t){return this.each((typeof t==`function`?dn:un)(e,t))}function*pn(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var mn=[null];function k(e,t){this._groups=e,this._parents=t}function A(){return new k([[document.documentElement]],mn)}function hn(){return this}k.prototype=A.prototype={constructor:k,select:De,selectAll:Me,selectChild:Re,selectChildren:He,filter:Ue,data:Ze,enter:Ge,exit:$e,join:et,merge:tt,selection:hn,order:nt,sort:rt,call:at,nodes:ot,node:st,size:ct,empty:lt,each:ut,attr:_t,style:St,property:Et,classed:Ft,text:zt,html:Ut,raise:Gt,lower:qt,append:Jt,insert:Xt,remove:Qt,clone:tn,datum:nn,on:cn,dispatch:fn,[Symbol.iterator]:pn};function gn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function _n(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function j(){}var M=.7,vn=1/M,N=`\\s*([+-]?\\d+)\\s*`,P=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,F=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,yn=/^#([0-9a-f]{3,8})$/,bn=RegExp(`^rgb\\(${N},${N},${N}\\)$`),xn=RegExp(`^rgb\\(${F},${F},${F}\\)$`),Sn=RegExp(`^rgba\\(${N},${N},${N},${P}\\)$`),Cn=RegExp(`^rgba\\(${F},${F},${F},${P}\\)$`),wn=RegExp(`^hsl\\(${P},${F},${F}\\)$`),Tn=RegExp(`^hsla\\(${P},${F},${F},${P}\\)$`),En={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};gn(j,I,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Dn,formatHex:Dn,formatHex8:On,formatHsl:kn,formatRgb:An,toString:An});function Dn(){return this.rgb().formatHex()}function On(){return this.rgb().formatHex8()}function kn(){return Bn(this).formatHsl()}function An(){return this.rgb().formatRgb()}function I(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=yn.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?jn(t):n===3?new L(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Mn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Mn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=bn.exec(e))?new L(t[1],t[2],t[3],1):(t=xn.exec(e))?new L(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Sn.exec(e))?Mn(t[1],t[2],t[3],t[4]):(t=Cn.exec(e))?Mn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=wn.exec(e))?zn(t[1],t[2]/100,t[3]/100,1):(t=Tn.exec(e))?zn(t[1],t[2]/100,t[3]/100,t[4]):En.hasOwnProperty(e)?jn(En[e]):e===`transparent`?new L(NaN,NaN,NaN,0):null}function jn(e){return new L(e>>16&255,e>>8&255,e&255,1)}function Mn(e,t,n,r){return r<=0&&(e=t=n=NaN),new L(e,t,n,r)}function Nn(e){return e instanceof j||(e=I(e)),e?(e=e.rgb(),new L(e.r,e.g,e.b,e.opacity)):new L}function Pn(e,t,n,r){return arguments.length===1?Nn(e):new L(e,t,n,r??1)}function L(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}gn(L,Pn,_n(j,{brighter(e){return e=e==null?vn:vn**+e,new L(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?M:M**+e,new L(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new L(R(this.r),R(this.g),R(this.b),Rn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Fn,formatHex:Fn,formatHex8:In,formatRgb:Ln,toString:Ln}));function Fn(){return`#${z(this.r)}${z(this.g)}${z(this.b)}`}function In(){return`#${z(this.r)}${z(this.g)}${z(this.b)}${z((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ln(){let e=Rn(this.opacity);return`${e===1?`rgb(`:`rgba(`}${R(this.r)}, ${R(this.g)}, ${R(this.b)}${e===1?`)`:`, ${e})`}`}function Rn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function R(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function z(e){return e=R(e),(e<16?`0`:``)+e.toString(16)}function zn(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new B(e,t,n,r)}function Bn(e){if(e instanceof B)return new B(e.h,e.s,e.l,e.opacity);if(e instanceof j||(e=I(e)),!e)return new B;if(e instanceof B)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new B(o,s,c,e.opacity)}function Vn(e,t,n,r){return arguments.length===1?Bn(e):new B(e,t,n,r??1)}function B(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}gn(B,Vn,_n(j,{brighter(e){return e=e==null?vn:vn**+e,new B(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?M:M**+e,new B(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new L(Wn(e>=240?e-240:e+120,i,r),Wn(e,i,r),Wn(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new B(Hn(this.h),Un(this.s),Un(this.l),Rn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Rn(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Hn(this.h)}, ${Un(this.s)*100}%, ${Un(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Hn(e){return e=(e||0)%360,e<0?e+360:e}function Un(e){return Math.max(0,Math.min(1,e||0))}function Wn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Gn=e=>()=>e;function Kn(e,t){return function(n){return e+n*t}}function qn(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Jn(e){return(e=+e)==1?Yn:function(t,n){return n-t?qn(t,n,e):Gn(isNaN(t)?n:t)}}function Yn(e,t){var n=t-e;return n?Kn(e,n):Gn(isNaN(e)?t:e)}var Xn=(function e(t){var n=Jn(t);function r(e,t){var r=n((e=Pn(e)).r,(t=Pn(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Yn(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function V(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Zn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qn=new RegExp(Zn.source,`g`);function $n(e){return function(){return e}}function er(e){return function(t){return e(t)+``}}function tr(e,t){var n=Zn.lastIndex=Qn.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Zn.exec(e))&&(i=Qn.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:V(r,i)})),n=Qn.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?er(c[0].x):$n(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}var nr=180/Math.PI,rr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ir(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*nr,skewX:Math.atan(c)*nr,scaleX:o,scaleY:s}}var ar;function or(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?rr:ir(t.a,t.b,t.c,t.d,t.e,t.f)}function sr(e){return e==null||(ar||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),ar.setAttribute(`transform`,e),!(e=ar.transform.baseVal.consolidate()))?rr:(e=e.matrix,ir(e.a,e.b,e.c,e.d,e.e,e.f))}function cr(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:V(e,i)},{i:c-2,x:V(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:V(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:V(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:V(e,n)},{i:s-2,x:V(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var lr=cr(or,`px, `,`px)`,`deg)`),ur=cr(sr,`, `,`)`,`)`),H=0,dr=0,fr=0,pr=1e3,mr,U,hr=0,W=0,gr=0,G=typeof performance==`object`&&performance.now?performance:Date,_r=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function vr(){return W||=(_r(yr),G.now()+gr)}function yr(){W=0}function br(){this._call=this._time=this._next=null}br.prototype=xr.prototype={constructor:br,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?vr():+n)+(t==null?0:+t),!this._next&&U!==this&&(U?U._next=this:mr=this,U=this),this._call=e,this._time=n,Er()},stop:function(){this._call&&(this._call=null,this._time=1/0,Er())}};function xr(e,t,n){var r=new br;return r.restart(e,t,n),r}function Sr(){vr(),++H;for(var e=mr,t;e;)(t=W-e._time)>=0&&e._call.call(void 0,t),e=e._next;--H}function Cr(){W=(hr=G.now())+gr,H=dr=0;try{Sr()}finally{H=0,Tr(),W=0}}function wr(){var e=G.now(),t=e-hr;t>pr&&(gr-=t,hr=e)}function Tr(){for(var e,t=mr,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:mr=n);U=e,Er(r)}function Er(e){H||(dr&&=clearTimeout(dr),e-W>24?(e<1/0&&(dr=setTimeout(Cr,e-G.now()-gr)),fr&&=clearInterval(fr)):(fr||=(hr=G.now(),setInterval(wr,pr)),H=1,_r(Cr)))}function Dr(e,t,n){var r=new br;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Or=he(`start`,`end`,`cancel`,`interrupt`),kr=[];function Ar(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Mr(e,n,{name:t,index:r,group:i,on:Or,tween:kr,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function jr(e,t){var n=q(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function K(e,t){var n=q(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function q(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Mr(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=xr(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return Dr(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(Dr(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Nr(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function Pr(e){return this.each(function(){Nr(this,e)})}function Fr(e,t){var n,r;return function(){var i=K(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Ir(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=K(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function Lr(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=q(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?Fr:Ir)(n,e,t))}function Rr(e,t,n){var r=e._id;return e.each(function(){var e=K(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return q(e,r).value[t]}}function zr(e,t){var n;return(typeof t==`number`?V:t instanceof I?Xn:(n=I(t))?(t=n,Xn):tr)(e,t)}function Br(e){return function(){this.removeAttribute(e)}}function Vr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hr(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Ur(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Wr(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Gr(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Kr(e,t){var n=xe(e),r=n===`transform`?ur:zr;return this.attrTween(e,typeof t==`function`?(n.local?Gr:Wr)(n,r,Rr(this,`attr.`+e,t)):t==null?(n.local?Vr:Br)(n):(n.local?Ur:Hr)(n,r,t))}function qr(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Jr(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Yr(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Jr(e,i)),n}return i._value=t,i}function Xr(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&qr(e,i)),n}return i._value=t,i}function Zr(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=xe(e);return this.tween(n,(r.local?Yr:Xr)(r,t))}function Qr(e,t){return function(){jr(this,e).delay=+t.apply(this,arguments)}}function $r(e,t){return t=+t,function(){jr(this,e).delay=t}}function ei(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Qr:$r)(t,e)):q(this.node(),t).delay}function ti(e,t){return function(){K(this,e).duration=+t.apply(this,arguments)}}function ni(e,t){return t=+t,function(){K(this,e).duration=t}}function ri(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?ti:ni)(t,e)):q(this.node(),t).duration}function ii(e,t){if(typeof t!=`function`)throw Error();return function(){K(this,e).ease=t}}function ai(e){var t=this._id;return arguments.length?this.each(ii(t,e)):q(this.node(),t).ease}function oi(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();K(this,e).ease=n}}function si(e){if(typeof e!=`function`)throw Error();return this.each(oi(this._id,e))}function ci(e){typeof e!=`function`&&(e=Ne(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new J(r,this._parents,this._name,this._id)}function li(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new J(o,this._parents,this._name,this._id)}function ui(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function di(e,t,n){var r,i,a=ui(t)?jr:K;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function fi(e,t){var n=this._id;return arguments.length<2?q(this.node(),n).on.on(e):this.each(di(n,e,t))}function pi(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function mi(){return this.on(`end.remove`,pi(this._id))}function hi(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Ee(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,Ar(l[f],t,n,f,l,q(u,n)));return new J(a,this._parents,t,n)}function gi(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Ae(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=q(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&Ar(p,t,n,h,f,m);a.push(f),o.push(u)}return new J(a,o,t,n)}var _i=A.prototype.constructor;function vi(){return new _i(this._groups,this._parents)}function yi(e,t){var n,r,i;return function(){var a=O(this,e),o=(this.style.removeProperty(e),O(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function bi(e){return function(){this.style.removeProperty(e)}}function xi(e,t,n){var r,i=n+``,a;return function(){var o=O(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function Si(e,t,n){var r,i,a;return function(){var o=O(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),O(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Ci(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=K(this,e),l=c.on,u=c.value[a]==null?s||=bi(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function wi(e,t,n){var r=(e+=``)==`transform`?lr:zr;return t==null?this.styleTween(e,yi(e,r)).on(`end.style.`+e,bi(e)):typeof t==`function`?this.styleTween(e,Si(e,r,Rr(this,`style.`+e,t))).each(Ci(this._id,e)):this.styleTween(e,xi(e,r,t),n).on(`end.style.`+e,null)}function Ti(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Ei(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Ti(e,a,n)),r}return a._value=t,a}function Di(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,Ei(e,t,n??``))}function Oi(e){return function(){this.textContent=e}}function ki(e){return function(){var t=e(this);this.textContent=t??``}}function Ai(e){return this.tween(`text`,typeof e==`function`?ki(Rr(this,`text`,e)):Oi(e==null?``:e+``))}function ji(e){return function(t){this.textContent=e.call(this,t)}}function Mi(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&ji(r)),t}return r._value=e,r}function Ni(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,Mi(e))}function Pi(){for(var e=this._name,t=this._id,n=Ri(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=q(c,t);Ar(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new J(r,this._parents,e,n)}function Fi(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=K(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var Ii=0;function J(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Li(e){return A().transition(e)}function Ri(){return++Ii}var Y=A.prototype;J.prototype=Li.prototype={constructor:J,select:hi,selectAll:gi,selectChild:Y.selectChild,selectChildren:Y.selectChildren,filter:ci,merge:li,selection:vi,transition:Pi,call:Y.call,nodes:Y.nodes,node:Y.node,size:Y.size,empty:Y.empty,each:Y.each,on:fi,attr:Kr,attrTween:Zr,style:wi,styleTween:Di,text:Ai,textTween:Ni,remove:mi,tween:Lr,delay:ei,duration:ri,ease:ai,easeVarying:si,end:Fi,[Symbol.iterator]:Y[Symbol.iterator]};function zi(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Bi={time:null,delay:0,duration:250,ease:zi};function Vi(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Hi(e){var t,n;e instanceof J?(t=e._id,e=e._name):(t=Ri(),(n=Bi).time=vr(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&Ar(c,e,t,l,o,n||Vi(c,t));return new J(r,this._parents,e,t)}A.prototype.interrupt=Pr,A.prototype.transition=Hi;var{abs:Ui,max:Wi,min:Gi}=Math;[`w`,`e`].map(Ki),[`n`,`s`].map(Ki),[`n`,`w`,`e`,`s`,`nw`,`ne`,`sw`,`se`].map(Ki);function Ki(e){return{type:e}}function qi(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Ji(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Yi(e){return e=Ji(Math.abs(e)),e?e[1]:NaN}function Xi(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Zi(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var Qi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $i(e){if(!(t=Qi.exec(e)))throw Error(`invalid format: `+e);var t;return new ea({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}$i.prototype=ea.prototype;function ea(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}ea.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function ta(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var na;function ra(e,t){var n=Ji(e,t);if(!n)return na=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(na=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Ji(e,Math.max(0,t+a-1))[0]}function ia(e,t){var n=Ji(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var aa={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:qi,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>ia(e*100,t),r:ia,s:ra,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function oa(e){return e}var sa=Array.prototype.map,ca=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function la(e){var t=e.grouping===void 0||e.thousands===void 0?oa:Xi(sa.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?oa:Zi(sa.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=$i(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):aa[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=aa[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=ta(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&na!==void 0?ca[8+na/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Yi(t)/3)))*3,r=10**-n,i=l((e=$i(e),e.type=`f`,e),{suffix:ca[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var ua;da({thousands:`,`,grouping:[3],currency:[`$`,``]});function da(e){return ua=la(e),ua.format,ua.formatPrefix,ua}function X(e,t,n){this.k=e,this.x=t,this.y=n}X.prototype={constructor:X,scale:function(e){return e===1?this:new X(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new X(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var fa=new X(1,0,0);pa.prototype=X.prototype;function pa(e){for(;!e.__zoom;)if(!(e=e.parentNode))return fa;return e.__zoom}function ma(e){let t=new oe(e);return{result:t,transfers:[t.batch_id?.buffer,t.batch_index?.buffer,t.normal?.buffer,t.position_3d_high?.buffer,t.position_3d_low?.buffer,t.position?.buffer,t.scale_normal_and_cap?.buffer,t.indices.buffer,t.outline_position?.buffer,t.outline_scale_normal_and_cap?.buffer,t.outline_skip_indices?.buffer,t.outline_batch_index?.buffer].filter(ne)}}function Z(e){return new n.TransferableTile(ha(e.coords),e.max_height,e.min_height,e.cached_mesh_handle?ga(e.cached_mesh_handle):void 0)}function ha(e){return new n.TileXYZ(e.x,e.y,e.z)}function ga(e){return new n.CachedMeshHandle(e.vertices,e.indices,e.uvs,e.heights)}function _a(e){return new n.UpsamplableTerrainGeometry(e.uvs,e.indices,e.heights,e.normals,e.watermask)}function va(e){return new n.ExtentRadianF32(e.west,e.south,e.east,e.north)}function ya(e){return new n.PolygonMaterial(e.show,e.castShadow,e.receiveShadow,e.color,e.clampToGround,e.tiled,e.height,e.extrudedHeight,e.wireframe,e.outline,e.perPositionHeight,e.__internal__)}function ba(e){let t=new n.TransferablePolygonBatchedFeature(e.crs,e.length);return t.setOuterRing(e.outer_ring.length,t=>{t.set(e.outer_ring)}),t.setOuterRingSizes(e.outer_ring_sizes.length,t=>{t.set(e.outer_ring_sizes)}),t.setHoles(e.holes.length,t=>{t.set(e.holes)}),t.setHolesSizes(e.holes_sizes.length,t=>{t.set(e.holes_sizes)}),t.setHolesTotalSizes(e.holes_total_sizes.length,t=>{t.set(e.holes_total_sizes)}),t.setHolesBoundaries(e.holes_boundaries.length,t=>{t.set(e.holes_boundaries)}),t.setExpectedWindingOrders(e.expected_winding_orders.length,t=>{t.set(e.expected_winding_orders)}),t.setBatchIds(e.batch_ids.length,t=>{t.set(e.batch_ids)}),t.setBatchIndices(e.batch_indices.length,t=>{t.set(e.batch_indices)}),t}var xa;async function Q(){return xa??=(0,n.default)(),xa}async function Sa(){if(!xa)return 0;let{memory:e}=await xa;return e.buffer.byteLength}async function Ca(e,t,r,i){await Q();let a=(0,n.constructPolygonBatchedFeature)(ba(e),ya(t),r,i?va(i):void 0);if(!a)return;let{result:o,transfers:s}=ma(a);return a.free(),$(o,s)}function wa(e){let t=new se(e);return{result:t,transfers:[t.position.buffer,t.position_high?.buffer,t.position_low?.buffer,t.start?.buffer,t.start_high?.buffer,t.start_low?.buffer,t.end_high?.buffer,t.end_low?.buffer,t.start_normals?.buffer,t.forward_offset?.buffer,t.end_normal_and_texture_coordinate_normalization_x?.buffer,t.right_normal_and_texture_coordinate_normalization_y.buffer,t.batch_id?.buffer,t.batch_index?.buffer,t.indices.buffer].filter(ne)}}function Ta(e){return new n.PolylineMaterial(e.show,e.castShadow,e.receiveShadow,e.color,e.clampToGround,e.tiled,e.height,e.width,e.maxWidth,e.__internal__)}function Ea(e){let t=new n.TransferablePolylineBatchedFeature(e.crs,e.length);return t.setPoints(e.points.length,t=>{t.set(e.points)}),t.setPointsSizes(e.points_sizes.length,t=>{t.set(e.points_sizes)}),t.setBatchIds(e.batch_ids.length,t=>{t.set(e.batch_ids)}),t.setBatchIndices(e.batch_indices.length,t=>{t.set(e.batch_indices)}),t}async function Da(e,t,r){await Q();let i=(0,n.constructPolylineBatchedFeature)(Ea(e),Ta(t),r);if(!i)return;let{result:a,transfers:o}=wa(i);return i.free(),$(a,o)}function Oa(e){let t=new ie(e),n=[t.vertices.buffer,t.uvs.buffer,t.indices.buffer,t.heights.buffer];return t.normals&&n.push(t.normals.buffer),t.skirt_vertices&&n.push(t.skirt_vertices.buffer),t.skirt_uvs&&n.push(t.skirt_uvs.buffer),t.skirt_indices&&n.push(t.skirt_indices.buffer),t.skirt_normals&&n.push(t.skirt_normals.buffer),t.watermask&&n.push(t.watermask.buffer),{result:t,transfers:n}}async function ka(e,t,r,i,a,o){await Q();let s=(0,n.constructQuantizedMeshTerrainMesh)(e,Z(t),r,i,a,o),{result:c,transfers:l}=Oa(s);return s.free(),$({result:c},[...l])}function Aa(e){return new n.TransferableRasterDEMData(new n.ElevationDecoder(e.decoder.r_scaler,e.decoder.g_scaler,e.decoder.b_scaler,e.decoder.offset,e.decoder.max_offset,e.decoder.min_offset,e.decoder.boundary,e.decoder.epsilon))}async function ja(e,t,r,i,a,o){await Q();let s=i+1,c=n.TransferableMartini.fromSize(s),l=(0,n.constructTerrainMesh)(e,Z(t),Aa(r),c,a,o),{result:u,transfers:d}=Oa(l);return l.free(),$({result:u},[...d])}async function Ma(e){let t=await createImageBitmap(e);try{let e=new OffscreenCanvas(t.width,t.height).getContext(`2d`);if(e===null)throw Error(`failed to get context of canvas`);e.drawImage(t,0,0);let n=e.getImageData(0,0,t.width,t.height).data;return $(n,[n.buffer])}finally{t.close()}}async function Na(e,t){try{let n=t.getContext(`2d`);if(n===null)throw Error(`failed to get context of canvas`);return n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height).data}finally{e.close()}}async function Pa(e,t,r,i,a,o,s){await Q();let c=(0,n.parseMvtTile)(e,t,r,i,a?va(a):void 0,o,s),l,u,d,f,p;try{l=c.f64_stream(),u=c.f32_stream(),d=c.u32_stream(),f=c.u8_stream(),p=c.meta()}finally{c.free()}return $({f64_stream:l,f32_stream:u,u32_stream:d,u8_stream:f,meta:p},[l.buffer,u.buffer,d.buffer,f.buffer])}async function Fa(e,t,r,i,a,o,s){await Q();let c=(0,n.upsampleQuantizedMeshTerrainMesh)(Z(e),Z(t),_a(r),i,a,o,s),{result:l,transfers:u}=Oa(c);return c.free(),$(l,u)}async function Ia(e,t,r,i,a,o,s){await Q();let c=(0,n.upsampleTerrainMesh)(Z(e),Z(t),Aa(r),_a(i),a,o,s),{result:l,transfers:u}=Oa(c);return c.free(),$(l,u)}async function La(){await Q()}var Ra={constructTerrainMesh:ja,constructQuantizedMeshTerrainMesh:ka,upsampleTerrainMesh:Ia,upsampleQuantizedMeshTerrainMesh:Fa,getImageDataFromImageBitmap:Na,getImageDataFromBlob:Ma,constructPolygonBatchedFeature:Ca,constructPolylineBatchedFeature:Da,parseMvtTile:Pa,warmUp:La,getWasmMemoryUsage:Sa},$=(e,t)=>new T.Transfer(e,t),za=!1,Ba=(...e)=>(za||=(T.worker(Ra),Va(),!0),T.worker(...e));function Va(){Ra.warmUp.worker?.addAbortListener(async()=>{})}var{initializeWorkerPool:Ha,terminateWorkerPool:Ua,warmUpWorkerPool:Wa,worker:Ga,workerPoolStats:Ka,workerPoolHeapStats:qa,probeWorkerPoolHeap:Ja}=(()=>{let e;return{initializeWorkerPool:(t,n,r)=>{if(e)throw Error(`Worker pool has already been initialized.`);e={pool:new te(t,n.total,r),manager:n}},terminateWorkerPool:()=>{e&&=(e.pool.terminate(),void 0)},warmUpWorkerPool:()=>(p(e,`initializeWorkerPool() must be invoked first.`),e.pool.warmUp()),worker:()=>(p(e,`initializeWorkerPool() must be invoked first.`),{pool:e.pool,manager:e.manager}),workerPoolStats:()=>e?.pool.stats(),workerPoolHeapStats:()=>e?.pool.heapStats(),probeWorkerPoolHeap:()=>e?.pool.probeHeap()}})(),Ya=()=>{let{pool:e,manager:t}=Ga();return t.canIncrement()&&e.canAcceptTasks()};function Xa(e,t,n){let{pool:r,manager:i}=Ga();i.increment();try{return r.exec(e,t,n).then(e=>(i.decrement(),e)).catch(e=>{throw i.decrement(),e})}catch(e){throw i.decrement(),e}}e.canWorkerProcessImmediately=Ya,e.createConcurrencyManager=e=>{let t=0,n=()=>t!==e,r=()=>t!==0;return{total:e,actives:()=>t,idles:()=>e-t,increment:()=>{n()&&t++},decrement:()=>{r()&&t--},canIncrement:n,canDecrement:r,reset:()=>{t=0}}},e.initializeWorkerPool=Ha,e.probeWorkerPoolHeap=Ja,e.queueTask=Xa,e.registerTasks=Ba,e.terminateWorkerPool=Ua,e.transfer=$,e.warmUpWorkerPool=Wa,e.workerPoolHeapStats=qa,e.workerPoolStats=Ka});
11
+ `,i(new D(r))}),this.processing=Object.create(null),this.tracking=Object.create(null),this.terminating=!1,this.terminated=!1,this.cleaning=!1,this.terminationHandler=null,this.lastId=0}E.prototype.methods=function(){return this.exec(`methods`)},E.prototype.exec=function(e,t,r,i){r||=n.defer();var a=++this.lastId;this.processing[a]={id:a,resolver:r,options:i};var o={message:{id:a,method:e,params:t},transfer:i&&i.transfer};this.terminated?r.reject(new D(`Worker is terminated`)):this.worker.ready?this.worker.send(o.message,o.transfer):this.requestQueue.push(o);var s=this;return r.promise.catch(function(e){if(e instanceof n.CancellationError||e instanceof n.TimeoutError)return s.tracking[a]={id:a,resolver:n.defer(),options:i,error:e},delete s.processing[a],s.tracking[a].resolver.promise=s.tracking[a].resolver.promise.catch(function(e){if(delete s.tracking[a],e instanceof ee)throw e.error;return s.terminateAndNotify(!0).then(function(){throw e},function(e){throw e})}),s.worker.send({id:a,method:l}),s.tracking[a].timeoutId=setTimeout(function(){s.tracking[a].resolver.reject(e)},s.workerTerminateTimeout),s.tracking[a].resolver.promise;throw e})},E.prototype.busy=function(){return this.cleaning||Object.keys(this.processing).length>0||Object.keys(this.tracking).length>0},E.prototype.terminate=function(e,t){var n=this;if(e){for(var r in this.processing)this.processing[r]!==void 0&&this.processing[r].resolver.reject(Error(`Worker terminated`));this.processing=Object.create(null)}for(var i of Object.values(n.tracking))clearTimeout(i.timeoutId),i.resolver.reject(Error(`Worker Terminating`));if(n.tracking=Object.create(null),typeof t==`function`&&(this.terminationHandler=t),this.busy())this.terminating=!0;else{var a=function(e){if(n.terminated=!0,n.cleaning=!1,n.worker!=null&&n.worker.removeAllListeners&&n.worker.removeAllListeners(`message`),n.worker=null,n.terminating=!1,n.terminationHandler)n.terminationHandler(e,n);else if(e)throw e};if(this.worker){if(typeof this.worker.kill==`function`){if(this.worker.killed){a(Error(`worker already killed!`));return}var o=setTimeout(function(){n.worker&&n.worker.kill()},this.workerTerminateTimeout);this.worker.once(`exit`,function(){clearTimeout(o),n.worker&&(n.worker.killed=!0),a()}),this.worker.ready?this.worker.send(c):this.requestQueue.push({message:c}),this.cleaning=!0;return}if(typeof this.worker.terminate==`function`)this.worker.terminate(),this.worker.killed=!0;else throw Error(`Failed to terminate worker`)}a()}},E.prototype.terminateAndNotify=function(e,t){var r=n.defer();return t&&r.promise.timeout(t),this.terminate(e,function(e,t){e?r.reject(e):r.resolve(t)}),r.promise};function ee(e){this.error=e,this.stack=Error().stack}var D=class extends Error{constructor(e,t){super(e||`worker terminated`),this.cause=t}};t.exports=E,t.exports._tryRequireWorkerThreads=f,t.exports._setupProcessWorker=S,t.exports._setupBrowserWorker=b,t.exports._setupWorkerThreadWorker=x,t.exports.ensureWorkerThreads=u,t.exports.TerminateError=D})),b=l(((e,t)=>{function n(){this.tasks=[]}n.prototype.push=function(e){this.tasks.push(e)},n.prototype.pop=function(){return this.tasks.shift()},n.prototype.size=function(){return this.tasks.length},n.prototype.contains=function(e){return this.tasks.includes(e)},n.prototype.clear=function(){this.tasks.length=0};function r(){this.tasks=[]}r.prototype.push=function(e){this.tasks.push(e)},r.prototype.pop=function(){return this.tasks.pop()},r.prototype.size=function(){return this.tasks.length},r.prototype.contains=function(e){return this.tasks.includes(e)},r.prototype.clear=function(){this.tasks.length=0},t.exports={FIFOQueue:n,LIFOQueue:r}})),x=l(((e,t)=>{t.exports=n;function n(){this.ports=Object.create(null),this.length=0}n.prototype.nextAvailableStartingAt=function(e){for(;this.ports[e]===!0;)e++;if(e>=65535)throw Error(`WorkerPool debug port limit reached: `+e+`>= 65535`);return this.ports[e]=!0,this.length++,e},n.prototype.releasePort=function(e){delete this.ports[e],this.length--}})),S=l(((e,t)=>{var{Promise:n}=g(),r=y(),i=h(),{FIFOQueue:a,LIFOQueue:o}=b(),s=new(x());function c(e,t){typeof e==`string`?this.script=e||null:(this.script=null,t=e),this.workers=[],this.taskQueue=this._createQueue(t&&t.queueStrategy||`fifo`),t||={},this.forkArgs=Object.freeze(t.forkArgs||[]),this.forkOpts=Object.freeze(t.forkOpts||{}),this.workerOpts=Object.freeze(t.workerOpts||{}),this.workerThreadOpts=Object.freeze(t.workerThreadOpts||{}),this.debugPortStart=t.debugPortStart||43210,this.nodeWorker=t.nodeWorker,this.workerType=t.workerType||t.nodeWorker||`auto`,this.maxQueueSize=t.maxQueueSize||1/0,this.workerTerminateTimeout=t.workerTerminateTimeout||1e3,this.onCreateWorker=t.onCreateWorker||(()=>null),this.onTerminateWorker=t.onTerminateWorker||(()=>null),this.emitStdStreams=t.emitStdStreams||!1,t&&`maxWorkers`in t?(l(t.maxWorkers),this.maxWorkers=t.maxWorkers):this.maxWorkers=Math.max((i.cpus||4)-1,1),t&&`minWorkers`in t&&(t.minWorkers===`max`?this.minWorkers=this.maxWorkers:(u(t.minWorkers),this.minWorkers=t.minWorkers,this.maxWorkers=Math.max(this.minWorkers,this.maxWorkers)),this._ensureMinWorkers()),this._boundNext=this._next.bind(this),this.workerType===`thread`&&r.ensureWorkerThreads()}c.prototype.exec=function(e,t,r){if(t&&!Array.isArray(t))throw TypeError(`Array expected as argument "params"`);if(typeof e==`string`){var i=n.defer();if(this.taskQueue.size()>=this.maxQueueSize)throw Error(`Max queue size of `+this.maxQueueSize+` reached`);var a={method:e,params:t,resolver:i,timeout:null,options:r};this.taskQueue.push(a);var o=i.promise.timeout,s=this.taskQueue;return i.promise.timeout=function(e){return s.contains(a)?(a.timeout=e,i.promise):o.call(i.promise,e)},this._next(),i.promise}if(typeof e==`function`)return this.exec(`run`,[String(e),t],r);throw TypeError(`Function or string expected as argument "method"`)},c.prototype.proxy=function(){if(arguments.length>0)throw Error(`No arguments expected`);var e=this;return this.exec(`methods`).then(function(t){var n={};return t.forEach(function(t){n[t]=function(){return e.exec(t,Array.prototype.slice.call(arguments))}}),n})},c.prototype._next=function(){if(this.taskQueue.size()>0){var e=this._getWorker();if(e){var t=this,n=this.taskQueue.pop();if(n.resolver.promise.pending){var r=e.exec(n.method,n.params,n.resolver,n.options).then(t._boundNext).catch(function(){if(e.terminated)return t._removeWorker(e)}).then(function(){t._next()});typeof n.timeout==`number`&&r.timeout(n.timeout)}else t._next()}}},c.prototype._getWorker=function(){for(var e=this.workers,t=0;t<e.length;t++){var n=e[t];if(n.busy()===!1)return n}return e.length<this.maxWorkers?(n=this._createWorkerHandler(),e.push(n),n):null},c.prototype._removeWorker=function(e){var t=this;return s.releasePort(e.debugPort),this._removeWorkerFromList(e),this._ensureMinWorkers(),new n(function(n,r){e.terminate(!1,function(i){t.onTerminateWorker({forkArgs:e.forkArgs,forkOpts:e.forkOpts,workerThreadOpts:e.workerThreadOpts,script:e.script}),i?r(i):n(e)})})},c.prototype._removeWorkerFromList=function(e){var t=this.workers.indexOf(e);t!==-1&&this.workers.splice(t,1)},c.prototype.terminate=function(e,t){for(var r=this,i=this.taskQueue;i.size()>0;){var a=i.pop();if(a)a.resolver.reject(Error(`Pool terminated`));else break}i.clear();var o=function(e){s.releasePort(e.debugPort),this._removeWorkerFromList(e)}.bind(this),c=[];return this.workers.slice().forEach(function(n){var i=n.terminateAndNotify(e,t).then(o).always(function(){r.onTerminateWorker({forkArgs:n.forkArgs,forkOpts:n.forkOpts,workerThreadOpts:n.workerThreadOpts,script:n.script})});c.push(i)}),n.all(c)},c.prototype.stats=function(){var e=this.workers.length,t=this.workers.filter(function(e){return e.busy()}).length;return{totalWorkers:e,busyWorkers:t,idleWorkers:e-t,pendingTasks:this.taskQueue.size(),activeTasks:t}},c.prototype._ensureMinWorkers=function(){if(this.minWorkers)for(var e=this.workers.length;e<this.minWorkers;e++)this.workers.push(this._createWorkerHandler())},c.prototype._createWorkerHandler=function(){let e=this.onCreateWorker({forkArgs:this.forkArgs,forkOpts:this.forkOpts,workerOpts:this.workerOpts,workerThreadOpts:this.workerThreadOpts,script:this.script})||{};return new r(e.script||this.script,{forkArgs:e.forkArgs||this.forkArgs,forkOpts:e.forkOpts||this.forkOpts,workerOpts:e.workerOpts||this.workerOpts,workerThreadOpts:e.workerThreadOpts||this.workerThreadOpts,debugPort:s.nextAvailableStartingAt(this.debugPortStart),workerType:this.workerType,workerTerminateTimeout:this.workerTerminateTimeout,emitStdStreams:this.emitStdStreams})},c.prototype._createQueue=function(e){if(typeof e==`string`)switch(e){case`fifo`:return new a;case`lifo`:return new o;default:throw Error(`Unknown queue strategy: `+e)}if(!e)throw Error(`Queue strategy cannot be null or undefined`);for(var t=[`push`,`pop`,`size`,`contains`,`clear`],n=0;n<t.length;n++){var r=t[n];if(typeof e[r]!=`function`)throw Error(`Queue strategy must implement method: `+r)}return e};function l(e){if(!d(e)||!f(e)||e<1)throw TypeError(`Option maxWorkers must be an integer number >= 1`)}function u(e){if(!d(e)||!f(e)||e<0)throw TypeError(`Option minWorkers must be an integer number >= 0`)}function d(e){return typeof e==`number`}function f(e){return Math.round(e)==e}t.exports=c})),C=l(((e,t)=>{function n(e,t){this.message=e,this.transfer=t}t.exports=n})),w=l((e=>{var t=C(),n=g().Promise,r=`__workerpool-terminate__`,i=`__workerpool-cleanup__`,a=1e3,o={exit:function(){}},s={addAbortListener:function(e){o.abortListeners.push(e)},emit:o.emit};if(typeof self<`u`&&typeof postMessage==`function`&&typeof addEventListener==`function`)o.on=function(e,t){addEventListener(e,function(e){t(e.data)})},o.send=function(e,t){t?postMessage(e,t):postMessage(e)};else if(typeof process<`u`){var c;try{c=m()}catch(e){if(!(typeof e==`object`&&e&&e.code===`MODULE_NOT_FOUND`))throw e}if(c&&c.parentPort!==null){var l=c.parentPort;o.send=l.postMessage.bind(l),o.on=l.on.bind(l),o.exit=process.exit.bind(process)}else o.on=process.on.bind(process),o.send=function(e){process.send(e)},o.on(`disconnect`,function(){process.exit(1)}),o.exit=process.exit.bind(process)}else throw Error(`Script must be executed as a worker`);function u(e){return e&&e.toJSON?JSON.parse(JSON.stringify(e)):JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)))}function d(e){return e&&typeof e.then==`function`&&typeof e.catch==`function`}o.methods={},o.methods.run=function(e,t){var n=Function(`return (`+e+`).apply(this, arguments);`);return n.worker=s,n.apply(n,t)},o.methods.methods=function(){return Object.keys(o.methods)},o.terminationHandler=void 0,o.abortListenerTimeout=a,o.abortListeners=[],o.terminateAndExit=function(e){var t=function(){o.exit(e)};if(!o.terminationHandler)return t();var r=o.terminationHandler(e);return d(r)?(r.then(t,t),r):(t(),new n(function(e,t){t(Error(`Worker terminating`))}))},o.cleanup=function(e){if(!o.abortListeners.length)return o.send({id:e,method:i,error:u(Error(`Worker terminating`))}),new n(function(e){e()});var t=function(){o.exit()},r=function(){o.abortListeners.length&&(o.abortListeners=[])};let a=o.abortListeners.map(e=>e()),s,c=new n((e,t)=>{s=setTimeout(function(){t(Error(`Timeout occurred waiting for abort handler, killing worker`))},o.abortListenerTimeout)}),l=n.all(a).then(function(){clearTimeout(s),r()},function(){clearTimeout(s),t()});return new n(function(e,t){l.then(e,t),c.then(e,t)}).then(function(){o.send({id:e,method:i,error:null})},function(t){o.send({id:e,method:i,error:t?u(t):null})})};var f=null;o.on(`message`,function(e){if(e===r)return o.terminateAndExit(0);if(e.method===i)return o.cleanup(e.id);try{var n=o.methods[e.method];if(n){f=e.id;var a=n.apply(n,e.params);d(a)?a.then(function(n){n instanceof t?o.send({id:e.id,result:n.message,error:null},n.transfer):o.send({id:e.id,result:n,error:null}),f=null}).catch(function(t){o.send({id:e.id,result:null,error:u(t)}),f=null}):(a instanceof t?o.send({id:e.id,result:a.message,error:null},a.transfer):o.send({id:e.id,result:a,error:null}),f=null)}else throw Error(`Unknown method "`+e.method+`"`)}catch(t){o.send({id:e.id,result:null,error:u(t)})}}),o.register=function(e,t){if(e)for(var n in e)e.hasOwnProperty(n)&&(o.methods[n]=e[n],o.methods[n].worker=s);t&&(o.terminationHandler=t.onTerminate,o.abortListenerTimeout=t.abortListenerTimeout||a),o.send(`ready`)},o.emit=function(e){if(f){if(e instanceof t){o.send({id:f,isEvent:!0,payload:e.message},e.transfer);return}o.send({id:f,isEvent:!0,payload:e})}},e!==void 0&&(e.add=o.register,e.emit=o.emit)})),T=d(l((e=>{var{platform:t,isMainThread:n,cpus:r}=h(),{TerminateError:i}=y();function a(e,t){return new(S())(e,t)}e.pool=a;function o(e,t){w().add(e,t)}e.worker=o;var{Promise:s}=g();e.Transfer=C()}))(),1),E=5e3,ee=3e4,D=e=>T.pool(e,{maxWorkers:1,minWorkers:0,workerTerminateTimeout:ee,workerOpts:{type:void 0}}),te=class{url;maxWorkerHeapBytes;slots;idleSweepTimer;terminated=!1;constructor(e,t,n){p(t>0,`maxWorkers must be a positive number.`),this.url=e,this.maxWorkerHeapBytes=n?.maxWorkerHeapBytes??268435456,this.slots=Array.from({length:t},()=>({pool:D(e),tasksSinceSpawn:0,inflight:0,draining:!1,probing:!1,lastHeapBytes:void 0}))}exec(e,t,n){let r=this.pickSlot();r.inflight++;try{return r.pool.exec(e,t,n).then(e=>(this.onSettled(r),e)).catch(e=>{throw this.onSettled(r),e})}catch(e){throw this.onSettled(r),e}}warmUp(){let[e,...t]=this.slots;return this.warmSlot(e).then(()=>{for(let e of t)this.warmSlot(e).catch(()=>void 0)},e=>{if(t.length===0)throw e;return Promise.any(t.map(e=>this.warmSlot(e))).then(()=>void 0)})}canAcceptTasks(){return this.slots.some(e=>!e.draining)}stats(){let e={totalWorkers:0,busyWorkers:0,idleWorkers:0,pendingTasks:0,activeTasks:0,tasksSinceSpawn:0};for(let t of this.slots){let n=t.pool.stats();e.totalWorkers+=n.totalWorkers,e.busyWorkers+=n.busyWorkers,e.idleWorkers+=n.idleWorkers,e.pendingTasks+=n.pendingTasks,e.activeTasks+=n.activeTasks,e.tasksSinceSpawn+=t.tasksSinceSpawn}return e}heapStats(){let e=this.slots.map(e=>e.lastHeapBytes);return{perSlot:e,totalBytes:e.reduce((e,t)=>e+(t??0),0),maxWorkerHeapBytes:this.maxWorkerHeapBytes}}probeHeap(){if(!this.terminated)for(let e of this.slots)e.draining||this.probeSlot(e)}terminate(){this.idleSweepTimer!==void 0&&(clearTimeout(this.idleSweepTimer),this.idleSweepTimer=void 0),this.terminated=!0;for(let e of this.slots)e.pool.terminate()}pickSlot(){let e=this.slots.filter(e=>!e.draining);return(e.length>0?e:this.slots).reduce((e,t)=>t.inflight<e.inflight?t:e)}onSettled(e){e.inflight--,!this.terminated&&(e.tasksSinceSpawn++,e.tasksSinceSpawn>=128&&(e.draining=!0),e.draining&&e.inflight===0?this.recycleSlot(e):e.draining||this.probeSlot(e),this.armIdleSweep())}recycleSlot(e){e.pool.terminate(),e.pool=D(this.url),e.tasksSinceSpawn=0,e.draining=!1,e.lastHeapBytes=void 0,this.warmSlot(e).catch(()=>void 0)}warmSlot(e){e.inflight++;let t=()=>{e.inflight--,!this.terminated&&e.draining&&e.inflight===0&&this.recycleSlot(e)};return new Promise((n,r)=>{try{e.pool.exec(`warmUp`).then(()=>{t(),n()}).catch(e=>{t(),r(e)})}catch(e){t(),r(e)}})}probeSlot(e){if(e.probing)return;e.probing=!0,e.inflight++;let t=t=>{e.probing=!1,e.inflight--,!this.terminated&&(t&&(e.draining=!0),e.draining&&e.inflight===0&&this.recycleSlot(e))};try{e.pool.exec(`getWasmMemoryUsage`).then(n=>{typeof n==`number`&&(e.lastHeapBytes=n),t(typeof n==`number`&&n>=this.maxWorkerHeapBytes)}).catch(()=>{t(!0)})}catch{t(!0)}}armIdleSweep(){this.idleSweepTimer!==void 0&&clearTimeout(this.idleSweepTimer),this.idleSweepTimer=setTimeout(()=>{this.idleSweepTimer=void 0;for(let e of this.slots)e.tasksSinceSpawn>0&&e.inflight===0&&this.recycleSlot(e)},E)}};function ne(e){return e!=null}var re=class{x;y;z;constructor(e){this.x=e.x,this.y=e.y,this.z=e.z}},ie=class{vertices;uvs;indices;heights;max_height;min_height;rtc_translation;normals;skirt_vertices;skirt_uvs;skirt_indices;skirt_normals;watermask;constructor(e){this.vertices=e.transferVertices(),this.uvs=e.transferUvs(),this.indices=e.transferIndices(),this.heights=e.transferHeights(),this.max_height=e.max_height,this.min_height=e.min_height,this.rtc_translation=e.rtc_translation?new re(e.rtc_translation):void 0,e.hasNormals()&&(this.normals=e.transferNormals()),e.hasSkirt()&&(this.skirt_vertices=e.transferSkirtVertices(),this.skirt_uvs=e.transferSkirtUvs(),this.skirt_indices=e.transferSkirtIndices(),this.skirt_normals=e.transferSkirtNormals()),e.hasWatermask()&&(this.watermask=e.transferWatermask())}transferVertices(){throw Error()}transferUvs(){throw Error()}transferIndices(){throw Error()}transferHeights(){throw Error()}transferNormals(){throw Error()}transferSkirtVertices(){throw Error()}transferSkirtUvs(){throw Error()}transferSkirtIndices(){throw Error()}transferSkirtNormals(){throw Error()}transferWatermask(){throw Error()}hasSkirt(){return this.skirt_vertices!==void 0&&this.skirt_uvs!==void 0&&this.skirt_indices!==void 0}hasNormals(){return this.normals!==void 0}hasWatermask(){return this.watermask!==void 0}},ae=class{east;north;south;west;constructor(e){this.east=e.east,this.north=e.north,this.south=e.south,this.west=e.west}},oe=class{extent;position_3d_high;position_3d_high_size;position_3d_low;position_3d_low_size;position;position_size;normal;normal_size;scale_normal_and_cap;scale_normal_and_cap_size;batch_id;batch_id_size;batch_index;batch_index_size;indices;rtc_translation;outline_position;outline_position_size;outline_position_3d_high;outline_position_3d_high_size;outline_position_3d_low;outline_position_3d_low_size;outline_scale_normal_and_cap;outline_scale_normal_and_cap_size;outline_skip_indices;outline_batch_index;outline_batch_index_size;constructor(e){let t=e.extent;this.extent=t?new ae(t):void 0,this.position_3d_high=e.position_3d_high()?.slice(),this.position_3d_high_size=e.position_3d_high_size(),this.position_3d_low=e.position_3d_low()?.slice(),this.position_3d_low_size=e.position_3d_low_size(),this.position=e.position()?.slice(),this.position_size=e.position_size(),this.normal=e.normal()?.slice(),this.normal_size=e.normal_size(),this.scale_normal_and_cap=e.scale_normal_and_cap()?.slice(),this.scale_normal_and_cap_size=e.scale_normal_and_cap_size(),this.batch_id=e.batch_id()?.slice(),this.batch_id_size=e.batch_id_size(),this.batch_index=e.batch_index()?.slice(),this.batch_index_size=e.batch_index_size(),this.indices=e.indices().slice(),this.rtc_translation=e.rtc_translation?new re(e.rtc_translation):void 0;let n=e.outline();n&&(this.outline_position=n.position()?.slice(),this.outline_position_size=n.position_size(),this.outline_position_3d_high=n.position_3d_high()?.slice(),this.outline_position_3d_high_size=n.position_3d_high_size(),this.outline_position_3d_low=n.position_3d_low()?.slice(),this.outline_position_3d_low_size=n.position_3d_low_size(),this.outline_scale_normal_and_cap=n.scale_normal_and_cap()?.slice(),this.outline_scale_normal_and_cap_size=n.scale_normal_and_cap_size(),this.outline_skip_indices=n.skip_indices()?.slice(),this.outline_batch_index=n.batch_index()?.slice(),this.outline_batch_index_size=n.batch_index_size(),n.free())}},se=class{extent;position;position_size;position_high;position_high_size;position_low;position_low_size;start;start_size;start_high;start_high_size;start_low;start_low_size;forward_offset;forward_offset_size;end_high;end_high_size;end_low;end_low_size;start_normals;start_normals_size;end_normal_and_texture_coordinate_normalization_x;end_normal_and_texture_coordinate_normalization_x_size;right_normal_and_texture_coordinate_normalization_y;right_normal_and_texture_coordinate_normalization_y_size;batch_id;batch_id_size;batch_index;batch_index_size;indices;constructor(e){let t=e.extent;this.extent=t?new ae(t):void 0,this.position=e.position().slice(),this.position_size=e.position_size(),this.position_high=e.position_high()?.slice(),this.position_high_size=e.position_high_size(),this.position_low=e.position_low()?.slice(),this.position_low_size=e.position_low_size(),this.start=e.start()?.slice(),this.start_size=e.start_size(),this.start_high=e.start_high()?.slice(),this.start_high_size=e.start_high_size(),this.start_low=e.start_low()?.slice(),this.start_low_size=e.start_low_size(),this.forward_offset=e.forward_offset()?.slice(),this.forward_offset_size=e.forward_offset_size(),this.end_high=e.end_high()?.slice(),this.end_high_size=e.end_high_size(),this.end_low=e.end_low()?.slice(),this.end_low_size=e.end_low_size(),this.start_normals=e.start_normals()?.slice(),this.start_normals_size=e.start_normals_size(),this.end_normal_and_texture_coordinate_normalization_x=e.end_normal_and_texture_coordinate_normalization_x()?.slice(),this.end_normal_and_texture_coordinate_normalization_x_size=e.end_normal_and_texture_coordinate_normalization_x_size(),this.right_normal_and_texture_coordinate_normalization_y=e.right_normal_and_texture_coordinate_normalization_y().slice(),this.right_normal_and_texture_coordinate_normalization_y_size=e.right_normal_and_texture_coordinate_normalization_y_size(),this.batch_id=e.batch_id()?.slice(),this.batch_id_size=e.batch_id_size(),this.batch_index=e.batch_index()?.slice(),this.batch_index_size=e.batch_index_size(),this.indices=e.indices().slice()}};function ce(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function le(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ue(e){let t,n,r;e.length===2?(t=e===ce||e===le?e:de,n=e,r=e):(t=ce,n=(t,n)=>ce(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function de(){return 0}function fe(e){return e===null?NaN:+e}var pe=ue(ce);pe.right,pe.left,ue(fe).center;var me={value:()=>{}};function he(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new ge(n)}function ge(e){this._=e}function _e(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}ge.prototype=he.prototype={constructor:ge,on:function(e,t){var n=this._,r=_e(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=ve(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=ye(n[i],e.name,t);else if(t==null)for(i in n)n[i]=ye(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ge(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function ve(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function ye(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=me,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var be={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function xe(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),be.hasOwnProperty(t)?{space:be[t],local:e}:e}function Se(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function Ce(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function we(e){var t=xe(e);return(t.local?Ce:Se)(t)}function Te(){}function Ee(e){return e==null?Te:function(){return this.querySelector(e)}}function De(e){typeof e!=`function`&&(e=Ee(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new k(r,this._parents)}function Oe(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ke(){return[]}function Ae(e){return e==null?ke:function(){return this.querySelectorAll(e)}}function je(e){return function(){return Oe(e.apply(this,arguments))}}function Me(e){e=typeof e==`function`?je(e):Ae(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new k(r,i)}function Ne(e){return function(){return this.matches(e)}}function Pe(e){return function(t){return t.matches(e)}}var Fe=Array.prototype.find;function Ie(e){return function(){return Fe.call(this.children,e)}}function Le(){return this.firstElementChild}function Re(e){return this.select(e==null?Le:Ie(typeof e==`function`?e:Pe(e)))}var ze=Array.prototype.filter;function Be(){return Array.from(this.children)}function Ve(e){return function(){return ze.call(this.children,e)}}function He(e){return this.selectAll(e==null?Be:Ve(typeof e==`function`?e:Pe(e)))}function Ue(e){typeof e!=`function`&&(e=Ne(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new k(r,this._parents)}function We(e){return Array(e.length)}function Ge(){return new k(this._enter||this._groups.map(We),this._parents)}function Ke(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ke.prototype={constructor:Ke,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function qe(e){return function(){return e}}function Je(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Ke(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Ye(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Ke(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Xe(e){return e.__data__}function Ze(e,t){if(!arguments.length)return Array.from(this,Xe);var n=t?Ye:Je,r=this._parents,i=this._groups;typeof e!=`function`&&(e=qe(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=Qe(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new k(o,r),o._enter=s,o._exit=c,o}function Qe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function $e(){return new k(this._exit||this._groups.map(We),this._parents)}function et(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function tt(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new k(s,this._parents)}function nt(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function rt(e){e||=it;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new k(i,this._parents).order()}function it(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function at(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ot(){return Array.from(this)}function st(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function ct(){let e=0;for(let t of this)++e;return e}function lt(){return!this.node()}function ut(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function dt(e){return function(){this.removeAttribute(e)}}function ft(e){return function(){this.removeAttributeNS(e.space,e.local)}}function pt(e,t){return function(){this.setAttribute(e,t)}}function mt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ht(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function gt(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function _t(e,t){var n=xe(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?ft:dt:typeof t==`function`?n.local?gt:ht:n.local?mt:pt)(n,t))}function vt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function yt(e){return function(){this.style.removeProperty(e)}}function bt(e,t,n){return function(){this.style.setProperty(e,t,n)}}function xt(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function St(e,t,n){return arguments.length>1?this.each((t==null?yt:typeof t==`function`?xt:bt)(e,t,n??``)):O(this.node(),e)}function O(e,t){return e.style.getPropertyValue(t)||vt(e).getComputedStyle(e,null).getPropertyValue(t)}function Ct(e){return function(){delete this[e]}}function wt(e,t){return function(){this[e]=t}}function Tt(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Et(e,t){return arguments.length>1?this.each((t==null?Ct:typeof t==`function`?Tt:wt)(e,t)):this.node()[e]}function Dt(e){return e.trim().split(/^|\s+/)}function Ot(e){return e.classList||new kt(e)}function kt(e){this._node=e,this._names=Dt(e.getAttribute(`class`)||``)}kt.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function At(e,t){for(var n=Ot(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function jt(e,t){for(var n=Ot(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Mt(e){return function(){At(this,e)}}function Nt(e){return function(){jt(this,e)}}function Pt(e,t){return function(){(t.apply(this,arguments)?At:jt)(this,e)}}function Ft(e,t){var n=Dt(e+``);if(arguments.length<2){for(var r=Ot(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Pt:t?Mt:Nt)(n,t))}function It(){this.textContent=``}function Lt(e){return function(){this.textContent=e}}function Rt(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function zt(e){return arguments.length?this.each(e==null?It:(typeof e==`function`?Rt:Lt)(e)):this.node().textContent}function Bt(){this.innerHTML=``}function Vt(e){return function(){this.innerHTML=e}}function Ht(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Ut(e){return arguments.length?this.each(e==null?Bt:(typeof e==`function`?Ht:Vt)(e)):this.node().innerHTML}function Wt(){this.nextSibling&&this.parentNode.appendChild(this)}function Gt(){return this.each(Wt)}function Kt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function qt(){return this.each(Kt)}function Jt(e){var t=typeof e==`function`?e:we(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Yt(){return null}function Xt(e,t){var n=typeof e==`function`?e:we(e),r=t==null?Yt:typeof t==`function`?t:Ee(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Zt(){var e=this.parentNode;e&&e.removeChild(this)}function Qt(){return this.each(Zt)}function $t(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function en(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function tn(e){return this.select(e?en:$t)}function nn(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function rn(e){return function(t){e.call(this,t,this.__data__)}}function an(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function on(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function sn(e,t,n){return function(){var r=this.__on,i,a=rn(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function cn(e,t,n){var r=an(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?sn:on,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function ln(e,t,n){var r=vt(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function un(e,t){return function(){return ln(this,e,t)}}function dn(e,t){return function(){return ln(this,e,t.apply(this,arguments))}}function fn(e,t){return this.each((typeof t==`function`?dn:un)(e,t))}function*pn(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var mn=[null];function k(e,t){this._groups=e,this._parents=t}function A(){return new k([[document.documentElement]],mn)}function hn(){return this}k.prototype=A.prototype={constructor:k,select:De,selectAll:Me,selectChild:Re,selectChildren:He,filter:Ue,data:Ze,enter:Ge,exit:$e,join:et,merge:tt,selection:hn,order:nt,sort:rt,call:at,nodes:ot,node:st,size:ct,empty:lt,each:ut,attr:_t,style:St,property:Et,classed:Ft,text:zt,html:Ut,raise:Gt,lower:qt,append:Jt,insert:Xt,remove:Qt,clone:tn,datum:nn,on:cn,dispatch:fn,[Symbol.iterator]:pn};function gn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function _n(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function j(){}var M=.7,vn=1/M,N=`\\s*([+-]?\\d+)\\s*`,P=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,F=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,yn=/^#([0-9a-f]{3,8})$/,bn=RegExp(`^rgb\\(${N},${N},${N}\\)$`),xn=RegExp(`^rgb\\(${F},${F},${F}\\)$`),Sn=RegExp(`^rgba\\(${N},${N},${N},${P}\\)$`),Cn=RegExp(`^rgba\\(${F},${F},${F},${P}\\)$`),wn=RegExp(`^hsl\\(${P},${F},${F}\\)$`),Tn=RegExp(`^hsla\\(${P},${F},${F},${P}\\)$`),En={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};gn(j,I,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Dn,formatHex:Dn,formatHex8:On,formatHsl:kn,formatRgb:An,toString:An});function Dn(){return this.rgb().formatHex()}function On(){return this.rgb().formatHex8()}function kn(){return Bn(this).formatHsl()}function An(){return this.rgb().formatRgb()}function I(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=yn.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?jn(t):n===3?new L(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Mn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Mn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=bn.exec(e))?new L(t[1],t[2],t[3],1):(t=xn.exec(e))?new L(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Sn.exec(e))?Mn(t[1],t[2],t[3],t[4]):(t=Cn.exec(e))?Mn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=wn.exec(e))?zn(t[1],t[2]/100,t[3]/100,1):(t=Tn.exec(e))?zn(t[1],t[2]/100,t[3]/100,t[4]):En.hasOwnProperty(e)?jn(En[e]):e===`transparent`?new L(NaN,NaN,NaN,0):null}function jn(e){return new L(e>>16&255,e>>8&255,e&255,1)}function Mn(e,t,n,r){return r<=0&&(e=t=n=NaN),new L(e,t,n,r)}function Nn(e){return e instanceof j||(e=I(e)),e?(e=e.rgb(),new L(e.r,e.g,e.b,e.opacity)):new L}function Pn(e,t,n,r){return arguments.length===1?Nn(e):new L(e,t,n,r??1)}function L(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}gn(L,Pn,_n(j,{brighter(e){return e=e==null?vn:vn**+e,new L(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?M:M**+e,new L(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new L(R(this.r),R(this.g),R(this.b),Rn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Fn,formatHex:Fn,formatHex8:In,formatRgb:Ln,toString:Ln}));function Fn(){return`#${z(this.r)}${z(this.g)}${z(this.b)}`}function In(){return`#${z(this.r)}${z(this.g)}${z(this.b)}${z((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ln(){let e=Rn(this.opacity);return`${e===1?`rgb(`:`rgba(`}${R(this.r)}, ${R(this.g)}, ${R(this.b)}${e===1?`)`:`, ${e})`}`}function Rn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function R(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function z(e){return e=R(e),(e<16?`0`:``)+e.toString(16)}function zn(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new B(e,t,n,r)}function Bn(e){if(e instanceof B)return new B(e.h,e.s,e.l,e.opacity);if(e instanceof j||(e=I(e)),!e)return new B;if(e instanceof B)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new B(o,s,c,e.opacity)}function Vn(e,t,n,r){return arguments.length===1?Bn(e):new B(e,t,n,r??1)}function B(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}gn(B,Vn,_n(j,{brighter(e){return e=e==null?vn:vn**+e,new B(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?M:M**+e,new B(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new L(Wn(e>=240?e-240:e+120,i,r),Wn(e,i,r),Wn(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new B(Hn(this.h),Un(this.s),Un(this.l),Rn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Rn(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Hn(this.h)}, ${Un(this.s)*100}%, ${Un(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Hn(e){return e=(e||0)%360,e<0?e+360:e}function Un(e){return Math.max(0,Math.min(1,e||0))}function Wn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Gn=e=>()=>e;function Kn(e,t){return function(n){return e+n*t}}function qn(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Jn(e){return(e=+e)==1?Yn:function(t,n){return n-t?qn(t,n,e):Gn(isNaN(t)?n:t)}}function Yn(e,t){var n=t-e;return n?Kn(e,n):Gn(isNaN(e)?t:e)}var Xn=(function e(t){var n=Jn(t);function r(e,t){var r=n((e=Pn(e)).r,(t=Pn(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Yn(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function V(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Zn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qn=new RegExp(Zn.source,`g`);function $n(e){return function(){return e}}function er(e){return function(t){return e(t)+``}}function tr(e,t){var n=Zn.lastIndex=Qn.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Zn.exec(e))&&(i=Qn.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:V(r,i)})),n=Qn.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?er(c[0].x):$n(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}var nr=180/Math.PI,rr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ir(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*nr,skewX:Math.atan(c)*nr,scaleX:o,scaleY:s}}var ar;function or(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?rr:ir(t.a,t.b,t.c,t.d,t.e,t.f)}function sr(e){return e==null||(ar||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),ar.setAttribute(`transform`,e),!(e=ar.transform.baseVal.consolidate()))?rr:(e=e.matrix,ir(e.a,e.b,e.c,e.d,e.e,e.f))}function cr(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:V(e,i)},{i:c-2,x:V(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:V(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:V(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:V(e,n)},{i:s-2,x:V(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var lr=cr(or,`px, `,`px)`,`deg)`),ur=cr(sr,`, `,`)`,`)`),H=0,dr=0,fr=0,pr=1e3,mr,U,hr=0,W=0,gr=0,G=typeof performance==`object`&&performance.now?performance:Date,_r=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function vr(){return W||=(_r(yr),G.now()+gr)}function yr(){W=0}function br(){this._call=this._time=this._next=null}br.prototype=xr.prototype={constructor:br,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?vr():+n)+(t==null?0:+t),!this._next&&U!==this&&(U?U._next=this:mr=this,U=this),this._call=e,this._time=n,Er()},stop:function(){this._call&&(this._call=null,this._time=1/0,Er())}};function xr(e,t,n){var r=new br;return r.restart(e,t,n),r}function Sr(){vr(),++H;for(var e=mr,t;e;)(t=W-e._time)>=0&&e._call.call(void 0,t),e=e._next;--H}function Cr(){W=(hr=G.now())+gr,H=dr=0;try{Sr()}finally{H=0,Tr(),W=0}}function wr(){var e=G.now(),t=e-hr;t>pr&&(gr-=t,hr=e)}function Tr(){for(var e,t=mr,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:mr=n);U=e,Er(r)}function Er(e){H||(dr&&=clearTimeout(dr),e-W>24?(e<1/0&&(dr=setTimeout(Cr,e-G.now()-gr)),fr&&=clearInterval(fr)):(fr||=(hr=G.now(),setInterval(wr,pr)),H=1,_r(Cr)))}function Dr(e,t,n){var r=new br;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Or=he(`start`,`end`,`cancel`,`interrupt`),kr=[];function Ar(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Mr(e,n,{name:t,index:r,group:i,on:Or,tween:kr,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function jr(e,t){var n=q(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function K(e,t){var n=q(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function q(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Mr(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=xr(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return Dr(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(Dr(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Nr(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function Pr(e){return this.each(function(){Nr(this,e)})}function Fr(e,t){var n,r;return function(){var i=K(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Ir(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=K(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function Lr(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=q(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?Fr:Ir)(n,e,t))}function Rr(e,t,n){var r=e._id;return e.each(function(){var e=K(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return q(e,r).value[t]}}function zr(e,t){var n;return(typeof t==`number`?V:t instanceof I?Xn:(n=I(t))?(t=n,Xn):tr)(e,t)}function Br(e){return function(){this.removeAttribute(e)}}function Vr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hr(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Ur(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Wr(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Gr(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Kr(e,t){var n=xe(e),r=n===`transform`?ur:zr;return this.attrTween(e,typeof t==`function`?(n.local?Gr:Wr)(n,r,Rr(this,`attr.`+e,t)):t==null?(n.local?Vr:Br)(n):(n.local?Ur:Hr)(n,r,t))}function qr(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Jr(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Yr(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Jr(e,i)),n}return i._value=t,i}function Xr(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&qr(e,i)),n}return i._value=t,i}function Zr(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=xe(e);return this.tween(n,(r.local?Yr:Xr)(r,t))}function Qr(e,t){return function(){jr(this,e).delay=+t.apply(this,arguments)}}function $r(e,t){return t=+t,function(){jr(this,e).delay=t}}function ei(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Qr:$r)(t,e)):q(this.node(),t).delay}function ti(e,t){return function(){K(this,e).duration=+t.apply(this,arguments)}}function ni(e,t){return t=+t,function(){K(this,e).duration=t}}function ri(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?ti:ni)(t,e)):q(this.node(),t).duration}function ii(e,t){if(typeof t!=`function`)throw Error();return function(){K(this,e).ease=t}}function ai(e){var t=this._id;return arguments.length?this.each(ii(t,e)):q(this.node(),t).ease}function oi(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();K(this,e).ease=n}}function si(e){if(typeof e!=`function`)throw Error();return this.each(oi(this._id,e))}function ci(e){typeof e!=`function`&&(e=Ne(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new J(r,this._parents,this._name,this._id)}function li(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new J(o,this._parents,this._name,this._id)}function ui(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function di(e,t,n){var r,i,a=ui(t)?jr:K;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function fi(e,t){var n=this._id;return arguments.length<2?q(this.node(),n).on.on(e):this.each(di(n,e,t))}function pi(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function mi(){return this.on(`end.remove`,pi(this._id))}function hi(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Ee(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,Ar(l[f],t,n,f,l,q(u,n)));return new J(a,this._parents,t,n)}function gi(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Ae(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=q(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&Ar(p,t,n,h,f,m);a.push(f),o.push(u)}return new J(a,o,t,n)}var _i=A.prototype.constructor;function vi(){return new _i(this._groups,this._parents)}function yi(e,t){var n,r,i;return function(){var a=O(this,e),o=(this.style.removeProperty(e),O(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function bi(e){return function(){this.style.removeProperty(e)}}function xi(e,t,n){var r,i=n+``,a;return function(){var o=O(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function Si(e,t,n){var r,i,a;return function(){var o=O(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),O(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Ci(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=K(this,e),l=c.on,u=c.value[a]==null?s||=bi(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function wi(e,t,n){var r=(e+=``)==`transform`?lr:zr;return t==null?this.styleTween(e,yi(e,r)).on(`end.style.`+e,bi(e)):typeof t==`function`?this.styleTween(e,Si(e,r,Rr(this,`style.`+e,t))).each(Ci(this._id,e)):this.styleTween(e,xi(e,r,t),n).on(`end.style.`+e,null)}function Ti(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Ei(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Ti(e,a,n)),r}return a._value=t,a}function Di(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,Ei(e,t,n??``))}function Oi(e){return function(){this.textContent=e}}function ki(e){return function(){var t=e(this);this.textContent=t??``}}function Ai(e){return this.tween(`text`,typeof e==`function`?ki(Rr(this,`text`,e)):Oi(e==null?``:e+``))}function ji(e){return function(t){this.textContent=e.call(this,t)}}function Mi(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&ji(r)),t}return r._value=e,r}function Ni(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,Mi(e))}function Pi(){for(var e=this._name,t=this._id,n=Li(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=q(c,t);Ar(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new J(r,this._parents,e,n)}function Fi(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=K(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var Ii=0;function J(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Li(){return++Ii}var Y=A.prototype;J.prototype={constructor:J,select:hi,selectAll:gi,selectChild:Y.selectChild,selectChildren:Y.selectChildren,filter:ci,merge:li,selection:vi,transition:Pi,call:Y.call,nodes:Y.nodes,node:Y.node,size:Y.size,empty:Y.empty,each:Y.each,on:fi,attr:Kr,attrTween:Zr,style:wi,styleTween:Di,text:Ai,textTween:Ni,remove:mi,tween:Lr,delay:ei,duration:ri,ease:ai,easeVarying:si,end:Fi,[Symbol.iterator]:Y[Symbol.iterator]};function Ri(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var zi={time:null,delay:0,duration:250,ease:Ri};function Bi(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Vi(e){var t,n;e instanceof J?(t=e._id,e=e._name):(t=Li(),(n=zi).time=vr(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&Ar(c,e,t,l,o,n||Bi(c,t));return new J(r,this._parents,e,t)}A.prototype.interrupt=Pr,A.prototype.transition=Vi;var{abs:Hi,max:Ui,min:Wi}=Math;[`w`,`e`].map(Gi),[`n`,`s`].map(Gi),[`n`,`w`,`e`,`s`,`nw`,`ne`,`sw`,`se`].map(Gi);function Gi(e){return{type:e}}function Ki(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function qi(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Ji(e){return e=qi(Math.abs(e)),e?e[1]:NaN}function Yi(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Xi(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var Zi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Qi(e){if(!(t=Zi.exec(e)))throw Error(`invalid format: `+e);var t;return new $i({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Qi.prototype=$i.prototype;function $i(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}$i.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function ea(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0)}return r>0?e.slice(0,r)+e.slice(i+1):e}var ta;function na(e,t){var n=qi(e,t);if(!n)return ta=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(ta=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+qi(e,Math.max(0,t+a-1))[0]}function ra(e,t){var n=qi(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var ia={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Ki,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>ra(e*100,t),r:ra,s:na,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function aa(e){return e}var oa=Array.prototype.map,sa=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function ca(e){var t=e.grouping===void 0||e.thousands===void 0?aa:Yi(oa.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?aa:Xi(oa.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=Qi(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):ia[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=ia[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=ea(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&ta!==void 0?sa[8+ta/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Ji(t)/3)))*3,r=10**-n,i=l((e=Qi(e),e.type=`f`,e),{suffix:sa[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var la;ua({thousands:`,`,grouping:[3],currency:[`$`,``]});function ua(e){return la=ca(e),la.format,la.formatPrefix,la}function X(e,t,n){this.k=e,this.x=t,this.y=n}X.prototype={constructor:X,scale:function(e){return e===1?this:new X(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new X(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var da=new X(1,0,0);fa.prototype=X.prototype;function fa(e){for(;!e.__zoom;)if(!(e=e.parentNode))return da;return e.__zoom}function pa(e){let t=new oe(e);return{result:t,transfers:[t.batch_id?.buffer,t.batch_index?.buffer,t.normal?.buffer,t.position_3d_high?.buffer,t.position_3d_low?.buffer,t.position?.buffer,t.scale_normal_and_cap?.buffer,t.indices.buffer,t.outline_position?.buffer,t.outline_position_3d_high?.buffer,t.outline_position_3d_low?.buffer,t.outline_scale_normal_and_cap?.buffer,t.outline_skip_indices?.buffer,t.outline_batch_index?.buffer].filter(ne)}}function Z(e){return new n.TransferableTile(ma(e.coords),e.max_height,e.min_height,e.cached_mesh_handle?ha(e.cached_mesh_handle):void 0)}function ma(e){return new n.TileXYZ(e.x,e.y,e.z)}function ha(e){return new n.CachedMeshHandle(e.vertices,e.indices,e.uvs,e.heights)}function ga(e){return new n.UpsamplableTerrainGeometry(e.uvs,e.indices,e.heights,e.normals,e.watermask)}function _a(e){return new n.ExtentRadianF32(e.west,e.south,e.east,e.north)}function va(e){return new n.PolygonMaterial(e.show,e.castShadow,e.receiveShadow,e.color,e.clampToGround,e.tiled,e.height,e.extrudedHeight,e.wireframe,e.outline,e.perPositionHeight,e.__internal__)}function ya(e){let t=new n.TransferablePolygonBatchedFeature(e.crs,e.length);return t.setOuterRing(e.outer_ring.length,t=>{t.set(e.outer_ring)}),t.setOuterRingSizes(e.outer_ring_sizes.length,t=>{t.set(e.outer_ring_sizes)}),t.setHoles(e.holes.length,t=>{t.set(e.holes)}),t.setHolesSizes(e.holes_sizes.length,t=>{t.set(e.holes_sizes)}),t.setHolesTotalSizes(e.holes_total_sizes.length,t=>{t.set(e.holes_total_sizes)}),t.setHolesBoundaries(e.holes_boundaries.length,t=>{t.set(e.holes_boundaries)}),t.setExpectedWindingOrders(e.expected_winding_orders.length,t=>{t.set(e.expected_winding_orders)}),t.setBatchIds(e.batch_ids.length,t=>{t.set(e.batch_ids)}),t.setBatchIndices(e.batch_indices.length,t=>{t.set(e.batch_indices)}),t}var ba;async function Q(){return ba??=(0,n.default)(),ba}async function xa(){if(!ba)return 0;let{memory:e}=await ba;return e.buffer.byteLength}async function Sa(e,t,r,i){await Q();let a=(0,n.constructPolygonBatchedFeature)(ya(e),va(t),r,i?_a(i):void 0);if(!a)return;let{result:o,transfers:s}=pa(a);return a.free(),$(o,s)}function Ca(e){let t=new se(e);return{result:t,transfers:[t.position.buffer,t.position_high?.buffer,t.position_low?.buffer,t.start?.buffer,t.start_high?.buffer,t.start_low?.buffer,t.end_high?.buffer,t.end_low?.buffer,t.start_normals?.buffer,t.forward_offset?.buffer,t.end_normal_and_texture_coordinate_normalization_x?.buffer,t.right_normal_and_texture_coordinate_normalization_y.buffer,t.batch_id?.buffer,t.batch_index?.buffer,t.indices.buffer].filter(ne)}}function wa(e){return new n.PolylineMaterial(e.show,e.castShadow,e.receiveShadow,e.color,e.clampToGround,e.tiled,e.height,e.width,e.maxWidth,e.__internal__)}function Ta(e){let t=new n.TransferablePolylineBatchedFeature(e.crs,e.length);return t.setPoints(e.points.length,t=>{t.set(e.points)}),t.setPointsSizes(e.points_sizes.length,t=>{t.set(e.points_sizes)}),t.setBatchIds(e.batch_ids.length,t=>{t.set(e.batch_ids)}),t.setBatchIndices(e.batch_indices.length,t=>{t.set(e.batch_indices)}),t}async function Ea(e,t,r){await Q();let i=(0,n.constructPolylineBatchedFeature)(Ta(e),wa(t),r);if(!i)return;let{result:a,transfers:o}=Ca(i);return i.free(),$(a,o)}function Da(e){let t=new ie(e),n=[t.vertices.buffer,t.uvs.buffer,t.indices.buffer,t.heights.buffer];return t.normals&&n.push(t.normals.buffer),t.skirt_vertices&&n.push(t.skirt_vertices.buffer),t.skirt_uvs&&n.push(t.skirt_uvs.buffer),t.skirt_indices&&n.push(t.skirt_indices.buffer),t.skirt_normals&&n.push(t.skirt_normals.buffer),t.watermask&&n.push(t.watermask.buffer),{result:t,transfers:n}}async function Oa(e,t,r,i,a,o){await Q();let s=(0,n.constructQuantizedMeshTerrainMesh)(e,Z(t),r,i,a,o),{result:c,transfers:l}=Da(s);return s.free(),$({result:c},[...l])}function ka(e){return new n.TransferableRasterDEMData(new n.ElevationDecoder(e.decoder.r_scaler,e.decoder.g_scaler,e.decoder.b_scaler,e.decoder.offset,e.decoder.max_offset,e.decoder.min_offset,e.decoder.boundary,e.decoder.epsilon))}async function Aa(e,t,r,i,a,o){await Q();let s=i+1,c=n.TransferableMartini.fromSize(s),l=(0,n.constructTerrainMesh)(e,Z(t),ka(r),c,a,o),{result:u,transfers:d}=Da(l);return l.free(),$({result:u},[...d])}async function ja(e){let t=await createImageBitmap(e);try{let e=new OffscreenCanvas(t.width,t.height).getContext(`2d`);if(e===null)throw Error(`failed to get context of canvas`);e.drawImage(t,0,0);let n=e.getImageData(0,0,t.width,t.height).data;return $(n,[n.buffer])}finally{t.close()}}async function Ma(e,t){try{let n=t.getContext(`2d`);if(n===null)throw Error(`failed to get context of canvas`);return n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height).data}finally{e.close()}}async function Na(e,t,r,i,a,o,s){await Q();let c=(0,n.parseMvtTile)(e,t,r,i,a?_a(a):void 0,o,s),l,u,d,f,p;try{l=c.f64_stream(),u=c.f32_stream(),d=c.u32_stream(),f=c.u8_stream(),p=c.meta()}finally{c.free()}return $({f64_stream:l,f32_stream:u,u32_stream:d,u8_stream:f,meta:p},[l.buffer,u.buffer,d.buffer,f.buffer])}async function Pa(e,t,r,i,a,o,s){await Q();let c=(0,n.upsampleQuantizedMeshTerrainMesh)(Z(e),Z(t),ga(r),i,a,o,s),{result:l,transfers:u}=Da(c);return c.free(),$(l,u)}async function Fa(e,t,r,i,a,o,s){await Q();let c=(0,n.upsampleTerrainMesh)(Z(e),Z(t),ka(r),ga(i),a,o,s),{result:l,transfers:u}=Da(c);return c.free(),$(l,u)}async function Ia(){await Q()}var La={constructTerrainMesh:Aa,constructQuantizedMeshTerrainMesh:Oa,upsampleTerrainMesh:Fa,upsampleQuantizedMeshTerrainMesh:Pa,getImageDataFromImageBitmap:Ma,getImageDataFromBlob:ja,constructPolygonBatchedFeature:Sa,constructPolylineBatchedFeature:Ea,parseMvtTile:Na,warmUp:Ia,getWasmMemoryUsage:xa},$=(e,t)=>new T.Transfer(e,t),Ra=!1,za=(...e)=>(Ra||=(T.worker(La),Ba(),!0),T.worker(...e));function Ba(){La.warmUp.worker?.addAbortListener(async()=>{})}var{initializeWorkerPool:Va,terminateWorkerPool:Ha,warmUpWorkerPool:Ua,worker:Wa,workerPoolStats:Ga,workerPoolHeapStats:Ka,probeWorkerPoolHeap:qa}=(()=>{let e;return{initializeWorkerPool:(t,n,r)=>{if(e)throw Error(`Worker pool has already been initialized.`);e={pool:new te(t,n.total,r),manager:n}},terminateWorkerPool:()=>{e&&=(e.pool.terminate(),void 0)},warmUpWorkerPool:()=>(p(e,`initializeWorkerPool() must be invoked first.`),e.pool.warmUp()),worker:()=>(p(e,`initializeWorkerPool() must be invoked first.`),{pool:e.pool,manager:e.manager}),workerPoolStats:()=>e?.pool.stats(),workerPoolHeapStats:()=>e?.pool.heapStats(),probeWorkerPoolHeap:()=>e?.pool.probeHeap()}})(),Ja=()=>{let{pool:e,manager:t}=Wa();return t.canIncrement()&&e.canAcceptTasks()};function Ya(e,t,n){let{pool:r,manager:i}=Wa();i.increment();try{return r.exec(e,t,n).then(e=>(i.decrement(),e)).catch(e=>{throw i.decrement(),e})}catch(e){throw i.decrement(),e}}e.canWorkerProcessImmediately=Ja,e.createConcurrencyManager=e=>{let t=0,n=()=>t!==e,r=()=>t!==0;return{total:e,actives:()=>t,idles:()=>e-t,increment:()=>{n()&&t++},decrement:()=>{r()&&t--},canIncrement:n,canDecrement:r,reset:()=>{t=0}}},e.initializeWorkerPool=Va,e.probeWorkerPoolHeap=qa,e.queueTask=Ya,e.registerTasks=za,e.terminateWorkerPool=Ha,e.transfer=$,e.warmUpWorkerPool=Ua,e.workerPoolHeapStats=Ka,e.workerPoolStats=Ga});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@navaramap/worker",
3
3
  "type": "module",
4
- "version": "0.0.6",
4
+ "version": "0.0.8",
5
5
  "main": "dist/index.umd.cjs",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -20,8 +20,8 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "workerpool": "10.0.3",
23
- "@navaramap/core": "0.0.6",
24
- "@navaramap/engine-worker": "0.0.6"
23
+ "@navaramap/engine-worker": "0.0.8",
24
+ "@navaramap/core": "0.0.8"
25
25
  },
26
26
  "scripts": {
27
27
  "type-check": "tsc && tsc -p tsconfig.node.json",
@@ -17,6 +17,8 @@ export function transferConstructedPolygonGeometry(
17
17
  like.scale_normal_and_cap?.buffer,
18
18
  like.indices.buffer,
19
19
  like.outline_position?.buffer,
20
+ like.outline_position_3d_high?.buffer,
21
+ like.outline_position_3d_low?.buffer,
20
22
  like.outline_scale_normal_and_cap?.buffer,
21
23
  like.outline_skip_indices?.buffer,
22
24
  like.outline_batch_index?.buffer,