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