@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/maplibregl.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { customElement as O, property as p, state as
|
|
3
|
-
import { convert as
|
|
4
|
-
import { classMap as
|
|
5
|
-
import { repeat as
|
|
1
|
+
import { css as F, LitElement as T, svg as D, html as m, unsafeCSS as ue, nothing as ie } from "lit";
|
|
2
|
+
import { customElement as O, property as p, state as x, queryAssignedElements as L } from "lit/decorators.js";
|
|
3
|
+
import { convert as Ye } from "geo-coordinates-parser";
|
|
4
|
+
import { classMap as q } from "lit/directives/class-map.js";
|
|
5
|
+
import { repeat as Je } from "lit/directives/repeat.js";
|
|
6
6
|
import "@turf/clone";
|
|
7
|
-
import { styleMap as
|
|
8
|
-
import { featureCollection as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
var
|
|
15
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
7
|
+
import { styleMap as Xe } from "lit/directives/style-map.js";
|
|
8
|
+
import { featureCollection as Z, polygon as et, feature as tt } from "@turf/helpers";
|
|
9
|
+
import Te from "@turf/union";
|
|
10
|
+
import te from "maplibre-gl";
|
|
11
|
+
import Ie from "@turf/bbox";
|
|
12
|
+
import it from "@turf/difference";
|
|
13
|
+
import st from "@turf/flatten";
|
|
14
|
+
var rt = Object.getOwnPropertyDescriptor, ot = (t, e, i, a) => {
|
|
15
|
+
for (var s = a > 1 ? void 0 : a ? rt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
16
16
|
(r = t[o]) && (s = r(s) || s);
|
|
17
17
|
return s;
|
|
18
18
|
};
|
|
19
|
-
let
|
|
19
|
+
let se = class extends T {
|
|
20
20
|
render() {
|
|
21
|
-
return
|
|
21
|
+
return D`
|
|
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 X = class extends F {
|
|
|
27
27
|
`;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
se.styles = F`
|
|
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
|
+
se = ot([
|
|
37
37
|
O("maptiler-geocode-clear-icon")
|
|
38
|
-
],
|
|
39
|
-
var
|
|
40
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
38
|
+
], se);
|
|
39
|
+
var at = Object.getOwnPropertyDescriptor, lt = (t, e, i, a) => {
|
|
40
|
+
for (var s = a > 1 ? void 0 : a ? at(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
41
41
|
(r = t[o]) && (s = r(s) || s);
|
|
42
42
|
return s;
|
|
43
43
|
};
|
|
44
|
-
let
|
|
44
|
+
let re = class extends T {
|
|
45
45
|
render() {
|
|
46
|
-
return
|
|
46
|
+
return D`
|
|
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 ee = class extends F {
|
|
|
52
52
|
`;
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
|
|
55
|
+
re.styles = F`
|
|
56
56
|
svg {
|
|
57
57
|
display: block;
|
|
58
|
-
fill: #e15042;
|
|
58
|
+
fill: var(--color-fail-icon, #e15042);
|
|
59
59
|
}
|
|
60
60
|
`;
|
|
61
|
-
|
|
61
|
+
re = lt([
|
|
62
62
|
O("maptiler-geocode-fail-icon")
|
|
63
|
-
],
|
|
64
|
-
var
|
|
65
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
63
|
+
], re);
|
|
64
|
+
var nt = Object.getOwnPropertyDescriptor, ct = (t, e, i, a) => {
|
|
65
|
+
for (var s = a > 1 ? void 0 : a ? nt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
66
66
|
(r = t[o]) && (s = r(s) || s);
|
|
67
67
|
return s;
|
|
68
68
|
};
|
|
69
|
-
let
|
|
69
|
+
let oe = class extends T {
|
|
70
70
|
render() {
|
|
71
71
|
return m`
|
|
72
72
|
<div>
|
|
@@ -78,7 +78,7 @@ let te = class extends F {
|
|
|
78
78
|
`;
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
oe.styles = F`
|
|
82
82
|
div {
|
|
83
83
|
position: absolute;
|
|
84
84
|
left: 50%;
|
|
@@ -105,17 +105,17 @@ te.styles = I`
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
`;
|
|
108
|
-
|
|
108
|
+
oe = ct([
|
|
109
109
|
O("maptiler-geocode-loading-icon")
|
|
110
|
-
],
|
|
111
|
-
var
|
|
112
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
110
|
+
], oe);
|
|
111
|
+
var ht = Object.getOwnPropertyDescriptor, pt = (t, e, i, a) => {
|
|
112
|
+
for (var s = a > 1 ? void 0 : a ? ht(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
113
113
|
(r = t[o]) && (s = r(s) || s);
|
|
114
114
|
return s;
|
|
115
115
|
};
|
|
116
|
-
let
|
|
116
|
+
let ae = class extends T {
|
|
117
117
|
render() {
|
|
118
|
-
return
|
|
118
|
+
return D`
|
|
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 ie = class extends F {
|
|
|
124
124
|
`;
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
|
-
|
|
127
|
+
ae.styles = F`
|
|
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
|
+
ae = pt([
|
|
134
134
|
O("maptiler-geocode-reverse-geocoding-icon")
|
|
135
|
-
],
|
|
136
|
-
var
|
|
137
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
135
|
+
], ae);
|
|
136
|
+
var dt = Object.getOwnPropertyDescriptor, ut = (t, e, i, a) => {
|
|
137
|
+
for (var s = a > 1 ? void 0 : a ? dt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
138
138
|
(r = t[o]) && (s = r(s) || s);
|
|
139
139
|
return s;
|
|
140
140
|
};
|
|
141
|
-
let
|
|
141
|
+
let le = class extends T {
|
|
142
142
|
render() {
|
|
143
|
-
return
|
|
143
|
+
return D`
|
|
144
144
|
<svg
|
|
145
145
|
xmlns="http://www.w3.org/2000/svg"
|
|
146
146
|
width="13"
|
|
@@ -153,7 +153,7 @@ let se = class extends F {
|
|
|
153
153
|
`;
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
|
-
|
|
156
|
+
le.styles = F`
|
|
157
157
|
circle {
|
|
158
158
|
stroke-width: 1.875;
|
|
159
159
|
fill: none;
|
|
@@ -166,30 +166,30 @@ se.styles = I`
|
|
|
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
|
+
le = ut([
|
|
173
173
|
O("maptiler-geocode-search-icon")
|
|
174
|
-
],
|
|
175
|
-
function
|
|
174
|
+
], le);
|
|
175
|
+
function ft(t, e, i) {
|
|
176
176
|
const a = e[1], s = e[0], o = a - s;
|
|
177
177
|
return t === a && i ? t : ((t - s) % o + o) % o + s;
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function Q(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
|
-
let
|
|
184
|
-
async function
|
|
183
|
+
let z;
|
|
184
|
+
async function mt(t, e, i) {
|
|
185
185
|
for (const a of e ?? [])
|
|
186
186
|
if (!(t && (a.minZoom != null && a.minZoom > t[0] || a.maxZoom != null && a.maxZoom < t[0]))) {
|
|
187
187
|
if (a.type === "fixed")
|
|
188
188
|
return a.coordinates.join(",");
|
|
189
189
|
if (a.type === "client-geolocation")
|
|
190
|
-
if (
|
|
191
|
-
if (
|
|
192
|
-
return
|
|
190
|
+
if (z && a.cachedLocationExpiry && z.time + a.cachedLocationExpiry > Date.now()) {
|
|
191
|
+
if (z.coords)
|
|
192
|
+
return z.coords;
|
|
193
193
|
} else {
|
|
194
194
|
let s;
|
|
195
195
|
try {
|
|
@@ -208,7 +208,7 @@ async function nt(t, e, i) {
|
|
|
208
208
|
}), s;
|
|
209
209
|
} catch {
|
|
210
210
|
} finally {
|
|
211
|
-
a.cachedLocationExpiry && (
|
|
211
|
+
a.cachedLocationExpiry && (z = {
|
|
212
212
|
time: Date.now(),
|
|
213
213
|
coords: s
|
|
214
214
|
});
|
|
@@ -222,21 +222,21 @@ async function nt(t, e, i) {
|
|
|
222
222
|
return t[1].toFixed(6) + "," + t[2].toFixed(6);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
const
|
|
226
|
-
var
|
|
225
|
+
const gt = ".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)}}";
|
|
226
|
+
var yt = Object.defineProperty, vt = Object.getOwnPropertyDescriptor, Oe = (t) => {
|
|
227
227
|
throw TypeError(t);
|
|
228
|
-
},
|
|
229
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
228
|
+
}, I = (t, e, i, a) => {
|
|
229
|
+
for (var s = a > 1 ? void 0 : a ? vt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
230
230
|
(r = t[o]) && (s = (a ? r(e, i, s) : r(s)) || s);
|
|
231
|
-
return a && s &&
|
|
232
|
-
},
|
|
233
|
-
const
|
|
234
|
-
let
|
|
231
|
+
return a && s && yt(e, i, s), s;
|
|
232
|
+
}, Me = (t, e, i) => e.has(t) || Oe("Cannot " + i), f = (t, e, i) => (Me(t, e, "read from private field"), i ? i.call(t) : e.get(t)), bt = (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) => (Me(t, e, "access private method"), i), d, j, G, g, Se, Ce, fe, ne;
|
|
233
|
+
const Pe = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Be = Pe ? "@2x" : "", C = Pe ? 2 : 1;
|
|
234
|
+
let S, ze, w = class extends T {
|
|
235
235
|
constructor() {
|
|
236
|
-
super(...arguments),
|
|
236
|
+
super(...arguments), bt(this, d), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
|
|
237
237
|
}
|
|
238
238
|
willUpdate(t) {
|
|
239
|
-
t.has("feature") && f(this, d,
|
|
239
|
+
t.has("feature") && f(this, d, j) && (this.index = f(this, d, j).length, P(this, d, fe).call(this));
|
|
240
240
|
}
|
|
241
241
|
render() {
|
|
242
242
|
return m`
|
|
@@ -248,112 +248,124 @@ let M, Se, w = class extends F {
|
|
|
248
248
|
class=${this.itemStyle}
|
|
249
249
|
@click=${() => this.dispatchEvent(new CustomEvent("select"))}
|
|
250
250
|
>
|
|
251
|
-
${
|
|
251
|
+
${S && this.spriteIcon ? m`
|
|
252
252
|
<div
|
|
253
253
|
class="sprite-icon"
|
|
254
|
-
style=${
|
|
255
|
-
width: `${this.spriteIcon.width /
|
|
256
|
-
height: `${this.spriteIcon.height /
|
|
257
|
-
backgroundImage: `url(${this.iconsBaseUrl}sprite${
|
|
258
|
-
backgroundPosition: `-${this.spriteIcon.x /
|
|
259
|
-
backgroundSize: `${
|
|
254
|
+
style=${Xe({
|
|
255
|
+
width: `${this.spriteIcon.width / C}px`,
|
|
256
|
+
height: `${this.spriteIcon.height / C}px`,
|
|
257
|
+
backgroundImage: `url(${this.iconsBaseUrl}sprite${Be}.png)`,
|
|
258
|
+
backgroundPosition: `-${this.spriteIcon.x / C}px -${this.spriteIcon.y / C}px`,
|
|
259
|
+
backgroundSize: `${S.width / C}px ${S.height / C}px`
|
|
260
260
|
})}
|
|
261
261
|
title=${f(this, d, g)}
|
|
262
262
|
/>
|
|
263
|
-
` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${f(this, d, g)} @error=${
|
|
263
|
+
` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${f(this, d, g)} @error=${P(this, d, Ce)} />` : this.feature?.address ? m` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("road.") ? m` <img src=${this.iconsBaseUrl + "road.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("address.") ? m` <img src=${this.iconsBaseUrl + "street.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? m` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("poi.") ? m` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : f(this, d, G) ? m` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : m` <img src=${this.iconsBaseUrl + "area.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> `}
|
|
264
264
|
|
|
265
265
|
<span class="texts">
|
|
266
266
|
<span>
|
|
267
|
-
<span class="primary"> ${f(this, d,
|
|
267
|
+
<span class="primary"> ${f(this, d, G) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
|
|
268
268
|
|
|
269
|
-
${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,
|
|
269
|
+
${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) ? m` <span class="secondary"> ${f(this, d, g)} </span> ` : ie}
|
|
270
270
|
</span>
|
|
271
271
|
|
|
272
|
-
<span class="line2"> ${f(this, d,
|
|
272
|
+
<span class="line2"> ${f(this, d, G) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
|
|
273
273
|
</span>
|
|
274
274
|
</li>
|
|
275
275
|
`;
|
|
276
276
|
}
|
|
277
277
|
};
|
|
278
278
|
d = /* @__PURE__ */ new WeakSet();
|
|
279
|
-
|
|
279
|
+
j = function() {
|
|
280
280
|
return this.feature?.properties?.categories;
|
|
281
281
|
};
|
|
282
|
-
|
|
282
|
+
G = function() {
|
|
283
283
|
return this.feature?.place_type[0] === "reverse";
|
|
284
284
|
};
|
|
285
285
|
g = function() {
|
|
286
|
-
return this
|
|
286
|
+
return f(this, d, j)?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
|
|
287
287
|
};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
Se = function() {
|
|
289
|
+
ze ??= fetch(`${this.iconsBaseUrl}sprite${Be}.json`).then((t) => t.json()).then((t) => {
|
|
290
|
+
S = t;
|
|
291
291
|
}).catch(() => {
|
|
292
|
-
|
|
292
|
+
S = null;
|
|
293
293
|
});
|
|
294
294
|
};
|
|
295
|
-
|
|
296
|
-
this.imageUrl && this.missingIconsCache.add(this.imageUrl),
|
|
295
|
+
Ce = function() {
|
|
296
|
+
this.imageUrl && this.missingIconsCache.add(this.imageUrl), P(this, d, fe).call(this);
|
|
297
297
|
};
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
298
|
+
fe = function() {
|
|
299
|
+
S !== void 0 ? P(this, d, ne).call(this) : (P(this, d, Se).call(this), ze?.then(() => {
|
|
300
|
+
P(this, d, ne).call(this);
|
|
301
301
|
}));
|
|
302
302
|
};
|
|
303
|
-
|
|
303
|
+
ne = function() {
|
|
304
304
|
do {
|
|
305
|
-
if (this.index--, this.category = f(this, d,
|
|
305
|
+
if (this.index--, this.category = f(this, d, j)?.[this.index], this.spriteIcon = this.category ? S?.icons[this.category] : void 0, this.spriteIcon)
|
|
306
306
|
break;
|
|
307
307
|
this.imageUrl = this.category ? this.iconsBaseUrl + this.category.replace(/ /g, "_") + ".svg" : void 0;
|
|
308
308
|
} while (this.index > -1 && (!this.imageUrl || this.missingIconsCache.has(this.imageUrl)));
|
|
309
309
|
};
|
|
310
|
-
w.styles =
|
|
311
|
-
${
|
|
310
|
+
w.styles = F`
|
|
311
|
+
${ue(gt)}
|
|
312
312
|
`;
|
|
313
|
-
|
|
313
|
+
I([
|
|
314
314
|
p({ type: Object })
|
|
315
315
|
], w.prototype, "feature", 2);
|
|
316
|
-
|
|
316
|
+
I([
|
|
317
317
|
p({ type: String })
|
|
318
318
|
], w.prototype, "itemStyle", 2);
|
|
319
|
-
|
|
319
|
+
I([
|
|
320
320
|
p({ type: String })
|
|
321
321
|
], w.prototype, "showPlaceType", 2);
|
|
322
|
-
|
|
322
|
+
I([
|
|
323
323
|
p({ attribute: !1 })
|
|
324
324
|
], w.prototype, "missingIconsCache", 2);
|
|
325
|
-
|
|
325
|
+
I([
|
|
326
326
|
p({ type: String })
|
|
327
327
|
], w.prototype, "iconsBaseUrl", 2);
|
|
328
|
-
|
|
329
|
-
|
|
328
|
+
I([
|
|
329
|
+
x()
|
|
330
330
|
], w.prototype, "category", 2);
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
I([
|
|
332
|
+
x()
|
|
333
333
|
], w.prototype, "imageUrl", 2);
|
|
334
|
-
|
|
335
|
-
|
|
334
|
+
I([
|
|
335
|
+
x()
|
|
336
336
|
], w.prototype, "spriteIcon", 2);
|
|
337
|
-
|
|
338
|
-
|
|
337
|
+
I([
|
|
338
|
+
x()
|
|
339
339
|
], w.prototype, "index", 2);
|
|
340
|
-
w =
|
|
340
|
+
w = I([
|
|
341
341
|
O("maptiler-geocoder-feature-item")
|
|
342
342
|
], w);
|
|
343
|
-
const
|
|
344
|
-
var
|
|
343
|
+
const xt = '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)}';
|
|
344
|
+
var wt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, Ue = (t) => {
|
|
345
345
|
throw TypeError(t);
|
|
346
|
-
},
|
|
347
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
346
|
+
}, h = (t, e, i, a) => {
|
|
347
|
+
for (var s = a > 1 ? void 0 : a ? kt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
348
348
|
(r = t[o]) && (s = (a ? r(e, i, s) : r(s)) || s);
|
|
349
|
-
return a && s &&
|
|
350
|
-
},
|
|
351
|
-
|
|
349
|
+
return a && s && wt(e, i, s), s;
|
|
350
|
+
}, me = (t, e, i) => e.has(t) || Ue("Cannot " + i), k = (t, e, i) => (me(t, e, "read from private field"), i ? i.call(t) : e.get(t)), U = (t, e, i) => e.has(t) ? Ue("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), ce = (t, e, i, a) => (me(t, e, "write to private field"), e.set(t, i), i), c = (t, e, i) => (me(t, e, "access private method"), i), K, W, he, A, l, H, ge, b, ye, Y, ve, be, $, xe, J, Ge, Re, pe, je, We, Ae, De, Ve, qe, Ne, Ze, Qe, Ke, E, R;
|
|
351
|
+
const we = "input:not([type]), input[type=text], input[type=search], select, textarea", X = "button, input[type=button]";
|
|
352
|
+
let n = class extends T {
|
|
352
353
|
constructor() {
|
|
353
|
-
super(...arguments), U(this, l), 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,
|
|
354
|
+
super(...arguments), U(this, l), 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, K, !1), U(this, W), U(this, he, /* @__PURE__ */ new Set()), U(this, A);
|
|
355
|
+
}
|
|
356
|
+
get isLoading() {
|
|
357
|
+
return this.abortController !== void 0;
|
|
358
|
+
}
|
|
359
|
+
get input() {
|
|
360
|
+
for (const t of this.contentSlotElements) {
|
|
361
|
+
if (c(this, l, E).call(this, t)) return t;
|
|
362
|
+
const e = t.querySelector(we);
|
|
363
|
+
if (c(this, l, E).call(this, e)) return e;
|
|
364
|
+
}
|
|
365
|
+
return this.inputSlotElements[0];
|
|
354
366
|
}
|
|
355
367
|
firstUpdated() {
|
|
356
|
-
|
|
368
|
+
ce(this, K, !0), this.input && (this.input.value = this.searchValue);
|
|
357
369
|
}
|
|
358
370
|
/**
|
|
359
371
|
* Set the options of this instance.
|
|
@@ -363,7 +375,7 @@ let n = class extends F {
|
|
|
363
375
|
setOptions(t) {
|
|
364
376
|
const e = { ...t };
|
|
365
377
|
for (const i of Object.keys(e))
|
|
366
|
-
|
|
378
|
+
_t.includes(i) || delete e[i];
|
|
367
379
|
Object.assign(this, e);
|
|
368
380
|
}
|
|
369
381
|
/**
|
|
@@ -372,7 +384,7 @@ let n = class extends F {
|
|
|
372
384
|
* @param value text to set
|
|
373
385
|
*/
|
|
374
386
|
setQuery(t) {
|
|
375
|
-
|
|
387
|
+
c(this, l, be).call(this, t, { external: !0 }), c(this, l, ve).call(this);
|
|
376
388
|
}
|
|
377
389
|
/**
|
|
378
390
|
* Set the content of search input box and immediately submit it.
|
|
@@ -380,13 +392,13 @@ let n = class extends F {
|
|
|
380
392
|
* @param value text to set and submit
|
|
381
393
|
*/
|
|
382
394
|
submitQuery(t) {
|
|
383
|
-
|
|
395
|
+
c(this, l, xe).call(this, t, { external: !0 });
|
|
384
396
|
}
|
|
385
397
|
/**
|
|
386
398
|
* Clear search result list.
|
|
387
399
|
*/
|
|
388
400
|
clearList() {
|
|
389
|
-
|
|
401
|
+
c(this, l, $).call(this), this.picked = void 0, this.selectedItemIndex = -1;
|
|
390
402
|
}
|
|
391
403
|
/**
|
|
392
404
|
* Focus the search input box.
|
|
@@ -394,13 +406,13 @@ let n = class extends F {
|
|
|
394
406
|
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
395
407
|
*/
|
|
396
408
|
focus(t) {
|
|
397
|
-
this.input
|
|
409
|
+
this.input?.focus(t);
|
|
398
410
|
}
|
|
399
411
|
/**
|
|
400
412
|
* Blur the search input box.
|
|
401
413
|
*/
|
|
402
414
|
blur() {
|
|
403
|
-
this.input
|
|
415
|
+
this.input?.blur();
|
|
404
416
|
}
|
|
405
417
|
addEventListener(t, e, i) {
|
|
406
418
|
super.addEventListener(t, e, i);
|
|
@@ -410,83 +422,101 @@ let n = class extends F {
|
|
|
410
422
|
}
|
|
411
423
|
/** @internal */
|
|
412
424
|
handleMapChange(t) {
|
|
413
|
-
|
|
425
|
+
ce(this, A, t);
|
|
414
426
|
}
|
|
415
427
|
/** @internal */
|
|
416
428
|
handleMapClick(t) {
|
|
417
|
-
this.reverseActive &&
|
|
429
|
+
this.reverseActive && c(this, l, Ge).call(this, t);
|
|
418
430
|
}
|
|
419
431
|
willUpdate(t) {
|
|
420
|
-
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 &&
|
|
432
|
+
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, l, $).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && k(this, l, ge) && (c(this, l, $).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, l, b).call(this, "select", { feature: k(this, l, H) }), ["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, l, J).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
|
|
421
433
|
() => {
|
|
422
|
-
|
|
434
|
+
c(this, l, b).call(this, "pick", { feature: this.picked });
|
|
423
435
|
},
|
|
424
436
|
(e) => {
|
|
425
|
-
e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e,
|
|
437
|
+
e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, c(this, l, b).call(this, "pick", { feature: this.picked }));
|
|
426
438
|
}
|
|
427
|
-
), ["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 ?
|
|
439
|
+
), ["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, l, b).call(this, "featuresshow") : c(this, l, b).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && c(this, l, b).call(this, "reversetoggle", { reverse: this.reverseActive }), ["searchValue"].some((e) => t.has(e)) && this.input && (this.input.value = this.searchValue);
|
|
428
440
|
}
|
|
429
441
|
render() {
|
|
430
442
|
return m`
|
|
431
|
-
<form
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
443
|
+
<form
|
|
444
|
+
class=${q({ "can-collapse": this.collapsed && this.searchValue === "" })}
|
|
445
|
+
@submit=${c(this, l, ye)}
|
|
446
|
+
@focusin=${c(this, l, Ae)}
|
|
447
|
+
@focusout=${c(this, l, De)}
|
|
448
|
+
@click=${c(this, l, Re)}
|
|
449
|
+
@keydown=${c(this, l, pe)}
|
|
450
|
+
@input=${c(this, l, je)}
|
|
451
|
+
@change=${c(this, l, We)}
|
|
452
|
+
>
|
|
453
|
+
<slot name="content">
|
|
454
|
+
<div class="input-group">
|
|
455
|
+
<slot name="start"></slot>
|
|
442
456
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
@change=${() => this.picked = void 0}
|
|
451
|
-
placeholder=${this.placeholder ?? "Search"}
|
|
452
|
-
aria-label=${this.placeholder ?? "Search"}
|
|
453
|
-
/>
|
|
457
|
+
<slot name="search-button">
|
|
458
|
+
<button class="search-button" type="button">
|
|
459
|
+
<slot name="search-icon">
|
|
460
|
+
<maptiler-geocode-search-icon></maptiler-geocode-search-icon>
|
|
461
|
+
</slot>
|
|
462
|
+
</button>
|
|
463
|
+
</slot>
|
|
454
464
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
465
|
+
<slot name="input">
|
|
466
|
+
<input placeholder=${this.placeholder ?? "Search"} aria-label=${this.placeholder ?? "Search"} />
|
|
467
|
+
</slot>
|
|
468
|
+
|
|
469
|
+
<div class="clear-button-container ${q({ displayable: this.searchValue !== "" })}">
|
|
470
|
+
${this.isLoading ? m`
|
|
471
|
+
<slot name="loading-icon">
|
|
472
|
+
<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>
|
|
473
|
+
</slot>
|
|
474
|
+
` : m`
|
|
475
|
+
<slot name="clear-button">
|
|
476
|
+
<button type="button" title=${this.clearButtonTitle ?? "clear"}>
|
|
477
|
+
<slot name="clear-icon">
|
|
478
|
+
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
479
|
+
</slot>
|
|
480
|
+
</button>
|
|
481
|
+
</slot>
|
|
482
|
+
`}
|
|
483
|
+
</div>
|
|
462
484
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
` : J}
|
|
485
|
+
${this.enableReverse === "button" ? m`
|
|
486
|
+
<slot name="reverse-button">
|
|
487
|
+
<button type="button" class=${q({ active: this.reverseActive })} title=${this.reverseButtonTitle ?? "toggle reverse geocoding"}>
|
|
488
|
+
<slot name="reverse-icon">
|
|
489
|
+
<maptiler-geocode-reverse-geocoding-icon></maptiler-geocode-reverse-geocoding-icon>
|
|
490
|
+
</slot>
|
|
491
|
+
</button>
|
|
492
|
+
</slot>
|
|
493
|
+
` : ie}
|
|
473
494
|
|
|
474
|
-
|
|
475
|
-
|
|
495
|
+
<slot name="end"></slot>
|
|
496
|
+
</div>
|
|
497
|
+
</slot>
|
|
476
498
|
|
|
477
499
|
${this.error ? m`
|
|
478
500
|
<div class="error">
|
|
479
|
-
<
|
|
501
|
+
<slot name="error-icon">
|
|
502
|
+
<maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
|
|
503
|
+
</slot>
|
|
480
504
|
|
|
481
505
|
<div>${this.errorMessage ?? "Something went wrong…"}</div>
|
|
482
506
|
|
|
483
|
-
<
|
|
484
|
-
<
|
|
485
|
-
|
|
507
|
+
<slot name="clear-error-button">
|
|
508
|
+
<button>
|
|
509
|
+
<slot name="clear-error-icon">
|
|
510
|
+
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
511
|
+
</slot>
|
|
512
|
+
</button>
|
|
513
|
+
</slot>
|
|
486
514
|
</div>
|
|
487
|
-
` : !this.focused && !this.isFeatureListInteractedWith && !this.keepListOpen || this.listFeatures === void 0 ?
|
|
515
|
+
` : !this.focused && !this.isFeatureListInteractedWith && !this.keepListOpen || this.listFeatures === void 0 ? ie : this.listFeatures.length === 0 ? m`
|
|
488
516
|
<div class="no-results">
|
|
489
|
-
<
|
|
517
|
+
<slot name="no-results-icon">
|
|
518
|
+
<maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
|
|
519
|
+
</slot>
|
|
490
520
|
|
|
491
521
|
<div>
|
|
492
522
|
${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!"}
|
|
@@ -494,14 +524,14 @@ let n = class extends F {
|
|
|
494
524
|
</div>
|
|
495
525
|
` : m`
|
|
496
526
|
<ul
|
|
497
|
-
class="options ${
|
|
498
|
-
@pointerleave=${
|
|
499
|
-
@pointerdown=${
|
|
500
|
-
@pointerup=${
|
|
501
|
-
@keydown=${
|
|
527
|
+
class="options ${q({ "open-on-top": this.openListOnTop })}"
|
|
528
|
+
@pointerleave=${c(this, l, Ne)}
|
|
529
|
+
@pointerdown=${c(this, l, Ze)}
|
|
530
|
+
@pointerup=${c(this, l, Qe)}
|
|
531
|
+
@keydown=${c(this, l, pe)}
|
|
502
532
|
role="listbox"
|
|
503
533
|
>
|
|
504
|
-
${
|
|
534
|
+
${Je(
|
|
505
535
|
this.listFeatures,
|
|
506
536
|
(t) => t.id + (t.address ? "," + t.address : ""),
|
|
507
537
|
(t, e) => m`
|
|
@@ -510,13 +540,13 @@ let n = class extends F {
|
|
|
510
540
|
.showPlaceType=${this.showPlaceType ?? "if-needed"}
|
|
511
541
|
itemStyle=${this.selectedItemIndex === e ? "selected" : this.picked?.id === t.id ? "picked" : "default"}
|
|
512
542
|
@pointerenter=${() => {
|
|
513
|
-
|
|
543
|
+
c(this, l, qe).call(this, e);
|
|
514
544
|
}}
|
|
515
545
|
@select=${() => {
|
|
516
|
-
|
|
546
|
+
c(this, l, Ve).call(this, t);
|
|
517
547
|
}}
|
|
518
|
-
.missingIconsCache=${k(this,
|
|
519
|
-
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.
|
|
548
|
+
.missingIconsCache=${k(this, he)}
|
|
549
|
+
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.1.0-rc.1/icons/"}
|
|
520
550
|
/>
|
|
521
551
|
`
|
|
522
552
|
)}
|
|
@@ -526,22 +556,19 @@ let n = class extends F {
|
|
|
526
556
|
`;
|
|
527
557
|
}
|
|
528
558
|
};
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
559
|
+
K = /* @__PURE__ */ new WeakMap();
|
|
560
|
+
W = /* @__PURE__ */ new WeakMap();
|
|
561
|
+
he = /* @__PURE__ */ new WeakMap();
|
|
562
|
+
A = /* @__PURE__ */ new WeakMap();
|
|
533
563
|
l = /* @__PURE__ */ new WeakSet();
|
|
534
|
-
|
|
564
|
+
H = function() {
|
|
535
565
|
return this.listFeatures?.[this.selectedItemIndex];
|
|
536
566
|
};
|
|
537
|
-
|
|
538
|
-
return this.abortController !== void 0;
|
|
539
|
-
};
|
|
540
|
-
de = function() {
|
|
567
|
+
ge = function() {
|
|
541
568
|
return this.searchValue.length < (this.minLength ?? 2);
|
|
542
569
|
};
|
|
543
|
-
|
|
544
|
-
k(this,
|
|
570
|
+
b = function(t, ...[e]) {
|
|
571
|
+
k(this, K) && this.dispatchEvent(
|
|
545
572
|
new CustomEvent(t, {
|
|
546
573
|
bubbles: !0,
|
|
547
574
|
composed: !0,
|
|
@@ -549,78 +576,78 @@ x = function(t, ...[e]) {
|
|
|
549
576
|
})
|
|
550
577
|
);
|
|
551
578
|
};
|
|
552
|
-
|
|
553
|
-
t?.preventDefault(), this.focused = !1, clearTimeout(k(this,
|
|
579
|
+
ye = function(t, { external: e = !1 } = {}) {
|
|
580
|
+
t?.preventDefault(), this.focused = !1, clearTimeout(k(this, W)), 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, l, J).call(this, this.searchValue, { exact: !0, external: e }).then(() => {
|
|
554
581
|
this.picked = void 0;
|
|
555
582
|
}).catch((i) => this.error = i);
|
|
556
583
|
};
|
|
557
|
-
|
|
584
|
+
Y = function(t) {
|
|
558
585
|
try {
|
|
559
|
-
return
|
|
586
|
+
return Ye(t, 6);
|
|
560
587
|
} catch {
|
|
561
588
|
return !1;
|
|
562
589
|
}
|
|
563
590
|
};
|
|
564
|
-
|
|
591
|
+
ve = function() {
|
|
565
592
|
setTimeout(() => {
|
|
566
|
-
this.input
|
|
593
|
+
this.input?.focus(), this.focused = !0, this.input instanceof HTMLSelectElement ? this.input.showPicker() : this.input?.select();
|
|
567
594
|
});
|
|
568
595
|
};
|
|
569
|
-
|
|
570
|
-
if (this.searchValue = t,
|
|
571
|
-
if (clearTimeout(k(this,
|
|
596
|
+
be = function(t, { external: e = !1 } = {}) {
|
|
597
|
+
if (this.searchValue = t, c(this, l, b).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, l, Y).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
|
|
598
|
+
if (clearTimeout(k(this, W)), k(this, l, ge))
|
|
572
599
|
return;
|
|
573
600
|
const i = this.searchValue;
|
|
574
|
-
|
|
575
|
-
|
|
601
|
+
ce(this, W, window.setTimeout(() => {
|
|
602
|
+
c(this, l, J).call(this, i, { external: e }).catch((a) => this.error = a);
|
|
576
603
|
}, this.debounceSearch ?? 200));
|
|
577
604
|
} else
|
|
578
|
-
|
|
605
|
+
c(this, l, $).call(this);
|
|
579
606
|
};
|
|
580
607
|
$ = function() {
|
|
581
|
-
this.listFeatures !== void 0 && (this.listFeatures = void 0,
|
|
608
|
+
this.listFeatures !== void 0 && (this.listFeatures = void 0, c(this, l, b).call(this, "featuresclear"));
|
|
582
609
|
};
|
|
583
|
-
|
|
584
|
-
this.searchValue = t,
|
|
610
|
+
xe = function(t, { external: e = !1 } = {}) {
|
|
611
|
+
this.searchValue = t, c(this, l, b).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, l, Y).call(this, t) }), this.selectedItemIndex = -1, c(this, l, ye).call(this, void 0, { external: e });
|
|
585
612
|
};
|
|
586
|
-
|
|
613
|
+
J = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
|
|
587
614
|
this.error = void 0, this.abortController?.abort();
|
|
588
615
|
const s = new AbortController();
|
|
589
616
|
this.abortController = s;
|
|
590
617
|
try {
|
|
591
|
-
const o = this.apiUrl ?? "https://api.maptiler.com/geocoding", r =
|
|
618
|
+
const o = this.apiUrl ?? "https://api.maptiler.com/geocoding", r = c(this, l, Y).call(this, t), u = new URL(o + "/" + encodeURIComponent(r ? `${r.decimalLongitude},${r.decimalLatitude}` : t) + ".json"), y = u.searchParams;
|
|
592
619
|
this.language !== void 0 && y.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
|
|
593
|
-
const [
|
|
620
|
+
const [M] = k(this, A) ?? [void 0];
|
|
594
621
|
let _ = (!r || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
|
|
595
|
-
(v) => typeof v == "string" ? v :
|
|
622
|
+
(v) => typeof v == "string" ? v : M === void 0 || (v[0] ?? 0) <= M && M < (v[1] ?? 1 / 0) ? v[2] : void 0
|
|
596
623
|
).filter((v) => v !== void 0);
|
|
597
624
|
_ && (_ = [...new Set(_)], y.set("types", _.join(",")));
|
|
598
|
-
const
|
|
599
|
-
if (
|
|
600
|
-
const v = this.proximity ?? [{ type: "server-geolocation" }],
|
|
601
|
-
|
|
625
|
+
const ke = !r || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
|
|
626
|
+
if (ke && y.set("excludeTypes", String(ke)), this.bbox && y.set("bbox", this.bbox.map((v) => v.toFixed(6)).join(",")), this.country && y.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && y.set("worldview", this.worldview), !e && !r) {
|
|
627
|
+
const v = this.proximity ?? [{ type: "server-geolocation" }], Le = await mt(k(this, A), v, s);
|
|
628
|
+
Le && y.set("proximity", Le), (i || this.showResultsWhileTyping === !1) && y.set("autocomplete", "false"), y.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
|
|
602
629
|
}
|
|
603
|
-
const
|
|
604
|
-
|
|
605
|
-
const
|
|
606
|
-
if (
|
|
607
|
-
e ? (this.clearListOnPick &&
|
|
630
|
+
const _e = this.limit ?? 5, ee = this.reverseGeocodingLimit ?? _e;
|
|
631
|
+
ee > 1 && _?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), r ? (ee === 1 || this.exhaustiveReverseGeocoding || _?.length === 1) && y.set("limit", String(ee)) : y.set("limit", String(_e)), this.apiKey && y.set("key", this.apiKey), this.adjustUrl?.(u);
|
|
632
|
+
const He = u.searchParams.get("types") === "" && u.searchParams.get("excludeTypes") !== "true", V = u.toString();
|
|
633
|
+
if (V === this.lastSearchUrl) {
|
|
634
|
+
e ? (this.clearListOnPick && c(this, l, $).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, c(this, l, b).call(this, "featureslisted", { features: this.listFeatures, external: a }), this.listFeatures[this.selectedItemIndex]?.id !== k(this, l, H)?.id && (this.selectedItemIndex = -1));
|
|
608
635
|
return;
|
|
609
636
|
}
|
|
610
|
-
|
|
611
|
-
let
|
|
612
|
-
if (
|
|
613
|
-
|
|
637
|
+
c(this, l, b).call(this, "request", { urlObj: u }), this.lastSearchUrl = V;
|
|
638
|
+
let B;
|
|
639
|
+
if (He)
|
|
640
|
+
B = { type: "FeatureCollection", features: [] };
|
|
614
641
|
else {
|
|
615
|
-
const v = await fetch(
|
|
642
|
+
const v = await fetch(V, {
|
|
616
643
|
signal: s.signal,
|
|
617
644
|
...this.fetchParameters
|
|
618
645
|
});
|
|
619
646
|
if (!v.ok)
|
|
620
647
|
throw new Error(await v.text());
|
|
621
|
-
|
|
648
|
+
B = await v.json();
|
|
622
649
|
}
|
|
623
|
-
|
|
650
|
+
c(this, l, b).call(this, "response", { url: V, featureCollection: B }), e ? (this.clearListOnPick && c(this, l, $).call(this), this.picked = B.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = B.features.filter(this.filter ?? (() => !0)), r && this.listFeatures.unshift({
|
|
624
651
|
type: "Feature",
|
|
625
652
|
properties: {},
|
|
626
653
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
@@ -636,7 +663,7 @@ K = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
|
|
|
636
663
|
type: "Point",
|
|
637
664
|
coordinates: [r.decimalLongitude, r.decimalLatitude]
|
|
638
665
|
}
|
|
639
|
-
}),
|
|
666
|
+
}), c(this, l, b).call(this, "featureslisted", { features: this.listFeatures, external: a }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== k(this, l, H)?.id && (this.selectedItemIndex = -1), r && this.input?.focus());
|
|
640
667
|
} catch (o) {
|
|
641
668
|
if (o && typeof o == "object" && "name" in o && o.name === "AbortError")
|
|
642
669
|
return;
|
|
@@ -645,192 +672,237 @@ K = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
|
|
|
645
672
|
s === this.abortController && (this.abortController = void 0);
|
|
646
673
|
}
|
|
647
674
|
};
|
|
648
|
-
|
|
649
|
-
this.reverseActive = this.enableReverse === "always",
|
|
675
|
+
Ge = function(t) {
|
|
676
|
+
this.reverseActive = this.enableReverse === "always", c(this, l, $).call(this), this.picked = void 0, c(this, l, xe).call(this, `${t[1].toFixed(6)}, ${ft(t[0], [-180, 180], !0).toFixed(6)}`), c(this, l, ve).call(this);
|
|
677
|
+
};
|
|
678
|
+
Re = function(t) {
|
|
679
|
+
c(this, l, E).call(this, t.target) ? this.focused = !0 : c(this, l, R).call(this, t.target, this.searchButtonElements, this.searchIconElements, "search-button") ? this.input?.focus() : c(this, l, R).call(this, t.target, this.clearButtonElements, this.clearIconElements, "clear-button") ? c(this, l, Ke).call(this) : c(this, l, R).call(this, t.target, this.reverseButtonElements, this.reverseIconElements, "reverse-button") ? this.reverseActive = !this.reverseActive : c(this, l, R).call(this, t.target, this.clearErrorButtonElements, this.clearErrorIconElements, "clear-error-button") && (this.error = void 0);
|
|
650
680
|
};
|
|
651
|
-
|
|
681
|
+
pe = function(t) {
|
|
652
682
|
if (!this.listFeatures)
|
|
653
683
|
return;
|
|
654
684
|
const e = t.key === "ArrowDown" ? 1 : t.key === "ArrowUp" ? -1 : 0;
|
|
655
|
-
e && (this.input
|
|
685
|
+
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));
|
|
686
|
+
};
|
|
687
|
+
je = function(t) {
|
|
688
|
+
c(this, l, E).call(this, t.target) && c(this, l, be).call(this, t.target.value);
|
|
656
689
|
};
|
|
657
|
-
|
|
658
|
-
|
|
690
|
+
We = function(t) {
|
|
691
|
+
c(this, l, E).call(this, t.target) && (this.picked = void 0);
|
|
659
692
|
};
|
|
660
|
-
|
|
693
|
+
Ae = function(t) {
|
|
694
|
+
c(this, l, E).call(this, t.target) && (this.focused = !0);
|
|
695
|
+
};
|
|
696
|
+
De = function(t) {
|
|
697
|
+
c(this, l, E).call(this, t.target) && (this.focused = !1);
|
|
698
|
+
};
|
|
699
|
+
Ve = function(t) {
|
|
661
700
|
(!this.picked || this.picked.id !== t.id) && (this.picked = t, this.searchValue = t.place_name);
|
|
662
701
|
};
|
|
663
|
-
|
|
702
|
+
qe = function(t) {
|
|
664
703
|
this.selectedItemIndex = t;
|
|
665
704
|
};
|
|
666
|
-
|
|
705
|
+
Ne = function() {
|
|
667
706
|
(!this.selectFirst || this.picked) && (this.selectedItemIndex = -1), this.isFeatureListInteractedWith && (this.isFeatureListInteractedWith = !1);
|
|
668
707
|
};
|
|
669
|
-
|
|
708
|
+
Ze = function() {
|
|
670
709
|
this.isFeatureListInteractedWith = !0;
|
|
671
710
|
};
|
|
672
|
-
|
|
711
|
+
Qe = function() {
|
|
673
712
|
setTimeout(() => {
|
|
674
713
|
this.isFeatureListInteractedWith = !1;
|
|
675
714
|
});
|
|
676
715
|
};
|
|
677
|
-
|
|
678
|
-
this.searchValue = "",
|
|
716
|
+
Ke = function() {
|
|
717
|
+
this.searchValue = "", c(this, l, b).call(this, "queryclear"), this.picked = void 0, this.input?.focus();
|
|
679
718
|
};
|
|
680
|
-
|
|
681
|
-
|
|
719
|
+
E = function(t) {
|
|
720
|
+
return t instanceof HTMLElement && t.matches(we);
|
|
721
|
+
};
|
|
722
|
+
R = function(t, e, i, a) {
|
|
723
|
+
return t instanceof HTMLElement && ([...e, ...i].some((s) => s.contains(t)) || t.closest(`[data-${a}]`) !== null);
|
|
724
|
+
};
|
|
725
|
+
n.styles = F`
|
|
726
|
+
${ue(xt)}
|
|
682
727
|
`;
|
|
683
|
-
|
|
728
|
+
h([
|
|
684
729
|
p({ attribute: !1 })
|
|
685
730
|
], n.prototype, "adjustUrl", 2);
|
|
686
|
-
|
|
731
|
+
h([
|
|
687
732
|
p({ type: String })
|
|
688
733
|
], n.prototype, "apiKey", 2);
|
|
689
|
-
|
|
734
|
+
h([
|
|
690
735
|
p({ type: String })
|
|
691
736
|
], n.prototype, "apiUrl", 2);
|
|
692
|
-
|
|
737
|
+
h([
|
|
693
738
|
p({ type: Array })
|
|
694
739
|
], n.prototype, "bbox", 2);
|
|
695
|
-
|
|
740
|
+
h([
|
|
696
741
|
p({ type: String })
|
|
697
742
|
], n.prototype, "clearButtonTitle", 2);
|
|
698
|
-
|
|
743
|
+
h([
|
|
699
744
|
p({ type: Boolean })
|
|
700
745
|
], n.prototype, "clearListOnPick", 2);
|
|
701
|
-
|
|
746
|
+
h([
|
|
702
747
|
p({ type: Boolean })
|
|
703
748
|
], n.prototype, "clearOnBlur", 2);
|
|
704
|
-
|
|
749
|
+
h([
|
|
705
750
|
p({ type: Boolean })
|
|
706
751
|
], n.prototype, "collapsed", 2);
|
|
707
|
-
|
|
752
|
+
h([
|
|
708
753
|
p({ attribute: !1 })
|
|
709
754
|
], n.prototype, "country", 2);
|
|
710
|
-
|
|
755
|
+
h([
|
|
711
756
|
p({ type: Number })
|
|
712
757
|
], n.prototype, "debounceSearch", 2);
|
|
713
|
-
|
|
758
|
+
h([
|
|
714
759
|
p({ type: String })
|
|
715
760
|
], n.prototype, "enableReverse", 2);
|
|
716
|
-
|
|
761
|
+
h([
|
|
717
762
|
p({ type: String })
|
|
718
763
|
], n.prototype, "errorMessage", 2);
|
|
719
|
-
|
|
764
|
+
h([
|
|
720
765
|
p({ type: Boolean })
|
|
721
766
|
], n.prototype, "excludeTypes", 2);
|
|
722
|
-
|
|
767
|
+
h([
|
|
723
768
|
p({ type: Boolean })
|
|
724
769
|
], n.prototype, "exhaustiveReverseGeocoding", 2);
|
|
725
|
-
|
|
770
|
+
h([
|
|
726
771
|
p({ type: Boolean })
|
|
727
772
|
], n.prototype, "fetchFullGeometryOnPick", 2);
|
|
728
|
-
|
|
773
|
+
h([
|
|
729
774
|
p({ type: Object })
|
|
730
775
|
], n.prototype, "fetchParameters", 2);
|
|
731
|
-
|
|
776
|
+
h([
|
|
732
777
|
p({ attribute: !1 })
|
|
733
778
|
], n.prototype, "filter", 2);
|
|
734
|
-
|
|
779
|
+
h([
|
|
735
780
|
p({ type: Object })
|
|
736
781
|
], n.prototype, "fuzzyMatch", 2);
|
|
737
|
-
|
|
782
|
+
h([
|
|
738
783
|
p({ type: String })
|
|
739
784
|
], n.prototype, "iconsBaseUrl", 2);
|
|
740
|
-
|
|
785
|
+
h([
|
|
741
786
|
p({ type: Boolean })
|
|
742
787
|
], n.prototype, "keepListOpen", 2);
|
|
743
|
-
|
|
788
|
+
h([
|
|
744
789
|
p({ attribute: !1 })
|
|
745
790
|
], n.prototype, "language", 2);
|
|
746
|
-
|
|
791
|
+
h([
|
|
747
792
|
p({ type: Number })
|
|
748
793
|
], n.prototype, "limit", 2);
|
|
749
|
-
|
|
794
|
+
h([
|
|
750
795
|
p({ type: Number })
|
|
751
796
|
], n.prototype, "minLength", 2);
|
|
752
|
-
|
|
797
|
+
h([
|
|
753
798
|
p({ type: String })
|
|
754
799
|
], n.prototype, "noResultsMessage", 2);
|
|
755
|
-
|
|
800
|
+
h([
|
|
756
801
|
p({ type: Boolean })
|
|
757
802
|
], n.prototype, "openListOnTop", 2);
|
|
758
|
-
|
|
803
|
+
h([
|
|
759
804
|
p({ type: String })
|
|
760
805
|
], n.prototype, "placeholder", 2);
|
|
761
|
-
|
|
806
|
+
h([
|
|
762
807
|
p({ type: Array })
|
|
763
808
|
], n.prototype, "proximity", 2);
|
|
764
|
-
|
|
809
|
+
h([
|
|
765
810
|
p({ type: Boolean })
|
|
766
811
|
], n.prototype, "reverseActive", 2);
|
|
767
|
-
|
|
812
|
+
h([
|
|
768
813
|
p({ type: String })
|
|
769
814
|
], n.prototype, "reverseButtonTitle", 2);
|
|
770
|
-
|
|
815
|
+
h([
|
|
771
816
|
p({ type: Object })
|
|
772
817
|
], n.prototype, "reverseGeocodingExcludeTypes", 2);
|
|
773
|
-
|
|
818
|
+
h([
|
|
774
819
|
p({ type: Number })
|
|
775
820
|
], n.prototype, "reverseGeocodingLimit", 2);
|
|
776
|
-
|
|
821
|
+
h([
|
|
777
822
|
p({ type: Array })
|
|
778
823
|
], n.prototype, "reverseGeocodingTypes", 2);
|
|
779
|
-
|
|
824
|
+
h([
|
|
780
825
|
p({ type: Object })
|
|
781
826
|
], n.prototype, "selectFirst", 2);
|
|
782
|
-
|
|
827
|
+
h([
|
|
783
828
|
p({ type: String })
|
|
784
829
|
], n.prototype, "showPlaceType", 2);
|
|
785
|
-
|
|
830
|
+
h([
|
|
786
831
|
p({ type: Object })
|
|
787
832
|
], n.prototype, "showResultsWhileTyping", 2);
|
|
788
|
-
|
|
833
|
+
h([
|
|
789
834
|
p({ type: Array })
|
|
790
835
|
], n.prototype, "types", 2);
|
|
791
|
-
|
|
836
|
+
h([
|
|
792
837
|
p({ type: String })
|
|
793
838
|
], n.prototype, "worldview", 2);
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
], n.prototype, "
|
|
797
|
-
|
|
798
|
-
|
|
839
|
+
h([
|
|
840
|
+
L({ slot: "content", flatten: !1 })
|
|
841
|
+
], n.prototype, "contentSlotElements", 2);
|
|
842
|
+
h([
|
|
843
|
+
L({ slot: "input", flatten: !0, selector: we })
|
|
844
|
+
], n.prototype, "inputSlotElements", 2);
|
|
845
|
+
h([
|
|
846
|
+
L({ slot: "search-button", flatten: !0, selector: X })
|
|
847
|
+
], n.prototype, "searchButtonElements", 2);
|
|
848
|
+
h([
|
|
849
|
+
L({ slot: "clear-button", flatten: !0, selector: X })
|
|
850
|
+
], n.prototype, "clearButtonElements", 2);
|
|
851
|
+
h([
|
|
852
|
+
L({ slot: "reverse-button", flatten: !0, selector: X })
|
|
853
|
+
], n.prototype, "reverseButtonElements", 2);
|
|
854
|
+
h([
|
|
855
|
+
L({ slot: "clear-error-button", flatten: !0, selector: X })
|
|
856
|
+
], n.prototype, "clearErrorButtonElements", 2);
|
|
857
|
+
h([
|
|
858
|
+
L({ slot: "search-icon", flatten: !0 })
|
|
859
|
+
], n.prototype, "searchIconElements", 2);
|
|
860
|
+
h([
|
|
861
|
+
L({ slot: "clear-icon", flatten: !0 })
|
|
862
|
+
], n.prototype, "clearIconElements", 2);
|
|
863
|
+
h([
|
|
864
|
+
L({ slot: "reverse-icon", flatten: !0 })
|
|
865
|
+
], n.prototype, "reverseIconElements", 2);
|
|
866
|
+
h([
|
|
867
|
+
L({ slot: "clear-error-icon", flatten: !0 })
|
|
868
|
+
], n.prototype, "clearErrorIconElements", 2);
|
|
869
|
+
h([
|
|
870
|
+
x()
|
|
799
871
|
], n.prototype, "searchValue", 2);
|
|
800
|
-
|
|
801
|
-
|
|
872
|
+
h([
|
|
873
|
+
x()
|
|
802
874
|
], n.prototype, "listFeatures", 2);
|
|
803
|
-
|
|
804
|
-
|
|
875
|
+
h([
|
|
876
|
+
x()
|
|
805
877
|
], n.prototype, "selectedItemIndex", 2);
|
|
806
|
-
|
|
807
|
-
|
|
878
|
+
h([
|
|
879
|
+
x()
|
|
808
880
|
], n.prototype, "picked", 2);
|
|
809
|
-
|
|
810
|
-
|
|
881
|
+
h([
|
|
882
|
+
x()
|
|
811
883
|
], n.prototype, "cachedFeatures", 2);
|
|
812
|
-
|
|
813
|
-
|
|
884
|
+
h([
|
|
885
|
+
x()
|
|
814
886
|
], n.prototype, "lastSearchUrl", 2);
|
|
815
|
-
|
|
816
|
-
|
|
887
|
+
h([
|
|
888
|
+
x()
|
|
817
889
|
], n.prototype, "error", 2);
|
|
818
|
-
|
|
819
|
-
|
|
890
|
+
h([
|
|
891
|
+
x()
|
|
820
892
|
], n.prototype, "abortController", 2);
|
|
821
|
-
|
|
822
|
-
|
|
893
|
+
h([
|
|
894
|
+
x()
|
|
823
895
|
], n.prototype, "focused", 2);
|
|
824
|
-
|
|
825
|
-
|
|
896
|
+
h([
|
|
897
|
+
x()
|
|
826
898
|
], n.prototype, "isFeatureListVisible", 2);
|
|
827
|
-
|
|
828
|
-
|
|
899
|
+
h([
|
|
900
|
+
x()
|
|
829
901
|
], n.prototype, "isFeatureListInteractedWith", 2);
|
|
830
|
-
n =
|
|
902
|
+
n = h([
|
|
831
903
|
O("maptiler-geocoder")
|
|
832
904
|
], n);
|
|
833
|
-
const
|
|
905
|
+
const _t = [
|
|
834
906
|
"adjustUrl",
|
|
835
907
|
"apiKey",
|
|
836
908
|
"apiUrl",
|
|
@@ -868,15 +940,15 @@ const gt = [
|
|
|
868
940
|
"types",
|
|
869
941
|
"reverseGeocodingTypes",
|
|
870
942
|
"worldview"
|
|
871
|
-
],
|
|
872
|
-
var
|
|
873
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
943
|
+
], Lt = "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)}";
|
|
944
|
+
var It = Object.getOwnPropertyDescriptor, $t = (t, e, i, a) => {
|
|
945
|
+
for (var s = a > 1 ? void 0 : a ? It(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
874
946
|
(r = t[o]) && (s = r(s) || s);
|
|
875
947
|
return s;
|
|
876
948
|
};
|
|
877
|
-
let
|
|
949
|
+
let de = class extends T {
|
|
878
950
|
render() {
|
|
879
|
-
return
|
|
951
|
+
return D`
|
|
880
952
|
<svg
|
|
881
953
|
viewBox="0 0 70 85"
|
|
882
954
|
fill="none"
|
|
@@ -890,16 +962,16 @@ let ne = class extends F {
|
|
|
890
962
|
`;
|
|
891
963
|
}
|
|
892
964
|
};
|
|
893
|
-
|
|
894
|
-
${
|
|
965
|
+
de.styles = F`
|
|
966
|
+
${ue(Lt)}
|
|
895
967
|
`;
|
|
896
|
-
|
|
968
|
+
de = $t([
|
|
897
969
|
O("maptiler-geocode-marker")
|
|
898
|
-
],
|
|
899
|
-
function
|
|
900
|
-
const e =
|
|
901
|
-
|
|
902
|
-
|
|
970
|
+
], de);
|
|
971
|
+
function $e(t) {
|
|
972
|
+
const e = it(
|
|
973
|
+
Z([
|
|
974
|
+
et([
|
|
903
975
|
[
|
|
904
976
|
[180, 90],
|
|
905
977
|
[-180, 90],
|
|
@@ -914,22 +986,22 @@ function ke(t) {
|
|
|
914
986
|
if (!e)
|
|
915
987
|
return;
|
|
916
988
|
e.properties = { isMask: !0 };
|
|
917
|
-
const i =
|
|
989
|
+
const i = Q(Ie(t)), a = (i[2] - i[0]) / 360 / 1e3, s = i[0] < -180, o = i[2] > 180, r = st(t);
|
|
918
990
|
if (r.features.length > 1 && (s || o))
|
|
919
991
|
for (const u of r.features) {
|
|
920
|
-
const y =
|
|
992
|
+
const y = Q(Ie(u));
|
|
921
993
|
if (o && y[0] < -180 + a)
|
|
922
|
-
for (const
|
|
923
|
-
for (const _ of
|
|
994
|
+
for (const M of u.geometry.coordinates)
|
|
995
|
+
for (const _ of M)
|
|
924
996
|
_[0] += 360 - a;
|
|
925
997
|
if (s && y[2] > 180 - a)
|
|
926
|
-
for (const
|
|
927
|
-
for (const _ of
|
|
998
|
+
for (const M of u.geometry.coordinates)
|
|
999
|
+
for (const _ of M)
|
|
928
1000
|
_[0] -= 360 - a;
|
|
929
1001
|
}
|
|
930
|
-
return
|
|
1002
|
+
return Z([r.features.length < 2 ? t : Te(r) ?? t, e]);
|
|
931
1003
|
}
|
|
932
|
-
const
|
|
1004
|
+
const Et = {
|
|
933
1005
|
continental_marine: 4,
|
|
934
1006
|
country: 4,
|
|
935
1007
|
major_landform: 8,
|
|
@@ -953,7 +1025,7 @@ const bt = {
|
|
|
953
1025
|
"poi.restaurant": 18,
|
|
954
1026
|
"poi.aerodrome": 13
|
|
955
1027
|
// TODO add many more
|
|
956
|
-
},
|
|
1028
|
+
}, Ft = {
|
|
957
1029
|
fill: {
|
|
958
1030
|
paint: {
|
|
959
1031
|
"fill-color": "#000",
|
|
@@ -972,8 +1044,8 @@ const bt = {
|
|
|
972
1044
|
},
|
|
973
1045
|
filter: ["!", ["has", "isMask"]]
|
|
974
1046
|
}
|
|
975
|
-
},
|
|
976
|
-
class
|
|
1047
|
+
}, N = "mtlr-gc-full-geom", Ee = "mtlr-gc-full-geom-fill", Fe = "mtlr-gc-full-geom-line";
|
|
1048
|
+
class At extends te.Evented {
|
|
977
1049
|
#e = {};
|
|
978
1050
|
#t;
|
|
979
1051
|
#i;
|
|
@@ -982,7 +1054,7 @@ class Ut extends H.Evented {
|
|
|
982
1054
|
}
|
|
983
1055
|
/** @internal Not to be called directly */
|
|
984
1056
|
onAdd(e) {
|
|
985
|
-
this.#t = e, this.#i = e._container.ownerDocument.createElement("maptiler-geocoder"), this.#i.classList.add("maplibregl-geocoder"), this.#v(), this.#
|
|
1057
|
+
this.#t = e, this.#i = e._container.ownerDocument.createElement("maptiler-geocoder"), this.#i.classList.add("maplibregl-geocoder"), this.#v(), this.#k();
|
|
986
1058
|
const i = e._container.ownerDocument.createElement("div");
|
|
987
1059
|
return i.classList.add("maplibregl-ctrl-geocoder", "maplibregl-ctrl", "maplibregl-ctrl-group"), i.style.position = "relative", i.style.zIndex = "3", i.appendChild(this.#i), setTimeout(() => this.#i?.setOptions({ openListOnTop: i.matches(".maplibregl-ctrl-bottom-left *, .maplibregl-ctrl-bottom-right *") })), i;
|
|
988
1060
|
}
|
|
@@ -1036,10 +1108,10 @@ class Ut extends H.Evented {
|
|
|
1036
1108
|
},
|
|
1037
1109
|
querychange: (e) => {
|
|
1038
1110
|
const i = e.detail.reverseCoords;
|
|
1039
|
-
this.#
|
|
1111
|
+
this.#w(i ? [i.decimalLongitude, i.decimalLatitude] : void 0), this.#s("querychange", e.detail);
|
|
1040
1112
|
},
|
|
1041
1113
|
queryclear: () => {
|
|
1042
|
-
this.#
|
|
1114
|
+
this.#w(void 0), this.#s("queryclear");
|
|
1043
1115
|
},
|
|
1044
1116
|
request: (e) => {
|
|
1045
1117
|
this.#s("request", e.detail);
|
|
@@ -1049,7 +1121,7 @@ class Ut extends H.Evented {
|
|
|
1049
1121
|
},
|
|
1050
1122
|
select: (e) => {
|
|
1051
1123
|
const i = e.detail.feature;
|
|
1052
|
-
i && this.#d && this.#e.flyToSelected && this.#
|
|
1124
|
+
i && this.#d && this.#e.flyToSelected && this.#b(i.center, this.#h(i)), this.#o && i && this.#F(i), this.#s("select", e.detail);
|
|
1053
1125
|
},
|
|
1054
1126
|
pick: (e) => {
|
|
1055
1127
|
const i = e.detail.feature;
|
|
@@ -1063,7 +1135,7 @@ class Ut extends H.Evented {
|
|
|
1063
1135
|
},
|
|
1064
1136
|
featureslisted: (e) => {
|
|
1065
1137
|
const i = e.detail.features;
|
|
1066
|
-
this.#o = i, this.#p(this.#o, void 0), this
|
|
1138
|
+
this.#o = i, this.#p(this.#o, void 0), this.#I(e), this.#s("featureslisted", e.detail);
|
|
1067
1139
|
},
|
|
1068
1140
|
featuresclear: () => {
|
|
1069
1141
|
this.#o = void 0, this.#p(void 0, void 0), this.#s("featuresclear");
|
|
@@ -1092,7 +1164,7 @@ class Ut extends H.Evented {
|
|
|
1092
1164
|
#v() {
|
|
1093
1165
|
this.#i && (this.#i.setOptions(this.#e), this.#i.fetchFullGeometryOnPick = this.#e.pickedResultStyle !== "marker-only");
|
|
1094
1166
|
}
|
|
1095
|
-
#
|
|
1167
|
+
#k() {
|
|
1096
1168
|
if (!(!this.#i || !this.#t)) {
|
|
1097
1169
|
for (const [e, i] of Object.entries(this.#g))
|
|
1098
1170
|
this.#i.addEventListener(e, i);
|
|
@@ -1112,21 +1184,21 @@ class Ut extends H.Evented {
|
|
|
1112
1184
|
return super.fire({ type: e, ...i ?? {} });
|
|
1113
1185
|
}
|
|
1114
1186
|
#L(e) {
|
|
1115
|
-
e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#
|
|
1187
|
+
e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#b(e.center, this.#h(e)) : this.#x(Q(e.bbox), 50, this.#h(e));
|
|
1116
1188
|
}
|
|
1117
|
-
|
|
1189
|
+
#I({ detail: { features: e, external: i } }) {
|
|
1118
1190
|
if (!e || e.length === 0 || !this.#d || this.#e.flyToFeatures === !1 || this.#e.flyToFeatures === "never" || !i && (this.#e.flyToFeatures === void 0 || this.#e.flyToFeatures === "external"))
|
|
1119
1191
|
return;
|
|
1120
1192
|
const a = e.every((r) => r.matching_text), s = e.reduce(
|
|
1121
1193
|
(r, u) => a || !u.matching_text ? [Math.min(r[0], u.bbox[0]), Math.min(r[1], u.bbox[1]), Math.max(r[2], u.bbox[2]), Math.max(r[3], u.bbox[3])] : r,
|
|
1122
1194
|
[180, 90, -180, -90]
|
|
1123
1195
|
), o = e.map((r) => this.#h(r)).filter((r) => r !== void 0).reduce((r, u) => r === void 0 ? u : Math.max(r, u), void 0);
|
|
1124
|
-
this.#
|
|
1196
|
+
this.#x(Q(s), 50, o);
|
|
1125
1197
|
}
|
|
1126
1198
|
#h(e) {
|
|
1127
1199
|
if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
|
|
1128
1200
|
return;
|
|
1129
|
-
const i = e.id.replace(/\..*/, ""), a = this.#e.zoom ??
|
|
1201
|
+
const i = e.id.replace(/\..*/, ""), a = this.#e.zoom ?? Et;
|
|
1130
1202
|
return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((s, o) => {
|
|
1131
1203
|
const r = a[i + "." + o];
|
|
1132
1204
|
return s === void 0 ? r : r === void 0 ? s : Math.max(s, r);
|
|
@@ -1135,25 +1207,25 @@ class Ut extends H.Evented {
|
|
|
1135
1207
|
get #d() {
|
|
1136
1208
|
return !!this.#e.flyTo || this.#e.flyTo === void 0;
|
|
1137
1209
|
}
|
|
1138
|
-
get
|
|
1210
|
+
get #$() {
|
|
1139
1211
|
return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
|
|
1140
1212
|
}
|
|
1141
|
-
get #
|
|
1213
|
+
get #E() {
|
|
1142
1214
|
return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
|
|
1143
1215
|
}
|
|
1144
|
-
#
|
|
1145
|
-
this.#t?.flyTo({ center: e, ...i ? { zoom: i } : {}, ...this
|
|
1216
|
+
#b(e, i) {
|
|
1217
|
+
this.#t?.flyTo({ center: e, ...i ? { zoom: i } : {}, ...this.#$ });
|
|
1146
1218
|
}
|
|
1147
|
-
#
|
|
1219
|
+
#x(e, i, a) {
|
|
1148
1220
|
this.#t?.fitBounds(
|
|
1149
1221
|
[
|
|
1150
1222
|
[e[0], e[1]],
|
|
1151
1223
|
[e[2], e[3]]
|
|
1152
1224
|
],
|
|
1153
|
-
{ padding: i, ...a ? { maxZoom: a } : {}, ...this.#
|
|
1225
|
+
{ padding: i, ...a ? { maxZoom: a } : {}, ...this.#E }
|
|
1154
1226
|
);
|
|
1155
1227
|
}
|
|
1156
|
-
#
|
|
1228
|
+
#w(e) {
|
|
1157
1229
|
if (!(this.#e.marker === !1 || this.#e.marker === null || !this.#t)) {
|
|
1158
1230
|
if (!e) {
|
|
1159
1231
|
this.#r?.remove(), this.#r = void 0;
|
|
@@ -1178,9 +1250,9 @@ class Ut extends H.Evented {
|
|
|
1178
1250
|
(o) => o.type === "Polygon" || o.type === "MultiPolygon"
|
|
1179
1251
|
);
|
|
1180
1252
|
if (s.length > 0) {
|
|
1181
|
-
const o =
|
|
1253
|
+
const o = Te(Z(s.map((r) => tt(r))));
|
|
1182
1254
|
if (o) {
|
|
1183
|
-
const r =
|
|
1255
|
+
const r = $e({ ...i, geometry: o.geometry });
|
|
1184
1256
|
r && this.#n(r);
|
|
1185
1257
|
}
|
|
1186
1258
|
} else {
|
|
@@ -1193,7 +1265,7 @@ class Ut extends H.Evented {
|
|
|
1193
1265
|
});
|
|
1194
1266
|
}
|
|
1195
1267
|
} else if (i?.geometry.type.endsWith("Polygon")) {
|
|
1196
|
-
const s =
|
|
1268
|
+
const s = $e(i);
|
|
1197
1269
|
s && this.#n(s), this.#e.pickedResultStyle === "full-geometry-including-polygon-center-marker" && a();
|
|
1198
1270
|
} else i?.geometry.type.endsWith("LineString") ? this.#n(i) : i?.geometry.type.endsWith("Point") && a();
|
|
1199
1271
|
if (this.#e.showResultMarkers !== !1 && this.#e.showResultMarkers !== null)
|
|
@@ -1206,7 +1278,7 @@ class Ut extends H.Evented {
|
|
|
1206
1278
|
continue;
|
|
1207
1279
|
} else
|
|
1208
1280
|
o = this.#f(this.#e.showResultMarkers).setLngLat(s.center).setPopup(
|
|
1209
|
-
new
|
|
1281
|
+
new te.Popup({
|
|
1210
1282
|
offset: [1, -27],
|
|
1211
1283
|
closeButton: !1,
|
|
1212
1284
|
closeOnMove: !0,
|
|
@@ -1223,7 +1295,7 @@ class Ut extends H.Evented {
|
|
|
1223
1295
|
}), r.classList.toggle("marker-fuzzy", !!s.matching_text), this.#l.set(s, o);
|
|
1224
1296
|
}
|
|
1225
1297
|
}
|
|
1226
|
-
#
|
|
1298
|
+
#F(e) {
|
|
1227
1299
|
this.#c?.getElement().classList.toggle("marker-selected", !1), this.#c = void 0, this.#e.markerOnSelected !== !1 && (this.#c = this.#l.get(e), this.#c?.getElement().classList.toggle("marker-selected", !0));
|
|
1228
1300
|
}
|
|
1229
1301
|
#u() {
|
|
@@ -1233,49 +1305,49 @@ class Ut extends H.Evented {
|
|
|
1233
1305
|
});
|
|
1234
1306
|
return;
|
|
1235
1307
|
}
|
|
1236
|
-
const e = this.#T(), i = this.#t.getSource(
|
|
1237
|
-
!e?.fill && !e?.line || !i && !this.#a || (i ? i.setData(this.#a ??
|
|
1308
|
+
const e = this.#T(), i = this.#t.getSource(N);
|
|
1309
|
+
!e?.fill && !e?.line || !i && !this.#a || (i ? i.setData(this.#a ?? Z([])) : this.#a && this.#t.addSource(N, {
|
|
1238
1310
|
type: "geojson",
|
|
1239
1311
|
data: this.#a
|
|
1240
|
-
}), !this.#t.getLayer(
|
|
1312
|
+
}), !this.#t.getLayer(Ee) && e.fill && this.#t.addLayer({
|
|
1241
1313
|
...e.fill,
|
|
1242
|
-
id:
|
|
1314
|
+
id: Ee,
|
|
1243
1315
|
type: "fill",
|
|
1244
|
-
source:
|
|
1245
|
-
}), !this.#t.getLayer(
|
|
1316
|
+
source: N
|
|
1317
|
+
}), !this.#t.getLayer(Fe) && e.line && this.#t.addLayer({
|
|
1246
1318
|
...e.line,
|
|
1247
|
-
id:
|
|
1319
|
+
id: Fe,
|
|
1248
1320
|
type: "line",
|
|
1249
|
-
source:
|
|
1321
|
+
source: N
|
|
1250
1322
|
}));
|
|
1251
1323
|
}
|
|
1252
1324
|
#n(e) {
|
|
1253
1325
|
this.#a = e, this.#u();
|
|
1254
1326
|
}
|
|
1255
1327
|
#f(e) {
|
|
1256
|
-
return typeof e != "object" && (e = { element: this.#t?._container.ownerDocument.createElement("maptiler-geocode-marker"), offset: [1, -13] }), new
|
|
1328
|
+
return typeof e != "object" && (e = { element: this.#t?._container.ownerDocument.createElement("maptiler-geocode-marker"), offset: [1, -13] }), new te.Marker(e);
|
|
1257
1329
|
}
|
|
1258
1330
|
#T() {
|
|
1259
1331
|
const { fullGeometryStyle: e } = this.#e;
|
|
1260
|
-
if (e === !0 || e === void 0) return
|
|
1332
|
+
if (e === !0 || e === void 0) return Ft;
|
|
1261
1333
|
if (!(e === !1 || e === null))
|
|
1262
1334
|
return e;
|
|
1263
1335
|
}
|
|
1264
1336
|
}
|
|
1265
1337
|
export {
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1338
|
+
Ft as DEFAULT_GEOMETRY_STYLE,
|
|
1339
|
+
At as GeocodingControl,
|
|
1340
|
+
At as MaplibreglGeocodingControl,
|
|
1341
|
+
se as MaptilerGeocodeClearIconElement,
|
|
1342
|
+
re as MaptilerGeocodeFailIconElement,
|
|
1343
|
+
oe as MaptilerGeocodeLoadingIconElement,
|
|
1344
|
+
de as MaptilerGeocodeMarkerElement,
|
|
1345
|
+
ae as MaptilerGeocodeReverseGeocodingIconElement,
|
|
1346
|
+
le as MaptilerGeocodeSearchIconElement,
|
|
1275
1347
|
n as MaptilerGeocoderElement,
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1348
|
+
Ee as RESULT_LAYER_FILL,
|
|
1349
|
+
Fe as RESULT_LAYER_LINE,
|
|
1350
|
+
N as RESULT_SOURCE,
|
|
1351
|
+
Et as ZOOM_DEFAULTS
|
|
1280
1352
|
};
|
|
1281
1353
|
//# sourceMappingURL=maplibregl.js.map
|