@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
package/dist/leaflet.public.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { customElement as
|
|
3
|
-
import { convert as
|
|
1
|
+
import { css as M, LitElement as O, svg as R, html as g, unsafeCSS as ce, nothing as J } from "lit";
|
|
2
|
+
import { customElement as C, property as p, state as w, query as We } from "lit/decorators.js";
|
|
3
|
+
import { convert as Ve } from "geo-coordinates-parser";
|
|
4
4
|
import { classMap as A } from "lit/directives/class-map.js";
|
|
5
|
-
import { repeat as
|
|
6
|
-
import
|
|
7
|
-
import { styleMap as
|
|
5
|
+
import { repeat as qe } from "lit/directives/repeat.js";
|
|
6
|
+
import Ne from "@turf/clone";
|
|
7
|
+
import { styleMap as Ze } from "lit/directives/style-map.js";
|
|
8
8
|
import X from "@turf/bbox";
|
|
9
|
-
import { featureCollection as q, polygon as
|
|
10
|
-
import
|
|
11
|
-
import { Evented as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
var
|
|
15
|
-
for (var
|
|
16
|
-
(
|
|
17
|
-
return
|
|
9
|
+
import { featureCollection as q, polygon as Qe, feature as Ke } from "@turf/helpers";
|
|
10
|
+
import $e from "@turf/union";
|
|
11
|
+
import { Evented as He, Control as Ye, DomEvent as be, Popup as Je, GeoJSON as Xe, DivIcon as et, Marker as tt } from "leaflet";
|
|
12
|
+
import it from "@turf/difference";
|
|
13
|
+
import st from "@turf/flatten";
|
|
14
|
+
var ot = Object.getOwnPropertyDescriptor, rt = (t, e, i, r) => {
|
|
15
|
+
for (var s = r > 1 ? void 0 : r ? ot(e, i) : e, a = t.length - 1, o; a >= 0; a--)
|
|
16
|
+
(o = t[a]) && (s = o(s) || s);
|
|
17
|
+
return s;
|
|
18
18
|
};
|
|
19
|
-
let ee = class extends
|
|
19
|
+
let ee = class extends O {
|
|
20
20
|
render() {
|
|
21
21
|
return R`
|
|
22
22
|
<svg viewBox="0 0 14 14" width="13" height="13">
|
|
@@ -27,21 +27,21 @@ let ee = class extends M {
|
|
|
27
27
|
`;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
ee.styles =
|
|
30
|
+
ee.styles = M`
|
|
31
31
|
svg {
|
|
32
32
|
display: block;
|
|
33
33
|
fill: var(--color-icon-button);
|
|
34
34
|
}
|
|
35
35
|
`;
|
|
36
|
-
ee =
|
|
37
|
-
|
|
36
|
+
ee = rt([
|
|
37
|
+
C("maptiler-geocode-clear-icon")
|
|
38
38
|
], ee);
|
|
39
|
-
var
|
|
40
|
-
for (var
|
|
41
|
-
(
|
|
42
|
-
return
|
|
39
|
+
var at = Object.getOwnPropertyDescriptor, nt = (t, e, i, r) => {
|
|
40
|
+
for (var s = r > 1 ? void 0 : r ? at(e, i) : e, a = t.length - 1, o; a >= 0; a--)
|
|
41
|
+
(o = t[a]) && (s = o(s) || s);
|
|
42
|
+
return s;
|
|
43
43
|
};
|
|
44
|
-
let te = class extends
|
|
44
|
+
let te = class extends O {
|
|
45
45
|
render() {
|
|
46
46
|
return R`
|
|
47
47
|
<svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -52,23 +52,23 @@ let te = class extends M {
|
|
|
52
52
|
`;
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
te.styles =
|
|
55
|
+
te.styles = M`
|
|
56
56
|
svg {
|
|
57
57
|
display: block;
|
|
58
58
|
fill: #e15042;
|
|
59
59
|
}
|
|
60
60
|
`;
|
|
61
|
-
te =
|
|
62
|
-
|
|
61
|
+
te = nt([
|
|
62
|
+
C("maptiler-geocode-fail-icon")
|
|
63
63
|
], te);
|
|
64
|
-
var
|
|
65
|
-
for (var
|
|
66
|
-
(
|
|
67
|
-
return
|
|
64
|
+
var lt = Object.getOwnPropertyDescriptor, ct = (t, e, i, r) => {
|
|
65
|
+
for (var s = r > 1 ? void 0 : r ? lt(e, i) : e, a = t.length - 1, o; a >= 0; a--)
|
|
66
|
+
(o = t[a]) && (s = o(s) || s);
|
|
67
|
+
return s;
|
|
68
68
|
};
|
|
69
|
-
let ie = class extends
|
|
69
|
+
let ie = class extends O {
|
|
70
70
|
render() {
|
|
71
|
-
return
|
|
71
|
+
return g`
|
|
72
72
|
<div>
|
|
73
73
|
<svg viewBox="0 0 18 18" width="24" height="24" class="loading-icon">
|
|
74
74
|
<path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z" />
|
|
@@ -78,7 +78,7 @@ let ie = class extends M {
|
|
|
78
78
|
`;
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
ie.styles =
|
|
81
|
+
ie.styles = M`
|
|
82
82
|
div {
|
|
83
83
|
position: absolute;
|
|
84
84
|
left: 50%;
|
|
@@ -105,15 +105,15 @@ ie.styles = I`
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
`;
|
|
108
|
-
ie =
|
|
109
|
-
|
|
108
|
+
ie = ct([
|
|
109
|
+
C("maptiler-geocode-loading-icon")
|
|
110
110
|
], ie);
|
|
111
|
-
var
|
|
112
|
-
for (var
|
|
113
|
-
(
|
|
114
|
-
return
|
|
111
|
+
var ht = Object.getOwnPropertyDescriptor, pt = (t, e, i, r) => {
|
|
112
|
+
for (var s = r > 1 ? void 0 : r ? ht(e, i) : e, a = t.length - 1, o; a >= 0; a--)
|
|
113
|
+
(o = t[a]) && (s = o(s) || s);
|
|
114
|
+
return s;
|
|
115
115
|
};
|
|
116
|
-
let se = class extends
|
|
116
|
+
let se = class extends O {
|
|
117
117
|
render() {
|
|
118
118
|
return R`
|
|
119
119
|
<svg viewBox="0 0 60.006 21.412" width="14" height="20">
|
|
@@ -124,21 +124,21 @@ let se = class extends M {
|
|
|
124
124
|
`;
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
|
-
se.styles =
|
|
127
|
+
se.styles = M`
|
|
128
128
|
svg {
|
|
129
129
|
display: block;
|
|
130
130
|
fill: var(--color-icon-button);
|
|
131
131
|
}
|
|
132
132
|
`;
|
|
133
|
-
se =
|
|
134
|
-
|
|
133
|
+
se = pt([
|
|
134
|
+
C("maptiler-geocode-reverse-geocoding-icon")
|
|
135
135
|
], se);
|
|
136
|
-
var
|
|
137
|
-
for (var
|
|
138
|
-
(
|
|
139
|
-
return
|
|
136
|
+
var dt = Object.getOwnPropertyDescriptor, ut = (t, e, i, r) => {
|
|
137
|
+
for (var s = r > 1 ? void 0 : r ? dt(e, i) : e, a = t.length - 1, o; a >= 0; a--)
|
|
138
|
+
(o = t[a]) && (s = o(s) || s);
|
|
139
|
+
return s;
|
|
140
140
|
};
|
|
141
|
-
let oe = class extends
|
|
141
|
+
let oe = class extends O {
|
|
142
142
|
render() {
|
|
143
143
|
return R`
|
|
144
144
|
<svg
|
|
@@ -153,7 +153,7 @@ let oe = class extends M {
|
|
|
153
153
|
`;
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
|
-
oe.styles =
|
|
156
|
+
oe.styles = M`
|
|
157
157
|
circle {
|
|
158
158
|
stroke-width: 1.875;
|
|
159
159
|
fill: none;
|
|
@@ -169,34 +169,34 @@ oe.styles = I`
|
|
|
169
169
|
stroke: var(--color-icon-button);
|
|
170
170
|
}
|
|
171
171
|
`;
|
|
172
|
-
oe =
|
|
173
|
-
|
|
172
|
+
oe = ut([
|
|
173
|
+
C("maptiler-geocode-search-icon")
|
|
174
174
|
], oe);
|
|
175
|
-
function
|
|
176
|
-
const r = e[1],
|
|
177
|
-
return t === r && i ? t : ((t -
|
|
175
|
+
function ft(t, e, i) {
|
|
176
|
+
const r = e[1], s = e[0], a = r - s;
|
|
177
|
+
return t === r && i ? t : ((t - s) % a + a) % a + s;
|
|
178
178
|
}
|
|
179
179
|
function U(t) {
|
|
180
180
|
const e = [...t];
|
|
181
181
|
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;
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
const i =
|
|
183
|
+
function we(t, e) {
|
|
184
|
+
const i = Ne(t);
|
|
185
185
|
for (const r of i.features)
|
|
186
186
|
if (r.geometry.type == "MultiPolygon")
|
|
187
|
-
for (const
|
|
188
|
-
|
|
187
|
+
for (const s of r.geometry.coordinates)
|
|
188
|
+
ke(s, e);
|
|
189
189
|
else
|
|
190
|
-
|
|
190
|
+
ke(r.geometry.coordinates, e);
|
|
191
191
|
return i;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function ke(t, e) {
|
|
194
194
|
for (const i of t)
|
|
195
195
|
for (const r of i)
|
|
196
196
|
r[0] += e;
|
|
197
197
|
}
|
|
198
198
|
let B;
|
|
199
|
-
async function
|
|
199
|
+
async function mt(t, e, i) {
|
|
200
200
|
for (const r of e ?? [])
|
|
201
201
|
if (!(t && (r.minZoom != null && r.minZoom > t[0] || r.maxZoom != null && r.maxZoom < t[0]))) {
|
|
202
202
|
if (r.type === "fixed")
|
|
@@ -206,26 +206,26 @@ async function ft(t, e, i) {
|
|
|
206
206
|
if (B.coords)
|
|
207
207
|
return B.coords;
|
|
208
208
|
} else {
|
|
209
|
-
let
|
|
209
|
+
let s;
|
|
210
210
|
try {
|
|
211
|
-
return
|
|
211
|
+
return s = await new Promise((a, o) => {
|
|
212
212
|
i.signal.addEventListener("abort", () => {
|
|
213
|
-
|
|
213
|
+
o(Error("aborted"));
|
|
214
214
|
}), navigator.geolocation.getCurrentPosition(
|
|
215
215
|
(u) => {
|
|
216
|
-
|
|
216
|
+
a([u.coords.longitude, u.coords.latitude].map((m) => m.toFixed(6)).join(","));
|
|
217
217
|
},
|
|
218
218
|
(u) => {
|
|
219
|
-
|
|
219
|
+
o(u);
|
|
220
220
|
},
|
|
221
221
|
r
|
|
222
222
|
);
|
|
223
|
-
}),
|
|
223
|
+
}), s;
|
|
224
224
|
} catch {
|
|
225
225
|
} finally {
|
|
226
226
|
r.cachedLocationExpiry && (B = {
|
|
227
227
|
time: Date.now(),
|
|
228
|
-
coords:
|
|
228
|
+
coords: s
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
if (i.signal.aborted)
|
|
@@ -237,24 +237,24 @@ async function ft(t, e, i) {
|
|
|
237
237
|
return t[1].toFixed(6) + "," + t[2].toFixed(6);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
const
|
|
241
|
-
var
|
|
240
|
+
const gt = ".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)}}";
|
|
241
|
+
var yt = Object.defineProperty, vt = Object.getOwnPropertyDescriptor, Le = (t) => {
|
|
242
242
|
throw TypeError(t);
|
|
243
|
-
},
|
|
244
|
-
for (var
|
|
245
|
-
(
|
|
246
|
-
return r &&
|
|
247
|
-
},
|
|
248
|
-
const
|
|
249
|
-
let
|
|
243
|
+
}, L = (t, e, i, r) => {
|
|
244
|
+
for (var s = r > 1 ? void 0 : r ? vt(e, i) : e, a = t.length - 1, o; a >= 0; a--)
|
|
245
|
+
(o = t[a]) && (s = (r ? o(e, i, s) : o(s)) || s);
|
|
246
|
+
return r && s && yt(e, i, s), s;
|
|
247
|
+
}, Ie = (t, e, i) => e.has(t) || Le("Cannot " + i), f = (t, e, i) => (Ie(t, e, "read from private field"), i ? i.call(t) : e.get(t)), xt = (t, e, i) => e.has(t) ? Le("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), E = (t, e, i) => (Ie(t, e, "access private method"), i), d, N, G, y, Me, Oe, he, re;
|
|
248
|
+
const Ce = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Te = Ce ? "@2x" : "", F = Ce ? 2 : 1;
|
|
249
|
+
let T, Fe, k = class extends O {
|
|
250
250
|
constructor() {
|
|
251
|
-
super(...arguments),
|
|
251
|
+
super(...arguments), xt(this, d), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
|
|
252
252
|
}
|
|
253
253
|
willUpdate(t) {
|
|
254
254
|
t.has("feature") && f(this, d, N) && (this.index = f(this, d, N).length, E(this, d, he).call(this));
|
|
255
255
|
}
|
|
256
256
|
render() {
|
|
257
|
-
return
|
|
257
|
+
return g`
|
|
258
258
|
<li
|
|
259
259
|
tabindex="-1"
|
|
260
260
|
role="option"
|
|
@@ -263,25 +263,25 @@ let C, Te, _ = class extends M {
|
|
|
263
263
|
class=${this.itemStyle}
|
|
264
264
|
@click=${() => this.dispatchEvent(new CustomEvent("select"))}
|
|
265
265
|
>
|
|
266
|
-
${
|
|
266
|
+
${T && this.spriteIcon ? g`
|
|
267
267
|
<div
|
|
268
268
|
class="sprite-icon"
|
|
269
|
-
style=${
|
|
269
|
+
style=${Ze({
|
|
270
270
|
width: `${this.spriteIcon.width / F}px`,
|
|
271
271
|
height: `${this.spriteIcon.height / F}px`,
|
|
272
|
-
backgroundImage: `url(${this.iconsBaseUrl}sprite${
|
|
272
|
+
backgroundImage: `url(${this.iconsBaseUrl}sprite${Te}.png)`,
|
|
273
273
|
backgroundPosition: `-${this.spriteIcon.x / F}px -${this.spriteIcon.y / F}px`,
|
|
274
|
-
backgroundSize: `${
|
|
274
|
+
backgroundSize: `${T.width / F}px ${T.height / F}px`
|
|
275
275
|
})}
|
|
276
|
-
title=${f(this, d,
|
|
276
|
+
title=${f(this, d, y)}
|
|
277
277
|
/>
|
|
278
|
-
` : this.imageUrl ?
|
|
278
|
+
` : this.imageUrl ? g` <img src=${this.imageUrl} alt=${this.category} title=${f(this, d, y)} @error=${E(this, d, Oe)} />` : this.feature?.address ? g` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${f(this, d, y)} title=${f(this, d, y)} /> ` : this.feature?.id.startsWith("road.") ? g` <img src=${this.iconsBaseUrl + "road.svg"} alt=${f(this, d, y)} title=${f(this, d, y)} /> ` : this.feature?.id.startsWith("address.") ? g` <img src=${this.iconsBaseUrl + "street.svg"} alt=${f(this, d, y)} title=${f(this, d, y)} /> ` : this.feature?.id.startsWith("postal_code.") ? g` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${f(this, d, y)} title=${f(this, d, y)} /> ` : this.feature?.id.startsWith("poi.") ? g` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${f(this, d, y)} title=${f(this, d, y)} /> ` : f(this, d, G) ? g` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${f(this, d, y)} title=${f(this, d, y)} /> ` : g` <img src=${this.iconsBaseUrl + "area.svg"} alt=${f(this, d, y)} title=${f(this, d, y)} /> `}
|
|
279
279
|
|
|
280
280
|
<span class="texts">
|
|
281
281
|
<span>
|
|
282
282
|
<span class="primary"> ${f(this, d, G) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
|
|
283
283
|
|
|
284
|
-
${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, d, G) ?
|
|
284
|
+
${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, d, G) ? g` <span class="secondary"> ${f(this, d, y)} </span> ` : J}
|
|
285
285
|
</span>
|
|
286
286
|
|
|
287
287
|
<span class="line2"> ${f(this, d, G) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
|
|
@@ -297,73 +297,73 @@ N = function() {
|
|
|
297
297
|
G = function() {
|
|
298
298
|
return this.feature?.place_type[0] === "reverse";
|
|
299
299
|
};
|
|
300
|
-
|
|
300
|
+
y = function() {
|
|
301
301
|
return this.feature?.properties?.categories?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
|
|
302
302
|
};
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
303
|
+
Me = function() {
|
|
304
|
+
Fe ??= fetch(`${this.iconsBaseUrl}sprite${Te}.json`).then((t) => t.json()).then((t) => {
|
|
305
|
+
T = t;
|
|
306
306
|
}).catch(() => {
|
|
307
|
-
|
|
307
|
+
T = null;
|
|
308
308
|
});
|
|
309
309
|
};
|
|
310
|
-
|
|
310
|
+
Oe = function() {
|
|
311
311
|
this.imageUrl && this.missingIconsCache.add(this.imageUrl), E(this, d, he).call(this);
|
|
312
312
|
};
|
|
313
313
|
he = function() {
|
|
314
|
-
|
|
314
|
+
T !== void 0 ? E(this, d, re).call(this) : (E(this, d, Me).call(this), Fe?.then(() => {
|
|
315
315
|
E(this, d, re).call(this);
|
|
316
316
|
}));
|
|
317
317
|
};
|
|
318
318
|
re = function() {
|
|
319
319
|
do {
|
|
320
|
-
if (this.index--, this.category = f(this, d, N)?.[this.index], this.spriteIcon = this.category ?
|
|
320
|
+
if (this.index--, this.category = f(this, d, N)?.[this.index], this.spriteIcon = this.category ? T?.icons[this.category] : void 0, this.spriteIcon)
|
|
321
321
|
break;
|
|
322
322
|
this.imageUrl = this.category ? this.iconsBaseUrl + this.category.replace(/ /g, "_") + ".svg" : void 0;
|
|
323
323
|
} while (this.index > -1 && (!this.imageUrl || this.missingIconsCache.has(this.imageUrl)));
|
|
324
324
|
};
|
|
325
|
-
|
|
326
|
-
${ce(
|
|
325
|
+
k.styles = M`
|
|
326
|
+
${ce(gt)}
|
|
327
327
|
`;
|
|
328
|
-
|
|
328
|
+
L([
|
|
329
329
|
p({ type: Object })
|
|
330
|
-
],
|
|
331
|
-
|
|
330
|
+
], k.prototype, "feature", 2);
|
|
331
|
+
L([
|
|
332
332
|
p({ type: String })
|
|
333
|
-
],
|
|
334
|
-
|
|
333
|
+
], k.prototype, "itemStyle", 2);
|
|
334
|
+
L([
|
|
335
335
|
p({ type: String })
|
|
336
|
-
],
|
|
337
|
-
|
|
336
|
+
], k.prototype, "showPlaceType", 2);
|
|
337
|
+
L([
|
|
338
338
|
p({ attribute: !1 })
|
|
339
|
-
],
|
|
340
|
-
|
|
339
|
+
], k.prototype, "missingIconsCache", 2);
|
|
340
|
+
L([
|
|
341
341
|
p({ type: String })
|
|
342
|
-
],
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
],
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
],
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
],
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
],
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
],
|
|
358
|
-
const
|
|
359
|
-
var
|
|
342
|
+
], k.prototype, "iconsBaseUrl", 2);
|
|
343
|
+
L([
|
|
344
|
+
w()
|
|
345
|
+
], k.prototype, "category", 2);
|
|
346
|
+
L([
|
|
347
|
+
w()
|
|
348
|
+
], k.prototype, "imageUrl", 2);
|
|
349
|
+
L([
|
|
350
|
+
w()
|
|
351
|
+
], k.prototype, "spriteIcon", 2);
|
|
352
|
+
L([
|
|
353
|
+
w()
|
|
354
|
+
], k.prototype, "index", 2);
|
|
355
|
+
k = L([
|
|
356
|
+
C("maptiler-geocoder-feature-item")
|
|
357
|
+
], k);
|
|
358
|
+
const bt = "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}";
|
|
359
|
+
var wt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, Se = (t) => {
|
|
360
360
|
throw TypeError(t);
|
|
361
361
|
}, c = (t, e, i, r) => {
|
|
362
|
-
for (var
|
|
363
|
-
(
|
|
364
|
-
return r &&
|
|
365
|
-
}, pe = (t, e, i) => e.has(t) ||
|
|
366
|
-
let l = class extends
|
|
362
|
+
for (var s = r > 1 ? void 0 : r ? kt(e, i) : e, a = t.length - 1, o; a >= 0; a--)
|
|
363
|
+
(o = t[a]) && (s = (r ? o(e, i, s) : o(s)) || s);
|
|
364
|
+
return r && s && wt(e, i, s), s;
|
|
365
|
+
}, pe = (t, e, i) => e.has(t) || Se("Cannot " + i), b = (t, e, i) => (pe(t, e, "read from private field"), i ? i.call(t) : e.get(t)), S = (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), W = (t, e, i, r) => (pe(t, e, "write to private field"), e.set(t, i), i), h = (t, e, i) => (pe(t, e, "access private method"), i), Z, V, z, ae, D, n, Q, Ee, Pe, de, x, ue, K, fe, me, I, ge, H, Be, ne, Ge, Ue, ze, De, Re;
|
|
366
|
+
let l = class extends O {
|
|
367
367
|
constructor() {
|
|
368
368
|
super(...arguments), S(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, S(this, Z, !1), S(this, V, !1), S(this, z), S(this, ae, /* @__PURE__ */ new Set()), S(this, D);
|
|
369
369
|
}
|
|
@@ -378,7 +378,7 @@ let l = class extends M {
|
|
|
378
378
|
setOptions(t) {
|
|
379
379
|
const e = { ...t };
|
|
380
380
|
for (const i of Object.keys(e))
|
|
381
|
-
|
|
381
|
+
_t.includes(i) || delete e[i];
|
|
382
382
|
Object.assign(this, e);
|
|
383
383
|
}
|
|
384
384
|
/**
|
|
@@ -387,7 +387,7 @@ let l = class extends M {
|
|
|
387
387
|
* @param value text to set
|
|
388
388
|
*/
|
|
389
389
|
setQuery(t) {
|
|
390
|
-
h(this, n, me).call(this, t), h(this, n, fe).call(this);
|
|
390
|
+
h(this, n, me).call(this, t, { external: !0 }), h(this, n, fe).call(this);
|
|
391
391
|
}
|
|
392
392
|
/**
|
|
393
393
|
* Set the content of search input box and immediately submit it.
|
|
@@ -401,7 +401,7 @@ let l = class extends M {
|
|
|
401
401
|
* Clear search result list.
|
|
402
402
|
*/
|
|
403
403
|
clearList() {
|
|
404
|
-
h(this, n,
|
|
404
|
+
h(this, n, I).call(this), this.picked = void 0, this.selectedItemIndex = -1;
|
|
405
405
|
}
|
|
406
406
|
/**
|
|
407
407
|
* Focus the search input box.
|
|
@@ -429,22 +429,22 @@ let l = class extends M {
|
|
|
429
429
|
}
|
|
430
430
|
/** @internal */
|
|
431
431
|
handleMapClick(t) {
|
|
432
|
-
this.reverseActive && h(this, n,
|
|
432
|
+
this.reverseActive && h(this, n, Be).call(this, t);
|
|
433
433
|
}
|
|
434
434
|
willUpdate(t) {
|
|
435
|
-
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,
|
|
435
|
+
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, de) && (h(this, n, I).call(this), this.error = void 0), ["focused"].some((e) => t.has(e)) && setTimeout(() => {
|
|
436
436
|
this.focusedDelayed = this.focused, this.clearOnBlur && !this.focused && (this.searchValue = "");
|
|
437
|
-
}, 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,
|
|
437
|
+
}, 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, Q) }), ["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(
|
|
438
438
|
() => {
|
|
439
|
-
h(this, n,
|
|
439
|
+
h(this, n, x).call(this, "pick", { feature: this.picked });
|
|
440
440
|
},
|
|
441
441
|
(e) => {
|
|
442
|
-
e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, n,
|
|
442
|
+
e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, n, x).call(this, "pick", { feature: this.picked }));
|
|
443
443
|
}
|
|
444
|
-
), ["listFeatures", "focusedDelayed"].some((e) => t.has(e)) && (
|
|
444
|
+
), ["listFeatures", "focusedDelayed"].some((e) => t.has(e)) && (b(this, n, Ee) ? (h(this, n, x).call(this, "featuresshow"), W(this, V, !0)) : b(this, V) && h(this, n, x).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && h(this, n, x).call(this, "reversetoggle", { reverse: this.reverseActive });
|
|
445
445
|
}
|
|
446
446
|
render() {
|
|
447
|
-
return
|
|
447
|
+
return g`
|
|
448
448
|
<form @submit=${h(this, n, ue)} class=${A({ "can-collapse": this.collapsed && this.searchValue === "" })}>
|
|
449
449
|
<div class="input-group">
|
|
450
450
|
<button
|
|
@@ -463,21 +463,21 @@ let l = class extends M {
|
|
|
463
463
|
@blur=${() => this.focused = !1}
|
|
464
464
|
@click=${() => this.focused = !0}
|
|
465
465
|
@keydown=${h(this, n, ne)}
|
|
466
|
-
@input=${h(this, n,
|
|
466
|
+
@input=${h(this, n, Ge)}
|
|
467
467
|
@change=${() => this.picked = void 0}
|
|
468
468
|
placeholder=${this.placeholder ?? "Search"}
|
|
469
469
|
aria-label=${this.placeholder ?? "Search"}
|
|
470
470
|
/>
|
|
471
471
|
|
|
472
472
|
<div class="clear-button-container ${A({ displayable: this.searchValue !== "" })}">
|
|
473
|
-
${
|
|
474
|
-
<button type="button" @click=${h(this, n,
|
|
473
|
+
${b(this, n, Pe) ? g`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : g`
|
|
474
|
+
<button type="button" @click=${h(this, n, Re)} title=${this.clearButtonTitle ?? "clear"}>
|
|
475
475
|
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
476
476
|
</button>
|
|
477
477
|
`}
|
|
478
478
|
</div>
|
|
479
479
|
|
|
480
|
-
${this.enableReverse === "button" ?
|
|
480
|
+
${this.enableReverse === "button" ? g`
|
|
481
481
|
<button
|
|
482
482
|
type="button"
|
|
483
483
|
class=${A({ active: this.reverseActive })}
|
|
@@ -491,7 +491,7 @@ let l = class extends M {
|
|
|
491
491
|
<!-- <slot /> -->
|
|
492
492
|
</div>
|
|
493
493
|
|
|
494
|
-
${this.error ?
|
|
494
|
+
${this.error ? g`
|
|
495
495
|
<div class="error">
|
|
496
496
|
<maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
|
|
497
497
|
|
|
@@ -501,7 +501,7 @@ let l = class extends M {
|
|
|
501
501
|
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
502
502
|
</button>
|
|
503
503
|
</div>
|
|
504
|
-
` : !this.focusedDelayed && !this.keepListOpen || this.listFeatures === void 0 ? J : this.listFeatures.length === 0 ?
|
|
504
|
+
` : !this.focusedDelayed && !this.keepListOpen || this.listFeatures === void 0 ? J : this.listFeatures.length === 0 ? g`
|
|
505
505
|
<div class="no-results">
|
|
506
506
|
<maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
|
|
507
507
|
|
|
@@ -509,24 +509,24 @@ let l = class extends M {
|
|
|
509
509
|
${this.noResultsMessage ?? "Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}
|
|
510
510
|
</div>
|
|
511
511
|
</div>
|
|
512
|
-
` :
|
|
513
|
-
<ul class="options ${A({ "open-on-top": this.openListOnTop })}" @mouseleave=${h(this, n,
|
|
514
|
-
${
|
|
512
|
+
` : g`
|
|
513
|
+
<ul class="options ${A({ "open-on-top": this.openListOnTop })}" @mouseleave=${h(this, n, De)} @keydown=${h(this, n, ne)} role="listbox">
|
|
514
|
+
${qe(
|
|
515
515
|
this.listFeatures,
|
|
516
516
|
(t) => t.id + (t.address ? "," + t.address : ""),
|
|
517
|
-
(t, e) =>
|
|
517
|
+
(t, e) => g`
|
|
518
518
|
<maptiler-geocoder-feature-item
|
|
519
519
|
.feature=${t}
|
|
520
520
|
.showPlaceType=${this.showPlaceType ?? "if-needed"}
|
|
521
521
|
itemStyle=${this.selectedItemIndex === e ? "selected" : this.picked?.id === t.id ? "picked" : "default"}
|
|
522
522
|
@mouseenter=${() => {
|
|
523
|
-
h(this, n,
|
|
523
|
+
h(this, n, ze).call(this, e);
|
|
524
524
|
}}
|
|
525
525
|
@select=${() => {
|
|
526
|
-
h(this, n,
|
|
526
|
+
h(this, n, Ue).call(this, t);
|
|
527
527
|
}}
|
|
528
|
-
.missingIconsCache=${
|
|
529
|
-
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.
|
|
528
|
+
.missingIconsCache=${b(this, ae)}
|
|
529
|
+
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.6/icons/"}
|
|
530
530
|
>
|
|
531
531
|
${t.place_name}
|
|
532
532
|
</maptiler-geocoder-feature-item>
|
|
@@ -547,17 +547,17 @@ n = /* @__PURE__ */ new WeakSet();
|
|
|
547
547
|
Q = function() {
|
|
548
548
|
return this.listFeatures?.[this.selectedItemIndex];
|
|
549
549
|
};
|
|
550
|
-
|
|
550
|
+
Ee = function() {
|
|
551
551
|
return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
|
|
552
552
|
};
|
|
553
|
-
|
|
553
|
+
Pe = function() {
|
|
554
554
|
return this.abortController !== void 0;
|
|
555
555
|
};
|
|
556
556
|
de = function() {
|
|
557
557
|
return this.searchValue.length < (this.minLength ?? 2);
|
|
558
558
|
};
|
|
559
|
-
|
|
560
|
-
|
|
559
|
+
x = function(t, ...[e]) {
|
|
560
|
+
b(this, Z) && this.dispatchEvent(
|
|
561
561
|
new CustomEvent(t, {
|
|
562
562
|
bubbles: !0,
|
|
563
563
|
composed: !0,
|
|
@@ -566,13 +566,13 @@ v = function(t, ...[e]) {
|
|
|
566
566
|
);
|
|
567
567
|
};
|
|
568
568
|
ue = function(t) {
|
|
569
|
-
t?.preventDefault(), this.focused = !1, clearTimeout(
|
|
569
|
+
t?.preventDefault(), this.focused = !1, clearTimeout(b(this, z)), 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(() => {
|
|
570
570
|
this.picked = void 0;
|
|
571
571
|
}).catch((e) => this.error = e);
|
|
572
572
|
};
|
|
573
573
|
K = function(t) {
|
|
574
574
|
try {
|
|
575
|
-
return
|
|
575
|
+
return Ve(t, 6);
|
|
576
576
|
} catch {
|
|
577
577
|
return !1;
|
|
578
578
|
}
|
|
@@ -582,87 +582,87 @@ fe = function() {
|
|
|
582
582
|
this.input.focus(), this.focused = !0, this.input.select();
|
|
583
583
|
});
|
|
584
584
|
};
|
|
585
|
-
me = function(t) {
|
|
586
|
-
if (this.searchValue = t, h(this, n,
|
|
587
|
-
if (clearTimeout(
|
|
585
|
+
me = function(t, { external: e = !1 } = {}) {
|
|
586
|
+
if (this.searchValue = t, h(this, n, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n, K).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
|
|
587
|
+
if (clearTimeout(b(this, z)), b(this, n, de))
|
|
588
588
|
return;
|
|
589
|
-
const
|
|
589
|
+
const i = this.searchValue;
|
|
590
590
|
W(this, z, window.setTimeout(() => {
|
|
591
|
-
h(this, n, H).call(this, e).catch((
|
|
591
|
+
h(this, n, H).call(this, i, { external: e }).catch((r) => this.error = r);
|
|
592
592
|
}, this.debounceSearch ?? 200));
|
|
593
593
|
} else
|
|
594
|
-
h(this, n,
|
|
594
|
+
h(this, n, I).call(this);
|
|
595
595
|
};
|
|
596
|
-
|
|
597
|
-
this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, n,
|
|
596
|
+
I = function() {
|
|
597
|
+
this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, n, x).call(this, "featuresclear"));
|
|
598
598
|
};
|
|
599
599
|
ge = function(t) {
|
|
600
|
-
this.searchValue = t, h(this, n,
|
|
600
|
+
this.searchValue = t, h(this, n, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n, K).call(this, t) }), this.selectedItemIndex = -1, h(this, n, ue).call(this);
|
|
601
601
|
};
|
|
602
|
-
H = async function(t, { byId: e = !1, exact: i = !1 } = {}) {
|
|
602
|
+
H = async function(t, { byId: e = !1, exact: i = !1, external: r = !1 } = {}) {
|
|
603
603
|
this.error = void 0, this.abortController?.abort();
|
|
604
|
-
const
|
|
605
|
-
this.abortController =
|
|
604
|
+
const s = new AbortController();
|
|
605
|
+
this.abortController = s;
|
|
606
606
|
try {
|
|
607
|
-
const
|
|
608
|
-
this.language !== void 0 &&
|
|
609
|
-
const [
|
|
610
|
-
let
|
|
611
|
-
(
|
|
612
|
-
).filter((
|
|
613
|
-
|
|
614
|
-
const
|
|
615
|
-
if (
|
|
616
|
-
const
|
|
617
|
-
|
|
607
|
+
const a = this.apiUrl ?? "https://api.maptiler.com/geocoding", o = h(this, n, K).call(this, t), u = new URL(a + "/" + encodeURIComponent(o ? `${o.decimalLongitude},${o.decimalLatitude}` : t) + ".json"), m = u.searchParams;
|
|
608
|
+
this.language !== void 0 && m.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
|
|
609
|
+
const [_] = b(this, D) ?? [void 0];
|
|
610
|
+
let $ = (!o || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
|
|
611
|
+
(v) => typeof v == "string" ? v : _ === void 0 || (v[0] ?? 0) <= _ && _ < (v[1] ?? 1 / 0) ? v[2] : void 0
|
|
612
|
+
).filter((v) => v !== void 0);
|
|
613
|
+
$ && ($ = [...new Set($)], m.set("types", $.join(",")));
|
|
614
|
+
const ye = !o || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
|
|
615
|
+
if (ye && m.set("excludeTypes", String(ye)), this.bbox && m.set("bbox", this.bbox.map((v) => v.toFixed(6)).join(",")), this.country && m.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && m.set("worldview", this.worldview), !e && !o) {
|
|
616
|
+
const v = this.proximity ?? [{ type: "server-geolocation" }], xe = await mt(b(this, D), v, s);
|
|
617
|
+
xe && m.set("proximity", xe), (i || this.showResultsWhileTyping === !1) && m.set("autocomplete", "false"), m.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
|
|
618
618
|
}
|
|
619
|
-
const
|
|
620
|
-
Y > 1 &&
|
|
621
|
-
const
|
|
619
|
+
const ve = this.limit ?? 5, Y = this.reverseGeocodingLimit ?? ve;
|
|
620
|
+
Y > 1 && $?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), o ? (Y === 1 || this.exhaustiveReverseGeocoding || $?.length === 1) && m.set("limit", String(Y)) : m.set("limit", String(ve)), this.apiKey && m.set("key", this.apiKey), this.adjustUrl?.(u);
|
|
621
|
+
const Ae = u.searchParams.get("types") === "" && u.searchParams.get("excludeTypes") !== "true", j = u.toString();
|
|
622
622
|
if (j === this.lastSearchUrl) {
|
|
623
|
-
e ? (this.clearListOnPick && h(this, n,
|
|
623
|
+
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: r }), this.listFeatures[this.selectedItemIndex]?.id !== b(this, n, Q)?.id && (this.selectedItemIndex = -1));
|
|
624
624
|
return;
|
|
625
625
|
}
|
|
626
|
-
h(this, n,
|
|
626
|
+
h(this, n, x).call(this, "request", { urlObj: u }), this.lastSearchUrl = j;
|
|
627
627
|
let P;
|
|
628
|
-
if (
|
|
628
|
+
if (Ae)
|
|
629
629
|
P = { type: "FeatureCollection", features: [] };
|
|
630
630
|
else {
|
|
631
|
-
const
|
|
632
|
-
signal:
|
|
631
|
+
const v = await fetch(j, {
|
|
632
|
+
signal: s.signal,
|
|
633
633
|
...this.fetchParameters
|
|
634
634
|
});
|
|
635
|
-
if (!
|
|
636
|
-
throw new Error(await
|
|
637
|
-
P = await
|
|
635
|
+
if (!v.ok)
|
|
636
|
+
throw new Error(await v.text());
|
|
637
|
+
P = await v.json();
|
|
638
638
|
}
|
|
639
|
-
h(this, n,
|
|
639
|
+
h(this, n, x).call(this, "response", { url: j, featureCollection: P }), e ? (this.clearListOnPick && h(this, n, I).call(this), this.picked = P.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = P.features.filter(this.filter ?? (() => !0)), o && this.listFeatures.unshift({
|
|
640
640
|
type: "Feature",
|
|
641
641
|
properties: {},
|
|
642
642
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
643
|
-
id: `reverse_${
|
|
644
|
-
text: `${
|
|
645
|
-
place_name:
|
|
643
|
+
id: `reverse_${o.decimalLongitude}_${o.decimalLatitude}`,
|
|
644
|
+
text: `${o.decimalLatitude}, ${o.decimalLongitude}`,
|
|
645
|
+
place_name: o.toCoordinateFormat("DMS"),
|
|
646
646
|
/* eslint-enable @typescript-eslint/restrict-template-expressions */
|
|
647
647
|
place_type: ["reverse"],
|
|
648
648
|
place_type_name: ["reverse"],
|
|
649
|
-
center: [
|
|
650
|
-
bbox: [
|
|
649
|
+
center: [o.decimalLongitude, o.decimalLatitude],
|
|
650
|
+
bbox: [o.decimalLongitude, o.decimalLatitude, o.decimalLongitude, o.decimalLatitude],
|
|
651
651
|
geometry: {
|
|
652
652
|
type: "Point",
|
|
653
|
-
coordinates: [
|
|
653
|
+
coordinates: [o.decimalLongitude, o.decimalLatitude]
|
|
654
654
|
}
|
|
655
|
-
}), h(this, n,
|
|
656
|
-
} catch (
|
|
657
|
-
if (
|
|
655
|
+
}), h(this, n, x).call(this, "featureslisted", { features: this.listFeatures, external: r }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== b(this, n, Q)?.id && (this.selectedItemIndex = -1), o && this.input.focus());
|
|
656
|
+
} catch (a) {
|
|
657
|
+
if (a && typeof a == "object" && "name" in a && a.name === "AbortError")
|
|
658
658
|
return;
|
|
659
|
-
throw
|
|
659
|
+
throw a;
|
|
660
660
|
} finally {
|
|
661
|
-
|
|
661
|
+
s === this.abortController && (this.abortController = void 0);
|
|
662
662
|
}
|
|
663
663
|
};
|
|
664
|
-
|
|
665
|
-
this.reverseActive = this.enableReverse === "always", h(this, n,
|
|
664
|
+
Be = function(t) {
|
|
665
|
+
this.reverseActive = this.enableReverse === "always", h(this, n, I).call(this), this.picked = void 0, h(this, n, ge).call(this, `${t[1].toFixed(6)}, ${ft(t[0], [-180, 180], !0).toFixed(6)}`), h(this, n, fe).call(this);
|
|
666
666
|
};
|
|
667
667
|
ne = function(t) {
|
|
668
668
|
if (!this.listFeatures)
|
|
@@ -670,23 +670,23 @@ ne = function(t) {
|
|
|
670
670
|
const e = t.key === "ArrowDown" ? 1 : t.key === "ArrowUp" ? -1 : 0;
|
|
671
671
|
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));
|
|
672
672
|
};
|
|
673
|
-
|
|
673
|
+
Ge = function(t) {
|
|
674
674
|
h(this, n, me).call(this, t.target.value);
|
|
675
675
|
};
|
|
676
|
-
|
|
676
|
+
Ue = function(t) {
|
|
677
677
|
(!this.picked || this.picked.id !== t.id) && (this.picked = t, this.searchValue = t.place_name);
|
|
678
678
|
};
|
|
679
|
-
|
|
679
|
+
ze = function(t) {
|
|
680
680
|
this.selectedItemIndex = t;
|
|
681
681
|
};
|
|
682
|
-
|
|
682
|
+
De = function() {
|
|
683
683
|
(!this.selectFirst || this.picked) && (this.selectedItemIndex = -1);
|
|
684
684
|
};
|
|
685
|
-
|
|
686
|
-
this.searchValue = "", h(this, n,
|
|
685
|
+
Re = function() {
|
|
686
|
+
this.searchValue = "", h(this, n, x).call(this, "queryclear"), this.picked = void 0, this.input.focus();
|
|
687
687
|
};
|
|
688
|
-
l.styles =
|
|
689
|
-
${ce(
|
|
688
|
+
l.styles = M`
|
|
689
|
+
${ce(bt)}
|
|
690
690
|
`;
|
|
691
691
|
c([
|
|
692
692
|
p({ attribute: !1 })
|
|
@@ -800,42 +800,42 @@ c([
|
|
|
800
800
|
p({ type: String })
|
|
801
801
|
], l.prototype, "worldview", 2);
|
|
802
802
|
c([
|
|
803
|
-
|
|
803
|
+
We("input")
|
|
804
804
|
], l.prototype, "input", 2);
|
|
805
805
|
c([
|
|
806
|
-
|
|
806
|
+
w()
|
|
807
807
|
], l.prototype, "searchValue", 2);
|
|
808
808
|
c([
|
|
809
|
-
|
|
809
|
+
w()
|
|
810
810
|
], l.prototype, "listFeatures", 2);
|
|
811
811
|
c([
|
|
812
|
-
|
|
812
|
+
w()
|
|
813
813
|
], l.prototype, "selectedItemIndex", 2);
|
|
814
814
|
c([
|
|
815
|
-
|
|
815
|
+
w()
|
|
816
816
|
], l.prototype, "picked", 2);
|
|
817
817
|
c([
|
|
818
|
-
|
|
818
|
+
w()
|
|
819
819
|
], l.prototype, "cachedFeatures", 2);
|
|
820
820
|
c([
|
|
821
|
-
|
|
821
|
+
w()
|
|
822
822
|
], l.prototype, "lastSearchUrl", 2);
|
|
823
823
|
c([
|
|
824
|
-
|
|
824
|
+
w()
|
|
825
825
|
], l.prototype, "error", 2);
|
|
826
826
|
c([
|
|
827
|
-
|
|
827
|
+
w()
|
|
828
828
|
], l.prototype, "abortController", 2);
|
|
829
829
|
c([
|
|
830
|
-
|
|
830
|
+
w()
|
|
831
831
|
], l.prototype, "focused", 2);
|
|
832
832
|
c([
|
|
833
|
-
|
|
833
|
+
w()
|
|
834
834
|
], l.prototype, "focusedDelayed", 2);
|
|
835
835
|
l = c([
|
|
836
|
-
|
|
836
|
+
C("maptiler-geocoder")
|
|
837
837
|
], l);
|
|
838
|
-
const
|
|
838
|
+
const _t = [
|
|
839
839
|
"adjustUrl",
|
|
840
840
|
"apiKey",
|
|
841
841
|
"apiUrl",
|
|
@@ -873,13 +873,13 @@ const kt = [
|
|
|
873
873
|
"types",
|
|
874
874
|
"reverseGeocodingTypes",
|
|
875
875
|
"worldview"
|
|
876
|
-
],
|
|
877
|
-
var
|
|
878
|
-
for (var
|
|
879
|
-
(
|
|
880
|
-
return
|
|
876
|
+
], $t = "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)}";
|
|
877
|
+
var Lt = Object.getOwnPropertyDescriptor, It = (t, e, i, r) => {
|
|
878
|
+
for (var s = r > 1 ? void 0 : r ? Lt(e, i) : e, a = t.length - 1, o; a >= 0; a--)
|
|
879
|
+
(o = t[a]) && (s = o(s) || s);
|
|
880
|
+
return s;
|
|
881
881
|
};
|
|
882
|
-
let le = class extends
|
|
882
|
+
let le = class extends O {
|
|
883
883
|
render() {
|
|
884
884
|
return R`
|
|
885
885
|
<svg
|
|
@@ -895,16 +895,16 @@ let le = class extends M {
|
|
|
895
895
|
`;
|
|
896
896
|
}
|
|
897
897
|
};
|
|
898
|
-
le.styles =
|
|
899
|
-
${ce(
|
|
898
|
+
le.styles = M`
|
|
899
|
+
${ce($t)}
|
|
900
900
|
`;
|
|
901
|
-
le =
|
|
902
|
-
|
|
901
|
+
le = It([
|
|
902
|
+
C("maptiler-geocode-marker")
|
|
903
903
|
], le);
|
|
904
|
-
function
|
|
905
|
-
const e =
|
|
904
|
+
function _e(t) {
|
|
905
|
+
const e = it(
|
|
906
906
|
q([
|
|
907
|
-
|
|
907
|
+
Qe([
|
|
908
908
|
[
|
|
909
909
|
[180, 90],
|
|
910
910
|
[-180, 90],
|
|
@@ -919,22 +919,22 @@ function ke(t) {
|
|
|
919
919
|
if (!e)
|
|
920
920
|
return;
|
|
921
921
|
e.properties = { isMask: !0 };
|
|
922
|
-
const i = U(X(t)), r = (i[2] - i[0]) / 360 / 1e3,
|
|
923
|
-
if (
|
|
924
|
-
for (const u of
|
|
925
|
-
const
|
|
926
|
-
if (
|
|
927
|
-
for (const
|
|
928
|
-
for (const
|
|
929
|
-
|
|
930
|
-
if (
|
|
931
|
-
for (const
|
|
932
|
-
for (const
|
|
933
|
-
|
|
922
|
+
const i = U(X(t)), r = (i[2] - i[0]) / 360 / 1e3, s = i[0] < -180, a = i[2] > 180, o = st(t);
|
|
923
|
+
if (o.features.length > 1 && (s || a))
|
|
924
|
+
for (const u of o.features) {
|
|
925
|
+
const m = U(X(u));
|
|
926
|
+
if (a && m[0] < -180 + r)
|
|
927
|
+
for (const _ of u.geometry.coordinates)
|
|
928
|
+
for (const $ of _)
|
|
929
|
+
$[0] += 360 - r;
|
|
930
|
+
if (s && m[2] > 180 - r)
|
|
931
|
+
for (const _ of u.geometry.coordinates)
|
|
932
|
+
for (const $ of _)
|
|
933
|
+
$[0] -= 360 - r;
|
|
934
934
|
}
|
|
935
|
-
return q([
|
|
935
|
+
return q([o.features.length < 2 ? t : $e(o) ?? t, e]);
|
|
936
936
|
}
|
|
937
|
-
const
|
|
937
|
+
const Mt = {
|
|
938
938
|
continental_marine: 4,
|
|
939
939
|
country: 4,
|
|
940
940
|
major_landform: 8,
|
|
@@ -958,7 +958,7 @@ const It = {
|
|
|
958
958
|
"poi.restaurant": 18,
|
|
959
959
|
"poi.aerodrome": 13
|
|
960
960
|
// TODO add many more
|
|
961
|
-
},
|
|
961
|
+
}, Ot = (t) => {
|
|
962
962
|
const e = t?.geometry.type, i = t?.properties?.isMask, r = i ? 0 : e === "LineString" || e === "MultiLineString" ? 3 : 2;
|
|
963
963
|
return {
|
|
964
964
|
color: "#3170fe",
|
|
@@ -969,10 +969,10 @@ const It = {
|
|
|
969
969
|
lineCap: "butt"
|
|
970
970
|
};
|
|
971
971
|
};
|
|
972
|
-
class
|
|
972
|
+
class je extends Ye {
|
|
973
973
|
}
|
|
974
|
-
Object.assign(
|
|
975
|
-
class
|
|
974
|
+
Object.assign(je.prototype, He.prototype);
|
|
975
|
+
class At extends je {
|
|
976
976
|
#e;
|
|
977
977
|
#t;
|
|
978
978
|
constructor(e = {}) {
|
|
@@ -982,7 +982,7 @@ class jt extends Re {
|
|
|
982
982
|
onAdd(e) {
|
|
983
983
|
this.#e = e, this.#t = e.getContainer().ownerDocument.createElement("maptiler-geocoder"), this.#t.classList.add("leaflet-geocoder"), this.#m(), this.#x(), this.#I();
|
|
984
984
|
const i = e.getContainer().ownerDocument.createElement("div");
|
|
985
|
-
return i.classList.add("leaflet-ctrl-geocoder", "leaflet-bar"), i.style.zIndex = "850", i.appendChild(this.#t),
|
|
985
|
+
return i.classList.add("leaflet-ctrl-geocoder", "leaflet-bar"), i.style.zIndex = "850", i.appendChild(this.#t), be.disableClickPropagation(i), be.disableScrollPropagation(i), i;
|
|
986
986
|
}
|
|
987
987
|
/** @internal Not to be called directly */
|
|
988
988
|
onRemove() {
|
|
@@ -1061,7 +1061,7 @@ class jt extends Re {
|
|
|
1061
1061
|
},
|
|
1062
1062
|
featureslisted: (e) => {
|
|
1063
1063
|
const i = e.detail.features;
|
|
1064
|
-
this.#r = i, this.#c(this.#r, void 0), this.#k(
|
|
1064
|
+
this.#r = i, this.#c(this.#r, void 0), this.#k(e), this.#i("featureslisted", e.detail);
|
|
1065
1065
|
},
|
|
1066
1066
|
featuresclear: () => {
|
|
1067
1067
|
this.#r = void 0, this.#c(void 0, void 0), this.#i("featuresclear");
|
|
@@ -1105,21 +1105,22 @@ class jt extends Re {
|
|
|
1105
1105
|
#w(e) {
|
|
1106
1106
|
e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#g({ lng: e.center[0], lat: e.center[1] }, this.#l(e)) : this.#y(U(e.bbox), 50, this.#l(e));
|
|
1107
1107
|
}
|
|
1108
|
-
#k(e) {
|
|
1109
|
-
if (!e || e.length === 0 || !this.#h)
|
|
1110
|
-
|
|
1111
|
-
|
|
1108
|
+
#k({ detail: { features: e, external: i } }) {
|
|
1109
|
+
if (!e || e.length === 0 || !this.#h || this.options.flyToFeatures === !1 || this.options.flyToFeatures === "never" || !i && (this.options.flyToFeatures === void 0 || this.options.flyToFeatures === "external"))
|
|
1110
|
+
return;
|
|
1111
|
+
const r = e.every((o) => o.matching_text), s = e.reduce(
|
|
1112
|
+
(o, u) => r || !u.matching_text ? [Math.min(o[0], u.bbox[0]), Math.min(o[1], u.bbox[1]), Math.max(o[2], u.bbox[2]), Math.max(o[3], u.bbox[3])] : o,
|
|
1112
1113
|
[180, 90, -180, -90]
|
|
1113
|
-
),
|
|
1114
|
-
this.#y(U(
|
|
1114
|
+
), a = e.map((o) => this.#l(o)).filter((o) => o !== void 0).reduce((o, u) => o === void 0 ? u : Math.max(o, u), void 0);
|
|
1115
|
+
this.#y(U(s), 50, a);
|
|
1115
1116
|
}
|
|
1116
1117
|
#l(e) {
|
|
1117
1118
|
if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
|
|
1118
1119
|
return;
|
|
1119
|
-
const i = e.id.replace(/\..*/, ""), r = this.options.zoom ??
|
|
1120
|
-
return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((
|
|
1121
|
-
const
|
|
1122
|
-
return
|
|
1120
|
+
const i = e.id.replace(/\..*/, ""), r = this.options.zoom ?? Mt;
|
|
1121
|
+
return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((s, a) => {
|
|
1122
|
+
const o = r[i + "." + a];
|
|
1123
|
+
return s === void 0 ? o : o === void 0 ? s : Math.max(s, o);
|
|
1123
1124
|
}, void 0) : void 0) ?? r[i];
|
|
1124
1125
|
}
|
|
1125
1126
|
get #h() {
|
|
@@ -1155,72 +1156,72 @@ class jt extends Re {
|
|
|
1155
1156
|
#c(e, i) {
|
|
1156
1157
|
if (!this.#e)
|
|
1157
1158
|
return;
|
|
1158
|
-
for (const
|
|
1159
|
-
|
|
1159
|
+
for (const s of this.#a.values())
|
|
1160
|
+
s.remove();
|
|
1160
1161
|
this.#a = /* @__PURE__ */ new Map(), this.#s?.clearLayers();
|
|
1161
1162
|
const r = () => {
|
|
1162
1163
|
if (!i || !this.#e || this.options.marker === !1 || this.options.marker === null) return;
|
|
1163
|
-
const
|
|
1164
|
-
|
|
1164
|
+
const s = this.options.marker instanceof Function ? this.options.marker(this.#e, i) : this.#p({ lng: i.center[0], lat: i.center[1] }, this.options.marker).addTo(this.#e);
|
|
1165
|
+
s && this.#a.set(i, s);
|
|
1165
1166
|
};
|
|
1166
1167
|
if (i?.geometry.type === "GeometryCollection") {
|
|
1167
|
-
const
|
|
1168
|
-
(
|
|
1168
|
+
const s = i.geometry.geometries.filter(
|
|
1169
|
+
(a) => a.type === "Polygon" || a.type === "MultiPolygon"
|
|
1169
1170
|
);
|
|
1170
|
-
if (
|
|
1171
|
-
const
|
|
1172
|
-
if (
|
|
1173
|
-
const
|
|
1174
|
-
if (
|
|
1175
|
-
const u = [...
|
|
1176
|
-
|
|
1171
|
+
if (s.length > 0) {
|
|
1172
|
+
const a = $e(q(s.map((o) => Ke(o))));
|
|
1173
|
+
if (a) {
|
|
1174
|
+
const o = _e({ ...i, geometry: a.geometry });
|
|
1175
|
+
if (o) {
|
|
1176
|
+
const u = [...o.features], m = U(X(i)), _ = m[2] - m[0];
|
|
1177
|
+
m[0] - _ / 4 < -180 && u.push(...we(o, -360).features), m[2] + _ / 4 > 180 && u.push(...we(o, 360).features), this.#s?.addData(q(u));
|
|
1177
1178
|
}
|
|
1178
1179
|
}
|
|
1179
1180
|
} else {
|
|
1180
|
-
const
|
|
1181
|
-
(
|
|
1181
|
+
const a = i.geometry.geometries.filter(
|
|
1182
|
+
(o) => o.type === "LineString" || o.type === "MultiLineString"
|
|
1182
1183
|
);
|
|
1183
|
-
|
|
1184
|
+
a.length > 0 && this.#s?.addData({
|
|
1184
1185
|
...i,
|
|
1185
|
-
geometry: { type: "GeometryCollection", geometries:
|
|
1186
|
+
geometry: { type: "GeometryCollection", geometries: a }
|
|
1186
1187
|
});
|
|
1187
1188
|
}
|
|
1188
1189
|
} else if (i?.geometry.type.endsWith("Polygon")) {
|
|
1189
|
-
const
|
|
1190
|
-
|
|
1190
|
+
const s = _e(i);
|
|
1191
|
+
s && this.#s?.addData(s), this.options.pickedResultStyle === "full-geometry-including-polygon-center-marker" && r();
|
|
1191
1192
|
} else i?.geometry.type.endsWith("LineString") ? this.#s?.addData(i) : i?.geometry.type.endsWith("Point") && r();
|
|
1192
1193
|
if (this.options.showResultMarkers !== !1 && this.options.showResultMarkers !== null)
|
|
1193
|
-
for (const
|
|
1194
|
-
if (
|
|
1194
|
+
for (const s of e ?? []) {
|
|
1195
|
+
if (s.id === i?.id || s.place_type.includes("reverse"))
|
|
1195
1196
|
continue;
|
|
1196
|
-
let
|
|
1197
|
+
let a;
|
|
1197
1198
|
if (this.options.showResultMarkers instanceof Function) {
|
|
1198
|
-
if (
|
|
1199
|
+
if (a = this.options.showResultMarkers(this.#e, s), !a)
|
|
1199
1200
|
continue;
|
|
1200
1201
|
} else
|
|
1201
|
-
|
|
1202
|
-
new
|
|
1202
|
+
a = this.#p({ lng: s.center[0], lat: s.center[1] }, this.options.showResultMarkers).bindPopup(
|
|
1203
|
+
new Je({
|
|
1203
1204
|
offset: [0.3, -21],
|
|
1204
1205
|
closeButton: !1,
|
|
1205
1206
|
closeOnMove: !0,
|
|
1206
1207
|
className: "maptiler-gc-popup"
|
|
1207
|
-
}).setContent(
|
|
1208
|
-
).addTo(this.#e),
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1211
|
-
u.stopPropagation(), this.#i("markerclick", { feature:
|
|
1212
|
-
}),
|
|
1213
|
-
this.#i("markermouseenter", { feature:
|
|
1214
|
-
}),
|
|
1215
|
-
this.#i("markermouseleave", { feature:
|
|
1216
|
-
}),
|
|
1208
|
+
}).setContent(s.place_type[0] === "reverse" ? s.place_name : s.place_name.replace(/,.*/, ""))
|
|
1209
|
+
).addTo(this.#e), a.getElement()?.classList.add("marker-interactive");
|
|
1210
|
+
const o = a.getElement();
|
|
1211
|
+
o?.addEventListener("click", (u) => {
|
|
1212
|
+
u.stopPropagation(), this.#i("markerclick", { feature: s, marker: a });
|
|
1213
|
+
}), o?.addEventListener("mouseenter", () => {
|
|
1214
|
+
this.#i("markermouseenter", { feature: s, marker: a }), a.togglePopup();
|
|
1215
|
+
}), o?.addEventListener("mouseleave", () => {
|
|
1216
|
+
this.#i("markermouseleave", { feature: s, marker: a }), a.togglePopup();
|
|
1217
|
+
}), o?.classList.toggle("marker-fuzzy", !!s.matching_text), this.#a.set(s, a);
|
|
1217
1218
|
}
|
|
1218
1219
|
}
|
|
1219
1220
|
#L(e) {
|
|
1220
1221
|
this.#n?.getElement()?.classList.toggle("marker-selected", !1), this.#n = void 0, this.options.markerOnSelected !== !1 && (this.#n = this.#a.get(e), this.#n?.getElement()?.classList.toggle("marker-selected", !0));
|
|
1221
1222
|
}
|
|
1222
1223
|
#I() {
|
|
1223
|
-
this.#e && (this.#s = new
|
|
1224
|
+
this.#e && (this.#s = new Xe(void 0, {
|
|
1224
1225
|
style: this.#O(),
|
|
1225
1226
|
interactive: !1
|
|
1226
1227
|
}).addTo(this.#e));
|
|
@@ -1229,19 +1230,19 @@ class jt extends Re {
|
|
|
1229
1230
|
this.#e && (this.#s?.removeFrom(this.#e), this.#s = void 0);
|
|
1230
1231
|
}
|
|
1231
1232
|
#p(e, i) {
|
|
1232
|
-
return typeof i != "object" && (i = { icon: new
|
|
1233
|
+
return typeof i != "object" && (i = { icon: new et({ html: this.#e?.getContainer().ownerDocument.createElement("maptiler-geocode-marker"), iconAnchor: [12.3, 30], className: "" }) }), new tt(e, i);
|
|
1233
1234
|
}
|
|
1234
1235
|
#O() {
|
|
1235
1236
|
const { fullGeometryStyle: e } = this.options;
|
|
1236
|
-
if (e === !0 || e === void 0) return
|
|
1237
|
+
if (e === !0 || e === void 0) return Ot;
|
|
1237
1238
|
if (!(e === !1 || e === null))
|
|
1238
1239
|
return e;
|
|
1239
1240
|
}
|
|
1240
1241
|
}
|
|
1241
1242
|
export {
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1243
|
+
Ot as DEFAULT_GEOMETRY_STYLE,
|
|
1244
|
+
At as GeocodingControl,
|
|
1245
|
+
At as LeafletGeocodingControl,
|
|
1245
1246
|
ee as MaptilerGeocodeClearIconElement,
|
|
1246
1247
|
te as MaptilerGeocodeFailIconElement,
|
|
1247
1248
|
ie as MaptilerGeocodeLoadingIconElement,
|
|
@@ -1249,6 +1250,6 @@ export {
|
|
|
1249
1250
|
se as MaptilerGeocodeReverseGeocodingIconElement,
|
|
1250
1251
|
oe as MaptilerGeocodeSearchIconElement,
|
|
1251
1252
|
l as MaptilerGeocoderElement,
|
|
1252
|
-
|
|
1253
|
+
Mt as ZOOM_DEFAULTS
|
|
1253
1254
|
};
|
|
1254
1255
|
//# sourceMappingURL=leaflet.public.js.map
|