@maptiler/geocoding-control 3.0.0-rc.5 → 3.0.0-rc.7

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.
@@ -1,23 +1,23 @@
1
- import { css as I, LitElement as O, svg as z, html as m, unsafeCSS as ce, nothing as X } from "lit";
2
- import { customElement as M, property as p, state as b, query as De } from "lit/decorators.js";
3
- import { convert as We } from "geo-coordinates-parser";
1
+ import { css as I, LitElement as F, svg as z, html as m, unsafeCSS as ne, nothing as H } from "lit";
2
+ import { customElement as O, property as p, state as b, query as De } from "lit/decorators.js";
3
+ import { convert as Ve } from "geo-coordinates-parser";
4
4
  import { classMap as A } from "lit/directives/class-map.js";
5
- import { repeat as Ve } from "lit/directives/repeat.js";
5
+ import { repeat as qe } from "lit/directives/repeat.js";
6
6
  import "@turf/clone";
7
- import { styleMap as qe } from "lit/directives/style-map.js";
8
- import { config as Ne } from "@maptiler/sdk";
9
- import { featureCollection as q, polygon as Ze, feature as Ke } from "@turf/helpers";
10
- import Le from "@turf/union";
11
- import he from "maplibre-gl";
7
+ import { styleMap as Ne } from "lit/directives/style-map.js";
8
+ import { config as Ze } from "@maptiler/sdk";
9
+ import { featureCollection as D, polygon as Ke, feature as Qe } from "@turf/helpers";
10
+ import _e from "@turf/union";
11
+ import ce from "maplibre-gl";
12
12
  import be from "@turf/bbox";
13
- import Qe from "@turf/difference";
14
- import Ye from "@turf/flatten";
15
- var He = Object.getOwnPropertyDescriptor, Je = (t, e, i, o) => {
16
- for (var r = o > 1 ? void 0 : o ? He(e, i) : e, s = t.length - 1, a; s >= 0; s--)
17
- (a = t[s]) && (r = a(r) || r);
18
- return r;
13
+ import Ye from "@turf/difference";
14
+ import He from "@turf/flatten";
15
+ var Je = Object.getOwnPropertyDescriptor, Xe = (t, e, i, a) => {
16
+ for (var s = a > 1 ? void 0 : a ? Je(e, i) : e, o = t.length - 1, r; o >= 0; o--)
17
+ (r = t[o]) && (s = r(s) || s);
18
+ return s;
19
19
  };
20
- let ee = class extends O {
20
+ let J = class extends F {
21
21
  render() {
22
22
  return z`
23
23
  <svg viewBox="0 0 14 14" width="13" height="13">
@@ -28,21 +28,21 @@ let ee = class extends O {
28
28
  `;
29
29
  }
30
30
  };
31
- ee.styles = I`
31
+ J.styles = I`
32
32
  svg {
33
33
  display: block;
34
34
  fill: var(--color-icon-button);
35
35
  }
36
36
  `;
37
- ee = Je([
38
- M("maptiler-geocode-clear-icon")
39
- ], ee);
40
- var Xe = Object.getOwnPropertyDescriptor, et = (t, e, i, o) => {
41
- for (var r = o > 1 ? void 0 : o ? Xe(e, i) : e, s = t.length - 1, a; s >= 0; s--)
42
- (a = t[s]) && (r = a(r) || r);
43
- return r;
37
+ J = Xe([
38
+ O("maptiler-geocode-clear-icon")
39
+ ], J);
40
+ var et = Object.getOwnPropertyDescriptor, tt = (t, e, i, a) => {
41
+ for (var s = a > 1 ? void 0 : a ? et(e, i) : e, o = t.length - 1, r; o >= 0; o--)
42
+ (r = t[o]) && (s = r(s) || s);
43
+ return s;
44
44
  };
45
- let te = class extends O {
45
+ let X = class extends F {
46
46
  render() {
47
47
  return z`
48
48
  <svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -53,21 +53,21 @@ let te = class extends O {
53
53
  `;
54
54
  }
55
55
  };
56
- te.styles = I`
56
+ X.styles = I`
57
57
  svg {
58
58
  display: block;
59
59
  fill: #e15042;
60
60
  }
61
61
  `;
62
- te = et([
63
- M("maptiler-geocode-fail-icon")
64
- ], te);
65
- var tt = Object.getOwnPropertyDescriptor, it = (t, e, i, o) => {
66
- for (var r = o > 1 ? void 0 : o ? tt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
67
- (a = t[s]) && (r = a(r) || r);
68
- return r;
62
+ X = tt([
63
+ O("maptiler-geocode-fail-icon")
64
+ ], X);
65
+ var it = Object.getOwnPropertyDescriptor, st = (t, e, i, a) => {
66
+ for (var s = a > 1 ? void 0 : a ? it(e, i) : e, o = t.length - 1, r; o >= 0; o--)
67
+ (r = t[o]) && (s = r(s) || s);
68
+ return s;
69
69
  };
70
- let ie = class extends O {
70
+ let ee = class extends F {
71
71
  render() {
72
72
  return m`
73
73
  <div>
@@ -79,7 +79,7 @@ let ie = class extends O {
79
79
  `;
80
80
  }
81
81
  };
82
- ie.styles = I`
82
+ ee.styles = I`
83
83
  div {
84
84
  position: absolute;
85
85
  left: 50%;
@@ -106,15 +106,15 @@ ie.styles = I`
106
106
  }
107
107
  }
108
108
  `;
109
- ie = it([
110
- M("maptiler-geocode-loading-icon")
111
- ], ie);
112
- var st = Object.getOwnPropertyDescriptor, rt = (t, e, i, o) => {
113
- for (var r = o > 1 ? void 0 : o ? st(e, i) : e, s = t.length - 1, a; s >= 0; s--)
114
- (a = t[s]) && (r = a(r) || r);
115
- return r;
109
+ ee = st([
110
+ O("maptiler-geocode-loading-icon")
111
+ ], ee);
112
+ var rt = Object.getOwnPropertyDescriptor, ot = (t, e, i, a) => {
113
+ for (var s = a > 1 ? void 0 : a ? rt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
114
+ (r = t[o]) && (s = r(s) || s);
115
+ return s;
116
116
  };
117
- let se = class extends O {
117
+ let te = class extends F {
118
118
  render() {
119
119
  return z`
120
120
  <svg viewBox="0 0 60.006 21.412" width="14" height="20">
@@ -125,21 +125,21 @@ let se = class extends O {
125
125
  `;
126
126
  }
127
127
  };
128
- se.styles = I`
128
+ te.styles = I`
129
129
  svg {
130
130
  display: block;
131
131
  fill: var(--color-icon-button);
132
132
  }
133
133
  `;
134
- se = rt([
135
- M("maptiler-geocode-reverse-geocoding-icon")
136
- ], se);
137
- var ot = Object.getOwnPropertyDescriptor, at = (t, e, i, o) => {
138
- for (var r = o > 1 ? void 0 : o ? ot(e, i) : e, s = t.length - 1, a; s >= 0; s--)
139
- (a = t[s]) && (r = a(r) || r);
140
- return r;
134
+ te = ot([
135
+ O("maptiler-geocode-reverse-geocoding-icon")
136
+ ], te);
137
+ var at = Object.getOwnPropertyDescriptor, lt = (t, e, i, a) => {
138
+ for (var s = a > 1 ? void 0 : a ? at(e, i) : e, o = t.length - 1, r; o >= 0; o--)
139
+ (r = t[o]) && (s = r(s) || s);
140
+ return s;
141
141
  };
142
- let re = class extends O {
142
+ let ie = class extends F {
143
143
  render() {
144
144
  return z`
145
145
  <svg
@@ -154,7 +154,7 @@ let re = class extends O {
154
154
  `;
155
155
  }
156
156
  };
157
- re.styles = I`
157
+ ie.styles = I`
158
158
  circle {
159
159
  stroke-width: 1.875;
160
160
  fill: none;
@@ -170,74 +170,74 @@ re.styles = I`
170
170
  stroke: var(--color-icon-button);
171
171
  }
172
172
  `;
173
- re = at([
174
- M("maptiler-geocode-search-icon")
175
- ], re);
176
- function lt(t, e, i) {
177
- const o = e[1], r = e[0], s = o - r;
178
- return t === o && i ? t : ((t - r) % s + s) % s + r;
173
+ ie = lt([
174
+ O("maptiler-geocode-search-icon")
175
+ ], ie);
176
+ function nt(t, e, i) {
177
+ const a = e[1], s = e[0], o = a - s;
178
+ return t === a && i ? t : ((t - s) % o + o) % o + s;
179
179
  }
180
- function N(t) {
180
+ function V(t) {
181
181
  const e = [...t];
182
182
  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;
183
183
  }
184
- let U;
185
- async function nt(t, e, i) {
186
- for (const o of e ?? [])
187
- if (!(t && (o.minZoom != null && o.minZoom > t[0] || o.maxZoom != null && o.maxZoom < t[0]))) {
188
- if (o.type === "fixed")
189
- return o.coordinates.join(",");
190
- if (o.type === "client-geolocation")
191
- if (U && o.cachedLocationExpiry && U.time + o.cachedLocationExpiry > Date.now()) {
192
- if (U.coords)
193
- return U.coords;
184
+ let P;
185
+ async function ct(t, e, i) {
186
+ for (const a of e ?? [])
187
+ if (!(t && (a.minZoom != null && a.minZoom > t[0] || a.maxZoom != null && a.maxZoom < t[0]))) {
188
+ if (a.type === "fixed")
189
+ return a.coordinates.join(",");
190
+ if (a.type === "client-geolocation")
191
+ if (P && a.cachedLocationExpiry && P.time + a.cachedLocationExpiry > Date.now()) {
192
+ if (P.coords)
193
+ return P.coords;
194
194
  } else {
195
- let r;
195
+ let s;
196
196
  try {
197
- return r = await new Promise((s, a) => {
197
+ return s = await new Promise((o, r) => {
198
198
  i.signal.addEventListener("abort", () => {
199
- a(Error("aborted"));
199
+ r(Error("aborted"));
200
200
  }), navigator.geolocation.getCurrentPosition(
201
- (f) => {
202
- s([f.coords.longitude, f.coords.latitude].map((L) => L.toFixed(6)).join(","));
201
+ (u) => {
202
+ o([u.coords.longitude, u.coords.latitude].map((y) => y.toFixed(6)).join(","));
203
203
  },
204
- (f) => {
205
- a(f);
204
+ (u) => {
205
+ r(u);
206
206
  },
207
- o
207
+ a
208
208
  );
209
- }), r;
209
+ }), s;
210
210
  } catch {
211
211
  } finally {
212
- o.cachedLocationExpiry && (U = {
212
+ a.cachedLocationExpiry && (P = {
213
213
  time: Date.now(),
214
- coords: r
214
+ coords: s
215
215
  });
216
216
  }
217
217
  if (i.signal.aborted)
218
218
  return;
219
219
  }
220
- if (o.type === "server-geolocation")
220
+ if (a.type === "server-geolocation")
221
221
  return "ip";
222
- if (t && o.type === "map-center")
222
+ if (t && a.type === "map-center")
223
223
  return t[1].toFixed(6) + "," + t[2].toFixed(6);
224
224
  }
225
225
  }
226
- const ct = ".sprite-icon{align-self:center;justify-self:center;opacity:.75;background-repeat:no-repeat}li{text-align:left;cursor:default;display:grid;grid-template-columns:40px 1fr;color:var(--color-text);padding:8px 0;font-size:14px;line-height:18px;min-width:fit-content;outline:0}li:first-child{padding-top:10px}li:last-child{padding-bottom:10px}li.picked{background-color:#e7edff}li.picked .secondary{color:#96a4c7;padding-left:4px}li.picked .line2{color:#96a4c7}li.selected{background-color:#f3f6ff;animation:backAndForth 5s linear infinite}li.selected .primary{color:#2b8bfb}li.selected .secondary{color:#a2adc7;padding-left:4px}li.selected .line2{color:#a2adc7}li>img{align-self:center;justify-self:center;opacity:.75}.texts{padding:0 17px 0 0}.texts>*{white-space:nowrap;display:block;min-width:fit-content}.primary{font-weight:600}.secondary{color:#aeb6c7;padding-left:4px}.line2{color:#aeb6c7}@keyframes backAndForth{0%{transform:translate(0)}10%{transform:translate(0)}45%{transform:translate(calc(-100% + 270px))}55%{transform:translate(calc(-100% + 270px))}90%{transform:translate(0)}to{transform:translate(0)}}";
227
- var ht = Object.defineProperty, pt = Object.getOwnPropertyDescriptor, $e = (t) => {
226
+ const ht = ".sprite-icon{align-self:center;justify-self:center;opacity:.75;background-repeat:no-repeat}li{text-align:left;cursor:default;display:grid;grid-template-columns:40px 1fr;color:var(--color-text);padding:8px 0;font-size:14px;line-height:18px;min-width:fit-content;outline:0}li:first-child{padding-top:10px}li:last-child{padding-bottom:10px}li.picked{background-color:#e7edff}li.picked .secondary{color:#96a4c7;padding-left:4px}li.picked .line2{color:#96a4c7}li.selected{background-color:#f3f6ff;animation:backAndForth 5s linear infinite}li.selected .primary{color:#2b8bfb}li.selected .secondary{color:#a2adc7;padding-left:4px}li.selected .line2{color:#a2adc7}li>img{align-self:center;justify-self:center;opacity:.75}.texts{padding:0 17px 0 0}.texts>*{white-space:nowrap;display:block;min-width:fit-content}.primary{font-weight:600}.secondary{color:#aeb6c7;padding-left:4px}.line2{color:#aeb6c7}@keyframes backAndForth{0%{transform:translate(0)}10%{transform:translate(0)}45%{transform:translate(calc(-100% + 270px))}55%{transform:translate(calc(-100% + 270px))}90%{transform:translate(0)}to{transform:translate(0)}}";
227
+ var pt = Object.defineProperty, dt = Object.getOwnPropertyDescriptor, $e = (t) => {
228
228
  throw TypeError(t);
229
- }, _ = (t, e, i, o) => {
230
- for (var r = o > 1 ? void 0 : o ? pt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
231
- (a = t[s]) && (r = (o ? a(e, i, r) : a(r)) || r);
232
- return o && r && ht(e, i, r), r;
233
- }, Ie = (t, e, i) => e.has(t) || $e("Cannot " + i), u = (t, e, i) => (Ie(t, e, "read from private field"), i ? i.call(t) : e.get(t)), dt = (t, e, i) => e.has(t) ? $e("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), E = (t, e, i) => (Ie(t, e, "access private method"), i), d, Z, G, g, Oe, Me, pe, oe;
234
- const Te = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Se = Te ? "@2x" : "", C = Te ? 2 : 1;
235
- let T, Ce, k = class extends O {
229
+ }, _ = (t, e, i, a) => {
230
+ for (var s = a > 1 ? void 0 : a ? dt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
231
+ (r = t[o]) && (s = (a ? r(e, i, s) : r(s)) || s);
232
+ return a && s && pt(e, i, s), s;
233
+ }, Ie = (t, e, i) => e.has(t) || $e("Cannot " + i), f = (t, e, i) => (Ie(t, e, "read from private field"), i ? i.call(t) : e.get(t)), ut = (t, e, i) => e.has(t) ? $e("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), C = (t, e, i) => (Ie(t, e, "access private method"), i), d, q, G, g, Fe, Oe, he, se;
234
+ const Me = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Te = Me ? "@2x" : "", S = Me ? 2 : 1;
235
+ let T, Se, w = class extends F {
236
236
  constructor() {
237
- super(...arguments), dt(this, d), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
237
+ super(...arguments), ut(this, d), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
238
238
  }
239
239
  willUpdate(t) {
240
- t.has("feature") && u(this, d, Z) && (this.index = u(this, d, Z).length, E(this, d, pe).call(this));
240
+ t.has("feature") && f(this, d, q) && (this.index = f(this, d, q).length, C(this, d, he).call(this));
241
241
  }
242
242
  render() {
243
243
  return m`
@@ -252,32 +252,32 @@ let T, Ce, k = class extends O {
252
252
  ${T && this.spriteIcon ? m`
253
253
  <div
254
254
  class="sprite-icon"
255
- style=${qe({
256
- width: `${this.spriteIcon.width / C}px`,
257
- height: `${this.spriteIcon.height / C}px`,
258
- backgroundImage: `url(${this.iconsBaseUrl}sprite${Se}.png)`,
259
- backgroundPosition: `-${this.spriteIcon.x / C}px -${this.spriteIcon.y / C}px`,
260
- backgroundSize: `${T.width / C}px ${T.height / C}px`
255
+ style=${Ne({
256
+ width: `${this.spriteIcon.width / S}px`,
257
+ height: `${this.spriteIcon.height / S}px`,
258
+ backgroundImage: `url(${this.iconsBaseUrl}sprite${Te}.png)`,
259
+ backgroundPosition: `-${this.spriteIcon.x / S}px -${this.spriteIcon.y / S}px`,
260
+ backgroundSize: `${T.width / S}px ${T.height / S}px`
261
261
  })}
262
- title=${u(this, d, g)}
262
+ title=${f(this, d, g)}
263
263
  />
264
- ` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${u(this, d, g)} @error=${E(this, d, Me)} />` : 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, G) ? 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)} /> `}
264
+ ` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${f(this, d, g)} @error=${C(this, d, Oe)} />` : 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)} /> `}
265
265
 
266
266
  <span class="texts">
267
267
  <span>
268
- <span class="primary"> ${u(this, d, G) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
268
+ <span class="primary"> ${f(this, d, G) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
269
269
 
270
- ${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, G) ? m` <span class="secondary"> ${u(this, d, g)} </span> ` : X}
270
+ ${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> ` : H}
271
271
  </span>
272
272
 
273
- <span class="line2"> ${u(this, d, G) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
273
+ <span class="line2"> ${f(this, d, G) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
274
274
  </span>
275
275
  </li>
276
276
  `;
277
277
  }
278
278
  };
279
279
  d = /* @__PURE__ */ new WeakSet();
280
- Z = function() {
280
+ q = function() {
281
281
  return this.feature?.properties?.categories;
282
282
  };
283
283
  G = function() {
@@ -286,75 +286,75 @@ G = function() {
286
286
  g = function() {
287
287
  return this.feature?.properties?.categories?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
288
288
  };
289
- Oe = function() {
290
- Ce ??= fetch(`${this.iconsBaseUrl}sprite${Se}.json`).then((t) => t.json()).then((t) => {
289
+ Fe = function() {
290
+ Se ??= fetch(`${this.iconsBaseUrl}sprite${Te}.json`).then((t) => t.json()).then((t) => {
291
291
  T = t;
292
292
  }).catch(() => {
293
293
  T = null;
294
294
  });
295
295
  };
296
- Me = function() {
297
- this.imageUrl && this.missingIconsCache.add(this.imageUrl), E(this, d, pe).call(this);
296
+ Oe = function() {
297
+ this.imageUrl && this.missingIconsCache.add(this.imageUrl), C(this, d, he).call(this);
298
298
  };
299
- pe = function() {
300
- T !== void 0 ? E(this, d, oe).call(this) : (E(this, d, Oe).call(this), Ce?.then(() => {
301
- E(this, d, oe).call(this);
299
+ he = function() {
300
+ T !== void 0 ? C(this, d, se).call(this) : (C(this, d, Fe).call(this), Se?.then(() => {
301
+ C(this, d, se).call(this);
302
302
  }));
303
303
  };
304
- oe = function() {
304
+ se = function() {
305
305
  do {
306
- if (this.index--, this.category = u(this, d, Z)?.[this.index], this.spriteIcon = this.category ? T?.icons[this.category] : void 0, this.spriteIcon)
306
+ if (this.index--, this.category = f(this, d, q)?.[this.index], this.spriteIcon = this.category ? T?.icons[this.category] : void 0, this.spriteIcon)
307
307
  break;
308
308
  this.imageUrl = this.category ? this.iconsBaseUrl + this.category.replace(/ /g, "_") + ".svg" : void 0;
309
309
  } while (this.index > -1 && (!this.imageUrl || this.missingIconsCache.has(this.imageUrl)));
310
310
  };
311
- k.styles = I`
312
- ${ce(ct)}
311
+ w.styles = I`
312
+ ${ne(ht)}
313
313
  `;
314
314
  _([
315
315
  p({ type: Object })
316
- ], k.prototype, "feature", 2);
316
+ ], w.prototype, "feature", 2);
317
317
  _([
318
318
  p({ type: String })
319
- ], k.prototype, "itemStyle", 2);
319
+ ], w.prototype, "itemStyle", 2);
320
320
  _([
321
321
  p({ type: String })
322
- ], k.prototype, "showPlaceType", 2);
322
+ ], w.prototype, "showPlaceType", 2);
323
323
  _([
324
324
  p({ attribute: !1 })
325
- ], k.prototype, "missingIconsCache", 2);
325
+ ], w.prototype, "missingIconsCache", 2);
326
326
  _([
327
327
  p({ type: String })
328
- ], k.prototype, "iconsBaseUrl", 2);
328
+ ], w.prototype, "iconsBaseUrl", 2);
329
329
  _([
330
330
  b()
331
- ], k.prototype, "category", 2);
331
+ ], w.prototype, "category", 2);
332
332
  _([
333
333
  b()
334
- ], k.prototype, "imageUrl", 2);
334
+ ], w.prototype, "imageUrl", 2);
335
335
  _([
336
336
  b()
337
- ], k.prototype, "spriteIcon", 2);
337
+ ], w.prototype, "spriteIcon", 2);
338
338
  _([
339
339
  b()
340
- ], k.prototype, "index", 2);
341
- k = _([
342
- M("maptiler-geocoder-feature-item")
343
- ], k);
344
- const ut = "form{font-family:Open Sans,Ubuntu,Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;background-color:#fff;z-index:10;border-radius:4px;margin:0;transition:max-width .25s;box-shadow:0 2px 5px #33335926;--color-text: #444952;--color-icon-button: #444952;pointer-events:all}form,form *,form *:after,form *:before{box-sizing:border-box}form.can-collapse{max-width:29px}form.can-collapse input::placeholder{transition:opacity .25s;opacity:0}form{width:270px;max-width:270px}form:focus-within,form:hover{width:270px;max-width:270px}form input::placeholder,form:focus-within input::placeholder,form:hover input::placeholder{opacity:1}input{font:inherit;font-size:14px;flex-grow:1;min-height:29px;background-color:transparent;color:#444952;white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input:focus{color:#444952;outline:0;outline:none;box-shadow:none}ul,div.error,div.no-results{background-color:#fff;border-radius:4px;left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul{font-size:14px;line-height:16px;box-shadow:0 5px 10px #33335926}div.error,div.no-results{font:inherit;line-height:18px;font-size:12px;display:flex;gap:16px}div.error{padding:16px;font-weight:600;color:#e25041;background-color:#fbeae8}div.error div{flex-grow:1}div.error maptiler-geocode-fail-icon{flex-shrink:0;width:20px;height:20px}div.error button{flex-shrink:0}div.error button maptiler-geocode-clear-icon{--color-icon-button: #e25041}div.error button:hover maptiler-geocode-clear-icon,div.error button:active maptiler-geocode-clear-icon{--color-icon-button: inherit}div.no-results{padding:14px 24px 14px 16px;font-weight:400;color:#6b7c93;box-shadow:0 5px 10px #33335926}div.no-results maptiler-geocode-fail-icon{margin-top:4px;flex-shrink:0;width:20px;height:20px}ul.options.open-on-top{top:auto;bottom:calc(100% + 6px)}button{padding:0;margin:0;border:0;background-color:transparent;height:auto;width:auto}button:hover{background-color:transparent}button:hover,button:active{--color-icon-button: #2b8bfb}.input-group{display:flex;align-items:stretch;gap:7px;padding-inline:8px;border-radius:4px;overflow:hidden}.input-group:focus-within{outline:#2b8bfb solid 2px}.search-button{flex-shrink:0}.clear-button-container{display:flex;display:none;position:relative;align-items:stretch}.clear-button-container.displayable{display:flex;flex-shrink:0}:host(.maptiler-geocoder):not(:empty){box-shadow:none}:host(.maptiler-geocoder) .input-group{border:white solid 2px}:host(.maptiler-geocoder) .input-group:focus-within{border:#2b8bfb solid 2px;outline:0;outline:none}:host(.maptiler-geocoder) form.can-collapse{max-width:33px}:host(.maptiler-geocoder) form,:host(.maptiler-geocoder) form:focus-within,:host(.maptiler-geocoder) form:hover{width:270px;max-width:270px}:host(.leaflet-geocoder) .input-group{border:white solid 1px}:host(.leaflet-geocoder) form.can-collapse{max-width:30px}";
345
- var ft = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, Fe = (t) => {
340
+ ], w.prototype, "index", 2);
341
+ w = _([
342
+ O("maptiler-geocoder-feature-item")
343
+ ], w);
344
+ const ft = "form{font-family:Open Sans,Ubuntu,Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;background-color:#fff;z-index:10;border-radius:4px;margin:0;transition:max-width .25s;box-shadow:0 2px 5px #33335926;--color-text: #444952;--color-icon-button: #444952;pointer-events:all}form,form *,form *:after,form *:before{box-sizing:border-box}form.can-collapse{max-width:29px}form.can-collapse input::placeholder{transition:opacity .25s;opacity:0}form{width:270px;max-width:270px}form:focus-within,form:hover{width:270px;max-width:270px}form input::placeholder,form:focus-within input::placeholder,form:hover input::placeholder{opacity:1}input{font:inherit;font-size:14px;flex-grow:1;min-height:29px;background-color:transparent;color:#444952;white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input:focus{color:#444952;outline:0;outline:none;box-shadow:none}ul,div.error,div.no-results{background-color:#fff;border-radius:4px;left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul{font-size:14px;line-height:16px;box-shadow:0 5px 10px #33335926}div.error,div.no-results{font:inherit;line-height:18px;font-size:12px;display:flex;gap:16px}div.error{padding:16px;font-weight:600;color:#e25041;background-color:#fbeae8}div.error div{flex-grow:1}div.error maptiler-geocode-fail-icon{flex-shrink:0;width:20px;height:20px}div.error button{flex-shrink:0}div.error button maptiler-geocode-clear-icon{--color-icon-button: #e25041}div.error button:hover maptiler-geocode-clear-icon,div.error button:active maptiler-geocode-clear-icon{--color-icon-button: inherit}div.no-results{padding:14px 24px 14px 16px;font-weight:400;color:#6b7c93;box-shadow:0 5px 10px #33335926}div.no-results maptiler-geocode-fail-icon{margin-top:4px;flex-shrink:0;width:20px;height:20px}ul.options.open-on-top{top:auto;bottom:calc(100% + 6px)}button{padding:0;margin:0;border:0;background-color:transparent;height:auto;width:auto}button:hover{background-color:transparent}button:hover,button:active{--color-icon-button: #2b8bfb}.input-group{display:flex;align-items:stretch;gap:7px;padding-inline:8px;border-radius:4px;overflow:hidden}.input-group:focus-within{outline:#2b8bfb solid 2px}.search-button{flex-shrink:0}.clear-button-container{display:flex;display:none;position:relative;align-items:stretch}.clear-button-container.displayable{display:flex;flex-shrink:0}:host(.maptiler-geocoder):not(:empty){box-shadow:none}:host(.maptiler-geocoder) .input-group{border:white solid 2px}:host(.maptiler-geocoder) .input-group:focus-within{border:#2b8bfb solid 2px;outline:0;outline:none}:host(.maptiler-geocoder) form.can-collapse{max-width:33px}:host(.maptiler-geocoder) form,:host(.maptiler-geocoder) form:focus-within,:host(.maptiler-geocoder) form:hover{width:270px;max-width:270px}:host(.leaflet-geocoder) .input-group{border:white solid 1px}:host(.leaflet-geocoder) form.can-collapse{max-width:30px}";
345
+ var mt = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, Ce = (t) => {
346
346
  throw TypeError(t);
347
- }, c = (t, e, i, o) => {
348
- for (var r = o > 1 ? void 0 : o ? mt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
349
- (a = t[s]) && (r = (o ? a(e, i, r) : a(r)) || r);
350
- return o && r && ft(e, i, r), r;
351
- }, de = (t, e, i) => e.has(t) || Fe("Cannot " + i), x = (t, e, i) => (de(t, e, "read from private field"), i ? i.call(t) : e.get(t)), F = (t, e, i) => e.has(t) ? Fe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), W = (t, e, i, o) => (de(t, e, "write to private field"), e.set(t, i), i), h = (t, e, i) => (de(t, e, "access private method"), i), K, V, B, ae, R, l, Q, Ee, Pe, ue, v, fe, Y, me, ge, $, ye, H, Ue, le, Ge, Be, Re, ze, je;
352
- let n = class extends O {
347
+ }, c = (t, e, i, a) => {
348
+ for (var s = a > 1 ? void 0 : a ? gt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
349
+ (r = t[o]) && (s = (a ? r(e, i, s) : r(s)) || s);
350
+ return a && s && mt(e, i, s), s;
351
+ }, pe = (t, e, i) => e.has(t) || Ce("Cannot " + i), k = (t, e, i) => (pe(t, e, "read from private field"), i ? i.call(t) : e.get(t)), U = (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), re = (t, e, i, a) => (pe(t, e, "write to private field"), e.set(t, i), i), h = (t, e, i) => (pe(t, e, "access private method"), i), N, B, oe, R, l, Z, Ee, de, x, ue, K, fe, me, $, ge, Q, Pe, ae, Ue, Ge, Be, Re, ze, je, Ae;
352
+ let n = class extends F {
353
353
  constructor() {
354
- super(...arguments), F(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.focusedDelayed = !1, F(this, K, !1), F(this, V, !1), F(this, B), F(this, ae, /* @__PURE__ */ new Set()), F(this, R);
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, N, !1), U(this, B), U(this, oe, /* @__PURE__ */ new Set()), U(this, R);
355
355
  }
356
356
  firstUpdated() {
357
- W(this, K, !0);
357
+ re(this, N, !0);
358
358
  }
359
359
  /**
360
360
  * Set the options of this instance.
@@ -364,7 +364,7 @@ let n = class extends O {
364
364
  setOptions(t) {
365
365
  const e = { ...t };
366
366
  for (const i of Object.keys(e))
367
- gt.includes(i) || delete e[i];
367
+ yt.includes(i) || delete e[i];
368
368
  Object.assign(this, e);
369
369
  }
370
370
  /**
@@ -373,7 +373,7 @@ let n = class extends O {
373
373
  * @param value text to set
374
374
  */
375
375
  setQuery(t) {
376
- h(this, l, ge).call(this, t), h(this, l, me).call(this);
376
+ h(this, l, me).call(this, t, { external: !0 }), h(this, l, fe).call(this);
377
377
  }
378
378
  /**
379
379
  * Set the content of search input box and immediately submit it.
@@ -381,7 +381,7 @@ let n = class extends O {
381
381
  * @param value text to set and submit
382
382
  */
383
383
  submitQuery(t) {
384
- h(this, l, ye).call(this, t);
384
+ h(this, l, ge).call(this, t);
385
385
  }
386
386
  /**
387
387
  * Clear search result list.
@@ -411,27 +411,25 @@ let n = class extends O {
411
411
  }
412
412
  /** @internal */
413
413
  handleMapChange(t) {
414
- W(this, R, t);
414
+ re(this, R, t);
415
415
  }
416
416
  /** @internal */
417
417
  handleMapClick(t) {
418
- this.reverseActive && h(this, l, Ue).call(this, t);
418
+ this.reverseActive && h(this, l, Pe).call(this, t);
419
419
  }
420
420
  willUpdate(t) {
421
- t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, l, $).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && x(this, l, ue) && (h(this, l, $).call(this), this.error = void 0), ["focused"].some((e) => t.has(e)) && setTimeout(() => {
422
- this.focusedDelayed = this.focused, this.clearOnBlur && !this.focused && (this.searchValue = "");
423
- }, 100), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, l, v).call(this, "select", { feature: x(this, l, Q) }), ["picked"].some((e) => t.has(e)) && this.picked && this.picked.id !== t.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? h(this, l, H).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
421
+ t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, l, $).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && k(this, l, de) && (h(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)) && h(this, l, x).call(this, "select", { feature: k(this, l, Z) }), ["picked"].some((e) => t.has(e)) && this.picked && this.picked.id !== t.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? h(this, l, Q).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
424
422
  () => {
425
- h(this, l, v).call(this, "pick", { feature: this.picked });
423
+ h(this, l, x).call(this, "pick", { feature: this.picked });
426
424
  },
427
425
  (e) => {
428
- e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, l, v).call(this, "pick", { feature: this.picked }));
426
+ e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, l, x).call(this, "pick", { feature: this.picked }));
429
427
  }
430
- ), ["listFeatures", "focusedDelayed"].some((e) => t.has(e)) && (x(this, l, Ee) ? (h(this, l, v).call(this, "featuresshow"), W(this, V, !0)) : x(this, V) && h(this, l, v).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && h(this, l, v).call(this, "reversetoggle", { reverse: this.reverseActive });
428
+ ), ["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 ? h(this, l, x).call(this, "featuresshow") : h(this, l, x).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && h(this, l, x).call(this, "reversetoggle", { reverse: this.reverseActive });
431
429
  }
432
430
  render() {
433
431
  return m`
434
- <form @submit=${h(this, l, fe)} class=${A({ "can-collapse": this.collapsed && this.searchValue === "" })}>
432
+ <form @submit=${h(this, l, ue)} class=${A({ "can-collapse": this.collapsed && this.searchValue === "" })}>
435
433
  <div class="input-group">
436
434
  <button
437
435
  class="search-button"
@@ -448,16 +446,16 @@ let n = class extends O {
448
446
  @focus=${() => this.focused = !0}
449
447
  @blur=${() => this.focused = !1}
450
448
  @click=${() => this.focused = !0}
451
- @keydown=${h(this, l, le)}
452
- @input=${h(this, l, Ge)}
449
+ @keydown=${h(this, l, ae)}
450
+ @input=${h(this, l, Ue)}
453
451
  @change=${() => this.picked = void 0}
454
452
  placeholder=${this.placeholder ?? "Search"}
455
453
  aria-label=${this.placeholder ?? "Search"}
456
454
  />
457
455
 
458
456
  <div class="clear-button-container ${A({ displayable: this.searchValue !== "" })}">
459
- ${x(this, l, Pe) ? m`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : m`
460
- <button type="button" @click=${h(this, l, je)} title=${this.clearButtonTitle ?? "clear"}>
457
+ ${k(this, l, Ee) ? m`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : m`
458
+ <button type="button" @click=${h(this, l, Ae)} title=${this.clearButtonTitle ?? "clear"}>
461
459
  <maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
462
460
  </button>
463
461
  `}
@@ -472,7 +470,7 @@ let n = class extends O {
472
470
  >
473
471
  <maptiler-geocode-reverse-geocoding-icon></maptiler-geocode-reverse-geocoding-icon>
474
472
  </button>
475
- ` : X}
473
+ ` : H}
476
474
 
477
475
  <!-- <slot /> -->
478
476
  </div>
@@ -487,7 +485,7 @@ let n = class extends O {
487
485
  <maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
488
486
  </button>
489
487
  </div>
490
- ` : !this.focusedDelayed && !this.keepListOpen || this.listFeatures === void 0 ? X : this.listFeatures.length === 0 ? m`
488
+ ` : !this.focused && !this.isFeatureListInteractedWith && !this.keepListOpen || this.listFeatures === void 0 ? H : this.listFeatures.length === 0 ? m`
491
489
  <div class="no-results">
492
490
  <maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
493
491
 
@@ -496,8 +494,15 @@ let n = class extends O {
496
494
  </div>
497
495
  </div>
498
496
  ` : m`
499
- <ul class="options ${A({ "open-on-top": this.openListOnTop })}" @mouseleave=${h(this, l, ze)} @keydown=${h(this, l, le)} role="listbox">
500
- ${Ve(
497
+ <ul
498
+ class="options ${A({ "open-on-top": this.openListOnTop })}"
499
+ @pointerleave=${h(this, l, Re)}
500
+ @pointerdown=${h(this, l, ze)}
501
+ @pointerup=${h(this, l, je)}
502
+ @keydown=${h(this, l, ae)}
503
+ role="listbox"
504
+ >
505
+ ${qe(
501
506
  this.listFeatures,
502
507
  (t) => t.id + (t.address ? "," + t.address : ""),
503
508
  (t, e) => m`
@@ -505,17 +510,15 @@ let n = class extends O {
505
510
  .feature=${t}
506
511
  .showPlaceType=${this.showPlaceType ?? "if-needed"}
507
512
  itemStyle=${this.selectedItemIndex === e ? "selected" : this.picked?.id === t.id ? "picked" : "default"}
508
- @mouseenter=${() => {
509
- h(this, l, Re).call(this, e);
513
+ @pointerenter=${() => {
514
+ h(this, l, Be).call(this, e);
510
515
  }}
511
516
  @select=${() => {
512
- h(this, l, Be).call(this, t);
517
+ h(this, l, Ge).call(this, t);
513
518
  }}
514
- .missingIconsCache=${x(this, ae)}
515
- .iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.5/icons/"}
516
- >
517
- ${t.place_name}
518
- </maptiler-geocoder-feature-item>
519
+ .missingIconsCache=${k(this, oe)}
520
+ .iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.7/icons/"}
521
+ />
519
522
  `
520
523
  )}
521
524
  </ul>
@@ -524,26 +527,22 @@ let n = class extends O {
524
527
  `;
525
528
  }
526
529
  };
527
- K = /* @__PURE__ */ new WeakMap();
528
- V = /* @__PURE__ */ new WeakMap();
530
+ N = /* @__PURE__ */ new WeakMap();
529
531
  B = /* @__PURE__ */ new WeakMap();
530
- ae = /* @__PURE__ */ new WeakMap();
532
+ oe = /* @__PURE__ */ new WeakMap();
531
533
  R = /* @__PURE__ */ new WeakMap();
532
534
  l = /* @__PURE__ */ new WeakSet();
533
- Q = function() {
535
+ Z = function() {
534
536
  return this.listFeatures?.[this.selectedItemIndex];
535
537
  };
536
538
  Ee = function() {
537
- return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
538
- };
539
- Pe = function() {
540
539
  return this.abortController !== void 0;
541
540
  };
542
- ue = function() {
541
+ de = function() {
543
542
  return this.searchValue.length < (this.minLength ?? 2);
544
543
  };
545
- v = function(t, ...[e]) {
546
- x(this, K) && this.dispatchEvent(
544
+ x = function(t, ...[e]) {
545
+ k(this, N) && this.dispatchEvent(
547
546
  new CustomEvent(t, {
548
547
  bubbles: !0,
549
548
  composed: !0,
@@ -551,128 +550,136 @@ v = function(t, ...[e]) {
551
550
  })
552
551
  );
553
552
  };
554
- fe = function(t) {
555
- t?.preventDefault(), this.focused = !1, clearTimeout(x(this, B)), this.selectedItemIndex > -1 && this.listFeatures ? (this.picked = this.listFeatures[this.selectedItemIndex], this.searchValue = this.picked.place_type[0] === "reverse" ? this.picked.place_name : this.picked.place_name.replace(/,.*/, ""), this.error = void 0, this.selectedItemIndex = -1) : this.searchValue && h(this, l, H).call(this, this.searchValue, { exact: !0 }).then(() => {
553
+ ue = function(t) {
554
+ t?.preventDefault(), this.focused = !1, clearTimeout(k(this, B)), this.selectedItemIndex > -1 && this.listFeatures ? (this.picked = this.listFeatures[this.selectedItemIndex], this.searchValue = this.picked.place_type[0] === "reverse" ? this.picked.place_name : this.picked.place_name.replace(/,.*/, ""), this.error = void 0, this.selectedItemIndex = -1) : this.searchValue && h(this, l, Q).call(this, this.searchValue, { exact: !0, external: t === void 0 }).then(() => {
556
555
  this.picked = void 0;
557
556
  }).catch((e) => this.error = e);
558
557
  };
559
- Y = function(t) {
558
+ K = function(t) {
560
559
  try {
561
- return We(t, 6);
560
+ return Ve(t, 6);
562
561
  } catch {
563
562
  return !1;
564
563
  }
565
564
  };
566
- me = function() {
565
+ fe = function() {
567
566
  setTimeout(() => {
568
567
  this.input.focus(), this.focused = !0, this.input.select();
569
568
  });
570
569
  };
571
- ge = function(t) {
572
- if (this.searchValue = t, h(this, l, v).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, l, Y).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
573
- if (clearTimeout(x(this, B)), x(this, l, ue))
570
+ me = function(t, { external: e = !1 } = {}) {
571
+ if (this.searchValue = t, h(this, l, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, l, K).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
572
+ if (clearTimeout(k(this, B)), k(this, l, de))
574
573
  return;
575
- const e = this.searchValue;
576
- W(this, B, window.setTimeout(() => {
577
- h(this, l, H).call(this, e).catch((i) => this.error = i);
574
+ const i = this.searchValue;
575
+ re(this, B, window.setTimeout(() => {
576
+ h(this, l, Q).call(this, i, { external: e }).catch((a) => this.error = a);
578
577
  }, this.debounceSearch ?? 200));
579
578
  } else
580
579
  h(this, l, $).call(this);
581
580
  };
582
581
  $ = function() {
583
- this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, l, v).call(this, "featuresclear"));
582
+ this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, l, x).call(this, "featuresclear"));
584
583
  };
585
- ye = function(t) {
586
- this.searchValue = t, h(this, l, v).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, l, Y).call(this, t) }), this.selectedItemIndex = -1, h(this, l, fe).call(this);
584
+ ge = function(t) {
585
+ this.searchValue = t, h(this, l, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, l, K).call(this, t) }), this.selectedItemIndex = -1, h(this, l, ue).call(this);
587
586
  };
588
- H = async function(t, { byId: e = !1, exact: i = !1 } = {}) {
587
+ Q = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
589
588
  this.error = void 0, this.abortController?.abort();
590
- const o = new AbortController();
591
- this.abortController = o;
589
+ const s = new AbortController();
590
+ this.abortController = s;
592
591
  try {
593
- const r = this.apiUrl ?? "https://api.maptiler.com/geocoding", s = h(this, l, Y).call(this, t), a = new URL(r + "/" + encodeURIComponent(s ? `${s.decimalLongitude},${s.decimalLatitude}` : t) + ".json"), f = a.searchParams;
594
- this.language !== void 0 && f.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
595
- const [L] = x(this, R) ?? [void 0];
596
- let w = (!s || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
597
- (y) => typeof y == "string" ? y : L === void 0 || (y[0] ?? 0) <= L && L < (y[1] ?? 1 / 0) ? y[2] : void 0
598
- ).filter((y) => y !== void 0);
599
- w && (w = [...new Set(w)], f.set("types", w.join(",")));
600
- const S = !s || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
601
- if (S && f.set("excludeTypes", String(S)), this.bbox && f.set("bbox", this.bbox.map((y) => y.toFixed(6)).join(",")), this.country && f.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && f.set("worldview", this.worldview), !e && !s) {
602
- const y = this.proximity ?? [{ type: "server-geolocation" }], xe = await nt(x(this, R), y, o);
603
- xe && f.set("proximity", xe), (i || this.showResultsWhileTyping === !1) && f.set("autocomplete", "false"), f.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
592
+ const o = this.apiUrl ?? "https://api.maptiler.com/geocoding", r = h(this, l, K).call(this, t), u = new URL(o + "/" + encodeURIComponent(r ? `${r.decimalLongitude},${r.decimalLatitude}` : t) + ".json"), y = u.searchParams;
593
+ this.language !== void 0 && y.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
594
+ const [M] = k(this, R) ?? [void 0];
595
+ let L = (!r || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
596
+ (v) => typeof v == "string" ? v : M === void 0 || (v[0] ?? 0) <= M && M < (v[1] ?? 1 / 0) ? v[2] : void 0
597
+ ).filter((v) => v !== void 0);
598
+ L && (L = [...new Set(L)], y.set("types", L.join(",")));
599
+ const ye = !r || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
600
+ if (ye && y.set("excludeTypes", String(ye)), 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) {
601
+ const v = this.proximity ?? [{ type: "server-geolocation" }], xe = await ct(k(this, R), v, s);
602
+ xe && y.set("proximity", xe), (i || this.showResultsWhileTyping === !1) && y.set("autocomplete", "false"), y.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
604
603
  }
605
- const ve = this.limit ?? 5, J = this.reverseGeocodingLimit ?? ve;
606
- J > 1 && w?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), s ? (J === 1 || this.exhaustiveReverseGeocoding || w?.length === 1) && f.set("limit", String(J)) : f.set("limit", String(ve)), this.apiKey && f.set("key", this.apiKey), this.adjustUrl?.(a);
607
- const Ae = a.searchParams.get("types") === "" && a.searchParams.get("excludeTypes") !== "true", j = a.toString();
604
+ const ve = this.limit ?? 5, Y = this.reverseGeocodingLimit ?? ve;
605
+ Y > 1 && L?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), r ? (Y === 1 || this.exhaustiveReverseGeocoding || L?.length === 1) && y.set("limit", String(Y)) : y.set("limit", String(ve)), this.apiKey && y.set("key", this.apiKey), this.adjustUrl?.(u);
606
+ const We = u.searchParams.get("types") === "" && u.searchParams.get("excludeTypes") !== "true", j = u.toString();
608
607
  if (j === this.lastSearchUrl) {
609
- e ? (this.clearListOnPick && h(this, l, $).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, l, v).call(this, "featureslisted", { features: this.listFeatures }), this.listFeatures[this.selectedItemIndex]?.id !== x(this, l, Q)?.id && (this.selectedItemIndex = -1));
608
+ e ? (this.clearListOnPick && h(this, l, $).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, l, x).call(this, "featureslisted", { features: this.listFeatures, external: a }), this.listFeatures[this.selectedItemIndex]?.id !== k(this, l, Z)?.id && (this.selectedItemIndex = -1));
610
609
  return;
611
610
  }
612
- h(this, l, v).call(this, "request", { urlObj: a }), this.lastSearchUrl = j;
613
- let P;
614
- if (Ae)
615
- P = { type: "FeatureCollection", features: [] };
611
+ h(this, l, x).call(this, "request", { urlObj: u }), this.lastSearchUrl = j;
612
+ let E;
613
+ if (We)
614
+ E = { type: "FeatureCollection", features: [] };
616
615
  else {
617
- const y = await fetch(j, {
618
- signal: o.signal,
616
+ const v = await fetch(j, {
617
+ signal: s.signal,
619
618
  ...this.fetchParameters
620
619
  });
621
- if (!y.ok)
622
- throw new Error(await y.text());
623
- P = await y.json();
620
+ if (!v.ok)
621
+ throw new Error(await v.text());
622
+ E = await v.json();
624
623
  }
625
- h(this, l, v).call(this, "response", { url: j, featureCollection: P }), e ? (this.clearListOnPick && h(this, l, $).call(this), this.picked = P.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = P.features.filter(this.filter ?? (() => !0)), s && this.listFeatures.unshift({
624
+ h(this, l, x).call(this, "response", { url: j, featureCollection: E }), e ? (this.clearListOnPick && h(this, l, $).call(this), this.picked = E.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = E.features.filter(this.filter ?? (() => !0)), r && this.listFeatures.unshift({
626
625
  type: "Feature",
627
626
  properties: {},
628
627
  /* eslint-disable @typescript-eslint/restrict-template-expressions */
629
- id: `reverse_${s.decimalLongitude}_${s.decimalLatitude}`,
630
- text: `${s.decimalLatitude}, ${s.decimalLongitude}`,
631
- place_name: s.toCoordinateFormat("DMS"),
628
+ id: `reverse_${r.decimalLongitude}_${r.decimalLatitude}`,
629
+ text: `${r.decimalLatitude}, ${r.decimalLongitude}`,
630
+ place_name: r.toCoordinateFormat("DMS"),
632
631
  /* eslint-enable @typescript-eslint/restrict-template-expressions */
633
632
  place_type: ["reverse"],
634
633
  place_type_name: ["reverse"],
635
- center: [s.decimalLongitude, s.decimalLatitude],
636
- bbox: [s.decimalLongitude, s.decimalLatitude, s.decimalLongitude, s.decimalLatitude],
634
+ center: [r.decimalLongitude, r.decimalLatitude],
635
+ bbox: [r.decimalLongitude, r.decimalLatitude, r.decimalLongitude, r.decimalLatitude],
637
636
  geometry: {
638
637
  type: "Point",
639
- coordinates: [s.decimalLongitude, s.decimalLatitude]
638
+ coordinates: [r.decimalLongitude, r.decimalLatitude]
640
639
  }
641
- }), h(this, l, v).call(this, "featureslisted", { features: this.listFeatures }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== x(this, l, Q)?.id && (this.selectedItemIndex = -1), s && this.input.focus());
642
- } catch (r) {
643
- if (r && typeof r == "object" && "name" in r && r.name === "AbortError")
640
+ }), h(this, l, x).call(this, "featureslisted", { features: this.listFeatures, external: a }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== k(this, l, Z)?.id && (this.selectedItemIndex = -1), r && this.input.focus());
641
+ } catch (o) {
642
+ if (o && typeof o == "object" && "name" in o && o.name === "AbortError")
644
643
  return;
645
- throw r;
644
+ throw o;
646
645
  } finally {
647
- o === this.abortController && (this.abortController = void 0);
646
+ s === this.abortController && (this.abortController = void 0);
648
647
  }
649
648
  };
650
- Ue = function(t) {
651
- this.reverseActive = this.enableReverse === "always", h(this, l, $).call(this), this.picked = void 0, h(this, l, ye).call(this, `${t[1].toFixed(6)}, ${lt(t[0], [-180, 180], !0).toFixed(6)}`), h(this, l, me).call(this);
649
+ Pe = function(t) {
650
+ this.reverseActive = this.enableReverse === "always", h(this, l, $).call(this), this.picked = void 0, h(this, l, ge).call(this, `${t[1].toFixed(6)}, ${nt(t[0], [-180, 180], !0).toFixed(6)}`), h(this, l, fe).call(this);
652
651
  };
653
- le = function(t) {
652
+ ae = function(t) {
654
653
  if (!this.listFeatures)
655
654
  return;
656
655
  const e = t.key === "ArrowDown" ? 1 : t.key === "ArrowUp" ? -1 : 0;
657
656
  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));
658
657
  };
659
- Ge = function(t) {
660
- h(this, l, ge).call(this, t.target.value);
658
+ Ue = function(t) {
659
+ h(this, l, me).call(this, t.target.value);
661
660
  };
662
- Be = function(t) {
661
+ Ge = function(t) {
663
662
  (!this.picked || this.picked.id !== t.id) && (this.picked = t, this.searchValue = t.place_name);
664
663
  };
665
- Re = function(t) {
664
+ Be = function(t) {
666
665
  this.selectedItemIndex = t;
667
666
  };
667
+ Re = function() {
668
+ (!this.selectFirst || this.picked) && (this.selectedItemIndex = -1), this.isFeatureListInteractedWith && (this.isFeatureListInteractedWith = !1);
669
+ };
668
670
  ze = function() {
669
- (!this.selectFirst || this.picked) && (this.selectedItemIndex = -1);
671
+ this.isFeatureListInteractedWith = !0;
670
672
  };
671
673
  je = function() {
672
- this.searchValue = "", h(this, l, v).call(this, "queryclear"), this.picked = void 0, this.input.focus();
674
+ setTimeout(() => {
675
+ this.isFeatureListInteractedWith = !1;
676
+ });
677
+ };
678
+ Ae = function() {
679
+ this.searchValue = "", h(this, l, x).call(this, "queryclear"), this.picked = void 0, this.input.focus();
673
680
  };
674
681
  n.styles = I`
675
- ${ce(ut)}
682
+ ${ne(ft)}
676
683
  `;
677
684
  c([
678
685
  p({ attribute: !1 })
@@ -817,11 +824,14 @@ c([
817
824
  ], n.prototype, "focused", 2);
818
825
  c([
819
826
  b()
820
- ], n.prototype, "focusedDelayed", 2);
827
+ ], n.prototype, "isFeatureListVisible", 2);
828
+ c([
829
+ b()
830
+ ], n.prototype, "isFeatureListInteractedWith", 2);
821
831
  n = c([
822
- M("maptiler-geocoder")
832
+ O("maptiler-geocoder")
823
833
  ], n);
824
- const gt = [
834
+ const yt = [
825
835
  "adjustUrl",
826
836
  "apiKey",
827
837
  "apiUrl",
@@ -859,13 +869,13 @@ const gt = [
859
869
  "types",
860
870
  "reverseGeocodingTypes",
861
871
  "worldview"
862
- ], yt = "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)}";
863
- var vt = Object.getOwnPropertyDescriptor, xt = (t, e, i, o) => {
864
- for (var r = o > 1 ? void 0 : o ? vt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
865
- (a = t[s]) && (r = a(r) || r);
866
- return r;
872
+ ], vt = "svg{display:block;fill:var(--maptiler-geocode-marker-fill, #3170fe);stroke:var(--maptiler-geocode-marker-stroke, #3170fe);height:30px}:host(.marker-selected){z-index:2}:host(.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fill, #98b7ff);stroke:var(--maptiler-geocode-marker-selected-stroke, #3170fe)}:host(.marker-reverse) svg path{fill:var(--maptiler-geocode-marker-reverse-fill, silver);stroke:var(--maptiler-geocode-marker-reverse-stroke, gray)}:host(.marker-interactive){cursor:pointer!important}:host(.marker-fuzzy) svg path{fill:var(--maptiler-geocode-marker-fuzzy-fill, silver);stroke:var(--maptiler-geocode-marker-fuzzy-stroke, gray)}:host(.marker-fuzzy.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fuzzy-fill, #ddd);stroke:var(--maptiler-geocode-marker-selected-fuzzy-stroke, silver)}";
873
+ var xt = Object.getOwnPropertyDescriptor, bt = (t, e, i, a) => {
874
+ for (var s = a > 1 ? void 0 : a ? xt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
875
+ (r = t[o]) && (s = r(s) || s);
876
+ return s;
867
877
  };
868
- let ne = class extends O {
878
+ let le = class extends F {
869
879
  render() {
870
880
  return z`
871
881
  <svg
@@ -881,17 +891,17 @@ let ne = class extends O {
881
891
  `;
882
892
  }
883
893
  };
884
- ne.styles = I`
885
- ${ce(yt)}
894
+ le.styles = I`
895
+ ${ne(vt)}
886
896
  `;
887
- ne = xt([
888
- M("maptiler-geocode-marker")
889
- ], ne);
890
- const bt = "@maptiler/geocoding-control", kt = "3.0.0-rc.5";
897
+ le = bt([
898
+ O("maptiler-geocode-marker")
899
+ ], le);
900
+ const kt = "@maptiler/geocoding-control", wt = "3.0.0-rc.7";
891
901
  function ke(t) {
892
- const e = Qe(
893
- q([
894
- Ze([
902
+ const e = Ye(
903
+ D([
904
+ Ke([
895
905
  [
896
906
  [180, 90],
897
907
  [-180, 90],
@@ -906,22 +916,22 @@ function ke(t) {
906
916
  if (!e)
907
917
  return;
908
918
  e.properties = { isMask: !0 };
909
- const i = N(be(t)), o = (i[2] - i[0]) / 360 / 1e3, r = i[0] < -180, s = i[2] > 180, a = Ye(t);
910
- if (a.features.length > 1 && (r || s))
911
- for (const f of a.features) {
912
- const L = N(be(f));
913
- if (s && L[0] < -180 + o)
914
- for (const w of f.geometry.coordinates)
915
- for (const S of w)
916
- S[0] += 360 - o;
917
- if (r && L[2] > 180 - o)
918
- for (const w of f.geometry.coordinates)
919
- for (const S of w)
920
- S[0] -= 360 - o;
919
+ const i = V(be(t)), a = (i[2] - i[0]) / 360 / 1e3, s = i[0] < -180, o = i[2] > 180, r = He(t);
920
+ if (r.features.length > 1 && (s || o))
921
+ for (const u of r.features) {
922
+ const y = V(be(u));
923
+ if (o && y[0] < -180 + a)
924
+ for (const M of u.geometry.coordinates)
925
+ for (const L of M)
926
+ L[0] += 360 - a;
927
+ if (s && y[2] > 180 - a)
928
+ for (const M of u.geometry.coordinates)
929
+ for (const L of M)
930
+ L[0] -= 360 - a;
921
931
  }
922
- return q([a.features.length < 2 ? t : Le(a) ?? t, e]);
932
+ return D([r.features.length < 2 ? t : _e(r) ?? t, e]);
923
933
  }
924
- const wt = {
934
+ const Lt = {
925
935
  continental_marine: 4,
926
936
  country: 4,
927
937
  major_landform: 8,
@@ -964,8 +974,8 @@ const wt = {
964
974
  },
965
975
  filter: ["!", ["has", "isMask"]]
966
976
  }
967
- }, D = "mtlr-gc-full-geom", we = "mtlr-gc-full-geom-fill", _e = "mtlr-gc-full-geom-line", Lt = he.Evented, $t = he.Marker, It = he.Popup;
968
- class Ot extends Lt {
977
+ }, W = "mtlr-gc-full-geom", we = "mtlr-gc-full-geom-fill", Le = "mtlr-gc-full-geom-line", $t = ce.Evented, It = ce.Marker, Ft = ce.Popup;
978
+ class Ot extends $t {
969
979
  #e = {};
970
980
  #t;
971
981
  #i;
@@ -980,7 +990,7 @@ class Ot extends Lt {
980
990
  }
981
991
  /** @internal Not to be called directly */
982
992
  onRemove() {
983
- this.#_(), this.#t = void 0, this.#i = void 0;
993
+ this.#L(), this.#t = void 0, this.#i = void 0;
984
994
  }
985
995
  getOptions() {
986
996
  return { ...this.#e };
@@ -1041,11 +1051,11 @@ class Ot extends Lt {
1041
1051
  },
1042
1052
  select: (e) => {
1043
1053
  const i = e.detail.feature;
1044
- i && this.#d && this.#e.flyToSelected && this.#x(i.center, this.#h(i)), this.#o && i && this.#M(i), this.#s("select", e.detail);
1054
+ i && this.#d && this.#e.flyToSelected && this.#x(i.center, this.#h(i)), this.#o && i && this.#O(i), this.#s("select", e.detail);
1045
1055
  },
1046
1056
  pick: (e) => {
1047
1057
  const i = e.detail.feature;
1048
- i && i.id !== this.#m && this.#d && (this.#L(i), this.#p(this.#o, i)), this.#m = i?.id, this.#s("pick", e.detail);
1058
+ i && i.id !== this.#m && this.#d && (this.#_(i), this.#p(this.#o, i)), this.#m = i?.id, this.#s("pick", e.detail);
1049
1059
  },
1050
1060
  featuresshow: () => {
1051
1061
  this.#s("featuresshow");
@@ -1055,7 +1065,7 @@ class Ot extends Lt {
1055
1065
  },
1056
1066
  featureslisted: (e) => {
1057
1067
  const i = e.detail.features;
1058
- this.#o = i, this.#p(this.#o, void 0), this.#$(i), this.#s("featureslisted", e.detail);
1068
+ this.#o = i, this.#p(this.#o, void 0), this.#$(e), this.#s("featureslisted", e.detail);
1059
1069
  },
1060
1070
  featuresclear: () => {
1061
1071
  this.#o = void 0, this.#p(void 0, void 0), this.#s("featuresclear");
@@ -1092,7 +1102,7 @@ class Ot extends Lt {
1092
1102
  this.#t.on(e, i);
1093
1103
  }
1094
1104
  }
1095
- #_() {
1105
+ #L() {
1096
1106
  if (!(!this.#i || !this.#t)) {
1097
1107
  for (const [e, i] of Object.entries(this.#g))
1098
1108
  this.#i.removeEventListener(e, i);
@@ -1103,25 +1113,26 @@ class Ot extends Lt {
1103
1113
  #s(e, i) {
1104
1114
  return super.fire({ type: e, ...i ?? {} });
1105
1115
  }
1106
- #L(e) {
1107
- e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#x(e.center, this.#h(e)) : this.#b(N(e.bbox), 50, this.#h(e));
1116
+ #_(e) {
1117
+ e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#x(e.center, this.#h(e)) : this.#b(V(e.bbox), 50, this.#h(e));
1108
1118
  }
1109
- #$(e) {
1110
- if (!e || e.length === 0 || !this.#d) return;
1111
- const i = e.every((s) => s.matching_text), o = e.reduce(
1112
- (s, a) => i || !a.matching_text ? [Math.min(s[0], a.bbox[0]), Math.min(s[1], a.bbox[1]), Math.max(s[2], a.bbox[2]), Math.max(s[3], a.bbox[3])] : s,
1119
+ #$({ detail: { features: e, external: i } }) {
1120
+ 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"))
1121
+ return;
1122
+ const a = e.every((r) => r.matching_text), s = e.reduce(
1123
+ (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,
1113
1124
  [180, 90, -180, -90]
1114
- ), r = e.map((s) => this.#h(s)).filter((s) => s !== void 0).reduce((s, a) => s === void 0 ? a : Math.max(s, a), void 0);
1115
- this.#b(N(o), 50, r);
1125
+ ), 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);
1126
+ this.#b(V(s), 50, o);
1116
1127
  }
1117
1128
  #h(e) {
1118
1129
  if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
1119
1130
  return;
1120
- const i = e.id.replace(/\..*/, ""), o = this.#e.zoom ?? wt;
1121
- return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((r, s) => {
1122
- const a = o[i + "." + s];
1123
- return r === void 0 ? a : a === void 0 ? r : Math.max(r, a);
1124
- }, void 0) : void 0) ?? o[i];
1131
+ const i = e.id.replace(/\..*/, ""), a = this.#e.zoom ?? Lt;
1132
+ return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((s, o) => {
1133
+ const r = a[i + "." + o];
1134
+ return s === void 0 ? r : r === void 0 ? s : Math.max(s, r);
1135
+ }, void 0) : void 0) ?? a[i];
1125
1136
  }
1126
1137
  get #d() {
1127
1138
  return !!this.#e.flyTo || this.#e.flyTo === void 0;
@@ -1129,19 +1140,19 @@ class Ot extends Lt {
1129
1140
  get #I() {
1130
1141
  return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
1131
1142
  }
1132
- get #O() {
1143
+ get #F() {
1133
1144
  return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
1134
1145
  }
1135
1146
  #x(e, i) {
1136
1147
  this.#t?.flyTo({ center: e, ...i ? { zoom: i } : {}, ...this.#I });
1137
1148
  }
1138
- #b(e, i, o) {
1149
+ #b(e, i, a) {
1139
1150
  this.#t?.fitBounds(
1140
1151
  [
1141
1152
  [e[0], e[1]],
1142
1153
  [e[2], e[3]]
1143
1154
  ],
1144
- { padding: i, ...o ? { maxZoom: o } : {}, ...this.#O }
1155
+ { padding: i, ...a ? { maxZoom: a } : {}, ...this.#F }
1145
1156
  );
1146
1157
  }
1147
1158
  #k(e) {
@@ -1156,65 +1167,65 @@ class Ot extends Lt {
1156
1167
  #p(e, i) {
1157
1168
  if (!this.#t)
1158
1169
  return;
1159
- for (const r of this.#l.values())
1160
- r.remove();
1170
+ for (const s of this.#l.values())
1171
+ s.remove();
1161
1172
  this.#l = /* @__PURE__ */ new Map(), this.#n(void 0);
1162
- const o = () => {
1173
+ const a = () => {
1163
1174
  if (!i || !this.#t || this.#e.marker === !1 || this.#e.marker === null) return;
1164
- const r = this.#e.marker instanceof Function ? this.#e.marker(this.#t, i) : this.#f(this.#e.marker).setLngLat(i.center).addTo(this.#t);
1165
- r && this.#l.set(i, r);
1175
+ const s = this.#e.marker instanceof Function ? this.#e.marker(this.#t, i) : this.#f(this.#e.marker).setLngLat(i.center).addTo(this.#t);
1176
+ s && this.#l.set(i, s);
1166
1177
  };
1167
1178
  if (i?.geometry.type === "GeometryCollection") {
1168
- const r = i.geometry.geometries.filter(
1169
- (s) => s.type === "Polygon" || s.type === "MultiPolygon"
1179
+ const s = i.geometry.geometries.filter(
1180
+ (o) => o.type === "Polygon" || o.type === "MultiPolygon"
1170
1181
  );
1171
- if (r.length > 0) {
1172
- const s = Le(q(r.map((a) => Ke(a))));
1173
- if (s) {
1174
- const a = ke({ ...i, geometry: s.geometry });
1175
- a && this.#n(a);
1182
+ if (s.length > 0) {
1183
+ const o = _e(D(s.map((r) => Qe(r))));
1184
+ if (o) {
1185
+ const r = ke({ ...i, geometry: o.geometry });
1186
+ r && this.#n(r);
1176
1187
  }
1177
1188
  } else {
1178
- const s = i.geometry.geometries.filter(
1179
- (a) => a.type === "LineString" || a.type === "MultiLineString"
1189
+ const o = i.geometry.geometries.filter(
1190
+ (r) => r.type === "LineString" || r.type === "MultiLineString"
1180
1191
  );
1181
- s.length > 0 && this.#n({
1192
+ o.length > 0 && this.#n({
1182
1193
  ...i,
1183
- geometry: { type: "GeometryCollection", geometries: s }
1194
+ geometry: { type: "GeometryCollection", geometries: o }
1184
1195
  });
1185
1196
  }
1186
1197
  } else if (i?.geometry.type.endsWith("Polygon")) {
1187
- const r = ke(i);
1188
- r && this.#n(r), this.#e.pickedResultStyle === "full-geometry-including-polygon-center-marker" && o();
1189
- } else i?.geometry.type.endsWith("LineString") ? this.#n(i) : i?.geometry.type.endsWith("Point") && o();
1198
+ const s = ke(i);
1199
+ s && this.#n(s), this.#e.pickedResultStyle === "full-geometry-including-polygon-center-marker" && a();
1200
+ } else i?.geometry.type.endsWith("LineString") ? this.#n(i) : i?.geometry.type.endsWith("Point") && a();
1190
1201
  if (this.#e.showResultMarkers !== !1 && this.#e.showResultMarkers !== null)
1191
- for (const r of e ?? []) {
1192
- if (r.id === i?.id || r.place_type.includes("reverse"))
1202
+ for (const s of e ?? []) {
1203
+ if (s.id === i?.id || s.place_type.includes("reverse"))
1193
1204
  continue;
1194
- let s;
1205
+ let o;
1195
1206
  if (this.#e.showResultMarkers instanceof Function) {
1196
- if (s = this.#e.showResultMarkers(this.#t, r), !s)
1207
+ if (o = this.#e.showResultMarkers(this.#t, s), !o)
1197
1208
  continue;
1198
1209
  } else
1199
- s = this.#f(this.#e.showResultMarkers).setLngLat(r.center).setPopup(
1200
- new It({
1210
+ o = this.#f(this.#e.showResultMarkers).setLngLat(s.center).setPopup(
1211
+ new Ft({
1201
1212
  offset: [1, -27],
1202
1213
  closeButton: !1,
1203
1214
  closeOnMove: !0,
1204
1215
  className: "maptiler-gc-popup"
1205
- }).setText(r.place_type[0] === "reverse" ? r.place_name : r.place_name.replace(/,.*/, ""))
1206
- ).addTo(this.#t), s.getElement().classList.add("marker-interactive");
1207
- const a = s.getElement();
1208
- a.addEventListener("click", (f) => {
1209
- f.stopPropagation(), this.#s("markerclick", { feature: r, marker: s });
1210
- }), a.addEventListener("mouseenter", () => {
1211
- this.#s("markermouseenter", { feature: r, marker: s }), s.togglePopup();
1212
- }), a.addEventListener("mouseleave", () => {
1213
- this.#s("markermouseleave", { feature: r, marker: s }), s.togglePopup();
1214
- }), a.classList.toggle("marker-fuzzy", !!r.matching_text), this.#l.set(r, s);
1216
+ }).setText(s.place_type[0] === "reverse" ? s.place_name : s.place_name.replace(/,.*/, ""))
1217
+ ).addTo(this.#t), o.getElement().classList.add("marker-interactive");
1218
+ const r = o.getElement();
1219
+ r.addEventListener("click", (u) => {
1220
+ u.stopPropagation(), this.#s("markerclick", { feature: s, marker: o });
1221
+ }), r.addEventListener("mouseenter", () => {
1222
+ this.#s("markermouseenter", { feature: s, marker: o }), o.togglePopup();
1223
+ }), r.addEventListener("mouseleave", () => {
1224
+ this.#s("markermouseleave", { feature: s, marker: o }), o.togglePopup();
1225
+ }), r.classList.toggle("marker-fuzzy", !!s.matching_text), this.#l.set(s, o);
1215
1226
  }
1216
1227
  }
1217
- #M(e) {
1228
+ #O(e) {
1218
1229
  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));
1219
1230
  }
1220
1231
  #u() {
@@ -1224,29 +1235,29 @@ class Ot extends Lt {
1224
1235
  });
1225
1236
  return;
1226
1237
  }
1227
- const e = this.#T(), i = this.#t.getSource(D);
1228
- !e?.fill && !e?.line || !i && !this.#a || (i ? i.setData(this.#a ?? q([])) : this.#a && this.#t.addSource(D, {
1238
+ const e = this.#M(), i = this.#t.getSource(W);
1239
+ !e?.fill && !e?.line || !i && !this.#a || (i ? i.setData(this.#a ?? D([])) : this.#a && this.#t.addSource(W, {
1229
1240
  type: "geojson",
1230
1241
  data: this.#a
1231
1242
  }), !this.#t.getLayer(we) && e.fill && this.#t.addLayer({
1232
1243
  ...e.fill,
1233
1244
  id: we,
1234
1245
  type: "fill",
1235
- source: D
1236
- }), !this.#t.getLayer(_e) && e.line && this.#t.addLayer({
1246
+ source: W
1247
+ }), !this.#t.getLayer(Le) && e.line && this.#t.addLayer({
1237
1248
  ...e.line,
1238
- id: _e,
1249
+ id: Le,
1239
1250
  type: "line",
1240
- source: D
1251
+ source: W
1241
1252
  }));
1242
1253
  }
1243
1254
  #n(e) {
1244
1255
  this.#a = e, this.#u();
1245
1256
  }
1246
1257
  #f(e) {
1247
- return typeof e != "object" && (e = { element: this.#t?._container.ownerDocument.createElement("maptiler-geocode-marker"), offset: [1, -13] }), new $t(e);
1258
+ return typeof e != "object" && (e = { element: this.#t?._container.ownerDocument.createElement("maptiler-geocode-marker"), offset: [1, -13] }), new It(e);
1248
1259
  }
1249
- #T() {
1260
+ #M() {
1250
1261
  const { fullGeometryStyle: e } = this.#e;
1251
1262
  if (e === !0 || e === void 0) return _t;
1252
1263
  if (!(e === !1 || e === null))
@@ -1260,14 +1271,14 @@ class Dt extends Ot {
1260
1271
  }
1261
1272
  /** @internal Not to be called directly */
1262
1273
  onAdd(e) {
1263
- this.#e = e, e.telemetry.registerModule(bt, kt);
1264
- const i = this.getOptions(), { primaryLanguage: o, apiKey: r } = e.getSdkConfig();
1265
- if (i.apiKey === void 0 && this.setOptions({ apiKey: r }), i.language === void 0) {
1266
- const a = o.code?.match(/^([a-z]{2,3})($|_|-)/);
1267
- a && this.setOptions({ language: a[1] });
1274
+ this.#e = e, e.telemetry.registerModule(kt, wt);
1275
+ const i = this.getOptions(), { primaryLanguage: a, apiKey: s } = e.getSdkConfig();
1276
+ if (i.apiKey === void 0 && this.setOptions({ apiKey: s }), i.language === void 0) {
1277
+ const r = a.code?.match(/^([a-z]{2,3})($|_|-)/);
1278
+ r && this.setOptions({ language: r[1] });
1268
1279
  }
1269
- const s = super.onAdd(e);
1270
- return s.classList.add("maptiler-ctrl-geocoder"), s.querySelector("maptiler-geocoder")?.classList.add("maptiler-geocoder"), s;
1280
+ const o = super.onAdd(e);
1281
+ return o.classList.add("maptiler-ctrl-geocoder"), o.querySelector("maptiler-geocoder")?.classList.add("maptiler-geocoder"), o;
1271
1282
  }
1272
1283
  /** @internal Not to be called directly */
1273
1284
  onRemove() {
@@ -1277,10 +1288,10 @@ class Dt extends Ot {
1277
1288
  const i = e.adjustUrl;
1278
1289
  super.setOptions({
1279
1290
  ...e,
1280
- adjustUrl: (o) => {
1281
- i?.(o);
1282
- const r = this.getOptions();
1283
- (Ne.session ? e.session !== !1 : e.session === !0) && this.#e && (!r.apiUrl || new URL(r.apiUrl).host === new URL("https://api.maptiler.com/geocoding").host) && o.searchParams.append("mtsid", this.#e.getMaptilerSessionId());
1291
+ adjustUrl: (a) => {
1292
+ i?.(a);
1293
+ const s = this.getOptions();
1294
+ (Ze.session ? e.session !== !1 : e.session === !0) && this.#e && (!s.apiUrl || new URL(s.apiUrl).host === new URL("https://api.maptiler.com/geocoding").host) && a.searchParams.append("mtsid", this.#e.getMaptilerSessionId());
1284
1295
  }
1285
1296
  });
1286
1297
  }
@@ -1288,17 +1299,17 @@ class Dt extends Ot {
1288
1299
  export {
1289
1300
  _t as DEFAULT_GEOMETRY_STYLE,
1290
1301
  Dt as GeocodingControl,
1291
- ee as MaptilerGeocodeClearIconElement,
1292
- te as MaptilerGeocodeFailIconElement,
1293
- ie as MaptilerGeocodeLoadingIconElement,
1294
- ne as MaptilerGeocodeMarkerElement,
1295
- se as MaptilerGeocodeReverseGeocodingIconElement,
1296
- re as MaptilerGeocodeSearchIconElement,
1302
+ J as MaptilerGeocodeClearIconElement,
1303
+ X as MaptilerGeocodeFailIconElement,
1304
+ ee as MaptilerGeocodeLoadingIconElement,
1305
+ le as MaptilerGeocodeMarkerElement,
1306
+ te as MaptilerGeocodeReverseGeocodingIconElement,
1307
+ ie as MaptilerGeocodeSearchIconElement,
1297
1308
  n as MaptilerGeocoderElement,
1298
1309
  Dt as MaptilerGeocodingControl,
1299
1310
  we as RESULT_LAYER_FILL,
1300
- _e as RESULT_LAYER_LINE,
1301
- D as RESULT_SOURCE,
1302
- wt as ZOOM_DEFAULTS
1311
+ Le as RESULT_LAYER_LINE,
1312
+ W as RESULT_SOURCE,
1313
+ Lt as ZOOM_DEFAULTS
1303
1314
  };
1304
1315
  //# sourceMappingURL=maptilersdk.js.map