@kalisio/common-geospatial 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2323 -518
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -4
package/dist/index.mjs
CHANGED
|
@@ -1,369 +1,369 @@
|
|
|
1
|
-
import { assert as
|
|
2
|
-
const
|
|
1
|
+
import { assert as p, is as f, has as ie, conform as P, optional as ae } from "@kalisio/common-core";
|
|
2
|
+
const w = {
|
|
3
3
|
LATITUDE: "LAT",
|
|
4
4
|
LONGITUDE: "LON",
|
|
5
5
|
ALTITUDE: "ALT"
|
|
6
6
|
};
|
|
7
|
-
function
|
|
8
|
-
return
|
|
7
|
+
function je(t) {
|
|
8
|
+
return p.that(t, f.string, "axis must be a string"), Object.values(w).includes(t);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
10
|
+
function ee(t) {
|
|
11
|
+
return p.that(t, f.string, "axis must be a string"), t === w.LATITUDE;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
13
|
+
function Se(t) {
|
|
14
|
+
return p.that(t, f.string, "axis must be a string"), t === w.LONGITUDE;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
return
|
|
16
|
+
function tr(t) {
|
|
17
|
+
return p.that(t, f.string, "axis must be a string"), t === w.ALTITUDE;
|
|
18
18
|
}
|
|
19
|
-
const
|
|
20
|
-
DIRECTIONS:
|
|
21
|
-
},
|
|
22
|
-
DIRECTIONS:
|
|
23
|
-
},
|
|
19
|
+
const We = { NORTH: { label: "Nord", symbol: "N" }, SOUTH: { label: "Sud", symbol: "S" }, EAST: { label: "Est", symbol: "E" }, WEST: { label: "Ouest", symbol: "O" } }, Ve = {
|
|
20
|
+
DIRECTIONS: We
|
|
21
|
+
}, Be = { NORTH: { label: "North", symbol: "N" }, SOUTH: { label: "South", symbol: "S" }, EAST: { label: "East", symbol: "E" }, WEST: { label: "West", symbol: "W" } }, Ke = {
|
|
22
|
+
DIRECTIONS: Be
|
|
23
|
+
}, Ze = {
|
|
24
24
|
DIRECTIONS: {
|
|
25
|
-
NORTH: { label:
|
|
26
|
-
SOUTH: { label:
|
|
27
|
-
EAST: { label:
|
|
28
|
-
WEST: { label:
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
en:
|
|
32
|
-
fr:
|
|
25
|
+
NORTH: { label: f.string, symbol: f.string },
|
|
26
|
+
SOUTH: { label: f.string, symbol: f.string },
|
|
27
|
+
EAST: { label: f.string, symbol: f.string },
|
|
28
|
+
WEST: { label: f.string, symbol: f.string }
|
|
29
|
+
}
|
|
30
|
+
}, k = {
|
|
31
|
+
en: Ke,
|
|
32
|
+
fr: Ve
|
|
33
33
|
};
|
|
34
|
-
let
|
|
35
|
-
function
|
|
36
|
-
return Object.keys(
|
|
37
|
-
}
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
{ value:
|
|
41
|
-
{ value:
|
|
42
|
-
{ value:
|
|
43
|
-
{ value:
|
|
44
|
-
]),
|
|
45
|
-
}
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
{ value:
|
|
49
|
-
{ value:
|
|
50
|
-
]),
|
|
51
|
-
}
|
|
52
|
-
function
|
|
34
|
+
let te = "en";
|
|
35
|
+
function rr() {
|
|
36
|
+
return Object.keys(k);
|
|
37
|
+
}
|
|
38
|
+
function nr(t, e) {
|
|
39
|
+
p.all([
|
|
40
|
+
{ value: t, validator: f.string, message: "code must be a string" },
|
|
41
|
+
{ value: t, validator: (r) => !ie.key(k, r), message: "locale already registered" },
|
|
42
|
+
{ value: e, validator: f.plainObject, message: "content must be an object" },
|
|
43
|
+
{ value: e, validator: (r) => P.schema(r, Ze), message: "content does not conform to schema" }
|
|
44
|
+
]), k[t] = e;
|
|
45
|
+
}
|
|
46
|
+
function ir(t) {
|
|
47
|
+
p.all([
|
|
48
|
+
{ value: t, validator: f.string, message: "code must be a string" },
|
|
49
|
+
{ value: t, validator: (e) => ie.key(k, e), message: "code is unknown" }
|
|
50
|
+
]), te = t;
|
|
51
|
+
}
|
|
52
|
+
function Ye() {
|
|
53
53
|
return {
|
|
54
|
-
code:
|
|
55
|
-
content:
|
|
54
|
+
code: te,
|
|
55
|
+
content: k[te]
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
return
|
|
58
|
+
function R() {
|
|
59
|
+
return Ye().content.DIRECTIONS;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
const
|
|
63
|
-
return
|
|
61
|
+
function W(t, e) {
|
|
62
|
+
const r = R(), n = r[t].label.toUpperCase(), i = r[t].symbol.toUpperCase();
|
|
63
|
+
return e.toUpperCase() === n || e.toUpperCase() === i;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
const
|
|
67
|
-
return
|
|
65
|
+
function ar(t = null) {
|
|
66
|
+
const e = R();
|
|
67
|
+
return f.defined(t) ? (p.that(t, je, "axis must be a valid axis"), ee(t) ? [e.SOUTH, e.NORTH] : Se(t) ? [e.EAST, e.WEST] : []) : [e.SOUTH, e.NORTH, e.EAST, e.WEST];
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
69
|
+
function sr() {
|
|
70
|
+
return R().NORTH;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
return
|
|
72
|
+
function or() {
|
|
73
|
+
return R().SOUTH;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
return
|
|
75
|
+
function lr() {
|
|
76
|
+
return R().EAST;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return
|
|
78
|
+
function ur() {
|
|
79
|
+
return R().WEST;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
81
|
+
function D(t) {
|
|
82
|
+
return p.that(t, f.string, "dir must be a string"), Je(t) || Le(t) || Te(t) || se(t);
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
return
|
|
84
|
+
function Je(t) {
|
|
85
|
+
return p.that(t, f.string, "dir must be a string"), W("NORTH", t);
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
return
|
|
87
|
+
function Le(t) {
|
|
88
|
+
return p.that(t, f.string, "dir must be a string"), W("SOUTH", t);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
return
|
|
90
|
+
function Te(t) {
|
|
91
|
+
return p.that(t, f.string, "dir must be a string"), W("EAST", t);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
return
|
|
93
|
+
function se(t) {
|
|
94
|
+
return p.that(t, f.string, "dir must be a string"), W("WEST", t);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
return
|
|
96
|
+
function Qe(t) {
|
|
97
|
+
return p.that(t, D, "dir must be a direction"), se(t) || Te(t) ? w.LONGITUDE : w.LATITUDE;
|
|
98
98
|
}
|
|
99
|
-
const
|
|
100
|
-
degrees:
|
|
101
|
-
direction:
|
|
102
|
-
},
|
|
103
|
-
function
|
|
104
|
-
let
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
else if (
|
|
108
|
-
const
|
|
109
|
-
|
|
99
|
+
const Xe = {
|
|
100
|
+
degrees: f.number,
|
|
101
|
+
direction: ae(D)
|
|
102
|
+
}, et = /^(-?\d{1,3}(?:\.\d+)?)°?$/, tt = /^(\d{1,3}(?:\.\d+)?)°?([NSEW])$/;
|
|
103
|
+
function U(t) {
|
|
104
|
+
let e = null, r = null;
|
|
105
|
+
if (f.plainObject(t) && P.schema(t, Xe))
|
|
106
|
+
f.defined(t.direction) ? t.degrees >= 0 && (e = t.degrees, r = t.direction) : e = t.degrees;
|
|
107
|
+
else if (f.string(t)) {
|
|
108
|
+
const n = t.replace(/\s+/g, ""), i = n.match(et) ?? n.match(tt);
|
|
109
|
+
i && (e = parseFloat(i[1]), r = i[2] ?? null);
|
|
110
110
|
}
|
|
111
111
|
return {
|
|
112
112
|
get degrees() {
|
|
113
|
-
return
|
|
113
|
+
return e;
|
|
114
114
|
},
|
|
115
115
|
get direction() {
|
|
116
|
-
return
|
|
116
|
+
return r;
|
|
117
117
|
},
|
|
118
118
|
get format() {
|
|
119
119
|
return "DD";
|
|
120
120
|
},
|
|
121
121
|
isValid() {
|
|
122
|
-
return
|
|
122
|
+
return f.number(e);
|
|
123
123
|
},
|
|
124
|
-
toString(
|
|
125
|
-
if (
|
|
126
|
-
let
|
|
127
|
-
return
|
|
124
|
+
toString(n) {
|
|
125
|
+
if (p.that(n, f.positiveInteger, "decimalPlaces must be a positive integer"), !this.isValid()) return "";
|
|
126
|
+
let i = `${e.toFixed(n)}°`;
|
|
127
|
+
return r && (i += ` ${r}`), i;
|
|
128
128
|
},
|
|
129
129
|
toDecimal() {
|
|
130
|
-
return this.isValid() ?
|
|
130
|
+
return this.isValid() ? U({ degrees: e, direction: r }) : null;
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
const
|
|
135
|
-
degrees:
|
|
136
|
-
minutes: (
|
|
137
|
-
direction:
|
|
138
|
-
},
|
|
139
|
-
function
|
|
140
|
-
let
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
else if (
|
|
144
|
-
const
|
|
145
|
-
a && (
|
|
134
|
+
const rt = {
|
|
135
|
+
degrees: f.integer,
|
|
136
|
+
minutes: (t) => f.inRangeExclusiveMax(t, 0, 60),
|
|
137
|
+
direction: ae(D)
|
|
138
|
+
}, nt = /^(-?\d{1,3})°(\d{1,2}(?:\.\d+)?)'?$/, it = /^(\d{1,3})°(\d{1,2}(?:\.\d+)?)'?([NSEW])$/;
|
|
139
|
+
function Ce(t) {
|
|
140
|
+
let e = null, r = null, n = null;
|
|
141
|
+
if (f.plainObject(t) && P.schema(t, rt))
|
|
142
|
+
f.defined(t.direction) ? t.degrees >= 0 && (e = t.degrees, r = t.minutes, n = t.direction) : (e = t.degrees, r = t.minutes);
|
|
143
|
+
else if (f.string(t)) {
|
|
144
|
+
const i = t.replace(/\s+/g, ""), a = i.match(nt) ?? i.match(it);
|
|
145
|
+
a && (e = parseFloat(a[1]), r = parseFloat(a[2]), n = a[3] ?? null);
|
|
146
146
|
}
|
|
147
147
|
return {
|
|
148
148
|
get degrees() {
|
|
149
|
-
return
|
|
149
|
+
return e;
|
|
150
150
|
},
|
|
151
151
|
get minutes() {
|
|
152
|
-
return
|
|
152
|
+
return r;
|
|
153
153
|
},
|
|
154
154
|
get direction() {
|
|
155
|
-
return
|
|
155
|
+
return n;
|
|
156
156
|
},
|
|
157
157
|
get format() {
|
|
158
158
|
return "DDM";
|
|
159
159
|
},
|
|
160
160
|
isValid() {
|
|
161
|
-
return
|
|
161
|
+
return f.integer(e) && f.inRangeExclusiveMax(r, 0, 60);
|
|
162
162
|
},
|
|
163
|
-
toString(
|
|
164
|
-
if (
|
|
165
|
-
let a = `${
|
|
166
|
-
return
|
|
163
|
+
toString(i) {
|
|
164
|
+
if (p.that(i, f.positiveInteger, "decimalPlaces must be a positive integer"), !this.isValid()) return "";
|
|
165
|
+
let a = `${e}° ${r.toFixed(i)}'`;
|
|
166
|
+
return n && (a += ` ${n}`), a;
|
|
167
167
|
},
|
|
168
168
|
toDecimal() {
|
|
169
|
-
return this.isValid() ?
|
|
169
|
+
return this.isValid() ? U({ degrees: e + r / 60, direction: n }) : null;
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
|
-
const
|
|
174
|
-
degrees:
|
|
175
|
-
minutes: (
|
|
176
|
-
direction:
|
|
177
|
-
},
|
|
178
|
-
function
|
|
179
|
-
let
|
|
180
|
-
if (
|
|
181
|
-
|
|
182
|
-
else if (
|
|
183
|
-
const
|
|
184
|
-
a && (
|
|
173
|
+
const at = {
|
|
174
|
+
degrees: f.nonNegativeInteger,
|
|
175
|
+
minutes: (t) => f.inRangeExclusiveMax(t, 0, 60),
|
|
176
|
+
direction: D
|
|
177
|
+
}, st = /^(\d{2})(\d{3})([NS])$/, ot = /^(\d{3})(\d{3})([EW])$/;
|
|
178
|
+
function Ie(t) {
|
|
179
|
+
let e = null, r = null, n = null;
|
|
180
|
+
if (f.plainObject(t) && P.schema(t, at))
|
|
181
|
+
e = t.degrees, r = t.minutes, n = t.direction;
|
|
182
|
+
else if (f.string(t)) {
|
|
183
|
+
const i = t.trim(), a = i.match(st) ?? i.match(ot);
|
|
184
|
+
a && (e = parseFloat(a[1]), r = parseFloat(a[2]) / 10, n = a[3]);
|
|
185
185
|
}
|
|
186
186
|
return {
|
|
187
187
|
get degrees() {
|
|
188
|
-
return
|
|
188
|
+
return e;
|
|
189
189
|
},
|
|
190
190
|
get minutes() {
|
|
191
|
-
return
|
|
191
|
+
return r;
|
|
192
192
|
},
|
|
193
193
|
get direction() {
|
|
194
|
-
return
|
|
194
|
+
return n;
|
|
195
195
|
},
|
|
196
196
|
get format() {
|
|
197
197
|
return "DDM_AERO";
|
|
198
198
|
},
|
|
199
199
|
isValid() {
|
|
200
|
-
return
|
|
200
|
+
return f.nonNegativeInteger(e) && f.inRangeExclusiveMax(r, 0, 60) && D(n);
|
|
201
201
|
},
|
|
202
202
|
toString() {
|
|
203
203
|
if (!this.isValid()) return "";
|
|
204
|
-
const
|
|
205
|
-
return `${a}${
|
|
204
|
+
const i = n === "E" || n === "W", a = String(e).padStart(i ? 3 : 2, "0"), s = Math.floor(r * 10).toString().padStart(3, "0");
|
|
205
|
+
return `${a}${s}${n}`;
|
|
206
206
|
},
|
|
207
207
|
toDecimal() {
|
|
208
|
-
return this.isValid() ?
|
|
208
|
+
return this.isValid() ? U({ degrees: e + r / 60, direction: n }) : null;
|
|
209
209
|
}
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
|
-
const
|
|
213
|
-
degrees:
|
|
214
|
-
minutes: (
|
|
215
|
-
seconds: (
|
|
216
|
-
direction:
|
|
217
|
-
},
|
|
218
|
-
function
|
|
219
|
-
let
|
|
220
|
-
if (
|
|
221
|
-
|
|
222
|
-
else if (
|
|
223
|
-
const a =
|
|
224
|
-
|
|
212
|
+
const lt = {
|
|
213
|
+
degrees: f.integer,
|
|
214
|
+
minutes: (t) => f.integer(t) && f.inRange(t, 0, 59),
|
|
215
|
+
seconds: (t) => f.inRangeExclusiveMax(t, 0, 60),
|
|
216
|
+
direction: ae(D)
|
|
217
|
+
}, ut = /^(-?\d{1,3})°(\d{1,2})'(\d{1,2}(?:\.\d+)?)"?$/, ft = /^(\d{1,3})°(\d{1,2})'(\d{1,2}(?:\.\d+)?)"?([NSEW])$/;
|
|
218
|
+
function Ne(t) {
|
|
219
|
+
let e = null, r = null, n = null, i = null;
|
|
220
|
+
if (f.plainObject(t) && P.schema(t, lt))
|
|
221
|
+
f.defined(t.direction) ? t.degrees >= 0 && (e = t.degrees, r = t.minutes, n = t.seconds, i = t.direction) : (e = t.degrees, r = t.minutes, n = t.seconds);
|
|
222
|
+
else if (f.string(t)) {
|
|
223
|
+
const a = t.replace(/\s+/g, ""), s = a.match(ut) ?? a.match(ft);
|
|
224
|
+
s && (e = parseFloat(s[1]), r = parseFloat(s[2]), n = parseFloat(s[3]), i = s[4] ?? null);
|
|
225
225
|
}
|
|
226
226
|
return {
|
|
227
227
|
get degrees() {
|
|
228
|
-
return
|
|
228
|
+
return e;
|
|
229
229
|
},
|
|
230
230
|
get minutes() {
|
|
231
|
-
return
|
|
231
|
+
return r;
|
|
232
232
|
},
|
|
233
233
|
get seconds() {
|
|
234
|
-
return
|
|
234
|
+
return n;
|
|
235
235
|
},
|
|
236
236
|
get direction() {
|
|
237
|
-
return
|
|
237
|
+
return i;
|
|
238
238
|
},
|
|
239
239
|
get format() {
|
|
240
240
|
return "DMS";
|
|
241
241
|
},
|
|
242
242
|
isValid() {
|
|
243
|
-
return
|
|
243
|
+
return f.integer(e) && f.integer(r) && f.inRange(r, 0, 59) && f.inRangeExclusiveMax(n, 0, 60);
|
|
244
244
|
},
|
|
245
245
|
toString(a) {
|
|
246
|
-
if (
|
|
247
|
-
let
|
|
248
|
-
return
|
|
246
|
+
if (p.that(a, f.positiveInteger, "decimalPlaces must be a positive integer"), !this.isValid()) return "";
|
|
247
|
+
let s = `${e}° ${r}' ${n.toFixed(a)}"`;
|
|
248
|
+
return i && (s += ` ${i}`), s;
|
|
249
249
|
},
|
|
250
250
|
toDecimal() {
|
|
251
|
-
return this.isValid() ?
|
|
251
|
+
return this.isValid() ? U({ degrees: e + r / 60 + n / 3600, direction: i }) : null;
|
|
252
252
|
}
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
|
-
function
|
|
256
|
-
const
|
|
257
|
-
return { degrees:
|
|
255
|
+
function pe(t) {
|
|
256
|
+
const e = Math.floor(t.degrees), r = (t.degrees - e) * 60;
|
|
257
|
+
return { degrees: e, minutes: r, direction: t.direction };
|
|
258
258
|
}
|
|
259
|
-
function
|
|
260
|
-
const
|
|
261
|
-
return { degrees:
|
|
259
|
+
function ct(t) {
|
|
260
|
+
const e = Math.floor(t.degrees), r = (t.degrees - e) * 60, n = Math.floor(r), i = (r - n) * 60;
|
|
261
|
+
return { degrees: e, minutes: n, seconds: i, direction: t.direction };
|
|
262
262
|
}
|
|
263
|
-
const
|
|
264
|
-
DD: (
|
|
265
|
-
DDM: (
|
|
266
|
-
|
|
267
|
-
const { degrees:
|
|
268
|
-
return
|
|
263
|
+
const ge = {
|
|
264
|
+
DD: (t) => (p.that(t, (e) => e.isValid(), "dd must be a valid coordinate"), t),
|
|
265
|
+
DDM: (t) => {
|
|
266
|
+
p.that(t, (i) => i.isValid(), "dd must be a valid coordinate");
|
|
267
|
+
const { degrees: e, minutes: r, direction: n } = pe(t);
|
|
268
|
+
return Ce(n ? { degrees: e, minutes: r, direction: n } : { degrees: e, minutes: r });
|
|
269
269
|
},
|
|
270
|
-
DMS: (
|
|
271
|
-
|
|
272
|
-
const { degrees:
|
|
273
|
-
return
|
|
270
|
+
DMS: (t) => {
|
|
271
|
+
p.that(t, (a) => a.isValid(), "dd must be a valid coordinate");
|
|
272
|
+
const { degrees: e, minutes: r, seconds: n, direction: i } = ct(t);
|
|
273
|
+
return Ne(i ? { degrees: e, minutes: r, seconds: n, direction: i } : { degrees: e, minutes: r, seconds: n });
|
|
274
274
|
},
|
|
275
|
-
DDM_AERO: (
|
|
276
|
-
|
|
277
|
-
const { degrees:
|
|
278
|
-
return
|
|
275
|
+
DDM_AERO: (t) => {
|
|
276
|
+
p.that(t, (i) => i.isValid(), "dd must be a valid coordinate");
|
|
277
|
+
const { degrees: e, minutes: r, direction: n } = pe(t);
|
|
278
|
+
return Ie({ degrees: e, minutes: r, direction: n });
|
|
279
279
|
}
|
|
280
|
-
},
|
|
280
|
+
}, re = {
|
|
281
281
|
DD: "DD",
|
|
282
282
|
DDM: "DDM",
|
|
283
283
|
DDM_AERO: "DDM_AERO",
|
|
284
284
|
DMS: "DMS"
|
|
285
|
-
},
|
|
286
|
-
DD:
|
|
287
|
-
DDM:
|
|
288
|
-
DDM_AERO:
|
|
289
|
-
DMS:
|
|
290
|
-
},
|
|
291
|
-
function
|
|
292
|
-
if (
|
|
293
|
-
return
|
|
294
|
-
if (Math.abs(
|
|
295
|
-
}
|
|
296
|
-
function
|
|
297
|
-
|
|
298
|
-
const
|
|
299
|
-
return Math.max(0,
|
|
300
|
-
}
|
|
301
|
-
function
|
|
302
|
-
|
|
303
|
-
{ value:
|
|
304
|
-
{ value:
|
|
285
|
+
}, ht = {
|
|
286
|
+
DD: U,
|
|
287
|
+
DDM: Ce,
|
|
288
|
+
DDM_AERO: Ie,
|
|
289
|
+
DMS: Ne
|
|
290
|
+
}, oe = Array.from({ length: 9 }, (t, e) => 10 ** e);
|
|
291
|
+
function ye(t, e) {
|
|
292
|
+
if (p.that(t, f.number, "coord must be a number"), f.defined(e))
|
|
293
|
+
return p.that(e, D, "dir must be a direction"), Qe(e);
|
|
294
|
+
if (Math.abs(t) > 90) return w.LONGITUDE;
|
|
295
|
+
}
|
|
296
|
+
function de(t) {
|
|
297
|
+
p.that(t, f.number, "coord must be a number");
|
|
298
|
+
const e = t.toExponential(), [r, n] = e.split("e").map(Number), i = (r.toString().split(".")[1] || "").length;
|
|
299
|
+
return Math.max(0, i - n);
|
|
300
|
+
}
|
|
301
|
+
function fr(t, e = 7) {
|
|
302
|
+
p.all([
|
|
303
|
+
{ value: t, validator: f.number, message: "coord must be a number" },
|
|
304
|
+
{ value: e, validator: (n) => f.inRange(n, 0, 8), message: "precision must be in range [0, 8]" }
|
|
305
305
|
]);
|
|
306
|
-
const
|
|
307
|
-
return Math.round(
|
|
308
|
-
}
|
|
309
|
-
function
|
|
310
|
-
if (
|
|
311
|
-
{ value:
|
|
312
|
-
{ value:
|
|
313
|
-
]),
|
|
314
|
-
return Math.max(-90, Math.min(90,
|
|
315
|
-
let
|
|
316
|
-
return
|
|
317
|
-
}
|
|
318
|
-
function
|
|
319
|
-
|
|
320
|
-
{ value:
|
|
321
|
-
{ value:
|
|
306
|
+
const r = oe[e];
|
|
307
|
+
return Math.round(t * r) / r;
|
|
308
|
+
}
|
|
309
|
+
function cr(t, e) {
|
|
310
|
+
if (p.all([
|
|
311
|
+
{ value: t, validator: f.number, message: "coord must be a number" },
|
|
312
|
+
{ value: e, validator: (n) => Se(n) || ee(n), message: "axis must be either a longitude or latitude" }
|
|
313
|
+
]), ee(e))
|
|
314
|
+
return Math.max(-90, Math.min(90, t));
|
|
315
|
+
let r = ((t + 180) % 360 + 360) % 360 - 180;
|
|
316
|
+
return r === -180 && (r = 180), Object.is(r, -0) && (r = 0), r;
|
|
317
|
+
}
|
|
318
|
+
function hr(t, e) {
|
|
319
|
+
p.all([
|
|
320
|
+
{ value: t, validator: (n) => f.defined(n) && n.isValid(), message: "from must be a valid coordinate" },
|
|
321
|
+
{ value: e, validator: (n) => ie.key(ge, n), message: `unknown format: ${e}` }
|
|
322
322
|
]);
|
|
323
|
-
const
|
|
324
|
-
return
|
|
325
|
-
}
|
|
326
|
-
function
|
|
327
|
-
|
|
328
|
-
for (const
|
|
329
|
-
const
|
|
330
|
-
if (
|
|
323
|
+
const r = t.format === re.DD ? t : t.toDecimal();
|
|
324
|
+
return r.isValid() ? e === re.DD ? r : ge[e](r) : null;
|
|
325
|
+
}
|
|
326
|
+
function pt(t) {
|
|
327
|
+
p.that(t, f.nonEmptyString, "pattern must be a non empty string");
|
|
328
|
+
for (const e of Object.keys(re)) {
|
|
329
|
+
const r = ht[e](t);
|
|
330
|
+
if (r.isValid()) return r;
|
|
331
331
|
}
|
|
332
332
|
return null;
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
|
|
336
|
-
const
|
|
337
|
-
if (
|
|
338
|
-
const [
|
|
339
|
-
if (!
|
|
340
|
-
const
|
|
341
|
-
const { degrees:
|
|
342
|
-
return
|
|
334
|
+
function pr(t) {
|
|
335
|
+
p.that(t, (o) => f.nonEmptyString(o), "pattern must be a non-empty string");
|
|
336
|
+
const e = t.split(/[,;|]/);
|
|
337
|
+
if (e.length !== 2) return null;
|
|
338
|
+
const [r, n] = e.map(pt);
|
|
339
|
+
if (!r || !n) return null;
|
|
340
|
+
const i = r.toDecimal(), a = n.toDecimal(), s = ye(i.degrees, i.direction), l = ye(a.degrees, a.direction), u = (o) => {
|
|
341
|
+
const { degrees: c, direction: h } = o;
|
|
342
|
+
return h && (se(h) || Le(h)) ? -c : c;
|
|
343
343
|
};
|
|
344
|
-
if (
|
|
345
|
-
if (
|
|
346
|
-
if (
|
|
347
|
-
if (
|
|
348
|
-
if (
|
|
349
|
-
if (
|
|
350
|
-
if (!
|
|
344
|
+
if (s === w.LONGITUDE && l === w.LATITUDE) return [u(i), u(a)];
|
|
345
|
+
if (l === w.LONGITUDE && s === w.LATITUDE) return [u(a), u(i)];
|
|
346
|
+
if (s === w.LONGITUDE && !l) return [u(i), a];
|
|
347
|
+
if (s === w.LATITUDE && !l) return [u(a), u(i)];
|
|
348
|
+
if (l === w.LONGITUDE && !s) return [u(a), u(i)];
|
|
349
|
+
if (l === w.LATITUDE && !s) return [u(i), u(a)];
|
|
350
|
+
if (!s && !l)
|
|
351
351
|
return [
|
|
352
|
-
[
|
|
353
|
-
[
|
|
352
|
+
[u(i), u(a)],
|
|
353
|
+
[u(a), u(i)]
|
|
354
354
|
];
|
|
355
355
|
}
|
|
356
|
-
function
|
|
357
|
-
return !
|
|
356
|
+
function gt(t) {
|
|
357
|
+
return !f.arrayOfLength(t, 4) && !f.arrayOfLength(t, 6) ? !1 : t.every(f.number);
|
|
358
358
|
}
|
|
359
|
-
const
|
|
359
|
+
const z = {
|
|
360
360
|
NAME: "name",
|
|
361
361
|
LINK: "link"
|
|
362
362
|
};
|
|
363
|
-
function
|
|
364
|
-
return
|
|
363
|
+
function gr(t) {
|
|
364
|
+
return f.plainObject(t) ? t.type === z.NAME ? f.nonEmptyString(t.properties?.name) : t.type === z.LINK ? f.nonEmptyString(t.properties?.href) : !1 : !1;
|
|
365
365
|
}
|
|
366
|
-
const
|
|
366
|
+
const v = {
|
|
367
367
|
POINT: "Point",
|
|
368
368
|
MULTI_POINT: "MultiPoint",
|
|
369
369
|
LINESTRING: "LineString",
|
|
@@ -372,122 +372,1910 @@ const p = {
|
|
|
372
372
|
MULTI_POLYGON: "MultiPolygon",
|
|
373
373
|
GEOMETRY_COLLECTION: "GeometryCollection"
|
|
374
374
|
};
|
|
375
|
-
function
|
|
376
|
-
return !
|
|
375
|
+
function le(t) {
|
|
376
|
+
return !f.plainObject(t) || !f.oneOf(t.type, Object.values(v)) ? !1 : t.type === v.GEOMETRY_COLLECTION ? f.array(t.geometries) : f.array(t.coordinates);
|
|
377
377
|
}
|
|
378
|
-
const
|
|
378
|
+
const I = {
|
|
379
379
|
FEATURE: "Feature",
|
|
380
380
|
FEATURE_COLLECTION: "FeatureCollection"
|
|
381
381
|
};
|
|
382
|
-
function
|
|
383
|
-
return
|
|
382
|
+
function yt(t) {
|
|
383
|
+
return f.plainObject(t) ? I.FEATURE === t.type : !1;
|
|
384
|
+
}
|
|
385
|
+
function dt(t) {
|
|
386
|
+
return !f.plainObject(t) || t.type !== I.FEATURE_COLLECTION ? !1 : f.array(t.features);
|
|
387
|
+
}
|
|
388
|
+
function De(t) {
|
|
389
|
+
return f.plainObject(t) ? le(t) || yt(t) ? !0 : dt(t) : !1;
|
|
390
|
+
}
|
|
391
|
+
function mt(t) {
|
|
392
|
+
return f.arrayOfLengthBetween(t, 2, 3) ? t.every(f.number) : !1;
|
|
384
393
|
}
|
|
385
|
-
|
|
386
|
-
|
|
394
|
+
const vt = {}, H = bt(globalThis, vt);
|
|
395
|
+
function bt(t, e) {
|
|
396
|
+
return new Proxy(t, {
|
|
397
|
+
get(r, n, i) {
|
|
398
|
+
return n in e ? e[n] : t[n];
|
|
399
|
+
},
|
|
400
|
+
set(r, n, i) {
|
|
401
|
+
return n in e && delete e[n], t[n] = i, !0;
|
|
402
|
+
},
|
|
403
|
+
deleteProperty(r, n) {
|
|
404
|
+
let i = !1;
|
|
405
|
+
return n in e && (delete e[n], i = !0), n in t && (delete t[n], i = !0), i;
|
|
406
|
+
},
|
|
407
|
+
ownKeys(r) {
|
|
408
|
+
const n = Reflect.ownKeys(t), i = Reflect.ownKeys(e), a = new Set(i);
|
|
409
|
+
return [...n.filter((s) => !a.has(s)), ...i];
|
|
410
|
+
},
|
|
411
|
+
defineProperty(r, n, i) {
|
|
412
|
+
return n in e && delete e[n], Reflect.defineProperty(t, n, i), !0;
|
|
413
|
+
},
|
|
414
|
+
getOwnPropertyDescriptor(r, n) {
|
|
415
|
+
return n in e ? Reflect.getOwnPropertyDescriptor(e, n) : Reflect.getOwnPropertyDescriptor(t, n);
|
|
416
|
+
},
|
|
417
|
+
has(r, n) {
|
|
418
|
+
return n in e || n in t;
|
|
419
|
+
}
|
|
420
|
+
});
|
|
387
421
|
}
|
|
388
|
-
function
|
|
389
|
-
return
|
|
422
|
+
function xe(t = []) {
|
|
423
|
+
return C.getLogger(t);
|
|
390
424
|
}
|
|
391
|
-
|
|
392
|
-
|
|
425
|
+
const B = /* @__PURE__ */ Symbol.for("logtape.rootLogger");
|
|
426
|
+
class C {
|
|
427
|
+
static getLogger(e = []) {
|
|
428
|
+
let r = B in H ? H[B] ?? null : null;
|
|
429
|
+
return r == null && (r = new C(null, []), H[B] = r), typeof e == "string" ? r.getChild(e) : e.length === 0 ? r : r.getChild(e);
|
|
430
|
+
}
|
|
431
|
+
constructor(e, r) {
|
|
432
|
+
Object.defineProperty(this, "parent", {
|
|
433
|
+
enumerable: !0,
|
|
434
|
+
configurable: !0,
|
|
435
|
+
writable: !0,
|
|
436
|
+
value: void 0
|
|
437
|
+
}), Object.defineProperty(this, "children", {
|
|
438
|
+
enumerable: !0,
|
|
439
|
+
configurable: !0,
|
|
440
|
+
writable: !0,
|
|
441
|
+
value: void 0
|
|
442
|
+
}), Object.defineProperty(this, "category", {
|
|
443
|
+
enumerable: !0,
|
|
444
|
+
configurable: !0,
|
|
445
|
+
writable: !0,
|
|
446
|
+
value: void 0
|
|
447
|
+
}), Object.defineProperty(this, "sinks", {
|
|
448
|
+
enumerable: !0,
|
|
449
|
+
configurable: !0,
|
|
450
|
+
writable: !0,
|
|
451
|
+
value: void 0
|
|
452
|
+
}), Object.defineProperty(this, "parentSinks", {
|
|
453
|
+
enumerable: !0,
|
|
454
|
+
configurable: !0,
|
|
455
|
+
writable: !0,
|
|
456
|
+
value: "inherit"
|
|
457
|
+
}), Object.defineProperty(this, "filters", {
|
|
458
|
+
enumerable: !0,
|
|
459
|
+
configurable: !0,
|
|
460
|
+
writable: !0,
|
|
461
|
+
value: void 0
|
|
462
|
+
}), Object.defineProperty(this, "contextLocalStorage", {
|
|
463
|
+
enumerable: !0,
|
|
464
|
+
configurable: !0,
|
|
465
|
+
writable: !0,
|
|
466
|
+
value: void 0
|
|
467
|
+
}), this.parent = e, this.children = {}, this.category = r, this.sinks = [], this.filters = [];
|
|
468
|
+
}
|
|
469
|
+
getChild(e) {
|
|
470
|
+
const r = typeof e == "string" ? e : e[0], n = this.children[r];
|
|
471
|
+
let i = n instanceof C ? n : n?.deref();
|
|
472
|
+
return i == null && (i = new C(this, [...this.category, r]), this.children[r] = "WeakRef" in H ? new WeakRef(i) : i), typeof e == "string" || e.length === 1 ? i : i.getChild(e.slice(1));
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Reset the logger. This removes all sinks and filters from the logger.
|
|
476
|
+
*/
|
|
477
|
+
reset() {
|
|
478
|
+
for (; this.sinks.length > 0; )
|
|
479
|
+
this.sinks.shift();
|
|
480
|
+
for (this.parentSinks = "inherit"; this.filters.length > 0; )
|
|
481
|
+
this.filters.shift();
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Reset the logger and all its descendants. This removes all sinks and
|
|
485
|
+
* filters from the logger and all its descendants.
|
|
486
|
+
*/
|
|
487
|
+
resetDescendants() {
|
|
488
|
+
for (const e of Object.values(this.children)) {
|
|
489
|
+
const r = e instanceof C ? e : e.deref();
|
|
490
|
+
r?.resetDescendants();
|
|
491
|
+
}
|
|
492
|
+
this.reset();
|
|
493
|
+
}
|
|
494
|
+
with(e) {
|
|
495
|
+
return new ue(this, { ...e });
|
|
496
|
+
}
|
|
497
|
+
filter(e) {
|
|
498
|
+
for (const r of this.filters)
|
|
499
|
+
if (!r(e))
|
|
500
|
+
return !1;
|
|
501
|
+
return this.filters.length < 1 ? this.parent?.filter(e) ?? !0 : !0;
|
|
502
|
+
}
|
|
503
|
+
*getSinks() {
|
|
504
|
+
if (this.parent != null && this.parentSinks === "inherit")
|
|
505
|
+
for (const e of this.parent.getSinks())
|
|
506
|
+
yield e;
|
|
507
|
+
for (const e of this.sinks)
|
|
508
|
+
yield e;
|
|
509
|
+
}
|
|
510
|
+
emit(e, r) {
|
|
511
|
+
if (this.filter(e)) {
|
|
512
|
+
for (const n of this.getSinks())
|
|
513
|
+
if (!r?.has(n))
|
|
514
|
+
try {
|
|
515
|
+
n(e);
|
|
516
|
+
} catch (i) {
|
|
517
|
+
const a = new Set(r);
|
|
518
|
+
a.add(n), At.log("fatal", "Failed to emit a log record to sink {sink}: {error}", { sink: n, error: i, record: e }, a);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
log(e, r, n, i) {
|
|
523
|
+
const a = C.getLogger().contextLocalStorage?.getStore() ?? {};
|
|
524
|
+
let s;
|
|
525
|
+
const l = typeof n == "function" ? {
|
|
526
|
+
category: this.category,
|
|
527
|
+
level: e,
|
|
528
|
+
timestamp: Date.now(),
|
|
529
|
+
get message() {
|
|
530
|
+
return me(r, this.properties);
|
|
531
|
+
},
|
|
532
|
+
rawMessage: r,
|
|
533
|
+
get properties() {
|
|
534
|
+
return s == null && (s = {
|
|
535
|
+
...a,
|
|
536
|
+
...n()
|
|
537
|
+
}), s;
|
|
538
|
+
}
|
|
539
|
+
} : {
|
|
540
|
+
category: this.category,
|
|
541
|
+
level: e,
|
|
542
|
+
timestamp: Date.now(),
|
|
543
|
+
message: me(r, {
|
|
544
|
+
...a,
|
|
545
|
+
...n
|
|
546
|
+
}),
|
|
547
|
+
rawMessage: r,
|
|
548
|
+
properties: { ...a, ...n }
|
|
549
|
+
};
|
|
550
|
+
this.emit(l, i);
|
|
551
|
+
}
|
|
552
|
+
logLazily(e, r, n = {}) {
|
|
553
|
+
const i = C.getLogger().contextLocalStorage?.getStore() ?? {};
|
|
554
|
+
let a, s;
|
|
555
|
+
function l() {
|
|
556
|
+
if ((s == null || a == null) && (s = r((u, ...o) => (a = u, ve(u, o))), a == null))
|
|
557
|
+
throw new TypeError("No log record was made.");
|
|
558
|
+
return [s, a];
|
|
559
|
+
}
|
|
560
|
+
this.emit({
|
|
561
|
+
category: this.category,
|
|
562
|
+
level: e,
|
|
563
|
+
get message() {
|
|
564
|
+
return l()[0];
|
|
565
|
+
},
|
|
566
|
+
get rawMessage() {
|
|
567
|
+
return l()[1];
|
|
568
|
+
},
|
|
569
|
+
timestamp: Date.now(),
|
|
570
|
+
properties: { ...i, ...n }
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
logTemplate(e, r, n, i = {}) {
|
|
574
|
+
const a = C.getLogger().contextLocalStorage?.getStore() ?? {};
|
|
575
|
+
this.emit({
|
|
576
|
+
category: this.category,
|
|
577
|
+
level: e,
|
|
578
|
+
message: ve(r, n),
|
|
579
|
+
rawMessage: r,
|
|
580
|
+
timestamp: Date.now(),
|
|
581
|
+
properties: { ...a, ...i }
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
debug(e, ...r) {
|
|
585
|
+
typeof e == "string" ? this.log("debug", e, r[0] ?? {}) : typeof e == "function" ? this.logLazily("debug", e) : this.logTemplate("debug", e, r);
|
|
586
|
+
}
|
|
587
|
+
info(e, ...r) {
|
|
588
|
+
typeof e == "string" ? this.log("info", e, r[0] ?? {}) : typeof e == "function" ? this.logLazily("info", e) : this.logTemplate("info", e, r);
|
|
589
|
+
}
|
|
590
|
+
warn(e, ...r) {
|
|
591
|
+
typeof e == "string" ? this.log("warning", e, r[0] ?? {}) : typeof e == "function" ? this.logLazily("warning", e) : this.logTemplate("warning", e, r);
|
|
592
|
+
}
|
|
593
|
+
error(e, ...r) {
|
|
594
|
+
typeof e == "string" ? this.log("error", e, r[0] ?? {}) : typeof e == "function" ? this.logLazily("error", e) : this.logTemplate("error", e, r);
|
|
595
|
+
}
|
|
596
|
+
fatal(e, ...r) {
|
|
597
|
+
typeof e == "string" ? this.log("fatal", e, r[0] ?? {}) : typeof e == "function" ? this.logLazily("fatal", e) : this.logTemplate("fatal", e, r);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
class ue {
|
|
601
|
+
constructor(e, r) {
|
|
602
|
+
Object.defineProperty(this, "logger", {
|
|
603
|
+
enumerable: !0,
|
|
604
|
+
configurable: !0,
|
|
605
|
+
writable: !0,
|
|
606
|
+
value: void 0
|
|
607
|
+
}), Object.defineProperty(this, "properties", {
|
|
608
|
+
enumerable: !0,
|
|
609
|
+
configurable: !0,
|
|
610
|
+
writable: !0,
|
|
611
|
+
value: void 0
|
|
612
|
+
}), this.logger = e, this.properties = r;
|
|
613
|
+
}
|
|
614
|
+
get category() {
|
|
615
|
+
return this.logger.category;
|
|
616
|
+
}
|
|
617
|
+
get parent() {
|
|
618
|
+
return this.logger.parent;
|
|
619
|
+
}
|
|
620
|
+
getChild(e) {
|
|
621
|
+
return this.logger.getChild(e).with(this.properties);
|
|
622
|
+
}
|
|
623
|
+
with(e) {
|
|
624
|
+
return new ue(this.logger, { ...this.properties, ...e });
|
|
625
|
+
}
|
|
626
|
+
log(e, r, n, i) {
|
|
627
|
+
this.logger.log(e, r, typeof n == "function" ? () => ({
|
|
628
|
+
...this.properties,
|
|
629
|
+
...n()
|
|
630
|
+
}) : { ...this.properties, ...n }, i);
|
|
631
|
+
}
|
|
632
|
+
logLazily(e, r) {
|
|
633
|
+
this.logger.logLazily(e, r, this.properties);
|
|
634
|
+
}
|
|
635
|
+
logTemplate(e, r, n) {
|
|
636
|
+
this.logger.logTemplate(e, r, n, this.properties);
|
|
637
|
+
}
|
|
638
|
+
debug(e, ...r) {
|
|
639
|
+
typeof e == "string" ? this.log("debug", e, r[0] ?? {}) : typeof e == "function" ? this.logLazily("debug", e) : this.logTemplate("debug", e, r);
|
|
640
|
+
}
|
|
641
|
+
info(e, ...r) {
|
|
642
|
+
typeof e == "string" ? this.log("info", e, r[0] ?? {}) : typeof e == "function" ? this.logLazily("info", e) : this.logTemplate("info", e, r);
|
|
643
|
+
}
|
|
644
|
+
warn(e, ...r) {
|
|
645
|
+
typeof e == "string" ? this.log("warning", e, r[0] ?? {}) : typeof e == "function" ? this.logLazily("warning", e) : this.logTemplate("warning", e, r);
|
|
646
|
+
}
|
|
647
|
+
error(e, ...r) {
|
|
648
|
+
typeof e == "string" ? this.log("error", e, r[0] ?? {}) : typeof e == "function" ? this.logLazily("error", e) : this.logTemplate("error", e, r);
|
|
649
|
+
}
|
|
650
|
+
fatal(e, ...r) {
|
|
651
|
+
typeof e == "string" ? this.log("fatal", e, r[0] ?? {}) : typeof e == "function" ? this.logLazily("fatal", e) : this.logTemplate("fatal", e, r);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
const At = C.getLogger(["logtape", "meta"]);
|
|
655
|
+
function me(t, e) {
|
|
656
|
+
const r = [];
|
|
657
|
+
let n = "";
|
|
658
|
+
for (let i = 0; i < t.length; i++) {
|
|
659
|
+
const a = t.charAt(i), s = t.charAt(i + 1);
|
|
660
|
+
if (a === "{" && s === "{")
|
|
661
|
+
n = n + a, i++;
|
|
662
|
+
else if (a === "}" && s === "}")
|
|
663
|
+
n = n + a, i++;
|
|
664
|
+
else if (a === "{")
|
|
665
|
+
r.push(n), n = "";
|
|
666
|
+
else if (a === "}") {
|
|
667
|
+
let l;
|
|
668
|
+
n.match(/^\s|\s$/) ? l = n in e ? e[n] : e[n.trim()] : l = e[n], r.push(l), n = "";
|
|
669
|
+
} else
|
|
670
|
+
n = n + a;
|
|
671
|
+
}
|
|
672
|
+
return r.push(n), r;
|
|
673
|
+
}
|
|
674
|
+
function ve(t, e) {
|
|
675
|
+
const r = [];
|
|
676
|
+
for (let n = 0; n < t.length; n++)
|
|
677
|
+
r.push(t[n]), n < e.length && r.push(e[n]);
|
|
678
|
+
return r;
|
|
679
|
+
}
|
|
680
|
+
function _e(t) {
|
|
681
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
682
|
+
}
|
|
683
|
+
function Re(t) {
|
|
684
|
+
throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
685
|
+
}
|
|
686
|
+
var K, be;
|
|
687
|
+
function wt() {
|
|
688
|
+
if (be) return K;
|
|
689
|
+
be = 1;
|
|
690
|
+
let t = null;
|
|
691
|
+
if (typeof window > "u" && ("process" in globalThis && "versions" in globalThis.process && "node" in globalThis.process.versions && typeof globalThis.caches > "u" && typeof globalThis.addEventListener != "function" || "Bun" in globalThis))
|
|
692
|
+
try {
|
|
693
|
+
t = [Re][0](`${["node", "util"].join(":")}`);
|
|
694
|
+
} catch {
|
|
695
|
+
t = null;
|
|
696
|
+
}
|
|
697
|
+
return K = t, K;
|
|
698
|
+
}
|
|
699
|
+
var Ot = wt();
|
|
700
|
+
const q = /* @__PURE__ */ _e(Ot), Ae = {
|
|
701
|
+
debug: "DBG",
|
|
702
|
+
info: "INF",
|
|
703
|
+
warning: "WRN",
|
|
704
|
+
error: "ERR",
|
|
705
|
+
fatal: "FTL"
|
|
706
|
+
}, Me = (
|
|
707
|
+
// @ts-ignore: Deno global
|
|
708
|
+
// dnt-shim-ignore
|
|
709
|
+
"Deno" in globalThis && "inspect" in globalThis.Deno && // @ts-ignore: Deno global
|
|
710
|
+
// dnt-shim-ignore
|
|
711
|
+
typeof globalThis.Deno.inspect == "function" ? (t, e) => (
|
|
712
|
+
// @ts-ignore: Deno global
|
|
713
|
+
// dnt-shim-ignore
|
|
714
|
+
globalThis.Deno.inspect(t, {
|
|
715
|
+
strAbbreviateSize: 1 / 0,
|
|
716
|
+
iterableLimit: 1 / 0,
|
|
717
|
+
...e
|
|
718
|
+
})
|
|
719
|
+
) : q != null && "inspect" in q && typeof q.inspect == "function" ? (t, e) => (
|
|
720
|
+
// @ts-ignore: Node.js global
|
|
721
|
+
// dnt-shim-ignore
|
|
722
|
+
q.inspect(t, {
|
|
723
|
+
maxArrayLength: 1 / 0,
|
|
724
|
+
maxStringLength: 1 / 0,
|
|
725
|
+
...e
|
|
726
|
+
})
|
|
727
|
+
) : (t) => JSON.stringify(t)
|
|
728
|
+
);
|
|
729
|
+
function $e(t = {}) {
|
|
730
|
+
const e = t.timestamp == null || t.timestamp === "date-time-timezone" ? (s) => new Date(s).toISOString().replace("T", " ").replace("Z", " +00:00") : t.timestamp === "date-time-tz" ? (s) => new Date(s).toISOString().replace("T", " ").replace("Z", " +00") : t.timestamp === "date-time" ? (s) => new Date(s).toISOString().replace("T", " ").replace("Z", "") : t.timestamp === "time-timezone" ? (s) => new Date(s).toISOString().replace(/.*T/, "").replace("Z", " +00:00") : t.timestamp === "time-tz" ? (s) => new Date(s).toISOString().replace(/.*T/, "").replace("Z", " +00") : t.timestamp === "time" ? (s) => new Date(s).toISOString().replace(/.*T/, "").replace("Z", "") : t.timestamp === "date" ? (s) => new Date(s).toISOString().replace(/T.*/, "") : t.timestamp === "rfc3339" ? (s) => new Date(s).toISOString() : t.timestamp, r = t.category ?? "·", n = t.value ?? Me, i = t.level == null || t.level === "ABBR" ? (s) => Ae[s] : t.level === "abbr" ? (s) => Ae[s].toLowerCase() : t.level === "FULL" ? (s) => s.toUpperCase() : t.level === "full" ? (s) => s : t.level === "L" ? (s) => s.charAt(0).toUpperCase() : t.level === "l" ? (s) => s.charAt(0) : t.level, a = t.format ?? (({ timestamp: s, level: l, category: u, message: o }) => `${s} [${l}] ${u}: ${o}`);
|
|
731
|
+
return (s) => {
|
|
732
|
+
let l = "";
|
|
733
|
+
for (let g = 0; g < s.message.length; g++)
|
|
734
|
+
g % 2 === 0 ? l += s.message[g] : l += n(s.message[g]);
|
|
735
|
+
const u = e(s.timestamp), o = i(s.level), c = typeof r == "function" ? r(s.category) : s.category.join(r);
|
|
736
|
+
return `${a({
|
|
737
|
+
timestamp: u,
|
|
738
|
+
level: o,
|
|
739
|
+
category: c,
|
|
740
|
+
message: l,
|
|
741
|
+
record: s
|
|
742
|
+
})}
|
|
743
|
+
`;
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
$e();
|
|
747
|
+
const Z = "\x1B[0m", Y = {
|
|
748
|
+
black: "\x1B[30m",
|
|
749
|
+
red: "\x1B[31m",
|
|
750
|
+
green: "\x1B[32m",
|
|
751
|
+
yellow: "\x1B[33m",
|
|
752
|
+
blue: "\x1B[34m",
|
|
753
|
+
magenta: "\x1B[35m",
|
|
754
|
+
cyan: "\x1B[36m",
|
|
755
|
+
white: "\x1B[37m"
|
|
756
|
+
}, J = {
|
|
757
|
+
bold: "\x1B[1m",
|
|
758
|
+
dim: "\x1B[2m",
|
|
759
|
+
italic: "\x1B[3m",
|
|
760
|
+
underline: "\x1B[4m",
|
|
761
|
+
strikethrough: "\x1B[9m"
|
|
762
|
+
}, Et = {
|
|
763
|
+
debug: "blue",
|
|
764
|
+
info: "green",
|
|
765
|
+
warning: "yellow",
|
|
766
|
+
error: "red",
|
|
767
|
+
fatal: "magenta"
|
|
768
|
+
};
|
|
769
|
+
function St(t = {}) {
|
|
770
|
+
const e = t.format, r = typeof t.timestampStyle > "u" ? "dim" : t.timestampStyle, n = t.timestampColor ?? null, i = `${r == null ? "" : J[r]}${n == null ? "" : Y[n]}`, a = r == null && n == null ? "" : Z, s = typeof t.levelStyle > "u" ? "bold" : t.levelStyle, l = t.levelColors ?? Et, u = typeof t.categoryStyle > "u" ? "dim" : t.categoryStyle, o = t.categoryColor ?? null, c = `${u == null ? "" : J[u]}${o == null ? "" : Y[o]}`, h = u == null && o == null ? "" : Z;
|
|
771
|
+
return $e({
|
|
772
|
+
timestamp: "date-time-tz",
|
|
773
|
+
value(g) {
|
|
774
|
+
return Me(g, { colors: !0 });
|
|
775
|
+
},
|
|
776
|
+
...t,
|
|
777
|
+
format({ timestamp: g, level: m, category: S, message: G, record: F }) {
|
|
778
|
+
const L = l[F.level];
|
|
779
|
+
return g = `${i}${g}${a}`, m = `${s == null ? "" : J[s]}${L == null ? "" : Y[L]}${m}${s == null && L == null ? "" : Z}`, e == null ? `${g} ${m} ${c}${S}:${h} ${G}` : e({
|
|
780
|
+
timestamp: g,
|
|
781
|
+
level: m,
|
|
782
|
+
category: `${c}${S}${h}`,
|
|
783
|
+
message: G,
|
|
784
|
+
record: F
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
St();
|
|
790
|
+
var Q, we;
|
|
791
|
+
function Lt() {
|
|
792
|
+
if (we) return Q;
|
|
793
|
+
we = 1;
|
|
794
|
+
let t = null;
|
|
795
|
+
if (typeof window > "u" && ("process" in globalThis && "versions" in globalThis.process && "node" in globalThis.process.versions && typeof globalThis.caches > "u" && typeof globalThis.addEventListener != "function" || "Bun" in globalThis))
|
|
796
|
+
try {
|
|
797
|
+
t = [Re][0](`${["node", "fs"].join(":")}`);
|
|
798
|
+
} catch {
|
|
799
|
+
t = null;
|
|
800
|
+
}
|
|
801
|
+
return Q = t, Q;
|
|
802
|
+
}
|
|
803
|
+
var Tt = Lt();
|
|
804
|
+
const Ct = /* @__PURE__ */ _e(Tt), It = {}, _ = Ct;
|
|
805
|
+
_ == null || (_.writeSync, _.fsyncSync, _.closeSync, _.statSync, _.renameSync);
|
|
806
|
+
var d = function(t, e, r, n) {
|
|
807
|
+
function i(a) {
|
|
808
|
+
return a instanceof r ? a : new r(function(s) {
|
|
809
|
+
s(a);
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
return new (r || (r = Promise))(function(a, s) {
|
|
813
|
+
function l(c) {
|
|
814
|
+
try {
|
|
815
|
+
o(n.next(c));
|
|
816
|
+
} catch (h) {
|
|
817
|
+
s(h);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
function u(c) {
|
|
821
|
+
try {
|
|
822
|
+
o(n.throw(c));
|
|
823
|
+
} catch (h) {
|
|
824
|
+
s(h);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
function o(c) {
|
|
828
|
+
c.done ? a(c.value) : i(c.value).then(l, u);
|
|
829
|
+
}
|
|
830
|
+
o((n = n.apply(t, e || [])).next());
|
|
831
|
+
});
|
|
832
|
+
}, y = function(t, e) {
|
|
833
|
+
var r = { label: 0, sent: function() {
|
|
834
|
+
if (a[0] & 1) throw a[1];
|
|
835
|
+
return a[1];
|
|
836
|
+
}, trys: [], ops: [] }, n, i, a, s = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
837
|
+
return s.next = l(0), s.throw = l(1), s.return = l(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
|
|
838
|
+
return this;
|
|
839
|
+
}), s;
|
|
840
|
+
function l(o) {
|
|
841
|
+
return function(c) {
|
|
842
|
+
return u([o, c]);
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
function u(o) {
|
|
846
|
+
if (n) throw new TypeError("Generator is already executing.");
|
|
847
|
+
for (; s && (s = 0, o[0] && (r = 0)), r; ) try {
|
|
848
|
+
if (n = 1, i && (a = o[0] & 2 ? i.return : o[0] ? i.throw || ((a = i.return) && a.call(i), 0) : i.next) && !(a = a.call(i, o[1])).done) return a;
|
|
849
|
+
switch (i = 0, a && (o = [o[0] & 2, a.value]), o[0]) {
|
|
850
|
+
case 0:
|
|
851
|
+
case 1:
|
|
852
|
+
a = o;
|
|
853
|
+
break;
|
|
854
|
+
case 4:
|
|
855
|
+
return r.label++, { value: o[1], done: !1 };
|
|
856
|
+
case 5:
|
|
857
|
+
r.label++, i = o[1], o = [0];
|
|
858
|
+
continue;
|
|
859
|
+
case 7:
|
|
860
|
+
o = r.ops.pop(), r.trys.pop();
|
|
861
|
+
continue;
|
|
862
|
+
default:
|
|
863
|
+
if (a = r.trys, !(a = a.length > 0 && a[a.length - 1]) && (o[0] === 6 || o[0] === 2)) {
|
|
864
|
+
r = 0;
|
|
865
|
+
continue;
|
|
866
|
+
}
|
|
867
|
+
if (o[0] === 3 && (!a || o[1] > a[0] && o[1] < a[3])) {
|
|
868
|
+
r.label = o[1];
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
if (o[0] === 6 && r.label < a[1]) {
|
|
872
|
+
r.label = a[1], a = o;
|
|
873
|
+
break;
|
|
874
|
+
}
|
|
875
|
+
if (a && r.label < a[2]) {
|
|
876
|
+
r.label = a[2], r.ops.push(o);
|
|
877
|
+
break;
|
|
878
|
+
}
|
|
879
|
+
a[2] && r.ops.pop(), r.trys.pop();
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
882
|
+
o = e.call(t, r);
|
|
883
|
+
} catch (c) {
|
|
884
|
+
o = [6, c], i = 0;
|
|
885
|
+
} finally {
|
|
886
|
+
n = a = 0;
|
|
887
|
+
}
|
|
888
|
+
if (o[0] & 5) throw o[1];
|
|
889
|
+
return { value: o[0] ? o[1] : void 0, done: !0 };
|
|
890
|
+
}
|
|
891
|
+
}, O = function(t, e) {
|
|
892
|
+
var r = typeof Symbol == "function" && t[Symbol.iterator];
|
|
893
|
+
if (!r) return t;
|
|
894
|
+
var n = r.call(t), i, a = [], s;
|
|
895
|
+
try {
|
|
896
|
+
for (; (e === void 0 || e-- > 0) && !(i = n.next()).done; ) a.push(i.value);
|
|
897
|
+
} catch (l) {
|
|
898
|
+
s = { error: l };
|
|
899
|
+
} finally {
|
|
900
|
+
try {
|
|
901
|
+
i && !i.done && (r = n.return) && r.call(n);
|
|
902
|
+
} finally {
|
|
903
|
+
if (s) throw s.error;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
return a;
|
|
907
|
+
}, E = function(t, e, r) {
|
|
908
|
+
if (r || arguments.length === 2) for (var n = 0, i = e.length, a; n < i; n++)
|
|
909
|
+
(a || !(n in e)) && (a || (a = Array.prototype.slice.call(e, 0, n)), a[n] = e[n]);
|
|
910
|
+
return t.concat(a || Array.prototype.slice.call(e));
|
|
911
|
+
}, Oe = function(t) {
|
|
912
|
+
var e = typeof Symbol == "function" && Symbol.iterator, r = e && t[e], n = 0;
|
|
913
|
+
if (r) return r.call(t);
|
|
914
|
+
if (t && typeof t.length == "number") return {
|
|
915
|
+
next: function() {
|
|
916
|
+
return t && n >= t.length && (t = void 0), { value: t && t[n++], done: !t };
|
|
917
|
+
}
|
|
918
|
+
};
|
|
919
|
+
throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
920
|
+
};
|
|
921
|
+
(function() {
|
|
922
|
+
function t(e) {
|
|
923
|
+
e === void 0 && (e = t.minComparator);
|
|
924
|
+
var r = this;
|
|
925
|
+
this.compare = e, this.heapArray = [], this._limit = 0, this.offer = this.add, this.element = this.peek, this.poll = this.pop, this._invertedCompare = function(n, i) {
|
|
926
|
+
return r.compare(n, i).then(function(a) {
|
|
927
|
+
return -1 * a;
|
|
928
|
+
});
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
return t.getChildrenIndexOf = function(e) {
|
|
932
|
+
return [e * 2 + 1, e * 2 + 2];
|
|
933
|
+
}, t.getParentIndexOf = function(e) {
|
|
934
|
+
if (e <= 0)
|
|
935
|
+
return -1;
|
|
936
|
+
var r = e % 2 ? 1 : 2;
|
|
937
|
+
return Math.floor((e - r) / 2);
|
|
938
|
+
}, t.getSiblingIndexOf = function(e) {
|
|
939
|
+
if (e <= 0)
|
|
940
|
+
return -1;
|
|
941
|
+
var r = e % 2 ? 1 : -1;
|
|
942
|
+
return e + r;
|
|
943
|
+
}, t.minComparator = function(e, r) {
|
|
944
|
+
return d(this, void 0, void 0, function() {
|
|
945
|
+
return y(this, function(n) {
|
|
946
|
+
return e > r ? [2, 1] : e < r ? [2, -1] : [2, 0];
|
|
947
|
+
});
|
|
948
|
+
});
|
|
949
|
+
}, t.maxComparator = function(e, r) {
|
|
950
|
+
return d(this, void 0, void 0, function() {
|
|
951
|
+
return y(this, function(n) {
|
|
952
|
+
return r > e ? [2, 1] : r < e ? [2, -1] : [2, 0];
|
|
953
|
+
});
|
|
954
|
+
});
|
|
955
|
+
}, t.minComparatorNumber = function(e, r) {
|
|
956
|
+
return d(this, void 0, void 0, function() {
|
|
957
|
+
return y(this, function(n) {
|
|
958
|
+
return [2, e - r];
|
|
959
|
+
});
|
|
960
|
+
});
|
|
961
|
+
}, t.maxComparatorNumber = function(e, r) {
|
|
962
|
+
return d(this, void 0, void 0, function() {
|
|
963
|
+
return y(this, function(n) {
|
|
964
|
+
return [2, r - e];
|
|
965
|
+
});
|
|
966
|
+
});
|
|
967
|
+
}, t.defaultIsEqual = function(e, r) {
|
|
968
|
+
return d(this, void 0, void 0, function() {
|
|
969
|
+
return y(this, function(n) {
|
|
970
|
+
return [2, e === r];
|
|
971
|
+
});
|
|
972
|
+
});
|
|
973
|
+
}, t.print = function(e) {
|
|
974
|
+
function r(c) {
|
|
975
|
+
var h = t.getParentIndexOf(c);
|
|
976
|
+
return Math.floor(Math.log2(h + 1));
|
|
977
|
+
}
|
|
978
|
+
function n(c, h) {
|
|
979
|
+
for (var g = ""; h > 0; --h)
|
|
980
|
+
g += c;
|
|
981
|
+
return g;
|
|
982
|
+
}
|
|
983
|
+
for (var i = 0, a = [], s = r(e.length - 1) + 2, l = 0; i < e.length; ) {
|
|
984
|
+
var u = r(i) + 1;
|
|
985
|
+
i === 0 && (u = 0);
|
|
986
|
+
var o = String(e.get(i));
|
|
987
|
+
o.length > l && (l = o.length), a[u] = a[u] || [], a[u].push(o), i += 1;
|
|
988
|
+
}
|
|
989
|
+
return a.map(function(c, h) {
|
|
990
|
+
var g = Math.pow(2, s - h) - 1;
|
|
991
|
+
return n(" ", Math.floor(g / 2) * l) + c.map(function(m) {
|
|
992
|
+
var S = (l - m.length) / 2;
|
|
993
|
+
return n(" ", Math.ceil(S)) + m + n(" ", Math.floor(S));
|
|
994
|
+
}).join(n(" ", g * l));
|
|
995
|
+
}).join(`
|
|
996
|
+
`);
|
|
997
|
+
}, t.heapify = function(e, r) {
|
|
998
|
+
return d(this, void 0, void 0, function() {
|
|
999
|
+
var n;
|
|
1000
|
+
return y(this, function(i) {
|
|
1001
|
+
switch (i.label) {
|
|
1002
|
+
case 0:
|
|
1003
|
+
return n = new t(r), n.heapArray = e, [4, n.init()];
|
|
1004
|
+
case 1:
|
|
1005
|
+
return i.sent(), [2, n];
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1008
|
+
});
|
|
1009
|
+
}, t.heappop = function(e, r) {
|
|
1010
|
+
var n = new t(r);
|
|
1011
|
+
return n.heapArray = e, n.pop();
|
|
1012
|
+
}, t.heappush = function(e, r, n) {
|
|
1013
|
+
return d(this, void 0, void 0, function() {
|
|
1014
|
+
var i;
|
|
1015
|
+
return y(this, function(a) {
|
|
1016
|
+
switch (a.label) {
|
|
1017
|
+
case 0:
|
|
1018
|
+
return i = new t(n), i.heapArray = e, [4, i.push(r)];
|
|
1019
|
+
case 1:
|
|
1020
|
+
return a.sent(), [
|
|
1021
|
+
2
|
|
1022
|
+
/*return*/
|
|
1023
|
+
];
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
});
|
|
1027
|
+
}, t.heappushpop = function(e, r, n) {
|
|
1028
|
+
var i = new t(n);
|
|
1029
|
+
return i.heapArray = e, i.pushpop(r);
|
|
1030
|
+
}, t.heapreplace = function(e, r, n) {
|
|
1031
|
+
var i = new t(n);
|
|
1032
|
+
return i.heapArray = e, i.replace(r);
|
|
1033
|
+
}, t.heaptop = function(e, r, n) {
|
|
1034
|
+
r === void 0 && (r = 1);
|
|
1035
|
+
var i = new t(n);
|
|
1036
|
+
return i.heapArray = e, i.top(r);
|
|
1037
|
+
}, t.heapbottom = function(e, r, n) {
|
|
1038
|
+
r === void 0 && (r = 1);
|
|
1039
|
+
var i = new t(n);
|
|
1040
|
+
return i.heapArray = e, i.bottom(r);
|
|
1041
|
+
}, t.nlargest = function(e, r, n) {
|
|
1042
|
+
return d(this, void 0, void 0, function() {
|
|
1043
|
+
var i;
|
|
1044
|
+
return y(this, function(a) {
|
|
1045
|
+
switch (a.label) {
|
|
1046
|
+
case 0:
|
|
1047
|
+
return i = new t(n), i.heapArray = E([], O(r), !1), [4, i.init()];
|
|
1048
|
+
case 1:
|
|
1049
|
+
return a.sent(), [2, i.top(e)];
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
});
|
|
1053
|
+
}, t.nsmallest = function(e, r, n) {
|
|
1054
|
+
return d(this, void 0, void 0, function() {
|
|
1055
|
+
var i;
|
|
1056
|
+
return y(this, function(a) {
|
|
1057
|
+
switch (a.label) {
|
|
1058
|
+
case 0:
|
|
1059
|
+
return i = new t(n), i.heapArray = E([], O(r), !1), [4, i.init()];
|
|
1060
|
+
case 1:
|
|
1061
|
+
return a.sent(), [2, i.bottom(e)];
|
|
1062
|
+
}
|
|
1063
|
+
});
|
|
1064
|
+
});
|
|
1065
|
+
}, t.prototype.add = function(e) {
|
|
1066
|
+
return d(this, void 0, void 0, function() {
|
|
1067
|
+
return y(this, function(r) {
|
|
1068
|
+
switch (r.label) {
|
|
1069
|
+
case 0:
|
|
1070
|
+
return [4, this._sortNodeUp(this.heapArray.push(e) - 1)];
|
|
1071
|
+
case 1:
|
|
1072
|
+
return r.sent(), this._applyLimit(), [2, !0];
|
|
1073
|
+
}
|
|
1074
|
+
});
|
|
1075
|
+
});
|
|
1076
|
+
}, t.prototype.addAll = function(e) {
|
|
1077
|
+
return d(this, void 0, void 0, function() {
|
|
1078
|
+
var r, n, i;
|
|
1079
|
+
return y(this, function(a) {
|
|
1080
|
+
switch (a.label) {
|
|
1081
|
+
case 0:
|
|
1082
|
+
r = this.length, (i = this.heapArray).push.apply(i, E([], O(e), !1)), n = this.length, a.label = 1;
|
|
1083
|
+
case 1:
|
|
1084
|
+
return r < n ? [4, this._sortNodeUp(r)] : [3, 4];
|
|
1085
|
+
case 2:
|
|
1086
|
+
a.sent(), a.label = 3;
|
|
1087
|
+
case 3:
|
|
1088
|
+
return ++r, [3, 1];
|
|
1089
|
+
case 4:
|
|
1090
|
+
return this._applyLimit(), [2, !0];
|
|
1091
|
+
}
|
|
1092
|
+
});
|
|
1093
|
+
});
|
|
1094
|
+
}, t.prototype.bottom = function() {
|
|
1095
|
+
return d(this, arguments, void 0, function(e) {
|
|
1096
|
+
return e === void 0 && (e = 1), y(this, function(r) {
|
|
1097
|
+
return this.heapArray.length === 0 || e <= 0 ? [2, []] : this.heapArray.length === 1 ? [2, [this.heapArray[0]]] : e >= this.heapArray.length ? [2, E([], O(this.heapArray), !1)] : [2, this._bottomN_push(~~e)];
|
|
1098
|
+
});
|
|
1099
|
+
});
|
|
1100
|
+
}, t.prototype.check = function() {
|
|
1101
|
+
return d(this, void 0, void 0, function() {
|
|
1102
|
+
var e, r, n, i, a, s, l, u, o;
|
|
1103
|
+
return y(this, function(c) {
|
|
1104
|
+
switch (c.label) {
|
|
1105
|
+
case 0:
|
|
1106
|
+
e = 0, c.label = 1;
|
|
1107
|
+
case 1:
|
|
1108
|
+
if (!(e < this.heapArray.length)) return [3, 10];
|
|
1109
|
+
r = this.heapArray[e], n = this.getChildrenOf(e), c.label = 2;
|
|
1110
|
+
case 2:
|
|
1111
|
+
c.trys.push([2, 7, 8, 9]), i = (u = void 0, Oe(n)), a = i.next(), c.label = 3;
|
|
1112
|
+
case 3:
|
|
1113
|
+
return a.done ? [3, 6] : (s = a.value, [4, this.compare(r, s)]);
|
|
1114
|
+
case 4:
|
|
1115
|
+
if (c.sent() > 0)
|
|
1116
|
+
return [2, r];
|
|
1117
|
+
c.label = 5;
|
|
1118
|
+
case 5:
|
|
1119
|
+
return a = i.next(), [3, 3];
|
|
1120
|
+
case 6:
|
|
1121
|
+
return [3, 9];
|
|
1122
|
+
case 7:
|
|
1123
|
+
return l = c.sent(), u = { error: l }, [3, 9];
|
|
1124
|
+
case 8:
|
|
1125
|
+
try {
|
|
1126
|
+
a && !a.done && (o = i.return) && o.call(i);
|
|
1127
|
+
} finally {
|
|
1128
|
+
if (u) throw u.error;
|
|
1129
|
+
}
|
|
1130
|
+
return [
|
|
1131
|
+
7
|
|
1132
|
+
/*endfinally*/
|
|
1133
|
+
];
|
|
1134
|
+
case 9:
|
|
1135
|
+
return ++e, [3, 1];
|
|
1136
|
+
case 10:
|
|
1137
|
+
return [
|
|
1138
|
+
2
|
|
1139
|
+
/*return*/
|
|
1140
|
+
];
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
});
|
|
1144
|
+
}, t.prototype.clear = function() {
|
|
1145
|
+
this.heapArray = [];
|
|
1146
|
+
}, t.prototype.clone = function() {
|
|
1147
|
+
var e = new t(this.comparator());
|
|
1148
|
+
return e.heapArray = this.toArray(), e._limit = this._limit, e;
|
|
1149
|
+
}, t.prototype.comparator = function() {
|
|
1150
|
+
return this.compare;
|
|
1151
|
+
}, t.prototype.contains = function(e) {
|
|
1152
|
+
return d(this, arguments, void 0, function(r, n) {
|
|
1153
|
+
var i, a, s, l, u, o;
|
|
1154
|
+
return n === void 0 && (n = t.defaultIsEqual), y(this, function(c) {
|
|
1155
|
+
switch (c.label) {
|
|
1156
|
+
case 0:
|
|
1157
|
+
c.trys.push([0, 5, 6, 7]), i = Oe(this.heapArray), a = i.next(), c.label = 1;
|
|
1158
|
+
case 1:
|
|
1159
|
+
return a.done ? [3, 4] : (s = a.value, [4, n(s, r)]);
|
|
1160
|
+
case 2:
|
|
1161
|
+
if (c.sent())
|
|
1162
|
+
return [2, !0];
|
|
1163
|
+
c.label = 3;
|
|
1164
|
+
case 3:
|
|
1165
|
+
return a = i.next(), [3, 1];
|
|
1166
|
+
case 4:
|
|
1167
|
+
return [3, 7];
|
|
1168
|
+
case 5:
|
|
1169
|
+
return l = c.sent(), u = { error: l }, [3, 7];
|
|
1170
|
+
case 6:
|
|
1171
|
+
try {
|
|
1172
|
+
a && !a.done && (o = i.return) && o.call(i);
|
|
1173
|
+
} finally {
|
|
1174
|
+
if (u) throw u.error;
|
|
1175
|
+
}
|
|
1176
|
+
return [
|
|
1177
|
+
7
|
|
1178
|
+
/*endfinally*/
|
|
1179
|
+
];
|
|
1180
|
+
case 7:
|
|
1181
|
+
return [2, !1];
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
});
|
|
1185
|
+
}, t.prototype.init = function(e) {
|
|
1186
|
+
return d(this, void 0, void 0, function() {
|
|
1187
|
+
var r;
|
|
1188
|
+
return y(this, function(n) {
|
|
1189
|
+
switch (n.label) {
|
|
1190
|
+
case 0:
|
|
1191
|
+
e && (this.heapArray = E([], O(e), !1)), r = t.getParentIndexOf(this.length - 1), n.label = 1;
|
|
1192
|
+
case 1:
|
|
1193
|
+
return r >= 0 ? [4, this._sortNodeDown(r)] : [3, 4];
|
|
1194
|
+
case 2:
|
|
1195
|
+
n.sent(), n.label = 3;
|
|
1196
|
+
case 3:
|
|
1197
|
+
return --r, [3, 1];
|
|
1198
|
+
case 4:
|
|
1199
|
+
return this._applyLimit(), [
|
|
1200
|
+
2
|
|
1201
|
+
/*return*/
|
|
1202
|
+
];
|
|
1203
|
+
}
|
|
1204
|
+
});
|
|
1205
|
+
});
|
|
1206
|
+
}, t.prototype.isEmpty = function() {
|
|
1207
|
+
return this.length === 0;
|
|
1208
|
+
}, t.prototype.leafs = function() {
|
|
1209
|
+
if (this.heapArray.length === 0)
|
|
1210
|
+
return [];
|
|
1211
|
+
var e = t.getParentIndexOf(this.heapArray.length - 1);
|
|
1212
|
+
return this.heapArray.slice(e + 1);
|
|
1213
|
+
}, Object.defineProperty(t.prototype, "length", {
|
|
1214
|
+
/**
|
|
1215
|
+
* Length of the heap.
|
|
1216
|
+
* @return {Number}
|
|
1217
|
+
*/
|
|
1218
|
+
get: function() {
|
|
1219
|
+
return this.heapArray.length;
|
|
1220
|
+
},
|
|
1221
|
+
enumerable: !1,
|
|
1222
|
+
configurable: !0
|
|
1223
|
+
}), Object.defineProperty(t.prototype, "limit", {
|
|
1224
|
+
/**
|
|
1225
|
+
* Get length limit of the heap.
|
|
1226
|
+
* @return {Number}
|
|
1227
|
+
*/
|
|
1228
|
+
get: function() {
|
|
1229
|
+
return this._limit;
|
|
1230
|
+
},
|
|
1231
|
+
/**
|
|
1232
|
+
* Set length limit of the heap.
|
|
1233
|
+
* @return {Number}
|
|
1234
|
+
*/
|
|
1235
|
+
set: function(e) {
|
|
1236
|
+
this._limit = ~~e, this._applyLimit();
|
|
1237
|
+
},
|
|
1238
|
+
enumerable: !1,
|
|
1239
|
+
configurable: !0
|
|
1240
|
+
}), t.prototype.peek = function() {
|
|
1241
|
+
return this.heapArray[0];
|
|
1242
|
+
}, t.prototype.pop = function() {
|
|
1243
|
+
return d(this, void 0, void 0, function() {
|
|
1244
|
+
var e;
|
|
1245
|
+
return y(this, function(r) {
|
|
1246
|
+
return e = this.heapArray.pop(), this.length > 0 && e !== void 0 ? [2, this.replace(e)] : [2, e];
|
|
1247
|
+
});
|
|
1248
|
+
});
|
|
1249
|
+
}, t.prototype.push = function() {
|
|
1250
|
+
for (var e = [], r = 0; r < arguments.length; r++)
|
|
1251
|
+
e[r] = arguments[r];
|
|
1252
|
+
return d(this, void 0, void 0, function() {
|
|
1253
|
+
return y(this, function(n) {
|
|
1254
|
+
return e.length < 1 ? [2, !1] : e.length === 1 ? [2, this.add(e[0])] : [2, this.addAll(e)];
|
|
1255
|
+
});
|
|
1256
|
+
});
|
|
1257
|
+
}, t.prototype.pushpop = function(e) {
|
|
1258
|
+
return d(this, void 0, void 0, function() {
|
|
1259
|
+
var r;
|
|
1260
|
+
return y(this, function(n) {
|
|
1261
|
+
switch (n.label) {
|
|
1262
|
+
case 0:
|
|
1263
|
+
return [4, this.compare(this.heapArray[0], e)];
|
|
1264
|
+
case 1:
|
|
1265
|
+
return n.sent() < 0 ? (r = O([this.heapArray[0], e], 2), e = r[0], this.heapArray[0] = r[1], [4, this._sortNodeDown(0)]) : [3, 3];
|
|
1266
|
+
case 2:
|
|
1267
|
+
n.sent(), n.label = 3;
|
|
1268
|
+
case 3:
|
|
1269
|
+
return [2, e];
|
|
1270
|
+
}
|
|
1271
|
+
});
|
|
1272
|
+
});
|
|
1273
|
+
}, t.prototype.remove = function(e) {
|
|
1274
|
+
return d(this, arguments, void 0, function(r, n) {
|
|
1275
|
+
var i, a, s, l = this;
|
|
1276
|
+
return n === void 0 && (n = t.defaultIsEqual), y(this, function(u) {
|
|
1277
|
+
switch (u.label) {
|
|
1278
|
+
case 0:
|
|
1279
|
+
return this.heapArray.length ? r !== void 0 ? [3, 2] : [4, this.pop()] : [2, !1];
|
|
1280
|
+
case 1:
|
|
1281
|
+
return u.sent(), [2, !0];
|
|
1282
|
+
case 2:
|
|
1283
|
+
i = [0], u.label = 3;
|
|
1284
|
+
case 3:
|
|
1285
|
+
return i.length ? (a = i.shift(), [4, n(this.heapArray[a], r)]) : [3, 13];
|
|
1286
|
+
case 4:
|
|
1287
|
+
return u.sent() ? a !== 0 ? [3, 6] : [4, this.pop()] : [3, 11];
|
|
1288
|
+
case 5:
|
|
1289
|
+
return u.sent(), [3, 10];
|
|
1290
|
+
case 6:
|
|
1291
|
+
return a !== this.heapArray.length - 1 ? [3, 7] : (this.heapArray.pop(), [3, 10]);
|
|
1292
|
+
case 7:
|
|
1293
|
+
return this.heapArray.splice(a, 1, this.heapArray.pop()), [4, this._sortNodeUp(a)];
|
|
1294
|
+
case 8:
|
|
1295
|
+
return u.sent(), [4, this._sortNodeDown(a)];
|
|
1296
|
+
case 9:
|
|
1297
|
+
u.sent(), u.label = 10;
|
|
1298
|
+
case 10:
|
|
1299
|
+
return [2, !0];
|
|
1300
|
+
case 11:
|
|
1301
|
+
s = t.getChildrenIndexOf(a).filter(function(o) {
|
|
1302
|
+
return o < l.heapArray.length;
|
|
1303
|
+
}), i.push.apply(i, E([], O(s), !1)), u.label = 12;
|
|
1304
|
+
case 12:
|
|
1305
|
+
return [3, 3];
|
|
1306
|
+
case 13:
|
|
1307
|
+
return [2, !1];
|
|
1308
|
+
}
|
|
1309
|
+
});
|
|
1310
|
+
});
|
|
1311
|
+
}, t.prototype.replace = function(e) {
|
|
1312
|
+
return d(this, void 0, void 0, function() {
|
|
1313
|
+
var r;
|
|
1314
|
+
return y(this, function(n) {
|
|
1315
|
+
switch (n.label) {
|
|
1316
|
+
case 0:
|
|
1317
|
+
return r = this.heapArray[0], this.heapArray[0] = e, [4, this._sortNodeDown(0)];
|
|
1318
|
+
case 1:
|
|
1319
|
+
return n.sent(), [2, r];
|
|
1320
|
+
}
|
|
1321
|
+
});
|
|
1322
|
+
});
|
|
1323
|
+
}, t.prototype.size = function() {
|
|
1324
|
+
return this.length;
|
|
1325
|
+
}, t.prototype.top = function() {
|
|
1326
|
+
return d(this, arguments, void 0, function(e) {
|
|
1327
|
+
return e === void 0 && (e = 1), y(this, function(r) {
|
|
1328
|
+
return this.heapArray.length === 0 || e <= 0 ? [2, []] : this.heapArray.length === 1 || e === 1 ? [2, [this.heapArray[0]]] : e >= this.heapArray.length ? [2, E([], O(this.heapArray), !1)] : [2, this._topN_push(~~e)];
|
|
1329
|
+
});
|
|
1330
|
+
});
|
|
1331
|
+
}, t.prototype.toArray = function() {
|
|
1332
|
+
return E([], O(this.heapArray), !1);
|
|
1333
|
+
}, t.prototype.toString = function() {
|
|
1334
|
+
return this.heapArray.toString();
|
|
1335
|
+
}, t.prototype.get = function(e) {
|
|
1336
|
+
return this.heapArray[e];
|
|
1337
|
+
}, t.prototype.getChildrenOf = function(e) {
|
|
1338
|
+
var r = this;
|
|
1339
|
+
return t.getChildrenIndexOf(e).map(function(n) {
|
|
1340
|
+
return r.heapArray[n];
|
|
1341
|
+
}).filter(function(n) {
|
|
1342
|
+
return n !== void 0;
|
|
1343
|
+
});
|
|
1344
|
+
}, t.prototype.getParentOf = function(e) {
|
|
1345
|
+
var r = t.getParentIndexOf(e);
|
|
1346
|
+
return this.heapArray[r];
|
|
1347
|
+
}, t.prototype[Symbol.iterator] = function() {
|
|
1348
|
+
return y(this, function(e) {
|
|
1349
|
+
switch (e.label) {
|
|
1350
|
+
case 0:
|
|
1351
|
+
return this.length ? [4, this.pop()] : [3, 2];
|
|
1352
|
+
case 1:
|
|
1353
|
+
return e.sent(), [3, 0];
|
|
1354
|
+
case 2:
|
|
1355
|
+
return [
|
|
1356
|
+
2
|
|
1357
|
+
/*return*/
|
|
1358
|
+
];
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
}, t.prototype.iterator = function() {
|
|
1362
|
+
return this;
|
|
1363
|
+
}, t.prototype._applyLimit = function() {
|
|
1364
|
+
if (this._limit && this._limit < this.heapArray.length)
|
|
1365
|
+
for (var e = this.heapArray.length - this._limit; e; )
|
|
1366
|
+
this.heapArray.pop(), --e;
|
|
1367
|
+
}, t.prototype._bottomN_push = function(e) {
|
|
1368
|
+
return d(this, void 0, void 0, function() {
|
|
1369
|
+
var r, n, i, a, l, s, l;
|
|
1370
|
+
return y(this, function(u) {
|
|
1371
|
+
switch (u.label) {
|
|
1372
|
+
case 0:
|
|
1373
|
+
return r = new t(this.compare), r.limit = e, r.heapArray = this.heapArray.slice(-e), [4, r.init()];
|
|
1374
|
+
case 1:
|
|
1375
|
+
for (u.sent(), n = this.heapArray.length - 1 - e, i = t.getParentIndexOf(n), a = [], l = n; l > i; --l)
|
|
1376
|
+
a.push(l);
|
|
1377
|
+
s = this.heapArray, u.label = 2;
|
|
1378
|
+
case 2:
|
|
1379
|
+
return a.length ? (l = a.shift(), [4, this.compare(s[l], r.peek())]) : [3, 6];
|
|
1380
|
+
case 3:
|
|
1381
|
+
return u.sent() > 0 ? [4, r.replace(s[l])] : [3, 5];
|
|
1382
|
+
case 4:
|
|
1383
|
+
u.sent(), l % 2 && a.push(t.getParentIndexOf(l)), u.label = 5;
|
|
1384
|
+
case 5:
|
|
1385
|
+
return [3, 2];
|
|
1386
|
+
case 6:
|
|
1387
|
+
return [2, r.toArray()];
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
});
|
|
1391
|
+
}, t.prototype._moveNode = function(e, r) {
|
|
1392
|
+
var n = this.heapArray[e];
|
|
1393
|
+
this.heapArray[e] = this.heapArray[r], this.heapArray[r] = n;
|
|
1394
|
+
}, t.prototype._sortNodeDown = function(e) {
|
|
1395
|
+
return d(this, void 0, void 0, function() {
|
|
1396
|
+
var r, n, i, a, s, l, u;
|
|
1397
|
+
return y(this, function(o) {
|
|
1398
|
+
switch (o.label) {
|
|
1399
|
+
case 0:
|
|
1400
|
+
r = this.heapArray.length, n = e, i = this.heapArray[e], a = 2 * e + 1, o.label = 1;
|
|
1401
|
+
case 1:
|
|
1402
|
+
return a < r ? (s = a + 1, u = s >= r, u ? [3, 3] : [4, this.compare(this.heapArray[a], this.heapArray[s])]) : [3, 5];
|
|
1403
|
+
case 2:
|
|
1404
|
+
u = o.sent() < 0, o.label = 3;
|
|
1405
|
+
case 3:
|
|
1406
|
+
return l = u ? a : s, [4, this.compare(this.heapArray[l], i)];
|
|
1407
|
+
case 4:
|
|
1408
|
+
if (o.sent() < 0)
|
|
1409
|
+
this.heapArray[e] = this.heapArray[l], e = l, a = 2 * e + 1;
|
|
1410
|
+
else
|
|
1411
|
+
return [3, 5];
|
|
1412
|
+
return [3, 1];
|
|
1413
|
+
case 5:
|
|
1414
|
+
return e !== n && (this.heapArray[e] = i), [
|
|
1415
|
+
2
|
|
1416
|
+
/*return*/
|
|
1417
|
+
];
|
|
1418
|
+
}
|
|
1419
|
+
});
|
|
1420
|
+
});
|
|
1421
|
+
}, t.prototype._sortNodeUp = function(e) {
|
|
1422
|
+
return d(this, void 0, void 0, function() {
|
|
1423
|
+
var r, n, i;
|
|
1424
|
+
return y(this, function(a) {
|
|
1425
|
+
switch (a.label) {
|
|
1426
|
+
case 0:
|
|
1427
|
+
r = this.heapArray[e], n = e, a.label = 1;
|
|
1428
|
+
case 1:
|
|
1429
|
+
return e > 0 ? (i = t.getParentIndexOf(e), [4, this.compare(r, this.heapArray[i])]) : [3, 3];
|
|
1430
|
+
case 2:
|
|
1431
|
+
if (a.sent() < 0)
|
|
1432
|
+
this.heapArray[e] = this.heapArray[i], e = i;
|
|
1433
|
+
else
|
|
1434
|
+
return [3, 3];
|
|
1435
|
+
return [3, 1];
|
|
1436
|
+
case 3:
|
|
1437
|
+
return e !== n && (this.heapArray[e] = r), [
|
|
1438
|
+
2
|
|
1439
|
+
/*return*/
|
|
1440
|
+
];
|
|
1441
|
+
}
|
|
1442
|
+
});
|
|
1443
|
+
});
|
|
1444
|
+
}, t.prototype._topN_push = function(e) {
|
|
1445
|
+
return d(this, void 0, void 0, function() {
|
|
1446
|
+
var r, n, i, a;
|
|
1447
|
+
return y(this, function(s) {
|
|
1448
|
+
switch (s.label) {
|
|
1449
|
+
case 0:
|
|
1450
|
+
r = new t(this._invertedCompare), r.limit = e, n = [0], i = this.heapArray, s.label = 1;
|
|
1451
|
+
case 1:
|
|
1452
|
+
return n.length ? (a = n.shift(), a < i.length ? r.length < e ? [4, r.push(i[a])] : [3, 3] : [3, 6]) : [3, 7];
|
|
1453
|
+
case 2:
|
|
1454
|
+
return s.sent(), n.push.apply(n, E([], O(t.getChildrenIndexOf(a)), !1)), [3, 6];
|
|
1455
|
+
case 3:
|
|
1456
|
+
return [4, this.compare(i[a], r.peek())];
|
|
1457
|
+
case 4:
|
|
1458
|
+
return s.sent() < 0 ? [4, r.replace(i[a])] : [3, 6];
|
|
1459
|
+
case 5:
|
|
1460
|
+
s.sent(), n.push.apply(n, E([], O(t.getChildrenIndexOf(a)), !1)), s.label = 6;
|
|
1461
|
+
case 6:
|
|
1462
|
+
return [3, 1];
|
|
1463
|
+
case 7:
|
|
1464
|
+
return [2, r.toArray()];
|
|
1465
|
+
}
|
|
1466
|
+
});
|
|
1467
|
+
});
|
|
1468
|
+
}, t.prototype._topN_fill = function(e) {
|
|
1469
|
+
return d(this, void 0, void 0, function() {
|
|
1470
|
+
var r, n, i, a, s, s;
|
|
1471
|
+
return y(this, function(l) {
|
|
1472
|
+
switch (l.label) {
|
|
1473
|
+
case 0:
|
|
1474
|
+
return r = this.heapArray, n = new t(this._invertedCompare), n.limit = e, n.heapArray = r.slice(0, e), [4, n.init()];
|
|
1475
|
+
case 1:
|
|
1476
|
+
for (l.sent(), i = t.getParentIndexOf(e - 1) + 1, a = [], s = i; s < e; ++s)
|
|
1477
|
+
a.push.apply(a, E([], O(t.getChildrenIndexOf(s).filter(function(u) {
|
|
1478
|
+
return u < r.length;
|
|
1479
|
+
})), !1));
|
|
1480
|
+
(e - 1) % 2 && a.push(e), l.label = 2;
|
|
1481
|
+
case 2:
|
|
1482
|
+
return a.length ? (s = a.shift(), s < r.length ? [4, this.compare(r[s], n.peek())] : [3, 5]) : [3, 6];
|
|
1483
|
+
case 3:
|
|
1484
|
+
return l.sent() < 0 ? [4, n.replace(r[s])] : [3, 5];
|
|
1485
|
+
case 4:
|
|
1486
|
+
l.sent(), a.push.apply(a, E([], O(t.getChildrenIndexOf(s)), !1)), l.label = 5;
|
|
1487
|
+
case 5:
|
|
1488
|
+
return [3, 2];
|
|
1489
|
+
case 6:
|
|
1490
|
+
return [2, n.toArray()];
|
|
1491
|
+
}
|
|
1492
|
+
});
|
|
1493
|
+
});
|
|
1494
|
+
}, t.prototype._topN_heap = function(e) {
|
|
1495
|
+
return d(this, void 0, void 0, function() {
|
|
1496
|
+
var r, n, i, a, s;
|
|
1497
|
+
return y(this, function(l) {
|
|
1498
|
+
switch (l.label) {
|
|
1499
|
+
case 0:
|
|
1500
|
+
r = this.clone(), n = [], i = 0, l.label = 1;
|
|
1501
|
+
case 1:
|
|
1502
|
+
return i < e ? (s = (a = n).push, [4, r.pop()]) : [3, 4];
|
|
1503
|
+
case 2:
|
|
1504
|
+
s.apply(a, [l.sent()]), l.label = 3;
|
|
1505
|
+
case 3:
|
|
1506
|
+
return ++i, [3, 1];
|
|
1507
|
+
case 4:
|
|
1508
|
+
return [2, n];
|
|
1509
|
+
}
|
|
1510
|
+
});
|
|
1511
|
+
});
|
|
1512
|
+
}, t.prototype._topIdxOf = function(e) {
|
|
1513
|
+
return d(this, void 0, void 0, function() {
|
|
1514
|
+
var r, n, i, a;
|
|
1515
|
+
return y(this, function(s) {
|
|
1516
|
+
switch (s.label) {
|
|
1517
|
+
case 0:
|
|
1518
|
+
if (!e.length)
|
|
1519
|
+
return [2, -1];
|
|
1520
|
+
r = 0, n = e[r], i = 1, s.label = 1;
|
|
1521
|
+
case 1:
|
|
1522
|
+
return i < e.length ? [4, this.compare(e[i], n)] : [3, 4];
|
|
1523
|
+
case 2:
|
|
1524
|
+
a = s.sent(), a < 0 && (r = i, n = e[i]), s.label = 3;
|
|
1525
|
+
case 3:
|
|
1526
|
+
return ++i, [3, 1];
|
|
1527
|
+
case 4:
|
|
1528
|
+
return [2, r];
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
});
|
|
1532
|
+
}, t.prototype._topOf = function() {
|
|
1533
|
+
for (var e = [], r = 0; r < arguments.length; r++)
|
|
1534
|
+
e[r] = arguments[r];
|
|
1535
|
+
return d(this, void 0, void 0, function() {
|
|
1536
|
+
var n;
|
|
1537
|
+
return y(this, function(i) {
|
|
1538
|
+
switch (i.label) {
|
|
1539
|
+
case 0:
|
|
1540
|
+
return n = new t(this.compare), [4, n.init(e)];
|
|
1541
|
+
case 1:
|
|
1542
|
+
return i.sent(), [2, n.peek()];
|
|
1543
|
+
}
|
|
1544
|
+
});
|
|
1545
|
+
});
|
|
1546
|
+
}, t;
|
|
1547
|
+
})();
|
|
1548
|
+
var Nt = function(t, e) {
|
|
1549
|
+
var r = { label: 0, sent: function() {
|
|
1550
|
+
if (a[0] & 1) throw a[1];
|
|
1551
|
+
return a[1];
|
|
1552
|
+
}, trys: [], ops: [] }, n, i, a, s = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
1553
|
+
return s.next = l(0), s.throw = l(1), s.return = l(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
|
|
1554
|
+
return this;
|
|
1555
|
+
}), s;
|
|
1556
|
+
function l(o) {
|
|
1557
|
+
return function(c) {
|
|
1558
|
+
return u([o, c]);
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
function u(o) {
|
|
1562
|
+
if (n) throw new TypeError("Generator is already executing.");
|
|
1563
|
+
for (; s && (s = 0, o[0] && (r = 0)), r; ) try {
|
|
1564
|
+
if (n = 1, i && (a = o[0] & 2 ? i.return : o[0] ? i.throw || ((a = i.return) && a.call(i), 0) : i.next) && !(a = a.call(i, o[1])).done) return a;
|
|
1565
|
+
switch (i = 0, a && (o = [o[0] & 2, a.value]), o[0]) {
|
|
1566
|
+
case 0:
|
|
1567
|
+
case 1:
|
|
1568
|
+
a = o;
|
|
1569
|
+
break;
|
|
1570
|
+
case 4:
|
|
1571
|
+
return r.label++, { value: o[1], done: !1 };
|
|
1572
|
+
case 5:
|
|
1573
|
+
r.label++, i = o[1], o = [0];
|
|
1574
|
+
continue;
|
|
1575
|
+
case 7:
|
|
1576
|
+
o = r.ops.pop(), r.trys.pop();
|
|
1577
|
+
continue;
|
|
1578
|
+
default:
|
|
1579
|
+
if (a = r.trys, !(a = a.length > 0 && a[a.length - 1]) && (o[0] === 6 || o[0] === 2)) {
|
|
1580
|
+
r = 0;
|
|
1581
|
+
continue;
|
|
1582
|
+
}
|
|
1583
|
+
if (o[0] === 3 && (!a || o[1] > a[0] && o[1] < a[3])) {
|
|
1584
|
+
r.label = o[1];
|
|
1585
|
+
break;
|
|
1586
|
+
}
|
|
1587
|
+
if (o[0] === 6 && r.label < a[1]) {
|
|
1588
|
+
r.label = a[1], a = o;
|
|
1589
|
+
break;
|
|
1590
|
+
}
|
|
1591
|
+
if (a && r.label < a[2]) {
|
|
1592
|
+
r.label = a[2], r.ops.push(o);
|
|
1593
|
+
break;
|
|
1594
|
+
}
|
|
1595
|
+
a[2] && r.ops.pop(), r.trys.pop();
|
|
1596
|
+
continue;
|
|
1597
|
+
}
|
|
1598
|
+
o = e.call(t, r);
|
|
1599
|
+
} catch (c) {
|
|
1600
|
+
o = [6, c], i = 0;
|
|
1601
|
+
} finally {
|
|
1602
|
+
n = a = 0;
|
|
1603
|
+
}
|
|
1604
|
+
if (o[0] & 5) throw o[1];
|
|
1605
|
+
return { value: o[0] ? o[1] : void 0, done: !0 };
|
|
1606
|
+
}
|
|
1607
|
+
}, b = function(t, e) {
|
|
1608
|
+
var r = typeof Symbol == "function" && t[Symbol.iterator];
|
|
1609
|
+
if (!r) return t;
|
|
1610
|
+
var n = r.call(t), i, a = [], s;
|
|
1611
|
+
try {
|
|
1612
|
+
for (; (e === void 0 || e-- > 0) && !(i = n.next()).done; ) a.push(i.value);
|
|
1613
|
+
} catch (l) {
|
|
1614
|
+
s = { error: l };
|
|
1615
|
+
} finally {
|
|
1616
|
+
try {
|
|
1617
|
+
i && !i.done && (r = n.return) && r.call(n);
|
|
1618
|
+
} finally {
|
|
1619
|
+
if (s) throw s.error;
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
return a;
|
|
1623
|
+
}, A = function(t, e, r) {
|
|
1624
|
+
if (r || arguments.length === 2) for (var n = 0, i = e.length, a; n < i; n++)
|
|
1625
|
+
(a || !(n in e)) && (a || (a = Array.prototype.slice.call(e, 0, n)), a[n] = e[n]);
|
|
1626
|
+
return t.concat(a || Array.prototype.slice.call(e));
|
|
1627
|
+
}, Dt = (
|
|
1628
|
+
/** @class */
|
|
1629
|
+
(function() {
|
|
1630
|
+
function t(e) {
|
|
1631
|
+
e === void 0 && (e = t.minComparator);
|
|
1632
|
+
var r = this;
|
|
1633
|
+
this.compare = e, this.heapArray = [], this._limit = 0, this.offer = this.add, this.element = this.peek, this.poll = this.pop, this.removeAll = this.clear, this._invertedCompare = function(n, i) {
|
|
1634
|
+
return -1 * r.compare(n, i);
|
|
1635
|
+
};
|
|
1636
|
+
}
|
|
1637
|
+
return t.getChildrenIndexOf = function(e) {
|
|
1638
|
+
return [e * 2 + 1, e * 2 + 2];
|
|
1639
|
+
}, t.getParentIndexOf = function(e) {
|
|
1640
|
+
return e <= 0 ? -1 : e - 1 >> 1;
|
|
1641
|
+
}, t.getSiblingIndexOf = function(e) {
|
|
1642
|
+
if (e <= 0)
|
|
1643
|
+
return -1;
|
|
1644
|
+
var r = e % 2 ? 1 : -1;
|
|
1645
|
+
return e + r;
|
|
1646
|
+
}, t.minComparator = function(e, r) {
|
|
1647
|
+
return e > r ? 1 : e < r ? -1 : 0;
|
|
1648
|
+
}, t.maxComparator = function(e, r) {
|
|
1649
|
+
return r > e ? 1 : r < e ? -1 : 0;
|
|
1650
|
+
}, t.minComparatorNumber = function(e, r) {
|
|
1651
|
+
return e - r;
|
|
1652
|
+
}, t.maxComparatorNumber = function(e, r) {
|
|
1653
|
+
return r - e;
|
|
1654
|
+
}, t.defaultIsEqual = function(e, r) {
|
|
1655
|
+
return e === r;
|
|
1656
|
+
}, t.print = function(e) {
|
|
1657
|
+
function r(c) {
|
|
1658
|
+
var h = t.getParentIndexOf(c);
|
|
1659
|
+
return Math.floor(Math.log2(h + 1));
|
|
1660
|
+
}
|
|
1661
|
+
function n(c, h) {
|
|
1662
|
+
for (var g = ""; h > 0; --h)
|
|
1663
|
+
g += c;
|
|
1664
|
+
return g;
|
|
1665
|
+
}
|
|
1666
|
+
for (var i = 0, a = [], s = r(e.length - 1) + 2, l = 0; i < e.length; ) {
|
|
1667
|
+
var u = r(i) + 1;
|
|
1668
|
+
i === 0 && (u = 0);
|
|
1669
|
+
var o = String(e.get(i));
|
|
1670
|
+
o.length > l && (l = o.length), a[u] = a[u] || [], a[u].push(o), i += 1;
|
|
1671
|
+
}
|
|
1672
|
+
return a.map(function(c, h) {
|
|
1673
|
+
var g = Math.pow(2, s - h) - 1;
|
|
1674
|
+
return n(" ", Math.floor(g / 2) * l) + c.map(function(m) {
|
|
1675
|
+
var S = (l - m.length) / 2;
|
|
1676
|
+
return n(" ", Math.ceil(S)) + m + n(" ", Math.floor(S));
|
|
1677
|
+
}).join(n(" ", g * l));
|
|
1678
|
+
}).join(`
|
|
1679
|
+
`);
|
|
1680
|
+
}, t.heapify = function(e, r) {
|
|
1681
|
+
var n = new t(r);
|
|
1682
|
+
return n.heapArray = e, n.init(), n;
|
|
1683
|
+
}, t.heappop = function(e, r) {
|
|
1684
|
+
var n = new t(r);
|
|
1685
|
+
return n.heapArray = e, n.pop();
|
|
1686
|
+
}, t.heappush = function(e, r, n) {
|
|
1687
|
+
var i = new t(n);
|
|
1688
|
+
i.heapArray = e, i.push(r);
|
|
1689
|
+
}, t.heappushpop = function(e, r, n) {
|
|
1690
|
+
var i = new t(n);
|
|
1691
|
+
return i.heapArray = e, i.pushpop(r);
|
|
1692
|
+
}, t.heapreplace = function(e, r, n) {
|
|
1693
|
+
var i = new t(n);
|
|
1694
|
+
return i.heapArray = e, i.replace(r);
|
|
1695
|
+
}, t.heaptop = function(e, r, n) {
|
|
1696
|
+
r === void 0 && (r = 1);
|
|
1697
|
+
var i = new t(n);
|
|
1698
|
+
return i.heapArray = e, i.top(r);
|
|
1699
|
+
}, t.heapbottom = function(e, r, n) {
|
|
1700
|
+
r === void 0 && (r = 1);
|
|
1701
|
+
var i = new t(n);
|
|
1702
|
+
return i.heapArray = e, i.bottom(r);
|
|
1703
|
+
}, t.nlargest = function(e, r, n) {
|
|
1704
|
+
var i = new t(n);
|
|
1705
|
+
return i.heapArray = A([], b(r), !1), i.init(), i.top(e);
|
|
1706
|
+
}, t.nsmallest = function(e, r, n) {
|
|
1707
|
+
var i = new t(n);
|
|
1708
|
+
return i.heapArray = A([], b(r), !1), i.init(), i.bottom(e);
|
|
1709
|
+
}, t.prototype.add = function(e) {
|
|
1710
|
+
return this._sortNodeUp(this.heapArray.push(e) - 1), this._applyLimit(), !0;
|
|
1711
|
+
}, t.prototype.addAll = function(e) {
|
|
1712
|
+
var r, n = this.length;
|
|
1713
|
+
(r = this.heapArray).push.apply(r, A([], b(e), !1));
|
|
1714
|
+
for (var i = this.length; n < i; ++n)
|
|
1715
|
+
this._sortNodeUp(n);
|
|
1716
|
+
return this._applyLimit(), !0;
|
|
1717
|
+
}, t.prototype.bottom = function(e) {
|
|
1718
|
+
return e === void 0 && (e = 1), this.heapArray.length === 0 || e <= 0 ? [] : this.heapArray.length === 1 ? [this.heapArray[0]] : e >= this.heapArray.length ? A([], b(this.heapArray), !1) : this._bottomN_push(~~e);
|
|
1719
|
+
}, t.prototype.check = function() {
|
|
1720
|
+
var e = this;
|
|
1721
|
+
return this.heapArray.find(function(r, n) {
|
|
1722
|
+
return !!e.getChildrenOf(n).find(function(i) {
|
|
1723
|
+
return e.compare(r, i) > 0;
|
|
1724
|
+
});
|
|
1725
|
+
});
|
|
1726
|
+
}, t.prototype.clear = function() {
|
|
1727
|
+
this.heapArray = [];
|
|
1728
|
+
}, t.prototype.clone = function() {
|
|
1729
|
+
var e = new t(this.comparator());
|
|
1730
|
+
return e.heapArray = this.toArray(), e._limit = this._limit, e;
|
|
1731
|
+
}, t.prototype.comparator = function() {
|
|
1732
|
+
return this.compare;
|
|
1733
|
+
}, t.prototype.contains = function(e, r) {
|
|
1734
|
+
return r === void 0 && (r = t.defaultIsEqual), this.indexOf(e, r) !== -1;
|
|
1735
|
+
}, t.prototype.init = function(e) {
|
|
1736
|
+
e && (this.heapArray = A([], b(e), !1));
|
|
1737
|
+
for (var r = t.getParentIndexOf(this.length - 1); r >= 0; --r)
|
|
1738
|
+
this._sortNodeDown(r);
|
|
1739
|
+
this._applyLimit();
|
|
1740
|
+
}, t.prototype.isEmpty = function() {
|
|
1741
|
+
return this.length === 0;
|
|
1742
|
+
}, t.prototype.indexOf = function(e, r) {
|
|
1743
|
+
if (r === void 0 && (r = t.defaultIsEqual), this.heapArray.length === 0)
|
|
1744
|
+
return -1;
|
|
1745
|
+
for (var n = [], i = 0; i < this.heapArray.length; ) {
|
|
1746
|
+
var a = this.heapArray[i];
|
|
1747
|
+
if (r(a, e))
|
|
1748
|
+
return i;
|
|
1749
|
+
this.compare(a, e) <= 0 && n.push.apply(n, A([], b(t.getChildrenIndexOf(i)), !1)), i = n.shift() || this.heapArray.length;
|
|
1750
|
+
}
|
|
1751
|
+
return -1;
|
|
1752
|
+
}, t.prototype.indexOfEvery = function(e, r) {
|
|
1753
|
+
if (r === void 0 && (r = t.defaultIsEqual), this.heapArray.length === 0)
|
|
1754
|
+
return [];
|
|
1755
|
+
for (var n = [], i = [], a = 0; a < this.heapArray.length; ) {
|
|
1756
|
+
var s = this.heapArray[a];
|
|
1757
|
+
r(s, e) ? (i.push(a), n.push.apply(n, A([], b(t.getChildrenIndexOf(a)), !1))) : this.compare(s, e) <= 0 && n.push.apply(n, A([], b(t.getChildrenIndexOf(a)), !1)), a = n.shift() || this.heapArray.length;
|
|
1758
|
+
}
|
|
1759
|
+
return i;
|
|
1760
|
+
}, t.prototype.leafs = function() {
|
|
1761
|
+
if (this.heapArray.length === 0)
|
|
1762
|
+
return [];
|
|
1763
|
+
var e = t.getParentIndexOf(this.heapArray.length - 1);
|
|
1764
|
+
return this.heapArray.slice(e + 1);
|
|
1765
|
+
}, Object.defineProperty(t.prototype, "length", {
|
|
1766
|
+
/**
|
|
1767
|
+
* Length of the heap. Aliases: {@link size}.
|
|
1768
|
+
* @return {Number}
|
|
1769
|
+
* @see size
|
|
1770
|
+
*/
|
|
1771
|
+
get: function() {
|
|
1772
|
+
return this.heapArray.length;
|
|
1773
|
+
},
|
|
1774
|
+
enumerable: !1,
|
|
1775
|
+
configurable: !0
|
|
1776
|
+
}), Object.defineProperty(t.prototype, "limit", {
|
|
1777
|
+
/**
|
|
1778
|
+
* Get length limit of the heap.
|
|
1779
|
+
* Use {@link setLimit} or {@link limit} to set the limit.
|
|
1780
|
+
* @return {Number}
|
|
1781
|
+
* @see setLimit
|
|
1782
|
+
*/
|
|
1783
|
+
get: function() {
|
|
1784
|
+
return this._limit;
|
|
1785
|
+
},
|
|
1786
|
+
/**
|
|
1787
|
+
* Set length limit of the heap. Same as using {@link setLimit}.
|
|
1788
|
+
* @description If the heap is longer than the limit, the needed amount of leafs are removed.
|
|
1789
|
+
* @param {Number} _l Limit, defaults to 0 (no limit). Negative, Infinity, or NaN values set the limit to 0.
|
|
1790
|
+
* @see setLimit
|
|
1791
|
+
*/
|
|
1792
|
+
set: function(e) {
|
|
1793
|
+
e < 0 || isNaN(e) ? this._limit = 0 : this._limit = ~~e, this._applyLimit();
|
|
1794
|
+
},
|
|
1795
|
+
enumerable: !1,
|
|
1796
|
+
configurable: !0
|
|
1797
|
+
}), t.prototype.setLimit = function(e) {
|
|
1798
|
+
return this.limit = e, e < 0 || isNaN(e) ? NaN : this._limit;
|
|
1799
|
+
}, t.prototype.peek = function() {
|
|
1800
|
+
return this.heapArray[0];
|
|
1801
|
+
}, t.prototype.pop = function() {
|
|
1802
|
+
var e = this.heapArray.pop();
|
|
1803
|
+
return this.length > 0 && e !== void 0 ? this.replace(e) : e;
|
|
1804
|
+
}, t.prototype.push = function() {
|
|
1805
|
+
for (var e = [], r = 0; r < arguments.length; r++)
|
|
1806
|
+
e[r] = arguments[r];
|
|
1807
|
+
return e.length < 1 ? !1 : e.length === 1 ? this.add(e[0]) : this.addAll(e);
|
|
1808
|
+
}, t.prototype.pushpop = function(e) {
|
|
1809
|
+
var r;
|
|
1810
|
+
return this.compare(this.heapArray[0], e) < 0 && (r = b([this.heapArray[0], e], 2), e = r[0], this.heapArray[0] = r[1], this._sortNodeDown(0)), e;
|
|
1811
|
+
}, t.prototype.remove = function(e, r) {
|
|
1812
|
+
var n = this;
|
|
1813
|
+
if (r === void 0 && (r = t.defaultIsEqual), !this.heapArray.length)
|
|
1814
|
+
return !1;
|
|
1815
|
+
if (e === void 0)
|
|
1816
|
+
return this.pop(), !0;
|
|
1817
|
+
for (var i = [0]; i.length; ) {
|
|
1818
|
+
var a = i.shift();
|
|
1819
|
+
if (r(this.heapArray[a], e))
|
|
1820
|
+
return a === 0 ? this.pop() : a === this.heapArray.length - 1 ? this.heapArray.pop() : (this.heapArray.splice(a, 1, this.heapArray.pop()), this._sortNodeUp(a), this._sortNodeDown(a)), !0;
|
|
1821
|
+
if (this.compare(this.heapArray[a], e) <= 0) {
|
|
1822
|
+
var s = t.getChildrenIndexOf(a).filter(function(l) {
|
|
1823
|
+
return l < n.heapArray.length;
|
|
1824
|
+
});
|
|
1825
|
+
i.push.apply(i, A([], b(s), !1));
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
return !1;
|
|
1829
|
+
}, t.prototype.replace = function(e) {
|
|
1830
|
+
var r = this.heapArray[0];
|
|
1831
|
+
return this.heapArray[0] = e, this._sortNodeDown(0), r;
|
|
1832
|
+
}, t.prototype.size = function() {
|
|
1833
|
+
return this.length;
|
|
1834
|
+
}, t.prototype.top = function(e) {
|
|
1835
|
+
return e === void 0 && (e = 1), this.heapArray.length === 0 || e <= 0 ? [] : this.heapArray.length === 1 || e === 1 ? [this.heapArray[0]] : e >= this.heapArray.length ? A([], b(this.heapArray), !1) : this._topN_push(~~e);
|
|
1836
|
+
}, t.prototype.toArray = function() {
|
|
1837
|
+
return A([], b(this.heapArray), !1);
|
|
1838
|
+
}, t.prototype.toString = function() {
|
|
1839
|
+
return this.heapArray.toString();
|
|
1840
|
+
}, t.prototype.get = function(e) {
|
|
1841
|
+
return this.heapArray[e];
|
|
1842
|
+
}, t.prototype.getChildrenOf = function(e) {
|
|
1843
|
+
var r = this;
|
|
1844
|
+
return t.getChildrenIndexOf(e).map(function(n) {
|
|
1845
|
+
return r.heapArray[n];
|
|
1846
|
+
}).filter(function(n) {
|
|
1847
|
+
return n !== void 0;
|
|
1848
|
+
});
|
|
1849
|
+
}, t.prototype.getParentOf = function(e) {
|
|
1850
|
+
var r = t.getParentIndexOf(e);
|
|
1851
|
+
return this.heapArray[r];
|
|
1852
|
+
}, t.prototype[Symbol.iterator] = function() {
|
|
1853
|
+
return Nt(this, function(e) {
|
|
1854
|
+
switch (e.label) {
|
|
1855
|
+
case 0:
|
|
1856
|
+
return this.length ? [4, this.pop()] : [3, 2];
|
|
1857
|
+
case 1:
|
|
1858
|
+
return e.sent(), [3, 0];
|
|
1859
|
+
case 2:
|
|
1860
|
+
return [
|
|
1861
|
+
2
|
|
1862
|
+
/*return*/
|
|
1863
|
+
];
|
|
1864
|
+
}
|
|
1865
|
+
});
|
|
1866
|
+
}, t.prototype.iterator = function() {
|
|
1867
|
+
return this.toArray();
|
|
1868
|
+
}, t.prototype._applyLimit = function() {
|
|
1869
|
+
if (this._limit > 0 && this._limit < this.heapArray.length)
|
|
1870
|
+
for (var e = this.heapArray.length - this._limit; e; )
|
|
1871
|
+
this.heapArray.pop(), --e;
|
|
1872
|
+
}, t.prototype._bottomN_push = function(e) {
|
|
1873
|
+
var r = new t(this.compare);
|
|
1874
|
+
r.limit = e, r.heapArray = this.heapArray.slice(-e), r.init();
|
|
1875
|
+
for (var n = this.heapArray.length - 1 - e, i = t.getParentIndexOf(n), a = [], s = n; s > i; --s)
|
|
1876
|
+
a.push(s);
|
|
1877
|
+
for (var l = this.heapArray; a.length; ) {
|
|
1878
|
+
var s = a.shift();
|
|
1879
|
+
this.compare(l[s], r.peek()) > 0 && (r.replace(l[s]), s % 2 && a.push(t.getParentIndexOf(s)));
|
|
1880
|
+
}
|
|
1881
|
+
return r.toArray();
|
|
1882
|
+
}, t.prototype._moveNode = function(e, r) {
|
|
1883
|
+
var n = this.heapArray[e];
|
|
1884
|
+
this.heapArray[e] = this.heapArray[r], this.heapArray[r] = n;
|
|
1885
|
+
}, t.prototype._sortNodeDown = function(e) {
|
|
1886
|
+
for (var r = this.heapArray.length, n = e, i = this.heapArray[e], a = 2 * e + 1; a < r; ) {
|
|
1887
|
+
var s = a + 1, l = s >= r || this.compare(this.heapArray[a], this.heapArray[s]) < 0 ? a : s;
|
|
1888
|
+
if (this.compare(this.heapArray[l], i) < 0)
|
|
1889
|
+
this.heapArray[e] = this.heapArray[l], e = l, a = 2 * e + 1;
|
|
1890
|
+
else
|
|
1891
|
+
break;
|
|
1892
|
+
}
|
|
1893
|
+
e !== n && (this.heapArray[e] = i);
|
|
1894
|
+
}, t.prototype._sortNodeUp = function(e) {
|
|
1895
|
+
for (var r = this.heapArray[e], n = e; e > 0; ) {
|
|
1896
|
+
var i = t.getParentIndexOf(e);
|
|
1897
|
+
if (this.compare(r, this.heapArray[i]) < 0)
|
|
1898
|
+
this.heapArray[e] = this.heapArray[i], e = i;
|
|
1899
|
+
else
|
|
1900
|
+
break;
|
|
1901
|
+
}
|
|
1902
|
+
e !== n && (this.heapArray[e] = r);
|
|
1903
|
+
}, t.prototype._topN_push = function(e) {
|
|
1904
|
+
var r = new t(this._invertedCompare);
|
|
1905
|
+
r.limit = e;
|
|
1906
|
+
for (var n = [0], i = this.heapArray; n.length; ) {
|
|
1907
|
+
var a = n.shift();
|
|
1908
|
+
a < i.length && (r.length < e ? (r.push(i[a]), n.push.apply(n, A([], b(t.getChildrenIndexOf(a)), !1))) : this.compare(i[a], r.peek()) < 0 && (r.replace(i[a]), n.push.apply(n, A([], b(t.getChildrenIndexOf(a)), !1))));
|
|
1909
|
+
}
|
|
1910
|
+
return r.toArray();
|
|
1911
|
+
}, t.prototype._topN_fill = function(e) {
|
|
1912
|
+
var r = this.heapArray, n = new t(this._invertedCompare);
|
|
1913
|
+
n.limit = e, n.heapArray = r.slice(0, e), n.init();
|
|
1914
|
+
for (var i = t.getParentIndexOf(e - 1) + 1, a = [], s = i; s < e; ++s)
|
|
1915
|
+
a.push.apply(a, A([], b(t.getChildrenIndexOf(s).filter(function(l) {
|
|
1916
|
+
return l < r.length;
|
|
1917
|
+
})), !1));
|
|
1918
|
+
for ((e - 1) % 2 && a.push(e); a.length; ) {
|
|
1919
|
+
var s = a.shift();
|
|
1920
|
+
s < r.length && this.compare(r[s], n.peek()) < 0 && (n.replace(r[s]), a.push.apply(a, A([], b(t.getChildrenIndexOf(s)), !1)));
|
|
1921
|
+
}
|
|
1922
|
+
return n.toArray();
|
|
1923
|
+
}, t.prototype._topN_heap = function(e) {
|
|
1924
|
+
for (var r = this.clone(), n = [], i = 0; i < e; ++i)
|
|
1925
|
+
n.push(r.pop());
|
|
1926
|
+
return n;
|
|
1927
|
+
}, t.prototype._topIdxOf = function(e) {
|
|
1928
|
+
if (!e.length)
|
|
1929
|
+
return -1;
|
|
1930
|
+
for (var r = 0, n = e[r], i = 1; i < e.length; ++i) {
|
|
1931
|
+
var a = this.compare(e[i], n);
|
|
1932
|
+
a < 0 && (r = i, n = e[i]);
|
|
1933
|
+
}
|
|
1934
|
+
return r;
|
|
1935
|
+
}, t.prototype._topOf = function() {
|
|
1936
|
+
for (var e = [], r = 0; r < arguments.length; r++)
|
|
1937
|
+
e[r] = arguments[r];
|
|
1938
|
+
var n = new t(this.compare);
|
|
1939
|
+
return n.init(e), n.peek();
|
|
1940
|
+
}, t;
|
|
1941
|
+
})()
|
|
1942
|
+
);
|
|
1943
|
+
function xt(t, e, r) {
|
|
1944
|
+
return Math.abs(
|
|
1945
|
+
(t[0] * (e[1] - r[1]) + e[0] * (r[1] - t[1]) + r[0] * (t[1] - e[1])) / 2
|
|
1946
|
+
);
|
|
393
1947
|
}
|
|
394
|
-
function
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
1948
|
+
function X(t, { tolerance: e = 0, getWeight: r = () => 1 } = {}) {
|
|
1949
|
+
if (t.length <= 2) return t;
|
|
1950
|
+
const n = t.map((o, c) => ({ coord: o, i: c, area: 1 / 0, removed: !1, prev: null, next: null }));
|
|
1951
|
+
for (let o = 0; o < n.length; o++)
|
|
1952
|
+
o > 0 && (n[o].prev = n[o - 1]), o < n.length - 1 && (n[o].next = n[o + 1]);
|
|
1953
|
+
const i = (o) => !o.prev || !o.next ? 1 / 0 : xt(o.prev.coord, o.coord, o.next.coord) * r(o.coord, o.i), a = new Dt((o, c) => o.area - c.area);
|
|
1954
|
+
for (let o = 1; o < n.length - 1; o++)
|
|
1955
|
+
n[o].area = i(n[o]), n[o]._currentArea = n[o].area, a.push(n[o]);
|
|
1956
|
+
let s = 0;
|
|
1957
|
+
for (; a.size() > 0; ) {
|
|
1958
|
+
const o = a.pop();
|
|
1959
|
+
if (!o.removed && o.area === o._currentArea) {
|
|
1960
|
+
if (o.area < s ? o.area = s : s = o.area, o.area >= e) break;
|
|
1961
|
+
o.removed = !0, o.prev && (o.prev.next = o.next), o.next && (o.next.prev = o.prev), o.prev?.prev && (o.prev.area = i(o.prev), o.prev._currentArea = o.prev.area, a.push(o.prev)), o.next?.next && (o.next.area = i(o.next), o.next._currentArea = o.next.area, a.push(o.next));
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
const l = [];
|
|
1965
|
+
let u = n[0];
|
|
1966
|
+
for (; u; )
|
|
1967
|
+
u.removed || l.push(u.coord), u = u.next;
|
|
1968
|
+
return l;
|
|
1969
|
+
}
|
|
1970
|
+
function fe(t, e) {
|
|
1971
|
+
switch (p.all([
|
|
1972
|
+
{ value: t, validator: le, message: "geometry must be a GeoJson geometry" }
|
|
1973
|
+
]), t.type) {
|
|
1974
|
+
case v.LINESTRING:
|
|
1975
|
+
t.coordinates = X(t.coordinates, e);
|
|
1976
|
+
break;
|
|
1977
|
+
case v.POLYGON:
|
|
1978
|
+
case v.MULTI_LINESTRING:
|
|
1979
|
+
t.coordinates = t.coordinates.map((r) => X(r, e));
|
|
1980
|
+
break;
|
|
1981
|
+
case v.MULTI_POLYGON:
|
|
1982
|
+
t.coordinates = t.coordinates.map((r) => r.map((n) => X(n, e)));
|
|
1983
|
+
break;
|
|
1984
|
+
case v.GEOMETRY_COLLECTION:
|
|
1985
|
+
t.geometries.forEach((r) => fe(r, e));
|
|
1986
|
+
break;
|
|
1987
|
+
}
|
|
1988
|
+
return t;
|
|
1989
|
+
}
|
|
1990
|
+
const _t = xe(["common-ekosystem", "simplify", "geojson"]);
|
|
1991
|
+
function ke(t, e) {
|
|
1992
|
+
if (t.type === I.FEATURE)
|
|
1993
|
+
t.geometry && fe(t.geometry, e);
|
|
1994
|
+
else if (t.type === I.FEATURE_COLLECTION)
|
|
1995
|
+
for (const r of t.features) ke(r, e);
|
|
1996
|
+
else
|
|
1997
|
+
_t.warn('Unknown feature type "{type}", skipping.', { type: t.type });
|
|
1998
|
+
return t;
|
|
1999
|
+
}
|
|
2000
|
+
function yr(t, e) {
|
|
2001
|
+
return p.all([
|
|
2002
|
+
{ value: t, validator: De, message: "geoJson must be a GeoJson object" }
|
|
2003
|
+
]), f.oneOf(t.type, Object.values(v)) ? fe(t, e) : ke(t, e);
|
|
2004
|
+
}
|
|
2005
|
+
function Pe(t, e = 7) {
|
|
2006
|
+
p.all([
|
|
2007
|
+
{ value: t, validator: gt, message: "bbox must be bounding box" },
|
|
2008
|
+
{ value: e, validator: (n) => f.inRange(n, 0, 8), message: "precision must be in range [0, 8]" }
|
|
398
2009
|
]);
|
|
399
|
-
const
|
|
400
|
-
for (let
|
|
401
|
-
|
|
402
|
-
return
|
|
2010
|
+
const r = oe[e];
|
|
2011
|
+
for (let n = 0; n < t.length; n++)
|
|
2012
|
+
t[n] = Math.round(t[n] * r) / r;
|
|
2013
|
+
return t;
|
|
2014
|
+
}
|
|
2015
|
+
function Rt(t, e, r = {}) {
|
|
2016
|
+
const n = { type: "Feature" };
|
|
2017
|
+
return (r.id === 0 || r.id) && (n.id = r.id), r.bbox && (n.bbox = r.bbox), n.properties = {}, n.geometry = t, n;
|
|
403
2018
|
}
|
|
404
|
-
function
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
2019
|
+
function Mt(t, e, r = {}) {
|
|
2020
|
+
if (!t)
|
|
2021
|
+
throw new Error("coordinates is required");
|
|
2022
|
+
if (!Array.isArray(t))
|
|
2023
|
+
throw new Error("coordinates must be an Array");
|
|
2024
|
+
if (t.length < 2)
|
|
2025
|
+
throw new Error("coordinates must be at least 2 numbers long");
|
|
2026
|
+
if (!Ee(t[0]) || !Ee(t[1]))
|
|
2027
|
+
throw new Error("coordinates must contain numbers");
|
|
2028
|
+
return Rt({
|
|
2029
|
+
type: "Point",
|
|
2030
|
+
coordinates: t
|
|
2031
|
+
}, e, r);
|
|
2032
|
+
}
|
|
2033
|
+
function Ee(t) {
|
|
2034
|
+
return !isNaN(t) && t !== null && !Array.isArray(t);
|
|
2035
|
+
}
|
|
2036
|
+
function $t(t) {
|
|
2037
|
+
return t !== null && typeof t == "object" && !Array.isArray(t);
|
|
2038
|
+
}
|
|
2039
|
+
function Ue(t, e, r) {
|
|
2040
|
+
if (t !== null)
|
|
2041
|
+
for (var n, i, a, s, l, u, o, c = 0, h = 0, g, m = t.type, S = m === "FeatureCollection", G = m === "Feature", F = S ? t.features.length : 1, L = 0; L < F; L++) {
|
|
2042
|
+
o = S ? (
|
|
2043
|
+
// @ts-expect-error: Known type conflict
|
|
2044
|
+
t.features[L].geometry
|
|
2045
|
+
) : G ? (
|
|
2046
|
+
// @ts-expect-error: Known type conflict
|
|
2047
|
+
t.geometry
|
|
2048
|
+
) : t, g = o ? o.type === "GeometryCollection" : !1, l = g ? o.geometries.length : 1;
|
|
2049
|
+
for (var V = 0; V < l; V++) {
|
|
2050
|
+
var T = 0, N = 0;
|
|
2051
|
+
if (s = g ? o.geometries[V] : o, s !== null) {
|
|
2052
|
+
u = s.coordinates;
|
|
2053
|
+
var x = s.type;
|
|
2054
|
+
switch (c = 0, x) {
|
|
2055
|
+
case null:
|
|
2056
|
+
break;
|
|
2057
|
+
case "Point":
|
|
2058
|
+
if (
|
|
2059
|
+
// @ts-expect-error: Known type conflict
|
|
2060
|
+
e(
|
|
2061
|
+
u,
|
|
2062
|
+
h,
|
|
2063
|
+
L,
|
|
2064
|
+
T,
|
|
2065
|
+
N
|
|
2066
|
+
) === !1
|
|
2067
|
+
)
|
|
2068
|
+
return !1;
|
|
2069
|
+
h++, T++;
|
|
2070
|
+
break;
|
|
2071
|
+
case "LineString":
|
|
2072
|
+
case "MultiPoint":
|
|
2073
|
+
for (n = 0; n < u.length; n++) {
|
|
2074
|
+
if (
|
|
2075
|
+
// @ts-expect-error: Known type conflict
|
|
2076
|
+
e(
|
|
2077
|
+
u[n],
|
|
2078
|
+
h,
|
|
2079
|
+
L,
|
|
2080
|
+
T,
|
|
2081
|
+
N
|
|
2082
|
+
) === !1
|
|
2083
|
+
)
|
|
2084
|
+
return !1;
|
|
2085
|
+
h++, x === "MultiPoint" && T++;
|
|
2086
|
+
}
|
|
2087
|
+
x === "LineString" && T++;
|
|
2088
|
+
break;
|
|
2089
|
+
case "Polygon":
|
|
2090
|
+
case "MultiLineString":
|
|
2091
|
+
for (n = 0; n < u.length; n++) {
|
|
2092
|
+
for (i = 0; i < u[n].length - c; i++) {
|
|
2093
|
+
if (
|
|
2094
|
+
// @ts-expect-error: Known type conflict
|
|
2095
|
+
e(
|
|
2096
|
+
u[n][i],
|
|
2097
|
+
h,
|
|
2098
|
+
L,
|
|
2099
|
+
T,
|
|
2100
|
+
N
|
|
2101
|
+
) === !1
|
|
2102
|
+
)
|
|
2103
|
+
return !1;
|
|
2104
|
+
h++;
|
|
2105
|
+
}
|
|
2106
|
+
x === "MultiLineString" && T++, x === "Polygon" && N++;
|
|
2107
|
+
}
|
|
2108
|
+
x === "Polygon" && T++;
|
|
2109
|
+
break;
|
|
2110
|
+
case "MultiPolygon":
|
|
2111
|
+
for (n = 0; n < u.length; n++) {
|
|
2112
|
+
for (N = 0, i = 0; i < u[n].length; i++) {
|
|
2113
|
+
for (a = 0; a < u[n][i].length - c; a++) {
|
|
2114
|
+
if (
|
|
2115
|
+
// @ts-expect-error: Known type conflict
|
|
2116
|
+
e(
|
|
2117
|
+
u[n][i][a],
|
|
2118
|
+
h,
|
|
2119
|
+
L,
|
|
2120
|
+
T,
|
|
2121
|
+
N
|
|
2122
|
+
) === !1
|
|
2123
|
+
)
|
|
2124
|
+
return !1;
|
|
2125
|
+
h++;
|
|
2126
|
+
}
|
|
2127
|
+
N++;
|
|
2128
|
+
}
|
|
2129
|
+
T++;
|
|
2130
|
+
}
|
|
2131
|
+
break;
|
|
2132
|
+
case "GeometryCollection":
|
|
2133
|
+
for (n = 0; n < s.geometries.length; n++)
|
|
2134
|
+
if (
|
|
2135
|
+
// @ts-expect-error: Known type conflict
|
|
2136
|
+
Ue(s.geometries[n], e) === !1
|
|
2137
|
+
)
|
|
2138
|
+
return !1;
|
|
2139
|
+
break;
|
|
2140
|
+
default:
|
|
2141
|
+
throw new Error("Unknown Geometry Type");
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
function kt(t, e) {
|
|
2148
|
+
if (e = e ?? {}, !$t(e)) throw new Error("options is invalid");
|
|
2149
|
+
var r = e.precision, n = e.coordinates, i = e.mutate;
|
|
2150
|
+
if (r = r == null || isNaN(r) ? 6 : r, n = n == null || isNaN(n) ? 3 : n, !t) throw new Error("<geojson> is required");
|
|
2151
|
+
if (typeof r != "number")
|
|
2152
|
+
throw new Error("<precision> must be a number");
|
|
2153
|
+
if (typeof n != "number")
|
|
2154
|
+
throw new Error("<coordinates> must be a number");
|
|
2155
|
+
(i === !1 || i === void 0) && (t = JSON.parse(JSON.stringify(t)));
|
|
2156
|
+
var a = Math.pow(10, r);
|
|
2157
|
+
return Ue(t, function(s) {
|
|
2158
|
+
Pt(s, a, n);
|
|
2159
|
+
}), t;
|
|
2160
|
+
}
|
|
2161
|
+
function Pt(t, e, r) {
|
|
2162
|
+
t.length > r && t.splice(r, t.length);
|
|
2163
|
+
for (var n = 0; n < t.length; n++)
|
|
2164
|
+
t[n] = Math.round(t[n] * e) / e;
|
|
2165
|
+
return t;
|
|
2166
|
+
}
|
|
2167
|
+
var Ut = kt;
|
|
2168
|
+
function Ge(t, e = 7) {
|
|
2169
|
+
p.all([
|
|
2170
|
+
{ value: t, validator: le, message: "geometry must be a GeoJson geometry" },
|
|
2171
|
+
{ value: e, validator: (n) => f.inRange(n, 0, 8), message: "precision must be in range [0, 8]" }
|
|
408
2172
|
]);
|
|
409
|
-
const
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
2173
|
+
const r = Ut(t, { precision: e, mutate: !0 });
|
|
2174
|
+
return r.bbox && Pe(r.bbox, e), r;
|
|
2175
|
+
}
|
|
2176
|
+
const Gt = xe(["common-ekosystem", "truncate", "geojson"]);
|
|
2177
|
+
function Fe(t, e) {
|
|
2178
|
+
if (t.type === I.FEATURE)
|
|
2179
|
+
t.geometry && Ge(t.geometry, e);
|
|
2180
|
+
else if (t.type === I.FEATURE_COLLECTION)
|
|
2181
|
+
for (const r of t.features) Fe(r, e);
|
|
2182
|
+
else
|
|
2183
|
+
Gt.warn('Unknown feature type "{type}", skipping.', { type: t.type });
|
|
2184
|
+
return t.bbox && Pe(t.bbox, e), t;
|
|
2185
|
+
}
|
|
2186
|
+
function dr(t, e = 7) {
|
|
2187
|
+
return p.all([
|
|
2188
|
+
{ value: t, validator: De, message: "geoJson must be a valid GeoJson" },
|
|
2189
|
+
{ value: e, validator: (r) => f.inRange(r, 0, 8), message: "precision must be in range [0, 8]" }
|
|
2190
|
+
]), f.oneOf(t.type, Object.values(v)) ? Ge(t, e) : Fe(t, e);
|
|
2191
|
+
}
|
|
2192
|
+
function mr(t, e = 7) {
|
|
2193
|
+
p.all([
|
|
2194
|
+
{ value: t, validator: mt, message: "position must be a position" },
|
|
2195
|
+
{ value: e, validator: (n) => f.inRange(n, 0, 8), message: "precision must be in range [0, 8]" }
|
|
2196
|
+
]);
|
|
2197
|
+
const r = oe[e];
|
|
2198
|
+
for (let n = 0; n < t.length; n++)
|
|
2199
|
+
t[n] = Math.round(t[n] * r) / r;
|
|
2200
|
+
return t;
|
|
413
2201
|
}
|
|
414
|
-
function
|
|
415
|
-
if (!
|
|
2202
|
+
function j(t) {
|
|
2203
|
+
if (!f.arrayOfLengthBetween(t, 2, 3))
|
|
416
2204
|
return {
|
|
417
2205
|
valid: !1,
|
|
418
2206
|
errors: [{ message: "Invalid coordinates: must be an array of 2 or 3 coordinates" }],
|
|
419
2207
|
warnings: []
|
|
420
2208
|
};
|
|
421
|
-
if (!
|
|
2209
|
+
if (!f.inRange(t[0], -180, 180))
|
|
422
2210
|
return {
|
|
423
2211
|
valid: !1,
|
|
424
2212
|
errors: [{ message: "Invalid coordinates: longitude must be in the range -180 to 180" }],
|
|
425
2213
|
warnings: []
|
|
426
2214
|
};
|
|
427
|
-
if (!
|
|
2215
|
+
if (!f.inRange(t[1], -90, 90))
|
|
428
2216
|
return {
|
|
429
2217
|
valid: !1,
|
|
430
2218
|
errors: [{ message: "Invalid coordinates: latitude must be in the range -90 to 90" }],
|
|
431
2219
|
warnings: []
|
|
432
2220
|
};
|
|
433
|
-
if (
|
|
2221
|
+
if (t.length === 3 && !f.number(t[2]))
|
|
434
2222
|
return {
|
|
435
2223
|
valid: !1,
|
|
436
2224
|
errors: [{ message: "Invalid coordinates: altitude must be a number" }],
|
|
437
2225
|
warnings: []
|
|
438
2226
|
};
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
const
|
|
442
|
-
return
|
|
2227
|
+
const e = { valid: !0, errors: [], warnings: [] }, r = de(t[0]);
|
|
2228
|
+
r > 6 && e.warnings.push({ message: `longitude precision is high (${r} decimals, max recommended: 6)` });
|
|
2229
|
+
const n = de(t[1]);
|
|
2230
|
+
return n > 6 && e.warnings.push({ message: `latitude precision is high (${n} decimals, max recommended: 6)` }), e;
|
|
443
2231
|
}
|
|
444
|
-
function
|
|
445
|
-
if (!
|
|
2232
|
+
function Ft(t) {
|
|
2233
|
+
if (!f.arrayOfLength(t, 4) && !f.arrayOfLength(t, 6))
|
|
446
2234
|
return {
|
|
447
2235
|
valid: !1,
|
|
448
2236
|
errors: [{ message: "Invalid bbox: must be an array of 4 (2D) or 6 (3D) numbers" }],
|
|
449
2237
|
warnings: []
|
|
450
2238
|
};
|
|
451
|
-
const
|
|
452
|
-
if (!
|
|
2239
|
+
const e = t.length === 4, r = e ? [t[0], t[1]] : [t[0], t[1], t[2]], n = e ? [t[2], t[3]] : [t[3], t[4], t[5]], i = j(r);
|
|
2240
|
+
if (!i.valid)
|
|
453
2241
|
return {
|
|
454
2242
|
valid: !1,
|
|
455
|
-
errors:
|
|
2243
|
+
errors: i.errors.map((h) => ({ ...h, message: `Invalid bbox south-west: ${h.message}` })),
|
|
456
2244
|
warnings: []
|
|
457
2245
|
};
|
|
458
|
-
const a =
|
|
2246
|
+
const a = j(n);
|
|
459
2247
|
if (!a.valid)
|
|
460
2248
|
return {
|
|
461
2249
|
valid: !1,
|
|
462
|
-
errors: a.errors.map((
|
|
2250
|
+
errors: a.errors.map((h) => ({ ...h, message: `Invalid bbox north-east: ${h.message}` })),
|
|
463
2251
|
warnings: []
|
|
464
2252
|
};
|
|
465
|
-
const [
|
|
466
|
-
if (
|
|
2253
|
+
const [s, l] = r, [u, o] = n;
|
|
2254
|
+
if (l > o)
|
|
467
2255
|
return {
|
|
468
2256
|
valid: !1,
|
|
469
|
-
errors: [{ message: `Invalid bbox: south (${
|
|
2257
|
+
errors: [{ message: `Invalid bbox: south (${l}) must be <= north (${o})` }],
|
|
470
2258
|
warnings: []
|
|
471
2259
|
};
|
|
472
|
-
const
|
|
473
|
-
return
|
|
2260
|
+
const c = { valid: !0, errors: [], warnings: [] };
|
|
2261
|
+
return s > u && c.warnings.push({ message: `bbox crosses the antimeridian (west: ${s} > east: ${u})` }), c.warnings.push(...i.warnings.map((h) => ({ ...h, message: `south-west: ${h.message}` }))), c.warnings.push(...a.warnings.map((h) => ({ ...h, message: `north-east: ${h.message}` }))), c;
|
|
474
2262
|
}
|
|
475
|
-
function
|
|
476
|
-
if (!
|
|
2263
|
+
function Ht(t) {
|
|
2264
|
+
if (!f.plainObject(t))
|
|
477
2265
|
return {
|
|
478
2266
|
valid: !1,
|
|
479
2267
|
errors: [{ message: "Invalid crs: must be an object" }],
|
|
480
2268
|
warnings: []
|
|
481
2269
|
};
|
|
482
|
-
switch (
|
|
483
|
-
case
|
|
484
|
-
return
|
|
2270
|
+
switch (t.type) {
|
|
2271
|
+
case z.NAME:
|
|
2272
|
+
return f.nonEmptyString(t.properties?.name) ? { valid: !0, errors: [], warnings: [] } : {
|
|
485
2273
|
valid: !1,
|
|
486
2274
|
errors: [{ message: "Invalid crs: linked crs must have a non-empty properties.name string" }],
|
|
487
2275
|
warnings: []
|
|
488
2276
|
};
|
|
489
|
-
case
|
|
490
|
-
return
|
|
2277
|
+
case z.LINK:
|
|
2278
|
+
return f.nonEmptyString(t.properties?.href) ? { valid: !0, errors: [], warnings: [] } : {
|
|
491
2279
|
valid: !1,
|
|
492
2280
|
errors: [{ message: "Invalid crs: linked crs must have a non-empty properties.href string" }],
|
|
493
2281
|
warnings: []
|
|
@@ -495,334 +2283,351 @@ function we(e) {
|
|
|
495
2283
|
default:
|
|
496
2284
|
return {
|
|
497
2285
|
valid: !1,
|
|
498
|
-
errors: [{ message: `Invalid crs: unknown type: ${
|
|
2286
|
+
errors: [{ message: `Invalid crs: unknown type: ${t.type}` }],
|
|
499
2287
|
warnings: []
|
|
500
2288
|
};
|
|
501
2289
|
}
|
|
502
2290
|
}
|
|
503
|
-
function
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
throw new Error("coordinates must be an Array");
|
|
512
|
-
if (e.length < 2)
|
|
513
|
-
throw new Error("coordinates must be at least 2 numbers long");
|
|
514
|
-
if (!V(e[0]) || !V(e[1]))
|
|
515
|
-
throw new Error("coordinates must contain numbers");
|
|
516
|
-
return Ne({
|
|
517
|
-
type: "Point",
|
|
518
|
-
coordinates: e
|
|
519
|
-
}, t, n);
|
|
520
|
-
}
|
|
521
|
-
function V(e) {
|
|
522
|
-
return !isNaN(e) && e !== null && !Array.isArray(e);
|
|
523
|
-
}
|
|
524
|
-
function Me(e) {
|
|
525
|
-
if (Array.isArray(e))
|
|
526
|
-
return e;
|
|
527
|
-
if (e.type === "Feature") {
|
|
528
|
-
if (e.geometry !== null)
|
|
529
|
-
return e.geometry.coordinates;
|
|
530
|
-
} else if (e.coordinates)
|
|
531
|
-
return e.coordinates;
|
|
2291
|
+
function qt(t) {
|
|
2292
|
+
if (Array.isArray(t))
|
|
2293
|
+
return t;
|
|
2294
|
+
if (t.type === "Feature") {
|
|
2295
|
+
if (t.geometry !== null)
|
|
2296
|
+
return t.geometry.coordinates;
|
|
2297
|
+
} else if (t.coordinates)
|
|
2298
|
+
return t.coordinates;
|
|
532
2299
|
throw new Error(
|
|
533
2300
|
"coords must be GeoJSON Feature, Geometry Object or an Array"
|
|
534
2301
|
);
|
|
535
2302
|
}
|
|
536
|
-
function
|
|
537
|
-
const
|
|
538
|
-
let
|
|
539
|
-
for (;
|
|
540
|
-
|
|
541
|
-
return
|
|
542
|
-
}
|
|
543
|
-
var
|
|
544
|
-
function
|
|
545
|
-
let
|
|
546
|
-
const
|
|
2303
|
+
function zt(t) {
|
|
2304
|
+
const e = qt(t);
|
|
2305
|
+
let r = 0, n = 1, i, a;
|
|
2306
|
+
for (; n < e.length; )
|
|
2307
|
+
i = a || e[0], a = e[n], r += (a[0] - i[0]) * (a[1] + i[1]), n++;
|
|
2308
|
+
return r > 0;
|
|
2309
|
+
}
|
|
2310
|
+
var jt = zt;
|
|
2311
|
+
function Wt(t) {
|
|
2312
|
+
let e, r;
|
|
2313
|
+
const n = {
|
|
547
2314
|
type: "FeatureCollection",
|
|
548
2315
|
features: []
|
|
549
2316
|
};
|
|
550
|
-
if (
|
|
551
|
-
|
|
552
|
-
else if (
|
|
553
|
-
|
|
554
|
-
else if (
|
|
555
|
-
|
|
556
|
-
else if (
|
|
557
|
-
|
|
2317
|
+
if (t.type === "Feature" ? r = t.geometry : r = t, r.type === "LineString")
|
|
2318
|
+
e = [r.coordinates];
|
|
2319
|
+
else if (r.type === "MultiLineString")
|
|
2320
|
+
e = r.coordinates;
|
|
2321
|
+
else if (r.type === "MultiPolygon")
|
|
2322
|
+
e = [].concat(...r.coordinates);
|
|
2323
|
+
else if (r.type === "Polygon")
|
|
2324
|
+
e = r.coordinates;
|
|
558
2325
|
else
|
|
559
2326
|
throw new Error(
|
|
560
2327
|
"Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry"
|
|
561
2328
|
);
|
|
562
|
-
return
|
|
563
|
-
|
|
564
|
-
for (let
|
|
565
|
-
for (let
|
|
566
|
-
if (
|
|
567
|
-
|
|
568
|
-
s
|
|
2329
|
+
return e.forEach((i) => {
|
|
2330
|
+
e.forEach((a) => {
|
|
2331
|
+
for (let s = 0; s < i.length - 1; s++)
|
|
2332
|
+
for (let l = s; l < a.length - 1; l++) {
|
|
2333
|
+
if (i === a && (Math.abs(s - l) === 1 || // segments are first and last segment of lineString
|
|
2334
|
+
s === 0 && l === i.length - 2 && // lineString is closed
|
|
2335
|
+
i[s][0] === i[i.length - 1][0] && i[s][1] === i[i.length - 1][1]))
|
|
569
2336
|
continue;
|
|
570
|
-
const
|
|
571
|
-
s
|
|
572
|
-
s
|
|
573
|
-
s
|
|
574
|
-
s
|
|
575
|
-
a[
|
|
576
|
-
a[
|
|
577
|
-
a[
|
|
578
|
-
a[
|
|
2337
|
+
const u = Vt(
|
|
2338
|
+
i[s][0],
|
|
2339
|
+
i[s][1],
|
|
2340
|
+
i[s + 1][0],
|
|
2341
|
+
i[s + 1][1],
|
|
2342
|
+
a[l][0],
|
|
2343
|
+
a[l][1],
|
|
2344
|
+
a[l + 1][0],
|
|
2345
|
+
a[l + 1][1]
|
|
579
2346
|
);
|
|
580
|
-
|
|
2347
|
+
u && n.features.push(Mt([u[0], u[1]]));
|
|
581
2348
|
}
|
|
582
2349
|
});
|
|
583
|
-
}),
|
|
2350
|
+
}), n;
|
|
584
2351
|
}
|
|
585
|
-
function
|
|
586
|
-
let
|
|
587
|
-
const
|
|
2352
|
+
function Vt(t, e, r, n, i, a, s, l) {
|
|
2353
|
+
let u, o, c, h, g;
|
|
2354
|
+
const m = {
|
|
588
2355
|
x: null,
|
|
589
2356
|
y: null,
|
|
590
2357
|
onLine1: !1,
|
|
591
2358
|
onLine2: !1
|
|
592
2359
|
};
|
|
593
|
-
return
|
|
594
|
-
}
|
|
595
|
-
var
|
|
596
|
-
function
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
2360
|
+
return u = (l - a) * (r - t) - (s - i) * (n - e), u === 0 ? m.x !== null && m.y !== null ? m : !1 : (o = e - a, c = t - i, h = (s - i) * o - (l - a) * c, g = (r - t) * o - (n - e) * c, o = h / u, c = g / u, m.x = t + o * (r - t), m.y = e + o * (n - e), o >= 0 && o <= 1 && (m.onLine1 = !0), c >= 0 && c <= 1 && (m.onLine2 = !0), m.onLine1 && m.onLine2 ? [m.x, m.y] : !1);
|
|
2361
|
+
}
|
|
2362
|
+
var Bt = Wt;
|
|
2363
|
+
function $() {
|
|
2364
|
+
return { Feature: 0, FeatureCollection: 0, geometries: {} };
|
|
2365
|
+
}
|
|
2366
|
+
function Kt(...t) {
|
|
2367
|
+
const e = $();
|
|
2368
|
+
for (const r of t) {
|
|
2369
|
+
const n = r.statistics;
|
|
2370
|
+
if (n) {
|
|
2371
|
+
e.Feature += n.Feature ?? 0, e.FeatureCollection += n.FeatureCollection ?? 0;
|
|
2372
|
+
for (const [i, a] of Object.entries(n.geometries ?? {}))
|
|
2373
|
+
e.geometries[i] = (e.geometries[i] ?? 0) + a;
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
return e;
|
|
605
2377
|
}
|
|
606
|
-
function
|
|
607
|
-
const
|
|
2378
|
+
function M(t, e, r = "") {
|
|
2379
|
+
const n = {
|
|
608
2380
|
valid: !0,
|
|
609
2381
|
errors: [],
|
|
610
2382
|
warnings: []
|
|
611
2383
|
};
|
|
612
|
-
for (let
|
|
613
|
-
const a = `${
|
|
614
|
-
if (!
|
|
615
|
-
|
|
2384
|
+
for (let i = 0; i < t.length; i++) {
|
|
2385
|
+
const a = `${r}/${i}`, s = e(t[i], a, i);
|
|
2386
|
+
if (!s.valid) {
|
|
2387
|
+
n.valid = !1, n.errors = n.errors.concat(s.errors.map((l) => ({ ...l, path: l.path || a, index: i })));
|
|
616
2388
|
continue;
|
|
617
2389
|
}
|
|
618
|
-
|
|
2390
|
+
f.empty(s.warnings) || (n.warnings = n.warnings.concat(s.warnings.map((l) => ({ ...l, path: l.path || a, index: i })))), s.statistics && (n.statistics = Kt(n, s));
|
|
619
2391
|
}
|
|
620
|
-
return
|
|
2392
|
+
return n;
|
|
2393
|
+
}
|
|
2394
|
+
function Zt(t, e) {
|
|
2395
|
+
if (!f.defined(t.crs)) return e;
|
|
2396
|
+
const r = Ht(t.crs);
|
|
2397
|
+
return r.valid || (e.valid = !1, e.errors.push(...r.errors.map((n) => ({ ...n, path: "/crs" })))), e.warnings.push(...r.warnings.map((n) => ({ ...n, path: "/crs" }))), e;
|
|
621
2398
|
}
|
|
622
|
-
function
|
|
623
|
-
|
|
2399
|
+
function ne(t, e, r = "") {
|
|
2400
|
+
if (!f.defined(t.bbox)) return e;
|
|
2401
|
+
const n = Ft(t.bbox);
|
|
2402
|
+
return n.valid || (e.valid = !1, e.errors.push(...n.errors.map((i) => ({ ...i, path: `${r}/bbox` })))), e.warnings.push(...n.warnings.map((i) => ({ ...i, path: `${r}/bbox` }))), e;
|
|
2403
|
+
}
|
|
2404
|
+
function ce(t, e = 0, r = "") {
|
|
2405
|
+
return f.arrayOfLengthAtLeast(t, e) ? M(t, j, r) : {
|
|
624
2406
|
valid: !1,
|
|
625
|
-
errors: [{ message: `Invalid coordinates: must have at least ${
|
|
2407
|
+
errors: [{ message: `Invalid coordinates: must have at least ${e} positions`, path: r }],
|
|
626
2408
|
warnings: []
|
|
627
2409
|
};
|
|
628
2410
|
}
|
|
629
|
-
function
|
|
630
|
-
const
|
|
631
|
-
if (!
|
|
632
|
-
for (let
|
|
633
|
-
const
|
|
634
|
-
Math.abs(a -
|
|
635
|
-
message: `LineString crosses the antimeridian between positions ${
|
|
636
|
-
path: `${
|
|
2411
|
+
function He(t, e = "") {
|
|
2412
|
+
const r = ce(t, 2, e);
|
|
2413
|
+
if (!r.valid) return r;
|
|
2414
|
+
for (let n = 0; n < t.length - 1; n++) {
|
|
2415
|
+
const i = t[n][0], a = t[n + 1][0];
|
|
2416
|
+
Math.abs(a - i) > 180 && r.warnings.push({
|
|
2417
|
+
message: `LineString crosses the antimeridian between positions ${n} and ${n + 1}, consider using MultiLineString`,
|
|
2418
|
+
path: `${e}/${n}`
|
|
637
2419
|
});
|
|
638
2420
|
}
|
|
639
|
-
return
|
|
2421
|
+
return r;
|
|
640
2422
|
}
|
|
641
|
-
function
|
|
642
|
-
return
|
|
2423
|
+
function Yt(t, e = "") {
|
|
2424
|
+
return f.nonEmptyArray(t) ? M(t, He, e) : {
|
|
643
2425
|
valid: !1,
|
|
644
|
-
errors: [{ message: "Invalid MultiLineString: coordinates must be a non empty array", path:
|
|
2426
|
+
errors: [{ message: "Invalid MultiLineString: coordinates must be a non empty array", path: e }],
|
|
645
2427
|
warnings: []
|
|
646
2428
|
};
|
|
647
2429
|
}
|
|
648
|
-
function
|
|
649
|
-
const
|
|
650
|
-
if (!
|
|
651
|
-
const
|
|
652
|
-
if (
|
|
653
|
-
return
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
-
const
|
|
657
|
-
return
|
|
658
|
-
}
|
|
659
|
-
function
|
|
660
|
-
return
|
|
2430
|
+
function Jt(t, e, r = "") {
|
|
2431
|
+
const n = ce(t, 4, r);
|
|
2432
|
+
if (!n.valid) return n;
|
|
2433
|
+
const i = t[0], a = t[t.length - 1];
|
|
2434
|
+
if (i[0] !== a[0] || i[1] !== a[1])
|
|
2435
|
+
return n.valid = !1, n.errors.push({ message: "Invalid LinearRing: first and last position must be identical", path: r }), n;
|
|
2436
|
+
const l = jt(t) ? "clockwise" : "counter-clockwise";
|
|
2437
|
+
l !== e && n.warnings.push({ message: `Ring must be ${e} but is ${l}`, path: r });
|
|
2438
|
+
const u = Bt({ type: "Polygon", coordinates: [t] });
|
|
2439
|
+
return u.features.length > 0 && (n.valid = !1, n.errors.push({ message: `Invalid LinearRing: ${u.features.length} self-intersection(s) detected`, path: r })), n;
|
|
2440
|
+
}
|
|
2441
|
+
function qe(t, e = "") {
|
|
2442
|
+
return f.nonEmptyArray(t) ? M(t, (r, n, i) => Jt(r, i === 0 ? "counter-clockwise" : "clockwise", n), e) : {
|
|
661
2443
|
valid: !1,
|
|
662
|
-
errors: [{ message: "Invalid Polygon: coordinates must be a non empty array", path:
|
|
2444
|
+
errors: [{ message: "Invalid Polygon: coordinates must be a non empty array", path: e }],
|
|
663
2445
|
warnings: []
|
|
664
2446
|
};
|
|
665
2447
|
}
|
|
666
|
-
function
|
|
667
|
-
return
|
|
2448
|
+
function Qt(t, e = "") {
|
|
2449
|
+
return f.nonEmptyArray(t) ? M(t, (r, n) => qe(r, n), e) : {
|
|
668
2450
|
valid: !1,
|
|
669
|
-
errors: [{ message: "Invalid MultiPolygon: coordinates must be a non empty array", path:
|
|
2451
|
+
errors: [{ message: "Invalid MultiPolygon: coordinates must be a non empty array", path: e }],
|
|
670
2452
|
warnings: []
|
|
671
2453
|
};
|
|
672
2454
|
}
|
|
673
|
-
function
|
|
674
|
-
return
|
|
2455
|
+
function Xt(t, e = "") {
|
|
2456
|
+
return f.nonEmptyArray(t) ? M(t, (r, n) => he(r, n), e) : {
|
|
675
2457
|
valid: !1,
|
|
676
|
-
errors: [{ message: "Invalid geometries: geometries must be a non empty array", path:
|
|
2458
|
+
errors: [{ message: "Invalid geometries: geometries must be a non empty array", path: e }],
|
|
677
2459
|
warnings: []
|
|
678
2460
|
};
|
|
679
2461
|
}
|
|
680
|
-
function
|
|
681
|
-
if (!
|
|
2462
|
+
function he(t, e = "") {
|
|
2463
|
+
if (!f.nonEmptyObject(t))
|
|
682
2464
|
return {
|
|
683
2465
|
valid: !1,
|
|
684
|
-
errors: [{ message: "Invalid geometry: geometry must be a non empty object", path:
|
|
2466
|
+
errors: [{ message: "Invalid geometry: geometry must be a non empty object", path: e }],
|
|
685
2467
|
warnings: []
|
|
686
2468
|
};
|
|
687
|
-
const
|
|
688
|
-
let
|
|
689
|
-
switch (
|
|
690
|
-
case
|
|
691
|
-
const
|
|
692
|
-
|
|
693
|
-
valid:
|
|
694
|
-
errors:
|
|
695
|
-
warnings:
|
|
2469
|
+
const r = `${e}/coordinates`;
|
|
2470
|
+
let n;
|
|
2471
|
+
switch (t.type) {
|
|
2472
|
+
case v.POINT: {
|
|
2473
|
+
const i = j(t.coordinates);
|
|
2474
|
+
n = {
|
|
2475
|
+
valid: i.valid,
|
|
2476
|
+
errors: i.errors.map((a) => ({ ...a, path: r })),
|
|
2477
|
+
warnings: i.warnings.map((a) => ({ ...a, path: r }))
|
|
696
2478
|
};
|
|
697
2479
|
break;
|
|
698
2480
|
}
|
|
699
|
-
case
|
|
700
|
-
|
|
2481
|
+
case v.MULTI_POINT: {
|
|
2482
|
+
n = ce(t.coordinates, 0, r);
|
|
701
2483
|
break;
|
|
702
2484
|
}
|
|
703
|
-
case
|
|
704
|
-
|
|
2485
|
+
case v.LINESTRING: {
|
|
2486
|
+
n = He(t.coordinates, r);
|
|
705
2487
|
break;
|
|
706
2488
|
}
|
|
707
|
-
case
|
|
708
|
-
|
|
2489
|
+
case v.MULTI_LINESTRING: {
|
|
2490
|
+
n = Yt(t.coordinates, r);
|
|
709
2491
|
break;
|
|
710
2492
|
}
|
|
711
|
-
case
|
|
712
|
-
|
|
2493
|
+
case v.POLYGON: {
|
|
2494
|
+
n = qe(t.coordinates, r);
|
|
713
2495
|
break;
|
|
714
2496
|
}
|
|
715
|
-
case
|
|
716
|
-
|
|
2497
|
+
case v.MULTI_POLYGON: {
|
|
2498
|
+
n = Qt(t.coordinates, r);
|
|
717
2499
|
break;
|
|
718
2500
|
}
|
|
719
|
-
case
|
|
720
|
-
|
|
2501
|
+
case v.GEOMETRY_COLLECTION: {
|
|
2502
|
+
n = Xt(t.geometries, `${e}/geometries`);
|
|
721
2503
|
break;
|
|
722
2504
|
}
|
|
723
2505
|
default:
|
|
724
2506
|
return {
|
|
725
2507
|
valid: !1,
|
|
726
|
-
errors: [{ message: `Invalid geometry type: ${
|
|
2508
|
+
errors: [{ message: `Invalid geometry type: ${t.type}`, path: e }],
|
|
727
2509
|
warnings: []
|
|
728
2510
|
};
|
|
729
2511
|
}
|
|
730
|
-
return
|
|
2512
|
+
return ne(t, n, e);
|
|
731
2513
|
}
|
|
732
|
-
function
|
|
733
|
-
if (!
|
|
2514
|
+
function ze(t, e = "") {
|
|
2515
|
+
if (!f.nonEmptyObject(t))
|
|
734
2516
|
return {
|
|
735
2517
|
valid: !1,
|
|
736
|
-
errors: [{ message: "Invalid feature: must be a non empty object", path:
|
|
737
|
-
warnings: []
|
|
2518
|
+
errors: [{ message: "Invalid feature: must be a non empty object", path: e }],
|
|
2519
|
+
warnings: [],
|
|
2520
|
+
statistics: $()
|
|
738
2521
|
};
|
|
739
|
-
if (
|
|
740
|
-
if (
|
|
741
|
-
const
|
|
742
|
-
return
|
|
2522
|
+
if (t.type === I.FEATURE) {
|
|
2523
|
+
if (f.nonEmptyObject(t.geometry)) {
|
|
2524
|
+
const r = he(t.geometry, `${e}/geometry`);
|
|
2525
|
+
return {
|
|
2526
|
+
...ne(t, r, e),
|
|
2527
|
+
statistics: {
|
|
2528
|
+
Feature: 1,
|
|
2529
|
+
FeatureCollection: 0,
|
|
2530
|
+
geometries: { [t.geometry.type]: 1 }
|
|
2531
|
+
}
|
|
2532
|
+
};
|
|
743
2533
|
}
|
|
744
2534
|
return {
|
|
745
2535
|
valid: !0,
|
|
746
2536
|
errors: [],
|
|
747
|
-
warnings: [{ message: "Feature has no geometry", path:
|
|
2537
|
+
warnings: [{ message: "Feature has no geometry", path: e }],
|
|
2538
|
+
statistics: { Feature: 1, FeatureCollection: 0, geometries: {} }
|
|
748
2539
|
};
|
|
749
2540
|
}
|
|
750
|
-
if (
|
|
751
|
-
if (
|
|
752
|
-
const
|
|
753
|
-
return
|
|
2541
|
+
if (t.type === I.FEATURE_COLLECTION) {
|
|
2542
|
+
if (f.nonEmptyArray(t.features)) {
|
|
2543
|
+
const r = M(t.features, ze, `${e}/features`);
|
|
2544
|
+
return {
|
|
2545
|
+
...ne(t, r, e),
|
|
2546
|
+
statistics: { ...r.statistics, FeatureCollection: r.statistics.FeatureCollection + 1 }
|
|
2547
|
+
};
|
|
754
2548
|
}
|
|
755
2549
|
return {
|
|
756
2550
|
valid: !1,
|
|
757
|
-
errors: [{ message: "Invalid FeatureCollection: features must be a non empty array", path:
|
|
758
|
-
warnings: []
|
|
2551
|
+
errors: [{ message: "Invalid FeatureCollection: features must be a non empty array", path: e }],
|
|
2552
|
+
warnings: [],
|
|
2553
|
+
statistics: $()
|
|
759
2554
|
};
|
|
760
2555
|
}
|
|
761
2556
|
return {
|
|
762
2557
|
valid: !1,
|
|
763
|
-
errors: [{ message: `Invalid feature: unknown type: ${
|
|
764
|
-
warnings: []
|
|
2558
|
+
errors: [{ message: `Invalid feature: unknown type: ${t.type}`, path: e }],
|
|
2559
|
+
warnings: [],
|
|
2560
|
+
statistics: $()
|
|
765
2561
|
};
|
|
766
2562
|
}
|
|
767
|
-
function
|
|
768
|
-
if (
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
2563
|
+
function vr(t) {
|
|
2564
|
+
if (p.that(t, f.nonEmptyObject, "geojson must be a non empty object"), f.oneOf(t.type, Object.values(v)))
|
|
2565
|
+
return {
|
|
2566
|
+
...he(t, ""),
|
|
2567
|
+
statistics: { Feature: 0, FeatureCollection: 0, geometries: { [t.type]: 1 } }
|
|
2568
|
+
};
|
|
2569
|
+
if (t.type === I.FEATURE || t.type === I.FEATURE_COLLECTION) {
|
|
2570
|
+
const e = ze(t, "");
|
|
2571
|
+
return Zt(t, e);
|
|
772
2572
|
}
|
|
773
2573
|
return {
|
|
774
2574
|
valid: !1,
|
|
775
2575
|
errors: [{ message: "Invalid GeoJson: type must be either a Geometry, a Feature or a FeatureCollection" }],
|
|
776
|
-
warnings: []
|
|
2576
|
+
warnings: [],
|
|
2577
|
+
statistics: $()
|
|
777
2578
|
};
|
|
778
2579
|
}
|
|
779
2580
|
export {
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
2581
|
+
w as AXES,
|
|
2582
|
+
re as COORDINATE_FORMATS,
|
|
2583
|
+
ht as COORDINATE_MODELS,
|
|
2584
|
+
oe as COORDINATE_TRUNCATION_FACTORS,
|
|
2585
|
+
z as CRS_TYPES,
|
|
2586
|
+
I as FEATURE_TYPES,
|
|
2587
|
+
v as GEOMETRY_TYPES,
|
|
2588
|
+
hr as convertCoordinate,
|
|
2589
|
+
de as getCoordinatePrecision,
|
|
2590
|
+
Qe as getDirectionAxis,
|
|
2591
|
+
ar as getDirections,
|
|
2592
|
+
lr as getEast,
|
|
2593
|
+
Ye as getLocale,
|
|
2594
|
+
sr as getNorth,
|
|
2595
|
+
or as getSouth,
|
|
2596
|
+
ur as getWest,
|
|
2597
|
+
ye as guessCoordinateAxis,
|
|
2598
|
+
tr as isAltitude,
|
|
2599
|
+
je as isAxis,
|
|
2600
|
+
D as isDirection,
|
|
2601
|
+
Te as isEast,
|
|
2602
|
+
ee as isLatitude,
|
|
2603
|
+
gt as isLikeBBox,
|
|
2604
|
+
gr as isLikeCRS,
|
|
2605
|
+
yt as isLikeFeature,
|
|
2606
|
+
dt as isLikeFeatureCollection,
|
|
2607
|
+
De as isLikeGeoJson,
|
|
2608
|
+
le as isLikeGeometry,
|
|
2609
|
+
mt as isLikePosition,
|
|
2610
|
+
Se as isLongitude,
|
|
2611
|
+
Je as isNorth,
|
|
2612
|
+
Le as isSouth,
|
|
2613
|
+
se as isWest,
|
|
2614
|
+
rr as listLocales,
|
|
2615
|
+
cr as normalizeCoordinate,
|
|
2616
|
+
pt as parseCoordinate,
|
|
2617
|
+
pr as parsePosition,
|
|
2618
|
+
nr as registerLocale,
|
|
2619
|
+
ir as setLocale,
|
|
2620
|
+
yr as simplifyGeoJson,
|
|
2621
|
+
fe as simplifyGeometry,
|
|
2622
|
+
Pe as truncateBBox,
|
|
2623
|
+
fr as truncateCoordinate,
|
|
2624
|
+
dr as truncateGeoJson,
|
|
2625
|
+
Ge as truncateGeometry,
|
|
2626
|
+
mr as truncatePosition,
|
|
2627
|
+
Ft as validateBBox,
|
|
2628
|
+
Ht as validateCRS,
|
|
2629
|
+
vr as validateGeoJson,
|
|
2630
|
+
he as validateGeometry,
|
|
2631
|
+
j as validatePosition
|
|
827
2632
|
};
|
|
828
2633
|
//# sourceMappingURL=index.mjs.map
|