@maptiler/geocoding-control 2.1.0-with-autocomplete-timeout → 2.1.2
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/MapLibreBasedGeocodingControl.d.ts +35 -69
- package/leaflet-controller.js +1942 -1523
- package/leaflet-controller.js.map +1 -1
- package/leaflet-controller.umd.js +1 -22
- package/leaflet-controller.umd.js.map +1 -1
- package/leaflet.js +2798 -2385
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +1 -22
- package/leaflet.umd.js.map +1 -1
- package/maplibregl-controller.js +1918 -1498
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js +1 -22
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.d.ts +34 -68
- package/maplibregl.js +2892 -2478
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +1 -22
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.d.ts +34 -68
- package/maptilersdk.js +2896 -2481
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +1 -22
- package/maptilersdk.umd.js.map +1 -1
- package/openlayers-controller.js +1686 -1264
- package/openlayers-controller.js.map +1 -1
- package/openlayers-controller.umd.js +1 -22
- package/openlayers-controller.umd.js.map +1 -1
- package/openlayers.js +2778 -2365
- package/openlayers.js.map +1 -1
- package/openlayers.umd.js +1 -22
- package/openlayers.umd.js.map +1 -1
- package/package.json +23 -23
- package/react.js +753 -756
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/svelte/GeocodingControl.svelte +71 -58
- package/svelte/GeocodingControl.svelte.d.ts +5 -3
- package/svelte/MapLibreBasedGeocodingControl.d.ts +35 -69
- package/svelte/info.json +1 -0
- package/svelte/maplibregl.d.ts +34 -68
- package/svelte/maptilersdk.d.ts +34 -68
- package/svelte/maptilersdk.js +2 -0
- package/svelte/react.js +3 -0
- package/svelte/types.d.ts +175 -128
- package/types.d.ts +175 -128
- package/vanilla.js +847 -853
- package/vanilla.js.map +1 -1
- package/vanilla.umd.js +1 -1
- package/vanilla.umd.js.map +1 -1
package/maplibregl-controller.js
CHANGED
|
@@ -1,612 +1,1059 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
return (
|
|
7
|
-
}
|
|
8
|
-
function
|
|
9
|
-
for (const r of
|
|
1
|
+
var Lt = Object.defineProperty;
|
|
2
|
+
var Tt = (n, e, t) => e in n ? Lt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var M = (n, e, t) => Tt(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
function we(n, e, t = {}) {
|
|
5
|
+
const i = { type: "Feature" };
|
|
6
|
+
return (t.id === 0 || t.id) && (i.id = t.id), t.bbox && (i.bbox = t.bbox), i.properties = e || {}, i.geometry = n, i;
|
|
7
|
+
}
|
|
8
|
+
function Ke(n, e, t = {}) {
|
|
9
|
+
for (const r of n) {
|
|
10
10
|
if (r.length < 4)
|
|
11
11
|
throw new Error(
|
|
12
12
|
"Each LinearRing of a Polygon must have 4 or more Positions."
|
|
13
13
|
);
|
|
14
14
|
if (r[r.length - 1].length !== r[0].length)
|
|
15
15
|
throw new Error("First and last Position are not equivalent.");
|
|
16
|
-
for (let
|
|
17
|
-
if (r[r.length - 1][
|
|
16
|
+
for (let u = 0; u < r[r.length - 1].length; u++)
|
|
17
|
+
if (r[r.length - 1][u] !== r[0][u])
|
|
18
18
|
throw new Error("First and last Position are not equivalent.");
|
|
19
19
|
}
|
|
20
|
-
return
|
|
20
|
+
return we({
|
|
21
21
|
type: "Polygon",
|
|
22
|
-
coordinates:
|
|
23
|
-
},
|
|
22
|
+
coordinates: n
|
|
23
|
+
}, e, t);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
return
|
|
25
|
+
function Ee(n, e = {}) {
|
|
26
|
+
const t = { type: "FeatureCollection" };
|
|
27
|
+
return e.id && (t.id = e.id), e.bbox && (t.bbox = e.bbox), t.features = n, t;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
return
|
|
29
|
+
function gt(n, e, t = {}) {
|
|
30
|
+
return we({
|
|
31
31
|
type: "MultiPolygon",
|
|
32
|
-
coordinates:
|
|
33
|
-
},
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
continue;
|
|
87
|
-
default:
|
|
88
|
-
if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
|
|
89
|
-
e = 0;
|
|
32
|
+
coordinates: n
|
|
33
|
+
}, e, t);
|
|
34
|
+
}
|
|
35
|
+
var Mt = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, Be = Math.ceil, J = Math.floor, Z = "[BigNumber Error] ", Ze = Z + "Number primitive has more than 15 significant digits: ", ee = 1e14, C = 14, je = 9007199254740991, Ge = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], le = 1e7, j = 1e9;
|
|
36
|
+
function pt(n) {
|
|
37
|
+
var e, t, i, r = S.prototype = { constructor: S, toString: null, valueOf: null }, u = new S(1), y = 20, c = 4, E = -7, h = 21, b = -1e7, _ = 1e7, T = !1, O = 1, G = 0, F = {
|
|
38
|
+
prefix: "",
|
|
39
|
+
groupSize: 3,
|
|
40
|
+
secondaryGroupSize: 0,
|
|
41
|
+
groupSeparator: ",",
|
|
42
|
+
decimalSeparator: ".",
|
|
43
|
+
fractionGroupSize: 0,
|
|
44
|
+
fractionGroupSeparator: " ",
|
|
45
|
+
// non-breaking space
|
|
46
|
+
suffix: ""
|
|
47
|
+
}, L = "0123456789abcdefghijklmnopqrstuvwxyz", N = !0;
|
|
48
|
+
function S(s, o) {
|
|
49
|
+
var l, m, a, p, w, f, g, x, d = this;
|
|
50
|
+
if (!(d instanceof S)) return new S(s, o);
|
|
51
|
+
if (o == null) {
|
|
52
|
+
if (s && s._isBigNumber === !0) {
|
|
53
|
+
d.s = s.s, !s.c || s.e > _ ? d.c = d.e = null : s.e < b ? d.c = [d.e = 0] : (d.e = s.e, d.c = s.c.slice());
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if ((f = typeof s == "number") && s * 0 == 0) {
|
|
57
|
+
if (d.s = 1 / s < 0 ? (s = -s, -1) : 1, s === ~~s) {
|
|
58
|
+
for (p = 0, w = s; w >= 10; w /= 10, p++) ;
|
|
59
|
+
p > _ ? d.c = d.e = null : (d.e = p, d.c = [s]);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
x = String(s);
|
|
63
|
+
} else {
|
|
64
|
+
if (!Mt.test(x = String(s))) return i(d, x, f);
|
|
65
|
+
d.s = x.charCodeAt(0) == 45 ? (x = x.slice(1), -1) : 1;
|
|
66
|
+
}
|
|
67
|
+
(p = x.indexOf(".")) > -1 && (x = x.replace(".", "")), (w = x.search(/e/i)) > 0 ? (p < 0 && (p = w), p += +x.slice(w + 1), x = x.substring(0, w)) : p < 0 && (p = x.length);
|
|
68
|
+
} else {
|
|
69
|
+
if (D(o, 2, L.length, "Base"), o == 10 && N)
|
|
70
|
+
return d = new S(s), V(d, y + d.e + 1, c);
|
|
71
|
+
if (x = String(s), f = typeof s == "number") {
|
|
72
|
+
if (s * 0 != 0) return i(d, x, f, o);
|
|
73
|
+
if (d.s = 1 / s < 0 ? (x = x.slice(1), -1) : 1, S.DEBUG && x.replace(/^0\.0*|\./, "").length > 15)
|
|
74
|
+
throw Error(Ze + s);
|
|
75
|
+
} else
|
|
76
|
+
d.s = x.charCodeAt(0) === 45 ? (x = x.slice(1), -1) : 1;
|
|
77
|
+
for (l = L.slice(0, o), p = w = 0, g = x.length; w < g; w++)
|
|
78
|
+
if (l.indexOf(m = x.charAt(w)) < 0) {
|
|
79
|
+
if (m == ".") {
|
|
80
|
+
if (w > p) {
|
|
81
|
+
p = g;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
} else if (!a && (x == x.toUpperCase() && (x = x.toLowerCase()) || x == x.toLowerCase() && (x = x.toUpperCase()))) {
|
|
85
|
+
a = !0, w = -1, p = 0;
|
|
90
86
|
continue;
|
|
91
87
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
if (u[0] === 6 && e.label < o[1]) {
|
|
97
|
-
e.label = o[1], o = u;
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
if (o && e.label < o[2]) {
|
|
101
|
-
e.label = o[2], e.ops.push(u);
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
o[2] && e.ops.pop(), e.trys.pop();
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
u = t.call(i, e);
|
|
108
|
-
} catch (g) {
|
|
109
|
-
u = [6, g], r = 0;
|
|
110
|
-
} finally {
|
|
111
|
-
n = o = 0;
|
|
112
|
-
}
|
|
113
|
-
if (u[0] & 5) throw u[1];
|
|
114
|
-
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
var G = (
|
|
118
|
-
/** @class */
|
|
119
|
-
/* @__PURE__ */ function() {
|
|
120
|
-
function i(t, e) {
|
|
121
|
-
this.next = null, this.key = t, this.data = e, this.left = null, this.right = null;
|
|
88
|
+
return i(d, String(s), f, o);
|
|
89
|
+
}
|
|
90
|
+
f = !1, x = t(x, o, 10, d.s), (p = x.indexOf(".")) > -1 ? x = x.replace(".", "") : p = x.length;
|
|
122
91
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
} else if (f > 0) {
|
|
142
|
-
if (t.right === null)
|
|
143
|
-
break;
|
|
144
|
-
if (e(i, t.right.key) > 0) {
|
|
145
|
-
var l = t.right;
|
|
146
|
-
if (t.right = l.left, l.left = t, t = l, t.right === null)
|
|
147
|
-
break;
|
|
92
|
+
for (w = 0; x.charCodeAt(w) === 48; w++) ;
|
|
93
|
+
for (g = x.length; x.charCodeAt(--g) === 48; ) ;
|
|
94
|
+
if (x = x.slice(w, ++g)) {
|
|
95
|
+
if (g -= w, f && S.DEBUG && g > 15 && (s > je || s !== J(s)))
|
|
96
|
+
throw Error(Ze + d.s * s);
|
|
97
|
+
if ((p = p - w - 1) > _)
|
|
98
|
+
d.c = d.e = null;
|
|
99
|
+
else if (p < b)
|
|
100
|
+
d.c = [d.e = 0];
|
|
101
|
+
else {
|
|
102
|
+
if (d.e = p, d.c = [], w = (p + 1) % C, p < 0 && (w += C), w < g) {
|
|
103
|
+
for (w && d.c.push(+x.slice(0, w)), g -= C; w < g; )
|
|
104
|
+
d.c.push(+x.slice(w, w += C));
|
|
105
|
+
w = C - (x = x.slice(w)).length;
|
|
106
|
+
} else
|
|
107
|
+
w -= g;
|
|
108
|
+
for (; w--; x += "0") ;
|
|
109
|
+
d.c.push(+x);
|
|
148
110
|
}
|
|
149
|
-
r.right = t, r = t, t = t.right;
|
|
150
111
|
} else
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
112
|
+
d.c = [d.e = 0];
|
|
113
|
+
}
|
|
114
|
+
S.clone = pt, S.ROUND_UP = 0, S.ROUND_DOWN = 1, S.ROUND_CEIL = 2, S.ROUND_FLOOR = 3, S.ROUND_HALF_UP = 4, S.ROUND_HALF_DOWN = 5, S.ROUND_HALF_EVEN = 6, S.ROUND_HALF_CEIL = 7, S.ROUND_HALF_FLOOR = 8, S.EUCLID = 9, S.config = S.set = function(s) {
|
|
115
|
+
var o, l;
|
|
116
|
+
if (s != null)
|
|
117
|
+
if (typeof s == "object") {
|
|
118
|
+
if (s.hasOwnProperty(o = "DECIMAL_PLACES") && (l = s[o], D(l, 0, j, o), y = l), s.hasOwnProperty(o = "ROUNDING_MODE") && (l = s[o], D(l, 0, 8, o), c = l), s.hasOwnProperty(o = "EXPONENTIAL_AT") && (l = s[o], l && l.pop ? (D(l[0], -1e9, 0, o), D(l[1], 0, j, o), E = l[0], h = l[1]) : (D(l, -1e9, j, o), E = -(h = l < 0 ? -l : l))), s.hasOwnProperty(o = "RANGE"))
|
|
119
|
+
if (l = s[o], l && l.pop)
|
|
120
|
+
D(l[0], -1e9, -1, o), D(l[1], 1, j, o), b = l[0], _ = l[1];
|
|
121
|
+
else if (D(l, -1e9, j, o), l)
|
|
122
|
+
b = -(_ = l < 0 ? -l : l);
|
|
123
|
+
else
|
|
124
|
+
throw Error(Z + o + " cannot be zero: " + l);
|
|
125
|
+
if (s.hasOwnProperty(o = "CRYPTO"))
|
|
126
|
+
if (l = s[o], l === !!l)
|
|
127
|
+
if (l)
|
|
128
|
+
if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
|
|
129
|
+
T = l;
|
|
130
|
+
else
|
|
131
|
+
throw T = !l, Error(Z + "crypto unavailable");
|
|
132
|
+
else
|
|
133
|
+
T = l;
|
|
134
|
+
else
|
|
135
|
+
throw Error(Z + o + " not true or false: " + l);
|
|
136
|
+
if (s.hasOwnProperty(o = "MODULO_MODE") && (l = s[o], D(l, 0, 9, o), O = l), s.hasOwnProperty(o = "POW_PRECISION") && (l = s[o], D(l, 0, j, o), G = l), s.hasOwnProperty(o = "FORMAT"))
|
|
137
|
+
if (l = s[o], typeof l == "object") F = l;
|
|
138
|
+
else throw Error(Z + o + " not an object: " + l);
|
|
139
|
+
if (s.hasOwnProperty(o = "ALPHABET"))
|
|
140
|
+
if (l = s[o], typeof l == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(l))
|
|
141
|
+
N = l.slice(0, 10) == "0123456789", L = l;
|
|
142
|
+
else
|
|
143
|
+
throw Error(Z + o + " invalid: " + l);
|
|
144
|
+
} else
|
|
145
|
+
throw Error(Z + "Object expected: " + s);
|
|
146
|
+
return {
|
|
147
|
+
DECIMAL_PLACES: y,
|
|
148
|
+
ROUNDING_MODE: c,
|
|
149
|
+
EXPONENTIAL_AT: [E, h],
|
|
150
|
+
RANGE: [b, _],
|
|
151
|
+
CRYPTO: T,
|
|
152
|
+
MODULO_MODE: O,
|
|
153
|
+
POW_PRECISION: G,
|
|
154
|
+
FORMAT: F,
|
|
155
|
+
ALPHABET: L
|
|
156
|
+
};
|
|
157
|
+
}, S.isBigNumber = function(s) {
|
|
158
|
+
if (!s || s._isBigNumber !== !0) return !1;
|
|
159
|
+
if (!S.DEBUG) return !0;
|
|
160
|
+
var o, l, m = s.c, a = s.e, p = s.s;
|
|
161
|
+
e: if ({}.toString.call(m) == "[object Array]") {
|
|
162
|
+
if ((p === 1 || p === -1) && a >= -1e9 && a <= j && a === J(a)) {
|
|
163
|
+
if (m[0] === 0) {
|
|
164
|
+
if (a === 0 && m.length === 1) return !0;
|
|
165
|
+
break e;
|
|
166
|
+
}
|
|
167
|
+
if (o = (a + 1) % C, o < 1 && (o += C), String(m[0]).length == o) {
|
|
168
|
+
for (o = 0; o < m.length; o++)
|
|
169
|
+
if (l = m[o], l < 0 || l >= ee || l !== J(l)) break e;
|
|
170
|
+
if (l !== 0) return !0;
|
|
171
|
+
}
|
|
211
172
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
173
|
+
} else if (m === null && a === null && (p === null || p === 1 || p === -1))
|
|
174
|
+
return !0;
|
|
175
|
+
throw Error(Z + "Invalid BigNumber: " + s);
|
|
176
|
+
}, S.maximum = S.max = function() {
|
|
177
|
+
return $(arguments, -1);
|
|
178
|
+
}, S.minimum = S.min = function() {
|
|
179
|
+
return $(arguments, 1);
|
|
180
|
+
}, S.random = function() {
|
|
181
|
+
var s = 9007199254740992, o = Math.random() * s & 2097151 ? function() {
|
|
182
|
+
return J(Math.random() * s);
|
|
183
|
+
} : function() {
|
|
184
|
+
return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
|
|
185
|
+
};
|
|
186
|
+
return function(l) {
|
|
187
|
+
var m, a, p, w, f, g = 0, x = [], d = new S(u);
|
|
188
|
+
if (l == null ? l = y : D(l, 0, j), w = Be(l / C), T)
|
|
189
|
+
if (crypto.getRandomValues) {
|
|
190
|
+
for (m = crypto.getRandomValues(new Uint32Array(w *= 2)); g < w; )
|
|
191
|
+
f = m[g] * 131072 + (m[g + 1] >>> 11), f >= 9e15 ? (a = crypto.getRandomValues(new Uint32Array(2)), m[g] = a[0], m[g + 1] = a[1]) : (x.push(f % 1e14), g += 2);
|
|
192
|
+
g = w / 2;
|
|
193
|
+
} else if (crypto.randomBytes) {
|
|
194
|
+
for (m = crypto.randomBytes(w *= 7); g < w; )
|
|
195
|
+
f = (m[g] & 31) * 281474976710656 + m[g + 1] * 1099511627776 + m[g + 2] * 4294967296 + m[g + 3] * 16777216 + (m[g + 4] << 16) + (m[g + 5] << 8) + m[g + 6], f >= 9e15 ? crypto.randomBytes(7).copy(m, g) : (x.push(f % 1e14), g += 7);
|
|
196
|
+
g = w / 7;
|
|
197
|
+
} else
|
|
198
|
+
throw T = !1, Error(Z + "crypto unavailable");
|
|
199
|
+
if (!T)
|
|
200
|
+
for (; g < w; )
|
|
201
|
+
f = o(), f < 9e15 && (x[g++] = f % 1e14);
|
|
202
|
+
for (w = x[--g], l %= C, w && l && (f = Ge[C - l], x[g] = J(w / f) * f); x[g] === 0; x.pop(), g--) ;
|
|
203
|
+
if (g < 0)
|
|
204
|
+
x = [p = 0];
|
|
205
|
+
else {
|
|
206
|
+
for (p = -1; x[0] === 0; x.splice(0, 1), p -= C) ;
|
|
207
|
+
for (g = 1, f = x[0]; f >= 10; f /= 10, g++) ;
|
|
208
|
+
g < C && (p -= C - g);
|
|
219
209
|
}
|
|
220
|
-
return
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
210
|
+
return d.e = p, d.c = x, d;
|
|
211
|
+
};
|
|
212
|
+
}(), S.sum = function() {
|
|
213
|
+
for (var s = 1, o = arguments, l = new S(o[0]); s < o.length; ) l = l.plus(o[s++]);
|
|
214
|
+
return l;
|
|
215
|
+
}, t = /* @__PURE__ */ function() {
|
|
216
|
+
var s = "0123456789";
|
|
217
|
+
function o(l, m, a, p) {
|
|
218
|
+
for (var w, f = [0], g, x = 0, d = l.length; x < d; ) {
|
|
219
|
+
for (g = f.length; g--; f[g] *= m) ;
|
|
220
|
+
for (f[0] += p.indexOf(l.charAt(x++)), w = 0; w < f.length; w++)
|
|
221
|
+
f[w] > a - 1 && (f[w + 1] == null && (f[w + 1] = 0), f[w + 1] += f[w] / a | 0, f[w] %= a);
|
|
229
222
|
}
|
|
230
|
-
return
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
223
|
+
return f.reverse();
|
|
224
|
+
}
|
|
225
|
+
return function(l, m, a, p, w) {
|
|
226
|
+
var f, g, x, d, v, P, R, I, U = l.indexOf("."), K = y, A = c;
|
|
227
|
+
for (U >= 0 && (d = G, G = 0, l = l.replace(".", ""), I = new S(m), P = I.pow(l.length - U), G = d, I.c = o(
|
|
228
|
+
se(H(P.c), P.e, "0"),
|
|
229
|
+
10,
|
|
230
|
+
a,
|
|
231
|
+
s
|
|
232
|
+
), I.e = I.c.length), R = o(l, m, a, w ? (f = L, s) : (f = s, L)), x = d = R.length; R[--d] == 0; R.pop()) ;
|
|
233
|
+
if (!R[0]) return f.charAt(0);
|
|
234
|
+
if (U < 0 ? --x : (P.c = R, P.e = x, P.s = p, P = e(P, I, K, A, a), R = P.c, v = P.r, x = P.e), g = x + K + 1, U = R[g], d = a / 2, v = v || g < 0 || R[g + 1] != null, v = A < 4 ? (U != null || v) && (A == 0 || A == (P.s < 0 ? 3 : 2)) : U > d || U == d && (A == 4 || v || A == 6 && R[g - 1] & 1 || A == (P.s < 0 ? 8 : 7)), g < 1 || !R[0])
|
|
235
|
+
l = v ? se(f.charAt(1), -K, f.charAt(0)) : f.charAt(0);
|
|
236
|
+
else {
|
|
237
|
+
if (R.length = g, v)
|
|
238
|
+
for (--a; ++R[--g] > a; )
|
|
239
|
+
R[g] = 0, g || (++x, R = [1].concat(R));
|
|
240
|
+
for (d = R.length; !R[--d]; ) ;
|
|
241
|
+
for (U = 0, l = ""; U <= d; l += f.charAt(R[U++])) ;
|
|
242
|
+
l = se(l, x, f.charAt(0));
|
|
243
|
+
}
|
|
244
|
+
return l;
|
|
245
|
+
};
|
|
246
|
+
}(), e = /* @__PURE__ */ function() {
|
|
247
|
+
function s(m, a, p) {
|
|
248
|
+
var w, f, g, x, d = 0, v = m.length, P = a % le, R = a / le | 0;
|
|
249
|
+
for (m = m.slice(); v--; )
|
|
250
|
+
g = m[v] % le, x = m[v] / le | 0, w = R * g + x * P, f = P * g + w % le * le + d, d = (f / p | 0) + (w / le | 0) + R * x, m[v] = f % p;
|
|
251
|
+
return d && (m = [d].concat(m)), m;
|
|
252
|
+
}
|
|
253
|
+
function o(m, a, p, w) {
|
|
254
|
+
var f, g;
|
|
255
|
+
if (p != w)
|
|
256
|
+
g = p > w ? 1 : -1;
|
|
257
|
+
else
|
|
258
|
+
for (f = g = 0; f < p; f++)
|
|
259
|
+
if (m[f] != a[f]) {
|
|
260
|
+
g = m[f] > a[f] ? 1 : -1;
|
|
241
261
|
break;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
r++, e = e.right;
|
|
281
|
-
} else
|
|
282
|
-
n = !0;
|
|
283
|
-
return null;
|
|
284
|
-
}, i.prototype.next = function(t) {
|
|
285
|
-
var e = this._root, n = null;
|
|
286
|
-
if (t.right) {
|
|
287
|
-
for (n = t.right; n.left; )
|
|
288
|
-
n = n.left;
|
|
289
|
-
return n;
|
|
262
|
+
}
|
|
263
|
+
return g;
|
|
264
|
+
}
|
|
265
|
+
function l(m, a, p, w) {
|
|
266
|
+
for (var f = 0; p--; )
|
|
267
|
+
m[p] -= f, f = m[p] < a[p] ? 1 : 0, m[p] = f * w + m[p] - a[p];
|
|
268
|
+
for (; !m[0] && m.length > 1; m.splice(0, 1)) ;
|
|
269
|
+
}
|
|
270
|
+
return function(m, a, p, w, f) {
|
|
271
|
+
var g, x, d, v, P, R, I, U, K, A, B, X, Se, Ie, ke, te, ge, W = m.s == a.s ? 1 : -1, Y = m.c, z = a.c;
|
|
272
|
+
if (!Y || !Y[0] || !z || !z[0])
|
|
273
|
+
return new S(
|
|
274
|
+
// Return NaN if either NaN, or both Infinity or 0.
|
|
275
|
+
!m.s || !a.s || (Y ? z && Y[0] == z[0] : !z) ? NaN : (
|
|
276
|
+
// Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
|
|
277
|
+
Y && Y[0] == 0 || !z ? W * 0 : W / 0
|
|
278
|
+
)
|
|
279
|
+
);
|
|
280
|
+
for (U = new S(W), K = U.c = [], x = m.e - a.e, W = p + x + 1, f || (f = ee, x = Q(m.e / C) - Q(a.e / C), W = W / C | 0), d = 0; z[d] == (Y[d] || 0); d++) ;
|
|
281
|
+
if (z[d] > (Y[d] || 0) && x--, W < 0)
|
|
282
|
+
K.push(1), v = !0;
|
|
283
|
+
else {
|
|
284
|
+
for (Ie = Y.length, te = z.length, d = 0, W += 2, P = J(f / (z[0] + 1)), P > 1 && (z = s(z, P, f), Y = s(Y, P, f), te = z.length, Ie = Y.length), Se = te, A = Y.slice(0, te), B = A.length; B < te; A[B++] = 0) ;
|
|
285
|
+
ge = z.slice(), ge = [0].concat(ge), ke = z[0], z[1] >= f / 2 && ke++;
|
|
286
|
+
do {
|
|
287
|
+
if (P = 0, g = o(z, A, te, B), g < 0) {
|
|
288
|
+
if (X = A[0], te != B && (X = X * f + (A[1] || 0)), P = J(X / ke), P > 1)
|
|
289
|
+
for (P >= f && (P = f - 1), R = s(z, P, f), I = R.length, B = A.length; o(R, A, I, B) == 1; )
|
|
290
|
+
P--, l(R, te < I ? ge : z, I, f), I = R.length, g = 1;
|
|
291
|
+
else
|
|
292
|
+
P == 0 && (g = P = 1), R = z.slice(), I = R.length;
|
|
293
|
+
if (I < B && (R = [0].concat(R)), l(A, R, B, f), B = A.length, g == -1)
|
|
294
|
+
for (; o(z, A, te, B) < 1; )
|
|
295
|
+
P++, l(A, te < B ? ge : z, B, f), B = A.length;
|
|
296
|
+
} else g === 0 && (P++, A = [0]);
|
|
297
|
+
K[d++] = P, A[0] ? A[B++] = Y[Se] || 0 : (A = [Y[Se]], B = 1);
|
|
298
|
+
} while ((Se++ < Ie || A[0] != null) && W--);
|
|
299
|
+
v = A[0] != null, K[0] || K.splice(0, 1);
|
|
290
300
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
301
|
+
if (f == ee) {
|
|
302
|
+
for (d = 1, W = K[0]; W >= 10; W /= 10, d++) ;
|
|
303
|
+
V(U, p + (U.e = d + x * C - 1) + 1, w, v);
|
|
304
|
+
} else
|
|
305
|
+
U.e = x, U.r = +v;
|
|
306
|
+
return U;
|
|
307
|
+
};
|
|
308
|
+
}();
|
|
309
|
+
function k(s, o, l, m) {
|
|
310
|
+
var a, p, w, f, g;
|
|
311
|
+
if (l == null ? l = c : D(l, 0, 8), !s.c) return s.toString();
|
|
312
|
+
if (a = s.c[0], w = s.e, o == null)
|
|
313
|
+
g = H(s.c), g = m == 1 || m == 2 && (w <= E || w >= h) ? be(g, w) : se(g, w, "0");
|
|
314
|
+
else if (s = V(new S(s), o, l), p = s.e, g = H(s.c), f = g.length, m == 1 || m == 2 && (o <= p || p <= E)) {
|
|
315
|
+
for (; f < o; g += "0", f++) ;
|
|
316
|
+
g = be(g, p);
|
|
317
|
+
} else if (o -= w, g = se(g, p, "0"), p + 1 > f) {
|
|
318
|
+
if (--o > 0) for (g += "."; o--; g += "0") ;
|
|
319
|
+
} else if (o += p - f, o > 0)
|
|
320
|
+
for (p + 1 == f && (g += "."); o--; g += "0") ;
|
|
321
|
+
return s.s < 0 && a ? "-" + g : g;
|
|
322
|
+
}
|
|
323
|
+
function $(s, o) {
|
|
324
|
+
for (var l, m, a = 1, p = new S(s[0]); a < s.length; a++)
|
|
325
|
+
m = new S(s[a]), (!m.s || (l = fe(p, m)) === o || l === 0 && p.s === o) && (p = m);
|
|
326
|
+
return p;
|
|
327
|
+
}
|
|
328
|
+
function q(s, o, l) {
|
|
329
|
+
for (var m = 1, a = o.length; !o[--a]; o.pop()) ;
|
|
330
|
+
for (a = o[0]; a >= 10; a /= 10, m++) ;
|
|
331
|
+
return (l = m + l * C - 1) > _ ? s.c = s.e = null : l < b ? s.c = [s.e = 0] : (s.e = l, s.c = o), s;
|
|
332
|
+
}
|
|
333
|
+
i = /* @__PURE__ */ function() {
|
|
334
|
+
var s = /^(-?)0([xbo])(?=\w[\w.]*$)/i, o = /^([^.]+)\.$/, l = /^\.([^.]+)$/, m = /^-?(Infinity|NaN)$/, a = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
|
|
335
|
+
return function(p, w, f, g) {
|
|
336
|
+
var x, d = f ? w : w.replace(a, "");
|
|
337
|
+
if (m.test(d))
|
|
338
|
+
p.s = isNaN(d) ? null : d < 0 ? -1 : 1;
|
|
339
|
+
else {
|
|
340
|
+
if (!f && (d = d.replace(s, function(v, P, R) {
|
|
341
|
+
return x = (R = R.toLowerCase()) == "x" ? 16 : R == "b" ? 2 : 8, !g || g == x ? P : v;
|
|
342
|
+
}), g && (x = g, d = d.replace(o, "$1").replace(l, "0.$1")), w != d))
|
|
343
|
+
return new S(d, x);
|
|
344
|
+
if (S.DEBUG)
|
|
345
|
+
throw Error(Z + "Not a" + (g ? " base " + g : "") + " number: " + w);
|
|
346
|
+
p.s = null;
|
|
296
347
|
}
|
|
297
|
-
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
348
|
+
p.c = p.e = null;
|
|
349
|
+
};
|
|
350
|
+
}();
|
|
351
|
+
function V(s, o, l, m) {
|
|
352
|
+
var a, p, w, f, g, x, d, v = s.c, P = Ge;
|
|
353
|
+
if (v) {
|
|
354
|
+
e: {
|
|
355
|
+
for (a = 1, f = v[0]; f >= 10; f /= 10, a++) ;
|
|
356
|
+
if (p = o - a, p < 0)
|
|
357
|
+
p += C, w = o, g = v[x = 0], d = J(g / P[a - w - 1] % 10);
|
|
358
|
+
else if (x = Be((p + 1) / C), x >= v.length)
|
|
359
|
+
if (m) {
|
|
360
|
+
for (; v.length <= x; v.push(0)) ;
|
|
361
|
+
g = d = 0, a = 1, p %= C, w = p - C + 1;
|
|
362
|
+
} else
|
|
363
|
+
break e;
|
|
364
|
+
else {
|
|
365
|
+
for (g = f = v[x], a = 1; f >= 10; f /= 10, a++) ;
|
|
366
|
+
p %= C, w = p - C + a, d = w < 0 ? 0 : J(g / P[a - w - 1] % 10);
|
|
367
|
+
}
|
|
368
|
+
if (m = m || o < 0 || // Are there any non-zero digits after the rounding digit?
|
|
369
|
+
// The expression n % pows10[d - j - 1] returns all digits of n to the right
|
|
370
|
+
// of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
|
|
371
|
+
v[x + 1] != null || (w < 0 ? g : g % P[a - w - 1]), m = l < 4 ? (d || m) && (l == 0 || l == (s.s < 0 ? 3 : 2)) : d > 5 || d == 5 && (l == 4 || m || l == 6 && // Check whether the digit to the left of the rounding digit is odd.
|
|
372
|
+
(p > 0 ? w > 0 ? g / P[a - w] : 0 : v[x - 1]) % 10 & 1 || l == (s.s < 0 ? 8 : 7)), o < 1 || !v[0])
|
|
373
|
+
return v.length = 0, m ? (o -= s.e + 1, v[0] = P[(C - o % C) % C], s.e = -o || 0) : v[0] = s.e = 0, s;
|
|
374
|
+
if (p == 0 ? (v.length = x, f = 1, x--) : (v.length = x + 1, f = P[C - p], v[x] = w > 0 ? J(g / P[a - w] % P[w]) * f : 0), m)
|
|
375
|
+
for (; ; )
|
|
376
|
+
if (x == 0) {
|
|
377
|
+
for (p = 1, w = v[0]; w >= 10; w /= 10, p++) ;
|
|
378
|
+
for (w = v[0] += f, f = 1; w >= 10; w /= 10, f++) ;
|
|
379
|
+
p != f && (s.e++, v[0] == ee && (v[0] = 1));
|
|
380
|
+
break;
|
|
381
|
+
} else {
|
|
382
|
+
if (v[x] += f, v[x] != ee) break;
|
|
383
|
+
v[x--] = 0, f = 1;
|
|
384
|
+
}
|
|
385
|
+
for (p = v.length; v[--p] === 0; v.pop()) ;
|
|
304
386
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
387
|
+
s.e > _ ? s.c = s.e = null : s.e < b && (s.c = [s.e = 0]);
|
|
388
|
+
}
|
|
389
|
+
return s;
|
|
390
|
+
}
|
|
391
|
+
function re(s) {
|
|
392
|
+
var o, l = s.e;
|
|
393
|
+
return l === null ? s.toString() : (o = H(s.c), o = l <= E || l >= h ? be(o, l) : se(o, l, "0"), s.s < 0 ? "-" + o : o);
|
|
394
|
+
}
|
|
395
|
+
return r.absoluteValue = r.abs = function() {
|
|
396
|
+
var s = new S(this);
|
|
397
|
+
return s.s < 0 && (s.s = 1), s;
|
|
398
|
+
}, r.comparedTo = function(s, o) {
|
|
399
|
+
return fe(this, new S(s, o));
|
|
400
|
+
}, r.decimalPlaces = r.dp = function(s, o) {
|
|
401
|
+
var l, m, a, p = this;
|
|
402
|
+
if (s != null)
|
|
403
|
+
return D(s, 0, j), o == null ? o = c : D(o, 0, 8), V(new S(p), s + p.e + 1, o);
|
|
404
|
+
if (!(l = p.c)) return null;
|
|
405
|
+
if (m = ((a = l.length - 1) - Q(this.e / C)) * C, a = l[a]) for (; a % 10 == 0; a /= 10, m--) ;
|
|
406
|
+
return m < 0 && (m = 0), m;
|
|
407
|
+
}, r.dividedBy = r.div = function(s, o) {
|
|
408
|
+
return e(this, new S(s, o), y, c);
|
|
409
|
+
}, r.dividedToIntegerBy = r.idiv = function(s, o) {
|
|
410
|
+
return e(this, new S(s, o), 0, 1);
|
|
411
|
+
}, r.exponentiatedBy = r.pow = function(s, o) {
|
|
412
|
+
var l, m, a, p, w, f, g, x, d, v = this;
|
|
413
|
+
if (s = new S(s), s.c && !s.isInteger())
|
|
414
|
+
throw Error(Z + "Exponent not an integer: " + re(s));
|
|
415
|
+
if (o != null && (o = new S(o)), f = s.e > 14, !v.c || !v.c[0] || v.c[0] == 1 && !v.e && v.c.length == 1 || !s.c || !s.c[0])
|
|
416
|
+
return d = new S(Math.pow(+re(v), f ? s.s * (2 - _e(s)) : +re(s))), o ? d.mod(o) : d;
|
|
417
|
+
if (g = s.s < 0, o) {
|
|
418
|
+
if (o.c ? !o.c[0] : !o.s) return new S(NaN);
|
|
419
|
+
m = !g && v.isInteger() && o.isInteger(), m && (v = v.mod(o));
|
|
420
|
+
} else {
|
|
421
|
+
if (s.e > 9 && (v.e > 0 || v.e < -1 || (v.e == 0 ? v.c[0] > 1 || f && v.c[1] >= 24e7 : v.c[0] < 8e13 || f && v.c[0] <= 9999975e7)))
|
|
422
|
+
return p = v.s < 0 && _e(s) ? -0 : 0, v.e > -1 && (p = 1 / p), new S(g ? 1 / p : p);
|
|
423
|
+
G && (p = Be(G / C + 2));
|
|
424
|
+
}
|
|
425
|
+
for (f ? (l = new S(0.5), g && (s.s = 1), x = _e(s)) : (a = Math.abs(+re(s)), x = a % 2), d = new S(u); ; ) {
|
|
426
|
+
if (x) {
|
|
427
|
+
if (d = d.times(v), !d.c) break;
|
|
428
|
+
p ? d.c.length > p && (d.c.length = p) : m && (d = d.mod(o));
|
|
310
429
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}, i.prototype.load = function(t, e, n) {
|
|
317
|
-
e === void 0 && (e = []), n === void 0 && (n = !1);
|
|
318
|
-
var r = t.length, o = this._comparator;
|
|
319
|
-
if (n && ht(t, e, 0, r - 1, o), this._root === null)
|
|
320
|
-
this._root = ft(t, e, 0, r), this._size = r;
|
|
430
|
+
if (a) {
|
|
431
|
+
if (a = J(a / 2), a === 0) break;
|
|
432
|
+
x = a % 2;
|
|
433
|
+
} else if (s = s.times(l), V(s, s.e + 1, 1), s.e > 14)
|
|
434
|
+
x = _e(s);
|
|
321
435
|
else {
|
|
322
|
-
|
|
323
|
-
|
|
436
|
+
if (a = +re(s), a === 0) break;
|
|
437
|
+
x = a % 2;
|
|
324
438
|
}
|
|
325
|
-
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
439
|
+
v = v.times(v), p ? v.c && v.c.length > p && (v.c.length = p) : m && (v = v.mod(o));
|
|
440
|
+
}
|
|
441
|
+
return m ? d : (g && (d = u.div(d)), o ? d.mod(o) : p ? V(d, G, c, w) : d);
|
|
442
|
+
}, r.integerValue = function(s) {
|
|
443
|
+
var o = new S(this);
|
|
444
|
+
return s == null ? s = c : D(s, 0, 8), V(o, o.e + 1, s);
|
|
445
|
+
}, r.isEqualTo = r.eq = function(s, o) {
|
|
446
|
+
return fe(this, new S(s, o)) === 0;
|
|
447
|
+
}, r.isFinite = function() {
|
|
448
|
+
return !!this.c;
|
|
449
|
+
}, r.isGreaterThan = r.gt = function(s, o) {
|
|
450
|
+
return fe(this, new S(s, o)) > 0;
|
|
451
|
+
}, r.isGreaterThanOrEqualTo = r.gte = function(s, o) {
|
|
452
|
+
return (o = fe(this, new S(s, o))) === 1 || o === 0;
|
|
453
|
+
}, r.isInteger = function() {
|
|
454
|
+
return !!this.c && Q(this.e / C) > this.c.length - 2;
|
|
455
|
+
}, r.isLessThan = r.lt = function(s, o) {
|
|
456
|
+
return fe(this, new S(s, o)) < 0;
|
|
457
|
+
}, r.isLessThanOrEqualTo = r.lte = function(s, o) {
|
|
458
|
+
return (o = fe(this, new S(s, o))) === -1 || o === 0;
|
|
459
|
+
}, r.isNaN = function() {
|
|
460
|
+
return !this.s;
|
|
461
|
+
}, r.isNegative = function() {
|
|
462
|
+
return this.s < 0;
|
|
463
|
+
}, r.isPositive = function() {
|
|
464
|
+
return this.s > 0;
|
|
465
|
+
}, r.isZero = function() {
|
|
466
|
+
return !!this.c && this.c[0] == 0;
|
|
467
|
+
}, r.minus = function(s, o) {
|
|
468
|
+
var l, m, a, p, w = this, f = w.s;
|
|
469
|
+
if (s = new S(s, o), o = s.s, !f || !o) return new S(NaN);
|
|
470
|
+
if (f != o)
|
|
471
|
+
return s.s = -o, w.plus(s);
|
|
472
|
+
var g = w.e / C, x = s.e / C, d = w.c, v = s.c;
|
|
473
|
+
if (!g || !x) {
|
|
474
|
+
if (!d || !v) return d ? (s.s = -o, s) : new S(v ? w : NaN);
|
|
475
|
+
if (!d[0] || !v[0])
|
|
476
|
+
return v[0] ? (s.s = -o, s) : new S(d[0] ? w : (
|
|
477
|
+
// IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
|
|
478
|
+
c == 3 ? -0 : 0
|
|
479
|
+
));
|
|
480
|
+
}
|
|
481
|
+
if (g = Q(g), x = Q(x), d = d.slice(), f = g - x) {
|
|
482
|
+
for ((p = f < 0) ? (f = -f, a = d) : (x = g, a = v), a.reverse(), o = f; o--; a.push(0)) ;
|
|
483
|
+
a.reverse();
|
|
484
|
+
} else
|
|
485
|
+
for (m = (p = (f = d.length) < (o = v.length)) ? f : o, f = o = 0; o < m; o++)
|
|
486
|
+
if (d[o] != v[o]) {
|
|
487
|
+
p = d[o] < v[o];
|
|
488
|
+
break;
|
|
374
489
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
);
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
var
|
|
401
|
-
return
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
490
|
+
if (p && (a = d, d = v, v = a, s.s = -s.s), o = (m = v.length) - (l = d.length), o > 0) for (; o--; d[l++] = 0) ;
|
|
491
|
+
for (o = ee - 1; m > f; ) {
|
|
492
|
+
if (d[--m] < v[m]) {
|
|
493
|
+
for (l = m; l && !d[--l]; d[l] = o) ;
|
|
494
|
+
--d[l], d[m] += ee;
|
|
495
|
+
}
|
|
496
|
+
d[m] -= v[m];
|
|
497
|
+
}
|
|
498
|
+
for (; d[0] == 0; d.splice(0, 1), --x) ;
|
|
499
|
+
return d[0] ? q(s, d, x) : (s.s = c == 3 ? -1 : 1, s.c = [s.e = 0], s);
|
|
500
|
+
}, r.modulo = r.mod = function(s, o) {
|
|
501
|
+
var l, m, a = this;
|
|
502
|
+
return s = new S(s, o), !a.c || !s.s || s.c && !s.c[0] ? new S(NaN) : !s.c || a.c && !a.c[0] ? new S(a) : (O == 9 ? (m = s.s, s.s = 1, l = e(a, s, 0, 3), s.s = m, l.s *= m) : l = e(a, s, 0, O), s = a.minus(l.times(s)), !s.c[0] && O == 1 && (s.s = a.s), s);
|
|
503
|
+
}, r.multipliedBy = r.times = function(s, o) {
|
|
504
|
+
var l, m, a, p, w, f, g, x, d, v, P, R, I, U, K, A = this, B = A.c, X = (s = new S(s, o)).c;
|
|
505
|
+
if (!B || !X || !B[0] || !X[0])
|
|
506
|
+
return !A.s || !s.s || B && !B[0] && !X || X && !X[0] && !B ? s.c = s.e = s.s = null : (s.s *= A.s, !B || !X ? s.c = s.e = null : (s.c = [0], s.e = 0)), s;
|
|
507
|
+
for (m = Q(A.e / C) + Q(s.e / C), s.s *= A.s, g = B.length, v = X.length, g < v && (I = B, B = X, X = I, a = g, g = v, v = a), a = g + v, I = []; a--; I.push(0)) ;
|
|
508
|
+
for (U = ee, K = le, a = v; --a >= 0; ) {
|
|
509
|
+
for (l = 0, P = X[a] % K, R = X[a] / K | 0, w = g, p = a + w; p > a; )
|
|
510
|
+
x = B[--w] % K, d = B[w] / K | 0, f = R * x + d * P, x = P * x + f % K * K + I[p] + l, l = (x / U | 0) + (f / K | 0) + R * d, I[p--] = x % U;
|
|
511
|
+
I[p] = l;
|
|
512
|
+
}
|
|
513
|
+
return l ? ++m : I.splice(0, 1), q(s, I, m);
|
|
514
|
+
}, r.negated = function() {
|
|
515
|
+
var s = new S(this);
|
|
516
|
+
return s.s = -s.s || null, s;
|
|
517
|
+
}, r.plus = function(s, o) {
|
|
518
|
+
var l, m = this, a = m.s;
|
|
519
|
+
if (s = new S(s, o), o = s.s, !a || !o) return new S(NaN);
|
|
520
|
+
if (a != o)
|
|
521
|
+
return s.s = -o, m.minus(s);
|
|
522
|
+
var p = m.e / C, w = s.e / C, f = m.c, g = s.c;
|
|
523
|
+
if (!p || !w) {
|
|
524
|
+
if (!f || !g) return new S(a / 0);
|
|
525
|
+
if (!f[0] || !g[0]) return g[0] ? s : new S(f[0] ? m : a * 0);
|
|
526
|
+
}
|
|
527
|
+
if (p = Q(p), w = Q(w), f = f.slice(), a = p - w) {
|
|
528
|
+
for (a > 0 ? (w = p, l = g) : (a = -a, l = f), l.reverse(); a--; l.push(0)) ;
|
|
529
|
+
l.reverse();
|
|
530
|
+
}
|
|
531
|
+
for (a = f.length, o = g.length, a - o < 0 && (l = g, g = f, f = l, o = a), a = 0; o; )
|
|
532
|
+
a = (f[--o] = f[o] + g[o] + a) / ee | 0, f[o] = ee === f[o] ? 0 : f[o] % ee;
|
|
533
|
+
return a && (f = [a].concat(f), ++w), q(s, f, w);
|
|
534
|
+
}, r.precision = r.sd = function(s, o) {
|
|
535
|
+
var l, m, a, p = this;
|
|
536
|
+
if (s != null && s !== !!s)
|
|
537
|
+
return D(s, 1, j), o == null ? o = c : D(o, 0, 8), V(new S(p), s, o);
|
|
538
|
+
if (!(l = p.c)) return null;
|
|
539
|
+
if (a = l.length - 1, m = a * C + 1, a = l[a]) {
|
|
540
|
+
for (; a % 10 == 0; a /= 10, m--) ;
|
|
541
|
+
for (a = l[0]; a >= 10; a /= 10, m++) ;
|
|
542
|
+
}
|
|
543
|
+
return s && p.e + 1 > m && (m = p.e + 1), m;
|
|
544
|
+
}, r.shiftedBy = function(s) {
|
|
545
|
+
return D(s, -9007199254740991, je), this.times("1e" + s);
|
|
546
|
+
}, r.squareRoot = r.sqrt = function() {
|
|
547
|
+
var s, o, l, m, a, p = this, w = p.c, f = p.s, g = p.e, x = y + 4, d = new S("0.5");
|
|
548
|
+
if (f !== 1 || !w || !w[0])
|
|
549
|
+
return new S(!f || f < 0 && (!w || w[0]) ? NaN : w ? p : 1 / 0);
|
|
550
|
+
if (f = Math.sqrt(+re(p)), f == 0 || f == 1 / 0 ? (o = H(w), (o.length + g) % 2 == 0 && (o += "0"), f = Math.sqrt(+o), g = Q((g + 1) / 2) - (g < 0 || g % 2), f == 1 / 0 ? o = "5e" + g : (o = f.toExponential(), o = o.slice(0, o.indexOf("e") + 1) + g), l = new S(o)) : l = new S(f + ""), l.c[0]) {
|
|
551
|
+
for (g = l.e, f = g + x, f < 3 && (f = 0); ; )
|
|
552
|
+
if (a = l, l = d.times(a.plus(e(p, a, x, 1))), H(a.c).slice(0, f) === (o = H(l.c)).slice(0, f))
|
|
553
|
+
if (l.e < g && --f, o = o.slice(f - 3, f + 1), o == "9999" || !m && o == "4999") {
|
|
554
|
+
if (!m && (V(a, a.e + y + 2, 0), a.times(a).eq(p))) {
|
|
555
|
+
l = a;
|
|
556
|
+
break;
|
|
557
|
+
}
|
|
558
|
+
x += 4, f += 4, m = 1;
|
|
559
|
+
} else {
|
|
560
|
+
(!+o || !+o.slice(1) && o.charAt(0) == "5") && (V(l, l.e + y + 2, 1), s = !l.times(l).eq(p));
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
return V(l, l.e + y + 1, c, s);
|
|
565
|
+
}, r.toExponential = function(s, o) {
|
|
566
|
+
return s != null && (D(s, 0, j), s++), k(this, s, o, 1);
|
|
567
|
+
}, r.toFixed = function(s, o) {
|
|
568
|
+
return s != null && (D(s, 0, j), s = s + this.e + 1), k(this, s, o);
|
|
569
|
+
}, r.toFormat = function(s, o, l) {
|
|
570
|
+
var m, a = this;
|
|
571
|
+
if (l == null)
|
|
572
|
+
s != null && o && typeof o == "object" ? (l = o, o = null) : s && typeof s == "object" ? (l = s, s = o = null) : l = F;
|
|
573
|
+
else if (typeof l != "object")
|
|
574
|
+
throw Error(Z + "Argument not an object: " + l);
|
|
575
|
+
if (m = a.toFixed(s, o), a.c) {
|
|
576
|
+
var p, w = m.split("."), f = +l.groupSize, g = +l.secondaryGroupSize, x = l.groupSeparator || "", d = w[0], v = w[1], P = a.s < 0, R = P ? d.slice(1) : d, I = R.length;
|
|
577
|
+
if (g && (p = f, f = g, g = p, I -= p), f > 0 && I > 0) {
|
|
578
|
+
for (p = I % f || f, d = R.substr(0, p); p < I; p += f) d += x + R.substr(p, f);
|
|
579
|
+
g > 0 && (d += x + R.slice(p)), P && (d = "-" + d);
|
|
580
|
+
}
|
|
581
|
+
m = v ? d + (l.decimalSeparator || "") + ((g = +l.fractionGroupSize) ? v.replace(
|
|
582
|
+
new RegExp("\\d{" + g + "}\\B", "g"),
|
|
583
|
+
"$&" + (l.fractionGroupSeparator || "")
|
|
584
|
+
) : v) : d;
|
|
585
|
+
}
|
|
586
|
+
return (l.prefix || "") + m + (l.suffix || "");
|
|
587
|
+
}, r.toFraction = function(s) {
|
|
588
|
+
var o, l, m, a, p, w, f, g, x, d, v, P, R = this, I = R.c;
|
|
589
|
+
if (s != null && (f = new S(s), !f.isInteger() && (f.c || f.s !== 1) || f.lt(u)))
|
|
590
|
+
throw Error(Z + "Argument " + (f.isInteger() ? "out of range: " : "not an integer: ") + re(f));
|
|
591
|
+
if (!I) return new S(R);
|
|
592
|
+
for (o = new S(u), x = l = new S(u), m = g = new S(u), P = H(I), p = o.e = P.length - R.e - 1, o.c[0] = Ge[(w = p % C) < 0 ? C + w : w], s = !s || f.comparedTo(o) > 0 ? p > 0 ? o : x : f, w = _, _ = 1 / 0, f = new S(P), g.c[0] = 0; d = e(f, o, 0, 1), a = l.plus(d.times(m)), a.comparedTo(s) != 1; )
|
|
593
|
+
l = m, m = a, x = g.plus(d.times(a = x)), g = a, o = f.minus(d.times(a = o)), f = a;
|
|
594
|
+
return a = e(s.minus(l), m, 0, 1), g = g.plus(a.times(x)), l = l.plus(a.times(m)), g.s = x.s = R.s, p = p * 2, v = e(x, m, p, c).minus(R).abs().comparedTo(
|
|
595
|
+
e(g, l, p, c).minus(R).abs()
|
|
596
|
+
) < 1 ? [x, m] : [g, l], _ = w, v;
|
|
597
|
+
}, r.toNumber = function() {
|
|
598
|
+
return +re(this);
|
|
599
|
+
}, r.toPrecision = function(s, o) {
|
|
600
|
+
return s != null && D(s, 1, j), k(this, s, o, 2);
|
|
601
|
+
}, r.toString = function(s) {
|
|
602
|
+
var o, l = this, m = l.s, a = l.e;
|
|
603
|
+
return a === null ? m ? (o = "Infinity", m < 0 && (o = "-" + o)) : o = "NaN" : (s == null ? o = a <= E || a >= h ? be(H(l.c), a) : se(H(l.c), a, "0") : s === 10 && N ? (l = V(new S(l), y + a + 1, c), o = se(H(l.c), l.e, "0")) : (D(s, 2, L.length, "Base"), o = t(se(H(l.c), a, "0"), 10, s, m, !0)), m < 0 && l.c[0] && (o = "-" + o)), o;
|
|
604
|
+
}, r.valueOf = r.toJSON = function() {
|
|
605
|
+
return re(this);
|
|
606
|
+
}, r._isBigNumber = !0, r[Symbol.toStringTag] = "BigNumber", r[Symbol.for("nodejs.util.inspect.custom")] = r.valueOf, n != null && S.set(n), S;
|
|
607
|
+
}
|
|
608
|
+
function Q(n) {
|
|
609
|
+
var e = n | 0;
|
|
610
|
+
return n > 0 || n === e ? e : e - 1;
|
|
611
|
+
}
|
|
612
|
+
function H(n) {
|
|
613
|
+
for (var e, t, i = 1, r = n.length, u = n[0] + ""; i < r; ) {
|
|
614
|
+
for (e = n[i++] + "", t = C - e.length; t--; e = "0" + e) ;
|
|
615
|
+
u += e;
|
|
616
|
+
}
|
|
617
|
+
for (r = u.length; u.charCodeAt(--r) === 48; ) ;
|
|
618
|
+
return u.slice(0, r + 1 || 1);
|
|
619
|
+
}
|
|
620
|
+
function fe(n, e) {
|
|
621
|
+
var t, i, r = n.c, u = e.c, y = n.s, c = e.s, E = n.e, h = e.e;
|
|
622
|
+
if (!y || !c) return null;
|
|
623
|
+
if (t = r && !r[0], i = u && !u[0], t || i) return t ? i ? 0 : -c : y;
|
|
624
|
+
if (y != c) return y;
|
|
625
|
+
if (t = y < 0, i = E == h, !r || !u) return i ? 0 : !r ^ t ? 1 : -1;
|
|
626
|
+
if (!i) return E > h ^ t ? 1 : -1;
|
|
627
|
+
for (c = (E = r.length) < (h = u.length) ? E : h, y = 0; y < c; y++) if (r[y] != u[y]) return r[y] > u[y] ^ t ? 1 : -1;
|
|
628
|
+
return E == h ? 0 : E > h ^ t ? 1 : -1;
|
|
629
|
+
}
|
|
630
|
+
function D(n, e, t, i) {
|
|
631
|
+
if (n < e || n > t || n !== J(n))
|
|
632
|
+
throw Error(Z + (i || "Argument") + (typeof n == "number" ? n < e || n > t ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
|
|
633
|
+
}
|
|
634
|
+
function _e(n) {
|
|
635
|
+
var e = n.c.length - 1;
|
|
636
|
+
return Q(n.e / C) == e && n.c[e] % 2 != 0;
|
|
637
|
+
}
|
|
638
|
+
function be(n, e) {
|
|
639
|
+
return (n.length > 1 ? n.charAt(0) + "." + n.slice(1) : n) + (e < 0 ? "e" : "e+") + e;
|
|
640
|
+
}
|
|
641
|
+
function se(n, e, t) {
|
|
642
|
+
var i, r;
|
|
643
|
+
if (e < 0) {
|
|
644
|
+
for (r = t + "."; ++e; r += t) ;
|
|
645
|
+
n = r + n;
|
|
646
|
+
} else if (i = n.length, ++e > i) {
|
|
647
|
+
for (r = t, e -= i; --e; r += t) ;
|
|
648
|
+
n += r;
|
|
649
|
+
} else e < i && (n = n.slice(0, e) + "." + n.slice(e));
|
|
650
|
+
return n;
|
|
651
|
+
}
|
|
652
|
+
var ie = pt(), Pt = class {
|
|
653
|
+
constructor(n) {
|
|
654
|
+
M(this, "key");
|
|
655
|
+
M(this, "left", null);
|
|
656
|
+
M(this, "right", null);
|
|
657
|
+
this.key = n;
|
|
658
|
+
}
|
|
659
|
+
}, pe = class extends Pt {
|
|
660
|
+
constructor(n) {
|
|
661
|
+
super(n);
|
|
662
|
+
}
|
|
663
|
+
}, Rt = class {
|
|
664
|
+
constructor() {
|
|
665
|
+
M(this, "size", 0);
|
|
666
|
+
M(this, "modificationCount", 0);
|
|
667
|
+
M(this, "splayCount", 0);
|
|
668
|
+
}
|
|
669
|
+
splay(n) {
|
|
670
|
+
const e = this.root;
|
|
671
|
+
if (e == null)
|
|
672
|
+
return this.compare(n, n), -1;
|
|
673
|
+
let t = null, i = null, r = null, u = null, y = e;
|
|
674
|
+
const c = this.compare;
|
|
675
|
+
let E;
|
|
676
|
+
for (; ; )
|
|
677
|
+
if (E = c(y.key, n), E > 0) {
|
|
678
|
+
let h = y.left;
|
|
679
|
+
if (h == null || (E = c(h.key, n), E > 0 && (y.left = h.right, h.right = y, y = h, h = y.left, h == null)))
|
|
680
|
+
break;
|
|
681
|
+
t == null ? i = y : t.left = y, t = y, y = h;
|
|
682
|
+
} else if (E < 0) {
|
|
683
|
+
let h = y.right;
|
|
684
|
+
if (h == null || (E = c(h.key, n), E < 0 && (y.right = h.left, h.left = y, y = h, h = y.right, h == null)))
|
|
685
|
+
break;
|
|
686
|
+
r == null ? u = y : r.right = y, r = y, y = h;
|
|
687
|
+
} else
|
|
420
688
|
break;
|
|
421
|
-
|
|
422
|
-
|
|
689
|
+
return r != null && (r.right = y.left, y.left = u), t != null && (t.left = y.right, y.right = i), this.root !== y && (this.root = y, this.splayCount++), E;
|
|
690
|
+
}
|
|
691
|
+
splayMin(n) {
|
|
692
|
+
let e = n, t = e.left;
|
|
693
|
+
for (; t != null; ) {
|
|
694
|
+
const i = t;
|
|
695
|
+
e.left = i.right, i.right = e, e = i, t = e.left;
|
|
423
696
|
}
|
|
424
|
-
|
|
697
|
+
return e;
|
|
425
698
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
let a = 0;
|
|
432
|
-
if (s < i && h < e)
|
|
433
|
-
for (g > u == g > -u ? (f = u + o, l = o - (f - u), u = t[++s]) : (f = g + o, l = o - (f - g), g = n[++h]), o = f, l !== 0 && (r[a++] = l); s < i && h < e; )
|
|
434
|
-
g > u == g > -u ? (f = o + u, c = f - o, l = o - (f - c) + (u - c), u = t[++s]) : (f = o + g, c = f - o, l = o - (f - c) + (g - c), g = n[++h]), o = f, l !== 0 && (r[a++] = l);
|
|
435
|
-
for (; s < i; )
|
|
436
|
-
f = o + u, c = f - o, l = o - (f - c) + (u - c), u = t[++s], o = f, l !== 0 && (r[a++] = l);
|
|
437
|
-
for (; h < e; )
|
|
438
|
-
f = o + g, c = f - o, l = o - (f - c) + (g - c), g = n[++h], o = f, l !== 0 && (r[a++] = l);
|
|
439
|
-
return (o !== 0 || a === 0) && (r[a++] = o), a;
|
|
440
|
-
}
|
|
441
|
-
function fe(i, t) {
|
|
442
|
-
let e = t[0];
|
|
443
|
-
for (let n = 1; n < i; n++) e += t[n];
|
|
444
|
-
return e;
|
|
445
|
-
}
|
|
446
|
-
function J(i) {
|
|
447
|
-
return new Float64Array(i);
|
|
448
|
-
}
|
|
449
|
-
const ce = (3 + 16 * O) * O, he = (2 + 12 * O) * O, ae = (9 + 64 * O) * O * O, U = J(4), mt = J(8), wt = J(12), bt = J(16), P = J(4);
|
|
450
|
-
function ge(i, t, e, n, r, o, f) {
|
|
451
|
-
let l, c, u, g, s, h, a, d, x, p, y, w, v, E, m, b, M, _;
|
|
452
|
-
const R = i - r, I = e - r, C = t - o, k = n - o;
|
|
453
|
-
E = R * k, h = S * R, a = h - (h - R), d = R - a, h = S * k, x = h - (h - k), p = k - x, m = d * p - (E - a * x - d * x - a * p), b = C * I, h = S * C, a = h - (h - C), d = C - a, h = S * I, x = h - (h - I), p = I - x, M = d * p - (b - a * x - d * x - a * p), y = m - M, s = m - y, U[0] = m - (y + s) + (s - M), w = E + y, s = w - E, v = E - (w - s) + (y - s), y = v - b, s = v - y, U[1] = v - (y + s) + (s - b), _ = w + y, s = _ - w, U[2] = w - (_ - s) + (y - s), U[3] = _;
|
|
454
|
-
let A = fe(4, U), F = he * f;
|
|
455
|
-
if (A >= F || -A >= F || (s = i - R, l = i - (R + s) + (s - r), s = e - I, u = e - (I + s) + (s - r), s = t - C, c = t - (C + s) + (s - o), s = n - k, g = n - (k + s) + (s - o), l === 0 && c === 0 && u === 0 && g === 0) || (F = ae * f + ue * Math.abs(A), A += R * g + k * l - (C * u + I * c), A >= F || -A >= F)) return A;
|
|
456
|
-
E = l * k, h = S * l, a = h - (h - l), d = l - a, h = S * k, x = h - (h - k), p = k - x, m = d * p - (E - a * x - d * x - a * p), b = c * I, h = S * c, a = h - (h - c), d = c - a, h = S * I, x = h - (h - I), p = I - x, M = d * p - (b - a * x - d * x - a * p), y = m - M, s = m - y, P[0] = m - (y + s) + (s - M), w = E + y, s = w - E, v = E - (w - s) + (y - s), y = v - b, s = v - y, P[1] = v - (y + s) + (s - b), _ = w + y, s = _ - w, P[2] = w - (_ - s) + (y - s), P[3] = _;
|
|
457
|
-
const Jt = st(4, U, 4, P, mt);
|
|
458
|
-
E = R * g, h = S * R, a = h - (h - R), d = R - a, h = S * g, x = h - (h - g), p = g - x, m = d * p - (E - a * x - d * x - a * p), b = C * u, h = S * C, a = h - (h - C), d = C - a, h = S * u, x = h - (h - u), p = u - x, M = d * p - (b - a * x - d * x - a * p), y = m - M, s = m - y, P[0] = m - (y + s) + (s - M), w = E + y, s = w - E, v = E - (w - s) + (y - s), y = v - b, s = v - y, P[1] = v - (y + s) + (s - b), _ = w + y, s = _ - w, P[2] = w - (_ - s) + (y - s), P[3] = _;
|
|
459
|
-
const Kt = st(Jt, mt, 4, P, wt);
|
|
460
|
-
E = l * g, h = S * l, a = h - (h - l), d = l - a, h = S * g, x = h - (h - g), p = g - x, m = d * p - (E - a * x - d * x - a * p), b = c * u, h = S * c, a = h - (h - c), d = c - a, h = S * u, x = h - (h - u), p = u - x, M = d * p - (b - a * x - d * x - a * p), y = m - M, s = m - y, P[0] = m - (y + s) + (s - M), w = E + y, s = w - E, v = E - (w - s) + (y - s), y = v - b, s = v - y, P[1] = v - (y + s) + (s - b), _ = w + y, s = _ - w, P[2] = w - (_ - s) + (y - s), P[3] = _;
|
|
461
|
-
const Ht = st(Kt, wt, 4, P, bt);
|
|
462
|
-
return bt[Ht - 1];
|
|
463
|
-
}
|
|
464
|
-
function pe(i, t, e, n, r, o) {
|
|
465
|
-
const f = (t - o) * (e - r), l = (i - r) * (n - o), c = f - l, u = Math.abs(f + l);
|
|
466
|
-
return Math.abs(c) >= ce * u ? c : -ge(i, t, e, n, r, o, u);
|
|
467
|
-
}
|
|
468
|
-
const Q = (i, t) => i.ll.x <= t.x && t.x <= i.ur.x && i.ll.y <= t.y && t.y <= i.ur.y, at = (i, t) => {
|
|
469
|
-
if (t.ur.x < i.ll.x || i.ur.x < t.ll.x || t.ur.y < i.ll.y || i.ur.y < t.ll.y) return null;
|
|
470
|
-
const e = i.ll.x < t.ll.x ? t.ll.x : i.ll.x, n = i.ur.x < t.ur.x ? i.ur.x : t.ur.x, r = i.ll.y < t.ll.y ? t.ll.y : i.ll.y, o = i.ur.y < t.ur.y ? i.ur.y : t.ur.y;
|
|
471
|
-
return {
|
|
472
|
-
ll: {
|
|
473
|
-
x: e,
|
|
474
|
-
y: r
|
|
475
|
-
},
|
|
476
|
-
ur: {
|
|
477
|
-
x: n,
|
|
478
|
-
y: o
|
|
699
|
+
splayMax(n) {
|
|
700
|
+
let e = n, t = e.right;
|
|
701
|
+
for (; t != null; ) {
|
|
702
|
+
const i = t;
|
|
703
|
+
e.right = i.left, i.left = e, e = i, t = e.right;
|
|
479
704
|
}
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
this.
|
|
705
|
+
return e;
|
|
706
|
+
}
|
|
707
|
+
_delete(n) {
|
|
708
|
+
if (this.root == null || this.splay(n) != 0) return null;
|
|
709
|
+
let t = this.root;
|
|
710
|
+
const i = t, r = t.left;
|
|
711
|
+
if (this.size--, r == null)
|
|
712
|
+
this.root = t.right;
|
|
713
|
+
else {
|
|
714
|
+
const u = t.right;
|
|
715
|
+
t = this.splayMax(r), t.right = u, this.root = t;
|
|
716
|
+
}
|
|
717
|
+
return this.modificationCount++, i;
|
|
718
|
+
}
|
|
719
|
+
addNewRoot(n, e) {
|
|
720
|
+
this.size++, this.modificationCount++;
|
|
721
|
+
const t = this.root;
|
|
722
|
+
if (t == null) {
|
|
723
|
+
this.root = n;
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
e < 0 ? (n.left = t, n.right = t.right, t.right = null) : (n.right = t, n.left = t.left, t.left = null), this.root = n;
|
|
727
|
+
}
|
|
728
|
+
_first() {
|
|
729
|
+
const n = this.root;
|
|
730
|
+
return n == null ? null : (this.root = this.splayMin(n), this.root);
|
|
731
|
+
}
|
|
732
|
+
_last() {
|
|
733
|
+
const n = this.root;
|
|
734
|
+
return n == null ? null : (this.root = this.splayMax(n), this.root);
|
|
493
735
|
}
|
|
494
|
-
|
|
495
|
-
this.
|
|
736
|
+
clear() {
|
|
737
|
+
this.root = null, this.size = 0, this.modificationCount++;
|
|
496
738
|
}
|
|
497
|
-
|
|
739
|
+
has(n) {
|
|
740
|
+
return this.validKey(n) && this.splay(n) == 0;
|
|
741
|
+
}
|
|
742
|
+
defaultCompare() {
|
|
743
|
+
return (n, e) => n < e ? -1 : n > e ? 1 : 0;
|
|
744
|
+
}
|
|
745
|
+
wrap() {
|
|
498
746
|
return {
|
|
499
|
-
|
|
500
|
-
|
|
747
|
+
getRoot: () => this.root,
|
|
748
|
+
setRoot: (n) => {
|
|
749
|
+
this.root = n;
|
|
750
|
+
},
|
|
751
|
+
getSize: () => this.size,
|
|
752
|
+
getModificationCount: () => this.modificationCount,
|
|
753
|
+
getSplayCount: () => this.splayCount,
|
|
754
|
+
setSplayCount: (n) => {
|
|
755
|
+
this.splayCount = n;
|
|
756
|
+
},
|
|
757
|
+
splay: (n) => this.splay(n),
|
|
758
|
+
has: (n) => this.has(n)
|
|
501
759
|
};
|
|
502
760
|
}
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
this
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
const
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
761
|
+
}, at, ht, Re = class de extends Rt {
|
|
762
|
+
constructor(t, i) {
|
|
763
|
+
super();
|
|
764
|
+
M(this, "root", null);
|
|
765
|
+
M(this, "compare");
|
|
766
|
+
M(this, "validKey");
|
|
767
|
+
M(this, at, "[object Set]");
|
|
768
|
+
this.compare = t ?? this.defaultCompare(), this.validKey = i ?? ((r) => r != null && r != null);
|
|
769
|
+
}
|
|
770
|
+
delete(t) {
|
|
771
|
+
return this.validKey(t) ? this._delete(t) != null : !1;
|
|
772
|
+
}
|
|
773
|
+
deleteAll(t) {
|
|
774
|
+
for (const i of t)
|
|
775
|
+
this.delete(i);
|
|
776
|
+
}
|
|
777
|
+
forEach(t) {
|
|
778
|
+
const i = this[Symbol.iterator]();
|
|
779
|
+
let r;
|
|
780
|
+
for (; r = i.next(), !r.done; )
|
|
781
|
+
t(r.value, r.value, this);
|
|
782
|
+
}
|
|
783
|
+
add(t) {
|
|
784
|
+
const i = this.splay(t);
|
|
785
|
+
return i != 0 && this.addNewRoot(new pe(t), i), this;
|
|
786
|
+
}
|
|
787
|
+
addAndReturn(t) {
|
|
788
|
+
const i = this.splay(t);
|
|
789
|
+
return i != 0 && this.addNewRoot(new pe(t), i), this.root.key;
|
|
790
|
+
}
|
|
791
|
+
addAll(t) {
|
|
792
|
+
for (const i of t)
|
|
793
|
+
this.add(i);
|
|
794
|
+
}
|
|
795
|
+
isEmpty() {
|
|
796
|
+
return this.root == null;
|
|
797
|
+
}
|
|
798
|
+
isNotEmpty() {
|
|
799
|
+
return this.root != null;
|
|
800
|
+
}
|
|
801
|
+
single() {
|
|
802
|
+
if (this.size == 0) throw "Bad state: No element";
|
|
803
|
+
if (this.size > 1) throw "Bad state: Too many element";
|
|
804
|
+
return this.root.key;
|
|
805
|
+
}
|
|
806
|
+
first() {
|
|
807
|
+
if (this.size == 0) throw "Bad state: No element";
|
|
808
|
+
return this._first().key;
|
|
809
|
+
}
|
|
810
|
+
last() {
|
|
811
|
+
if (this.size == 0) throw "Bad state: No element";
|
|
812
|
+
return this._last().key;
|
|
813
|
+
}
|
|
814
|
+
lastBefore(t) {
|
|
815
|
+
if (t == null) throw "Invalid arguments(s)";
|
|
816
|
+
if (this.root == null) return null;
|
|
817
|
+
if (this.splay(t) < 0) return this.root.key;
|
|
818
|
+
let r = this.root.left;
|
|
819
|
+
if (r == null) return null;
|
|
820
|
+
let u = r.right;
|
|
821
|
+
for (; u != null; )
|
|
822
|
+
r = u, u = r.right;
|
|
823
|
+
return r.key;
|
|
824
|
+
}
|
|
825
|
+
firstAfter(t) {
|
|
826
|
+
if (t == null) throw "Invalid arguments(s)";
|
|
827
|
+
if (this.root == null) return null;
|
|
828
|
+
if (this.splay(t) > 0) return this.root.key;
|
|
829
|
+
let r = this.root.right;
|
|
830
|
+
if (r == null) return null;
|
|
831
|
+
let u = r.left;
|
|
832
|
+
for (; u != null; )
|
|
833
|
+
r = u, u = r.left;
|
|
834
|
+
return r.key;
|
|
835
|
+
}
|
|
836
|
+
retainAll(t) {
|
|
837
|
+
const i = new de(this.compare, this.validKey), r = this.modificationCount;
|
|
838
|
+
for (const u of t) {
|
|
839
|
+
if (r != this.modificationCount)
|
|
840
|
+
throw "Concurrent modification during iteration.";
|
|
841
|
+
this.validKey(u) && this.splay(u) == 0 && i.add(this.root.key);
|
|
842
|
+
}
|
|
843
|
+
i.size != this.size && (this.root = i.root, this.size = i.size, this.modificationCount++);
|
|
521
844
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
845
|
+
lookup(t) {
|
|
846
|
+
return !this.validKey(t) || this.splay(t) != 0 ? null : this.root.key;
|
|
847
|
+
}
|
|
848
|
+
intersection(t) {
|
|
849
|
+
const i = new de(this.compare, this.validKey);
|
|
850
|
+
for (const r of this)
|
|
851
|
+
t.has(r) && i.add(r);
|
|
852
|
+
return i;
|
|
853
|
+
}
|
|
854
|
+
difference(t) {
|
|
855
|
+
const i = new de(this.compare, this.validKey);
|
|
856
|
+
for (const r of this)
|
|
857
|
+
t.has(r) || i.add(r);
|
|
858
|
+
return i;
|
|
859
|
+
}
|
|
860
|
+
union(t) {
|
|
861
|
+
const i = this.clone();
|
|
862
|
+
return i.addAll(t), i;
|
|
863
|
+
}
|
|
864
|
+
clone() {
|
|
865
|
+
const t = new de(this.compare, this.validKey);
|
|
866
|
+
return t.size = this.size, t.root = this.copyNode(this.root), t;
|
|
867
|
+
}
|
|
868
|
+
copyNode(t) {
|
|
869
|
+
if (t == null) return null;
|
|
870
|
+
function i(u, y) {
|
|
871
|
+
let c, E;
|
|
872
|
+
do {
|
|
873
|
+
if (c = u.left, E = u.right, c != null) {
|
|
874
|
+
const h = new pe(c.key);
|
|
875
|
+
y.left = h, i(c, h);
|
|
876
|
+
}
|
|
877
|
+
if (E != null) {
|
|
878
|
+
const h = new pe(E.key);
|
|
879
|
+
y.right = h, u = E, y = h;
|
|
880
|
+
}
|
|
881
|
+
} while (E != null);
|
|
882
|
+
}
|
|
883
|
+
const r = new pe(t.key);
|
|
884
|
+
return i(t, r), r;
|
|
885
|
+
}
|
|
886
|
+
toSet() {
|
|
887
|
+
return this.clone();
|
|
888
|
+
}
|
|
889
|
+
entries() {
|
|
890
|
+
return new Ot(this.wrap());
|
|
891
|
+
}
|
|
892
|
+
keys() {
|
|
893
|
+
return this[Symbol.iterator]();
|
|
894
|
+
}
|
|
895
|
+
values() {
|
|
896
|
+
return this[Symbol.iterator]();
|
|
897
|
+
}
|
|
898
|
+
[(ht = Symbol.iterator, at = Symbol.toStringTag, ht)]() {
|
|
899
|
+
return new Ct(this.wrap());
|
|
900
|
+
}
|
|
901
|
+
}, yt = class {
|
|
902
|
+
constructor(n) {
|
|
903
|
+
M(this, "tree");
|
|
904
|
+
M(this, "path", new Array());
|
|
905
|
+
M(this, "modificationCount", null);
|
|
906
|
+
M(this, "splayCount");
|
|
907
|
+
this.tree = n, this.splayCount = n.getSplayCount();
|
|
908
|
+
}
|
|
909
|
+
[Symbol.iterator]() {
|
|
910
|
+
return this;
|
|
911
|
+
}
|
|
912
|
+
next() {
|
|
913
|
+
return this.moveNext() ? { done: !1, value: this.current() } : { done: !0, value: null };
|
|
914
|
+
}
|
|
915
|
+
current() {
|
|
916
|
+
if (!this.path.length) return null;
|
|
917
|
+
const n = this.path[this.path.length - 1];
|
|
918
|
+
return this.getValue(n);
|
|
919
|
+
}
|
|
920
|
+
rebuildPath(n) {
|
|
921
|
+
this.path.splice(0, this.path.length), this.tree.splay(n), this.path.push(this.tree.getRoot()), this.splayCount = this.tree.getSplayCount();
|
|
922
|
+
}
|
|
923
|
+
findLeftMostDescendent(n) {
|
|
924
|
+
for (; n != null; )
|
|
925
|
+
this.path.push(n), n = n.left;
|
|
926
|
+
}
|
|
927
|
+
moveNext() {
|
|
928
|
+
if (this.modificationCount != this.tree.getModificationCount()) {
|
|
929
|
+
if (this.modificationCount == null) {
|
|
930
|
+
this.modificationCount = this.tree.getModificationCount();
|
|
931
|
+
let t = this.tree.getRoot();
|
|
932
|
+
for (; t != null; )
|
|
933
|
+
this.path.push(t), t = t.left;
|
|
934
|
+
return this.path.length > 0;
|
|
935
|
+
}
|
|
936
|
+
throw "Concurrent modification during iteration.";
|
|
937
|
+
}
|
|
938
|
+
if (!this.path.length) return !1;
|
|
939
|
+
this.splayCount != this.tree.getSplayCount() && this.rebuildPath(this.path[this.path.length - 1].key);
|
|
940
|
+
let n = this.path[this.path.length - 1], e = n.right;
|
|
941
|
+
if (e != null) {
|
|
942
|
+
for (; e != null; )
|
|
943
|
+
this.path.push(e), e = e.left;
|
|
944
|
+
return !0;
|
|
945
|
+
}
|
|
946
|
+
for (this.path.pop(); this.path.length && this.path[this.path.length - 1].right === n; )
|
|
947
|
+
n = this.path.pop();
|
|
948
|
+
return this.path.length > 0;
|
|
949
|
+
}
|
|
950
|
+
}, Ct = class extends yt {
|
|
951
|
+
getValue(n) {
|
|
952
|
+
return n.key;
|
|
953
|
+
}
|
|
954
|
+
}, Ot = class extends yt {
|
|
955
|
+
getValue(n) {
|
|
956
|
+
return [n.key, n.key];
|
|
957
|
+
}
|
|
958
|
+
}, dt = (n) => () => n, qe = (n) => {
|
|
959
|
+
const e = n ? (t, i) => i.minus(t).abs().isLessThanOrEqualTo(n) : dt(!1);
|
|
960
|
+
return (t, i) => e(t, i) ? 0 : t.comparedTo(i);
|
|
565
961
|
};
|
|
566
|
-
|
|
962
|
+
function Nt(n) {
|
|
963
|
+
const e = n ? (t, i, r, u, y) => t.exponentiatedBy(2).isLessThanOrEqualTo(
|
|
964
|
+
u.minus(i).exponentiatedBy(2).plus(y.minus(r).exponentiatedBy(2)).times(n)
|
|
965
|
+
) : dt(!1);
|
|
966
|
+
return (t, i, r) => {
|
|
967
|
+
const u = t.x, y = t.y, c = r.x, E = r.y, h = y.minus(E).times(i.x.minus(c)).minus(u.minus(c).times(i.y.minus(E)));
|
|
968
|
+
return e(h, u, y, c, E) ? 0 : h.comparedTo(0);
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
var At = (n) => n, It = (n) => {
|
|
972
|
+
if (n) {
|
|
973
|
+
const e = new Re(qe(n)), t = new Re(qe(n)), i = (u, y) => y.addAndReturn(u), r = (u) => ({
|
|
974
|
+
x: i(u.x, e),
|
|
975
|
+
y: i(u.y, t)
|
|
976
|
+
});
|
|
977
|
+
return r({ x: new ie(0), y: new ie(0) }), r;
|
|
978
|
+
}
|
|
979
|
+
return At;
|
|
980
|
+
}, De = (n) => ({
|
|
981
|
+
set: (e) => {
|
|
982
|
+
oe = De(e);
|
|
983
|
+
},
|
|
984
|
+
reset: () => De(n),
|
|
985
|
+
compare: qe(n),
|
|
986
|
+
snap: It(n),
|
|
987
|
+
orient: Nt(n)
|
|
988
|
+
}), oe = De(), ye = (n, e) => n.ll.x.isLessThanOrEqualTo(e.x) && e.x.isLessThanOrEqualTo(n.ur.x) && n.ll.y.isLessThanOrEqualTo(e.y) && e.y.isLessThanOrEqualTo(n.ur.y), Ue = (n, e) => {
|
|
989
|
+
if (e.ur.x.isLessThan(n.ll.x) || n.ur.x.isLessThan(e.ll.x) || e.ur.y.isLessThan(n.ll.y) || n.ur.y.isLessThan(e.ll.y))
|
|
990
|
+
return null;
|
|
991
|
+
const t = n.ll.x.isLessThan(e.ll.x) ? e.ll.x : n.ll.x, i = n.ur.x.isLessThan(e.ur.x) ? n.ur.x : e.ur.x, r = n.ll.y.isLessThan(e.ll.y) ? e.ll.y : n.ll.y, u = n.ur.y.isLessThan(e.ur.y) ? n.ur.y : e.ur.y;
|
|
992
|
+
return { ll: { x: t, y: r }, ur: { x: i, y: u } };
|
|
993
|
+
}, Me = (n, e) => n.x.times(e.y).minus(n.y.times(e.x)), mt = (n, e) => n.x.times(e.x).plus(n.y.times(e.y)), Ce = (n) => mt(n, n).sqrt(), kt = (n, e, t) => {
|
|
994
|
+
const i = { x: e.x.minus(n.x), y: e.y.minus(n.y) }, r = { x: t.x.minus(n.x), y: t.y.minus(n.y) };
|
|
995
|
+
return Me(r, i).div(Ce(r)).div(Ce(i));
|
|
996
|
+
}, Bt = (n, e, t) => {
|
|
997
|
+
const i = { x: e.x.minus(n.x), y: e.y.minus(n.y) }, r = { x: t.x.minus(n.x), y: t.y.minus(n.y) };
|
|
998
|
+
return mt(r, i).div(Ce(r)).div(Ce(i));
|
|
999
|
+
}, We = (n, e, t) => e.y.isZero() ? null : { x: n.x.plus(e.x.div(e.y).times(t.minus(n.y))), y: t }, He = (n, e, t) => e.x.isZero() ? null : { x: t, y: n.y.plus(e.y.div(e.x).times(t.minus(n.x))) }, Gt = (n, e, t, i) => {
|
|
1000
|
+
if (e.x.isZero()) return He(t, i, n.x);
|
|
1001
|
+
if (i.x.isZero()) return He(n, e, t.x);
|
|
1002
|
+
if (e.y.isZero()) return We(t, i, n.y);
|
|
1003
|
+
if (i.y.isZero()) return We(n, e, t.y);
|
|
1004
|
+
const r = Me(e, i);
|
|
1005
|
+
if (r.isZero()) return null;
|
|
1006
|
+
const u = { x: t.x.minus(n.x), y: t.y.minus(n.y) }, y = Me(u, e).div(r), c = Me(u, i).div(r), E = n.x.plus(c.times(e.x)), h = t.x.plus(y.times(i.x)), b = n.y.plus(c.times(e.y)), _ = t.y.plus(y.times(i.y)), T = E.plus(h).div(2), O = b.plus(_).div(2);
|
|
1007
|
+
return { x: T, y: O };
|
|
1008
|
+
}, ne = class xt {
|
|
1009
|
+
// Warning: 'point' input will be modified and re-used (for performance)
|
|
1010
|
+
constructor(e, t) {
|
|
1011
|
+
M(this, "point");
|
|
1012
|
+
M(this, "isLeft");
|
|
1013
|
+
M(this, "segment");
|
|
1014
|
+
M(this, "otherSE");
|
|
1015
|
+
M(this, "consumedBy");
|
|
1016
|
+
e.events === void 0 ? e.events = [this] : e.events.push(this), this.point = e, this.isLeft = t;
|
|
1017
|
+
}
|
|
567
1018
|
// for ordering sweep events in the sweep event queue
|
|
568
|
-
static compare(
|
|
569
|
-
const
|
|
570
|
-
return
|
|
1019
|
+
static compare(e, t) {
|
|
1020
|
+
const i = xt.comparePoints(e.point, t.point);
|
|
1021
|
+
return i !== 0 ? i : (e.point !== t.point && e.link(t), e.isLeft !== t.isLeft ? e.isLeft ? 1 : -1 : Ne.compare(e.segment, t.segment));
|
|
571
1022
|
}
|
|
572
1023
|
// for ordering points in sweep line order
|
|
573
|
-
static comparePoints(
|
|
574
|
-
return
|
|
575
|
-
}
|
|
576
|
-
// Warning: 'point' input will be modified and re-used (for performance)
|
|
577
|
-
constructor(t, e) {
|
|
578
|
-
t.events === void 0 ? t.events = [this] : t.events.push(this), this.point = t, this.isLeft = e;
|
|
1024
|
+
static comparePoints(e, t) {
|
|
1025
|
+
return e.x.isLessThan(t.x) ? -1 : e.x.isGreaterThan(t.x) ? 1 : e.y.isLessThan(t.y) ? -1 : e.y.isGreaterThan(t.y) ? 1 : 0;
|
|
579
1026
|
}
|
|
580
|
-
link(
|
|
581
|
-
if (
|
|
1027
|
+
link(e) {
|
|
1028
|
+
if (e.point === this.point)
|
|
582
1029
|
throw new Error("Tried to link already linked events");
|
|
583
|
-
const
|
|
584
|
-
for (let
|
|
585
|
-
const
|
|
586
|
-
this.point.events.push(
|
|
1030
|
+
const t = e.point.events;
|
|
1031
|
+
for (let i = 0, r = t.length; i < r; i++) {
|
|
1032
|
+
const u = t[i];
|
|
1033
|
+
this.point.events.push(u), u.point = this.point;
|
|
587
1034
|
}
|
|
588
1035
|
this.checkForConsuming();
|
|
589
1036
|
}
|
|
590
1037
|
/* Do a pass over our linked events and check to see if any pair
|
|
591
1038
|
* of segments match, and should be consumed. */
|
|
592
1039
|
checkForConsuming() {
|
|
593
|
-
const
|
|
594
|
-
for (let
|
|
595
|
-
const
|
|
596
|
-
if (
|
|
597
|
-
for (let r =
|
|
598
|
-
const
|
|
599
|
-
|
|
1040
|
+
const e = this.point.events.length;
|
|
1041
|
+
for (let t = 0; t < e; t++) {
|
|
1042
|
+
const i = this.point.events[t];
|
|
1043
|
+
if (i.segment.consumedBy === void 0)
|
|
1044
|
+
for (let r = t + 1; r < e; r++) {
|
|
1045
|
+
const u = this.point.events[r];
|
|
1046
|
+
u.consumedBy === void 0 && i.otherSE.point.events === u.otherSE.point.events && i.segment.consume(u.segment);
|
|
600
1047
|
}
|
|
601
1048
|
}
|
|
602
1049
|
}
|
|
603
1050
|
getAvailableLinkedEvents() {
|
|
604
|
-
const
|
|
605
|
-
for (let
|
|
606
|
-
const r = this.point.events[
|
|
607
|
-
r !== this && !r.segment.ringOut && r.segment.isInResult() &&
|
|
1051
|
+
const e = [];
|
|
1052
|
+
for (let t = 0, i = this.point.events.length; t < i; t++) {
|
|
1053
|
+
const r = this.point.events[t];
|
|
1054
|
+
r !== this && !r.segment.ringOut && r.segment.isInResult() && e.push(r);
|
|
608
1055
|
}
|
|
609
|
-
return
|
|
1056
|
+
return e;
|
|
610
1057
|
}
|
|
611
1058
|
/**
|
|
612
1059
|
* Returns a comparator function for sorting linked events that will
|
|
@@ -618,29 +1065,303 @@ class L {
|
|
|
618
1065
|
* The comparator function has a compute cache such that it avoids
|
|
619
1066
|
* re-computing already-computed values.
|
|
620
1067
|
*/
|
|
621
|
-
getLeftmostComparator(
|
|
622
|
-
const
|
|
623
|
-
const
|
|
624
|
-
|
|
625
|
-
sine:
|
|
626
|
-
cosine:
|
|
1068
|
+
getLeftmostComparator(e) {
|
|
1069
|
+
const t = /* @__PURE__ */ new Map(), i = (r) => {
|
|
1070
|
+
const u = r.otherSE;
|
|
1071
|
+
t.set(r, {
|
|
1072
|
+
sine: kt(this.point, e.point, u.point),
|
|
1073
|
+
cosine: Bt(this.point, e.point, u.point)
|
|
627
1074
|
});
|
|
628
1075
|
};
|
|
629
|
-
return (r,
|
|
630
|
-
|
|
631
|
-
const {
|
|
632
|
-
|
|
633
|
-
cosine: l
|
|
634
|
-
} = e.get(r), {
|
|
635
|
-
sine: c,
|
|
636
|
-
cosine: u
|
|
637
|
-
} = e.get(o);
|
|
638
|
-
return f >= 0 && c >= 0 ? l < u ? 1 : l > u ? -1 : 0 : f < 0 && c < 0 ? l < u ? -1 : l > u ? 1 : 0 : c < f ? -1 : c > f ? 1 : 0;
|
|
1076
|
+
return (r, u) => {
|
|
1077
|
+
t.has(r) || i(r), t.has(u) || i(u);
|
|
1078
|
+
const { sine: y, cosine: c } = t.get(r), { sine: E, cosine: h } = t.get(u);
|
|
1079
|
+
return y.isGreaterThanOrEqualTo(0) && E.isGreaterThanOrEqualTo(0) ? c.isLessThan(h) ? 1 : c.isGreaterThan(h) ? -1 : 0 : y.isLessThan(0) && E.isLessThan(0) ? c.isLessThan(h) ? -1 : c.isGreaterThan(h) ? 1 : 0 : E.isLessThan(y) ? -1 : E.isGreaterThan(y) ? 1 : 0;
|
|
639
1080
|
};
|
|
640
1081
|
}
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
|
|
1082
|
+
}, $t = class ze {
|
|
1083
|
+
constructor(e) {
|
|
1084
|
+
M(this, "events");
|
|
1085
|
+
M(this, "poly");
|
|
1086
|
+
M(this, "_isExteriorRing");
|
|
1087
|
+
M(this, "_enclosingRing");
|
|
1088
|
+
this.events = e;
|
|
1089
|
+
for (let t = 0, i = e.length; t < i; t++)
|
|
1090
|
+
e[t].segment.ringOut = this;
|
|
1091
|
+
this.poly = null;
|
|
1092
|
+
}
|
|
1093
|
+
/* Given the segments from the sweep line pass, compute & return a series
|
|
1094
|
+
* of closed rings from all the segments marked to be part of the result */
|
|
1095
|
+
static factory(e) {
|
|
1096
|
+
const t = [];
|
|
1097
|
+
for (let i = 0, r = e.length; i < r; i++) {
|
|
1098
|
+
const u = e[i];
|
|
1099
|
+
if (!u.isInResult() || u.ringOut) continue;
|
|
1100
|
+
let y = null, c = u.leftSE, E = u.rightSE;
|
|
1101
|
+
const h = [c], b = c.point, _ = [];
|
|
1102
|
+
for (; y = c, c = E, h.push(c), c.point !== b; )
|
|
1103
|
+
for (; ; ) {
|
|
1104
|
+
const T = c.getAvailableLinkedEvents();
|
|
1105
|
+
if (T.length === 0) {
|
|
1106
|
+
const F = h[0].point, L = h[h.length - 1].point;
|
|
1107
|
+
throw new Error(
|
|
1108
|
+
`Unable to complete output ring starting at [${F.x}, ${F.y}]. Last matching segment found ends at [${L.x}, ${L.y}].`
|
|
1109
|
+
);
|
|
1110
|
+
}
|
|
1111
|
+
if (T.length === 1) {
|
|
1112
|
+
E = T[0].otherSE;
|
|
1113
|
+
break;
|
|
1114
|
+
}
|
|
1115
|
+
let O = null;
|
|
1116
|
+
for (let F = 0, L = _.length; F < L; F++)
|
|
1117
|
+
if (_[F].point === c.point) {
|
|
1118
|
+
O = F;
|
|
1119
|
+
break;
|
|
1120
|
+
}
|
|
1121
|
+
if (O !== null) {
|
|
1122
|
+
const F = _.splice(O)[0], L = h.splice(F.index);
|
|
1123
|
+
L.unshift(L[0].otherSE), t.push(new ze(L.reverse()));
|
|
1124
|
+
continue;
|
|
1125
|
+
}
|
|
1126
|
+
_.push({
|
|
1127
|
+
index: h.length,
|
|
1128
|
+
point: c.point
|
|
1129
|
+
});
|
|
1130
|
+
const G = c.getLeftmostComparator(y);
|
|
1131
|
+
E = T.sort(G)[0].otherSE;
|
|
1132
|
+
break;
|
|
1133
|
+
}
|
|
1134
|
+
t.push(new ze(h));
|
|
1135
|
+
}
|
|
1136
|
+
return t;
|
|
1137
|
+
}
|
|
1138
|
+
getGeom() {
|
|
1139
|
+
let e = this.events[0].point;
|
|
1140
|
+
const t = [e];
|
|
1141
|
+
for (let h = 1, b = this.events.length - 1; h < b; h++) {
|
|
1142
|
+
const _ = this.events[h].point, T = this.events[h + 1].point;
|
|
1143
|
+
oe.orient(_, e, T) !== 0 && (t.push(_), e = _);
|
|
1144
|
+
}
|
|
1145
|
+
if (t.length === 1) return null;
|
|
1146
|
+
const i = t[0], r = t[1];
|
|
1147
|
+
oe.orient(i, e, r) === 0 && t.shift(), t.push(t[0]);
|
|
1148
|
+
const u = this.isExteriorRing() ? 1 : -1, y = this.isExteriorRing() ? 0 : t.length - 1, c = this.isExteriorRing() ? t.length : -1, E = [];
|
|
1149
|
+
for (let h = y; h != c; h += u)
|
|
1150
|
+
E.push([t[h].x.toNumber(), t[h].y.toNumber()]);
|
|
1151
|
+
return E;
|
|
1152
|
+
}
|
|
1153
|
+
isExteriorRing() {
|
|
1154
|
+
if (this._isExteriorRing === void 0) {
|
|
1155
|
+
const e = this.enclosingRing();
|
|
1156
|
+
this._isExteriorRing = e ? !e.isExteriorRing() : !0;
|
|
1157
|
+
}
|
|
1158
|
+
return this._isExteriorRing;
|
|
1159
|
+
}
|
|
1160
|
+
enclosingRing() {
|
|
1161
|
+
return this._enclosingRing === void 0 && (this._enclosingRing = this._calcEnclosingRing()), this._enclosingRing;
|
|
1162
|
+
}
|
|
1163
|
+
/* Returns the ring that encloses this one, if any */
|
|
1164
|
+
_calcEnclosingRing() {
|
|
1165
|
+
var r, u;
|
|
1166
|
+
let e = this.events[0];
|
|
1167
|
+
for (let y = 1, c = this.events.length; y < c; y++) {
|
|
1168
|
+
const E = this.events[y];
|
|
1169
|
+
ne.compare(e, E) > 0 && (e = E);
|
|
1170
|
+
}
|
|
1171
|
+
let t = e.segment.prevInResult(), i = t ? t.prevInResult() : null;
|
|
1172
|
+
for (; ; ) {
|
|
1173
|
+
if (!t) return null;
|
|
1174
|
+
if (!i) return t.ringOut;
|
|
1175
|
+
if (i.ringOut !== t.ringOut)
|
|
1176
|
+
return ((r = i.ringOut) == null ? void 0 : r.enclosingRing()) !== t.ringOut ? t.ringOut : (u = t.ringOut) == null ? void 0 : u.enclosingRing();
|
|
1177
|
+
t = i.prevInResult(), i = t ? t.prevInResult() : null;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
}, Je = class {
|
|
1181
|
+
constructor(n) {
|
|
1182
|
+
M(this, "exteriorRing");
|
|
1183
|
+
M(this, "interiorRings");
|
|
1184
|
+
this.exteriorRing = n, n.poly = this, this.interiorRings = [];
|
|
1185
|
+
}
|
|
1186
|
+
addInterior(n) {
|
|
1187
|
+
this.interiorRings.push(n), n.poly = this;
|
|
1188
|
+
}
|
|
1189
|
+
getGeom() {
|
|
1190
|
+
const n = this.exteriorRing.getGeom();
|
|
1191
|
+
if (n === null) return null;
|
|
1192
|
+
const e = [n];
|
|
1193
|
+
for (let t = 0, i = this.interiorRings.length; t < i; t++) {
|
|
1194
|
+
const r = this.interiorRings[t].getGeom();
|
|
1195
|
+
r !== null && e.push(r);
|
|
1196
|
+
}
|
|
1197
|
+
return e;
|
|
1198
|
+
}
|
|
1199
|
+
}, qt = class {
|
|
1200
|
+
constructor(n) {
|
|
1201
|
+
M(this, "rings");
|
|
1202
|
+
M(this, "polys");
|
|
1203
|
+
this.rings = n, this.polys = this._composePolys(n);
|
|
1204
|
+
}
|
|
1205
|
+
getGeom() {
|
|
1206
|
+
const n = [];
|
|
1207
|
+
for (let e = 0, t = this.polys.length; e < t; e++) {
|
|
1208
|
+
const i = this.polys[e].getGeom();
|
|
1209
|
+
i !== null && n.push(i);
|
|
1210
|
+
}
|
|
1211
|
+
return n;
|
|
1212
|
+
}
|
|
1213
|
+
_composePolys(n) {
|
|
1214
|
+
var t;
|
|
1215
|
+
const e = [];
|
|
1216
|
+
for (let i = 0, r = n.length; i < r; i++) {
|
|
1217
|
+
const u = n[i];
|
|
1218
|
+
if (!u.poly)
|
|
1219
|
+
if (u.isExteriorRing()) e.push(new Je(u));
|
|
1220
|
+
else {
|
|
1221
|
+
const y = u.enclosingRing();
|
|
1222
|
+
y != null && y.poly || e.push(new Je(y)), (t = y == null ? void 0 : y.poly) == null || t.addInterior(u);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
return e;
|
|
1226
|
+
}
|
|
1227
|
+
}, Dt = class {
|
|
1228
|
+
constructor(n, e = Ne.compare) {
|
|
1229
|
+
M(this, "queue");
|
|
1230
|
+
M(this, "tree");
|
|
1231
|
+
M(this, "segments");
|
|
1232
|
+
this.queue = n, this.tree = new Re(e), this.segments = [];
|
|
1233
|
+
}
|
|
1234
|
+
process(n) {
|
|
1235
|
+
const e = n.segment, t = [];
|
|
1236
|
+
if (n.consumedBy)
|
|
1237
|
+
return n.isLeft ? this.queue.delete(n.otherSE) : this.tree.delete(e), t;
|
|
1238
|
+
n.isLeft && this.tree.add(e);
|
|
1239
|
+
let i = e, r = e;
|
|
1240
|
+
do
|
|
1241
|
+
i = this.tree.lastBefore(i);
|
|
1242
|
+
while (i != null && i.consumedBy != null);
|
|
1243
|
+
do
|
|
1244
|
+
r = this.tree.firstAfter(r);
|
|
1245
|
+
while (r != null && r.consumedBy != null);
|
|
1246
|
+
if (n.isLeft) {
|
|
1247
|
+
let u = null;
|
|
1248
|
+
if (i) {
|
|
1249
|
+
const c = i.getIntersection(e);
|
|
1250
|
+
if (c !== null && (e.isAnEndpoint(c) || (u = c), !i.isAnEndpoint(c))) {
|
|
1251
|
+
const E = this._splitSafely(i, c);
|
|
1252
|
+
for (let h = 0, b = E.length; h < b; h++)
|
|
1253
|
+
t.push(E[h]);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
let y = null;
|
|
1257
|
+
if (r) {
|
|
1258
|
+
const c = r.getIntersection(e);
|
|
1259
|
+
if (c !== null && (e.isAnEndpoint(c) || (y = c), !r.isAnEndpoint(c))) {
|
|
1260
|
+
const E = this._splitSafely(r, c);
|
|
1261
|
+
for (let h = 0, b = E.length; h < b; h++)
|
|
1262
|
+
t.push(E[h]);
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
if (u !== null || y !== null) {
|
|
1266
|
+
let c = null;
|
|
1267
|
+
u === null ? c = y : y === null ? c = u : c = ne.comparePoints(
|
|
1268
|
+
u,
|
|
1269
|
+
y
|
|
1270
|
+
) <= 0 ? u : y, this.queue.delete(e.rightSE), t.push(e.rightSE);
|
|
1271
|
+
const E = e.split(c);
|
|
1272
|
+
for (let h = 0, b = E.length; h < b; h++)
|
|
1273
|
+
t.push(E[h]);
|
|
1274
|
+
}
|
|
1275
|
+
t.length > 0 ? (this.tree.delete(e), t.push(n)) : (this.segments.push(e), e.prev = i);
|
|
1276
|
+
} else {
|
|
1277
|
+
if (i && r) {
|
|
1278
|
+
const u = i.getIntersection(r);
|
|
1279
|
+
if (u !== null) {
|
|
1280
|
+
if (!i.isAnEndpoint(u)) {
|
|
1281
|
+
const y = this._splitSafely(i, u);
|
|
1282
|
+
for (let c = 0, E = y.length; c < E; c++)
|
|
1283
|
+
t.push(y[c]);
|
|
1284
|
+
}
|
|
1285
|
+
if (!r.isAnEndpoint(u)) {
|
|
1286
|
+
const y = this._splitSafely(r, u);
|
|
1287
|
+
for (let c = 0, E = y.length; c < E; c++)
|
|
1288
|
+
t.push(y[c]);
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
this.tree.delete(e);
|
|
1293
|
+
}
|
|
1294
|
+
return t;
|
|
1295
|
+
}
|
|
1296
|
+
/* Safely split a segment that is currently in the datastructures
|
|
1297
|
+
* IE - a segment other than the one that is currently being processed. */
|
|
1298
|
+
_splitSafely(n, e) {
|
|
1299
|
+
this.tree.delete(n);
|
|
1300
|
+
const t = n.rightSE;
|
|
1301
|
+
this.queue.delete(t);
|
|
1302
|
+
const i = n.split(e);
|
|
1303
|
+
return i.push(t), n.consumedBy === void 0 && this.tree.add(n), i;
|
|
1304
|
+
}
|
|
1305
|
+
}, Ut = class {
|
|
1306
|
+
constructor() {
|
|
1307
|
+
M(this, "type");
|
|
1308
|
+
M(this, "numMultiPolys");
|
|
1309
|
+
}
|
|
1310
|
+
run(n, e, t) {
|
|
1311
|
+
me.type = n;
|
|
1312
|
+
const i = [new et(e, !0)];
|
|
1313
|
+
for (let h = 0, b = t.length; h < b; h++)
|
|
1314
|
+
i.push(new et(t[h], !1));
|
|
1315
|
+
if (me.numMultiPolys = i.length, me.type === "difference") {
|
|
1316
|
+
const h = i[0];
|
|
1317
|
+
let b = 1;
|
|
1318
|
+
for (; b < i.length; )
|
|
1319
|
+
Ue(i[b].bbox, h.bbox) !== null ? b++ : i.splice(b, 1);
|
|
1320
|
+
}
|
|
1321
|
+
if (me.type === "intersection")
|
|
1322
|
+
for (let h = 0, b = i.length; h < b; h++) {
|
|
1323
|
+
const _ = i[h];
|
|
1324
|
+
for (let T = h + 1, O = i.length; T < O; T++)
|
|
1325
|
+
if (Ue(_.bbox, i[T].bbox) === null) return [];
|
|
1326
|
+
}
|
|
1327
|
+
const r = new Re(ne.compare);
|
|
1328
|
+
for (let h = 0, b = i.length; h < b; h++) {
|
|
1329
|
+
const _ = i[h].getSweepEvents();
|
|
1330
|
+
for (let T = 0, O = _.length; T < O; T++)
|
|
1331
|
+
r.add(_[T]);
|
|
1332
|
+
}
|
|
1333
|
+
const u = new Dt(r);
|
|
1334
|
+
let y = null;
|
|
1335
|
+
for (r.size != 0 && (y = r.first(), r.delete(y)); y; ) {
|
|
1336
|
+
const h = u.process(y);
|
|
1337
|
+
for (let b = 0, _ = h.length; b < _; b++) {
|
|
1338
|
+
const T = h[b];
|
|
1339
|
+
T.consumedBy === void 0 && r.add(T);
|
|
1340
|
+
}
|
|
1341
|
+
r.size != 0 ? (y = r.first(), r.delete(y)) : y = null;
|
|
1342
|
+
}
|
|
1343
|
+
oe.reset();
|
|
1344
|
+
const c = $t.factory(u.segments);
|
|
1345
|
+
return new qt(c).getGeom();
|
|
1346
|
+
}
|
|
1347
|
+
}, me = new Ut(), Oe = me, zt = 0, Ne = class Pe {
|
|
1348
|
+
/* Warning: a reference to ringWindings input will be stored,
|
|
1349
|
+
* and possibly will be later modified */
|
|
1350
|
+
constructor(e, t, i, r) {
|
|
1351
|
+
M(this, "id");
|
|
1352
|
+
M(this, "leftSE");
|
|
1353
|
+
M(this, "rightSE");
|
|
1354
|
+
M(this, "rings");
|
|
1355
|
+
M(this, "windings");
|
|
1356
|
+
M(this, "ringOut");
|
|
1357
|
+
M(this, "consumedBy");
|
|
1358
|
+
M(this, "prev");
|
|
1359
|
+
M(this, "_prevInResult");
|
|
1360
|
+
M(this, "_beforeState");
|
|
1361
|
+
M(this, "_afterState");
|
|
1362
|
+
M(this, "_isInResult");
|
|
1363
|
+
this.id = ++zt, this.leftSE = e, e.segment = this, e.otherSE = t, this.rightSE = t, t.segment = this, t.otherSE = e, this.rings = i, this.windings = r;
|
|
1364
|
+
}
|
|
644
1365
|
/* This compare() function is for ordering segments in the sweep
|
|
645
1366
|
* line tree, and does so according to the following criteria:
|
|
646
1367
|
*
|
|
@@ -654,88 +1375,80 @@ class z {
|
|
|
654
1375
|
* or more of the segments are vertical) then the line to be considered
|
|
655
1376
|
* is directly on the right-more of the two left inputs.
|
|
656
1377
|
*/
|
|
657
|
-
static compare(
|
|
658
|
-
const
|
|
659
|
-
if (
|
|
660
|
-
if (
|
|
661
|
-
const
|
|
662
|
-
if (
|
|
663
|
-
if (c
|
|
664
|
-
if (c
|
|
665
|
-
const
|
|
666
|
-
if (
|
|
667
|
-
if (
|
|
668
|
-
const
|
|
669
|
-
return
|
|
670
|
-
}
|
|
671
|
-
if (
|
|
672
|
-
if (
|
|
673
|
-
if (
|
|
674
|
-
const
|
|
675
|
-
if (
|
|
676
|
-
const
|
|
677
|
-
return
|
|
678
|
-
}
|
|
679
|
-
if (
|
|
680
|
-
if (
|
|
681
|
-
if (
|
|
682
|
-
const
|
|
683
|
-
if (
|
|
684
|
-
}
|
|
685
|
-
if (
|
|
686
|
-
const
|
|
687
|
-
if (
|
|
688
|
-
if (
|
|
689
|
-
}
|
|
690
|
-
if (
|
|
691
|
-
const
|
|
692
|
-
if (
|
|
693
|
-
if (
|
|
694
|
-
}
|
|
695
|
-
return
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
const c = new L(r, !0), u = new L(o, !1);
|
|
711
|
-
return new z(c, u, [n], [f]);
|
|
1378
|
+
static compare(e, t) {
|
|
1379
|
+
const i = e.leftSE.point.x, r = t.leftSE.point.x, u = e.rightSE.point.x, y = t.rightSE.point.x;
|
|
1380
|
+
if (y.isLessThan(i)) return 1;
|
|
1381
|
+
if (u.isLessThan(r)) return -1;
|
|
1382
|
+
const c = e.leftSE.point.y, E = t.leftSE.point.y, h = e.rightSE.point.y, b = t.rightSE.point.y;
|
|
1383
|
+
if (i.isLessThan(r)) {
|
|
1384
|
+
if (E.isLessThan(c) && E.isLessThan(h)) return 1;
|
|
1385
|
+
if (E.isGreaterThan(c) && E.isGreaterThan(h)) return -1;
|
|
1386
|
+
const _ = e.comparePoint(t.leftSE.point);
|
|
1387
|
+
if (_ < 0) return 1;
|
|
1388
|
+
if (_ > 0) return -1;
|
|
1389
|
+
const T = t.comparePoint(e.rightSE.point);
|
|
1390
|
+
return T !== 0 ? T : -1;
|
|
1391
|
+
}
|
|
1392
|
+
if (i.isGreaterThan(r)) {
|
|
1393
|
+
if (c.isLessThan(E) && c.isLessThan(b)) return -1;
|
|
1394
|
+
if (c.isGreaterThan(E) && c.isGreaterThan(b)) return 1;
|
|
1395
|
+
const _ = t.comparePoint(e.leftSE.point);
|
|
1396
|
+
if (_ !== 0) return _;
|
|
1397
|
+
const T = e.comparePoint(t.rightSE.point);
|
|
1398
|
+
return T < 0 ? 1 : T > 0 ? -1 : 1;
|
|
1399
|
+
}
|
|
1400
|
+
if (c.isLessThan(E)) return -1;
|
|
1401
|
+
if (c.isGreaterThan(E)) return 1;
|
|
1402
|
+
if (u.isLessThan(y)) {
|
|
1403
|
+
const _ = t.comparePoint(e.rightSE.point);
|
|
1404
|
+
if (_ !== 0) return _;
|
|
1405
|
+
}
|
|
1406
|
+
if (u.isGreaterThan(y)) {
|
|
1407
|
+
const _ = e.comparePoint(t.rightSE.point);
|
|
1408
|
+
if (_ < 0) return 1;
|
|
1409
|
+
if (_ > 0) return -1;
|
|
1410
|
+
}
|
|
1411
|
+
if (!u.eq(y)) {
|
|
1412
|
+
const _ = h.minus(c), T = u.minus(i), O = b.minus(E), G = y.minus(r);
|
|
1413
|
+
if (_.isGreaterThan(T) && O.isLessThan(G)) return 1;
|
|
1414
|
+
if (_.isLessThan(T) && O.isGreaterThan(G)) return -1;
|
|
1415
|
+
}
|
|
1416
|
+
return u.isGreaterThan(y) ? 1 : u.isLessThan(y) || h.isLessThan(b) ? -1 : h.isGreaterThan(b) ? 1 : e.id < t.id ? -1 : e.id > t.id ? 1 : 0;
|
|
1417
|
+
}
|
|
1418
|
+
static fromRing(e, t, i) {
|
|
1419
|
+
let r, u, y;
|
|
1420
|
+
const c = ne.comparePoints(e, t);
|
|
1421
|
+
if (c < 0)
|
|
1422
|
+
r = e, u = t, y = 1;
|
|
1423
|
+
else if (c > 0)
|
|
1424
|
+
r = t, u = e, y = -1;
|
|
1425
|
+
else
|
|
1426
|
+
throw new Error(
|
|
1427
|
+
`Tried to create degenerate segment at [${e.x}, ${e.y}]`
|
|
1428
|
+
);
|
|
1429
|
+
const E = new ne(r, !0), h = new ne(u, !1);
|
|
1430
|
+
return new Pe(E, h, [i], [y]);
|
|
712
1431
|
}
|
|
713
1432
|
/* When a segment is split, the rightSE is replaced with a new sweep event */
|
|
714
|
-
replaceRightSE(
|
|
715
|
-
this.rightSE =
|
|
1433
|
+
replaceRightSE(e) {
|
|
1434
|
+
this.rightSE = e, this.rightSE.segment = this, this.rightSE.otherSE = this.leftSE, this.leftSE.otherSE = this.rightSE;
|
|
716
1435
|
}
|
|
717
1436
|
bbox() {
|
|
718
|
-
const
|
|
1437
|
+
const e = this.leftSE.point.y, t = this.rightSE.point.y;
|
|
719
1438
|
return {
|
|
720
|
-
ll: {
|
|
721
|
-
|
|
722
|
-
y: t < e ? t : e
|
|
723
|
-
},
|
|
724
|
-
ur: {
|
|
725
|
-
x: this.rightSE.point.x,
|
|
726
|
-
y: t > e ? t : e
|
|
727
|
-
}
|
|
1439
|
+
ll: { x: this.leftSE.point.x, y: e.isLessThan(t) ? e : t },
|
|
1440
|
+
ur: { x: this.rightSE.point.x, y: e.isGreaterThan(t) ? e : t }
|
|
728
1441
|
};
|
|
729
1442
|
}
|
|
730
1443
|
/* A vector from the left point to the right */
|
|
731
1444
|
vector() {
|
|
732
1445
|
return {
|
|
733
|
-
x: this.rightSE.point.x
|
|
734
|
-
y: this.rightSE.point.y
|
|
1446
|
+
x: this.rightSE.point.x.minus(this.leftSE.point.x),
|
|
1447
|
+
y: this.rightSE.point.y.minus(this.leftSE.point.y)
|
|
735
1448
|
};
|
|
736
1449
|
}
|
|
737
|
-
isAnEndpoint(
|
|
738
|
-
return
|
|
1450
|
+
isAnEndpoint(e) {
|
|
1451
|
+
return e.x.eq(this.leftSE.point.x) && e.y.eq(this.leftSE.point.y) || e.x.eq(this.rightSE.point.x) && e.y.eq(this.rightSE.point.y);
|
|
739
1452
|
}
|
|
740
1453
|
/* Compare this segment with a point.
|
|
741
1454
|
*
|
|
@@ -750,15 +1463,8 @@ class z {
|
|
|
750
1463
|
* 0: point is colinear to segment
|
|
751
1464
|
* -1: point lies below the segment (to the right of vertical)
|
|
752
1465
|
*/
|
|
753
|
-
comparePoint(
|
|
754
|
-
|
|
755
|
-
const e = this.leftSE.point, n = this.rightSE.point, r = this.vector();
|
|
756
|
-
if (e.x === n.x)
|
|
757
|
-
return t.x === e.x ? 0 : t.x < e.x ? 1 : -1;
|
|
758
|
-
const o = (t.y - e.y) / r.y, f = e.x + o * r.x;
|
|
759
|
-
if (t.x === f) return 0;
|
|
760
|
-
const l = (t.x - e.x) / r.x, c = e.y + l * r.y;
|
|
761
|
-
return t.y === c ? 0 : t.y < c ? -1 : 1;
|
|
1466
|
+
comparePoint(e) {
|
|
1467
|
+
return oe.orient(this.leftSE.point, e, this.rightSE.point);
|
|
762
1468
|
}
|
|
763
1469
|
/**
|
|
764
1470
|
* Given another segment, returns the first non-trivial intersection
|
|
@@ -775,21 +1481,21 @@ class z {
|
|
|
775
1481
|
* If no non-trivial intersection exists, return null
|
|
776
1482
|
* Else, return null.
|
|
777
1483
|
*/
|
|
778
|
-
getIntersection(
|
|
779
|
-
const
|
|
1484
|
+
getIntersection(e) {
|
|
1485
|
+
const t = this.bbox(), i = e.bbox(), r = Ue(t, i);
|
|
780
1486
|
if (r === null) return null;
|
|
781
|
-
const
|
|
782
|
-
if (
|
|
783
|
-
return
|
|
784
|
-
if (
|
|
785
|
-
return
|
|
786
|
-
if (
|
|
787
|
-
return
|
|
788
|
-
if (
|
|
789
|
-
if (
|
|
790
|
-
if (
|
|
791
|
-
const
|
|
792
|
-
return
|
|
1487
|
+
const u = this.leftSE.point, y = this.rightSE.point, c = e.leftSE.point, E = e.rightSE.point, h = ye(t, c) && this.comparePoint(c) === 0, b = ye(i, u) && e.comparePoint(u) === 0, _ = ye(t, E) && this.comparePoint(E) === 0, T = ye(i, y) && e.comparePoint(y) === 0;
|
|
1488
|
+
if (b && h)
|
|
1489
|
+
return T && !_ ? y : !T && _ ? E : null;
|
|
1490
|
+
if (b)
|
|
1491
|
+
return _ && u.x.eq(E.x) && u.y.eq(E.y) ? null : u;
|
|
1492
|
+
if (h)
|
|
1493
|
+
return T && y.x.eq(c.x) && y.y.eq(c.y) ? null : c;
|
|
1494
|
+
if (T && _) return null;
|
|
1495
|
+
if (T) return y;
|
|
1496
|
+
if (_) return E;
|
|
1497
|
+
const O = Gt(u, this.vector(), c, e.vector());
|
|
1498
|
+
return O === null || !ye(r, O) ? null : oe.snap(O);
|
|
793
1499
|
}
|
|
794
1500
|
/**
|
|
795
1501
|
* Split the given segment into multiple segments on the given points.
|
|
@@ -803,40 +1509,45 @@ class z {
|
|
|
803
1509
|
*
|
|
804
1510
|
* Warning: input array of points is modified
|
|
805
1511
|
*/
|
|
806
|
-
split(
|
|
807
|
-
const
|
|
808
|
-
this.replaceRightSE(
|
|
809
|
-
const
|
|
810
|
-
|
|
1512
|
+
split(e) {
|
|
1513
|
+
const t = [], i = e.events !== void 0, r = new ne(e, !0), u = new ne(e, !1), y = this.rightSE;
|
|
1514
|
+
this.replaceRightSE(u), t.push(u), t.push(r);
|
|
1515
|
+
const c = new Pe(
|
|
1516
|
+
r,
|
|
1517
|
+
y,
|
|
1518
|
+
this.rings.slice(),
|
|
1519
|
+
this.windings.slice()
|
|
1520
|
+
);
|
|
1521
|
+
return ne.comparePoints(c.leftSE.point, c.rightSE.point) > 0 && c.swapEvents(), ne.comparePoints(this.leftSE.point, this.rightSE.point) > 0 && this.swapEvents(), i && (r.checkForConsuming(), u.checkForConsuming()), t;
|
|
811
1522
|
}
|
|
812
1523
|
/* Swap which event is left and right */
|
|
813
1524
|
swapEvents() {
|
|
814
|
-
const
|
|
815
|
-
this.rightSE = this.leftSE, this.leftSE =
|
|
816
|
-
for (let
|
|
817
|
-
this.windings[
|
|
1525
|
+
const e = this.rightSE;
|
|
1526
|
+
this.rightSE = this.leftSE, this.leftSE = e, this.leftSE.isLeft = !0, this.rightSE.isLeft = !1;
|
|
1527
|
+
for (let t = 0, i = this.windings.length; t < i; t++)
|
|
1528
|
+
this.windings[t] *= -1;
|
|
818
1529
|
}
|
|
819
1530
|
/* Consume another segment. We take their rings under our wing
|
|
820
1531
|
* and mark them as consumed. Use for perfectly overlapping segments */
|
|
821
|
-
consume(
|
|
822
|
-
let
|
|
823
|
-
for (;
|
|
824
|
-
for (;
|
|
825
|
-
const r =
|
|
1532
|
+
consume(e) {
|
|
1533
|
+
let t = this, i = e;
|
|
1534
|
+
for (; t.consumedBy; ) t = t.consumedBy;
|
|
1535
|
+
for (; i.consumedBy; ) i = i.consumedBy;
|
|
1536
|
+
const r = Pe.compare(t, i);
|
|
826
1537
|
if (r !== 0) {
|
|
827
1538
|
if (r > 0) {
|
|
828
|
-
const
|
|
829
|
-
|
|
1539
|
+
const u = t;
|
|
1540
|
+
t = i, i = u;
|
|
830
1541
|
}
|
|
831
|
-
if (
|
|
832
|
-
const
|
|
833
|
-
|
|
1542
|
+
if (t.prev === i) {
|
|
1543
|
+
const u = t;
|
|
1544
|
+
t = i, i = u;
|
|
834
1545
|
}
|
|
835
|
-
for (let
|
|
836
|
-
const
|
|
837
|
-
|
|
1546
|
+
for (let u = 0, y = i.rings.length; u < y; u++) {
|
|
1547
|
+
const c = i.rings[u], E = i.windings[u], h = t.rings.indexOf(c);
|
|
1548
|
+
h === -1 ? (t.rings.push(c), t.windings.push(E)) : t.windings[h] += E;
|
|
838
1549
|
}
|
|
839
|
-
|
|
1550
|
+
i.rings = null, i.windings = null, i.consumedBy = t, i.leftSE.consumedBy = t.leftSE, i.rightSE.consumedBy = t.rightSE;
|
|
840
1551
|
}
|
|
841
1552
|
}
|
|
842
1553
|
/* The first segment previous segment chain that is in the result */
|
|
@@ -845,45 +1556,46 @@ class z {
|
|
|
845
1556
|
}
|
|
846
1557
|
beforeState() {
|
|
847
1558
|
if (this._beforeState !== void 0) return this._beforeState;
|
|
848
|
-
if (!this.prev)
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
1559
|
+
if (!this.prev)
|
|
1560
|
+
this._beforeState = {
|
|
1561
|
+
rings: [],
|
|
1562
|
+
windings: [],
|
|
1563
|
+
multiPolys: []
|
|
1564
|
+
};
|
|
853
1565
|
else {
|
|
854
|
-
const
|
|
855
|
-
this._beforeState =
|
|
1566
|
+
const e = this.prev.consumedBy || this.prev;
|
|
1567
|
+
this._beforeState = e.afterState();
|
|
856
1568
|
}
|
|
857
1569
|
return this._beforeState;
|
|
858
1570
|
}
|
|
859
1571
|
afterState() {
|
|
860
1572
|
if (this._afterState !== void 0) return this._afterState;
|
|
861
|
-
const
|
|
1573
|
+
const e = this.beforeState();
|
|
862
1574
|
this._afterState = {
|
|
863
|
-
rings:
|
|
864
|
-
windings:
|
|
1575
|
+
rings: e.rings.slice(0),
|
|
1576
|
+
windings: e.windings.slice(0),
|
|
865
1577
|
multiPolys: []
|
|
866
1578
|
};
|
|
867
|
-
const
|
|
868
|
-
for (let
|
|
869
|
-
const
|
|
870
|
-
|
|
871
|
-
}
|
|
872
|
-
const
|
|
873
|
-
for (let
|
|
874
|
-
if (
|
|
875
|
-
const
|
|
876
|
-
if (
|
|
877
|
-
if (
|
|
1579
|
+
const t = this._afterState.rings, i = this._afterState.windings, r = this._afterState.multiPolys;
|
|
1580
|
+
for (let c = 0, E = this.rings.length; c < E; c++) {
|
|
1581
|
+
const h = this.rings[c], b = this.windings[c], _ = t.indexOf(h);
|
|
1582
|
+
_ === -1 ? (t.push(h), i.push(b)) : i[_] += b;
|
|
1583
|
+
}
|
|
1584
|
+
const u = [], y = [];
|
|
1585
|
+
for (let c = 0, E = t.length; c < E; c++) {
|
|
1586
|
+
if (i[c] === 0) continue;
|
|
1587
|
+
const h = t[c], b = h.poly;
|
|
1588
|
+
if (y.indexOf(b) === -1)
|
|
1589
|
+
if (h.isExterior) u.push(b);
|
|
878
1590
|
else {
|
|
879
|
-
|
|
880
|
-
const
|
|
881
|
-
|
|
1591
|
+
y.indexOf(b) === -1 && y.push(b);
|
|
1592
|
+
const _ = u.indexOf(h.poly);
|
|
1593
|
+
_ !== -1 && u.splice(_, 1);
|
|
882
1594
|
}
|
|
883
1595
|
}
|
|
884
|
-
for (let
|
|
885
|
-
const
|
|
886
|
-
r.indexOf(
|
|
1596
|
+
for (let c = 0, E = u.length; c < E; c++) {
|
|
1597
|
+
const h = u[c].multiPoly;
|
|
1598
|
+
r.indexOf(h) === -1 && r.push(h);
|
|
887
1599
|
}
|
|
888
1600
|
return this._afterState;
|
|
889
1601
|
}
|
|
@@ -891,491 +1603,200 @@ class z {
|
|
|
891
1603
|
isInResult() {
|
|
892
1604
|
if (this.consumedBy) return !1;
|
|
893
1605
|
if (this._isInResult !== void 0) return this._isInResult;
|
|
894
|
-
const
|
|
895
|
-
switch (
|
|
1606
|
+
const e = this.beforeState().multiPolys, t = this.afterState().multiPolys;
|
|
1607
|
+
switch (Oe.type) {
|
|
896
1608
|
case "union": {
|
|
897
|
-
const
|
|
898
|
-
this._isInResult =
|
|
1609
|
+
const i = e.length === 0, r = t.length === 0;
|
|
1610
|
+
this._isInResult = i !== r;
|
|
899
1611
|
break;
|
|
900
1612
|
}
|
|
901
1613
|
case "intersection": {
|
|
902
|
-
let
|
|
903
|
-
|
|
1614
|
+
let i, r;
|
|
1615
|
+
e.length < t.length ? (i = e.length, r = t.length) : (i = t.length, r = e.length), this._isInResult = r === Oe.numMultiPolys && i < r;
|
|
904
1616
|
break;
|
|
905
1617
|
}
|
|
906
1618
|
case "xor": {
|
|
907
|
-
const
|
|
908
|
-
this._isInResult =
|
|
1619
|
+
const i = Math.abs(e.length - t.length);
|
|
1620
|
+
this._isInResult = i % 2 === 1;
|
|
909
1621
|
break;
|
|
910
1622
|
}
|
|
911
1623
|
case "difference": {
|
|
912
|
-
const
|
|
913
|
-
this._isInResult =
|
|
1624
|
+
const i = (r) => r.length === 1 && r[0].isSubject;
|
|
1625
|
+
this._isInResult = i(e) !== i(t);
|
|
914
1626
|
break;
|
|
915
1627
|
}
|
|
916
|
-
default:
|
|
917
|
-
throw new Error(`Unrecognized operation type found ${$.type}`);
|
|
918
1628
|
}
|
|
919
1629
|
return this._isInResult;
|
|
920
1630
|
}
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
1631
|
+
}, Qe = class {
|
|
1632
|
+
constructor(n, e, t) {
|
|
1633
|
+
M(this, "poly");
|
|
1634
|
+
M(this, "isExterior");
|
|
1635
|
+
M(this, "segments");
|
|
1636
|
+
M(this, "bbox");
|
|
1637
|
+
if (!Array.isArray(n) || n.length === 0)
|
|
925
1638
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
926
|
-
if (this.poly = e, this.isExterior =
|
|
1639
|
+
if (this.poly = e, this.isExterior = t, this.segments = [], typeof n[0][0] != "number" || typeof n[0][1] != "number")
|
|
927
1640
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
928
|
-
const
|
|
1641
|
+
const i = oe.snap({ x: new ie(n[0][0]), y: new ie(n[0][1]) });
|
|
929
1642
|
this.bbox = {
|
|
930
|
-
ll: {
|
|
931
|
-
|
|
932
|
-
y: r.y
|
|
933
|
-
},
|
|
934
|
-
ur: {
|
|
935
|
-
x: r.x,
|
|
936
|
-
y: r.y
|
|
937
|
-
}
|
|
1643
|
+
ll: { x: i.x, y: i.y },
|
|
1644
|
+
ur: { x: i.x, y: i.y }
|
|
938
1645
|
};
|
|
939
|
-
let
|
|
940
|
-
for (let
|
|
941
|
-
if (typeof
|
|
1646
|
+
let r = i;
|
|
1647
|
+
for (let u = 1, y = n.length; u < y; u++) {
|
|
1648
|
+
if (typeof n[u][0] != "number" || typeof n[u][1] != "number")
|
|
942
1649
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
943
|
-
|
|
944
|
-
c.x
|
|
1650
|
+
const c = oe.snap({ x: new ie(n[u][0]), y: new ie(n[u][1]) });
|
|
1651
|
+
c.x.eq(r.x) && c.y.eq(r.y) || (this.segments.push(Ne.fromRing(r, c, this)), c.x.isLessThan(this.bbox.ll.x) && (this.bbox.ll.x = c.x), c.y.isLessThan(this.bbox.ll.y) && (this.bbox.ll.y = c.y), c.x.isGreaterThan(this.bbox.ur.x) && (this.bbox.ur.x = c.x), c.y.isGreaterThan(this.bbox.ur.y) && (this.bbox.ur.y = c.y), r = c);
|
|
945
1652
|
}
|
|
946
|
-
(
|
|
1653
|
+
(!i.x.eq(r.x) || !i.y.eq(r.y)) && this.segments.push(Ne.fromRing(r, i, this));
|
|
947
1654
|
}
|
|
948
1655
|
getSweepEvents() {
|
|
949
|
-
const
|
|
950
|
-
for (let e = 0,
|
|
951
|
-
const
|
|
952
|
-
|
|
1656
|
+
const n = [];
|
|
1657
|
+
for (let e = 0, t = this.segments.length; e < t; e++) {
|
|
1658
|
+
const i = this.segments[e];
|
|
1659
|
+
n.push(i.leftSE), n.push(i.rightSE);
|
|
953
1660
|
}
|
|
954
|
-
return
|
|
1661
|
+
return n;
|
|
955
1662
|
}
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1663
|
+
}, Ft = class {
|
|
1664
|
+
constructor(n, e) {
|
|
1665
|
+
M(this, "multiPoly");
|
|
1666
|
+
M(this, "exteriorRing");
|
|
1667
|
+
M(this, "interiorRings");
|
|
1668
|
+
M(this, "bbox");
|
|
1669
|
+
if (!Array.isArray(n))
|
|
960
1670
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
961
|
-
this.exteriorRing = new
|
|
962
|
-
ll: {
|
|
963
|
-
|
|
964
|
-
y: this.exteriorRing.bbox.ll.y
|
|
965
|
-
},
|
|
966
|
-
ur: {
|
|
967
|
-
x: this.exteriorRing.bbox.ur.x,
|
|
968
|
-
y: this.exteriorRing.bbox.ur.y
|
|
969
|
-
}
|
|
1671
|
+
this.exteriorRing = new Qe(n[0], this, !0), this.bbox = {
|
|
1672
|
+
ll: { x: this.exteriorRing.bbox.ll.x, y: this.exteriorRing.bbox.ll.y },
|
|
1673
|
+
ur: { x: this.exteriorRing.bbox.ur.x, y: this.exteriorRing.bbox.ur.y }
|
|
970
1674
|
}, this.interiorRings = [];
|
|
971
|
-
for (let
|
|
972
|
-
const
|
|
973
|
-
|
|
1675
|
+
for (let t = 1, i = n.length; t < i; t++) {
|
|
1676
|
+
const r = new Qe(n[t], this, !1);
|
|
1677
|
+
r.bbox.ll.x.isLessThan(this.bbox.ll.x) && (this.bbox.ll.x = r.bbox.ll.x), r.bbox.ll.y.isLessThan(this.bbox.ll.y) && (this.bbox.ll.y = r.bbox.ll.y), r.bbox.ur.x.isGreaterThan(this.bbox.ur.x) && (this.bbox.ur.x = r.bbox.ur.x), r.bbox.ur.y.isGreaterThan(this.bbox.ur.y) && (this.bbox.ur.y = r.bbox.ur.y), this.interiorRings.push(r);
|
|
974
1678
|
}
|
|
975
1679
|
this.multiPoly = e;
|
|
976
1680
|
}
|
|
977
1681
|
getSweepEvents() {
|
|
978
|
-
const
|
|
979
|
-
for (let e = 0,
|
|
980
|
-
const
|
|
981
|
-
for (let
|
|
982
|
-
|
|
1682
|
+
const n = this.exteriorRing.getSweepEvents();
|
|
1683
|
+
for (let e = 0, t = this.interiorRings.length; e < t; e++) {
|
|
1684
|
+
const i = this.interiorRings[e].getSweepEvents();
|
|
1685
|
+
for (let r = 0, u = i.length; r < u; r++)
|
|
1686
|
+
n.push(i[r]);
|
|
983
1687
|
}
|
|
984
|
-
return
|
|
1688
|
+
return n;
|
|
985
1689
|
}
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1690
|
+
}, et = class {
|
|
1691
|
+
constructor(n, e) {
|
|
1692
|
+
M(this, "isSubject");
|
|
1693
|
+
M(this, "polys");
|
|
1694
|
+
M(this, "bbox");
|
|
1695
|
+
if (!Array.isArray(n))
|
|
990
1696
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
991
1697
|
try {
|
|
992
|
-
typeof
|
|
1698
|
+
typeof n[0][0][0] == "number" && (n = [n]);
|
|
993
1699
|
} catch {
|
|
994
1700
|
}
|
|
995
1701
|
this.polys = [], this.bbox = {
|
|
996
|
-
ll: {
|
|
997
|
-
|
|
998
|
-
y: Number.POSITIVE_INFINITY
|
|
999
|
-
},
|
|
1000
|
-
ur: {
|
|
1001
|
-
x: Number.NEGATIVE_INFINITY,
|
|
1002
|
-
y: Number.NEGATIVE_INFINITY
|
|
1003
|
-
}
|
|
1702
|
+
ll: { x: new ie(Number.POSITIVE_INFINITY), y: new ie(Number.POSITIVE_INFINITY) },
|
|
1703
|
+
ur: { x: new ie(Number.NEGATIVE_INFINITY), y: new ie(Number.NEGATIVE_INFINITY) }
|
|
1004
1704
|
};
|
|
1005
|
-
for (let
|
|
1006
|
-
const
|
|
1007
|
-
|
|
1705
|
+
for (let t = 0, i = n.length; t < i; t++) {
|
|
1706
|
+
const r = new Ft(n[t], this);
|
|
1707
|
+
r.bbox.ll.x.isLessThan(this.bbox.ll.x) && (this.bbox.ll.x = r.bbox.ll.x), r.bbox.ll.y.isLessThan(this.bbox.ll.y) && (this.bbox.ll.y = r.bbox.ll.y), r.bbox.ur.x.isGreaterThan(this.bbox.ur.x) && (this.bbox.ur.x = r.bbox.ur.x), r.bbox.ur.y.isGreaterThan(this.bbox.ur.y) && (this.bbox.ur.y = r.bbox.ur.y), this.polys.push(r);
|
|
1008
1708
|
}
|
|
1009
1709
|
this.isSubject = e;
|
|
1010
1710
|
}
|
|
1011
1711
|
getSweepEvents() {
|
|
1012
|
-
const
|
|
1013
|
-
for (let e = 0,
|
|
1014
|
-
const
|
|
1015
|
-
for (let
|
|
1016
|
-
|
|
1017
|
-
}
|
|
1018
|
-
return t;
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
class nt {
|
|
1022
|
-
/* Given the segments from the sweep line pass, compute & return a series
|
|
1023
|
-
* of closed rings from all the segments marked to be part of the result */
|
|
1024
|
-
static factory(t) {
|
|
1025
|
-
const e = [];
|
|
1026
|
-
for (let n = 0, r = t.length; n < r; n++) {
|
|
1027
|
-
const o = t[n];
|
|
1028
|
-
if (!o.isInResult() || o.ringOut) continue;
|
|
1029
|
-
let f = null, l = o.leftSE, c = o.rightSE;
|
|
1030
|
-
const u = [l], g = l.point, s = [];
|
|
1031
|
-
for (; f = l, l = c, u.push(l), l.point !== g; )
|
|
1032
|
-
for (; ; ) {
|
|
1033
|
-
const h = l.getAvailableLinkedEvents();
|
|
1034
|
-
if (h.length === 0) {
|
|
1035
|
-
const x = u[0].point, p = u[u.length - 1].point;
|
|
1036
|
-
throw new Error(`Unable to complete output ring starting at [${x.x}, ${x.y}]. Last matching segment found ends at [${p.x}, ${p.y}].`);
|
|
1037
|
-
}
|
|
1038
|
-
if (h.length === 1) {
|
|
1039
|
-
c = h[0].otherSE;
|
|
1040
|
-
break;
|
|
1041
|
-
}
|
|
1042
|
-
let a = null;
|
|
1043
|
-
for (let x = 0, p = s.length; x < p; x++)
|
|
1044
|
-
if (s[x].point === l.point) {
|
|
1045
|
-
a = x;
|
|
1046
|
-
break;
|
|
1047
|
-
}
|
|
1048
|
-
if (a !== null) {
|
|
1049
|
-
const x = s.splice(a)[0], p = u.splice(x.index);
|
|
1050
|
-
p.unshift(p[0].otherSE), e.push(new nt(p.reverse()));
|
|
1051
|
-
continue;
|
|
1052
|
-
}
|
|
1053
|
-
s.push({
|
|
1054
|
-
index: u.length,
|
|
1055
|
-
point: l.point
|
|
1056
|
-
});
|
|
1057
|
-
const d = l.getLeftmostComparator(f);
|
|
1058
|
-
c = h.sort(d)[0].otherSE;
|
|
1059
|
-
break;
|
|
1060
|
-
}
|
|
1061
|
-
e.push(new nt(u));
|
|
1062
|
-
}
|
|
1063
|
-
return e;
|
|
1064
|
-
}
|
|
1065
|
-
constructor(t) {
|
|
1066
|
-
this.events = t;
|
|
1067
|
-
for (let e = 0, n = t.length; e < n; e++)
|
|
1068
|
-
t[e].segment.ringOut = this;
|
|
1069
|
-
this.poly = null;
|
|
1070
|
-
}
|
|
1071
|
-
getGeom() {
|
|
1072
|
-
let t = this.events[0].point;
|
|
1073
|
-
const e = [t];
|
|
1074
|
-
for (let u = 1, g = this.events.length - 1; u < g; u++) {
|
|
1075
|
-
const s = this.events[u].point, h = this.events[u + 1].point;
|
|
1076
|
-
Pt(s, t, h) !== 0 && (e.push(s), t = s);
|
|
1077
|
-
}
|
|
1078
|
-
if (e.length === 1) return null;
|
|
1079
|
-
const n = e[0], r = e[1];
|
|
1080
|
-
Pt(n, t, r) === 0 && e.shift(), e.push(e[0]);
|
|
1081
|
-
const o = this.isExteriorRing() ? 1 : -1, f = this.isExteriorRing() ? 0 : e.length - 1, l = this.isExteriorRing() ? e.length : -1, c = [];
|
|
1082
|
-
for (let u = f; u != l; u += o) c.push([e[u].x, e[u].y]);
|
|
1083
|
-
return c;
|
|
1084
|
-
}
|
|
1085
|
-
isExteriorRing() {
|
|
1086
|
-
if (this._isExteriorRing === void 0) {
|
|
1087
|
-
const t = this.enclosingRing();
|
|
1088
|
-
this._isExteriorRing = t ? !t.isExteriorRing() : !0;
|
|
1089
|
-
}
|
|
1090
|
-
return this._isExteriorRing;
|
|
1091
|
-
}
|
|
1092
|
-
enclosingRing() {
|
|
1093
|
-
return this._enclosingRing === void 0 && (this._enclosingRing = this._calcEnclosingRing()), this._enclosingRing;
|
|
1094
|
-
}
|
|
1095
|
-
/* Returns the ring that encloses this one, if any */
|
|
1096
|
-
_calcEnclosingRing() {
|
|
1097
|
-
let t = this.events[0];
|
|
1098
|
-
for (let r = 1, o = this.events.length; r < o; r++) {
|
|
1099
|
-
const f = this.events[r];
|
|
1100
|
-
L.compare(t, f) > 0 && (t = f);
|
|
1101
|
-
}
|
|
1102
|
-
let e = t.segment.prevInResult(), n = e ? e.prevInResult() : null;
|
|
1103
|
-
for (; ; ) {
|
|
1104
|
-
if (!e) return null;
|
|
1105
|
-
if (!n) return e.ringOut;
|
|
1106
|
-
if (n.ringOut !== e.ringOut)
|
|
1107
|
-
return n.ringOut.enclosingRing() !== e.ringOut ? e.ringOut : e.ringOut.enclosingRing();
|
|
1108
|
-
e = n.prevInResult(), n = e ? e.prevInResult() : null;
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
class Ct {
|
|
1113
|
-
constructor(t) {
|
|
1114
|
-
this.exteriorRing = t, t.poly = this, this.interiorRings = [];
|
|
1115
|
-
}
|
|
1116
|
-
addInterior(t) {
|
|
1117
|
-
this.interiorRings.push(t), t.poly = this;
|
|
1118
|
-
}
|
|
1119
|
-
getGeom() {
|
|
1120
|
-
const t = [this.exteriorRing.getGeom()];
|
|
1121
|
-
if (t[0] === null) return null;
|
|
1122
|
-
for (let e = 0, n = this.interiorRings.length; e < n; e++) {
|
|
1123
|
-
const r = this.interiorRings[e].getGeom();
|
|
1124
|
-
r !== null && t.push(r);
|
|
1125
|
-
}
|
|
1126
|
-
return t;
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
class be {
|
|
1130
|
-
constructor(t) {
|
|
1131
|
-
this.rings = t, this.polys = this._composePolys(t);
|
|
1132
|
-
}
|
|
1133
|
-
getGeom() {
|
|
1134
|
-
const t = [];
|
|
1135
|
-
for (let e = 0, n = this.polys.length; e < n; e++) {
|
|
1136
|
-
const r = this.polys[e].getGeom();
|
|
1137
|
-
r !== null && t.push(r);
|
|
1138
|
-
}
|
|
1139
|
-
return t;
|
|
1140
|
-
}
|
|
1141
|
-
_composePolys(t) {
|
|
1142
|
-
const e = [];
|
|
1143
|
-
for (let n = 0, r = t.length; n < r; n++) {
|
|
1144
|
-
const o = t[n];
|
|
1145
|
-
if (!o.poly)
|
|
1146
|
-
if (o.isExteriorRing()) e.push(new Ct(o));
|
|
1147
|
-
else {
|
|
1148
|
-
const f = o.enclosingRing();
|
|
1149
|
-
f.poly || e.push(new Ct(f)), f.poly.addInterior(o);
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
return e;
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
class _e {
|
|
1156
|
-
constructor(t) {
|
|
1157
|
-
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : z.compare;
|
|
1158
|
-
this.queue = t, this.tree = new dt(e), this.segments = [];
|
|
1159
|
-
}
|
|
1160
|
-
process(t) {
|
|
1161
|
-
const e = t.segment, n = [];
|
|
1162
|
-
if (t.consumedBy)
|
|
1163
|
-
return t.isLeft ? this.queue.remove(t.otherSE) : this.tree.remove(e), n;
|
|
1164
|
-
const r = t.isLeft ? this.tree.add(e) : this.tree.find(e);
|
|
1165
|
-
if (!r) throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);
|
|
1166
|
-
let o = r, f = r, l, c;
|
|
1167
|
-
for (; l === void 0; )
|
|
1168
|
-
o = this.tree.prev(o), o === null ? l = null : o.key.consumedBy === void 0 && (l = o.key);
|
|
1169
|
-
for (; c === void 0; )
|
|
1170
|
-
f = this.tree.next(f), f === null ? c = null : f.key.consumedBy === void 0 && (c = f.key);
|
|
1171
|
-
if (t.isLeft) {
|
|
1172
|
-
let u = null;
|
|
1173
|
-
if (l) {
|
|
1174
|
-
const s = l.getIntersection(e);
|
|
1175
|
-
if (s !== null && (e.isAnEndpoint(s) || (u = s), !l.isAnEndpoint(s))) {
|
|
1176
|
-
const h = this._splitSafely(l, s);
|
|
1177
|
-
for (let a = 0, d = h.length; a < d; a++)
|
|
1178
|
-
n.push(h[a]);
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
let g = null;
|
|
1182
|
-
if (c) {
|
|
1183
|
-
const s = c.getIntersection(e);
|
|
1184
|
-
if (s !== null && (e.isAnEndpoint(s) || (g = s), !c.isAnEndpoint(s))) {
|
|
1185
|
-
const h = this._splitSafely(c, s);
|
|
1186
|
-
for (let a = 0, d = h.length; a < d; a++)
|
|
1187
|
-
n.push(h[a]);
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
if (u !== null || g !== null) {
|
|
1191
|
-
let s = null;
|
|
1192
|
-
u === null ? s = g : g === null ? s = u : s = L.comparePoints(u, g) <= 0 ? u : g, this.queue.remove(e.rightSE), n.push(e.rightSE);
|
|
1193
|
-
const h = e.split(s);
|
|
1194
|
-
for (let a = 0, d = h.length; a < d; a++)
|
|
1195
|
-
n.push(h[a]);
|
|
1196
|
-
}
|
|
1197
|
-
n.length > 0 ? (this.tree.remove(e), n.push(t)) : (this.segments.push(e), e.prev = l);
|
|
1198
|
-
} else {
|
|
1199
|
-
if (l && c) {
|
|
1200
|
-
const u = l.getIntersection(c);
|
|
1201
|
-
if (u !== null) {
|
|
1202
|
-
if (!l.isAnEndpoint(u)) {
|
|
1203
|
-
const g = this._splitSafely(l, u);
|
|
1204
|
-
for (let s = 0, h = g.length; s < h; s++)
|
|
1205
|
-
n.push(g[s]);
|
|
1206
|
-
}
|
|
1207
|
-
if (!c.isAnEndpoint(u)) {
|
|
1208
|
-
const g = this._splitSafely(c, u);
|
|
1209
|
-
for (let s = 0, h = g.length; s < h; s++)
|
|
1210
|
-
n.push(g[s]);
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
this.tree.remove(e);
|
|
1712
|
+
const n = [];
|
|
1713
|
+
for (let e = 0, t = this.polys.length; e < t; e++) {
|
|
1714
|
+
const i = this.polys[e].getSweepEvents();
|
|
1715
|
+
for (let r = 0, u = i.length; r < u; r++)
|
|
1716
|
+
n.push(i[r]);
|
|
1215
1717
|
}
|
|
1216
1718
|
return n;
|
|
1217
1719
|
}
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
run(t, e, n) {
|
|
1231
|
-
$.type = t, Z.reset();
|
|
1232
|
-
const r = [new It(e, !0)];
|
|
1233
|
-
for (let s = 0, h = n.length; s < h; s++)
|
|
1234
|
-
r.push(new It(n[s], !1));
|
|
1235
|
-
if ($.numMultiPolys = r.length, $.type === "difference") {
|
|
1236
|
-
const s = r[0];
|
|
1237
|
-
let h = 1;
|
|
1238
|
-
for (; h < r.length; )
|
|
1239
|
-
at(r[h].bbox, s.bbox) !== null ? h++ : r.splice(h, 1);
|
|
1240
|
-
}
|
|
1241
|
-
if ($.type === "intersection")
|
|
1242
|
-
for (let s = 0, h = r.length; s < h; s++) {
|
|
1243
|
-
const a = r[s];
|
|
1244
|
-
for (let d = s + 1, x = r.length; d < x; d++)
|
|
1245
|
-
if (at(a.bbox, r[d].bbox) === null) return [];
|
|
1246
|
-
}
|
|
1247
|
-
const o = new dt(L.compare);
|
|
1248
|
-
for (let s = 0, h = r.length; s < h; s++) {
|
|
1249
|
-
const a = r[s].getSweepEvents();
|
|
1250
|
-
for (let d = 0, x = a.length; d < x; d++)
|
|
1251
|
-
if (o.insert(a[d]), o.size > kt)
|
|
1252
|
-
throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).");
|
|
1253
|
-
}
|
|
1254
|
-
const f = new _e(o);
|
|
1255
|
-
let l = o.size, c = o.pop();
|
|
1256
|
-
for (; c; ) {
|
|
1257
|
-
const s = c.key;
|
|
1258
|
-
if (o.size === l) {
|
|
1259
|
-
const a = s.segment;
|
|
1260
|
-
throw new Error(`Unable to pop() ${s.isLeft ? "left" : "right"} SweepEvent [${s.point.x}, ${s.point.y}] from segment #${a.id} [${a.leftSE.point.x}, ${a.leftSE.point.y}] -> [${a.rightSE.point.x}, ${a.rightSE.point.y}] from queue.`);
|
|
1261
|
-
}
|
|
1262
|
-
if (o.size > kt)
|
|
1263
|
-
throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");
|
|
1264
|
-
if (f.segments.length > Se)
|
|
1265
|
-
throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
|
|
1266
|
-
const h = f.process(s);
|
|
1267
|
-
for (let a = 0, d = h.length; a < d; a++) {
|
|
1268
|
-
const x = h[a];
|
|
1269
|
-
x.consumedBy === void 0 && o.insert(x);
|
|
1270
|
-
}
|
|
1271
|
-
l = o.size, c = o.pop();
|
|
1272
|
-
}
|
|
1273
|
-
Z.reset();
|
|
1274
|
-
const u = nt.factory(f.segments);
|
|
1275
|
-
return new be(u).getGeom();
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
const $ = new Pe(), Me = function(i) {
|
|
1279
|
-
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
1280
|
-
e[n - 1] = arguments[n];
|
|
1281
|
-
return $.run("union", i, e);
|
|
1282
|
-
}, Le = function(i) {
|
|
1283
|
-
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
1284
|
-
e[n - 1] = arguments[n];
|
|
1285
|
-
return $.run("intersection", i, e);
|
|
1286
|
-
}, Re = function(i) {
|
|
1287
|
-
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
1288
|
-
e[n - 1] = arguments[n];
|
|
1289
|
-
return $.run("xor", i, e);
|
|
1290
|
-
}, Ie = function(i) {
|
|
1291
|
-
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
1292
|
-
e[n - 1] = arguments[n];
|
|
1293
|
-
return $.run("difference", i, e);
|
|
1294
|
-
};
|
|
1295
|
-
var Ft = {
|
|
1296
|
-
union: Me,
|
|
1297
|
-
intersection: Le,
|
|
1298
|
-
xor: Re,
|
|
1299
|
-
difference: Ie
|
|
1300
|
-
};
|
|
1301
|
-
function Qt(i, t, e) {
|
|
1302
|
-
if (i !== null)
|
|
1303
|
-
for (var n, r, o, f, l, c, u, g = 0, s = 0, h, a = i.type, d = a === "FeatureCollection", x = a === "Feature", p = d ? i.features.length : 1, y = 0; y < p; y++) {
|
|
1304
|
-
u = d ? i.features[y].geometry : x ? i.geometry : i, h = u ? u.type === "GeometryCollection" : !1, l = h ? u.geometries.length : 1;
|
|
1305
|
-
for (var w = 0; w < l; w++) {
|
|
1306
|
-
var v = 0, E = 0;
|
|
1307
|
-
if (f = h ? u.geometries[w] : u, f !== null) {
|
|
1308
|
-
c = f.coordinates;
|
|
1309
|
-
var m = f.type;
|
|
1310
|
-
switch (g = 0, m) {
|
|
1720
|
+
}, Vt = (n, ...e) => Oe.run("union", n, e), Kt = (n, ...e) => Oe.run("difference", n, e);
|
|
1721
|
+
oe.set;
|
|
1722
|
+
function wt(n, e, t) {
|
|
1723
|
+
if (n !== null)
|
|
1724
|
+
for (var i, r, u, y, c, E, h, b = 0, _ = 0, T, O = n.type, G = O === "FeatureCollection", F = O === "Feature", L = G ? n.features.length : 1, N = 0; N < L; N++) {
|
|
1725
|
+
h = G ? n.features[N].geometry : F ? n.geometry : n, T = h ? h.type === "GeometryCollection" : !1, c = T ? h.geometries.length : 1;
|
|
1726
|
+
for (var S = 0; S < c; S++) {
|
|
1727
|
+
var k = 0, $ = 0;
|
|
1728
|
+
if (y = T ? h.geometries[S] : h, y !== null) {
|
|
1729
|
+
E = y.coordinates;
|
|
1730
|
+
var q = y.type;
|
|
1731
|
+
switch (b = 0, q) {
|
|
1311
1732
|
case null:
|
|
1312
1733
|
break;
|
|
1313
1734
|
case "Point":
|
|
1314
|
-
if (
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1735
|
+
if (e(
|
|
1736
|
+
E,
|
|
1737
|
+
_,
|
|
1738
|
+
N,
|
|
1739
|
+
k,
|
|
1740
|
+
$
|
|
1320
1741
|
) === !1)
|
|
1321
1742
|
return !1;
|
|
1322
|
-
|
|
1743
|
+
_++, k++;
|
|
1323
1744
|
break;
|
|
1324
1745
|
case "LineString":
|
|
1325
1746
|
case "MultiPoint":
|
|
1326
|
-
for (
|
|
1327
|
-
if (
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1747
|
+
for (i = 0; i < E.length; i++) {
|
|
1748
|
+
if (e(
|
|
1749
|
+
E[i],
|
|
1750
|
+
_,
|
|
1751
|
+
N,
|
|
1752
|
+
k,
|
|
1753
|
+
$
|
|
1333
1754
|
) === !1)
|
|
1334
1755
|
return !1;
|
|
1335
|
-
|
|
1756
|
+
_++, q === "MultiPoint" && k++;
|
|
1336
1757
|
}
|
|
1337
|
-
|
|
1758
|
+
q === "LineString" && k++;
|
|
1338
1759
|
break;
|
|
1339
1760
|
case "Polygon":
|
|
1340
1761
|
case "MultiLineString":
|
|
1341
|
-
for (
|
|
1342
|
-
for (r = 0; r <
|
|
1343
|
-
if (
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1762
|
+
for (i = 0; i < E.length; i++) {
|
|
1763
|
+
for (r = 0; r < E[i].length - b; r++) {
|
|
1764
|
+
if (e(
|
|
1765
|
+
E[i][r],
|
|
1766
|
+
_,
|
|
1767
|
+
N,
|
|
1768
|
+
k,
|
|
1769
|
+
$
|
|
1349
1770
|
) === !1)
|
|
1350
1771
|
return !1;
|
|
1351
|
-
|
|
1772
|
+
_++;
|
|
1352
1773
|
}
|
|
1353
|
-
|
|
1774
|
+
q === "MultiLineString" && k++, q === "Polygon" && $++;
|
|
1354
1775
|
}
|
|
1355
|
-
|
|
1776
|
+
q === "Polygon" && k++;
|
|
1356
1777
|
break;
|
|
1357
1778
|
case "MultiPolygon":
|
|
1358
|
-
for (
|
|
1359
|
-
for (
|
|
1360
|
-
for (
|
|
1361
|
-
if (
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1779
|
+
for (i = 0; i < E.length; i++) {
|
|
1780
|
+
for ($ = 0, r = 0; r < E[i].length; r++) {
|
|
1781
|
+
for (u = 0; u < E[i][r].length - b; u++) {
|
|
1782
|
+
if (e(
|
|
1783
|
+
E[i][r][u],
|
|
1784
|
+
_,
|
|
1785
|
+
N,
|
|
1786
|
+
k,
|
|
1787
|
+
$
|
|
1367
1788
|
) === !1)
|
|
1368
1789
|
return !1;
|
|
1369
|
-
|
|
1790
|
+
_++;
|
|
1370
1791
|
}
|
|
1371
|
-
|
|
1792
|
+
$++;
|
|
1372
1793
|
}
|
|
1373
|
-
|
|
1794
|
+
k++;
|
|
1374
1795
|
}
|
|
1375
1796
|
break;
|
|
1376
1797
|
case "GeometryCollection":
|
|
1377
|
-
for (
|
|
1378
|
-
if (
|
|
1798
|
+
for (i = 0; i < y.geometries.length; i++)
|
|
1799
|
+
if (wt(y.geometries[i], e) === !1)
|
|
1379
1800
|
return !1;
|
|
1380
1801
|
break;
|
|
1381
1802
|
default:
|
|
@@ -1385,46 +1806,46 @@ function Qt(i, t, e) {
|
|
|
1385
1806
|
}
|
|
1386
1807
|
}
|
|
1387
1808
|
}
|
|
1388
|
-
function
|
|
1389
|
-
var
|
|
1390
|
-
for (
|
|
1391
|
-
for (
|
|
1392
|
-
if (
|
|
1393
|
-
if (
|
|
1809
|
+
function Xe(n, e) {
|
|
1810
|
+
var t, i, r, u, y, c, E, h, b, _, T = 0, O = n.type === "FeatureCollection", G = n.type === "Feature", F = O ? n.features.length : 1;
|
|
1811
|
+
for (t = 0; t < F; t++) {
|
|
1812
|
+
for (c = O ? n.features[t].geometry : G ? n.geometry : n, h = O ? n.features[t].properties : G ? n.properties : {}, b = O ? n.features[t].bbox : G ? n.bbox : void 0, _ = O ? n.features[t].id : G ? n.id : void 0, E = c ? c.type === "GeometryCollection" : !1, y = E ? c.geometries.length : 1, r = 0; r < y; r++) {
|
|
1813
|
+
if (u = E ? c.geometries[r] : c, u === null) {
|
|
1814
|
+
if (e(
|
|
1394
1815
|
null,
|
|
1816
|
+
T,
|
|
1395
1817
|
h,
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
s
|
|
1818
|
+
b,
|
|
1819
|
+
_
|
|
1399
1820
|
) === !1)
|
|
1400
1821
|
return !1;
|
|
1401
1822
|
continue;
|
|
1402
1823
|
}
|
|
1403
|
-
switch (
|
|
1824
|
+
switch (u.type) {
|
|
1404
1825
|
case "Point":
|
|
1405
1826
|
case "LineString":
|
|
1406
1827
|
case "MultiPoint":
|
|
1407
1828
|
case "Polygon":
|
|
1408
1829
|
case "MultiLineString":
|
|
1409
1830
|
case "MultiPolygon": {
|
|
1410
|
-
if (
|
|
1411
|
-
o,
|
|
1412
|
-
h,
|
|
1831
|
+
if (e(
|
|
1413
1832
|
u,
|
|
1414
|
-
|
|
1415
|
-
|
|
1833
|
+
T,
|
|
1834
|
+
h,
|
|
1835
|
+
b,
|
|
1836
|
+
_
|
|
1416
1837
|
) === !1)
|
|
1417
1838
|
return !1;
|
|
1418
1839
|
break;
|
|
1419
1840
|
}
|
|
1420
1841
|
case "GeometryCollection": {
|
|
1421
|
-
for (
|
|
1422
|
-
if (
|
|
1423
|
-
|
|
1842
|
+
for (i = 0; i < u.geometries.length; i++)
|
|
1843
|
+
if (e(
|
|
1844
|
+
u.geometries[i],
|
|
1845
|
+
T,
|
|
1424
1846
|
h,
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
s
|
|
1847
|
+
b,
|
|
1848
|
+
_
|
|
1428
1849
|
) === !1)
|
|
1429
1850
|
return !1;
|
|
1430
1851
|
break;
|
|
@@ -1433,205 +1854,205 @@ function xt(i, t) {
|
|
|
1433
1854
|
throw new Error("Unknown Geometry Type");
|
|
1434
1855
|
}
|
|
1435
1856
|
}
|
|
1436
|
-
|
|
1857
|
+
T++;
|
|
1437
1858
|
}
|
|
1438
1859
|
}
|
|
1439
|
-
function
|
|
1440
|
-
|
|
1441
|
-
var
|
|
1442
|
-
switch (
|
|
1860
|
+
function Xt(n, e) {
|
|
1861
|
+
Xe(n, function(t, i, r, u, y) {
|
|
1862
|
+
var c = t === null ? null : t.type;
|
|
1863
|
+
switch (c) {
|
|
1443
1864
|
case null:
|
|
1444
1865
|
case "Point":
|
|
1445
1866
|
case "LineString":
|
|
1446
1867
|
case "Polygon":
|
|
1447
|
-
return
|
|
1448
|
-
|
|
1449
|
-
|
|
1868
|
+
return e(
|
|
1869
|
+
we(t, r, { bbox: u, id: y }),
|
|
1870
|
+
i,
|
|
1450
1871
|
0
|
|
1451
1872
|
) === !1 ? !1 : void 0;
|
|
1452
1873
|
}
|
|
1453
|
-
var
|
|
1454
|
-
switch (
|
|
1874
|
+
var E;
|
|
1875
|
+
switch (c) {
|
|
1455
1876
|
case "MultiPoint":
|
|
1456
|
-
|
|
1877
|
+
E = "Point";
|
|
1457
1878
|
break;
|
|
1458
1879
|
case "MultiLineString":
|
|
1459
|
-
|
|
1880
|
+
E = "LineString";
|
|
1460
1881
|
break;
|
|
1461
1882
|
case "MultiPolygon":
|
|
1462
|
-
|
|
1883
|
+
E = "Polygon";
|
|
1463
1884
|
break;
|
|
1464
1885
|
}
|
|
1465
|
-
for (var
|
|
1466
|
-
var
|
|
1467
|
-
type:
|
|
1468
|
-
coordinates:
|
|
1886
|
+
for (var h = 0; h < t.coordinates.length; h++) {
|
|
1887
|
+
var b = t.coordinates[h], _ = {
|
|
1888
|
+
type: E,
|
|
1889
|
+
coordinates: b
|
|
1469
1890
|
};
|
|
1470
|
-
if (
|
|
1891
|
+
if (e(we(_, r), i, h) === !1)
|
|
1471
1892
|
return !1;
|
|
1472
1893
|
}
|
|
1473
1894
|
});
|
|
1474
1895
|
}
|
|
1475
|
-
function
|
|
1476
|
-
const
|
|
1477
|
-
if (
|
|
1478
|
-
|
|
1479
|
-
}),
|
|
1896
|
+
function Yt(n, e = {}) {
|
|
1897
|
+
const t = [];
|
|
1898
|
+
if (Xe(n, (r) => {
|
|
1899
|
+
t.push(r.coordinates);
|
|
1900
|
+
}), t.length < 2)
|
|
1480
1901
|
throw new Error("Must have at least 2 geometries");
|
|
1481
|
-
const
|
|
1482
|
-
return
|
|
1902
|
+
const i = Vt(t[0], ...t.slice(1));
|
|
1903
|
+
return i.length === 0 ? null : i.length === 1 ? Ke(i[0], e.properties) : gt(i, e.properties);
|
|
1483
1904
|
}
|
|
1484
|
-
var
|
|
1485
|
-
function
|
|
1905
|
+
var Et = Yt;
|
|
1906
|
+
function ve() {
|
|
1486
1907
|
}
|
|
1487
|
-
function
|
|
1488
|
-
return
|
|
1908
|
+
function vt(n) {
|
|
1909
|
+
return n();
|
|
1489
1910
|
}
|
|
1490
|
-
function
|
|
1911
|
+
function tt() {
|
|
1491
1912
|
return /* @__PURE__ */ Object.create(null);
|
|
1492
1913
|
}
|
|
1493
|
-
function
|
|
1494
|
-
|
|
1914
|
+
function Ae(n) {
|
|
1915
|
+
n.forEach(vt);
|
|
1495
1916
|
}
|
|
1496
|
-
function
|
|
1497
|
-
return typeof
|
|
1917
|
+
function St(n) {
|
|
1918
|
+
return typeof n == "function";
|
|
1498
1919
|
}
|
|
1499
|
-
function
|
|
1500
|
-
return
|
|
1920
|
+
function Zt(n, e) {
|
|
1921
|
+
return n != n ? e == e : n !== e || n && typeof n == "object" || typeof n == "function";
|
|
1501
1922
|
}
|
|
1502
|
-
function
|
|
1503
|
-
return Object.keys(
|
|
1923
|
+
function jt(n) {
|
|
1924
|
+
return Object.keys(n).length === 0;
|
|
1504
1925
|
}
|
|
1505
|
-
function
|
|
1506
|
-
|
|
1926
|
+
function Wt(n, e) {
|
|
1927
|
+
n.appendChild(e);
|
|
1507
1928
|
}
|
|
1508
|
-
function
|
|
1509
|
-
|
|
1929
|
+
function Ht(n, e, t) {
|
|
1930
|
+
n.insertBefore(e, t || null);
|
|
1510
1931
|
}
|
|
1511
|
-
function
|
|
1512
|
-
|
|
1932
|
+
function _t(n) {
|
|
1933
|
+
n.parentNode && n.parentNode.removeChild(n);
|
|
1513
1934
|
}
|
|
1514
|
-
function
|
|
1515
|
-
return document.createElementNS("http://www.w3.org/2000/svg",
|
|
1935
|
+
function nt(n) {
|
|
1936
|
+
return document.createElementNS("http://www.w3.org/2000/svg", n);
|
|
1516
1937
|
}
|
|
1517
|
-
function
|
|
1518
|
-
|
|
1938
|
+
function ue(n, e, t) {
|
|
1939
|
+
t == null ? n.removeAttribute(e) : n.getAttribute(e) !== t && n.setAttribute(e, t);
|
|
1519
1940
|
}
|
|
1520
|
-
function
|
|
1521
|
-
return Array.from(
|
|
1941
|
+
function Jt(n) {
|
|
1942
|
+
return Array.from(n.childNodes);
|
|
1522
1943
|
}
|
|
1523
|
-
function
|
|
1524
|
-
|
|
1944
|
+
function Le(n, e, t) {
|
|
1945
|
+
n.classList.toggle(e, !!t);
|
|
1525
1946
|
}
|
|
1526
|
-
let
|
|
1527
|
-
function
|
|
1528
|
-
|
|
1947
|
+
let Ye;
|
|
1948
|
+
function xe(n) {
|
|
1949
|
+
Ye = n;
|
|
1529
1950
|
}
|
|
1530
|
-
const
|
|
1531
|
-
let
|
|
1532
|
-
const
|
|
1533
|
-
let
|
|
1534
|
-
function
|
|
1535
|
-
|
|
1951
|
+
const ae = [], it = [];
|
|
1952
|
+
let he = [];
|
|
1953
|
+
const rt = [], Qt = /* @__PURE__ */ Promise.resolve();
|
|
1954
|
+
let Fe = !1;
|
|
1955
|
+
function en() {
|
|
1956
|
+
Fe || (Fe = !0, Qt.then(bt));
|
|
1536
1957
|
}
|
|
1537
|
-
function
|
|
1538
|
-
|
|
1958
|
+
function Ve(n) {
|
|
1959
|
+
he.push(n);
|
|
1539
1960
|
}
|
|
1540
|
-
const
|
|
1541
|
-
let
|
|
1542
|
-
function
|
|
1543
|
-
if (
|
|
1961
|
+
const $e = /* @__PURE__ */ new Set();
|
|
1962
|
+
let ce = 0;
|
|
1963
|
+
function bt() {
|
|
1964
|
+
if (ce !== 0)
|
|
1544
1965
|
return;
|
|
1545
|
-
const
|
|
1966
|
+
const n = Ye;
|
|
1546
1967
|
do {
|
|
1547
1968
|
try {
|
|
1548
|
-
for (;
|
|
1549
|
-
const
|
|
1550
|
-
|
|
1969
|
+
for (; ce < ae.length; ) {
|
|
1970
|
+
const e = ae[ce];
|
|
1971
|
+
ce++, xe(e), tn(e.$$);
|
|
1551
1972
|
}
|
|
1552
|
-
} catch (
|
|
1553
|
-
throw
|
|
1554
|
-
}
|
|
1555
|
-
for (
|
|
1556
|
-
for (let
|
|
1557
|
-
const
|
|
1558
|
-
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
} while (
|
|
1562
|
-
for (;
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
}
|
|
1566
|
-
function
|
|
1567
|
-
if (
|
|
1568
|
-
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
function
|
|
1574
|
-
const
|
|
1575
|
-
|
|
1576
|
-
}
|
|
1577
|
-
const
|
|
1578
|
-
function
|
|
1579
|
-
|
|
1580
|
-
}
|
|
1581
|
-
function
|
|
1582
|
-
const { fragment:
|
|
1583
|
-
|
|
1584
|
-
const
|
|
1585
|
-
|
|
1586
|
-
}), r.forEach(
|
|
1587
|
-
}
|
|
1588
|
-
function
|
|
1589
|
-
const
|
|
1590
|
-
|
|
1591
|
-
}
|
|
1592
|
-
function
|
|
1593
|
-
|
|
1594
|
-
}
|
|
1595
|
-
function
|
|
1596
|
-
const
|
|
1597
|
-
|
|
1598
|
-
const
|
|
1973
|
+
} catch (e) {
|
|
1974
|
+
throw ae.length = 0, ce = 0, e;
|
|
1975
|
+
}
|
|
1976
|
+
for (xe(null), ae.length = 0, ce = 0; it.length; ) it.pop()();
|
|
1977
|
+
for (let e = 0; e < he.length; e += 1) {
|
|
1978
|
+
const t = he[e];
|
|
1979
|
+
$e.has(t) || ($e.add(t), t());
|
|
1980
|
+
}
|
|
1981
|
+
he.length = 0;
|
|
1982
|
+
} while (ae.length);
|
|
1983
|
+
for (; rt.length; )
|
|
1984
|
+
rt.pop()();
|
|
1985
|
+
Fe = !1, $e.clear(), xe(n);
|
|
1986
|
+
}
|
|
1987
|
+
function tn(n) {
|
|
1988
|
+
if (n.fragment !== null) {
|
|
1989
|
+
n.update(), Ae(n.before_update);
|
|
1990
|
+
const e = n.dirty;
|
|
1991
|
+
n.dirty = [-1], n.fragment && n.fragment.p(n.ctx, e), n.after_update.forEach(Ve);
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
function nn(n) {
|
|
1995
|
+
const e = [], t = [];
|
|
1996
|
+
he.forEach((i) => n.indexOf(i) === -1 ? e.push(i) : t.push(i)), t.forEach((i) => i()), he = e;
|
|
1997
|
+
}
|
|
1998
|
+
const rn = /* @__PURE__ */ new Set();
|
|
1999
|
+
function sn(n, e) {
|
|
2000
|
+
n && n.i && (rn.delete(n), n.i(e));
|
|
2001
|
+
}
|
|
2002
|
+
function on(n, e, t) {
|
|
2003
|
+
const { fragment: i, after_update: r } = n.$$;
|
|
2004
|
+
i && i.m(e, t), Ve(() => {
|
|
2005
|
+
const u = n.$$.on_mount.map(vt).filter(St);
|
|
2006
|
+
n.$$.on_destroy ? n.$$.on_destroy.push(...u) : Ae(u), n.$$.on_mount = [];
|
|
2007
|
+
}), r.forEach(Ve);
|
|
2008
|
+
}
|
|
2009
|
+
function ln(n, e) {
|
|
2010
|
+
const t = n.$$;
|
|
2011
|
+
t.fragment !== null && (nn(t.after_update), Ae(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
|
|
2012
|
+
}
|
|
2013
|
+
function un(n, e) {
|
|
2014
|
+
n.$$.dirty[0] === -1 && (ae.push(n), en(), n.$$.dirty.fill(0)), n.$$.dirty[e / 31 | 0] |= 1 << e % 31;
|
|
2015
|
+
}
|
|
2016
|
+
function fn(n, e, t, i, r, u, y = null, c = [-1]) {
|
|
2017
|
+
const E = Ye;
|
|
2018
|
+
xe(n);
|
|
2019
|
+
const h = n.$$ = {
|
|
1599
2020
|
fragment: null,
|
|
1600
2021
|
ctx: [],
|
|
1601
2022
|
// state
|
|
1602
|
-
props:
|
|
1603
|
-
update:
|
|
2023
|
+
props: u,
|
|
2024
|
+
update: ve,
|
|
1604
2025
|
not_equal: r,
|
|
1605
|
-
bound:
|
|
2026
|
+
bound: tt(),
|
|
1606
2027
|
// lifecycle
|
|
1607
2028
|
on_mount: [],
|
|
1608
2029
|
on_destroy: [],
|
|
1609
2030
|
on_disconnect: [],
|
|
1610
2031
|
before_update: [],
|
|
1611
2032
|
after_update: [],
|
|
1612
|
-
context: new Map(
|
|
2033
|
+
context: new Map(e.context || (E ? E.$$.context : [])),
|
|
1613
2034
|
// everything else
|
|
1614
|
-
callbacks:
|
|
1615
|
-
dirty:
|
|
2035
|
+
callbacks: tt(),
|
|
2036
|
+
dirty: c,
|
|
1616
2037
|
skip_bound: !1,
|
|
1617
|
-
root:
|
|
2038
|
+
root: e.target || E.$$.root
|
|
1618
2039
|
};
|
|
1619
|
-
|
|
1620
|
-
let
|
|
1621
|
-
if (
|
|
1622
|
-
const
|
|
1623
|
-
return
|
|
1624
|
-
})
|
|
1625
|
-
if (
|
|
1626
|
-
const
|
|
1627
|
-
|
|
2040
|
+
y && y(h.root);
|
|
2041
|
+
let b = !1;
|
|
2042
|
+
if (h.ctx = t(n, e.props || {}, (_, T, ...O) => {
|
|
2043
|
+
const G = O.length ? O[0] : T;
|
|
2044
|
+
return h.ctx && r(h.ctx[_], h.ctx[_] = G) && (!h.skip_bound && h.bound[_] && h.bound[_](G), b && un(n, _)), T;
|
|
2045
|
+
}), h.update(), b = !0, Ae(h.before_update), h.fragment = i(h.ctx), e.target) {
|
|
2046
|
+
if (e.hydrate) {
|
|
2047
|
+
const _ = Jt(e.target);
|
|
2048
|
+
h.fragment && h.fragment.l(_), _.forEach(_t);
|
|
1628
2049
|
} else
|
|
1629
|
-
|
|
1630
|
-
|
|
2050
|
+
h.fragment && h.fragment.c();
|
|
2051
|
+
e.intro && sn(n.$$.fragment), on(n, e.target, e.anchor), bt();
|
|
1631
2052
|
}
|
|
1632
|
-
|
|
2053
|
+
xe(E);
|
|
1633
2054
|
}
|
|
1634
|
-
class
|
|
2055
|
+
class cn {
|
|
1635
2056
|
constructor() {
|
|
1636
2057
|
/**
|
|
1637
2058
|
* ### PRIVATE API
|
|
@@ -1640,7 +2061,7 @@ class Xe {
|
|
|
1640
2061
|
*
|
|
1641
2062
|
* @type {any}
|
|
1642
2063
|
*/
|
|
1643
|
-
|
|
2064
|
+
M(this, "$$");
|
|
1644
2065
|
/**
|
|
1645
2066
|
* ### PRIVATE API
|
|
1646
2067
|
*
|
|
@@ -1648,11 +2069,11 @@ class Xe {
|
|
|
1648
2069
|
*
|
|
1649
2070
|
* @type {any}
|
|
1650
2071
|
*/
|
|
1651
|
-
|
|
2072
|
+
M(this, "$$set");
|
|
1652
2073
|
}
|
|
1653
2074
|
/** @returns {void} */
|
|
1654
2075
|
$destroy() {
|
|
1655
|
-
|
|
2076
|
+
ln(this, 1), this.$destroy = ve;
|
|
1656
2077
|
}
|
|
1657
2078
|
/**
|
|
1658
2079
|
* @template {Extract<keyof Events, string>} K
|
|
@@ -1660,116 +2081,115 @@ class Xe {
|
|
|
1660
2081
|
* @param {((e: Events[K]) => void) | null | undefined} callback
|
|
1661
2082
|
* @returns {() => void}
|
|
1662
2083
|
*/
|
|
1663
|
-
$on(
|
|
1664
|
-
if (!
|
|
1665
|
-
return
|
|
1666
|
-
const
|
|
1667
|
-
return
|
|
1668
|
-
const r =
|
|
1669
|
-
r !== -1 &&
|
|
2084
|
+
$on(e, t) {
|
|
2085
|
+
if (!St(t))
|
|
2086
|
+
return ve;
|
|
2087
|
+
const i = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
|
|
2088
|
+
return i.push(t), () => {
|
|
2089
|
+
const r = i.indexOf(t);
|
|
2090
|
+
r !== -1 && i.splice(r, 1);
|
|
1670
2091
|
};
|
|
1671
2092
|
}
|
|
1672
2093
|
/**
|
|
1673
2094
|
* @param {Partial<Props>} props
|
|
1674
2095
|
* @returns {void}
|
|
1675
2096
|
*/
|
|
1676
|
-
$set(
|
|
1677
|
-
this.$$set && !
|
|
2097
|
+
$set(e) {
|
|
2098
|
+
this.$$set && !jt(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
|
|
1678
2099
|
}
|
|
1679
2100
|
}
|
|
1680
|
-
const
|
|
1681
|
-
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(
|
|
1682
|
-
function
|
|
1683
|
-
let
|
|
2101
|
+
const an = "4";
|
|
2102
|
+
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(an);
|
|
2103
|
+
function hn(n) {
|
|
2104
|
+
let e, t, i;
|
|
1684
2105
|
return {
|
|
1685
2106
|
c() {
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
2107
|
+
e = nt("svg"), t = nt("path"), ue(t, "stroke-width", "4"), ue(t, "d", "M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"), ue(t, "class", "svelte-gzo3ar"), ue(e, "width", i = /*displayIn*/
|
|
2108
|
+
n[0] === "list" ? 20 : void 0), ue(e, "viewBox", "0 0 70 85"), ue(e, "fill", "none"), ue(e, "class", "svelte-gzo3ar"), Le(
|
|
2109
|
+
e,
|
|
1689
2110
|
"in-map",
|
|
1690
2111
|
/*displayIn*/
|
|
1691
|
-
|
|
1692
|
-
),
|
|
1693
|
-
|
|
2112
|
+
n[0] !== "list"
|
|
2113
|
+
), Le(
|
|
2114
|
+
e,
|
|
1694
2115
|
"list-icon",
|
|
1695
2116
|
/*displayIn*/
|
|
1696
|
-
|
|
2117
|
+
n[0] === "list"
|
|
1697
2118
|
);
|
|
1698
2119
|
},
|
|
1699
|
-
m(r,
|
|
1700
|
-
|
|
2120
|
+
m(r, u) {
|
|
2121
|
+
Ht(r, e, u), Wt(e, t);
|
|
1701
2122
|
},
|
|
1702
|
-
p(r, [
|
|
1703
|
-
|
|
1704
|
-
1 &&
|
|
1705
|
-
r[0] === "list" ? 20 : void 0) &&
|
|
1706
|
-
1 &&
|
|
1707
|
-
|
|
2123
|
+
p(r, [u]) {
|
|
2124
|
+
u & /*displayIn*/
|
|
2125
|
+
1 && i !== (i = /*displayIn*/
|
|
2126
|
+
r[0] === "list" ? 20 : void 0) && ue(e, "width", i), u & /*displayIn*/
|
|
2127
|
+
1 && Le(
|
|
2128
|
+
e,
|
|
1708
2129
|
"in-map",
|
|
1709
2130
|
/*displayIn*/
|
|
1710
2131
|
r[0] !== "list"
|
|
1711
|
-
),
|
|
1712
|
-
1 &&
|
|
1713
|
-
|
|
2132
|
+
), u & /*displayIn*/
|
|
2133
|
+
1 && Le(
|
|
2134
|
+
e,
|
|
1714
2135
|
"list-icon",
|
|
1715
2136
|
/*displayIn*/
|
|
1716
2137
|
r[0] === "list"
|
|
1717
2138
|
);
|
|
1718
2139
|
},
|
|
1719
|
-
i:
|
|
1720
|
-
o:
|
|
2140
|
+
i: ve,
|
|
2141
|
+
o: ve,
|
|
1721
2142
|
d(r) {
|
|
1722
|
-
r &&
|
|
2143
|
+
r && _t(e);
|
|
1723
2144
|
}
|
|
1724
2145
|
};
|
|
1725
2146
|
}
|
|
1726
|
-
function
|
|
1727
|
-
let { displayIn:
|
|
1728
|
-
return
|
|
1729
|
-
"displayIn" in r &&
|
|
1730
|
-
}, [
|
|
2147
|
+
function gn(n, e, t) {
|
|
2148
|
+
let { displayIn: i } = e;
|
|
2149
|
+
return n.$$set = (r) => {
|
|
2150
|
+
"displayIn" in r && t(0, i = r.displayIn);
|
|
2151
|
+
}, [i];
|
|
1731
2152
|
}
|
|
1732
|
-
class
|
|
1733
|
-
constructor(
|
|
1734
|
-
super(),
|
|
2153
|
+
class pn extends cn {
|
|
2154
|
+
constructor(e) {
|
|
2155
|
+
super(), fn(this, e, gn, hn, Zt, { displayIn: 0 });
|
|
1735
2156
|
}
|
|
1736
2157
|
}
|
|
1737
|
-
function
|
|
1738
|
-
if (
|
|
1739
|
-
return
|
|
1740
|
-
const
|
|
1741
|
-
return
|
|
1742
|
-
|
|
1743
|
-
}),
|
|
2158
|
+
function yn(n, e = {}) {
|
|
2159
|
+
if (n.bbox != null && e.recompute !== !0)
|
|
2160
|
+
return n.bbox;
|
|
2161
|
+
const t = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
|
|
2162
|
+
return wt(n, (i) => {
|
|
2163
|
+
t[0] > i[0] && (t[0] = i[0]), t[1] > i[1] && (t[1] = i[1]), t[2] < i[0] && (t[2] = i[0]), t[3] < i[1] && (t[3] = i[1]);
|
|
2164
|
+
}), t;
|
|
1744
2165
|
}
|
|
1745
|
-
var
|
|
1746
|
-
function
|
|
1747
|
-
const
|
|
1748
|
-
if (
|
|
1749
|
-
|
|
1750
|
-
}),
|
|
2166
|
+
var st = yn;
|
|
2167
|
+
function dn(n) {
|
|
2168
|
+
const e = [];
|
|
2169
|
+
if (Xe(n, (r) => {
|
|
2170
|
+
e.push(r.coordinates);
|
|
2171
|
+
}), e.length < 2)
|
|
1751
2172
|
throw new Error("Must have at least two features");
|
|
1752
|
-
const
|
|
1753
|
-
return
|
|
1754
|
-
}
|
|
1755
|
-
var
|
|
1756
|
-
function
|
|
1757
|
-
if (!
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
yt([
|
|
2173
|
+
const t = n.features[0].properties || {}, i = Kt(e[0], ...e.slice(1));
|
|
2174
|
+
return i.length === 0 ? null : i.length === 1 ? Ke(i[0], t) : gt(i, t);
|
|
2175
|
+
}
|
|
2176
|
+
var mn = dn;
|
|
2177
|
+
function xn(n) {
|
|
2178
|
+
if (!n) throw new Error("geojson is required");
|
|
2179
|
+
var e = [];
|
|
2180
|
+
return Xt(n, function(t) {
|
|
2181
|
+
e.push(t);
|
|
2182
|
+
}), Ee(e);
|
|
2183
|
+
}
|
|
2184
|
+
var wn = xn;
|
|
2185
|
+
function ot(n) {
|
|
2186
|
+
const e = [...n];
|
|
2187
|
+
return e[2] < e[0] && (Math.abs((e[0] + e[2] + 360) / 2) > Math.abs((e[0] - 360 + e[2]) / 2) ? e[0] -= 360 : e[2] += 360), e;
|
|
2188
|
+
}
|
|
2189
|
+
function lt(n, e) {
|
|
2190
|
+
const t = mn(
|
|
2191
|
+
Ee([
|
|
2192
|
+
Ke([
|
|
1773
2193
|
[
|
|
1774
2194
|
[180, 90],
|
|
1775
2195
|
[-180, 90],
|
|
@@ -1778,33 +2198,33 @@ function zt(i, t) {
|
|
|
1778
2198
|
[180, 90]
|
|
1779
2199
|
]
|
|
1780
2200
|
]),
|
|
1781
|
-
|
|
2201
|
+
n
|
|
1782
2202
|
])
|
|
1783
2203
|
);
|
|
1784
|
-
if (!
|
|
2204
|
+
if (!t)
|
|
1785
2205
|
return;
|
|
1786
|
-
|
|
1787
|
-
const
|
|
1788
|
-
if (
|
|
1789
|
-
for (const
|
|
1790
|
-
const
|
|
1791
|
-
if (
|
|
1792
|
-
for (const
|
|
1793
|
-
for (const
|
|
1794
|
-
|
|
1795
|
-
if (
|
|
1796
|
-
for (const
|
|
1797
|
-
for (const
|
|
1798
|
-
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
2206
|
+
t.properties = { isMask: !0 };
|
|
2207
|
+
const i = ot(st(n)), r = (i[2] - i[0]) / 360 / 1e3, u = i[0] < -180, y = i[2] > 180, c = wn(n);
|
|
2208
|
+
if (c.features.length > 1 && (u || y))
|
|
2209
|
+
for (const E of c.features) {
|
|
2210
|
+
const h = ot(st(E));
|
|
2211
|
+
if (y && h[0] < -180 + r)
|
|
2212
|
+
for (const b of E.geometry.coordinates)
|
|
2213
|
+
for (const _ of b)
|
|
2214
|
+
_[0] += 360 - r;
|
|
2215
|
+
if (u && h[2] > 180 - r)
|
|
2216
|
+
for (const b of E.geometry.coordinates)
|
|
2217
|
+
for (const _ of b)
|
|
2218
|
+
_[0] -= 360 - r;
|
|
2219
|
+
}
|
|
2220
|
+
e(
|
|
2221
|
+
Ee([
|
|
2222
|
+
c.features.length < 2 ? n : Et(c) ?? n,
|
|
2223
|
+
t
|
|
1804
2224
|
])
|
|
1805
2225
|
);
|
|
1806
2226
|
}
|
|
1807
|
-
const
|
|
2227
|
+
const ut = {
|
|
1808
2228
|
fill: {
|
|
1809
2229
|
paint: {
|
|
1810
2230
|
"fill-color": "#000",
|
|
@@ -1823,176 +2243,176 @@ const Gt = {
|
|
|
1823
2243
|
},
|
|
1824
2244
|
filter: ["!", ["has", "isMask"]]
|
|
1825
2245
|
}
|
|
1826
|
-
},
|
|
1827
|
-
function
|
|
1828
|
-
let
|
|
1829
|
-
const
|
|
1830
|
-
let
|
|
1831
|
-
function
|
|
1832
|
-
if (!
|
|
1833
|
-
|
|
2246
|
+
}, Te = "mtlr-gc-full-geom", ft = "mtlr-gc-full-geom-fill", ct = "mtlr-gc-full-geom-line";
|
|
2247
|
+
function vn(n, e, t = !0, i = !0, r = {}, u = {}, y = ut) {
|
|
2248
|
+
let c;
|
|
2249
|
+
const E = [];
|
|
2250
|
+
let h, b, _;
|
|
2251
|
+
function T() {
|
|
2252
|
+
if (!n.loaded) {
|
|
2253
|
+
n.once("load", T);
|
|
1834
2254
|
return;
|
|
1835
2255
|
}
|
|
1836
|
-
const
|
|
1837
|
-
if (!(
|
|
2256
|
+
const L = y ? y === !0 ? ut : y : void 0;
|
|
2257
|
+
if (!(L != null && L.fill) && !(L != null && L.line))
|
|
1838
2258
|
return;
|
|
1839
|
-
const
|
|
1840
|
-
if (
|
|
1841
|
-
|
|
1842
|
-
else if (
|
|
1843
|
-
|
|
2259
|
+
const N = n.getSource(Te);
|
|
2260
|
+
if (N)
|
|
2261
|
+
N.setData(_ ?? Ee([]));
|
|
2262
|
+
else if (_)
|
|
2263
|
+
n.addSource(Te, {
|
|
1844
2264
|
type: "geojson",
|
|
1845
|
-
data:
|
|
2265
|
+
data: _
|
|
1846
2266
|
});
|
|
1847
2267
|
else
|
|
1848
2268
|
return;
|
|
1849
|
-
!
|
|
1850
|
-
...
|
|
1851
|
-
id:
|
|
2269
|
+
!n.getLayer(ft) && (L != null && L.fill) && n.addLayer({
|
|
2270
|
+
...L == null ? void 0 : L.fill,
|
|
2271
|
+
id: ft,
|
|
1852
2272
|
type: "fill",
|
|
1853
|
-
source:
|
|
1854
|
-
}), !
|
|
1855
|
-
...
|
|
1856
|
-
id:
|
|
2273
|
+
source: Te
|
|
2274
|
+
}), !n.getLayer(ct) && (L != null && L.line) && n.addLayer({
|
|
2275
|
+
...L == null ? void 0 : L.line,
|
|
2276
|
+
id: ct,
|
|
1857
2277
|
type: "line",
|
|
1858
|
-
source:
|
|
2278
|
+
source: Te
|
|
1859
2279
|
});
|
|
1860
2280
|
}
|
|
1861
|
-
function
|
|
1862
|
-
|
|
2281
|
+
function O(L) {
|
|
2282
|
+
_ = L, T();
|
|
1863
2283
|
}
|
|
1864
|
-
|
|
2284
|
+
n.on("styledata", () => {
|
|
1865
2285
|
setTimeout(() => {
|
|
1866
|
-
|
|
2286
|
+
_ && T();
|
|
1867
2287
|
});
|
|
1868
2288
|
});
|
|
1869
|
-
const
|
|
1870
|
-
|
|
2289
|
+
const G = (L) => {
|
|
2290
|
+
c == null || c({
|
|
1871
2291
|
type: "mapClick",
|
|
1872
|
-
coordinates: [
|
|
2292
|
+
coordinates: [L.lngLat.lng, L.lngLat.lat]
|
|
1873
2293
|
});
|
|
1874
2294
|
};
|
|
1875
|
-
function
|
|
1876
|
-
if (!
|
|
2295
|
+
function F(L = !1) {
|
|
2296
|
+
if (!e)
|
|
1877
2297
|
throw new Error();
|
|
1878
|
-
const
|
|
1879
|
-
return
|
|
2298
|
+
const N = document.createElement("div");
|
|
2299
|
+
return L && N.classList.add("marker-interactive"), new pn({
|
|
1880
2300
|
props: { displayIn: "maplibre" },
|
|
1881
|
-
target:
|
|
1882
|
-
}), new
|
|
2301
|
+
target: N
|
|
2302
|
+
}), new e.Marker({ element: N, offset: [1, -13] });
|
|
1883
2303
|
}
|
|
1884
2304
|
return {
|
|
1885
|
-
setEventHandler(
|
|
1886
|
-
|
|
2305
|
+
setEventHandler(L) {
|
|
2306
|
+
L ? (c = L, n.on("click", G)) : (c = void 0, n.off("click", G));
|
|
1887
2307
|
},
|
|
1888
|
-
flyTo(
|
|
1889
|
-
|
|
2308
|
+
flyTo(L, N) {
|
|
2309
|
+
n.flyTo({ center: L, ...N ? { zoom: N } : {}, ...r });
|
|
1890
2310
|
},
|
|
1891
|
-
fitBounds(
|
|
1892
|
-
|
|
2311
|
+
fitBounds(L, N, S) {
|
|
2312
|
+
n.fitBounds(
|
|
1893
2313
|
[
|
|
1894
|
-
[
|
|
1895
|
-
[
|
|
2314
|
+
[L[0], L[1]],
|
|
2315
|
+
[L[2], L[3]]
|
|
1896
2316
|
],
|
|
1897
|
-
{ padding:
|
|
2317
|
+
{ padding: N, ...S ? { maxZoom: S } : {}, ...u }
|
|
1898
2318
|
);
|
|
1899
2319
|
},
|
|
1900
|
-
indicateReverse(
|
|
1901
|
-
|
|
2320
|
+
indicateReverse(L) {
|
|
2321
|
+
n.getCanvasContainer().style.cursor = L ? "crosshair" : "";
|
|
1902
2322
|
},
|
|
1903
|
-
setReverseMarker(
|
|
1904
|
-
!
|
|
2323
|
+
setReverseMarker(L) {
|
|
2324
|
+
!e || !t || (b ? L ? b.setLngLat(L) : (b.remove(), b = void 0) : L && (t instanceof Function ? b = t(n) ?? void 0 : (b = (typeof t == "object" ? new e.Marker(t) : F()).setLngLat(L).addTo(n), b.getElement().classList.add("marker-reverse"))));
|
|
1905
2325
|
},
|
|
1906
|
-
setFeatures(
|
|
1907
|
-
for (const
|
|
1908
|
-
|
|
1909
|
-
if (
|
|
1910
|
-
|
|
1911
|
-
let
|
|
1912
|
-
if (
|
|
1913
|
-
const
|
|
1914
|
-
(
|
|
2326
|
+
setFeatures(L, N, S) {
|
|
2327
|
+
for (const k of E)
|
|
2328
|
+
k.remove();
|
|
2329
|
+
if (E.length = 0, O(void 0), !!e) {
|
|
2330
|
+
e: if (N) {
|
|
2331
|
+
let k = !1;
|
|
2332
|
+
if (N.geometry.type === "GeometryCollection") {
|
|
2333
|
+
const $ = N.geometry.geometries.filter(
|
|
2334
|
+
(q) => q.type === "Polygon" || q.type === "MultiPolygon"
|
|
1915
2335
|
);
|
|
1916
|
-
|
|
1917
|
-
const
|
|
1918
|
-
|
|
2336
|
+
t: if ($.length > 0) {
|
|
2337
|
+
const q = Et(
|
|
2338
|
+
Ee($.map((V) => we(V)))
|
|
1919
2339
|
);
|
|
1920
|
-
if (!
|
|
1921
|
-
break
|
|
1922
|
-
|
|
2340
|
+
if (!q)
|
|
2341
|
+
break t;
|
|
2342
|
+
lt(
|
|
1923
2343
|
{
|
|
1924
|
-
...
|
|
1925
|
-
geometry:
|
|
2344
|
+
...N,
|
|
2345
|
+
geometry: q.geometry
|
|
1926
2346
|
},
|
|
1927
|
-
|
|
1928
|
-
),
|
|
2347
|
+
O
|
|
2348
|
+
), k = !0;
|
|
1929
2349
|
} else {
|
|
1930
|
-
const
|
|
1931
|
-
(
|
|
2350
|
+
const q = N.geometry.geometries.filter(
|
|
2351
|
+
(V) => V.type === "LineString" || V.type === "MultiLineString"
|
|
1932
2352
|
);
|
|
1933
|
-
|
|
1934
|
-
...
|
|
1935
|
-
geometry: { type: "GeometryCollection", geometries:
|
|
1936
|
-
}),
|
|
2353
|
+
q.length > 0 && (O({
|
|
2354
|
+
...N,
|
|
2355
|
+
geometry: { type: "GeometryCollection", geometries: q }
|
|
2356
|
+
}), k = !0);
|
|
1937
2357
|
}
|
|
1938
2358
|
}
|
|
1939
|
-
if (!
|
|
1940
|
-
if (
|
|
1941
|
-
|
|
1942
|
-
else if (
|
|
1943
|
-
|
|
1944
|
-
break
|
|
2359
|
+
if (!k) {
|
|
2360
|
+
if (N.geometry.type === "Polygon" || N.geometry.type === "MultiPolygon")
|
|
2361
|
+
lt(N, O);
|
|
2362
|
+
else if (N.geometry.type === "LineString" || N.geometry.type === "MultiLineString") {
|
|
2363
|
+
O(N);
|
|
2364
|
+
break e;
|
|
1945
2365
|
}
|
|
1946
2366
|
}
|
|
1947
|
-
if (!
|
|
1948
|
-
break
|
|
1949
|
-
if (
|
|
1950
|
-
const
|
|
1951
|
-
|
|
1952
|
-
} else
|
|
1953
|
-
typeof
|
|
2367
|
+
if (!S && N.geometry.type !== "Point")
|
|
2368
|
+
break e;
|
|
2369
|
+
if (t instanceof Function) {
|
|
2370
|
+
const $ = t(n, N);
|
|
2371
|
+
$ && E.push($);
|
|
2372
|
+
} else t && E.push(
|
|
2373
|
+
typeof t == "object" ? new e.Marker(t) : F().setLngLat(N.center).addTo(n)
|
|
1954
2374
|
);
|
|
1955
2375
|
}
|
|
1956
|
-
if (
|
|
1957
|
-
for (const
|
|
1958
|
-
if (
|
|
2376
|
+
if (i)
|
|
2377
|
+
for (const k of L ?? []) {
|
|
2378
|
+
if (k === N)
|
|
1959
2379
|
continue;
|
|
1960
|
-
let
|
|
1961
|
-
if (
|
|
1962
|
-
if (
|
|
2380
|
+
let $;
|
|
2381
|
+
if (i instanceof Function) {
|
|
2382
|
+
if ($ = i(n, k), !$)
|
|
1963
2383
|
continue;
|
|
1964
2384
|
} else
|
|
1965
|
-
|
|
1966
|
-
new
|
|
2385
|
+
$ = (typeof i == "object" ? new e.Marker(i) : F(!0)).setLngLat(k.center).setPopup(
|
|
2386
|
+
new e.Popup({
|
|
1967
2387
|
offset: [1, -27],
|
|
1968
2388
|
closeButton: !1,
|
|
1969
2389
|
closeOnMove: !0,
|
|
1970
2390
|
className: "maptiler-gc-popup"
|
|
1971
2391
|
}).setText(
|
|
1972
|
-
|
|
2392
|
+
k.place_type[0] === "reverse" ? k.place_name : k.place_name.replace(/,.*/, "")
|
|
1973
2393
|
)
|
|
1974
|
-
).addTo(
|
|
1975
|
-
const
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
}),
|
|
1979
|
-
|
|
1980
|
-
}),
|
|
1981
|
-
|
|
1982
|
-
}),
|
|
2394
|
+
).addTo(n);
|
|
2395
|
+
const q = $.getElement();
|
|
2396
|
+
q.addEventListener("click", (V) => {
|
|
2397
|
+
V.stopPropagation(), c == null || c({ type: "markerClick", id: k.id });
|
|
2398
|
+
}), q.addEventListener("mouseenter", () => {
|
|
2399
|
+
c == null || c({ type: "markerMouseEnter", id: k.id }), $.togglePopup();
|
|
2400
|
+
}), q.addEventListener("mouseleave", () => {
|
|
2401
|
+
c == null || c({ type: "markerMouseLeave", id: k.id }), $.togglePopup();
|
|
2402
|
+
}), E.push($);
|
|
1983
2403
|
}
|
|
1984
2404
|
}
|
|
1985
2405
|
},
|
|
1986
|
-
setSelectedMarker(
|
|
1987
|
-
|
|
2406
|
+
setSelectedMarker(L) {
|
|
2407
|
+
h && h.getElement().classList.toggle("marker-selected", !1), h = L > -1 ? E[L] : void 0, h == null || h.getElement().classList.toggle("marker-selected", !0);
|
|
1988
2408
|
},
|
|
1989
2409
|
getCenterAndZoom() {
|
|
1990
|
-
const
|
|
1991
|
-
return [
|
|
2410
|
+
const L = n.getCenter();
|
|
2411
|
+
return [n.getZoom(), L.lng, L.lat];
|
|
1992
2412
|
}
|
|
1993
2413
|
};
|
|
1994
2414
|
}
|
|
1995
2415
|
export {
|
|
1996
|
-
|
|
2416
|
+
vn as createMapLibreGlMapController
|
|
1997
2417
|
};
|
|
1998
2418
|
//# sourceMappingURL=maplibregl-controller.js.map
|