@maptiler/geocoding-control 3.0.0-rc.4 → 3.0.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +307 -307
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +25 -25
- package/dist/index.umd.js.map +1 -1
- package/dist/leaflet.public.js +314 -313
- package/dist/leaflet.public.js.map +1 -1
- package/dist/leaflet.public.umd.js +28 -28
- package/dist/leaflet.public.umd.js.map +1 -1
- package/dist/maplibregl.js +296 -295
- package/dist/maplibregl.js.map +1 -1
- package/dist/maplibregl.umd.js +26 -26
- package/dist/maplibregl.umd.js.map +1 -1
- package/dist/maptilersdk.js +310 -309
- package/dist/maptilersdk.js.map +1 -1
- package/dist/maptilersdk.umd.js +29 -29
- package/dist/maptilersdk.umd.js.map +1 -1
- package/dist/openlayers.public.js +343 -341
- package/dist/openlayers.public.js.map +1 -1
- package/dist/openlayers.public.umd.js +41 -41
- package/dist/openlayers.public.umd.js.map +1 -1
- package/dist/src/controls/leaflet-events.d.ts +55 -26
- package/dist/src/controls/leaflet-options.d.ts +11 -1
- package/dist/src/controls/maplibregl-events.d.ts +54 -25
- package/dist/src/controls/maplibregl-options.d.ts +12 -2
- package/dist/src/controls/maptilersdk-control.d.ts +11 -1
- package/dist/src/controls/maptilersdk-events.d.ts +72 -2
- package/dist/src/controls/openlayers-control.d.ts +4 -4
- package/dist/src/controls/openlayers-events.d.ts +55 -25
- package/dist/src/controls/openlayers-options.d.ts +11 -1
- package/dist/src/geocoder/geocoder-events.d.ts +41 -27
- package/dist/src/geocoder/geocoder-options.d.ts +1 -3
- package/dist/src/leaflet.public.d.ts +1 -1
- package/dist/src/maplibregl.d.ts +1 -1
- package/dist/src/maptilersdk.d.ts +1 -1
- package/dist/src/openlayers.public.d.ts +1 -1
- package/dist/src/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { customElement as
|
|
3
|
-
import { convert as
|
|
1
|
+
import { css as F, LitElement as M, svg as A, html as m, unsafeCSS as he, nothing as ee } from "lit";
|
|
2
|
+
import { customElement as S, property as d, state as w, query as Ze } from "lit/decorators.js";
|
|
3
|
+
import { convert as Ne } from "geo-coordinates-parser";
|
|
4
4
|
import { classMap as V } from "lit/directives/class-map.js";
|
|
5
|
-
import { repeat as
|
|
5
|
+
import { repeat as Qe } from "lit/directives/repeat.js";
|
|
6
6
|
import "@turf/clone";
|
|
7
|
-
import { styleMap as
|
|
8
|
-
import { Feature as
|
|
9
|
-
import { Control as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import it from "ol/
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
7
|
+
import { styleMap as Ke } from "lit/directives/style-map.js";
|
|
8
|
+
import { Feature as L } from "ol";
|
|
9
|
+
import { Control as Ye } from "ol/control";
|
|
10
|
+
import He from "ol/events/Event";
|
|
11
|
+
import { Point as X, Polygon as we, MultiPolygon as ke, GeometryCollection as Je, LineString as _e, MultiLineString as $e } from "ol/geom";
|
|
12
|
+
import Xe from "ol/layer/Vector";
|
|
13
|
+
import { transformExtent as et, getUserProjection as tt, fromLonLat as it, toLonLat as st } from "ol/proj";
|
|
14
|
+
import rt from "ol/source/Vector";
|
|
15
|
+
import Le from "@turf/bbox";
|
|
16
|
+
import ot from "@turf/difference";
|
|
17
|
+
import at from "@turf/flatten";
|
|
18
|
+
import { featureCollection as Ie, polygon as nt } from "@turf/helpers";
|
|
19
|
+
import lt from "@turf/union";
|
|
20
|
+
import Fe from "ol/style/Fill";
|
|
21
|
+
import ct from "ol/style/Icon";
|
|
21
22
|
import Me from "ol/style/Stroke";
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
var
|
|
25
|
-
for (var
|
|
26
|
-
(a = t[
|
|
27
|
-
return
|
|
23
|
+
import ht from "ol/style/Style";
|
|
24
|
+
import dt from "ol/style/Text";
|
|
25
|
+
var pt = Object.getOwnPropertyDescriptor, ut = (t, e, i, o) => {
|
|
26
|
+
for (var s = o > 1 ? void 0 : o ? pt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
|
|
27
|
+
(a = t[r]) && (s = a(s) || s);
|
|
28
|
+
return s;
|
|
28
29
|
};
|
|
29
|
-
let te = class extends
|
|
30
|
+
let te = class extends M {
|
|
30
31
|
render() {
|
|
31
32
|
return A`
|
|
32
33
|
<svg viewBox="0 0 14 14" width="13" height="13">
|
|
@@ -37,21 +38,21 @@ let te = class extends S {
|
|
|
37
38
|
`;
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
|
-
te.styles =
|
|
41
|
+
te.styles = F`
|
|
41
42
|
svg {
|
|
42
43
|
display: block;
|
|
43
44
|
fill: var(--color-icon-button);
|
|
44
45
|
}
|
|
45
46
|
`;
|
|
46
|
-
te =
|
|
47
|
-
|
|
47
|
+
te = ut([
|
|
48
|
+
S("maptiler-geocode-clear-icon")
|
|
48
49
|
], te);
|
|
49
|
-
var
|
|
50
|
-
for (var
|
|
51
|
-
(a = t[
|
|
52
|
-
return
|
|
50
|
+
var ft = Object.getOwnPropertyDescriptor, mt = (t, e, i, o) => {
|
|
51
|
+
for (var s = o > 1 ? void 0 : o ? ft(e, i) : e, r = t.length - 1, a; r >= 0; r--)
|
|
52
|
+
(a = t[r]) && (s = a(s) || s);
|
|
53
|
+
return s;
|
|
53
54
|
};
|
|
54
|
-
let ie = class extends
|
|
55
|
+
let ie = class extends M {
|
|
55
56
|
render() {
|
|
56
57
|
return A`
|
|
57
58
|
<svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -62,21 +63,21 @@ let ie = class extends S {
|
|
|
62
63
|
`;
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
|
-
ie.styles =
|
|
66
|
+
ie.styles = F`
|
|
66
67
|
svg {
|
|
67
68
|
display: block;
|
|
68
69
|
fill: #e15042;
|
|
69
70
|
}
|
|
70
71
|
`;
|
|
71
|
-
ie =
|
|
72
|
-
|
|
72
|
+
ie = mt([
|
|
73
|
+
S("maptiler-geocode-fail-icon")
|
|
73
74
|
], ie);
|
|
74
|
-
var
|
|
75
|
-
for (var
|
|
76
|
-
(a = t[
|
|
77
|
-
return
|
|
75
|
+
var gt = Object.getOwnPropertyDescriptor, yt = (t, e, i, o) => {
|
|
76
|
+
for (var s = o > 1 ? void 0 : o ? gt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
|
|
77
|
+
(a = t[r]) && (s = a(s) || s);
|
|
78
|
+
return s;
|
|
78
79
|
};
|
|
79
|
-
let se = class extends
|
|
80
|
+
let se = class extends M {
|
|
80
81
|
render() {
|
|
81
82
|
return m`
|
|
82
83
|
<div>
|
|
@@ -88,7 +89,7 @@ let se = class extends S {
|
|
|
88
89
|
`;
|
|
89
90
|
}
|
|
90
91
|
};
|
|
91
|
-
se.styles =
|
|
92
|
+
se.styles = F`
|
|
92
93
|
div {
|
|
93
94
|
position: absolute;
|
|
94
95
|
left: 50%;
|
|
@@ -115,15 +116,15 @@ se.styles = M`
|
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
`;
|
|
118
|
-
se =
|
|
119
|
-
|
|
119
|
+
se = yt([
|
|
120
|
+
S("maptiler-geocode-loading-icon")
|
|
120
121
|
], se);
|
|
121
|
-
var
|
|
122
|
-
for (var
|
|
123
|
-
(a = t[
|
|
124
|
-
return
|
|
122
|
+
var vt = Object.getOwnPropertyDescriptor, xt = (t, e, i, o) => {
|
|
123
|
+
for (var s = o > 1 ? void 0 : o ? vt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
|
|
124
|
+
(a = t[r]) && (s = a(s) || s);
|
|
125
|
+
return s;
|
|
125
126
|
};
|
|
126
|
-
let re = class extends
|
|
127
|
+
let re = class extends M {
|
|
127
128
|
render() {
|
|
128
129
|
return A`
|
|
129
130
|
<svg viewBox="0 0 60.006 21.412" width="14" height="20">
|
|
@@ -134,21 +135,21 @@ let re = class extends S {
|
|
|
134
135
|
`;
|
|
135
136
|
}
|
|
136
137
|
};
|
|
137
|
-
re.styles =
|
|
138
|
+
re.styles = F`
|
|
138
139
|
svg {
|
|
139
140
|
display: block;
|
|
140
141
|
fill: var(--color-icon-button);
|
|
141
142
|
}
|
|
142
143
|
`;
|
|
143
|
-
re =
|
|
144
|
-
|
|
144
|
+
re = xt([
|
|
145
|
+
S("maptiler-geocode-reverse-geocoding-icon")
|
|
145
146
|
], re);
|
|
146
|
-
var
|
|
147
|
-
for (var
|
|
148
|
-
(a = t[
|
|
149
|
-
return
|
|
147
|
+
var bt = Object.getOwnPropertyDescriptor, wt = (t, e, i, o) => {
|
|
148
|
+
for (var s = o > 1 ? void 0 : o ? bt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
|
|
149
|
+
(a = t[r]) && (s = a(s) || s);
|
|
150
|
+
return s;
|
|
150
151
|
};
|
|
151
|
-
let oe = class extends
|
|
152
|
+
let oe = class extends M {
|
|
152
153
|
render() {
|
|
153
154
|
return A`
|
|
154
155
|
<svg
|
|
@@ -163,7 +164,7 @@ let oe = class extends S {
|
|
|
163
164
|
`;
|
|
164
165
|
}
|
|
165
166
|
};
|
|
166
|
-
oe.styles =
|
|
167
|
+
oe.styles = F`
|
|
167
168
|
circle {
|
|
168
169
|
stroke-width: 1.875;
|
|
169
170
|
fill: none;
|
|
@@ -179,19 +180,19 @@ oe.styles = M`
|
|
|
179
180
|
stroke: var(--color-icon-button);
|
|
180
181
|
}
|
|
181
182
|
`;
|
|
182
|
-
oe =
|
|
183
|
-
|
|
183
|
+
oe = wt([
|
|
184
|
+
S("maptiler-geocode-search-icon")
|
|
184
185
|
], oe);
|
|
185
|
-
function
|
|
186
|
-
const o = e[1],
|
|
187
|
-
return t === o && i ? t : ((t -
|
|
186
|
+
function kt(t, e, i) {
|
|
187
|
+
const o = e[1], s = e[0], r = o - s;
|
|
188
|
+
return t === o && i ? t : ((t - s) % r + r) % r + s;
|
|
188
189
|
}
|
|
189
190
|
function Z(t) {
|
|
190
191
|
const e = [...t];
|
|
191
192
|
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;
|
|
192
193
|
}
|
|
193
194
|
let G;
|
|
194
|
-
async function
|
|
195
|
+
async function _t(t, e, i) {
|
|
195
196
|
for (const o of e ?? [])
|
|
196
197
|
if (!(t && (o.minZoom != null && o.minZoom > t[0] || o.maxZoom != null && o.maxZoom < t[0]))) {
|
|
197
198
|
if (o.type === "fixed")
|
|
@@ -201,26 +202,26 @@ async function wt(t, e, i) {
|
|
|
201
202
|
if (G.coords)
|
|
202
203
|
return G.coords;
|
|
203
204
|
} else {
|
|
204
|
-
let
|
|
205
|
+
let s;
|
|
205
206
|
try {
|
|
206
|
-
return
|
|
207
|
+
return s = await new Promise((r, a) => {
|
|
207
208
|
i.signal.addEventListener("abort", () => {
|
|
208
209
|
a(Error("aborted"));
|
|
209
210
|
}), navigator.geolocation.getCurrentPosition(
|
|
210
|
-
(
|
|
211
|
-
|
|
211
|
+
(u) => {
|
|
212
|
+
r([u.coords.longitude, u.coords.latitude].map((y) => y.toFixed(6)).join(","));
|
|
212
213
|
},
|
|
213
|
-
(
|
|
214
|
-
a(
|
|
214
|
+
(u) => {
|
|
215
|
+
a(u);
|
|
215
216
|
},
|
|
216
217
|
o
|
|
217
218
|
);
|
|
218
|
-
}),
|
|
219
|
+
}), s;
|
|
219
220
|
} catch {
|
|
220
221
|
} finally {
|
|
221
222
|
o.cachedLocationExpiry && (G = {
|
|
222
223
|
time: Date.now(),
|
|
223
|
-
coords:
|
|
224
|
+
coords: s
|
|
224
225
|
});
|
|
225
226
|
}
|
|
226
227
|
if (i.signal.aborted)
|
|
@@ -232,21 +233,21 @@ async function wt(t, e, i) {
|
|
|
232
233
|
return t[1].toFixed(6) + "," + t[2].toFixed(6);
|
|
233
234
|
}
|
|
234
235
|
}
|
|
235
|
-
const
|
|
236
|
-
var
|
|
236
|
+
const $t = ".sprite-icon{align-self:center;justify-self:center;opacity:.75;background-repeat:no-repeat}li{text-align:left;cursor:default;display:grid;grid-template-columns:40px 1fr;color:var(--color-text);padding:8px 0;font-size:14px;line-height:18px;min-width:fit-content;outline:0}li:first-child{padding-top:10px}li:last-child{padding-bottom:10px}li.picked{background-color:#e7edff}li.picked .secondary{color:#96a4c7;padding-left:4px}li.picked .line2{color:#96a4c7}li.selected{background-color:#f3f6ff;animation:backAndForth 5s linear infinite}li.selected .primary{color:#2b8bfb}li.selected .secondary{color:#a2adc7;padding-left:4px}li.selected .line2{color:#a2adc7}li>img{align-self:center;justify-self:center;opacity:.75}.texts{padding:0 17px 0 0}.texts>*{white-space:nowrap;display:block;min-width:fit-content}.primary{font-weight:600}.secondary{color:#aeb6c7;padding-left:4px}.line2{color:#aeb6c7}@keyframes backAndForth{0%{transform:translate(0)}10%{transform:translate(0)}45%{transform:translate(calc(-100% + 270px))}55%{transform:translate(calc(-100% + 270px))}90%{transform:translate(0)}to{transform:translate(0)}}";
|
|
237
|
+
var Lt = Object.defineProperty, It = Object.getOwnPropertyDescriptor, Se = (t) => {
|
|
237
238
|
throw TypeError(t);
|
|
238
|
-
},
|
|
239
|
-
for (var
|
|
240
|
-
(a = t[
|
|
241
|
-
return o &&
|
|
242
|
-
},
|
|
243
|
-
const
|
|
244
|
-
let C,
|
|
239
|
+
}, $ = (t, e, i, o) => {
|
|
240
|
+
for (var s = o > 1 ? void 0 : o ? It(e, i) : e, r = t.length - 1, a; r >= 0; r--)
|
|
241
|
+
(a = t[r]) && (s = (o ? a(e, i, s) : a(s)) || s);
|
|
242
|
+
return o && s && Lt(e, i, s), s;
|
|
243
|
+
}, Oe = (t, e, i) => e.has(t) || Se("Cannot " + i), f = (t, e, i) => (Oe(t, e, "read from private field"), i ? i.call(t) : e.get(t)), Ft = (t, e, i) => e.has(t) ? Se("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), U = (t, e, i) => (Oe(t, e, "access private method"), i), p, N, z, g, Te, Ce, de, ae;
|
|
244
|
+
const Pe = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Ee = Pe ? "@2x" : "", P = Pe ? 2 : 1;
|
|
245
|
+
let C, Ue, k = class extends M {
|
|
245
246
|
constructor() {
|
|
246
|
-
super(...arguments),
|
|
247
|
+
super(...arguments), Ft(this, p), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
|
|
247
248
|
}
|
|
248
249
|
willUpdate(t) {
|
|
249
|
-
t.has("feature") &&
|
|
250
|
+
t.has("feature") && f(this, p, N) && (this.index = f(this, p, N).length, U(this, p, de).call(this));
|
|
250
251
|
}
|
|
251
252
|
render() {
|
|
252
253
|
return m`
|
|
@@ -261,25 +262,25 @@ let C, Ee, w = class extends S {
|
|
|
261
262
|
${C && this.spriteIcon ? m`
|
|
262
263
|
<div
|
|
263
264
|
class="sprite-icon"
|
|
264
|
-
style=${
|
|
265
|
+
style=${Ke({
|
|
265
266
|
width: `${this.spriteIcon.width / P}px`,
|
|
266
267
|
height: `${this.spriteIcon.height / P}px`,
|
|
267
|
-
backgroundImage: `url(${this.iconsBaseUrl}sprite${
|
|
268
|
+
backgroundImage: `url(${this.iconsBaseUrl}sprite${Ee}.png)`,
|
|
268
269
|
backgroundPosition: `-${this.spriteIcon.x / P}px -${this.spriteIcon.y / P}px`,
|
|
269
270
|
backgroundSize: `${C.width / P}px ${C.height / P}px`
|
|
270
271
|
})}
|
|
271
|
-
title=${
|
|
272
|
+
title=${f(this, p, g)}
|
|
272
273
|
/>
|
|
273
|
-
` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${
|
|
274
|
+
` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${f(this, p, g)} @error=${U(this, p, Ce)} />` : this.feature?.address ? m` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : this.feature?.id.startsWith("road.") ? m` <img src=${this.iconsBaseUrl + "road.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : this.feature?.id.startsWith("address.") ? m` <img src=${this.iconsBaseUrl + "street.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? m` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : this.feature?.id.startsWith("poi.") ? m` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : f(this, p, z) ? m` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : m` <img src=${this.iconsBaseUrl + "area.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> `}
|
|
274
275
|
|
|
275
276
|
<span class="texts">
|
|
276
277
|
<span>
|
|
277
|
-
<span class="primary"> ${
|
|
278
|
+
<span class="primary"> ${f(this, p, z) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
|
|
278
279
|
|
|
279
|
-
${this.showPlaceType === "always" || this.showPlaceType !== "never" && !this.feature?.address && !this.feature?.id.startsWith("road.") && !this.feature?.id.startsWith("address.") && !this.feature?.id.startsWith("postal_code.") && (!this.feature?.id.startsWith("poi.") || !this.imageUrl) && !
|
|
280
|
+
${this.showPlaceType === "always" || this.showPlaceType !== "never" && !this.feature?.address && !this.feature?.id.startsWith("road.") && !this.feature?.id.startsWith("address.") && !this.feature?.id.startsWith("postal_code.") && (!this.feature?.id.startsWith("poi.") || !this.imageUrl) && !f(this, p, z) ? m` <span class="secondary"> ${f(this, p, g)} </span> ` : ee}
|
|
280
281
|
</span>
|
|
281
282
|
|
|
282
|
-
<span class="line2"> ${
|
|
283
|
+
<span class="line2"> ${f(this, p, z) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
|
|
283
284
|
</span>
|
|
284
285
|
</li>
|
|
285
286
|
`;
|
|
@@ -295,8 +296,8 @@ z = function() {
|
|
|
295
296
|
g = function() {
|
|
296
297
|
return this.feature?.properties?.categories?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
|
|
297
298
|
};
|
|
298
|
-
|
|
299
|
-
|
|
299
|
+
Te = function() {
|
|
300
|
+
Ue ??= fetch(`${this.iconsBaseUrl}sprite${Ee}.json`).then((t) => t.json()).then((t) => {
|
|
300
301
|
C = t;
|
|
301
302
|
}).catch(() => {
|
|
302
303
|
C = null;
|
|
@@ -306,59 +307,59 @@ Ce = function() {
|
|
|
306
307
|
this.imageUrl && this.missingIconsCache.add(this.imageUrl), U(this, p, de).call(this);
|
|
307
308
|
};
|
|
308
309
|
de = function() {
|
|
309
|
-
C !== void 0 ? U(this, p, ae).call(this) : (U(this, p,
|
|
310
|
+
C !== void 0 ? U(this, p, ae).call(this) : (U(this, p, Te).call(this), Ue?.then(() => {
|
|
310
311
|
U(this, p, ae).call(this);
|
|
311
312
|
}));
|
|
312
313
|
};
|
|
313
314
|
ae = function() {
|
|
314
315
|
do {
|
|
315
|
-
if (this.index--, this.category =
|
|
316
|
+
if (this.index--, this.category = f(this, p, N)?.[this.index], this.spriteIcon = this.category ? C?.icons[this.category] : void 0, this.spriteIcon)
|
|
316
317
|
break;
|
|
317
318
|
this.imageUrl = this.category ? this.iconsBaseUrl + this.category.replace(/ /g, "_") + ".svg" : void 0;
|
|
318
319
|
} while (this.index > -1 && (!this.imageUrl || this.missingIconsCache.has(this.imageUrl)));
|
|
319
320
|
};
|
|
320
|
-
|
|
321
|
-
${he(
|
|
321
|
+
k.styles = F`
|
|
322
|
+
${he($t)}
|
|
322
323
|
`;
|
|
323
|
-
|
|
324
|
+
$([
|
|
324
325
|
d({ type: Object })
|
|
325
|
-
],
|
|
326
|
-
|
|
326
|
+
], k.prototype, "feature", 2);
|
|
327
|
+
$([
|
|
327
328
|
d({ type: String })
|
|
328
|
-
],
|
|
329
|
-
|
|
329
|
+
], k.prototype, "itemStyle", 2);
|
|
330
|
+
$([
|
|
330
331
|
d({ type: String })
|
|
331
|
-
],
|
|
332
|
-
|
|
332
|
+
], k.prototype, "showPlaceType", 2);
|
|
333
|
+
$([
|
|
333
334
|
d({ attribute: !1 })
|
|
334
|
-
],
|
|
335
|
-
|
|
335
|
+
], k.prototype, "missingIconsCache", 2);
|
|
336
|
+
$([
|
|
336
337
|
d({ type: String })
|
|
337
|
-
],
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
],
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
],
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
],
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
],
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
],
|
|
353
|
-
const
|
|
354
|
-
var
|
|
338
|
+
], k.prototype, "iconsBaseUrl", 2);
|
|
339
|
+
$([
|
|
340
|
+
w()
|
|
341
|
+
], k.prototype, "category", 2);
|
|
342
|
+
$([
|
|
343
|
+
w()
|
|
344
|
+
], k.prototype, "imageUrl", 2);
|
|
345
|
+
$([
|
|
346
|
+
w()
|
|
347
|
+
], k.prototype, "spriteIcon", 2);
|
|
348
|
+
$([
|
|
349
|
+
w()
|
|
350
|
+
], k.prototype, "index", 2);
|
|
351
|
+
k = $([
|
|
352
|
+
S("maptiler-geocoder-feature-item")
|
|
353
|
+
], k);
|
|
354
|
+
const Mt = "form{font-family:Open Sans,Ubuntu,Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;background-color:#fff;z-index:10;border-radius:4px;margin:0;transition:max-width .25s;box-shadow:0 2px 5px #33335926;--color-text: #444952;--color-icon-button: #444952;pointer-events:all}form,form *,form *:after,form *:before{box-sizing:border-box}form.can-collapse{max-width:29px}form.can-collapse input::placeholder{transition:opacity .25s;opacity:0}form{width:270px;max-width:270px}form:focus-within,form:hover{width:270px;max-width:270px}form input::placeholder,form:focus-within input::placeholder,form:hover input::placeholder{opacity:1}input{font:inherit;font-size:14px;flex-grow:1;min-height:29px;background-color:transparent;color:#444952;white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input:focus{color:#444952;outline:0;outline:none;box-shadow:none}ul,div.error,div.no-results{background-color:#fff;border-radius:4px;left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul{font-size:14px;line-height:16px;box-shadow:0 5px 10px #33335926}div.error,div.no-results{font:inherit;line-height:18px;font-size:12px;display:flex;gap:16px}div.error{padding:16px;font-weight:600;color:#e25041;background-color:#fbeae8}div.error div{flex-grow:1}div.error maptiler-geocode-fail-icon{flex-shrink:0;width:20px;height:20px}div.error button{flex-shrink:0}div.error button maptiler-geocode-clear-icon{--color-icon-button: #e25041}div.error button:hover maptiler-geocode-clear-icon,div.error button:active maptiler-geocode-clear-icon{--color-icon-button: inherit}div.no-results{padding:14px 24px 14px 16px;font-weight:400;color:#6b7c93;box-shadow:0 5px 10px #33335926}div.no-results maptiler-geocode-fail-icon{margin-top:4px;flex-shrink:0;width:20px;height:20px}ul.options.open-on-top{top:auto;bottom:calc(100% + 6px)}button{padding:0;margin:0;border:0;background-color:transparent;height:auto;width:auto}button:hover{background-color:transparent}button:hover,button:active{--color-icon-button: #2b8bfb}.input-group{display:flex;align-items:stretch;gap:7px;padding-inline:8px;border-radius:4px;overflow:hidden}.input-group:focus-within{outline:#2b8bfb solid 2px}.search-button{flex-shrink:0}.clear-button-container{display:flex;display:none;position:relative;align-items:stretch}.clear-button-container.displayable{display:flex;flex-shrink:0}:host(.maptiler-geocoder):not(:empty){box-shadow:none}:host(.maptiler-geocoder) .input-group{border:white solid 2px}:host(.maptiler-geocoder) .input-group:focus-within{border:#2b8bfb solid 2px;outline:0;outline:none}:host(.maptiler-geocoder) form.can-collapse{max-width:33px}:host(.maptiler-geocoder) form,:host(.maptiler-geocoder) form:focus-within,:host(.maptiler-geocoder) form:hover{width:270px;max-width:270px}:host(.leaflet-geocoder) .input-group{border:white solid 1px}:host(.leaflet-geocoder) form.can-collapse{max-width:30px}";
|
|
355
|
+
var St = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, Be = (t) => {
|
|
355
356
|
throw TypeError(t);
|
|
356
357
|
}, c = (t, e, i, o) => {
|
|
357
|
-
for (var
|
|
358
|
-
(a = t[
|
|
359
|
-
return o &&
|
|
360
|
-
}, pe = (t, e, i) => e.has(t) ||
|
|
361
|
-
let l = class extends
|
|
358
|
+
for (var s = o > 1 ? void 0 : o ? Ot(e, i) : e, r = t.length - 1, a; r >= 0; r--)
|
|
359
|
+
(a = t[r]) && (s = (o ? a(e, i, s) : a(s)) || s);
|
|
360
|
+
return o && s && St(e, i, s), s;
|
|
361
|
+
}, pe = (t, e, i) => e.has(t) || Be("Cannot " + i), b = (t, e, i) => (pe(t, e, "read from private field"), i ? i.call(t) : e.get(t)), E = (t, e, i) => e.has(t) ? Be("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), W = (t, e, i, o) => (pe(t, e, "write to private field"), e.set(t, i), i), h = (t, e, i) => (pe(t, e, "access private method"), i), Q, q, j, ne, R, n, K, Ge, ze, ue, x, fe, Y, me, ge, I, ye, H, je, le, Re, Ae, De, Ve, We;
|
|
362
|
+
let l = class extends M {
|
|
362
363
|
constructor() {
|
|
363
364
|
super(...arguments), E(this, n), this.clearListOnPick = !1, this.clearOnBlur = !1, this.collapsed = !1, this.excludeTypes = !1, this.exhaustiveReverseGeocoding = !1, this.fetchFullGeometryOnPick = !1, this.keepListOpen = !1, this.openListOnTop = !1, this.reverseActive = !1, this.searchValue = "", this.selectedItemIndex = -1, this.cachedFeatures = [], this.lastSearchUrl = "", this.focused = !1, this.focusedDelayed = !1, E(this, Q, !1), E(this, q, !1), E(this, j), E(this, ne, /* @__PURE__ */ new Set()), E(this, R);
|
|
364
365
|
}
|
|
@@ -373,7 +374,7 @@ let l = class extends S {
|
|
|
373
374
|
setOptions(t) {
|
|
374
375
|
const e = { ...t };
|
|
375
376
|
for (const i of Object.keys(e))
|
|
376
|
-
|
|
377
|
+
Tt.includes(i) || delete e[i];
|
|
377
378
|
Object.assign(this, e);
|
|
378
379
|
}
|
|
379
380
|
/**
|
|
@@ -382,7 +383,7 @@ let l = class extends S {
|
|
|
382
383
|
* @param value text to set
|
|
383
384
|
*/
|
|
384
385
|
setQuery(t) {
|
|
385
|
-
h(this, n, ge).call(this, t), h(this, n, me).call(this);
|
|
386
|
+
h(this, n, ge).call(this, t, { external: !0 }), h(this, n, me).call(this);
|
|
386
387
|
}
|
|
387
388
|
/**
|
|
388
389
|
* Set the content of search input box and immediately submit it.
|
|
@@ -424,19 +425,19 @@ let l = class extends S {
|
|
|
424
425
|
}
|
|
425
426
|
/** @internal */
|
|
426
427
|
handleMapClick(t) {
|
|
427
|
-
this.reverseActive && h(this, n,
|
|
428
|
+
this.reverseActive && h(this, n, je).call(this, t);
|
|
428
429
|
}
|
|
429
430
|
willUpdate(t) {
|
|
430
|
-
t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, n, I).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) &&
|
|
431
|
+
t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, n, I).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && b(this, n, ue) && (h(this, n, I).call(this), this.error = void 0), ["focused"].some((e) => t.has(e)) && setTimeout(() => {
|
|
431
432
|
this.focusedDelayed = this.focused, this.clearOnBlur && !this.focused && (this.searchValue = "");
|
|
432
|
-
}, 100), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, n,
|
|
433
|
+
}, 100), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, n, x).call(this, "select", { feature: b(this, n, K) }), ["picked"].some((e) => t.has(e)) && this.picked && this.picked.id !== t.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? h(this, n, H).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
|
|
433
434
|
() => {
|
|
434
|
-
h(this, n,
|
|
435
|
+
h(this, n, x).call(this, "pick", { feature: this.picked });
|
|
435
436
|
},
|
|
436
437
|
(e) => {
|
|
437
|
-
e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, n,
|
|
438
|
+
e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, n, x).call(this, "pick", { feature: this.picked }));
|
|
438
439
|
}
|
|
439
|
-
), ["listFeatures", "focusedDelayed"].some((e) => t.has(e)) && (
|
|
440
|
+
), ["listFeatures", "focusedDelayed"].some((e) => t.has(e)) && (b(this, n, Ge) ? (h(this, n, x).call(this, "featuresshow"), W(this, q, !0)) : b(this, q) && h(this, n, x).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && h(this, n, x).call(this, "reversetoggle", { reverse: this.reverseActive });
|
|
440
441
|
}
|
|
441
442
|
render() {
|
|
442
443
|
return m`
|
|
@@ -458,15 +459,15 @@ let l = class extends S {
|
|
|
458
459
|
@blur=${() => this.focused = !1}
|
|
459
460
|
@click=${() => this.focused = !0}
|
|
460
461
|
@keydown=${h(this, n, le)}
|
|
461
|
-
@input=${h(this, n,
|
|
462
|
+
@input=${h(this, n, Re)}
|
|
462
463
|
@change=${() => this.picked = void 0}
|
|
463
464
|
placeholder=${this.placeholder ?? "Search"}
|
|
464
465
|
aria-label=${this.placeholder ?? "Search"}
|
|
465
466
|
/>
|
|
466
467
|
|
|
467
468
|
<div class="clear-button-container ${V({ displayable: this.searchValue !== "" })}">
|
|
468
|
-
${
|
|
469
|
-
<button type="button" @click=${h(this, n,
|
|
469
|
+
${b(this, n, ze) ? m`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : m`
|
|
470
|
+
<button type="button" @click=${h(this, n, We)} title=${this.clearButtonTitle ?? "clear"}>
|
|
470
471
|
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
471
472
|
</button>
|
|
472
473
|
`}
|
|
@@ -505,8 +506,8 @@ let l = class extends S {
|
|
|
505
506
|
</div>
|
|
506
507
|
</div>
|
|
507
508
|
` : m`
|
|
508
|
-
<ul class="options ${V({ "open-on-top": this.openListOnTop })}" @mouseleave=${h(this, n,
|
|
509
|
-
${
|
|
509
|
+
<ul class="options ${V({ "open-on-top": this.openListOnTop })}" @mouseleave=${h(this, n, Ve)} @keydown=${h(this, n, le)} role="listbox">
|
|
510
|
+
${Qe(
|
|
510
511
|
this.listFeatures,
|
|
511
512
|
(t) => t.id + (t.address ? "," + t.address : ""),
|
|
512
513
|
(t, e) => m`
|
|
@@ -515,13 +516,13 @@ let l = class extends S {
|
|
|
515
516
|
.showPlaceType=${this.showPlaceType ?? "if-needed"}
|
|
516
517
|
itemStyle=${this.selectedItemIndex === e ? "selected" : this.picked?.id === t.id ? "picked" : "default"}
|
|
517
518
|
@mouseenter=${() => {
|
|
518
|
-
h(this, n,
|
|
519
|
+
h(this, n, De).call(this, e);
|
|
519
520
|
}}
|
|
520
521
|
@select=${() => {
|
|
521
|
-
h(this, n,
|
|
522
|
+
h(this, n, Ae).call(this, t);
|
|
522
523
|
}}
|
|
523
|
-
.missingIconsCache=${
|
|
524
|
-
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.
|
|
524
|
+
.missingIconsCache=${b(this, ne)}
|
|
525
|
+
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.6/icons/"}
|
|
525
526
|
>
|
|
526
527
|
${t.place_name}
|
|
527
528
|
</maptiler-geocoder-feature-item>
|
|
@@ -542,17 +543,17 @@ n = /* @__PURE__ */ new WeakSet();
|
|
|
542
543
|
K = function() {
|
|
543
544
|
return this.listFeatures?.[this.selectedItemIndex];
|
|
544
545
|
};
|
|
545
|
-
|
|
546
|
+
Ge = function() {
|
|
546
547
|
return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
|
|
547
548
|
};
|
|
548
|
-
|
|
549
|
+
ze = function() {
|
|
549
550
|
return this.abortController !== void 0;
|
|
550
551
|
};
|
|
551
552
|
ue = function() {
|
|
552
553
|
return this.searchValue.length < (this.minLength ?? 2);
|
|
553
554
|
};
|
|
554
|
-
|
|
555
|
-
|
|
555
|
+
x = function(t, ...[e]) {
|
|
556
|
+
b(this, Q) && this.dispatchEvent(
|
|
556
557
|
new CustomEvent(t, {
|
|
557
558
|
bubbles: !0,
|
|
558
559
|
composed: !0,
|
|
@@ -561,13 +562,13 @@ v = function(t, ...[e]) {
|
|
|
561
562
|
);
|
|
562
563
|
};
|
|
563
564
|
fe = function(t) {
|
|
564
|
-
t?.preventDefault(), this.focused = !1, clearTimeout(
|
|
565
|
+
t?.preventDefault(), this.focused = !1, clearTimeout(b(this, j)), this.selectedItemIndex > -1 && this.listFeatures ? (this.picked = this.listFeatures[this.selectedItemIndex], this.searchValue = this.picked.place_type[0] === "reverse" ? this.picked.place_name : this.picked.place_name.replace(/,.*/, ""), this.error = void 0, this.selectedItemIndex = -1) : this.searchValue && h(this, n, H).call(this, this.searchValue, { exact: !0, external: t === void 0 }).then(() => {
|
|
565
566
|
this.picked = void 0;
|
|
566
567
|
}).catch((e) => this.error = e);
|
|
567
568
|
};
|
|
568
569
|
Y = function(t) {
|
|
569
570
|
try {
|
|
570
|
-
return
|
|
571
|
+
return Ne(t, 6);
|
|
571
572
|
} catch {
|
|
572
573
|
return !1;
|
|
573
574
|
}
|
|
@@ -577,87 +578,87 @@ me = function() {
|
|
|
577
578
|
this.input.focus(), this.focused = !0, this.input.select();
|
|
578
579
|
});
|
|
579
580
|
};
|
|
580
|
-
ge = function(t) {
|
|
581
|
-
if (this.searchValue = t, h(this, n,
|
|
582
|
-
if (clearTimeout(
|
|
581
|
+
ge = function(t, { external: e = !1 } = {}) {
|
|
582
|
+
if (this.searchValue = t, h(this, n, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n, Y).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
|
|
583
|
+
if (clearTimeout(b(this, j)), b(this, n, ue))
|
|
583
584
|
return;
|
|
584
|
-
const
|
|
585
|
+
const i = this.searchValue;
|
|
585
586
|
W(this, j, window.setTimeout(() => {
|
|
586
|
-
h(this, n, H).call(this, e).catch((
|
|
587
|
+
h(this, n, H).call(this, i, { external: e }).catch((o) => this.error = o);
|
|
587
588
|
}, this.debounceSearch ?? 200));
|
|
588
589
|
} else
|
|
589
590
|
h(this, n, I).call(this);
|
|
590
591
|
};
|
|
591
592
|
I = function() {
|
|
592
|
-
this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, n,
|
|
593
|
+
this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, n, x).call(this, "featuresclear"));
|
|
593
594
|
};
|
|
594
595
|
ye = function(t) {
|
|
595
|
-
this.searchValue = t, h(this, n,
|
|
596
|
+
this.searchValue = t, h(this, n, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n, Y).call(this, t) }), this.selectedItemIndex = -1, h(this, n, fe).call(this);
|
|
596
597
|
};
|
|
597
|
-
H = async function(t, { byId: e = !1, exact: i = !1 } = {}) {
|
|
598
|
+
H = async function(t, { byId: e = !1, exact: i = !1, external: o = !1 } = {}) {
|
|
598
599
|
this.error = void 0, this.abortController?.abort();
|
|
599
|
-
const
|
|
600
|
-
this.abortController =
|
|
600
|
+
const s = new AbortController();
|
|
601
|
+
this.abortController = s;
|
|
601
602
|
try {
|
|
602
|
-
const r = this.apiUrl ?? "https://api.maptiler.com/geocoding",
|
|
603
|
-
this.language !== void 0 &&
|
|
604
|
-
const [
|
|
605
|
-
let
|
|
606
|
-
(
|
|
607
|
-
).filter((
|
|
608
|
-
|
|
609
|
-
const
|
|
610
|
-
if (
|
|
611
|
-
const
|
|
612
|
-
|
|
603
|
+
const r = this.apiUrl ?? "https://api.maptiler.com/geocoding", a = h(this, n, Y).call(this, t), u = new URL(r + "/" + encodeURIComponent(a ? `${a.decimalLongitude},${a.decimalLatitude}` : t) + ".json"), y = u.searchParams;
|
|
604
|
+
this.language !== void 0 && y.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
|
|
605
|
+
const [O] = b(this, R) ?? [void 0];
|
|
606
|
+
let _ = (!a || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
|
|
607
|
+
(v) => typeof v == "string" ? v : O === void 0 || (v[0] ?? 0) <= O && O < (v[1] ?? 1 / 0) ? v[2] : void 0
|
|
608
|
+
).filter((v) => v !== void 0);
|
|
609
|
+
_ && (_ = [...new Set(_)], y.set("types", _.join(",")));
|
|
610
|
+
const ve = !a || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
|
|
611
|
+
if (ve && y.set("excludeTypes", String(ve)), this.bbox && y.set("bbox", this.bbox.map((v) => v.toFixed(6)).join(",")), this.country && y.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && y.set("worldview", this.worldview), !e && !a) {
|
|
612
|
+
const v = this.proximity ?? [{ type: "server-geolocation" }], be = await _t(b(this, R), v, s);
|
|
613
|
+
be && y.set("proximity", be), (i || this.showResultsWhileTyping === !1) && y.set("autocomplete", "false"), y.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
|
|
613
614
|
}
|
|
614
|
-
const
|
|
615
|
-
J > 1 &&
|
|
616
|
-
const
|
|
615
|
+
const xe = this.limit ?? 5, J = this.reverseGeocodingLimit ?? xe;
|
|
616
|
+
J > 1 && _?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), a ? (J === 1 || this.exhaustiveReverseGeocoding || _?.length === 1) && y.set("limit", String(J)) : y.set("limit", String(xe)), this.apiKey && y.set("key", this.apiKey), this.adjustUrl?.(u);
|
|
617
|
+
const qe = u.searchParams.get("types") === "" && u.searchParams.get("excludeTypes") !== "true", D = u.toString();
|
|
617
618
|
if (D === this.lastSearchUrl) {
|
|
618
|
-
e ? (this.clearListOnPick && h(this, n, I).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, n,
|
|
619
|
+
e ? (this.clearListOnPick && h(this, n, I).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, n, x).call(this, "featureslisted", { features: this.listFeatures, external: o }), this.listFeatures[this.selectedItemIndex]?.id !== b(this, n, K)?.id && (this.selectedItemIndex = -1));
|
|
619
620
|
return;
|
|
620
621
|
}
|
|
621
|
-
h(this, n,
|
|
622
|
+
h(this, n, x).call(this, "request", { urlObj: u }), this.lastSearchUrl = D;
|
|
622
623
|
let B;
|
|
623
|
-
if (
|
|
624
|
+
if (qe)
|
|
624
625
|
B = { type: "FeatureCollection", features: [] };
|
|
625
626
|
else {
|
|
626
|
-
const
|
|
627
|
-
signal:
|
|
627
|
+
const v = await fetch(D, {
|
|
628
|
+
signal: s.signal,
|
|
628
629
|
...this.fetchParameters
|
|
629
630
|
});
|
|
630
|
-
if (!
|
|
631
|
-
throw new Error(await
|
|
632
|
-
B = await
|
|
631
|
+
if (!v.ok)
|
|
632
|
+
throw new Error(await v.text());
|
|
633
|
+
B = await v.json();
|
|
633
634
|
}
|
|
634
|
-
h(this, n,
|
|
635
|
+
h(this, n, x).call(this, "response", { url: D, featureCollection: B }), e ? (this.clearListOnPick && h(this, n, I).call(this), this.picked = B.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = B.features.filter(this.filter ?? (() => !0)), a && this.listFeatures.unshift({
|
|
635
636
|
type: "Feature",
|
|
636
637
|
properties: {},
|
|
637
638
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
638
|
-
id: `reverse_${
|
|
639
|
-
text: `${
|
|
640
|
-
place_name:
|
|
639
|
+
id: `reverse_${a.decimalLongitude}_${a.decimalLatitude}`,
|
|
640
|
+
text: `${a.decimalLatitude}, ${a.decimalLongitude}`,
|
|
641
|
+
place_name: a.toCoordinateFormat("DMS"),
|
|
641
642
|
/* eslint-enable @typescript-eslint/restrict-template-expressions */
|
|
642
643
|
place_type: ["reverse"],
|
|
643
644
|
place_type_name: ["reverse"],
|
|
644
|
-
center: [
|
|
645
|
-
bbox: [
|
|
645
|
+
center: [a.decimalLongitude, a.decimalLatitude],
|
|
646
|
+
bbox: [a.decimalLongitude, a.decimalLatitude, a.decimalLongitude, a.decimalLatitude],
|
|
646
647
|
geometry: {
|
|
647
648
|
type: "Point",
|
|
648
|
-
coordinates: [
|
|
649
|
+
coordinates: [a.decimalLongitude, a.decimalLatitude]
|
|
649
650
|
}
|
|
650
|
-
}), h(this, n,
|
|
651
|
+
}), h(this, n, x).call(this, "featureslisted", { features: this.listFeatures, external: o }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== b(this, n, K)?.id && (this.selectedItemIndex = -1), a && this.input.focus());
|
|
651
652
|
} catch (r) {
|
|
652
653
|
if (r && typeof r == "object" && "name" in r && r.name === "AbortError")
|
|
653
654
|
return;
|
|
654
655
|
throw r;
|
|
655
656
|
} finally {
|
|
656
|
-
|
|
657
|
+
s === this.abortController && (this.abortController = void 0);
|
|
657
658
|
}
|
|
658
659
|
};
|
|
659
|
-
|
|
660
|
-
this.reverseActive = this.enableReverse === "always", h(this, n, I).call(this), this.picked = void 0, h(this, n, ye).call(this, `${t[1].toFixed(6)}, ${
|
|
660
|
+
je = function(t) {
|
|
661
|
+
this.reverseActive = this.enableReverse === "always", h(this, n, I).call(this), this.picked = void 0, h(this, n, ye).call(this, `${t[1].toFixed(6)}, ${kt(t[0], [-180, 180], !0).toFixed(6)}`), h(this, n, me).call(this);
|
|
661
662
|
};
|
|
662
663
|
le = function(t) {
|
|
663
664
|
if (!this.listFeatures)
|
|
@@ -665,23 +666,23 @@ le = function(t) {
|
|
|
665
666
|
const e = t.key === "ArrowDown" ? 1 : t.key === "ArrowUp" ? -1 : 0;
|
|
666
667
|
e && (this.input.focus(), this.focused = !0, t.preventDefault(), this.picked && this.selectedItemIndex === -1 && (this.selectedItemIndex = this.listFeatures.findIndex((i) => i.id === this.picked?.id)), this.selectedItemIndex === (this.picked || this.selectFirst !== !1 ? 0 : -1) && e === -1 && (this.selectedItemIndex = this.listFeatures.length), this.selectedItemIndex += e, this.selectedItemIndex >= this.listFeatures.length && (this.selectedItemIndex = -1), this.selectedItemIndex < 0 && (this.picked || this.selectFirst !== !1) && (this.selectedItemIndex = 0));
|
|
667
668
|
};
|
|
668
|
-
|
|
669
|
+
Re = function(t) {
|
|
669
670
|
h(this, n, ge).call(this, t.target.value);
|
|
670
671
|
};
|
|
671
|
-
|
|
672
|
+
Ae = function(t) {
|
|
672
673
|
(!this.picked || this.picked.id !== t.id) && (this.picked = t, this.searchValue = t.place_name);
|
|
673
674
|
};
|
|
674
|
-
|
|
675
|
+
De = function(t) {
|
|
675
676
|
this.selectedItemIndex = t;
|
|
676
677
|
};
|
|
677
|
-
|
|
678
|
+
Ve = function() {
|
|
678
679
|
(!this.selectFirst || this.picked) && (this.selectedItemIndex = -1);
|
|
679
680
|
};
|
|
680
|
-
|
|
681
|
-
this.searchValue = "", h(this, n,
|
|
681
|
+
We = function() {
|
|
682
|
+
this.searchValue = "", h(this, n, x).call(this, "queryclear"), this.picked = void 0, this.input.focus();
|
|
682
683
|
};
|
|
683
|
-
l.styles =
|
|
684
|
-
${he(
|
|
684
|
+
l.styles = F`
|
|
685
|
+
${he(Mt)}
|
|
685
686
|
`;
|
|
686
687
|
c([
|
|
687
688
|
d({ attribute: !1 })
|
|
@@ -795,42 +796,42 @@ c([
|
|
|
795
796
|
d({ type: String })
|
|
796
797
|
], l.prototype, "worldview", 2);
|
|
797
798
|
c([
|
|
798
|
-
|
|
799
|
+
Ze("input")
|
|
799
800
|
], l.prototype, "input", 2);
|
|
800
801
|
c([
|
|
801
|
-
|
|
802
|
+
w()
|
|
802
803
|
], l.prototype, "searchValue", 2);
|
|
803
804
|
c([
|
|
804
|
-
|
|
805
|
+
w()
|
|
805
806
|
], l.prototype, "listFeatures", 2);
|
|
806
807
|
c([
|
|
807
|
-
|
|
808
|
+
w()
|
|
808
809
|
], l.prototype, "selectedItemIndex", 2);
|
|
809
810
|
c([
|
|
810
|
-
|
|
811
|
+
w()
|
|
811
812
|
], l.prototype, "picked", 2);
|
|
812
813
|
c([
|
|
813
|
-
|
|
814
|
+
w()
|
|
814
815
|
], l.prototype, "cachedFeatures", 2);
|
|
815
816
|
c([
|
|
816
|
-
|
|
817
|
+
w()
|
|
817
818
|
], l.prototype, "lastSearchUrl", 2);
|
|
818
819
|
c([
|
|
819
|
-
|
|
820
|
+
w()
|
|
820
821
|
], l.prototype, "error", 2);
|
|
821
822
|
c([
|
|
822
|
-
|
|
823
|
+
w()
|
|
823
824
|
], l.prototype, "abortController", 2);
|
|
824
825
|
c([
|
|
825
|
-
|
|
826
|
+
w()
|
|
826
827
|
], l.prototype, "focused", 2);
|
|
827
828
|
c([
|
|
828
|
-
|
|
829
|
+
w()
|
|
829
830
|
], l.prototype, "focusedDelayed", 2);
|
|
830
831
|
l = c([
|
|
831
|
-
|
|
832
|
+
S("maptiler-geocoder")
|
|
832
833
|
], l);
|
|
833
|
-
const
|
|
834
|
+
const Tt = [
|
|
834
835
|
"adjustUrl",
|
|
835
836
|
"apiKey",
|
|
836
837
|
"apiUrl",
|
|
@@ -868,13 +869,13 @@ const Ft = [
|
|
|
868
869
|
"types",
|
|
869
870
|
"reverseGeocodingTypes",
|
|
870
871
|
"worldview"
|
|
871
|
-
],
|
|
872
|
-
var
|
|
873
|
-
for (var
|
|
874
|
-
(a = t[
|
|
875
|
-
return
|
|
872
|
+
], Ct = "svg{display:block;fill:var(--maptiler-geocode-marker-fill, #3170fe);stroke:var(--maptiler-geocode-marker-stroke, #3170fe);height:30px}:host(.marker-selected){z-index:2}:host(.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fill, #98b7ff);stroke:var(--maptiler-geocode-marker-selected-stroke, #3170fe)}:host(.marker-reverse) svg path{fill:var(--maptiler-geocode-marker-reverse-fill, silver);stroke:var(--maptiler-geocode-marker-reverse-stroke, gray)}:host(.marker-interactive){cursor:pointer!important}:host(.marker-fuzzy) svg path{fill:var(--maptiler-geocode-marker-fuzzy-fill, silver);stroke:var(--maptiler-geocode-marker-fuzzy-stroke, gray)}:host(.marker-fuzzy.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fuzzy-fill, #ddd);stroke:var(--maptiler-geocode-marker-selected-fuzzy-stroke, silver)}";
|
|
873
|
+
var Pt = Object.getOwnPropertyDescriptor, Et = (t, e, i, o) => {
|
|
874
|
+
for (var s = o > 1 ? void 0 : o ? Pt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
|
|
875
|
+
(a = t[r]) && (s = a(s) || s);
|
|
876
|
+
return s;
|
|
876
877
|
};
|
|
877
|
-
let ce = class extends
|
|
878
|
+
let ce = class extends M {
|
|
878
879
|
render() {
|
|
879
880
|
return A`
|
|
880
881
|
<svg
|
|
@@ -890,16 +891,16 @@ let ce = class extends S {
|
|
|
890
891
|
`;
|
|
891
892
|
}
|
|
892
893
|
};
|
|
893
|
-
ce.styles =
|
|
894
|
-
${he(
|
|
894
|
+
ce.styles = F`
|
|
895
|
+
${he(Ct)}
|
|
895
896
|
`;
|
|
896
|
-
ce =
|
|
897
|
-
|
|
897
|
+
ce = Et([
|
|
898
|
+
S("maptiler-geocode-marker")
|
|
898
899
|
], ce);
|
|
899
|
-
function
|
|
900
|
-
const e =
|
|
901
|
-
|
|
902
|
-
|
|
900
|
+
function Ut(t) {
|
|
901
|
+
const e = ot(
|
|
902
|
+
Ie([
|
|
903
|
+
nt([
|
|
903
904
|
[
|
|
904
905
|
[180, 90],
|
|
905
906
|
[-180, 90],
|
|
@@ -914,22 +915,22 @@ function Pt(t) {
|
|
|
914
915
|
if (!e)
|
|
915
916
|
return;
|
|
916
917
|
e.properties = { isMask: !0 };
|
|
917
|
-
const i = Z(
|
|
918
|
-
if (a.features.length > 1 && (
|
|
919
|
-
for (const
|
|
920
|
-
const
|
|
921
|
-
if (
|
|
922
|
-
for (const
|
|
923
|
-
for (const
|
|
924
|
-
|
|
925
|
-
if (
|
|
926
|
-
for (const
|
|
927
|
-
for (const
|
|
928
|
-
|
|
918
|
+
const i = Z(Le(t)), o = (i[2] - i[0]) / 360 / 1e3, s = i[0] < -180, r = i[2] > 180, a = at(t);
|
|
919
|
+
if (a.features.length > 1 && (s || r))
|
|
920
|
+
for (const u of a.features) {
|
|
921
|
+
const y = Z(Le(u));
|
|
922
|
+
if (r && y[0] < -180 + o)
|
|
923
|
+
for (const O of u.geometry.coordinates)
|
|
924
|
+
for (const _ of O)
|
|
925
|
+
_[0] += 360 - o;
|
|
926
|
+
if (s && y[2] > 180 - o)
|
|
927
|
+
for (const O of u.geometry.coordinates)
|
|
928
|
+
for (const _ of O)
|
|
929
|
+
_[0] -= 360 - o;
|
|
929
930
|
}
|
|
930
|
-
return
|
|
931
|
+
return Ie([a.features.length < 2 ? t : lt(a) ?? t, e]);
|
|
931
932
|
}
|
|
932
|
-
const
|
|
933
|
+
const Bt = {
|
|
933
934
|
continental_marine: 4,
|
|
934
935
|
country: 4,
|
|
935
936
|
major_landform: 8,
|
|
@@ -953,25 +954,25 @@ const Et = {
|
|
|
953
954
|
"poi.restaurant": 18,
|
|
954
955
|
"poi.aerodrome": 13
|
|
955
956
|
// TODO add many more
|
|
956
|
-
},
|
|
957
|
-
const i = t.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.
|
|
958
|
-
return new
|
|
957
|
+
}, Gt = (t) => (e) => {
|
|
958
|
+
const i = t.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.6/icons/", o = e.getProperties(), s = e.getGeometry()?.getType(), r = o.isMask ? 0 : s === "LineString" || s === "MultiLineString" ? 3 : 2;
|
|
959
|
+
return new ht({
|
|
959
960
|
stroke: o.isMask ? void 0 : new Me({
|
|
960
961
|
color: "#3170fe",
|
|
961
|
-
lineDash: [
|
|
962
|
-
width:
|
|
962
|
+
lineDash: [r, r],
|
|
963
|
+
width: r,
|
|
963
964
|
lineCap: "butt"
|
|
964
965
|
}),
|
|
965
|
-
fill: o.isMask ? new
|
|
966
|
+
fill: o.isMask ? new Fe({
|
|
966
967
|
color: "#00000020"
|
|
967
968
|
}) : void 0,
|
|
968
|
-
image: new
|
|
969
|
+
image: new ct({
|
|
969
970
|
src: `${i}marker_${o.isReverse ? "reverse" : o.isSelected ? "selected" : "unselected"}.svg`,
|
|
970
971
|
anchor: [0.5, 1]
|
|
971
972
|
}),
|
|
972
973
|
zIndex: o.isSelected ? 2 : o.isReverse ? 0 : 1,
|
|
973
|
-
text: (o.isSelected || o.isMouseOver) && o.tooltip ? new
|
|
974
|
-
backgroundFill: new
|
|
974
|
+
text: (o.isSelected || o.isMouseOver) && o.tooltip ? new dt({
|
|
975
|
+
backgroundFill: new Fe({ color: "white" }),
|
|
975
976
|
text: o.tooltip,
|
|
976
977
|
offsetY: -40,
|
|
977
978
|
backgroundStroke: new Me({
|
|
@@ -982,27 +983,27 @@ const Et = {
|
|
|
982
983
|
padding: [2, 0, 0, 2]
|
|
983
984
|
}) : void 0
|
|
984
985
|
});
|
|
985
|
-
},
|
|
986
|
-
class
|
|
987
|
-
#t;
|
|
986
|
+
}, T = "EPSG:4326";
|
|
987
|
+
class li extends Ye {
|
|
988
988
|
#e;
|
|
989
|
+
#t;
|
|
989
990
|
#r;
|
|
990
991
|
constructor(e = {}) {
|
|
991
992
|
const i = document.createElement("div");
|
|
992
993
|
super({
|
|
993
994
|
element: i,
|
|
994
995
|
...e
|
|
995
|
-
}), this.#
|
|
996
|
+
}), this.#e = e, this.#r = document.createElement("maptiler-geocoder"), this.#r.classList.add("openlayers-geocoder"), this.#b(), i.classList.add("openlayers-ctrl-geocoder"), i.style.zIndex = "3", i.appendChild(this.#r);
|
|
996
997
|
}
|
|
997
998
|
/** @internal Not to be called directly */
|
|
998
999
|
setMap(e) {
|
|
999
|
-
super.setMap(e), this.#
|
|
1000
|
+
super.setMap(e), this.#t && this.#t !== e && (this.#I(), this.#P(), this.#t = void 0), e && (this.#t = e, this.#L(), this.#C());
|
|
1000
1001
|
}
|
|
1001
1002
|
getOptions() {
|
|
1002
|
-
return { ...this.#
|
|
1003
|
+
return { ...this.#e };
|
|
1003
1004
|
}
|
|
1004
1005
|
setOptions(e) {
|
|
1005
|
-
Object.assign(this.#
|
|
1006
|
+
Object.assign(this.#e, e), this.#b();
|
|
1006
1007
|
}
|
|
1007
1008
|
setQuery(e) {
|
|
1008
1009
|
this.#r.setQuery(e);
|
|
@@ -1062,11 +1063,11 @@ class oi extends Ke {
|
|
|
1062
1063
|
},
|
|
1063
1064
|
select: (e) => {
|
|
1064
1065
|
const i = e.detail.feature;
|
|
1065
|
-
i && this.#m && this.#
|
|
1066
|
+
i && this.#m && this.#e.flyToSelected && this.#w(i.center, this.#p(i)), this.#a && i && this.#T(i), this.#i("select", e.detail);
|
|
1066
1067
|
},
|
|
1067
1068
|
pick: (e) => {
|
|
1068
1069
|
const i = e.detail.feature;
|
|
1069
|
-
i && i.id !== this.#g && this.#m && (this.#
|
|
1070
|
+
i && i.id !== this.#g && this.#m && (this.#F(i), this.#u(this.#a, i)), this.#g = i?.id, this.#i("pick", e.detail);
|
|
1070
1071
|
},
|
|
1071
1072
|
featuresshow: () => {
|
|
1072
1073
|
this.#i("featuresshow");
|
|
@@ -1076,7 +1077,7 @@ class oi extends Ke {
|
|
|
1076
1077
|
},
|
|
1077
1078
|
featureslisted: (e) => {
|
|
1078
1079
|
const i = e.detail.features;
|
|
1079
|
-
this.#a = i, this.#u(this.#a, void 0), this.#
|
|
1080
|
+
this.#a = i, this.#u(this.#a, void 0), this.#M(e), this.#i("featureslisted", e.detail);
|
|
1080
1081
|
},
|
|
1081
1082
|
featuresclear: () => {
|
|
1082
1083
|
this.#a = void 0, this.#u(void 0, void 0), this.#i("featuresclear");
|
|
@@ -1090,95 +1091,96 @@ class oi extends Ke {
|
|
|
1090
1091
|
};
|
|
1091
1092
|
#x = {
|
|
1092
1093
|
postrender: () => {
|
|
1093
|
-
const e = this.#
|
|
1094
|
+
const e = this.#t?.getView().getZoom(), i = this.#t?.getView().getCenter();
|
|
1094
1095
|
this.#r.handleMapChange(e && i ? [e, ...this.#$(i)] : void 0);
|
|
1095
1096
|
},
|
|
1096
1097
|
click: (e) => {
|
|
1097
|
-
this.#r.handleMapClick(this.#$(e.coordinate)), this.#
|
|
1098
|
-
const o = i.getId(),
|
|
1099
|
-
if (!(!o || !
|
|
1100
|
-
return e.stopPropagation(), this.#i("markerclick", { feature:
|
|
1098
|
+
this.#r.handleMapClick(this.#$(e.coordinate)), this.#t?.forEachFeatureAtPixel(e.pixel, (i) => {
|
|
1099
|
+
const o = i.getId(), s = this.#a?.find((r) => r.id === o);
|
|
1100
|
+
if (!(!o || !s))
|
|
1101
|
+
return e.stopPropagation(), this.#i("markerclick", { feature: s, marker: i }), !0;
|
|
1101
1102
|
});
|
|
1102
1103
|
},
|
|
1103
1104
|
pointermove: (e) => {
|
|
1104
|
-
if (!this.#
|
|
1105
|
-
const i = this.#
|
|
1106
|
-
this.#
|
|
1105
|
+
if (!this.#t) return;
|
|
1106
|
+
const i = this.#t.forEachFeatureAtPixel(e.pixel, (s) => s.getId() ? s : void 0);
|
|
1107
|
+
this.#t.getTargetElement().style.cursor = i ? "pointer" : this.#y ? "crosshair" : "";
|
|
1107
1108
|
const o = i?.getId();
|
|
1108
1109
|
if (this.#d !== o) {
|
|
1109
1110
|
if (this.#d) {
|
|
1110
|
-
const
|
|
1111
|
-
|
|
1111
|
+
const s = this.#a?.find((a) => a.id === this.#d), r = this.#c.get(s);
|
|
1112
|
+
r?.set("isMouseOver", !1), s && r && this.#i("markermouseleave", { feature: s, marker: r });
|
|
1112
1113
|
}
|
|
1113
1114
|
if (i) {
|
|
1114
|
-
const
|
|
1115
|
-
this.#i("markermouseenter", { feature:
|
|
1115
|
+
const s = this.#a?.find((r) => r.id === o);
|
|
1116
|
+
this.#i("markermouseenter", { feature: s, marker: i }), i.set("isMouseOver", !0);
|
|
1116
1117
|
}
|
|
1117
1118
|
this.#d = o;
|
|
1118
1119
|
}
|
|
1119
1120
|
}
|
|
1120
1121
|
};
|
|
1121
1122
|
#b() {
|
|
1122
|
-
this.#r.setOptions(this.#
|
|
1123
|
+
this.#r.setOptions(this.#e), this.#r.fetchFullGeometryOnPick = this.#e.pickedResultStyle !== "marker-only";
|
|
1123
1124
|
}
|
|
1124
1125
|
#L() {
|
|
1125
|
-
if (this.#
|
|
1126
|
+
if (this.#t) {
|
|
1126
1127
|
for (const [e, i] of Object.entries(this.#v))
|
|
1127
1128
|
this.#r.addEventListener(e, i);
|
|
1128
1129
|
for (const [e, i] of Object.entries(this.#x))
|
|
1129
|
-
this.#
|
|
1130
|
+
this.#t.on([e], i);
|
|
1130
1131
|
}
|
|
1131
1132
|
}
|
|
1132
1133
|
#I() {
|
|
1133
|
-
if (this.#
|
|
1134
|
+
if (this.#t) {
|
|
1134
1135
|
for (const [e, i] of Object.entries(this.#v))
|
|
1135
1136
|
this.#r.removeEventListener(e, i);
|
|
1136
1137
|
for (const [e, i] of Object.entries(this.#x))
|
|
1137
|
-
this.#
|
|
1138
|
+
this.#t.un([e], i);
|
|
1138
1139
|
}
|
|
1139
1140
|
}
|
|
1140
1141
|
#i(e, i) {
|
|
1141
|
-
this.dispatchEvent(
|
|
1142
|
+
this.dispatchEvent(Object.assign(new He(e), i));
|
|
1142
1143
|
}
|
|
1143
|
-
#
|
|
1144
|
+
#F(e) {
|
|
1144
1145
|
e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#w(e.center, this.#p(e)) : this.#k(Z(e.bbox), 50, this.#p(e));
|
|
1145
1146
|
}
|
|
1146
|
-
#
|
|
1147
|
-
if (!e || e.length === 0 || !this.#m)
|
|
1148
|
-
|
|
1149
|
-
|
|
1147
|
+
#M({ detail: { features: e, external: i } }) {
|
|
1148
|
+
if (!e || e.length === 0 || !this.#m || this.#e.flyToFeatures === !1 || this.#e.flyToFeatures === "never" || !i && (this.#e.flyToFeatures === void 0 || this.#e.flyToFeatures === "external"))
|
|
1149
|
+
return;
|
|
1150
|
+
const o = e.every((a) => a.matching_text), s = e.reduce(
|
|
1151
|
+
(a, u) => o || !u.matching_text ? [Math.min(a[0], u.bbox[0]), Math.min(a[1], u.bbox[1]), Math.max(a[2], u.bbox[2]), Math.max(a[3], u.bbox[3])] : a,
|
|
1150
1152
|
[180, 90, -180, -90]
|
|
1151
|
-
), r = e.map((
|
|
1152
|
-
this.#k(Z(
|
|
1153
|
+
), r = e.map((a) => this.#p(a)).filter((a) => a !== void 0).reduce((a, u) => a === void 0 ? u : Math.max(a, u), void 0);
|
|
1154
|
+
this.#k(Z(s), 50, r);
|
|
1153
1155
|
}
|
|
1154
1156
|
#p(e) {
|
|
1155
1157
|
if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
|
|
1156
1158
|
return;
|
|
1157
|
-
const i = e.id.replace(/\..*/, ""), o = this.#
|
|
1158
|
-
return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((
|
|
1159
|
-
const a = o[i + "." +
|
|
1160
|
-
return
|
|
1159
|
+
const i = e.id.replace(/\..*/, ""), o = this.#e.zoom ?? Bt;
|
|
1160
|
+
return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((s, r) => {
|
|
1161
|
+
const a = o[i + "." + r];
|
|
1162
|
+
return s === void 0 ? a : a === void 0 ? s : Math.max(s, a);
|
|
1161
1163
|
}, void 0) : void 0) ?? o[i];
|
|
1162
1164
|
}
|
|
1163
1165
|
get #m() {
|
|
1164
|
-
return !!this.#
|
|
1166
|
+
return !!this.#e.flyTo || this.#e.flyTo === void 0;
|
|
1165
1167
|
}
|
|
1166
|
-
get #
|
|
1167
|
-
return typeof this.#
|
|
1168
|
+
get #S() {
|
|
1169
|
+
return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
|
|
1168
1170
|
}
|
|
1169
1171
|
get #O() {
|
|
1170
|
-
return typeof this.#
|
|
1172
|
+
return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
|
|
1171
1173
|
}
|
|
1172
1174
|
#w(e, i) {
|
|
1173
|
-
this.#
|
|
1175
|
+
this.#t?.getView().animate({
|
|
1174
1176
|
center: this.#f(e),
|
|
1175
1177
|
...i ? { zoom: i } : {},
|
|
1176
1178
|
duration: 2e3,
|
|
1177
|
-
...this.#
|
|
1179
|
+
...this.#S
|
|
1178
1180
|
});
|
|
1179
1181
|
}
|
|
1180
1182
|
#k(e, i, o) {
|
|
1181
|
-
this.#
|
|
1183
|
+
this.#t?.getView().fit(et(e, T, this.#n()), {
|
|
1182
1184
|
padding: [i, i, i, i],
|
|
1183
1185
|
...o ? { maxZoom: o } : {},
|
|
1184
1186
|
duration: 2e3,
|
|
@@ -1186,7 +1188,7 @@ class oi extends Ke {
|
|
|
1186
1188
|
});
|
|
1187
1189
|
}
|
|
1188
1190
|
#_(e) {
|
|
1189
|
-
if (this.#
|
|
1191
|
+
if (this.#e.marker === !1 || !this.#t || !this.#s)
|
|
1190
1192
|
return;
|
|
1191
1193
|
if (!e) {
|
|
1192
1194
|
this.#o && (this.#s.removeFeature(this.#o), this.#o.dispose(), this.#o = void 0);
|
|
@@ -1194,82 +1196,82 @@ class oi extends Ke {
|
|
|
1194
1196
|
}
|
|
1195
1197
|
const i = this.#f(e);
|
|
1196
1198
|
if (!this.#o) {
|
|
1197
|
-
this.#o = new
|
|
1199
|
+
this.#o = new L(new X(i)), this.#o.set("isReverse", !0), this.#s.addFeature(this.#o);
|
|
1198
1200
|
return;
|
|
1199
1201
|
}
|
|
1200
1202
|
this.#o.getGeometry().setCoordinates(i);
|
|
1201
1203
|
}
|
|
1202
1204
|
#u(e, i) {
|
|
1203
|
-
if (!this.#
|
|
1205
|
+
if (!this.#t || !this.#s)
|
|
1204
1206
|
return;
|
|
1205
1207
|
this.#s.removeFeatures([...this.#c.values()]), this.#c = /* @__PURE__ */ new Map();
|
|
1206
1208
|
const o = () => {
|
|
1207
|
-
if (!i || !this.#
|
|
1208
|
-
const
|
|
1209
|
-
|
|
1209
|
+
if (!i || !this.#t || this.#e.marker === !1) return;
|
|
1210
|
+
const s = new L(new X(this.#f(i.center)));
|
|
1211
|
+
s.setId(i.id), this.#c.set(i, s), this.#s?.addFeature(s);
|
|
1210
1212
|
};
|
|
1211
1213
|
if (i?.geometry.type === "GeometryCollection") {
|
|
1212
|
-
const
|
|
1213
|
-
if (
|
|
1214
|
-
this.#s.addFeature(new
|
|
1214
|
+
const s = i.geometry.geometries.map((r) => r.type === "Polygon" ? new we(r.coordinates) : r.type === "MultiPolygon" ? new ke(r.coordinates) : null).filter((r) => !!r);
|
|
1215
|
+
if (s.length > 0)
|
|
1216
|
+
this.#s.addFeature(new L(new Je(s).transform(T, this.#n())));
|
|
1215
1217
|
else
|
|
1216
|
-
for (const
|
|
1217
|
-
|
|
1218
|
+
for (const r of i.geometry.geometries)
|
|
1219
|
+
r.type === "LineString" ? this.#s.addFeature(new L(new _e(r.coordinates).transform(T, this.#n()))) : r.type === "MultiLineString" && this.#s.addFeature(new L(new $e(r.coordinates).transform(T, this.#n())));
|
|
1218
1220
|
} else if (i?.geometry.type.endsWith("Polygon")) {
|
|
1219
|
-
const
|
|
1220
|
-
if (
|
|
1221
|
-
for (const
|
|
1222
|
-
const a =
|
|
1221
|
+
const s = Ut(i);
|
|
1222
|
+
if (s)
|
|
1223
|
+
for (const r of s.features) {
|
|
1224
|
+
const a = r.geometry.type === "Polygon" ? new we(r.geometry.coordinates) : new ke(r.geometry.coordinates);
|
|
1223
1225
|
this.#s.addFeature(
|
|
1224
|
-
new
|
|
1225
|
-
isMask: !!
|
|
1226
|
-
geometry: a.transform(
|
|
1226
|
+
new L({
|
|
1227
|
+
isMask: !!r.properties?.isMask,
|
|
1228
|
+
geometry: a.transform(T, this.#n())
|
|
1227
1229
|
})
|
|
1228
1230
|
);
|
|
1229
1231
|
}
|
|
1230
|
-
this.#
|
|
1231
|
-
} else i?.geometry.type === "LineString" ? this.#s.addFeature(new
|
|
1232
|
-
if (this.#
|
|
1233
|
-
for (const
|
|
1234
|
-
if (
|
|
1232
|
+
this.#e.pickedResultStyle === "full-geometry-including-polygon-center-marker" && o();
|
|
1233
|
+
} else i?.geometry.type === "LineString" ? this.#s.addFeature(new L(new _e(i.geometry.coordinates).transform(T, this.#n()))) : i?.geometry.type === "MultiLineString" ? this.#s.addFeature(new L(new $e(i.geometry.coordinates).transform(T, this.#n()))) : i?.geometry.type.endsWith("Point") && o();
|
|
1234
|
+
if (this.#e.showResultMarkers !== !1)
|
|
1235
|
+
for (const s of e ?? []) {
|
|
1236
|
+
if (s.id === i?.id || s.place_type.includes("reverse"))
|
|
1235
1237
|
continue;
|
|
1236
|
-
const
|
|
1237
|
-
|
|
1238
|
-
fuzzy: !!
|
|
1239
|
-
tooltip:
|
|
1240
|
-
}), this.#s.addFeature(
|
|
1238
|
+
const r = new L(new X(this.#f(s.center)));
|
|
1239
|
+
r.setId(s.id), r.setProperties({
|
|
1240
|
+
fuzzy: !!s.matching_text,
|
|
1241
|
+
tooltip: s.place_type[0] === "reverse" ? s.place_name : s.place_name.replace(/,.*/, "")
|
|
1242
|
+
}), this.#s.addFeature(r), this.#c.set(s, r);
|
|
1241
1243
|
}
|
|
1242
1244
|
}
|
|
1243
|
-
#
|
|
1244
|
-
this.#h?.set("isSelected", !1), this.#h = void 0, this.#
|
|
1245
|
+
#T(e) {
|
|
1246
|
+
this.#h?.set("isSelected", !1), this.#h = void 0, this.#e.markerOnSelected !== !1 && (this.#h = this.#c.get(e), this.#h?.setProperties({ isSelected: !0 }));
|
|
1245
1247
|
}
|
|
1246
|
-
#
|
|
1247
|
-
this.#
|
|
1248
|
+
#C() {
|
|
1249
|
+
this.#t && (this.#s = new rt({}), this.#l = new Xe({
|
|
1248
1250
|
updateWhileAnimating: !0
|
|
1249
|
-
}), this.#l.setSource(this.#s), this.#l.setStyle(this.#E()), this.#
|
|
1251
|
+
}), this.#l.setSource(this.#s), this.#l.setStyle(this.#E()), this.#t.addLayer(this.#l));
|
|
1250
1252
|
}
|
|
1251
1253
|
#P() {
|
|
1252
|
-
!this.#
|
|
1254
|
+
!this.#t || !this.#l || (this.#t.removeLayer(this.#l), this.#l = void 0);
|
|
1253
1255
|
}
|
|
1254
1256
|
#n() {
|
|
1255
|
-
return
|
|
1257
|
+
return tt() ?? this.#t?.getView().getProjection();
|
|
1256
1258
|
}
|
|
1257
1259
|
#f(e) {
|
|
1258
|
-
return
|
|
1260
|
+
return it(e, this.#n());
|
|
1259
1261
|
}
|
|
1260
1262
|
#$(e) {
|
|
1261
|
-
return
|
|
1263
|
+
return st(e, this.#n());
|
|
1262
1264
|
}
|
|
1263
1265
|
#E() {
|
|
1264
|
-
const { fullGeometryStyle: e } = this.#
|
|
1265
|
-
if (e === !0 || e === void 0) return
|
|
1266
|
+
const { fullGeometryStyle: e } = this.#e;
|
|
1267
|
+
if (e === !0 || e === void 0) return Gt(this.#e);
|
|
1266
1268
|
if (!(e === !1 || e === null))
|
|
1267
1269
|
return e;
|
|
1268
1270
|
}
|
|
1269
1271
|
}
|
|
1270
1272
|
export {
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
+
Gt as DEFAULT_GEOMETRY_STYLE,
|
|
1274
|
+
li as GeocodingControl,
|
|
1273
1275
|
te as MaptilerGeocodeClearIconElement,
|
|
1274
1276
|
ie as MaptilerGeocodeFailIconElement,
|
|
1275
1277
|
se as MaptilerGeocodeLoadingIconElement,
|
|
@@ -1277,7 +1279,7 @@ export {
|
|
|
1277
1279
|
re as MaptilerGeocodeReverseGeocodingIconElement,
|
|
1278
1280
|
oe as MaptilerGeocodeSearchIconElement,
|
|
1279
1281
|
l as MaptilerGeocoderElement,
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
+
li as OpenLayersGeocodingControl,
|
|
1283
|
+
Bt as ZOOM_DEFAULTS
|
|
1282
1284
|
};
|
|
1283
1285
|
//# sourceMappingURL=openlayers.public.js.map
|