aviation-chart 0.1.5 → 0.1.6

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
@@ -6,8 +6,8 @@ function Mt(o, r) {
6
6
  else if (!Rt)
7
7
  Rt = r;
8
8
  else {
9
- var u = "var sharedChunk = {}; (" + vt + ")(sharedChunk); (" + Rt + ")(sharedChunk);", x = {};
10
- vt(x), Ot = r(x), typeof window < "u" && (Ot.workerUrl = window.URL.createObjectURL(
9
+ var u = "var sharedChunk = {}; (" + vt + ")(sharedChunk); (" + Rt + ")(sharedChunk);", g = {};
10
+ vt(g), Ot = r(g), typeof window < "u" && (Ot.workerUrl = window.URL.createObjectURL(
11
11
  new Blob([u], { type: "text/javascript" })
12
12
  ));
13
13
  }
@@ -132,64 +132,64 @@ Mt(["exports"], function(o) {
132
132
  ],
133
133
  []
134
134
  ];
135
- function x(t, e, i, n) {
135
+ function g(t, e, i, n) {
136
136
  return e = e * 2 + n[0], i = i * 2 + n[1], e + i * (t + 1) * 2;
137
137
  }
138
- function p(t, e, i) {
138
+ function y(t, e, i) {
139
139
  return (e - t) / (i - t);
140
140
  }
141
- function y(t, e, i = 4096, n = 1) {
141
+ function x(t, e, i = 4096, n = 1) {
142
142
  if (!t)
143
143
  return {};
144
144
  const a = i / (e.width - 1);
145
145
  let l, s, c, m, d, f;
146
146
  const h = {}, w = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
147
- function R(C, I, A) {
148
- C[0] === 0 ? A(a * (f - 1), a * (d - p(c, I, l))) : C[0] === 2 ? A(a * f, a * (d - p(m, I, s))) : C[1] === 0 ? A(a * (f - p(s, I, l)), a * (d - 1)) : A(a * (f - p(m, I, c)), a * d);
147
+ function P(O, I, R) {
148
+ O[0] === 0 ? R(a * (f - 1), a * (d - y(c, I, l))) : O[0] === 2 ? R(a * f, a * (d - y(m, I, s))) : O[1] === 0 ? R(a * (f - y(s, I, l)), a * (d - 1)) : R(a * (f - y(m, I, c)), a * d);
149
149
  }
150
150
  for (d = 1 - n; d < e.height + n; d++) {
151
151
  s = e.get(0, d - 1), m = e.get(0, d);
152
- let C = Math.min(s, m), I = Math.max(s, m);
152
+ let O = Math.min(s, m), I = Math.max(s, m);
153
153
  for (f = 1 - n; f < e.width + n; f++) {
154
154
  l = s, c = m, s = e.get(f, d - 1), m = e.get(f, d);
155
- const A = C, V = I;
156
- if (C = Math.min(s, m), I = Math.max(s, m), isNaN(l) || isNaN(s) || isNaN(m) || isNaN(c))
155
+ const R = O, V = I;
156
+ if (O = Math.min(s, m), I = Math.max(s, m), isNaN(l) || isNaN(s) || isNaN(m) || isNaN(c))
157
157
  continue;
158
- const ht = Math.min(A, C), pt = Math.max(V, I), X = Math.ceil(ht / t) * t, ot = Math.floor(pt / t) * t;
159
- for (let k = X; k <= ot; k += t) {
160
- const At = l > k, q = s > k, nt = c > k, bt = m > k;
161
- for (const _t of u[(At ? 8 : 0) | (q ? 4 : 0) | (bt ? 2 : 0) | (nt ? 1 : 0)]) {
162
- let Y = w.get(k);
163
- Y || w.set(k, Y = /* @__PURE__ */ new Map());
164
- let lt = E.get(k);
165
- lt || E.set(k, lt = /* @__PURE__ */ new Map());
166
- const kt = _t[0], zt = _t[1], yt = x(e.width, f, d, kt), st = x(e.width, f, d, zt);
158
+ const ht = Math.min(R, O), pt = Math.max(V, I), X = Math.ceil(ht / t) * t, ot = Math.floor(pt / t) * t;
159
+ for (let C = X; C <= ot; C += t) {
160
+ const At = l > C, q = s > C, nt = c > C, _t = m > C;
161
+ for (const bt of u[(At ? 8 : 0) | (q ? 4 : 0) | (_t ? 2 : 0) | (nt ? 1 : 0)]) {
162
+ let Y = w.get(C);
163
+ Y || w.set(C, Y = /* @__PURE__ */ new Map());
164
+ let lt = E.get(C);
165
+ lt || E.set(C, lt = /* @__PURE__ */ new Map());
166
+ const kt = bt[0], zt = bt[1], yt = g(e.width, f, d, kt), st = g(e.width, f, d, zt);
167
167
  let L, Tt;
168
168
  if (L = lt.get(yt))
169
169
  if (lt.delete(yt), Tt = Y.get(st))
170
170
  if (Y.delete(st), L === Tt) {
171
- if (R(zt, k, L.append), !L.isEmpty()) {
172
- let rt = h[k];
173
- rt || (h[k] = rt = []), rt.push(L.lineString());
171
+ if (P(zt, C, L.append), !L.isEmpty()) {
172
+ let rt = h[C];
173
+ rt || (h[C] = rt = []), rt.push(L.lineString());
174
174
  }
175
175
  } else
176
176
  L.appendFragment(Tt), lt.set(L.end = Tt.end, L);
177
177
  else
178
- R(zt, k, L.append), lt.set(L.end = st, L);
178
+ P(zt, C, L.append), lt.set(L.end = st, L);
179
179
  else if (L = Y.get(st))
180
- Y.delete(st), R(kt, k, L.prepend), Y.set(L.start = yt, L);
180
+ Y.delete(st), P(kt, C, L.prepend), Y.set(L.start = yt, L);
181
181
  else {
182
182
  const rt = new r(yt, st);
183
- R(kt, k, rt.append), R(zt, k, rt.append), Y.set(yt, rt), lt.set(st, rt);
183
+ P(kt, C, rt.append), P(zt, C, rt.append), Y.set(yt, rt), lt.set(st, rt);
184
184
  }
185
185
  }
186
186
  }
187
187
  }
188
188
  }
189
- for (const [C, I] of w.entries()) {
190
- let A = null;
189
+ for (const [O, I] of w.entries()) {
190
+ let R = null;
191
191
  for (const V of I.values())
192
- V.isEmpty() || (A == null && (A = h[C] || (h[C] = [])), A.push(V.lineString()));
192
+ V.isEmpty() || (R == null && (R = h[O] || (h[O] = [])), R.push(V.lineString()));
193
193
  }
194
194
  return h;
195
195
  }
@@ -200,10 +200,10 @@ Mt(["exports"], function(o) {
200
200
  function F(t) {
201
201
  return b(t).map(([e, i]) => [e, ...typeof i == "number" ? [i] : i].join("*")).join("~");
202
202
  }
203
- function M(t) {
203
+ function k(t) {
204
204
  return Object.fromEntries(t.split("~").map((e) => e.split("*").map(Number)).map(([e, ...i]) => [e, i]));
205
205
  }
206
- function P({ thresholds: t, ...e }) {
206
+ function A({ thresholds: t, ...e }) {
207
207
  return b({ thresholds: F(t), ...e }).map(([i, n]) => `${encodeURIComponent(i)}=${encodeURIComponent(n)}`).join("&");
208
208
  }
209
209
  function z(t) {
@@ -212,7 +212,7 @@ Mt(["exports"], function(o) {
212
212
  let a = i[1];
213
213
  switch (n) {
214
214
  case "thresholds":
215
- a = M(a);
215
+ a = k(a);
216
216
  break;
217
217
  case "extent":
218
218
  case "multiplier":
@@ -223,7 +223,7 @@ Mt(["exports"], function(o) {
223
223
  return [n, a];
224
224
  }));
225
225
  }
226
- function g(t) {
226
+ function p(t) {
227
227
  return b(t).map(([e, i]) => `${encodeURIComponent(e)}=${encodeURIComponent(i)}`).join(",");
228
228
  }
229
229
  function _(t, e) {
@@ -247,7 +247,7 @@ Mt(["exports"], function(o) {
247
247
  return e && (a = new Float32Array(i.length), a.set(i)), { ...n, data: a, transferrables: [a.buffer] };
248
248
  });
249
249
  }
250
- function O(t) {
250
+ function M(t) {
251
251
  return t.then(({ arrayBuffer: e }) => {
252
252
  const i = v(e);
253
253
  return {
@@ -421,7 +421,7 @@ Mt(["exports"], function(o) {
421
421
  if (a <= 1)
422
422
  return this;
423
423
  const s = 0.5 - 1 / (2 * a), c = (m, d) => {
424
- const f = m / a - s, h = d / a - s, w = Math.floor(f), E = Math.floor(h), R = this.get(w, E), C = this.get(w + 1, E), I = this.get(w, E + 1), A = this.get(w + 1, E + 1), V = f - w, ht = h - E, pt = l(R, C, V), X = l(I, A, V);
424
+ const f = m / a - s, h = d / a - s, w = Math.floor(f), E = Math.floor(h), P = this.get(w, E), O = this.get(w + 1, E), I = this.get(w, E + 1), R = this.get(w + 1, E + 1), V = f - w, ht = h - E, pt = l(P, O, V), X = l(I, R, V);
425
425
  return l(pt, X, ht);
426
426
  };
427
427
  return new $(this.width * a, this.height * a, c);
@@ -488,12 +488,12 @@ Mt(["exports"], function(o) {
488
488
  }
489
489
  return (E ? -1 : 1) * s * Math.pow(2, l - n);
490
490
  }, Et.write = function(t, e, i, n, a, l) {
491
- var s, c, m, d = l * 8 - a - 1, f = (1 << d) - 1, h = f >> 1, w = a === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, E = n ? 0 : l - 1, R = n ? 1 : -1, C = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
492
- for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (c = isNaN(e) ? 1 : 0, s = f) : (s = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -s)) < 1 && (s--, m *= 2), s + h >= 1 ? e += w / m : e += w * Math.pow(2, 1 - h), e * m >= 2 && (s++, m /= 2), s + h >= f ? (c = 0, s = f) : s + h >= 1 ? (c = (e * m - 1) * Math.pow(2, a), s = s + h) : (c = e * Math.pow(2, h - 1) * Math.pow(2, a), s = 0)); a >= 8; t[i + E] = c & 255, E += R, c /= 256, a -= 8)
491
+ var s, c, m, d = l * 8 - a - 1, f = (1 << d) - 1, h = f >> 1, w = a === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, E = n ? 0 : l - 1, P = n ? 1 : -1, O = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
492
+ for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (c = isNaN(e) ? 1 : 0, s = f) : (s = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -s)) < 1 && (s--, m *= 2), s + h >= 1 ? e += w / m : e += w * Math.pow(2, 1 - h), e * m >= 2 && (s++, m /= 2), s + h >= f ? (c = 0, s = f) : s + h >= 1 ? (c = (e * m - 1) * Math.pow(2, a), s = s + h) : (c = e * Math.pow(2, h - 1) * Math.pow(2, a), s = 0)); a >= 8; t[i + E] = c & 255, E += P, c /= 256, a -= 8)
493
493
  ;
494
- for (s = s << a | c, d += a; d > 0; t[i + E] = s & 255, E += R, s /= 256, d -= 8)
494
+ for (s = s << a | c, d += a; d > 0; t[i + E] = s & 255, E += P, s /= 256, d -= 8)
495
495
  ;
496
- t[i + E - R] |= C * 128;
496
+ t[i + E - P] |= O * 128;
497
497
  };
498
498
  var ne = T, gt = Et;
499
499
  function T(t) {
@@ -557,7 +557,7 @@ Mt(["exports"], function(o) {
557
557
  },
558
558
  readString: function() {
559
559
  var t = this.readVarint() + this.pos, e = this.pos;
560
- return this.pos = t, t - e >= le && Bt ? ze(this.buf, e, t) : _e(this.buf, e, t);
560
+ return this.pos = t, t - e >= le && Bt ? ze(this.buf, e, t) : be(this.buf, e, t);
561
561
  },
562
562
  readBytes: function() {
563
563
  var t = this.readVarint() + this.pos, e = this.buf.subarray(this.pos, t);
@@ -719,7 +719,7 @@ Mt(["exports"], function(o) {
719
719
  e.length && this.writeMessage(t, we, e);
720
720
  },
721
721
  writePackedSFixed64: function(t, e) {
722
- e.length && this.writeMessage(t, be, e);
722
+ e.length && this.writeMessage(t, _e, e);
723
723
  },
724
724
  writeBytesField: function(t, e) {
725
725
  this.writeTag(t, T.Bytes), this.writeBytes(e);
@@ -808,7 +808,7 @@ Mt(["exports"], function(o) {
808
808
  function we(t, e) {
809
809
  for (var i = 0; i < t.length; i++) e.writeFixed64(t[i]);
810
810
  }
811
- function be(t, e) {
811
+ function _e(t, e) {
812
812
  for (var i = 0; i < t.length; i++) e.writeSFixed64(t[i]);
813
813
  }
814
814
  function wt(t, e) {
@@ -820,7 +820,7 @@ Mt(["exports"], function(o) {
820
820
  function Nt(t, e) {
821
821
  return (t[e] | t[e + 1] << 8 | t[e + 2] << 16) + (t[e + 3] << 24);
822
822
  }
823
- function _e(t, e, i) {
823
+ function be(t, e, i) {
824
824
  for (var n = "", a = e; a < i; ) {
825
825
  var l = t[a], s = null, c = l > 239 ? 4 : l > 223 ? 3 : l > 191 ? 2 : 1;
826
826
  if (a + c > i) break;
@@ -934,12 +934,12 @@ Mt(["exports"], function(o) {
934
934
  constructor(e, i, n, a, l) {
935
935
  this.loaded = Promise.resolve(), this.decodeImage = It, this.fetchAndParseTile = (s, c, m, d, f) => {
936
936
  const h = this, w = this.demUrlPattern.replace("{z}", s.toString()).replace("{x}", c.toString()).replace("{y}", m.toString());
937
- return f == null || f.useTile(w), this.parsedCache.get(w, async (E, R) => {
938
- const C = await h.fetchTile(s, c, m, R, f);
939
- if (B(R))
937
+ return f == null || f.useTile(w), this.parsedCache.get(w, async (E, P) => {
938
+ const O = await h.fetchTile(s, c, m, P, f);
939
+ if (B(P))
940
940
  throw new Error("canceled");
941
- const I = h.decodeImage(C.data, h.encoding, R), A = f == null ? void 0 : f.marker("decode"), V = await I;
942
- return A == null || A(), V;
941
+ const I = h.decodeImage(O.data, h.encoding, P), R = f == null ? void 0 : f.marker("decode"), V = await I;
942
+ return R == null || R(), V;
943
943
  }, d);
944
944
  }, this.tileCache = new Z(i), this.parsedCache = new Z(i), this.contourCache = new Z(i), this.timeoutMs = l, this.demUrlPattern = e, this.encoding = n, this.maxzoom = a;
945
945
  }
@@ -967,40 +967,40 @@ Mt(["exports"], function(o) {
967
967
  return $.fromRawDem(w).split(m, i % d, n % d);
968
968
  }
969
969
  fetchContourTile(e, i, n, a, l, s) {
970
- const { levels: c, multiplier: m = 1, buffer: d = 1, extent: f = 4096, contourLayer: h = "contours", elevationKey: w = "ele", levelKey: E = "level", subsampleBelow: R = 100 } = a;
970
+ const { levels: c, multiplier: m = 1, buffer: d = 1, extent: f = 4096, contourLayer: h = "contours", elevationKey: w = "ele", levelKey: E = "level", subsampleBelow: P = 100 } = a;
971
971
  if (!c || c.length === 0)
972
972
  return Promise.resolve({ arrayBuffer: new ArrayBuffer(0) });
973
- const C = [e, i, n, g(a)].join("/");
974
- return this.contourCache.get(C, async (I, A) => {
973
+ const O = [e, i, n, p(a)].join("/");
974
+ return this.contourCache.get(O, async (I, R) => {
975
975
  const V = 1 << e, ht = [];
976
976
  for (let q = n - 1; q <= n + 1; q++)
977
977
  for (let nt = i - 1; nt <= i + 1; nt++)
978
- ht.push(q < 0 || q >= V ? void 0 : this.fetchDem(e, (nt + V) % V, q, a, A, s));
978
+ ht.push(q < 0 || q >= V ? void 0 : this.fetchDem(e, (nt + V) % V, q, a, R, s));
979
979
  const pt = await Promise.all(ht);
980
980
  let X = $.combineNeighbors(pt);
981
- if (!X || B(A))
981
+ if (!X || B(R))
982
982
  return { arrayBuffer: new Uint8Array().buffer };
983
983
  const ot = s == null ? void 0 : s.marker("isoline");
984
- if (X.width >= R)
984
+ if (X.width >= P)
985
985
  X = X.materialize(2);
986
986
  else
987
- for (; X.width < R; )
987
+ for (; X.width < P; )
988
988
  X = X.subsamplePixelCenters(2).materialize(2);
989
989
  X = X.averagePixelCentersToGrid().scaleElevation(m).materialize(1);
990
- const k = y(c[0], X, f, d);
990
+ const C = x(c[0], X, f, d);
991
991
  ot == null || ot();
992
992
  const At = De({
993
993
  extent: f,
994
994
  layers: {
995
995
  [h]: {
996
- features: Object.entries(k).map(([q, nt]) => {
997
- const bt = Number(q);
996
+ features: Object.entries(C).map(([q, nt]) => {
997
+ const _t = Number(q);
998
998
  return {
999
999
  type: ft.LINESTRING,
1000
1000
  geometry: nt,
1001
1001
  properties: {
1002
- [w]: bt,
1003
- [E]: Math.max(...c.map((_t, Y) => bt % _t === 0 ? Y : 0))
1002
+ [w]: _t,
1003
+ [E]: Math.max(...c.map((bt, Y) => _t % bt === 0 ? Y : 0))
1004
1004
  }
1005
1005
  };
1006
1006
  })
@@ -1131,51 +1131,51 @@ Mt(["exports"], function(o) {
1131
1131
  }), G(this.timeoutMs, c, n);
1132
1132
  }
1133
1133
  }
1134
- o.A = Ge, o.H = $, o.L = Re, o.T = Wt, o.a = z, o.b = y, o.c = Dt, o.d = It, o.e = P, o.f = O, o.g = _, o.p = S;
1134
+ o.A = Ge, o.H = $, o.L = Re, o.T = Wt, o.a = z, o.b = x, o.c = Dt, o.d = It, o.e = A, o.f = M, o.g = _, o.p = S;
1135
1135
  });
1136
1136
  Mt(["./shared"], function(o) {
1137
- const r = (p) => Promise.reject(new Error(`No manager registered for ${p}`));
1137
+ const r = (y) => Promise.reject(new Error(`No manager registered for ${y}`));
1138
1138
  class u {
1139
1139
  constructor() {
1140
- this.managers = {}, this.init = (y, b) => (this.managers[y.managerId] = new o.L(y.demUrlPattern, y.cacheSize, y.encoding, y.maxzoom, y.timeoutMs), Promise.resolve()), this.fetchTile = (y, b, F, M, P, z) => {
1141
- var g;
1142
- return ((g = this.managers[y]) === null || g === void 0 ? void 0 : g.fetchTile(b, F, M, P, z)) || r(y);
1143
- }, this.fetchAndParseTile = (y, b, F, M, P, z) => {
1144
- var g;
1145
- return o.p(((g = this.managers[y]) === null || g === void 0 ? void 0 : g.fetchAndParseTile(b, F, M, P, z)) || r(y), !0);
1146
- }, this.fetchContourTile = (y, b, F, M, P, z, g) => {
1140
+ this.managers = {}, this.init = (x, b) => (this.managers[x.managerId] = new o.L(x.demUrlPattern, x.cacheSize, x.encoding, x.maxzoom, x.timeoutMs), Promise.resolve()), this.fetchTile = (x, b, F, k, A, z) => {
1141
+ var p;
1142
+ return ((p = this.managers[x]) === null || p === void 0 ? void 0 : p.fetchTile(b, F, k, A, z)) || r(x);
1143
+ }, this.fetchAndParseTile = (x, b, F, k, A, z) => {
1144
+ var p;
1145
+ return o.p(((p = this.managers[x]) === null || p === void 0 ? void 0 : p.fetchAndParseTile(b, F, k, A, z)) || r(x), !0);
1146
+ }, this.fetchContourTile = (x, b, F, k, A, z, p) => {
1147
1147
  var _;
1148
- return o.f(((_ = this.managers[y]) === null || _ === void 0 ? void 0 : _.fetchContourTile(b, F, M, P, z, g)) || r(y));
1148
+ return o.f(((_ = this.managers[x]) === null || _ === void 0 ? void 0 : _.fetchContourTile(b, F, k, A, z, p)) || r(x));
1149
1149
  };
1150
1150
  }
1151
1151
  }
1152
- const x = typeof self < "u" ? self : typeof window < "u" ? window : global;
1153
- x.actor = new o.A(x, new u());
1152
+ const g = typeof self < "u" ? self : typeof window < "u" ? window : global;
1153
+ g.actor = new o.A(g, new u());
1154
1154
  });
1155
1155
  Mt(["./shared"], function(o) {
1156
1156
  const r = { workerUrl: "" };
1157
- let u, x = 0;
1158
- class p {
1157
+ let u, g = 0;
1158
+ class y {
1159
1159
  constructor() {
1160
1160
  this.decodeImage = (_, v, S) => o.p(o.d(_, v, S), !1);
1161
1161
  }
1162
1162
  }
1163
- function y() {
1163
+ function x() {
1164
1164
  if (!u) {
1165
- const g = new Worker(r.workerUrl), _ = new p();
1166
- u = new o.A(g, _);
1165
+ const p = new Worker(r.workerUrl), _ = new y();
1166
+ u = new o.A(p, _);
1167
1167
  }
1168
1168
  return u;
1169
1169
  }
1170
1170
  class b {
1171
- constructor(_, v, S, O, j, ct) {
1171
+ constructor(_, v, S, M, j, ct) {
1172
1172
  this.fetchTile = (H, G, U, B, D) => this.actor.send("fetchTile", [], B, D, this.managerId, H, G, U), this.fetchAndParseTile = (H, G, U, B, D) => this.actor.send("fetchAndParseTile", [], B, D, this.managerId, H, G, U), this.fetchContourTile = (H, G, U, B, D, Z) => this.actor.send("fetchContourTile", [], D, Z, this.managerId, H, G, U, B);
1173
- const tt = this.managerId = ++x;
1174
- this.actor = ct || y(), this.loaded = this.actor.send("init", [], new AbortController(), void 0, {
1173
+ const tt = this.managerId = ++g;
1174
+ this.actor = ct || x(), this.loaded = this.actor.send("init", [], new AbortController(), void 0, {
1175
1175
  cacheSize: v,
1176
1176
  demUrlPattern: _,
1177
1177
  encoding: S,
1178
- maxzoom: O,
1178
+ maxzoom: M,
1179
1179
  managerId: tt,
1180
1180
  timeoutMs: j
1181
1181
  });
@@ -1184,22 +1184,22 @@ Mt(["./shared"], function(o) {
1184
1184
  Blob.prototype.arrayBuffer || (Blob.prototype.arrayBuffer = function() {
1185
1185
  return new Promise((_, v) => {
1186
1186
  const S = new FileReader();
1187
- S.onload = (O) => {
1187
+ S.onload = (M) => {
1188
1188
  var j;
1189
- return _((j = O.target) === null || j === void 0 ? void 0 : j.result);
1189
+ return _((j = M.target) === null || j === void 0 ? void 0 : j.result);
1190
1190
  }, S.onerror = v, S.readAsArrayBuffer(this);
1191
1191
  });
1192
1192
  });
1193
- const F = (g) => (_, v) => {
1193
+ const F = (p) => (_, v) => {
1194
1194
  if (v instanceof AbortController)
1195
- return g(_, v);
1195
+ return p(_, v);
1196
1196
  {
1197
1197
  const S = new AbortController();
1198
- return g(_, S).then((O) => v(void 0, O.data, O.cacheControl, O.expires), (O) => v(O)), { cancel: () => S.abort() };
1198
+ return p(_, S).then((M) => v(void 0, M.data, M.cacheControl, M.expires), (M) => v(M)), { cancel: () => S.abort() };
1199
1199
  }
1200
- }, M = /* @__PURE__ */ new Set();
1201
- class P {
1202
- constructor({ url: _, cacheSize: v = 100, id: S = "dem", encoding: O = "terrarium", maxzoom: j = 12, worker: ct = !0, timeoutMs: tt = 1e4, actor: H }) {
1200
+ }, k = /* @__PURE__ */ new Set();
1201
+ class A {
1202
+ constructor({ url: _, cacheSize: v = 100, id: S = "dem", encoding: M = "terrarium", maxzoom: j = 12, worker: ct = !0, timeoutMs: tt = 1e4, actor: H }) {
1203
1203
  this.timingCallbacks = [], this.onTiming = (D) => {
1204
1204
  this.timingCallbacks.push(D);
1205
1205
  }, this.setupMaplibre = (D) => {
@@ -1232,28 +1232,28 @@ Mt(["./shared"], function(o) {
1232
1232
  }
1233
1233
  }, this.contourProtocol = F(this.contourProtocolV4), this.sharedDemProtocol = F(this.sharedDemProtocolV4), this.contourProtocolUrl = (D) => `${this.contourProtocolUrlBase}?${o.e(D)}`;
1234
1234
  let G = S, U = 1;
1235
- for (; M.has(G); )
1235
+ for (; k.has(G); )
1236
1236
  G = S + U++;
1237
- M.add(G), this.sharedDemProtocolId = `${G}-shared`, this.contourProtocolId = `${G}-contour`, this.sharedDemProtocolUrl = `${this.sharedDemProtocolId}://{z}/{x}/{y}`, this.contourProtocolUrlBase = `${this.contourProtocolId}://{z}/{x}/{y}`;
1237
+ k.add(G), this.sharedDemProtocolId = `${G}-shared`, this.contourProtocolId = `${G}-contour`, this.sharedDemProtocolUrl = `${this.sharedDemProtocolId}://{z}/{x}/{y}`, this.contourProtocolUrlBase = `${this.contourProtocolId}://{z}/{x}/{y}`;
1238
1238
  const B = ct ? b : o.L;
1239
- this.manager = new B(_, v, O, j, tt, H);
1239
+ this.manager = new B(_, v, M, j, tt, H);
1240
1240
  }
1241
- getDemTile(_, v, S, O) {
1242
- return this.manager.fetchAndParseTile(_, v, S, O || new AbortController());
1241
+ getDemTile(_, v, S, M) {
1242
+ return this.manager.fetchAndParseTile(_, v, S, M || new AbortController());
1243
1243
  }
1244
1244
  parseUrl(_) {
1245
- const [, v, S, O] = /\/\/(\d+)\/(\d+)\/(\d+)/.exec(_) || [];
1246
- return [Number(v), Number(S), Number(O)];
1245
+ const [, v, S, M] = /\/\/(\d+)\/(\d+)\/(\d+)/.exec(_) || [];
1246
+ return [Number(v), Number(S), Number(M)];
1247
1247
  }
1248
1248
  }
1249
1249
  return {
1250
1250
  generateIsolines: o.b,
1251
- DemSource: P,
1251
+ DemSource: A,
1252
1252
  HeightTile: o.H,
1253
1253
  LocalDemManager: o.L,
1254
1254
  decodeParsedImage: o.c,
1255
- set workerUrl(g) {
1256
- r.workerUrl = g;
1255
+ set workerUrl(p) {
1256
+ r.workerUrl = p;
1257
1257
  },
1258
1258
  get workerUrl() {
1259
1259
  return r.workerUrl;
@@ -1266,16 +1266,16 @@ function Xe(o) {
1266
1266
  }
1267
1267
  function Ne(o) {
1268
1268
  if (o == null) return Xe;
1269
- var r, u, x = o.scale[0], p = o.scale[1], y = o.translate[0], b = o.translate[1];
1270
- return function(F, M) {
1271
- M || (r = u = 0);
1272
- var P = 2, z = F.length, g = new Array(z);
1273
- for (g[0] = (r += F[0]) * x + y, g[1] = (u += F[1]) * p + b; P < z; ) g[P] = F[P], ++P;
1274
- return g;
1269
+ var r, u, g = o.scale[0], y = o.scale[1], x = o.translate[0], b = o.translate[1];
1270
+ return function(F, k) {
1271
+ k || (r = u = 0);
1272
+ var A = 2, z = F.length, p = new Array(z);
1273
+ for (p[0] = (r += F[0]) * g + x, p[1] = (u += F[1]) * y + b; A < z; ) p[A] = F[A], ++A;
1274
+ return p;
1275
1275
  };
1276
1276
  }
1277
1277
  function Ve(o, r) {
1278
- for (var u, x = o.length, p = x - r; p < --x; ) u = o[p], o[p++] = o[x], o[x] = u;
1278
+ for (var u, g = o.length, y = g - r; y < --g; ) u = o[y], o[y++] = o[g], o[g] = u;
1279
1279
  }
1280
1280
  function $t(o, r) {
1281
1281
  return typeof r == "string" && (r = o.objects[r]), r.type === "GeometryCollection" ? { type: "FeatureCollection", features: r.geometries.map(function(u) {
@@ -1283,41 +1283,41 @@ function $t(o, r) {
1283
1283
  }) } : Kt(o, r);
1284
1284
  }
1285
1285
  function Kt(o, r) {
1286
- var u = r.id, x = r.bbox, p = r.properties == null ? {} : r.properties, y = Ue(o, r);
1287
- return u == null && x == null ? { type: "Feature", properties: p, geometry: y } : x == null ? { type: "Feature", id: u, properties: p, geometry: y } : { type: "Feature", id: u, bbox: x, properties: p, geometry: y };
1286
+ var u = r.id, g = r.bbox, y = r.properties == null ? {} : r.properties, x = Ue(o, r);
1287
+ return u == null && g == null ? { type: "Feature", properties: y, geometry: x } : g == null ? { type: "Feature", id: u, properties: y, geometry: x } : { type: "Feature", id: u, bbox: g, properties: y, geometry: x };
1288
1288
  }
1289
1289
  function Ue(o, r) {
1290
- var u = Ne(o.transform), x = o.arcs;
1291
- function p(z, g) {
1292
- g.length && g.pop();
1293
- for (var _ = x[z < 0 ? ~z : z], v = 0, S = _.length; v < S; ++v)
1294
- g.push(u(_[v], v));
1295
- z < 0 && Ve(g, S);
1296
- }
1297
- function y(z) {
1290
+ var u = Ne(o.transform), g = o.arcs;
1291
+ function y(z, p) {
1292
+ p.length && p.pop();
1293
+ for (var _ = g[z < 0 ? ~z : z], v = 0, S = _.length; v < S; ++v)
1294
+ p.push(u(_[v], v));
1295
+ z < 0 && Ve(p, S);
1296
+ }
1297
+ function x(z) {
1298
1298
  return u(z);
1299
1299
  }
1300
1300
  function b(z) {
1301
- for (var g = [], _ = 0, v = z.length; _ < v; ++_) p(z[_], g);
1302
- return g.length < 2 && g.push(g[0]), g;
1301
+ for (var p = [], _ = 0, v = z.length; _ < v; ++_) y(z[_], p);
1302
+ return p.length < 2 && p.push(p[0]), p;
1303
1303
  }
1304
1304
  function F(z) {
1305
- for (var g = b(z); g.length < 4; ) g.push(g[0]);
1306
- return g;
1305
+ for (var p = b(z); p.length < 4; ) p.push(p[0]);
1306
+ return p;
1307
1307
  }
1308
- function M(z) {
1308
+ function k(z) {
1309
1309
  return z.map(F);
1310
1310
  }
1311
- function P(z) {
1312
- var g = z.type, _;
1313
- switch (g) {
1311
+ function A(z) {
1312
+ var p = z.type, _;
1313
+ switch (p) {
1314
1314
  case "GeometryCollection":
1315
- return { type: g, geometries: z.geometries.map(P) };
1315
+ return { type: p, geometries: z.geometries.map(A) };
1316
1316
  case "Point":
1317
- _ = y(z.coordinates);
1317
+ _ = x(z.coordinates);
1318
1318
  break;
1319
1319
  case "MultiPoint":
1320
- _ = z.coordinates.map(y);
1320
+ _ = z.coordinates.map(x);
1321
1321
  break;
1322
1322
  case "LineString":
1323
1323
  _ = b(z.arcs);
@@ -1326,17 +1326,17 @@ function Ue(o, r) {
1326
1326
  _ = z.arcs.map(b);
1327
1327
  break;
1328
1328
  case "Polygon":
1329
- _ = M(z.arcs);
1329
+ _ = k(z.arcs);
1330
1330
  break;
1331
1331
  case "MultiPolygon":
1332
- _ = z.arcs.map(M);
1332
+ _ = z.arcs.map(k);
1333
1333
  break;
1334
1334
  default:
1335
1335
  return null;
1336
1336
  }
1337
- return { type: g, coordinates: _ };
1337
+ return { type: p, coordinates: _ };
1338
1338
  }
1339
- return P(r);
1339
+ return A(r);
1340
1340
  }
1341
1341
  const We = {
1342
1342
  airspaceStroke: "#AAB7B8",
@@ -3241,11 +3241,11 @@ const oi = {
3241
3241
  async function Qt(o) {
3242
3242
  const r = await fetch(o);
3243
3243
  if (!r.ok) throw new Error(`fetch ${o} → ${r.status}`);
3244
- const u = r.headers.get("Content-Encoding"), x = r.headers.get("Content-Type") || "";
3245
- if (u === "gzip" || x.includes("json"))
3244
+ const u = r.headers.get("Content-Encoding"), g = r.headers.get("Content-Type") || "";
3245
+ if (u === "gzip" || g.includes("json"))
3246
3246
  return r.json();
3247
- const p = r.body.pipeThrough(new DecompressionStream("gzip"));
3248
- return new Response(p).json();
3247
+ const y = r.body.pipeThrough(new DecompressionStream("gzip"));
3248
+ return new Response(y).json();
3249
3249
  }
3250
3250
  class ri {
3251
3251
  /**
@@ -3260,13 +3260,13 @@ class ri {
3260
3260
  constructor(r = {}) {
3261
3261
  const {
3262
3262
  container: u,
3263
- theme: x = "light",
3264
- apiUrl: p = ti,
3265
- spriteUrl: y,
3263
+ theme: g = "light",
3264
+ apiUrl: y = ti,
3265
+ spriteUrl: x,
3266
3266
  period: b = null,
3267
3267
  layers: F = {}
3268
3268
  } = r;
3269
- this._apiUrl = p.replace(/\/$/, ""), this._spriteUrl = (y ?? p).replace(/\/$/, ""), this._theme = x, this._period = b, this._ready = !1, this._layerVisible = {
3269
+ return this._apiUrl = y.replace(/\/$/, ""), this._spriteUrl = (x ?? y).replace(/\/$/, ""), this._theme = g, this._period = b, this._ready = !1, this._layerVisible = {
3270
3270
  // aviation groups — all visible by default
3271
3271
  adiz: !0,
3272
3272
  fir: !0,
@@ -3285,7 +3285,14 @@ class ri {
3285
3285
  contour: !1,
3286
3286
  // user overrides
3287
3287
  ...F
3288
- }, this._initMap(u);
3288
+ }, this._initMap(u), new Proxy(this, {
3289
+ get(k, A, z) {
3290
+ var _;
3291
+ if (A in k) return Reflect.get(k, A, z);
3292
+ const p = (_ = k._map) == null ? void 0 : _[A];
3293
+ return typeof p == "function" ? p.bind(k._map) : p;
3294
+ }
3295
+ });
3289
3296
  }
3290
3297
  // ── Map initialization ────────────────────────────────────────────────────
3291
3298
  _initMap(r) {
@@ -3324,8 +3331,8 @@ class ri {
3324
3331
  async _initSources() {
3325
3332
  if (!this._period)
3326
3333
  try {
3327
- const x = await (await fetch(`${this._apiUrl}/api/periods`)).json();
3328
- this._period = x[x.length - 1];
3334
+ const g = await (await fetch(`${this._apiUrl}/api/periods`)).json();
3335
+ this._period = g[g.length - 1];
3329
3336
  } catch (u) {
3330
3337
  console.warn("[AviationChart] fetchPeriods failed:", u), this._period = "latest";
3331
3338
  }
@@ -3370,15 +3377,15 @@ class ri {
3370
3377
  }), await this._loadBaseData();
3371
3378
  }
3372
3379
  async _loadBaseData() {
3373
- var r, u, x, p;
3380
+ var r, u, g, y;
3374
3381
  try {
3375
- const [y, b] = await Promise.all([
3382
+ const [x, b] = await Promise.all([
3376
3383
  Qt(`${this._apiUrl}/topjson/land.topojson.gz`),
3377
3384
  Qt(`${this._apiUrl}/topjson/boundary.topojson.gz`)
3378
3385
  ]);
3379
- (r = y == null ? void 0 : y.objects) != null && r.land ? (u = this._map.getSource("land")) == null || u.setData($t(y, y.objects.land)) : console.warn("[AviationChart] land topojson missing objects.land"), (x = b == null ? void 0 : b.objects) != null && x.boundary ? (p = this._map.getSource("boundary")) == null || p.setData($t(b, b.objects.boundary)) : console.warn("[AviationChart] boundary topojson missing objects.boundary");
3380
- } catch (y) {
3381
- console.error("[AviationChart] loadBaseData failed:", y);
3386
+ (r = x == null ? void 0 : x.objects) != null && r.land ? (u = this._map.getSource("land")) == null || u.setData($t(x, x.objects.land)) : console.warn("[AviationChart] land topojson missing objects.land"), (g = b == null ? void 0 : b.objects) != null && g.boundary ? (y = this._map.getSource("boundary")) == null || y.setData($t(b, b.objects.boundary)) : console.warn("[AviationChart] boundary topojson missing objects.boundary");
3387
+ } catch (x) {
3388
+ console.error("[AviationChart] loadBaseData failed:", x);
3382
3389
  }
3383
3390
  }
3384
3391
  _initLayers() {
@@ -3433,26 +3440,26 @@ class ri {
3433
3440
  "text-halo-width": 1
3434
3441
  }
3435
3442
  }), this._layerVisible.terrain && this._map.setTerrain({ source: "terrain", exaggeration: 4 });
3436
- for (const x of Yt(this._theme))
3437
- this._map.getLayer(x.id) || this._map.addLayer(x);
3438
- for (const x of Ht("amm", this._theme))
3439
- this._map.getLayer(x.id) || this._map.addLayer(x, "fir-line");
3443
+ for (const g of Yt(this._theme))
3444
+ this._map.getLayer(g.id) || this._map.addLayer(g);
3445
+ for (const g of Ht("amm", this._theme))
3446
+ this._map.getLayer(g.id) || this._map.addLayer(g, "fir-line");
3440
3447
  }
3441
3448
  _applyVisibility() {
3442
- for (const [p, y] of Object.entries(Ct)) {
3443
- const b = this._layerVisible[p] !== !1 ? "visible" : "none";
3444
- for (const F of y)
3449
+ for (const [y, x] of Object.entries(Ct)) {
3450
+ const b = this._layerVisible[y] !== !1 ? "visible" : "none";
3451
+ for (const F of x)
3445
3452
  this._map.getLayer(F) && this._map.setLayoutProperty(F, "visibility", b);
3446
3453
  }
3447
3454
  const r = this._layerVisible.amm !== !1 ? "visible" : "none";
3448
- for (const p of Pt)
3449
- this._map.getLayer(p) && this._map.setLayoutProperty(p, "visibility", r);
3455
+ for (const y of Pt)
3456
+ this._map.getLayer(y) && this._map.setLayoutProperty(y, "visibility", r);
3450
3457
  const u = this._layerVisible.terrain ? "visible" : "none";
3451
- for (const p of Zt)
3452
- this._map.getLayer(p) && this._map.setLayoutProperty(p, "visibility", u);
3453
- const x = this._layerVisible.contour ? "visible" : "none";
3454
- for (const p of Jt)
3455
- this._map.getLayer(p) && this._map.setLayoutProperty(p, "visibility", x);
3458
+ for (const y of Zt)
3459
+ this._map.getLayer(y) && this._map.setLayoutProperty(y, "visibility", u);
3460
+ const g = this._layerVisible.contour ? "visible" : "none";
3461
+ for (const y of Jt)
3462
+ this._map.getLayer(y) && this._map.setLayoutProperty(y, "visibility", g);
3456
3463
  }
3457
3464
  // ── Public API ────────────────────────────────────────────────────────────
3458
3465
  /** Raw MapLibre Map instance */
@@ -3476,18 +3483,18 @@ class ri {
3476
3483
  this._theme = r;
3477
3484
  const u = ut[r] ?? ut.light;
3478
3485
  this._map.setPaintProperty("background", "background-color", u.background);
3479
- const x = [
3486
+ const g = [
3480
3487
  "landLaye",
3481
3488
  "boundary",
3482
3489
  ...Object.values(Ct).flat(),
3483
3490
  ...Pt
3484
3491
  ];
3485
- for (const p of x)
3486
- this._map.getLayer(p) && this._map.removeLayer(p);
3487
- for (const p of Yt(this._theme))
3488
- this._map.addLayer(p);
3489
- for (const p of Ht("amm", this._theme))
3490
- this._map.getLayer(p.id) || this._map.addLayer(p, "fir-line");
3492
+ for (const y of g)
3493
+ this._map.getLayer(y) && this._map.removeLayer(y);
3494
+ for (const y of Yt(this._theme))
3495
+ this._map.addLayer(y);
3496
+ for (const y of Ht("amm", this._theme))
3497
+ this._map.getLayer(y.id) || this._map.addLayer(y, "fir-line");
3491
3498
  this._applyVisibility();
3492
3499
  }
3493
3500
  /**
@@ -3503,41 +3510,41 @@ class ri {
3503
3510
  */
3504
3511
  setLayerVisible(r, u) {
3505
3512
  if (this._layerVisible[r] = u, r === "terrain") {
3506
- const y = u ? "visible" : "none";
3513
+ const x = u ? "visible" : "none";
3507
3514
  for (const b of Zt)
3508
- this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", y);
3515
+ this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", x);
3509
3516
  this._map.setTerrain(u ? { source: "terrain", exaggeration: 4 } : null);
3510
3517
  return;
3511
3518
  }
3512
3519
  if (r === "contour") {
3513
- const y = u ? "visible" : "none";
3520
+ const x = u ? "visible" : "none";
3514
3521
  for (const b of Jt)
3515
- this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", y);
3522
+ this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", x);
3516
3523
  return;
3517
3524
  }
3518
3525
  if (r === "amm") {
3519
- const y = u ? "visible" : "none";
3526
+ const x = u ? "visible" : "none";
3520
3527
  for (const b of Pt)
3521
- this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", y);
3528
+ this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", x);
3522
3529
  return;
3523
3530
  }
3524
- const x = Ct[r];
3525
- if (!x) {
3531
+ const g = Ct[r];
3532
+ if (!g) {
3526
3533
  console.warn(`[AviationChart] Unknown layer key: "${r}"`);
3527
3534
  return;
3528
3535
  }
3529
- const p = u ? "visible" : "none";
3530
- for (const y of x)
3531
- this._map.getLayer(y) && this._map.setLayoutProperty(y, "visibility", p);
3536
+ const y = u ? "visible" : "none";
3537
+ for (const x of g)
3538
+ this._map.getLayer(x) && this._map.setLayoutProperty(x, "visibility", y);
3532
3539
  }
3533
3540
  /**
3534
3541
  * Switch the navdata period. Fetches tiles for the new period immediately.
3535
3542
  * @param {string} period
3536
3543
  */
3537
3544
  setPeriod(r) {
3538
- var x;
3545
+ var g;
3539
3546
  this._period = r;
3540
- const u = (x = this._map) == null ? void 0 : x.getSource("navdata");
3547
+ const u = (g = this._map) == null ? void 0 : g.getSource("navdata");
3541
3548
  u && u.setTiles([`${this._apiUrl}/api/tiles/${r}/{z}/{x}/{y}.pbf`]);
3542
3549
  }
3543
3550
  /** Proxy to map.on — returns `this` for chaining */