@craft-native/ts-maps 0.0.246 → 0.0.248

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,51 +1,3 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined")
5
- return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
-
9
- // src/types.ts
10
- var defaultMapConfiguration = {
11
- provider: "ts_maps",
12
- map_type: "standard",
13
- shows_user_location: false,
14
- user_tracking_mode: "none",
15
- shows_compass: true,
16
- shows_scale: true,
17
- shows_traffic: false,
18
- shows_buildings: true,
19
- is_rotate_enabled: true,
20
- is_scroll_enabled: true,
21
- is_zoom_enabled: true,
22
- is_pitch_enabled: true,
23
- min_zoom: 0,
24
- max_zoom: 22
25
- };
26
- var defaultMapCamera = {
27
- center: { latitude: 0, longitude: 0 },
28
- zoom: 15,
29
- pitch: 0,
30
- heading: 0
31
- };
32
- var markerColorHex = {
33
- red: "#ff3b30",
34
- green: "#34c759",
35
- blue: "#007aff",
36
- yellow: "#ffcc00",
37
- orange: "#ff9500",
38
- purple: "#af52de",
39
- cyan: "#32ade6",
40
- magenta: "#ff2d55"
41
- };
42
- var strokePatternDashes = {
43
- solid: [],
44
- dashed: [10, 5],
45
- dotted: [2, 2],
46
- dash_dot: [10, 5, 2, 5]
47
- };
48
-
49
1
  // ../../node_modules/ts-maps/dist/index.js
50
2
  var __defProp = Object.defineProperty;
51
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -891,7 +843,7 @@ var Evented;
891
843
  var init_Events = __esm(() => {
892
844
  init_Util();
893
845
  init_Class();
894
- Evented = class Evented2 extends Class {
846
+ Evented = class Evented extends Class {
895
847
  static __REMOVED_EVENTS = ["mousedown", "mouseup", "mouseover", "mouseout", "mousemove"];
896
848
  on(types, fn, context) {
897
849
  assertEventTypes("on", types);
@@ -928,7 +880,7 @@ var init_Events = __esm(() => {
928
880
  return this;
929
881
  }
930
882
  _on(type, fn, context, _once) {
931
- if (Evented2.__REMOVED_EVENTS.includes(type)) {
883
+ if (Evented.__REMOVED_EVENTS.includes(type)) {
932
884
  console.error(`The event ${type} has been removed. Use the PointerEvent variant instead.`);
933
885
  }
934
886
  if (typeof fn !== "function") {
@@ -1152,7 +1104,7 @@ function cubicBezier(x1, y1, x2, y2) {
1152
1104
  var Animation;
1153
1105
  var init_Animation = __esm(() => {
1154
1106
  init_Events();
1155
- Animation = class Animation2 extends Evented {
1107
+ Animation = class Animation extends Evented {
1156
1108
  constructor() {
1157
1109
  super();
1158
1110
  this._easing = easeInOutCubic;
@@ -1237,7 +1189,7 @@ var PosAnimation;
1237
1189
  var init_PosAnimation = __esm(() => {
1238
1190
  init_DomUtil();
1239
1191
  init_Events();
1240
- PosAnimation = class PosAnimation2 extends Evented {
1192
+ PosAnimation = class PosAnimation extends Evented {
1241
1193
  run(el, newPos, duration, easeLinearity) {
1242
1194
  this.stop();
1243
1195
  this._el = el;
@@ -1654,7 +1606,7 @@ var init_CRS = __esm(() => {
1654
1606
  var EarthCRS;
1655
1607
  var init_EarthCRS = __esm(() => {
1656
1608
  init_CRS();
1657
- EarthCRS = class EarthCRS2 extends CRS {
1609
+ EarthCRS = class EarthCRS extends CRS {
1658
1610
  static wrapLng = [-180, 180];
1659
1611
  static R = 6371000;
1660
1612
  static distance(latlng1, latlng2) {
@@ -1792,7 +1744,7 @@ var init_EPSG3857 = __esm(() => {
1792
1744
  init_Transformation();
1793
1745
  init_Projection_SphericalMercator();
1794
1746
  init_EarthCRS();
1795
- EPSG3857 = class EPSG38572 extends EarthCRS {
1747
+ EPSG3857 = class EPSG3857 extends EarthCRS {
1796
1748
  static code = "EPSG:3857";
1797
1749
  static projection = SphericalMercator;
1798
1750
  static transformation = (() => {
@@ -1800,7 +1752,7 @@ var init_EPSG3857 = __esm(() => {
1800
1752
  return new Transformation(scale, 0.5, -scale, 0.5);
1801
1753
  })();
1802
1754
  };
1803
- EPSG900913 = class EPSG9009132 extends EPSG3857 {
1755
+ EPSG900913 = class EPSG900913 extends EPSG3857 {
1804
1756
  static code = "EPSG:900913";
1805
1757
  };
1806
1758
  });
@@ -1845,10 +1797,10 @@ function parseHex(hex) {
1845
1797
  function parseRgbComponent(input) {
1846
1798
  const s = input.trim();
1847
1799
  if (s.endsWith("%")) {
1848
- const n2 = Number.parseFloat(s.slice(0, -1));
1849
- if (Number.isNaN(n2))
1800
+ const n = Number.parseFloat(s.slice(0, -1));
1801
+ if (Number.isNaN(n))
1850
1802
  return Number.NaN;
1851
- return clamp01(n2 / 100);
1803
+ return clamp01(n / 100);
1852
1804
  }
1853
1805
  const n = Number.parseFloat(s);
1854
1806
  if (Number.isNaN(n))
@@ -1858,10 +1810,10 @@ function parseRgbComponent(input) {
1858
1810
  function parseAlpha(input) {
1859
1811
  const s = input.trim();
1860
1812
  if (s.endsWith("%")) {
1861
- const n2 = Number.parseFloat(s.slice(0, -1));
1862
- if (Number.isNaN(n2))
1813
+ const n = Number.parseFloat(s.slice(0, -1));
1814
+ if (Number.isNaN(n))
1863
1815
  return Number.NaN;
1864
- return clamp01(n2 / 100);
1816
+ return clamp01(n / 100);
1865
1817
  }
1866
1818
  const n = Number.parseFloat(s);
1867
1819
  if (Number.isNaN(n))
@@ -2137,7 +2089,7 @@ var init_Color = __esm(() => {
2137
2089
  });
2138
2090
  var ExpressionError;
2139
2091
  var init_errors = __esm(() => {
2140
- ExpressionError = class ExpressionError2 extends Error {
2092
+ ExpressionError = class ExpressionError extends Error {
2141
2093
  constructor(message, expression, path = []) {
2142
2094
  const prefix = path.length > 0 ? `[${path.map((p) => JSON.stringify(p)).join("][")}] ` : "";
2143
2095
  super(`${prefix}${message}`);
@@ -3006,11 +2958,11 @@ function registerLogicalOps() {
3006
2958
  throw new ExpressionError('"in" expects at least 1 argument', ["in", ...args], path);
3007
2959
  if (args.length === 2 && Array.isArray(args[1])) {
3008
2960
  const needle = compile(args[0], "value", path.concat(1));
3009
- const haystack2 = compile(args[1], "value", path.concat(2));
2961
+ const haystack = compile(args[1], "value", path.concat(2));
3010
2962
  return {
3011
2963
  evaluate: (ctx) => {
3012
2964
  const x = needle.evaluate(ctx);
3013
- const hay = haystack2.evaluate(ctx);
2965
+ const hay = haystack.evaluate(ctx);
3014
2966
  if (Array.isArray(hay))
3015
2967
  return hay.some((value) => strictEq(x, value));
3016
2968
  if (typeof hay === "string")
@@ -3018,7 +2970,7 @@ function registerLogicalOps() {
3018
2970
  return false;
3019
2971
  },
3020
2972
  returnType: "boolean",
3021
- ...mergeDeps4([needle, haystack2])
2973
+ ...mergeDeps4([needle, haystack])
3022
2974
  };
3023
2975
  }
3024
2976
  const input = compile(args[0], "value", path.concat(1));
@@ -3354,12 +3306,12 @@ function registerMathOps() {
3354
3306
  registerOperator("-", (args, compile, path) => {
3355
3307
  if (args.length !== 1 && args.length !== 2)
3356
3308
  throw new ExpressionError(`"-" expects 1 or 2 arguments, got ${args.length}`, ["-", ...args], path);
3357
- const children = args.map((a2, i) => compile(a2, "number", path.concat(i + 1)));
3309
+ const children = args.map((a, i) => compile(a, "number", path.concat(i + 1)));
3358
3310
  const expr = ["-", ...args];
3359
3311
  if (children.length === 1) {
3360
- const a2 = children[0];
3312
+ const a = children[0];
3361
3313
  return {
3362
- evaluate: (ctx) => -expectNumber(a2.evaluate(ctx), "-", expr),
3314
+ evaluate: (ctx) => -expectNumber(a.evaluate(ctx), "-", expr),
3363
3315
  returnType: "number",
3364
3316
  ...mergeDeps5(children)
3365
3317
  };
@@ -4816,7 +4768,7 @@ var init_header = __esm(() => {
4816
4768
  };
4817
4769
  MAGIC = [80, 77, 84, 105, 108, 101, 115];
4818
4770
  TWO_32 = 2 ** 32;
4819
- PMTilesFormatError = class PMTilesFormatError2 extends Error {
4771
+ PMTilesFormatError = class PMTilesFormatError extends Error {
4820
4772
  constructor(message) {
4821
4773
  super(message);
4822
4774
  this.name = "PMTilesFormatError";
@@ -5440,10 +5392,10 @@ function decodeDirectory(bytes) {
5440
5392
  if (count * 4 > bytes.length)
5441
5393
  throw new RangeError(`PMTiles: directory claims ${count} entries in ${bytes.length} bytes`);
5442
5394
  const entries = Array.from({ length: count });
5443
- let lastId2 = 0;
5395
+ let lastId = 0;
5444
5396
  for (let i = 0;i < count; i++) {
5445
- lastId2 += read();
5446
- entries[i] = { tileId: lastId2, offset: 0, length: 0, runLength: 1 };
5397
+ lastId += read();
5398
+ entries[i] = { tileId: lastId, offset: 0, length: 0, runLength: 1 };
5447
5399
  }
5448
5400
  for (let i = 0;i < count; i++)
5449
5401
  entries[i].runLength = read();
@@ -5532,7 +5484,7 @@ class FetchSource {
5532
5484
  var PMTilesChangedError;
5533
5485
  var MAX_WHOLE_FILE_BYTES;
5534
5486
  var init_sources = __esm(() => {
5535
- PMTilesChangedError = class PMTilesChangedError2 extends Error {
5487
+ PMTilesChangedError = class PMTilesChangedError extends Error {
5536
5488
  constructor(key) {
5537
5489
  super(`PMTiles: ${key} changed while it was being read`);
5538
5490
  this.name = "PMTilesChangedError";
@@ -6090,7 +6042,7 @@ async function saveOfflineRegion(options, emitter) {
6090
6042
  const concurrency = Math.max(1, options.concurrency ?? 4);
6091
6043
  const coords = computeTileCoords(options.bounds, options.zoomRange);
6092
6044
  const total = coords.length;
6093
- const template2 = isPMTilesUrl(options.tileUrl) ? pmtilesTileUrl(options.tileUrl) : options.tileUrl;
6045
+ const template = isPMTilesUrl(options.tileUrl) ? pmtilesTileUrl(options.tileUrl) : options.tileUrl;
6094
6046
  const result = { saved: 0, failed: 0, skipped: 0 };
6095
6047
  if (isPMTilesUrl(options.tileUrl))
6096
6048
  await cachedFetch(pmtilesSourceUrl(options.tileUrl), { cache, signal: options.signal }).catch(() => {});
@@ -6100,7 +6052,7 @@ async function saveOfflineRegion(options, emitter) {
6100
6052
  while (cursor < coords.length) {
6101
6053
  const idx = cursor++;
6102
6054
  const c = coords[idx];
6103
- const url = fillTileUrl(template2, c);
6055
+ const url = fillTileUrl(template, c);
6104
6056
  try {
6105
6057
  const res = await cachedFetch(url, { cache, signal: options.signal });
6106
6058
  if (res.fromCache)
@@ -6478,9 +6430,9 @@ class VectorTile {
6478
6430
  var init_VectorTile = __esm(() => {
6479
6431
  init_VectorTileLayer();
6480
6432
  });
6481
- function glyphUrl(template2, fontstack, rangeStart) {
6433
+ function glyphUrl(template, fontstack, rangeStart) {
6482
6434
  const range = `${rangeStart}-${rangeStart + 255}`;
6483
- return template2.replace("{fontstack}", encodeURIComponent(fontstack)).replace("{range}", range);
6435
+ return template.replace("{fontstack}", encodeURIComponent(fontstack)).replace("{range}", range);
6484
6436
  }
6485
6437
  function rangeStartFor(codePoint) {
6486
6438
  return Math.floor(codePoint / 256) * 256;
@@ -6548,8 +6500,8 @@ class GlyphSource {
6548
6500
  _fetch;
6549
6501
  _ranges;
6550
6502
  _pending;
6551
- constructor(template2, options = {}) {
6552
- this._template = template2;
6503
+ constructor(template, options = {}) {
6504
+ this._template = template;
6553
6505
  this._fetch = options.fetch ?? globalThis.fetch;
6554
6506
  this._ranges = new Map;
6555
6507
  this._pending = new Map;
@@ -6703,12 +6655,12 @@ function rangeCount(r) {
6703
6655
  function isVectorUrl(url) {
6704
6656
  return /\.(?:pbf|mvt)(?:$|\?)/i.test(url);
6705
6657
  }
6706
- function fill(template2, x, y, z) {
6707
- return template2.replace("{z}", String(z)).replace("{x}", String(x)).replace("{y}", String(y));
6658
+ function fill(template, x, y, z) {
6659
+ return template.replace("{z}", String(z)).replace("{x}", String(x)).replace("{y}", String(y));
6708
6660
  }
6709
6661
  function jobForSource(source, minZoom, maxZoom) {
6710
- const template2 = isPMTilesUrl(source.url) ? pmtilesTileUrl(source.url) : source.url;
6711
- const kind = source.type ?? (isVectorUrl(template2) || isPMTilesUrl(template2) ? "vector" : "raster");
6662
+ const template = isPMTilesUrl(source.url) ? pmtilesTileUrl(source.url) : source.url;
6663
+ const kind = source.type ?? (isVectorUrl(template) || isPMTilesUrl(template) ? "vector" : "raster");
6712
6664
  const tileSize = source.tileSize ?? (kind === "vector" ? 512 : 256);
6713
6665
  const shift = Math.round(Math.log2(tileSize / 256));
6714
6666
  const srcMin = source.minZoom ?? 0;
@@ -6719,9 +6671,9 @@ function jobForSource(source, minZoom, maxZoom) {
6719
6671
  zooms.push({ z, gridZ: z, mapZ: z + shift });
6720
6672
  return {
6721
6673
  kind,
6722
- template: template2,
6674
+ template,
6723
6675
  zooms,
6724
- url: (x, y, z) => fill(template2, x, y, z),
6676
+ url: (x, y, z) => fill(template, x, y, z),
6725
6677
  indexAt: kind === "vector" ? top : undefined,
6726
6678
  server: (x, y, z) => ({ x, y, z })
6727
6679
  };
@@ -6733,8 +6685,8 @@ function jobForLayer(layer, minZoom, maxZoom) {
6733
6685
  if (options.localSource)
6734
6686
  return;
6735
6687
  const vector = typeof layer._subTile === "function";
6736
- const template2 = vector ? options.url : layer._url;
6737
- if (!template2)
6688
+ const template = vector ? options.url : layer._url;
6689
+ if (!template)
6738
6690
  return;
6739
6691
  const tileSize = layer.getTileSize().x;
6740
6692
  const gridShift = Math.round(Math.log2(tileSize / 256));
@@ -6753,7 +6705,7 @@ function jobForLayer(layer, minZoom, maxZoom) {
6753
6705
  zooms.push({ z, gridZ: z - gridShift, mapZ: z });
6754
6706
  return {
6755
6707
  kind: vector ? "vector" : "raster",
6756
- template: template2,
6708
+ template,
6757
6709
  zooms,
6758
6710
  url: (x, y, z) => layer.getTileUrl({ x, y, z }),
6759
6711
  indexAt: vector ? top : undefined,
@@ -6945,7 +6897,7 @@ function extractTile(bytes, x, y, z, layers = {}) {
6945
6897
  return { places, roads };
6946
6898
  }
6947
6899
  const n = 2 ** z;
6948
- const toLatLng2 = (p, extent) => [
6900
+ const toLatLng = (p, extent) => [
6949
6901
  unitToLat((y + p[1] / extent) / n),
6950
6902
  unitToLng((x + p[0] / extent) / n)
6951
6903
  ];
@@ -6999,7 +6951,7 @@ function extractTile(bytes, x, y, z, layers = {}) {
6999
6951
  const p = anchor(geometry, type, extent);
7000
6952
  if (!name || !p)
7001
6953
  return;
7002
- const [lat, lng] = toLatLng2(p, extent);
6954
+ const [lat, lng] = toLatLng(p, extent);
7003
6955
  places.push({ name, lat, lng, kind, rank });
7004
6956
  };
7005
6957
  eachFeature(names.place, (props, g, type, extent) => {
@@ -7083,18 +7035,18 @@ function extractTile(bytes, x, y, z, layers = {}) {
7083
7035
  const level = typeof props.layer === "number" && props.layer !== 0 ? props.layer : props.brunnel === "bridge" ? 1 : props.brunnel === "tunnel" ? -1 : 0;
7084
7036
  for (const line of g) {
7085
7037
  for (const piece of clipLine(line, extent)) {
7086
- const names2 = piece.slice(1).map((p, i) => nameFor(piece[i], p, kind, extent));
7087
- for (let i = 1;i < names2.length - 1; i++) {
7088
- if (names2[i] === undefined && names2[i - 1] !== undefined && names2[i - 1] === names2.slice(i + 1).find((n2) => n2 !== undefined))
7089
- names2[i] = names2[i - 1];
7038
+ const names = piece.slice(1).map((p, i) => nameFor(piece[i], p, kind, extent));
7039
+ for (let i = 1;i < names.length - 1; i++) {
7040
+ if (names[i] === undefined && names[i - 1] !== undefined && names[i - 1] === names.slice(i + 1).find((n) => n !== undefined))
7041
+ names[i] = names[i - 1];
7090
7042
  }
7091
7043
  let start = 0;
7092
- for (let i = 1;i <= names2.length; i++) {
7093
- if (i < names2.length && names2[i] === names2[start])
7044
+ for (let i = 1;i <= names.length; i++) {
7045
+ if (i < names.length && names[i] === names[start])
7094
7046
  continue;
7095
7047
  const coords = [];
7096
7048
  for (const p of piece.slice(start, i + 1)) {
7097
- const [lat, lng] = toLatLng2(p, extent);
7049
+ const [lat, lng] = toLatLng(p, extent);
7098
7050
  coords.push(lat, lng);
7099
7051
  }
7100
7052
  const road = { coords, kind: kind === "path" && props.subclass ? `path:${props.subclass}` : kind, oneway };
@@ -7102,8 +7054,8 @@ function extractTile(bytes, x, y, z, layers = {}) {
7102
7054
  road.ramp = true;
7103
7055
  if (level)
7104
7056
  road.level = level;
7105
- if (names2[start])
7106
- road.name = names2[start];
7057
+ if (names[start])
7058
+ road.name = names[start];
7107
7059
  roads.push(road);
7108
7060
  start = i;
7109
7061
  }
@@ -7544,11 +7496,11 @@ function laneIcon(lane, maneuver) {
7544
7496
  function maneuverIcon(maneuver) {
7545
7497
  const stroke = 'stroke="currentColor" stroke-width="5.5" stroke-linecap="round" stroke-linejoin="round" fill="none"';
7546
7498
  const wrap = (body) => `<svg viewBox="0 0 48 48" width="48" height="48" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">${body}</svg>`;
7547
- const head = (x, y, angle2) => {
7499
+ const head = (x, y, angle) => {
7548
7500
  const s = 8;
7549
- const tip = [x + Math.sin(angle2) * s, y - Math.cos(angle2) * s];
7550
- const left = [x + Math.sin(angle2 - 2.3) * s * 0.9, y - Math.cos(angle2 - 2.3) * s * 0.9];
7551
- const right = [x + Math.sin(angle2 + 2.3) * s * 0.9, y - Math.cos(angle2 + 2.3) * s * 0.9];
7501
+ const tip = [x + Math.sin(angle) * s, y - Math.cos(angle) * s];
7502
+ const left = [x + Math.sin(angle - 2.3) * s * 0.9, y - Math.cos(angle - 2.3) * s * 0.9];
7503
+ const right = [x + Math.sin(angle + 2.3) * s * 0.9, y - Math.cos(angle + 2.3) * s * 0.9];
7552
7504
  return `<path d="M${tip[0].toFixed(1)} ${tip[1].toFixed(1)}L${left[0].toFixed(1)} ${left[1].toFixed(1)}L${right[0].toFixed(1)} ${right[1].toFixed(1)}Z" fill="currentColor"/>`;
7553
7505
  };
7554
7506
  const sign = maneuver.direction === "left" ? -1 : 1;
@@ -7561,9 +7513,9 @@ function maneuverIcon(maneuver) {
7561
7513
  }
7562
7514
  if (maneuver.kind === "roundabout" || maneuver.kind === "roundabout-exit") {
7563
7515
  const exitAngle = maneuver.direction === "straight" ? 0 : sign * Math.PI / 2;
7564
- const ex2 = 24 + Math.sin(exitAngle) * 18;
7565
- const ey2 = 20 - Math.cos(exitAngle) * 18;
7566
- return wrap(`<circle cx="24" cy="20" r="9" ${stroke}/><path d="M24 42V29" ${stroke}/><path d="M${24 + Math.sin(exitAngle) * 9} ${20 - Math.cos(exitAngle) * 9}L${ex2 - Math.sin(exitAngle) * 5} ${ey2 + Math.cos(exitAngle) * 5}" ${stroke}/>${head(ex2, ey2, exitAngle)}`);
7516
+ const ex = 24 + Math.sin(exitAngle) * 18;
7517
+ const ey = 20 - Math.cos(exitAngle) * 18;
7518
+ return wrap(`<circle cx="24" cy="20" r="9" ${stroke}/><path d="M24 42V29" ${stroke}/><path d="M${24 + Math.sin(exitAngle) * 9} ${20 - Math.cos(exitAngle) * 9}L${ex - Math.sin(exitAngle) * 5} ${ey + Math.cos(exitAngle) * 5}" ${stroke}/>${head(ex, ey, exitAngle)}`);
7567
7519
  }
7568
7520
  let angle = 0;
7569
7521
  if (maneuver.direction !== "straight") {
@@ -7662,7 +7614,7 @@ class RoadGraph {
7662
7614
  this._junctionDelays();
7663
7615
  }
7664
7616
  _junctionDelays() {
7665
- const delay2 = JUNCTION_DELAY[this.profile];
7617
+ const delay = JUNCTION_DELAY[this.profile];
7666
7618
  const neighbours = this.edges.map(() => new Set);
7667
7619
  this.edges.forEach((list, from) => {
7668
7620
  for (const edge of list) {
@@ -7675,7 +7627,7 @@ class RoadGraph {
7675
7627
  for (const list of this.edges) {
7676
7628
  for (const edge of list) {
7677
7629
  if (edge.road >= 0 && neighbours[edge.to].size >= 3)
7678
- edge.cost += delay2;
7630
+ edge.cost += delay;
7679
7631
  }
7680
7632
  }
7681
7633
  }
@@ -7739,7 +7691,7 @@ class RoadGraph {
7739
7691
  else
7740
7692
  byRoad.set(s.i, [point]);
7741
7693
  };
7742
- const touch2 = (px, py, b) => {
7694
+ const touch = (px, py, b) => {
7743
7695
  const vx = b.bx - b.ax;
7744
7696
  const vy = b.by - b.ay;
7745
7697
  const len = vx * vx + vy * vy;
@@ -7781,10 +7733,10 @@ class RoadGraph {
7781
7733
  }
7782
7734
  }
7783
7735
  for (const [p, other] of [[a, b], [b, a]]) {
7784
- const ta = touch2(p.ax, p.ay, other);
7736
+ const ta = touch(p.ax, p.ay, other);
7785
7737
  if (ta !== undefined)
7786
7738
  split(other, ta, p.a[0], p.a[1]);
7787
- const tb = touch2(p.bx, p.by, other);
7739
+ const tb = touch(p.bx, p.by, other);
7788
7740
  if (tb !== undefined)
7789
7741
  split(other, tb, p.b[0], p.b[1]);
7790
7742
  }
@@ -8138,14 +8090,14 @@ function describe(graph, found, from, to) {
8138
8090
  let code = "depart";
8139
8091
  const flush = (endHop, nextCode) => {
8140
8092
  const slice = hops.slice(stepStart, endHop);
8141
- const geometry2 = [slice[0].from, ...slice.map((h) => h.to)];
8093
+ const geometry = [slice[0].from, ...slice.map((h) => h.to)];
8142
8094
  const road = slice.find((h) => h.road?.name)?.road ?? slice[0].road;
8143
8095
  const name = road?.name;
8144
8096
  const step = {
8145
8097
  distance: slice.reduce((s, h) => s + h.length, 0),
8146
8098
  duration: slice.reduce((s, h) => s + h.cost, 0),
8147
8099
  instruction: formatInstruction(parseManeuver(code), { name }),
8148
- geometry: geometry2,
8100
+ geometry,
8149
8101
  maneuver: code
8150
8102
  };
8151
8103
  if (name)
@@ -8386,19 +8338,19 @@ function withOfflineFallback(online, offline) {
8386
8338
  };
8387
8339
  const isEmpty = (r) => r.length === 0;
8388
8340
  if ("getDirections" in online) {
8389
- const on3 = online;
8390
- const off3 = offline;
8341
+ const on = online;
8342
+ const off = offline;
8391
8343
  return {
8392
- name: `${on3.name}+offline`,
8393
- getDirections: wrap(on3.getDirections.bind(on3), off3.getDirections.bind(off3), isEmpty)
8344
+ name: `${on.name}+offline`,
8345
+ getDirections: wrap(on.getDirections.bind(on), off.getDirections.bind(off), isEmpty)
8394
8346
  };
8395
8347
  }
8396
- const on2 = online;
8397
- const off2 = offline;
8348
+ const on = online;
8349
+ const off = offline;
8398
8350
  return {
8399
- name: `${on2.name}+offline`,
8400
- search: wrap(on2.search.bind(on2), off2.search.bind(off2), isEmpty),
8401
- reverse: wrap(on2.reverse.bind(on2), off2.reverse.bind(off2), isEmpty)
8351
+ name: `${on.name}+offline`,
8352
+ search: wrap(on.search.bind(on), off.search.bind(off), isEmpty),
8353
+ reverse: wrap(on.reverse.bind(on), off.reverse.bind(off), isEmpty)
8402
8354
  };
8403
8355
  }
8404
8356
  var PLACE_TYPES;
@@ -8486,7 +8438,7 @@ var init_OfflineMaps = __esm(() => {
8486
8438
  init_plan();
8487
8439
  init_router();
8488
8440
  init_search();
8489
- OfflineMaps = class OfflineMaps2 extends Evented {
8441
+ OfflineMaps = class OfflineMaps extends Evented {
8490
8442
  store;
8491
8443
  concurrency;
8492
8444
  maxTiles;
@@ -8993,7 +8945,7 @@ function buildTerrainMesh(opts) {
8993
8945
  const upm = opts.unitsPerMeter ?? 1;
8994
8946
  const verticesPerSide = resolution + 1;
8995
8947
  const vertexCount = verticesPerSide * verticesPerSide;
8996
- const positions2 = new Float32Array(vertexCount * 6);
8948
+ const positions = new Float32Array(vertexCount * 6);
8997
8949
  const step = tileSize / resolution;
8998
8950
  const demStep = (demSize - 1) / resolution;
8999
8951
  for (let j = 0;j < verticesPerSide; j++) {
@@ -9005,12 +8957,12 @@ function buildTerrainMesh(opts) {
9005
8957
  const metres = sampleElevationBilinear(opts.elevation, demSize, du, dv);
9006
8958
  const z = metres * exaggeration * upm;
9007
8959
  const vi = (j * verticesPerSide + i) * 6;
9008
- positions2[vi] = x;
9009
- positions2[vi + 1] = y;
9010
- positions2[vi + 2] = z;
9011
- positions2[vi + 3] = 0;
9012
- positions2[vi + 4] = 0;
9013
- positions2[vi + 5] = 1;
8960
+ positions[vi] = x;
8961
+ positions[vi + 1] = y;
8962
+ positions[vi + 2] = z;
8963
+ positions[vi + 3] = 0;
8964
+ positions[vi + 4] = 0;
8965
+ positions[vi + 5] = 1;
9014
8966
  }
9015
8967
  }
9016
8968
  for (let j = 0;j < verticesPerSide; j++) {
@@ -9019,10 +8971,10 @@ function buildTerrainMesh(opts) {
9019
8971
  const ip = Math.min(verticesPerSide - 1, i + 1);
9020
8972
  const jm = Math.max(0, j - 1);
9021
8973
  const jp = Math.min(verticesPerSide - 1, j + 1);
9022
- const zL = positions2[(j * verticesPerSide + im) * 6 + 2];
9023
- const zR = positions2[(j * verticesPerSide + ip) * 6 + 2];
9024
- const zU = positions2[(jm * verticesPerSide + i) * 6 + 2];
9025
- const zD = positions2[(jp * verticesPerSide + i) * 6 + 2];
8974
+ const zL = positions[(j * verticesPerSide + im) * 6 + 2];
8975
+ const zR = positions[(j * verticesPerSide + ip) * 6 + 2];
8976
+ const zU = positions[(jm * verticesPerSide + i) * 6 + 2];
8977
+ const zD = positions[(jp * verticesPerSide + i) * 6 + 2];
9026
8978
  const dx = (ip - im) * step || 1;
9027
8979
  const dy = (jp - jm) * step || 1;
9028
8980
  const nx = -(zR - zL) / dx;
@@ -9030,9 +8982,9 @@ function buildTerrainMesh(opts) {
9030
8982
  const nz = 1;
9031
8983
  const len = Math.hypot(nx, ny, nz) || 1;
9032
8984
  const base = (j * verticesPerSide + i) * 6;
9033
- positions2[base + 3] = nx / len;
9034
- positions2[base + 4] = ny / len;
9035
- positions2[base + 5] = nz / len;
8985
+ positions[base + 3] = nx / len;
8986
+ positions[base + 4] = ny / len;
8987
+ positions[base + 5] = nz / len;
9036
8988
  }
9037
8989
  }
9038
8990
  const indices = new Uint32Array(resolution * resolution * 6);
@@ -9052,7 +9004,7 @@ function buildTerrainMesh(opts) {
9052
9004
  }
9053
9005
  }
9054
9006
  return {
9055
- positions: positions2,
9007
+ positions,
9056
9008
  indices,
9057
9009
  vertexCount,
9058
9010
  indexCount: indices.length,
@@ -9400,7 +9352,7 @@ function earcutLinked(earIn, triangles, dim, minX, minY, invSize, pass) {
9400
9352
  let ear = earIn;
9401
9353
  if (pass === 0 && invSize)
9402
9354
  indexCurve(ear, minX, minY, invSize);
9403
- let stop2 = ear;
9355
+ let stop = ear;
9404
9356
  while (ear.prev !== ear.next) {
9405
9357
  const prev = ear.prev;
9406
9358
  const next = ear.next;
@@ -9408,11 +9360,11 @@ function earcutLinked(earIn, triangles, dim, minX, minY, invSize, pass) {
9408
9360
  triangles.push(prev.i / dim | 0, ear.i / dim | 0, next.i / dim | 0);
9409
9361
  removeNode(ear);
9410
9362
  ear = next.next;
9411
- stop2 = next.next;
9363
+ stop = next.next;
9412
9364
  continue;
9413
9365
  }
9414
9366
  ear = next;
9415
- if (ear === stop2) {
9367
+ if (ear === stop) {
9416
9368
  if (pass === 0) {
9417
9369
  earcutLinked(filterPoints(ear, null), triangles, dim, minX, minY, invSize, 1);
9418
9370
  } else if (pass === 1) {
@@ -9575,7 +9527,7 @@ function findHoleBridge(hole, outerNode) {
9575
9527
  } while (p !== outerNode);
9576
9528
  if (!m)
9577
9529
  return null;
9578
- const stop2 = m;
9530
+ const stop = m;
9579
9531
  const mx = m.x;
9580
9532
  const my = m.y;
9581
9533
  let tanMin = Infinity;
@@ -9590,7 +9542,7 @@ function findHoleBridge(hole, outerNode) {
9590
9542
  }
9591
9543
  }
9592
9544
  p = p.next;
9593
- } while (p !== stop2);
9545
+ } while (p !== stop);
9594
9546
  return m;
9595
9547
  }
9596
9548
  function indexCurve(startIn, minX, minY, invSize) {
@@ -9876,7 +9828,7 @@ ${src}`);
9876
9828
  }
9877
9829
  var WebGLUnsupportedError;
9878
9830
  var init_GLContext = __esm(() => {
9879
- WebGLUnsupportedError = class WebGLUnsupportedError2 extends Error {
9831
+ WebGLUnsupportedError = class WebGLUnsupportedError extends Error {
9880
9832
  constructor(message) {
9881
9833
  super(message ?? "WebGL2 is not supported in this environment.");
9882
9834
  this.name = "WebGLUnsupportedError";
@@ -10102,8 +10054,8 @@ class WebGLTileRenderer {
10102
10054
  gl.drawArrays(gl.TRIANGLES, 0, 6);
10103
10055
  this._disposeBuffer(buf);
10104
10056
  }
10105
- drawTerrain(positions2, indices, color, opacity, projectionMatrix) {
10106
- if (positions2.length === 0 || indices.length === 0)
10057
+ drawTerrain(positions, indices, color, opacity, projectionMatrix) {
10058
+ if (positions.length === 0 || indices.length === 0)
10107
10059
  return 0;
10108
10060
  const prog = this._fillExtrusion ?? (this._fillExtrusion = this._buildFillExtrusionProgram());
10109
10061
  const gl = this.ctx.gl;
@@ -10115,7 +10067,7 @@ class WebGLTileRenderer {
10115
10067
  gl.uniform4f(prog.u_color, color[0], color[1], color[2], color[3]);
10116
10068
  if (prog.u_opacity)
10117
10069
  gl.uniform1f(prog.u_opacity, opacity);
10118
- const vbo = this.ctx.createBuffer(positions2);
10070
+ const vbo = this.ctx.createBuffer(positions);
10119
10071
  this._buffers.push(vbo);
10120
10072
  gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
10121
10073
  const stride = 6 * 4;
@@ -10187,11 +10139,11 @@ class WebGLTileRenderer {
10187
10139
  const cx = centers[i * 2];
10188
10140
  const cy = centers[i * 2 + 1];
10189
10141
  for (let v = 0;v < 6; v++) {
10190
- const off2 = (i * 6 + v) * 4;
10191
- verts[off2] = cx;
10192
- verts[off2 + 1] = cy;
10193
- verts[off2 + 2] = quadCorners[v * 2];
10194
- verts[off2 + 3] = quadCorners[v * 2 + 1];
10142
+ const off = (i * 6 + v) * 4;
10143
+ verts[off] = cx;
10144
+ verts[off + 1] = cy;
10145
+ verts[off + 2] = quadCorners[v * 2];
10146
+ verts[off + 3] = quadCorners[v * 2 + 1];
10195
10147
  }
10196
10148
  }
10197
10149
  const buf = this.ctx.createBuffer(verts);
@@ -10294,10 +10246,10 @@ function tessellateLine(linestrip) {
10294
10246
  ty += dy / len;
10295
10247
  }
10296
10248
  if (i < n - 1) {
10297
- const nx2 = linestrip[(i + 1) * 2];
10298
- const ny2 = linestrip[(i + 1) * 2 + 1];
10299
- const dx = nx2 - x;
10300
- const dy = ny2 - y;
10249
+ const nx = linestrip[(i + 1) * 2];
10250
+ const ny = linestrip[(i + 1) * 2 + 1];
10251
+ const dx = nx - x;
10252
+ const dy = ny - y;
10301
10253
  const len = Math.hypot(dx, dy) || 1;
10302
10254
  tx += dx / len;
10303
10255
  ty += dy / len;
@@ -10366,15 +10318,15 @@ class GlyphAtlas {
10366
10318
  this._shelfH = 0;
10367
10319
  }
10368
10320
  getOrAddGlyph(codePoint, style) {
10369
- const key2 = {
10321
+ const key = {
10370
10322
  codePoint,
10371
10323
  italic: !!style?.italic,
10372
10324
  bold: !!style?.bold
10373
10325
  };
10374
- const existing = this._glyphs.get(cacheKey(key2));
10326
+ const existing = this._glyphs.get(cacheKey(key));
10375
10327
  if (existing)
10376
10328
  return existing;
10377
- return this._rasterize(key2);
10329
+ return this._rasterize(key);
10378
10330
  }
10379
10331
  measure(text, style) {
10380
10332
  let width = 0;
@@ -10528,11 +10480,11 @@ class GlyphAtlas {
10528
10480
  }
10529
10481
  return out;
10530
10482
  }
10531
- _rasterize(key2) {
10483
+ _rasterize(key) {
10532
10484
  const ctx = this._ctx;
10533
10485
  if (!ctx) {
10534
- const metrics2 = {
10535
- codePoint: key2.codePoint,
10486
+ const metrics = {
10487
+ codePoint: key.codePoint,
10536
10488
  x: 0,
10537
10489
  y: 0,
10538
10490
  width: 0,
@@ -10541,12 +10493,12 @@ class GlyphAtlas {
10541
10493
  bearingX: 0,
10542
10494
  bearingY: 0
10543
10495
  };
10544
- this._glyphs.set(cacheKey(key2), metrics2);
10545
- return metrics2;
10496
+ this._glyphs.set(cacheKey(key), metrics);
10497
+ return metrics;
10546
10498
  }
10547
- const font = this._buildFontSpec(key2);
10499
+ const font = this._buildFontSpec(key);
10548
10500
  ctx.font = font;
10549
- const ch = String.fromCodePoint(key2.codePoint);
10501
+ const ch = String.fromCodePoint(key.codePoint);
10550
10502
  const m = ctx.measureText(ch);
10551
10503
  const advance = m.width && m.width > 0 ? m.width : this._fontSize * 0.6;
10552
10504
  const ascent = m.actualBoundingBoxAscent && m.actualBoundingBoxAscent > 0 ? m.actualBoundingBoxAscent : this._fontSize * 0.8;
@@ -10585,7 +10537,7 @@ class GlyphAtlas {
10585
10537
  if (bmpH > this._shelfH)
10586
10538
  this._shelfH = bmpH;
10587
10539
  const metrics = {
10588
- codePoint: key2.codePoint,
10540
+ codePoint: key.codePoint,
10589
10541
  x: dx,
10590
10542
  y: dy,
10591
10543
  width: bmpW,
@@ -10594,14 +10546,14 @@ class GlyphAtlas {
10594
10546
  bearingX: -pad,
10595
10547
  bearingY: ascent + pad
10596
10548
  };
10597
- this._glyphs.set(cacheKey(key2), metrics);
10549
+ this._glyphs.set(cacheKey(key), metrics);
10598
10550
  return metrics;
10599
10551
  }
10600
- _buildFontSpec(key2) {
10552
+ _buildFontSpec(key) {
10601
10553
  const parts = [];
10602
- if (key2.italic)
10554
+ if (key.italic)
10603
10555
  parts.push("italic");
10604
- if (key2.bold)
10556
+ if (key.bold)
10605
10557
  parts.push("bold");
10606
10558
  parts.push(`${this._fontSize}px`);
10607
10559
  parts.push(this._fontFamily);
@@ -10695,7 +10647,7 @@ var init_Layer = __esm(() => {
10695
10647
  init_Util();
10696
10648
  init_Events();
10697
10649
  init_Map();
10698
- Layer = class Layer2 extends Evented {
10650
+ Layer = class Layer extends Evented {
10699
10651
  getEvents() {
10700
10652
  return {};
10701
10653
  }
@@ -10869,7 +10821,7 @@ var init_GridLayer = __esm(() => {
10869
10821
  init_Bounds();
10870
10822
  init_Point();
10871
10823
  init_Layer();
10872
- GridLayer = class GridLayer2 extends Layer {
10824
+ GridLayer = class GridLayer extends Layer {
10873
10825
  _onMove;
10874
10826
  initialize(options) {
10875
10827
  setOptions(this, options);
@@ -10964,16 +10916,16 @@ var init_GridLayer = __esm(() => {
10964
10916
  if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null)
10965
10917
  this._container.style.zIndex = this.options.zIndex;
10966
10918
  }
10967
- _setAutoZIndex(compare2) {
10919
+ _setAutoZIndex(compare) {
10968
10920
  const layers = this.getPane().children;
10969
- let edgeZIndex = -compare2(-Infinity, Infinity);
10921
+ let edgeZIndex = -compare(-Infinity, Infinity);
10970
10922
  for (const layer of Array.from(layers)) {
10971
10923
  const zIndex = layer.style.zIndex;
10972
10924
  if (layer !== this._container && zIndex)
10973
- edgeZIndex = compare2(edgeZIndex, +zIndex);
10925
+ edgeZIndex = compare(edgeZIndex, +zIndex);
10974
10926
  }
10975
10927
  if (Number.isFinite(edgeZIndex)) {
10976
- this.options.zIndex = edgeZIndex + compare2(-1, 1);
10928
+ this.options.zIndex = edgeZIndex + compare(-1, 1);
10977
10929
  this._updateZIndex();
10978
10930
  }
10979
10931
  }
@@ -11075,20 +11027,20 @@ var init_GridLayer = __esm(() => {
11075
11027
  this._retainChildren(coords.x, coords.y, coords.z, coords.z + 2);
11076
11028
  }
11077
11029
  }
11078
- for (const [key2, tile] of Object.entries(this._tiles)) {
11030
+ for (const [key, tile] of Object.entries(this._tiles)) {
11079
11031
  if (!tile.retain)
11080
- this._removeTile(key2);
11032
+ this._removeTile(key);
11081
11033
  }
11082
11034
  }
11083
11035
  _removeTilesAtZoom(zoom) {
11084
- for (const [key2, tile] of Object.entries(this._tiles)) {
11036
+ for (const [key, tile] of Object.entries(this._tiles)) {
11085
11037
  if (tile.coords.z === zoom)
11086
- this._removeTile(key2);
11038
+ this._removeTile(key);
11087
11039
  }
11088
11040
  }
11089
11041
  _removeAllTiles() {
11090
- for (const key2 of Object.keys(this._tiles))
11091
- this._removeTile(key2);
11042
+ for (const key of Object.keys(this._tiles))
11043
+ this._removeTile(key);
11092
11044
  }
11093
11045
  _invalidateAll() {
11094
11046
  for (const z of Object.keys(this._levels)) {
@@ -11105,8 +11057,8 @@ var init_GridLayer = __esm(() => {
11105
11057
  const z2 = z - 1;
11106
11058
  const coords2 = new Point(x2, y2);
11107
11059
  coords2.z = z2;
11108
- const key2 = this._tileCoordsToKey(coords2);
11109
- const tile = this._tiles[key2];
11060
+ const key = this._tileCoordsToKey(coords2);
11061
+ const tile = this._tiles[key];
11110
11062
  if (tile?.active) {
11111
11063
  tile.retain = true;
11112
11064
  return true;
@@ -11122,8 +11074,8 @@ var init_GridLayer = __esm(() => {
11122
11074
  for (let j = 2 * y;j < 2 * y + 2; j++) {
11123
11075
  const coords = new Point(i, j);
11124
11076
  coords.z = z + 1;
11125
- const key2 = this._tileCoordsToKey(coords);
11126
- const tile = this._tiles[key2];
11077
+ const key = this._tileCoordsToKey(coords);
11078
+ const tile = this._tiles[key];
11127
11079
  if (tile?.active) {
11128
11080
  tile.retain = true;
11129
11081
  continue;
@@ -11241,9 +11193,9 @@ var init_GridLayer = __esm(() => {
11241
11193
  });
11242
11194
  const pitch = map._pitch;
11243
11195
  const geometry = pitch ? map._cameraGeometry() : null;
11244
- const bearing2 = -map._bearing * Math.PI / 180;
11245
- const sinB = Math.sin(bearing2);
11246
- const cosB = Math.cos(bearing2);
11196
+ const bearing = -map._bearing * Math.PI / 180;
11197
+ const sinB = Math.sin(bearing);
11198
+ const cosB = Math.cos(bearing);
11247
11199
  const sinT = Math.sin(pitch * Math.PI / 180);
11248
11200
  const magnification = (x, y) => {
11249
11201
  if (!geometry)
@@ -11262,11 +11214,11 @@ var init_GridLayer = __esm(() => {
11262
11214
  coords.z = z;
11263
11215
  if (!this._isValidTile(coords))
11264
11216
  return;
11265
- const k2 = map.getZoomScale(mapZoom, z);
11266
- const x0 = x * T * k2 - centerPx.x;
11267
- const y0 = y * T * k2 - centerPx.y;
11268
- const x1 = x0 + T * k2;
11269
- const y1 = y0 + T * k2;
11217
+ const k = map.getZoomScale(mapZoom, z);
11218
+ const x0 = x * T * k - centerPx.x;
11219
+ const y0 = y * T * k - centerPx.y;
11220
+ const x1 = x0 + T * k;
11221
+ const y1 = y0 + T * k;
11270
11222
  if (!rectTouchesPolygon(x0, y0, x1, y1, poly))
11271
11223
  return;
11272
11224
  const s = Math.max(magnification(x0, y0), magnification(x1, y0), magnification(x0, y1), magnification(x1, y1));
@@ -11295,11 +11247,11 @@ var init_GridLayer = __esm(() => {
11295
11247
  for (let x = Math.floor((centerPx.x + minX) / k);x <= Math.floor((centerPx.x + maxX) / k); x++)
11296
11248
  visit(x, y, minZ);
11297
11249
  }
11298
- const distance2 = (c) => {
11250
+ const distance = (c) => {
11299
11251
  const kk = map.getZoomScale(mapZoom, c.z) * T;
11300
11252
  return Math.hypot((c.x + 0.5) * kk - centerPx.x, (c.y + 0.5) * kk - centerPx.y);
11301
11253
  };
11302
- return out.sort((a, b) => b.z - a.z || distance2(a) - distance2(b));
11254
+ return out.sort((a, b) => b.z - a.z || distance(a) - distance(b));
11303
11255
  }
11304
11256
  _onMoveEnd() {
11305
11257
  if (!this._map || this._map._animatingZoom)
@@ -11338,12 +11290,12 @@ var init_GridLayer = __esm(() => {
11338
11290
  if (this._tileZoom === undefined)
11339
11291
  return;
11340
11292
  const pixelBounds = this._getTiledPixelBounds(center);
11341
- const tileRange2 = this._pxBoundsToTileRange(pixelBounds);
11342
- const tileCenter = tileRange2.getCenter();
11293
+ const tileRange = this._pxBoundsToTileRange(pixelBounds);
11294
+ const tileCenter = tileRange.getCenter();
11343
11295
  const queue = [];
11344
11296
  const margin = this.options.keepBuffer;
11345
- const noPruneRange = new Bounds(tileRange2.getBottomLeft().subtract([margin, -margin]), tileRange2.getTopRight().add([margin, -margin]));
11346
- if (!(Number.isFinite(tileRange2.min.x) && Number.isFinite(tileRange2.min.y) && Number.isFinite(tileRange2.max.x) && Number.isFinite(tileRange2.max.y))) {
11297
+ const noPruneRange = new Bounds(tileRange.getBottomLeft().subtract([margin, -margin]), tileRange.getTopRight().add([margin, -margin]));
11298
+ if (!(Number.isFinite(tileRange.min.x) && Number.isFinite(tileRange.min.y) && Number.isFinite(tileRange.max.x) && Number.isFinite(tileRange.max.y))) {
11347
11299
  throw new Error("Attempted to load an infinite number of tiles");
11348
11300
  }
11349
11301
  for (const tile of Object.values(this._tiles)) {
@@ -11359,8 +11311,8 @@ var init_GridLayer = __esm(() => {
11359
11311
  this._updateCovering(center);
11360
11312
  return;
11361
11313
  }
11362
- for (let j = tileRange2.min.y;j <= tileRange2.max.y; j++) {
11363
- for (let i = tileRange2.min.x;i <= tileRange2.max.x; i++) {
11314
+ for (let j = tileRange.min.y;j <= tileRange.max.y; j++) {
11315
+ for (let i = tileRange.min.x;i <= tileRange.max.x; i++) {
11364
11316
  const coords = new Point(i, j);
11365
11317
  coords.z = this._tileZoom;
11366
11318
  if (!this._isValidTile(coords))
@@ -11427,8 +11379,8 @@ var init_GridLayer = __esm(() => {
11427
11379
  const tileBounds = this._tileCoordsToBounds(coords);
11428
11380
  return new LatLngBounds(this.options.bounds).overlaps(tileBounds);
11429
11381
  }
11430
- _keyToBounds(key2) {
11431
- return this._tileCoordsToBounds(this._keyToTileCoords(key2));
11382
+ _keyToBounds(key) {
11383
+ return this._tileCoordsToBounds(this._keyToTileCoords(key));
11432
11384
  }
11433
11385
  _tileCoordsToNwSe(coords) {
11434
11386
  const map = this._map;
@@ -11449,19 +11401,19 @@ var init_GridLayer = __esm(() => {
11449
11401
  _tileCoordsToKey(coords) {
11450
11402
  return `${coords.x}:${coords.y}:${coords.z}`;
11451
11403
  }
11452
- _keyToTileCoords(key2) {
11453
- const k = key2.split(":");
11404
+ _keyToTileCoords(key) {
11405
+ const k = key.split(":");
11454
11406
  const coords = new Point(+k[0], +k[1]);
11455
11407
  coords.z = +k[2];
11456
11408
  return coords;
11457
11409
  }
11458
- _removeTile(key2) {
11459
- const tile = this._tiles[key2];
11410
+ _removeTile(key) {
11411
+ const tile = this._tiles[key];
11460
11412
  if (!tile)
11461
11413
  return;
11462
11414
  tile.el.remove();
11463
- delete this._tiles[key2];
11464
- this.fire("tileunload", { tile: tile.el, coords: this._keyToTileCoords(key2) });
11415
+ delete this._tiles[key];
11416
+ this.fire("tileunload", { tile: tile.el, coords: this._keyToTileCoords(key) });
11465
11417
  }
11466
11418
  _initTile(tile) {
11467
11419
  tile.classList.add("tsmap-tile");
@@ -11473,21 +11425,21 @@ var init_GridLayer = __esm(() => {
11473
11425
  }
11474
11426
  _addTile(coords, container) {
11475
11427
  const tilePos = this._getTilePos(coords);
11476
- const key2 = this._tileCoordsToKey(coords);
11428
+ const key = this._tileCoordsToKey(coords);
11477
11429
  const tile = this.createTile(this._wrapCoords(coords), this._tileReady.bind(this, coords));
11478
11430
  this._initTile(tile);
11479
11431
  if (this.createTile.length < 2)
11480
11432
  requestAnimationFrame(this._tileReady.bind(this, coords, null, tile));
11481
11433
  setPosition(tile, tilePos);
11482
- this._tiles[key2] = { el: tile, coords, current: true };
11434
+ this._tiles[key] = { el: tile, coords, current: true };
11483
11435
  container.appendChild(tile);
11484
11436
  this.fire("tileloadstart", { tile, coords });
11485
11437
  }
11486
11438
  _tileReady(coords, err, tile) {
11487
11439
  if (err)
11488
11440
  this.fire("tileerror", { error: err, tile, coords });
11489
- const key2 = this._tileCoordsToKey(coords);
11490
- const entry = this._tiles[key2];
11441
+ const key = this._tileCoordsToKey(coords);
11442
+ const entry = this._tiles[key];
11491
11443
  if (!entry)
11492
11444
  return;
11493
11445
  entry.loaded = Date.now();
@@ -11558,7 +11510,7 @@ var init_TileLayer = __esm(() => {
11558
11510
  init_OfflineMaps();
11559
11511
  init_storage();
11560
11512
  init_GridLayer();
11561
- TileLayer = class TileLayer2 extends GridLayer {
11513
+ TileLayer = class TileLayer extends GridLayer {
11562
11514
  initialize(url, options) {
11563
11515
  super.initialize(options);
11564
11516
  this._url = url;
@@ -11712,8 +11664,8 @@ var init_TileLayer = __esm(() => {
11712
11664
  }
11713
11665
  }
11714
11666
  }
11715
- _removeTile(key2) {
11716
- const tile = this._tiles[key2];
11667
+ _removeTile(key) {
11668
+ const tile = this._tiles[key];
11717
11669
  if (!tile)
11718
11670
  return;
11719
11671
  const el = tile.el;
@@ -11725,7 +11677,7 @@ var init_TileLayer = __esm(() => {
11725
11677
  this._activeBlobUrls.delete(src);
11726
11678
  }
11727
11679
  el.setAttribute("src", "");
11728
- super._removeTile(key2);
11680
+ super._removeTile(key);
11729
11681
  }
11730
11682
  _tileReady(coords, err, tile) {
11731
11683
  if (!this._map || tile && tile.getAttribute("src") === "")
@@ -11773,9 +11725,9 @@ class FlatTileFeature {
11773
11725
  const start = layer.tagStart[this._index];
11774
11726
  const end = layer.tagStart[this._index + 1];
11775
11727
  for (let i = start;i + 1 < end; i += 2) {
11776
- const key2 = layer.keys[layer.tags[i]];
11777
- if (key2 !== undefined)
11778
- out[key2] = layer.values[layer.tags[i + 1]];
11728
+ const key = layer.keys[layer.tags[i]];
11729
+ if (key !== undefined)
11730
+ out[key] = layer.values[layer.tags[i + 1]];
11779
11731
  }
11780
11732
  this._properties = out;
11781
11733
  return out;
@@ -11890,33 +11842,33 @@ function decodeMvtFlat(bytes) {
11890
11842
  value |= (byte & 15) << 28;
11891
11843
  high = (byte & 112) >> 4;
11892
11844
  if (byte < 128)
11893
- return toNum2(value, high, isSigned === true);
11845
+ return toNum(value, high, isSigned === true);
11894
11846
  const shifts = [3, 10, 17, 24];
11895
11847
  for (const shift of shifts) {
11896
11848
  byte = buf[pos++];
11897
11849
  high |= (byte & 127) << shift;
11898
11850
  if (byte < 128)
11899
- return toNum2(value, high, isSigned === true);
11851
+ return toNum(value, high, isSigned === true);
11900
11852
  }
11901
11853
  byte = buf[pos++];
11902
11854
  high |= (byte & 1) << 31;
11903
11855
  if (byte < 128)
11904
- return toNum2(value, high, isSigned === true);
11856
+ return toNum(value, high, isSigned === true);
11905
11857
  throw new Error("Expected varint not more than 10 bytes");
11906
11858
  }
11907
- function toNum2(low, high, isSigned) {
11908
- const SHIFT_LEFT_322 = (1 << 16) * (1 << 16);
11859
+ function toNum(low, high, isSigned) {
11860
+ const SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
11909
11861
  if (isSigned && (high & 2147483648) !== 0) {
11910
11862
  const negLow = ~low + 1 >>> 0;
11911
11863
  let negHigh = ~high >>> 0;
11912
11864
  if (negLow === 0)
11913
11865
  negHigh = negHigh + 1 >>> 0;
11914
- const mag = negHigh * SHIFT_LEFT_322 + negLow;
11866
+ const mag = negHigh * SHIFT_LEFT_32 + negLow;
11915
11867
  if (mag > Number.MAX_SAFE_INTEGER)
11916
11868
  throw new Error("Varint exceeds safe integer range");
11917
11869
  return -mag;
11918
11870
  }
11919
- const val = (high >>> 0) * SHIFT_LEFT_322 + (low >>> 0);
11871
+ const val = (high >>> 0) * SHIFT_LEFT_32 + (low >>> 0);
11920
11872
  if (val > Number.MAX_SAFE_INTEGER)
11921
11873
  throw new Error("Varint exceeds safe integer range");
11922
11874
  return val;
@@ -11962,9 +11914,9 @@ function decodeMvtFlat(bytes) {
11962
11914
  const end = readVarint() + pos;
11963
11915
  let value = null;
11964
11916
  while (pos < end) {
11965
- const key2 = readVarint();
11966
- const tag = key2 >> 3;
11967
- const wire = key2 & 7;
11917
+ const key = readVarint();
11918
+ const tag = key >> 3;
11919
+ const wire = key & 7;
11968
11920
  if (tag === 1) {
11969
11921
  value = readString(readVarint() + pos);
11970
11922
  } else if (tag === 2) {
@@ -11988,9 +11940,9 @@ function decodeMvtFlat(bytes) {
11988
11940
  }
11989
11941
  const layers = [];
11990
11942
  while (pos < len) {
11991
- const key2 = readVarint();
11992
- const tag = key2 >> 3;
11993
- const wire = key2 & 7;
11943
+ const key = readVarint();
11944
+ const tag = key >> 3;
11945
+ const wire = key & 7;
11994
11946
  if (tag !== 3) {
11995
11947
  skip(wire);
11996
11948
  continue;
@@ -12629,14 +12581,14 @@ class RTree {
12629
12581
  let minArea = bboxArea(target.bbox);
12630
12582
  for (let i = 1;i < children.length; i++) {
12631
12583
  const c = children[i];
12632
- const area2 = bboxArea(c.bbox);
12633
- const enlargement = enlargedArea(c.bbox, record.bbox) - area2;
12584
+ const area = bboxArea(c.bbox);
12585
+ const enlargement = enlargedArea(c.bbox, record.bbox) - area;
12634
12586
  if (enlargement < minEnlargement) {
12635
12587
  minEnlargement = enlargement;
12636
- minArea = area2;
12588
+ minArea = area;
12637
12589
  target = c;
12638
- } else if (enlargement === minEnlargement && area2 < minArea) {
12639
- minArea = area2;
12590
+ } else if (enlargement === minEnlargement && area < minArea) {
12591
+ minArea = area;
12640
12592
  target = c;
12641
12593
  }
12642
12594
  }
@@ -12667,11 +12619,11 @@ class RTree {
12667
12619
  let minArea = bboxArea(target.bbox);
12668
12620
  for (let i = 1;i < children.length; i++) {
12669
12621
  const c = children[i];
12670
- const area2 = bboxArea(c.bbox);
12671
- const enlargement = enlargedArea(c.bbox, sub.bbox) - area2;
12622
+ const area = bboxArea(c.bbox);
12623
+ const enlargement = enlargedArea(c.bbox, sub.bbox) - area;
12672
12624
  if (enlargement < minEnlargement) {
12673
12625
  minEnlargement = enlargement;
12674
- minArea = area2;
12626
+ minArea = area;
12675
12627
  target = c;
12676
12628
  }
12677
12629
  }
@@ -12758,13 +12710,13 @@ class RTree {
12758
12710
  for (let k = i;k < total; k++)
12759
12711
  extend(rightBBox, children[k].bbox);
12760
12712
  const overlap = intersectionArea(leftBBox, rightBBox);
12761
- const area2 = bboxArea(leftBBox) + bboxArea(rightBBox);
12713
+ const area = bboxArea(leftBBox) + bboxArea(rightBBox);
12762
12714
  if (overlap < minOverlap) {
12763
12715
  minOverlap = overlap;
12764
- minArea = area2;
12716
+ minArea = area;
12765
12717
  index = i;
12766
- } else if (overlap === minOverlap && area2 < minArea) {
12767
- minArea = area2;
12718
+ } else if (overlap === minOverlap && area < minArea) {
12719
+ minArea = area;
12768
12720
  index = i;
12769
12721
  }
12770
12722
  }
@@ -12831,9 +12783,9 @@ function compareCentroidX(a, b) {
12831
12783
  function compareCentroidY(a, b) {
12832
12784
  return a.bbox[1] + a.bbox[3] - (b.bbox[1] + b.bbox[3]);
12833
12785
  }
12834
- function multiSelectSort(arr, left, right, step, compare2) {
12786
+ function multiSelectSort(arr, left, right, step, compare) {
12835
12787
  const slice = arr.slice(left, right + 1);
12836
- slice.sort(compare2);
12788
+ slice.sort(compare);
12837
12789
  for (let i = 0;i < slice.length; i++)
12838
12790
  arr[left + i] = slice[i];
12839
12791
  }
@@ -12893,15 +12845,15 @@ class CollisionIndex {
12893
12845
  const cells = this._ownerCells.get(owner);
12894
12846
  if (!cells)
12895
12847
  return;
12896
- for (const key2 of cells) {
12897
- const bucket = this._cells.get(key2);
12848
+ for (const key of cells) {
12849
+ const bucket = this._cells.get(key);
12898
12850
  if (!bucket)
12899
12851
  continue;
12900
12852
  const kept = bucket.filter((box) => box.owner !== owner);
12901
12853
  if (kept.length)
12902
- this._cells.set(key2, kept);
12854
+ this._cells.set(key, kept);
12903
12855
  else
12904
- this._cells.delete(key2);
12856
+ this._cells.delete(key);
12905
12857
  }
12906
12858
  this._ownerCells.delete(owner);
12907
12859
  }
@@ -12937,13 +12889,13 @@ class CollisionIndex {
12937
12889
  }
12938
12890
  for (let cy = range.y0;cy <= range.y1; cy++) {
12939
12891
  for (let cx = range.x0;cx <= range.x1; cx++) {
12940
- const key2 = cellKey(cx, cy);
12941
- const bucket = this._cells.get(key2);
12892
+ const key = cellKey(cx, cy);
12893
+ const bucket = this._cells.get(key);
12942
12894
  if (bucket)
12943
12895
  bucket.push(box);
12944
12896
  else
12945
- this._cells.set(key2, [box]);
12946
- ownerCells?.add(key2);
12897
+ this._cells.set(key, [box]);
12898
+ ownerCells?.add(key);
12947
12899
  }
12948
12900
  }
12949
12901
  }
@@ -13004,22 +12956,22 @@ function drawSections(ctx, atlas, sections, x, y, base) {
13004
12956
  }
13005
12957
  function renderSdfPixels(field, width, height, options) {
13006
12958
  const out = new Uint8ClampedArray(width * height * 4);
13007
- const fill2 = parseColor2(options.color);
12959
+ const fill = parseColor2(options.color);
13008
12960
  const haloWidth = options.haloWidth ?? 0;
13009
12961
  const halo = options.haloColor && haloWidth > 0 ? parseColor2(options.haloColor) : null;
13010
12962
  const haloEdge = halo ? Math.max(0.02, 0.5 - haloWidth / 16) : 0;
13011
12963
  const band = 0.06;
13012
12964
  for (let i = 0;i < width * height; i++) {
13013
- const distance2 = field[i * 4 + 3] / 255;
13014
- const inside = smoothstep(0.5 - band, 0.5 + band, distance2);
13015
- const outline = halo ? smoothstep(haloEdge - band, haloEdge + band, distance2) : 0;
12965
+ const distance = field[i * 4 + 3] / 255;
12966
+ const inside = smoothstep(0.5 - band, 0.5 + band, distance);
12967
+ const outline = halo ? smoothstep(haloEdge - band, haloEdge + band, distance) : 0;
13016
12968
  const alpha = inside + outline * (1 - inside);
13017
12969
  if (alpha <= 0)
13018
12970
  continue;
13019
12971
  const weight = outline * (1 - inside);
13020
- out[i * 4] = halo ? (fill2[0] * inside + halo[0] * weight) / alpha : fill2[0];
13021
- out[i * 4 + 1] = halo ? (fill2[1] * inside + halo[1] * weight) / alpha : fill2[1];
13022
- out[i * 4 + 2] = halo ? (fill2[2] * inside + halo[2] * weight) / alpha : fill2[2];
12972
+ out[i * 4] = halo ? (fill[0] * inside + halo[0] * weight) / alpha : fill[0];
12973
+ out[i * 4 + 1] = halo ? (fill[1] * inside + halo[1] * weight) / alpha : fill[1];
12974
+ out[i * 4 + 2] = halo ? (fill[2] * inside + halo[2] * weight) / alpha : fill[2];
13023
12975
  out[i * 4 + 3] = Math.round(alpha * 255);
13024
12976
  }
13025
12977
  return out;
@@ -13060,10 +13012,10 @@ function parseColor2(color) {
13060
13012
  function probeColor(color) {
13061
13013
  if (typeof document === "undefined")
13062
13014
  return [0, 0, 0];
13063
- const probe2 = document.createElement("canvas");
13064
- probe2.width = 1;
13065
- probe2.height = 1;
13066
- const ctx = probe2.getContext("2d");
13015
+ const probe = document.createElement("canvas");
13016
+ probe.width = 1;
13017
+ probe.height = 1;
13018
+ const ctx = probe.getContext("2d");
13067
13019
  if (!ctx)
13068
13020
  return [0, 0, 0];
13069
13021
  ctx.fillStyle = color;
@@ -13153,13 +13105,13 @@ class GlyphBitmapCache {
13153
13105
  this._limit = limit;
13154
13106
  }
13155
13107
  get(glyph, options) {
13156
- const key2 = `${glyph.id}|${options.color}|${options.haloColor ?? ""}|${options.haloWidth ?? 0}`;
13157
- if (this._entries.has(key2))
13158
- return this._entries.get(key2) ?? null;
13108
+ const key = `${glyph.id}|${options.color}|${options.haloColor ?? ""}|${options.haloWidth ?? 0}`;
13109
+ if (this._entries.has(key))
13110
+ return this._entries.get(key) ?? null;
13159
13111
  const bitmap = renderGlyphBitmap(glyph, options);
13160
13112
  if (this._entries.size >= this._limit)
13161
13113
  this._entries.clear();
13162
- this._entries.set(key2, bitmap);
13114
+ this._entries.set(key, bitmap);
13163
13115
  return bitmap;
13164
13116
  }
13165
13117
  clear() {
@@ -13376,8 +13328,8 @@ class IconAtlas {
13376
13328
  const color = opts?.color ?? "#000000";
13377
13329
  const haloColor = opts?.haloColor;
13378
13330
  const haloWidth = opts?.haloWidth ?? 0;
13379
- const key2 = `${entry.id}|${color}|${haloColor ?? ""}|${haloWidth}`;
13380
- const cached = this._sdfCache.get(key2);
13331
+ const key = `${entry.id}|${color}|${haloColor ?? ""}|${haloWidth}`;
13332
+ const cached = this._sdfCache.get(key);
13381
13333
  if (cached)
13382
13334
  return cached;
13383
13335
  const w = entry.width;
@@ -13400,7 +13352,7 @@ class IconAtlas {
13400
13352
  octx.putImageData(pixels, 0, 0);
13401
13353
  if (this._sdfCache.size > 128)
13402
13354
  this._sdfCache.clear();
13403
- this._sdfCache.set(key2, out);
13355
+ this._sdfCache.set(key, out);
13404
13356
  return out;
13405
13357
  }
13406
13358
  _grow(newSide) {
@@ -13503,8 +13455,8 @@ function lineLength(line) {
13503
13455
  }
13504
13456
  return total;
13505
13457
  }
13506
- function pointAtDistance(line, distance2) {
13507
- if (line.length < 2 || distance2 < 0)
13458
+ function pointAtDistance(line, distance) {
13459
+ if (line.length < 2 || distance < 0)
13508
13460
  return null;
13509
13461
  let travelled = 0;
13510
13462
  for (let i = 1;i < line.length; i++) {
@@ -13515,8 +13467,8 @@ function pointAtDistance(line, distance2) {
13515
13467
  const segment = Math.hypot(dx, dy);
13516
13468
  if (segment === 0)
13517
13469
  continue;
13518
- if (travelled + segment >= distance2) {
13519
- const t = (distance2 - travelled) / segment;
13470
+ if (travelled + segment >= distance) {
13471
+ const t = (distance - travelled) / segment;
13520
13472
  return { x: a.x + dx * t, y: a.y + dy * t, angle: Math.atan2(dy, dx) };
13521
13473
  }
13522
13474
  travelled += segment;
@@ -13609,10 +13561,10 @@ class LabelPlacer {
13609
13561
  for (const seen of this._lastSeen.get(label.identity) ?? []) {
13610
13562
  const dx = seen.x - x;
13611
13563
  const dy = seen.y - y;
13612
- const distance2 = dx * dx + dy * dy;
13613
- if (distance2 <= bestDistance) {
13564
+ const distance = dx * dx + dy * dy;
13565
+ if (distance <= bestDistance) {
13614
13566
  best = seen.state;
13615
- bestDistance = distance2;
13567
+ bestDistance = distance;
13616
13568
  }
13617
13569
  }
13618
13570
  if (best)
@@ -13721,9 +13673,9 @@ class LabelPlacer {
13721
13673
  if (state.opacity > 0)
13722
13674
  shown.push(item);
13723
13675
  }
13724
- for (const key2 of this._states.keys()) {
13725
- if (!seen.has(key2))
13726
- this._states.delete(key2);
13676
+ for (const key of this._states.keys()) {
13677
+ if (!seen.has(key))
13678
+ this._states.delete(key);
13727
13679
  }
13728
13680
  this._lastSeen = points;
13729
13681
  for (let i = shown.length - 1;i >= 0; i--) {
@@ -13761,25 +13713,25 @@ class LabelPlacer {
13761
13713
  ctx.drawImage(sprite.canvas, -sprite.ox, -sprite.oy);
13762
13714
  }
13763
13715
  }
13764
- _sprite(key2, build) {
13765
- const cached = this._sprites.get(key2);
13716
+ _sprite(key, build) {
13717
+ const cached = this._sprites.get(key);
13766
13718
  if (cached !== undefined) {
13767
- this._sprites.delete(key2);
13768
- this._sprites.set(key2, cached);
13719
+ this._sprites.delete(key);
13720
+ this._sprites.set(key, cached);
13769
13721
  return cached;
13770
13722
  }
13771
13723
  const sprite = build();
13772
- this._sprites.set(key2, sprite);
13724
+ this._sprites.set(key, sprite);
13773
13725
  return sprite;
13774
13726
  }
13775
13727
  _trimSprites() {
13776
13728
  if (this._sprites.size <= SPRITE_CACHE_LIMIT)
13777
13729
  return;
13778
13730
  let excess = this._sprites.size - SPRITE_CACHE_LIMIT * 0.75;
13779
- for (const key2 of this._sprites.keys()) {
13731
+ for (const key of this._sprites.keys()) {
13780
13732
  if (excess-- <= 0)
13781
13733
  break;
13782
- this._sprites.delete(key2);
13734
+ this._sprites.delete(key);
13783
13735
  }
13784
13736
  }
13785
13737
  }
@@ -14101,13 +14053,13 @@ function buildBuildingMesh(buildings, tileSize) {
14101
14053
  for (const ring of building.rings) {
14102
14054
  if (ring.length < 3)
14103
14055
  continue;
14104
- const area2 = ringArea(ring);
14105
- if (area2 === 0)
14056
+ const area = ringArea(ring);
14057
+ if (area === 0)
14106
14058
  continue;
14107
- const sign2 = Math.sign(area2);
14059
+ const sign = Math.sign(area);
14108
14060
  if (outerSign === 0)
14109
- outerSign = sign2;
14110
- if (sign2 === outerSign || polygons.length === 0)
14061
+ outerSign = sign;
14062
+ if (sign === outerSign || polygons.length === 0)
14111
14063
  polygons.push([ring]);
14112
14064
  else
14113
14065
  polygons[polygons.length - 1].push(ring);
@@ -14383,11 +14335,11 @@ class BuildingOverlay {
14383
14335
  this.buffers.set(draw.key, { buffer, mesh: draw.mesh });
14384
14336
  return buffer;
14385
14337
  }
14386
- release(key2) {
14387
- const cached = this.buffers.get(key2);
14338
+ release(key) {
14339
+ const cached = this.buffers.get(key);
14388
14340
  if (cached && this.gl)
14389
14341
  this.gl.deleteBuffer(cached.buffer);
14390
- this.buffers.delete(key2);
14342
+ this.buffers.delete(key);
14391
14343
  }
14392
14344
  remove() {
14393
14345
  const ext = this.gl?.getExtension?.("WEBGL_lose_context");
@@ -14517,16 +14469,16 @@ class OccluderIndex {
14517
14469
  return false;
14518
14470
  const length = Math.hypot(ex - ax, ey - ay);
14519
14471
  const steps = Math.max(1, Math.ceil(length / (CELL / 2)));
14520
- const stamp2 = ++this.query;
14472
+ const stamp = ++this.query;
14521
14473
  for (let s = 0;s <= steps; s++) {
14522
14474
  const x = ax + (ex - ax) * s / steps;
14523
14475
  const y = ay + (ey - ay) * s / steps;
14524
14476
  if (x < lo || x > hi || y < lo || y > hi)
14525
14477
  continue;
14526
14478
  for (const i of this.cells[this._cell(y) * this.cols + this._cell(x)]) {
14527
- if (this.stamps[i] === stamp2)
14479
+ if (this.stamps[i] === stamp)
14528
14480
  continue;
14529
- this.stamps[i] = stamp2;
14481
+ this.stamps[i] = stamp;
14530
14482
  const b = this.buildings[i];
14531
14483
  if (Math.max(ax, ex) < b.minX || Math.min(ax, ex) > b.maxX || Math.max(ay, ey) < b.minY || Math.min(ay, ey) > b.maxY)
14532
14484
  continue;
@@ -14635,12 +14587,12 @@ class GlyphProvider {
14635
14587
  this.cache = new GlyphBitmapCache;
14636
14588
  }
14637
14589
  needsServer(fontStack) {
14638
- const key2 = stackKey(fontStack);
14639
- const cached = this._availability.get(key2);
14590
+ const key = stackKey(fontStack);
14591
+ const cached = this._availability.get(key);
14640
14592
  if (cached !== undefined)
14641
14593
  return !cached;
14642
14594
  const available = this._available(fontStack);
14643
- this._availability.set(key2, available);
14595
+ this._availability.set(key, available);
14644
14596
  return !available;
14645
14597
  }
14646
14598
  glyphs(fontStack, text) {
@@ -14661,10 +14613,10 @@ class GlyphProvider {
14661
14613
  if (codePoint === undefined)
14662
14614
  continue;
14663
14615
  const start = rangeStartFor(codePoint);
14664
- const key2 = `${stack}/${start}`;
14665
- if (this._requested.has(key2))
14616
+ const key = `${stack}/${start}`;
14617
+ if (this._requested.has(key))
14666
14618
  continue;
14667
- this._requested.add(key2);
14619
+ this._requested.add(key);
14668
14620
  this._source.load(stack, codePoint).then(() => this._onLoad()).catch(() => {});
14669
14621
  }
14670
14622
  }
@@ -14869,12 +14821,12 @@ function wrapText(text, maxWidth, measure) {
14869
14821
  const words = text.split(/\s+/).filter(Boolean);
14870
14822
  if (words.length < 2 || maxWidth <= 0 || measure(text) <= maxWidth)
14871
14823
  return [text];
14872
- const greedy = (limit2) => {
14824
+ const greedy = (limit) => {
14873
14825
  const lines = [];
14874
14826
  let line = "";
14875
14827
  for (const word of words) {
14876
14828
  const next = line ? `${line} ${word}` : word;
14877
- if (line && measure(next) > limit2) {
14829
+ if (line && measure(next) > limit) {
14878
14830
  lines.push(line);
14879
14831
  line = word;
14880
14832
  } else {
@@ -14902,34 +14854,34 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
14902
14854
  return;
14903
14855
  const layout = styleLayer.layout;
14904
14856
  const paint = styleLayer.paint;
14905
- const resolve2 = (value) => resolveLayoutExpression(value, zoom, feature, featureState);
14906
- const rawText = resolve2(layout?.["text-field"]);
14857
+ const resolve = (value) => resolveLayoutExpression(value, zoom, feature, featureState);
14858
+ const rawText = resolve(layout?.["text-field"]);
14907
14859
  const formatted = isFormatted(rawText) && !isUniform(rawText.sections) ? rawText : null;
14908
- const textTransform = resolve2(layout?.["text-transform"]);
14860
+ const textTransform = resolve(layout?.["text-transform"]);
14909
14861
  const text = formatted ? formatted.toString() : transformText(coerceString(isFormatted(rawText) ? rawText.toString() : rawText), textTransform);
14910
- const textSize = resolve2(layout?.["text-size"]) ?? 16;
14862
+ const textSize = resolve(layout?.["text-size"]) ?? 16;
14911
14863
  const font = glyphAtlas.resolveFont(layout?.["text-font"]);
14912
- const italic = font.italic || !!resolve2(layout?.["text-italic"]);
14913
- const bold = font.bold || !!resolve2(layout?.["text-bold"]);
14914
- const textColor = resolve2(paint?.["text-color"]) ?? "#000";
14915
- const haloColor = resolve2(paint?.["text-halo-color"]);
14916
- const haloWidth = resolve2(paint?.["text-halo-width"]);
14917
- const textOpacity = resolve2(paint?.["text-opacity"]);
14918
- const iconId = coerceString(resolve2(layout?.["icon-image"]));
14919
- const iconSize = resolve2(layout?.["icon-size"]);
14920
- const iconRotate = resolve2(layout?.["icon-rotate"]);
14864
+ const italic = font.italic || !!resolve(layout?.["text-italic"]);
14865
+ const bold = font.bold || !!resolve(layout?.["text-bold"]);
14866
+ const textColor = resolve(paint?.["text-color"]) ?? "#000";
14867
+ const haloColor = resolve(paint?.["text-halo-color"]);
14868
+ const haloWidth = resolve(paint?.["text-halo-width"]);
14869
+ const textOpacity = resolve(paint?.["text-opacity"]);
14870
+ const iconId = coerceString(resolve(layout?.["icon-image"]));
14871
+ const iconSize = resolve(layout?.["icon-size"]);
14872
+ const iconRotate = resolve(layout?.["icon-rotate"]);
14921
14873
  const iconEntry = iconId && iconAtlas ? builtinIcon(iconAtlas, iconId) : undefined;
14922
- const iconOpacity = resolve2(paint?.["icon-opacity"]);
14923
- const iconColor = iconEntry?.sdf ? resolve2(paint?.["icon-color"]) ?? "#000000" : undefined;
14924
- const iconHaloColor = iconEntry?.sdf ? resolve2(paint?.["icon-halo-color"]) : undefined;
14925
- const iconHaloWidth = iconEntry?.sdf ? resolve2(paint?.["icon-halo-width"]) : undefined;
14926
- const sortKeyValue = resolve2(layout?.["symbol-sort-key"]);
14874
+ const iconOpacity = resolve(paint?.["icon-opacity"]);
14875
+ const iconColor = iconEntry?.sdf ? resolve(paint?.["icon-color"]) ?? "#000000" : undefined;
14876
+ const iconHaloColor = iconEntry?.sdf ? resolve(paint?.["icon-halo-color"]) : undefined;
14877
+ const iconHaloWidth = iconEntry?.sdf ? resolve(paint?.["icon-halo-width"]) : undefined;
14878
+ const sortKeyValue = resolve(layout?.["symbol-sort-key"]);
14927
14879
  const legacyPriority = layout?.["symbol-priority"];
14928
14880
  const sortKey = typeof sortKeyValue === "number" ? sortKeyValue : typeof legacyPriority === "number" ? -legacyPriority : 0;
14929
- const allowOverlap = !!(resolve2(layout?.["text-allow-overlap"]) ?? resolve2(layout?.["icon-allow-overlap"]));
14930
- const ignorePlacement = !!(resolve2(layout?.["text-ignore-placement"]) ?? resolve2(layout?.["icon-ignore-placement"]));
14931
- const padding = resolve2(layout?.["text-padding"]) ?? 2;
14932
- const letterSpacing = (resolve2(layout?.["text-letter-spacing"]) ?? 0) * textSize;
14881
+ const allowOverlap = !!(resolve(layout?.["text-allow-overlap"]) ?? resolve(layout?.["icon-allow-overlap"]));
14882
+ const ignorePlacement = !!(resolve(layout?.["text-ignore-placement"]) ?? resolve(layout?.["icon-ignore-placement"]));
14883
+ const padding = resolve(layout?.["text-padding"]) ?? 2;
14884
+ const letterSpacing = (resolve(layout?.["text-letter-spacing"]) ?? 0) * textSize;
14933
14885
  const textStyle = { italic, bold, family: font.family, letterSpacing };
14934
14886
  const drawOptions = { color: textColor, haloColor, haloWidth, size: textSize, italic, bold, family: font.family, letterSpacing };
14935
14887
  const bleed = Math.ceil((haloWidth ?? 0) + 2);
@@ -14953,10 +14905,10 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
14953
14905
  if (labelWidth <= 0)
14954
14906
  return;
14955
14907
  const height = glyphAtlas.measureText(text, textSize, textStyle).height;
14956
- const spacing = resolve2(layout?.["symbol-spacing"]) ?? 250;
14957
- const maxAngle = resolve2(layout?.["text-max-angle"]) ?? 45;
14908
+ const spacing = resolve(layout?.["symbol-spacing"]) ?? 250;
14909
+ const maxAngle = resolve(layout?.["text-max-angle"]) ?? 45;
14958
14910
  const centreOnly = layout?.["symbol-placement"] === "line-center";
14959
- const signature2 = `${styleLayer.id}\x00${textSize}\x00${font.family ?? ""}\x00${italic}${bold}\x00${textColor}\x00${haloColor ?? ""}\x00${haloWidth ?? 0}\x00${letterSpacing}\x00${alpha}`;
14911
+ const signature = `${styleLayer.id}\x00${textSize}\x00${font.family ?? ""}\x00${italic}${bold}\x00${textColor}\x00${haloColor ?? ""}\x00${haloWidth ?? 0}\x00${letterSpacing}\x00${alpha}`;
14960
14912
  for (const ring of rings) {
14961
14913
  if (ring.length < 2)
14962
14914
  continue;
@@ -14964,8 +14916,8 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
14964
14916
  const length = lineLength(line);
14965
14917
  const starts = centreOnly ? length >= labelWidth ? [(length - labelWidth) / 2] : [] : repeatDistances(length, labelWidth, spacing);
14966
14918
  for (const start of starts) {
14967
- const anchor2 = start + labelWidth / 2;
14968
- const at = pointAtDistance(line, anchor2);
14919
+ const anchor = start + labelWidth / 2;
14920
+ const at = pointAtDistance(line, anchor);
14969
14921
  if (!at)
14970
14922
  continue;
14971
14923
  out.push({
@@ -14974,7 +14926,7 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
14974
14926
  key: `${styleLayer.id}\x00${text}\x00${context.spot(at.x, at.y, 18)}`,
14975
14927
  order: context.next(),
14976
14928
  line,
14977
- anchor: anchor2,
14929
+ anchor,
14978
14930
  text,
14979
14931
  repeatDistance: Math.max(labelWidth * 1.5, spacing * 0.75),
14980
14932
  chars: advances.map((a) => a.char),
@@ -14982,7 +14934,7 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
14982
14934
  width: labelWidth,
14983
14935
  height,
14984
14936
  maxAngle,
14985
- signature: signature2,
14937
+ signature,
14986
14938
  paintGlyph: (ctx, char) => {
14987
14939
  ctx.globalAlpha = alpha;
14988
14940
  glyphAtlas.drawText(ctx, char, 0, height * 0.35, drawOptions);
@@ -14994,15 +14946,15 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
14994
14946
  }
14995
14947
  if (feature.type !== 1)
14996
14948
  return;
14997
- const anchor = resolve2(layout?.["text-anchor"]) ?? "center";
14998
- const offset = offsetPixels(resolve2(layout?.["text-offset"]), textSize);
14999
- const rotateDeg = resolve2(layout?.["text-rotate"]) ?? 0;
15000
- const rotate2 = rotateDeg * Math.PI / 180;
14949
+ const anchor = resolve(layout?.["text-anchor"]) ?? "center";
14950
+ const offset = offsetPixels(resolve(layout?.["text-offset"]), textSize);
14951
+ const rotateDeg = resolve(layout?.["text-rotate"]) ?? 0;
14952
+ const rotate = rotateDeg * Math.PI / 180;
15001
14953
  const needsServer = !!text && !formatted && !!glyphProvider?.needsServer(layout?.["text-font"]);
15002
14954
  const serverGlyphs = needsServer ? glyphProvider.glyphs(layout?.["text-font"], text) : null;
15003
14955
  if (needsServer && serverGlyphs === null)
15004
14956
  return;
15005
- const maxWidthEm = resolve2(layout?.["text-max-width"]) ?? 10;
14957
+ const maxWidthEm = resolve(layout?.["text-max-width"]) ?? 10;
15006
14958
  const lines = text && !formatted && !serverGlyphs ? wrapText(text, maxWidthEm * textSize, (s) => glyphAtlas.measureText(s, textSize, textStyle).width) : [text];
15007
14959
  let textWidth = 0;
15008
14960
  let textHeight = 0;
@@ -15036,7 +14988,7 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
15036
14988
  const textY = shift.y + offset.y;
15037
14989
  let box = { minX: 0, minY: 0, maxX: 0, maxY: 0 };
15038
14990
  if (text && textWidth > 0) {
15039
- const bounds = rotate2 === 0 ? { minX: textX, minY: textY, maxX: textX + textWidth, maxY: textY + textHeight } : rotatedBounds(textX, textY, textWidth, textHeight, rotate2, 0, 0);
14991
+ const bounds = rotate === 0 ? { minX: textX, minY: textY, maxX: textX + textWidth, maxY: textY + textHeight } : rotatedBounds(textX, textY, textWidth, textHeight, rotate, 0, 0);
15040
14992
  box = { ...bounds };
15041
14993
  }
15042
14994
  if (iconEntry) {
@@ -15063,8 +15015,8 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
15063
15015
  return;
15064
15016
  ctx.save();
15065
15017
  ctx.globalAlpha = alpha;
15066
- if (rotate2 !== 0)
15067
- ctx.rotate(rotate2);
15018
+ if (rotate !== 0)
15019
+ ctx.rotate(rotate);
15068
15020
  const baselineY = textY + ascent;
15069
15021
  if (serverGlyphs)
15070
15022
  drawGlyphs(ctx, serverGlyphs, textX, baselineY, drawOptions, glyphProvider?.cache);
@@ -15080,19 +15032,19 @@ function buildSymbolCandidates(out, rings, styleLayer, feature, zoom, featureSta
15080
15032
  for (const ring of rings) {
15081
15033
  for (const pt of ring) {
15082
15034
  const at = context.toTile(pt.x, pt.y);
15083
- const key2 = `${identity}\x00${context.spot(at.x, at.y, 21)}`;
15035
+ const key = `${identity}\x00${context.spot(at.x, at.y, 21)}`;
15084
15036
  out.push({
15085
15037
  ...base,
15086
15038
  kind: "point",
15087
15039
  identity,
15088
15040
  occludable: !!iconEntry,
15089
- key: key2,
15041
+ key,
15090
15042
  order: context.next(),
15091
15043
  x: at.x,
15092
15044
  y: at.y,
15093
15045
  box,
15094
15046
  paint: paintLabel,
15095
- signature: signature || key2
15047
+ signature: signature || key
15096
15048
  });
15097
15049
  }
15098
15050
  }
@@ -15155,12 +15107,12 @@ function evaluateFilterLegacy(filter, feature) {
15155
15107
  if (op === "none")
15156
15108
  return rest.every((child) => !evaluateFilterLegacy(child, feature));
15157
15109
  if (op === "has") {
15158
- const key2 = rest[0];
15159
- return typeof key2 === "string" && key2 in feature.properties;
15110
+ const key = rest[0];
15111
+ return typeof key === "string" && key in feature.properties;
15160
15112
  }
15161
15113
  if (op === "!has") {
15162
- const key2 = rest[0];
15163
- return typeof key2 === "string" && !(key2 in feature.properties);
15114
+ const key = rest[0];
15115
+ return typeof key === "string" && !(key in feature.properties);
15164
15116
  }
15165
15117
  const left = resolveLegacyKey(rest[0], feature);
15166
15118
  if (op === "==" || op === "!=") {
@@ -15353,8 +15305,8 @@ function pointInPolygon2(p, rings) {
15353
15305
  const yi = ring[i].y;
15354
15306
  const xj = ring[j].x;
15355
15307
  const yj = ring[j].y;
15356
- const intersects2 = yi > p.y !== yj > p.y && p.x < (xj - xi) * (p.y - yi) / (yj - yi || 1) + xi;
15357
- if (intersects2)
15308
+ const intersects = yi > p.y !== yj > p.y && p.x < (xj - xi) * (p.y - yi) / (yj - yi || 1) + xi;
15309
+ if (intersects)
15358
15310
  inside = !inside;
15359
15311
  }
15360
15312
  }
@@ -15524,7 +15476,7 @@ var init_VectorTileMapLayer = __esm(() => {
15524
15476
  init_WebGLTileRenderer();
15525
15477
  init_GridLayer();
15526
15478
  init_urlTemplate();
15527
- VectorTileMapLayer = class VectorTileMapLayer2 extends GridLayer {
15479
+ VectorTileMapLayer = class VectorTileMapLayer extends GridLayer {
15528
15480
  initialize(options) {
15529
15481
  super.initialize(options);
15530
15482
  this._styleLayers = this.options.layers ?? [];
@@ -15561,12 +15513,12 @@ var init_VectorTileMapLayer = __esm(() => {
15561
15513
  return archive.loading;
15562
15514
  }
15563
15515
  async _loadArchiveTileJSON() {
15564
- const key2 = pmtilesSourceUrl(this.options.url);
15516
+ const key = pmtilesSourceUrl(this.options.url);
15565
15517
  const maps = await activeOfflineMaps();
15566
15518
  const offline = async () => {
15567
- const hit = (maps?.enabled ? await maps.lookup(key2).catch(() => {
15519
+ const hit = (maps?.enabled ? await maps.lookup(key).catch(() => {
15568
15520
  return;
15569
- }) : undefined) ?? await this._offlineCache?.get(key2).catch(() => {
15521
+ }) : undefined) ?? await this._offlineCache?.get(key).catch(() => {
15570
15522
  return;
15571
15523
  });
15572
15524
  return hit?.data.byteLength ? JSON.parse(new TextDecoder().decode(hit.data)) : undefined;
@@ -15574,12 +15526,12 @@ var init_VectorTileMapLayer = __esm(() => {
15574
15526
  if (maps?.enabled && maps.onlyOffline) {
15575
15527
  const stored = await offline();
15576
15528
  if (!stored)
15577
- throw new Error(`Only using offline maps, and ${key2} is not downloaded`);
15529
+ throw new Error(`Only using offline maps, and ${key} is not downloaded`);
15578
15530
  return stored;
15579
15531
  }
15580
15532
  try {
15581
- const tilejson = await pmtilesTileJSON(key2);
15582
- this._offlineCache?.put(key2, new TextEncoder().encode(JSON.stringify(tilejson)), "application/json").catch(() => {});
15533
+ const tilejson = await pmtilesTileJSON(key);
15534
+ this._offlineCache?.put(key, new TextEncoder().encode(JSON.stringify(tilejson)), "application/json").catch(() => {});
15583
15535
  return tilejson;
15584
15536
  } catch (error) {
15585
15537
  const stored = await offline();
@@ -15764,10 +15716,10 @@ var init_VectorTileMapLayer = __esm(() => {
15764
15716
  continue;
15765
15717
  const id = feature.id;
15766
15718
  if (id !== undefined) {
15767
- const key2 = `${layerName}|${typeof id}|${id}`;
15768
- if (seen.has(key2))
15719
+ const key = `${layerName}|${typeof id}|${id}`;
15720
+ if (seen.has(key))
15769
15721
  continue;
15770
- seen.add(key2);
15722
+ seen.add(key);
15771
15723
  }
15772
15724
  out.push({ feature, sourceLayer: layerName, tile: entry.coords });
15773
15725
  }
@@ -15839,8 +15791,8 @@ var init_VectorTileMapLayer = __esm(() => {
15839
15791
  this._sourceCache.clear();
15840
15792
  super.onRemove(map);
15841
15793
  }
15842
- _removeTile(key2) {
15843
- const tile = this._tiles?.[key2];
15794
+ _removeTile(key) {
15795
+ const tile = this._tiles?.[key];
15844
15796
  if (tile) {
15845
15797
  const entry = this._decodedTiles.get(tile.el);
15846
15798
  if (entry) {
@@ -15850,7 +15802,7 @@ var init_VectorTileMapLayer = __esm(() => {
15850
15802
  this._decodedTiles.delete(tile.el);
15851
15803
  }
15852
15804
  }
15853
- super._removeTile(key2);
15805
+ super._removeTile(key);
15854
15806
  this._refreshSymbols();
15855
15807
  }
15856
15808
  getTileUrl(coords) {
@@ -16008,9 +15960,9 @@ var init_VectorTileMapLayer = __esm(() => {
16008
15960
  return !!this._buildingOverlay?.active;
16009
15961
  }
16010
15962
  _buildingsFor(entry, layers) {
16011
- const key2 = this._sourceKey(entry.coords);
15963
+ const key = this._sourceKey(entry.coords);
16012
15964
  this._buildingMeshes ??= new Map;
16013
- const cached = this._buildingMeshes.get(key2);
15965
+ const cached = this._buildingMeshes.get(key);
16014
15966
  if (cached && cached.version === this._labelVersion)
16015
15967
  return cached.meshes;
16016
15968
  for (const item of cached?.meshes ?? [])
@@ -16038,12 +15990,12 @@ var init_VectorTileMapLayer = __esm(() => {
16038
15990
  let featureState;
16039
15991
  if (lookup && feature.id !== undefined)
16040
15992
  featureState = lookup(sourceId, styleLayer.sourceLayer, feature.id);
16041
- const resolve2 = (value) => resolvePaintExpression(value, source.z, feature, featureState);
16042
- const height = Number(resolve2(paint?.["fill-extrusion-height"]) ?? 0);
16043
- const base = Number(resolve2(paint?.["fill-extrusion-base"]) ?? 0);
15993
+ const resolve = (value) => resolvePaintExpression(value, source.z, feature, featureState);
15994
+ const height = Number(resolve(paint?.["fill-extrusion-height"]) ?? 0);
15995
+ const base = Number(resolve(paint?.["fill-extrusion-base"]) ?? 0);
16044
15996
  if (!(height > base))
16045
15997
  continue;
16046
- const color = parseCssColor(resolve2(paint?.["fill-extrusion-color"]) ?? "#000", 1);
15998
+ const color = parseCssColor(resolve(paint?.["fill-extrusion-color"]) ?? "#000", 1);
16047
15999
  const rings = feature.loadGeometry().map((ring) => ring.map((pt) => ({ x: pt.x * scale, y: pt.y * scale })));
16048
16000
  footprints.push({ rings, height, base, color: [color[0], color[1], color[2], color[3]] });
16049
16001
  const outer = rings[0];
@@ -16068,7 +16020,7 @@ var init_VectorTileMapLayer = __esm(() => {
16068
16020
  meshes.push({ layer: styleLayer.id, mesh: buildBuildingMesh(footprints, size) });
16069
16021
  }
16070
16022
  }
16071
- this._buildingMeshes.set(key2, { version: this._labelVersion, meshes, occluders: new OccluderIndex(occluders, this.getTileSize().x) });
16023
+ this._buildingMeshes.set(key, { version: this._labelVersion, meshes, occluders: new OccluderIndex(occluders, this.getTileSize().x) });
16072
16024
  return meshes;
16073
16025
  }
16074
16026
  _occlusionTest(occlusion) {
@@ -16078,11 +16030,11 @@ var init_VectorTileMapLayer = __esm(() => {
16078
16030
  if (!memo || memo.signature !== signature)
16079
16031
  memo = this._occlusionMemo = { signature, results: new Map };
16080
16032
  const results = memo.results;
16081
- return (x, y, key2) => {
16082
- let hidden = results.get(key2);
16033
+ return (x, y, key) => {
16034
+ let hidden = results.get(key);
16083
16035
  if (hidden === undefined) {
16084
16036
  hidden = occluded(occlusion.sources, map.containerPointToLayerPoint([x, y]), occlusion.camera, occlusion.rise);
16085
- results.set(key2, hidden);
16037
+ results.set(key, hidden);
16086
16038
  }
16087
16039
  return hidden;
16088
16040
  };
@@ -16123,10 +16075,10 @@ var init_VectorTileMapLayer = __esm(() => {
16123
16075
  const drawn = new Set;
16124
16076
  const ready = (e) => meshes.get(this._sourceKey(e.coords))?.version === this._labelVersion;
16125
16077
  for (const entry of this._labelEntries(ready)) {
16126
- const key2 = this._sourceKey(entry.coords);
16127
- if (drawn.has(key2))
16078
+ const key = this._sourceKey(entry.coords);
16079
+ if (drawn.has(key))
16128
16080
  continue;
16129
- drawn.add(key2);
16081
+ drawn.add(key);
16130
16082
  const { x, y, z } = this._subTile(entry.coords);
16131
16083
  const k = map.getZoomScale(mapZoom, z);
16132
16084
  const matrix = buildingMatrix(camera, k, [x * tileSize * k - origin.x, y * tileSize * k - origin.y]);
@@ -16153,7 +16105,7 @@ var init_VectorTileMapLayer = __esm(() => {
16153
16105
  if (layerOpacity >= 0.5)
16154
16106
  solid = true;
16155
16107
  }
16156
- const cached = meshes.get(key2);
16108
+ const cached = meshes.get(key);
16157
16109
  if (solid && cached)
16158
16110
  occlusionSources.push({ index: cached.occluders, scale: k, origin: [x * tileSize * k - origin.x, y * tileSize * k - origin.y], pxPerMetre: heightScale });
16159
16111
  }
@@ -16171,12 +16123,12 @@ var init_VectorTileMapLayer = __esm(() => {
16171
16123
  const held = new Set;
16172
16124
  for (const entry of this._decodedTiles.values())
16173
16125
  held.add(this._sourceKey(entry.coords));
16174
- for (const [key2, cached] of meshes) {
16175
- if (held.has(key2))
16126
+ for (const [key, cached] of meshes) {
16127
+ if (held.has(key))
16176
16128
  continue;
16177
16129
  for (const item of cached.meshes)
16178
16130
  overlay.release(item);
16179
- meshes.delete(key2);
16131
+ meshes.delete(key);
16180
16132
  }
16181
16133
  return pending;
16182
16134
  }
@@ -16313,33 +16265,33 @@ var init_VectorTileMapLayer = __esm(() => {
16313
16265
  }
16314
16266
  _abortLoading() {
16315
16267
  const wanted = new Set;
16316
- for (const key2 of Object.keys(this._tiles ?? {})) {
16317
- const tile = this._tiles[key2];
16268
+ for (const key of Object.keys(this._tiles ?? {})) {
16269
+ const tile = this._tiles[key];
16318
16270
  if (tile?.current && tile.coords)
16319
16271
  wanted.add(this._sourceKey(tile.coords));
16320
16272
  }
16321
- for (const [key2, pending] of [...this._sourcePending.entries()]) {
16322
- if (wanted.has(key2))
16273
+ for (const [key, pending] of [...this._sourcePending.entries()]) {
16274
+ if (wanted.has(key))
16323
16275
  continue;
16324
16276
  pending.abort.abort();
16325
- this._sourcePending.delete(key2);
16277
+ this._sourcePending.delete(key);
16326
16278
  }
16327
16279
  }
16328
16280
  _sourceKey(coords) {
16329
16281
  const sub = this._subTile(coords);
16330
16282
  return `${sub.z}/${sub.x}/${sub.y}`;
16331
16283
  }
16332
- async _acquireSource(key2, url, entry) {
16333
- const cached = this._sourceCache.get(key2);
16284
+ async _acquireSource(key, url, entry) {
16285
+ const cached = this._sourceCache.get(key);
16334
16286
  if (cached) {
16335
16287
  cached.refs += 1;
16336
- entry.sourceKey = key2;
16288
+ entry.sourceKey = key;
16337
16289
  return { tile: cached.tile, index: cached.index };
16338
16290
  }
16339
- const pending = this._sourcePending.get(key2);
16291
+ const pending = this._sourcePending.get(key);
16340
16292
  if (pending) {
16341
16293
  pending.refs += 1;
16342
- entry.sourceKey = key2;
16294
+ entry.sourceKey = key;
16343
16295
  entry.sourcePending = true;
16344
16296
  return pending.promise;
16345
16297
  }
@@ -16351,16 +16303,16 @@ var init_VectorTileMapLayer = __esm(() => {
16351
16303
  const bytes = await this._fetchTileBytes(url, { abort });
16352
16304
  const decoded = await this._decode(bytes);
16353
16305
  const built = { tile: decoded, index: buildTileIndex(decoded) };
16354
- const waiting = this._sourcePending.get(key2)?.refs ?? 1;
16355
- this._sourcePending.delete(key2);
16356
- this._sourceCache.set(key2, { ...built, refs: waiting });
16306
+ const waiting = this._sourcePending.get(key)?.refs ?? 1;
16307
+ this._sourcePending.delete(key);
16308
+ this._sourceCache.set(key, { ...built, refs: waiting });
16357
16309
  return built;
16358
16310
  })()
16359
16311
  };
16360
- this._sourcePending.set(key2, record);
16361
- entry.sourceKey = key2;
16312
+ this._sourcePending.set(key, record);
16313
+ entry.sourceKey = key;
16362
16314
  entry.sourcePending = true;
16363
- record.promise.catch(() => this._sourcePending.delete(key2));
16315
+ record.promise.catch(() => this._sourcePending.delete(key));
16364
16316
  return record.promise;
16365
16317
  }
16366
16318
  async _decode(bytes) {
@@ -16385,23 +16337,23 @@ var init_VectorTileMapLayer = __esm(() => {
16385
16337
  return pool.size() > 0 ? pool : null;
16386
16338
  }
16387
16339
  _releaseSource(entry) {
16388
- const key2 = entry.sourceKey;
16389
- if (!key2)
16340
+ const key = entry.sourceKey;
16341
+ if (!key)
16390
16342
  return;
16391
16343
  entry.sourceKey = undefined;
16392
- const cached = this._sourceCache.get(key2);
16344
+ const cached = this._sourceCache.get(key);
16393
16345
  if (cached) {
16394
16346
  cached.refs -= 1;
16395
16347
  if (cached.refs <= 0)
16396
- this._sourceCache.delete(key2);
16348
+ this._sourceCache.delete(key);
16397
16349
  return;
16398
16350
  }
16399
- const pending = this._sourcePending.get(key2);
16351
+ const pending = this._sourcePending.get(key);
16400
16352
  if (pending) {
16401
16353
  pending.refs -= 1;
16402
16354
  if (pending.refs <= 0) {
16403
16355
  pending.abort.abort();
16404
- this._sourcePending.delete(key2);
16356
+ this._sourcePending.delete(key);
16405
16357
  }
16406
16358
  }
16407
16359
  }
@@ -16621,7 +16573,7 @@ var HillshadeLayer;
16621
16573
  var init_RasterDEMLayer = __esm(() => {
16622
16574
  init_DomEvent();
16623
16575
  init_TileLayer();
16624
- RasterDEMLayer = class RasterDEMLayer2 extends TileLayer {
16576
+ RasterDEMLayer = class RasterDEMLayer extends TileLayer {
16625
16577
  initialize(url, options) {
16626
16578
  super.initialize(url, { tileSize: 512, crossOrigin: true, ...options });
16627
16579
  this._encoding = options?.encoding ?? "mapbox";
@@ -17097,9 +17049,9 @@ function swapItem(ids, coords, i, j) {
17097
17049
  function rangeKD(ids, coords, minX, minY, maxX, maxY, left, right, axis, nodeSize, out) {
17098
17050
  if (right - left <= nodeSize) {
17099
17051
  for (let i = left;i <= right; i++) {
17100
- const x2 = coords[2 * i];
17101
- const y2 = coords[2 * i + 1];
17102
- if (x2 >= minX && x2 <= maxX && y2 >= minY && y2 <= maxY)
17052
+ const x = coords[2 * i];
17053
+ const y = coords[2 * i + 1];
17054
+ if (x >= minX && x <= maxX && y >= minY && y <= maxY)
17103
17055
  out.push(ids[i]);
17104
17056
  }
17105
17057
  return;
@@ -17461,7 +17413,7 @@ var init_HeatmapLayer = __esm(() => {
17461
17413
  0.8: "yellow",
17462
17414
  1: "red"
17463
17415
  };
17464
- HeatmapLayer = class HeatmapLayer2 extends Layer {
17416
+ HeatmapLayer = class HeatmapLayer extends Layer {
17465
17417
  initialize(options) {
17466
17418
  setOptions(this, options);
17467
17419
  this._data = options?.data ? [...options.data] : [];
@@ -17615,8 +17567,8 @@ var init_HeatmapLayer = __esm(() => {
17615
17567
  return this._gradientTexture;
17616
17568
  }
17617
17569
  const g = ctx.createLinearGradient(0, 0, 0, 256);
17618
- for (const [stop2, colour] of Object.entries(gradient)) {
17619
- g.addColorStop(Number(stop2), colour);
17570
+ for (const [stop, colour] of Object.entries(gradient)) {
17571
+ g.addColorStop(Number(stop), colour);
17620
17572
  }
17621
17573
  ctx.fillStyle = g;
17622
17574
  ctx.fillRect(0, 0, 1, 256);
@@ -17707,10 +17659,10 @@ async function fetchDemTile(url, demSize) {
17707
17659
  if (!res.ok)
17708
17660
  return null;
17709
17661
  const blob = await res.blob();
17710
- const img = await new Promise((resolve2, reject) => {
17662
+ const img = await new Promise((resolve, reject) => {
17711
17663
  const el = new Image;
17712
17664
  el.crossOrigin = "anonymous";
17713
- el.onload = () => resolve2(el);
17665
+ el.onload = () => resolve(el);
17714
17666
  el.onerror = reject;
17715
17667
  el.src = URL.createObjectURL(blob);
17716
17668
  });
@@ -17733,13 +17685,13 @@ async function loadSpriteImage(url) {
17733
17685
  return;
17734
17686
  });
17735
17687
  const blobUrl = hit?.data.byteLength ? URL.createObjectURL(new Blob([hit.data], { type: hit.mime })) : undefined;
17736
- return new Promise((resolve2, reject) => {
17688
+ return new Promise((resolve, reject) => {
17737
17689
  const image = new Image;
17738
17690
  image.crossOrigin = "anonymous";
17739
17691
  image.onload = () => {
17740
17692
  if (blobUrl)
17741
17693
  URL.revokeObjectURL(blobUrl);
17742
- resolve2(image);
17694
+ resolve(image);
17743
17695
  };
17744
17696
  image.onerror = () => {
17745
17697
  if (blobUrl)
@@ -17771,7 +17723,7 @@ var init_Map = __esm(() => {
17771
17723
  init_terrainMesh();
17772
17724
  init_TerrainSource();
17773
17725
  init_WebGLTileRenderer();
17774
- TsMap = class TsMap2 extends Evented {
17726
+ TsMap = class TsMap extends Evented {
17775
17727
  static _pointerEvents = ["click", "dblclick", "pointerover", "pointerout", "contextmenu"];
17776
17728
  _sizeChanged = true;
17777
17729
  _initControlPos;
@@ -17845,8 +17797,8 @@ var init_Map = __esm(() => {
17845
17797
  const containerPoint = latlng instanceof Point ? latlng : this.latLngToContainerPoint(latlng);
17846
17798
  if (this._bearing || this._pitch) {
17847
17799
  const offset = this._groundOffset(containerPoint).multiplyBy(1 - 1 / scale);
17848
- const newCenter2 = this.layerPointToLatLng(this._getCenterLayerPoint().add(offset));
17849
- return this.setView(newCenter2, zoom, { zoom: options });
17800
+ const newCenter = this.layerPointToLatLng(this._getCenterLayerPoint().add(offset));
17801
+ return this.setView(newCenter, zoom, { zoom: options });
17850
17802
  }
17851
17803
  const centerOffset = containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale);
17852
17804
  const newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset));
@@ -18004,7 +17956,7 @@ var init_Map = __esm(() => {
18004
17956
  const center = this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom);
18005
17957
  const zoom = this.getScaleZoom(w0 / w(s), startZoom);
18006
17958
  if (bearingChanged)
18007
- this._bearing = TsMap2._lerpBearing(startBearing, targetBearing, t);
17959
+ this._bearing = TsMap._lerpBearing(startBearing, targetBearing, t);
18008
17960
  if (pitchChanged)
18009
17961
  this._pitch = startPitch + (targetPitch - startPitch) * t;
18010
17962
  this._move(center, zoom, { flyTo: true });
@@ -18269,8 +18221,8 @@ var init_Map = __esm(() => {
18269
18221
  getBearing() {
18270
18222
  return this._bearing;
18271
18223
  }
18272
- setBearing(bearing2) {
18273
- const wrapped = (bearing2 % 360 + 360) % 360;
18224
+ setBearing(bearing) {
18225
+ const wrapped = (bearing % 360 + 360) % 360;
18274
18226
  if (wrapped === this._bearing)
18275
18227
  return this;
18276
18228
  this.fire("rotatestart", { bearing: this._bearing });
@@ -18280,11 +18232,11 @@ var init_Map = __esm(() => {
18280
18232
  this.fire("rotateend", { bearing: wrapped });
18281
18233
  return this;
18282
18234
  }
18283
- rotateTo(bearing2, options) {
18235
+ rotateTo(bearing, options) {
18284
18236
  if (!options?.animate)
18285
- return this.setBearing(bearing2);
18237
+ return this.setBearing(bearing);
18286
18238
  return this.easeTo({
18287
- bearing: bearing2,
18239
+ bearing,
18288
18240
  duration: options.duration ?? 300,
18289
18241
  easing: options.easing
18290
18242
  });
@@ -18379,7 +18331,7 @@ var init_Map = __esm(() => {
18379
18331
  const px = fromPx.add(toPx.subtract(fromPx).multiplyBy(t));
18380
18332
  const center = this.unproject(px, startZoom);
18381
18333
  if (bearingChanged)
18382
- this._bearing = TsMap2._lerpBearing(startBearing, endBearing, t);
18334
+ this._bearing = TsMap._lerpBearing(startBearing, endBearing, t);
18383
18335
  if (pitchChanged)
18384
18336
  this._pitch = startPitch + (endPitch - startPitch) * t;
18385
18337
  this._move(center, lerpZoom, { easeTo: true });
@@ -18811,7 +18763,7 @@ var init_Map = __esm(() => {
18811
18763
  }
18812
18764
  for (const t of targets) {
18813
18765
  t.fire(type, data, true);
18814
- if (data.originalEvent._stopped || t.options?.bubblingPointerEvents === false && TsMap2._pointerEvents.includes(type)) {
18766
+ if (data.originalEvent._stopped || t.options?.bubblingPointerEvents === false && TsMap._pointerEvents.includes(type)) {
18815
18767
  return;
18816
18768
  }
18817
18769
  }
@@ -18850,13 +18802,13 @@ var init_Map = __esm(() => {
18850
18802
  const pos = this._getMapPanePos();
18851
18803
  if (this._pitch && (pos.x || pos.y) && this._loaded) {
18852
18804
  const pitch = this._pitch;
18853
- const bearing2 = this._bearing;
18805
+ const bearing = this._bearing;
18854
18806
  this._pitch = this._appliedPitch ?? 0;
18855
- this._bearing = this._appliedBearing ?? bearing2;
18856
- const center2 = this.getCenter();
18807
+ this._bearing = this._appliedBearing ?? bearing;
18808
+ const center = this.getCenter();
18857
18809
  this._pitch = pitch;
18858
- this._bearing = bearing2;
18859
- this._resetView(center2, this._zoom, true);
18810
+ this._bearing = bearing;
18811
+ this._resetView(center, this._zoom, true);
18860
18812
  }
18861
18813
  const size = this.getSize();
18862
18814
  const center = size.divideBy(2);
@@ -19279,8 +19231,8 @@ var init_Map = __esm(() => {
19279
19231
  if (!names.length)
19280
19232
  return true;
19281
19233
  try {
19282
- const probe2 = new GlyphAtlas;
19283
- const { family } = probe2.resolveFont(names);
19234
+ const probe = new GlyphAtlas;
19235
+ const { family } = probe.resolveFont(names);
19284
19236
  return fonts.check(`16px ${family}`);
19285
19237
  } catch {
19286
19238
  return true;
@@ -19689,12 +19641,12 @@ var init_Map = __esm(() => {
19689
19641
  }
19690
19642
  setFeatureState(lookup, state) {
19691
19643
  const store = this._ensureFeatureStateMap();
19692
- const key2 = this._featureStateKey(lookup);
19693
- const existing = store.get(key2);
19644
+ const key = this._featureStateKey(lookup);
19645
+ const existing = store.get(key);
19694
19646
  if (existing)
19695
19647
  Object.assign(existing, state);
19696
19648
  else
19697
- store.set(key2, { ...state });
19649
+ store.set(key, { ...state });
19698
19650
  this._repaintSource(lookup.source);
19699
19651
  return this;
19700
19652
  }
@@ -19702,20 +19654,20 @@ var init_Map = __esm(() => {
19702
19654
  const store = this._featureState;
19703
19655
  if (!store)
19704
19656
  return {};
19705
- const key2 = this._featureStateKey(lookup);
19706
- return store.get(key2) ?? {};
19657
+ const key = this._featureStateKey(lookup);
19658
+ return store.get(key) ?? {};
19707
19659
  }
19708
- removeFeatureState(lookup, key2) {
19660
+ removeFeatureState(lookup, key) {
19709
19661
  const store = this._featureState;
19710
19662
  if (!store)
19711
19663
  return this;
19712
19664
  const fullKey = this._featureStateKey(lookup);
19713
- if (key2 === undefined) {
19665
+ if (key === undefined) {
19714
19666
  store.delete(fullKey);
19715
19667
  } else {
19716
19668
  const existing = store.get(fullKey);
19717
19669
  if (existing) {
19718
- delete existing[key2];
19670
+ delete existing[key];
19719
19671
  if (Object.keys(existing).length === 0)
19720
19672
  store.delete(fullKey);
19721
19673
  }
@@ -19808,10 +19760,10 @@ var init_Map = __esm(() => {
19808
19760
  setSky(sky) {
19809
19761
  if (sky !== null) {
19810
19762
  const numericFields = ["fog-ground-blend", "sun-intensity"];
19811
- for (const key2 of numericFields) {
19812
- const value = sky[key2];
19763
+ for (const key of numericFields) {
19764
+ const value = sky[key];
19813
19765
  if (value !== undefined && Number.isNaN(value))
19814
- throw new RangeError(`setSky: ${key2} is NaN.`);
19766
+ throw new RangeError(`setSky: ${key} is NaN.`);
19815
19767
  }
19816
19768
  if (sky["sun-position"] !== undefined) {
19817
19769
  const [az, alt] = sky["sun-position"];
@@ -19999,15 +19951,15 @@ var init_Map = __esm(() => {
19999
19951
  this._theme = theme;
20000
19952
  this.options.theme = theme;
20001
19953
  if (theme === "auto") {
20002
- const resolve2 = () => {
20003
- const page2 = this._pageTheme();
20004
- const dark = page2 !== undefined ? page2 === "dark" : Boolean(this._themeQuery?.matches);
19954
+ const resolve = () => {
19955
+ const page = this._pageTheme();
19956
+ const dark = page !== undefined ? page === "dark" : Boolean(this._themeQuery?.matches);
20005
19957
  if (dark !== this._container?.classList.contains("tsmap-dark"))
20006
19958
  this._applyTheme(dark);
20007
19959
  };
20008
19960
  if (typeof matchMedia === "function") {
20009
19961
  const query = matchMedia("(prefers-color-scheme: dark)");
20010
- const listener = () => resolve2();
19962
+ const listener = () => resolve();
20011
19963
  if (typeof query.addEventListener === "function")
20012
19964
  query.addEventListener("change", listener);
20013
19965
  else
@@ -20017,7 +19969,7 @@ var init_Map = __esm(() => {
20017
19969
  }
20018
19970
  const root = typeof document !== "undefined" ? document.documentElement : undefined;
20019
19971
  if (root && typeof MutationObserver === "function") {
20020
- this._themeObserver = new MutationObserver(resolve2);
19972
+ this._themeObserver = new MutationObserver(resolve);
20021
19973
  this._themeObserver.observe(root, { attributes: true, attributeFilter: ["data-theme", "data-color-mode", "class"] });
20022
19974
  }
20023
19975
  const page = this._pageTheme();
@@ -20128,10 +20080,10 @@ var init_Map = __esm(() => {
20128
20080
  }
20129
20081
  toBlob(type = "image/png", quality) {
20130
20082
  this._requestExportFrame();
20131
- return new Promise((resolve2) => {
20083
+ return new Promise((resolve) => {
20132
20084
  const canvas = this.toCanvas();
20133
20085
  if (typeof canvas.toBlob === "function") {
20134
- canvas.toBlob((blob) => resolve2(blob), type, quality);
20086
+ canvas.toBlob((blob) => resolve(blob), type, quality);
20135
20087
  } else {
20136
20088
  try {
20137
20089
  const dataUrl = canvas.toDataURL(type, quality);
@@ -20141,9 +20093,9 @@ var init_Map = __esm(() => {
20141
20093
  const bytes = new Uint8Array(binary.length);
20142
20094
  for (let i = 0;i < binary.length; i++)
20143
20095
  bytes[i] = binary.charCodeAt(i);
20144
- resolve2(new Blob([bytes], { type }));
20096
+ resolve(new Blob([bytes], { type }));
20145
20097
  } catch {
20146
- resolve2(null);
20098
+ resolve(null);
20147
20099
  }
20148
20100
  }
20149
20101
  });
@@ -20325,10 +20277,10 @@ var init_Map = __esm(() => {
20325
20277
  const spec = this._style.spec.sources?.[this._terrain.source];
20326
20278
  if (!spec || spec.type !== "raster-dem")
20327
20279
  return;
20328
- const template2 = Array.isArray(spec.tiles) ? spec.tiles[0] : undefined;
20329
- if (!template2 || typeof template2 !== "string")
20280
+ const template = Array.isArray(spec.tiles) ? spec.tiles[0] : undefined;
20281
+ if (!template || typeof template !== "string")
20330
20282
  return;
20331
- const url = template2.replace(/\{z\}/g, String(coord.z)).replace(/\{x\}/g, String(coord.x)).replace(/\{y\}/g, String(coord.y));
20283
+ const url = template.replace(/\{z\}/g, String(coord.z)).replace(/\{x\}/g, String(coord.x)).replace(/\{y\}/g, String(coord.y));
20332
20284
  if (!this._terrainFetchInFlight)
20333
20285
  this._terrainFetchInFlight = new globalThis.Map;
20334
20286
  if (this._terrainFetchInFlight.has(url))
@@ -20981,9 +20933,9 @@ function assemblePolygons(rings) {
20981
20933
  continue;
20982
20934
  if (!pointInRing2(samples[i], kept[j]))
20983
20935
  continue;
20984
- const area2 = Math.abs(ringSignedArea(kept[j]));
20985
- if (area2 < bestArea) {
20986
- bestArea = area2;
20936
+ const area = Math.abs(ringSignedArea(kept[j]));
20937
+ if (area < bestArea) {
20938
+ bestArea = area;
20987
20939
  bestParent = j;
20988
20940
  }
20989
20941
  depths[i]++;
@@ -21206,7 +21158,7 @@ function prepareClaim(ring) {
21206
21158
  }
21207
21159
  var InvalidGeometryError;
21208
21160
  var init_validate3 = __esm(() => {
21209
- InvalidGeometryError = class InvalidGeometryError2 extends Error {
21161
+ InvalidGeometryError = class InvalidGeometryError extends Error {
21210
21162
  constructor(message) {
21211
21163
  super(message);
21212
21164
  this.name = "InvalidGeometryError";
@@ -21218,7 +21170,7 @@ var init_TerritoryStore = __esm(() => {
21218
21170
  init_Events();
21219
21171
  init_area();
21220
21172
  init_validate3();
21221
- TerritoryStore = class TerritoryStore2 extends Evented {
21173
+ TerritoryStore = class TerritoryStore extends Evented {
21222
21174
  initialize(options = {}) {
21223
21175
  this._byOwner = new Map;
21224
21176
  this._options = {
@@ -21807,11 +21759,11 @@ init_Point();
21807
21759
 
21808
21760
  class Draggable extends Evented {
21809
21761
  static _dragging = false;
21810
- initialize(element, dragStartTarget, preventOutline2, options) {
21762
+ initialize(element, dragStartTarget, preventOutline, options) {
21811
21763
  setOptions(this, options);
21812
21764
  this._element = element;
21813
21765
  this._dragStartTarget = dragStartTarget ?? element;
21814
- this._preventOutline = preventOutline2;
21766
+ this._preventOutline = preventOutline;
21815
21767
  }
21816
21768
  enable() {
21817
21769
  if (this._enabled)
@@ -22396,16 +22348,16 @@ function distanceToStretch(p, a, b, kx) {
22396
22348
  }
22397
22349
  function cutEvery(points, every) {
22398
22350
  const cuts = [0];
22399
- let run2 = 0;
22351
+ let run = 0;
22400
22352
  for (let i = 1;i < points.length - 1; i++) {
22401
- run2 += distanceMeters(points[i - 1], points[i]);
22402
- if (run2 >= every) {
22353
+ run += distanceMeters(points[i - 1], points[i]);
22354
+ if (run >= every) {
22403
22355
  cuts.push(i);
22404
- run2 = 0;
22356
+ run = 0;
22405
22357
  }
22406
22358
  }
22407
- run2 += distanceMeters(points[points.length - 2], points[points.length - 1]);
22408
- if (cuts.length > 1 && run2 < every / 2)
22359
+ run += distanceMeters(points[points.length - 2], points[points.length - 1]);
22360
+ if (cuts.length > 1 && run < every / 2)
22409
22361
  cuts.pop();
22410
22362
  cuts.push(points.length - 1);
22411
22363
  return cuts;
@@ -22536,7 +22488,7 @@ class RouteBuilder {
22536
22488
  return this.add(start, opts);
22537
22489
  }
22538
22490
  outAndBack() {
22539
- const run2 = async () => {
22491
+ const run = async () => {
22540
22492
  const { waypoints, segments, straight } = this.state;
22541
22493
  if (waypoints.length < 2)
22542
22494
  return;
@@ -22547,7 +22499,7 @@ class RouteBuilder {
22547
22499
  straight: [...straight, ...straight.slice().reverse()]
22548
22500
  };
22549
22501
  };
22550
- return this.enqueue(run2);
22502
+ return this.enqueue(run);
22551
22503
  }
22552
22504
  undo() {
22553
22505
  return this.enqueue(async () => {
@@ -22612,10 +22564,10 @@ class RouteBuilder {
22612
22564
  const found = await reverse;
22613
22565
  return { ...found, segment: found.segment.slice().reverse() };
22614
22566
  }
22615
- const key3 = pairKey(from, to);
22616
- if (!jobs.has(key3))
22617
- jobs.set(key3, this.route(from, to, router));
22618
- return jobs.get(key3);
22567
+ const key = pairKey(from, to);
22568
+ if (!jobs.has(key))
22569
+ jobs.set(key, this.route(from, to, router));
22570
+ return jobs.get(key);
22619
22571
  }));
22620
22572
  this.lastError = results.find((r) => r.error)?.error ?? null;
22621
22573
  return results.map(({ segment, straight }) => ({ segment, straight }));
@@ -22725,8 +22677,8 @@ class Navigator extends Evented {
22725
22677
  const last = points[points.length - 1];
22726
22678
  starts.push(first && last && first.lat === last.lat && first.lng === last.lng ? points.length - 1 : points.length);
22727
22679
  for (const p of step.geometry) {
22728
- const last2 = points[points.length - 1];
22729
- if (!last2 || last2.lat !== p.lat || last2.lng !== p.lng)
22680
+ const last = points[points.length - 1];
22681
+ if (!last || last.lat !== p.lat || last.lng !== p.lng)
22730
22682
  points.push(p);
22731
22683
  }
22732
22684
  }
@@ -22754,8 +22706,8 @@ class Navigator extends Evented {
22754
22706
  get steps() {
22755
22707
  return this.route.steps;
22756
22708
  }
22757
- pointAt(distance2) {
22758
- const d = Math.max(0, Math.min(this.length, distance2));
22709
+ pointAt(distance) {
22710
+ const d = Math.max(0, Math.min(this.length, distance));
22759
22711
  let i = 1;
22760
22712
  while (i < this.along.length - 1 && this.along[i] < d)
22761
22713
  i++;
@@ -22798,29 +22750,29 @@ class Navigator extends Evented {
22798
22750
  }
22799
22751
  update(fix) {
22800
22752
  const time = fix.time ?? Date.now();
22801
- const { distance: distance2, offset } = this.snap(fix);
22753
+ const { distance, offset } = this.snap(fix);
22802
22754
  let speed = typeof fix.speed === "number" && fix.speed >= 0 ? fix.speed : 0;
22803
22755
  if (!(speed > 0) && this._last && time > this._last.time)
22804
- speed = Math.max(0, (distance2 - this._last.distance) / ((time - this._last.time) / 1000));
22805
- this._last = { distance: distance2, time };
22806
- const stepIndex = this._stepAt(distance2);
22756
+ speed = Math.max(0, (distance - this._last.distance) / ((time - this._last.time) / 1000));
22757
+ this._last = { distance, time };
22758
+ const stepIndex = this._stepAt(distance);
22807
22759
  const next = this.route.steps[stepIndex + 1];
22808
22760
  const stepEnd = this.stepStarts[stepIndex + 1] ?? this.length;
22809
- const distanceToManeuver = Math.max(0, stepEnd - distance2);
22761
+ const distanceToManeuver = Math.max(0, stepEnd - distance);
22810
22762
  const nextManeuver = parseManeuver(next?.maneuver ?? "arrive", next?.exit);
22811
22763
  const after = this.route.steps[stepIndex + 2];
22812
22764
  const afterGap = (this.stepStarts[stepIndex + 2] ?? this.length) - stepEnd;
22813
22765
  const thenManeuver = after && afterGap < (this.options.profile === "walking" ? 40 : 150) ? parseManeuver(after.maneuver, after.exit) : undefined;
22814
- const distanceRemaining = Math.max(0, this.length - distance2);
22815
- const durationRemaining = this._durationFrom(distance2, stepIndex);
22816
- const { heading } = this.pointAt(distance2);
22766
+ const distanceRemaining = Math.max(0, this.length - distance);
22767
+ const durationRemaining = this._durationFrom(distance, stepIndex);
22768
+ const { heading } = this.pointAt(distance);
22817
22769
  const progress = {
22818
- location: this.pointAt(distance2).location,
22770
+ location: this.pointAt(distance).location,
22819
22771
  raw: fix,
22820
22772
  offRouteDistance: offset,
22821
22773
  heading,
22822
22774
  speed,
22823
- distanceTraveled: distance2,
22775
+ distanceTraveled: distance,
22824
22776
  distanceRemaining,
22825
22777
  durationRemaining,
22826
22778
  arrival: new Date(time + durationRemaining * 1000),
@@ -22857,19 +22809,19 @@ class Navigator extends Evented {
22857
22809
  this.fire("progress", { progress });
22858
22810
  return progress;
22859
22811
  }
22860
- _stepAt(distance2) {
22812
+ _stepAt(distance) {
22861
22813
  let i = 0;
22862
- while (i + 1 < this.stepStarts.length && this.stepStarts[i + 1] <= distance2)
22814
+ while (i + 1 < this.stepStarts.length && this.stepStarts[i + 1] <= distance)
22863
22815
  i++;
22864
22816
  return i;
22865
22817
  }
22866
- _durationFrom(distance2, stepIndex) {
22818
+ _durationFrom(distance, stepIndex) {
22867
22819
  const steps = this.route.steps;
22868
22820
  if (!steps.length)
22869
- return this.length > 0 ? this.route.duration * (1 - distance2 / this.length) : 0;
22821
+ return this.length > 0 ? this.route.duration * (1 - distance / this.length) : 0;
22870
22822
  const start = this.stepStarts[stepIndex] ?? 0;
22871
22823
  const end = this.stepStarts[stepIndex + 1] ?? this.length;
22872
- const fraction = end > start ? (end - distance2) / (end - start) : 0;
22824
+ const fraction = end > start ? (end - distance) / (end - start) : 0;
22873
22825
  let total = (steps[stepIndex]?.duration ?? 0) * Math.max(0, Math.min(1, fraction));
22874
22826
  for (let i = stepIndex + 1;i < steps.length; i++)
22875
22827
  total += steps[i].duration;
@@ -22889,8 +22841,8 @@ class Navigator extends Evented {
22889
22841
  continue;
22890
22842
  if (stage === "early" && stepLength < at * 1.2)
22891
22843
  return;
22892
- const key3 = `${progress.stepIndex}:${stage}`;
22893
- if (this._announced.has(key3))
22844
+ const key = `${progress.stepIndex}:${stage}`;
22845
+ if (this._announced.has(key))
22894
22846
  return;
22895
22847
  for (let j = i;j < stages.length; j++)
22896
22848
  this._announced.add(`${progress.stepIndex}:${stages[j][0]}`);
@@ -22938,11 +22890,11 @@ class RouteSimulator {
22938
22890
  clearInterval(this._timer);
22939
22891
  this._timer = null;
22940
22892
  }
22941
- speedAt(distance2) {
22893
+ speedAt(distance) {
22942
22894
  const starts = this.navigator.stepStarts;
22943
22895
  let nearest = Infinity;
22944
22896
  for (let i = 1;i < starts.length; i++)
22945
- nearest = Math.min(nearest, Math.abs(starts[i] - distance2));
22897
+ nearest = Math.min(nearest, Math.abs(starts[i] - distance));
22946
22898
  const slow = this.speed * 0.35;
22947
22899
  const reach = 60;
22948
22900
  return nearest >= reach ? this.speed : slow + (this.speed - slow) * (nearest / reach);
@@ -23143,10 +23095,10 @@ function stepToStep(step) {
23143
23095
  function routeToRoute(r) {
23144
23096
  const legs = r.legs ?? [];
23145
23097
  const steps = legs.flatMap((l) => (l.steps ?? []).map(stepToStep));
23146
- const distance2 = legs.reduce((sum, l) => sum + (l.distance?.value ?? 0), 0);
23098
+ const distance = legs.reduce((sum, l) => sum + (l.distance?.value ?? 0), 0);
23147
23099
  const duration = legs.reduce((sum, l) => sum + (l.duration?.value ?? 0), 0);
23148
23100
  const geometry = r.overview_polyline ? decodePolyline(r.overview_polyline.points) : steps.flatMap((s) => s.geometry);
23149
- return { distance: distance2, duration, geometry, steps };
23101
+ return { distance, duration, geometry, steps };
23150
23102
  }
23151
23103
 
23152
23104
  class GoogleDirections {
@@ -23551,12 +23503,12 @@ class NominatimGeocoder {
23551
23503
  constructor(opts = {}) {
23552
23504
  this.baseUrl = (opts.baseUrl ?? "https://nominatim.openstreetmap.org").replace(/\/$/, "");
23553
23505
  this.userAgent = opts.userAgent ?? "ts-maps";
23554
- this.scheduleRequest = throttle((run2) => run2(), 250);
23506
+ this.scheduleRequest = throttle((run) => run(), 250);
23555
23507
  }
23556
23508
  gate(work) {
23557
- return new Promise((resolve2, reject) => {
23509
+ return new Promise((resolve, reject) => {
23558
23510
  this.scheduleRequest(() => {
23559
- work().then(resolve2, reject);
23511
+ work().then(resolve, reject);
23560
23512
  });
23561
23513
  });
23562
23514
  }
@@ -23620,8 +23572,8 @@ var profileMap3 = {
23620
23572
  walking: "foot",
23621
23573
  cycling: "bike"
23622
23574
  };
23623
- function coordsToLatLng(coords2) {
23624
- return coords2.map(([lng, lat]) => ({ lat, lng }));
23575
+ function coordsToLatLng(coords) {
23576
+ return coords.map(([lng, lat]) => ({ lat, lng }));
23625
23577
  }
23626
23578
  function stepInstruction(step) {
23627
23579
  if (step.maneuver?.instruction)
@@ -23692,13 +23644,13 @@ class OSRMDirections {
23692
23644
  if (waypoints.length < 2)
23693
23645
  throw new Error("OSRM requires at least two waypoints");
23694
23646
  const profile = profileMap3[opts?.profile ?? "driving"] ?? "driving";
23695
- const coords2 = waypoints.map((w) => `${w.lng},${w.lat}`).join(";");
23647
+ const coords = waypoints.map((w) => `${w.lng},${w.lat}`).join(";");
23696
23648
  const params = new URLSearchParams;
23697
23649
  params.set("overview", "full");
23698
23650
  params.set("geometries", "geojson");
23699
23651
  params.set("steps", "true");
23700
23652
  params.set("alternatives", opts?.alternatives ? "true" : "false");
23701
- const url = `${this.baseUrl}/route/v1/${profile}/${coords2}?${params.toString()}`;
23653
+ const url = `${this.baseUrl}/route/v1/${profile}/${coords}?${params.toString()}`;
23702
23654
  const res = await fetch(url, { signal: opts?.signal });
23703
23655
  if (!res.ok)
23704
23656
  throw new Error(`OSRM request failed: ${res.status} ${res.statusText}`);
@@ -23720,7 +23672,7 @@ class OSRMMatrix {
23720
23672
  throw new Error("OSRM matrix requires at least one origin and one destination");
23721
23673
  const profile = profileMap3[opts?.profile ?? "driving"] ?? "driving";
23722
23674
  const all = [...origins, ...destinations];
23723
- const coords2 = all.map((w) => `${w.lng},${w.lat}`).join(";");
23675
+ const coords = all.map((w) => `${w.lng},${w.lat}`).join(";");
23724
23676
  const sources = origins.map((_, i) => i).join(";");
23725
23677
  const destinationsParam = destinations.map((_, i) => origins.length + i).join(";");
23726
23678
  const annotations = opts?.metric === "distance" ? "distance" : "duration";
@@ -23728,7 +23680,7 @@ class OSRMMatrix {
23728
23680
  params.set("sources", sources);
23729
23681
  params.set("destinations", destinationsParam);
23730
23682
  params.set("annotations", annotations);
23731
- const url = `${this.baseUrl}/table/v1/${profile}/${coords2}?${params.toString()}`;
23683
+ const url = `${this.baseUrl}/table/v1/${profile}/${coords}?${params.toString()}`;
23732
23684
  const res = await fetch(url, { signal: opts?.signal });
23733
23685
  if (!res.ok)
23734
23686
  throw new Error(`OSRM matrix request failed: ${res.status} ${res.statusText}`);
@@ -23781,10 +23733,10 @@ function buildLabel(props) {
23781
23733
  return parts.filter(Boolean).join(", ");
23782
23734
  }
23783
23735
  function toResult4(f) {
23784
- const coords2 = f.geometry?.coordinates ?? [0, 0];
23736
+ const coords = f.geometry?.coordinates ?? [0, 0];
23785
23737
  const out = {
23786
23738
  text: buildLabel(f.properties),
23787
- center: { lat: coords2[1], lng: coords2[0] },
23739
+ center: { lat: coords[1], lng: coords[0] },
23788
23740
  properties: f.properties
23789
23741
  };
23790
23742
  if (f.properties?.extent) {
@@ -24216,12 +24168,12 @@ class GeocoderControl extends Control {
24216
24168
  this._renderList();
24217
24169
  return;
24218
24170
  }
24219
- const run2 = () => this._request(trimmed);
24171
+ const run = () => this._request(trimmed);
24220
24172
  const wait = options.debounce ?? 300;
24221
24173
  if (wait > 0)
24222
- this._timer = setTimeout(run2, wait);
24174
+ this._timer = setTimeout(run, wait);
24223
24175
  else
24224
- run2();
24176
+ run();
24225
24177
  }
24226
24178
  _request(query) {
24227
24179
  const options = this.options;
@@ -24991,12 +24943,12 @@ class NavigationControl extends Control {
24991
24943
  if (!map || !needle)
24992
24944
  return;
24993
24945
  const options = this.options;
24994
- const bearing2 = map.getBearing?.() ?? 0;
24995
- const transforms = [`rotate(${-bearing2}deg)`];
24946
+ const bearing = map.getBearing?.() ?? 0;
24947
+ const transforms = [`rotate(${-bearing}deg)`];
24996
24948
  if (options.visualizePitch)
24997
24949
  transforms.unshift(`rotateX(${map.getPitch?.() ?? 0}deg)`);
24998
24950
  needle.style.transform = transforms.join(" ");
24999
- this._compassButton?.setAttribute("data-bearing", String(Math.round(bearing2)));
24951
+ this._compassButton?.setAttribute("data-bearing", String(Math.round(bearing)));
25000
24952
  }
25001
24953
  _updateDisabled() {
25002
24954
  const map = this._map;
@@ -25063,7 +25015,7 @@ __export(exports_PolyUtil, {
25063
25015
  init_LatLng();
25064
25016
  init_LatLngBounds();
25065
25017
  init_Point();
25066
- function clipPolygon(points, bounds, round2) {
25018
+ function clipPolygon(points, bounds, round) {
25067
25019
  let clippedPoints;
25068
25020
  const edges = [1, 4, 2, 8];
25069
25021
  for (let i = 0, len = points.length;i < len; i++) {
@@ -25077,13 +25029,13 @@ function clipPolygon(points, bounds, round2) {
25077
25029
  const b = points[j];
25078
25030
  if (!(a._code & edge)) {
25079
25031
  if (b._code & edge) {
25080
- const p = _getEdgeIntersection(b, a, edge, bounds, round2);
25032
+ const p = _getEdgeIntersection(b, a, edge, bounds, round);
25081
25033
  p._code = _getBitCode(p, bounds);
25082
25034
  clippedPoints.push(p);
25083
25035
  }
25084
25036
  clippedPoints.push(a);
25085
25037
  } else if (!(b._code & edge)) {
25086
- const p = _getEdgeIntersection(b, a, edge, bounds, round2);
25038
+ const p = _getEdgeIntersection(b, a, edge, bounds, round);
25087
25039
  p._code = _getBitCode(p, bounds);
25088
25040
  clippedPoints.push(p);
25089
25041
  }
@@ -25111,7 +25063,7 @@ function polygonCenter(latlngs, crs) {
25111
25063
  const latlng = new LatLng(latlngs[i]);
25112
25064
  points.push(crs.project(new LatLng(latlng.lat - centroidLatLng.lat, latlng.lng - centroidLatLng.lng)));
25113
25065
  }
25114
- let area2 = 0, x = 0, y = 0;
25066
+ let area = 0, x = 0, y = 0;
25115
25067
  let center;
25116
25068
  for (let i = 0, j = len - 1;i < len; j = i++) {
25117
25069
  const p1 = points[i];
@@ -25119,21 +25071,21 @@ function polygonCenter(latlngs, crs) {
25119
25071
  const f = p1.y * p2.x - p2.y * p1.x;
25120
25072
  x += (p1.x + p2.x) * f;
25121
25073
  y += (p1.y + p2.y) * f;
25122
- area2 += f * 3;
25074
+ area += f * 3;
25123
25075
  }
25124
- if (area2 === 0) {
25076
+ if (area === 0) {
25125
25077
  center = points[0];
25126
25078
  } else {
25127
- center = [x / area2, y / area2];
25079
+ center = [x / area, y / area];
25128
25080
  }
25129
25081
  const latlngCenter = crs.unproject(new Point(center));
25130
25082
  return new LatLng(latlngCenter.lat + centroidLatLng.lat, latlngCenter.lng + centroidLatLng.lng);
25131
25083
  }
25132
- function centroid(coords2) {
25084
+ function centroid(coords) {
25133
25085
  let latSum = 0;
25134
25086
  let lngSum = 0;
25135
25087
  let len = 0;
25136
- for (const coord of coords2) {
25088
+ for (const coord of coords) {
25137
25089
  const latlng = new LatLng(coord);
25138
25090
  latSum += latlng.lat;
25139
25091
  lngSum += latlng.lng;
@@ -25171,10 +25123,10 @@ function _simplifyDPStep(points, markers, sqTolerance, first, last) {
25171
25123
  let maxSqDist = 0;
25172
25124
  let index = 0;
25173
25125
  for (let i = first + 1;i <= last - 1; i++) {
25174
- const sqDist2 = _sqClosestPointOnSegment(points[i], points[first], points[last], true);
25175
- if (sqDist2 > maxSqDist) {
25126
+ const sqDist = _sqClosestPointOnSegment(points[i], points[first], points[last], true);
25127
+ if (sqDist > maxSqDist) {
25176
25128
  index = i;
25177
- maxSqDist = sqDist2;
25129
+ maxSqDist = sqDist;
25178
25130
  }
25179
25131
  }
25180
25132
  if (maxSqDist > sqTolerance) {
@@ -25197,7 +25149,7 @@ function _reducePoints(points, sqTolerance) {
25197
25149
  return reducedPoints;
25198
25150
  }
25199
25151
  var _lastCode;
25200
- function clipSegment(a, b, bounds, useLastCode, round2) {
25152
+ function clipSegment(a, b, bounds, useLastCode, round) {
25201
25153
  let codeA = useLastCode ? _lastCode : _getBitCode(a, bounds);
25202
25154
  let codeB = _getBitCode(b, bounds);
25203
25155
  _lastCode = codeB;
@@ -25207,7 +25159,7 @@ function clipSegment(a, b, bounds, useLastCode, round2) {
25207
25159
  if (codeA & codeB)
25208
25160
  return false;
25209
25161
  const codeOut = codeA || codeB;
25210
- const p = _getEdgeIntersection(a, b, codeOut, bounds, round2);
25162
+ const p = _getEdgeIntersection(a, b, codeOut, bounds, round);
25211
25163
  const newCode = _getBitCode(p, bounds);
25212
25164
  if (codeOut === codeA) {
25213
25165
  a = p;
@@ -25218,7 +25170,7 @@ function clipSegment(a, b, bounds, useLastCode, round2) {
25218
25170
  }
25219
25171
  }
25220
25172
  }
25221
- function _getEdgeIntersection(a, b, code, bounds, round2) {
25173
+ function _getEdgeIntersection(a, b, code, bounds, round) {
25222
25174
  const dx = b.x - a.x;
25223
25175
  const dy = b.y - a.y;
25224
25176
  const min = bounds.min;
@@ -25237,7 +25189,7 @@ function _getEdgeIntersection(a, b, code, bounds, round2) {
25237
25189
  x = min.x;
25238
25190
  y = a.y + dy * (min.x - a.x) / dx;
25239
25191
  }
25240
- return new Point(x, y, round2);
25192
+ return new Point(x, y, round);
25241
25193
  }
25242
25194
  function _getBitCode(p, bounds) {
25243
25195
  let code = 0;
@@ -25256,7 +25208,7 @@ function _sqDist(p1, p2) {
25256
25208
  const dy = p2.y - p1.y;
25257
25209
  return dx * dx + dy * dy;
25258
25210
  }
25259
- function _sqClosestPointOnSegment(p, p1, p2, sqDist2) {
25211
+ function _sqClosestPointOnSegment(p, p1, p2, sqDist) {
25260
25212
  let { x, y } = p1;
25261
25213
  let dx = p2.x - x, dy = p2.y - y;
25262
25214
  const dot = dx * dx + dy * dy;
@@ -25273,7 +25225,7 @@ function _sqClosestPointOnSegment(p, p1, p2, sqDist2) {
25273
25225
  }
25274
25226
  dx = p.x - x;
25275
25227
  dy = p.y - y;
25276
- return sqDist2 ? dx * dx + dy * dy : new Point(x, y);
25228
+ return sqDist ? dx * dx + dy * dy : new Point(x, y);
25277
25229
  }
25278
25230
  function isFlat(latlngs) {
25279
25231
  return !Array.isArray(latlngs[0]) || typeof latlngs[0][0] !== "object" && typeof latlngs[0][0] !== "undefined";
@@ -25355,9 +25307,9 @@ class Polyline extends Path {
25355
25307
  for (let i = 1, len = points.length;i < len; i++) {
25356
25308
  const p1 = points[i - 1];
25357
25309
  const p2 = points[i];
25358
- const sqDist2 = closest(p, p1, p2, true);
25359
- if (sqDist2 < minDistance) {
25360
- minDistance = sqDist2;
25310
+ const sqDist = closest(p, p1, p2, true);
25311
+ if (sqDist < minDistance) {
25312
+ minDistance = sqDist;
25361
25313
  minPoint = closest(p, p1, p2);
25362
25314
  }
25363
25315
  }
@@ -25727,9 +25679,9 @@ class OfflineMapsControl extends Control {
25727
25679
  this._button?.classList.add(`${CLASS5}-button-active`);
25728
25680
  this._nameEdited = false;
25729
25681
  this._frame = { top: 0, left: 0, right: 0, bottom: 0 };
25730
- const select2 = this._select = create("div", `${CLASS5}-select`, map.getContainer());
25731
- select2.innerHTML = `<div class="${CLASS5}-frame"></div>${["nw", "ne", "sw", "se"].map((c) => `<div class="${CLASS5}-handle ${CLASS5}-handle-${c}" data-corner="${c}"></div>`).join("")}`;
25732
- for (const handle of select2.querySelectorAll(`.${CLASS5}-handle`))
25682
+ const select = this._select = create("div", `${CLASS5}-select`, map.getContainer());
25683
+ select.innerHTML = `<div class="${CLASS5}-frame"></div>${["nw", "ne", "sw", "se"].map((c) => `<div class="${CLASS5}-handle ${CLASS5}-handle-${c}" data-corner="${c}"></div>`).join("")}`;
25684
+ for (const handle of select.querySelectorAll(`.${CLASS5}-handle`))
25733
25685
  this._dragHandle(handle);
25734
25686
  const card = this._card = this._panel(`${CLASS5}-card ${CLASS5}-card-select`);
25735
25687
  card.innerHTML = `
@@ -25897,14 +25849,14 @@ class OfflineMapsControl extends Control {
25897
25849
  this._outline = undefined;
25898
25850
  }
25899
25851
  _layoutSelection() {
25900
- const select2 = this._select;
25852
+ const select = this._select;
25901
25853
  const f = this._frame;
25902
- if (!select2 || !f)
25854
+ if (!select || !f)
25903
25855
  return;
25904
- const frame = select2.querySelector(`.${CLASS5}-frame`);
25856
+ const frame = select.querySelector(`.${CLASS5}-frame`);
25905
25857
  Object.assign(frame.style, { top: `${f.top}px`, left: `${f.left}px`, right: `${f.right}px`, bottom: `${f.bottom}px` });
25906
25858
  const place = (corner, x, y) => {
25907
- const el = select2.querySelector(`.${CLASS5}-handle-${corner}`);
25859
+ const el = select.querySelector(`.${CLASS5}-handle-${corner}`);
25908
25860
  if (el)
25909
25861
  Object.assign(el.style, { left: x, top: y });
25910
25862
  };
@@ -25965,7 +25917,7 @@ class OfflineMapsControl extends Control {
25965
25917
  const card = this._card;
25966
25918
  if (!bounds || !card)
25967
25919
  return;
25968
- const area2 = { bounds, map: this._map };
25920
+ const area = { bounds, map: this._map };
25969
25921
  const render = (estimate) => {
25970
25922
  const el = card.querySelector(`.${CLASS5}-estimate`);
25971
25923
  const button = card.querySelector(`.${CLASS5}-download`);
@@ -25982,10 +25934,10 @@ class OfflineMapsControl extends Control {
25982
25934
  button.disabled = false;
25983
25935
  }
25984
25936
  };
25985
- render(this.maps.quickEstimate(area2));
25937
+ render(this.maps.quickEstimate(area));
25986
25938
  if (sample) {
25987
25939
  const token = this._estimateToken = (this._estimateToken ?? 0) + 1;
25988
- this.maps.estimate(area2).then((estimate) => {
25940
+ this.maps.estimate(area).then((estimate) => {
25989
25941
  if (token === this._estimateToken && this._select)
25990
25942
  render(estimate);
25991
25943
  }, () => {});
@@ -26079,8 +26031,8 @@ function nameFromLabels(map, bounds) {
26079
26031
  const lng = unitToLng((sub.x + p.x / feature.extent) / 2 ** z);
26080
26032
  if (lng < w || lng > e || lat < s || lat > n)
26081
26033
  continue;
26082
- const off2 = Math.hypot((lng - cx) / (e - w || 1), (lat - cy) / (n - s || 1));
26083
- const score = rank + (typeof props.rank === "number" ? props.rank / 100 : 0) + off2;
26034
+ const off = Math.hypot((lng - cx) / (e - w || 1), (lat - cy) / (n - s || 1));
26035
+ const score = rank + (typeof props.rank === "number" ? props.rank / 100 : 0) + off;
26084
26036
  if (!best || score < best.score)
26085
26037
  best = { name, score };
26086
26038
  }
@@ -26359,12 +26311,12 @@ class StreetIndex {
26359
26311
  const segment = { name: feature.name, a, b };
26360
26312
  for (let cx = Math.floor(Math.min(a.lat, b.lat) * 500);cx <= Math.floor(Math.max(a.lat, b.lat) * 500); cx++) {
26361
26313
  for (let cy = Math.floor(Math.min(a.lng, b.lng) * 500);cy <= Math.floor(Math.max(a.lng, b.lng) * 500); cy++) {
26362
- const key3 = `${cx},${cy}`;
26363
- const list = this._cells.get(key3);
26314
+ const key = `${cx},${cy}`;
26315
+ const list = this._cells.get(key);
26364
26316
  if (list)
26365
26317
  list.push(segment);
26366
26318
  else
26367
- this._cells.set(key3, [segment]);
26319
+ this._cells.set(key, [segment]);
26368
26320
  }
26369
26321
  }
26370
26322
  }
@@ -26449,8 +26401,8 @@ class SearchEngine {
26449
26401
  return false;
26450
26402
  if (typeof navigator !== "undefined" && navigator.onLine === false)
26451
26403
  return false;
26452
- const shared3 = offlineMapsNow();
26453
- const maps = this.offline ?? (typeof shared3 === "object" ? shared3 : undefined);
26404
+ const shared = offlineMapsNow();
26405
+ const maps = this.offline ?? (typeof shared === "object" ? shared : undefined);
26454
26406
  return !maps?.onlyOffline;
26455
26407
  }
26456
26408
  async local(query, options = {}) {
@@ -26494,11 +26446,11 @@ class SearchEngine {
26494
26446
  return out;
26495
26447
  }
26496
26448
  _score(place, match, near) {
26497
- const distance2 = near ? distanceMeters2(near, place.center) : undefined;
26449
+ const distance = near ? distanceMeters2(near, place.center) : undefined;
26498
26450
  let score = match * 10 - place.rank * 0.3;
26499
- if (distance2 !== undefined)
26500
- score -= Math.log10(1 + distance2 / 400) * 1.6;
26501
- return { ...place, distance: distance2, score };
26451
+ if (distance !== undefined)
26452
+ score -= Math.log10(1 + distance / 400) * 1.6;
26453
+ return { ...place, distance, score };
26502
26454
  }
26503
26455
  async suggest(query, options = {}) {
26504
26456
  const limit = options.limit ?? 8;
@@ -26585,9 +26537,9 @@ class SearchEngine {
26585
26537
  if (!needs.length || !this.map)
26586
26538
  return places;
26587
26539
  const c = this.map.getCenter?.();
26588
- const key3 = `${c?.lat.toFixed(3)},${c?.lng.toFixed(3)},${this.map.getZoom?.()?.toFixed(1)}`;
26589
- if (this._streets?.key !== key3)
26590
- this._streets = { key: key3, index: new StreetIndex(this.map) };
26540
+ const key = `${c?.lat.toFixed(3)},${c?.lng.toFixed(3)},${this.map.getZoom?.()?.toFixed(1)}`;
26541
+ if (this._streets?.key !== key)
26542
+ this._streets = { key, index: new StreetIndex(this.map) };
26591
26543
  const index = this._streets.index;
26592
26544
  for (const place of needs) {
26593
26545
  const street = index.nearest(place.center);
@@ -26613,10 +26565,10 @@ function merge(places) {
26613
26565
  }
26614
26566
  return kept;
26615
26567
  }
26616
- function describePlace(place, formatDistance3) {
26568
+ function describePlace(place, formatDistance) {
26617
26569
  return [
26618
26570
  kindLabel(place.kind),
26619
- place.distance !== undefined && formatDistance3 ? formatDistance3(place.distance) : undefined,
26571
+ place.distance !== undefined && formatDistance ? formatDistance(place.distance) : undefined,
26620
26572
  place.address
26621
26573
  ].filter(Boolean).join(" · ");
26622
26574
  }
@@ -26625,8 +26577,8 @@ class SearchHistory {
26625
26577
  key;
26626
26578
  max;
26627
26579
  _memory = [];
26628
- constructor(key3 = "ts-maps-search-recents", max = 8) {
26629
- this.key = key3;
26580
+ constructor(key = "ts-maps-search-recents", max = 8) {
26581
+ this.key = key;
26630
26582
  this.max = max;
26631
26583
  }
26632
26584
  list() {
@@ -27081,8 +27033,8 @@ class SearchControl extends Control {
27081
27033
  return;
27082
27034
  const units = this._units();
27083
27035
  const kind = kindLabel(place.kind);
27084
- const distance2 = place.distance !== undefined ? formatDistance(place.distance, units) : undefined;
27085
- const coords2 = `${place.center.lat.toFixed(5)}, ${place.center.lng.toFixed(5)}`;
27036
+ const distance = place.distance !== undefined ? formatDistance(place.distance, units) : undefined;
27037
+ const coords = `${place.center.lat.toFixed(5)}, ${place.center.lng.toFixed(5)}`;
27086
27038
  this._rows = [];
27087
27039
  this._body.dataset.html = "";
27088
27040
  this._body.innerHTML = `
@@ -27091,14 +27043,14 @@ class SearchControl extends Control {
27091
27043
  ${badge(place.icon, 44)}
27092
27044
  <div class="${CLASS6}-place-title">
27093
27045
  <div class="${CLASS6}-place-name">${escape2(place.name)}</div>
27094
- <div class="${CLASS6}-place-kind">${escape2([kind, distance2].filter(Boolean).join(" · "))}</div>
27046
+ <div class="${CLASS6}-place-kind">${escape2([kind, distance].filter(Boolean).join(" · "))}</div>
27095
27047
  </div>
27096
27048
  <button type="button" class="${CLASS6}-close" data-action="close-place" aria-label="Close">✕</button>
27097
27049
  </div>
27098
27050
  ${this.options.turnByTurn || this.options.onDirections ? `<button type="button" class="${CLASS6}-directions" data-action="directions">${CAR}<span>Directions</span></button>` : ""}
27099
27051
  <div class="${CLASS6}-place-info">
27100
27052
  ${place.address ? `<div class="${CLASS6}-info-label">Address</div><div class="${CLASS6}-info-value">${escape2(place.address)}</div>` : ""}
27101
- <div class="${CLASS6}-info-label">Coordinates</div><div class="${CLASS6}-info-value">${coords2}</div>
27053
+ <div class="${CLASS6}-info-label">Coordinates</div><div class="${CLASS6}-info-value">${coords}</div>
27102
27054
  </div>
27103
27055
  </div>`;
27104
27056
  }
@@ -27194,17 +27146,17 @@ class SearchControl extends Control {
27194
27146
  }
27195
27147
  }
27196
27148
  function deviceLocation(fallback) {
27197
- return new Promise((resolve2) => {
27149
+ return new Promise((resolve) => {
27198
27150
  const geo = typeof navigator !== "undefined" ? navigator.geolocation : undefined;
27199
27151
  if (!geo)
27200
- return resolve2(fallback);
27201
- const timer = setTimeout(() => resolve2(fallback), 5000);
27152
+ return resolve(fallback);
27153
+ const timer = setTimeout(() => resolve(fallback), 5000);
27202
27154
  geo.getCurrentPosition((p) => {
27203
27155
  clearTimeout(timer);
27204
- resolve2({ lat: p.coords.latitude, lng: p.coords.longitude });
27156
+ resolve({ lat: p.coords.latitude, lng: p.coords.longitude });
27205
27157
  }, () => {
27206
27158
  clearTimeout(timer);
27207
- resolve2(fallback);
27159
+ resolve(fallback);
27208
27160
  }, { timeout: 5000, maximumAge: 60000 });
27209
27161
  });
27210
27162
  }
@@ -27340,7 +27292,7 @@ class TerritoryLog extends Evented {
27340
27292
  return this._seen.has(id);
27341
27293
  }
27342
27294
  confirm(id, seq) {
27343
- const index = this._log.findIndex((event2) => event2.id === id);
27295
+ const index = this._log.findIndex((event) => event.id === id);
27344
27296
  if (index === -1)
27345
27297
  return false;
27346
27298
  const event = this._log[index];
@@ -27477,10 +27429,10 @@ function makeLoop(ring, startIndex, endIndex, closure, options) {
27477
27429
  const perimeter = ringPerimeter(ring, false);
27478
27430
  if (perimeter < options.minLoopLength)
27479
27431
  return null;
27480
- const area2 = Math.abs(ringArea2(ring));
27481
- if (area2 < options.minArea)
27432
+ const area = Math.abs(ringArea2(ring));
27433
+ if (area < options.minArea)
27482
27434
  return null;
27483
- return { ring, area: area2, perimeter, startIndex, endIndex, closure };
27435
+ return { ring, area, perimeter, startIndex, endIndex, closure };
27484
27436
  }
27485
27437
  function detectLoop(track, options = {}) {
27486
27438
  const opts = { ...DEFAULTS, ...options };
@@ -27490,10 +27442,10 @@ function detectLoop(track, options = {}) {
27490
27442
  const a1 = track[i - 1];
27491
27443
  const a2 = track[i];
27492
27444
  for (let j = 1;j < i - 1; j++) {
27493
- const cross2 = segmentCross(a1, a2, track[j - 1], track[j]);
27494
- if (!cross2)
27445
+ const cross = segmentCross(a1, a2, track[j - 1], track[j]);
27446
+ if (!cross)
27495
27447
  continue;
27496
- const point = lerp(a1, a2, cross2.t);
27448
+ const point = lerp(a1, a2, cross.t);
27497
27449
  const ring = [point, ...track.slice(j, i), point];
27498
27450
  const loop = makeLoop(ring, j - 1, i, "crossing", opts);
27499
27451
  if (loop)
@@ -27541,10 +27493,10 @@ class LoopDetector {
27541
27493
  const a1 = track[i - 1];
27542
27494
  const a2 = track[i];
27543
27495
  for (let j = 1;j < i - 1; j++) {
27544
- const cross2 = segmentCross(a1, a2, track[j - 1], track[j]);
27545
- if (!cross2)
27496
+ const cross = segmentCross(a1, a2, track[j - 1], track[j]);
27497
+ if (!cross)
27546
27498
  continue;
27547
- const crossing = lerp(a1, a2, cross2.t);
27499
+ const crossing = lerp(a1, a2, cross.t);
27548
27500
  const ring = [crossing, ...track.slice(j, i), crossing];
27549
27501
  const loop = makeLoop(ring, j - 1, i, "crossing", this._options);
27550
27502
  if (loop) {
@@ -27583,9 +27535,9 @@ function simplifyTrack(track, tolerance = 3) {
27583
27535
  let furthest = -1;
27584
27536
  let maxDistance = tolerance;
27585
27537
  for (let i = first + 1;i < last; i++) {
27586
- const distance2 = perpendicularDistance(track[i], track[first], track[last]);
27587
- if (distance2 > maxDistance) {
27588
- maxDistance = distance2;
27538
+ const distance = perpendicularDistance(track[i], track[first], track[last]);
27539
+ if (distance > maxDistance) {
27540
+ maxDistance = distance;
27589
27541
  furthest = i;
27590
27542
  }
27591
27543
  }
@@ -27836,8 +27788,8 @@ class BlanketOverlay extends Layer {
27836
27788
  const p = this.options.padding;
27837
27789
  const size = map.getSize();
27838
27790
  if (!map._bearing && !map._pitch) {
27839
- const min2 = map.containerPointToLayerPoint(size.multiplyBy(-p)).round();
27840
- return new Bounds(min2, min2.add(size.multiplyBy(1 + p * 2)).round());
27791
+ const min = map.containerPointToLayerPoint(size.multiplyBy(-p)).round();
27792
+ return new Bounds(min, min.add(size.multiplyBy(1 + p * 2)).round());
27841
27793
  }
27842
27794
  const corners = [
27843
27795
  new Point(-p * size.x, -p * size.y),
@@ -28270,30 +28222,30 @@ class GeoJSON extends FeatureGroup {
28270
28222
  }
28271
28223
  static geometryToLayer(geojson, options) {
28272
28224
  const geometry = geojson.type === "Feature" ? geojson.geometry : geojson;
28273
- const coords2 = geometry?.coordinates;
28225
+ const coords = geometry?.coordinates;
28274
28226
  const layers = [];
28275
28227
  const pointToLayer = options?.pointToLayer;
28276
28228
  const _coordsToLatLng = options?.coordsToLatLng ?? GeoJSON.coordsToLatLng;
28277
28229
  let latlng, latlngs;
28278
- if (!coords2 && !geometry)
28230
+ if (!coords && !geometry)
28279
28231
  return null;
28280
28232
  switch (geometry.type) {
28281
28233
  case "Point":
28282
- latlng = _coordsToLatLng(coords2);
28234
+ latlng = _coordsToLatLng(coords);
28283
28235
  return GeoJSON._pointToLayer(pointToLayer, geojson, latlng, options);
28284
28236
  case "MultiPoint":
28285
- for (const coord of coords2) {
28237
+ for (const coord of coords) {
28286
28238
  latlng = _coordsToLatLng(coord);
28287
28239
  layers.push(GeoJSON._pointToLayer(pointToLayer, geojson, latlng, options));
28288
28240
  }
28289
28241
  return new FeatureGroup(layers);
28290
28242
  case "LineString":
28291
28243
  case "MultiLineString":
28292
- latlngs = GeoJSON.coordsToLatLngs(coords2, geometry.type === "LineString" ? 0 : 1, _coordsToLatLng);
28244
+ latlngs = GeoJSON.coordsToLatLngs(coords, geometry.type === "LineString" ? 0 : 1, _coordsToLatLng);
28293
28245
  return new Polyline(latlngs, options);
28294
28246
  case "Polygon":
28295
28247
  case "MultiPolygon":
28296
- latlngs = GeoJSON.coordsToLatLngs(coords2, geometry.type === "Polygon" ? 1 : 2, _coordsToLatLng);
28248
+ latlngs = GeoJSON.coordsToLatLngs(coords, geometry.type === "Polygon" ? 1 : 2, _coordsToLatLng);
28297
28249
  return new Polygon(latlngs, options);
28298
28250
  case "GeometryCollection":
28299
28251
  for (const g of geometry.geometries) {
@@ -28320,21 +28272,21 @@ class GeoJSON extends FeatureGroup {
28320
28272
  static _pointToLayer(pointToLayerFn, geojson, latlng, options) {
28321
28273
  return pointToLayerFn ? pointToLayerFn(geojson, latlng) : new Marker(latlng, options?.markersInheritOptions && options);
28322
28274
  }
28323
- static coordsToLatLng(coords2) {
28324
- return new LatLng(coords2[1], coords2[0], coords2[2]);
28275
+ static coordsToLatLng(coords) {
28276
+ return new LatLng(coords[1], coords[0], coords[2]);
28325
28277
  }
28326
- static coordsToLatLngs(coords2, levelsDeep, _coordsToLatLng) {
28327
- return coords2.map((coord) => levelsDeep ? GeoJSON.coordsToLatLngs(coord, levelsDeep - 1, _coordsToLatLng) : (_coordsToLatLng || GeoJSON.coordsToLatLng)(coord));
28278
+ static coordsToLatLngs(coords, levelsDeep, _coordsToLatLng) {
28279
+ return coords.map((coord) => levelsDeep ? GeoJSON.coordsToLatLngs(coord, levelsDeep - 1, _coordsToLatLng) : (_coordsToLatLng || GeoJSON.coordsToLatLng)(coord));
28328
28280
  }
28329
28281
  static latLngToCoords(latlng, precision) {
28330
28282
  const ll = new LatLng(latlng);
28331
28283
  return ll.alt !== undefined ? [formatNum(ll.lng, precision), formatNum(ll.lat, precision), formatNum(ll.alt, precision)] : [formatNum(ll.lng, precision), formatNum(ll.lat, precision)];
28332
28284
  }
28333
28285
  static latLngsToCoords(latlngs, levelsDeep, close, precision) {
28334
- const coords2 = latlngs.map((latlng) => levelsDeep ? GeoJSON.latLngsToCoords(latlng, isFlat(latlng) ? 0 : levelsDeep - 1, close, precision) : GeoJSON.latLngToCoords(latlng, precision));
28335
- if (!levelsDeep && close && coords2.length > 0)
28336
- coords2.push(coords2[0].slice());
28337
- return coords2;
28286
+ const coords = latlngs.map((latlng) => levelsDeep ? GeoJSON.latLngsToCoords(latlng, isFlat(latlng) ? 0 : levelsDeep - 1, close, precision) : GeoJSON.latLngToCoords(latlng, precision));
28287
+ if (!levelsDeep && close && coords.length > 0)
28288
+ coords.push(coords[0].slice());
28289
+ return coords;
28338
28290
  }
28339
28291
  static getFeature(layer, newGeometry) {
28340
28292
  return layer.feature ? { ...layer.feature, geometry: newGeometry } : GeoJSON.asFeature(newGeometry);
@@ -28359,10 +28311,10 @@ CircleMarker.include(PointToGeoJSON);
28359
28311
  Polyline.include({
28360
28312
  toGeoJSON(precision) {
28361
28313
  const multi = !isFlat(this._latlngs);
28362
- const coords2 = GeoJSON.latLngsToCoords(this._latlngs, multi ? 1 : 0, false, precision);
28314
+ const coords = GeoJSON.latLngsToCoords(this._latlngs, multi ? 1 : 0, false, precision);
28363
28315
  return GeoJSON.getFeature(this, {
28364
28316
  type: `${multi ? "Multi" : ""}LineString`,
28365
- coordinates: coords2
28317
+ coordinates: coords
28366
28318
  });
28367
28319
  }
28368
28320
  });
@@ -28370,22 +28322,22 @@ Polygon.include({
28370
28322
  toGeoJSON(precision) {
28371
28323
  const holes = !isFlat(this._latlngs);
28372
28324
  const multi = holes && !isFlat(this._latlngs[0]);
28373
- let coords2 = GeoJSON.latLngsToCoords(this._latlngs, multi ? 2 : holes ? 1 : 0, true, precision);
28325
+ let coords = GeoJSON.latLngsToCoords(this._latlngs, multi ? 2 : holes ? 1 : 0, true, precision);
28374
28326
  if (!holes)
28375
- coords2 = [coords2];
28327
+ coords = [coords];
28376
28328
  return GeoJSON.getFeature(this, {
28377
28329
  type: `${multi ? "Multi" : ""}Polygon`,
28378
- coordinates: coords2
28330
+ coordinates: coords
28379
28331
  });
28380
28332
  }
28381
28333
  });
28382
28334
  LayerGroup.include({
28383
28335
  toMultiPoint(precision) {
28384
- const coords2 = [];
28336
+ const coords = [];
28385
28337
  this.eachLayer((layer) => {
28386
- coords2.push(layer.toGeoJSON(precision).geometry.coordinates);
28338
+ coords.push(layer.toGeoJSON(precision).geometry.coordinates);
28387
28339
  });
28388
- return GeoJSON.getFeature(this, { type: "MultiPoint", coordinates: coords2 });
28340
+ return GeoJSON.getFeature(this, { type: "MultiPoint", coordinates: coords });
28389
28341
  },
28390
28342
  toGeoJSON(precision) {
28391
28343
  const type = this.feature?.geometry?.type;
@@ -28595,7 +28547,7 @@ class TerritoryLayer extends Layer {
28595
28547
  ctx.clearRect(0, 0, canvas.width, canvas.height);
28596
28548
  ctx.setTransform(this._ratio, 0, 0, this._ratio, 0, 0);
28597
28549
  const options = this.options;
28598
- const project2 = (position) => map.latLngToContainerPoint([position[1], position[0]]);
28550
+ const project = (position) => map.latLngToContainerPoint([position[1], position[0]]);
28599
28551
  const entries = this._territories();
28600
28552
  entries.sort(([a], [b]) => {
28601
28553
  if (a === options.self)
@@ -28607,9 +28559,9 @@ class TerritoryLayer extends Layer {
28607
28559
  for (const [owner, territory] of entries) {
28608
28560
  if (territory.length === 0)
28609
28561
  continue;
28610
- this._drawTerritory(ctx, owner, territory, project2);
28562
+ this._drawTerritory(ctx, owner, territory, project);
28611
28563
  }
28612
- this._drawCaptures(ctx, project2);
28564
+ this._drawCaptures(ctx, project);
28613
28565
  if (this._animations.length > 0)
28614
28566
  this.redraw();
28615
28567
  }
@@ -28626,13 +28578,13 @@ class TerritoryLayer extends Layer {
28626
28578
  label: style.label ?? true
28627
28579
  };
28628
28580
  }
28629
- _drawTerritory(ctx, owner, territory, project2) {
28581
+ _drawTerritory(ctx, owner, territory, project) {
28630
28582
  const style = this._styleFor(owner);
28631
28583
  const path = (polygon) => {
28632
28584
  ctx.beginPath();
28633
28585
  for (const ring of polygon) {
28634
28586
  ring.forEach((position, index) => {
28635
- const point = project2(position);
28587
+ const point = project(position);
28636
28588
  if (index === 0)
28637
28589
  ctx.moveTo(point.x, point.y);
28638
28590
  else
@@ -28664,7 +28616,7 @@ class TerritoryLayer extends Layer {
28664
28616
  ctx.stroke();
28665
28617
  }
28666
28618
  if (style.label)
28667
- this._drawLabels(ctx, territory, style.color, project2);
28619
+ this._drawLabels(ctx, territory, style.color, project);
28668
28620
  }
28669
28621
  _drawHatch(ctx, color) {
28670
28622
  ctx.save();
@@ -28684,7 +28636,7 @@ class TerritoryLayer extends Layer {
28684
28636
  ctx.stroke();
28685
28637
  ctx.restore();
28686
28638
  }
28687
- _drawLabels(ctx, territory, color, project2) {
28639
+ _drawLabels(ctx, territory, color, project) {
28688
28640
  const options = this.options;
28689
28641
  const map = this._map;
28690
28642
  const minZoom = options.labelMinZoom ?? 13;
@@ -28693,7 +28645,7 @@ class TerritoryLayer extends Layer {
28693
28645
  for (const polygon of territory) {
28694
28646
  if (polygon.length === 0)
28695
28647
  continue;
28696
- const projected = polygon[0].map(project2);
28648
+ const projected = polygon[0].map(project);
28697
28649
  const bounds = boundsOf(projected);
28698
28650
  const width = bounds.maxX - bounds.minX;
28699
28651
  const height = bounds.maxY - bounds.minY;
@@ -28714,7 +28666,7 @@ class TerritoryLayer extends Layer {
28714
28666
  ctx.restore();
28715
28667
  }
28716
28668
  }
28717
- _drawCaptures(ctx, project2) {
28669
+ _drawCaptures(ctx, project) {
28718
28670
  const time = now2();
28719
28671
  const remaining = [];
28720
28672
  for (const animation of this._animations) {
@@ -28724,7 +28676,7 @@ class TerritoryLayer extends Layer {
28724
28676
  remaining.push(animation);
28725
28677
  const eased = 1 - (1 - progress) ** 3;
28726
28678
  const color = this.colorFor(animation.owner);
28727
- const projected = animation.ring.map(project2);
28679
+ const projected = animation.ring.map(project);
28728
28680
  ctx.save();
28729
28681
  ctx.beginPath();
28730
28682
  projected.forEach((point, index) => {
@@ -29021,11 +28973,11 @@ class RouteEditor extends Layer {
29021
28973
  }
29022
28974
  onAdd(map) {
29023
28975
  const { color, casingColor, weight } = this.options;
29024
- const round2 = { lineCap: "round", lineJoin: "round" };
29025
- this._casing = new Polyline([], { ...round2, color: casingColor, weight: weight + 3, opacity: 0.35, interactive: false }).addTo(map);
29026
- this._line = new Polyline([], { ...round2, color, weight, opacity: 1, interactive: false }).addTo(map);
29027
- this._preview = new Polyline([], { ...round2, color, weight: 3, opacity: 0.9, dashArray: "2 8", interactive: false }).addTo(map);
29028
- this._hit = new Polyline([], { ...round2, color, weight: 22, opacity: 0, className: "tsmap-route-hit" }).addTo(map);
28976
+ const round = { lineCap: "round", lineJoin: "round" };
28977
+ this._casing = new Polyline([], { ...round, color: casingColor, weight: weight + 3, opacity: 0.35, interactive: false }).addTo(map);
28978
+ this._line = new Polyline([], { ...round, color, weight, opacity: 1, interactive: false }).addTo(map);
28979
+ this._preview = new Polyline([], { ...round, color, weight: 3, opacity: 0.9, dashArray: "2 8", interactive: false }).addTo(map);
28980
+ this._hit = new Polyline([], { ...round, color, weight: 22, opacity: 0, className: "tsmap-route-hit" }).addTo(map);
29029
28981
  this._hit.on("pointerdown", this._onLineDown, this);
29030
28982
  this._unsubscribe = this._builder.onChange(() => this._redraw());
29031
28983
  this._redraw();
@@ -29073,10 +29025,10 @@ class RouteEditor extends Layer {
29073
29025
  this._builder.segments.forEach((segment, i) => {
29074
29026
  const from = waypoints[i];
29075
29027
  const to = waypoints[i + 1];
29076
- const key3 = [from, to].map((p) => `${p.lat},${p.lng}`).sort().join("|");
29077
- if (seen.has(key3) || this._pixelLength(segment) < opts.midpointMinPixels)
29028
+ const key = [from, to].map((p) => `${p.lat},${p.lng}`).sort().join("|");
29029
+ if (seen.has(key) || this._pixelLength(segment) < opts.midpointMinPixels)
29078
29030
  return;
29079
- seen.add(key3);
29031
+ seen.add(key);
29080
29032
  wanted.push({ kind: "midpoint", point: halfway(segment), leg: [from, to] });
29081
29033
  });
29082
29034
  }
@@ -29182,10 +29134,10 @@ class RouteEditor extends Layer {
29182
29134
  this._redraw();
29183
29135
  }
29184
29136
  }
29185
- _at(builder, point, run2) {
29137
+ _at(builder, point, run) {
29186
29138
  const index = builder.waypoints.findIndex((w) => samePoint2(w, point));
29187
29139
  if (index >= 0)
29188
- return run2(index);
29140
+ return run(index);
29189
29141
  }
29190
29142
  _insertInto(builder, leg, point) {
29191
29143
  const waypoints = builder.waypoints;
@@ -30083,9 +30035,9 @@ class WMSTileLayer extends TileLayer {
30083
30035
  initialize(url, options) {
30084
30036
  super.initialize(url, options);
30085
30037
  const wmsParams = { ...this.defaultWmsParams };
30086
- for (const [key3, value] of Object.entries(options ?? {})) {
30087
- if (!(key3 in WMSTileLayer.prototype.options))
30088
- wmsParams[key3] = value;
30038
+ for (const [key, value] of Object.entries(options ?? {})) {
30039
+ if (!(key in WMSTileLayer.prototype.options))
30040
+ wmsParams[key] = value;
30089
30041
  }
30090
30042
  const realRetina = this.options.detectRetina && Browser_default.retina ? 2 : 1;
30091
30043
  const tileSize = this.getTileSize();
@@ -30100,14 +30052,14 @@ class WMSTileLayer extends TileLayer {
30100
30052
  this.wmsParams[projectionKey] = this._crs.code;
30101
30053
  super.onAdd();
30102
30054
  }
30103
- getTileUrl(coords2) {
30104
- const tileBounds = this._tileCoordsToNwSe(coords2);
30055
+ getTileUrl(coords) {
30056
+ const tileBounds = this._tileCoordsToNwSe(coords);
30105
30057
  const crs = this._crs;
30106
30058
  const bounds = new Bounds(crs.project(tileBounds[0]), crs.project(tileBounds[1]));
30107
30059
  const min = bounds.min;
30108
30060
  const max = bounds.max;
30109
30061
  const bbox = (this._wmsVersion >= 1.3 && this._crs === EPSG4326 ? [min.y, min.x, max.y, max.x] : [min.x, min.y, max.x, max.y]).join(",");
30110
- const url = new URL(super.getTileUrl(coords2));
30062
+ const url = new URL(super.getTileUrl(coords));
30111
30063
  for (const [k, v] of Object.entries({ ...this.wmsParams, bbox }))
30112
30064
  url.searchParams.append(this.options.uppercase ? k.toUpperCase() : k, String(v));
30113
30065
  return url.toString();
@@ -30803,15 +30755,15 @@ class CooperativeGesturesHandler extends Handler {
30803
30755
  return this.active() && e.pointerType === "touch";
30804
30756
  }
30805
30757
  _onTouchStart = (e) => {
30806
- const touch2 = e.touches.length === 1 ? e.touches[0] : undefined;
30807
- this._touchStart = touch2 ? { x: touch2.clientX, y: touch2.clientY } : null;
30758
+ const touch = e.touches.length === 1 ? e.touches[0] : undefined;
30759
+ this._touchStart = touch ? { x: touch.clientX, y: touch.clientY } : null;
30808
30760
  };
30809
30761
  _onTouchMove = (e) => {
30810
30762
  const start = this._touchStart;
30811
- const touch2 = e.touches.length === 1 ? e.touches[0] : undefined;
30812
- if (!start || !touch2 || !this.active())
30763
+ const touch = e.touches.length === 1 ? e.touches[0] : undefined;
30764
+ if (!start || !touch || !this.active())
30813
30765
  return;
30814
- if (Math.abs(touch2.clientX - start.x) + Math.abs(touch2.clientY - start.y) < 10)
30766
+ if (Math.abs(touch.clientX - start.x) + Math.abs(touch.clientY - start.y) < 10)
30815
30767
  return;
30816
30768
  this._touchStart = null;
30817
30769
  this._show("touch");
@@ -31145,12 +31097,12 @@ class KeyboardHandler extends Handler {
31145
31097
  _onKeyDown(e) {
31146
31098
  if (e.altKey || e.ctrlKey || e.metaKey)
31147
31099
  return;
31148
- const key3 = e.code;
31100
+ const key = e.code;
31149
31101
  const map = this._map;
31150
31102
  let offset;
31151
- if (key3 in this._panKeys) {
31103
+ if (key in this._panKeys) {
31152
31104
  if (!map._panAnim || !map._panAnim._inProgress) {
31153
- offset = this._panKeys[key3];
31105
+ offset = this._panKeys[key];
31154
31106
  if (e.shiftKey)
31155
31107
  offset = new Point(offset).multiplyBy(3);
31156
31108
  if (map.options.maxBounds)
@@ -31162,9 +31114,9 @@ class KeyboardHandler extends Handler {
31162
31114
  map.panBy(offset);
31163
31115
  }
31164
31116
  }
31165
- } else if (key3 in this._zoomKeys) {
31166
- map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key3]);
31167
- } else if (key3 === "Escape" && map._popup && map._popup.options.closeOnEscapeKey) {
31117
+ } else if (key in this._zoomKeys) {
31118
+ map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key]);
31119
+ } else if (key === "Escape" && map._popup && map._popup.options.closeOnEscapeKey) {
31168
31120
  map.closePopup?.();
31169
31121
  } else {
31170
31122
  return;
@@ -32019,8 +31971,8 @@ class LayerEvaluator {
32019
31971
  this.zoom = zoom;
32020
31972
  }
32021
31973
  compiled(group, name, type) {
32022
- const key3 = `${group}:${name}`;
32023
- if (!this.cache.has(key3)) {
31974
+ const key = `${group}:${name}`;
31975
+ if (!this.cache.has(key)) {
32024
31976
  const value = this.layer[group]?.[name];
32025
31977
  let expression = null;
32026
31978
  if (value !== undefined) {
@@ -32030,9 +31982,9 @@ class LayerEvaluator {
32030
31982
  expression = null;
32031
31983
  }
32032
31984
  }
32033
- this.cache.set(key3, expression);
31985
+ this.cache.set(key, expression);
32034
31986
  }
32035
- return this.cache.get(key3) ?? null;
31987
+ return this.cache.get(key) ?? null;
32036
31988
  }
32037
31989
  get(group, name, type, feature) {
32038
31990
  const expression = this.compiled(group, name, type);
@@ -32088,8 +32040,8 @@ async function gunzipIfNeeded(bytes) {
32088
32040
  const stream = new Blob([bytes]).stream().pipeThrough(new DecompressionStream("gzip"));
32089
32041
  return new Uint8Array(await new Response(stream).arrayBuffer());
32090
32042
  }
32091
- function tileUrl(template2, z, x, y) {
32092
- return template2.replaceAll("{z}", String(z)).replaceAll("{x}", String(x)).replaceAll("{y}", String(y)).replaceAll("{s}", "abc"[(x + y) % 3]);
32043
+ function tileUrl(template, z, x, y) {
32044
+ return template.replaceAll("{z}", String(z)).replaceAll("{x}", String(x)).replaceAll("{y}", String(y)).replaceAll("{s}", "abc"[(x + y) % 3]);
32093
32045
  }
32094
32046
  async function resolveSource(source, doFetch, archiveFetch) {
32095
32047
  let tiles = Array.isArray(source.tiles) ? source.tiles : [];
@@ -32159,7 +32111,7 @@ function resolveFont(textFont, fallback) {
32159
32111
  }
32160
32112
  function textOf(value, properties) {
32161
32113
  if (typeof value === "string")
32162
- return value.replace(/\{([^}]+)\}/g, (_, key3) => String(properties[key3] ?? ""));
32114
+ return value.replace(/\{([^}]+)\}/g, (_, key) => String(properties[key] ?? ""));
32163
32115
  if (value && typeof value === "object" && Array.isArray(value.sections))
32164
32116
  return value.sections.map((section) => section.text ?? "").join("");
32165
32117
  return value == null ? "" : String(value);
@@ -32254,8 +32206,8 @@ async function renderStaticMap(options) {
32254
32206
  const zoom = staticMapZoom(view);
32255
32207
  const fallbackFont = options.fontFamily ?? "Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
32256
32208
  const layers = (style.layers ?? []).filter((layer) => {
32257
- const visibility2 = layer.layout?.visibility;
32258
- if (visibility2 === "none")
32209
+ const visibility = layer.layout?.visibility;
32210
+ if (visibility === "none")
32259
32211
  return false;
32260
32212
  if (typeof layer.minzoom === "number" && zoom < layer.minzoom)
32261
32213
  return false;
@@ -32289,8 +32241,8 @@ async function renderStaticMap(options) {
32289
32241
  }
32290
32242
  const loaded = await Promise.all(wanted.map(async ({ x, y, wrapX }) => {
32291
32243
  try {
32292
- const template2 = resolved.tiles[(wrapX + y) % resolved.tiles.length];
32293
- const response = await tileFetch(tileUrl(template2, z, wrapX, y));
32244
+ const template = resolved.tiles[(wrapX + y) % resolved.tiles.length];
32245
+ const response = await tileFetch(tileUrl(template, z, wrapX, y));
32294
32246
  if (!response.ok)
32295
32247
  return null;
32296
32248
  const bytes = await gunzipIfNeeded(new Uint8Array(await response.arrayBuffer()));
@@ -32332,7 +32284,7 @@ async function renderStaticMap(options) {
32332
32284
  continue;
32333
32285
  const count = 2 ** loaded.z;
32334
32286
  const extent = tileLayer.extent || 4096;
32335
- const project2 = (gx, gy) => [
32287
+ const project = (gx, gy) => [
32336
32288
  ((loaded.x + gx / extent) / count - view.left) * view.scale,
32337
32289
  ((loaded.y + gy / extent) / count - view.top) * view.scale
32338
32290
  ];
@@ -32365,7 +32317,7 @@ async function renderStaticMap(options) {
32365
32317
  const font = resolveFont(layer.layout?.["text-font"], fallbackFont);
32366
32318
  for (const ring of raw.loadGeometry()) {
32367
32319
  for (const point of ring) {
32368
- let [x, y] = project2(point.x, point.y);
32320
+ let [x, y] = project(point.x, point.y);
32369
32321
  if (Array.isArray(offset) && offset.length === 2) {
32370
32322
  x += Number(offset[0]) * size;
32371
32323
  y += Number(offset[1]) * size;
@@ -32423,7 +32375,7 @@ async function renderStaticMap(options) {
32423
32375
  if (ring.length < 2)
32424
32376
  continue;
32425
32377
  d += ring.map((point, index) => {
32426
- const [x, y] = project2(point.x, point.y);
32378
+ const [x, y] = project(point.x, point.y);
32427
32379
  return `${index === 0 ? "M" : "L"}${round2(x)} ${round2(y)}`;
32428
32380
  }).join("") + close;
32429
32381
  }
@@ -32466,7 +32418,7 @@ async function renderStaticMap(options) {
32466
32418
  const [left, top, right, bottom] = box;
32467
32419
  if (left < 4 || top < 4 || right > width - 4 || bottom > height - 4)
32468
32420
  continue;
32469
- if (options.reserve?.some((area2) => overlaps2(box, area2, 2)))
32421
+ if (options.reserve?.some((area) => overlaps2(box, area, 2)))
32470
32422
  continue;
32471
32423
  if (options.avoid?.length) {
32472
32424
  const grown = [left - avoidPadding, top - avoidPadding, right + avoidPadding, bottom + avoidPadding];
@@ -32867,28 +32819,28 @@ class TurnByTurn extends Evented {
32867
32819
  const chosen = i === this.selected;
32868
32820
  const latlngs = route.geometry.map((p) => [p.lat, p.lng]);
32869
32821
  const casing = new Polyline(latlngs, { color: chosen ? BLUE_CASING : GREY_CASING, weight: 12, opacity: 1, lineCap: "round", lineJoin: "round", interactive: !chosen });
32870
- const fill2 = new Polyline(latlngs, { color: chosen ? BLUE : GREY, weight: 8, opacity: 1, lineCap: "round", lineJoin: "round", interactive: !chosen });
32871
- for (const line of [casing, fill2]) {
32822
+ const fill = new Polyline(latlngs, { color: chosen ? BLUE : GREY, weight: 8, opacity: 1, lineCap: "round", lineJoin: "round", interactive: !chosen });
32823
+ for (const line of [casing, fill]) {
32872
32824
  line.addTo(this.map);
32873
32825
  if (!chosen)
32874
32826
  line.on("click", () => this.selectRoute(i));
32875
32827
  }
32876
- this._lines.push(casing, fill2);
32828
+ this._lines.push(casing, fill);
32877
32829
  }
32878
32830
  if (this.state === "navigating" || this.navigator) {
32879
32831
  const casing = new Polyline([], { color: TRAVELED_CASING, weight: 12, opacity: 1, lineCap: "round", lineJoin: "round", interactive: false }).addTo(this.map);
32880
- const fill2 = new Polyline([], { color: TRAVELED, weight: 8, opacity: 1, lineCap: "round", lineJoin: "round", interactive: false }).addTo(this.map);
32881
- this._traveled = [casing, fill2];
32832
+ const fill = new Polyline([], { color: TRAVELED, weight: 8, opacity: 1, lineCap: "round", lineJoin: "round", interactive: false }).addTo(this.map);
32833
+ this._traveled = [casing, fill];
32882
32834
  }
32883
32835
  }
32884
- _updateTraveled(distance2) {
32836
+ _updateTraveled(distance) {
32885
32837
  const nav = this.navigator;
32886
32838
  if (!nav || !this._traveled.length)
32887
32839
  return;
32888
32840
  const latlngs = [];
32889
- for (let i = 0;i < nav.points.length && nav.along[i] < distance2; i++)
32841
+ for (let i = 0;i < nav.points.length && nav.along[i] < distance; i++)
32890
32842
  latlngs.push([nav.points[i].lat, nav.points[i].lng]);
32891
- const here = nav.pointAt(distance2).location;
32843
+ const here = nav.pointAt(distance).location;
32892
32844
  latlngs.push([here.lat, here.lng]);
32893
32845
  for (const line of this._traveled)
32894
32846
  line.setLatLngs(latlngs);
@@ -33154,138 +33106,6 @@ var tsMap = {
33154
33106
  };
33155
33107
  if (typeof window !== "undefined")
33156
33108
  window.tsMap ??= tsMap;
33157
-
33158
- // src/adapters.ts
33159
- function craftCoordToLatLng(coord) {
33160
- return new LatLng(coord.latitude, coord.longitude);
33161
- }
33162
- function latLngToCraftCoord(ll) {
33163
- return { latitude: ll.lat, longitude: ll.lng };
33164
- }
33165
- function craftRegionToBounds(region) {
33166
- const { center, span } = region;
33167
- const halfLat = span.latitude_delta / 2;
33168
- const halfLng = span.longitude_delta / 2;
33169
- const sw = new LatLng(center.latitude - halfLat, center.longitude - halfLng);
33170
- const ne = new LatLng(center.latitude + halfLat, center.longitude + halfLng);
33171
- return new LatLngBounds(sw, ne);
33172
- }
33173
- function craftBoundingBoxToBounds(box) {
33174
- return new LatLngBounds(craftCoordToLatLng(box.south_west), craftCoordToLatLng(box.north_east));
33175
- }
33176
- function boundsToCraftRegion(bounds) {
33177
- const sw = bounds._southWest;
33178
- const ne = bounds._northEast;
33179
- if (!sw || !ne) {
33180
- return {
33181
- center: { latitude: 0, longitude: 0 },
33182
- span: { latitude_delta: 0, longitude_delta: 0 }
33183
- };
33184
- }
33185
- return {
33186
- center: {
33187
- latitude: (sw.lat + ne.lat) / 2,
33188
- longitude: (sw.lng + ne.lng) / 2
33189
- },
33190
- span: {
33191
- latitude_delta: ne.lat - sw.lat,
33192
- longitude_delta: ne.lng - sw.lng
33193
- }
33194
- };
33195
- }
33196
- function craftCameraToOptions(cam) {
33197
- return {
33198
- center: craftCoordToLatLng(cam.center),
33199
- zoom: cam.zoom,
33200
- bearing: cam.heading,
33201
- pitch: cam.pitch
33202
- };
33203
- }
33204
- function cameraToCamera(cam) {
33205
- return craftCameraToOptions(cam);
33206
- }
33207
- function craftMarkerToMarker(m) {
33208
- const marker = new Marker(craftCoordToLatLng(m.coordinate), {
33209
- title: m.title ?? undefined,
33210
- draggable: m.is_draggable,
33211
- icon: m.custom_icon ?? undefined
33212
- });
33213
- marker.__craftMarkerId = m.id;
33214
- marker.__craftMarkerColor = m.color;
33215
- if (m.is_selected)
33216
- marker.__craftSelected = true;
33217
- return marker;
33218
- }
33219
- function craftPolylineToPolyline(pl) {
33220
- const latlngs = pl.coordinates.map(craftCoordToLatLng);
33221
- const polyline2 = new Polyline(latlngs, {
33222
- color: markerColorHex[pl.stroke_color],
33223
- weight: pl.stroke_width,
33224
- dashArray: strokePatternDashes[pl.stroke_pattern].join(",") || undefined
33225
- });
33226
- polyline2.__craftPolylineId = pl.id;
33227
- polyline2.__craftZIndex = pl.z_index;
33228
- return polyline2;
33229
- }
33230
- function craftPolygonToPolygon(pg) {
33231
- const rings = [pg.exterior_ring.map(craftCoordToLatLng)];
33232
- for (const ring of pg.interior_rings)
33233
- rings.push(ring.map(craftCoordToLatLng));
33234
- const polygon2 = new Polygon(rings, {
33235
- color: markerColorHex[pg.stroke_color],
33236
- weight: pg.stroke_width,
33237
- fillColor: markerColorHex[pg.fill_color],
33238
- fillOpacity: pg.fill_opacity
33239
- });
33240
- polygon2.__craftPolygonId = pg.id;
33241
- polygon2.__craftZIndex = pg.z_index;
33242
- return polygon2;
33243
- }
33244
- function craftCircleToCircle(c) {
33245
- const circle2 = new Circle(craftCoordToLatLng(c.center), {
33246
- radius: c.radius_meters,
33247
- color: markerColorHex[c.stroke_color],
33248
- weight: c.stroke_width,
33249
- fillColor: markerColorHex[c.fill_color],
33250
- fillOpacity: c.fill_opacity
33251
- });
33252
- circle2.__craftCircleId = c.id;
33253
- return circle2;
33254
- }
33255
- function regionFromBounds(coords2) {
33256
- if (coords2.length === 0)
33257
- return null;
33258
- let minLat = 90;
33259
- let maxLat = -90;
33260
- let minLng = 180;
33261
- let maxLng = -180;
33262
- for (const c of coords2) {
33263
- if (c.latitude < minLat)
33264
- minLat = c.latitude;
33265
- if (c.latitude > maxLat)
33266
- maxLat = c.latitude;
33267
- if (c.longitude < minLng)
33268
- minLng = c.longitude;
33269
- if (c.longitude > maxLng)
33270
- maxLng = c.longitude;
33271
- }
33272
- return {
33273
- center: {
33274
- latitude: (minLat + maxLat) / 2,
33275
- longitude: (minLng + maxLng) / 2
33276
- },
33277
- span: {
33278
- latitude_delta: maxLat - minLat,
33279
- longitude_delta: maxLng - minLng
33280
- }
33281
- };
33282
- }
33283
-
33284
- // src/bridge-protocol.ts
33285
- var BRIDGE_NAMESPACE = "ts_maps";
33286
- function mapEventName(type) {
33287
- return `map:${type}`;
33288
- }
33289
33109
  // node:events
33290
33110
  var SymbolFor = Symbol.for;
33291
33111
  var kCapture = Symbol("kCapture");
@@ -33528,34 +33348,35 @@ EventEmitterPrototype.eventNames = function() {
33528
33348
  return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
33529
33349
  };
33530
33350
  EventEmitterPrototype[kCapture] = false;
33531
- function once2(emitter, type, options) {
33351
+ function once(emitter, type, options) {
33532
33352
  var signal = options?.signal;
33533
33353
  if (validateAbortSignal(signal, "options.signal"), signal?.aborted)
33534
33354
  throw new AbortError(undefined, { cause: signal?.reason });
33535
- let { resolve: resolve2, reject, promise } = $newPromiseCapability(Promise), errorListener = (err) => {
33536
- if (emitter.removeListener(type, resolver), signal != null)
33537
- eventTargetAgnosticRemoveListener(signal, "abort", abortListener);
33538
- reject(err);
33539
- }, resolver = (...args) => {
33540
- if (typeof emitter.removeListener === "function")
33541
- emitter.removeListener("error", errorListener);
33355
+ return new Promise((resolve, reject) => {
33356
+ let errorListener = (err) => {
33357
+ if (emitter.removeListener(type, resolver), signal != null)
33358
+ eventTargetAgnosticRemoveListener(signal, "abort", abortListener);
33359
+ reject(err);
33360
+ }, resolver = (...args) => {
33361
+ if (typeof emitter.removeListener === "function")
33362
+ emitter.removeListener("error", errorListener);
33363
+ if (signal != null)
33364
+ eventTargetAgnosticRemoveListener(signal, "abort", abortListener);
33365
+ resolve(args);
33366
+ };
33367
+ if (eventTargetAgnosticAddListener(emitter, type, resolver, { once: true }), type !== "error" && typeof emitter.once === "function")
33368
+ emitter.once("error", errorListener);
33369
+ function abortListener() {
33370
+ eventTargetAgnosticRemoveListener(emitter, type, resolver), eventTargetAgnosticRemoveListener(emitter, "error", errorListener), reject(new AbortError(undefined, { cause: signal?.reason }));
33371
+ }
33542
33372
  if (signal != null)
33543
- eventTargetAgnosticRemoveListener(signal, "abort", abortListener);
33544
- resolve2(args);
33545
- };
33546
- if (eventTargetAgnosticAddListener(emitter, type, resolver, { once: true }), type !== "error" && typeof emitter.once === "function")
33547
- emitter.once("error", errorListener);
33548
- function abortListener() {
33549
- eventTargetAgnosticRemoveListener(emitter, type, resolver), eventTargetAgnosticRemoveListener(emitter, "error", errorListener), reject(new AbortError(undefined, { cause: signal?.reason }));
33550
- }
33551
- if (signal != null)
33552
- eventTargetAgnosticAddListener(signal, "abort", abortListener, { once: true });
33553
- return promise;
33373
+ eventTargetAgnosticAddListener(signal, "abort", abortListener, { once: true });
33374
+ });
33554
33375
  }
33555
33376
  function getEventListeners(emitter, type) {
33556
33377
  return emitter.listeners(type);
33557
33378
  }
33558
- function setMaxListeners2(n, ...eventTargets) {
33379
+ function setMaxListeners(n, ...eventTargets) {
33559
33380
  validateNumber(n, "setMaxListeners", 0);
33560
33381
  var length;
33561
33382
  if (eventTargets && (length = eventTargets.length))
@@ -33564,7 +33385,7 @@ function setMaxListeners2(n, ...eventTargets) {
33564
33385
  else
33565
33386
  defaultMaxListeners = n;
33566
33387
  }
33567
- function listenerCount2(emitter, type) {
33388
+ function listenerCount(emitter, type) {
33568
33389
  return emitter.listenerCount(type);
33569
33390
  }
33570
33391
  function eventTargetAgnosticRemoveListener(emitter, name, listener, flags) {
@@ -33617,7 +33438,7 @@ function validateBoolean(value, name) {
33617
33438
  if (typeof value !== "boolean")
33618
33439
  throw ERR_INVALID_ARG_TYPE(name, "boolean", value);
33619
33440
  }
33620
- function getMaxListeners2(emitterOrTarget) {
33441
+ function getMaxListeners(emitterOrTarget) {
33621
33442
  return emitterOrTarget?._maxListeners ?? defaultMaxListeners;
33622
33443
  }
33623
33444
  function addAbortListener(signal, listener) {
@@ -33640,12 +33461,10 @@ Object.defineProperties(EventEmitter, { captureRejections: { get() {
33640
33461
  return EventEmitterPrototype[kCapture];
33641
33462
  }, set(value) {
33642
33463
  validateBoolean(value, "EventEmitter.captureRejections"), EventEmitterPrototype[kCapture] = value;
33643
- }, enumerable: true }, defaultMaxListeners: { enumerable: true, get: () => {
33644
- return defaultMaxListeners;
33645
- }, set: (arg) => {
33464
+ }, enumerable: true }, defaultMaxListeners: { enumerable: true, get: () => defaultMaxListeners, set: (arg) => {
33646
33465
  validateNumber(arg, "defaultMaxListeners", 0), defaultMaxListeners = arg;
33647
33466
  } }, kMaxEventTargetListeners: { value: kMaxEventTargetListeners, enumerable: false, configurable: false, writable: false }, kMaxEventTargetListenersWarned: { value: kMaxEventTargetListenersWarned, enumerable: false, configurable: false, writable: false } });
33648
- Object.assign(EventEmitter, { once: once2, getEventListeners, getMaxListeners: getMaxListeners2, setMaxListeners: setMaxListeners2, EventEmitter, usingDomains: false, captureRejectionSymbol, errorMonitor: kErrorMonitor, addAbortListener, init: EventEmitter, listenerCount: listenerCount2 });
33467
+ Object.assign(EventEmitter, { once, getEventListeners, getMaxListeners, setMaxListeners, EventEmitter, usingDomains: false, captureRejectionSymbol, errorMonitor: kErrorMonitor, addAbortListener, init: EventEmitter, listenerCount });
33649
33468
 
33650
33469
  // ../typescript/src/bridge/ids.ts
33651
33470
  function secureUUID() {
@@ -33855,9 +33674,9 @@ class NativeBridge extends EventEmitter {
33855
33674
  throw new BridgeError("Offline queue full", BridgeErrorCodes.QUEUE_FULL);
33856
33675
  }
33857
33676
  this.offlineQueue.push(message);
33858
- return new Promise((resolve2, reject) => {
33677
+ return new Promise((resolve, reject) => {
33859
33678
  this.pendingRequests.set(message.id, {
33860
- resolve: resolve2,
33679
+ resolve,
33861
33680
  reject,
33862
33681
  timeout: setTimeout(() => {
33863
33682
  this.pendingRequests.delete(message.id);
@@ -33869,13 +33688,13 @@ class NativeBridge extends EventEmitter {
33869
33688
  });
33870
33689
  });
33871
33690
  }
33872
- return new Promise((resolve2, reject) => {
33691
+ return new Promise((resolve, reject) => {
33873
33692
  const timer = setTimeout(() => {
33874
33693
  this.pendingRequests.delete(message.id);
33875
33694
  reject(new BridgeError("Request timeout", BridgeErrorCodes.TIMEOUT));
33876
33695
  }, effectiveTimeout);
33877
33696
  this.pendingRequests.set(message.id, {
33878
- resolve: resolve2,
33697
+ resolve,
33879
33698
  reject,
33880
33699
  timeout: timer
33881
33700
  });
@@ -34118,7 +33937,7 @@ class NativeBridge extends EventEmitter {
34118
33937
  pending.reject(error);
34119
33938
  }
34120
33939
  delay(ms) {
34121
- return new Promise((resolve2) => setTimeout(resolve2, ms));
33940
+ return new Promise((resolve) => setTimeout(resolve, ms));
34122
33941
  }
34123
33942
  arrayBufferToBase64(buffer) {
34124
33943
  const chunks = [];
@@ -34168,54 +33987,6 @@ class BridgeError extends Error {
34168
33987
  this.data = data;
34169
33988
  }
34170
33989
  }
34171
- class NativeComponentBridge {
34172
- bridge;
34173
- components = new Map;
34174
- constructor(bridge) {
34175
- this.bridge = bridge;
34176
- this.bridge.on("component.event", this.handleComponentEvent.bind(this));
34177
- }
34178
- handleComponentEvent(event) {
34179
- const component = this.components.get(event.componentId);
34180
- if (component) {
34181
- this.bridge.emit(`component:${event.componentId}:${event.eventType}`, event.data);
34182
- }
34183
- }
34184
- async createSidebar(config) {
34185
- const id = await this.bridge.request("component.createSidebar", config);
34186
- this.components.set(id, { id, type: "sidebar", props: config });
34187
- return id;
34188
- }
34189
- async createFileBrowser(config) {
34190
- const id = await this.bridge.request("component.createFileBrowser", config);
34191
- this.components.set(id, { id, type: "fileBrowser", props: config });
34192
- return id;
34193
- }
34194
- async createSplitView(config) {
34195
- const id = await this.bridge.request("component.createSplitView", config);
34196
- this.components.set(id, { id, type: "splitView", props: config });
34197
- return id;
34198
- }
34199
- async updateComponent(componentId, props) {
34200
- const component = this.components.get(componentId);
34201
- if (component) {
34202
- component.props = { ...component.props, ...props };
34203
- }
34204
- await this.bridge.request("component.update", { componentId, props });
34205
- }
34206
- async destroyComponent(componentId) {
34207
- this.components.delete(componentId);
34208
- await this.bridge.request("component.destroy", { componentId });
34209
- }
34210
- onComponentEvent(componentId, eventType, callback) {
34211
- const eventName = `component:${componentId}:${eventType}`;
34212
- this.bridge.on(eventName, callback);
34213
- return () => this.bridge.off(eventName, callback);
34214
- }
34215
- async getFileBrowserSelection(componentId) {
34216
- return this.bridge.request("component.getFileBrowserSelection", { componentId });
34217
- }
34218
- }
34219
33990
  var globalBridge = null;
34220
33991
  var globalBridgeConfig = null;
34221
33992
  function getBridge(config) {
@@ -34243,6 +34014,178 @@ function shallowConfigEqual(a, b) {
34243
34014
  return true;
34244
34015
  }
34245
34016
 
34017
+ // src/types.ts
34018
+ var defaultMapConfiguration = {
34019
+ provider: "ts_maps",
34020
+ map_type: "standard",
34021
+ shows_user_location: false,
34022
+ user_tracking_mode: "none",
34023
+ shows_compass: true,
34024
+ shows_scale: true,
34025
+ shows_traffic: false,
34026
+ shows_buildings: true,
34027
+ is_rotate_enabled: true,
34028
+ is_scroll_enabled: true,
34029
+ is_zoom_enabled: true,
34030
+ is_pitch_enabled: true,
34031
+ min_zoom: 0,
34032
+ max_zoom: 22
34033
+ };
34034
+ var defaultMapCamera = {
34035
+ center: { latitude: 0, longitude: 0 },
34036
+ zoom: 15,
34037
+ pitch: 0,
34038
+ heading: 0
34039
+ };
34040
+ var markerColorHex = {
34041
+ red: "#ff3b30",
34042
+ green: "#34c759",
34043
+ blue: "#007aff",
34044
+ yellow: "#ffcc00",
34045
+ orange: "#ff9500",
34046
+ purple: "#af52de",
34047
+ cyan: "#32ade6",
34048
+ magenta: "#ff2d55"
34049
+ };
34050
+ var strokePatternDashes = {
34051
+ solid: [],
34052
+ dashed: [10, 5],
34053
+ dotted: [2, 2],
34054
+ dash_dot: [10, 5, 2, 5]
34055
+ };
34056
+
34057
+ // src/adapters.ts
34058
+ function craftCoordToLatLng(coord) {
34059
+ return new LatLng(coord.latitude, coord.longitude);
34060
+ }
34061
+ function latLngToCraftCoord(ll) {
34062
+ return { latitude: ll.lat, longitude: ll.lng };
34063
+ }
34064
+ function craftRegionToBounds(region) {
34065
+ const { center, span } = region;
34066
+ const halfLat = span.latitude_delta / 2;
34067
+ const halfLng = span.longitude_delta / 2;
34068
+ const sw = new LatLng(center.latitude - halfLat, center.longitude - halfLng);
34069
+ const ne = new LatLng(center.latitude + halfLat, center.longitude + halfLng);
34070
+ return new LatLngBounds(sw, ne);
34071
+ }
34072
+ function craftBoundingBoxToBounds(box) {
34073
+ return new LatLngBounds(craftCoordToLatLng(box.south_west), craftCoordToLatLng(box.north_east));
34074
+ }
34075
+ function boundsToCraftRegion(bounds) {
34076
+ const sw = bounds._southWest;
34077
+ const ne = bounds._northEast;
34078
+ if (!sw || !ne) {
34079
+ return {
34080
+ center: { latitude: 0, longitude: 0 },
34081
+ span: { latitude_delta: 0, longitude_delta: 0 }
34082
+ };
34083
+ }
34084
+ return {
34085
+ center: {
34086
+ latitude: (sw.lat + ne.lat) / 2,
34087
+ longitude: (sw.lng + ne.lng) / 2
34088
+ },
34089
+ span: {
34090
+ latitude_delta: ne.lat - sw.lat,
34091
+ longitude_delta: ne.lng - sw.lng
34092
+ }
34093
+ };
34094
+ }
34095
+ function craftCameraToOptions(cam) {
34096
+ return {
34097
+ center: craftCoordToLatLng(cam.center),
34098
+ zoom: cam.zoom,
34099
+ bearing: cam.heading,
34100
+ pitch: cam.pitch
34101
+ };
34102
+ }
34103
+ function cameraToCamera(cam) {
34104
+ return craftCameraToOptions(cam);
34105
+ }
34106
+ function craftMarkerToMarker(m) {
34107
+ const marker = new Marker(craftCoordToLatLng(m.coordinate), {
34108
+ title: m.title ?? undefined,
34109
+ draggable: m.is_draggable,
34110
+ icon: m.custom_icon ?? undefined
34111
+ });
34112
+ marker.__craftMarkerId = m.id;
34113
+ marker.__craftMarkerColor = m.color;
34114
+ if (m.is_selected)
34115
+ marker.__craftSelected = true;
34116
+ return marker;
34117
+ }
34118
+ function craftPolylineToPolyline(pl) {
34119
+ const latlngs = pl.coordinates.map(craftCoordToLatLng);
34120
+ const polyline = new Polyline(latlngs, {
34121
+ color: markerColorHex[pl.stroke_color],
34122
+ weight: pl.stroke_width,
34123
+ dashArray: strokePatternDashes[pl.stroke_pattern].join(",") || undefined
34124
+ });
34125
+ polyline.__craftPolylineId = pl.id;
34126
+ polyline.__craftZIndex = pl.z_index;
34127
+ return polyline;
34128
+ }
34129
+ function craftPolygonToPolygon(pg) {
34130
+ const rings = [pg.exterior_ring.map(craftCoordToLatLng)];
34131
+ for (const ring of pg.interior_rings)
34132
+ rings.push(ring.map(craftCoordToLatLng));
34133
+ const polygon = new Polygon(rings, {
34134
+ color: markerColorHex[pg.stroke_color],
34135
+ weight: pg.stroke_width,
34136
+ fillColor: markerColorHex[pg.fill_color],
34137
+ fillOpacity: pg.fill_opacity
34138
+ });
34139
+ polygon.__craftPolygonId = pg.id;
34140
+ polygon.__craftZIndex = pg.z_index;
34141
+ return polygon;
34142
+ }
34143
+ function craftCircleToCircle(c) {
34144
+ const circle = new Circle(craftCoordToLatLng(c.center), {
34145
+ radius: c.radius_meters,
34146
+ color: markerColorHex[c.stroke_color],
34147
+ weight: c.stroke_width,
34148
+ fillColor: markerColorHex[c.fill_color],
34149
+ fillOpacity: c.fill_opacity
34150
+ });
34151
+ circle.__craftCircleId = c.id;
34152
+ return circle;
34153
+ }
34154
+ function regionFromBounds(coords) {
34155
+ if (coords.length === 0)
34156
+ return null;
34157
+ let minLat = 90;
34158
+ let maxLat = -90;
34159
+ let minLng = 180;
34160
+ let maxLng = -180;
34161
+ for (const c of coords) {
34162
+ if (c.latitude < minLat)
34163
+ minLat = c.latitude;
34164
+ if (c.latitude > maxLat)
34165
+ maxLat = c.latitude;
34166
+ if (c.longitude < minLng)
34167
+ minLng = c.longitude;
34168
+ if (c.longitude > maxLng)
34169
+ maxLng = c.longitude;
34170
+ }
34171
+ return {
34172
+ center: {
34173
+ latitude: (minLat + maxLat) / 2,
34174
+ longitude: (minLng + maxLng) / 2
34175
+ },
34176
+ span: {
34177
+ latitude_delta: maxLat - minLat,
34178
+ longitude_delta: maxLng - minLng
34179
+ }
34180
+ };
34181
+ }
34182
+
34183
+ // src/bridge-protocol.ts
34184
+ var BRIDGE_NAMESPACE = "ts_maps";
34185
+ function mapEventName(type) {
34186
+ return `map:${type}`;
34187
+ }
34188
+
34246
34189
  // src/MapView.ts
34247
34190
  var _mapViewIdCounter = 0;
34248
34191
  function nextMapViewId() {
@@ -34369,37 +34312,37 @@ function createMapView(props = {}) {
34369
34312
  markers.delete(markerId);
34370
34313
  return true;
34371
34314
  },
34372
- addPolyline(polyline2) {
34373
- const tsLine = craftPolylineToPolyline(polyline2);
34315
+ addPolyline(polyline) {
34316
+ const tsLine = craftPolylineToPolyline(polyline);
34374
34317
  tsLine.addTo?.(map);
34375
- polylines.set(polyline2.id, tsLine);
34376
- return polyline2.id;
34318
+ polylines.set(polyline.id, tsLine);
34319
+ return polyline.id;
34377
34320
  },
34378
- addPolygon(polygon2) {
34379
- const tsPolygon = craftPolygonToPolygon(polygon2);
34321
+ addPolygon(polygon) {
34322
+ const tsPolygon = craftPolygonToPolygon(polygon);
34380
34323
  tsPolygon.addTo?.(map);
34381
- polygons.set(polygon2.id, tsPolygon);
34382
- return polygon2.id;
34324
+ polygons.set(polygon.id, tsPolygon);
34325
+ return polygon.id;
34383
34326
  },
34384
- addCircle(circle2) {
34385
- const tsCircle = craftCircleToCircle(circle2);
34327
+ addCircle(circle) {
34328
+ const tsCircle = craftCircleToCircle(circle);
34386
34329
  tsCircle.addTo?.(map);
34387
- circles.set(circle2.id, tsCircle);
34388
- return circle2.id;
34330
+ circles.set(circle.id, tsCircle);
34331
+ return circle.id;
34389
34332
  },
34390
34333
  fitToMarkers(paddingPercent = 10) {
34391
34334
  if (markers.size === 0)
34392
34335
  return;
34393
- const coords2 = [];
34336
+ const coords = [];
34394
34337
  for (const m of markers.values()) {
34395
34338
  const ll = m.getLatLng?.();
34396
34339
  if (ll)
34397
- coords2.push(latLngToCraftCoord(ll));
34340
+ coords.push(latLngToCraftCoord(ll));
34398
34341
  }
34399
- if (coords2.length === 0)
34342
+ if (coords.length === 0)
34400
34343
  return;
34401
34344
  let minLat = 90, maxLat = -90, minLng = 180, maxLng = -180;
34402
- for (const c of coords2) {
34345
+ for (const c of coords) {
34403
34346
  if (c.latitude < minLat)
34404
34347
  minLat = c.latitude;
34405
34348
  if (c.latitude > maxLat)
@@ -34457,22 +34400,22 @@ function createMapView(props = {}) {
34457
34400
  instance.addCircle(c);
34458
34401
  if (bridge) {
34459
34402
  const unbind = [];
34460
- const on2 = (method, handler) => {
34403
+ const on = (method, handler) => {
34461
34404
  const event = `${BRIDGE_NAMESPACE}:${method}:${id}`;
34462
34405
  bridge.on(event, handler);
34463
34406
  unbind.push(() => bridge.off(event, handler));
34464
34407
  };
34465
- on2("setCamera", (p) => instance.setCamera(p.camera, p.animated));
34466
- on2("setRegion", (p) => instance.setRegion(p.region, p.animated));
34467
- on2("addMarker", (p) => instance.addMarker(p.marker));
34468
- on2("removeMarker", (p) => instance.removeMarker(p.id));
34469
- on2("addPolyline", (p) => instance.addPolyline(p.polyline));
34470
- on2("addPolygon", (p) => instance.addPolygon(p.polygon));
34471
- on2("addCircle", (p) => instance.addCircle(p.circle));
34472
- on2("fitToMarkers", (p) => instance.fitToMarkers(p.padding));
34473
- on2("selectMarker", (p) => instance.selectMarker(p.id));
34474
- on2("deselectAll", () => instance.deselectAll());
34475
- on2("setConfiguration", (p) => instance.setConfiguration(p.configuration));
34408
+ on("setCamera", (p) => instance.setCamera(p.camera, p.animated));
34409
+ on("setRegion", (p) => instance.setRegion(p.region, p.animated));
34410
+ on("addMarker", (p) => instance.addMarker(p.marker));
34411
+ on("removeMarker", (p) => instance.removeMarker(p.id));
34412
+ on("addPolyline", (p) => instance.addPolyline(p.polyline));
34413
+ on("addPolygon", (p) => instance.addPolygon(p.polygon));
34414
+ on("addCircle", (p) => instance.addCircle(p.circle));
34415
+ on("fitToMarkers", (p) => instance.fitToMarkers(p.padding));
34416
+ on("selectMarker", (p) => instance.selectMarker(p.id));
34417
+ on("deselectAll", () => instance.deselectAll());
34418
+ on("setConfiguration", (p) => instance.setConfiguration(p.configuration));
34476
34419
  const originalDestroy = instance.destroy;
34477
34420
  instance.destroy = () => {
34478
34421
  for (const fn of unbind)
@@ -34653,18 +34596,18 @@ function createFilesystemBackend(opts) {
34653
34596
  await fs.mkdir(baseDir);
34654
34597
  ensured = true;
34655
34598
  }
34656
- function filePath(key3) {
34657
- return `${baseDir}/${hashKey(key3)}${FILE_SUFFIX}`;
34599
+ function filePath(key) {
34600
+ return `${baseDir}/${hashKey(key)}${FILE_SUFFIX}`;
34658
34601
  }
34659
34602
  return {
34660
- async get(key3) {
34661
- const path = filePath(key3);
34603
+ async get(key) {
34604
+ const path = filePath(key);
34662
34605
  if (!await fs.exists(path))
34663
34606
  return;
34664
34607
  try {
34665
34608
  const bytes = await readBinaryFile(path);
34666
34609
  const decoded = decodeTile(bytes);
34667
- if (decoded.key !== key3)
34610
+ if (decoded.key !== key)
34668
34611
  return;
34669
34612
  return decoded;
34670
34613
  } catch {
@@ -34676,8 +34619,8 @@ function createFilesystemBackend(opts) {
34676
34619
  const payload = encodeTile(tile);
34677
34620
  await writeBinaryFile(filePath(tile.key), payload);
34678
34621
  },
34679
- async delete(key3) {
34680
- const path = filePath(key3);
34622
+ async delete(key) {
34623
+ const path = filePath(key);
34681
34624
  try {
34682
34625
  if (await fs.exists(path))
34683
34626
  await fs.remove(path);
@@ -34721,11 +34664,11 @@ function createFilesystemBackend(opts) {
34721
34664
  }
34722
34665
  function encodeTile(tile) {
34723
34666
  const enc = new TextEncoder;
34724
- const key3 = enc.encode(tile.key);
34667
+ const key = enc.encode(tile.key);
34725
34668
  const mime = enc.encode(tile.mime);
34726
34669
  const reserved = new Uint8Array;
34727
34670
  const headerLen = 4 + 1 + 4 + 4 + 4 + 8 + 8 + 4;
34728
- const total = headerLen + key3.length + mime.length + reserved.length + tile.data.length;
34671
+ const total = headerLen + key.length + mime.length + reserved.length + tile.data.length;
34729
34672
  const buf = new Uint8Array(total);
34730
34673
  const view = new DataView(buf.buffer);
34731
34674
  let o = 0;
@@ -34734,7 +34677,7 @@ function encodeTile(tile) {
34734
34677
  buf[o++] = MAGIC2[2];
34735
34678
  buf[o++] = MAGIC2[3];
34736
34679
  buf[o++] = VERSION;
34737
- view.setUint32(o, key3.length, true);
34680
+ view.setUint32(o, key.length, true);
34738
34681
  o += 4;
34739
34682
  view.setUint32(o, mime.length, true);
34740
34683
  o += 4;
@@ -34746,8 +34689,8 @@ function encodeTile(tile) {
34746
34689
  o += 8;
34747
34690
  view.setUint32(o, tile.data.length, true);
34748
34691
  o += 4;
34749
- buf.set(key3, o);
34750
- o += key3.length;
34692
+ buf.set(key, o);
34693
+ o += key.length;
34751
34694
  buf.set(mime, o);
34752
34695
  o += mime.length;
34753
34696
  buf.set(reserved, o);
@@ -34776,25 +34719,25 @@ function decodeTile(bytes) {
34776
34719
  const dataLen = view.getUint32(o, true);
34777
34720
  o += 4;
34778
34721
  const dec = new TextDecoder;
34779
- const key3 = dec.decode(bytes.subarray(o, o + keyLen));
34722
+ const key = dec.decode(bytes.subarray(o, o + keyLen));
34780
34723
  o += keyLen;
34781
34724
  const mime = dec.decode(bytes.subarray(o, o + mimeLen));
34782
34725
  o += mimeLen;
34783
34726
  o += reservedLen;
34784
34727
  const data = bytes.subarray(o, o + dataLen).slice();
34785
34728
  return {
34786
- key: key3,
34729
+ key,
34787
34730
  data,
34788
34731
  mime,
34789
34732
  addedAt,
34790
34733
  bytes: data.length
34791
34734
  };
34792
34735
  }
34793
- function hashKey(key3) {
34736
+ function hashKey(key) {
34794
34737
  let a = 2166136261 >>> 0;
34795
34738
  let b = 3421674724 >>> 0;
34796
- for (let i = 0;i < key3.length; i++) {
34797
- const c = key3.charCodeAt(i);
34739
+ for (let i = 0;i < key.length; i++) {
34740
+ const c = key.charCodeAt(i);
34798
34741
  a ^= c;
34799
34742
  a = Math.imul(a, 16777619) >>> 0;
34800
34743
  b ^= c;
@@ -34871,273 +34814,273 @@ function probeCapabilities() {
34871
34814
  };
34872
34815
  }
34873
34816
  function supportsAdvancedRendering(caps) {
34874
- const probe2 = caps ?? probeCapabilities();
34875
- return probe2.webgl2 && probe2.hardwareConcurrency >= 2 && probe2.pointerEvents;
34817
+ const probe = caps ?? probeCapabilities();
34818
+ return probe.webgl2 && probe.hardwareConcurrency >= 2 && probe.pointerEvents;
34876
34819
  }
34877
34820
 
34878
34821
  // src/index.ts
34879
34822
  var tsMapsProvider = "ts_maps";
34880
34823
  export {
34881
- xor,
34882
- withPMTiles,
34883
- withOfflineFallback,
34884
- videoOverlay,
34885
- version,
34886
- vectorTileLayer,
34887
- validateRing,
34888
- unwrapRing,
34889
- union,
34890
- turnByTurn,
34891
- tsMapsProvider,
34892
- tooltip,
34893
- toTransformation,
34894
- toPoint,
34895
- toLatLngBounds,
34896
- toLatLng,
34897
- toBounds,
34898
- tileLayer,
34899
- territoryLayer,
34900
- svgOverlay,
34901
- supportsAdvancedRendering,
34902
- exports_styles as styles,
34903
- strokePatternDashes,
34904
- staticMapZoom,
34905
- staticMapView,
34906
- staticMapSvg,
34907
- splitSelfIntersecting,
34908
- simplifyTrack,
34909
- setPMTilesArchive,
34910
- setOfflineMaps,
34911
- exports_services as services,
34912
- selfIntersects,
34913
- saveOfflineRegionToFilesystem,
34914
- saveOfflineRegion,
34915
- sampleElevationBilinear,
34916
- runTrailLayer,
34917
- routeOnGraph,
34918
- routeEditor,
34919
- ringPerimeter,
34920
- ringArea2 as ringArea,
34921
- resolveSelfIntersections,
34922
- resetDefaultCache,
34923
- renderStaticMap,
34924
- regionFromBounds,
34925
- rectangle,
34926
- readPMTilesTile,
34927
- rasterDEMLayer,
34928
- probeCapabilities,
34929
- prepareClaim,
34930
- popup,
34931
- polyline,
34932
- polygonArea,
34933
- polygon,
34934
- pmtilesTileUrl,
34935
- pmtilesTileJSON,
34936
- pmtilesSourceUrl,
34937
- pmtilesFetch,
34938
- pmtilesArchiveUrl,
34939
- planArea,
34940
- placeFromResult,
34941
- parsePMTilesTileUrl,
34942
- offlineMapsNow,
34943
- offlineMaps,
34944
- offlineFetch,
34945
- nameFromLabels,
34946
- multiPolygonArea,
34947
- merge as mergeSearchResults,
34948
- mergePlaces,
34949
- mercatorY,
34950
- mercatorX,
34951
- matchScore,
34952
- markerColorHex,
34953
- marker2 as marker,
34954
- mapEventName,
34955
- map2 as map,
34956
- layerGroup,
34957
- latLngToCraftCoord,
34958
- craftCoordToLatLng as latLngFromCoordinate,
34959
- kindLabel,
34960
- isPMTilesUrl,
34961
- intersects2 as intersects,
34962
- intersection,
34963
- imageOverlay,
34964
- iconForKind,
34965
- icon,
34966
- heatmapLayer,
34967
- haversine3 as haversine,
34968
- gridLayer,
34969
- getPMTilesArchive,
34970
- getElevationDecoder,
34971
- getDefaultCache,
34972
- geoJson,
34973
- geoJSON,
34974
- formatDuration,
34975
- formatDistance2 as formatDistance,
34976
- formatBytes,
34977
- formatArea,
34978
- flatten,
34979
- featureGroup,
34980
- extractTile,
34981
- exports_easing as easing,
34982
- earcut,
34983
- divIcon,
34984
- distanceMeters2 as distanceMeters,
34985
- difference,
34986
- deviation,
34987
- detectLoop,
34988
- describePlace,
34989
- defaultMapConfiguration,
34990
- defaultMapCamera,
34991
- decodeTerrariumRGB,
34992
- decodeMapboxRGB,
34993
- decodeElevationGrid,
34994
- createMapView,
34995
- createMap,
34996
- createFilesystemTileCache,
34997
- createFilesystemBackend,
34998
- craftRegionToBounds,
34999
- craftPolylineToPolyline,
35000
- craftPolygonToPolygon,
35001
- craftMarkerToMarker,
35002
- craftCoordToLatLng,
35003
- craftCircleToCircle,
35004
- craftCameraToOptions,
35005
- craftBoundingBoxToBounds,
35006
- latLngToCraftCoord as coordinateFromLatLng,
35007
- control2 as control,
35008
- contains,
35009
- computeTileCoords,
35010
- compareEvents2 as compareEvents,
35011
- clearPMTilesArchives,
35012
- circleMarker,
35013
- circle,
35014
- categoryForQuery,
35015
- categoriesMatching,
35016
- cameraToCamera,
35017
- cachedFetch,
35018
- buildTerrainMesh,
35019
- boundsToCraftRegion,
35020
- badge,
35021
- activeOfflineMaps,
35022
- ZoomControl,
35023
- WebGLUnsupportedError,
35024
- WebGLTileRenderer,
35025
- WMSTileLayer,
35026
- VideoOverlay,
35027
- VectorTileMapLayer,
35028
- VectorTileLayer,
35029
- VectorTileFeature,
35030
- VectorTile,
35031
- exports_Util as Util,
35032
- TwoFingerRotateHandler,
35033
- TwoFingerPitchHandler,
35034
- TurnByTurn,
35035
- TsMap,
35036
- Transformation,
35037
- Tooltip,
35038
- TileLayer,
35039
- TileCache,
35040
- TerritoryStore,
35041
- TerritoryLog,
35042
- TerritoryLayer,
35043
- TerrainSource,
35044
- TapHoldHandler,
35045
- TURN_BY_TURN_EVENTS,
35046
- StreetIndex,
35047
- SimpleCRS,
35048
- SearchHistory,
35049
- SearchEngine,
35050
- SearchControl,
35051
- ScrollWheelZoomHandler,
35052
- ScaleControl,
35053
- SVGOverlay,
35054
- SVG,
35055
- SEARCH_EVENTS,
35056
- SEARCH_CATEGORIES,
35057
- RunTrailLayer,
35058
- RouteEditor,
35059
- RoadGraph,
35060
- Renderer,
35061
- Rectangle,
35062
- RasterDEMLayer,
35063
- RTree,
35064
- exports_projection as Projection,
35065
- PosAnimation,
35066
- Popup,
35067
- Polyline,
35068
- Polygon,
35069
- exports_PolyUtil as PolyUtil,
35070
- Point,
35071
- PinchZoomHandler,
35072
- Pbf,
35073
- Path,
35074
- PMTILES_PROTOCOL,
35075
- OfflineMapsControl,
35076
- OfflineMaps,
35077
- OfflineGeocoder,
35078
- OfflineDirections,
35079
- OFFLINE_MAPS_EVENTS,
35080
- NavigationControl,
35081
- MemoryOfflineStore,
35082
- MarkerDrag,
35083
- Marker,
35084
- Map2 as Map,
35085
- MVT_GEOM_UNKNOWN,
35086
- MVT_GEOM_POLYGON,
35087
- MVT_GEOM_POINT,
35088
- MVT_GEOM_LINESTRING,
35089
- LoopDetector,
35090
- LocateControl,
35091
- exports_LineUtil as LineUtil,
35092
- LayersControl,
35093
- LayerGroup,
35094
- Layer,
35095
- LatLngBounds,
35096
- LatLng,
35097
- KeyboardHandler,
35098
- KDBush,
35099
- InvalidGeometryError,
35100
- IndexedDBOfflineStore,
35101
- ImageOverlay,
35102
- Icon,
35103
- HillshadeLayer,
35104
- HeatmapLayer,
35105
- Handler,
35106
- GridLayer,
35107
- GeocoderControl,
35108
- GeoJSONTileSource,
35109
- GeoJSONClusterSource,
35110
- GeoJSON,
35111
- GEOM_TYPE_NAMES,
35112
- FullscreenControl,
35113
- FeatureGroup,
35114
- Evented,
35115
- EarthCRS,
35116
- EPSG900913,
35117
- EPSG4326,
35118
- EPSG3857,
35119
- EPSG3395,
35120
- EARTH_RADIUS2 as EARTH_RADIUS,
35121
- Draggable,
35122
- DragHandler,
35123
- DoubleClickZoomHandler,
35124
- exports_DomUtil as DomUtil,
35125
- exports_DomEvent as DomEvent,
35126
- DivOverlay,
35127
- DivIcon,
35128
- DefaultIcon,
35129
- CooperativeGesturesHandler,
35130
- Control,
35131
- Class,
35132
- CircleMarker,
35133
- Circle,
35134
- Canvas,
35135
- CRS,
35136
- Browser_default as Browser,
35137
- BoxZoomHandler,
35138
- Bounds,
35139
- BlanketOverlay,
35140
- BRIDGE_NAMESPACE,
34824
+ Animation,
35141
34825
  AttributionControl,
35142
- Animation
34826
+ BRIDGE_NAMESPACE,
34827
+ BlanketOverlay,
34828
+ Bounds,
34829
+ BoxZoomHandler,
34830
+ Browser_default as Browser,
34831
+ CRS,
34832
+ Canvas,
34833
+ Circle,
34834
+ CircleMarker,
34835
+ Class,
34836
+ Control,
34837
+ CooperativeGesturesHandler,
34838
+ DefaultIcon,
34839
+ DivIcon,
34840
+ DivOverlay,
34841
+ exports_DomEvent as DomEvent,
34842
+ exports_DomUtil as DomUtil,
34843
+ DoubleClickZoomHandler,
34844
+ DragHandler,
34845
+ Draggable,
34846
+ EARTH_RADIUS2 as EARTH_RADIUS,
34847
+ EPSG3395,
34848
+ EPSG3857,
34849
+ EPSG4326,
34850
+ EPSG900913,
34851
+ EarthCRS,
34852
+ Evented,
34853
+ FeatureGroup,
34854
+ FullscreenControl,
34855
+ GEOM_TYPE_NAMES,
34856
+ GeoJSON,
34857
+ GeoJSONClusterSource,
34858
+ GeoJSONTileSource,
34859
+ GeocoderControl,
34860
+ GridLayer,
34861
+ Handler,
34862
+ HeatmapLayer,
34863
+ HillshadeLayer,
34864
+ Icon,
34865
+ ImageOverlay,
34866
+ IndexedDBOfflineStore,
34867
+ InvalidGeometryError,
34868
+ KDBush,
34869
+ KeyboardHandler,
34870
+ LatLng,
34871
+ LatLngBounds,
34872
+ Layer,
34873
+ LayerGroup,
34874
+ LayersControl,
34875
+ exports_LineUtil as LineUtil,
34876
+ LocateControl,
34877
+ LoopDetector,
34878
+ MVT_GEOM_LINESTRING,
34879
+ MVT_GEOM_POINT,
34880
+ MVT_GEOM_POLYGON,
34881
+ MVT_GEOM_UNKNOWN,
34882
+ Map2 as Map,
34883
+ Marker,
34884
+ MarkerDrag,
34885
+ MemoryOfflineStore,
34886
+ NavigationControl,
34887
+ OFFLINE_MAPS_EVENTS,
34888
+ OfflineDirections,
34889
+ OfflineGeocoder,
34890
+ OfflineMaps,
34891
+ OfflineMapsControl,
34892
+ PMTILES_PROTOCOL,
34893
+ Path,
34894
+ Pbf,
34895
+ PinchZoomHandler,
34896
+ Point,
34897
+ exports_PolyUtil as PolyUtil,
34898
+ Polygon,
34899
+ Polyline,
34900
+ Popup,
34901
+ PosAnimation,
34902
+ exports_projection as Projection,
34903
+ RTree,
34904
+ RasterDEMLayer,
34905
+ Rectangle,
34906
+ Renderer,
34907
+ RoadGraph,
34908
+ RouteEditor,
34909
+ RunTrailLayer,
34910
+ SEARCH_CATEGORIES,
34911
+ SEARCH_EVENTS,
34912
+ SVG,
34913
+ SVGOverlay,
34914
+ ScaleControl,
34915
+ ScrollWheelZoomHandler,
34916
+ SearchControl,
34917
+ SearchEngine,
34918
+ SearchHistory,
34919
+ SimpleCRS,
34920
+ StreetIndex,
34921
+ TURN_BY_TURN_EVENTS,
34922
+ TapHoldHandler,
34923
+ TerrainSource,
34924
+ TerritoryLayer,
34925
+ TerritoryLog,
34926
+ TerritoryStore,
34927
+ TileCache,
34928
+ TileLayer,
34929
+ Tooltip,
34930
+ Transformation,
34931
+ TsMap,
34932
+ TurnByTurn,
34933
+ TwoFingerPitchHandler,
34934
+ TwoFingerRotateHandler,
34935
+ exports_Util as Util,
34936
+ VectorTile,
34937
+ VectorTileFeature,
34938
+ VectorTileLayer,
34939
+ VectorTileMapLayer,
34940
+ VideoOverlay,
34941
+ WMSTileLayer,
34942
+ WebGLTileRenderer,
34943
+ WebGLUnsupportedError,
34944
+ ZoomControl,
34945
+ activeOfflineMaps,
34946
+ badge,
34947
+ boundsToCraftRegion,
34948
+ buildTerrainMesh,
34949
+ cachedFetch,
34950
+ cameraToCamera,
34951
+ categoriesMatching,
34952
+ categoryForQuery,
34953
+ circle,
34954
+ circleMarker,
34955
+ clearPMTilesArchives,
34956
+ compareEvents2 as compareEvents,
34957
+ computeTileCoords,
34958
+ contains,
34959
+ control2 as control,
34960
+ latLngToCraftCoord as coordinateFromLatLng,
34961
+ craftBoundingBoxToBounds,
34962
+ craftCameraToOptions,
34963
+ craftCircleToCircle,
34964
+ craftCoordToLatLng,
34965
+ craftMarkerToMarker,
34966
+ craftPolygonToPolygon,
34967
+ craftPolylineToPolyline,
34968
+ craftRegionToBounds,
34969
+ createFilesystemBackend,
34970
+ createFilesystemTileCache,
34971
+ createMap,
34972
+ createMapView,
34973
+ decodeElevationGrid,
34974
+ decodeMapboxRGB,
34975
+ decodeTerrariumRGB,
34976
+ defaultMapCamera,
34977
+ defaultMapConfiguration,
34978
+ describePlace,
34979
+ detectLoop,
34980
+ deviation,
34981
+ difference,
34982
+ distanceMeters2 as distanceMeters,
34983
+ divIcon,
34984
+ earcut,
34985
+ exports_easing as easing,
34986
+ extractTile,
34987
+ featureGroup,
34988
+ flatten,
34989
+ formatArea,
34990
+ formatBytes,
34991
+ formatDistance2 as formatDistance,
34992
+ formatDuration,
34993
+ geoJSON,
34994
+ geoJson,
34995
+ getDefaultCache,
34996
+ getElevationDecoder,
34997
+ getPMTilesArchive,
34998
+ gridLayer,
34999
+ haversine3 as haversine,
35000
+ heatmapLayer,
35001
+ icon,
35002
+ iconForKind,
35003
+ imageOverlay,
35004
+ intersection,
35005
+ intersects2 as intersects,
35006
+ isPMTilesUrl,
35007
+ kindLabel,
35008
+ craftCoordToLatLng as latLngFromCoordinate,
35009
+ latLngToCraftCoord,
35010
+ layerGroup,
35011
+ map2 as map,
35012
+ mapEventName,
35013
+ marker2 as marker,
35014
+ markerColorHex,
35015
+ matchScore,
35016
+ mercatorX,
35017
+ mercatorY,
35018
+ mergePlaces,
35019
+ merge as mergeSearchResults,
35020
+ multiPolygonArea,
35021
+ nameFromLabels,
35022
+ offlineFetch,
35023
+ offlineMaps,
35024
+ offlineMapsNow,
35025
+ parsePMTilesTileUrl,
35026
+ placeFromResult,
35027
+ planArea,
35028
+ pmtilesArchiveUrl,
35029
+ pmtilesFetch,
35030
+ pmtilesSourceUrl,
35031
+ pmtilesTileJSON,
35032
+ pmtilesTileUrl,
35033
+ polygon,
35034
+ polygonArea,
35035
+ polyline,
35036
+ popup,
35037
+ prepareClaim,
35038
+ probeCapabilities,
35039
+ rasterDEMLayer,
35040
+ readPMTilesTile,
35041
+ rectangle,
35042
+ regionFromBounds,
35043
+ renderStaticMap,
35044
+ resetDefaultCache,
35045
+ resolveSelfIntersections,
35046
+ ringArea2 as ringArea,
35047
+ ringPerimeter,
35048
+ routeEditor,
35049
+ routeOnGraph,
35050
+ runTrailLayer,
35051
+ sampleElevationBilinear,
35052
+ saveOfflineRegion,
35053
+ saveOfflineRegionToFilesystem,
35054
+ selfIntersects,
35055
+ exports_services as services,
35056
+ setOfflineMaps,
35057
+ setPMTilesArchive,
35058
+ simplifyTrack,
35059
+ splitSelfIntersecting,
35060
+ staticMapSvg,
35061
+ staticMapView,
35062
+ staticMapZoom,
35063
+ strokePatternDashes,
35064
+ exports_styles as styles,
35065
+ supportsAdvancedRendering,
35066
+ svgOverlay,
35067
+ territoryLayer,
35068
+ tileLayer,
35069
+ toBounds,
35070
+ toLatLng,
35071
+ toLatLngBounds,
35072
+ toPoint,
35073
+ toTransformation,
35074
+ tooltip,
35075
+ tsMapsProvider,
35076
+ turnByTurn,
35077
+ union,
35078
+ unwrapRing,
35079
+ validateRing,
35080
+ vectorTileLayer,
35081
+ version,
35082
+ videoOverlay,
35083
+ withOfflineFallback,
35084
+ withPMTiles,
35085
+ xor
35143
35086
  };