@maptiler/geocoding-control 2.1.6 → 3.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/CODE_OF_CONDUCT.md +46 -0
  2. package/CONTRIBUTING.md +72 -0
  3. package/README.md +36 -22
  4. package/SECURITY.md +16 -0
  5. package/dist/index.js +856 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.umd.js +263 -0
  8. package/dist/index.umd.js.map +1 -0
  9. package/dist/leaflet.public.js +1273 -0
  10. package/dist/leaflet.public.js.map +1 -0
  11. package/dist/leaflet.public.umd.js +276 -0
  12. package/dist/leaflet.public.umd.js.map +1 -0
  13. package/dist/maplibregl.js +1297 -0
  14. package/dist/maplibregl.js.map +1 -0
  15. package/dist/maplibregl.umd.js +276 -0
  16. package/dist/maplibregl.umd.js.map +1 -0
  17. package/dist/maptilersdk.js +1305 -0
  18. package/dist/maptilersdk.js.map +1 -0
  19. package/dist/maptilersdk.umd.js +276 -0
  20. package/dist/maptilersdk.umd.js.map +1 -0
  21. package/dist/src/components/clear-icon.d.ts +10 -0
  22. package/dist/src/components/fail-icon.d.ts +10 -0
  23. package/dist/src/components/loading-icon.d.ts +10 -0
  24. package/dist/src/components/marker.d.ts +10 -0
  25. package/dist/src/components/reverse-geocoding-icon.d.ts +10 -0
  26. package/dist/src/components/search-icon.d.ts +10 -0
  27. package/dist/src/controls/leaflet-control.d.ts +58 -0
  28. package/dist/src/controls/leaflet-events.d.ts +42 -0
  29. package/dist/src/controls/leaflet-options.d.ts +84 -0
  30. package/dist/src/controls/maplibregl-control.d.ts +55 -0
  31. package/dist/src/controls/maplibregl-events.d.ts +44 -0
  32. package/dist/src/controls/maplibregl-options.d.ts +104 -0
  33. package/dist/src/controls/maptilersdk-control.d.ts +6 -0
  34. package/dist/src/controls/maptilersdk-events.d.ts +2 -0
  35. package/dist/src/controls/maptilersdk-options.d.ts +10 -0
  36. package/dist/src/geocoder/geocoder-events.d.ts +46 -0
  37. package/dist/src/geocoder/geocoder-feature-item.d.ts +22 -0
  38. package/{svelte/types.d.ts → dist/src/geocoder/geocoder-options.d.ts} +12 -148
  39. package/dist/src/geocoder/geocoder.d.ts +112 -0
  40. package/dist/src/index.d.ts +9 -0
  41. package/dist/src/leaflet.public.d.ts +7 -0
  42. package/dist/src/maplibregl.d.ts +7 -0
  43. package/dist/src/maptilersdk.d.ts +7 -0
  44. package/dist/src/types.d.ts +45 -0
  45. package/dist/src/utils/geo-utils.d.ts +6 -0
  46. package/dist/src/utils/mask.d.ts +2 -0
  47. package/dist/src/utils/proximity.d.ts +2 -0
  48. package/package.json +84 -116
  49. package/MapLibreBasedGeocodingControl.d.ts +0 -3072
  50. package/geo-coordinates-parser.t.d.ts +0 -8
  51. package/geoUtils.d.ts +0 -3
  52. package/leaflet-controller.d.ts +0 -12
  53. package/leaflet-controller.js +0 -2475
  54. package/leaflet-controller.js.map +0 -1
  55. package/leaflet-controller.umd.js +0 -2
  56. package/leaflet-controller.umd.js.map +0 -1
  57. package/leaflet.d.ts +0 -131
  58. package/leaflet.js +0 -5055
  59. package/leaflet.js.map +0 -1
  60. package/leaflet.umd.js +0 -14
  61. package/leaflet.umd.js.map +0 -1
  62. package/maplibregl-controller.d.ts +0 -19
  63. package/maplibregl-controller.js +0 -2418
  64. package/maplibregl-controller.js.map +0 -1
  65. package/maplibregl-controller.umd.js +0 -2
  66. package/maplibregl-controller.umd.js.map +0 -1
  67. package/maplibregl.d.ts +0 -2509
  68. package/maplibregl.js +0 -5115
  69. package/maplibregl.js.map +0 -1
  70. package/maplibregl.umd.js +0 -14
  71. package/maplibregl.umd.js.map +0 -1
  72. package/maptilersdk.d.ts +0 -2504
  73. package/maptilersdk.js +0 -5125
  74. package/maptilersdk.js.map +0 -1
  75. package/maptilersdk.umd.js +0 -14
  76. package/maptilersdk.umd.js.map +0 -1
  77. package/mask.d.ts +0 -2
  78. package/openlayers-controller.d.ts +0 -15
  79. package/openlayers-controller.js +0 -2174
  80. package/openlayers-controller.js.map +0 -1
  81. package/openlayers-controller.umd.js +0 -2
  82. package/openlayers-controller.umd.js.map +0 -1
  83. package/openlayers.d.ts +0 -109
  84. package/openlayers.js +0 -5018
  85. package/openlayers.js.map +0 -1
  86. package/openlayers.umd.js +0 -14
  87. package/openlayers.umd.js.map +0 -1
  88. package/proximity.d.ts +0 -2
  89. package/react.d.ts +0 -45
  90. package/react.js +0 -2768
  91. package/react.js.map +0 -1
  92. package/react.umd.js +0 -14
  93. package/react.umd.js.map +0 -1
  94. package/style.css +0 -1
  95. package/svelte/ClearIcon.svelte +0 -12
  96. package/svelte/ClearIcon.svelte.d.ts +0 -25
  97. package/svelte/FailIcon.svelte +0 -12
  98. package/svelte/FailIcon.svelte.d.ts +0 -25
  99. package/svelte/FeatureItem.svelte +0 -246
  100. package/svelte/FeatureItem.svelte.d.ts +0 -26
  101. package/svelte/GeocodingControl.svelte +0 -919
  102. package/svelte/GeocodingControl.svelte.d.ts +0 -105
  103. package/svelte/LoadingIcon.svelte +0 -40
  104. package/svelte/LoadingIcon.svelte.d.ts +0 -25
  105. package/svelte/MapLibreBasedGeocodingControl.d.ts +0 -3072
  106. package/svelte/MapLibreBasedGeocodingControl.js +0 -210
  107. package/svelte/MarkerIcon.svelte +0 -71
  108. package/svelte/MarkerIcon.svelte.d.ts +0 -18
  109. package/svelte/ReverseGeocodingIcon.svelte +0 -12
  110. package/svelte/ReverseGeocodingIcon.svelte.d.ts +0 -25
  111. package/svelte/SearchIcon.svelte +0 -26
  112. package/svelte/SearchIcon.svelte.d.ts +0 -25
  113. package/svelte/geo-coordinates-parser.t.d.ts +0 -8
  114. package/svelte/geo-coordinates-parser.t.js +0 -1
  115. package/svelte/geoUtils.d.ts +0 -3
  116. package/svelte/geoUtils.js +0 -18
  117. package/svelte/info.json +0 -1
  118. package/svelte/leaflet-controller.d.ts +0 -12
  119. package/svelte/leaflet-controller.js +0 -274
  120. package/svelte/leaflet.d.ts +0 -131
  121. package/svelte/leaflet.js +0 -116
  122. package/svelte/maplibregl-controller.d.ts +0 -19
  123. package/svelte/maplibregl-controller.js +0 -279
  124. package/svelte/maplibregl.d.ts +0 -2509
  125. package/svelte/maplibregl.js +0 -17
  126. package/svelte/maptilersdk.d.ts +0 -2504
  127. package/svelte/maptilersdk.js +0 -32
  128. package/svelte/mask.d.ts +0 -2
  129. package/svelte/mask.js +0 -54
  130. package/svelte/openlayers-controller.d.ts +0 -15
  131. package/svelte/openlayers-controller.js +0 -283
  132. package/svelte/openlayers.d.ts +0 -109
  133. package/svelte/openlayers.js +0 -178
  134. package/svelte/proximity.d.ts +0 -2
  135. package/svelte/proximity.js +0 -60
  136. package/svelte/react.d.ts +0 -45
  137. package/svelte/react.js +0 -106
  138. package/svelte/types.js +0 -1
  139. package/svelte/vanilla.d.ts +0 -61
  140. package/svelte/vanilla.js +0 -101
  141. package/svelte/vite-env.d.ts +0 -2
  142. package/types.d.ts +0 -391
  143. package/vanilla.d.ts +0 -61
  144. package/vanilla.js +0 -2772
  145. package/vanilla.js.map +0 -1
  146. package/vanilla.umd.js +0 -14
  147. package/vanilla.umd.js.map +0 -1
  148. /package/{icons → dist/icons}/10pin.svg +0 -0
  149. /package/{icons → dist/icons}/9pin.svg +0 -0
  150. /package/{icons → dist/icons}/advertising_column.svg +0 -0
  151. /package/{icons → dist/icons}/aerodrome.svg +0 -0
  152. /package/{icons → dist/icons}/alcohol.svg +0 -0
  153. /package/{icons → dist/icons}/alpine_hut.svg +0 -0
  154. /package/{icons → dist/icons}/amusement_arcade.svg +0 -0
  155. /package/{icons → dist/icons}/amusement_park.svg +0 -0
  156. /package/{icons → dist/icons}/apartment.svg +0 -0
  157. /package/{icons → dist/icons}/archaeological_site.svg +0 -0
  158. /package/{icons → dist/icons}/area.svg +0 -0
  159. /package/{icons → dist/icons}/art.svg +0 -0
  160. /package/{icons → dist/icons}/arts_centre.svg +0 -0
  161. /package/{icons → dist/icons}/artwork.svg +0 -0
  162. /package/{icons → dist/icons}/audioguide.svg +0 -0
  163. /package/{icons → dist/icons}/bag.svg +0 -0
  164. /package/{icons → dist/icons}/beauty.svg +0 -0
  165. /package/{icons → dist/icons}/bed.svg +0 -0
  166. /package/{icons → dist/icons}/bell_tower.svg +0 -0
  167. /package/{icons → dist/icons}/beverages.svg +0 -0
  168. /package/{icons → dist/icons}/bicycle_repair_station.svg +0 -0
  169. /package/{icons → dist/icons}/biergarten.svg +0 -0
  170. /package/{icons → dist/icons}/bird_hide.svg +0 -0
  171. /package/{icons → dist/icons}/boat_rental.svg +0 -0
  172. /package/{icons → dist/icons}/bookmaker.svg +0 -0
  173. /package/{icons → dist/icons}/books.svg +0 -0
  174. /package/{icons → dist/icons}/bowl.svg +0 -0
  175. /package/{icons → dist/icons}/bowling_alley.svg +0 -0
  176. /package/{icons → dist/icons}/bunker.svg +0 -0
  177. /package/{icons → dist/icons}/bureau_de_change.svg +0 -0
  178. /package/{icons → dist/icons}/bus_station.svg +0 -0
  179. /package/{icons → dist/icons}/bust.svg +0 -0
  180. /package/{icons → dist/icons}/camping.svg +0 -0
  181. /package/{icons → dist/icons}/car_parts.svg +0 -0
  182. /package/{icons → dist/icons}/car_wash.svg +0 -0
  183. /package/{icons → dist/icons}/caravan_park.svg +0 -0
  184. /package/{icons → dist/icons}/carpet.svg +0 -0
  185. /package/{icons → dist/icons}/cattle_grid.svg +0 -0
  186. /package/{icons → dist/icons}/cave_entrance.svg +0 -0
  187. /package/{icons → dist/icons}/chalet.svg +0 -0
  188. /package/{icons → dist/icons}/charity.svg +0 -0
  189. /package/{icons → dist/icons}/chemist.svg +0 -0
  190. /package/{icons → dist/icons}/chimney.svg +0 -0
  191. /package/{icons → dist/icons}/church.svg +0 -0
  192. /package/{icons → dist/icons}/city_gate.svg +0 -0
  193. /package/{icons → dist/icons}/clinic.svg +0 -0
  194. /package/{icons → dist/icons}/clothes.svg +0 -0
  195. /package/{icons → dist/icons}/coffee.svg +0 -0
  196. /package/{icons → dist/icons}/community_centre.svg +0 -0
  197. /package/{icons → dist/icons}/computer.svg +0 -0
  198. /package/{icons → dist/icons}/consulate.svg +0 -0
  199. /package/{icons → dist/icons}/copyshop.svg +0 -0
  200. /package/{icons → dist/icons}/cosmetics.svg +0 -0
  201. /package/{icons → dist/icons}/courthouse.svg +0 -0
  202. /package/{icons → dist/icons}/crane.svg +0 -0
  203. /package/{icons → dist/icons}/dairy.svg +0 -0
  204. /package/{icons → dist/icons}/deli.svg +0 -0
  205. /package/{icons → dist/icons}/department_store.svg +0 -0
  206. /package/{icons → dist/icons}/diy.svg +0 -0
  207. /package/{icons → dist/icons}/electronics.svg +0 -0
  208. /package/{icons → dist/icons}/embankment.svg +0 -0
  209. /package/{icons → dist/icons}/embassy.svg +0 -0
  210. /package/{icons → dist/icons}/excrement_bags.svg +0 -0
  211. /package/{icons → dist/icons}/fabric.svg +0 -0
  212. /package/{icons → dist/icons}/farmyard.svg +0 -0
  213. /package/{icons → dist/icons}/ferry.svg +0 -0
  214. /package/{icons → dist/icons}/firepit.svg +0 -0
  215. /package/{icons → dist/icons}/firestation.svg +0 -0
  216. /package/{icons → dist/icons}/fishing.svg +0 -0
  217. /package/{icons → dist/icons}/fitness.svg +0 -0
  218. /package/{icons → dist/icons}/ford.svg +0 -0
  219. /package/{icons → dist/icons}/fort.svg +0 -0
  220. /package/{icons → dist/icons}/fortress.svg +0 -0
  221. /package/{icons → dist/icons}/full-height_turnstile.svg +0 -0
  222. /package/{icons → dist/icons}/generator_wind.svg +0 -0
  223. /package/{icons → dist/icons}/golf_pin.svg +0 -0
  224. /package/{icons → dist/icons}/greengrocer.svg +0 -0
  225. /package/{icons → dist/icons}/guest_house.svg +0 -0
  226. /package/{icons → dist/icons}/helipad.svg +0 -0
  227. /package/{icons → dist/icons}/hifi.svg +0 -0
  228. /package/{icons → dist/icons}/hostel.svg +0 -0
  229. /package/{icons → dist/icons}/hotel.svg +0 -0
  230. /package/{icons → dist/icons}/housenumber.svg +0 -0
  231. /package/{icons → dist/icons}/houseware.svg +0 -0
  232. /package/{icons → dist/icons}/hunting_stand.svg +0 -0
  233. /package/{icons → dist/icons}/interior_decoration.svg +0 -0
  234. /package/{icons → dist/icons}/internet_cafe.svg +0 -0
  235. /package/{icons → dist/icons}/kindergarten.svg +0 -0
  236. /package/{icons → dist/icons}/kissing_gate.svg +0 -0
  237. /package/{icons → dist/icons}/manor.svg +0 -0
  238. /package/{icons → dist/icons}/map.svg +0 -0
  239. /package/{icons → dist/icons}/marker_reverse.svg +0 -0
  240. /package/{icons → dist/icons}/marker_selected.svg +0 -0
  241. /package/{icons → dist/icons}/marker_unselected.svg +0 -0
  242. /package/{icons → dist/icons}/marketplace.svg +0 -0
  243. /package/{icons → dist/icons}/massage.svg +0 -0
  244. /package/{icons → dist/icons}/mast.svg +0 -0
  245. /package/{icons → dist/icons}/mast_communications.svg +0 -0
  246. /package/{icons → dist/icons}/mast_lighting.svg +0 -0
  247. /package/{icons → dist/icons}/medical_supply.svg +0 -0
  248. /package/{icons → dist/icons}/memorial.svg +0 -0
  249. /package/{icons → dist/icons}/miniature_golf.svg +0 -0
  250. /package/{icons → dist/icons}/motel.svg +0 -0
  251. /package/{icons → dist/icons}/mountain_range.svg +0 -0
  252. /package/{icons → dist/icons}/multifaith.svg +0 -0
  253. /package/{icons → dist/icons}/musical_instrument.svg +0 -0
  254. /package/{icons → dist/icons}/newsagent.svg +0 -0
  255. /package/{icons → dist/icons}/nightclub.svg +0 -0
  256. /package/{icons → dist/icons}/ocean.svg +0 -0
  257. /package/{icons → dist/icons}/office.svg +0 -0
  258. /package/{icons → dist/icons}/outdoor_seating.svg +0 -0
  259. /package/{icons → dist/icons}/palace.svg +0 -0
  260. /package/{icons → dist/icons}/parcel_locker.svg +0 -0
  261. /package/{icons → dist/icons}/parking_space.svg +0 -0
  262. /package/{icons → dist/icons}/parking_tickets.svg +0 -0
  263. /package/{icons → dist/icons}/pet.svg +0 -0
  264. /package/{icons → dist/icons}/photo.svg +0 -0
  265. /package/{icons → dist/icons}/picnic.svg +0 -0
  266. /package/{icons → dist/icons}/plaque.svg +0 -0
  267. /package/{icons → dist/icons}/poi.svg +0 -0
  268. /package/{icons → dist/icons}/post_box.svg +0 -0
  269. /package/{icons → dist/icons}/post_office.svg +0 -0
  270. /package/{icons → dist/icons}/postal_code.svg +0 -0
  271. /package/{icons → dist/icons}/pub.svg +0 -0
  272. /package/{icons → dist/icons}/public_bath.svg +0 -0
  273. /package/{icons → dist/icons}/public_bookcase.svg +0 -0
  274. /package/{icons → dist/icons}/public_building.svg +0 -0
  275. /package/{icons → dist/icons}/public_transport_tickets.svg +0 -0
  276. /package/{icons → dist/icons}/reverse.svg +0 -0
  277. /package/{icons → dist/icons}/river.svg +0 -0
  278. /package/{icons → dist/icons}/road.svg +0 -0
  279. /package/{icons → dist/icons}/saddle.svg +0 -0
  280. /package/{icons → dist/icons}/sauna.svg +0 -0
  281. /package/{icons → dist/icons}/sea.svg +0 -0
  282. /package/{icons → dist/icons}/second_hand.svg +0 -0
  283. /package/{icons → dist/icons}/shintoist.svg +0 -0
  284. /package/{icons → dist/icons}/shoe.svg +0 -0
  285. /package/{icons → dist/icons}/shower.svg +0 -0
  286. /package/{icons → dist/icons}/shrine.svg +0 -0
  287. /package/{icons → dist/icons}/sikhist.svg +0 -0
  288. /package/{icons → dist/icons}/slipway.svg +0 -0
  289. /package/{icons → dist/icons}/snowmobile.svg +0 -0
  290. /package/{icons → dist/icons}/social_facility.svg +0 -0
  291. /package/{icons → dist/icons}/sports.svg +0 -0
  292. /package/{icons → dist/icons}/sprite.json +0 -0
  293. /package/{icons → dist/icons}/sprite.png +0 -0
  294. /package/{icons → dist/icons}/sprite@2x.json +0 -0
  295. /package/{icons → dist/icons}/sprite@2x.png +0 -0
  296. /package/{icons → dist/icons}/stationery.svg +0 -0
  297. /package/{icons → dist/icons}/stile.svg +0 -0
  298. /package/{icons → dist/icons}/stone.svg +0 -0
  299. /package/{icons → dist/icons}/storage_tank.svg +0 -0
  300. /package/{icons → dist/icons}/stream.svg +0 -0
  301. /package/{icons → dist/icons}/street.svg +0 -0
  302. /package/{icons → dist/icons}/supermarket.svg +0 -0
  303. /package/{icons → dist/icons}/tea.svg +0 -0
  304. /package/{icons → dist/icons}/telescope_dish.svg +0 -0
  305. /package/{icons → dist/icons}/telescope_dome.svg +0 -0
  306. /package/{icons → dist/icons}/ticket.svg +0 -0
  307. /package/{icons → dist/icons}/tobacco.svg +0 -0
  308. /package/{icons → dist/icons}/tower_cantilever_communication.svg +0 -0
  309. /package/{icons → dist/icons}/tower_cooling.svg +0 -0
  310. /package/{icons → dist/icons}/tower_dish.svg +0 -0
  311. /package/{icons → dist/icons}/tower_dome.svg +0 -0
  312. /package/{icons → dist/icons}/tower_generic.svg +0 -0
  313. /package/{icons → dist/icons}/tower_lattice.svg +0 -0
  314. /package/{icons → dist/icons}/tower_lattice_communication.svg +0 -0
  315. /package/{icons → dist/icons}/tower_lattice_lighting.svg +0 -0
  316. /package/{icons → dist/icons}/tower_lighting.svg +0 -0
  317. /package/{icons → dist/icons}/townhall.svg +0 -0
  318. /package/{icons → dist/icons}/toys.svg +0 -0
  319. /package/{icons → dist/icons}/trade.svg +0 -0
  320. /package/{icons → dist/icons}/traffic_light.svg +0 -0
  321. /package/{icons → dist/icons}/train_station.svg +0 -0
  322. /package/{icons → dist/icons}/travel_agency.svg +0 -0
  323. /package/{icons → dist/icons}/tyres.svg +0 -0
  324. /package/{icons → dist/icons}/university.svg +0 -0
  325. /package/{icons → dist/icons}/variety_store.svg +0 -0
  326. /package/{icons → dist/icons}/vehicle_inspection.svg +0 -0
  327. /package/{icons → dist/icons}/vending_machine.svg +0 -0
  328. /package/{icons → dist/icons}/video.svg +0 -0
  329. /package/{icons → dist/icons}/video_games.svg +0 -0
  330. /package/{icons → dist/icons}/waste_disposal.svg +0 -0
  331. /package/{icons → dist/icons}/water_well.svg +0 -0
  332. /package/{icons → dist/icons}/waterfall.svg +0 -0
  333. /package/{icons → dist/icons}/wilderness_hut.svg +0 -0
@@ -0,0 +1,1297 @@
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 b, query as Ae } from "lit/decorators.js";
3
+ import { convert as We } from "geo-coordinates-parser";
4
+ import { classMap as D } from "lit/directives/class-map.js";
5
+ import { repeat as Ve } from "lit/directives/repeat.js";
6
+ import "@turf/clone";
7
+ import { styleMap as qe } from "lit/directives/style-map.js";
8
+ import { featureCollection as q, polygon as Ke, feature as Ne } from "@turf/helpers";
9
+ import Le from "@turf/union";
10
+ import he from "maplibre-gl";
11
+ import be from "@turf/bbox";
12
+ import Ze from "@turf/difference";
13
+ import Qe from "@turf/flatten";
14
+ var Ye = Object.getOwnPropertyDescriptor, He = (t, e, i, o) => {
15
+ for (var r = o > 1 ? void 0 : o ? Ye(e, i) : e, s = t.length - 1, a; s >= 0; s--)
16
+ (a = t[s]) && (r = a(r) || r);
17
+ return r;
18
+ };
19
+ let ee = class extends M {
20
+ render() {
21
+ return z`
22
+ <svg viewBox="0 0 14 14" width="13" height="13">
23
+ <path
24
+ d="M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"
25
+ />
26
+ </svg>
27
+ `;
28
+ }
29
+ };
30
+ ee.styles = I`
31
+ svg {
32
+ display: block;
33
+ fill: var(--color-icon-button);
34
+ }
35
+ `;
36
+ ee = He([
37
+ O("maptiler-geocode-clear-icon")
38
+ ], ee);
39
+ var Je = Object.getOwnPropertyDescriptor, Xe = (t, e, i, o) => {
40
+ for (var r = o > 1 ? void 0 : o ? Je(e, i) : e, s = t.length - 1, a; s >= 0; s--)
41
+ (a = t[s]) && (r = a(r) || r);
42
+ return r;
43
+ };
44
+ let te = class extends M {
45
+ render() {
46
+ return z`
47
+ <svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
48
+ <path
49
+ d="M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"
50
+ />
51
+ </svg>
52
+ `;
53
+ }
54
+ };
55
+ te.styles = I`
56
+ svg {
57
+ display: block;
58
+ fill: #e15042;
59
+ }
60
+ `;
61
+ te = Xe([
62
+ O("maptiler-geocode-fail-icon")
63
+ ], te);
64
+ var et = Object.getOwnPropertyDescriptor, tt = (t, e, i, o) => {
65
+ for (var r = o > 1 ? void 0 : o ? et(e, i) : e, s = t.length - 1, a; s >= 0; s--)
66
+ (a = t[s]) && (r = a(r) || r);
67
+ return r;
68
+ };
69
+ let ie = class extends M {
70
+ render() {
71
+ return m`
72
+ <div>
73
+ <svg viewBox="0 0 18 18" width="24" height="24" class="loading-icon">
74
+ <path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z" />
75
+ <path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z" />
76
+ </svg>
77
+ </div>
78
+ `;
79
+ }
80
+ };
81
+ ie.styles = I`
82
+ div {
83
+ position: absolute;
84
+ left: 50%;
85
+ top: 50%;
86
+ transform: translate(-50%, -50%);
87
+ pointer-events: none;
88
+
89
+ display: flex;
90
+ align-items: center;
91
+ }
92
+
93
+ .loading-icon {
94
+ animation: rotate 0.8s infinite cubic-bezier(0.45, 0.05, 0.55, 0.95);
95
+ }
96
+
97
+ @keyframes rotate {
98
+ from {
99
+ -webkit-transform: rotate(0);
100
+ transform: rotate(0);
101
+ }
102
+ to {
103
+ -webkit-transform: rotate(360deg);
104
+ transform: rotate(360deg);
105
+ }
106
+ }
107
+ `;
108
+ ie = tt([
109
+ O("maptiler-geocode-loading-icon")
110
+ ], ie);
111
+ var it = Object.getOwnPropertyDescriptor, st = (t, e, i, o) => {
112
+ for (var r = o > 1 ? void 0 : o ? it(e, i) : e, s = t.length - 1, a; s >= 0; s--)
113
+ (a = t[s]) && (r = a(r) || r);
114
+ return r;
115
+ };
116
+ let se = class extends M {
117
+ render() {
118
+ return z`
119
+ <svg viewBox="0 0 60.006 21.412" width="14" height="20">
120
+ <path
121
+ d="M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"
122
+ />
123
+ </svg>
124
+ `;
125
+ }
126
+ };
127
+ se.styles = I`
128
+ svg {
129
+ display: block;
130
+ fill: var(--color-icon-button);
131
+ }
132
+ `;
133
+ se = st([
134
+ O("maptiler-geocode-reverse-geocoding-icon")
135
+ ], se);
136
+ var rt = Object.getOwnPropertyDescriptor, ot = (t, e, i, o) => {
137
+ for (var r = o > 1 ? void 0 : o ? rt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
138
+ (a = t[s]) && (r = a(r) || r);
139
+ return r;
140
+ };
141
+ let re = class extends M {
142
+ render() {
143
+ return z`
144
+ <svg
145
+ xmlns="http://www.w3.org/2000/svg"
146
+ width="13"
147
+ height="13"
148
+ viewBox="0 0 13 13"
149
+ >
150
+ <circle cx="4.789" cy="4.787" r="3.85" />
151
+ <path d="M12.063 12.063 7.635 7.635" />
152
+ </svg>
153
+ `;
154
+ }
155
+ };
156
+ re.styles = I`
157
+ circle {
158
+ stroke-width: 1.875;
159
+ fill: none;
160
+ }
161
+
162
+ path {
163
+ stroke-width: 1.875;
164
+ stroke-linecap: round;
165
+ }
166
+
167
+ svg {
168
+ display: block;
169
+ stroke: var(--color-icon-button);
170
+ }
171
+ `;
172
+ re = ot([
173
+ O("maptiler-geocode-search-icon")
174
+ ], re);
175
+ function at(t, e, i) {
176
+ const o = e[1], r = e[0], s = o - r;
177
+ return t === o && i ? t : ((t - r) % s + s) % s + r;
178
+ }
179
+ function K(t) {
180
+ const e = [...t];
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
+ }
183
+ let U;
184
+ async function lt(t, e, i) {
185
+ for (const o of e ?? [])
186
+ if (!(t && (o.minZoom != null && o.minZoom > t[0] || o.maxZoom != null && o.maxZoom < t[0]))) {
187
+ if (o.type === "fixed")
188
+ return o.coordinates.join(",");
189
+ if (o.type === "client-geolocation")
190
+ if (U && o.cachedLocationExpiry && U.time + o.cachedLocationExpiry > Date.now()) {
191
+ if (U.coords)
192
+ return U.coords;
193
+ } else {
194
+ let r;
195
+ try {
196
+ return r = await new Promise((s, a) => {
197
+ i.signal.addEventListener("abort", () => {
198
+ a(Error("aborted"));
199
+ }), navigator.geolocation.getCurrentPosition(
200
+ (f) => {
201
+ s([f.coords.longitude, f.coords.latitude].map((L) => L.toFixed(6)).join(","));
202
+ },
203
+ (f) => {
204
+ a(f);
205
+ },
206
+ o
207
+ );
208
+ }), r;
209
+ } catch {
210
+ } finally {
211
+ o.cachedLocationExpiry && (U = {
212
+ time: Date.now(),
213
+ coords: r
214
+ });
215
+ }
216
+ if (i.signal.aborted)
217
+ return;
218
+ }
219
+ if (o.type === "server-geolocation")
220
+ return "ip";
221
+ if (t && o.type === "map-center")
222
+ return t[1].toFixed(6) + "," + t[2].toFixed(6);
223
+ }
224
+ }
225
+ const nt = ".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 ct = Object.defineProperty, ht = Object.getOwnPropertyDescriptor, $e = (t) => {
227
+ throw TypeError(t);
228
+ }, _ = (t, e, i, o) => {
229
+ for (var r = o > 1 ? void 0 : o ? ht(e, i) : e, s = t.length - 1, a; s >= 0; s--)
230
+ (a = t[s]) && (r = (o ? a(e, i, r) : a(r)) || r);
231
+ return o && r && ct(e, i, r), r;
232
+ }, 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)), pt = (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, N, G, g, Me, Oe, pe, oe;
233
+ const Se = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Te = Se ? "@2x" : "", C = Se ? 2 : 1;
234
+ let S, Ce, k = class extends M {
235
+ constructor() {
236
+ super(...arguments), pt(this, d), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
237
+ }
238
+ willUpdate(t) {
239
+ t.has("feature") && u(this, d, N) && (this.index = u(this, d, N).length, E(this, d, pe).call(this));
240
+ }
241
+ render() {
242
+ return m`
243
+ <li
244
+ tabindex="-1"
245
+ role="option"
246
+ aria-selected=${this.itemStyle === "selected"}
247
+ aria-checked=${this.itemStyle === "picked"}
248
+ class=${this.itemStyle}
249
+ @click=${() => this.dispatchEvent(new CustomEvent("select"))}
250
+ >
251
+ ${S && this.spriteIcon ? m`
252
+ <div
253
+ class="sprite-icon"
254
+ style=${qe({
255
+ width: `${this.spriteIcon.width / C}px`,
256
+ height: `${this.spriteIcon.height / C}px`,
257
+ backgroundImage: `url(${this.iconsBaseUrl}sprite${Te}.png)`,
258
+ backgroundPosition: `-${this.spriteIcon.x / C}px -${this.spriteIcon.y / C}px`,
259
+ backgroundSize: `${S.width / C}px ${S.height / C}px`
260
+ })}
261
+ title=${u(this, d, g)}
262
+ />
263
+ ` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${u(this, d, g)} @error=${E(this, d, Oe)} />` : 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
+
265
+ <span class="texts">
266
+ <span>
267
+ <span class="primary"> ${u(this, d, G) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
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) && !u(this, d, G) ? m` <span class="secondary"> ${u(this, d, g)} </span> ` : X}
270
+ </span>
271
+
272
+ <span class="line2"> ${u(this, d, G) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
273
+ </span>
274
+ </li>
275
+ `;
276
+ }
277
+ };
278
+ d = /* @__PURE__ */ new WeakSet();
279
+ N = function() {
280
+ return this.feature?.properties?.categories;
281
+ };
282
+ G = function() {
283
+ return this.feature?.place_type[0] === "reverse";
284
+ };
285
+ g = function() {
286
+ return this.feature?.properties?.categories?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
287
+ };
288
+ Me = function() {
289
+ Ce ??= fetch(`${this.iconsBaseUrl}sprite${Te}.json`).then((t) => t.json()).then((t) => {
290
+ S = t;
291
+ }).catch(() => {
292
+ S = null;
293
+ });
294
+ };
295
+ Oe = function() {
296
+ this.imageUrl && this.missingIconsCache.add(this.imageUrl), E(this, d, pe).call(this);
297
+ };
298
+ pe = function() {
299
+ S !== void 0 ? E(this, d, oe).call(this) : (E(this, d, Me).call(this), Ce?.then(() => {
300
+ E(this, d, oe).call(this);
301
+ }));
302
+ };
303
+ oe = function() {
304
+ do {
305
+ if (this.index--, this.category = u(this, d, N)?.[this.index], this.spriteIcon = this.category ? S?.icons[this.category] : void 0, this.spriteIcon)
306
+ break;
307
+ this.imageUrl = this.category ? this.iconsBaseUrl + this.category.replace(/ /g, "_") + ".svg" : void 0;
308
+ } while (this.index > -1 && (!this.imageUrl || this.missingIconsCache.has(this.imageUrl)));
309
+ };
310
+ k.styles = I`
311
+ ${ce(nt)}
312
+ `;
313
+ _([
314
+ p({ type: Object })
315
+ ], k.prototype, "feature", 2);
316
+ _([
317
+ p({ type: String })
318
+ ], k.prototype, "itemStyle", 2);
319
+ _([
320
+ p({ type: String })
321
+ ], k.prototype, "showPlaceType", 2);
322
+ _([
323
+ p({ attribute: !1 })
324
+ ], k.prototype, "missingIconsCache", 2);
325
+ _([
326
+ p({ type: String })
327
+ ], k.prototype, "iconsBaseUrl", 2);
328
+ _([
329
+ b()
330
+ ], k.prototype, "category", 2);
331
+ _([
332
+ b()
333
+ ], k.prototype, "imageUrl", 2);
334
+ _([
335
+ b()
336
+ ], k.prototype, "spriteIcon", 2);
337
+ _([
338
+ b()
339
+ ], k.prototype, "index", 2);
340
+ k = _([
341
+ O("maptiler-geocoder-feature-item")
342
+ ], k);
343
+ const dt = "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 ut = Object.defineProperty, ft = Object.getOwnPropertyDescriptor, Fe = (t) => {
345
+ throw TypeError(t);
346
+ }, c = (t, e, i, o) => {
347
+ for (var r = o > 1 ? void 0 : o ? ft(e, i) : e, s = t.length - 1, a; s >= 0; s--)
348
+ (a = t[s]) && (r = (o ? a(e, i, r) : a(r)) || r);
349
+ return o && r && ut(e, i, r), r;
350
+ }, 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), Z, V, B, ae, R, l, Q, Ee, Pe, ue, v, fe, Y, me, ge, $, ye, H, Ue, le, Ge, Be, Re, ze, je;
351
+ let n = class extends M {
352
+ constructor() {
353
+ 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, Z, !1), F(this, V, !1), F(this, B), F(this, ae, /* @__PURE__ */ new Set()), F(this, R);
354
+ }
355
+ firstUpdated() {
356
+ W(this, Z, !0);
357
+ }
358
+ /**
359
+ * Set the options of this instance.
360
+ *
361
+ * @param options options to set
362
+ */
363
+ setOptions(t) {
364
+ const e = { ...t };
365
+ for (const i of Object.keys(e))
366
+ mt.includes(i) || delete e[i];
367
+ Object.assign(this, e);
368
+ }
369
+ /**
370
+ * Set the content of search input box.
371
+ *
372
+ * @param value text to set
373
+ */
374
+ setQuery(t) {
375
+ h(this, l, ge).call(this, t), h(this, l, me).call(this);
376
+ }
377
+ /**
378
+ * Set the content of search input box and immediately submit it.
379
+ *
380
+ * @param value text to set and submit
381
+ */
382
+ submitQuery(t) {
383
+ h(this, l, ye).call(this, t);
384
+ }
385
+ /**
386
+ * Clear search result list.
387
+ */
388
+ clearList() {
389
+ h(this, l, $).call(this), this.picked = void 0, this.selectedItemIndex = -1;
390
+ }
391
+ /**
392
+ * Focus the search input box.
393
+ *
394
+ * @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
395
+ */
396
+ focus(t) {
397
+ this.input.focus(t);
398
+ }
399
+ /**
400
+ * Blur the search input box.
401
+ */
402
+ blur() {
403
+ this.input.blur();
404
+ }
405
+ addEventListener(t, e, i) {
406
+ super.addEventListener(t, e, i);
407
+ }
408
+ removeEventListener(t, e, i) {
409
+ super.removeEventListener(t, e, i);
410
+ }
411
+ /** @internal */
412
+ handleMapChange(t) {
413
+ W(this, R, t);
414
+ }
415
+ /** @internal */
416
+ handleMapClick(t) {
417
+ this.reverseActive && h(this, l, Ue).call(this, t);
418
+ }
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)) && x(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, v).call(this, "select", { feature: x(this, l, Q) }), ["picked"].some((e) => t.has(e)) && this.picked && (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(
423
+ () => {
424
+ h(this, l, v).call(this, "pick", { feature: this.picked });
425
+ },
426
+ (e) => {
427
+ e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, l, v).call(this, "pick", { feature: this.picked }));
428
+ }
429
+ ), ["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 });
430
+ }
431
+ render() {
432
+ return m`
433
+ <form @submit=${h(this, l, fe)} class=${D({ "can-collapse": this.collapsed && this.searchValue === "" })}>
434
+ <div class="input-group">
435
+ <button
436
+ class="search-button"
437
+ type="button"
438
+ @click=${() => {
439
+ this.input.focus();
440
+ }}
441
+ >
442
+ <maptiler-geocode-search-icon></maptiler-geocode-search-icon>
443
+ </button>
444
+
445
+ <input
446
+ .value=${this.searchValue}
447
+ @focus=${() => this.focused = !0}
448
+ @blur=${() => this.focused = !1}
449
+ @click=${() => this.focused = !0}
450
+ @keydown=${h(this, l, le)}
451
+ @input=${h(this, l, Ge)}
452
+ @change=${() => this.picked = void 0}
453
+ placeholder=${this.placeholder ?? "Search"}
454
+ aria-label=${this.placeholder ?? "Search"}
455
+ />
456
+
457
+ <div class="clear-button-container ${D({ displayable: this.searchValue !== "" })}">
458
+ ${x(this, l, Pe) ? m`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : m`
459
+ <button type="button" @click=${h(this, l, je)} title=${this.clearButtonTitle ?? "clear"}>
460
+ <maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
461
+ </button>
462
+ `}
463
+ </div>
464
+
465
+ ${this.enableReverse === "button" ? m`
466
+ <button
467
+ type="button"
468
+ class=${D({ active: this.reverseActive })}
469
+ title=${this.reverseButtonTitle ?? "toggle reverse geocoding"}
470
+ @click=${() => this.reverseActive = !this.reverseActive}
471
+ >
472
+ <maptiler-geocode-reverse-geocoding-icon></maptiler-geocode-reverse-geocoding-icon>
473
+ </button>
474
+ ` : X}
475
+
476
+ <!-- <slot /> -->
477
+ </div>
478
+
479
+ ${this.error ? m`
480
+ <div class="error">
481
+ <maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
482
+
483
+ <div>${this.errorMessage ?? "Something went wrong…"}</div>
484
+
485
+ <button @click=${() => this.error = void 0}>
486
+ <maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
487
+ </button>
488
+ </div>
489
+ ` : !this.focusedDelayed && !this.keepListOpen || this.listFeatures === void 0 ? X : this.listFeatures.length === 0 ? m`
490
+ <div class="no-results">
491
+ <maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
492
+
493
+ <div>
494
+ ${this.noResultsMessage ?? "Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}
495
+ </div>
496
+ </div>
497
+ ` : m`
498
+ <ul class="options ${D({ "open-on-top": this.openListOnTop })}" @mouseleave=${h(this, l, ze)} @keydown=${h(this, l, le)} role="listbox">
499
+ ${Ve(
500
+ this.listFeatures,
501
+ (t) => t.id + (t.address ? "," + t.address : ""),
502
+ (t, e) => m`
503
+ <maptiler-geocoder-feature-item
504
+ .feature=${t}
505
+ .showPlaceType=${this.showPlaceType ?? "if-needed"}
506
+ itemStyle=${this.selectedItemIndex === e ? "selected" : this.picked?.id === t.id ? "picked" : "default"}
507
+ @mouseenter=${() => {
508
+ h(this, l, Re).call(this, e);
509
+ }}
510
+ @select=${() => {
511
+ h(this, l, Be).call(this, t);
512
+ }}
513
+ .missingIconsCache=${x(this, ae)}
514
+ .iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.1/icons/"}
515
+ >
516
+ ${t.place_name}
517
+ </maptiler-geocoder-feature-item>
518
+ `
519
+ )}
520
+ </ul>
521
+ `}
522
+ </form>
523
+ `;
524
+ }
525
+ };
526
+ Z = /* @__PURE__ */ new WeakMap();
527
+ V = /* @__PURE__ */ new WeakMap();
528
+ B = /* @__PURE__ */ new WeakMap();
529
+ ae = /* @__PURE__ */ new WeakMap();
530
+ R = /* @__PURE__ */ new WeakMap();
531
+ l = /* @__PURE__ */ new WeakSet();
532
+ Q = function() {
533
+ return this.listFeatures?.[this.selectedItemIndex];
534
+ };
535
+ Ee = function() {
536
+ return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
537
+ };
538
+ Pe = function() {
539
+ return this.abortController !== void 0;
540
+ };
541
+ ue = function() {
542
+ return this.searchValue.length < (this.minLength ?? 2);
543
+ };
544
+ v = function(t, ...[e]) {
545
+ x(this, Z) && this.dispatchEvent(
546
+ new CustomEvent(t, {
547
+ bubbles: !0,
548
+ composed: !0,
549
+ detail: e
550
+ })
551
+ );
552
+ };
553
+ fe = function(t) {
554
+ 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(() => {
555
+ this.picked = void 0;
556
+ }).catch((e) => this.error = e);
557
+ };
558
+ Y = function(t) {
559
+ try {
560
+ return We(t, 6);
561
+ } catch {
562
+ return !1;
563
+ }
564
+ };
565
+ me = function() {
566
+ setTimeout(() => {
567
+ this.input.focus(), this.focused = !0, this.input.select();
568
+ });
569
+ };
570
+ ge = function(t) {
571
+ 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) {
572
+ if (clearTimeout(x(this, B)), x(this, l, ue))
573
+ return;
574
+ const e = this.searchValue;
575
+ W(this, B, window.setTimeout(() => {
576
+ h(this, l, H).call(this, e).catch((i) => this.error = i);
577
+ }, this.debounceSearch ?? 200));
578
+ } else
579
+ h(this, l, $).call(this);
580
+ };
581
+ $ = function() {
582
+ this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, l, v).call(this, "featuresclear"));
583
+ };
584
+ ye = function(t) {
585
+ 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);
586
+ };
587
+ H = async function(t, { byId: e = !1, exact: i = !1 } = {}) {
588
+ this.error = void 0, this.abortController?.abort();
589
+ const o = new AbortController();
590
+ this.abortController = o;
591
+ try {
592
+ 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;
593
+ this.language !== void 0 && f.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
594
+ const [L] = x(this, R) ?? [void 0];
595
+ let w = (!s || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
596
+ (y) => typeof y == "string" ? y : L === void 0 || (y[0] ?? 0) <= L && L < (y[1] ?? 1 / 0) ? y[2] : void 0
597
+ ).filter((y) => y !== void 0);
598
+ w && (w = [...new Set(w)], f.set("types", w.join(",")));
599
+ const T = !s || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
600
+ if (T && f.set("excludeTypes", String(T)), 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), !e && !s) {
601
+ const y = this.proximity ?? [{ type: "server-geolocation" }], xe = await lt(x(this, R), y, o);
602
+ xe && f.set("proximity", xe), (i || this.showResultsWhileTyping === !1) && f.set("autocomplete", "false"), f.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
603
+ }
604
+ const ve = this.limit ?? 5, J = this.reverseGeocodingLimit ?? ve;
605
+ 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);
606
+ const De = a.searchParams.get("types") === "" && a.searchParams.get("excludeTypes") !== "true", j = a.toString();
607
+ 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, v).call(this, "featureslisted", { features: this.listFeatures }), this.listFeatures[this.selectedItemIndex]?.id !== x(this, l, Q)?.id && (this.selectedItemIndex = -1));
609
+ return;
610
+ }
611
+ h(this, l, v).call(this, "request", { urlObj: a }), this.lastSearchUrl = j;
612
+ let P;
613
+ if (De)
614
+ P = { type: "FeatureCollection", features: [] };
615
+ else {
616
+ const y = await fetch(j, {
617
+ signal: o.signal,
618
+ ...this.fetchParameters
619
+ });
620
+ if (!y.ok)
621
+ throw new Error(await y.text());
622
+ P = await y.json();
623
+ }
624
+ 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({
625
+ type: "Feature",
626
+ properties: {},
627
+ /* eslint-disable @typescript-eslint/restrict-template-expressions */
628
+ id: `reverse_${s.decimalLongitude}_${s.decimalLatitude}`,
629
+ text: `${s.decimalLatitude}, ${s.decimalLongitude}`,
630
+ place_name: s.toCoordinateFormat("DMS"),
631
+ /* eslint-enable @typescript-eslint/restrict-template-expressions */
632
+ place_type: ["reverse"],
633
+ place_type_name: ["reverse"],
634
+ center: [s.decimalLongitude, s.decimalLatitude],
635
+ bbox: [s.decimalLongitude, s.decimalLatitude, s.decimalLongitude, s.decimalLatitude],
636
+ geometry: {
637
+ type: "Point",
638
+ coordinates: [s.decimalLongitude, s.decimalLatitude]
639
+ }
640
+ }), 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());
641
+ } catch (r) {
642
+ if (r && typeof r == "object" && "name" in r && r.name === "AbortError")
643
+ return;
644
+ throw r;
645
+ } finally {
646
+ o === this.abortController && (this.abortController = void 0);
647
+ }
648
+ };
649
+ Ue = 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)}, ${at(t[0], [-180, 180], !0).toFixed(6)}`), h(this, l, me).call(this);
651
+ };
652
+ le = function(t) {
653
+ if (!this.listFeatures)
654
+ return;
655
+ const e = t.key === "ArrowDown" ? 1 : t.key === "ArrowUp" ? -1 : 0;
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));
657
+ };
658
+ Ge = function(t) {
659
+ h(this, l, ge).call(this, t.target.value);
660
+ };
661
+ Be = function(t) {
662
+ (!this.picked || this.picked.id !== t.id) && (this.picked = t, this.searchValue = t.place_name);
663
+ };
664
+ Re = function(t) {
665
+ this.selectedItemIndex = t;
666
+ };
667
+ ze = function() {
668
+ (!this.selectFirst || this.picked) && (this.selectedItemIndex = -1);
669
+ };
670
+ je = function() {
671
+ this.searchValue = "", h(this, l, v).call(this, "queryclear"), this.picked = void 0, this.input.focus();
672
+ };
673
+ n.styles = I`
674
+ ${ce(dt)}
675
+ `;
676
+ c([
677
+ p({ attribute: !1 })
678
+ ], n.prototype, "adjustUrl", 2);
679
+ c([
680
+ p({ type: String })
681
+ ], n.prototype, "apiKey", 2);
682
+ c([
683
+ p({ type: String })
684
+ ], n.prototype, "apiUrl", 2);
685
+ c([
686
+ p({ type: Array })
687
+ ], n.prototype, "bbox", 2);
688
+ c([
689
+ p({ type: String })
690
+ ], n.prototype, "clearButtonTitle", 2);
691
+ c([
692
+ p({ type: Boolean })
693
+ ], n.prototype, "clearListOnPick", 2);
694
+ c([
695
+ p({ type: Boolean })
696
+ ], n.prototype, "clearOnBlur", 2);
697
+ c([
698
+ p({ type: Boolean })
699
+ ], n.prototype, "collapsed", 2);
700
+ c([
701
+ p({ attribute: !1 })
702
+ ], n.prototype, "country", 2);
703
+ c([
704
+ p({ type: Number })
705
+ ], n.prototype, "debounceSearch", 2);
706
+ c([
707
+ p({ type: String })
708
+ ], n.prototype, "enableReverse", 2);
709
+ c([
710
+ p({ type: String })
711
+ ], n.prototype, "errorMessage", 2);
712
+ c([
713
+ p({ type: Boolean })
714
+ ], n.prototype, "excludeTypes", 2);
715
+ c([
716
+ p({ type: Boolean })
717
+ ], n.prototype, "exhaustiveReverseGeocoding", 2);
718
+ c([
719
+ p({ type: Boolean })
720
+ ], n.prototype, "fetchFullGeometryOnPick", 2);
721
+ c([
722
+ p({ type: Object })
723
+ ], n.prototype, "fetchParameters", 2);
724
+ c([
725
+ p({ attribute: !1 })
726
+ ], n.prototype, "filter", 2);
727
+ c([
728
+ p({ type: Object })
729
+ ], n.prototype, "fuzzyMatch", 2);
730
+ c([
731
+ p({ type: String })
732
+ ], n.prototype, "iconsBaseUrl", 2);
733
+ c([
734
+ p({ type: Boolean })
735
+ ], n.prototype, "keepListOpen", 2);
736
+ c([
737
+ p({ attribute: !1 })
738
+ ], n.prototype, "language", 2);
739
+ c([
740
+ p({ type: Number })
741
+ ], n.prototype, "limit", 2);
742
+ c([
743
+ p({ type: Number })
744
+ ], n.prototype, "minLength", 2);
745
+ c([
746
+ p({ type: String })
747
+ ], n.prototype, "noResultsMessage", 2);
748
+ c([
749
+ p({ type: Boolean })
750
+ ], n.prototype, "openListOnTop", 2);
751
+ c([
752
+ p({ type: String })
753
+ ], n.prototype, "placeholder", 2);
754
+ c([
755
+ p({ type: Array })
756
+ ], n.prototype, "proximity", 2);
757
+ c([
758
+ p({ type: Boolean })
759
+ ], n.prototype, "reverseActive", 2);
760
+ c([
761
+ p({ type: String })
762
+ ], n.prototype, "reverseButtonTitle", 2);
763
+ c([
764
+ p({ type: Object })
765
+ ], n.prototype, "reverseGeocodingExcludeTypes", 2);
766
+ c([
767
+ p({ type: Number })
768
+ ], n.prototype, "reverseGeocodingLimit", 2);
769
+ c([
770
+ p({ type: Array })
771
+ ], n.prototype, "reverseGeocodingTypes", 2);
772
+ c([
773
+ p({ type: Object })
774
+ ], n.prototype, "selectFirst", 2);
775
+ c([
776
+ p({ type: String })
777
+ ], n.prototype, "showPlaceType", 2);
778
+ c([
779
+ p({ type: Object })
780
+ ], n.prototype, "showResultsWhileTyping", 2);
781
+ c([
782
+ p({ type: Array })
783
+ ], n.prototype, "types", 2);
784
+ c([
785
+ Ae("input")
786
+ ], n.prototype, "input", 2);
787
+ c([
788
+ b()
789
+ ], n.prototype, "searchValue", 2);
790
+ c([
791
+ b()
792
+ ], n.prototype, "listFeatures", 2);
793
+ c([
794
+ b()
795
+ ], n.prototype, "selectedItemIndex", 2);
796
+ c([
797
+ b()
798
+ ], n.prototype, "picked", 2);
799
+ c([
800
+ b()
801
+ ], n.prototype, "cachedFeatures", 2);
802
+ c([
803
+ b()
804
+ ], n.prototype, "lastSearchUrl", 2);
805
+ c([
806
+ b()
807
+ ], n.prototype, "error", 2);
808
+ c([
809
+ b()
810
+ ], n.prototype, "abortController", 2);
811
+ c([
812
+ b()
813
+ ], n.prototype, "focused", 2);
814
+ c([
815
+ b()
816
+ ], n.prototype, "focusedDelayed", 2);
817
+ n = c([
818
+ O("maptiler-geocoder")
819
+ ], n);
820
+ const mt = [
821
+ "adjustUrl",
822
+ "apiKey",
823
+ "apiUrl",
824
+ "bbox",
825
+ "clearButtonTitle",
826
+ "clearListOnPick",
827
+ "clearOnBlur",
828
+ "collapsed",
829
+ "country",
830
+ "debounceSearch",
831
+ "enableReverse",
832
+ "errorMessage",
833
+ "excludeTypes",
834
+ "reverseGeocodingExcludeTypes",
835
+ "exhaustiveReverseGeocoding",
836
+ "fetchParameters",
837
+ "fetchFullGeometryOnPick",
838
+ "filter",
839
+ "fuzzyMatch",
840
+ "iconsBaseUrl",
841
+ "keepListOpen",
842
+ "language",
843
+ "limit",
844
+ "reverseGeocodingLimit",
845
+ "minLength",
846
+ "noResultsMessage",
847
+ "openListOnTop",
848
+ "placeholder",
849
+ "proximity",
850
+ "reverseActive",
851
+ "reverseButtonTitle",
852
+ "selectFirst",
853
+ "showPlaceType",
854
+ "showResultsWhileTyping",
855
+ "types",
856
+ "reverseGeocodingTypes"
857
+ ], gt = "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-reverse-fill, #98b7ff);stroke:var(--maptiler-geocode-marker-reverse-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)}";
858
+ var yt = Object.getOwnPropertyDescriptor, vt = (t, e, i, o) => {
859
+ for (var r = o > 1 ? void 0 : o ? yt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
860
+ (a = t[s]) && (r = a(r) || r);
861
+ return r;
862
+ };
863
+ let ne = class extends M {
864
+ render() {
865
+ return z`
866
+ <svg
867
+ viewBox="0 0 70 85"
868
+ fill="none"
869
+ class:in-map={displayIn !== "list"}
870
+ >
871
+ <path
872
+ stroke-width="4"
873
+ d="M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"
874
+ />
875
+ </svg>
876
+ `;
877
+ }
878
+ };
879
+ ne.styles = I`
880
+ ${ce(gt)}
881
+ `;
882
+ ne = vt([
883
+ O("maptiler-geocode-marker")
884
+ ], ne);
885
+ function ke(t) {
886
+ const e = Ze(
887
+ q([
888
+ Ke([
889
+ [
890
+ [180, 90],
891
+ [-180, 90],
892
+ [-180, -90],
893
+ [180, -90],
894
+ [180, 90]
895
+ ]
896
+ ]),
897
+ t
898
+ ])
899
+ );
900
+ if (!e)
901
+ return;
902
+ e.properties = { isMask: !0 };
903
+ const i = K(be(t)), o = (i[2] - i[0]) / 360 / 1e3, r = i[0] < -180, s = i[2] > 180, a = Qe(t);
904
+ if (a.features.length > 1 && (r || s))
905
+ for (const f of a.features) {
906
+ const L = K(be(f));
907
+ if (s && L[0] < -180 + o)
908
+ for (const w of f.geometry.coordinates)
909
+ for (const T of w)
910
+ T[0] += 360 - o;
911
+ if (r && L[2] > 180 - o)
912
+ for (const w of f.geometry.coordinates)
913
+ for (const T of w)
914
+ T[0] -= 360 - o;
915
+ }
916
+ return q([a.features.length < 2 ? t : Le(a) ?? t, e]);
917
+ }
918
+ const xt = {
919
+ continental_marine: 4,
920
+ country: 4,
921
+ major_landform: 8,
922
+ region: 5,
923
+ subregion: 6,
924
+ county: 7,
925
+ joint_municipality: 8,
926
+ joint_submunicipality: 9,
927
+ municipality: 10,
928
+ municipal_district: 11,
929
+ locality: 12,
930
+ neighbourhood: 13,
931
+ place: 14,
932
+ postal_code: 14,
933
+ road: 16,
934
+ poi: 17,
935
+ address: 18,
936
+ "poi.peak": 15,
937
+ "poi.shop": 18,
938
+ "poi.cafe": 18,
939
+ "poi.restaurant": 18,
940
+ "poi.aerodrome": 13
941
+ // TODO add many more
942
+ }, bt = {
943
+ fill: {
944
+ paint: {
945
+ "fill-color": "#000",
946
+ "fill-opacity": 0.1
947
+ },
948
+ filter: ["all", ["==", ["geometry-type"], "Polygon"], ["has", "isMask"]]
949
+ },
950
+ line: {
951
+ layout: {
952
+ "line-cap": "square"
953
+ },
954
+ paint: {
955
+ "line-width": ["case", ["==", ["geometry-type"], "Polygon"], 2, 3],
956
+ "line-dasharray": [1, 1],
957
+ "line-color": "#3170fe"
958
+ },
959
+ filter: ["!", ["has", "isMask"]]
960
+ }
961
+ }, A = "mtlr-gc-full-geom", we = "mtlr-gc-full-geom-fill", _e = "mtlr-gc-full-geom-line", kt = he.Evented, wt = he.Marker, _t = he.Popup;
962
+ class Bt extends kt {
963
+ #e;
964
+ #t;
965
+ #i;
966
+ constructor(e = {}) {
967
+ super(), this.#e = e;
968
+ }
969
+ onAdd(e) {
970
+ if (this.#t = e, this.#i = e._container.ownerDocument.createElement("maptiler-geocoder"), this.#i.classList.add("maplibregl-geocoder"), "getSdkConfig" in e && typeof e.getSdkConfig == "function") {
971
+ const { primaryLanguage: o, apiKey: r } = e.getSdkConfig();
972
+ if (this.#e.apiKey === void 0 && (this.#e.apiKey = r), this.#e.language === void 0) {
973
+ const s = o.code?.match(/^([a-z]{2,3})($|_|-)/);
974
+ s && (this.#e.language = s[1]);
975
+ }
976
+ this.#i.classList.add("maptiler-geocoder");
977
+ }
978
+ this.#v(), this.#w();
979
+ const i = e._container.ownerDocument.createElement("div");
980
+ return i.classList.add("maplibregl-ctrl-geocoder", "maplibregl-ctrl", "maplibregl-ctrl-group"), i.style.position = "relative", i.style.zIndex = "3", i.appendChild(this.#i), setTimeout(() => this.#i?.setOptions({ openListOnTop: i.matches(".maplibregl-ctrl-bottom-left *, .maplibregl-ctrl-bottom-right *") })), i;
981
+ }
982
+ onRemove() {
983
+ this.#_(), this.#t = void 0, this.#i = void 0;
984
+ }
985
+ /**
986
+ * Update the control options.
987
+ *
988
+ * @param options options to update
989
+ */
990
+ setOptions(e) {
991
+ Object.assign(this.#e, e), this.#v();
992
+ }
993
+ /**
994
+ * Set the content of search input box.
995
+ *
996
+ * @param value text to set
997
+ */
998
+ setQuery(e) {
999
+ this.#i?.setQuery(e);
1000
+ }
1001
+ /**
1002
+ * Set the content of search input box and immediately submit it.
1003
+ *
1004
+ * @param value text to set and submit
1005
+ */
1006
+ submitQuery(e) {
1007
+ this.#i?.submitQuery(e);
1008
+ }
1009
+ /**
1010
+ * Clear geocoding search results from the map.
1011
+ */
1012
+ clearMap() {
1013
+ this.#o = [], this.#p(void 0, void 0);
1014
+ }
1015
+ /**
1016
+ * Clear search result list.
1017
+ */
1018
+ clearList() {
1019
+ this.#i?.clearList();
1020
+ }
1021
+ /**
1022
+ * Set reverse geocoding mode.
1023
+ *
1024
+ * @param reverseActive reverse geocoding active
1025
+ */
1026
+ setReverseMode(e) {
1027
+ this.setOptions({ reverseActive: e });
1028
+ }
1029
+ /**
1030
+ * Focus the search input box.
1031
+ *
1032
+ * @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
1033
+ */
1034
+ focus(e) {
1035
+ this.#i?.focus(e);
1036
+ }
1037
+ /**
1038
+ * Blur the search input box.
1039
+ */
1040
+ blur() {
1041
+ this.#i?.blur();
1042
+ }
1043
+ /** Markers currently displayed on the map */
1044
+ #l = /* @__PURE__ */ new Map();
1045
+ /** Marker representing the selected feature */
1046
+ #c;
1047
+ /** Marker representing the picked feature */
1048
+ #r;
1049
+ /** Features currently marked on the map */
1050
+ #o;
1051
+ /** Used to restore features on style switch */
1052
+ #a;
1053
+ /** Remember last feature that the map flew to as to not do it again */
1054
+ #m;
1055
+ #g = {
1056
+ reversetoggle: (e) => {
1057
+ const i = this.#t?.getCanvasContainer();
1058
+ i && (i.style.cursor = e.detail.reverse ? "crosshair" : ""), this.#s("reversetoggle", e.detail);
1059
+ },
1060
+ querychange: (e) => {
1061
+ const i = e.detail.reverseCoords;
1062
+ this.#k(i ? [i.decimalLongitude, i.decimalLatitude] : void 0), this.#s("querychange", e.detail);
1063
+ },
1064
+ queryclear: () => {
1065
+ this.#k(void 0), this.#s("queryclear");
1066
+ },
1067
+ request: (e) => {
1068
+ this.#s("request", e.detail);
1069
+ },
1070
+ response: (e) => {
1071
+ this.#s("response", e.detail);
1072
+ },
1073
+ select: (e) => {
1074
+ const i = e.detail.feature;
1075
+ i && this.#d && this.#e.flyToSelected && this.#x(i.center, this.#h(i)), this.#o && i && this.#O(i), this.#s("select", e.detail);
1076
+ },
1077
+ pick: (e) => {
1078
+ const i = e.detail.feature;
1079
+ i && i.id !== this.#m && this.#d && (this.#L(i), this.#p(this.#o, i)), this.#m = i?.id, this.#s("pick", e.detail);
1080
+ },
1081
+ featuresshow: () => {
1082
+ this.#s("featuresshow");
1083
+ },
1084
+ featureshide: () => {
1085
+ this.#s("featureshide");
1086
+ },
1087
+ featureslisted: (e) => {
1088
+ const i = e.detail.features;
1089
+ this.#o = i, this.#p(this.#o, void 0), this.#$(i), this.#s("featureslisted", e.detail);
1090
+ },
1091
+ featuresclear: () => {
1092
+ this.#o = void 0, this.#p(void 0, void 0), this.#s("featuresclear");
1093
+ },
1094
+ focusin: () => {
1095
+ this.#s("focusin");
1096
+ },
1097
+ focusout: () => {
1098
+ this.#s("focusout");
1099
+ }
1100
+ };
1101
+ #y = {
1102
+ render: () => {
1103
+ const e = this.#t?.getZoom(), i = this.#t?.getCenter();
1104
+ this.#i?.handleMapChange(e && i ? [e, i.lng, i.lat] : void 0);
1105
+ },
1106
+ click: (e) => {
1107
+ this.#i?.handleMapClick([e.lngLat.lng, e.lngLat.lat]);
1108
+ },
1109
+ styledata: () => {
1110
+ setTimeout(() => {
1111
+ this.#a && this.#u();
1112
+ });
1113
+ }
1114
+ };
1115
+ #v() {
1116
+ this.#i && (this.#i.setOptions(this.#e), this.#i.fetchFullGeometryOnPick = this.#e.pickedResultStyle !== "marker-only");
1117
+ }
1118
+ #w() {
1119
+ if (!(!this.#i || !this.#t)) {
1120
+ for (const [e, i] of Object.entries(this.#g))
1121
+ this.#i.addEventListener(e, i);
1122
+ for (const [e, i] of Object.entries(this.#y))
1123
+ this.#t.on(e, i);
1124
+ }
1125
+ }
1126
+ #_() {
1127
+ if (!(!this.#i || !this.#t)) {
1128
+ for (const [e, i] of Object.entries(this.#g))
1129
+ this.#i.removeEventListener(e, i);
1130
+ for (const [e, i] of Object.entries(this.#y))
1131
+ this.#t.off(e, i);
1132
+ }
1133
+ }
1134
+ #s(e, i) {
1135
+ return super.fire({ type: e, ...i ?? {} });
1136
+ }
1137
+ #L(e) {
1138
+ e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#x(e.center, this.#h(e)) : this.#b(K(e.bbox), 50, this.#h(e));
1139
+ }
1140
+ #$(e) {
1141
+ if (!e || e.length === 0 || !this.#d) return;
1142
+ const i = e.every((s) => s.matching_text), o = e.reduce(
1143
+ (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,
1144
+ [180, 90, -180, -90]
1145
+ ), 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);
1146
+ this.#b(K(o), 50, r);
1147
+ }
1148
+ #h(e) {
1149
+ if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
1150
+ return;
1151
+ const i = e.id.replace(/\..*/, ""), o = this.#e.zoom ?? xt;
1152
+ return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((r, s) => {
1153
+ const a = o[i + "." + s];
1154
+ return r === void 0 ? a : a === void 0 ? r : Math.max(r, a);
1155
+ }, void 0) : void 0) ?? o[i];
1156
+ }
1157
+ get #d() {
1158
+ return !!this.#e.flyTo || this.#e.flyTo === void 0;
1159
+ }
1160
+ get #I() {
1161
+ return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
1162
+ }
1163
+ get #M() {
1164
+ return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
1165
+ }
1166
+ #x(e, i) {
1167
+ this.#t?.flyTo({ center: e, ...i ? { zoom: i } : {}, ...this.#I });
1168
+ }
1169
+ #b(e, i, o) {
1170
+ this.#t?.fitBounds(
1171
+ [
1172
+ [e[0], e[1]],
1173
+ [e[2], e[3]]
1174
+ ],
1175
+ { padding: i, ...o ? { maxZoom: o } : {}, ...this.#M }
1176
+ );
1177
+ }
1178
+ #k(e) {
1179
+ if (!(this.#e.marker === !1 || this.#e.marker === null || !this.#t)) {
1180
+ if (!e) {
1181
+ this.#r?.remove(), this.#r = void 0;
1182
+ return;
1183
+ }
1184
+ this.#r || (this.#e.marker instanceof Function ? this.#r = this.#e.marker(this.#t) ?? void 0 : (this.#r = this.#f(this.#e.marker).setLngLat(e).addTo(this.#t), this.#r.getElement().classList.add("marker-reverse"))), this.#r?.setLngLat(e);
1185
+ }
1186
+ }
1187
+ #p(e, i) {
1188
+ if (!this.#t)
1189
+ return;
1190
+ for (const r of this.#l.values())
1191
+ r.remove();
1192
+ this.#l = /* @__PURE__ */ new Map(), this.#n(void 0);
1193
+ const o = () => {
1194
+ if (!i || !this.#t || this.#e.marker === !1 || this.#e.marker === null) return;
1195
+ const r = this.#e.marker instanceof Function ? this.#e.marker(this.#t, i) : this.#f(this.#e.marker).setLngLat(i.center).addTo(this.#t);
1196
+ r && this.#l.set(i, r);
1197
+ };
1198
+ if (i?.geometry.type === "GeometryCollection") {
1199
+ const r = i.geometry.geometries.filter(
1200
+ (s) => s.type === "Polygon" || s.type === "MultiPolygon"
1201
+ );
1202
+ if (r.length > 0) {
1203
+ const s = Le(q(r.map((a) => Ne(a))));
1204
+ if (s) {
1205
+ const a = ke({ ...i, geometry: s.geometry });
1206
+ a && this.#n(a);
1207
+ }
1208
+ } else {
1209
+ const s = i.geometry.geometries.filter(
1210
+ (a) => a.type === "LineString" || a.type === "MultiLineString"
1211
+ );
1212
+ s.length > 0 && this.#n({
1213
+ ...i,
1214
+ geometry: { type: "GeometryCollection", geometries: s }
1215
+ });
1216
+ }
1217
+ } else if (i?.geometry.type.endsWith("Polygon")) {
1218
+ const r = ke(i);
1219
+ r && this.#n(r), this.#e.pickedResultStyle === "full-geometry-including-polygon-center-marker" && o();
1220
+ } else i?.geometry.type.endsWith("LineString") ? this.#n(i) : i?.geometry.type.endsWith("Point") && o();
1221
+ if (this.#e.showResultMarkers !== !1 && this.#e.showResultMarkers !== null)
1222
+ for (const r of e ?? []) {
1223
+ if (r.id === i?.id || r.place_type.includes("reverse"))
1224
+ continue;
1225
+ let s;
1226
+ if (this.#e.showResultMarkers instanceof Function) {
1227
+ if (s = this.#e.showResultMarkers(this.#t, r), !s)
1228
+ continue;
1229
+ } else
1230
+ s = this.#f(this.#e.showResultMarkers).setLngLat(r.center).setPopup(
1231
+ new _t({
1232
+ offset: [1, -27],
1233
+ closeButton: !1,
1234
+ closeOnMove: !0,
1235
+ className: "maptiler-gc-popup"
1236
+ }).setText(r.place_type[0] === "reverse" ? r.place_name : r.place_name.replace(/,.*/, ""))
1237
+ ).addTo(this.#t), s.getElement().classList.add("marker-interactive");
1238
+ const a = s.getElement();
1239
+ a.addEventListener("click", (f) => {
1240
+ f.stopPropagation(), this.#s("markerclick", { feature: r, marker: s });
1241
+ }), a.addEventListener("mouseenter", () => {
1242
+ this.#s("markermouseenter", { feature: r, marker: s }), s.togglePopup();
1243
+ }), a.addEventListener("mouseleave", () => {
1244
+ this.#s("markermouseleave", { feature: r, marker: s }), s.togglePopup();
1245
+ }), a.classList.toggle("marker-fuzzy", !!r.matching_text), this.#l.set(r, s);
1246
+ }
1247
+ }
1248
+ #O(e) {
1249
+ 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));
1250
+ }
1251
+ #u() {
1252
+ if (!this.#t?.loaded) {
1253
+ this.#t?.once("load", () => {
1254
+ this.#u();
1255
+ });
1256
+ return;
1257
+ }
1258
+ const e = this.#e.fullGeometryStyle === void 0 || this.#e.fullGeometryStyle === !0 ? bt : this.#e.fullGeometryStyle ? this.#e.fullGeometryStyle : void 0, i = this.#t.getSource(A);
1259
+ !e?.fill && !e?.line || !i && !this.#a || (i ? i.setData(this.#a ?? q([])) : this.#a && this.#t.addSource(A, {
1260
+ type: "geojson",
1261
+ data: this.#a
1262
+ }), !this.#t.getLayer(we) && e.fill && this.#t.addLayer({
1263
+ ...e.fill,
1264
+ id: we,
1265
+ type: "fill",
1266
+ source: A
1267
+ }), !this.#t.getLayer(_e) && e.line && this.#t.addLayer({
1268
+ ...e.line,
1269
+ id: _e,
1270
+ type: "line",
1271
+ source: A
1272
+ }));
1273
+ }
1274
+ #n(e) {
1275
+ this.#a = e, this.#u();
1276
+ }
1277
+ #f(e) {
1278
+ return typeof e != "object" && (e = { element: this.#t?._container.ownerDocument.createElement("maptiler-geocode-marker"), offset: [1, -13] }), new wt(e);
1279
+ }
1280
+ }
1281
+ export {
1282
+ bt as DEFAULT_GEOMETRY_STYLE,
1283
+ Bt as GeocodingControl,
1284
+ Bt as MaplibreglGeocodingControl,
1285
+ ee as MaptilerGeocodeClearIconElement,
1286
+ te as MaptilerGeocodeFailIconElement,
1287
+ ie as MaptilerGeocodeLoadingIconElement,
1288
+ ne as MaptilerGeocodeMarkerElement,
1289
+ se as MaptilerGeocodeReverseGeocodingIconElement,
1290
+ re as MaptilerGeocodeSearchIconElement,
1291
+ n as MaptilerGeocoderElement,
1292
+ we as RESULT_LAYER_FILL,
1293
+ _e as RESULT_LAYER_LINE,
1294
+ A as RESULT_SOURCE,
1295
+ xt as ZOOM_DEFAULTS
1296
+ };
1297
+ //# sourceMappingURL=maplibregl.js.map