@maptiler/geocoding-control 3.0.0 → 3.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +455 -383
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +118 -98
- package/dist/index.umd.js.map +1 -1
- package/dist/leaflet.js +520 -448
- package/dist/leaflet.js.map +1 -1
- package/dist/leaflet.umd.js +121 -101
- package/dist/leaflet.umd.js.map +1 -1
- package/dist/maplibregl.js +454 -382
- package/dist/maplibregl.js.map +1 -1
- package/dist/maplibregl.umd.js +120 -100
- package/dist/maplibregl.umd.js.map +1 -1
- package/dist/maptilersdk.js +466 -394
- package/dist/maptilersdk.js.map +1 -1
- package/dist/maptilersdk.umd.js +120 -100
- package/dist/maptilersdk.umd.js.map +1 -1
- package/dist/openlayers.js +610 -538
- package/dist/openlayers.js.map +1 -1
- package/dist/openlayers.umd.js +121 -101
- package/dist/openlayers.umd.js.map +1 -1
- package/dist/src/geocoder/geocoder.d.ts +14 -2
- package/package.json +3 -3
package/dist/leaflet.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { customElement as C, property as p, state as
|
|
3
|
-
import { convert as
|
|
4
|
-
import { classMap as
|
|
5
|
-
import { repeat as
|
|
6
|
-
import
|
|
7
|
-
import { styleMap as
|
|
8
|
-
import
|
|
9
|
-
import { featureCollection as
|
|
10
|
-
import
|
|
11
|
-
import { Evented as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
var
|
|
15
|
-
for (var s =
|
|
16
|
-
(
|
|
1
|
+
import { css as O, LitElement as T, svg as V, html as g, unsafeCSS as de, nothing as ee } from "lit";
|
|
2
|
+
import { customElement as C, property as p, state as x, queryAssignedElements as I } from "lit/decorators.js";
|
|
3
|
+
import { convert as Ye } from "geo-coordinates-parser";
|
|
4
|
+
import { classMap as N } from "lit/directives/class-map.js";
|
|
5
|
+
import { repeat as Je } from "lit/directives/repeat.js";
|
|
6
|
+
import Xe from "@turf/clone";
|
|
7
|
+
import { styleMap as et } from "lit/directives/style-map.js";
|
|
8
|
+
import te from "@turf/bbox";
|
|
9
|
+
import { featureCollection as Z, polygon as tt, feature as it } from "@turf/helpers";
|
|
10
|
+
import Fe from "@turf/union";
|
|
11
|
+
import { Evented as st, Control as ot, DomEvent as Le, Popup as rt, GeoJSON as at, DivIcon as nt, Marker as lt } from "leaflet";
|
|
12
|
+
import ct from "@turf/difference";
|
|
13
|
+
import ht from "@turf/flatten";
|
|
14
|
+
var pt = Object.getOwnPropertyDescriptor, dt = (t, e, i, r) => {
|
|
15
|
+
for (var s = r > 1 ? void 0 : r ? pt(e, i) : e, a = t.length - 1, o; a >= 0; a--)
|
|
16
|
+
(o = t[a]) && (s = o(s) || s);
|
|
17
17
|
return s;
|
|
18
18
|
};
|
|
19
|
-
let
|
|
19
|
+
let ie = class extends T {
|
|
20
20
|
render() {
|
|
21
|
-
return
|
|
21
|
+
return V`
|
|
22
22
|
<svg viewBox="0 0 14 14" width="13" height="13">
|
|
23
23
|
<path
|
|
24
24
|
d="M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"
|
|
@@ -27,23 +27,23 @@ let J = class extends O {
|
|
|
27
27
|
`;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
ie.styles = O`
|
|
31
31
|
svg {
|
|
32
32
|
display: block;
|
|
33
|
-
fill: var(--color-icon-button);
|
|
33
|
+
fill: var(--color-icon-button, #444952);
|
|
34
34
|
}
|
|
35
35
|
`;
|
|
36
|
-
|
|
36
|
+
ie = dt([
|
|
37
37
|
C("maptiler-geocode-clear-icon")
|
|
38
|
-
],
|
|
39
|
-
var
|
|
40
|
-
for (var s =
|
|
41
|
-
(
|
|
38
|
+
], ie);
|
|
39
|
+
var ut = Object.getOwnPropertyDescriptor, ft = (t, e, i, r) => {
|
|
40
|
+
for (var s = r > 1 ? void 0 : r ? ut(e, i) : e, a = t.length - 1, o; a >= 0; a--)
|
|
41
|
+
(o = t[a]) && (s = o(s) || s);
|
|
42
42
|
return s;
|
|
43
43
|
};
|
|
44
|
-
let
|
|
44
|
+
let se = class extends T {
|
|
45
45
|
render() {
|
|
46
|
-
return
|
|
46
|
+
return V`
|
|
47
47
|
<svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
48
48
|
<path
|
|
49
49
|
d="M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"
|
|
@@ -52,21 +52,21 @@ let X = class extends O {
|
|
|
52
52
|
`;
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
|
|
55
|
+
se.styles = O`
|
|
56
56
|
svg {
|
|
57
57
|
display: block;
|
|
58
|
-
fill: #e15042;
|
|
58
|
+
fill: var(--color-fail-icon, #e15042);
|
|
59
59
|
}
|
|
60
60
|
`;
|
|
61
|
-
|
|
61
|
+
se = ft([
|
|
62
62
|
C("maptiler-geocode-fail-icon")
|
|
63
|
-
],
|
|
64
|
-
var
|
|
65
|
-
for (var s =
|
|
66
|
-
(
|
|
63
|
+
], se);
|
|
64
|
+
var mt = Object.getOwnPropertyDescriptor, gt = (t, e, i, r) => {
|
|
65
|
+
for (var s = r > 1 ? void 0 : r ? mt(e, i) : e, a = t.length - 1, o; a >= 0; a--)
|
|
66
|
+
(o = t[a]) && (s = o(s) || s);
|
|
67
67
|
return s;
|
|
68
68
|
};
|
|
69
|
-
let
|
|
69
|
+
let oe = class extends T {
|
|
70
70
|
render() {
|
|
71
71
|
return g`
|
|
72
72
|
<div>
|
|
@@ -78,7 +78,7 @@ let ee = class extends O {
|
|
|
78
78
|
`;
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
oe.styles = O`
|
|
82
82
|
div {
|
|
83
83
|
position: absolute;
|
|
84
84
|
left: 50%;
|
|
@@ -105,17 +105,17 @@ ee.styles = F`
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
`;
|
|
108
|
-
|
|
108
|
+
oe = gt([
|
|
109
109
|
C("maptiler-geocode-loading-icon")
|
|
110
|
-
],
|
|
111
|
-
var
|
|
112
|
-
for (var s =
|
|
113
|
-
(
|
|
110
|
+
], oe);
|
|
111
|
+
var vt = Object.getOwnPropertyDescriptor, yt = (t, e, i, r) => {
|
|
112
|
+
for (var s = r > 1 ? void 0 : r ? vt(e, i) : e, a = t.length - 1, o; a >= 0; a--)
|
|
113
|
+
(o = t[a]) && (s = o(s) || s);
|
|
114
114
|
return s;
|
|
115
115
|
};
|
|
116
|
-
let
|
|
116
|
+
let re = class extends T {
|
|
117
117
|
render() {
|
|
118
|
-
return
|
|
118
|
+
return V`
|
|
119
119
|
<svg viewBox="0 0 60.006 21.412" width="14" height="20">
|
|
120
120
|
<path
|
|
121
121
|
d="M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"
|
|
@@ -124,23 +124,23 @@ let te = class extends O {
|
|
|
124
124
|
`;
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
|
-
|
|
127
|
+
re.styles = O`
|
|
128
128
|
svg {
|
|
129
129
|
display: block;
|
|
130
|
-
fill: var(--color-icon-button);
|
|
130
|
+
fill: var(--color-icon-button, #444952);
|
|
131
131
|
}
|
|
132
132
|
`;
|
|
133
|
-
|
|
133
|
+
re = yt([
|
|
134
134
|
C("maptiler-geocode-reverse-geocoding-icon")
|
|
135
|
-
],
|
|
136
|
-
var
|
|
137
|
-
for (var s =
|
|
138
|
-
(
|
|
135
|
+
], re);
|
|
136
|
+
var bt = Object.getOwnPropertyDescriptor, xt = (t, e, i, r) => {
|
|
137
|
+
for (var s = r > 1 ? void 0 : r ? bt(e, i) : e, a = t.length - 1, o; a >= 0; a--)
|
|
138
|
+
(o = t[a]) && (s = o(s) || s);
|
|
139
139
|
return s;
|
|
140
140
|
};
|
|
141
|
-
let
|
|
141
|
+
let ae = class extends T {
|
|
142
142
|
render() {
|
|
143
|
-
return
|
|
143
|
+
return V`
|
|
144
144
|
<svg
|
|
145
145
|
xmlns="http://www.w3.org/2000/svg"
|
|
146
146
|
width="13"
|
|
@@ -153,7 +153,7 @@ let ie = class extends O {
|
|
|
153
153
|
`;
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
|
-
|
|
156
|
+
ae.styles = O`
|
|
157
157
|
circle {
|
|
158
158
|
stroke-width: 1.875;
|
|
159
159
|
fill: none;
|
|
@@ -166,64 +166,64 @@ ie.styles = F`
|
|
|
166
166
|
|
|
167
167
|
svg {
|
|
168
168
|
display: block;
|
|
169
|
-
stroke: var(--color-icon-button);
|
|
169
|
+
stroke: var(--color-icon-button, #444952);
|
|
170
170
|
}
|
|
171
171
|
`;
|
|
172
|
-
|
|
172
|
+
ae = xt([
|
|
173
173
|
C("maptiler-geocode-search-icon")
|
|
174
|
-
],
|
|
175
|
-
function
|
|
176
|
-
const
|
|
177
|
-
return t ===
|
|
174
|
+
], ae);
|
|
175
|
+
function wt(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
|
-
function
|
|
179
|
+
function W(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 =
|
|
185
|
-
for (const
|
|
186
|
-
if (
|
|
187
|
-
for (const s of
|
|
188
|
-
|
|
183
|
+
function Ie(t, e) {
|
|
184
|
+
const i = Xe(t);
|
|
185
|
+
for (const r of i.features)
|
|
186
|
+
if (r.geometry.type == "MultiPolygon")
|
|
187
|
+
for (const s of r.geometry.coordinates)
|
|
188
|
+
$e(s, e);
|
|
189
189
|
else
|
|
190
|
-
|
|
190
|
+
$e(r.geometry.coordinates, e);
|
|
191
191
|
return i;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function $e(t, e) {
|
|
194
194
|
for (const i of t)
|
|
195
|
-
for (const
|
|
196
|
-
|
|
195
|
+
for (const r of i)
|
|
196
|
+
r[0] += e;
|
|
197
197
|
}
|
|
198
|
-
let
|
|
199
|
-
async function
|
|
200
|
-
for (const
|
|
201
|
-
if (!(t && (
|
|
202
|
-
if (
|
|
203
|
-
return
|
|
204
|
-
if (
|
|
205
|
-
if (
|
|
206
|
-
if (
|
|
207
|
-
return
|
|
198
|
+
let z;
|
|
199
|
+
async function kt(t, e, i) {
|
|
200
|
+
for (const r of e ?? [])
|
|
201
|
+
if (!(t && (r.minZoom != null && r.minZoom > t[0] || r.maxZoom != null && r.maxZoom < t[0]))) {
|
|
202
|
+
if (r.type === "fixed")
|
|
203
|
+
return r.coordinates.join(",");
|
|
204
|
+
if (r.type === "client-geolocation")
|
|
205
|
+
if (z && r.cachedLocationExpiry && z.time + r.cachedLocationExpiry > Date.now()) {
|
|
206
|
+
if (z.coords)
|
|
207
|
+
return z.coords;
|
|
208
208
|
} else {
|
|
209
209
|
let s;
|
|
210
210
|
try {
|
|
211
|
-
return s = await new Promise((a,
|
|
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 && (z = {
|
|
227
227
|
time: Date.now(),
|
|
228
228
|
coords: s
|
|
229
229
|
});
|
|
@@ -231,27 +231,27 @@ async function mt(t, e, i) {
|
|
|
231
231
|
if (i.signal.aborted)
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
|
-
if (
|
|
234
|
+
if (r.type === "server-geolocation")
|
|
235
235
|
return "ip";
|
|
236
|
-
if (t &&
|
|
236
|
+
if (t && r.type === "map-center")
|
|
237
237
|
return t[1].toFixed(6) + "," + t[2].toFixed(6);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
const
|
|
241
|
-
var
|
|
240
|
+
const _t = ".sprite-icon{align-self:center;justify-self:center;opacity:var(--icon-items-opacity, .75);background-repeat:no-repeat}li{text-align:left;cursor:default;display:grid;grid-template-columns:40px 1fr;color:var(--color-items, #444952);padding:8px 0;font-size:var(--font-size-items, 14px);line-height:1.3;min-width:fit-content;outline:0}li:first-child{padding-top:10px}li:last-child{padding-bottom:10px}li.picked{background-color:var(--color-items-picked-bg, #e7edff)}li.picked .secondary,li.picked .line2{color:var(--color-items-picked-secondary, #96a4c7)}li.selected{background-color:var(--color-items-selected-bg, #f3f6ff);animation:backAndForth 5s linear infinite}li.selected .primary{color:var(--color-items-selected, #2b8bfb)}li.selected .secondary,li.selected .line2{color:var(--color-items-selected-secondary, #a2adc7)}li>img{align-self:center;justify-self:center;opacity:var(--icon-opacity, .75)}.texts{padding:0 17px 0 0}.texts>*{white-space:nowrap;display:block;min-width:fit-content}.primary{font-weight:600}.secondary{color:var(--color-items-secondary, #aeb6c7);padding-left:4px}.line2{color:var(--color-items-secondary, #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 Lt = Object.defineProperty, It = Object.getOwnPropertyDescriptor, Oe = (t) => {
|
|
242
242
|
throw TypeError(t);
|
|
243
|
-
}, $ = (t, e, i,
|
|
244
|
-
for (var s =
|
|
245
|
-
(
|
|
246
|
-
return
|
|
247
|
-
},
|
|
248
|
-
const
|
|
249
|
-
let M,
|
|
243
|
+
}, $ = (t, e, i, r) => {
|
|
244
|
+
for (var s = r > 1 ? void 0 : r ? It(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 && Lt(e, i, s), s;
|
|
247
|
+
}, Te = (t, e, i) => e.has(t) || Oe("Cannot " + i), f = (t, e, i) => (Te(t, e, "read from private field"), i ? i.call(t) : e.get(t)), $t = (t, e, i) => e.has(t) ? Oe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), P = (t, e, i) => (Te(t, e, "access private method"), i), d, j, G, v, Ce, Me, ue, ne;
|
|
248
|
+
const Se = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Pe = Se ? "@2x" : "", S = Se ? 2 : 1;
|
|
249
|
+
let M, Be, w = class extends T {
|
|
250
250
|
constructor() {
|
|
251
|
-
super(...arguments),
|
|
251
|
+
super(...arguments), $t(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
|
-
t.has("feature") && f(this, d,
|
|
254
|
+
t.has("feature") && f(this, d, j) && (this.index = f(this, d, j).length, P(this, d, ue).call(this));
|
|
255
255
|
}
|
|
256
256
|
render() {
|
|
257
257
|
return g`
|
|
@@ -266,109 +266,121 @@ let M, Me, k = class extends O {
|
|
|
266
266
|
${M && this.spriteIcon ? g`
|
|
267
267
|
<div
|
|
268
268
|
class="sprite-icon"
|
|
269
|
-
style=${
|
|
270
|
-
width: `${this.spriteIcon.width /
|
|
271
|
-
height: `${this.spriteIcon.height /
|
|
272
|
-
backgroundImage: `url(${this.iconsBaseUrl}sprite${
|
|
273
|
-
backgroundPosition: `-${this.spriteIcon.x /
|
|
274
|
-
backgroundSize: `${M.width /
|
|
269
|
+
style=${et({
|
|
270
|
+
width: `${this.spriteIcon.width / S}px`,
|
|
271
|
+
height: `${this.spriteIcon.height / S}px`,
|
|
272
|
+
backgroundImage: `url(${this.iconsBaseUrl}sprite${Pe}.png)`,
|
|
273
|
+
backgroundPosition: `-${this.spriteIcon.x / S}px -${this.spriteIcon.y / S}px`,
|
|
274
|
+
backgroundSize: `${M.width / S}px ${M.height / S}px`
|
|
275
275
|
})}
|
|
276
|
-
title=${f(this, d,
|
|
276
|
+
title=${f(this, d, v)}
|
|
277
277
|
/>
|
|
278
|
-
` : this.imageUrl ? g` <img src=${this.imageUrl} alt=${this.category} title=${f(this, d,
|
|
278
|
+
` : this.imageUrl ? g` <img src=${this.imageUrl} alt=${this.category} title=${f(this, d, v)} @error=${P(this, d, Me)} />` : this.feature?.address ? g` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${f(this, d, v)} title=${f(this, d, v)} /> ` : this.feature?.id.startsWith("road.") ? g` <img src=${this.iconsBaseUrl + "road.svg"} alt=${f(this, d, v)} title=${f(this, d, v)} /> ` : this.feature?.id.startsWith("address.") ? g` <img src=${this.iconsBaseUrl + "street.svg"} alt=${f(this, d, v)} title=${f(this, d, v)} /> ` : this.feature?.id.startsWith("postal_code.") ? g` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${f(this, d, v)} title=${f(this, d, v)} /> ` : this.feature?.id.startsWith("poi.") ? g` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${f(this, d, v)} title=${f(this, d, v)} /> ` : f(this, d, G) ? g` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${f(this, d, v)} title=${f(this, d, v)} /> ` : g` <img src=${this.iconsBaseUrl + "area.svg"} alt=${f(this, d, v)} title=${f(this, d, v)} /> `}
|
|
279
279
|
|
|
280
280
|
<span class="texts">
|
|
281
281
|
<span>
|
|
282
|
-
<span class="primary"> ${f(this, d,
|
|
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,
|
|
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, v)} </span> ` : ee}
|
|
285
285
|
</span>
|
|
286
286
|
|
|
287
|
-
<span class="line2"> ${f(this, d,
|
|
287
|
+
<span class="line2"> ${f(this, d, G) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
|
|
288
288
|
</span>
|
|
289
289
|
</li>
|
|
290
290
|
`;
|
|
291
291
|
}
|
|
292
292
|
};
|
|
293
293
|
d = /* @__PURE__ */ new WeakSet();
|
|
294
|
-
|
|
294
|
+
j = function() {
|
|
295
295
|
return this.feature?.properties?.categories;
|
|
296
296
|
};
|
|
297
|
-
|
|
297
|
+
G = function() {
|
|
298
298
|
return this.feature?.place_type[0] === "reverse";
|
|
299
299
|
};
|
|
300
|
-
|
|
301
|
-
return this
|
|
300
|
+
v = function() {
|
|
301
|
+
return f(this, d, j)?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
|
|
302
302
|
};
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
Ce = function() {
|
|
304
|
+
Be ??= fetch(`${this.iconsBaseUrl}sprite${Pe}.json`).then((t) => t.json()).then((t) => {
|
|
305
305
|
M = t;
|
|
306
306
|
}).catch(() => {
|
|
307
307
|
M = null;
|
|
308
308
|
});
|
|
309
309
|
};
|
|
310
|
-
|
|
311
|
-
this.imageUrl && this.missingIconsCache.add(this.imageUrl),
|
|
310
|
+
Me = function() {
|
|
311
|
+
this.imageUrl && this.missingIconsCache.add(this.imageUrl), P(this, d, ue).call(this);
|
|
312
312
|
};
|
|
313
|
-
|
|
314
|
-
M !== void 0 ?
|
|
315
|
-
|
|
313
|
+
ue = function() {
|
|
314
|
+
M !== void 0 ? P(this, d, ne).call(this) : (P(this, d, Ce).call(this), Be?.then(() => {
|
|
315
|
+
P(this, d, ne).call(this);
|
|
316
316
|
}));
|
|
317
317
|
};
|
|
318
|
-
|
|
318
|
+
ne = function() {
|
|
319
319
|
do {
|
|
320
|
-
if (this.index--, this.category = f(this, d,
|
|
320
|
+
if (this.index--, this.category = f(this, d, j)?.[this.index], this.spriteIcon = this.category ? M?.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
|
-
${
|
|
325
|
+
w.styles = O`
|
|
326
|
+
${de(_t)}
|
|
327
327
|
`;
|
|
328
328
|
$([
|
|
329
329
|
p({ type: Object })
|
|
330
|
-
],
|
|
330
|
+
], w.prototype, "feature", 2);
|
|
331
331
|
$([
|
|
332
332
|
p({ type: String })
|
|
333
|
-
],
|
|
333
|
+
], w.prototype, "itemStyle", 2);
|
|
334
334
|
$([
|
|
335
335
|
p({ type: String })
|
|
336
|
-
],
|
|
336
|
+
], w.prototype, "showPlaceType", 2);
|
|
337
337
|
$([
|
|
338
338
|
p({ attribute: !1 })
|
|
339
|
-
],
|
|
339
|
+
], w.prototype, "missingIconsCache", 2);
|
|
340
340
|
$([
|
|
341
341
|
p({ type: String })
|
|
342
|
-
],
|
|
342
|
+
], w.prototype, "iconsBaseUrl", 2);
|
|
343
343
|
$([
|
|
344
|
-
|
|
345
|
-
],
|
|
344
|
+
x()
|
|
345
|
+
], w.prototype, "category", 2);
|
|
346
346
|
$([
|
|
347
|
-
|
|
348
|
-
],
|
|
347
|
+
x()
|
|
348
|
+
], w.prototype, "imageUrl", 2);
|
|
349
349
|
$([
|
|
350
|
-
|
|
351
|
-
],
|
|
350
|
+
x()
|
|
351
|
+
], w.prototype, "spriteIcon", 2);
|
|
352
352
|
$([
|
|
353
|
-
|
|
354
|
-
],
|
|
355
|
-
|
|
353
|
+
x()
|
|
354
|
+
], w.prototype, "index", 2);
|
|
355
|
+
w = $([
|
|
356
356
|
C("maptiler-geocoder-feature-item")
|
|
357
|
-
],
|
|
358
|
-
const
|
|
359
|
-
var
|
|
357
|
+
], w);
|
|
358
|
+
const Et = 'form{font-family:var(--font-family, "Open Sans", "Ubuntu", "Helvetica Neue", Arial, Helvetica, sans-serif);position:relative;background-color:var(--color-bg, #fff);z-index:10;border-radius:var(--radius, 4px);margin:0;transition:max-width .25s;box-shadow:var(--shadow, 0px 2px 5px rgba(51, 51, 89, .15));pointer-events:all}form,form *,form *:after,form *:before{box-sizing:border-box}form.can-collapse{max-width:var(--size-collapse-width, 29px)}form.can-collapse input::placeholder{transition:opacity .25s;opacity:0}form,form.can-collapse:focus-within,form.can-collapse:hover{width:var(--size-width, 270px);max-width:var(--size-width, 270px)}form input::placeholder,form:focus-within input::placeholder,form:hover input::placeholder{opacity:1}input{font:inherit;font-size:var(--font-size-input, 14px);flex-grow:1;min-height:var(--size-input-min-height, 29px);background-color:transparent;color:var(--color-input, #444952);white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input:focus{color:var(--color-input-focus, #444952);outline:0;box-shadow:none}ul,div.error,div.no-results{background-color:var(--color-bg-dropdown, #fff);border-radius:var(--radius-dropdown, 4px);left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul{font-size:var(--font-size-items, 14px);line-height:16px;box-shadow:var(--shadow-dropdown, 0px 5px 10px rgba(51, 51, 89, .15))}div.error,div.no-results{font:inherit;line-height:18px;font-size:var(--font-size-error, 12px);display:flex;gap:16px}div.error{padding:16px;font-weight:600;color:var(--color-error-text, #e25041);background-color:var(--color-error-bg, #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: var(--color-error-icon, #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:var(--color-no-results-text, #6b7c93);box-shadow:var(--shadow-dropdown, 0px 5px 10px rgba(51, 51, 89, .15))}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: var(--color-icon-button-hover, #2b8bfb)}.input-group{display:flex;align-items:stretch;gap:var(--input-group-gap, 7px);padding:var(--input-group-padding, 0 8px);border-radius:var(--radius-input-group, 4px);overflow:hidden}.input-group:focus-within{outline:var(--color-focus-outline, #2b8bfb) solid var(--size-focus-outline, 2px)}.search-button{flex-shrink:0}.clear-button-container{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:var(--color-input-group-border, white solid 2px)}:host(.maptiler-geocoder) .input-group:focus-within{border:var(--color-input-group-border-focused, #2b8bfb solid 2px);outline:0}:host(.maptiler-geocoder) form.can-collapse{max-width:var(--size-collapse-width, 33px)}:host(.maptiler-geocoder) form,:host(.leaflet-geocoder) form,:host(.maptiler-geocoder) form.can-collapse:focus-within,:host(.leaflet-geocoder) form.can-collapse:focus-within,:host(.maptiler-geocoder) form.can-collapse:hover,:host(.leaflet-geocoder) form.can-collapse:hover{width:var(--size-width, 270px);max-width:var(--size-width, 270px)}:host(.leaflet-geocoder) .input-group{border:var(--color-input-group-border, white solid 1px)}:host(.leaflet-geocoder) form.can-collapse{max-width:var(--size-collapse-width, 30px)}';
|
|
359
|
+
var Ft = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, ze = (t) => {
|
|
360
360
|
throw TypeError(t);
|
|
361
|
-
},
|
|
362
|
-
for (var s =
|
|
363
|
-
(
|
|
364
|
-
return
|
|
365
|
-
},
|
|
366
|
-
|
|
361
|
+
}, h = (t, e, i, r) => {
|
|
362
|
+
for (var s = r > 1 ? void 0 : r ? Ot(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 && Ft(e, i, s), s;
|
|
365
|
+
}, fe = (t, e, i) => e.has(t) || ze("Cannot " + i), k = (t, e, i) => (fe(t, e, "read from private field"), i ? i.call(t) : e.get(t)), U = (t, e, i) => e.has(t) ? ze("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), le = (t, e, i, r) => (fe(t, e, "write to private field"), e.set(t, i), i), c = (t, e, i) => (fe(t, e, "access private method"), i), Q, D, ce, A, n, K, me, b, ge, H, ve, ye, E, be, Y, Ue, Ge, he, Re, We, je, De, Ae, Ve, qe, Ne, Ze, Qe, F, R;
|
|
366
|
+
const xe = "input:not([type]), input[type=text], input[type=search], select, textarea", J = "button, input[type=button]";
|
|
367
|
+
let l = class extends T {
|
|
367
368
|
constructor() {
|
|
368
|
-
super(...arguments),
|
|
369
|
+
super(...arguments), U(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.isFeatureListVisible = !1, this.isFeatureListInteractedWith = !1, U(this, Q, !1), U(this, D), U(this, ce, /* @__PURE__ */ new Set()), U(this, A);
|
|
370
|
+
}
|
|
371
|
+
get isLoading() {
|
|
372
|
+
return this.abortController !== void 0;
|
|
373
|
+
}
|
|
374
|
+
get input() {
|
|
375
|
+
for (const t of this.contentSlotElements) {
|
|
376
|
+
if (c(this, n, F).call(this, t)) return t;
|
|
377
|
+
const e = t.querySelector(xe);
|
|
378
|
+
if (c(this, n, F).call(this, e)) return e;
|
|
379
|
+
}
|
|
380
|
+
return this.inputSlotElements[0];
|
|
369
381
|
}
|
|
370
382
|
firstUpdated() {
|
|
371
|
-
|
|
383
|
+
le(this, Q, !0), this.input && (this.input.value = this.searchValue);
|
|
372
384
|
}
|
|
373
385
|
/**
|
|
374
386
|
* Set the options of this instance.
|
|
@@ -378,7 +390,7 @@ let l = class extends O {
|
|
|
378
390
|
setOptions(t) {
|
|
379
391
|
const e = { ...t };
|
|
380
392
|
for (const i of Object.keys(e))
|
|
381
|
-
|
|
393
|
+
Tt.includes(i) || delete e[i];
|
|
382
394
|
Object.assign(this, e);
|
|
383
395
|
}
|
|
384
396
|
/**
|
|
@@ -387,7 +399,7 @@ let l = class extends O {
|
|
|
387
399
|
* @param value text to set
|
|
388
400
|
*/
|
|
389
401
|
setQuery(t) {
|
|
390
|
-
|
|
402
|
+
c(this, n, ye).call(this, t, { external: !0 }), c(this, n, ve).call(this);
|
|
391
403
|
}
|
|
392
404
|
/**
|
|
393
405
|
* Set the content of search input box and immediately submit it.
|
|
@@ -395,13 +407,13 @@ let l = class extends O {
|
|
|
395
407
|
* @param value text to set and submit
|
|
396
408
|
*/
|
|
397
409
|
submitQuery(t) {
|
|
398
|
-
|
|
410
|
+
c(this, n, be).call(this, t, { external: !0 });
|
|
399
411
|
}
|
|
400
412
|
/**
|
|
401
413
|
* Clear search result list.
|
|
402
414
|
*/
|
|
403
415
|
clearList() {
|
|
404
|
-
|
|
416
|
+
c(this, n, E).call(this), this.picked = void 0, this.selectedItemIndex = -1;
|
|
405
417
|
}
|
|
406
418
|
/**
|
|
407
419
|
* Focus the search input box.
|
|
@@ -409,13 +421,13 @@ let l = class extends O {
|
|
|
409
421
|
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
410
422
|
*/
|
|
411
423
|
focus(t) {
|
|
412
|
-
this.input
|
|
424
|
+
this.input?.focus(t);
|
|
413
425
|
}
|
|
414
426
|
/**
|
|
415
427
|
* Blur the search input box.
|
|
416
428
|
*/
|
|
417
429
|
blur() {
|
|
418
|
-
this.input
|
|
430
|
+
this.input?.blur();
|
|
419
431
|
}
|
|
420
432
|
addEventListener(t, e, i) {
|
|
421
433
|
super.addEventListener(t, e, i);
|
|
@@ -425,83 +437,101 @@ let l = class extends O {
|
|
|
425
437
|
}
|
|
426
438
|
/** @internal */
|
|
427
439
|
handleMapChange(t) {
|
|
428
|
-
|
|
440
|
+
le(this, A, t);
|
|
429
441
|
}
|
|
430
442
|
/** @internal */
|
|
431
443
|
handleMapClick(t) {
|
|
432
|
-
this.reverseActive &&
|
|
444
|
+
this.reverseActive && c(this, n, Ue).call(this, t);
|
|
433
445
|
}
|
|
434
446
|
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 &&
|
|
447
|
+
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 && c(this, n, E).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && k(this, n, me) && (c(this, n, E).call(this), this.error = void 0), ["focused", "listIsInteractedWith"].some((e) => t.has(e)) && this.clearOnBlur && !this.focused && !this.isFeatureListInteractedWith && (this.searchValue = ""), ["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)) && c(this, n, b).call(this, "select", { feature: k(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" ? c(this, n, Y).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
|
|
436
448
|
() => {
|
|
437
|
-
|
|
449
|
+
c(this, n, b).call(this, "pick", { feature: this.picked });
|
|
438
450
|
},
|
|
439
451
|
(e) => {
|
|
440
|
-
e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e,
|
|
452
|
+
e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, c(this, n, b).call(this, "pick", { feature: this.picked }));
|
|
441
453
|
}
|
|
442
|
-
), ["listFeatures", "focused", "isFeatureListInteractedWith", "keepListOpen"].some((e) => t.has(e)) && (this.isFeatureListVisible = !!this.listFeatures?.length && (this.focused || this.isFeatureListInteractedWith || this.keepListOpen)), ["isFeatureListVisible"].some((e) => t.has(e)) && (this.isFeatureListVisible ?
|
|
454
|
+
), ["listFeatures", "focused", "isFeatureListInteractedWith", "keepListOpen"].some((e) => t.has(e)) && (this.isFeatureListVisible = !!this.listFeatures?.length && (this.focused || this.isFeatureListInteractedWith || this.keepListOpen)), ["isFeatureListVisible"].some((e) => t.has(e)) && (this.isFeatureListVisible ? c(this, n, b).call(this, "featuresshow") : c(this, n, b).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && c(this, n, b).call(this, "reversetoggle", { reverse: this.reverseActive }), ["searchValue"].some((e) => t.has(e)) && this.input && (this.input.value = this.searchValue);
|
|
443
455
|
}
|
|
444
456
|
render() {
|
|
445
457
|
return g`
|
|
446
|
-
<form
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
458
|
+
<form
|
|
459
|
+
class=${N({ "can-collapse": this.collapsed && this.searchValue === "" })}
|
|
460
|
+
@submit=${c(this, n, ge)}
|
|
461
|
+
@focusin=${c(this, n, je)}
|
|
462
|
+
@focusout=${c(this, n, De)}
|
|
463
|
+
@click=${c(this, n, Ge)}
|
|
464
|
+
@keydown=${c(this, n, he)}
|
|
465
|
+
@input=${c(this, n, Re)}
|
|
466
|
+
@change=${c(this, n, We)}
|
|
467
|
+
>
|
|
468
|
+
<slot name="content">
|
|
469
|
+
<div class="input-group">
|
|
470
|
+
<slot name="start"></slot>
|
|
457
471
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
@change=${() => this.picked = void 0}
|
|
466
|
-
placeholder=${this.placeholder ?? "Search"}
|
|
467
|
-
aria-label=${this.placeholder ?? "Search"}
|
|
468
|
-
/>
|
|
472
|
+
<slot name="search-button">
|
|
473
|
+
<button class="search-button" type="button">
|
|
474
|
+
<slot name="search-icon">
|
|
475
|
+
<maptiler-geocode-search-icon></maptiler-geocode-search-icon>
|
|
476
|
+
</slot>
|
|
477
|
+
</button>
|
|
478
|
+
</slot>
|
|
469
479
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
480
|
+
<slot name="input">
|
|
481
|
+
<input placeholder=${this.placeholder ?? "Search"} aria-label=${this.placeholder ?? "Search"} />
|
|
482
|
+
</slot>
|
|
483
|
+
|
|
484
|
+
<div class="clear-button-container ${N({ displayable: this.searchValue !== "" })}">
|
|
485
|
+
${this.isLoading ? g`
|
|
486
|
+
<slot name="loading-icon">
|
|
487
|
+
<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>
|
|
488
|
+
</slot>
|
|
489
|
+
` : g`
|
|
490
|
+
<slot name="clear-button">
|
|
491
|
+
<button type="button" title=${this.clearButtonTitle ?? "clear"}>
|
|
492
|
+
<slot name="clear-icon">
|
|
493
|
+
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
494
|
+
</slot>
|
|
495
|
+
</button>
|
|
496
|
+
</slot>
|
|
497
|
+
`}
|
|
498
|
+
</div>
|
|
477
499
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
` : H}
|
|
500
|
+
${this.enableReverse === "button" ? g`
|
|
501
|
+
<slot name="reverse-button">
|
|
502
|
+
<button type="button" class=${N({ active: this.reverseActive })} title=${this.reverseButtonTitle ?? "toggle reverse geocoding"}>
|
|
503
|
+
<slot name="reverse-icon">
|
|
504
|
+
<maptiler-geocode-reverse-geocoding-icon></maptiler-geocode-reverse-geocoding-icon>
|
|
505
|
+
</slot>
|
|
506
|
+
</button>
|
|
507
|
+
</slot>
|
|
508
|
+
` : ee}
|
|
488
509
|
|
|
489
|
-
|
|
490
|
-
|
|
510
|
+
<slot name="end"></slot>
|
|
511
|
+
</div>
|
|
512
|
+
</slot>
|
|
491
513
|
|
|
492
514
|
${this.error ? g`
|
|
493
515
|
<div class="error">
|
|
494
|
-
<
|
|
516
|
+
<slot name="error-icon">
|
|
517
|
+
<maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
|
|
518
|
+
</slot>
|
|
495
519
|
|
|
496
520
|
<div>${this.errorMessage ?? "Something went wrong…"}</div>
|
|
497
521
|
|
|
498
|
-
<
|
|
499
|
-
<
|
|
500
|
-
|
|
522
|
+
<slot name="clear-error-button">
|
|
523
|
+
<button>
|
|
524
|
+
<slot name="clear-error-icon">
|
|
525
|
+
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
526
|
+
</slot>
|
|
527
|
+
</button>
|
|
528
|
+
</slot>
|
|
501
529
|
</div>
|
|
502
|
-
` : !this.focused && !this.isFeatureListInteractedWith && !this.keepListOpen || this.listFeatures === void 0 ?
|
|
530
|
+
` : !this.focused && !this.isFeatureListInteractedWith && !this.keepListOpen || this.listFeatures === void 0 ? ee : this.listFeatures.length === 0 ? g`
|
|
503
531
|
<div class="no-results">
|
|
504
|
-
<
|
|
532
|
+
<slot name="no-results-icon">
|
|
533
|
+
<maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
|
|
534
|
+
</slot>
|
|
505
535
|
|
|
506
536
|
<div>
|
|
507
537
|
${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!"}
|
|
@@ -509,14 +539,14 @@ let l = class extends O {
|
|
|
509
539
|
</div>
|
|
510
540
|
` : g`
|
|
511
541
|
<ul
|
|
512
|
-
class="options ${
|
|
513
|
-
@pointerleave=${
|
|
514
|
-
@pointerdown=${
|
|
515
|
-
@pointerup=${
|
|
516
|
-
@keydown=${
|
|
542
|
+
class="options ${N({ "open-on-top": this.openListOnTop })}"
|
|
543
|
+
@pointerleave=${c(this, n, qe)}
|
|
544
|
+
@pointerdown=${c(this, n, Ne)}
|
|
545
|
+
@pointerup=${c(this, n, Ze)}
|
|
546
|
+
@keydown=${c(this, n, he)}
|
|
517
547
|
role="listbox"
|
|
518
548
|
>
|
|
519
|
-
${
|
|
549
|
+
${Je(
|
|
520
550
|
this.listFeatures,
|
|
521
551
|
(t) => t.id + (t.address ? "," + t.address : ""),
|
|
522
552
|
(t, e) => g`
|
|
@@ -525,13 +555,13 @@ let l = class extends O {
|
|
|
525
555
|
.showPlaceType=${this.showPlaceType ?? "if-needed"}
|
|
526
556
|
itemStyle=${this.selectedItemIndex === e ? "selected" : this.picked?.id === t.id ? "picked" : "default"}
|
|
527
557
|
@pointerenter=${() => {
|
|
528
|
-
|
|
558
|
+
c(this, n, Ve).call(this, e);
|
|
529
559
|
}}
|
|
530
560
|
@select=${() => {
|
|
531
|
-
|
|
561
|
+
c(this, n, Ae).call(this, t);
|
|
532
562
|
}}
|
|
533
|
-
.missingIconsCache=${
|
|
534
|
-
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.
|
|
563
|
+
.missingIconsCache=${k(this, ce)}
|
|
564
|
+
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.1.0-rc.1/icons/"}
|
|
535
565
|
/>
|
|
536
566
|
`
|
|
537
567
|
)}
|
|
@@ -541,22 +571,19 @@ let l = class extends O {
|
|
|
541
571
|
`;
|
|
542
572
|
}
|
|
543
573
|
};
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
574
|
+
Q = /* @__PURE__ */ new WeakMap();
|
|
575
|
+
D = /* @__PURE__ */ new WeakMap();
|
|
576
|
+
ce = /* @__PURE__ */ new WeakMap();
|
|
577
|
+
A = /* @__PURE__ */ new WeakMap();
|
|
548
578
|
n = /* @__PURE__ */ new WeakSet();
|
|
549
|
-
|
|
579
|
+
K = function() {
|
|
550
580
|
return this.listFeatures?.[this.selectedItemIndex];
|
|
551
581
|
};
|
|
552
|
-
|
|
553
|
-
return this.abortController !== void 0;
|
|
554
|
-
};
|
|
555
|
-
pe = function() {
|
|
582
|
+
me = function() {
|
|
556
583
|
return this.searchValue.length < (this.minLength ?? 2);
|
|
557
584
|
};
|
|
558
|
-
|
|
559
|
-
|
|
585
|
+
b = function(t, ...[e]) {
|
|
586
|
+
k(this, Q) && this.dispatchEvent(
|
|
560
587
|
new CustomEvent(t, {
|
|
561
588
|
bubbles: !0,
|
|
562
589
|
composed: !0,
|
|
@@ -564,94 +591,94 @@ x = function(t, ...[e]) {
|
|
|
564
591
|
})
|
|
565
592
|
);
|
|
566
593
|
};
|
|
567
|
-
|
|
568
|
-
t?.preventDefault(), this.focused = !1, clearTimeout(
|
|
594
|
+
ge = function(t, { external: e = !1 } = {}) {
|
|
595
|
+
t?.preventDefault(), this.focused = !1, clearTimeout(k(this, D)), 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 && c(this, n, Y).call(this, this.searchValue, { exact: !0, external: e }).then(() => {
|
|
569
596
|
this.picked = void 0;
|
|
570
597
|
}).catch((i) => this.error = i);
|
|
571
598
|
};
|
|
572
|
-
|
|
599
|
+
H = function(t) {
|
|
573
600
|
try {
|
|
574
|
-
return
|
|
601
|
+
return Ye(t, 6);
|
|
575
602
|
} catch {
|
|
576
603
|
return !1;
|
|
577
604
|
}
|
|
578
605
|
};
|
|
579
|
-
|
|
606
|
+
ve = function() {
|
|
580
607
|
setTimeout(() => {
|
|
581
|
-
this.input
|
|
608
|
+
this.input?.focus(), this.focused = !0, this.input instanceof HTMLSelectElement ? this.input.showPicker() : this.input?.select();
|
|
582
609
|
});
|
|
583
610
|
};
|
|
584
|
-
|
|
585
|
-
if (this.searchValue = t,
|
|
586
|
-
if (clearTimeout(
|
|
611
|
+
ye = function(t, { external: e = !1 } = {}) {
|
|
612
|
+
if (this.searchValue = t, c(this, n, b).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, n, H).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
|
|
613
|
+
if (clearTimeout(k(this, D)), k(this, n, me))
|
|
587
614
|
return;
|
|
588
615
|
const i = this.searchValue;
|
|
589
|
-
|
|
590
|
-
|
|
616
|
+
le(this, D, window.setTimeout(() => {
|
|
617
|
+
c(this, n, Y).call(this, i, { external: e }).catch((r) => this.error = r);
|
|
591
618
|
}, this.debounceSearch ?? 200));
|
|
592
619
|
} else
|
|
593
|
-
|
|
620
|
+
c(this, n, E).call(this);
|
|
594
621
|
};
|
|
595
|
-
|
|
596
|
-
this.listFeatures !== void 0 && (this.listFeatures = void 0,
|
|
622
|
+
E = function() {
|
|
623
|
+
this.listFeatures !== void 0 && (this.listFeatures = void 0, c(this, n, b).call(this, "featuresclear"));
|
|
597
624
|
};
|
|
598
|
-
|
|
599
|
-
this.searchValue = t,
|
|
625
|
+
be = function(t, { external: e = !1 } = {}) {
|
|
626
|
+
this.searchValue = t, c(this, n, b).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, n, H).call(this, t) }), this.selectedItemIndex = -1, c(this, n, ge).call(this, void 0, { external: e });
|
|
600
627
|
};
|
|
601
|
-
|
|
628
|
+
Y = async function(t, { byId: e = !1, exact: i = !1, external: r = !1 } = {}) {
|
|
602
629
|
this.error = void 0, this.abortController?.abort();
|
|
603
630
|
const s = new AbortController();
|
|
604
631
|
this.abortController = s;
|
|
605
632
|
try {
|
|
606
|
-
const a = this.apiUrl ?? "https://api.maptiler.com/geocoding",
|
|
633
|
+
const a = this.apiUrl ?? "https://api.maptiler.com/geocoding", o = c(this, n, H).call(this, t), u = new URL(a + "/" + encodeURIComponent(o ? `${o.decimalLongitude},${o.decimalLatitude}` : t) + ".json"), m = u.searchParams;
|
|
607
634
|
this.language !== void 0 && m.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
|
|
608
|
-
const [_] =
|
|
609
|
-
let L = (!
|
|
610
|
-
(
|
|
611
|
-
).filter((
|
|
635
|
+
const [_] = k(this, A) ?? [void 0];
|
|
636
|
+
let L = (!o || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
|
|
637
|
+
(y) => typeof y == "string" ? y : _ === void 0 || (y[0] ?? 0) <= _ && _ < (y[1] ?? 1 / 0) ? y[2] : void 0
|
|
638
|
+
).filter((y) => y !== void 0);
|
|
612
639
|
L && (L = [...new Set(L)], m.set("types", L.join(",")));
|
|
613
|
-
const
|
|
614
|
-
if (
|
|
615
|
-
const
|
|
616
|
-
|
|
640
|
+
const we = !o || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
|
|
641
|
+
if (we && m.set("excludeTypes", String(we)), this.bbox && m.set("bbox", this.bbox.map((y) => y.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) {
|
|
642
|
+
const y = this.proximity ?? [{ type: "server-geolocation" }], _e = await kt(k(this, A), y, s);
|
|
643
|
+
_e && m.set("proximity", _e), (i || this.showResultsWhileTyping === !1) && m.set("autocomplete", "false"), m.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
|
|
617
644
|
}
|
|
618
|
-
const
|
|
619
|
-
|
|
620
|
-
const
|
|
621
|
-
if (
|
|
622
|
-
e ? (this.clearListOnPick &&
|
|
645
|
+
const ke = this.limit ?? 5, X = this.reverseGeocodingLimit ?? ke;
|
|
646
|
+
X > 1 && L?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), o ? (X === 1 || this.exhaustiveReverseGeocoding || L?.length === 1) && m.set("limit", String(X)) : m.set("limit", String(ke)), this.apiKey && m.set("key", this.apiKey), this.adjustUrl?.(u);
|
|
647
|
+
const He = u.searchParams.get("types") === "" && u.searchParams.get("excludeTypes") !== "true", q = u.toString();
|
|
648
|
+
if (q === this.lastSearchUrl) {
|
|
649
|
+
e ? (this.clearListOnPick && c(this, n, E).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, c(this, n, b).call(this, "featureslisted", { features: this.listFeatures, external: r }), this.listFeatures[this.selectedItemIndex]?.id !== k(this, n, K)?.id && (this.selectedItemIndex = -1));
|
|
623
650
|
return;
|
|
624
651
|
}
|
|
625
|
-
|
|
626
|
-
let
|
|
627
|
-
if (
|
|
628
|
-
|
|
652
|
+
c(this, n, b).call(this, "request", { urlObj: u }), this.lastSearchUrl = q;
|
|
653
|
+
let B;
|
|
654
|
+
if (He)
|
|
655
|
+
B = { type: "FeatureCollection", features: [] };
|
|
629
656
|
else {
|
|
630
|
-
const
|
|
657
|
+
const y = await fetch(q, {
|
|
631
658
|
signal: s.signal,
|
|
632
659
|
...this.fetchParameters
|
|
633
660
|
});
|
|
634
|
-
if (!
|
|
635
|
-
throw new Error(await
|
|
636
|
-
|
|
661
|
+
if (!y.ok)
|
|
662
|
+
throw new Error(await y.text());
|
|
663
|
+
B = await y.json();
|
|
637
664
|
}
|
|
638
|
-
|
|
665
|
+
c(this, n, b).call(this, "response", { url: q, featureCollection: B }), e ? (this.clearListOnPick && c(this, n, E).call(this), this.picked = B.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = B.features.filter(this.filter ?? (() => !0)), o && this.listFeatures.unshift({
|
|
639
666
|
type: "Feature",
|
|
640
667
|
properties: {},
|
|
641
668
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
642
|
-
id: `reverse_${
|
|
643
|
-
place_name: `${
|
|
644
|
-
text:
|
|
669
|
+
id: `reverse_${o.decimalLongitude}_${o.decimalLatitude}`,
|
|
670
|
+
place_name: `${o.decimalLatitude}, ${o.decimalLongitude}`,
|
|
671
|
+
text: o.toCoordinateFormat("DMS"),
|
|
645
672
|
/* eslint-enable @typescript-eslint/restrict-template-expressions */
|
|
646
673
|
place_type: ["reverse"],
|
|
647
674
|
place_type_name: ["reverse"],
|
|
648
|
-
center: [
|
|
649
|
-
bbox: [
|
|
675
|
+
center: [o.decimalLongitude, o.decimalLatitude],
|
|
676
|
+
bbox: [o.decimalLongitude, o.decimalLatitude, o.decimalLongitude, o.decimalLatitude],
|
|
650
677
|
geometry: {
|
|
651
678
|
type: "Point",
|
|
652
|
-
coordinates: [
|
|
679
|
+
coordinates: [o.decimalLongitude, o.decimalLatitude]
|
|
653
680
|
}
|
|
654
|
-
}),
|
|
681
|
+
}), c(this, n, b).call(this, "featureslisted", { features: this.listFeatures, external: r }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== k(this, n, K)?.id && (this.selectedItemIndex = -1), o && this.input?.focus());
|
|
655
682
|
} catch (a) {
|
|
656
683
|
if (a && typeof a == "object" && "name" in a && a.name === "AbortError")
|
|
657
684
|
return;
|
|
@@ -660,192 +687,237 @@ Q = async function(t, { byId: e = !1, exact: i = !1, external: o = !1 } = {}) {
|
|
|
660
687
|
s === this.abortController && (this.abortController = void 0);
|
|
661
688
|
}
|
|
662
689
|
};
|
|
663
|
-
|
|
664
|
-
this.reverseActive = this.enableReverse === "always",
|
|
690
|
+
Ue = function(t) {
|
|
691
|
+
this.reverseActive = this.enableReverse === "always", c(this, n, E).call(this), this.picked = void 0, c(this, n, be).call(this, `${t[1].toFixed(6)}, ${wt(t[0], [-180, 180], !0).toFixed(6)}`), c(this, n, ve).call(this);
|
|
692
|
+
};
|
|
693
|
+
Ge = function(t) {
|
|
694
|
+
c(this, n, F).call(this, t.target) ? this.focused = !0 : c(this, n, R).call(this, t.target, this.searchButtonElements, this.searchIconElements, "search-button") ? this.input?.focus() : c(this, n, R).call(this, t.target, this.clearButtonElements, this.clearIconElements, "clear-button") ? c(this, n, Qe).call(this) : c(this, n, R).call(this, t.target, this.reverseButtonElements, this.reverseIconElements, "reverse-button") ? this.reverseActive = !this.reverseActive : c(this, n, R).call(this, t.target, this.clearErrorButtonElements, this.clearErrorIconElements, "clear-error-button") && (this.error = void 0);
|
|
665
695
|
};
|
|
666
|
-
|
|
696
|
+
he = function(t) {
|
|
667
697
|
if (!this.listFeatures)
|
|
668
698
|
return;
|
|
669
699
|
const e = t.key === "ArrowDown" ? 1 : t.key === "ArrowUp" ? -1 : 0;
|
|
670
|
-
e && (this.input
|
|
700
|
+
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));
|
|
671
701
|
};
|
|
672
|
-
|
|
673
|
-
|
|
702
|
+
Re = function(t) {
|
|
703
|
+
c(this, n, F).call(this, t.target) && c(this, n, ye).call(this, t.target.value);
|
|
674
704
|
};
|
|
675
|
-
|
|
705
|
+
We = function(t) {
|
|
706
|
+
c(this, n, F).call(this, t.target) && (this.picked = void 0);
|
|
707
|
+
};
|
|
708
|
+
je = function(t) {
|
|
709
|
+
c(this, n, F).call(this, t.target) && (this.focused = !0);
|
|
710
|
+
};
|
|
711
|
+
De = function(t) {
|
|
712
|
+
c(this, n, F).call(this, t.target) && (this.focused = !1);
|
|
713
|
+
};
|
|
714
|
+
Ae = function(t) {
|
|
676
715
|
(!this.picked || this.picked.id !== t.id) && (this.picked = t, this.searchValue = t.place_name);
|
|
677
716
|
};
|
|
678
|
-
|
|
717
|
+
Ve = function(t) {
|
|
679
718
|
this.selectedItemIndex = t;
|
|
680
719
|
};
|
|
681
|
-
|
|
720
|
+
qe = function() {
|
|
682
721
|
(!this.selectFirst || this.picked) && (this.selectedItemIndex = -1), this.isFeatureListInteractedWith && (this.isFeatureListInteractedWith = !1);
|
|
683
722
|
};
|
|
684
|
-
|
|
723
|
+
Ne = function() {
|
|
685
724
|
this.isFeatureListInteractedWith = !0;
|
|
686
725
|
};
|
|
687
|
-
|
|
726
|
+
Ze = function() {
|
|
688
727
|
setTimeout(() => {
|
|
689
728
|
this.isFeatureListInteractedWith = !1;
|
|
690
729
|
});
|
|
691
730
|
};
|
|
692
|
-
|
|
693
|
-
this.searchValue = "",
|
|
731
|
+
Qe = function() {
|
|
732
|
+
this.searchValue = "", c(this, n, b).call(this, "queryclear"), this.picked = void 0, this.input?.focus();
|
|
694
733
|
};
|
|
695
|
-
|
|
696
|
-
|
|
734
|
+
F = function(t) {
|
|
735
|
+
return t instanceof HTMLElement && t.matches(xe);
|
|
736
|
+
};
|
|
737
|
+
R = function(t, e, i, r) {
|
|
738
|
+
return t instanceof HTMLElement && ([...e, ...i].some((s) => s.contains(t)) || t.closest(`[data-${r}]`) !== null);
|
|
739
|
+
};
|
|
740
|
+
l.styles = O`
|
|
741
|
+
${de(Et)}
|
|
697
742
|
`;
|
|
698
|
-
|
|
743
|
+
h([
|
|
699
744
|
p({ attribute: !1 })
|
|
700
745
|
], l.prototype, "adjustUrl", 2);
|
|
701
|
-
|
|
746
|
+
h([
|
|
702
747
|
p({ type: String })
|
|
703
748
|
], l.prototype, "apiKey", 2);
|
|
704
|
-
|
|
749
|
+
h([
|
|
705
750
|
p({ type: String })
|
|
706
751
|
], l.prototype, "apiUrl", 2);
|
|
707
|
-
|
|
752
|
+
h([
|
|
708
753
|
p({ type: Array })
|
|
709
754
|
], l.prototype, "bbox", 2);
|
|
710
|
-
|
|
755
|
+
h([
|
|
711
756
|
p({ type: String })
|
|
712
757
|
], l.prototype, "clearButtonTitle", 2);
|
|
713
|
-
|
|
758
|
+
h([
|
|
714
759
|
p({ type: Boolean })
|
|
715
760
|
], l.prototype, "clearListOnPick", 2);
|
|
716
|
-
|
|
761
|
+
h([
|
|
717
762
|
p({ type: Boolean })
|
|
718
763
|
], l.prototype, "clearOnBlur", 2);
|
|
719
|
-
|
|
764
|
+
h([
|
|
720
765
|
p({ type: Boolean })
|
|
721
766
|
], l.prototype, "collapsed", 2);
|
|
722
|
-
|
|
767
|
+
h([
|
|
723
768
|
p({ attribute: !1 })
|
|
724
769
|
], l.prototype, "country", 2);
|
|
725
|
-
|
|
770
|
+
h([
|
|
726
771
|
p({ type: Number })
|
|
727
772
|
], l.prototype, "debounceSearch", 2);
|
|
728
|
-
|
|
773
|
+
h([
|
|
729
774
|
p({ type: String })
|
|
730
775
|
], l.prototype, "enableReverse", 2);
|
|
731
|
-
|
|
776
|
+
h([
|
|
732
777
|
p({ type: String })
|
|
733
778
|
], l.prototype, "errorMessage", 2);
|
|
734
|
-
|
|
779
|
+
h([
|
|
735
780
|
p({ type: Boolean })
|
|
736
781
|
], l.prototype, "excludeTypes", 2);
|
|
737
|
-
|
|
782
|
+
h([
|
|
738
783
|
p({ type: Boolean })
|
|
739
784
|
], l.prototype, "exhaustiveReverseGeocoding", 2);
|
|
740
|
-
|
|
785
|
+
h([
|
|
741
786
|
p({ type: Boolean })
|
|
742
787
|
], l.prototype, "fetchFullGeometryOnPick", 2);
|
|
743
|
-
|
|
788
|
+
h([
|
|
744
789
|
p({ type: Object })
|
|
745
790
|
], l.prototype, "fetchParameters", 2);
|
|
746
|
-
|
|
791
|
+
h([
|
|
747
792
|
p({ attribute: !1 })
|
|
748
793
|
], l.prototype, "filter", 2);
|
|
749
|
-
|
|
794
|
+
h([
|
|
750
795
|
p({ type: Object })
|
|
751
796
|
], l.prototype, "fuzzyMatch", 2);
|
|
752
|
-
|
|
797
|
+
h([
|
|
753
798
|
p({ type: String })
|
|
754
799
|
], l.prototype, "iconsBaseUrl", 2);
|
|
755
|
-
|
|
800
|
+
h([
|
|
756
801
|
p({ type: Boolean })
|
|
757
802
|
], l.prototype, "keepListOpen", 2);
|
|
758
|
-
|
|
803
|
+
h([
|
|
759
804
|
p({ attribute: !1 })
|
|
760
805
|
], l.prototype, "language", 2);
|
|
761
|
-
|
|
806
|
+
h([
|
|
762
807
|
p({ type: Number })
|
|
763
808
|
], l.prototype, "limit", 2);
|
|
764
|
-
|
|
809
|
+
h([
|
|
765
810
|
p({ type: Number })
|
|
766
811
|
], l.prototype, "minLength", 2);
|
|
767
|
-
|
|
812
|
+
h([
|
|
768
813
|
p({ type: String })
|
|
769
814
|
], l.prototype, "noResultsMessage", 2);
|
|
770
|
-
|
|
815
|
+
h([
|
|
771
816
|
p({ type: Boolean })
|
|
772
817
|
], l.prototype, "openListOnTop", 2);
|
|
773
|
-
|
|
818
|
+
h([
|
|
774
819
|
p({ type: String })
|
|
775
820
|
], l.prototype, "placeholder", 2);
|
|
776
|
-
|
|
821
|
+
h([
|
|
777
822
|
p({ type: Array })
|
|
778
823
|
], l.prototype, "proximity", 2);
|
|
779
|
-
|
|
824
|
+
h([
|
|
780
825
|
p({ type: Boolean })
|
|
781
826
|
], l.prototype, "reverseActive", 2);
|
|
782
|
-
|
|
827
|
+
h([
|
|
783
828
|
p({ type: String })
|
|
784
829
|
], l.prototype, "reverseButtonTitle", 2);
|
|
785
|
-
|
|
830
|
+
h([
|
|
786
831
|
p({ type: Object })
|
|
787
832
|
], l.prototype, "reverseGeocodingExcludeTypes", 2);
|
|
788
|
-
|
|
833
|
+
h([
|
|
789
834
|
p({ type: Number })
|
|
790
835
|
], l.prototype, "reverseGeocodingLimit", 2);
|
|
791
|
-
|
|
836
|
+
h([
|
|
792
837
|
p({ type: Array })
|
|
793
838
|
], l.prototype, "reverseGeocodingTypes", 2);
|
|
794
|
-
|
|
839
|
+
h([
|
|
795
840
|
p({ type: Object })
|
|
796
841
|
], l.prototype, "selectFirst", 2);
|
|
797
|
-
|
|
842
|
+
h([
|
|
798
843
|
p({ type: String })
|
|
799
844
|
], l.prototype, "showPlaceType", 2);
|
|
800
|
-
|
|
845
|
+
h([
|
|
801
846
|
p({ type: Object })
|
|
802
847
|
], l.prototype, "showResultsWhileTyping", 2);
|
|
803
|
-
|
|
848
|
+
h([
|
|
804
849
|
p({ type: Array })
|
|
805
850
|
], l.prototype, "types", 2);
|
|
806
|
-
|
|
851
|
+
h([
|
|
807
852
|
p({ type: String })
|
|
808
853
|
], l.prototype, "worldview", 2);
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
], l.prototype, "
|
|
812
|
-
|
|
813
|
-
|
|
854
|
+
h([
|
|
855
|
+
I({ slot: "content", flatten: !1 })
|
|
856
|
+
], l.prototype, "contentSlotElements", 2);
|
|
857
|
+
h([
|
|
858
|
+
I({ slot: "input", flatten: !0, selector: xe })
|
|
859
|
+
], l.prototype, "inputSlotElements", 2);
|
|
860
|
+
h([
|
|
861
|
+
I({ slot: "search-button", flatten: !0, selector: J })
|
|
862
|
+
], l.prototype, "searchButtonElements", 2);
|
|
863
|
+
h([
|
|
864
|
+
I({ slot: "clear-button", flatten: !0, selector: J })
|
|
865
|
+
], l.prototype, "clearButtonElements", 2);
|
|
866
|
+
h([
|
|
867
|
+
I({ slot: "reverse-button", flatten: !0, selector: J })
|
|
868
|
+
], l.prototype, "reverseButtonElements", 2);
|
|
869
|
+
h([
|
|
870
|
+
I({ slot: "clear-error-button", flatten: !0, selector: J })
|
|
871
|
+
], l.prototype, "clearErrorButtonElements", 2);
|
|
872
|
+
h([
|
|
873
|
+
I({ slot: "search-icon", flatten: !0 })
|
|
874
|
+
], l.prototype, "searchIconElements", 2);
|
|
875
|
+
h([
|
|
876
|
+
I({ slot: "clear-icon", flatten: !0 })
|
|
877
|
+
], l.prototype, "clearIconElements", 2);
|
|
878
|
+
h([
|
|
879
|
+
I({ slot: "reverse-icon", flatten: !0 })
|
|
880
|
+
], l.prototype, "reverseIconElements", 2);
|
|
881
|
+
h([
|
|
882
|
+
I({ slot: "clear-error-icon", flatten: !0 })
|
|
883
|
+
], l.prototype, "clearErrorIconElements", 2);
|
|
884
|
+
h([
|
|
885
|
+
x()
|
|
814
886
|
], l.prototype, "searchValue", 2);
|
|
815
|
-
|
|
816
|
-
|
|
887
|
+
h([
|
|
888
|
+
x()
|
|
817
889
|
], l.prototype, "listFeatures", 2);
|
|
818
|
-
|
|
819
|
-
|
|
890
|
+
h([
|
|
891
|
+
x()
|
|
820
892
|
], l.prototype, "selectedItemIndex", 2);
|
|
821
|
-
|
|
822
|
-
|
|
893
|
+
h([
|
|
894
|
+
x()
|
|
823
895
|
], l.prototype, "picked", 2);
|
|
824
|
-
|
|
825
|
-
|
|
896
|
+
h([
|
|
897
|
+
x()
|
|
826
898
|
], l.prototype, "cachedFeatures", 2);
|
|
827
|
-
|
|
828
|
-
|
|
899
|
+
h([
|
|
900
|
+
x()
|
|
829
901
|
], l.prototype, "lastSearchUrl", 2);
|
|
830
|
-
|
|
831
|
-
|
|
902
|
+
h([
|
|
903
|
+
x()
|
|
832
904
|
], l.prototype, "error", 2);
|
|
833
|
-
|
|
834
|
-
|
|
905
|
+
h([
|
|
906
|
+
x()
|
|
835
907
|
], l.prototype, "abortController", 2);
|
|
836
|
-
|
|
837
|
-
|
|
908
|
+
h([
|
|
909
|
+
x()
|
|
838
910
|
], l.prototype, "focused", 2);
|
|
839
|
-
|
|
840
|
-
|
|
911
|
+
h([
|
|
912
|
+
x()
|
|
841
913
|
], l.prototype, "isFeatureListVisible", 2);
|
|
842
|
-
|
|
843
|
-
|
|
914
|
+
h([
|
|
915
|
+
x()
|
|
844
916
|
], l.prototype, "isFeatureListInteractedWith", 2);
|
|
845
|
-
l =
|
|
917
|
+
l = h([
|
|
846
918
|
C("maptiler-geocoder")
|
|
847
919
|
], l);
|
|
848
|
-
const
|
|
920
|
+
const Tt = [
|
|
849
921
|
"adjustUrl",
|
|
850
922
|
"apiKey",
|
|
851
923
|
"apiUrl",
|
|
@@ -883,15 +955,15 @@ const _t = [
|
|
|
883
955
|
"types",
|
|
884
956
|
"reverseGeocodingTypes",
|
|
885
957
|
"worldview"
|
|
886
|
-
],
|
|
887
|
-
var
|
|
888
|
-
for (var s =
|
|
889
|
-
(
|
|
958
|
+
], 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)}";
|
|
959
|
+
var Mt = Object.getOwnPropertyDescriptor, St = (t, e, i, r) => {
|
|
960
|
+
for (var s = r > 1 ? void 0 : r ? Mt(e, i) : e, a = t.length - 1, o; a >= 0; a--)
|
|
961
|
+
(o = t[a]) && (s = o(s) || s);
|
|
890
962
|
return s;
|
|
891
963
|
};
|
|
892
|
-
let
|
|
964
|
+
let pe = class extends T {
|
|
893
965
|
render() {
|
|
894
|
-
return
|
|
966
|
+
return V`
|
|
895
967
|
<svg
|
|
896
968
|
viewBox="0 0 70 85"
|
|
897
969
|
fill="none"
|
|
@@ -905,16 +977,16 @@ let ne = class extends O {
|
|
|
905
977
|
`;
|
|
906
978
|
}
|
|
907
979
|
};
|
|
908
|
-
|
|
909
|
-
${
|
|
980
|
+
pe.styles = O`
|
|
981
|
+
${de(Ct)}
|
|
910
982
|
`;
|
|
911
|
-
|
|
983
|
+
pe = St([
|
|
912
984
|
C("maptiler-geocode-marker")
|
|
913
|
-
],
|
|
914
|
-
function
|
|
915
|
-
const e =
|
|
916
|
-
|
|
917
|
-
|
|
985
|
+
], pe);
|
|
986
|
+
function Ee(t) {
|
|
987
|
+
const e = ct(
|
|
988
|
+
Z([
|
|
989
|
+
tt([
|
|
918
990
|
[
|
|
919
991
|
[180, 90],
|
|
920
992
|
[-180, 90],
|
|
@@ -929,22 +1001,22 @@ function ke(t) {
|
|
|
929
1001
|
if (!e)
|
|
930
1002
|
return;
|
|
931
1003
|
e.properties = { isMask: !0 };
|
|
932
|
-
const i =
|
|
933
|
-
if (
|
|
934
|
-
for (const u of
|
|
935
|
-
const m =
|
|
936
|
-
if (a && m[0] < -180 +
|
|
1004
|
+
const i = W(te(t)), r = (i[2] - i[0]) / 360 / 1e3, s = i[0] < -180, a = i[2] > 180, o = ht(t);
|
|
1005
|
+
if (o.features.length > 1 && (s || a))
|
|
1006
|
+
for (const u of o.features) {
|
|
1007
|
+
const m = W(te(u));
|
|
1008
|
+
if (a && m[0] < -180 + r)
|
|
937
1009
|
for (const _ of u.geometry.coordinates)
|
|
938
1010
|
for (const L of _)
|
|
939
|
-
L[0] += 360 -
|
|
940
|
-
if (s && m[2] > 180 -
|
|
1011
|
+
L[0] += 360 - r;
|
|
1012
|
+
if (s && m[2] > 180 - r)
|
|
941
1013
|
for (const _ of u.geometry.coordinates)
|
|
942
1014
|
for (const L of _)
|
|
943
|
-
L[0] -= 360 -
|
|
1015
|
+
L[0] -= 360 - r;
|
|
944
1016
|
}
|
|
945
|
-
return
|
|
1017
|
+
return Z([o.features.length < 2 ? t : Fe(o) ?? t, e]);
|
|
946
1018
|
}
|
|
947
|
-
const
|
|
1019
|
+
const Pt = {
|
|
948
1020
|
continental_marine: 4,
|
|
949
1021
|
country: 4,
|
|
950
1022
|
major_landform: 8,
|
|
@@ -968,21 +1040,21 @@ const Ft = {
|
|
|
968
1040
|
"poi.restaurant": 18,
|
|
969
1041
|
"poi.aerodrome": 13
|
|
970
1042
|
// TODO add many more
|
|
971
|
-
},
|
|
972
|
-
const e = t?.geometry.type, i = t?.properties?.isMask,
|
|
1043
|
+
}, Bt = (t) => {
|
|
1044
|
+
const e = t?.geometry.type, i = t?.properties?.isMask, r = i ? 0 : e === "LineString" || e === "MultiLineString" ? 3 : 2;
|
|
973
1045
|
return {
|
|
974
1046
|
color: "#3170fe",
|
|
975
1047
|
fillColor: "#000",
|
|
976
1048
|
fillOpacity: i ? 0.1 : 0,
|
|
977
|
-
weight:
|
|
978
|
-
dashArray: [
|
|
1049
|
+
weight: r,
|
|
1050
|
+
dashArray: [r, r],
|
|
979
1051
|
lineCap: "butt"
|
|
980
1052
|
};
|
|
981
1053
|
};
|
|
982
|
-
class
|
|
1054
|
+
class Ke extends ot {
|
|
983
1055
|
}
|
|
984
|
-
Object.assign(
|
|
985
|
-
class
|
|
1056
|
+
Object.assign(Ke.prototype, st.prototype);
|
|
1057
|
+
class Kt extends Ke {
|
|
986
1058
|
#e;
|
|
987
1059
|
#t;
|
|
988
1060
|
constructor(e = {}) {
|
|
@@ -990,13 +1062,13 @@ class Dt extends je {
|
|
|
990
1062
|
}
|
|
991
1063
|
/** @internal Not to be called directly */
|
|
992
1064
|
onAdd(e) {
|
|
993
|
-
this.#e = e, this.#t = e.getContainer().ownerDocument.createElement("maptiler-geocoder"), this.#t.classList.add("leaflet-geocoder"), this.#m(), this.#
|
|
1065
|
+
this.#e = e, this.#t = e.getContainer().ownerDocument.createElement("maptiler-geocoder"), this.#t.classList.add("leaflet-geocoder"), this.#m(), this.#b(), this.#$();
|
|
994
1066
|
const i = e.getContainer().ownerDocument.createElement("div");
|
|
995
|
-
return i.classList.add("leaflet-ctrl-geocoder", "leaflet-bar"), i.style.zIndex = "850", i.appendChild(this.#t),
|
|
1067
|
+
return i.classList.add("leaflet-ctrl-geocoder", "leaflet-bar"), i.style.zIndex = "850", i.appendChild(this.#t), Le.disableClickPropagation(i), Le.disableScrollPropagation(i), i;
|
|
996
1068
|
}
|
|
997
1069
|
/** @internal Not to be called directly */
|
|
998
1070
|
onRemove() {
|
|
999
|
-
this.#
|
|
1071
|
+
this.#x(), this.#E(), this.#e = void 0, this.#t = void 0;
|
|
1000
1072
|
}
|
|
1001
1073
|
getOptions() {
|
|
1002
1074
|
return { ...this.options };
|
|
@@ -1011,7 +1083,7 @@ class Dt extends je {
|
|
|
1011
1083
|
this.#t?.submitQuery(e);
|
|
1012
1084
|
}
|
|
1013
1085
|
clearMap() {
|
|
1014
|
-
this.#
|
|
1086
|
+
this.#r = [], this.#c(void 0, void 0);
|
|
1015
1087
|
}
|
|
1016
1088
|
clearList() {
|
|
1017
1089
|
this.#t?.clearList();
|
|
@@ -1030,9 +1102,9 @@ class Dt extends je {
|
|
|
1030
1102
|
/** Marker representing the selected feature */
|
|
1031
1103
|
#n;
|
|
1032
1104
|
/** Marker representing the picked feature */
|
|
1033
|
-
#r;
|
|
1034
|
-
/** Features currently marked on the map */
|
|
1035
1105
|
#o;
|
|
1106
|
+
/** Features currently marked on the map */
|
|
1107
|
+
#r;
|
|
1036
1108
|
/** Remember last feature that the map flew to as to not do it again */
|
|
1037
1109
|
#d;
|
|
1038
1110
|
/** Layer used for showing geometry results */
|
|
@@ -1044,10 +1116,10 @@ class Dt extends je {
|
|
|
1044
1116
|
},
|
|
1045
1117
|
querychange: (e) => {
|
|
1046
1118
|
const i = e.detail.reverseCoords;
|
|
1047
|
-
this.#
|
|
1119
|
+
this.#y(i ? { lng: i.decimalLongitude, lat: i.decimalLatitude } : void 0), this.#i("querychange", e.detail);
|
|
1048
1120
|
},
|
|
1049
1121
|
queryclear: () => {
|
|
1050
|
-
this.#
|
|
1122
|
+
this.#y(void 0), this.#i("queryclear");
|
|
1051
1123
|
},
|
|
1052
1124
|
request: (e) => {
|
|
1053
1125
|
this.#i("request", e.detail);
|
|
@@ -1057,11 +1129,11 @@ class Dt extends je {
|
|
|
1057
1129
|
},
|
|
1058
1130
|
select: (e) => {
|
|
1059
1131
|
const i = e.detail.feature;
|
|
1060
|
-
i && this.#h && this.options.flyToSelected && this.#g({ lng: i.center[0], lat: i.center[1] }, this.#l(i)), this.#
|
|
1132
|
+
i && this.#h && this.options.flyToSelected && this.#g({ lng: i.center[0], lat: i.center[1] }, this.#l(i)), this.#r && i && this.#I(i), this.#i("select", e.detail);
|
|
1061
1133
|
},
|
|
1062
1134
|
pick: (e) => {
|
|
1063
1135
|
const i = e.detail.feature;
|
|
1064
|
-
i && i.id !== this.#d && this.#h && (this.#w(i), this.#c(this.#
|
|
1136
|
+
i && i.id !== this.#d && this.#h && (this.#w(i), this.#c(this.#r, i)), this.#d = i?.id, this.#i("pick", e.detail);
|
|
1065
1137
|
},
|
|
1066
1138
|
featuresshow: () => {
|
|
1067
1139
|
this.#i("featuresshow");
|
|
@@ -1071,10 +1143,10 @@ class Dt extends je {
|
|
|
1071
1143
|
},
|
|
1072
1144
|
featureslisted: (e) => {
|
|
1073
1145
|
const i = e.detail.features;
|
|
1074
|
-
this.#
|
|
1146
|
+
this.#r = i, this.#c(this.#r, void 0), this.#k(e), this.#i("featureslisted", e.detail);
|
|
1075
1147
|
},
|
|
1076
1148
|
featuresclear: () => {
|
|
1077
|
-
this.#
|
|
1149
|
+
this.#r = void 0, this.#c(void 0, void 0), this.#i("featuresclear");
|
|
1078
1150
|
},
|
|
1079
1151
|
focusin: () => {
|
|
1080
1152
|
this.#i("focusin");
|
|
@@ -1095,14 +1167,14 @@ class Dt extends je {
|
|
|
1095
1167
|
#m() {
|
|
1096
1168
|
this.#t && (this.#t.setOptions(this.options), this.#t.fetchFullGeometryOnPick = this.options.pickedResultStyle !== "marker-only", this.#t.openListOnTop = this.options.position === "bottomleft" || this.options.position === "bottomright");
|
|
1097
1169
|
}
|
|
1098
|
-
#
|
|
1170
|
+
#b() {
|
|
1099
1171
|
if (!(!this.#t || !this.#e)) {
|
|
1100
1172
|
for (const [e, i] of Object.entries(this.#u))
|
|
1101
1173
|
this.#t.addEventListener(e, i);
|
|
1102
1174
|
this.#e.on(this.#f);
|
|
1103
1175
|
}
|
|
1104
1176
|
}
|
|
1105
|
-
#
|
|
1177
|
+
#x() {
|
|
1106
1178
|
if (!(!this.#t || !this.#e)) {
|
|
1107
1179
|
for (const [e, i] of Object.entries(this.#u))
|
|
1108
1180
|
this.#t.removeEventListener(e, i);
|
|
@@ -1113,25 +1185,25 @@ class Dt extends je {
|
|
|
1113
1185
|
return super.fire(e, i);
|
|
1114
1186
|
}
|
|
1115
1187
|
#w(e) {
|
|
1116
|
-
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.#
|
|
1188
|
+
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.#v(W(e.bbox), 50, this.#l(e));
|
|
1117
1189
|
}
|
|
1118
1190
|
#k({ detail: { features: e, external: i } }) {
|
|
1119
1191
|
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"))
|
|
1120
1192
|
return;
|
|
1121
|
-
const
|
|
1122
|
-
(
|
|
1193
|
+
const r = e.every((o) => o.matching_text), s = e.reduce(
|
|
1194
|
+
(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,
|
|
1123
1195
|
[180, 90, -180, -90]
|
|
1124
|
-
), a = e.map((
|
|
1125
|
-
this.#
|
|
1196
|
+
), 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);
|
|
1197
|
+
this.#v(W(s), 50, a);
|
|
1126
1198
|
}
|
|
1127
1199
|
#l(e) {
|
|
1128
1200
|
if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
|
|
1129
1201
|
return;
|
|
1130
|
-
const i = e.id.replace(/\..*/, ""),
|
|
1202
|
+
const i = e.id.replace(/\..*/, ""), r = this.options.zoom ?? Pt;
|
|
1131
1203
|
return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((s, a) => {
|
|
1132
|
-
const
|
|
1133
|
-
return s === void 0 ?
|
|
1134
|
-
}, void 0) : void 0) ??
|
|
1204
|
+
const o = r[i + "." + a];
|
|
1205
|
+
return s === void 0 ? o : o === void 0 ? s : Math.max(s, o);
|
|
1206
|
+
}, void 0) : void 0) ?? r[i];
|
|
1135
1207
|
}
|
|
1136
1208
|
get #h() {
|
|
1137
1209
|
return !!this.options.flyTo || this.options.flyTo === void 0;
|
|
@@ -1145,22 +1217,22 @@ class Dt extends je {
|
|
|
1145
1217
|
#g(e, i) {
|
|
1146
1218
|
this.#e?.flyTo(e, i, this.#_ ?? void 0);
|
|
1147
1219
|
}
|
|
1148
|
-
#
|
|
1220
|
+
#v(e, i, r) {
|
|
1149
1221
|
this.#e?.fitBounds(
|
|
1150
1222
|
[
|
|
1151
1223
|
[e[1], e[0]],
|
|
1152
1224
|
[e[3], e[2]]
|
|
1153
1225
|
],
|
|
1154
|
-
{ padding: [i, i], ...
|
|
1226
|
+
{ padding: [i, i], ...r ? { maxZoom: r } : {}, ...this.#L }
|
|
1155
1227
|
);
|
|
1156
1228
|
}
|
|
1157
|
-
#
|
|
1229
|
+
#y(e) {
|
|
1158
1230
|
if (!(this.options.marker === !1 || this.options.marker === null || !this.#e)) {
|
|
1159
1231
|
if (!e) {
|
|
1160
|
-
this.#
|
|
1232
|
+
this.#o?.remove(), this.#o = void 0;
|
|
1161
1233
|
return;
|
|
1162
1234
|
}
|
|
1163
|
-
this.#
|
|
1235
|
+
this.#o || (this.options.marker instanceof Function ? this.#o = this.options.marker(this.#e) ?? void 0 : (this.#o = this.#p(e, this.options.marker).addTo(this.#e), this.#o.getElement()?.classList.add("marker-reverse"))), this.#o?.setLatLng(e);
|
|
1164
1236
|
}
|
|
1165
1237
|
}
|
|
1166
1238
|
#c(e, i) {
|
|
@@ -1169,7 +1241,7 @@ class Dt extends je {
|
|
|
1169
1241
|
for (const s of this.#a.values())
|
|
1170
1242
|
s.remove();
|
|
1171
1243
|
this.#a = /* @__PURE__ */ new Map(), this.#s?.clearLayers();
|
|
1172
|
-
const
|
|
1244
|
+
const r = () => {
|
|
1173
1245
|
if (!i || !this.#e || this.options.marker === !1 || this.options.marker === null) return;
|
|
1174
1246
|
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);
|
|
1175
1247
|
s && this.#a.set(i, s);
|
|
@@ -1179,17 +1251,17 @@ class Dt extends je {
|
|
|
1179
1251
|
(a) => a.type === "Polygon" || a.type === "MultiPolygon"
|
|
1180
1252
|
);
|
|
1181
1253
|
if (s.length > 0) {
|
|
1182
|
-
const a =
|
|
1254
|
+
const a = Fe(Z(s.map((o) => it(o))));
|
|
1183
1255
|
if (a) {
|
|
1184
|
-
const
|
|
1185
|
-
if (
|
|
1186
|
-
const u = [...
|
|
1187
|
-
m[0] - _ / 4 < -180 && u.push(...
|
|
1256
|
+
const o = Ee({ ...i, geometry: a.geometry });
|
|
1257
|
+
if (o) {
|
|
1258
|
+
const u = [...o.features], m = W(te(i)), _ = m[2] - m[0];
|
|
1259
|
+
m[0] - _ / 4 < -180 && u.push(...Ie(o, -360).features), m[2] + _ / 4 > 180 && u.push(...Ie(o, 360).features), this.#s?.addData(Z(u));
|
|
1188
1260
|
}
|
|
1189
1261
|
}
|
|
1190
1262
|
} else {
|
|
1191
1263
|
const a = i.geometry.geometries.filter(
|
|
1192
|
-
(
|
|
1264
|
+
(o) => o.type === "LineString" || o.type === "MultiLineString"
|
|
1193
1265
|
);
|
|
1194
1266
|
a.length > 0 && this.#s?.addData({
|
|
1195
1267
|
...i,
|
|
@@ -1197,9 +1269,9 @@ class Dt extends je {
|
|
|
1197
1269
|
});
|
|
1198
1270
|
}
|
|
1199
1271
|
} else if (i?.geometry.type.endsWith("Polygon")) {
|
|
1200
|
-
const s =
|
|
1201
|
-
s && this.#s?.addData(s), this.options.pickedResultStyle === "full-geometry-including-polygon-center-marker" &&
|
|
1202
|
-
} else i?.geometry.type.endsWith("LineString") ? this.#s?.addData(i) : i?.geometry.type.endsWith("Point") &&
|
|
1272
|
+
const s = Ee(i);
|
|
1273
|
+
s && this.#s?.addData(s), this.options.pickedResultStyle === "full-geometry-including-polygon-center-marker" && r();
|
|
1274
|
+
} else i?.geometry.type.endsWith("LineString") ? this.#s?.addData(i) : i?.geometry.type.endsWith("Point") && r();
|
|
1203
1275
|
if (this.options.showResultMarkers !== !1 && this.options.showResultMarkers !== null)
|
|
1204
1276
|
for (const s of e ?? []) {
|
|
1205
1277
|
if (s.id === i?.id || s.place_type.includes("reverse"))
|
|
@@ -1210,56 +1282,56 @@ class Dt extends je {
|
|
|
1210
1282
|
continue;
|
|
1211
1283
|
} else
|
|
1212
1284
|
a = this.#p({ lng: s.center[0], lat: s.center[1] }, this.options.showResultMarkers).bindPopup(
|
|
1213
|
-
new
|
|
1285
|
+
new rt({
|
|
1214
1286
|
offset: [0.3, -21],
|
|
1215
1287
|
closeButton: !1,
|
|
1216
1288
|
closeOnMove: !0,
|
|
1217
1289
|
className: "maptiler-gc-popup"
|
|
1218
1290
|
}).setContent(s.place_type[0] === "reverse" ? s.place_name : s.place_name.replace(/,.*/, ""))
|
|
1219
1291
|
).addTo(this.#e), a.getElement()?.classList.add("marker-interactive");
|
|
1220
|
-
const
|
|
1221
|
-
|
|
1292
|
+
const o = a.getElement();
|
|
1293
|
+
o?.addEventListener("click", (u) => {
|
|
1222
1294
|
u.stopPropagation(), this.#i("markerclick", { feature: s, marker: a });
|
|
1223
|
-
}),
|
|
1295
|
+
}), o?.addEventListener("mouseenter", () => {
|
|
1224
1296
|
this.#i("markermouseenter", { feature: s, marker: a }), a.togglePopup();
|
|
1225
|
-
}),
|
|
1297
|
+
}), o?.addEventListener("mouseleave", () => {
|
|
1226
1298
|
this.#i("markermouseleave", { feature: s, marker: a }), a.togglePopup();
|
|
1227
|
-
}),
|
|
1299
|
+
}), o?.classList.toggle("marker-fuzzy", !!s.matching_text), this.#a.set(s, a);
|
|
1228
1300
|
}
|
|
1229
1301
|
}
|
|
1230
|
-
|
|
1302
|
+
#I(e) {
|
|
1231
1303
|
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));
|
|
1232
1304
|
}
|
|
1233
|
-
|
|
1234
|
-
this.#e && (this.#s = new
|
|
1235
|
-
style: this.#
|
|
1305
|
+
#$() {
|
|
1306
|
+
this.#e && (this.#s = new at(void 0, {
|
|
1307
|
+
style: this.#F(),
|
|
1236
1308
|
interactive: !1
|
|
1237
1309
|
}).addTo(this.#e));
|
|
1238
1310
|
}
|
|
1239
|
-
#
|
|
1311
|
+
#E() {
|
|
1240
1312
|
this.#e && (this.#s?.removeFrom(this.#e), this.#s = void 0);
|
|
1241
1313
|
}
|
|
1242
1314
|
#p(e, i) {
|
|
1243
|
-
return typeof i != "object" && (i = { icon: new
|
|
1315
|
+
return typeof i != "object" && (i = { icon: new nt({ html: this.#e?.getContainer().ownerDocument.createElement("maptiler-geocode-marker"), iconAnchor: [12.3, 30], className: "" }) }), new lt(e, i);
|
|
1244
1316
|
}
|
|
1245
|
-
#
|
|
1317
|
+
#F() {
|
|
1246
1318
|
const { fullGeometryStyle: e } = this.options;
|
|
1247
|
-
if (e === !0 || e === void 0) return
|
|
1319
|
+
if (e === !0 || e === void 0) return Bt;
|
|
1248
1320
|
if (!(e === !1 || e === null))
|
|
1249
1321
|
return e;
|
|
1250
1322
|
}
|
|
1251
1323
|
}
|
|
1252
1324
|
export {
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1325
|
+
Bt as DEFAULT_GEOMETRY_STYLE,
|
|
1326
|
+
Kt as GeocodingControl,
|
|
1327
|
+
Kt as LeafletGeocodingControl,
|
|
1328
|
+
ie as MaptilerGeocodeClearIconElement,
|
|
1329
|
+
se as MaptilerGeocodeFailIconElement,
|
|
1330
|
+
oe as MaptilerGeocodeLoadingIconElement,
|
|
1331
|
+
pe as MaptilerGeocodeMarkerElement,
|
|
1332
|
+
re as MaptilerGeocodeReverseGeocodingIconElement,
|
|
1333
|
+
ae as MaptilerGeocodeSearchIconElement,
|
|
1262
1334
|
l as MaptilerGeocoderElement,
|
|
1263
|
-
|
|
1335
|
+
Pt as ZOOM_DEFAULTS
|
|
1264
1336
|
};
|
|
1265
1337
|
//# sourceMappingURL=leaflet.js.map
|