aviation-chart 0.1.35 → 0.1.36

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
@@ -1,18 +1,18 @@
1
- import jt from "maplibre-gl";
2
- var vt, Rt, Pt;
3
- function Ot(o, r) {
1
+ import $t from "maplibre-gl";
2
+ var vt, Ct, Ot;
3
+ function It(o, r) {
4
4
  if (!vt)
5
5
  vt = r;
6
- else if (!Rt)
7
- Rt = r;
6
+ else if (!Ct)
7
+ Ct = r;
8
8
  else {
9
- var d = "var sharedChunk = {}; (" + vt + ")(sharedChunk); (" + Rt + ")(sharedChunk);", y = {};
10
- vt(y), Pt = r(y), typeof window < "u" && (Pt.workerUrl = window.URL.createObjectURL(
9
+ var d = "var sharedChunk = {}; (" + vt + ")(sharedChunk); (" + Ct + ")(sharedChunk);", y = {};
10
+ vt(y), Ot = r(y), typeof window < "u" && (Ot.workerUrl = window.URL.createObjectURL(
11
11
  new Blob([d], { type: "text/javascript" })
12
12
  ));
13
13
  }
14
14
  }
15
- Ot(["exports"], function(o) {
15
+ It(["exports"], function(o) {
16
16
  class r {
17
17
  constructor(e, i) {
18
18
  this.start = e, this.end = i, this.points = [], this.append = this.append.bind(this), this.prepend = this.prepend.bind(this);
@@ -132,122 +132,122 @@ Ot(["exports"], function(o) {
132
132
  ],
133
133
  []
134
134
  ];
135
- function y(t, e, i, n) {
136
- return e = e * 2 + n[0], i = i * 2 + n[1], e + i * (t + 1) * 2;
135
+ function y(t, e, i, a) {
136
+ return e = e * 2 + a[0], i = i * 2 + a[1], e + i * (t + 1) * 2;
137
137
  }
138
- function g(t, e, i) {
138
+ function w(t, e, i) {
139
139
  return (e - t) / (i - t);
140
140
  }
141
- function w(t, e, i = 4096, n = 1) {
141
+ function x(t, e, i = 4096, a = 1) {
142
142
  if (!t)
143
143
  return {};
144
- const a = i / (e.width - 1);
144
+ const n = i / (e.width - 1);
145
145
  let l, s, c, m, h, f;
146
- const u = {}, _ = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
147
- function M(P, L, R) {
148
- P[0] === 0 ? R(a * (f - 1), a * (h - g(c, L, l))) : P[0] === 2 ? R(a * f, a * (h - g(m, L, s))) : P[1] === 0 ? R(a * (f - g(s, L, l)), a * (h - 1)) : R(a * (f - g(m, L, c)), a * h);
146
+ const u = {}, _ = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map();
147
+ function M(O, I, C) {
148
+ O[0] === 0 ? C(n * (f - 1), n * (h - w(c, I, l))) : O[0] === 2 ? C(n * f, n * (h - w(m, I, s))) : O[1] === 0 ? C(n * (f - w(s, I, l)), n * (h - 1)) : C(n * (f - w(m, I, c)), n * h);
149
149
  }
150
- for (h = 1 - n; h < e.height + n; h++) {
150
+ for (h = 1 - a; h < e.height + a; h++) {
151
151
  s = e.get(0, h - 1), m = e.get(0, h);
152
- let P = Math.min(s, m), L = Math.max(s, m);
153
- for (f = 1 - n; f < e.width + n; f++) {
152
+ let O = Math.min(s, m), I = Math.max(s, m);
153
+ for (f = 1 - a; f < e.width + a; f++) {
154
154
  l = s, c = m, s = e.get(f, h - 1), m = e.get(f, h);
155
- const R = P, V = L;
156
- if (P = Math.min(s, m), L = Math.max(s, m), isNaN(l) || isNaN(s) || isNaN(m) || isNaN(c))
155
+ const C = 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 dt = Math.min(R, P), pt = Math.max(V, L), X = Math.ceil(dt / t) * t, ot = Math.floor(pt / t) * t;
159
- for (let C = X; C <= ot; C += t) {
160
- const kt = l > C, q = s > C, nt = c > C, _t = m > C;
161
- for (const bt of d[(kt ? 8 : 0) | (q ? 4 : 0) | (_t ? 2 : 0) | (nt ? 1 : 0)]) {
162
- let H = _.get(C);
163
- H || _.set(C, H = /* @__PURE__ */ new Map());
164
- let lt = F.get(C);
165
- lt || F.set(C, lt = /* @__PURE__ */ new Map());
166
- const At = bt[0], zt = bt[1], yt = y(e.width, f, h, At), st = y(e.width, f, h, zt);
167
- let I, Tt;
168
- if (I = lt.get(yt))
158
+ const dt = Math.min(C, O), pt = Math.max(V, I), X = Math.ceil(dt / t) * t, ot = Math.floor(pt / t) * t;
159
+ for (let P = X; P <= ot; P += t) {
160
+ const At = l > P, q = s > P, at = c > P, bt = m > P;
161
+ for (const _t of d[(At ? 8 : 0) | (q ? 4 : 0) | (bt ? 2 : 0) | (at ? 1 : 0)]) {
162
+ let H = _.get(P);
163
+ H || _.set(P, H = /* @__PURE__ */ new Map());
164
+ let lt = k.get(P);
165
+ lt || k.set(P, lt = /* @__PURE__ */ new Map());
166
+ const Rt = _t[0], zt = _t[1], yt = y(e.width, f, h, Rt), st = y(e.width, f, h, zt);
167
+ let G, Tt;
168
+ if (G = lt.get(yt))
169
169
  if (lt.delete(yt), Tt = H.get(st))
170
- if (H.delete(st), I === Tt) {
171
- if (M(zt, C, I.append), !I.isEmpty()) {
172
- let rt = u[C];
173
- rt || (u[C] = rt = []), rt.push(I.lineString());
170
+ if (H.delete(st), G === Tt) {
171
+ if (M(zt, P, G.append), !G.isEmpty()) {
172
+ let rt = u[P];
173
+ rt || (u[P] = rt = []), rt.push(G.lineString());
174
174
  }
175
175
  } else
176
- I.appendFragment(Tt), lt.set(I.end = Tt.end, I);
176
+ G.appendFragment(Tt), lt.set(G.end = Tt.end, G);
177
177
  else
178
- M(zt, C, I.append), lt.set(I.end = st, I);
179
- else if (I = H.get(st))
180
- H.delete(st), M(At, C, I.prepend), H.set(I.start = yt, I);
178
+ M(zt, P, G.append), lt.set(G.end = st, G);
179
+ else if (G = H.get(st))
180
+ H.delete(st), M(Rt, P, G.prepend), H.set(G.start = yt, G);
181
181
  else {
182
182
  const rt = new r(yt, st);
183
- M(At, C, rt.append), M(zt, C, rt.append), H.set(yt, rt), lt.set(st, rt);
183
+ M(Rt, P, rt.append), M(zt, P, rt.append), H.set(yt, rt), lt.set(st, rt);
184
184
  }
185
185
  }
186
186
  }
187
187
  }
188
188
  }
189
- for (const [P, L] of _.entries()) {
190
- let R = null;
191
- for (const V of L.values())
192
- V.isEmpty() || (R == null && (R = u[P] || (u[P] = [])), R.push(V.lineString()));
189
+ for (const [O, I] of _.entries()) {
190
+ let C = null;
191
+ for (const V of I.values())
192
+ V.isEmpty() || (C == null && (C = u[O] || (u[O] = [])), C.push(V.lineString()));
193
193
  }
194
194
  return u;
195
195
  }
196
196
  function b(t) {
197
197
  const e = Object.entries(t);
198
- return e.sort(([i], [n]) => i < n ? -1 : i > n ? 1 : 0), e;
198
+ return e.sort(([i], [a]) => i < a ? -1 : i > a ? 1 : 0), e;
199
199
  }
200
- function S(t) {
200
+ function v(t) {
201
201
  return b(t).map(([e, i]) => [e, ...typeof i == "number" ? [i] : i].join("*")).join("~");
202
202
  }
203
- function O(t) {
203
+ function F(t) {
204
204
  return Object.fromEntries(t.split("~").map((e) => e.split("*").map(Number)).map(([e, ...i]) => [e, i]));
205
205
  }
206
206
  function A({ thresholds: t, ...e }) {
207
- return b({ thresholds: S(t), ...e }).map(([i, n]) => `${encodeURIComponent(i)}=${encodeURIComponent(n)}`).join("&");
207
+ return b({ thresholds: v(t), ...e }).map(([i, a]) => `${encodeURIComponent(i)}=${encodeURIComponent(a)}`).join("&");
208
208
  }
209
209
  function z(t) {
210
210
  return Object.fromEntries(t.replace(/^.*\?/, "").split("&").map((e) => {
211
- const i = e.split("=").map(decodeURIComponent), n = i[0];
212
- let a = i[1];
213
- switch (n) {
211
+ const i = e.split("=").map(decodeURIComponent), a = i[0];
212
+ let n = i[1];
213
+ switch (a) {
214
214
  case "thresholds":
215
- a = O(a);
215
+ n = F(n);
216
216
  break;
217
217
  case "extent":
218
218
  case "multiplier":
219
219
  case "overzoom":
220
220
  case "buffer":
221
- a = Number(a);
221
+ n = Number(n);
222
222
  }
223
- return [n, a];
223
+ return [a, n];
224
224
  }));
225
225
  }
226
226
  function p(t) {
227
227
  return b(t).map(([e, i]) => `${encodeURIComponent(e)}=${encodeURIComponent(i)}`).join(",");
228
228
  }
229
- function x(t, e) {
230
- const { thresholds: i, ...n } = t;
231
- let a = [], l = -1 / 0;
229
+ function g(t, e) {
230
+ const { thresholds: i, ...a } = t;
231
+ let n = [], l = -1 / 0;
232
232
  return Object.entries(i).forEach(([s, c]) => {
233
233
  const m = Number(s);
234
- m <= e && m > l && (l = m, a = typeof c == "number" ? [c] : c);
234
+ m <= e && m > l && (l = m, n = typeof c == "number" ? [c] : c);
235
235
  }), {
236
- levels: a,
237
- ...n
236
+ levels: n,
237
+ ...a
238
238
  };
239
239
  }
240
240
  function T(t) {
241
241
  const e = new ArrayBuffer(t.byteLength);
242
242
  return new Uint8Array(e).set(new Uint8Array(t)), e;
243
243
  }
244
- function D(t, e) {
245
- return t.then(({ data: i, ...n }) => {
246
- let a = i;
247
- return e && (a = new Float32Array(i.length), a.set(i)), { ...n, data: a, transferrables: [a.buffer] };
244
+ function E(t, e) {
245
+ return t.then(({ data: i, ...a }) => {
246
+ let n = i;
247
+ return e && (n = new Float32Array(i.length), n.set(i)), { ...a, data: n, transferrables: [n.buffer] };
248
248
  });
249
249
  }
250
- function k(t) {
250
+ function R(t) {
251
251
  return t.then(({ arrayBuffer: e }) => {
252
252
  const i = T(e);
253
253
  return {
@@ -265,13 +265,13 @@ Ot(["exports"], function(o) {
265
265
  if (tt == null && (tt = !1, ct() && typeof VideoFrame < "u")) {
266
266
  const i = new OffscreenCanvas(5, 5).getContext("2d", { willReadFrequently: !0 });
267
267
  if (i) {
268
- for (let a = 0; a < 5 * 5; a++) {
269
- const l = a * 4;
270
- i.fillStyle = `rgb(${l},${l + 1},${l + 2})`, i.fillRect(a % 5, Math.floor(a / 5), 1, 1);
268
+ for (let n = 0; n < 5 * 5; n++) {
269
+ const l = n * 4;
270
+ i.fillStyle = `rgb(${l},${l + 1},${l + 2})`, i.fillRect(n % 5, Math.floor(n / 5), 1, 1);
271
271
  }
272
- const n = i.getImageData(0, 0, 5, 5).data;
273
- for (let a = 0; a < 5 * 5 * 4; a++)
274
- if (a % 4 !== 3 && n[a] !== a) {
272
+ const a = i.getImageData(0, 0, 5, 5).data;
273
+ for (let n = 0; n < 5 * 5 * 4; n++)
274
+ if (n % 4 !== 3 && a[n] !== n) {
275
275
  tt = !0;
276
276
  break;
277
277
  }
@@ -279,21 +279,21 @@ Ot(["exports"], function(o) {
279
279
  }
280
280
  return tt || !1;
281
281
  }
282
- function G(t, e, i) {
283
- let n = () => {
282
+ function L(t, e, i) {
283
+ let a = () => {
284
284
  };
285
- const a = setTimeout(() => {
286
- n(new Error("timed out")), i == null || i.abort();
285
+ const n = setTimeout(() => {
286
+ a(new Error("timed out")), i == null || i.abort();
287
287
  }, t);
288
288
  U(i, () => {
289
- n(new Error("aborted")), clearTimeout(a);
289
+ a(new Error("aborted")), clearTimeout(n);
290
290
  });
291
291
  const l = new Promise((s, c) => {
292
- n = c;
292
+ a = c;
293
293
  });
294
294
  return Promise.race([
295
295
  l,
296
- e.finally(() => clearTimeout(a))
296
+ e.finally(() => clearTimeout(n))
297
297
  ]);
298
298
  }
299
299
  function U(t, e) {
@@ -303,25 +303,25 @@ Ot(["exports"], function(o) {
303
303
  var e;
304
304
  return !!(!((e = t == null ? void 0 : t.signal) === null || e === void 0) && e.aborted);
305
305
  }
306
- let E = 0;
307
- class Z {
306
+ let S = 0;
307
+ class J {
308
308
  constructor(e = 100) {
309
- this.size = () => this.items.size, this.get = (i, n, a) => {
309
+ this.size = () => this.items.size, this.get = (i, a, n) => {
310
310
  let l = this.items.get(i);
311
311
  if (l)
312
- l.lastUsed = ++E, l.waiting++;
312
+ l.lastUsed = ++S, l.waiting++;
313
313
  else {
314
- const h = new AbortController(), f = n(i, h);
314
+ const h = new AbortController(), f = a(i, h);
315
315
  l = {
316
316
  abortController: h,
317
317
  item: f,
318
- lastUsed: ++E,
318
+ lastUsed: ++S,
319
319
  waiting: 1
320
320
  }, this.items.set(i, l), this.prune();
321
321
  }
322
322
  const s = this.items, c = l.item.then((h) => h, (h) => (s.delete(i), Promise.reject(h)));
323
323
  let m = !1;
324
- return U(a, () => {
324
+ return U(n, () => {
325
325
  var h;
326
326
  l && l.abortController && !m && (m = !0, --l.waiting <= 0 && ((h = l.abortController) === null || h === void 0 || h.abort(), s.delete(i)));
327
327
  }), c;
@@ -330,121 +330,121 @@ Ot(["exports"], function(o) {
330
330
  prune() {
331
331
  if (this.items.size > this.maxSize) {
332
332
  let e, i = 1 / 0;
333
- this.items.forEach((n, a) => {
334
- n.lastUsed < i && (i = n.lastUsed, e = a);
333
+ this.items.forEach((a, n) => {
334
+ a.lastUsed < i && (i = a.lastUsed, e = n);
335
335
  }), typeof e < "u" && this.items.delete(e);
336
336
  }
337
337
  }
338
338
  }
339
339
  let K, et, N, it;
340
- async function at(t, e, i) {
341
- const n = await createImageBitmap(t);
342
- return B(i) ? null : W(n, e);
340
+ async function nt(t, e, i) {
341
+ const a = await createImageBitmap(t);
342
+ return B(i) ? null : W(a, e);
343
343
  }
344
344
  function W(t, e) {
345
345
  return K || (K = new OffscreenCanvas(t.width, t.height), et = K.getContext("2d", {
346
346
  willReadFrequently: !0
347
- })), It(t, e, K, et);
347
+ })), Lt(t, e, K, et);
348
348
  }
349
349
  async function xt(t, e, i) {
350
- var n, a, l;
350
+ var a, n, l;
351
351
  const s = await createImageBitmap(t);
352
352
  if (B(i))
353
353
  return null;
354
354
  const c = new VideoFrame(s, { timestamp: 0 });
355
355
  try {
356
- if (!(((n = c == null ? void 0 : c.format) === null || n === void 0 ? void 0 : n.startsWith("BGR")) || ((a = c == null ? void 0 : c.format) === null || a === void 0 ? void 0 : a.startsWith("RGB"))))
356
+ if (!(((a = c == null ? void 0 : c.format) === null || a === void 0 ? void 0 : a.startsWith("BGR")) || ((n = c == null ? void 0 : c.format) === null || n === void 0 ? void 0 : n.startsWith("RGB"))))
357
357
  throw new Error(`Unrecognized format: ${c == null ? void 0 : c.format}`);
358
358
  const h = (l = c == null ? void 0 : c.format) === null || l === void 0 ? void 0 : l.startsWith("BGR"), f = c.allocationSize(), u = new Uint8ClampedArray(f);
359
359
  if (await c.copyTo(u), h)
360
360
  for (let _ = 0; _ < u.length; _ += 4) {
361
- const F = u[_];
362
- u[_] = u[_ + 2], u[_ + 2] = F;
361
+ const k = u[_];
362
+ u[_] = u[_ + 2], u[_ + 2] = k;
363
363
  }
364
- return Dt(s.width, s.height, e, u);
364
+ return Et(s.width, s.height, e, u);
365
365
  } catch {
366
366
  return B(i) ? null : W(s, e);
367
367
  } finally {
368
368
  c.close();
369
369
  }
370
370
  }
371
- async function qt(t, e, i) {
371
+ async function te(t, e, i) {
372
372
  N || (N = document.createElement("canvas"), it = N.getContext("2d", {
373
373
  willReadFrequently: !0
374
374
  }));
375
- const n = new Image();
376
- U(i, () => n.src = "");
377
- const a = await new Promise((l, s) => {
378
- n.onload = () => {
379
- B(i) || l(n), URL.revokeObjectURL(n.src), n.onload = null;
380
- }, n.onerror = () => s(new Error("Could not load image.")), n.src = t.size ? URL.createObjectURL(t) : "";
375
+ const a = new Image();
376
+ U(i, () => a.src = "");
377
+ const n = await new Promise((l, s) => {
378
+ a.onload = () => {
379
+ B(i) || l(a), URL.revokeObjectURL(a.src), a.onload = null;
380
+ }, a.onerror = () => s(new Error("Could not load image.")), a.src = t.size ? URL.createObjectURL(t) : "";
381
381
  });
382
- return It(a, e, N, it);
382
+ return Lt(n, e, N, it);
383
383
  }
384
- function te(t, e, i) {
384
+ function ee(t, e, i) {
385
385
  return self.actor.send("decodeImage", [], i, void 0, t, e);
386
386
  }
387
- function ee() {
387
+ function ie() {
388
388
  return (
389
389
  // @ts-ignore
390
390
  typeof WorkerGlobalScope < "u" && typeof self < "u" && // @ts-ignore
391
391
  self instanceof WorkerGlobalScope
392
392
  );
393
393
  }
394
- const Lt = Y() ? xt : ct() ? at : ee() ? te : qt;
395
- function It(t, e, i, n) {
396
- if (i.width = t.width, i.height = t.height, !n)
394
+ const Gt = Y() ? xt : ct() ? nt : ie() ? ee : te;
395
+ function Lt(t, e, i, a) {
396
+ if (i.width = t.width, i.height = t.height, !a)
397
397
  throw new Error("failed to get context");
398
- n.drawImage(t, 0, 0, t.width, t.height);
399
- const a = n.getImageData(0, 0, t.width, t.height).data;
400
- return Dt(t.width, t.height, e, a);
401
- }
402
- function Dt(t, e, i, n) {
403
- const a = i === "mapbox" ? (s, c, m) => -1e4 + (s * 256 * 256 + c * 256 + m) * 0.1 : (s, c, m) => s * 256 + c + m / 256 - 32768, l = new Float32Array(t * e);
404
- for (let s = 0; s < n.length; s += 4)
405
- l[s / 4] = a(n[s], n[s + 1], n[s + 2]);
398
+ a.drawImage(t, 0, 0, t.width, t.height);
399
+ const n = a.getImageData(0, 0, t.width, t.height).data;
400
+ return Et(t.width, t.height, e, n);
401
+ }
402
+ function Et(t, e, i, a) {
403
+ const n = i === "mapbox" ? (s, c, m) => -1e4 + (s * 256 * 256 + c * 256 + m) * 0.1 : (s, c, m) => s * 256 + c + m / 256 - 32768, l = new Float32Array(t * e);
404
+ for (let s = 0; s < a.length; s += 4)
405
+ l[s / 4] = n(a[s], a[s + 1], a[s + 2]);
406
406
  return { width: t, height: e, data: l };
407
407
  }
408
- const ie = -12e3, oe = 9e3;
409
- function re(t) {
410
- return !isNaN(t) && t >= ie && t <= oe;
408
+ const oe = -12e3, re = 9e3;
409
+ function ne(t) {
410
+ return !isNaN(t) && t >= oe && t <= re;
411
411
  }
412
412
  class $ {
413
- constructor(e, i, n) {
414
- this.split = (a, l, s) => {
415
- if (a === 0)
413
+ constructor(e, i, a) {
414
+ this.split = (n, l, s) => {
415
+ if (n === 0)
416
416
  return this;
417
- const c = 1 << a, m = l * this.width / c, h = s * this.height / c;
417
+ const c = 1 << n, m = l * this.width / c, h = s * this.height / c;
418
418
  return new $(this.width / c, this.height / c, (f, u) => this.get(f + m, u + h));
419
- }, this.subsamplePixelCenters = (a) => {
419
+ }, this.subsamplePixelCenters = (n) => {
420
420
  const l = (m, h, f) => isNaN(m) ? h : isNaN(h) ? m : m + (h - m) * f;
421
- if (a <= 1)
421
+ if (n <= 1)
422
422
  return this;
423
- const s = 0.5 - 1 / (2 * a), c = (m, h) => {
424
- const f = m / a - s, u = h / a - s, _ = Math.floor(f), F = Math.floor(u), M = this.get(_, F), P = this.get(_ + 1, F), L = this.get(_, F + 1), R = this.get(_ + 1, F + 1), V = f - _, dt = u - F, pt = l(M, P, V), X = l(L, R, V);
423
+ const s = 0.5 - 1 / (2 * n), c = (m, h) => {
424
+ const f = m / n - s, u = h / n - s, _ = Math.floor(f), k = Math.floor(u), M = this.get(_, k), O = this.get(_ + 1, k), I = this.get(_, k + 1), C = this.get(_ + 1, k + 1), V = f - _, dt = u - k, pt = l(M, O, V), X = l(I, C, V);
425
425
  return l(pt, X, dt);
426
426
  };
427
- return new $(this.width * a, this.height * a, c);
428
- }, this.averagePixelCentersToGrid = (a = 1) => new $(this.width + 1, this.height + 1, (l, s) => {
427
+ return new $(this.width * n, this.height * n, c);
428
+ }, this.averagePixelCentersToGrid = (n = 1) => new $(this.width + 1, this.height + 1, (l, s) => {
429
429
  let c = 0, m = 0, h = 0;
430
- for (let f = l - a; f < l + a; f++)
431
- for (let u = s - a; u < s + a; u++)
430
+ for (let f = l - n; f < l + n; f++)
431
+ for (let u = s - n; u < s + n; u++)
432
432
  isNaN(h = this.get(f, u)) || (m++, c += h);
433
433
  return m === 0 ? NaN : c / m;
434
- }), this.scaleElevation = (a) => a === 1 ? this : new $(this.width, this.height, (l, s) => this.get(l, s) * a), this.materialize = (a = 2) => {
435
- const l = this.width + 2 * a, s = new Float32Array(l * (this.height + 2 * a));
434
+ }), this.scaleElevation = (n) => n === 1 ? this : new $(this.width, this.height, (l, s) => this.get(l, s) * n), this.materialize = (n = 2) => {
435
+ const l = this.width + 2 * n, s = new Float32Array(l * (this.height + 2 * n));
436
436
  let c = 0;
437
- for (let m = -a; m < this.height + a; m++)
438
- for (let h = -a; h < this.width + a; h++)
437
+ for (let m = -n; m < this.height + n; m++)
438
+ for (let h = -n; h < this.width + n; h++)
439
439
  s[c++] = this.get(h, m);
440
- return new $(this.width, this.height, (m, h) => s[(h + a) * l + m + a]);
441
- }, this.get = n, this.width = e, this.height = i;
440
+ return new $(this.width, this.height, (m, h) => s[(h + n) * l + m + n]);
441
+ }, this.get = a, this.width = e, this.height = i;
442
442
  }
443
443
  /** Construct a height tile from raw DEM pixel values */
444
444
  static fromRawDem(e) {
445
- return new $(e.width, e.height, (i, n) => {
446
- const a = e.data[n * e.width + i];
447
- return re(a) ? a : NaN;
445
+ return new $(e.width, e.height, (i, a) => {
446
+ const n = e.data[a * e.width + i];
447
+ return ne(n) ? n : NaN;
448
448
  });
449
449
  }
450
450
  /**
@@ -459,10 +459,10 @@ Ot(["exports"], function(o) {
459
459
  const i = e[4];
460
460
  if (!i)
461
461
  return;
462
- const n = i.width, a = i.height;
463
- return new $(n, a, (l, s) => {
462
+ const a = i.width, n = i.height;
463
+ return new $(a, n, (l, s) => {
464
464
  let c = 0;
465
- s < 0 ? s += a : s < a ? c += 3 : (s -= a, c += 6), l < 0 ? l += n : l < n ? c += 1 : (l -= n, c += 2);
465
+ s < 0 ? s += n : s < n ? c += 3 : (s -= n, c += 6), l < 0 ? l += a : l < a ? c += 1 : (l -= a, c += 2);
466
466
  const m = e[c];
467
467
  return m ? m.get(l, s) : NaN;
468
468
  });
@@ -471,45 +471,45 @@ Ot(["exports"], function(o) {
471
471
  function ae(t) {
472
472
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
473
473
  }
474
- var Et = {};
474
+ var Ft = {};
475
475
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
476
- Et.read = function(t, e, i, n, a) {
477
- var l, s, c = a * 8 - n - 1, m = (1 << c) - 1, h = m >> 1, f = -7, u = i ? a - 1 : 0, _ = i ? -1 : 1, F = t[e + u];
478
- for (u += _, l = F & (1 << -f) - 1, F >>= -f, f += c; f > 0; l = l * 256 + t[e + u], u += _, f -= 8)
476
+ Ft.read = function(t, e, i, a, n) {
477
+ var l, s, c = n * 8 - a - 1, m = (1 << c) - 1, h = m >> 1, f = -7, u = i ? n - 1 : 0, _ = i ? -1 : 1, k = t[e + u];
478
+ for (u += _, l = k & (1 << -f) - 1, k >>= -f, f += c; f > 0; l = l * 256 + t[e + u], u += _, f -= 8)
479
479
  ;
480
- for (s = l & (1 << -f) - 1, l >>= -f, f += n; f > 0; s = s * 256 + t[e + u], u += _, f -= 8)
480
+ for (s = l & (1 << -f) - 1, l >>= -f, f += a; f > 0; s = s * 256 + t[e + u], u += _, f -= 8)
481
481
  ;
482
482
  if (l === 0)
483
483
  l = 1 - h;
484
484
  else {
485
485
  if (l === m)
486
- return s ? NaN : (F ? -1 : 1) * (1 / 0);
487
- s = s + Math.pow(2, n), l = l - h;
486
+ return s ? NaN : (k ? -1 : 1) * (1 / 0);
487
+ s = s + Math.pow(2, a), l = l - h;
488
488
  }
489
- return (F ? -1 : 1) * s * Math.pow(2, l - n);
490
- }, Et.write = function(t, e, i, n, a, l) {
491
- var s, c, m, h = l * 8 - a - 1, f = (1 << h) - 1, u = f >> 1, _ = a === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, F = n ? 0 : l - 1, M = n ? 1 : -1, P = 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 + u >= 1 ? e += _ / m : e += _ * Math.pow(2, 1 - u), e * m >= 2 && (s++, m /= 2), s + u >= f ? (c = 0, s = f) : s + u >= 1 ? (c = (e * m - 1) * Math.pow(2, a), s = s + u) : (c = e * Math.pow(2, u - 1) * Math.pow(2, a), s = 0)); a >= 8; t[i + F] = c & 255, F += M, c /= 256, a -= 8)
489
+ return (k ? -1 : 1) * s * Math.pow(2, l - a);
490
+ }, Ft.write = function(t, e, i, a, n, l) {
491
+ var s, c, m, h = l * 8 - n - 1, f = (1 << h) - 1, u = f >> 1, _ = n === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, k = a ? 0 : l - 1, M = a ? 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 + u >= 1 ? e += _ / m : e += _ * Math.pow(2, 1 - u), e * m >= 2 && (s++, m /= 2), s + u >= f ? (c = 0, s = f) : s + u >= 1 ? (c = (e * m - 1) * Math.pow(2, n), s = s + u) : (c = e * Math.pow(2, u - 1) * Math.pow(2, n), s = 0)); n >= 8; t[i + k] = c & 255, k += M, c /= 256, n -= 8)
493
493
  ;
494
- for (s = s << a | c, h += a; h > 0; t[i + F] = s & 255, F += M, s /= 256, h -= 8)
494
+ for (s = s << n | c, h += n; h > 0; t[i + k] = s & 255, k += M, s /= 256, h -= 8)
495
495
  ;
496
- t[i + F - M] |= P * 128;
496
+ t[i + k - M] |= O * 128;
497
497
  };
498
- var ne = v, gt = Et;
499
- function v(t) {
498
+ var le = D, gt = Ft;
499
+ function D(t) {
500
500
  this.buf = ArrayBuffer.isView && ArrayBuffer.isView(t) ? t : new Uint8Array(t || 0), this.pos = 0, this.type = 0, this.length = this.buf.length;
501
501
  }
502
- v.Varint = 0, v.Fixed64 = 1, v.Bytes = 2, v.Fixed32 = 5;
503
- var Ft = 65536 * 65536, Gt = 1 / Ft, le = 12, Bt = typeof TextDecoder > "u" ? null : new TextDecoder("utf8");
504
- v.prototype = {
502
+ D.Varint = 0, D.Fixed64 = 1, D.Bytes = 2, D.Fixed32 = 5;
503
+ var St = 65536 * 65536, Bt = 1 / St, se = 12, Xt = typeof TextDecoder > "u" ? null : new TextDecoder("utf8");
504
+ D.prototype = {
505
505
  destroy: function() {
506
506
  this.buf = null;
507
507
  },
508
508
  // === READING =================================================================
509
509
  readFields: function(t, e, i) {
510
510
  for (i = i || this.length; this.pos < i; ) {
511
- var n = this.readVarint(), a = n >> 3, l = this.pos;
512
- this.type = n & 7, t(a, e, this), this.pos === l && this.skip(n);
511
+ var a = this.readVarint(), n = a >> 3, l = this.pos;
512
+ this.type = a & 7, t(n, e, this), this.pos === l && this.skip(a);
513
513
  }
514
514
  return e;
515
515
  },
@@ -521,16 +521,16 @@ Ot(["exports"], function(o) {
521
521
  return this.pos += 4, t;
522
522
  },
523
523
  readSFixed32: function() {
524
- var t = Nt(this.buf, this.pos);
524
+ var t = Vt(this.buf, this.pos);
525
525
  return this.pos += 4, t;
526
526
  },
527
527
  // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
528
528
  readFixed64: function() {
529
- var t = wt(this.buf, this.pos) + wt(this.buf, this.pos + 4) * Ft;
529
+ var t = wt(this.buf, this.pos) + wt(this.buf, this.pos + 4) * St;
530
530
  return this.pos += 8, t;
531
531
  },
532
532
  readSFixed64: function() {
533
- var t = wt(this.buf, this.pos) + Nt(this.buf, this.pos + 4) * Ft;
533
+ var t = wt(this.buf, this.pos) + Vt(this.buf, this.pos + 4) * St;
534
534
  return this.pos += 8, t;
535
535
  },
536
536
  readFloat: function() {
@@ -542,8 +542,8 @@ Ot(["exports"], function(o) {
542
542
  return this.pos += 8, t;
543
543
  },
544
544
  readVarint: function(t) {
545
- var e = this.buf, i, n;
546
- return n = e[this.pos++], i = n & 127, n < 128 || (n = e[this.pos++], i |= (n & 127) << 7, n < 128) || (n = e[this.pos++], i |= (n & 127) << 14, n < 128) || (n = e[this.pos++], i |= (n & 127) << 21, n < 128) ? i : (n = e[this.pos], i |= (n & 15) << 28, se(i, t, this));
545
+ var e = this.buf, i, a;
546
+ return a = e[this.pos++], i = a & 127, a < 128 || (a = e[this.pos++], i |= (a & 127) << 7, a < 128) || (a = e[this.pos++], i |= (a & 127) << 14, a < 128) || (a = e[this.pos++], i |= (a & 127) << 21, a < 128) ? i : (a = e[this.pos], i |= (a & 15) << 28, ce(i, t, this));
547
547
  },
548
548
  readVarint64: function() {
549
549
  return this.readVarint(!0);
@@ -557,7 +557,7 @@ Ot(["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) : be(this.buf, e, t);
560
+ return this.pos = t, t - e >= se && Xt ? Te(this.buf, e, t) : ze(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);
@@ -565,66 +565,66 @@ Ot(["exports"], function(o) {
565
565
  },
566
566
  // verbose for performance reasons; doesn't affect gzipped size
567
567
  readPackedVarint: function(t, e) {
568
- if (this.type !== v.Bytes) return t.push(this.readVarint(e));
569
- var i = J(this);
568
+ if (this.type !== D.Bytes) return t.push(this.readVarint(e));
569
+ var i = Z(this);
570
570
  for (t = t || []; this.pos < i; ) t.push(this.readVarint(e));
571
571
  return t;
572
572
  },
573
573
  readPackedSVarint: function(t) {
574
- if (this.type !== v.Bytes) return t.push(this.readSVarint());
575
- var e = J(this);
574
+ if (this.type !== D.Bytes) return t.push(this.readSVarint());
575
+ var e = Z(this);
576
576
  for (t = t || []; this.pos < e; ) t.push(this.readSVarint());
577
577
  return t;
578
578
  },
579
579
  readPackedBoolean: function(t) {
580
- if (this.type !== v.Bytes) return t.push(this.readBoolean());
581
- var e = J(this);
580
+ if (this.type !== D.Bytes) return t.push(this.readBoolean());
581
+ var e = Z(this);
582
582
  for (t = t || []; this.pos < e; ) t.push(this.readBoolean());
583
583
  return t;
584
584
  },
585
585
  readPackedFloat: function(t) {
586
- if (this.type !== v.Bytes) return t.push(this.readFloat());
587
- var e = J(this);
586
+ if (this.type !== D.Bytes) return t.push(this.readFloat());
587
+ var e = Z(this);
588
588
  for (t = t || []; this.pos < e; ) t.push(this.readFloat());
589
589
  return t;
590
590
  },
591
591
  readPackedDouble: function(t) {
592
- if (this.type !== v.Bytes) return t.push(this.readDouble());
593
- var e = J(this);
592
+ if (this.type !== D.Bytes) return t.push(this.readDouble());
593
+ var e = Z(this);
594
594
  for (t = t || []; this.pos < e; ) t.push(this.readDouble());
595
595
  return t;
596
596
  },
597
597
  readPackedFixed32: function(t) {
598
- if (this.type !== v.Bytes) return t.push(this.readFixed32());
599
- var e = J(this);
598
+ if (this.type !== D.Bytes) return t.push(this.readFixed32());
599
+ var e = Z(this);
600
600
  for (t = t || []; this.pos < e; ) t.push(this.readFixed32());
601
601
  return t;
602
602
  },
603
603
  readPackedSFixed32: function(t) {
604
- if (this.type !== v.Bytes) return t.push(this.readSFixed32());
605
- var e = J(this);
604
+ if (this.type !== D.Bytes) return t.push(this.readSFixed32());
605
+ var e = Z(this);
606
606
  for (t = t || []; this.pos < e; ) t.push(this.readSFixed32());
607
607
  return t;
608
608
  },
609
609
  readPackedFixed64: function(t) {
610
- if (this.type !== v.Bytes) return t.push(this.readFixed64());
611
- var e = J(this);
610
+ if (this.type !== D.Bytes) return t.push(this.readFixed64());
611
+ var e = Z(this);
612
612
  for (t = t || []; this.pos < e; ) t.push(this.readFixed64());
613
613
  return t;
614
614
  },
615
615
  readPackedSFixed64: function(t) {
616
- if (this.type !== v.Bytes) return t.push(this.readSFixed64());
617
- var e = J(this);
616
+ if (this.type !== D.Bytes) return t.push(this.readSFixed64());
617
+ var e = Z(this);
618
618
  for (t = t || []; this.pos < e; ) t.push(this.readSFixed64());
619
619
  return t;
620
620
  },
621
621
  skip: function(t) {
622
622
  var e = t & 7;
623
- if (e === v.Varint) for (; this.buf[this.pos++] > 127; )
623
+ if (e === D.Varint) for (; this.buf[this.pos++] > 127; )
624
624
  ;
625
- else if (e === v.Bytes) this.pos = this.readVarint() + this.pos;
626
- else if (e === v.Fixed32) this.pos += 4;
627
- else if (e === v.Fixed64) this.pos += 8;
625
+ else if (e === D.Bytes) this.pos = this.readVarint() + this.pos;
626
+ else if (e === D.Fixed32) this.pos += 4;
627
+ else if (e === D.Fixed64) this.pos += 8;
628
628
  else throw new Error("Unimplemented type: " + e);
629
629
  },
630
630
  // === WRITING =================================================================
@@ -648,14 +648,14 @@ Ot(["exports"], function(o) {
648
648
  this.realloc(4), ht(this.buf, t, this.pos), this.pos += 4;
649
649
  },
650
650
  writeFixed64: function(t) {
651
- this.realloc(8), ht(this.buf, t & -1, this.pos), ht(this.buf, Math.floor(t * Gt), this.pos + 4), this.pos += 8;
651
+ this.realloc(8), ht(this.buf, t & -1, this.pos), ht(this.buf, Math.floor(t * Bt), this.pos + 4), this.pos += 8;
652
652
  },
653
653
  writeSFixed64: function(t) {
654
- this.realloc(8), ht(this.buf, t & -1, this.pos), ht(this.buf, Math.floor(t * Gt), this.pos + 4), this.pos += 8;
654
+ this.realloc(8), ht(this.buf, t & -1, this.pos), ht(this.buf, Math.floor(t * Bt), this.pos + 4), this.pos += 8;
655
655
  },
656
656
  writeVarint: function(t) {
657
657
  if (t = +t || 0, t > 268435455 || t < 0) {
658
- ce(t, this);
658
+ me(t, this);
659
659
  return;
660
660
  }
661
661
  this.realloc(4), this.buf[this.pos++] = t & 127 | (t > 127 ? 128 : 0), !(t <= 127) && (this.buf[this.pos++] = (t >>>= 7) & 127 | (t > 127 ? 128 : 0), !(t <= 127) && (this.buf[this.pos++] = (t >>>= 7) & 127 | (t > 127 ? 128 : 0), !(t <= 127) && (this.buf[this.pos++] = t >>> 7 & 127)));
@@ -669,9 +669,9 @@ Ot(["exports"], function(o) {
669
669
  writeString: function(t) {
670
670
  t = String(t), this.realloc(t.length * 4), this.pos++;
671
671
  var e = this.pos;
672
- this.pos = Te(this.buf, t, this.pos);
672
+ this.pos = ve(this.buf, t, this.pos);
673
673
  var i = this.pos - e;
674
- i >= 128 && Xt(e, i, this), this.pos = e - 1, this.writeVarint(i), this.pos += i;
674
+ i >= 128 && Nt(e, i, this), this.pos = e - 1, this.writeVarint(i), this.pos += i;
675
675
  },
676
676
  writeFloat: function(t) {
677
677
  this.realloc(4), gt.write(this.buf, t, this.pos, !0, 23, 4), this.pos += 4;
@@ -688,124 +688,124 @@ Ot(["exports"], function(o) {
688
688
  this.pos++;
689
689
  var i = this.pos;
690
690
  t(e, this);
691
- var n = this.pos - i;
692
- n >= 128 && Xt(i, n, this), this.pos = i - 1, this.writeVarint(n), this.pos += n;
691
+ var a = this.pos - i;
692
+ a >= 128 && Nt(i, a, this), this.pos = i - 1, this.writeVarint(a), this.pos += a;
693
693
  },
694
694
  writeMessage: function(t, e, i) {
695
- this.writeTag(t, v.Bytes), this.writeRawMessage(e, i);
695
+ this.writeTag(t, D.Bytes), this.writeRawMessage(e, i);
696
696
  },
697
697
  writePackedVarint: function(t, e) {
698
- e.length && this.writeMessage(t, fe, e);
698
+ e.length && this.writeMessage(t, de, e);
699
699
  },
700
700
  writePackedSVarint: function(t, e) {
701
- e.length && this.writeMessage(t, de, e);
701
+ e.length && this.writeMessage(t, ue, e);
702
702
  },
703
703
  writePackedBoolean: function(t, e) {
704
- e.length && this.writeMessage(t, ye, e);
704
+ e.length && this.writeMessage(t, xe, e);
705
705
  },
706
706
  writePackedFloat: function(t, e) {
707
- e.length && this.writeMessage(t, ue, e);
707
+ e.length && this.writeMessage(t, pe, e);
708
708
  },
709
709
  writePackedDouble: function(t, e) {
710
- e.length && this.writeMessage(t, pe, e);
710
+ e.length && this.writeMessage(t, ye, e);
711
711
  },
712
712
  writePackedFixed32: function(t, e) {
713
- e.length && this.writeMessage(t, xe, e);
713
+ e.length && this.writeMessage(t, ge, e);
714
714
  },
715
715
  writePackedSFixed32: function(t, e) {
716
- e.length && this.writeMessage(t, ge, e);
716
+ e.length && this.writeMessage(t, we, e);
717
717
  },
718
718
  writePackedFixed64: function(t, e) {
719
- e.length && this.writeMessage(t, we, e);
719
+ e.length && this.writeMessage(t, be, e);
720
720
  },
721
721
  writePackedSFixed64: function(t, e) {
722
722
  e.length && this.writeMessage(t, _e, e);
723
723
  },
724
724
  writeBytesField: function(t, e) {
725
- this.writeTag(t, v.Bytes), this.writeBytes(e);
725
+ this.writeTag(t, D.Bytes), this.writeBytes(e);
726
726
  },
727
727
  writeFixed32Field: function(t, e) {
728
- this.writeTag(t, v.Fixed32), this.writeFixed32(e);
728
+ this.writeTag(t, D.Fixed32), this.writeFixed32(e);
729
729
  },
730
730
  writeSFixed32Field: function(t, e) {
731
- this.writeTag(t, v.Fixed32), this.writeSFixed32(e);
731
+ this.writeTag(t, D.Fixed32), this.writeSFixed32(e);
732
732
  },
733
733
  writeFixed64Field: function(t, e) {
734
- this.writeTag(t, v.Fixed64), this.writeFixed64(e);
734
+ this.writeTag(t, D.Fixed64), this.writeFixed64(e);
735
735
  },
736
736
  writeSFixed64Field: function(t, e) {
737
- this.writeTag(t, v.Fixed64), this.writeSFixed64(e);
737
+ this.writeTag(t, D.Fixed64), this.writeSFixed64(e);
738
738
  },
739
739
  writeVarintField: function(t, e) {
740
- this.writeTag(t, v.Varint), this.writeVarint(e);
740
+ this.writeTag(t, D.Varint), this.writeVarint(e);
741
741
  },
742
742
  writeSVarintField: function(t, e) {
743
- this.writeTag(t, v.Varint), this.writeSVarint(e);
743
+ this.writeTag(t, D.Varint), this.writeSVarint(e);
744
744
  },
745
745
  writeStringField: function(t, e) {
746
- this.writeTag(t, v.Bytes), this.writeString(e);
746
+ this.writeTag(t, D.Bytes), this.writeString(e);
747
747
  },
748
748
  writeFloatField: function(t, e) {
749
- this.writeTag(t, v.Fixed32), this.writeFloat(e);
749
+ this.writeTag(t, D.Fixed32), this.writeFloat(e);
750
750
  },
751
751
  writeDoubleField: function(t, e) {
752
- this.writeTag(t, v.Fixed64), this.writeDouble(e);
752
+ this.writeTag(t, D.Fixed64), this.writeDouble(e);
753
753
  },
754
754
  writeBooleanField: function(t, e) {
755
755
  this.writeVarintField(t, !!e);
756
756
  }
757
757
  };
758
- function se(t, e, i) {
759
- var n = i.buf, a, l;
760
- if (l = n[i.pos++], a = (l & 112) >> 4, l < 128 || (l = n[i.pos++], a |= (l & 127) << 3, l < 128) || (l = n[i.pos++], a |= (l & 127) << 10, l < 128) || (l = n[i.pos++], a |= (l & 127) << 17, l < 128) || (l = n[i.pos++], a |= (l & 127) << 24, l < 128) || (l = n[i.pos++], a |= (l & 1) << 31, l < 128)) return mt(t, a, e);
758
+ function ce(t, e, i) {
759
+ var a = i.buf, n, l;
760
+ if (l = a[i.pos++], n = (l & 112) >> 4, l < 128 || (l = a[i.pos++], n |= (l & 127) << 3, l < 128) || (l = a[i.pos++], n |= (l & 127) << 10, l < 128) || (l = a[i.pos++], n |= (l & 127) << 17, l < 128) || (l = a[i.pos++], n |= (l & 127) << 24, l < 128) || (l = a[i.pos++], n |= (l & 1) << 31, l < 128)) return mt(t, n, e);
761
761
  throw new Error("Expected varint not more than 10 bytes");
762
762
  }
763
- function J(t) {
764
- return t.type === v.Bytes ? t.readVarint() + t.pos : t.pos + 1;
763
+ function Z(t) {
764
+ return t.type === D.Bytes ? t.readVarint() + t.pos : t.pos + 1;
765
765
  }
766
766
  function mt(t, e, i) {
767
767
  return i ? e * 4294967296 + (t >>> 0) : (e >>> 0) * 4294967296 + (t >>> 0);
768
768
  }
769
- function ce(t, e) {
770
- var i, n;
771
- if (t >= 0 ? (i = t % 4294967296 | 0, n = t / 4294967296 | 0) : (i = ~(-t % 4294967296), n = ~(-t / 4294967296), i ^ 4294967295 ? i = i + 1 | 0 : (i = 0, n = n + 1 | 0)), t >= 18446744073709552e3 || t < -18446744073709552e3)
769
+ function me(t, e) {
770
+ var i, a;
771
+ if (t >= 0 ? (i = t % 4294967296 | 0, a = t / 4294967296 | 0) : (i = ~(-t % 4294967296), a = ~(-t / 4294967296), i ^ 4294967295 ? i = i + 1 | 0 : (i = 0, a = a + 1 | 0)), t >= 18446744073709552e3 || t < -18446744073709552e3)
772
772
  throw new Error("Given varint doesn't fit into 10 bytes");
773
- e.realloc(10), me(i, n, e), he(n, e);
773
+ e.realloc(10), he(i, a, e), fe(a, e);
774
774
  }
775
- function me(t, e, i) {
775
+ function he(t, e, i) {
776
776
  i.buf[i.pos++] = t & 127 | 128, t >>>= 7, i.buf[i.pos++] = t & 127 | 128, t >>>= 7, i.buf[i.pos++] = t & 127 | 128, t >>>= 7, i.buf[i.pos++] = t & 127 | 128, t >>>= 7, i.buf[i.pos] = t & 127;
777
777
  }
778
- function he(t, e) {
778
+ function fe(t, e) {
779
779
  var i = (t & 7) << 4;
780
780
  e.buf[e.pos++] |= i | ((t >>>= 3) ? 128 : 0), t && (e.buf[e.pos++] = t & 127 | ((t >>>= 7) ? 128 : 0), t && (e.buf[e.pos++] = t & 127 | ((t >>>= 7) ? 128 : 0), t && (e.buf[e.pos++] = t & 127 | ((t >>>= 7) ? 128 : 0), t && (e.buf[e.pos++] = t & 127 | ((t >>>= 7) ? 128 : 0), t && (e.buf[e.pos++] = t & 127)))));
781
781
  }
782
- function Xt(t, e, i) {
783
- var n = e <= 16383 ? 1 : e <= 2097151 ? 2 : e <= 268435455 ? 3 : Math.floor(Math.log(e) / (Math.LN2 * 7));
784
- i.realloc(n);
785
- for (var a = i.pos - 1; a >= t; a--) i.buf[a + n] = i.buf[a];
782
+ function Nt(t, e, i) {
783
+ var a = e <= 16383 ? 1 : e <= 2097151 ? 2 : e <= 268435455 ? 3 : Math.floor(Math.log(e) / (Math.LN2 * 7));
784
+ i.realloc(a);
785
+ for (var n = i.pos - 1; n >= t; n--) i.buf[n + a] = i.buf[n];
786
786
  }
787
- function fe(t, e) {
787
+ function de(t, e) {
788
788
  for (var i = 0; i < t.length; i++) e.writeVarint(t[i]);
789
789
  }
790
- function de(t, e) {
790
+ function ue(t, e) {
791
791
  for (var i = 0; i < t.length; i++) e.writeSVarint(t[i]);
792
792
  }
793
- function ue(t, e) {
793
+ function pe(t, e) {
794
794
  for (var i = 0; i < t.length; i++) e.writeFloat(t[i]);
795
795
  }
796
- function pe(t, e) {
796
+ function ye(t, e) {
797
797
  for (var i = 0; i < t.length; i++) e.writeDouble(t[i]);
798
798
  }
799
- function ye(t, e) {
799
+ function xe(t, e) {
800
800
  for (var i = 0; i < t.length; i++) e.writeBoolean(t[i]);
801
801
  }
802
- function xe(t, e) {
802
+ function ge(t, e) {
803
803
  for (var i = 0; i < t.length; i++) e.writeFixed32(t[i]);
804
804
  }
805
- function ge(t, e) {
805
+ function we(t, e) {
806
806
  for (var i = 0; i < t.length; i++) e.writeSFixed32(t[i]);
807
807
  }
808
- function we(t, e) {
808
+ function be(t, e) {
809
809
  for (var i = 0; i < t.length; i++) e.writeFixed64(t[i]);
810
810
  }
811
811
  function _e(t, e) {
@@ -817,52 +817,52 @@ Ot(["exports"], function(o) {
817
817
  function ht(t, e, i) {
818
818
  t[i] = e, t[i + 1] = e >>> 8, t[i + 2] = e >>> 16, t[i + 3] = e >>> 24;
819
819
  }
820
- function Nt(t, e) {
820
+ function Vt(t, e) {
821
821
  return (t[e] | t[e + 1] << 8 | t[e + 2] << 16) + (t[e + 3] << 24);
822
822
  }
823
- function be(t, e, i) {
824
- for (var n = "", a = e; a < i; ) {
825
- var l = t[a], s = null, c = l > 239 ? 4 : l > 223 ? 3 : l > 191 ? 2 : 1;
826
- if (a + c > i) break;
823
+ function ze(t, e, i) {
824
+ for (var a = "", n = e; n < i; ) {
825
+ var l = t[n], s = null, c = l > 239 ? 4 : l > 223 ? 3 : l > 191 ? 2 : 1;
826
+ if (n + c > i) break;
827
827
  var m, h, f;
828
- c === 1 ? l < 128 && (s = l) : c === 2 ? (m = t[a + 1], (m & 192) === 128 && (s = (l & 31) << 6 | m & 63, s <= 127 && (s = null))) : c === 3 ? (m = t[a + 1], h = t[a + 2], (m & 192) === 128 && (h & 192) === 128 && (s = (l & 15) << 12 | (m & 63) << 6 | h & 63, (s <= 2047 || s >= 55296 && s <= 57343) && (s = null))) : c === 4 && (m = t[a + 1], h = t[a + 2], f = t[a + 3], (m & 192) === 128 && (h & 192) === 128 && (f & 192) === 128 && (s = (l & 15) << 18 | (m & 63) << 12 | (h & 63) << 6 | f & 63, (s <= 65535 || s >= 1114112) && (s = null))), s === null ? (s = 65533, c = 1) : s > 65535 && (s -= 65536, n += String.fromCharCode(s >>> 10 & 1023 | 55296), s = 56320 | s & 1023), n += String.fromCharCode(s), a += c;
828
+ c === 1 ? l < 128 && (s = l) : c === 2 ? (m = t[n + 1], (m & 192) === 128 && (s = (l & 31) << 6 | m & 63, s <= 127 && (s = null))) : c === 3 ? (m = t[n + 1], h = t[n + 2], (m & 192) === 128 && (h & 192) === 128 && (s = (l & 15) << 12 | (m & 63) << 6 | h & 63, (s <= 2047 || s >= 55296 && s <= 57343) && (s = null))) : c === 4 && (m = t[n + 1], h = t[n + 2], f = t[n + 3], (m & 192) === 128 && (h & 192) === 128 && (f & 192) === 128 && (s = (l & 15) << 18 | (m & 63) << 12 | (h & 63) << 6 | f & 63, (s <= 65535 || s >= 1114112) && (s = null))), s === null ? (s = 65533, c = 1) : s > 65535 && (s -= 65536, a += String.fromCharCode(s >>> 10 & 1023 | 55296), s = 56320 | s & 1023), a += String.fromCharCode(s), n += c;
829
829
  }
830
- return n;
831
- }
832
- function ze(t, e, i) {
833
- return Bt.decode(t.subarray(e, i));
830
+ return a;
834
831
  }
835
832
  function Te(t, e, i) {
836
- for (var n = 0, a, l; n < e.length; n++) {
837
- if (a = e.charCodeAt(n), a > 55295 && a < 57344)
833
+ return Xt.decode(t.subarray(e, i));
834
+ }
835
+ function ve(t, e, i) {
836
+ for (var a = 0, n, l; a < e.length; a++) {
837
+ if (n = e.charCodeAt(a), n > 55295 && n < 57344)
838
838
  if (l)
839
- if (a < 56320) {
840
- t[i++] = 239, t[i++] = 191, t[i++] = 189, l = a;
839
+ if (n < 56320) {
840
+ t[i++] = 239, t[i++] = 191, t[i++] = 189, l = n;
841
841
  continue;
842
842
  } else
843
- a = l - 55296 << 10 | a - 56320 | 65536, l = null;
843
+ n = l - 55296 << 10 | n - 56320 | 65536, l = null;
844
844
  else {
845
- a > 56319 || n + 1 === e.length ? (t[i++] = 239, t[i++] = 191, t[i++] = 189) : l = a;
845
+ n > 56319 || a + 1 === e.length ? (t[i++] = 239, t[i++] = 191, t[i++] = 189) : l = n;
846
846
  continue;
847
847
  }
848
848
  else l && (t[i++] = 239, t[i++] = 191, t[i++] = 189, l = null);
849
- a < 128 ? t[i++] = a : (a < 2048 ? t[i++] = a >> 6 | 192 : (a < 65536 ? t[i++] = a >> 12 | 224 : (t[i++] = a >> 18 | 240, t[i++] = a >> 12 & 63 | 128), t[i++] = a >> 6 & 63 | 128), t[i++] = a & 63 | 128);
849
+ n < 128 ? t[i++] = n : (n < 2048 ? t[i++] = n >> 6 | 192 : (n < 65536 ? t[i++] = n >> 12 | 224 : (t[i++] = n >> 18 | 240, t[i++] = n >> 12 & 63 | 128), t[i++] = n >> 6 & 63 | 128), t[i++] = n & 63 | 128);
850
850
  }
851
851
  return i;
852
852
  }
853
- var ve = /* @__PURE__ */ ae(ne), ft;
853
+ var De = /* @__PURE__ */ ae(le), ft;
854
854
  (function(t) {
855
855
  t[t.UNKNOWN = 0] = "UNKNOWN", t[t.POINT = 1] = "POINT", t[t.LINESTRING = 2] = "LINESTRING", t[t.POLYGON = 3] = "POLYGON";
856
856
  })(ft || (ft = {}));
857
- function De(t) {
858
- const e = new ve();
857
+ function Ee(t) {
858
+ const e = new De();
859
859
  for (const i in t.layers) {
860
- const n = t.layers[i];
861
- n.extent || (n.extent = t.extent), e.writeMessage(3, Ee, { ...n, id: i });
860
+ const a = t.layers[i];
861
+ a.extent || (a.extent = t.extent), e.writeMessage(3, Fe, { ...a, id: i });
862
862
  }
863
863
  return e.finish();
864
864
  }
865
- function Ee(t, e) {
865
+ function Fe(t, e) {
866
866
  if (!e)
867
867
  throw new Error("pbf undefined");
868
868
  e.writeVarintField(15, 2), e.writeStringField(1, t.id || ""), e.writeVarintField(5, t.extent || 4096);
@@ -872,86 +872,86 @@ Ot(["exports"], function(o) {
872
872
  keycache: {},
873
873
  valuecache: {}
874
874
  };
875
- for (const n of t.features)
876
- i.feature = n, e.writeMessage(2, Fe, i);
877
- for (const n of i.keys)
878
- e.writeStringField(3, n);
879
- for (const n of i.values)
880
- e.writeMessage(4, Ae, n);
875
+ for (const a of t.features)
876
+ i.feature = a, e.writeMessage(2, Se, i);
877
+ for (const a of i.keys)
878
+ e.writeStringField(3, a);
879
+ for (const a of i.values)
880
+ e.writeMessage(4, Re, a);
881
881
  }
882
- function Fe(t, e) {
882
+ function Se(t, e) {
883
883
  const i = t.feature;
884
884
  if (!i || !e)
885
885
  throw new Error();
886
- e.writeMessage(2, Se, t), e.writeVarintField(3, i.type), e.writeMessage(4, ke, i);
886
+ e.writeMessage(2, ke, t), e.writeVarintField(3, i.type), e.writeMessage(4, Ae, i);
887
887
  }
888
- function Se(t, e) {
888
+ function ke(t, e) {
889
889
  const i = t.feature;
890
890
  if (!i || !e)
891
891
  throw new Error();
892
- const n = t.keys, a = t.values, l = t.keycache, s = t.valuecache;
892
+ const a = t.keys, n = t.values, l = t.keycache, s = t.valuecache;
893
893
  for (const c in i.properties) {
894
894
  let m = i.properties[c], h = l[c];
895
895
  if (m === null)
896
896
  continue;
897
- typeof h > "u" && (n.push(c), h = n.length - 1, l[c] = h), e.writeVarint(h);
897
+ typeof h > "u" && (a.push(c), h = a.length - 1, l[c] = h), e.writeVarint(h);
898
898
  const f = typeof m;
899
899
  f !== "string" && f !== "boolean" && f !== "number" && (m = JSON.stringify(m));
900
900
  const u = `${f}:${m}`;
901
901
  let _ = s[u];
902
- typeof _ > "u" && (a.push(m), _ = a.length - 1, s[u] = _), e.writeVarint(_);
902
+ typeof _ > "u" && (n.push(m), _ = n.length - 1, s[u] = _), e.writeVarint(_);
903
903
  }
904
904
  }
905
- function St(t, e) {
905
+ function kt(t, e) {
906
906
  return (e << 3) + (t & 7);
907
907
  }
908
- function Vt(t) {
908
+ function Ut(t) {
909
909
  return t << 1 ^ t >> 31;
910
910
  }
911
- function ke(t, e) {
911
+ function Ae(t, e) {
912
912
  if (!e)
913
913
  throw new Error();
914
- const i = t.geometry, n = t.type;
915
- let a = 0, l = 0;
914
+ const i = t.geometry, a = t.type;
915
+ let n = 0, l = 0;
916
916
  for (const s of i) {
917
917
  let c = 1;
918
- n === ft.POINT && (c = s.length / 2), e.writeVarint(St(1, c));
919
- const m = s.length / 2, h = n === ft.POLYGON ? m - 1 : m;
918
+ a === ft.POINT && (c = s.length / 2), e.writeVarint(kt(1, c));
919
+ const m = s.length / 2, h = a === ft.POLYGON ? m - 1 : m;
920
920
  for (let f = 0; f < h; f++) {
921
- f === 1 && n !== 1 && e.writeVarint(St(2, h - 1));
922
- const u = s[f * 2] - a, _ = s[f * 2 + 1] - l;
923
- e.writeVarint(Vt(u)), e.writeVarint(Vt(_)), a += u, l += _;
921
+ f === 1 && a !== 1 && e.writeVarint(kt(2, h - 1));
922
+ const u = s[f * 2] - n, _ = s[f * 2 + 1] - l;
923
+ e.writeVarint(Ut(u)), e.writeVarint(Ut(_)), n += u, l += _;
924
924
  }
925
- n === ft.POLYGON && e.writeVarint(St(7, 1));
925
+ a === ft.POLYGON && e.writeVarint(kt(7, 1));
926
926
  }
927
927
  }
928
- function Ae(t, e) {
928
+ function Re(t, e) {
929
929
  if (!e)
930
930
  throw new Error();
931
931
  typeof t == "string" ? e.writeStringField(1, t) : typeof t == "boolean" ? e.writeBooleanField(7, t) : typeof t == "number" && (t % 1 !== 0 ? e.writeDoubleField(3, t) : t < 0 ? e.writeSVarintField(6, t) : e.writeVarintField(5, t));
932
932
  }
933
- class Re {
934
- constructor(e, i, n, a, l) {
935
- this.loaded = Promise.resolve(), this.decodeImage = Lt, this.fetchAndParseTile = (s, c, m, h, f) => {
933
+ class Ce {
934
+ constructor(e, i, a, n, l) {
935
+ this.loaded = Promise.resolve(), this.decodeImage = Gt, this.fetchAndParseTile = (s, c, m, h, f) => {
936
936
  const u = this, _ = this.demUrlPattern.replace("{z}", s.toString()).replace("{x}", c.toString()).replace("{y}", m.toString());
937
- return f == null || f.useTile(_), this.parsedCache.get(_, async (F, M) => {
938
- const P = await u.fetchTile(s, c, m, M, f);
937
+ return f == null || f.useTile(_), this.parsedCache.get(_, async (k, M) => {
938
+ const O = await u.fetchTile(s, c, m, M, f);
939
939
  if (B(M))
940
940
  throw new Error("canceled");
941
- const L = u.decodeImage(P.data, u.encoding, M), R = f == null ? void 0 : f.marker("decode"), V = await L;
942
- return R == null || R(), V;
941
+ const I = u.decodeImage(O.data, u.encoding, M), C = f == null ? void 0 : f.marker("decode"), V = await I;
942
+ return C == null || C(), V;
943
943
  }, h);
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;
944
+ }, this.tileCache = new J(i), this.parsedCache = new J(i), this.contourCache = new J(i), this.timeoutMs = l, this.demUrlPattern = e, this.encoding = a, this.maxzoom = n;
945
945
  }
946
- fetchTile(e, i, n, a, l) {
947
- const s = this.demUrlPattern.replace("{z}", e.toString()).replace("{x}", i.toString()).replace("{y}", n.toString());
946
+ fetchTile(e, i, a, n, l) {
947
+ const s = this.demUrlPattern.replace("{z}", e.toString()).replace("{x}", i.toString()).replace("{y}", a.toString());
948
948
  return l == null || l.useTile(s), this.tileCache.get(s, (c, m) => {
949
949
  const h = {
950
950
  signal: m.signal
951
951
  };
952
952
  l == null || l.fetchTile(s);
953
953
  const f = l == null ? void 0 : l.marker("fetch");
954
- return G(this.timeoutMs, fetch(s, h).then(async (u) => {
954
+ return L(this.timeoutMs, fetch(s, h).then(async (u) => {
955
955
  if (f == null || f(), !u.ok)
956
956
  throw new Error(`Bad response: ${u.status} for ${s}`);
957
957
  return {
@@ -960,25 +960,25 @@ Ot(["exports"], function(o) {
960
960
  cacheControl: u.headers.get("cache-control") || void 0
961
961
  };
962
962
  }), m);
963
- }, a);
963
+ }, n);
964
964
  }
965
- async fetchDem(e, i, n, a, l, s) {
966
- const c = Math.min(e - (a.overzoom || 0), this.maxzoom), m = e - c, h = 1 << m, f = Math.floor(i / h), u = Math.floor(n / h), _ = await this.fetchAndParseTile(c, f, u, l, s);
967
- return $.fromRawDem(_).split(m, i % h, n % h);
965
+ async fetchDem(e, i, a, n, l, s) {
966
+ const c = Math.min(e - (n.overzoom || 0), this.maxzoom), m = e - c, h = 1 << m, f = Math.floor(i / h), u = Math.floor(a / h), _ = await this.fetchAndParseTile(c, f, u, l, s);
967
+ return $.fromRawDem(_).split(m, i % h, a % h);
968
968
  }
969
- fetchContourTile(e, i, n, a, l, s) {
970
- const { levels: c, multiplier: m = 1, buffer: h = 1, extent: f = 4096, contourLayer: u = "contours", elevationKey: _ = "ele", levelKey: F = "level", subsampleBelow: M = 100 } = a;
969
+ fetchContourTile(e, i, a, n, l, s) {
970
+ const { levels: c, multiplier: m = 1, buffer: h = 1, extent: f = 4096, contourLayer: u = "contours", elevationKey: _ = "ele", levelKey: k = "level", subsampleBelow: M = 100 } = n;
971
971
  if (!c || c.length === 0)
972
972
  return Promise.resolve({ arrayBuffer: new ArrayBuffer(0) });
973
- const P = [e, i, n, p(a)].join("/");
974
- return this.contourCache.get(P, async (L, R) => {
973
+ const O = [e, i, a, p(n)].join("/");
974
+ return this.contourCache.get(O, async (I, C) => {
975
975
  const V = 1 << e, dt = [];
976
- for (let q = n - 1; q <= n + 1; q++)
977
- for (let nt = i - 1; nt <= i + 1; nt++)
978
- dt.push(q < 0 || q >= V ? void 0 : this.fetchDem(e, (nt + V) % V, q, a, R, s));
976
+ for (let q = a - 1; q <= a + 1; q++)
977
+ for (let at = i - 1; at <= i + 1; at++)
978
+ dt.push(q < 0 || q >= V ? void 0 : this.fetchDem(e, (at + V) % V, q, n, C, s));
979
979
  const pt = await Promise.all(dt);
980
980
  let X = $.combineNeighbors(pt);
981
- if (!X || B(R))
981
+ if (!X || B(C))
982
982
  return { arrayBuffer: new Uint8Array().buffer };
983
983
  const ot = s == null ? void 0 : s.marker("isoline");
984
984
  if (X.width >= M)
@@ -987,52 +987,52 @@ Ot(["exports"], function(o) {
987
987
  for (; X.width < M; )
988
988
  X = X.subsamplePixelCenters(2).materialize(2);
989
989
  X = X.averagePixelCentersToGrid().scaleElevation(m).materialize(1);
990
- const C = w(c[0], X, f, h);
990
+ const P = x(c[0], X, f, h);
991
991
  ot == null || ot();
992
- const kt = De({
992
+ const At = Ee({
993
993
  extent: f,
994
994
  layers: {
995
995
  [u]: {
996
- features: Object.entries(C).map(([q, nt]) => {
997
- const _t = Number(q);
996
+ features: Object.entries(P).map(([q, at]) => {
997
+ const bt = Number(q);
998
998
  return {
999
999
  type: ft.LINESTRING,
1000
- geometry: nt,
1000
+ geometry: at,
1001
1001
  properties: {
1002
- [_]: _t,
1003
- [F]: Math.max(...c.map((bt, H) => _t % bt === 0 ? H : 0))
1002
+ [_]: bt,
1003
+ [k]: Math.max(...c.map((_t, H) => bt % _t === 0 ? H : 0))
1004
1004
  }
1005
1005
  };
1006
1006
  })
1007
1007
  }
1008
1008
  }
1009
1009
  });
1010
- return ot == null || ot(), { arrayBuffer: kt.buffer };
1010
+ return ot == null || ot(), { arrayBuffer: At.buffer };
1011
1011
  }, l);
1012
1012
  }
1013
1013
  }
1014
- const Q = typeof performance < "u" ? performance : void 0, Ce = Q ? Q.timeOrigin || (/* @__PURE__ */ new Date()).getTime() - Q.now() : (/* @__PURE__ */ new Date()).getTime();
1014
+ const Q = typeof performance < "u" ? performance : void 0, Pe = Q ? Q.timeOrigin || (/* @__PURE__ */ new Date()).getTime() - Q.now() : (/* @__PURE__ */ new Date()).getTime();
1015
1015
  function Me(t) {
1016
1016
  var e;
1017
1017
  return JSON.parse(JSON.stringify(((e = Q == null ? void 0 : Q.getEntriesByName) === null || e === void 0 ? void 0 : e.call(Q, t)) || []));
1018
1018
  }
1019
- function Ut() {
1019
+ function Wt() {
1020
1020
  return Q ? Q.now() : (/* @__PURE__ */ new Date()).getTime();
1021
1021
  }
1022
- function Pe(t) {
1022
+ function Oe(t) {
1023
1023
  const e = [];
1024
1024
  for (const i of t)
1025
1025
  e.push(...i);
1026
1026
  return e;
1027
1027
  }
1028
- class Wt {
1028
+ class jt {
1029
1029
  constructor(e) {
1030
- this.marks = {}, this.urls = [], this.fetched = [], this.resources = [], this.tilesFetched = 0, this.timeOrigin = Ce, this.finish = (i) => {
1030
+ this.marks = {}, this.urls = [], this.fetched = [], this.resources = [], this.tilesFetched = 0, this.timeOrigin = Pe, this.finish = (i) => {
1031
1031
  this.markFinish();
1032
- const n = (m) => {
1032
+ const a = (m) => {
1033
1033
  const h = this.marks[m] || [], f = Math.max(...h.map((_) => Math.max(..._))), u = Math.min(...h.map((_) => Math.min(..._)));
1034
1034
  return Number.isFinite(f) ? f - u : void 0;
1035
- }, a = n("main") || 0, l = n("fetch"), s = n("decode"), c = n("isoline");
1035
+ }, n = a("main") || 0, l = a("fetch"), s = a("decode"), c = a("isoline");
1036
1036
  return {
1037
1037
  url: i,
1038
1038
  tilesUsed: this.tilesFetched,
@@ -1040,47 +1040,47 @@ Ot(["exports"], function(o) {
1040
1040
  marks: this.marks,
1041
1041
  resources: [
1042
1042
  ...this.resources,
1043
- ...Pe(this.fetched.map(Me))
1043
+ ...Oe(this.fetched.map(Me))
1044
1044
  ],
1045
- duration: a,
1045
+ duration: n,
1046
1046
  fetch: l,
1047
1047
  decode: s,
1048
1048
  process: c,
1049
- wait: a - (l || 0) - (s || 0) - (c || 0)
1049
+ wait: n - (l || 0) - (s || 0) - (c || 0)
1050
1050
  };
1051
1051
  }, this.error = (i) => ({ ...this.finish(i), error: !0 }), this.marker = (i) => {
1052
- var n;
1052
+ var a;
1053
1053
  this.marks[i] || (this.marks[i] = []);
1054
- const a = [Ut()];
1055
- return (n = this.marks[i]) === null || n === void 0 || n.push(a), () => a.push(Ut());
1054
+ const n = [Wt()];
1055
+ return (a = this.marks[i]) === null || a === void 0 || a.push(n), () => n.push(Wt());
1056
1056
  }, this.useTile = (i) => {
1057
1057
  this.urls.indexOf(i) < 0 && (this.urls.push(i), this.tilesFetched++);
1058
1058
  }, this.fetchTile = (i) => {
1059
1059
  this.fetched.indexOf(i) < 0 && this.fetched.push(i);
1060
1060
  }, this.addAll = (i) => {
1061
- var n;
1061
+ var a;
1062
1062
  this.tilesFetched += i.tilesUsed;
1063
- const a = i.origin - this.timeOrigin;
1063
+ const n = i.origin - this.timeOrigin;
1064
1064
  for (const l in i.marks) {
1065
1065
  const s = l;
1066
- (this.marks[s] || (this.marks[s] = [])).push(...((n = i.marks[s]) === null || n === void 0 ? void 0 : n.map((m) => m.map((h) => h + a))) || []);
1066
+ (this.marks[s] || (this.marks[s] = [])).push(...((a = i.marks[s]) === null || a === void 0 ? void 0 : a.map((m) => m.map((h) => h + n))) || []);
1067
1067
  }
1068
- this.resources.push(...i.resources.map((l) => Le(l, a)));
1068
+ this.resources.push(...i.resources.map((l) => Ge(l, n)));
1069
1069
  }, this.markFinish = this.marker(e);
1070
1070
  }
1071
1071
  }
1072
- const Oe = /(Start$|End$|^start|^end)/;
1073
- function Le(t, e) {
1072
+ const Ie = /(Start$|End$|^start|^end)/;
1073
+ function Ge(t, e) {
1074
1074
  const i = {};
1075
- for (const n in t)
1076
- t[n] !== 0 && Oe.test(n) ? i[n] = Number(t[n]) + e : i[n] = t[n];
1075
+ for (const a in t)
1076
+ t[a] !== 0 && Ie.test(a) ? i[a] = Number(t[a]) + e : i[a] = t[a];
1077
1077
  return i;
1078
1078
  }
1079
- let Ie = 0;
1080
- class Ge {
1081
- constructor(e, i, n = 2e4) {
1082
- this.callbacks = {}, this.cancels = {}, this.dest = e, this.timeoutMs = n, this.dest.onmessage = async ({ data: a }) => {
1083
- const l = a;
1079
+ let Le = 0;
1080
+ class Be {
1081
+ constructor(e, i, a = 2e4) {
1082
+ this.callbacks = {}, this.cancels = {}, this.dest = e, this.timeoutMs = a, this.dest.onmessage = async ({ data: n }) => {
1083
+ const l = n;
1084
1084
  if (l.type === "cancel") {
1085
1085
  const s = this.cancels[l.id];
1086
1086
  delete this.cancels[l.id], s == null || s.abort();
@@ -1088,7 +1088,7 @@ Ot(["exports"], function(o) {
1088
1088
  const s = this.callbacks[l.id];
1089
1089
  delete this.callbacks[l.id], s && s(l.error ? new Error(l.error) : void 0, l.response, l.timings);
1090
1090
  } else if (l.type === "request") {
1091
- const s = new Wt("worker"), c = i[l.name], m = new AbortController(), h = c.apply(c, [
1091
+ const s = new jt("worker"), c = i[l.name], m = new AbortController(), h = c.apply(c, [
1092
1092
  ...l.args,
1093
1093
  m,
1094
1094
  s
@@ -1120,130 +1120,130 @@ Ot(["exports"], function(o) {
1120
1120
  this.dest.postMessage(e, i || []);
1121
1121
  }
1122
1122
  /** Invokes a method by name with a set of arguments in the remote context. */
1123
- send(e, i, n, a, ...l) {
1124
- const s = ++Ie, c = new Promise((m, h) => {
1123
+ send(e, i, a, n, ...l) {
1124
+ const s = ++Le, c = new Promise((m, h) => {
1125
1125
  this.postMessage({ id: s, type: "request", name: e, args: l }, i), this.callbacks[s] = (f, u, _) => {
1126
- a == null || a.addAll(_), f ? h(f) : m(u);
1126
+ n == null || n.addAll(_), f ? h(f) : m(u);
1127
1127
  };
1128
1128
  });
1129
- return U(n, () => {
1129
+ return U(a, () => {
1130
1130
  delete this.callbacks[s], this.postMessage({ id: s, type: "cancel" });
1131
- }), G(this.timeoutMs, c, n);
1131
+ }), L(this.timeoutMs, c, a);
1132
1132
  }
1133
1133
  }
1134
- o.A = Ge, o.H = $, o.L = Re, o.T = Wt, o.a = z, o.b = w, o.c = Dt, o.d = Lt, o.e = A, o.f = k, o.g = x, o.p = D;
1134
+ o.A = Be, o.H = $, o.L = Ce, o.T = jt, o.a = z, o.b = x, o.c = Et, o.d = Gt, o.e = A, o.f = R, o.g = g, o.p = E;
1135
1135
  });
1136
- Ot(["./shared"], function(o) {
1137
- const r = (g) => Promise.reject(new Error(`No manager registered for ${g}`));
1136
+ It(["./shared"], function(o) {
1137
+ const r = (w) => Promise.reject(new Error(`No manager registered for ${w}`));
1138
1138
  class d {
1139
1139
  constructor() {
1140
- this.managers = {}, this.init = (w, b) => (this.managers[w.managerId] = new o.L(w.demUrlPattern, w.cacheSize, w.encoding, w.maxzoom, w.timeoutMs), Promise.resolve()), this.fetchTile = (w, b, S, O, A, z) => {
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, v, F, A, z) => {
1141
1141
  var p;
1142
- return ((p = this.managers[w]) === null || p === void 0 ? void 0 : p.fetchTile(b, S, O, A, z)) || r(w);
1143
- }, this.fetchAndParseTile = (w, b, S, O, A, z) => {
1142
+ return ((p = this.managers[x]) === null || p === void 0 ? void 0 : p.fetchTile(b, v, F, A, z)) || r(x);
1143
+ }, this.fetchAndParseTile = (x, b, v, F, A, z) => {
1144
1144
  var p;
1145
- return o.p(((p = this.managers[w]) === null || p === void 0 ? void 0 : p.fetchAndParseTile(b, S, O, A, z)) || r(w), !0);
1146
- }, this.fetchContourTile = (w, b, S, O, A, z, p) => {
1147
- var x;
1148
- return o.f(((x = this.managers[w]) === null || x === void 0 ? void 0 : x.fetchContourTile(b, S, O, A, z, p)) || r(w));
1145
+ return o.p(((p = this.managers[x]) === null || p === void 0 ? void 0 : p.fetchAndParseTile(b, v, F, A, z)) || r(x), !0);
1146
+ }, this.fetchContourTile = (x, b, v, F, A, z, p) => {
1147
+ var g;
1148
+ return o.f(((g = this.managers[x]) === null || g === void 0 ? void 0 : g.fetchContourTile(b, v, F, A, z, p)) || r(x));
1149
1149
  };
1150
1150
  }
1151
1151
  }
1152
1152
  const y = typeof self < "u" ? self : typeof window < "u" ? window : global;
1153
1153
  y.actor = new o.A(y, new d());
1154
1154
  });
1155
- Ot(["./shared"], function(o) {
1155
+ It(["./shared"], function(o) {
1156
1156
  const r = { workerUrl: "" };
1157
1157
  let d, y = 0;
1158
- class g {
1158
+ class w {
1159
1159
  constructor() {
1160
- this.decodeImage = (x, T, D) => o.p(o.d(x, T, D), !1);
1160
+ this.decodeImage = (g, T, E) => o.p(o.d(g, T, E), !1);
1161
1161
  }
1162
1162
  }
1163
- function w() {
1163
+ function x() {
1164
1164
  if (!d) {
1165
- const p = new Worker(r.workerUrl), x = new g();
1166
- d = new o.A(p, x);
1165
+ const p = new Worker(r.workerUrl), g = new w();
1166
+ d = new o.A(p, g);
1167
1167
  }
1168
1168
  return d;
1169
1169
  }
1170
1170
  class b {
1171
- constructor(x, T, D, k, j, ct) {
1172
- this.fetchTile = (Y, G, U, B, E) => this.actor.send("fetchTile", [], B, E, this.managerId, Y, G, U), this.fetchAndParseTile = (Y, G, U, B, E) => this.actor.send("fetchAndParseTile", [], B, E, this.managerId, Y, G, U), this.fetchContourTile = (Y, G, U, B, E, Z) => this.actor.send("fetchContourTile", [], E, Z, this.managerId, Y, G, U, B);
1171
+ constructor(g, T, E, R, j, ct) {
1172
+ this.fetchTile = (Y, L, U, B, S) => this.actor.send("fetchTile", [], B, S, this.managerId, Y, L, U), this.fetchAndParseTile = (Y, L, U, B, S) => this.actor.send("fetchAndParseTile", [], B, S, this.managerId, Y, L, U), this.fetchContourTile = (Y, L, U, B, S, J) => this.actor.send("fetchContourTile", [], S, J, this.managerId, Y, L, U, B);
1173
1173
  const tt = this.managerId = ++y;
1174
- this.actor = ct || w(), this.loaded = this.actor.send("init", [], new AbortController(), void 0, {
1174
+ this.actor = ct || x(), this.loaded = this.actor.send("init", [], new AbortController(), void 0, {
1175
1175
  cacheSize: T,
1176
- demUrlPattern: x,
1177
- encoding: D,
1178
- maxzoom: k,
1176
+ demUrlPattern: g,
1177
+ encoding: E,
1178
+ maxzoom: R,
1179
1179
  managerId: tt,
1180
1180
  timeoutMs: j
1181
1181
  });
1182
1182
  }
1183
1183
  }
1184
1184
  Blob.prototype.arrayBuffer || (Blob.prototype.arrayBuffer = function() {
1185
- return new Promise((x, T) => {
1186
- const D = new FileReader();
1187
- D.onload = (k) => {
1185
+ return new Promise((g, T) => {
1186
+ const E = new FileReader();
1187
+ E.onload = (R) => {
1188
1188
  var j;
1189
- return x((j = k.target) === null || j === void 0 ? void 0 : j.result);
1190
- }, D.onerror = T, D.readAsArrayBuffer(this);
1189
+ return g((j = R.target) === null || j === void 0 ? void 0 : j.result);
1190
+ }, E.onerror = T, E.readAsArrayBuffer(this);
1191
1191
  });
1192
1192
  });
1193
- const S = (p) => (x, T) => {
1193
+ const v = (p) => (g, T) => {
1194
1194
  if (T instanceof AbortController)
1195
- return p(x, T);
1195
+ return p(g, T);
1196
1196
  {
1197
- const D = new AbortController();
1198
- return p(x, D).then((k) => T(void 0, k.data, k.cacheControl, k.expires), (k) => T(k)), { cancel: () => D.abort() };
1197
+ const E = new AbortController();
1198
+ return p(g, E).then((R) => T(void 0, R.data, R.cacheControl, R.expires), (R) => T(R)), { cancel: () => E.abort() };
1199
1199
  }
1200
- }, O = /* @__PURE__ */ new Set();
1200
+ }, F = /* @__PURE__ */ new Set();
1201
1201
  class A {
1202
- constructor({ url: x, cacheSize: T = 100, id: D = "dem", encoding: k = "terrarium", maxzoom: j = 12, worker: ct = !0, timeoutMs: tt = 1e4, actor: Y }) {
1203
- this.timingCallbacks = [], this.onTiming = (E) => {
1204
- this.timingCallbacks.push(E);
1205
- }, this.setupMaplibre = (E) => {
1206
- E.addProtocol(this.sharedDemProtocolId, this.sharedDemProtocol), E.addProtocol(this.contourProtocolId, this.contourProtocol);
1207
- }, this.sharedDemProtocolV4 = async (E, Z) => {
1208
- const [K, et, N] = this.parseUrl(E.url), it = new o.T("main");
1209
- let at;
1202
+ constructor({ url: g, cacheSize: T = 100, id: E = "dem", encoding: R = "terrarium", maxzoom: j = 12, worker: ct = !0, timeoutMs: tt = 1e4, actor: Y }) {
1203
+ this.timingCallbacks = [], this.onTiming = (S) => {
1204
+ this.timingCallbacks.push(S);
1205
+ }, this.setupMaplibre = (S) => {
1206
+ S.addProtocol(this.sharedDemProtocolId, this.sharedDemProtocol), S.addProtocol(this.contourProtocolId, this.contourProtocol);
1207
+ }, this.sharedDemProtocolV4 = async (S, J) => {
1208
+ const [K, et, N] = this.parseUrl(S.url), it = new o.T("main");
1209
+ let nt;
1210
1210
  try {
1211
- const W = await this.manager.fetchTile(K, et, N, Z, it);
1212
- return at = it.finish(E.url), {
1211
+ const W = await this.manager.fetchTile(K, et, N, J, it);
1212
+ return nt = it.finish(S.url), {
1213
1213
  data: await W.data.arrayBuffer(),
1214
1214
  cacheControl: W.cacheControl,
1215
1215
  expires: W.expires
1216
1216
  };
1217
1217
  } catch (W) {
1218
- throw at = it.error(E.url), W;
1218
+ throw nt = it.error(S.url), W;
1219
1219
  } finally {
1220
- this.timingCallbacks.forEach((W) => W(at));
1220
+ this.timingCallbacks.forEach((W) => W(nt));
1221
1221
  }
1222
- }, this.contourProtocolV4 = async (E, Z) => {
1222
+ }, this.contourProtocolV4 = async (S, J) => {
1223
1223
  const K = new o.T("main");
1224
1224
  let et;
1225
1225
  try {
1226
- const [N, it, at] = this.parseUrl(E.url), W = o.a(E.url), xt = await this.manager.fetchContourTile(N, it, at, o.g(W, N), Z, K);
1227
- return et = K.finish(E.url), { data: xt.arrayBuffer };
1226
+ const [N, it, nt] = this.parseUrl(S.url), W = o.a(S.url), xt = await this.manager.fetchContourTile(N, it, nt, o.g(W, N), J, K);
1227
+ return et = K.finish(S.url), { data: xt.arrayBuffer };
1228
1228
  } catch (N) {
1229
- throw et = K.error(E.url), N;
1229
+ throw et = K.error(S.url), N;
1230
1230
  } finally {
1231
1231
  this.timingCallbacks.forEach((N) => N(et));
1232
1232
  }
1233
- }, this.contourProtocol = S(this.contourProtocolV4), this.sharedDemProtocol = S(this.sharedDemProtocolV4), this.contourProtocolUrl = (E) => `${this.contourProtocolUrlBase}?${o.e(E)}`;
1234
- let G = D, U = 1;
1235
- for (; O.has(G); )
1236
- G = D + U++;
1237
- O.add(G), this.sharedDemProtocolId = `${G}-shared`, this.contourProtocolId = `${G}-contour`, this.sharedDemProtocolUrl = `${this.sharedDemProtocolId}://{z}/{x}/{y}`, this.contourProtocolUrlBase = `${this.contourProtocolId}://{z}/{x}/{y}`;
1233
+ }, this.contourProtocol = v(this.contourProtocolV4), this.sharedDemProtocol = v(this.sharedDemProtocolV4), this.contourProtocolUrl = (S) => `${this.contourProtocolUrlBase}?${o.e(S)}`;
1234
+ let L = E, U = 1;
1235
+ for (; F.has(L); )
1236
+ L = E + U++;
1237
+ F.add(L), this.sharedDemProtocolId = `${L}-shared`, this.contourProtocolId = `${L}-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(x, T, k, j, tt, Y);
1239
+ this.manager = new B(g, T, R, j, tt, Y);
1240
1240
  }
1241
- getDemTile(x, T, D, k) {
1242
- return this.manager.fetchAndParseTile(x, T, D, k || new AbortController());
1241
+ getDemTile(g, T, E, R) {
1242
+ return this.manager.fetchAndParseTile(g, T, E, R || new AbortController());
1243
1243
  }
1244
- parseUrl(x) {
1245
- const [, T, D, k] = /\/\/(\d+)\/(\d+)\/(\d+)/.exec(x) || [];
1246
- return [Number(T), Number(D), Number(k)];
1244
+ parseUrl(g) {
1245
+ const [, T, E, R] = /\/\/(\d+)\/(\d+)\/(\d+)/.exec(g) || [];
1246
+ return [Number(T), Number(E), Number(R)];
1247
1247
  }
1248
1248
  }
1249
1249
  return {
@@ -1260,85 +1260,85 @@ Ot(["./shared"], function(o) {
1260
1260
  }
1261
1261
  };
1262
1262
  });
1263
- var Be = Pt;
1264
- function Xe(o) {
1263
+ var Xe = Ot;
1264
+ function Ne(o) {
1265
1265
  return o;
1266
1266
  }
1267
- function Ne(o) {
1268
- if (o == null) return Xe;
1269
- var r, d, y = o.scale[0], g = o.scale[1], w = o.translate[0], b = o.translate[1];
1270
- return function(S, O) {
1271
- O || (r = d = 0);
1272
- var A = 2, z = S.length, p = new Array(z);
1273
- for (p[0] = (r += S[0]) * y + w, p[1] = (d += S[1]) * g + b; A < z; ) p[A] = S[A], ++A;
1267
+ function Ve(o) {
1268
+ if (o == null) return Ne;
1269
+ var r, d, y = o.scale[0], w = o.scale[1], x = o.translate[0], b = o.translate[1];
1270
+ return function(v, F) {
1271
+ F || (r = d = 0);
1272
+ var A = 2, z = v.length, p = new Array(z);
1273
+ for (p[0] = (r += v[0]) * y + x, p[1] = (d += v[1]) * w + b; A < z; ) p[A] = v[A], ++A;
1274
1274
  return p;
1275
1275
  };
1276
1276
  }
1277
- function Ve(o, r) {
1278
- for (var d, y = o.length, g = y - r; g < --y; ) d = o[g], o[g++] = o[y], o[y] = d;
1277
+ function Ue(o, r) {
1278
+ for (var d, y = o.length, w = y - r; w < --y; ) d = o[w], o[w++] = o[y], o[y] = d;
1279
1279
  }
1280
- function $t(o, r) {
1280
+ function Kt(o, r) {
1281
1281
  return typeof r == "string" && (r = o.objects[r]), r.type === "GeometryCollection" ? { type: "FeatureCollection", features: r.geometries.map(function(d) {
1282
- return Kt(o, d);
1283
- }) } : Kt(o, r);
1282
+ return Ht(o, d);
1283
+ }) } : Ht(o, r);
1284
1284
  }
1285
- function Kt(o, r) {
1286
- var d = r.id, y = r.bbox, g = r.properties == null ? {} : r.properties, w = Ue(o, r);
1287
- return d == null && y == null ? { type: "Feature", properties: g, geometry: w } : y == null ? { type: "Feature", id: d, properties: g, geometry: w } : { type: "Feature", id: d, bbox: y, properties: g, geometry: w };
1285
+ function Ht(o, r) {
1286
+ var d = r.id, y = r.bbox, w = r.properties == null ? {} : r.properties, x = We(o, r);
1287
+ return d == null && y == null ? { type: "Feature", properties: w, geometry: x } : y == null ? { type: "Feature", id: d, properties: w, geometry: x } : { type: "Feature", id: d, bbox: y, properties: w, geometry: x };
1288
1288
  }
1289
- function Ue(o, r) {
1290
- var d = Ne(o.transform), y = o.arcs;
1291
- function g(z, p) {
1289
+ function We(o, r) {
1290
+ var d = Ve(o.transform), y = o.arcs;
1291
+ function w(z, p) {
1292
1292
  p.length && p.pop();
1293
- for (var x = y[z < 0 ? ~z : z], T = 0, D = x.length; T < D; ++T)
1294
- p.push(d(x[T], T));
1295
- z < 0 && Ve(p, D);
1293
+ for (var g = y[z < 0 ? ~z : z], T = 0, E = g.length; T < E; ++T)
1294
+ p.push(d(g[T], T));
1295
+ z < 0 && Ue(p, E);
1296
1296
  }
1297
- function w(z) {
1297
+ function x(z) {
1298
1298
  return d(z);
1299
1299
  }
1300
1300
  function b(z) {
1301
- for (var p = [], x = 0, T = z.length; x < T; ++x) g(z[x], p);
1301
+ for (var p = [], g = 0, T = z.length; g < T; ++g) w(z[g], p);
1302
1302
  return p.length < 2 && p.push(p[0]), p;
1303
1303
  }
1304
- function S(z) {
1304
+ function v(z) {
1305
1305
  for (var p = b(z); p.length < 4; ) p.push(p[0]);
1306
1306
  return p;
1307
1307
  }
1308
- function O(z) {
1309
- return z.map(S);
1308
+ function F(z) {
1309
+ return z.map(v);
1310
1310
  }
1311
1311
  function A(z) {
1312
- var p = z.type, x;
1312
+ var p = z.type, g;
1313
1313
  switch (p) {
1314
1314
  case "GeometryCollection":
1315
1315
  return { type: p, geometries: z.geometries.map(A) };
1316
1316
  case "Point":
1317
- x = w(z.coordinates);
1317
+ g = x(z.coordinates);
1318
1318
  break;
1319
1319
  case "MultiPoint":
1320
- x = z.coordinates.map(w);
1320
+ g = z.coordinates.map(x);
1321
1321
  break;
1322
1322
  case "LineString":
1323
- x = b(z.arcs);
1323
+ g = b(z.arcs);
1324
1324
  break;
1325
1325
  case "MultiLineString":
1326
- x = z.arcs.map(b);
1326
+ g = z.arcs.map(b);
1327
1327
  break;
1328
1328
  case "Polygon":
1329
- x = O(z.arcs);
1329
+ g = F(z.arcs);
1330
1330
  break;
1331
1331
  case "MultiPolygon":
1332
- x = z.arcs.map(O);
1332
+ g = z.arcs.map(F);
1333
1333
  break;
1334
1334
  default:
1335
1335
  return null;
1336
1336
  }
1337
- return { type: p, coordinates: x };
1337
+ return { type: p, coordinates: g };
1338
1338
  }
1339
1339
  return A(r);
1340
1340
  }
1341
- const We = {
1341
+ const je = {
1342
1342
  airspaceStroke: "#AAB7B8",
1343
1343
  restrictedStroke: "#D35400",
1344
1344
  controlledStroke: "#10B981",
@@ -1350,8 +1350,8 @@ const We = {
1350
1350
  airport: "#006400",
1351
1351
  runway: "#333333"
1352
1352
  };
1353
- function je() {
1354
- const o = "navdata", r = We;
1353
+ function $e() {
1354
+ const o = "navdata", r = je;
1355
1355
  return [
1356
1356
  {
1357
1357
  id: "landLaye",
@@ -2048,7 +2048,7 @@ function je() {
2048
2048
  }
2049
2049
  ];
2050
2050
  }
2051
- const $e = {
2051
+ const Ke = {
2052
2052
  airspaceStroke: "#18C29C",
2053
2053
  restrictedStroke: "#CC7722",
2054
2054
  controlledStroke: "#22C55E",
@@ -2060,8 +2060,8 @@ const $e = {
2060
2060
  airport: "#73ccdd",
2061
2061
  runway: "#64748b"
2062
2062
  };
2063
- function Ke() {
2064
- const o = "navdata", r = $e;
2063
+ function He() {
2064
+ const o = "navdata", r = Ke;
2065
2065
  return [
2066
2066
  {
2067
2067
  id: "landLaye",
@@ -2435,6 +2435,27 @@ function Ke() {
2435
2435
  layout: { "icon-image": "vor_dial", "icon-size": ["interpolate", ["linear"], ["zoom"], 5, 0.072, 10, 0.072, 11, 0.126, 12, 0.18, 13, 0.234, 14, 0.288, 15, 0.342, 16, 0.396, 17, 0.45, 22, 0.45], "icon-rotate": ["to-number", ["get", "VAL_MAG_VAR"], 0], "icon-rotation-alignment": "map", "symbol-z-order": "viewport-y", "text-letter-spacing": 0.05, "text-optional": !0, "icon-allow-overlap": !0, visibility: "none" },
2436
2436
  paint: { "icon-color": "#38bdf8" }
2437
2437
  },
2438
+ {
2439
+ id: "vor-symbol-normal",
2440
+ minzoom: 4,
2441
+ maxzoom: 9,
2442
+ type: "symbol",
2443
+ source: o,
2444
+ "source-layer": "vor",
2445
+ layout: {
2446
+ "icon-image": "v2:vor-normal",
2447
+ "icon-size": ["interpolate", ["linear"], ["zoom"], 4, 0.7, 8, 1],
2448
+ "icon-rotation-alignment": "map",
2449
+ "symbol-z-order": "viewport-y",
2450
+ "text-letter-spacing": 0.05,
2451
+ "text-optional": !0,
2452
+ "icon-allow-overlap": !0
2453
+ },
2454
+ paint: {
2455
+ "icon-color": "#38bdf8",
2456
+ "icon-opacity": ["interpolate", ["linear"], ["zoom"], 8, 1, 9, 0]
2457
+ }
2458
+ },
2438
2459
  {
2439
2460
  id: "vor-label",
2440
2461
  type: "symbol",
@@ -2475,13 +2496,13 @@ function Ke() {
2475
2496
  ];
2476
2497
  }
2477
2498
  const ut = {
2478
- light: { id: "light", label: "日间", background: "#EAF2F8", build: je },
2479
- dark: { id: "dark", label: "夜间", background: "#000000", build: Ke }
2499
+ light: { id: "light", label: "日间", background: "#EAF2F8", build: $e },
2500
+ dark: { id: "dark", label: "夜间", background: "#000000", build: He }
2480
2501
  };
2481
- function Ht(o = "light") {
2502
+ function Pt(o = "light") {
2482
2503
  return (ut[o] ?? ut.light).build();
2483
2504
  }
2484
- const Ct = {
2505
+ const Yt = {
2485
2506
  adiz: ["adiz-line", "adiz-label"],
2486
2507
  airspace: ["fir-line", "fir_line_dash", "fir-label", "fir-label-lineside"],
2487
2508
  restricted: ["restricted-fill", "restricted-stroke", "restricted-label"],
@@ -2492,7 +2513,7 @@ const Ct = {
2492
2513
  ndb: ["ndb-symbol"],
2493
2514
  airport: ["airport-circle"],
2494
2515
  runway: ["runway-line", "runway-line-amm", "runway-label"]
2495
- }, He = {
2516
+ }, Ye = {
2496
2517
  /** 机场边界(淡暖灰垫底,在纯白底上显现轮廓) */
2497
2518
  airport: "#e2e8f0",
2498
2519
  /** 跑道面(中深灰,作为白底上的绝对重心) */
@@ -2518,8 +2539,8 @@ const Ct = {
2518
2539
  /** 事故易发区(深橙色) */
2519
2540
  hotspot: "#ea580c"
2520
2541
  };
2521
- function Ye(o = "amm") {
2522
- const r = He;
2542
+ function Je(o = "amm") {
2543
+ const r = Ye;
2523
2544
  return [
2524
2545
  // ── 机场边界轮廓(z11+)
2525
2546
  {
@@ -2957,7 +2978,7 @@ const Ze = {
2957
2978
  restricted: "#f87171",
2958
2979
  hotspot: "#fb923c"
2959
2980
  };
2960
- function Je(o = "amm") {
2981
+ function Qe(o = "amm") {
2961
2982
  const r = Ze;
2962
2983
  return [
2963
2984
  { id: "amm-airport-fill", type: "fill", source: o, "source-layer": "amm-airport", minzoom: 11, paint: { "fill-color": r.airport, "fill-opacity": 0.3 } },
@@ -3038,7 +3059,7 @@ function Je(o = "amm") {
3038
3059
  }
3039
3060
  ];
3040
3061
  }
3041
- const Qe = {
3062
+ const qe = {
3042
3063
  airport: "#4b5563",
3043
3064
  runway: "#71717a",
3044
3065
  apron: "#27272a",
@@ -3053,8 +3074,8 @@ const Qe = {
3053
3074
  restricted: "#f87171",
3054
3075
  hotspot: "#fb923c"
3055
3076
  };
3056
- function qe(o = "amm") {
3057
- const r = Qe, d = "#1f1f23";
3077
+ function ti(o = "amm") {
3078
+ const r = qe, d = "#1f1f23";
3058
3079
  return [
3059
3080
  { id: "amm-airport-fill", type: "fill", source: o, "source-layer": "amm-airport", minzoom: 11, paint: { "fill-color": r.airport, "fill-opacity": 0.3 } },
3060
3081
  { id: "amm-airport-stroke", type: "line", source: o, "source-layer": "amm-airport", minzoom: 11, paint: { "line-color": "#52525b", "line-width": 1 } },
@@ -3134,10 +3155,10 @@ function qe(o = "amm") {
3134
3155
  }
3135
3156
  ];
3136
3157
  }
3137
- function Yt(o = "amm", r = "light") {
3138
- return r === "dark" ? Je(o) : r === "neutral" ? qe(o) : Ye(o);
3158
+ function Mt(o = "amm", r = "light") {
3159
+ return r === "dark" ? Qe(o) : r === "neutral" ? ti(o) : Je(o);
3139
3160
  }
3140
- const oi = {
3161
+ const ri = {
3141
3162
  ammAirport: ["amm-airport-fill", "amm-airport-stroke"],
3142
3163
  ammRunway: [
3143
3164
  "amm-runway-fill",
@@ -3162,7 +3183,7 @@ const oi = {
3162
3183
  "amm-obstacle-point-label"
3163
3184
  ],
3164
3185
  ammConstruction: ["amm-construction-fill", "amm-construction-stroke", "amm-construction-label"]
3165
- }, ti = "https://aips.siniswift.com", ei = [
3186
+ }, ei = "https://aips.siniswift.com", ii = [
3166
3187
  "interpolate",
3167
3188
  ["linear"],
3168
3189
  ["elevation"],
@@ -3178,7 +3199,7 @@ const oi = {
3178
3199
  "#9c6b3f",
3179
3200
  4500,
3180
3201
  "#f2efe9"
3181
- ], Mt = [
3202
+ ], Jt = [
3182
3203
  "amm-airport-fill",
3183
3204
  "amm-airport-stroke",
3184
3205
  "amm-runway-fill",
@@ -3207,17 +3228,22 @@ const oi = {
3207
3228
  "amm-construction-fill",
3208
3229
  "amm-construction-stroke",
3209
3230
  "amm-construction-label"
3210
- ], Zt = ["terrain-color", "terrain-hillshade"], Jt = ["contour-line", "contour-label"];
3211
- async function Qt(o) {
3231
+ ], Zt = ["terrain-color", "terrain-hillshade"], Qt = ["contour-line", "contour-label"];
3232
+ async function qt(o) {
3212
3233
  const r = await fetch(o);
3213
3234
  if (!r.ok) throw new Error(`fetch ${o} → ${r.status}`);
3214
3235
  const d = r.headers.get("Content-Encoding"), y = r.headers.get("Content-Type") || "";
3215
3236
  if (d === "gzip" || y.includes("json"))
3216
3237
  return r.json();
3217
- const g = r.body.pipeThrough(new DecompressionStream("gzip"));
3218
- return new Response(g).json();
3238
+ const w = r.body.pipeThrough(new DecompressionStream("gzip"));
3239
+ return new Response(w).json();
3240
+ }
3241
+ function Dt(o) {
3242
+ const r = {};
3243
+ for (const d of o) r[d.id] = d;
3244
+ return r;
3219
3245
  }
3220
- class ri {
3246
+ class ni {
3221
3247
  /**
3222
3248
  * @param {object} options
3223
3249
  * @param {string|HTMLElement} options.container DOM element id or element
@@ -3234,15 +3260,15 @@ class ri {
3234
3260
  const {
3235
3261
  container: d,
3236
3262
  theme: y = "light",
3237
- apiUrl: g = ti,
3238
- spriteUrl: w,
3263
+ apiUrl: w = ei,
3264
+ spriteUrl: x,
3239
3265
  period: b = null,
3240
- layers: S = {},
3241
- center: O = [104, 36],
3266
+ layers: v = {},
3267
+ center: F = [104, 36],
3242
3268
  zoom: A = 4,
3243
3269
  terrainUrl: z = null
3244
3270
  } = r;
3245
- return this._apiUrl = g.replace(/\/$/, ""), this._spriteUrl = (w ?? g).replace(/\/$/, ""), this._terrainUrl = z ?? `${this._apiUrl}/api/terrain/{z}/{x}/{y}.png`, this._theme = y, this._period = b, this._center = O, this._zoom = A, this._ready = !1, this._layerVisible = {
3271
+ return this._apiUrl = w.replace(/\/$/, ""), this._spriteUrl = (x ?? w).replace(/\/$/, ""), this._terrainUrl = z ?? `${this._apiUrl}/api/terrain/{z}/{x}/{y}.png`, this._theme = y, this._period = b, this._center = F, this._zoom = A, this._ready = !1, this._layerVisible = {
3246
3272
  // aviation groups — all visible by default
3247
3273
  adiz: !0,
3248
3274
  fir: !0,
@@ -3260,30 +3286,30 @@ class ri {
3260
3286
  terrain: !1,
3261
3287
  contour: !1,
3262
3288
  // user overrides
3263
- ...S
3289
+ ...v
3264
3290
  }, this._initMap(d), new Proxy(this, {
3265
- get(p, x) {
3266
- if (typeof x == "symbol" || Reflect.has(p, x)) {
3267
- const k = p[x];
3268
- return typeof k == "function" ? k.bind(p) : k;
3291
+ get(p, g) {
3292
+ if (typeof g == "symbol" || Reflect.has(p, g)) {
3293
+ const R = p[g];
3294
+ return typeof R == "function" ? R.bind(p) : R;
3269
3295
  }
3270
3296
  const T = p._map;
3271
3297
  if (!T) return;
3272
- const D = T[x];
3273
- return typeof D == "function" ? D.bind(T) : D;
3298
+ const E = T[g];
3299
+ return typeof E == "function" ? E.bind(T) : E;
3274
3300
  },
3275
- set(p, x, T) {
3276
- return typeof x == "symbol" || Reflect.has(p, x) || !p._map ? p[x] = T : x in p._map ? p._map[x] = T : p[x] = T, !0;
3301
+ set(p, g, T) {
3302
+ return typeof g == "symbol" || Reflect.has(p, g) || !p._map ? p[g] = T : g in p._map ? p._map[g] = T : p[g] = T, !0;
3277
3303
  },
3278
- has(p, x) {
3279
- return Reflect.has(p, x) || (p._map ? x in p._map : !1);
3304
+ has(p, g) {
3305
+ return Reflect.has(p, g) || (p._map ? g in p._map : !1);
3280
3306
  }
3281
3307
  });
3282
3308
  }
3283
3309
  // ── Map initialization ────────────────────────────────────────────────────
3284
3310
  _initMap(r) {
3285
3311
  const d = ut[this._theme] ?? ut.light;
3286
- this._map = new jt.Map({
3312
+ this._map = new $t.Map({
3287
3313
  container: r,
3288
3314
  style: {
3289
3315
  version: 8,
@@ -3340,13 +3366,13 @@ class ri {
3340
3366
  encoding: "mapbox",
3341
3367
  maxzoom: 8
3342
3368
  });
3343
- const r = new Be.DemSource({
3369
+ const r = new Xe.DemSource({
3344
3370
  url: this._terrainUrl,
3345
3371
  encoding: "mapbox",
3346
3372
  maxzoom: 8,
3347
3373
  worker: !0
3348
3374
  });
3349
- r.setupMaplibre(jt), this._map.addSource("contour", {
3375
+ r.setupMaplibre($t), this._map.addSource("contour", {
3350
3376
  type: "vector",
3351
3377
  tiles: [r.contourProtocolUrl({
3352
3378
  thresholds: {
@@ -3364,15 +3390,15 @@ class ri {
3364
3390
  }), await this._loadBaseData();
3365
3391
  }
3366
3392
  async _loadBaseData() {
3367
- var r, d, y, g;
3393
+ var r, d, y, w;
3368
3394
  try {
3369
- const [w, b] = await Promise.all([
3370
- Qt(`${this._apiUrl}/topjson/land.topojson.gz`),
3371
- Qt(`${this._apiUrl}/topjson/boundary.topojson.gz`)
3395
+ const [x, b] = await Promise.all([
3396
+ qt(`${this._apiUrl}/topjson/land.topojson.gz`),
3397
+ qt(`${this._apiUrl}/topjson/boundary.topojson.gz`)
3372
3398
  ]);
3373
- (r = w == null ? void 0 : w.objects) != null && r.land ? (d = this._map.getSource("land")) == null || d.setData($t(w, w.objects.land)) : console.warn("[AviationChart] land topojson missing objects.land"), (y = b == null ? void 0 : b.objects) != null && y.boundary ? (g = this._map.getSource("boundary")) == null || g.setData($t(b, b.objects.boundary)) : console.warn("[AviationChart] boundary topojson missing objects.boundary");
3374
- } catch (w) {
3375
- console.error("[AviationChart] loadBaseData failed:", w);
3399
+ (r = x == null ? void 0 : x.objects) != null && r.land ? (d = this._map.getSource("land")) == null || d.setData(Kt(x, x.objects.land)) : console.warn("[AviationChart] land topojson missing objects.land"), (y = b == null ? void 0 : b.objects) != null && y.boundary ? (w = this._map.getSource("boundary")) == null || w.setData(Kt(b, b.objects.boundary)) : console.warn("[AviationChart] boundary topojson missing objects.boundary");
3400
+ } catch (x) {
3401
+ console.error("[AviationChart] loadBaseData failed:", x);
3376
3402
  }
3377
3403
  }
3378
3404
  _initLayers() {
@@ -3382,7 +3408,7 @@ class ri {
3382
3408
  type: "color-relief",
3383
3409
  source: "terrain",
3384
3410
  layout: { visibility: r },
3385
- paint: { "color-relief-color": ei }
3411
+ paint: { "color-relief-color": ii }
3386
3412
  }), this._map.addLayer({
3387
3413
  id: "terrain-hillshade",
3388
3414
  type: "hillshade",
@@ -3427,28 +3453,28 @@ class ri {
3427
3453
  "text-halo-width": 1
3428
3454
  }
3429
3455
  }), this._layerVisible.terrain && this._map.setTerrain({ source: "terrain", exaggeration: 4 });
3430
- for (const y of Ht(this._theme))
3456
+ for (const y of Pt(this._theme))
3431
3457
  this._map.getLayer(y.id) || this._map.addLayer(y);
3432
3458
  for (const y of ["terrain-color", "terrain-hillshade", "contour-line", "contour-label"])
3433
3459
  this._map.getLayer(y) && this._map.getLayer("boundary") && this._map.moveLayer(y, "boundary");
3434
- for (const y of Yt("amm", this._theme))
3460
+ for (const y of Mt("amm", this._theme))
3435
3461
  this._map.getLayer(y.id) || this._map.addLayer(y, "fir-line");
3436
3462
  }
3437
3463
  _applyVisibility() {
3438
- for (const [g, w] of Object.entries(Ct)) {
3439
- const b = this._layerVisible[g] !== !1 ? "visible" : "none";
3440
- for (const S of w)
3441
- this._map.getLayer(S) && this._map.setLayoutProperty(S, "visibility", b);
3464
+ for (const [w, x] of Object.entries(Yt)) {
3465
+ const b = this._layerVisible[w] !== !1 ? "visible" : "none";
3466
+ for (const v of x)
3467
+ this._map.getLayer(v) && this._map.setLayoutProperty(v, "visibility", b);
3442
3468
  }
3443
3469
  const r = this._layerVisible.amm !== !1 ? "visible" : "none";
3444
- for (const g of Mt)
3445
- this._map.getLayer(g) && this._map.setLayoutProperty(g, "visibility", r);
3470
+ for (const w of Jt)
3471
+ this._map.getLayer(w) && this._map.setLayoutProperty(w, "visibility", r);
3446
3472
  const d = this._layerVisible.terrain ? "visible" : "none";
3447
- for (const g of Zt)
3448
- this._map.getLayer(g) && this._map.setLayoutProperty(g, "visibility", d);
3473
+ for (const w of Zt)
3474
+ this._map.getLayer(w) && this._map.setLayoutProperty(w, "visibility", d);
3449
3475
  const y = this._layerVisible.contour ? "visible" : "none";
3450
- for (const g of Jt)
3451
- this._map.getLayer(g) && this._map.setLayoutProperty(g, "visibility", y);
3476
+ for (const w of Qt)
3477
+ this._map.getLayer(w) && this._map.setLayoutProperty(w, "visibility", y);
3452
3478
  }
3453
3479
  // ── Public API ────────────────────────────────────────────────────────────
3454
3480
  /** Raw MapLibre Map instance */
@@ -3469,23 +3495,36 @@ class ri {
3469
3495
  */
3470
3496
  setTheme(r) {
3471
3497
  if (r === this._theme) return;
3498
+ const d = this._theme;
3472
3499
  this._theme = r;
3473
- const d = ut[r] ?? ut.light;
3474
- this._map.setPaintProperty("background", "background-color", d.background);
3475
- const y = [
3476
- "landLaye",
3477
- "boundary",
3478
- ...Object.values(Ct).flat(),
3479
- ...Mt
3480
- ];
3481
- for (const g of y)
3482
- this._map.getLayer(g) && this._map.removeLayer(g);
3483
- for (const g of Ht(this._theme))
3484
- this._map.addLayer(g);
3485
- for (const g of Yt("amm", this._theme))
3486
- this._map.getLayer(g.id) || this._map.addLayer(g, "fir-line");
3500
+ const y = ut[r] ?? ut.light;
3501
+ this._map.setPaintProperty("background", "background-color", y.background);
3502
+ const w = Dt(Pt(r)), x = Dt(Pt(d)), b = Dt(Mt("amm", r)), v = Dt(Mt("amm", d));
3503
+ Object.assign(w, b), Object.assign(x, v);
3504
+ for (const F of Object.keys(w))
3505
+ this._map.getLayer(F) && this._applyThemedProps(F, x[F], w[F]);
3487
3506
  this._applyVisibility();
3488
3507
  }
3508
+ /**
3509
+ * Apply a layer definition's paint + layout properties in place. Properties
3510
+ * present in the previous theme but absent in the next are reset to default
3511
+ * (set to undefined) so no stale styling lingers.
3512
+ * @private
3513
+ */
3514
+ _applyThemedProps(r, d, y) {
3515
+ const w = this._map, x = {
3516
+ paint: (b, v) => w.setPaintProperty(r, b, v),
3517
+ layout: (b, v) => w.setLayoutProperty(r, b, v)
3518
+ };
3519
+ for (const b of ["paint", "layout"]) {
3520
+ const v = d && d[b] || {}, F = y && y[b] || {}, A = /* @__PURE__ */ new Set([...Object.keys(v), ...Object.keys(F)]);
3521
+ for (const z of A) {
3522
+ if (b === "layout" && z === "visibility") continue;
3523
+ const p = F[z], g = v[z];
3524
+ JSON.stringify(p) !== JSON.stringify(g) && x[b](z, p);
3525
+ }
3526
+ }
3527
+ }
3489
3528
  /**
3490
3529
  * Show or hide a built-in layer group.
3491
3530
  *
@@ -3499,32 +3538,32 @@ class ri {
3499
3538
  */
3500
3539
  setLayerVisible(r, d) {
3501
3540
  if (this._layerVisible[r] = d, r === "terrain") {
3502
- const w = d ? "visible" : "none";
3541
+ const x = d ? "visible" : "none";
3503
3542
  for (const b of Zt)
3504
- this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", w);
3543
+ this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", x);
3505
3544
  this._map.setTerrain(d ? { source: "terrain", exaggeration: 4 } : null);
3506
3545
  return;
3507
3546
  }
3508
3547
  if (r === "contour") {
3509
- const w = d ? "visible" : "none";
3510
- for (const b of Jt)
3511
- this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", w);
3548
+ const x = d ? "visible" : "none";
3549
+ for (const b of Qt)
3550
+ this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", x);
3512
3551
  return;
3513
3552
  }
3514
3553
  if (r === "amm") {
3515
- const w = d ? "visible" : "none";
3516
- for (const b of Mt)
3517
- this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", w);
3554
+ const x = d ? "visible" : "none";
3555
+ for (const b of Jt)
3556
+ this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", x);
3518
3557
  return;
3519
3558
  }
3520
- const y = Ct[r];
3559
+ const y = Yt[r];
3521
3560
  if (!y) {
3522
3561
  console.warn(`[AviationChart] Unknown layer key: "${r}"`);
3523
3562
  return;
3524
3563
  }
3525
- const g = d ? "visible" : "none";
3526
- for (const w of y)
3527
- this._map.getLayer(w) && this._map.setLayoutProperty(w, "visibility", g);
3564
+ const w = d ? "visible" : "none";
3565
+ for (const x of y)
3566
+ this._map.getLayer(x) && this._map.setLayoutProperty(x, "visibility", w);
3528
3567
  }
3529
3568
  /**
3530
3569
  * Switch the navdata period. Fetches tiles for the new period immediately.
@@ -3564,8 +3603,8 @@ class ri {
3564
3603
  }
3565
3604
  }
3566
3605
  export {
3567
- oi as AMM_LAYER_GROUPS,
3568
- ri as AviationChart,
3606
+ ri as AMM_LAYER_GROUPS,
3607
+ ni as AviationChart,
3569
3608
  ut as CHART_THEMES,
3570
- Ct as LAYER_GROUPS
3609
+ Yt as LAYER_GROUPS
3571
3610
  };