@maptiler/geocoding-control 3.0.0-rc.6 → 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,14 +1,14 @@
1
- import { css as I, LitElement as M, svg as z, html as m, unsafeCSS as ce, nothing as X } from "lit";
2
- import { customElement as O, property as p, state as k, query as We } from "lit/decorators.js";
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
3
  import { convert as Ve } from "geo-coordinates-parser";
4
- import { classMap as D } from "lit/directives/class-map.js";
4
+ import { classMap as W } from "lit/directives/class-map.js";
5
5
  import { repeat as qe } from "lit/directives/repeat.js";
6
6
  import "@turf/clone";
7
7
  import { styleMap as Ne } from "lit/directives/style-map.js";
8
- import { featureCollection as q, polygon as Ze, feature as Qe } from "@turf/helpers";
9
- import $e from "@turf/union";
10
- import he from "maplibre-gl";
11
- import ke from "@turf/bbox";
8
+ import { featureCollection as D, polygon as Ze, feature as Qe } from "@turf/helpers";
9
+ import Le from "@turf/union";
10
+ import ce from "maplibre-gl";
11
+ import be from "@turf/bbox";
12
12
  import Ke from "@turf/difference";
13
13
  import Ye from "@turf/flatten";
14
14
  var He = Object.getOwnPropertyDescriptor, Je = (t, e, i, a) => {
@@ -16,7 +16,7 @@ var He = Object.getOwnPropertyDescriptor, Je = (t, e, i, a) => {
16
16
  (r = t[o]) && (s = r(s) || s);
17
17
  return s;
18
18
  };
19
- let ee = class extends M {
19
+ let J = class extends F {
20
20
  render() {
21
21
  return z`
22
22
  <svg viewBox="0 0 14 14" width="13" height="13">
@@ -27,21 +27,21 @@ let ee = class extends M {
27
27
  `;
28
28
  }
29
29
  };
30
- ee.styles = I`
30
+ J.styles = I`
31
31
  svg {
32
32
  display: block;
33
33
  fill: var(--color-icon-button);
34
34
  }
35
35
  `;
36
- ee = Je([
36
+ J = Je([
37
37
  O("maptiler-geocode-clear-icon")
38
- ], ee);
38
+ ], J);
39
39
  var Xe = Object.getOwnPropertyDescriptor, et = (t, e, i, a) => {
40
40
  for (var s = a > 1 ? void 0 : a ? Xe(e, i) : e, o = t.length - 1, r; o >= 0; o--)
41
41
  (r = t[o]) && (s = r(s) || s);
42
42
  return s;
43
43
  };
44
- let te = class extends M {
44
+ let X = class extends F {
45
45
  render() {
46
46
  return z`
47
47
  <svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -52,21 +52,21 @@ let te = class extends M {
52
52
  `;
53
53
  }
54
54
  };
55
- te.styles = I`
55
+ X.styles = I`
56
56
  svg {
57
57
  display: block;
58
58
  fill: #e15042;
59
59
  }
60
60
  `;
61
- te = et([
61
+ X = et([
62
62
  O("maptiler-geocode-fail-icon")
63
- ], te);
63
+ ], X);
64
64
  var tt = Object.getOwnPropertyDescriptor, it = (t, e, i, a) => {
65
65
  for (var s = a > 1 ? void 0 : a ? tt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
66
66
  (r = t[o]) && (s = r(s) || s);
67
67
  return s;
68
68
  };
69
- let ie = class extends M {
69
+ let ee = class extends F {
70
70
  render() {
71
71
  return m`
72
72
  <div>
@@ -78,7 +78,7 @@ let ie = class extends M {
78
78
  `;
79
79
  }
80
80
  };
81
- ie.styles = I`
81
+ ee.styles = I`
82
82
  div {
83
83
  position: absolute;
84
84
  left: 50%;
@@ -105,15 +105,15 @@ ie.styles = I`
105
105
  }
106
106
  }
107
107
  `;
108
- ie = it([
108
+ ee = it([
109
109
  O("maptiler-geocode-loading-icon")
110
- ], ie);
110
+ ], ee);
111
111
  var st = Object.getOwnPropertyDescriptor, rt = (t, e, i, a) => {
112
112
  for (var s = a > 1 ? void 0 : a ? st(e, i) : e, o = t.length - 1, r; o >= 0; o--)
113
113
  (r = t[o]) && (s = r(s) || s);
114
114
  return s;
115
115
  };
116
- let se = class extends M {
116
+ let te = class extends F {
117
117
  render() {
118
118
  return z`
119
119
  <svg viewBox="0 0 60.006 21.412" width="14" height="20">
@@ -124,21 +124,21 @@ let se = class extends M {
124
124
  `;
125
125
  }
126
126
  };
127
- se.styles = I`
127
+ te.styles = I`
128
128
  svg {
129
129
  display: block;
130
130
  fill: var(--color-icon-button);
131
131
  }
132
132
  `;
133
- se = rt([
133
+ te = rt([
134
134
  O("maptiler-geocode-reverse-geocoding-icon")
135
- ], se);
135
+ ], te);
136
136
  var ot = Object.getOwnPropertyDescriptor, at = (t, e, i, a) => {
137
137
  for (var s = a > 1 ? void 0 : a ? ot(e, i) : e, o = t.length - 1, r; o >= 0; o--)
138
138
  (r = t[o]) && (s = r(s) || s);
139
139
  return s;
140
140
  };
141
- let re = class extends M {
141
+ let ie = class extends F {
142
142
  render() {
143
143
  return z`
144
144
  <svg
@@ -153,7 +153,7 @@ let re = class extends M {
153
153
  `;
154
154
  }
155
155
  };
156
- re.styles = I`
156
+ ie.styles = I`
157
157
  circle {
158
158
  stroke-width: 1.875;
159
159
  fill: none;
@@ -169,27 +169,27 @@ re.styles = I`
169
169
  stroke: var(--color-icon-button);
170
170
  }
171
171
  `;
172
- re = at([
172
+ ie = at([
173
173
  O("maptiler-geocode-search-icon")
174
- ], re);
174
+ ], ie);
175
175
  function lt(t, e, i) {
176
176
  const a = e[1], s = e[0], o = a - s;
177
177
  return t === a && i ? t : ((t - s) % o + o) % o + s;
178
178
  }
179
- function N(t) {
179
+ function V(t) {
180
180
  const e = [...t];
181
181
  return e[2] < e[0] && (Math.abs((e[0] + e[2] + 360) / 2) > Math.abs((e[0] - 360 + e[2]) / 2) ? e[0] -= 360 : e[2] += 360), e;
182
182
  }
183
- let U;
183
+ let P;
184
184
  async function nt(t, e, i) {
185
185
  for (const a of e ?? [])
186
186
  if (!(t && (a.minZoom != null && a.minZoom > t[0] || a.maxZoom != null && a.maxZoom < t[0]))) {
187
187
  if (a.type === "fixed")
188
188
  return a.coordinates.join(",");
189
189
  if (a.type === "client-geolocation")
190
- if (U && a.cachedLocationExpiry && U.time + a.cachedLocationExpiry > Date.now()) {
191
- if (U.coords)
192
- return U.coords;
190
+ if (P && a.cachedLocationExpiry && P.time + a.cachedLocationExpiry > Date.now()) {
191
+ if (P.coords)
192
+ return P.coords;
193
193
  } else {
194
194
  let s;
195
195
  try {
@@ -208,7 +208,7 @@ async function nt(t, e, i) {
208
208
  }), s;
209
209
  } catch {
210
210
  } finally {
211
- a.cachedLocationExpiry && (U = {
211
+ a.cachedLocationExpiry && (P = {
212
212
  time: Date.now(),
213
213
  coords: s
214
214
  });
@@ -223,20 +223,20 @@ async function nt(t, e, i) {
223
223
  }
224
224
  }
225
225
  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)}}";
226
- var ht = Object.defineProperty, pt = Object.getOwnPropertyDescriptor, Ie = (t) => {
226
+ var ht = Object.defineProperty, pt = Object.getOwnPropertyDescriptor, $e = (t) => {
227
227
  throw TypeError(t);
228
228
  }, L = (t, e, i, a) => {
229
229
  for (var s = a > 1 ? void 0 : a ? pt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
230
230
  (r = t[o]) && (s = (a ? r(e, i, s) : r(s)) || s);
231
231
  return a && s && ht(e, i, s), s;
232
- }, Me = (t, e, i) => e.has(t) || Ie("Cannot " + i), f = (t, e, i) => (Me(t, e, "read from private field"), i ? i.call(t) : e.get(t)), dt = (t, e, i) => e.has(t) ? Ie("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), E = (t, e, i) => (Me(t, e, "access private method"), i), d, Z, B, g, Oe, Te, pe, oe;
233
- const Fe = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Se = Fe ? "@2x" : "", S = Fe ? 2 : 1;
234
- let F, Ce, w = class extends M {
232
+ }, 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)), 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), C = (t, e, i) => (Ie(t, e, "access private method"), i), d, q, B, g, Fe, Oe, he, se;
233
+ const Te = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Me = Te ? "@2x" : "", S = Te ? 2 : 1;
234
+ let M, Se, w = class extends F {
235
235
  constructor() {
236
236
  super(...arguments), dt(this, d), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
237
237
  }
238
238
  willUpdate(t) {
239
- t.has("feature") && f(this, d, Z) && (this.index = f(this, d, Z).length, E(this, d, pe).call(this));
239
+ t.has("feature") && f(this, d, q) && (this.index = f(this, d, q).length, C(this, d, he).call(this));
240
240
  }
241
241
  render() {
242
242
  return m`
@@ -248,25 +248,25 @@ let F, Ce, w = class extends M {
248
248
  class=${this.itemStyle}
249
249
  @click=${() => this.dispatchEvent(new CustomEvent("select"))}
250
250
  >
251
- ${F && this.spriteIcon ? m`
251
+ ${M && this.spriteIcon ? m`
252
252
  <div
253
253
  class="sprite-icon"
254
254
  style=${Ne({
255
255
  width: `${this.spriteIcon.width / S}px`,
256
256
  height: `${this.spriteIcon.height / S}px`,
257
- backgroundImage: `url(${this.iconsBaseUrl}sprite${Se}.png)`,
257
+ backgroundImage: `url(${this.iconsBaseUrl}sprite${Me}.png)`,
258
258
  backgroundPosition: `-${this.spriteIcon.x / S}px -${this.spriteIcon.y / S}px`,
259
- backgroundSize: `${F.width / S}px ${F.height / S}px`
259
+ backgroundSize: `${M.width / S}px ${M.height / S}px`
260
260
  })}
261
261
  title=${f(this, d, g)}
262
262
  />
263
- ` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${f(this, d, g)} @error=${E(this, d, Te)} />` : 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, B) ? 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)} /> `}
263
+ ` : 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, B) ? m` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : m` <img src=${this.iconsBaseUrl + "area.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> `}
264
264
 
265
265
  <span class="texts">
266
266
  <span>
267
267
  <span class="primary"> ${f(this, d, B) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
268
268
 
269
- ${this.showPlaceType === "always" || this.showPlaceType !== "never" && !this.feature?.address && !this.feature?.id.startsWith("road.") && !this.feature?.id.startsWith("address.") && !this.feature?.id.startsWith("postal_code.") && (!this.feature?.id.startsWith("poi.") || !this.imageUrl) && !f(this, d, B) ? m` <span class="secondary"> ${f(this, d, g)} </span> ` : X}
269
+ ${this.showPlaceType === "always" || this.showPlaceType !== "never" && !this.feature?.address && !this.feature?.id.startsWith("road.") && !this.feature?.id.startsWith("address.") && !this.feature?.id.startsWith("postal_code.") && (!this.feature?.id.startsWith("poi.") || !this.imageUrl) && !f(this, d, B) ? m` <span class="secondary"> ${f(this, d, g)} </span> ` : H}
270
270
  </span>
271
271
 
272
272
  <span class="line2"> ${f(this, d, B) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
@@ -276,7 +276,7 @@ let F, Ce, w = class extends M {
276
276
  }
277
277
  };
278
278
  d = /* @__PURE__ */ new WeakSet();
279
- Z = function() {
279
+ q = function() {
280
280
  return this.feature?.properties?.categories;
281
281
  };
282
282
  B = function() {
@@ -285,30 +285,30 @@ B = function() {
285
285
  g = function() {
286
286
  return this.feature?.properties?.categories?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
287
287
  };
288
- Oe = function() {
289
- Ce ??= fetch(`${this.iconsBaseUrl}sprite${Se}.json`).then((t) => t.json()).then((t) => {
290
- F = t;
288
+ Fe = function() {
289
+ Se ??= fetch(`${this.iconsBaseUrl}sprite${Me}.json`).then((t) => t.json()).then((t) => {
290
+ M = t;
291
291
  }).catch(() => {
292
- F = null;
292
+ M = null;
293
293
  });
294
294
  };
295
- Te = function() {
296
- this.imageUrl && this.missingIconsCache.add(this.imageUrl), E(this, d, pe).call(this);
295
+ Oe = function() {
296
+ this.imageUrl && this.missingIconsCache.add(this.imageUrl), C(this, d, he).call(this);
297
297
  };
298
- pe = function() {
299
- F !== void 0 ? E(this, d, oe).call(this) : (E(this, d, Oe).call(this), Ce?.then(() => {
300
- E(this, d, oe).call(this);
298
+ he = function() {
299
+ M !== void 0 ? C(this, d, se).call(this) : (C(this, d, Fe).call(this), Se?.then(() => {
300
+ C(this, d, se).call(this);
301
301
  }));
302
302
  };
303
- oe = function() {
303
+ se = function() {
304
304
  do {
305
- if (this.index--, this.category = f(this, d, Z)?.[this.index], this.spriteIcon = this.category ? F?.icons[this.category] : void 0, this.spriteIcon)
305
+ if (this.index--, this.category = f(this, d, q)?.[this.index], this.spriteIcon = this.category ? M?.icons[this.category] : void 0, this.spriteIcon)
306
306
  break;
307
307
  this.imageUrl = this.category ? this.iconsBaseUrl + this.category.replace(/ /g, "_") + ".svg" : void 0;
308
308
  } while (this.index > -1 && (!this.imageUrl || this.missingIconsCache.has(this.imageUrl)));
309
309
  };
310
310
  w.styles = I`
311
- ${ce(ct)}
311
+ ${ne(ct)}
312
312
  `;
313
313
  L([
314
314
  p({ type: Object })
@@ -326,34 +326,34 @@ L([
326
326
  p({ type: String })
327
327
  ], w.prototype, "iconsBaseUrl", 2);
328
328
  L([
329
- k()
329
+ b()
330
330
  ], w.prototype, "category", 2);
331
331
  L([
332
- k()
332
+ b()
333
333
  ], w.prototype, "imageUrl", 2);
334
334
  L([
335
- k()
335
+ b()
336
336
  ], w.prototype, "spriteIcon", 2);
337
337
  L([
338
- k()
338
+ b()
339
339
  ], w.prototype, "index", 2);
340
340
  w = L([
341
341
  O("maptiler-geocoder-feature-item")
342
342
  ], w);
343
343
  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}";
344
- var ft = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, Ee = (t) => {
344
+ var ft = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, Ce = (t) => {
345
345
  throw TypeError(t);
346
346
  }, c = (t, e, i, a) => {
347
347
  for (var s = a > 1 ? void 0 : a ? mt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
348
348
  (r = t[o]) && (s = (a ? r(e, i, s) : r(s)) || s);
349
349
  return a && s && ft(e, i, s), s;
350
- }, de = (t, e, i) => e.has(t) || Ee("Cannot " + i), b = (t, e, i) => (de(t, e, "read from private field"), i ? i.call(t) : e.get(t)), C = (t, e, i) => e.has(t) ? Ee("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), W = (t, e, i, a) => (de(t, e, "write to private field"), e.set(t, i), i), h = (t, e, i) => (de(t, e, "access private method"), i), Q, V, G, ae, R, l, K, Pe, Ue, ue, x, fe, Y, me, ge, $, ye, H, Be, le, Ge, Re, ze, je, De;
351
- let n = class extends M {
350
+ }, 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, G, oe, R, l, Z, Ee, de, x, ue, Q, fe, me, $, ge, K, Pe, ae, Ue, Be, Ge, Re, ze, je, We;
351
+ let n = class extends F {
352
352
  constructor() {
353
- super(...arguments), C(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, C(this, Q, !1), C(this, V, !1), C(this, G), C(this, ae, /* @__PURE__ */ new Set()), C(this, R);
353
+ super(...arguments), U(this, l), this.clearListOnPick = !1, this.clearOnBlur = !1, this.collapsed = !1, this.excludeTypes = !1, this.exhaustiveReverseGeocoding = !1, this.fetchFullGeometryOnPick = !1, this.keepListOpen = !1, this.openListOnTop = !1, this.reverseActive = !1, this.searchValue = "", this.selectedItemIndex = -1, this.cachedFeatures = [], this.lastSearchUrl = "", this.focused = !1, this.isFeatureListVisible = !1, this.isFeatureListInteractedWith = !1, U(this, N, !1), U(this, G), U(this, oe, /* @__PURE__ */ new Set()), U(this, R);
354
354
  }
355
355
  firstUpdated() {
356
- W(this, Q, !0);
356
+ re(this, N, !0);
357
357
  }
358
358
  /**
359
359
  * Set the options of this instance.
@@ -372,7 +372,7 @@ let n = class extends M {
372
372
  * @param value text to set
373
373
  */
374
374
  setQuery(t) {
375
- h(this, l, ge).call(this, t, { external: !0 }), h(this, l, me).call(this);
375
+ h(this, l, me).call(this, t, { external: !0 }), h(this, l, fe).call(this);
376
376
  }
377
377
  /**
378
378
  * Set the content of search input box and immediately submit it.
@@ -380,7 +380,7 @@ let n = class extends M {
380
380
  * @param value text to set and submit
381
381
  */
382
382
  submitQuery(t) {
383
- h(this, l, ye).call(this, t);
383
+ h(this, l, ge).call(this, t);
384
384
  }
385
385
  /**
386
386
  * Clear search result list.
@@ -410,27 +410,25 @@ let n = class extends M {
410
410
  }
411
411
  /** @internal */
412
412
  handleMapChange(t) {
413
- W(this, R, t);
413
+ re(this, R, t);
414
414
  }
415
415
  /** @internal */
416
416
  handleMapClick(t) {
417
- this.reverseActive && h(this, l, Be).call(this, t);
417
+ this.reverseActive && h(this, l, Pe).call(this, t);
418
418
  }
419
419
  willUpdate(t) {
420
- t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, l, $).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && b(this, l, ue) && (h(this, l, $).call(this), this.error = void 0), ["focused"].some((e) => t.has(e)) && setTimeout(() => {
421
- this.focusedDelayed = this.focused, this.clearOnBlur && !this.focused && (this.searchValue = "");
422
- }, 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, x).call(this, "select", { feature: b(this, l, 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" ? h(this, l, H).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
420
+ t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && 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, K).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
423
421
  () => {
424
422
  h(this, l, x).call(this, "pick", { feature: this.picked });
425
423
  },
426
424
  (e) => {
427
425
  e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, l, x).call(this, "pick", { feature: this.picked }));
428
426
  }
429
- ), ["listFeatures", "focusedDelayed"].some((e) => t.has(e)) && (b(this, l, Pe) ? (h(this, l, x).call(this, "featuresshow"), W(this, V, !0)) : b(this, V) && h(this, l, x).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && h(this, l, x).call(this, "reversetoggle", { reverse: this.reverseActive });
427
+ ), ["listFeatures", "focused", "isFeatureListInteractedWith", "keepListOpen"].some((e) => t.has(e)) && (this.isFeatureListVisible = !!this.listFeatures?.length && (this.focused || this.isFeatureListInteractedWith || this.keepListOpen)), ["isFeatureListVisible"].some((e) => t.has(e)) && (this.isFeatureListVisible ? 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 });
430
428
  }
431
429
  render() {
432
430
  return m`
433
- <form @submit=${h(this, l, fe)} class=${D({ "can-collapse": this.collapsed && this.searchValue === "" })}>
431
+ <form @submit=${h(this, l, ue)} class=${W({ "can-collapse": this.collapsed && this.searchValue === "" })}>
434
432
  <div class="input-group">
435
433
  <button
436
434
  class="search-button"
@@ -447,16 +445,16 @@ let n = class extends M {
447
445
  @focus=${() => this.focused = !0}
448
446
  @blur=${() => this.focused = !1}
449
447
  @click=${() => this.focused = !0}
450
- @keydown=${h(this, l, le)}
451
- @input=${h(this, l, Ge)}
448
+ @keydown=${h(this, l, ae)}
449
+ @input=${h(this, l, Ue)}
452
450
  @change=${() => this.picked = void 0}
453
451
  placeholder=${this.placeholder ?? "Search"}
454
452
  aria-label=${this.placeholder ?? "Search"}
455
453
  />
456
454
 
457
- <div class="clear-button-container ${D({ displayable: this.searchValue !== "" })}">
458
- ${b(this, l, Ue) ? m`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : m`
459
- <button type="button" @click=${h(this, l, De)} title=${this.clearButtonTitle ?? "clear"}>
455
+ <div class="clear-button-container ${W({ displayable: this.searchValue !== "" })}">
456
+ ${k(this, l, Ee) ? m`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : m`
457
+ <button type="button" @click=${h(this, l, We)} title=${this.clearButtonTitle ?? "clear"}>
460
458
  <maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
461
459
  </button>
462
460
  `}
@@ -465,13 +463,13 @@ let n = class extends M {
465
463
  ${this.enableReverse === "button" ? m`
466
464
  <button
467
465
  type="button"
468
- class=${D({ active: this.reverseActive })}
466
+ class=${W({ active: this.reverseActive })}
469
467
  title=${this.reverseButtonTitle ?? "toggle reverse geocoding"}
470
468
  @click=${() => this.reverseActive = !this.reverseActive}
471
469
  >
472
470
  <maptiler-geocode-reverse-geocoding-icon></maptiler-geocode-reverse-geocoding-icon>
473
471
  </button>
474
- ` : X}
472
+ ` : H}
475
473
 
476
474
  <!-- <slot /> -->
477
475
  </div>
@@ -486,7 +484,7 @@ let n = class extends M {
486
484
  <maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
487
485
  </button>
488
486
  </div>
489
- ` : !this.focusedDelayed && !this.keepListOpen || this.listFeatures === void 0 ? X : this.listFeatures.length === 0 ? m`
487
+ ` : !this.focused && !this.isFeatureListInteractedWith && !this.keepListOpen || this.listFeatures === void 0 ? H : this.listFeatures.length === 0 ? m`
490
488
  <div class="no-results">
491
489
  <maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
492
490
 
@@ -495,7 +493,14 @@ let n = class extends M {
495
493
  </div>
496
494
  </div>
497
495
  ` : m`
498
- <ul class="options ${D({ "open-on-top": this.openListOnTop })}" @mouseleave=${h(this, l, je)} @keydown=${h(this, l, le)} role="listbox">
496
+ <ul
497
+ class="options ${W({ "open-on-top": this.openListOnTop })}"
498
+ @pointerleave=${h(this, l, Re)}
499
+ @pointerdown=${h(this, l, ze)}
500
+ @pointerup=${h(this, l, je)}
501
+ @keydown=${h(this, l, ae)}
502
+ role="listbox"
503
+ >
499
504
  ${qe(
500
505
  this.listFeatures,
501
506
  (t) => t.id + (t.address ? "," + t.address : ""),
@@ -504,17 +509,15 @@ let n = class extends M {
504
509
  .feature=${t}
505
510
  .showPlaceType=${this.showPlaceType ?? "if-needed"}
506
511
  itemStyle=${this.selectedItemIndex === e ? "selected" : this.picked?.id === t.id ? "picked" : "default"}
507
- @mouseenter=${() => {
508
- h(this, l, ze).call(this, e);
512
+ @pointerenter=${() => {
513
+ h(this, l, Ge).call(this, e);
509
514
  }}
510
515
  @select=${() => {
511
- h(this, l, Re).call(this, t);
516
+ h(this, l, Be).call(this, t);
512
517
  }}
513
- .missingIconsCache=${b(this, ae)}
514
- .iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.6/icons/"}
515
- >
516
- ${t.place_name}
517
- </maptiler-geocoder-feature-item>
518
+ .missingIconsCache=${k(this, oe)}
519
+ .iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.7/icons/"}
520
+ />
518
521
  `
519
522
  )}
520
523
  </ul>
@@ -523,26 +526,22 @@ let n = class extends M {
523
526
  `;
524
527
  }
525
528
  };
526
- Q = /* @__PURE__ */ new WeakMap();
527
- V = /* @__PURE__ */ new WeakMap();
529
+ N = /* @__PURE__ */ new WeakMap();
528
530
  G = /* @__PURE__ */ new WeakMap();
529
- ae = /* @__PURE__ */ new WeakMap();
531
+ oe = /* @__PURE__ */ new WeakMap();
530
532
  R = /* @__PURE__ */ new WeakMap();
531
533
  l = /* @__PURE__ */ new WeakSet();
532
- K = function() {
534
+ Z = function() {
533
535
  return this.listFeatures?.[this.selectedItemIndex];
534
536
  };
535
- Pe = function() {
536
- return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
537
- };
538
- Ue = function() {
537
+ Ee = function() {
539
538
  return this.abortController !== void 0;
540
539
  };
541
- ue = function() {
540
+ de = function() {
542
541
  return this.searchValue.length < (this.minLength ?? 2);
543
542
  };
544
543
  x = function(t, ...[e]) {
545
- b(this, Q) && this.dispatchEvent(
544
+ k(this, N) && this.dispatchEvent(
546
545
  new CustomEvent(t, {
547
546
  bubbles: !0,
548
547
  composed: !0,
@@ -550,30 +549,30 @@ x = function(t, ...[e]) {
550
549
  })
551
550
  );
552
551
  };
553
- fe = function(t) {
554
- t?.preventDefault(), this.focused = !1, clearTimeout(b(this, G)), 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, external: t === void 0 }).then(() => {
552
+ ue = function(t) {
553
+ t?.preventDefault(), this.focused = !1, clearTimeout(k(this, G)), 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, K).call(this, this.searchValue, { exact: !0, external: t === void 0 }).then(() => {
555
554
  this.picked = void 0;
556
555
  }).catch((e) => this.error = e);
557
556
  };
558
- Y = function(t) {
557
+ Q = function(t) {
559
558
  try {
560
559
  return Ve(t, 6);
561
560
  } catch {
562
561
  return !1;
563
562
  }
564
563
  };
565
- me = function() {
564
+ fe = function() {
566
565
  setTimeout(() => {
567
566
  this.input.focus(), this.focused = !0, this.input.select();
568
567
  });
569
568
  };
570
- ge = function(t, { external: e = !1 } = {}) {
571
- if (this.searchValue = t, h(this, l, x).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) {
572
- if (clearTimeout(b(this, G)), b(this, l, ue))
569
+ me = function(t, { external: e = !1 } = {}) {
570
+ if (this.searchValue = t, h(this, l, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, l, Q).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
571
+ if (clearTimeout(k(this, G)), k(this, l, de))
573
572
  return;
574
573
  const i = this.searchValue;
575
- W(this, G, window.setTimeout(() => {
576
- h(this, l, H).call(this, i, { external: e }).catch((a) => this.error = a);
574
+ re(this, G, window.setTimeout(() => {
575
+ h(this, l, K).call(this, i, { external: e }).catch((a) => this.error = a);
577
576
  }, this.debounceSearch ?? 200));
578
577
  } else
579
578
  h(this, l, $).call(this);
@@ -581,37 +580,37 @@ ge = function(t, { external: e = !1 } = {}) {
581
580
  $ = function() {
582
581
  this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, l, x).call(this, "featuresclear"));
583
582
  };
584
- ye = function(t) {
585
- this.searchValue = t, h(this, l, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, l, Y).call(this, t) }), this.selectedItemIndex = -1, h(this, l, fe).call(this);
583
+ ge = function(t) {
584
+ this.searchValue = t, h(this, l, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, l, Q).call(this, t) }), this.selectedItemIndex = -1, h(this, l, ue).call(this);
586
585
  };
587
- H = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
586
+ K = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
588
587
  this.error = void 0, this.abortController?.abort();
589
588
  const s = new AbortController();
590
589
  this.abortController = s;
591
590
  try {
592
- const o = this.apiUrl ?? "https://api.maptiler.com/geocoding", r = h(this, l, Y).call(this, t), u = new URL(o + "/" + encodeURIComponent(r ? `${r.decimalLongitude},${r.decimalLatitude}` : t) + ".json"), y = u.searchParams;
591
+ const o = this.apiUrl ?? "https://api.maptiler.com/geocoding", r = h(this, l, Q).call(this, t), u = new URL(o + "/" + encodeURIComponent(r ? `${r.decimalLongitude},${r.decimalLatitude}` : t) + ".json"), y = u.searchParams;
593
592
  this.language !== void 0 && y.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
594
- const [T] = b(this, R) ?? [void 0];
593
+ const [T] = k(this, R) ?? [void 0];
595
594
  let _ = (!r || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
596
595
  (v) => typeof v == "string" ? v : T === void 0 || (v[0] ?? 0) <= T && T < (v[1] ?? 1 / 0) ? v[2] : void 0
597
596
  ).filter((v) => v !== void 0);
598
597
  _ && (_ = [...new Set(_)], y.set("types", _.join(",")));
599
- const ve = !r || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
600
- if (ve && y.set("excludeTypes", String(ve)), 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" }], be = await nt(b(this, R), v, s);
602
- be && y.set("proximity", be), (i || this.showResultsWhileTyping === !1) && y.set("autocomplete", "false"), y.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
598
+ const ye = !r || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
599
+ 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) {
600
+ const v = this.proximity ?? [{ type: "server-geolocation" }], xe = await nt(k(this, R), v, s);
601
+ xe && y.set("proximity", xe), (i || this.showResultsWhileTyping === !1) && y.set("autocomplete", "false"), y.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
603
602
  }
604
- const xe = this.limit ?? 5, J = this.reverseGeocodingLimit ?? xe;
605
- J > 1 && _?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), r ? (J === 1 || this.exhaustiveReverseGeocoding || _?.length === 1) && y.set("limit", String(J)) : y.set("limit", String(xe)), this.apiKey && y.set("key", this.apiKey), this.adjustUrl?.(u);
603
+ const ve = this.limit ?? 5, Y = this.reverseGeocodingLimit ?? ve;
604
+ Y > 1 && _?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), r ? (Y === 1 || this.exhaustiveReverseGeocoding || _?.length === 1) && y.set("limit", String(Y)) : y.set("limit", String(ve)), this.apiKey && y.set("key", this.apiKey), this.adjustUrl?.(u);
606
605
  const Ae = u.searchParams.get("types") === "" && u.searchParams.get("excludeTypes") !== "true", j = u.toString();
607
606
  if (j === this.lastSearchUrl) {
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 !== b(this, l, K)?.id && (this.selectedItemIndex = -1));
607
+ 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));
609
608
  return;
610
609
  }
611
610
  h(this, l, x).call(this, "request", { urlObj: u }), this.lastSearchUrl = j;
612
- let P;
611
+ let E;
613
612
  if (Ae)
614
- P = { type: "FeatureCollection", features: [] };
613
+ E = { type: "FeatureCollection", features: [] };
615
614
  else {
616
615
  const v = await fetch(j, {
617
616
  signal: s.signal,
@@ -619,9 +618,9 @@ H = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
619
618
  });
620
619
  if (!v.ok)
621
620
  throw new Error(await v.text());
622
- P = await v.json();
621
+ E = await v.json();
623
622
  }
624
- h(this, l, x).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)), r && this.listFeatures.unshift({
623
+ 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({
625
624
  type: "Feature",
626
625
  properties: {},
627
626
  /* eslint-disable @typescript-eslint/restrict-template-expressions */
@@ -637,7 +636,7 @@ H = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
637
636
  type: "Point",
638
637
  coordinates: [r.decimalLongitude, r.decimalLatitude]
639
638
  }
640
- }), h(this, l, x).call(this, "featureslisted", { features: this.listFeatures, external: a }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== b(this, l, K)?.id && (this.selectedItemIndex = -1), r && this.input.focus());
639
+ }), 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
640
  } catch (o) {
642
641
  if (o && typeof o == "object" && "name" in o && o.name === "AbortError")
643
642
  return;
@@ -646,32 +645,40 @@ H = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
646
645
  s === this.abortController && (this.abortController = void 0);
647
646
  }
648
647
  };
649
- Be = function(t) {
650
- 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);
648
+ Pe = function(t) {
649
+ this.reverseActive = this.enableReverse === "always", h(this, l, $).call(this), this.picked = void 0, h(this, l, ge).call(this, `${t[1].toFixed(6)}, ${lt(t[0], [-180, 180], !0).toFixed(6)}`), h(this, l, fe).call(this);
651
650
  };
652
- le = function(t) {
651
+ ae = function(t) {
653
652
  if (!this.listFeatures)
654
653
  return;
655
654
  const e = t.key === "ArrowDown" ? 1 : t.key === "ArrowUp" ? -1 : 0;
656
655
  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));
657
656
  };
658
- Ge = function(t) {
659
- h(this, l, ge).call(this, t.target.value);
657
+ Ue = function(t) {
658
+ h(this, l, me).call(this, t.target.value);
660
659
  };
661
- Re = function(t) {
660
+ Be = function(t) {
662
661
  (!this.picked || this.picked.id !== t.id) && (this.picked = t, this.searchValue = t.place_name);
663
662
  };
664
- ze = function(t) {
663
+ Ge = function(t) {
665
664
  this.selectedItemIndex = t;
666
665
  };
666
+ Re = function() {
667
+ (!this.selectFirst || this.picked) && (this.selectedItemIndex = -1), this.isFeatureListInteractedWith && (this.isFeatureListInteractedWith = !1);
668
+ };
669
+ ze = function() {
670
+ this.isFeatureListInteractedWith = !0;
671
+ };
667
672
  je = function() {
668
- (!this.selectFirst || this.picked) && (this.selectedItemIndex = -1);
673
+ setTimeout(() => {
674
+ this.isFeatureListInteractedWith = !1;
675
+ });
669
676
  };
670
- De = function() {
677
+ We = function() {
671
678
  this.searchValue = "", h(this, l, x).call(this, "queryclear"), this.picked = void 0, this.input.focus();
672
679
  };
673
680
  n.styles = I`
674
- ${ce(ut)}
681
+ ${ne(ut)}
675
682
  `;
676
683
  c([
677
684
  p({ attribute: !1 })
@@ -785,38 +792,41 @@ c([
785
792
  p({ type: String })
786
793
  ], n.prototype, "worldview", 2);
787
794
  c([
788
- We("input")
795
+ De("input")
789
796
  ], n.prototype, "input", 2);
790
797
  c([
791
- k()
798
+ b()
792
799
  ], n.prototype, "searchValue", 2);
793
800
  c([
794
- k()
801
+ b()
795
802
  ], n.prototype, "listFeatures", 2);
796
803
  c([
797
- k()
804
+ b()
798
805
  ], n.prototype, "selectedItemIndex", 2);
799
806
  c([
800
- k()
807
+ b()
801
808
  ], n.prototype, "picked", 2);
802
809
  c([
803
- k()
810
+ b()
804
811
  ], n.prototype, "cachedFeatures", 2);
805
812
  c([
806
- k()
813
+ b()
807
814
  ], n.prototype, "lastSearchUrl", 2);
808
815
  c([
809
- k()
816
+ b()
810
817
  ], n.prototype, "error", 2);
811
818
  c([
812
- k()
819
+ b()
813
820
  ], n.prototype, "abortController", 2);
814
821
  c([
815
- k()
822
+ b()
816
823
  ], n.prototype, "focused", 2);
817
824
  c([
818
- k()
819
- ], n.prototype, "focusedDelayed", 2);
825
+ b()
826
+ ], n.prototype, "isFeatureListVisible", 2);
827
+ c([
828
+ b()
829
+ ], n.prototype, "isFeatureListInteractedWith", 2);
820
830
  n = c([
821
831
  O("maptiler-geocoder")
822
832
  ], n);
@@ -864,7 +874,7 @@ var vt = Object.getOwnPropertyDescriptor, xt = (t, e, i, a) => {
864
874
  (r = t[o]) && (s = r(s) || s);
865
875
  return s;
866
876
  };
867
- let ne = class extends M {
877
+ let le = class extends F {
868
878
  render() {
869
879
  return z`
870
880
  <svg
@@ -880,15 +890,15 @@ let ne = class extends M {
880
890
  `;
881
891
  }
882
892
  };
883
- ne.styles = I`
884
- ${ce(yt)}
893
+ le.styles = I`
894
+ ${ne(yt)}
885
895
  `;
886
- ne = xt([
896
+ le = xt([
887
897
  O("maptiler-geocode-marker")
888
- ], ne);
889
- function we(t) {
898
+ ], le);
899
+ function ke(t) {
890
900
  const e = Ke(
891
- q([
901
+ D([
892
902
  Ze([
893
903
  [
894
904
  [180, 90],
@@ -904,10 +914,10 @@ function we(t) {
904
914
  if (!e)
905
915
  return;
906
916
  e.properties = { isMask: !0 };
907
- const i = N(ke(t)), a = (i[2] - i[0]) / 360 / 1e3, s = i[0] < -180, o = i[2] > 180, r = Ye(t);
917
+ const i = V(be(t)), a = (i[2] - i[0]) / 360 / 1e3, s = i[0] < -180, o = i[2] > 180, r = Ye(t);
908
918
  if (r.features.length > 1 && (s || o))
909
919
  for (const u of r.features) {
910
- const y = N(ke(u));
920
+ const y = V(be(u));
911
921
  if (o && y[0] < -180 + a)
912
922
  for (const T of u.geometry.coordinates)
913
923
  for (const _ of T)
@@ -917,7 +927,7 @@ function we(t) {
917
927
  for (const _ of T)
918
928
  _[0] -= 360 - a;
919
929
  }
920
- return q([r.features.length < 2 ? t : $e(r) ?? t, e]);
930
+ return D([r.features.length < 2 ? t : Le(r) ?? t, e]);
921
931
  }
922
932
  const bt = {
923
933
  continental_marine: 4,
@@ -962,7 +972,7 @@ const bt = {
962
972
  },
963
973
  filter: ["!", ["has", "isMask"]]
964
974
  }
965
- }, A = "mtlr-gc-full-geom", _e = "mtlr-gc-full-geom-fill", Le = "mtlr-gc-full-geom-line", wt = he.Evented, _t = he.Marker, Lt = he.Popup;
975
+ }, A = "mtlr-gc-full-geom", we = "mtlr-gc-full-geom-fill", _e = "mtlr-gc-full-geom-line", wt = ce.Evented, _t = ce.Marker, Lt = ce.Popup;
966
976
  class Rt extends wt {
967
977
  #e = {};
968
978
  #t;
@@ -1102,7 +1112,7 @@ class Rt extends wt {
1102
1112
  return super.fire({ type: e, ...i ?? {} });
1103
1113
  }
1104
1114
  #L(e) {
1105
- 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));
1115
+ 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));
1106
1116
  }
1107
1117
  #$({ detail: { features: e, external: i } }) {
1108
1118
  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"))
@@ -1111,7 +1121,7 @@ class Rt extends wt {
1111
1121
  (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,
1112
1122
  [180, 90, -180, -90]
1113
1123
  ), 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);
1114
- this.#b(N(s), 50, o);
1124
+ this.#b(V(s), 50, o);
1115
1125
  }
1116
1126
  #h(e) {
1117
1127
  if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
@@ -1128,7 +1138,7 @@ class Rt extends wt {
1128
1138
  get #I() {
1129
1139
  return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
1130
1140
  }
1131
- get #M() {
1141
+ get #F() {
1132
1142
  return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
1133
1143
  }
1134
1144
  #x(e, i) {
@@ -1140,7 +1150,7 @@ class Rt extends wt {
1140
1150
  [e[0], e[1]],
1141
1151
  [e[2], e[3]]
1142
1152
  ],
1143
- { padding: i, ...a ? { maxZoom: a } : {}, ...this.#M }
1153
+ { padding: i, ...a ? { maxZoom: a } : {}, ...this.#F }
1144
1154
  );
1145
1155
  }
1146
1156
  #k(e) {
@@ -1168,9 +1178,9 @@ class Rt extends wt {
1168
1178
  (o) => o.type === "Polygon" || o.type === "MultiPolygon"
1169
1179
  );
1170
1180
  if (s.length > 0) {
1171
- const o = $e(q(s.map((r) => Qe(r))));
1181
+ const o = Le(D(s.map((r) => Qe(r))));
1172
1182
  if (o) {
1173
- const r = we({ ...i, geometry: o.geometry });
1183
+ const r = ke({ ...i, geometry: o.geometry });
1174
1184
  r && this.#n(r);
1175
1185
  }
1176
1186
  } else {
@@ -1183,7 +1193,7 @@ class Rt extends wt {
1183
1193
  });
1184
1194
  }
1185
1195
  } else if (i?.geometry.type.endsWith("Polygon")) {
1186
- const s = we(i);
1196
+ const s = ke(i);
1187
1197
  s && this.#n(s), this.#e.pickedResultStyle === "full-geometry-including-polygon-center-marker" && a();
1188
1198
  } else i?.geometry.type.endsWith("LineString") ? this.#n(i) : i?.geometry.type.endsWith("Point") && a();
1189
1199
  if (this.#e.showResultMarkers !== !1 && this.#e.showResultMarkers !== null)
@@ -1224,17 +1234,17 @@ class Rt extends wt {
1224
1234
  return;
1225
1235
  }
1226
1236
  const e = this.#T(), i = this.#t.getSource(A);
1227
- !e?.fill && !e?.line || !i && !this.#a || (i ? i.setData(this.#a ?? q([])) : this.#a && this.#t.addSource(A, {
1237
+ !e?.fill && !e?.line || !i && !this.#a || (i ? i.setData(this.#a ?? D([])) : this.#a && this.#t.addSource(A, {
1228
1238
  type: "geojson",
1229
1239
  data: this.#a
1230
- }), !this.#t.getLayer(_e) && e.fill && this.#t.addLayer({
1240
+ }), !this.#t.getLayer(we) && e.fill && this.#t.addLayer({
1231
1241
  ...e.fill,
1232
- id: _e,
1242
+ id: we,
1233
1243
  type: "fill",
1234
1244
  source: A
1235
- }), !this.#t.getLayer(Le) && e.line && this.#t.addLayer({
1245
+ }), !this.#t.getLayer(_e) && e.line && this.#t.addLayer({
1236
1246
  ...e.line,
1237
- id: Le,
1247
+ id: _e,
1238
1248
  type: "line",
1239
1249
  source: A
1240
1250
  }));
@@ -1256,15 +1266,15 @@ export {
1256
1266
  kt as DEFAULT_GEOMETRY_STYLE,
1257
1267
  Rt as GeocodingControl,
1258
1268
  Rt as MaplibreglGeocodingControl,
1259
- ee as MaptilerGeocodeClearIconElement,
1260
- te as MaptilerGeocodeFailIconElement,
1261
- ie as MaptilerGeocodeLoadingIconElement,
1262
- ne as MaptilerGeocodeMarkerElement,
1263
- se as MaptilerGeocodeReverseGeocodingIconElement,
1264
- re as MaptilerGeocodeSearchIconElement,
1269
+ J as MaptilerGeocodeClearIconElement,
1270
+ X as MaptilerGeocodeFailIconElement,
1271
+ ee as MaptilerGeocodeLoadingIconElement,
1272
+ le as MaptilerGeocodeMarkerElement,
1273
+ te as MaptilerGeocodeReverseGeocodingIconElement,
1274
+ ie as MaptilerGeocodeSearchIconElement,
1265
1275
  n as MaptilerGeocoderElement,
1266
- _e as RESULT_LAYER_FILL,
1267
- Le as RESULT_LAYER_LINE,
1276
+ we as RESULT_LAYER_FILL,
1277
+ _e as RESULT_LAYER_LINE,
1268
1278
  A as RESULT_SOURCE,
1269
1279
  bt as ZOOM_DEFAULTS
1270
1280
  };