@nika-js/onlymap 0.2.3 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/.vscode/onlymap.code-snippets +13 -0
  2. package/LICENSE.md +4 -0
  3. package/README.md +30 -7
  4. package/THIRD-PARTY-LICENSES.md +7874 -0
  5. package/dist/{Arrow.dom-7AXne1TU.js → Arrow.dom-BNjbQ9jb.js} +23 -23
  6. package/dist/LercDecode.es-CVmNpXBp.js +303 -0
  7. package/dist/assets/LercDecode.es-BJb2dZu5.js +305 -0
  8. package/dist/assets/__vite-browser-external-DDArsqdc.js +29 -0
  9. package/dist/assets/lerc-wasm.wasm +0 -0
  10. package/dist/assets/lzw-BY5a_5nb.js +83 -0
  11. package/dist/assets/worker-DtIrTJB7.js +305 -0
  12. package/dist/assets/zstd-QGAv3PMm.js +383 -0
  13. package/dist/{basemap-BdvB-SHy.js → basemap-BSb-g03Z.js} +5729 -5684
  14. package/dist/basemap-registry.d.ts +10 -0
  15. package/dist/basemap.d.ts +23 -0
  16. package/dist/color.d.ts +9 -0
  17. package/dist/{convert-arrow-schema-CvZ3cT5m.js → convert-arrow-schema-DrAihRf9.js} +31 -31
  18. package/dist/ctx.d.ts +3 -0
  19. package/dist/deck.d.ts +28 -0
  20. package/dist/deck.js +16 -0
  21. package/dist/elements/om-map.d.ts +29 -0
  22. package/dist/html-data.d.ts +2 -2
  23. package/dist/index-CIEkseeV.js +3108 -0
  24. package/dist/index-D67FynN5.js +594 -0
  25. package/dist/{index-CJOMgp8k.js → index-QSkZjzIL.js} +4 -4
  26. package/dist/index-WeMwLoaQ.js +1446 -0
  27. package/dist/{index-BxzDKZpu.js → index-lV5eG2Xt.js} +22439 -21347
  28. package/dist/index.d.ts +13 -0
  29. package/dist/ir-snapshot.d.ts +2 -0
  30. package/dist/ir.d.ts +10 -0
  31. package/dist/layer-registry.d.ts +15 -1
  32. package/dist/legend-spec.d.ts +66 -0
  33. package/dist/lerc-DJzRIT6z.js +30 -0
  34. package/dist/lerc-wasm.wasm +0 -0
  35. package/dist/lzw-BY5a_5nb.js +83 -0
  36. package/dist/mgrs-BY9bIvp4.js +799 -0
  37. package/dist/onlymapjs.css +1 -1
  38. package/dist/onlymapjs.js +55 -35
  39. package/dist/programmatic.d.ts +35 -0
  40. package/dist/raster-BKf1dx54.js +8843 -0
  41. package/dist/raster.d.ts +61 -0
  42. package/dist/react/om-layer.d.ts +2 -0
  43. package/dist/react.js +18 -16
  44. package/dist/{recordbatch-HRu0SMKp.js → recordbatch-Bpc0uxFn.js} +200 -200
  45. package/dist/runtime-core.d.ts +73 -1
  46. package/dist/scene-lighting.d.ts +83 -0
  47. package/dist/selection.d.ts +1 -1
  48. package/dist/snapshot.d.ts +14 -0
  49. package/dist/{table-accessors-DBjWgN0C.js → table-accessors-CYWTzpQI.js} +71 -76
  50. package/dist/terrain.d.ts +113 -0
  51. package/dist/version.d.ts +1 -1
  52. package/dist/zstd-jXobGRcq.js +14 -0
  53. package/docs/custom-layers.md +99 -0
  54. package/llms.txt +5 -5
  55. package/onlymapjs.html-data.json +163 -29
  56. package/package.json +35 -15
  57. package/skills/onlymapjs/SKILL.md +3 -1
  58. package/skills/onlymapjs/references/syntax.md +53 -3
  59. package/dist/index-BVQ0s1Zh.js +0 -1457
  60. package/dist/index-CvBHiOGD.js +0 -605
  61. package/dist/index-Vc8QfNEf.js +0 -3907
  62. package/dist/onlymapjs.umd.cjs +0 -8634
@@ -0,0 +1,3108 @@
1
+ import { ai as Bt, ak as Xt, al as Yt, am as Us } from "./index-lV5eG2Xt.js";
2
+ import { w as gs, t as Hs, f as Ws, m as Qs } from "./mgrs-BY9bIvp4.js";
3
+ import { c as Xs } from "./convert-arrow-schema-DrAihRf9.js";
4
+ import { y as Ys, A as bt, a as Ks, z as Vs, R as Zs } from "./recordbatch-Bpc0uxFn.js";
5
+ class Js {
6
+ schema;
7
+ arrowSchema;
8
+ arrowBuilders;
9
+ length;
10
+ constructor(s) {
11
+ this.schema = s, this.arrowSchema = Xs(s), this.arrowBuilders = this.arrowSchema.fields.map((a) => Ys({ type: a.type, nullValues: [null] })), this.length = 0;
12
+ }
13
+ addObjectRow(s) {
14
+ for (let a = 0; a < this.arrowBuilders.length; a++) {
15
+ const i = this.schema.fields[a].name, e = s[i];
16
+ this.arrowBuilders[a].append(e);
17
+ }
18
+ this.length++;
19
+ }
20
+ addArrayRow(s) {
21
+ for (let a = 0; a < this.arrowBuilders.length; a++)
22
+ this.arrowBuilders[a].append(s[a]);
23
+ this.length++;
24
+ }
25
+ /** Makes sure that a first batch with schema is sent even if no rows */
26
+ firstBatch() {
27
+ const s = this._getArrowRecordBatch();
28
+ return s.numCols !== 0 ? null : {
29
+ shape: "arrow-table",
30
+ batchType: "data",
31
+ length: s.numRows,
32
+ schema: this.schema,
33
+ data: new bt(s)
34
+ };
35
+ }
36
+ /** Flush the current batch if conditions are right */
37
+ flushBatch() {
38
+ const s = this._getArrowRecordBatch();
39
+ return s.numCols === 0 ? null : {
40
+ shape: "arrow-table",
41
+ batchType: "data",
42
+ length: s.numRows,
43
+ schema: this.schema,
44
+ data: new bt(s)
45
+ };
46
+ }
47
+ /** Get a last batch if any data is left */
48
+ finishBatch() {
49
+ const s = this._getArrowRecordBatch();
50
+ return this.arrowBuilders.forEach((a) => a.finish()), s.numCols === 0 ? null : {
51
+ shape: "arrow-table",
52
+ batchType: "data",
53
+ length: s.numRows,
54
+ schema: this.schema,
55
+ data: new bt(s)
56
+ };
57
+ }
58
+ /** Return a table with all the accumulated data */
59
+ finishTable() {
60
+ const s = this._getArrowRecordBatch();
61
+ return this.arrowBuilders.forEach((a) => a.finish()), {
62
+ shape: "arrow-table",
63
+ schema: this.schema,
64
+ data: new bt(s)
65
+ };
66
+ }
67
+ /** Extract a record batch flushing the currently accumulated data in the builders */
68
+ _getArrowRecordBatch() {
69
+ const { arrowBuilders: s, arrowSchema: a } = this, i = s.map((o) => o.flush()), e = i[0].length, h = new Ks(a.fields), r = new Vs(h, 0, e, 0, void 0, i);
70
+ return new Zs(a, r);
71
+ }
72
+ }
73
+ function ta(t, s) {
74
+ for (const a of t)
75
+ a.geometry.coordinates = bs(a.geometry.coordinates, s);
76
+ return t;
77
+ }
78
+ function bs(t, s) {
79
+ return sa(t) ? s(t) : t.map((a) => bs(a, s));
80
+ }
81
+ function sa(t) {
82
+ return Array.isArray(t) && Number.isFinite(t[0]) && Number.isFinite(t[1]);
83
+ }
84
+ class zt {
85
+ offset;
86
+ arrayBuffers;
87
+ ended;
88
+ maxRewindBytes;
89
+ constructor(s) {
90
+ const { maxRewindBytes: a = 0 } = s || {};
91
+ this.offset = 0, this.arrayBuffers = [], this.ended = !1, this.maxRewindBytes = a;
92
+ }
93
+ /**
94
+ * @param arrayBuffer
95
+ */
96
+ write(s) {
97
+ this.arrayBuffers.push(s);
98
+ }
99
+ end() {
100
+ this.arrayBuffers = [], this.ended = !0;
101
+ }
102
+ /**
103
+ * Has enough bytes available in array buffers
104
+ *
105
+ * @param bytes Number of bytes
106
+ * @return boolean
107
+ */
108
+ hasAvailableBytes(s) {
109
+ let a = -this.offset;
110
+ for (const i of this.arrayBuffers)
111
+ if (a += i.byteLength, a >= s)
112
+ return !0;
113
+ return !1;
114
+ }
115
+ /**
116
+ * Find offsets of byte ranges within this.arrayBuffers
117
+ *
118
+ * @param bytes Byte length to read
119
+ * @return Arrays with byte ranges pointing to this.arrayBuffers, Output type is nested array, e.g. [ [0, [1, 2]], ...]
120
+ */
121
+ findBufferOffsets(s) {
122
+ let a = -this.offset;
123
+ const i = [];
124
+ for (let e = 0; e < this.arrayBuffers.length; e++) {
125
+ const h = this.arrayBuffers[e];
126
+ if (a + h.byteLength <= 0) {
127
+ a += h.byteLength;
128
+ continue;
129
+ }
130
+ const r = a <= 0 ? Math.abs(a) : 0;
131
+ let n;
132
+ if (r + s <= h.byteLength)
133
+ return n = r + s, i.push([e, [r, n]]), i;
134
+ n = h.byteLength, i.push([e, [r, n]]), s -= h.byteLength - r, a += h.byteLength;
135
+ }
136
+ return null;
137
+ }
138
+ /**
139
+ * Get the required number of bytes from the iterator
140
+ *
141
+ * @param bytes Number of bytes
142
+ * @return DataView with data
143
+ */
144
+ getDataView(s) {
145
+ const a = this.findBufferOffsets(s);
146
+ if (!a && this.ended)
147
+ throw new Error("binary data exhausted");
148
+ if (!a)
149
+ return null;
150
+ if (a.length === 1) {
151
+ const [e, [h, r]] = a[0], n = this.arrayBuffers[e], o = new DataView(n, h, r - h);
152
+ return this.offset += s, this.disposeBuffers(), o;
153
+ }
154
+ const i = new DataView(this._combineArrayBuffers(a));
155
+ return this.offset += s, this.disposeBuffers(), i;
156
+ }
157
+ /**
158
+ * Dispose of old array buffers
159
+ */
160
+ disposeBuffers() {
161
+ for (; this.arrayBuffers.length > 0 && this.offset - this.maxRewindBytes >= this.arrayBuffers[0].byteLength; )
162
+ this.offset -= this.arrayBuffers[0].byteLength, this.arrayBuffers.shift();
163
+ }
164
+ /**
165
+ * Copy multiple ArrayBuffers into one contiguous ArrayBuffer
166
+ *
167
+ * In contrast to concatenateArrayBuffers, this only copies the necessary
168
+ * portions of the source arrays, rather than first copying the entire arrays
169
+ * then taking a part of them.
170
+ *
171
+ * @param bufferOffsets List of internal array offsets
172
+ * @return New contiguous ArrayBuffer
173
+ */
174
+ _combineArrayBuffers(s) {
175
+ let a = 0;
176
+ for (const h of s) {
177
+ const [r, n] = h[1];
178
+ a += n - r;
179
+ }
180
+ const i = new Uint8Array(a);
181
+ let e = 0;
182
+ for (const h of s) {
183
+ const [r, [n, o]] = h, l = new Uint8Array(this.arrayBuffers[r]);
184
+ i.set(l.subarray(n, o), e), e += o - n;
185
+ }
186
+ return i.buffer;
187
+ }
188
+ /**
189
+ * @param bytes
190
+ */
191
+ skip(s) {
192
+ this.offset += s;
193
+ }
194
+ /**
195
+ * @param bytes
196
+ */
197
+ rewind(s) {
198
+ this.offset -= s;
199
+ }
200
+ }
201
+ const U = !0, Kt = !1, aa = 9994;
202
+ function _s(t) {
203
+ const s = {
204
+ magic: t.getInt32(0, Kt),
205
+ // Length is stored as # of 2-byte words; multiply by 2 to get # of bytes
206
+ length: t.getInt32(24, Kt) * 2,
207
+ version: t.getInt32(28, U),
208
+ type: t.getInt32(32, U),
209
+ bbox: {
210
+ minX: t.getFloat64(36, U),
211
+ minY: t.getFloat64(44, U),
212
+ minZ: t.getFloat64(68, U),
213
+ minM: t.getFloat64(84, U),
214
+ maxX: t.getFloat64(52, U),
215
+ maxY: t.getFloat64(60, U),
216
+ maxZ: t.getFloat64(76, U),
217
+ maxM: t.getFloat64(92, U)
218
+ }
219
+ };
220
+ return s.magic !== aa && console.error(`SHP file: bad magic number ${s.magic}`), s.version !== 1e3 && console.error(`SHP file: bad version ${s.version}`), s;
221
+ }
222
+ const It = !0;
223
+ function ia(t, s) {
224
+ const { _maxDimensions: a = 4 } = s?.shp || {};
225
+ let i = 0;
226
+ const e = t.getInt32(i, It);
227
+ switch (i += Int32Array.BYTES_PER_ELEMENT, e) {
228
+ case 0:
229
+ return ea();
230
+ case 1:
231
+ return Dt(t, i, Math.min(2, a));
232
+ case 3:
233
+ return at(t, i, Math.min(2, a), "LineString");
234
+ case 5:
235
+ return at(t, i, Math.min(2, a), "Polygon");
236
+ case 8:
237
+ return kt(t, i, Math.min(2, a));
238
+ // GeometryZ can have 3 or 4 dimensions, since the M is not required to
239
+ // exist
240
+ case 11:
241
+ return Dt(t, i, Math.min(4, a));
242
+ case 13:
243
+ return at(t, i, Math.min(4, a), "LineString");
244
+ case 15:
245
+ return at(t, i, Math.min(4, a), "Polygon");
246
+ case 18:
247
+ return kt(t, i, Math.min(4, a));
248
+ case 21:
249
+ return Dt(t, i, Math.min(3, a));
250
+ case 23:
251
+ return at(t, i, Math.min(3, a), "LineString");
252
+ case 25:
253
+ return at(t, i, Math.min(3, a), "Polygon");
254
+ case 28:
255
+ return kt(t, i, Math.min(3, a));
256
+ default:
257
+ throw new Error(`unsupported shape type: ${e}`);
258
+ }
259
+ }
260
+ function ea() {
261
+ return null;
262
+ }
263
+ function Dt(t, s, a) {
264
+ let i;
265
+ return [i, s] = J(t, s, 1, a), {
266
+ positions: { value: i, size: a },
267
+ type: "Point"
268
+ };
269
+ }
270
+ function kt(t, s, a) {
271
+ s += 4 * Float64Array.BYTES_PER_ELEMENT;
272
+ const i = t.getInt32(s, It);
273
+ s += Int32Array.BYTES_PER_ELEMENT;
274
+ let e = null, h = null, r = null;
275
+ return [e, s] = J(t, s, i, 2), a === 4 && (s += 2 * Float64Array.BYTES_PER_ELEMENT, [r, s] = J(t, s, i, 1)), a >= 3 && (s += 2 * Float64Array.BYTES_PER_ELEMENT, [h, s] = J(t, s, i, 1)), {
276
+ positions: { value: xs(e, h, r), size: a },
277
+ type: "Point"
278
+ };
279
+ }
280
+ function at(t, s, a, i) {
281
+ s += 4 * Float64Array.BYTES_PER_ELEMENT;
282
+ const e = t.getInt32(s, It);
283
+ s += Int32Array.BYTES_PER_ELEMENT;
284
+ const h = t.getInt32(s, It);
285
+ s += Int32Array.BYTES_PER_ELEMENT;
286
+ const r = t.byteOffset + s, n = e * Int32Array.BYTES_PER_ELEMENT, o = new Int32Array(e + 1);
287
+ o.set(new Int32Array(t.buffer.slice(r, r + n))), o[e] = h, s += e * Int32Array.BYTES_PER_ELEMENT;
288
+ let l = null, c = null, f = null;
289
+ [l, s] = J(t, s, h, 2), a === 4 && (s += 2 * Float64Array.BYTES_PER_ELEMENT, [f, s] = J(t, s, h, 1)), a >= 3 && (s += 2 * Float64Array.BYTES_PER_ELEMENT, [c, s] = J(t, s, h, 1));
290
+ const u = xs(l, c, f);
291
+ if (i === "LineString")
292
+ return {
293
+ type: i,
294
+ positions: { value: u, size: a },
295
+ pathIndices: { value: o, size: 1 }
296
+ };
297
+ const v = [];
298
+ for (let d = 1; d < o.length; d++) {
299
+ const y = o[d - 1], g = o[d], x = l.subarray(y * 2, g * 2);
300
+ ha(x) > 0 && v.push(y);
301
+ }
302
+ return v.push(h), {
303
+ type: i,
304
+ positions: { value: u, size: a },
305
+ primitivePolygonIndices: { value: o, size: 1 },
306
+ // TODO: Dynamically choose Uint32Array over Uint16Array only when
307
+ // necessary. I believe the implementation requires nPoints to be the
308
+ // largest value in the array, so you should be able to use Uint32Array only
309
+ // when nPoints > 65535.
310
+ polygonIndices: { value: new Uint32Array(v), size: 1 }
311
+ };
312
+ }
313
+ function J(t, s, a, i) {
314
+ const e = t.byteOffset + s, h = a * i * Float64Array.BYTES_PER_ELEMENT;
315
+ return [
316
+ new Float64Array(t.buffer.slice(e, e + h)),
317
+ s + h
318
+ ];
319
+ }
320
+ function xs(t, s, a) {
321
+ if (!(s || a))
322
+ return t;
323
+ let i = t.length, e = 2;
324
+ a && a.length && (i += a.length, e++), s && s.length && (i += s.length, e++);
325
+ const h = new Float64Array(i);
326
+ for (let r = 0; r < t.length / 2; r++)
327
+ h[e * r] = t[r * 2], h[e * r + 1] = t[r * 2 + 1];
328
+ if (a && a.length)
329
+ for (let r = 0; r < a.length; r++)
330
+ h[e * r + 2] = a[r];
331
+ if (s && s.length)
332
+ for (let r = 0; r < s.length; r++)
333
+ h[e * r + (e - 1)] = s[r];
334
+ return h;
335
+ }
336
+ function ha(t) {
337
+ return Math.sign(ra(t));
338
+ }
339
+ function ra(t) {
340
+ let s = 0;
341
+ const a = t.length / 2 - 1;
342
+ for (let i = 0; i < a; i++)
343
+ s += (t[i * 2] + t[(i + 1) * 2]) * (t[i * 2 + 1] - t[(i + 1) * 2 + 1]);
344
+ return s / 2;
345
+ }
346
+ const na = !0, Vt = !1, oa = 100, ot = 12, G = {
347
+ EXPECTING_HEADER: 0,
348
+ EXPECTING_RECORD: 1,
349
+ END: 2,
350
+ ERROR: 3
351
+ };
352
+ class ws {
353
+ options = {};
354
+ binaryReader = new zt({ maxRewindBytes: ot });
355
+ state = G.EXPECTING_HEADER;
356
+ result = {
357
+ geometries: [],
358
+ // Initialize with number values to make TS happy
359
+ // These are initialized for real in STATE.EXPECTING_HEADER
360
+ progress: {
361
+ bytesTotal: NaN,
362
+ bytesUsed: NaN,
363
+ rows: NaN
364
+ },
365
+ currentIndex: NaN
366
+ };
367
+ constructor(s) {
368
+ this.options = s;
369
+ }
370
+ write(s) {
371
+ this.binaryReader.write(s), this.state = Jt(this.state, this.result, this.binaryReader, this.options);
372
+ }
373
+ end() {
374
+ this.binaryReader.end(), this.state = Jt(this.state, this.result, this.binaryReader, this.options), this.state !== G.END && (this.state = G.ERROR, this.result.error = "SHP incomplete file");
375
+ }
376
+ }
377
+ function Zt(t, s) {
378
+ const a = new ws(s);
379
+ return a.write(t), a.end(), a.result;
380
+ }
381
+ async function* la(t, s) {
382
+ const a = new ws(s);
383
+ let i = !1;
384
+ for await (const e of Bt(t))
385
+ a.write(e), !i && a.result.header && (i = !0, yield a.result.header), a.result.geometries.length > 0 && (yield a.result.geometries, a.result.geometries = []);
386
+ a.end(), a.result.geometries.length > 0 && (yield a.result.geometries);
387
+ }
388
+ function Jt(t, s, a, i) {
389
+ for (; ; )
390
+ try {
391
+ switch (t) {
392
+ case G.ERROR:
393
+ case G.END:
394
+ return t;
395
+ case G.EXPECTING_HEADER:
396
+ const e = a.getDataView(oa);
397
+ if (!e)
398
+ return t;
399
+ s.header = _s(e), s.progress = {
400
+ bytesUsed: 0,
401
+ bytesTotal: s.header.length,
402
+ rows: 0
403
+ }, s.currentIndex = 1, t = G.EXPECTING_RECORD;
404
+ break;
405
+ case G.EXPECTING_RECORD:
406
+ for (; a.hasAvailableBytes(ot); ) {
407
+ const h = a.getDataView(ot), r = {
408
+ recordNumber: h.getInt32(0, Vt),
409
+ // 2 byte words; includes the four words of record header
410
+ byteLength: h.getInt32(4, Vt) * 2,
411
+ // This is actually part of the record, not the header...
412
+ type: h.getInt32(8, na)
413
+ };
414
+ if (!a.hasAvailableBytes(r.byteLength - 4))
415
+ return a.rewind(ot), t;
416
+ if (r.byteLength < 4 || r.type !== s.header?.type || r.recordNumber !== s.currentIndex)
417
+ a.rewind(ot - 4);
418
+ else {
419
+ a.rewind(4);
420
+ const o = a.getDataView(r.byteLength), l = ia(o, i);
421
+ s.geometries.push(l), s.currentIndex++, s.progress.rows = s.currentIndex - 1;
422
+ }
423
+ }
424
+ return a.ended && (t = G.END), t;
425
+ default:
426
+ return t = G.ERROR, s.error = `illegal parser state ${t}`, t;
427
+ }
428
+ } catch (e) {
429
+ return t = G.ERROR, s.error = `SHP parsing failed: ${e?.message}`, t;
430
+ }
431
+ }
432
+ const ca = "4.4.3", Es = [0, 0, 39, 10], fa = {
433
+ dataType: null,
434
+ batchType: null,
435
+ name: "SHP",
436
+ id: "shp",
437
+ module: "shapefile",
438
+ version: ca,
439
+ worker: !0,
440
+ category: "geometry",
441
+ extensions: ["shp"],
442
+ mimeTypes: ["application/octet-stream"],
443
+ // ISSUE: This also identifies SHX files, which are identical to SHP for the first 100 bytes...
444
+ tests: [new Uint8Array(Es).buffer],
445
+ options: {
446
+ shp: {
447
+ _maxDimensions: 4
448
+ }
449
+ }
450
+ }, ps = {
451
+ ...fa,
452
+ parse: async (t, s) => Zt(t, s),
453
+ parseSync: Zt,
454
+ parseInBatches: (t, s) => la(t, s)
455
+ };
456
+ function ua(t) {
457
+ t("EPSG:4326", "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"), t("EPSG:4269", "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"), t("EPSG:3857", "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"), t.WGS84 = t["EPSG:4326"], t["EPSG:3785"] = t["EPSG:3857"], t.GOOGLE = t["EPSG:3857"], t["EPSG:900913"] = t["EPSG:3857"], t["EPSG:102113"] = t["EPSG:3857"];
458
+ }
459
+ var tt = 1, st = 2, Ma = 4, qt = 5, ct = 484813681109536e-20, M = Math.PI / 2, va = 0.16666666666666666, da = 0.04722222222222222, ya = 0.022156084656084655, m = 1e-10, D = 0.017453292519943295, Q = 57.29577951308232, p = Math.PI / 4, Ft = Math.PI * 2, N = 3.14159265359, T = {};
460
+ T.greenwich = 0;
461
+ T.lisbon = -9.131906111111;
462
+ T.paris = 2.337229166667;
463
+ T.bogota = -74.080916666667;
464
+ T.madrid = -3.687938888889;
465
+ T.rome = 12.452333333333;
466
+ T.bern = 7.439583333333;
467
+ T.jakarta = 106.807719444444;
468
+ T.ferro = -17.666666666667;
469
+ T.brussels = 4.367975;
470
+ T.stockholm = 18.058277777778;
471
+ T.athens = 23.7163375;
472
+ T.oslo = 10.722916666667;
473
+ const ma = {
474
+ ft: { to_meter: 0.3048 },
475
+ "us-ft": { to_meter: 1200 / 3937 }
476
+ };
477
+ var ts = /[\s_\-\/\(\)]/g;
478
+ function Y(t, s) {
479
+ if (t[s])
480
+ return t[s];
481
+ for (var a = Object.keys(t), i = s.toLowerCase().replace(ts, ""), e = -1, h, r; ++e < a.length; )
482
+ if (h = a[e], r = h.toLowerCase().replace(ts, ""), r === i)
483
+ return t[h];
484
+ }
485
+ function Gt(t) {
486
+ var s = {}, a = t.split("+").map(function(n) {
487
+ return n.trim();
488
+ }).filter(function(n) {
489
+ return n;
490
+ }).reduce(function(n, o) {
491
+ var l = o.split("=");
492
+ return l.push(!0), n[l[0].toLowerCase()] = l[1], n;
493
+ }, {}), i, e, h, r = {
494
+ proj: "projName",
495
+ datum: "datumCode",
496
+ rf: function(n) {
497
+ s.rf = parseFloat(n);
498
+ },
499
+ lat_0: function(n) {
500
+ s.lat0 = n * D;
501
+ },
502
+ lat_1: function(n) {
503
+ s.lat1 = n * D;
504
+ },
505
+ lat_2: function(n) {
506
+ s.lat2 = n * D;
507
+ },
508
+ lat_ts: function(n) {
509
+ s.lat_ts = n * D;
510
+ },
511
+ lon_0: function(n) {
512
+ s.long0 = n * D;
513
+ },
514
+ lon_1: function(n) {
515
+ s.long1 = n * D;
516
+ },
517
+ lon_2: function(n) {
518
+ s.long2 = n * D;
519
+ },
520
+ alpha: function(n) {
521
+ s.alpha = parseFloat(n) * D;
522
+ },
523
+ lonc: function(n) {
524
+ s.longc = n * D;
525
+ },
526
+ x_0: function(n) {
527
+ s.x0 = parseFloat(n);
528
+ },
529
+ y_0: function(n) {
530
+ s.y0 = parseFloat(n);
531
+ },
532
+ k_0: function(n) {
533
+ s.k0 = parseFloat(n);
534
+ },
535
+ k: function(n) {
536
+ s.k0 = parseFloat(n);
537
+ },
538
+ a: function(n) {
539
+ s.a = parseFloat(n);
540
+ },
541
+ b: function(n) {
542
+ s.b = parseFloat(n);
543
+ },
544
+ r_a: function() {
545
+ s.R_A = !0;
546
+ },
547
+ zone: function(n) {
548
+ s.zone = parseInt(n, 10);
549
+ },
550
+ south: function() {
551
+ s.utmSouth = !0;
552
+ },
553
+ towgs84: function(n) {
554
+ s.datum_params = n.split(",").map(function(o) {
555
+ return parseFloat(o);
556
+ });
557
+ },
558
+ to_meter: function(n) {
559
+ s.to_meter = parseFloat(n);
560
+ },
561
+ units: function(n) {
562
+ s.units = n;
563
+ var o = Y(ma, n);
564
+ o && (s.to_meter = o.to_meter);
565
+ },
566
+ from_greenwich: function(n) {
567
+ s.from_greenwich = n * D;
568
+ },
569
+ pm: function(n) {
570
+ var o = Y(T, n);
571
+ s.from_greenwich = (o || parseFloat(n)) * D;
572
+ },
573
+ nadgrids: function(n) {
574
+ n === "@null" ? s.datumCode = "none" : s.nadgrids = n;
575
+ },
576
+ axis: function(n) {
577
+ var o = "ewnsud";
578
+ n.length === 3 && o.indexOf(n.substr(0, 1)) !== -1 && o.indexOf(n.substr(1, 1)) !== -1 && o.indexOf(n.substr(2, 1)) !== -1 && (s.axis = n);
579
+ }
580
+ };
581
+ for (i in a)
582
+ e = a[i], i in r ? (h = r[i], typeof h == "function" ? h(e) : s[h] = e) : s[i] = e;
583
+ return typeof s.datumCode == "string" && s.datumCode !== "WGS84" && (s.datumCode = s.datumCode.toLowerCase()), s;
584
+ }
585
+ function k(t) {
586
+ var s = this;
587
+ if (arguments.length === 2) {
588
+ var a = arguments[1];
589
+ typeof a == "string" ? a.charAt(0) === "+" ? k[t] = Gt(arguments[1]) : k[t] = gs(arguments[1]) : k[t] = a;
590
+ } else if (arguments.length === 1) {
591
+ if (Array.isArray(t))
592
+ return t.map(function(i) {
593
+ Array.isArray(i) ? k.apply(s, i) : k(i);
594
+ });
595
+ if (typeof t == "string") {
596
+ if (t in k)
597
+ return k[t];
598
+ } else "EPSG" in t ? k["EPSG:" + t.EPSG] = t : "ESRI" in t ? k["ESRI:" + t.ESRI] = t : "IAU2000" in t ? k["IAU2000:" + t.IAU2000] = t : console.log(t);
599
+ return;
600
+ }
601
+ }
602
+ ua(k);
603
+ function ga(t) {
604
+ return typeof t == "string";
605
+ }
606
+ function ba(t) {
607
+ return t in k;
608
+ }
609
+ var _a = ["PROJECTEDCRS", "PROJCRS", "GEOGCS", "GEOCCS", "PROJCS", "LOCAL_CS", "GEODCRS", "GEODETICCRS", "GEODETICDATUM", "ENGCRS", "ENGINEERINGCRS"];
610
+ function xa(t) {
611
+ return _a.some(function(s) {
612
+ return t.indexOf(s) > -1;
613
+ });
614
+ }
615
+ var wa = ["3857", "900913", "3785", "102113"];
616
+ function Ea(t) {
617
+ var s = Y(t, "authority");
618
+ if (s) {
619
+ var a = Y(s, "epsg");
620
+ return a && wa.indexOf(a) > -1;
621
+ }
622
+ }
623
+ function pa(t) {
624
+ var s = Y(t, "extension");
625
+ if (s)
626
+ return Y(s, "proj4");
627
+ }
628
+ function Ra(t) {
629
+ return t[0] === "+";
630
+ }
631
+ function Ia(t) {
632
+ if (ga(t)) {
633
+ if (ba(t))
634
+ return k[t];
635
+ if (xa(t)) {
636
+ var s = gs(t);
637
+ if (Ea(s))
638
+ return k["EPSG:3857"];
639
+ var a = pa(s);
640
+ return a ? Gt(a) : s;
641
+ }
642
+ if (Ra(t))
643
+ return Gt(t);
644
+ } else
645
+ return t;
646
+ }
647
+ function ss(t, s) {
648
+ t = t || {};
649
+ var a, i;
650
+ if (!s)
651
+ return t;
652
+ for (i in s)
653
+ a = s[i], a !== void 0 && (t[i] = a);
654
+ return t;
655
+ }
656
+ function W(t, s, a) {
657
+ var i = t * s;
658
+ return a / Math.sqrt(1 - i * i);
659
+ }
660
+ function Mt(t) {
661
+ return t < 0 ? -1 : 1;
662
+ }
663
+ function b(t) {
664
+ return Math.abs(t) <= N ? t : t - Mt(t) * Ft;
665
+ }
666
+ function j(t, s, a) {
667
+ var i = t * a, e = 0.5 * t;
668
+ return i = Math.pow((1 - i) / (1 + i), e), Math.tan(0.5 * (M - s)) / i;
669
+ }
670
+ function ut(t, s) {
671
+ for (var a = 0.5 * t, i, e, h = M - 2 * Math.atan(s), r = 0; r <= 15; r++)
672
+ if (i = t * Math.sin(h), e = M - 2 * Math.atan(s * Math.pow((1 - i) / (1 + i), a)) - h, h += e, Math.abs(e) <= 1e-10)
673
+ return h;
674
+ return -9999;
675
+ }
676
+ function Pa() {
677
+ var t = this.b / this.a;
678
+ this.es = 1 - t * t, "x0" in this || (this.x0 = 0), "y0" in this || (this.y0 = 0), this.e = Math.sqrt(this.es), this.lat_ts ? this.sphere ? this.k0 = Math.cos(this.lat_ts) : this.k0 = W(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) : this.k0 || (this.k ? this.k0 = this.k : this.k0 = 1);
679
+ }
680
+ function Sa(t) {
681
+ var s = t.x, a = t.y;
682
+ if (a * Q > 90 && a * Q < -90 && s * Q > 180 && s * Q < -180)
683
+ return null;
684
+ var i, e;
685
+ if (Math.abs(Math.abs(a) - M) <= m)
686
+ return null;
687
+ if (this.sphere)
688
+ i = this.x0 + this.a * this.k0 * b(s - this.long0), e = this.y0 + this.a * this.k0 * Math.log(Math.tan(p + 0.5 * a));
689
+ else {
690
+ var h = Math.sin(a), r = j(this.e, a, h);
691
+ i = this.x0 + this.a * this.k0 * b(s - this.long0), e = this.y0 - this.a * this.k0 * Math.log(r);
692
+ }
693
+ return t.x = i, t.y = e, t;
694
+ }
695
+ function Aa(t) {
696
+ var s = t.x - this.x0, a = t.y - this.y0, i, e;
697
+ if (this.sphere)
698
+ e = M - 2 * Math.atan(Math.exp(-a / (this.a * this.k0)));
699
+ else {
700
+ var h = Math.exp(-a / (this.a * this.k0));
701
+ if (e = ut(this.e, h), e === -9999)
702
+ return null;
703
+ }
704
+ return i = b(this.long0 + s / (this.a * this.k0)), t.x = i, t.y = e, t;
705
+ }
706
+ var Na = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"];
707
+ const Ba = {
708
+ init: Pa,
709
+ forward: Sa,
710
+ inverse: Aa,
711
+ names: Na
712
+ };
713
+ function Ca() {
714
+ }
715
+ function as(t) {
716
+ return t;
717
+ }
718
+ var Da = ["longlat", "identity"];
719
+ const ka = {
720
+ init: Ca,
721
+ forward: as,
722
+ inverse: as,
723
+ names: Da
724
+ };
725
+ var La = [Ba, ka], pt = {}, Pt = [];
726
+ function Rs(t, s) {
727
+ var a = Pt.length;
728
+ return t.names ? (Pt[a] = t, t.names.forEach(function(i) {
729
+ pt[i.toLowerCase()] = a;
730
+ }), this) : (console.log(s), !0);
731
+ }
732
+ function $a(t) {
733
+ if (!t)
734
+ return !1;
735
+ var s = t.toLowerCase();
736
+ if (typeof pt[s] < "u" && Pt[pt[s]])
737
+ return Pt[pt[s]];
738
+ }
739
+ function Oa() {
740
+ La.forEach(Rs);
741
+ }
742
+ const Ta = {
743
+ start: Oa,
744
+ add: Rs,
745
+ get: $a
746
+ };
747
+ var _ = {};
748
+ _.MERIT = {
749
+ a: 6378137,
750
+ rf: 298.257,
751
+ ellipseName: "MERIT 1983"
752
+ };
753
+ _.SGS85 = {
754
+ a: 6378136,
755
+ rf: 298.257,
756
+ ellipseName: "Soviet Geodetic System 85"
757
+ };
758
+ _.GRS80 = {
759
+ a: 6378137,
760
+ rf: 298.257222101,
761
+ ellipseName: "GRS 1980(IUGG, 1980)"
762
+ };
763
+ _.IAU76 = {
764
+ a: 6378140,
765
+ rf: 298.257,
766
+ ellipseName: "IAU 1976"
767
+ };
768
+ _.airy = {
769
+ a: 6377563396e-3,
770
+ b: 635625691e-2,
771
+ ellipseName: "Airy 1830"
772
+ };
773
+ _.APL4 = {
774
+ a: 6378137,
775
+ rf: 298.25,
776
+ ellipseName: "Appl. Physics. 1965"
777
+ };
778
+ _.NWL9D = {
779
+ a: 6378145,
780
+ rf: 298.25,
781
+ ellipseName: "Naval Weapons Lab., 1965"
782
+ };
783
+ _.mod_airy = {
784
+ a: 6377340189e-3,
785
+ b: 6356034446e-3,
786
+ ellipseName: "Modified Airy"
787
+ };
788
+ _.andrae = {
789
+ a: 637710443e-2,
790
+ rf: 300,
791
+ ellipseName: "Andrae 1876 (Den., Iclnd.)"
792
+ };
793
+ _.aust_SA = {
794
+ a: 6378160,
795
+ rf: 298.25,
796
+ ellipseName: "Australian Natl & S. Amer. 1969"
797
+ };
798
+ _.GRS67 = {
799
+ a: 6378160,
800
+ rf: 298.247167427,
801
+ ellipseName: "GRS 67(IUGG 1967)"
802
+ };
803
+ _.bessel = {
804
+ a: 6377397155e-3,
805
+ rf: 299.1528128,
806
+ ellipseName: "Bessel 1841"
807
+ };
808
+ _.bess_nam = {
809
+ a: 6377483865e-3,
810
+ rf: 299.1528128,
811
+ ellipseName: "Bessel 1841 (Namibia)"
812
+ };
813
+ _.clrk66 = {
814
+ a: 63782064e-1,
815
+ b: 63565838e-1,
816
+ ellipseName: "Clarke 1866"
817
+ };
818
+ _.clrk80 = {
819
+ a: 6378249145e-3,
820
+ rf: 293.4663,
821
+ ellipseName: "Clarke 1880 mod."
822
+ };
823
+ _.clrk58 = {
824
+ a: 6378293645208759e-9,
825
+ rf: 294.2606763692654,
826
+ ellipseName: "Clarke 1858"
827
+ };
828
+ _.CPM = {
829
+ a: 63757387e-1,
830
+ rf: 334.29,
831
+ ellipseName: "Comm. des Poids et Mesures 1799"
832
+ };
833
+ _.delmbr = {
834
+ a: 6376428,
835
+ rf: 311.5,
836
+ ellipseName: "Delambre 1810 (Belgium)"
837
+ };
838
+ _.engelis = {
839
+ a: 637813605e-2,
840
+ rf: 298.2566,
841
+ ellipseName: "Engelis 1985"
842
+ };
843
+ _.evrst30 = {
844
+ a: 6377276345e-3,
845
+ rf: 300.8017,
846
+ ellipseName: "Everest 1830"
847
+ };
848
+ _.evrst48 = {
849
+ a: 6377304063e-3,
850
+ rf: 300.8017,
851
+ ellipseName: "Everest 1948"
852
+ };
853
+ _.evrst56 = {
854
+ a: 6377301243e-3,
855
+ rf: 300.8017,
856
+ ellipseName: "Everest 1956"
857
+ };
858
+ _.evrst69 = {
859
+ a: 6377295664e-3,
860
+ rf: 300.8017,
861
+ ellipseName: "Everest 1969"
862
+ };
863
+ _.evrstSS = {
864
+ a: 6377298556e-3,
865
+ rf: 300.8017,
866
+ ellipseName: "Everest (Sabah & Sarawak)"
867
+ };
868
+ _.fschr60 = {
869
+ a: 6378166,
870
+ rf: 298.3,
871
+ ellipseName: "Fischer (Mercury Datum) 1960"
872
+ };
873
+ _.fschr60m = {
874
+ a: 6378155,
875
+ rf: 298.3,
876
+ ellipseName: "Fischer 1960"
877
+ };
878
+ _.fschr68 = {
879
+ a: 6378150,
880
+ rf: 298.3,
881
+ ellipseName: "Fischer 1968"
882
+ };
883
+ _.helmert = {
884
+ a: 6378200,
885
+ rf: 298.3,
886
+ ellipseName: "Helmert 1906"
887
+ };
888
+ _.hough = {
889
+ a: 6378270,
890
+ rf: 297,
891
+ ellipseName: "Hough"
892
+ };
893
+ _.intl = {
894
+ a: 6378388,
895
+ rf: 297,
896
+ ellipseName: "International 1909 (Hayford)"
897
+ };
898
+ _.kaula = {
899
+ a: 6378163,
900
+ rf: 298.24,
901
+ ellipseName: "Kaula 1961"
902
+ };
903
+ _.lerch = {
904
+ a: 6378139,
905
+ rf: 298.257,
906
+ ellipseName: "Lerch 1979"
907
+ };
908
+ _.mprts = {
909
+ a: 6397300,
910
+ rf: 191,
911
+ ellipseName: "Maupertius 1738"
912
+ };
913
+ _.new_intl = {
914
+ a: 63781575e-1,
915
+ b: 63567722e-1,
916
+ ellipseName: "New International 1967"
917
+ };
918
+ _.plessis = {
919
+ a: 6376523,
920
+ rf: 6355863,
921
+ ellipseName: "Plessis 1817 (France)"
922
+ };
923
+ _.krass = {
924
+ a: 6378245,
925
+ rf: 298.3,
926
+ ellipseName: "Krassovsky, 1942"
927
+ };
928
+ _.SEasia = {
929
+ a: 6378155,
930
+ b: 63567733205e-4,
931
+ ellipseName: "Southeast Asia"
932
+ };
933
+ _.walbeck = {
934
+ a: 6376896,
935
+ b: 63558348467e-4,
936
+ ellipseName: "Walbeck"
937
+ };
938
+ _.WGS60 = {
939
+ a: 6378165,
940
+ rf: 298.3,
941
+ ellipseName: "WGS 60"
942
+ };
943
+ _.WGS66 = {
944
+ a: 6378145,
945
+ rf: 298.25,
946
+ ellipseName: "WGS 66"
947
+ };
948
+ _.WGS7 = {
949
+ a: 6378135,
950
+ rf: 298.26,
951
+ ellipseName: "WGS 72"
952
+ };
953
+ var qa = _.WGS84 = {
954
+ a: 6378137,
955
+ rf: 298.257223563,
956
+ ellipseName: "WGS 84"
957
+ };
958
+ _.sphere = {
959
+ a: 6370997,
960
+ b: 6370997,
961
+ ellipseName: "Normal Sphere (r=6370997)"
962
+ };
963
+ function Fa(t, s, a, i) {
964
+ var e = t * t, h = s * s, r = (e - h) / e, n = 0;
965
+ i ? (t *= 1 - r * (va + r * (da + r * ya)), e = t * t, r = 0) : n = Math.sqrt(r);
966
+ var o = (e - h) / h;
967
+ return {
968
+ es: r,
969
+ e: n,
970
+ ep2: o
971
+ };
972
+ }
973
+ function Ga(t, s, a, i, e) {
974
+ if (!t) {
975
+ var h = Y(_, i);
976
+ h || (h = qa), t = h.a, s = h.b, a = h.rf;
977
+ }
978
+ return a && !s && (s = (1 - 1 / a) * t), (a === 0 || Math.abs(t - s) < m) && (e = !0, s = t), {
979
+ a: t,
980
+ b: s,
981
+ rf: a,
982
+ sphere: e
983
+ };
984
+ }
985
+ var C = {};
986
+ C.wgs84 = {
987
+ towgs84: "0,0,0",
988
+ ellipse: "WGS84",
989
+ datumName: "WGS84"
990
+ };
991
+ C.ch1903 = {
992
+ towgs84: "674.374,15.056,405.346",
993
+ ellipse: "bessel",
994
+ datumName: "swiss"
995
+ };
996
+ C.ggrs87 = {
997
+ towgs84: "-199.87,74.79,246.62",
998
+ ellipse: "GRS80",
999
+ datumName: "Greek_Geodetic_Reference_System_1987"
1000
+ };
1001
+ C.nad83 = {
1002
+ towgs84: "0,0,0",
1003
+ ellipse: "GRS80",
1004
+ datumName: "North_American_Datum_1983"
1005
+ };
1006
+ C.nad27 = {
1007
+ nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
1008
+ ellipse: "clrk66",
1009
+ datumName: "North_American_Datum_1927"
1010
+ };
1011
+ C.potsdam = {
1012
+ towgs84: "606.0,23.0,413.0",
1013
+ ellipse: "bessel",
1014
+ datumName: "Potsdam Rauenberg 1950 DHDN"
1015
+ };
1016
+ C.carthage = {
1017
+ towgs84: "-263.0,6.0,431.0",
1018
+ ellipse: "clark80",
1019
+ datumName: "Carthage 1934 Tunisia"
1020
+ };
1021
+ C.hermannskogel = {
1022
+ towgs84: "653.0,-212.0,449.0",
1023
+ ellipse: "bessel",
1024
+ datumName: "Hermannskogel"
1025
+ };
1026
+ C.osni52 = {
1027
+ towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
1028
+ ellipse: "airy",
1029
+ datumName: "Irish National"
1030
+ };
1031
+ C.ire65 = {
1032
+ towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
1033
+ ellipse: "mod_airy",
1034
+ datumName: "Ireland 1965"
1035
+ };
1036
+ C.rassadiran = {
1037
+ towgs84: "-133.63,-157.5,-158.62",
1038
+ ellipse: "intl",
1039
+ datumName: "Rassadiran"
1040
+ };
1041
+ C.nzgd49 = {
1042
+ towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
1043
+ ellipse: "intl",
1044
+ datumName: "New Zealand Geodetic Datum 1949"
1045
+ };
1046
+ C.osgb36 = {
1047
+ towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
1048
+ ellipse: "airy",
1049
+ datumName: "Airy 1830"
1050
+ };
1051
+ C.s_jtsk = {
1052
+ towgs84: "589,76,480",
1053
+ ellipse: "bessel",
1054
+ datumName: "S-JTSK (Ferro)"
1055
+ };
1056
+ C.beduaram = {
1057
+ towgs84: "-106,-87,188",
1058
+ ellipse: "clrk80",
1059
+ datumName: "Beduaram"
1060
+ };
1061
+ C.gunung_segara = {
1062
+ towgs84: "-403,684,41",
1063
+ ellipse: "bessel",
1064
+ datumName: "Gunung Segara Jakarta"
1065
+ };
1066
+ C.rnb72 = {
1067
+ towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",
1068
+ ellipse: "intl",
1069
+ datumName: "Reseau National Belge 1972"
1070
+ };
1071
+ function ja(t, s, a, i, e, h) {
1072
+ var r = {};
1073
+ return t === void 0 || t === "none" ? r.datum_type = qt : r.datum_type = Ma, s && (r.datum_params = s.map(parseFloat), (r.datum_params[0] !== 0 || r.datum_params[1] !== 0 || r.datum_params[2] !== 0) && (r.datum_type = tt), r.datum_params.length > 3 && (r.datum_params[3] !== 0 || r.datum_params[4] !== 0 || r.datum_params[5] !== 0 || r.datum_params[6] !== 0) && (r.datum_type = st, r.datum_params[3] *= ct, r.datum_params[4] *= ct, r.datum_params[5] *= ct, r.datum_params[6] = r.datum_params[6] / 1e6 + 1)), r.a = a, r.b = i, r.es = e, r.ep2 = h, r;
1074
+ }
1075
+ function H(t, s) {
1076
+ if (!(this instanceof H))
1077
+ return new H(t);
1078
+ s = s || function(o) {
1079
+ if (o)
1080
+ throw o;
1081
+ };
1082
+ var a = Ia(t);
1083
+ if (typeof a != "object") {
1084
+ s(t);
1085
+ return;
1086
+ }
1087
+ var i = H.projections.get(a.projName);
1088
+ if (!i) {
1089
+ s(t);
1090
+ return;
1091
+ }
1092
+ if (a.datumCode && a.datumCode !== "none") {
1093
+ var e = Y(C, a.datumCode);
1094
+ e && (a.datum_params = e.towgs84 ? e.towgs84.split(",") : null, a.ellps = e.ellipse, a.datumName = e.datumName ? e.datumName : a.datumCode);
1095
+ }
1096
+ a.k0 = a.k0 || 1, a.axis = a.axis || "enu", a.ellps = a.ellps || "wgs84";
1097
+ var h = Ga(a.a, a.b, a.rf, a.ellps, a.sphere), r = Fa(h.a, h.b, h.rf, a.R_A), n = a.datum || ja(a.datumCode, a.datum_params, h.a, h.b, r.es, r.ep2);
1098
+ ss(this, a), ss(this, i), this.a = h.a, this.b = h.b, this.rf = h.rf, this.sphere = h.sphere, this.es = r.es, this.e = r.e, this.ep2 = r.ep2, this.datum = n, this.init(), s(null, this);
1099
+ }
1100
+ H.projections = Ta;
1101
+ H.projections.start();
1102
+ function za(t, s) {
1103
+ return t.datum_type !== s.datum_type || t.a !== s.a || Math.abs(t.es - s.es) > 5e-11 ? !1 : t.datum_type === tt ? t.datum_params[0] === s.datum_params[0] && t.datum_params[1] === s.datum_params[1] && t.datum_params[2] === s.datum_params[2] : t.datum_type === st ? t.datum_params[0] === s.datum_params[0] && t.datum_params[1] === s.datum_params[1] && t.datum_params[2] === s.datum_params[2] && t.datum_params[3] === s.datum_params[3] && t.datum_params[4] === s.datum_params[4] && t.datum_params[5] === s.datum_params[5] && t.datum_params[6] === s.datum_params[6] : !0;
1104
+ }
1105
+ function Is(t, s, a) {
1106
+ var i = t.x, e = t.y, h = t.z ? t.z : 0, r, n, o, l;
1107
+ if (e < -M && e > -1.001 * M)
1108
+ e = -M;
1109
+ else if (e > M && e < 1.001 * M)
1110
+ e = M;
1111
+ else {
1112
+ if (e < -M)
1113
+ return { x: -1 / 0, y: -1 / 0, z: t.z };
1114
+ if (e > M)
1115
+ return { x: 1 / 0, y: 1 / 0, z: t.z };
1116
+ }
1117
+ return i > Math.PI && (i -= 2 * Math.PI), n = Math.sin(e), l = Math.cos(e), o = n * n, r = a / Math.sqrt(1 - s * o), {
1118
+ x: (r + h) * l * Math.cos(i),
1119
+ y: (r + h) * l * Math.sin(i),
1120
+ z: (r * (1 - s) + h) * n
1121
+ };
1122
+ }
1123
+ function Ps(t, s, a, i) {
1124
+ var e = 1e-12, h = e * e, r = 30, n, o, l, c, f, u, v, d, y, g, x, S, E, I = t.x, R = t.y, P = t.z ? t.z : 0, F, B, z;
1125
+ if (n = Math.sqrt(I * I + R * R), o = Math.sqrt(I * I + R * R + P * P), n / a < e) {
1126
+ if (F = 0, o / a < e)
1127
+ return B = M, z = -i, {
1128
+ x: t.x,
1129
+ y: t.y,
1130
+ z: t.z
1131
+ };
1132
+ } else
1133
+ F = Math.atan2(R, I);
1134
+ l = P / o, c = n / o, f = 1 / Math.sqrt(1 - s * (2 - s) * c * c), d = c * (1 - s) * f, y = l * f, E = 0;
1135
+ do
1136
+ E++, v = a / Math.sqrt(1 - s * y * y), z = n * d + P * y - v * (1 - s * y * y), u = s * v / (v + z), f = 1 / Math.sqrt(1 - u * (2 - u) * c * c), g = c * (1 - u) * f, x = l * f, S = x * d - g * y, d = g, y = x;
1137
+ while (S * S > h && E < r);
1138
+ return B = Math.atan(x / Math.abs(g)), {
1139
+ x: F,
1140
+ y: B,
1141
+ z
1142
+ };
1143
+ }
1144
+ function Ua(t, s, a) {
1145
+ if (s === tt)
1146
+ return {
1147
+ x: t.x + a[0],
1148
+ y: t.y + a[1],
1149
+ z: t.z + a[2]
1150
+ };
1151
+ if (s === st) {
1152
+ var i = a[0], e = a[1], h = a[2], r = a[3], n = a[4], o = a[5], l = a[6];
1153
+ return {
1154
+ x: l * (t.x - o * t.y + n * t.z) + i,
1155
+ y: l * (o * t.x + t.y - r * t.z) + e,
1156
+ z: l * (-n * t.x + r * t.y + t.z) + h
1157
+ };
1158
+ }
1159
+ }
1160
+ function Ha(t, s, a) {
1161
+ if (s === tt)
1162
+ return {
1163
+ x: t.x - a[0],
1164
+ y: t.y - a[1],
1165
+ z: t.z - a[2]
1166
+ };
1167
+ if (s === st) {
1168
+ var i = a[0], e = a[1], h = a[2], r = a[3], n = a[4], o = a[5], l = a[6], c = (t.x - i) / l, f = (t.y - e) / l, u = (t.z - h) / l;
1169
+ return {
1170
+ x: c + o * f - n * u,
1171
+ y: -o * c + f + r * u,
1172
+ z: n * c - r * f + u
1173
+ };
1174
+ }
1175
+ }
1176
+ function _t(t) {
1177
+ return t === tt || t === st;
1178
+ }
1179
+ function Wa(t, s, a) {
1180
+ return za(t, s) || t.datum_type === qt || s.datum_type === qt || t.es === s.es && t.a === s.a && !_t(t.datum_type) && !_t(s.datum_type) ? a : (a = Is(a, t.es, t.a), _t(t.datum_type) && (a = Ua(a, t.datum_type, t.datum_params)), _t(s.datum_type) && (a = Ha(a, s.datum_type, s.datum_params)), Ps(a, s.es, s.a, s.b));
1181
+ }
1182
+ function is(t, s, a) {
1183
+ var i = a.x, e = a.y, h = a.z || 0, r, n, o, l = {};
1184
+ for (o = 0; o < 3; o++)
1185
+ if (!(s && o === 2 && a.z === void 0))
1186
+ switch (o === 0 ? (r = i, "ew".indexOf(t.axis[o]) !== -1 ? n = "x" : n = "y") : o === 1 ? (r = e, "ns".indexOf(t.axis[o]) !== -1 ? n = "y" : n = "x") : (r = h, n = "z"), t.axis[o]) {
1187
+ case "e":
1188
+ case "w":
1189
+ case "n":
1190
+ case "s":
1191
+ l[n] = r;
1192
+ break;
1193
+ case "u":
1194
+ a[n] !== void 0 && (l.z = r);
1195
+ break;
1196
+ case "d":
1197
+ a[n] !== void 0 && (l.z = -r);
1198
+ break;
1199
+ default:
1200
+ return null;
1201
+ }
1202
+ return l;
1203
+ }
1204
+ function Ss(t) {
1205
+ var s = {
1206
+ x: t[0],
1207
+ y: t[1]
1208
+ };
1209
+ return t.length > 2 && (s.z = t[2]), t.length > 3 && (s.m = t[3]), s;
1210
+ }
1211
+ function Qa(t) {
1212
+ es(t.x), es(t.y);
1213
+ }
1214
+ function es(t) {
1215
+ if (typeof Number.isFinite == "function") {
1216
+ if (Number.isFinite(t))
1217
+ return;
1218
+ throw new TypeError("coordinates must be finite numbers");
1219
+ }
1220
+ if (typeof t != "number" || t !== t || !isFinite(t))
1221
+ throw new TypeError("coordinates must be finite numbers");
1222
+ }
1223
+ function Xa(t, s) {
1224
+ return (t.datum.datum_type === tt || t.datum.datum_type === st) && s.datumCode !== "WGS84" || (s.datum.datum_type === tt || s.datum.datum_type === st) && t.datumCode !== "WGS84";
1225
+ }
1226
+ function St(t, s, a) {
1227
+ var i;
1228
+ if (Array.isArray(a) && (a = Ss(a)), Qa(a), t.datum && s.datum && Xa(t, s) && (i = new H("WGS84"), a = St(t, i, a), t = i), t.axis !== "enu" && (a = is(t, !1, a)), t.projName === "longlat")
1229
+ a = {
1230
+ x: a.x * D,
1231
+ y: a.y * D,
1232
+ z: a.z || 0
1233
+ };
1234
+ else if (t.to_meter && (a = {
1235
+ x: a.x * t.to_meter,
1236
+ y: a.y * t.to_meter,
1237
+ z: a.z || 0
1238
+ }), a = t.inverse(a), !a)
1239
+ return;
1240
+ return t.from_greenwich && (a.x += t.from_greenwich), a = Wa(t.datum, s.datum, a), s.from_greenwich && (a = {
1241
+ x: a.x - s.from_greenwich,
1242
+ y: a.y,
1243
+ z: a.z || 0
1244
+ }), s.projName === "longlat" ? a = {
1245
+ x: a.x * Q,
1246
+ y: a.y * Q,
1247
+ z: a.z || 0
1248
+ } : (a = s.forward(a), s.to_meter && (a = {
1249
+ x: a.x / s.to_meter,
1250
+ y: a.y / s.to_meter,
1251
+ z: a.z || 0
1252
+ })), s.axis !== "enu" ? is(s, !0, a) : a;
1253
+ }
1254
+ var hs = H("WGS84");
1255
+ function Lt(t, s, a) {
1256
+ var i, e, h;
1257
+ return Array.isArray(a) ? (i = St(t, s, a) || { x: NaN, y: NaN }, a.length > 2 ? typeof t.name < "u" && t.name === "geocent" || typeof s.name < "u" && s.name === "geocent" ? typeof i.z == "number" ? [i.x, i.y, i.z].concat(a.splice(3)) : [i.x, i.y, a[2]].concat(a.splice(3)) : [i.x, i.y].concat(a.splice(2)) : [i.x, i.y]) : (e = St(t, s, a), h = Object.keys(a), h.length === 2 || h.forEach(function(r) {
1258
+ if (typeof t.name < "u" && t.name === "geocent" || typeof s.name < "u" && s.name === "geocent") {
1259
+ if (r === "x" || r === "y" || r === "z")
1260
+ return;
1261
+ } else if (r === "x" || r === "y")
1262
+ return;
1263
+ e[r] = a[r];
1264
+ }), e);
1265
+ }
1266
+ function rs(t) {
1267
+ return t instanceof H ? t : t.oProj ? t.oProj : H(t);
1268
+ }
1269
+ function q(t, s, a) {
1270
+ t = rs(t);
1271
+ var i = !1, e;
1272
+ return typeof s > "u" ? (s = t, t = hs, i = !0) : (typeof s.x < "u" || Array.isArray(s)) && (a = s, s = t, t = hs, i = !0), s = rs(s), a ? Lt(t, s, a) : (e = {
1273
+ forward: function(h) {
1274
+ return Lt(t, s, h);
1275
+ },
1276
+ inverse: function(h) {
1277
+ return Lt(s, t, h);
1278
+ }
1279
+ }, i && (e.oProj = s), e);
1280
+ }
1281
+ function ht(t, s, a) {
1282
+ if (!(this instanceof ht))
1283
+ return new ht(t, s, a);
1284
+ if (Array.isArray(t))
1285
+ this.x = t[0], this.y = t[1], this.z = t[2] || 0;
1286
+ else if (typeof t == "object")
1287
+ this.x = t.x, this.y = t.y, this.z = t.z || 0;
1288
+ else if (typeof t == "string" && typeof s > "u") {
1289
+ var i = t.split(",");
1290
+ this.x = parseFloat(i[0], 10), this.y = parseFloat(i[1], 10), this.z = parseFloat(i[2], 10) || 0;
1291
+ } else
1292
+ this.x = t, this.y = s, this.z = a || 0;
1293
+ console.warn("proj4.Point will be removed in version 3, use proj4.toPoint");
1294
+ }
1295
+ ht.fromMGRS = function(t) {
1296
+ return new ht(Hs(t));
1297
+ };
1298
+ ht.prototype.toMGRS = function(t) {
1299
+ return Ws([this.x, this.y], t);
1300
+ };
1301
+ var Ya = 1, Ka = 0.25, ns = 0.046875, os = 0.01953125, ls = 0.01068115234375, Va = 0.75, Za = 0.46875, Ja = 0.013020833333333334, ti = 0.007120768229166667, si = 0.3645833333333333, ai = 0.005696614583333333, ii = 0.3076171875;
1302
+ function As(t) {
1303
+ var s = [];
1304
+ s[0] = Ya - t * (Ka + t * (ns + t * (os + t * ls))), s[1] = t * (Va - t * (ns + t * (os + t * ls)));
1305
+ var a = t * t;
1306
+ return s[2] = a * (Za - t * (Ja + t * ti)), a *= t, s[3] = a * (si - t * ai), s[4] = a * t * ii, s;
1307
+ }
1308
+ function Ct(t, s, a, i) {
1309
+ return a *= s, s *= s, i[0] * t - a * (i[1] + s * (i[2] + s * (i[3] + s * i[4])));
1310
+ }
1311
+ var ei = 20;
1312
+ function Ns(t, s, a) {
1313
+ for (var i = 1 / (1 - s), e = t, h = ei; h; --h) {
1314
+ var r = Math.sin(e), n = 1 - s * r * r;
1315
+ if (n = (Ct(e, r, Math.cos(e), a) - t) * (n * Math.sqrt(n)) * i, e -= n, Math.abs(n) < m)
1316
+ return e;
1317
+ }
1318
+ return e;
1319
+ }
1320
+ function hi() {
1321
+ this.x0 = this.x0 !== void 0 ? this.x0 : 0, this.y0 = this.y0 !== void 0 ? this.y0 : 0, this.long0 = this.long0 !== void 0 ? this.long0 : 0, this.lat0 = this.lat0 !== void 0 ? this.lat0 : 0, this.es && (this.en = As(this.es), this.ml0 = Ct(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en));
1322
+ }
1323
+ function ri(t) {
1324
+ var s = t.x, a = t.y, i = b(s - this.long0), e, h, r, n = Math.sin(a), o = Math.cos(a);
1325
+ if (this.es) {
1326
+ var c = o * i, f = Math.pow(c, 2), u = this.ep2 * Math.pow(o, 2), v = Math.pow(u, 2), d = Math.abs(o) > m ? Math.tan(a) : 0, y = Math.pow(d, 2), g = Math.pow(y, 2);
1327
+ e = 1 - this.es * Math.pow(n, 2), c = c / Math.sqrt(e);
1328
+ var x = Ct(a, n, o, this.en);
1329
+ h = this.a * (this.k0 * c * (1 + f / 6 * (1 - y + u + f / 20 * (5 - 18 * y + g + 14 * u - 58 * y * u + f / 42 * (61 + 179 * g - g * y - 479 * y))))) + this.x0, r = this.a * (this.k0 * (x - this.ml0 + n * i * c / 2 * (1 + f / 12 * (5 - y + 9 * u + 4 * v + f / 30 * (61 + g - 58 * y + 270 * u - 330 * y * u + f / 56 * (1385 + 543 * g - g * y - 3111 * y)))))) + this.y0;
1330
+ } else {
1331
+ var l = o * Math.sin(i);
1332
+ if (Math.abs(Math.abs(l) - 1) < m)
1333
+ return 93;
1334
+ if (h = 0.5 * this.a * this.k0 * Math.log((1 + l) / (1 - l)) + this.x0, r = o * Math.cos(i) / Math.sqrt(1 - Math.pow(l, 2)), l = Math.abs(r), l >= 1) {
1335
+ if (l - 1 > m)
1336
+ return 93;
1337
+ r = 0;
1338
+ } else
1339
+ r = Math.acos(r);
1340
+ a < 0 && (r = -r), r = this.a * this.k0 * (r - this.lat0) + this.y0;
1341
+ }
1342
+ return t.x = h, t.y = r, t;
1343
+ }
1344
+ function ni(t) {
1345
+ var s, a, i, e, h = (t.x - this.x0) * (1 / this.a), r = (t.y - this.y0) * (1 / this.a);
1346
+ if (this.es)
1347
+ if (s = this.ml0 + r / this.k0, a = Ns(s, this.es, this.en), Math.abs(a) < M) {
1348
+ var f = Math.sin(a), u = Math.cos(a), v = Math.abs(u) > m ? Math.tan(a) : 0, d = this.ep2 * Math.pow(u, 2), y = Math.pow(d, 2), g = Math.pow(v, 2), x = Math.pow(g, 2);
1349
+ s = 1 - this.es * Math.pow(f, 2);
1350
+ var S = h * Math.sqrt(s) / this.k0, E = Math.pow(S, 2);
1351
+ s = s * v, i = a - s * E / (1 - this.es) * 0.5 * (1 - E / 12 * (5 + 3 * g - 9 * d * g + d - 4 * y - E / 30 * (61 + 90 * g - 252 * d * g + 45 * x + 46 * d - E / 56 * (1385 + 3633 * g + 4095 * x + 1574 * x * g)))), e = b(this.long0 + S * (1 - E / 6 * (1 + 2 * g + d - E / 20 * (5 + 28 * g + 24 * x + 8 * d * g + 6 * d - E / 42 * (61 + 662 * g + 1320 * x + 720 * x * g)))) / u);
1352
+ } else
1353
+ i = M * Mt(r), e = 0;
1354
+ else {
1355
+ var n = Math.exp(h / this.k0), o = 0.5 * (n - 1 / n), l = this.lat0 + r / this.k0, c = Math.cos(l);
1356
+ s = Math.sqrt((1 - Math.pow(c, 2)) / (1 + Math.pow(o, 2))), i = Math.asin(s), r < 0 && (i = -i), o === 0 && c === 0 ? e = 0 : e = b(Math.atan2(o, c) + this.long0);
1357
+ }
1358
+ return t.x = e, t.y = i, t;
1359
+ }
1360
+ var oi = ["Transverse_Mercator", "Transverse Mercator", "tmerc"];
1361
+ const li = {
1362
+ init: hi,
1363
+ forward: ri,
1364
+ inverse: ni,
1365
+ names: oi
1366
+ };
1367
+ function Bs(t) {
1368
+ var s = Math.exp(t);
1369
+ return s = (s - 1 / s) / 2, s;
1370
+ }
1371
+ function Ut(t, s) {
1372
+ t = Math.abs(t), s = Math.abs(s);
1373
+ var a = Math.max(t, s), i = Math.min(t, s) / (a || 1);
1374
+ return a * Math.sqrt(1 + Math.pow(i, 2));
1375
+ }
1376
+ function ci(t) {
1377
+ var s = 1 + t, a = s - 1;
1378
+ return a === 0 ? t : t * Math.log(s) / a;
1379
+ }
1380
+ function fi(t) {
1381
+ var s = Math.abs(t);
1382
+ return s = ci(s * (1 + s / (Ut(1, s) + 1))), t < 0 ? -s : s;
1383
+ }
1384
+ function Ht(t, s) {
1385
+ for (var a = 2 * Math.cos(2 * s), i = t.length - 1, e = t[i], h = 0, r; --i >= 0; )
1386
+ r = -h + a * e + t[i], h = e, e = r;
1387
+ return s + r * Math.sin(2 * s);
1388
+ }
1389
+ function ui(t, s) {
1390
+ for (var a = 2 * Math.cos(s), i = t.length - 1, e = t[i], h = 0, r; --i >= 0; )
1391
+ r = -h + a * e + t[i], h = e, e = r;
1392
+ return Math.sin(s) * r;
1393
+ }
1394
+ function Mi(t) {
1395
+ var s = Math.exp(t);
1396
+ return s = (s + 1 / s) / 2, s;
1397
+ }
1398
+ function Cs(t, s, a) {
1399
+ for (var i = Math.sin(s), e = Math.cos(s), h = Bs(a), r = Mi(a), n = 2 * e * r, o = -2 * i * h, l = t.length - 1, c = t[l], f = 0, u = 0, v = 0, d, y; --l >= 0; )
1400
+ d = u, y = f, u = c, f = v, c = -d + n * u - o * f + t[l], v = -y + o * u + n * f;
1401
+ return n = i * r, o = e * h, [n * c - o * v, n * v + o * c];
1402
+ }
1403
+ function vi() {
1404
+ if (this.es === void 0 || this.es <= 0)
1405
+ throw new Error("incorrect elliptical usage");
1406
+ this.x0 = this.x0 !== void 0 ? this.x0 : 0, this.y0 = this.y0 !== void 0 ? this.y0 : 0, this.long0 = this.long0 !== void 0 ? this.long0 : 0, this.lat0 = this.lat0 !== void 0 ? this.lat0 : 0, this.cgb = [], this.cbg = [], this.utg = [], this.gtu = [];
1407
+ var t = this.es / (1 + Math.sqrt(1 - this.es)), s = t / (2 - t), a = s;
1408
+ this.cgb[0] = s * (2 + s * (-2 / 3 + s * (-2 + s * (116 / 45 + s * (26 / 45 + s * (-2854 / 675)))))), this.cbg[0] = s * (-2 + s * (2 / 3 + s * (4 / 3 + s * (-82 / 45 + s * (32 / 45 + s * (4642 / 4725)))))), a = a * s, this.cgb[1] = a * (7 / 3 + s * (-8 / 5 + s * (-227 / 45 + s * (2704 / 315 + s * (2323 / 945))))), this.cbg[1] = a * (5 / 3 + s * (-16 / 15 + s * (-13 / 9 + s * (904 / 315 + s * (-1522 / 945))))), a = a * s, this.cgb[2] = a * (56 / 15 + s * (-136 / 35 + s * (-1262 / 105 + s * (73814 / 2835)))), this.cbg[2] = a * (-26 / 15 + s * (34 / 21 + s * (8 / 5 + s * (-12686 / 2835)))), a = a * s, this.cgb[3] = a * (4279 / 630 + s * (-332 / 35 + s * (-399572 / 14175))), this.cbg[3] = a * (1237 / 630 + s * (-12 / 5 + s * (-24832 / 14175))), a = a * s, this.cgb[4] = a * (4174 / 315 + s * (-144838 / 6237)), this.cbg[4] = a * (-734 / 315 + s * (109598 / 31185)), a = a * s, this.cgb[5] = a * (601676 / 22275), this.cbg[5] = a * (444337 / 155925), a = Math.pow(s, 2), this.Qn = this.k0 / (1 + s) * (1 + a * (1 / 4 + a * (1 / 64 + a / 256))), this.utg[0] = s * (-0.5 + s * (2 / 3 + s * (-37 / 96 + s * (1 / 360 + s * (81 / 512 + s * (-96199 / 604800)))))), this.gtu[0] = s * (0.5 + s * (-2 / 3 + s * (5 / 16 + s * (41 / 180 + s * (-127 / 288 + s * (7891 / 37800)))))), this.utg[1] = a * (-1 / 48 + s * (-1 / 15 + s * (437 / 1440 + s * (-46 / 105 + s * (1118711 / 3870720))))), this.gtu[1] = a * (13 / 48 + s * (-3 / 5 + s * (557 / 1440 + s * (281 / 630 + s * (-1983433 / 1935360))))), a = a * s, this.utg[2] = a * (-17 / 480 + s * (37 / 840 + s * (209 / 4480 + s * (-5569 / 90720)))), this.gtu[2] = a * (61 / 240 + s * (-103 / 140 + s * (15061 / 26880 + s * (167603 / 181440)))), a = a * s, this.utg[3] = a * (-4397 / 161280 + s * (11 / 504 + s * (830251 / 7257600))), this.gtu[3] = a * (49561 / 161280 + s * (-179 / 168 + s * (6601661 / 7257600))), a = a * s, this.utg[4] = a * (-4583 / 161280 + s * (108847 / 3991680)), this.gtu[4] = a * (34729 / 80640 + s * (-3418889 / 1995840)), a = a * s, this.utg[5] = a * (-20648693 / 638668800), this.gtu[5] = a * (212378941 / 319334400);
1409
+ var i = Ht(this.cbg, this.lat0);
1410
+ this.Zb = -this.Qn * (i + ui(this.gtu, 2 * i));
1411
+ }
1412
+ function di(t) {
1413
+ var s = b(t.x - this.long0), a = t.y;
1414
+ a = Ht(this.cbg, a);
1415
+ var i = Math.sin(a), e = Math.cos(a), h = Math.sin(s), r = Math.cos(s);
1416
+ a = Math.atan2(i, r * e), s = Math.atan2(h * e, Ut(i, e * r)), s = fi(Math.tan(s));
1417
+ var n = Cs(this.gtu, 2 * a, 2 * s);
1418
+ a = a + n[0], s = s + n[1];
1419
+ var o, l;
1420
+ return Math.abs(s) <= 2.623395162778 ? (o = this.a * (this.Qn * s) + this.x0, l = this.a * (this.Qn * a + this.Zb) + this.y0) : (o = 1 / 0, l = 1 / 0), t.x = o, t.y = l, t;
1421
+ }
1422
+ function yi(t) {
1423
+ var s = (t.x - this.x0) * (1 / this.a), a = (t.y - this.y0) * (1 / this.a);
1424
+ a = (a - this.Zb) / this.Qn, s = s / this.Qn;
1425
+ var i, e;
1426
+ if (Math.abs(s) <= 2.623395162778) {
1427
+ var h = Cs(this.utg, 2 * a, 2 * s);
1428
+ a = a + h[0], s = s + h[1], s = Math.atan(Bs(s));
1429
+ var r = Math.sin(a), n = Math.cos(a), o = Math.sin(s), l = Math.cos(s);
1430
+ a = Math.atan2(r * l, Ut(o, l * n)), s = Math.atan2(o, l * n), i = b(s + this.long0), e = Ht(this.cgb, a);
1431
+ } else
1432
+ i = 1 / 0, e = 1 / 0;
1433
+ return t.x = i, t.y = e, t;
1434
+ }
1435
+ var mi = ["Extended_Transverse_Mercator", "Extended Transverse Mercator", "etmerc"];
1436
+ const Rt = {
1437
+ init: vi,
1438
+ forward: di,
1439
+ inverse: yi,
1440
+ names: mi
1441
+ };
1442
+ function gi(t, s) {
1443
+ if (t === void 0) {
1444
+ if (t = Math.floor((b(s) + Math.PI) * 30 / Math.PI) + 1, t < 0)
1445
+ return 0;
1446
+ if (t > 60)
1447
+ return 60;
1448
+ }
1449
+ return t;
1450
+ }
1451
+ var bi = "etmerc";
1452
+ function _i() {
1453
+ var t = gi(this.zone, this.long0);
1454
+ if (t === void 0)
1455
+ throw new Error("unknown utm zone");
1456
+ this.lat0 = 0, this.long0 = (6 * Math.abs(t) - 183) * D, this.x0 = 5e5, this.y0 = this.utmSouth ? 1e7 : 0, this.k0 = 0.9996, Rt.init.apply(this), this.forward = Rt.forward, this.inverse = Rt.inverse;
1457
+ }
1458
+ var xi = ["Universal Transverse Mercator System", "utm"];
1459
+ const wi = {
1460
+ init: _i,
1461
+ names: xi,
1462
+ dependsOn: bi
1463
+ };
1464
+ function Wt(t, s) {
1465
+ return Math.pow((1 - t) / (1 + t), s);
1466
+ }
1467
+ var Ei = 20;
1468
+ function pi() {
1469
+ var t = Math.sin(this.lat0), s = Math.cos(this.lat0);
1470
+ s *= s, this.rc = Math.sqrt(1 - this.es) / (1 - this.es * t * t), this.C = Math.sqrt(1 + this.es * s * s / (1 - this.es)), this.phic0 = Math.asin(t / this.C), this.ratexp = 0.5 * this.C * this.e, this.K = Math.tan(0.5 * this.phic0 + p) / (Math.pow(Math.tan(0.5 * this.lat0 + p), this.C) * Wt(this.e * t, this.ratexp));
1471
+ }
1472
+ function Ri(t) {
1473
+ var s = t.x, a = t.y;
1474
+ return t.y = 2 * Math.atan(this.K * Math.pow(Math.tan(0.5 * a + p), this.C) * Wt(this.e * Math.sin(a), this.ratexp)) - M, t.x = this.C * s, t;
1475
+ }
1476
+ function Ii(t) {
1477
+ for (var s = 1e-14, a = t.x / this.C, i = t.y, e = Math.pow(Math.tan(0.5 * i + p) / this.K, 1 / this.C), h = Ei; h > 0 && (i = 2 * Math.atan(e * Wt(this.e * Math.sin(t.y), -0.5 * this.e)) - M, !(Math.abs(i - t.y) < s)); --h)
1478
+ t.y = i;
1479
+ return h ? (t.x = a, t.y = i, t) : null;
1480
+ }
1481
+ const Qt = {
1482
+ init: pi,
1483
+ forward: Ri,
1484
+ inverse: Ii
1485
+ };
1486
+ function Pi() {
1487
+ Qt.init.apply(this), this.rc && (this.sinc0 = Math.sin(this.phic0), this.cosc0 = Math.cos(this.phic0), this.R2 = 2 * this.rc, this.title || (this.title = "Oblique Stereographic Alternative"));
1488
+ }
1489
+ function Si(t) {
1490
+ var s, a, i, e;
1491
+ return t.x = b(t.x - this.long0), Qt.forward.apply(this, [t]), s = Math.sin(t.y), a = Math.cos(t.y), i = Math.cos(t.x), e = this.k0 * this.R2 / (1 + this.sinc0 * s + this.cosc0 * a * i), t.x = e * a * Math.sin(t.x), t.y = e * (this.cosc0 * s - this.sinc0 * a * i), t.x = this.a * t.x + this.x0, t.y = this.a * t.y + this.y0, t;
1492
+ }
1493
+ function Ai(t) {
1494
+ var s, a, i, e, h;
1495
+ if (t.x = (t.x - this.x0) / this.a, t.y = (t.y - this.y0) / this.a, t.x /= this.k0, t.y /= this.k0, h = Math.sqrt(t.x * t.x + t.y * t.y)) {
1496
+ var r = 2 * Math.atan2(h, this.R2);
1497
+ s = Math.sin(r), a = Math.cos(r), e = Math.asin(a * this.sinc0 + t.y * s * this.cosc0 / h), i = Math.atan2(t.x * s, h * this.cosc0 * a - t.y * this.sinc0 * s);
1498
+ } else
1499
+ e = this.phic0, i = 0;
1500
+ return t.x = i, t.y = e, Qt.inverse.apply(this, [t]), t.x = b(t.x + this.long0), t;
1501
+ }
1502
+ var Ni = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea", "Oblique Stereographic Alternative", "Double_Stereographic"];
1503
+ const Bi = {
1504
+ init: Pi,
1505
+ forward: Si,
1506
+ inverse: Ai,
1507
+ names: Ni
1508
+ };
1509
+ function Ci(t, s, a) {
1510
+ return s *= a, Math.tan(0.5 * (M + t)) * Math.pow((1 - s) / (1 + s), 0.5 * a);
1511
+ }
1512
+ function Di() {
1513
+ this.coslat0 = Math.cos(this.lat0), this.sinlat0 = Math.sin(this.lat0), this.sphere ? this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= m && (this.k0 = 0.5 * (1 + Mt(this.lat0) * Math.sin(this.lat_ts))) : (Math.abs(this.coslat0) <= m && (this.lat0 > 0 ? this.con = 1 : this.con = -1), this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e)), this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= m && (this.k0 = 0.5 * this.cons * W(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / j(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts))), this.ms1 = W(this.e, this.sinlat0, this.coslat0), this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - M, this.cosX0 = Math.cos(this.X0), this.sinX0 = Math.sin(this.X0));
1514
+ }
1515
+ function ki(t) {
1516
+ var s = t.x, a = t.y, i = Math.sin(a), e = Math.cos(a), h, r, n, o, l, c, f = b(s - this.long0);
1517
+ return Math.abs(Math.abs(s - this.long0) - Math.PI) <= m && Math.abs(a + this.lat0) <= m ? (t.x = NaN, t.y = NaN, t) : this.sphere ? (h = 2 * this.k0 / (1 + this.sinlat0 * i + this.coslat0 * e * Math.cos(f)), t.x = this.a * h * e * Math.sin(f) + this.x0, t.y = this.a * h * (this.coslat0 * i - this.sinlat0 * e * Math.cos(f)) + this.y0, t) : (r = 2 * Math.atan(this.ssfn_(a, i, this.e)) - M, o = Math.cos(r), n = Math.sin(r), Math.abs(this.coslat0) <= m ? (l = j(this.e, a * this.con, this.con * i), c = 2 * this.a * this.k0 * l / this.cons, t.x = this.x0 + c * Math.sin(s - this.long0), t.y = this.y0 - this.con * c * Math.cos(s - this.long0), t) : (Math.abs(this.sinlat0) < m ? (h = 2 * this.a * this.k0 / (1 + o * Math.cos(f)), t.y = h * n) : (h = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * n + this.cosX0 * o * Math.cos(f))), t.y = h * (this.cosX0 * n - this.sinX0 * o * Math.cos(f)) + this.y0), t.x = h * o * Math.sin(f) + this.x0, t));
1518
+ }
1519
+ function Li(t) {
1520
+ t.x -= this.x0, t.y -= this.y0;
1521
+ var s, a, i, e, h, r = Math.sqrt(t.x * t.x + t.y * t.y);
1522
+ if (this.sphere) {
1523
+ var n = 2 * Math.atan(r / (2 * this.a * this.k0));
1524
+ return s = this.long0, a = this.lat0, r <= m ? (t.x = s, t.y = a, t) : (a = Math.asin(Math.cos(n) * this.sinlat0 + t.y * Math.sin(n) * this.coslat0 / r), Math.abs(this.coslat0) < m ? this.lat0 > 0 ? s = b(this.long0 + Math.atan2(t.x, -1 * t.y)) : s = b(this.long0 + Math.atan2(t.x, t.y)) : s = b(this.long0 + Math.atan2(t.x * Math.sin(n), r * this.coslat0 * Math.cos(n) - t.y * this.sinlat0 * Math.sin(n))), t.x = s, t.y = a, t);
1525
+ } else if (Math.abs(this.coslat0) <= m) {
1526
+ if (r <= m)
1527
+ return a = this.lat0, s = this.long0, t.x = s, t.y = a, t;
1528
+ t.x *= this.con, t.y *= this.con, i = r * this.cons / (2 * this.a * this.k0), a = this.con * ut(this.e, i), s = this.con * b(this.con * this.long0 + Math.atan2(t.x, -1 * t.y));
1529
+ } else
1530
+ e = 2 * Math.atan(r * this.cosX0 / (2 * this.a * this.k0 * this.ms1)), s = this.long0, r <= m ? h = this.X0 : (h = Math.asin(Math.cos(e) * this.sinX0 + t.y * Math.sin(e) * this.cosX0 / r), s = b(this.long0 + Math.atan2(t.x * Math.sin(e), r * this.cosX0 * Math.cos(e) - t.y * this.sinX0 * Math.sin(e)))), a = -1 * ut(this.e, Math.tan(0.5 * (M + h)));
1531
+ return t.x = s, t.y = a, t;
1532
+ }
1533
+ var $i = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"];
1534
+ const Oi = {
1535
+ init: Di,
1536
+ forward: ki,
1537
+ inverse: Li,
1538
+ names: $i,
1539
+ ssfn_: Ci
1540
+ };
1541
+ function Ti() {
1542
+ var t = this.lat0;
1543
+ this.lambda0 = this.long0;
1544
+ var s = Math.sin(t), a = this.a, i = this.rf, e = 1 / i, h = 2 * e - Math.pow(e, 2), r = this.e = Math.sqrt(h);
1545
+ this.R = this.k0 * a * Math.sqrt(1 - h) / (1 - h * Math.pow(s, 2)), this.alpha = Math.sqrt(1 + h / (1 - h) * Math.pow(Math.cos(t), 4)), this.b0 = Math.asin(s / this.alpha);
1546
+ var n = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2)), o = Math.log(Math.tan(Math.PI / 4 + t / 2)), l = Math.log((1 + r * s) / (1 - r * s));
1547
+ this.K = n - this.alpha * o + this.alpha * r / 2 * l;
1548
+ }
1549
+ function qi(t) {
1550
+ var s = Math.log(Math.tan(Math.PI / 4 - t.y / 2)), a = this.e / 2 * Math.log((1 + this.e * Math.sin(t.y)) / (1 - this.e * Math.sin(t.y))), i = -this.alpha * (s + a) + this.K, e = 2 * (Math.atan(Math.exp(i)) - Math.PI / 4), h = this.alpha * (t.x - this.lambda0), r = Math.atan(Math.sin(h) / (Math.sin(this.b0) * Math.tan(e) + Math.cos(this.b0) * Math.cos(h))), n = Math.asin(Math.cos(this.b0) * Math.sin(e) - Math.sin(this.b0) * Math.cos(e) * Math.cos(h));
1551
+ return t.y = this.R / 2 * Math.log((1 + Math.sin(n)) / (1 - Math.sin(n))) + this.y0, t.x = this.R * r + this.x0, t;
1552
+ }
1553
+ function Fi(t) {
1554
+ for (var s = t.x - this.x0, a = t.y - this.y0, i = s / this.R, e = 2 * (Math.atan(Math.exp(a / this.R)) - Math.PI / 4), h = Math.asin(Math.cos(this.b0) * Math.sin(e) + Math.sin(this.b0) * Math.cos(e) * Math.cos(i)), r = Math.atan(Math.sin(i) / (Math.cos(this.b0) * Math.cos(i) - Math.sin(this.b0) * Math.tan(e))), n = this.lambda0 + r / this.alpha, o = 0, l = h, c = -1e3, f = 0; Math.abs(l - c) > 1e-7; ) {
1555
+ if (++f > 20)
1556
+ return;
1557
+ o = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + h / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(l)) / 2)), c = l, l = 2 * Math.atan(Math.exp(o)) - Math.PI / 2;
1558
+ }
1559
+ return t.x = n, t.y = l, t;
1560
+ }
1561
+ var Gi = ["somerc"];
1562
+ const ji = {
1563
+ init: Ti,
1564
+ forward: qi,
1565
+ inverse: Fi,
1566
+ names: Gi
1567
+ };
1568
+ function zi() {
1569
+ this.no_off = this.no_off || !1, this.no_rot = this.no_rot || !1, isNaN(this.k0) && (this.k0 = 1);
1570
+ var t = Math.sin(this.lat0), s = Math.cos(this.lat0), a = this.e * t;
1571
+ this.bl = Math.sqrt(1 + this.es / (1 - this.es) * Math.pow(s, 4)), this.al = this.a * this.bl * this.k0 * Math.sqrt(1 - this.es) / (1 - a * a);
1572
+ var i = j(this.e, this.lat0, t), e = this.bl / s * Math.sqrt((1 - this.es) / (1 - a * a));
1573
+ e * e < 1 && (e = 1);
1574
+ var h, r;
1575
+ if (!isNaN(this.longc))
1576
+ this.lat0 >= 0 ? h = e + Math.sqrt(e * e - 1) : h = e - Math.sqrt(e * e - 1), this.el = h * Math.pow(i, this.bl), r = 0.5 * (h - 1 / h), this.gamma0 = Math.asin(Math.sin(this.alpha) / e), this.long0 = this.longc - Math.asin(r * Math.tan(this.gamma0)) / this.bl;
1577
+ else {
1578
+ var n = j(this.e, this.lat1, Math.sin(this.lat1)), o = j(this.e, this.lat2, Math.sin(this.lat2));
1579
+ this.lat0 >= 0 ? this.el = (e + Math.sqrt(e * e - 1)) * Math.pow(i, this.bl) : this.el = (e - Math.sqrt(e * e - 1)) * Math.pow(i, this.bl);
1580
+ var l = Math.pow(n, this.bl), c = Math.pow(o, this.bl);
1581
+ h = this.el / l, r = 0.5 * (h - 1 / h);
1582
+ var f = (this.el * this.el - c * l) / (this.el * this.el + c * l), u = (c - l) / (c + l), v = b(this.long1 - this.long2);
1583
+ this.long0 = 0.5 * (this.long1 + this.long2) - Math.atan(f * Math.tan(0.5 * this.bl * v) / u) / this.bl, this.long0 = b(this.long0);
1584
+ var d = b(this.long1 - this.long0);
1585
+ this.gamma0 = Math.atan(Math.sin(this.bl * d) / r), this.alpha = Math.asin(e * Math.sin(this.gamma0));
1586
+ }
1587
+ this.no_off ? this.uc = 0 : this.lat0 >= 0 ? this.uc = this.al / this.bl * Math.atan2(Math.sqrt(e * e - 1), Math.cos(this.alpha)) : this.uc = -1 * this.al / this.bl * Math.atan2(Math.sqrt(e * e - 1), Math.cos(this.alpha));
1588
+ }
1589
+ function Ui(t) {
1590
+ var s = t.x, a = t.y, i = b(s - this.long0), e, h, r;
1591
+ if (Math.abs(Math.abs(a) - M) <= m)
1592
+ a > 0 ? r = -1 : r = 1, h = this.al / this.bl * Math.log(Math.tan(p + r * this.gamma0 * 0.5)), e = -1 * r * M * this.al / this.bl;
1593
+ else {
1594
+ var n = j(this.e, a, Math.sin(a)), o = this.el / Math.pow(n, this.bl), l = 0.5 * (o - 1 / o), c = 0.5 * (o + 1 / o), f = Math.sin(this.bl * i), u = (l * Math.sin(this.gamma0) - f * Math.cos(this.gamma0)) / c;
1595
+ Math.abs(Math.abs(u) - 1) <= m ? h = Number.POSITIVE_INFINITY : h = 0.5 * this.al * Math.log((1 - u) / (1 + u)) / this.bl, Math.abs(Math.cos(this.bl * i)) <= m ? e = this.al * this.bl * i : e = this.al * Math.atan2(l * Math.cos(this.gamma0) + f * Math.sin(this.gamma0), Math.cos(this.bl * i)) / this.bl;
1596
+ }
1597
+ return this.no_rot ? (t.x = this.x0 + e, t.y = this.y0 + h) : (e -= this.uc, t.x = this.x0 + h * Math.cos(this.alpha) + e * Math.sin(this.alpha), t.y = this.y0 + e * Math.cos(this.alpha) - h * Math.sin(this.alpha)), t;
1598
+ }
1599
+ function Hi(t) {
1600
+ var s, a;
1601
+ this.no_rot ? (a = t.y - this.y0, s = t.x - this.x0) : (a = (t.x - this.x0) * Math.cos(this.alpha) - (t.y - this.y0) * Math.sin(this.alpha), s = (t.y - this.y0) * Math.cos(this.alpha) + (t.x - this.x0) * Math.sin(this.alpha), s += this.uc);
1602
+ var i = Math.exp(-1 * this.bl * a / this.al), e = 0.5 * (i - 1 / i), h = 0.5 * (i + 1 / i), r = Math.sin(this.bl * s / this.al), n = (r * Math.cos(this.gamma0) + e * Math.sin(this.gamma0)) / h, o = Math.pow(this.el / Math.sqrt((1 + n) / (1 - n)), 1 / this.bl);
1603
+ return Math.abs(n - 1) < m ? (t.x = this.long0, t.y = M) : Math.abs(n + 1) < m ? (t.x = this.long0, t.y = -1 * M) : (t.y = ut(this.e, o), t.x = b(this.long0 - Math.atan2(e * Math.cos(this.gamma0) - r * Math.sin(this.gamma0), Math.cos(this.bl * s / this.al)) / this.bl)), t;
1604
+ }
1605
+ var Wi = ["Hotine_Oblique_Mercator", "Hotine Oblique Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin", "Hotine_Oblique_Mercator_Azimuth_Center", "omerc"];
1606
+ const Qi = {
1607
+ init: zi,
1608
+ forward: Ui,
1609
+ inverse: Hi,
1610
+ names: Wi
1611
+ };
1612
+ function Xi() {
1613
+ if (this.lat2 || (this.lat2 = this.lat1), this.k0 || (this.k0 = 1), this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, !(Math.abs(this.lat1 + this.lat2) < m)) {
1614
+ var t = this.b / this.a;
1615
+ this.e = Math.sqrt(1 - t * t);
1616
+ var s = Math.sin(this.lat1), a = Math.cos(this.lat1), i = W(this.e, s, a), e = j(this.e, this.lat1, s), h = Math.sin(this.lat2), r = Math.cos(this.lat2), n = W(this.e, h, r), o = j(this.e, this.lat2, h), l = j(this.e, this.lat0, Math.sin(this.lat0));
1617
+ Math.abs(this.lat1 - this.lat2) > m ? this.ns = Math.log(i / n) / Math.log(e / o) : this.ns = s, isNaN(this.ns) && (this.ns = s), this.f0 = i / (this.ns * Math.pow(e, this.ns)), this.rh = this.a * this.f0 * Math.pow(l, this.ns), this.title || (this.title = "Lambert Conformal Conic");
1618
+ }
1619
+ }
1620
+ function Yi(t) {
1621
+ var s = t.x, a = t.y;
1622
+ Math.abs(2 * Math.abs(a) - Math.PI) <= m && (a = Mt(a) * (M - 2 * m));
1623
+ var i = Math.abs(Math.abs(a) - M), e, h;
1624
+ if (i > m)
1625
+ e = j(this.e, a, Math.sin(a)), h = this.a * this.f0 * Math.pow(e, this.ns);
1626
+ else {
1627
+ if (i = a * this.ns, i <= 0)
1628
+ return null;
1629
+ h = 0;
1630
+ }
1631
+ var r = this.ns * b(s - this.long0);
1632
+ return t.x = this.k0 * (h * Math.sin(r)) + this.x0, t.y = this.k0 * (this.rh - h * Math.cos(r)) + this.y0, t;
1633
+ }
1634
+ function Ki(t) {
1635
+ var s, a, i, e, h, r = (t.x - this.x0) / this.k0, n = this.rh - (t.y - this.y0) / this.k0;
1636
+ this.ns > 0 ? (s = Math.sqrt(r * r + n * n), a = 1) : (s = -Math.sqrt(r * r + n * n), a = -1);
1637
+ var o = 0;
1638
+ if (s !== 0 && (o = Math.atan2(a * r, a * n)), s !== 0 || this.ns > 0) {
1639
+ if (a = 1 / this.ns, i = Math.pow(s / (this.a * this.f0), a), e = ut(this.e, i), e === -9999)
1640
+ return null;
1641
+ } else
1642
+ e = -M;
1643
+ return h = b(o / this.ns + this.long0), t.x = h, t.y = e, t;
1644
+ }
1645
+ var Vi = ["Lambert Tangential Conformal Conic Projection", "Lambert_Conformal_Conic", "Lambert_Conformal_Conic_2SP", "lcc"];
1646
+ const Zi = {
1647
+ init: Xi,
1648
+ forward: Yi,
1649
+ inverse: Ki,
1650
+ names: Vi
1651
+ };
1652
+ function Ji() {
1653
+ this.a = 6377397155e-3, this.es = 0.006674372230614, this.e = Math.sqrt(this.es), this.lat0 || (this.lat0 = 0.863937979737193), this.long0 || (this.long0 = 0.7417649320975901 - 0.308341501185665), this.k0 || (this.k0 = 0.9999), this.s45 = 0.785398163397448, this.s90 = 2 * this.s45, this.fi0 = this.lat0, this.e2 = this.es, this.e = Math.sqrt(this.e2), this.alfa = Math.sqrt(1 + this.e2 * Math.pow(Math.cos(this.fi0), 4) / (1 - this.e2)), this.uq = 1.04216856380474, this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa), this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2), this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g, this.k1 = this.k0, this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2)), this.s0 = 1.37008346281555, this.n = Math.sin(this.s0), this.ro0 = this.k1 * this.n0 / Math.tan(this.s0), this.ad = this.s90 - this.uq;
1654
+ }
1655
+ function te(t) {
1656
+ var s, a, i, e, h, r, n, o = t.x, l = t.y, c = b(o - this.long0);
1657
+ return s = Math.pow((1 + this.e * Math.sin(l)) / (1 - this.e * Math.sin(l)), this.alfa * this.e / 2), a = 2 * (Math.atan(this.k * Math.pow(Math.tan(l / 2 + this.s45), this.alfa) / s) - this.s45), i = -c * this.alfa, e = Math.asin(Math.cos(this.ad) * Math.sin(a) + Math.sin(this.ad) * Math.cos(a) * Math.cos(i)), h = Math.asin(Math.cos(a) * Math.sin(i) / Math.cos(e)), r = this.n * h, n = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(e / 2 + this.s45), this.n), t.y = n * Math.cos(r) / 1, t.x = n * Math.sin(r) / 1, this.czech || (t.y *= -1, t.x *= -1), t;
1658
+ }
1659
+ function se(t) {
1660
+ var s, a, i, e, h, r, n, o, l = t.x;
1661
+ t.x = t.y, t.y = l, this.czech || (t.y *= -1, t.x *= -1), r = Math.sqrt(t.x * t.x + t.y * t.y), h = Math.atan2(t.y, t.x), e = h / Math.sin(this.s0), i = 2 * (Math.atan(Math.pow(this.ro0 / r, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45), s = Math.asin(Math.cos(this.ad) * Math.sin(i) - Math.sin(this.ad) * Math.cos(i) * Math.cos(e)), a = Math.asin(Math.cos(i) * Math.sin(e) / Math.cos(s)), t.x = this.long0 - a / this.alfa, n = s, o = 0;
1662
+ var c = 0;
1663
+ do
1664
+ t.y = 2 * (Math.atan(Math.pow(this.k, -1 / this.alfa) * Math.pow(Math.tan(s / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(n)) / (1 - this.e * Math.sin(n)), this.e / 2)) - this.s45), Math.abs(n - t.y) < 1e-10 && (o = 1), n = t.y, c += 1;
1665
+ while (o === 0 && c < 15);
1666
+ return c >= 15 ? null : t;
1667
+ }
1668
+ var ae = ["Krovak", "krovak"];
1669
+ const ie = {
1670
+ init: Ji,
1671
+ forward: te,
1672
+ inverse: se,
1673
+ names: ae
1674
+ };
1675
+ function O(t, s, a, i, e) {
1676
+ return t * e - s * Math.sin(2 * e) + a * Math.sin(4 * e) - i * Math.sin(6 * e);
1677
+ }
1678
+ function vt(t) {
1679
+ return 1 - 0.25 * t * (1 + t / 16 * (3 + 1.25 * t));
1680
+ }
1681
+ function dt(t) {
1682
+ return 0.375 * t * (1 + 0.25 * t * (1 + 0.46875 * t));
1683
+ }
1684
+ function yt(t) {
1685
+ return 0.05859375 * t * t * (1 + 0.75 * t);
1686
+ }
1687
+ function mt(t) {
1688
+ return t * t * t * (35 / 3072);
1689
+ }
1690
+ function rt(t, s, a) {
1691
+ var i = s * a;
1692
+ return t / Math.sqrt(1 - i * i);
1693
+ }
1694
+ function nt(t) {
1695
+ return Math.abs(t) < M ? t : t - Mt(t) * Math.PI;
1696
+ }
1697
+ function At(t, s, a, i, e) {
1698
+ var h, r;
1699
+ h = t / s;
1700
+ for (var n = 0; n < 15; n++)
1701
+ if (r = (t - (s * h - a * Math.sin(2 * h) + i * Math.sin(4 * h) - e * Math.sin(6 * h))) / (s - 2 * a * Math.cos(2 * h) + 4 * i * Math.cos(4 * h) - 6 * e * Math.cos(6 * h)), h += r, Math.abs(r) <= 1e-10)
1702
+ return h;
1703
+ return NaN;
1704
+ }
1705
+ function ee() {
1706
+ this.sphere || (this.e0 = vt(this.es), this.e1 = dt(this.es), this.e2 = yt(this.es), this.e3 = mt(this.es), this.ml0 = this.a * O(this.e0, this.e1, this.e2, this.e3, this.lat0));
1707
+ }
1708
+ function he(t) {
1709
+ var s, a, i = t.x, e = t.y;
1710
+ if (i = b(i - this.long0), this.sphere)
1711
+ s = this.a * Math.asin(Math.cos(e) * Math.sin(i)), a = this.a * (Math.atan2(Math.tan(e), Math.cos(i)) - this.lat0);
1712
+ else {
1713
+ var h = Math.sin(e), r = Math.cos(e), n = rt(this.a, this.e, h), o = Math.tan(e) * Math.tan(e), l = i * Math.cos(e), c = l * l, f = this.es * r * r / (1 - this.es), u = this.a * O(this.e0, this.e1, this.e2, this.e3, e);
1714
+ s = n * l * (1 - c * o * (1 / 6 - (8 - o + 8 * f) * c / 120)), a = u - this.ml0 + n * h / r * c * (0.5 + (5 - o + 6 * f) * c / 24);
1715
+ }
1716
+ return t.x = s + this.x0, t.y = a + this.y0, t;
1717
+ }
1718
+ function re(t) {
1719
+ t.x -= this.x0, t.y -= this.y0;
1720
+ var s = t.x / this.a, a = t.y / this.a, i, e;
1721
+ if (this.sphere) {
1722
+ var h = a + this.lat0;
1723
+ i = Math.asin(Math.sin(h) * Math.cos(s)), e = Math.atan2(Math.tan(s), Math.cos(h));
1724
+ } else {
1725
+ var r = this.ml0 / this.a + a, n = At(r, this.e0, this.e1, this.e2, this.e3);
1726
+ if (Math.abs(Math.abs(n) - M) <= m)
1727
+ return t.x = this.long0, t.y = M, a < 0 && (t.y *= -1), t;
1728
+ var o = rt(this.a, this.e, Math.sin(n)), l = o * o * o / this.a / this.a * (1 - this.es), c = Math.pow(Math.tan(n), 2), f = s * this.a / o, u = f * f;
1729
+ i = n - o * Math.tan(n) / l * f * f * (0.5 - (1 + 3 * c) * f * f / 24), e = f * (1 - u * (c / 3 + (1 + 3 * c) * c * u / 15)) / Math.cos(n);
1730
+ }
1731
+ return t.x = b(e + this.long0), t.y = nt(i), t;
1732
+ }
1733
+ var ne = ["Cassini", "Cassini_Soldner", "cass"];
1734
+ const oe = {
1735
+ init: ee,
1736
+ forward: he,
1737
+ inverse: re,
1738
+ names: ne
1739
+ };
1740
+ function X(t, s) {
1741
+ var a;
1742
+ return t > 1e-7 ? (a = t * s, (1 - t * t) * (s / (1 - a * a) - 0.5 / t * Math.log((1 - a) / (1 + a)))) : 2 * s;
1743
+ }
1744
+ var le = 1, ce = 2, fe = 3, ue = 4;
1745
+ function Me() {
1746
+ var t = Math.abs(this.lat0);
1747
+ if (Math.abs(t - M) < m ? this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE : Math.abs(t) < m ? this.mode = this.EQUIT : this.mode = this.OBLIQ, this.es > 0) {
1748
+ var s;
1749
+ switch (this.qp = X(this.e, 1), this.mmf = 0.5 / (1 - this.es), this.apa = we(this.es), this.mode) {
1750
+ case this.N_POLE:
1751
+ this.dd = 1;
1752
+ break;
1753
+ case this.S_POLE:
1754
+ this.dd = 1;
1755
+ break;
1756
+ case this.EQUIT:
1757
+ this.rq = Math.sqrt(0.5 * this.qp), this.dd = 1 / this.rq, this.xmf = 1, this.ymf = 0.5 * this.qp;
1758
+ break;
1759
+ case this.OBLIQ:
1760
+ this.rq = Math.sqrt(0.5 * this.qp), s = Math.sin(this.lat0), this.sinb1 = X(this.e, s) / this.qp, this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1), this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * s * s) * this.rq * this.cosb1), this.ymf = (this.xmf = this.rq) / this.dd, this.xmf *= this.dd;
1761
+ break;
1762
+ }
1763
+ } else
1764
+ this.mode === this.OBLIQ && (this.sinph0 = Math.sin(this.lat0), this.cosph0 = Math.cos(this.lat0));
1765
+ }
1766
+ function ve(t) {
1767
+ var s, a, i, e, h, r, n, o, l, c, f = t.x, u = t.y;
1768
+ if (f = b(f - this.long0), this.sphere) {
1769
+ if (h = Math.sin(u), c = Math.cos(u), i = Math.cos(f), this.mode === this.OBLIQ || this.mode === this.EQUIT) {
1770
+ if (a = this.mode === this.EQUIT ? 1 + c * i : 1 + this.sinph0 * h + this.cosph0 * c * i, a <= m)
1771
+ return null;
1772
+ a = Math.sqrt(2 / a), s = a * c * Math.sin(f), a *= this.mode === this.EQUIT ? h : this.cosph0 * h - this.sinph0 * c * i;
1773
+ } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
1774
+ if (this.mode === this.N_POLE && (i = -i), Math.abs(u + this.lat0) < m)
1775
+ return null;
1776
+ a = p - u * 0.5, a = 2 * (this.mode === this.S_POLE ? Math.cos(a) : Math.sin(a)), s = a * Math.sin(f), a *= i;
1777
+ }
1778
+ } else {
1779
+ switch (n = 0, o = 0, l = 0, i = Math.cos(f), e = Math.sin(f), h = Math.sin(u), r = X(this.e, h), (this.mode === this.OBLIQ || this.mode === this.EQUIT) && (n = r / this.qp, o = Math.sqrt(1 - n * n)), this.mode) {
1780
+ case this.OBLIQ:
1781
+ l = 1 + this.sinb1 * n + this.cosb1 * o * i;
1782
+ break;
1783
+ case this.EQUIT:
1784
+ l = 1 + o * i;
1785
+ break;
1786
+ case this.N_POLE:
1787
+ l = M + u, r = this.qp - r;
1788
+ break;
1789
+ case this.S_POLE:
1790
+ l = u - M, r = this.qp + r;
1791
+ break;
1792
+ }
1793
+ if (Math.abs(l) < m)
1794
+ return null;
1795
+ switch (this.mode) {
1796
+ case this.OBLIQ:
1797
+ case this.EQUIT:
1798
+ l = Math.sqrt(2 / l), this.mode === this.OBLIQ ? a = this.ymf * l * (this.cosb1 * n - this.sinb1 * o * i) : a = (l = Math.sqrt(2 / (1 + o * i))) * n * this.ymf, s = this.xmf * l * o * e;
1799
+ break;
1800
+ case this.N_POLE:
1801
+ case this.S_POLE:
1802
+ r >= 0 ? (s = (l = Math.sqrt(r)) * e, a = i * (this.mode === this.S_POLE ? l : -l)) : s = a = 0;
1803
+ break;
1804
+ }
1805
+ }
1806
+ return t.x = this.a * s + this.x0, t.y = this.a * a + this.y0, t;
1807
+ }
1808
+ function de(t) {
1809
+ t.x -= this.x0, t.y -= this.y0;
1810
+ var s = t.x / this.a, a = t.y / this.a, i, e, h, r, n, o, l;
1811
+ if (this.sphere) {
1812
+ var c = 0, f, u = 0;
1813
+ if (f = Math.sqrt(s * s + a * a), e = f * 0.5, e > 1)
1814
+ return null;
1815
+ switch (e = 2 * Math.asin(e), (this.mode === this.OBLIQ || this.mode === this.EQUIT) && (u = Math.sin(e), c = Math.cos(e)), this.mode) {
1816
+ case this.EQUIT:
1817
+ e = Math.abs(f) <= m ? 0 : Math.asin(a * u / f), s *= u, a = c * f;
1818
+ break;
1819
+ case this.OBLIQ:
1820
+ e = Math.abs(f) <= m ? this.lat0 : Math.asin(c * this.sinph0 + a * u * this.cosph0 / f), s *= u * this.cosph0, a = (c - Math.sin(e) * this.sinph0) * f;
1821
+ break;
1822
+ case this.N_POLE:
1823
+ a = -a, e = M - e;
1824
+ break;
1825
+ case this.S_POLE:
1826
+ e -= M;
1827
+ break;
1828
+ }
1829
+ i = a === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ) ? 0 : Math.atan2(s, a);
1830
+ } else {
1831
+ if (l = 0, this.mode === this.OBLIQ || this.mode === this.EQUIT) {
1832
+ if (s /= this.dd, a *= this.dd, o = Math.sqrt(s * s + a * a), o < m)
1833
+ return t.x = this.long0, t.y = this.lat0, t;
1834
+ r = 2 * Math.asin(0.5 * o / this.rq), h = Math.cos(r), s *= r = Math.sin(r), this.mode === this.OBLIQ ? (l = h * this.sinb1 + a * r * this.cosb1 / o, n = this.qp * l, a = o * this.cosb1 * h - a * this.sinb1 * r) : (l = a * r / o, n = this.qp * l, a = o * h);
1835
+ } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
1836
+ if (this.mode === this.N_POLE && (a = -a), n = s * s + a * a, !n)
1837
+ return t.x = this.long0, t.y = this.lat0, t;
1838
+ l = 1 - n / this.qp, this.mode === this.S_POLE && (l = -l);
1839
+ }
1840
+ i = Math.atan2(s, a), e = Ee(Math.asin(l), this.apa);
1841
+ }
1842
+ return t.x = b(this.long0 + i), t.y = e, t;
1843
+ }
1844
+ var ye = 0.3333333333333333, me = 0.17222222222222222, ge = 0.10257936507936508, be = 0.06388888888888888, _e = 0.0664021164021164, xe = 0.016415012942191543;
1845
+ function we(t) {
1846
+ var s, a = [];
1847
+ return a[0] = t * ye, s = t * t, a[0] += s * me, a[1] = s * be, s *= t, a[0] += s * ge, a[1] += s * _e, a[2] = s * xe, a;
1848
+ }
1849
+ function Ee(t, s) {
1850
+ var a = t + t;
1851
+ return t + s[0] * Math.sin(a) + s[1] * Math.sin(a + a) + s[2] * Math.sin(a + a + a);
1852
+ }
1853
+ var pe = ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area", "laea"];
1854
+ const Re = {
1855
+ init: Me,
1856
+ forward: ve,
1857
+ inverse: de,
1858
+ names: pe,
1859
+ S_POLE: le,
1860
+ N_POLE: ce,
1861
+ EQUIT: fe,
1862
+ OBLIQ: ue
1863
+ };
1864
+ function K(t) {
1865
+ return Math.abs(t) > 1 && (t = t > 1 ? 1 : -1), Math.asin(t);
1866
+ }
1867
+ function Ie() {
1868
+ Math.abs(this.lat1 + this.lat2) < m || (this.temp = this.b / this.a, this.es = 1 - Math.pow(this.temp, 2), this.e3 = Math.sqrt(this.es), this.sin_po = Math.sin(this.lat1), this.cos_po = Math.cos(this.lat1), this.t1 = this.sin_po, this.con = this.sin_po, this.ms1 = W(this.e3, this.sin_po, this.cos_po), this.qs1 = X(this.e3, this.sin_po, this.cos_po), this.sin_po = Math.sin(this.lat2), this.cos_po = Math.cos(this.lat2), this.t2 = this.sin_po, this.ms2 = W(this.e3, this.sin_po, this.cos_po), this.qs2 = X(this.e3, this.sin_po, this.cos_po), this.sin_po = Math.sin(this.lat0), this.cos_po = Math.cos(this.lat0), this.t3 = this.sin_po, this.qs0 = X(this.e3, this.sin_po, this.cos_po), Math.abs(this.lat1 - this.lat2) > m ? this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1) : this.ns0 = this.con, this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1, this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0);
1869
+ }
1870
+ function Pe(t) {
1871
+ var s = t.x, a = t.y;
1872
+ this.sin_phi = Math.sin(a), this.cos_phi = Math.cos(a);
1873
+ var i = X(this.e3, this.sin_phi, this.cos_phi), e = this.a * Math.sqrt(this.c - this.ns0 * i) / this.ns0, h = this.ns0 * b(s - this.long0), r = e * Math.sin(h) + this.x0, n = this.rh - e * Math.cos(h) + this.y0;
1874
+ return t.x = r, t.y = n, t;
1875
+ }
1876
+ function Se(t) {
1877
+ var s, a, i, e, h, r;
1878
+ return t.x -= this.x0, t.y = this.rh - t.y + this.y0, this.ns0 >= 0 ? (s = Math.sqrt(t.x * t.x + t.y * t.y), i = 1) : (s = -Math.sqrt(t.x * t.x + t.y * t.y), i = -1), e = 0, s !== 0 && (e = Math.atan2(i * t.x, i * t.y)), i = s * this.ns0 / this.a, this.sphere ? r = Math.asin((this.c - i * i) / (2 * this.ns0)) : (a = (this.c - i * i) / this.ns0, r = this.phi1z(this.e3, a)), h = b(e / this.ns0 + this.long0), t.x = h, t.y = r, t;
1879
+ }
1880
+ function Ae(t, s) {
1881
+ var a, i, e, h, r, n = K(0.5 * s);
1882
+ if (t < m)
1883
+ return n;
1884
+ for (var o = t * t, l = 1; l <= 25; l++)
1885
+ if (a = Math.sin(n), i = Math.cos(n), e = t * a, h = 1 - e * e, r = 0.5 * h * h / i * (s / (1 - o) - a / h + 0.5 / t * Math.log((1 - e) / (1 + e))), n = n + r, Math.abs(r) <= 1e-7)
1886
+ return n;
1887
+ return null;
1888
+ }
1889
+ var Ne = ["Albers_Conic_Equal_Area", "Albers", "aea"];
1890
+ const Be = {
1891
+ init: Ie,
1892
+ forward: Pe,
1893
+ inverse: Se,
1894
+ names: Ne,
1895
+ phi1z: Ae
1896
+ };
1897
+ function Ce() {
1898
+ this.sin_p14 = Math.sin(this.lat0), this.cos_p14 = Math.cos(this.lat0), this.infinity_dist = 1e3 * this.a, this.rc = 1;
1899
+ }
1900
+ function De(t) {
1901
+ var s, a, i, e, h, r, n, o, l = t.x, c = t.y;
1902
+ return i = b(l - this.long0), s = Math.sin(c), a = Math.cos(c), e = Math.cos(i), r = this.sin_p14 * s + this.cos_p14 * a * e, h = 1, r > 0 || Math.abs(r) <= m ? (n = this.x0 + this.a * h * a * Math.sin(i) / r, o = this.y0 + this.a * h * (this.cos_p14 * s - this.sin_p14 * a * e) / r) : (n = this.x0 + this.infinity_dist * a * Math.sin(i), o = this.y0 + this.infinity_dist * (this.cos_p14 * s - this.sin_p14 * a * e)), t.x = n, t.y = o, t;
1903
+ }
1904
+ function ke(t) {
1905
+ var s, a, i, e, h, r;
1906
+ return t.x = (t.x - this.x0) / this.a, t.y = (t.y - this.y0) / this.a, t.x /= this.k0, t.y /= this.k0, (s = Math.sqrt(t.x * t.x + t.y * t.y)) ? (e = Math.atan2(s, this.rc), a = Math.sin(e), i = Math.cos(e), r = K(i * this.sin_p14 + t.y * a * this.cos_p14 / s), h = Math.atan2(t.x * a, s * this.cos_p14 * i - t.y * this.sin_p14 * a), h = b(this.long0 + h)) : (r = this.phic0, h = 0), t.x = h, t.y = r, t;
1907
+ }
1908
+ var Le = ["gnom"];
1909
+ const $e = {
1910
+ init: Ce,
1911
+ forward: De,
1912
+ inverse: ke,
1913
+ names: Le
1914
+ };
1915
+ function Oe(t, s) {
1916
+ var a = 1 - (1 - t * t) / (2 * t) * Math.log((1 - t) / (1 + t));
1917
+ if (Math.abs(Math.abs(s) - a) < 1e-6)
1918
+ return s < 0 ? -1 * M : M;
1919
+ for (var i = Math.asin(0.5 * s), e, h, r, n, o = 0; o < 30; o++)
1920
+ if (h = Math.sin(i), r = Math.cos(i), n = t * h, e = Math.pow(1 - n * n, 2) / (2 * r) * (s / (1 - t * t) - h / (1 - n * n) + 0.5 / t * Math.log((1 - n) / (1 + n))), i += e, Math.abs(e) <= 1e-10)
1921
+ return i;
1922
+ return NaN;
1923
+ }
1924
+ function Te() {
1925
+ this.sphere || (this.k0 = W(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)));
1926
+ }
1927
+ function qe(t) {
1928
+ var s = t.x, a = t.y, i, e, h = b(s - this.long0);
1929
+ if (this.sphere)
1930
+ i = this.x0 + this.a * h * Math.cos(this.lat_ts), e = this.y0 + this.a * Math.sin(a) / Math.cos(this.lat_ts);
1931
+ else {
1932
+ var r = X(this.e, Math.sin(a));
1933
+ i = this.x0 + this.a * this.k0 * h, e = this.y0 + this.a * r * 0.5 / this.k0;
1934
+ }
1935
+ return t.x = i, t.y = e, t;
1936
+ }
1937
+ function Fe(t) {
1938
+ t.x -= this.x0, t.y -= this.y0;
1939
+ var s, a;
1940
+ return this.sphere ? (s = b(this.long0 + t.x / this.a / Math.cos(this.lat_ts)), a = Math.asin(t.y / this.a * Math.cos(this.lat_ts))) : (a = Oe(this.e, 2 * t.y * this.k0 / this.a), s = b(this.long0 + t.x / (this.a * this.k0))), t.x = s, t.y = a, t;
1941
+ }
1942
+ var Ge = ["cea"];
1943
+ const je = {
1944
+ init: Te,
1945
+ forward: qe,
1946
+ inverse: Fe,
1947
+ names: Ge
1948
+ };
1949
+ function ze() {
1950
+ this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, this.lat0 = this.lat0 || 0, this.long0 = this.long0 || 0, this.lat_ts = this.lat_ts || 0, this.title = this.title || "Equidistant Cylindrical (Plate Carre)", this.rc = Math.cos(this.lat_ts);
1951
+ }
1952
+ function Ue(t) {
1953
+ var s = t.x, a = t.y, i = b(s - this.long0), e = nt(a - this.lat0);
1954
+ return t.x = this.x0 + this.a * i * this.rc, t.y = this.y0 + this.a * e, t;
1955
+ }
1956
+ function He(t) {
1957
+ var s = t.x, a = t.y;
1958
+ return t.x = b(this.long0 + (s - this.x0) / (this.a * this.rc)), t.y = nt(this.lat0 + (a - this.y0) / this.a), t;
1959
+ }
1960
+ var We = ["Equirectangular", "Equidistant_Cylindrical", "eqc"];
1961
+ const Qe = {
1962
+ init: ze,
1963
+ forward: Ue,
1964
+ inverse: He,
1965
+ names: We
1966
+ };
1967
+ var cs = 20;
1968
+ function Xe() {
1969
+ this.temp = this.b / this.a, this.es = 1 - Math.pow(this.temp, 2), this.e = Math.sqrt(this.es), this.e0 = vt(this.es), this.e1 = dt(this.es), this.e2 = yt(this.es), this.e3 = mt(this.es), this.ml0 = this.a * O(this.e0, this.e1, this.e2, this.e3, this.lat0);
1970
+ }
1971
+ function Ye(t) {
1972
+ var s = t.x, a = t.y, i, e, h, r = b(s - this.long0);
1973
+ if (h = r * Math.sin(a), this.sphere)
1974
+ Math.abs(a) <= m ? (i = this.a * r, e = -1 * this.a * this.lat0) : (i = this.a * Math.sin(h) / Math.tan(a), e = this.a * (nt(a - this.lat0) + (1 - Math.cos(h)) / Math.tan(a)));
1975
+ else if (Math.abs(a) <= m)
1976
+ i = this.a * r, e = -1 * this.ml0;
1977
+ else {
1978
+ var n = rt(this.a, this.e, Math.sin(a)) / Math.tan(a);
1979
+ i = n * Math.sin(h), e = this.a * O(this.e0, this.e1, this.e2, this.e3, a) - this.ml0 + n * (1 - Math.cos(h));
1980
+ }
1981
+ return t.x = i + this.x0, t.y = e + this.y0, t;
1982
+ }
1983
+ function Ke(t) {
1984
+ var s, a, i, e, h, r, n, o, l;
1985
+ if (i = t.x - this.x0, e = t.y - this.y0, this.sphere)
1986
+ if (Math.abs(e + this.a * this.lat0) <= m)
1987
+ s = b(i / this.a + this.long0), a = 0;
1988
+ else {
1989
+ r = this.lat0 + e / this.a, n = i * i / this.a / this.a + r * r, o = r;
1990
+ var c;
1991
+ for (h = cs; h; --h)
1992
+ if (c = Math.tan(o), l = -1 * (r * (o * c + 1) - o - 0.5 * (o * o + n) * c) / ((o - r) / c - 1), o += l, Math.abs(l) <= m) {
1993
+ a = o;
1994
+ break;
1995
+ }
1996
+ s = b(this.long0 + Math.asin(i * Math.tan(o) / this.a) / Math.sin(a));
1997
+ }
1998
+ else if (Math.abs(e + this.ml0) <= m)
1999
+ a = 0, s = b(this.long0 + i / this.a);
2000
+ else {
2001
+ r = (this.ml0 + e) / this.a, n = i * i / this.a / this.a + r * r, o = r;
2002
+ var f, u, v, d, y;
2003
+ for (h = cs; h; --h)
2004
+ if (y = this.e * Math.sin(o), f = Math.sqrt(1 - y * y) * Math.tan(o), u = this.a * O(this.e0, this.e1, this.e2, this.e3, o), v = this.e0 - 2 * this.e1 * Math.cos(2 * o) + 4 * this.e2 * Math.cos(4 * o) - 6 * this.e3 * Math.cos(6 * o), d = u / this.a, l = (r * (f * d + 1) - d - 0.5 * f * (d * d + n)) / (this.es * Math.sin(2 * o) * (d * d + n - 2 * r * d) / (4 * f) + (r - d) * (f * v - 2 / Math.sin(2 * o)) - v), o -= l, Math.abs(l) <= m) {
2005
+ a = o;
2006
+ break;
2007
+ }
2008
+ f = Math.sqrt(1 - this.es * Math.pow(Math.sin(a), 2)) * Math.tan(a), s = b(this.long0 + Math.asin(i * f / this.a) / Math.sin(a));
2009
+ }
2010
+ return t.x = s, t.y = a, t;
2011
+ }
2012
+ var Ve = ["Polyconic", "poly"];
2013
+ const Ze = {
2014
+ init: Xe,
2015
+ forward: Ye,
2016
+ inverse: Ke,
2017
+ names: Ve
2018
+ };
2019
+ function Je() {
2020
+ this.A = [], this.A[1] = 0.6399175073, this.A[2] = -0.1358797613, this.A[3] = 0.063294409, this.A[4] = -0.02526853, this.A[5] = 0.0117879, this.A[6] = -55161e-7, this.A[7] = 26906e-7, this.A[8] = -1333e-6, this.A[9] = 67e-5, this.A[10] = -34e-5, this.B_re = [], this.B_im = [], this.B_re[1] = 0.7557853228, this.B_im[1] = 0, this.B_re[2] = 0.249204646, this.B_im[2] = 3371507e-9, this.B_re[3] = -1541739e-9, this.B_im[3] = 0.04105856, this.B_re[4] = -0.10162907, this.B_im[4] = 0.01727609, this.B_re[5] = -0.26623489, this.B_im[5] = -0.36249218, this.B_re[6] = -0.6870983, this.B_im[6] = -1.1651967, this.C_re = [], this.C_im = [], this.C_re[1] = 1.3231270439, this.C_im[1] = 0, this.C_re[2] = -0.577245789, this.C_im[2] = -7809598e-9, this.C_re[3] = 0.508307513, this.C_im[3] = -0.112208952, this.C_re[4] = -0.15094762, this.C_im[4] = 0.18200602, this.C_re[5] = 1.01418179, this.C_im[5] = 1.64497696, this.C_re[6] = 1.9660549, this.C_im[6] = 2.5127645, this.D = [], this.D[1] = 1.5627014243, this.D[2] = 0.5185406398, this.D[3] = -0.03333098, this.D[4] = -0.1052906, this.D[5] = -0.0368594, this.D[6] = 7317e-6, this.D[7] = 0.0122, this.D[8] = 394e-5, this.D[9] = -13e-4;
2021
+ }
2022
+ function th(t) {
2023
+ var s, a = t.x, i = t.y, e = i - this.lat0, h = a - this.long0, r = e / ct * 1e-5, n = h, o = 1, l = 0;
2024
+ for (s = 1; s <= 10; s++)
2025
+ o = o * r, l = l + this.A[s] * o;
2026
+ var c = l, f = n, u = 1, v = 0, d, y, g = 0, x = 0;
2027
+ for (s = 1; s <= 6; s++)
2028
+ d = u * c - v * f, y = v * c + u * f, u = d, v = y, g = g + this.B_re[s] * u - this.B_im[s] * v, x = x + this.B_im[s] * u + this.B_re[s] * v;
2029
+ return t.x = x * this.a + this.x0, t.y = g * this.a + this.y0, t;
2030
+ }
2031
+ function sh(t) {
2032
+ var s, a = t.x, i = t.y, e = a - this.x0, h = i - this.y0, r = h / this.a, n = e / this.a, o = 1, l = 0, c, f, u = 0, v = 0;
2033
+ for (s = 1; s <= 6; s++)
2034
+ c = o * r - l * n, f = l * r + o * n, o = c, l = f, u = u + this.C_re[s] * o - this.C_im[s] * l, v = v + this.C_im[s] * o + this.C_re[s] * l;
2035
+ for (var d = 0; d < this.iterations; d++) {
2036
+ var y = u, g = v, x, S, E = r, I = n;
2037
+ for (s = 2; s <= 6; s++)
2038
+ x = y * u - g * v, S = g * u + y * v, y = x, g = S, E = E + (s - 1) * (this.B_re[s] * y - this.B_im[s] * g), I = I + (s - 1) * (this.B_im[s] * y + this.B_re[s] * g);
2039
+ y = 1, g = 0;
2040
+ var R = this.B_re[1], P = this.B_im[1];
2041
+ for (s = 2; s <= 6; s++)
2042
+ x = y * u - g * v, S = g * u + y * v, y = x, g = S, R = R + s * (this.B_re[s] * y - this.B_im[s] * g), P = P + s * (this.B_im[s] * y + this.B_re[s] * g);
2043
+ var F = R * R + P * P;
2044
+ u = (E * R + I * P) / F, v = (I * R - E * P) / F;
2045
+ }
2046
+ var B = u, z = v, V = 1, Z = 0;
2047
+ for (s = 1; s <= 9; s++)
2048
+ V = V * B, Z = Z + this.D[s] * V;
2049
+ var gt = this.lat0 + Z * ct * 1e5, zs = this.long0 + z;
2050
+ return t.x = zs, t.y = gt, t;
2051
+ }
2052
+ var ah = ["New_Zealand_Map_Grid", "nzmg"];
2053
+ const ih = {
2054
+ init: Je,
2055
+ forward: th,
2056
+ inverse: sh,
2057
+ names: ah
2058
+ };
2059
+ function eh() {
2060
+ }
2061
+ function hh(t) {
2062
+ var s = t.x, a = t.y, i = b(s - this.long0), e = this.x0 + this.a * i, h = this.y0 + this.a * Math.log(Math.tan(Math.PI / 4 + a / 2.5)) * 1.25;
2063
+ return t.x = e, t.y = h, t;
2064
+ }
2065
+ function rh(t) {
2066
+ t.x -= this.x0, t.y -= this.y0;
2067
+ var s = b(this.long0 + t.x / this.a), a = 2.5 * (Math.atan(Math.exp(0.8 * t.y / this.a)) - Math.PI / 4);
2068
+ return t.x = s, t.y = a, t;
2069
+ }
2070
+ var nh = ["Miller_Cylindrical", "mill"];
2071
+ const oh = {
2072
+ init: eh,
2073
+ forward: hh,
2074
+ inverse: rh,
2075
+ names: nh
2076
+ };
2077
+ var lh = 20;
2078
+ function ch() {
2079
+ this.sphere ? (this.n = 1, this.m = 0, this.es = 0, this.C_y = Math.sqrt((this.m + 1) / this.n), this.C_x = this.C_y / (this.m + 1)) : this.en = As(this.es);
2080
+ }
2081
+ function fh(t) {
2082
+ var s, a, i = t.x, e = t.y;
2083
+ if (i = b(i - this.long0), this.sphere) {
2084
+ if (!this.m)
2085
+ e = this.n !== 1 ? Math.asin(this.n * Math.sin(e)) : e;
2086
+ else
2087
+ for (var h = this.n * Math.sin(e), r = lh; r; --r) {
2088
+ var n = (this.m * e + Math.sin(e) - h) / (this.m + Math.cos(e));
2089
+ if (e -= n, Math.abs(n) < m)
2090
+ break;
2091
+ }
2092
+ s = this.a * this.C_x * i * (this.m + Math.cos(e)), a = this.a * this.C_y * e;
2093
+ } else {
2094
+ var o = Math.sin(e), l = Math.cos(e);
2095
+ a = this.a * Ct(e, o, l, this.en), s = this.a * i * l / Math.sqrt(1 - this.es * o * o);
2096
+ }
2097
+ return t.x = s, t.y = a, t;
2098
+ }
2099
+ function uh(t) {
2100
+ var s, a, i, e;
2101
+ return t.x -= this.x0, i = t.x / this.a, t.y -= this.y0, s = t.y / this.a, this.sphere ? (s /= this.C_y, i = i / (this.C_x * (this.m + Math.cos(s))), this.m ? s = K((this.m * s + Math.sin(s)) / this.n) : this.n !== 1 && (s = K(Math.sin(s) / this.n)), i = b(i + this.long0), s = nt(s)) : (s = Ns(t.y / this.a, this.es, this.en), e = Math.abs(s), e < M ? (e = Math.sin(s), a = this.long0 + t.x * Math.sqrt(1 - this.es * e * e) / (this.a * Math.cos(s)), i = b(a)) : e - m < M && (i = this.long0)), t.x = i, t.y = s, t;
2102
+ }
2103
+ var Mh = ["Sinusoidal", "sinu"];
2104
+ const vh = {
2105
+ init: ch,
2106
+ forward: fh,
2107
+ inverse: uh,
2108
+ names: Mh
2109
+ };
2110
+ function dh() {
2111
+ }
2112
+ function yh(t) {
2113
+ for (var s = t.x, a = t.y, i = b(s - this.long0), e = a, h = Math.PI * Math.sin(a); ; ) {
2114
+ var r = -(e + Math.sin(e) - h) / (1 + Math.cos(e));
2115
+ if (e += r, Math.abs(r) < m)
2116
+ break;
2117
+ }
2118
+ e /= 2, Math.PI / 2 - Math.abs(a) < m && (i = 0);
2119
+ var n = 0.900316316158 * this.a * i * Math.cos(e) + this.x0, o = 1.4142135623731 * this.a * Math.sin(e) + this.y0;
2120
+ return t.x = n, t.y = o, t;
2121
+ }
2122
+ function mh(t) {
2123
+ var s, a;
2124
+ t.x -= this.x0, t.y -= this.y0, a = t.y / (1.4142135623731 * this.a), Math.abs(a) > 0.999999999999 && (a = 0.999999999999), s = Math.asin(a);
2125
+ var i = b(this.long0 + t.x / (0.900316316158 * this.a * Math.cos(s)));
2126
+ i < -Math.PI && (i = -Math.PI), i > Math.PI && (i = Math.PI), a = (2 * s + Math.sin(2 * s)) / Math.PI, Math.abs(a) > 1 && (a = 1);
2127
+ var e = Math.asin(a);
2128
+ return t.x = i, t.y = e, t;
2129
+ }
2130
+ var gh = ["Mollweide", "moll"];
2131
+ const bh = {
2132
+ init: dh,
2133
+ forward: yh,
2134
+ inverse: mh,
2135
+ names: gh
2136
+ };
2137
+ function _h() {
2138
+ Math.abs(this.lat1 + this.lat2) < m || (this.lat2 = this.lat2 || this.lat1, this.temp = this.b / this.a, this.es = 1 - Math.pow(this.temp, 2), this.e = Math.sqrt(this.es), this.e0 = vt(this.es), this.e1 = dt(this.es), this.e2 = yt(this.es), this.e3 = mt(this.es), this.sinphi = Math.sin(this.lat1), this.cosphi = Math.cos(this.lat1), this.ms1 = W(this.e, this.sinphi, this.cosphi), this.ml1 = O(this.e0, this.e1, this.e2, this.e3, this.lat1), Math.abs(this.lat1 - this.lat2) < m ? this.ns = this.sinphi : (this.sinphi = Math.sin(this.lat2), this.cosphi = Math.cos(this.lat2), this.ms2 = W(this.e, this.sinphi, this.cosphi), this.ml2 = O(this.e0, this.e1, this.e2, this.e3, this.lat2), this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1)), this.g = this.ml1 + this.ms1 / this.ns, this.ml0 = O(this.e0, this.e1, this.e2, this.e3, this.lat0), this.rh = this.a * (this.g - this.ml0));
2139
+ }
2140
+ function xh(t) {
2141
+ var s = t.x, a = t.y, i;
2142
+ if (this.sphere)
2143
+ i = this.a * (this.g - a);
2144
+ else {
2145
+ var e = O(this.e0, this.e1, this.e2, this.e3, a);
2146
+ i = this.a * (this.g - e);
2147
+ }
2148
+ var h = this.ns * b(s - this.long0), r = this.x0 + i * Math.sin(h), n = this.y0 + this.rh - i * Math.cos(h);
2149
+ return t.x = r, t.y = n, t;
2150
+ }
2151
+ function wh(t) {
2152
+ t.x -= this.x0, t.y = this.rh - t.y + this.y0;
2153
+ var s, a, i, e;
2154
+ this.ns >= 0 ? (a = Math.sqrt(t.x * t.x + t.y * t.y), s = 1) : (a = -Math.sqrt(t.x * t.x + t.y * t.y), s = -1);
2155
+ var h = 0;
2156
+ if (a !== 0 && (h = Math.atan2(s * t.x, s * t.y)), this.sphere)
2157
+ return e = b(this.long0 + h / this.ns), i = nt(this.g - a / this.a), t.x = e, t.y = i, t;
2158
+ var r = this.g - a / this.a;
2159
+ return i = At(r, this.e0, this.e1, this.e2, this.e3), e = b(this.long0 + h / this.ns), t.x = e, t.y = i, t;
2160
+ }
2161
+ var Eh = ["Equidistant_Conic", "eqdc"];
2162
+ const ph = {
2163
+ init: _h,
2164
+ forward: xh,
2165
+ inverse: wh,
2166
+ names: Eh
2167
+ };
2168
+ function Rh() {
2169
+ this.R = this.a;
2170
+ }
2171
+ function Ih(t) {
2172
+ var s = t.x, a = t.y, i = b(s - this.long0), e, h;
2173
+ Math.abs(a) <= m && (e = this.x0 + this.R * i, h = this.y0);
2174
+ var r = K(2 * Math.abs(a / Math.PI));
2175
+ (Math.abs(i) <= m || Math.abs(Math.abs(a) - M) <= m) && (e = this.x0, a >= 0 ? h = this.y0 + Math.PI * this.R * Math.tan(0.5 * r) : h = this.y0 + Math.PI * this.R * -Math.tan(0.5 * r));
2176
+ var n = 0.5 * Math.abs(Math.PI / i - i / Math.PI), o = n * n, l = Math.sin(r), c = Math.cos(r), f = c / (l + c - 1), u = f * f, v = f * (2 / l - 1), d = v * v, y = Math.PI * this.R * (n * (f - d) + Math.sqrt(o * (f - d) * (f - d) - (d + o) * (u - d))) / (d + o);
2177
+ i < 0 && (y = -y), e = this.x0 + y;
2178
+ var g = o + f;
2179
+ return y = Math.PI * this.R * (v * g - n * Math.sqrt((d + o) * (o + 1) - g * g)) / (d + o), a >= 0 ? h = this.y0 + y : h = this.y0 - y, t.x = e, t.y = h, t;
2180
+ }
2181
+ function Ph(t) {
2182
+ var s, a, i, e, h, r, n, o, l, c, f, u, v;
2183
+ return t.x -= this.x0, t.y -= this.y0, f = Math.PI * this.R, i = t.x / f, e = t.y / f, h = i * i + e * e, r = -Math.abs(e) * (1 + h), n = r - 2 * e * e + i * i, o = -2 * r + 1 + 2 * e * e + h * h, v = e * e / o + (2 * n * n * n / o / o / o - 9 * r * n / o / o) / 27, l = (r - n * n / 3 / o) / o, c = 2 * Math.sqrt(-l / 3), f = 3 * v / l / c, Math.abs(f) > 1 && (f >= 0 ? f = 1 : f = -1), u = Math.acos(f) / 3, t.y >= 0 ? a = (-c * Math.cos(u + Math.PI / 3) - n / 3 / o) * Math.PI : a = -(-c * Math.cos(u + Math.PI / 3) - n / 3 / o) * Math.PI, Math.abs(i) < m ? s = this.long0 : s = b(this.long0 + Math.PI * (h - 1 + Math.sqrt(1 + 2 * (i * i - e * e) + h * h)) / 2 / i), t.x = s, t.y = a, t;
2184
+ }
2185
+ var Sh = ["Van_der_Grinten_I", "VanDerGrinten", "vandg"];
2186
+ const Ah = {
2187
+ init: Rh,
2188
+ forward: Ih,
2189
+ inverse: Ph,
2190
+ names: Sh
2191
+ };
2192
+ function Nh() {
2193
+ this.sin_p12 = Math.sin(this.lat0), this.cos_p12 = Math.cos(this.lat0);
2194
+ }
2195
+ function Bh(t) {
2196
+ var s = t.x, a = t.y, i = Math.sin(t.y), e = Math.cos(t.y), h = b(s - this.long0), r, n, o, l, c, f, u, v, d, y, g, x, S, E, I, R, P, F, B, z, V, Z, gt;
2197
+ return this.sphere ? Math.abs(this.sin_p12 - 1) <= m ? (t.x = this.x0 + this.a * (M - a) * Math.sin(h), t.y = this.y0 - this.a * (M - a) * Math.cos(h), t) : Math.abs(this.sin_p12 + 1) <= m ? (t.x = this.x0 + this.a * (M + a) * Math.sin(h), t.y = this.y0 + this.a * (M + a) * Math.cos(h), t) : (F = this.sin_p12 * i + this.cos_p12 * e * Math.cos(h), R = Math.acos(F), P = R ? R / Math.sin(R) : 1, t.x = this.x0 + this.a * P * e * Math.sin(h), t.y = this.y0 + this.a * P * (this.cos_p12 * i - this.sin_p12 * e * Math.cos(h)), t) : (r = vt(this.es), n = dt(this.es), o = yt(this.es), l = mt(this.es), Math.abs(this.sin_p12 - 1) <= m ? (c = this.a * O(r, n, o, l, M), f = this.a * O(r, n, o, l, a), t.x = this.x0 + (c - f) * Math.sin(h), t.y = this.y0 - (c - f) * Math.cos(h), t) : Math.abs(this.sin_p12 + 1) <= m ? (c = this.a * O(r, n, o, l, M), f = this.a * O(r, n, o, l, a), t.x = this.x0 + (c + f) * Math.sin(h), t.y = this.y0 + (c + f) * Math.cos(h), t) : (u = i / e, v = rt(this.a, this.e, this.sin_p12), d = rt(this.a, this.e, i), y = Math.atan((1 - this.es) * u + this.es * v * this.sin_p12 / (d * e)), g = Math.atan2(Math.sin(h), this.cos_p12 * Math.tan(y) - this.sin_p12 * Math.cos(h)), g === 0 ? B = Math.asin(this.cos_p12 * Math.sin(y) - this.sin_p12 * Math.cos(y)) : Math.abs(Math.abs(g) - Math.PI) <= m ? B = -Math.asin(this.cos_p12 * Math.sin(y) - this.sin_p12 * Math.cos(y)) : B = Math.asin(Math.sin(h) * Math.cos(y) / Math.sin(g)), x = this.e * this.sin_p12 / Math.sqrt(1 - this.es), S = this.e * this.cos_p12 * Math.cos(g) / Math.sqrt(1 - this.es), E = x * S, I = S * S, z = B * B, V = z * B, Z = V * B, gt = Z * B, R = v * B * (1 - z * I * (1 - I) / 6 + V / 8 * E * (1 - 2 * I) + Z / 120 * (I * (4 - 7 * I) - 3 * x * x * (1 - 7 * I)) - gt / 48 * E), t.x = this.x0 + R * Math.sin(g), t.y = this.y0 + R * Math.cos(g), t));
2198
+ }
2199
+ function Ch(t) {
2200
+ t.x -= this.x0, t.y -= this.y0;
2201
+ var s, a, i, e, h, r, n, o, l, c, f, u, v, d, y, g, x, S, E, I, R, P, F, B;
2202
+ return this.sphere ? (s = Math.sqrt(t.x * t.x + t.y * t.y), s > 2 * M * this.a ? void 0 : (a = s / this.a, i = Math.sin(a), e = Math.cos(a), h = this.long0, Math.abs(s) <= m ? r = this.lat0 : (r = K(e * this.sin_p12 + t.y * i * this.cos_p12 / s), n = Math.abs(this.lat0) - M, Math.abs(n) <= m ? this.lat0 >= 0 ? h = b(this.long0 + Math.atan2(t.x, -t.y)) : h = b(this.long0 - Math.atan2(-t.x, t.y)) : h = b(this.long0 + Math.atan2(t.x * i, s * this.cos_p12 * e - t.y * this.sin_p12 * i))), t.x = h, t.y = r, t)) : (o = vt(this.es), l = dt(this.es), c = yt(this.es), f = mt(this.es), Math.abs(this.sin_p12 - 1) <= m ? (u = this.a * O(o, l, c, f, M), s = Math.sqrt(t.x * t.x + t.y * t.y), v = u - s, r = At(v / this.a, o, l, c, f), h = b(this.long0 + Math.atan2(t.x, -1 * t.y)), t.x = h, t.y = r, t) : Math.abs(this.sin_p12 + 1) <= m ? (u = this.a * O(o, l, c, f, M), s = Math.sqrt(t.x * t.x + t.y * t.y), v = s - u, r = At(v / this.a, o, l, c, f), h = b(this.long0 + Math.atan2(t.x, t.y)), t.x = h, t.y = r, t) : (s = Math.sqrt(t.x * t.x + t.y * t.y), g = Math.atan2(t.x, t.y), d = rt(this.a, this.e, this.sin_p12), x = Math.cos(g), S = this.e * this.cos_p12 * x, E = -S * S / (1 - this.es), I = 3 * this.es * (1 - E) * this.sin_p12 * this.cos_p12 * x / (1 - this.es), R = s / d, P = R - E * (1 + E) * Math.pow(R, 3) / 6 - I * (1 + 3 * E) * Math.pow(R, 4) / 24, F = 1 - E * P * P / 2 - R * P * P * P / 6, y = Math.asin(this.sin_p12 * Math.cos(P) + this.cos_p12 * Math.sin(P) * x), h = b(this.long0 + Math.asin(Math.sin(g) * Math.sin(P) / Math.cos(y))), B = Math.sin(y), r = Math.atan2((B - this.es * F * this.sin_p12) * Math.tan(y), B * (1 - this.es)), t.x = h, t.y = r, t));
2203
+ }
2204
+ var Dh = ["Azimuthal_Equidistant", "aeqd"];
2205
+ const kh = {
2206
+ init: Nh,
2207
+ forward: Bh,
2208
+ inverse: Ch,
2209
+ names: Dh
2210
+ };
2211
+ function Lh() {
2212
+ this.sin_p14 = Math.sin(this.lat0), this.cos_p14 = Math.cos(this.lat0);
2213
+ }
2214
+ function $h(t) {
2215
+ var s, a, i, e, h, r, n, o, l = t.x, c = t.y;
2216
+ return i = b(l - this.long0), s = Math.sin(c), a = Math.cos(c), e = Math.cos(i), r = this.sin_p14 * s + this.cos_p14 * a * e, h = 1, (r > 0 || Math.abs(r) <= m) && (n = this.a * h * a * Math.sin(i), o = this.y0 + this.a * h * (this.cos_p14 * s - this.sin_p14 * a * e)), t.x = n, t.y = o, t;
2217
+ }
2218
+ function Oh(t) {
2219
+ var s, a, i, e, h, r, n;
2220
+ return t.x -= this.x0, t.y -= this.y0, s = Math.sqrt(t.x * t.x + t.y * t.y), a = K(s / this.a), i = Math.sin(a), e = Math.cos(a), r = this.long0, Math.abs(s) <= m ? (n = this.lat0, t.x = r, t.y = n, t) : (n = K(e * this.sin_p14 + t.y * i * this.cos_p14 / s), h = Math.abs(this.lat0) - M, Math.abs(h) <= m ? (this.lat0 >= 0 ? r = b(this.long0 + Math.atan2(t.x, -t.y)) : r = b(this.long0 - Math.atan2(-t.x, t.y)), t.x = r, t.y = n, t) : (r = b(this.long0 + Math.atan2(t.x * i, s * this.cos_p14 * e - t.y * this.sin_p14 * i)), t.x = r, t.y = n, t));
2221
+ }
2222
+ var Th = ["ortho"];
2223
+ const qh = {
2224
+ init: Lh,
2225
+ forward: $h,
2226
+ inverse: Oh,
2227
+ names: Th
2228
+ };
2229
+ var A = {
2230
+ FRONT: 1,
2231
+ RIGHT: 2,
2232
+ BACK: 3,
2233
+ LEFT: 4,
2234
+ TOP: 5,
2235
+ BOTTOM: 6
2236
+ }, w = {
2237
+ AREA_0: 1,
2238
+ AREA_1: 2,
2239
+ AREA_2: 3,
2240
+ AREA_3: 4
2241
+ };
2242
+ function Fh() {
2243
+ this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, this.lat0 = this.lat0 || 0, this.long0 = this.long0 || 0, this.lat_ts = this.lat_ts || 0, this.title = this.title || "Quadrilateralized Spherical Cube", this.lat0 >= M - p / 2 ? this.face = A.TOP : this.lat0 <= -(M - p / 2) ? this.face = A.BOTTOM : Math.abs(this.long0) <= p ? this.face = A.FRONT : Math.abs(this.long0) <= M + p ? this.face = this.long0 > 0 ? A.RIGHT : A.LEFT : this.face = A.BACK, this.es !== 0 && (this.one_minus_f = 1 - (this.a - this.b) / this.a, this.one_minus_f_squared = this.one_minus_f * this.one_minus_f);
2244
+ }
2245
+ function Gh(t) {
2246
+ var s = { x: 0, y: 0 }, a, i, e, h, r, n, o = { value: 0 };
2247
+ if (t.x -= this.long0, this.es !== 0 ? a = Math.atan(this.one_minus_f_squared * Math.tan(t.y)) : a = t.y, i = t.x, this.face === A.TOP)
2248
+ h = M - a, i >= p && i <= M + p ? (o.value = w.AREA_0, e = i - M) : i > M + p || i <= -(M + p) ? (o.value = w.AREA_1, e = i > 0 ? i - N : i + N) : i > -(M + p) && i <= -p ? (o.value = w.AREA_2, e = i + M) : (o.value = w.AREA_3, e = i);
2249
+ else if (this.face === A.BOTTOM)
2250
+ h = M + a, i >= p && i <= M + p ? (o.value = w.AREA_0, e = -i + M) : i < p && i >= -p ? (o.value = w.AREA_1, e = -i) : i < -p && i >= -(M + p) ? (o.value = w.AREA_2, e = -i - M) : (o.value = w.AREA_3, e = i > 0 ? -i + N : -i - N);
2251
+ else {
2252
+ var l, c, f, u, v, d, y;
2253
+ this.face === A.RIGHT ? i = et(i, +M) : this.face === A.BACK ? i = et(i, +N) : this.face === A.LEFT && (i = et(i, -M)), u = Math.sin(a), v = Math.cos(a), d = Math.sin(i), y = Math.cos(i), l = v * y, c = v * d, f = u, this.face === A.FRONT ? (h = Math.acos(l), e = xt(h, f, c, o)) : this.face === A.RIGHT ? (h = Math.acos(c), e = xt(h, f, -l, o)) : this.face === A.BACK ? (h = Math.acos(-l), e = xt(h, f, -c, o)) : this.face === A.LEFT ? (h = Math.acos(-c), e = xt(h, f, l, o)) : (h = e = 0, o.value = w.AREA_0);
2254
+ }
2255
+ return n = Math.atan(12 / N * (e + Math.acos(Math.sin(e) * Math.cos(p)) - M)), r = Math.sqrt((1 - Math.cos(h)) / (Math.cos(n) * Math.cos(n)) / (1 - Math.cos(Math.atan(1 / Math.cos(e))))), o.value === w.AREA_1 ? n += M : o.value === w.AREA_2 ? n += N : o.value === w.AREA_3 && (n += 1.5 * N), s.x = r * Math.cos(n), s.y = r * Math.sin(n), s.x = s.x * this.a + this.x0, s.y = s.y * this.a + this.y0, t.x = s.x, t.y = s.y, t;
2256
+ }
2257
+ function jh(t) {
2258
+ var s = { lam: 0, phi: 0 }, a, i, e, h, r, n, o, l, c, f = { value: 0 };
2259
+ if (t.x = (t.x - this.x0) / this.a, t.y = (t.y - this.y0) / this.a, i = Math.atan(Math.sqrt(t.x * t.x + t.y * t.y)), a = Math.atan2(t.y, t.x), t.x >= 0 && t.x >= Math.abs(t.y) ? f.value = w.AREA_0 : t.y >= 0 && t.y >= Math.abs(t.x) ? (f.value = w.AREA_1, a -= M) : t.x < 0 && -t.x >= Math.abs(t.y) ? (f.value = w.AREA_2, a = a < 0 ? a + N : a - N) : (f.value = w.AREA_3, a += M), c = N / 12 * Math.tan(a), r = Math.sin(c) / (Math.cos(c) - 1 / Math.sqrt(2)), n = Math.atan(r), e = Math.cos(a), h = Math.tan(i), o = 1 - e * e * h * h * (1 - Math.cos(Math.atan(1 / Math.cos(n)))), o < -1 ? o = -1 : o > 1 && (o = 1), this.face === A.TOP)
2260
+ l = Math.acos(o), s.phi = M - l, f.value === w.AREA_0 ? s.lam = n + M : f.value === w.AREA_1 ? s.lam = n < 0 ? n + N : n - N : f.value === w.AREA_2 ? s.lam = n - M : s.lam = n;
2261
+ else if (this.face === A.BOTTOM)
2262
+ l = Math.acos(o), s.phi = l - M, f.value === w.AREA_0 ? s.lam = -n + M : f.value === w.AREA_1 ? s.lam = -n : f.value === w.AREA_2 ? s.lam = -n - M : s.lam = n < 0 ? -n - N : -n + N;
2263
+ else {
2264
+ var u, v, d;
2265
+ u = o, c = u * u, c >= 1 ? d = 0 : d = Math.sqrt(1 - c) * Math.sin(n), c += d * d, c >= 1 ? v = 0 : v = Math.sqrt(1 - c), f.value === w.AREA_1 ? (c = v, v = -d, d = c) : f.value === w.AREA_2 ? (v = -v, d = -d) : f.value === w.AREA_3 && (c = v, v = d, d = -c), this.face === A.RIGHT ? (c = u, u = -v, v = c) : this.face === A.BACK ? (u = -u, v = -v) : this.face === A.LEFT && (c = u, u = v, v = -c), s.phi = Math.acos(-d) - M, s.lam = Math.atan2(v, u), this.face === A.RIGHT ? s.lam = et(s.lam, -M) : this.face === A.BACK ? s.lam = et(s.lam, -N) : this.face === A.LEFT && (s.lam = et(s.lam, +M));
2266
+ }
2267
+ if (this.es !== 0) {
2268
+ var y, g, x;
2269
+ y = s.phi < 0 ? 1 : 0, g = Math.tan(s.phi), x = this.b / Math.sqrt(g * g + this.one_minus_f_squared), s.phi = Math.atan(Math.sqrt(this.a * this.a - x * x) / (this.one_minus_f * x)), y && (s.phi = -s.phi);
2270
+ }
2271
+ return s.lam += this.long0, t.x = s.lam, t.y = s.phi, t;
2272
+ }
2273
+ function xt(t, s, a, i) {
2274
+ var e;
2275
+ return t < m ? (i.value = w.AREA_0, e = 0) : (e = Math.atan2(s, a), Math.abs(e) <= p ? i.value = w.AREA_0 : e > p && e <= M + p ? (i.value = w.AREA_1, e -= M) : e > M + p || e <= -(M + p) ? (i.value = w.AREA_2, e = e >= 0 ? e - N : e + N) : (i.value = w.AREA_3, e += M)), e;
2276
+ }
2277
+ function et(t, s) {
2278
+ var a = t + s;
2279
+ return a < -N ? a += Ft : a > +N && (a -= Ft), a;
2280
+ }
2281
+ var zh = ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube", "qsc"];
2282
+ const Uh = {
2283
+ init: Fh,
2284
+ forward: Gh,
2285
+ inverse: jh,
2286
+ names: zh
2287
+ };
2288
+ var jt = [
2289
+ [1, 22199e-21, -715515e-10, 31103e-10],
2290
+ [0.9986, -482243e-9, -24897e-9, -13309e-10],
2291
+ [0.9954, -83103e-8, -448605e-10, -986701e-12],
2292
+ [0.99, -135364e-8, -59661e-9, 36777e-10],
2293
+ [0.9822, -167442e-8, -449547e-11, -572411e-11],
2294
+ [0.973, -214868e-8, -903571e-10, 18736e-12],
2295
+ [0.96, -305085e-8, -900761e-10, 164917e-11],
2296
+ [0.9427, -382792e-8, -653386e-10, -26154e-10],
2297
+ [0.9216, -467746e-8, -10457e-8, 481243e-11],
2298
+ [0.8962, -536223e-8, -323831e-10, -543432e-11],
2299
+ [0.8679, -609363e-8, -113898e-9, 332484e-11],
2300
+ [0.835, -698325e-8, -640253e-10, 934959e-12],
2301
+ [0.7986, -755338e-8, -500009e-10, 935324e-12],
2302
+ [0.7597, -798324e-8, -35971e-9, -227626e-11],
2303
+ [0.7186, -851367e-8, -701149e-10, -86303e-10],
2304
+ [0.6732, -986209e-8, -199569e-9, 191974e-10],
2305
+ [0.6213, -0.010418, 883923e-10, 624051e-11],
2306
+ [0.5722, -906601e-8, 182e-6, 624051e-11],
2307
+ [0.5322, -677797e-8, 275608e-9, 624051e-11]
2308
+ ], lt = [
2309
+ [-520417e-23, 0.0124, 121431e-23, -845284e-16],
2310
+ [0.062, 0.0124, -126793e-14, 422642e-15],
2311
+ [0.124, 0.0124, 507171e-14, -160604e-14],
2312
+ [0.186, 0.0123999, -190189e-13, 600152e-14],
2313
+ [0.248, 0.0124002, 710039e-13, -224e-10],
2314
+ [0.31, 0.0123992, -264997e-12, 835986e-13],
2315
+ [0.372, 0.0124029, 988983e-12, -311994e-12],
2316
+ [0.434, 0.0123893, -369093e-11, -435621e-12],
2317
+ [0.4958, 0.0123198, -102252e-10, -345523e-12],
2318
+ [0.5571, 0.0121916, -154081e-10, -582288e-12],
2319
+ [0.6176, 0.0119938, -241424e-10, -525327e-12],
2320
+ [0.6769, 0.011713, -320223e-10, -516405e-12],
2321
+ [0.7346, 0.0113541, -397684e-10, -609052e-12],
2322
+ [0.7903, 0.0109107, -489042e-10, -104739e-11],
2323
+ [0.8435, 0.0103431, -64615e-9, -140374e-14],
2324
+ [0.8936, 969686e-8, -64636e-9, -8547e-9],
2325
+ [0.9394, 840947e-8, -192841e-9, -42106e-10],
2326
+ [0.9761, 616527e-8, -256e-6, -42106e-10],
2327
+ [1, 328947e-8, -319159e-9, -42106e-10]
2328
+ ], Ds = 0.8487, ks = 1.3523, Ls = Q / 5, Hh = 1 / Ls, it = 18, Nt = function(t, s) {
2329
+ return t[0] + s * (t[1] + s * (t[2] + s * t[3]));
2330
+ }, Wh = function(t, s) {
2331
+ return t[1] + s * (2 * t[2] + s * 3 * t[3]);
2332
+ };
2333
+ function Qh(t, s, a, i) {
2334
+ for (var e = s; i; --i) {
2335
+ var h = t(e);
2336
+ if (e -= h, Math.abs(h) < a)
2337
+ break;
2338
+ }
2339
+ return e;
2340
+ }
2341
+ function Xh() {
2342
+ this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, this.long0 = this.long0 || 0, this.es = 0, this.title = this.title || "Robinson";
2343
+ }
2344
+ function Yh(t) {
2345
+ var s = b(t.x - this.long0), a = Math.abs(t.y), i = Math.floor(a * Ls);
2346
+ i < 0 ? i = 0 : i >= it && (i = it - 1), a = Q * (a - Hh * i);
2347
+ var e = {
2348
+ x: Nt(jt[i], a) * s,
2349
+ y: Nt(lt[i], a)
2350
+ };
2351
+ return t.y < 0 && (e.y = -e.y), e.x = e.x * this.a * Ds + this.x0, e.y = e.y * this.a * ks + this.y0, e;
2352
+ }
2353
+ function Kh(t) {
2354
+ var s = {
2355
+ x: (t.x - this.x0) / (this.a * Ds),
2356
+ y: Math.abs(t.y - this.y0) / (this.a * ks)
2357
+ };
2358
+ if (s.y >= 1)
2359
+ s.x /= jt[it][0], s.y = t.y < 0 ? -M : M;
2360
+ else {
2361
+ var a = Math.floor(s.y * it);
2362
+ for (a < 0 ? a = 0 : a >= it && (a = it - 1); ; )
2363
+ if (lt[a][0] > s.y)
2364
+ --a;
2365
+ else if (lt[a + 1][0] <= s.y)
2366
+ ++a;
2367
+ else
2368
+ break;
2369
+ var i = lt[a], e = 5 * (s.y - i[0]) / (lt[a + 1][0] - i[0]);
2370
+ e = Qh(function(h) {
2371
+ return (Nt(i, h) - s.y) / Wh(i, h);
2372
+ }, e, m, 100), s.x /= Nt(jt[a], e), s.y = (5 * a + e) * D, t.y < 0 && (s.y = -s.y);
2373
+ }
2374
+ return s.x = b(s.x + this.long0), s;
2375
+ }
2376
+ var Vh = ["Robinson", "robin"];
2377
+ const Zh = {
2378
+ init: Xh,
2379
+ forward: Yh,
2380
+ inverse: Kh,
2381
+ names: Vh
2382
+ };
2383
+ function Jh() {
2384
+ this.name = "geocent";
2385
+ }
2386
+ function tr(t) {
2387
+ var s = Is(t, this.es, this.a);
2388
+ return s;
2389
+ }
2390
+ function sr(t) {
2391
+ var s = Ps(t, this.es, this.a, this.b);
2392
+ return s;
2393
+ }
2394
+ var ar = ["Geocentric", "geocentric", "geocent", "Geocent"];
2395
+ const ir = {
2396
+ init: Jh,
2397
+ forward: tr,
2398
+ inverse: sr,
2399
+ names: ar
2400
+ };
2401
+ function er(t) {
2402
+ t.Proj.projections.add(li), t.Proj.projections.add(Rt), t.Proj.projections.add(wi), t.Proj.projections.add(Bi), t.Proj.projections.add(Oi), t.Proj.projections.add(ji), t.Proj.projections.add(Qi), t.Proj.projections.add(Zi), t.Proj.projections.add(ie), t.Proj.projections.add(oe), t.Proj.projections.add(Re), t.Proj.projections.add(Be), t.Proj.projections.add($e), t.Proj.projections.add(je), t.Proj.projections.add(Qe), t.Proj.projections.add(Ze), t.Proj.projections.add(ih), t.Proj.projections.add(oh), t.Proj.projections.add(vh), t.Proj.projections.add(bh), t.Proj.projections.add(ph), t.Proj.projections.add(Ah), t.Proj.projections.add(kh), t.Proj.projections.add(qh), t.Proj.projections.add(Uh), t.Proj.projections.add(Zh), t.Proj.projections.add(ir);
2403
+ }
2404
+ q.defaultDatum = "WGS84";
2405
+ q.Proj = H;
2406
+ q.WGS84 = new q.Proj("WGS84");
2407
+ q.Point = ht;
2408
+ q.toPoint = Ss;
2409
+ q.defs = k;
2410
+ q.transform = St;
2411
+ q.mgrs = Qs;
2412
+ q.version = "__VERSION__";
2413
+ er(q);
2414
+ class hr {
2415
+ /** Define aliases for one or more projections */
2416
+ static defineProjectionAliases(s) {
2417
+ const a = [];
2418
+ for (const i in s)
2419
+ a.push([i, s[i]]);
2420
+ q.defs(a);
2421
+ }
2422
+ constructor({ from: s = "WGS84", to: a = "WGS84" }) {
2423
+ if (this._projection = q(s, a), !this._projection)
2424
+ throw new Error("Invalid projection");
2425
+ this.project = this.project.bind(this), this.unproject = this.unproject.bind(this);
2426
+ }
2427
+ /** Project a coordinate project from first to second coordinate system */
2428
+ project(s) {
2429
+ return this._projection.forward(s);
2430
+ }
2431
+ /** Project a coordinate project from second to first coordinate system */
2432
+ unproject(s) {
2433
+ return this._projection.inverse(s);
2434
+ }
2435
+ }
2436
+ const $t = 100, fs = !1;
2437
+ function rr(t) {
2438
+ const s = new DataView(t, 0, $t), i = _s(s).length - $t, e = new DataView(t, $t, i), h = new Int32Array(i), r = new Int32Array(i);
2439
+ for (let n = 0; n < i / 8; n++)
2440
+ h[n] = e.getInt32(n * 8, fs), r[n] = e.getInt32(n * 8 + 4, fs);
2441
+ return {
2442
+ offsets: h,
2443
+ lengths: r
2444
+ };
2445
+ }
2446
+ async function* nr(t, s, a) {
2447
+ const i = [], e = [];
2448
+ let h = !1, r = !1;
2449
+ for (; !h && !r; ) {
2450
+ if (i.length === 0 && !h) {
2451
+ const { value: o, done: l } = await t.next();
2452
+ l ? h = !0 : i.push(...o);
2453
+ }
2454
+ if (e.length === 0 && !r) {
2455
+ const { value: o, done: l } = await s.next();
2456
+ l ? r = !0 : e.push(...o);
2457
+ }
2458
+ const n = or(i, e);
2459
+ n && (yield {
2460
+ batchType: "data",
2461
+ shape: a,
2462
+ length: n.length,
2463
+ data: n
2464
+ });
2465
+ }
2466
+ }
2467
+ function or(t, s) {
2468
+ const a = Math.min(t.length, s.length);
2469
+ if (a === 0)
2470
+ return null;
2471
+ const i = [t.slice(0, a), s.slice(0, a)];
2472
+ return t.splice(0, a), s.splice(0, a), i;
2473
+ }
2474
+ const Ot = !0, us = 32;
2475
+ var L;
2476
+ (function(t) {
2477
+ t[t.START = 0] = "START", t[t.FIELD_DESCRIPTORS = 1] = "FIELD_DESCRIPTORS", t[t.FIELD_PROPERTIES = 2] = "FIELD_PROPERTIES", t[t.END = 3] = "END", t[t.ERROR = 4] = "ERROR";
2478
+ })(L || (L = {}));
2479
+ let $s = class {
2480
+ binaryReader = new zt();
2481
+ textDecoder;
2482
+ state = L.START;
2483
+ result = {
2484
+ data: []
2485
+ };
2486
+ constructor(s) {
2487
+ this.textDecoder = new TextDecoder(s.encoding);
2488
+ }
2489
+ /**
2490
+ * @param arrayBuffer
2491
+ */
2492
+ write(s) {
2493
+ this.binaryReader.write(s), this.state = vs(this.state, this.result, this.binaryReader, this.textDecoder);
2494
+ }
2495
+ end() {
2496
+ this.binaryReader.end(), this.state = vs(this.state, this.result, this.binaryReader, this.textDecoder), this.state !== L.END && (this.state = L.ERROR, this.result.error = "DBF incomplete file");
2497
+ }
2498
+ };
2499
+ function Ms(t, s = {}) {
2500
+ const { encoding: a = "latin1" } = s.dbf || {}, i = new $s({ encoding: a });
2501
+ i.write(t), i.end();
2502
+ const { data: e, schema: h } = i.result;
2503
+ switch (s?.dbf?.shape) {
2504
+ case "object-row-table":
2505
+ return {
2506
+ shape: "object-row-table",
2507
+ schema: h,
2508
+ data: e
2509
+ };
2510
+ case "table":
2511
+ return { schema: h, rows: e };
2512
+ case "rows":
2513
+ default:
2514
+ return e;
2515
+ }
2516
+ }
2517
+ async function* lr(t, s = {}) {
2518
+ const { encoding: a = "latin1" } = s.dbf || {}, i = new $s({ encoding: a });
2519
+ let e = !1;
2520
+ for await (const h of Bt(t))
2521
+ i.write(h), !e && i.result.dbfHeader && (e = !0, yield i.result.dbfHeader), i.result.data.length > 0 && (yield i.result.data, i.result.data = []);
2522
+ i.end(), i.result.data.length > 0 && (yield i.result.data);
2523
+ }
2524
+ function vs(t, s, a, i) {
2525
+ for (; ; )
2526
+ try {
2527
+ switch (t) {
2528
+ case L.ERROR:
2529
+ case L.END:
2530
+ return t;
2531
+ case L.START:
2532
+ const e = a.getDataView(us);
2533
+ if (!e)
2534
+ return t;
2535
+ s.dbfHeader = cr(e), s.progress = {
2536
+ bytesUsed: 0,
2537
+ rowsTotal: s.dbfHeader.nRecords,
2538
+ rows: 0
2539
+ }, t = L.FIELD_DESCRIPTORS;
2540
+ break;
2541
+ case L.FIELD_DESCRIPTORS:
2542
+ const h = a.getDataView(
2543
+ // @ts-ignore
2544
+ s.dbfHeader.headerLength - us
2545
+ );
2546
+ if (!h)
2547
+ return t;
2548
+ s.dbfFields = fr(h, i), s.schema = {
2549
+ fields: s.dbfFields.map((o) => mr(o)),
2550
+ metadata: {}
2551
+ }, t = L.FIELD_PROPERTIES, a.skip(1);
2552
+ break;
2553
+ case L.FIELD_PROPERTIES:
2554
+ const { recordLength: r = 0, nRecords: n = 0 } = s?.dbfHeader || {};
2555
+ for (; s.data.length < n; ) {
2556
+ const o = a.getDataView(r - 1);
2557
+ if (!o)
2558
+ return t;
2559
+ a.skip(1);
2560
+ const l = ur(o, s.dbfFields, i);
2561
+ s.data.push(l), s.progress.rows = s.data.length;
2562
+ }
2563
+ t = L.END;
2564
+ break;
2565
+ default:
2566
+ return t = L.ERROR, s.error = `illegal parser state ${t}`, t;
2567
+ }
2568
+ } catch (e) {
2569
+ return t = L.ERROR, s.error = `DBF parsing failed: ${e.message}`, t;
2570
+ }
2571
+ }
2572
+ function cr(t) {
2573
+ return {
2574
+ // Last updated date
2575
+ year: t.getUint8(1) + 1900,
2576
+ month: t.getUint8(2),
2577
+ day: t.getUint8(3),
2578
+ // Number of records in data file
2579
+ nRecords: t.getUint32(4, Ot),
2580
+ // Length of header in bytes
2581
+ headerLength: t.getUint16(8, Ot),
2582
+ // Length of each record
2583
+ recordLength: t.getUint16(10, Ot),
2584
+ // Not sure if this is usually set
2585
+ languageDriver: t.getUint8(29)
2586
+ };
2587
+ }
2588
+ function fr(t, s) {
2589
+ const a = (t.byteLength - 1) / 32, i = [];
2590
+ let e = 0;
2591
+ for (let h = 0; h < a; h++) {
2592
+ const r = s.decode(new Uint8Array(t.buffer, t.byteOffset + e, 11)).replace(/\u0000/g, "");
2593
+ i.push({
2594
+ name: r,
2595
+ dataType: String.fromCharCode(t.getUint8(e + 11)),
2596
+ fieldLength: t.getUint8(e + 16),
2597
+ decimal: t.getUint8(e + 17)
2598
+ }), e += 32;
2599
+ }
2600
+ return i;
2601
+ }
2602
+ function ur(t, s, a) {
2603
+ const i = {};
2604
+ let e = 0;
2605
+ for (const h of s) {
2606
+ const r = a.decode(new Uint8Array(t.buffer, t.byteOffset + e, h.fieldLength));
2607
+ i[h.name] = Mr(r, h.dataType), e += h.fieldLength;
2608
+ }
2609
+ return i;
2610
+ }
2611
+ function Mr(t, s) {
2612
+ switch (s) {
2613
+ case "B":
2614
+ return wt(t);
2615
+ case "C":
2616
+ return yr(t);
2617
+ case "F":
2618
+ return wt(t);
2619
+ case "N":
2620
+ return wt(t);
2621
+ case "O":
2622
+ return wt(t);
2623
+ case "D":
2624
+ return vr(t);
2625
+ case "L":
2626
+ return dr(t);
2627
+ default:
2628
+ throw new Error("Unsupported data type");
2629
+ }
2630
+ }
2631
+ function vr(t) {
2632
+ return Date.UTC(t.slice(0, 4), parseInt(t.slice(4, 6), 10) - 1, t.slice(6, 8));
2633
+ }
2634
+ function dr(t) {
2635
+ return /^[nf]$/i.test(t) ? !1 : /^[yt]$/i.test(t) ? !0 : null;
2636
+ }
2637
+ function wt(t) {
2638
+ const s = parseFloat(t);
2639
+ return isNaN(s) ? null : s;
2640
+ }
2641
+ function yr(t) {
2642
+ return t.trim() || null;
2643
+ }
2644
+ function mr({ name: t, dataType: s, fieldLength: a, decimal: i }) {
2645
+ switch (s) {
2646
+ case "B":
2647
+ return { name: t, type: "float64", nullable: !0, metadata: {} };
2648
+ case "C":
2649
+ return { name: t, type: "utf8", nullable: !0, metadata: {} };
2650
+ case "F":
2651
+ return { name: t, type: "float64", nullable: !0, metadata: {} };
2652
+ case "N":
2653
+ return { name: t, type: "float64", nullable: !0, metadata: {} };
2654
+ case "O":
2655
+ return { name: t, type: "float64", nullable: !0, metadata: {} };
2656
+ case "D":
2657
+ return { name: t, type: "timestamp-millisecond", nullable: !0, metadata: {} };
2658
+ case "L":
2659
+ return { name: t, type: "bool", nullable: !0, metadata: {} };
2660
+ default:
2661
+ throw new Error("Unsupported data type");
2662
+ }
2663
+ }
2664
+ const gr = "4.4.3", br = {
2665
+ name: "DBF",
2666
+ dataType: null,
2667
+ batchType: null,
2668
+ id: "dbf",
2669
+ module: "shapefile",
2670
+ version: gr,
2671
+ worker: !0,
2672
+ category: "table",
2673
+ extensions: ["dbf"],
2674
+ mimeTypes: ["application/x-dbf"],
2675
+ options: {
2676
+ dbf: {
2677
+ encoding: "latin1"
2678
+ }
2679
+ }
2680
+ }, Os = {
2681
+ ...br,
2682
+ parse: async (t, s) => Ms(t, s),
2683
+ parseSync: Ms,
2684
+ parseInBatches(t, s) {
2685
+ return lr(t, s);
2686
+ }
2687
+ };
2688
+ async function* _r(t, s, a) {
2689
+ const { reproject: i = !1, _targetCrs: e = "WGS84" } = s?.gis || {}, { shx: h, cpg: r, prj: n } = await Gs(s, a), o = await Xt(Bt(t), ps, s, a), l = o[Symbol.asyncIterator]?.() || o[Symbol.iterator]?.();
2690
+ let c = null;
2691
+ const f = await a?.fetch(ft(a?.url || "", "dbf"));
2692
+ if (f?.ok) {
2693
+ const g = await Xt(f, Os, {
2694
+ ...s,
2695
+ dbf: {
2696
+ ...s?.dbf,
2697
+ encoding: r || "latin1"
2698
+ }
2699
+ }, a);
2700
+ c = g[Symbol.asyncIterator]?.() || g[Symbol.iterator]();
2701
+ }
2702
+ let u = (await l.next()).value;
2703
+ u && u.batchType === "metadata" && (u = (await l.next()).value);
2704
+ let v = {};
2705
+ c && (v = (await c.next()).value, v && v.batchType === "metadata" && (v = (await c.next()).value));
2706
+ const d = c ? nr(l, c, "object-row-table") : l, y = {
2707
+ [Symbol.asyncIterator]() {
2708
+ return d;
2709
+ }
2710
+ };
2711
+ for await (const g of y) {
2712
+ let x, S;
2713
+ c ? [x, S] = g.data : x = g;
2714
+ const E = Ts(x);
2715
+ let I = qs(E, S);
2716
+ i && (I = Fs(I, n, e)), yield {
2717
+ encoding: r,
2718
+ prj: n,
2719
+ shx: h,
2720
+ header: u,
2721
+ data: I
2722
+ };
2723
+ }
2724
+ }
2725
+ async function xr(t, s, a) {
2726
+ const { reproject: i = !1, _targetCrs: e = "WGS84" } = s?.gis || {}, { shx: h, cpg: r, prj: n } = await Gs(s, a), { header: o, geometries: l } = await Yt(t, ps, s, a), c = Ts(l);
2727
+ let f;
2728
+ const u = await a?.fetch(ft(a?.url, "dbf"));
2729
+ if (u?.ok) {
2730
+ const d = {
2731
+ ...s,
2732
+ dbf: {
2733
+ ...s?.dbf,
2734
+ shape: "object-row-table",
2735
+ encoding: r || "latin1"
2736
+ }
2737
+ };
2738
+ f = await Yt(u, Os, d, a);
2739
+ }
2740
+ let v = qs(c, f?.data || []);
2741
+ switch (i && (v = Fs(v, n, e)), s?.shapefile?.shape) {
2742
+ case "geojson-table":
2743
+ return {
2744
+ // @ts-expect-error
2745
+ shape: "geojson-table",
2746
+ type: "FeatureCollection",
2747
+ encoding: r,
2748
+ schema: f?.schema || { metadata: {}, fields: [] },
2749
+ prj: n,
2750
+ shx: h,
2751
+ header: o,
2752
+ features: v
2753
+ };
2754
+ default:
2755
+ return {
2756
+ encoding: r,
2757
+ prj: n,
2758
+ shx: h,
2759
+ header: o,
2760
+ data: v
2761
+ };
2762
+ }
2763
+ }
2764
+ function Ts(t) {
2765
+ const s = [];
2766
+ for (const a of t)
2767
+ s.push(Us(a));
2768
+ return s;
2769
+ }
2770
+ function qs(t, s) {
2771
+ const a = [];
2772
+ for (let i = 0; i < t.length; i++) {
2773
+ const h = {
2774
+ type: "Feature",
2775
+ geometry: t[i],
2776
+ // properties can be undefined if dbfResponse above was empty
2777
+ properties: s && s[i] || {}
2778
+ };
2779
+ a.push(h);
2780
+ }
2781
+ return a;
2782
+ }
2783
+ function Fs(t, s, a) {
2784
+ if (!s && !a)
2785
+ return t;
2786
+ const i = new hr({ from: s || "WGS84", to: a || "WGS84" });
2787
+ return ta(t, (e) => i.project(e));
2788
+ }
2789
+ async function Gs(t, s) {
2790
+ const { url: a, fetch: i } = s, e = i(ft(a, "shx")), h = i(ft(a, "cpg")), r = i(ft(a, "prj"));
2791
+ await Promise.all([e, h, r]);
2792
+ let n, o, l;
2793
+ const c = await e;
2794
+ if (c.ok) {
2795
+ const v = await c.arrayBuffer();
2796
+ n = rr(v);
2797
+ }
2798
+ const f = await h;
2799
+ f.ok && (o = await f.text());
2800
+ const u = await r;
2801
+ return u.ok && (l = await u.text()), {
2802
+ shx: n,
2803
+ cpg: o,
2804
+ prj: l
2805
+ };
2806
+ }
2807
+ function ft(t, s) {
2808
+ const a = wr(t), i = Er(t);
2809
+ return i === i.toUpperCase() && (s = s.toUpperCase()), `${a}.${s}`;
2810
+ }
2811
+ function wr(t) {
2812
+ const s = t && t.lastIndexOf(".");
2813
+ return typeof s == "number" ? s >= 0 ? t.substr(0, s) : "" : s;
2814
+ }
2815
+ function Er(t) {
2816
+ const s = t && t.lastIndexOf(".");
2817
+ return typeof s == "number" ? s >= 0 ? t.substr(s + 1) : "" : s;
2818
+ }
2819
+ const pr = "4.4.3", jr = {
2820
+ name: "Shapefile",
2821
+ id: "shapefile",
2822
+ module: "shapefile",
2823
+ version: pr,
2824
+ category: "geometry",
2825
+ extensions: ["shp"],
2826
+ mimeTypes: ["application/octet-stream"],
2827
+ tests: [new Uint8Array(Es).buffer],
2828
+ options: {
2829
+ shapefile: {
2830
+ shape: "v3"
2831
+ },
2832
+ shp: {
2833
+ _maxDimensions: 4
2834
+ }
2835
+ },
2836
+ // @ts-expect-error
2837
+ parse: xr,
2838
+ // @ts-expect-error
2839
+ parseInBatches: _r
2840
+ }, Tt = !0, ds = 32;
2841
+ var $;
2842
+ (function(t) {
2843
+ t[t.START = 0] = "START", t[t.FIELD_DESCRIPTORS = 1] = "FIELD_DESCRIPTORS", t[t.FIELD_PROPERTIES = 2] = "FIELD_PROPERTIES", t[t.END = 3] = "END", t[t.ERROR = 4] = "ERROR";
2844
+ })($ || ($ = {}));
2845
+ class js {
2846
+ binaryReader = new zt();
2847
+ textDecoder;
2848
+ state = $.START;
2849
+ result = {};
2850
+ constructor(s) {
2851
+ this.textDecoder = new TextDecoder(s.encoding);
2852
+ }
2853
+ /**
2854
+ * @param arrayBuffer
2855
+ */
2856
+ write(s) {
2857
+ this.binaryReader.write(s), this.state = ms(this.state, this.result, this.binaryReader, this.textDecoder);
2858
+ }
2859
+ end() {
2860
+ this.binaryReader.end(), this.state = ms(this.state, this.result, this.binaryReader, this.textDecoder), this.state !== $.END && (this.state = $.ERROR, this.result.error = "DBF incomplete file");
2861
+ }
2862
+ }
2863
+ function ys(t, s = {}) {
2864
+ const { encoding: a = "latin1" } = s.dbf || {}, i = new js({ encoding: a });
2865
+ return i.write(t), i.end(), i.result.tableBuilder.finishTable();
2866
+ }
2867
+ async function* Rr(t, s = {}) {
2868
+ const { encoding: a = "latin1" } = s.dbf || {}, i = new js({ encoding: a });
2869
+ let e = !1;
2870
+ for await (const n of Bt(t)) {
2871
+ if (i.write(n), !e && i.result.dbfHeader) {
2872
+ e = !0;
2873
+ const f = i.result.tableBuilder.firstBatch();
2874
+ f && (yield f);
2875
+ }
2876
+ const l = i.result.tableBuilder.flushBatch();
2877
+ l && (yield l);
2878
+ }
2879
+ i.end();
2880
+ const r = i.result.tableBuilder.finishBatch();
2881
+ r && (yield r);
2882
+ }
2883
+ function ms(t, s, a, i) {
2884
+ for (; ; )
2885
+ try {
2886
+ switch (t) {
2887
+ case $.ERROR:
2888
+ case $.END:
2889
+ return t;
2890
+ case $.START:
2891
+ const e = a.getDataView(ds);
2892
+ if (!e)
2893
+ return t;
2894
+ s.dbfHeader = Ir(e), s.progress = {
2895
+ bytesUsed: 0,
2896
+ rowsTotal: s.dbfHeader.nRecords,
2897
+ rows: 0
2898
+ }, t = $.FIELD_DESCRIPTORS;
2899
+ break;
2900
+ case $.FIELD_DESCRIPTORS:
2901
+ const h = a.getDataView(
2902
+ // @ts-ignore
2903
+ s.dbfHeader.headerLength - ds
2904
+ );
2905
+ if (!h)
2906
+ return t;
2907
+ s.dbfFields = Pr(h, i);
2908
+ const r = {
2909
+ fields: s.dbfFields.map((c) => Dr(c)),
2910
+ metadata: {}
2911
+ };
2912
+ s.tableBuilder = new Js(r), t = $.FIELD_PROPERTIES, a.skip(1);
2913
+ break;
2914
+ case $.FIELD_PROPERTIES:
2915
+ const { recordLength: n = 0, nRecords: o = 0 } = s?.dbfHeader || {};
2916
+ let l = 0;
2917
+ for (; l < o; ) {
2918
+ l++;
2919
+ const c = a.getDataView(n - 1);
2920
+ if (!c)
2921
+ return t;
2922
+ a.skip(1);
2923
+ const f = Sr(c, s.dbfFields, i);
2924
+ s.tableBuilder.addObjectRow(f);
2925
+ }
2926
+ t = $.END;
2927
+ break;
2928
+ default:
2929
+ return t = $.ERROR, s.error = `illegal parser state ${t}`, t;
2930
+ }
2931
+ } catch (e) {
2932
+ return t = $.ERROR, s.error = `DBF parsing failed: ${e.message}`, t;
2933
+ }
2934
+ }
2935
+ function Ir(t) {
2936
+ return {
2937
+ // Last updated date
2938
+ year: t.getUint8(1) + 1900,
2939
+ month: t.getUint8(2),
2940
+ day: t.getUint8(3),
2941
+ // Number of records in data file
2942
+ nRecords: t.getUint32(4, Tt),
2943
+ // Length of header in bytes
2944
+ headerLength: t.getUint16(8, Tt),
2945
+ // Length of each record
2946
+ recordLength: t.getUint16(10, Tt),
2947
+ // Not sure if this is usually set
2948
+ languageDriver: t.getUint8(29)
2949
+ };
2950
+ }
2951
+ function Pr(t, s) {
2952
+ const a = (t.byteLength - 1) / 32, i = [];
2953
+ let e = 0;
2954
+ for (let h = 0; h < a; h++) {
2955
+ const r = s.decode(new Uint8Array(t.buffer, t.byteOffset + e, 11)).replace(/\u0000/g, "");
2956
+ i.push({
2957
+ name: r,
2958
+ dataType: String.fromCharCode(t.getUint8(e + 11)),
2959
+ fieldLength: t.getUint8(e + 16),
2960
+ decimal: t.getUint8(e + 17)
2961
+ }), e += 32;
2962
+ }
2963
+ return i;
2964
+ }
2965
+ function Sr(t, s, a) {
2966
+ const i = {};
2967
+ let e = 0;
2968
+ for (const h of s) {
2969
+ const r = a.decode(new Uint8Array(t.buffer, t.byteOffset + e, h.fieldLength));
2970
+ i[h.name] = Ar(r, h.dataType), e += h.fieldLength;
2971
+ }
2972
+ return i;
2973
+ }
2974
+ function Ar(t, s) {
2975
+ switch (s) {
2976
+ case "B":
2977
+ return Et(t);
2978
+ case "C":
2979
+ return Cr(t);
2980
+ case "F":
2981
+ return Et(t);
2982
+ case "N":
2983
+ return Et(t);
2984
+ case "O":
2985
+ return Et(t);
2986
+ case "D":
2987
+ return Nr(t);
2988
+ case "L":
2989
+ return Br(t);
2990
+ default:
2991
+ throw new Error("Unsupported data type");
2992
+ }
2993
+ }
2994
+ function Nr(t) {
2995
+ return Date.UTC(t.slice(0, 4), parseInt(t.slice(4, 6), 10) - 1, t.slice(6, 8));
2996
+ }
2997
+ function Br(t) {
2998
+ return /^[nf]$/i.test(t) ? !1 : /^[yt]$/i.test(t) ? !0 : null;
2999
+ }
3000
+ function Et(t) {
3001
+ const s = parseFloat(t);
3002
+ return isNaN(s) ? null : s;
3003
+ }
3004
+ function Cr(t) {
3005
+ return t.trim() || null;
3006
+ }
3007
+ function Dr({ name: t, dataType: s, fieldLength: a, decimal: i }) {
3008
+ switch (s) {
3009
+ case "B":
3010
+ return { name: t, type: "float64", nullable: !0, metadata: {} };
3011
+ case "C":
3012
+ return { name: t, type: "utf8", nullable: !0, metadata: {} };
3013
+ case "F":
3014
+ return { name: t, type: "float64", nullable: !0, metadata: {} };
3015
+ case "N":
3016
+ return { name: t, type: "float64", nullable: !0, metadata: {} };
3017
+ case "O":
3018
+ return { name: t, type: "float64", nullable: !0, metadata: {} };
3019
+ case "D":
3020
+ return { name: t, type: "timestamp-millisecond", nullable: !0, metadata: {} };
3021
+ case "L":
3022
+ return { name: t, type: "bool", nullable: !0, metadata: {} };
3023
+ default:
3024
+ throw new Error("Unsupported data type");
3025
+ }
3026
+ }
3027
+ const kr = {
3028
+ name: "DBF",
3029
+ id: "dbf",
3030
+ module: "shapefile",
3031
+ category: "table",
3032
+ extensions: ["dbf"],
3033
+ mimeTypes: ["application/x-dbf"]
3034
+ }, Lr = "4.4.3", $r = {
3035
+ ...kr,
3036
+ dataType: null,
3037
+ batchType: null,
3038
+ version: Lr,
3039
+ worker: !0,
3040
+ options: {
3041
+ dbf: {
3042
+ encoding: "latin1"
3043
+ }
3044
+ }
3045
+ }, zr = {
3046
+ ...$r,
3047
+ parse: async (t, s) => ys(t, s),
3048
+ parseSync: ys,
3049
+ parseInBatches(t, s) {
3050
+ return Rr(t, s);
3051
+ }
3052
+ };
3053
+ class Ur {
3054
+ offset;
3055
+ arrayBuffer;
3056
+ constructor(s) {
3057
+ this.offset = 0, this.arrayBuffer = s;
3058
+ }
3059
+ /**
3060
+ * Checks if there are available bytes in data
3061
+ *
3062
+ * @param bytes
3063
+ * @returns boolean
3064
+ */
3065
+ hasAvailableBytes(s) {
3066
+ return this.arrayBuffer.byteLength - this.offset >= s;
3067
+ }
3068
+ /**
3069
+ * Get the required number of bytes from the iterator
3070
+ *
3071
+ * @param bytes
3072
+ * @returns Dataview
3073
+ */
3074
+ getDataView(s) {
3075
+ if (s && !this.hasAvailableBytes(s))
3076
+ throw new Error("binary data exhausted");
3077
+ const a = s ? new DataView(this.arrayBuffer, this.offset, s) : new DataView(this.arrayBuffer, this.offset);
3078
+ return this.offset += s, a;
3079
+ }
3080
+ /**
3081
+ * Skipping
3082
+ *
3083
+ * @param bytes
3084
+ */
3085
+ skip(s) {
3086
+ this.offset += s;
3087
+ }
3088
+ /**
3089
+ * Rewinding
3090
+ *
3091
+ * @param bytes
3092
+ */
3093
+ rewind(s) {
3094
+ this.offset -= s;
3095
+ }
3096
+ }
3097
+ export {
3098
+ zr as DBFArrowLoader,
3099
+ $r as DBFArrowWorkerLoader,
3100
+ Os as DBFLoader,
3101
+ br as DBFWorkerLoader,
3102
+ ps as SHPLoader,
3103
+ fa as SHPWorkerLoader,
3104
+ jr as ShapefileLoader,
3105
+ zt as _BinaryChunkReader,
3106
+ Ur as _BinaryReader,
3107
+ nr as _zipBatchIterators
3108
+ };