themelia-react-ui 2.0.1 → 2.0.3

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 (490) hide show
  1. package/CHANGELOG.md +317 -131
  2. package/README.md +25 -9
  3. package/THIRD_PARTY_NOTICES.md +7 -0
  4. package/dist/{accordion-B6a3vVgA.js → accordion-Cjb6sx0G.js} +14 -13
  5. package/dist/accordion-Cjb6sx0G.js.map +1 -0
  6. package/dist/action-menu-CllU52Mm.js +280 -0
  7. package/dist/action-menu-CllU52Mm.js.map +1 -0
  8. package/dist/affordance-geometry.generated-tF36bREk.js +140 -0
  9. package/dist/affordance-geometry.generated-tF36bREk.js.map +1 -0
  10. package/dist/ai-artifact-DvTwDVyL.js +1148 -0
  11. package/dist/ai-artifact-DvTwDVyL.js.map +1 -0
  12. package/dist/{app-shell-ZK5RWdo6.js → app-shell-C4FhvCqF.js} +5 -5
  13. package/dist/{app-shell-ZK5RWdo6.js.map → app-shell-C4FhvCqF.js.map} +1 -1
  14. package/dist/attachment-BxDfL2mw.js +246 -0
  15. package/dist/attachment-BxDfL2mw.js.map +1 -0
  16. package/dist/{auth-CYxKfo69.js → auth-BGua8ouh.js} +58 -54
  17. package/dist/auth-BGua8ouh.js.map +1 -0
  18. package/dist/{avatar-BBnEJIx8.js → avatar-DAPlDvhJ.js} +7 -7
  19. package/dist/avatar-DAPlDvhJ.js.map +1 -0
  20. package/dist/{badge-MrKVNzW9.js → badge-HpFqoqSY.js} +40 -40
  21. package/dist/badge-HpFqoqSY.js.map +1 -0
  22. package/dist/base/accordion.js +1 -1
  23. package/dist/base/action-menu.js +1 -1
  24. package/dist/base/attachment.js +1 -1
  25. package/dist/base/avatar.js +1 -1
  26. package/dist/base/badge.js +1 -1
  27. package/dist/base/batch-action-bar.js +1 -1
  28. package/dist/base/buttons.js +1 -1
  29. package/dist/base/cards.js +2 -2
  30. package/dist/base/carousel.js +40 -36
  31. package/dist/base/carousel.js.map +1 -1
  32. package/dist/base/cascader.js +92 -92
  33. package/dist/base/cascader.js.map +1 -1
  34. package/dist/base/chart.js +1 -1
  35. package/dist/base/choice-inputs.js +2 -2
  36. package/dist/base/code-block.js +1 -1
  37. package/dist/base/combobox.js +2 -2
  38. package/dist/base/command.js +1 -1
  39. package/dist/base/copyable.js +1 -1
  40. package/dist/base/date-pickers.js +2 -2
  41. package/dist/base/display.js +6 -6
  42. package/dist/base/feedback.js +3 -3
  43. package/dist/base/forms-numeric.js +1 -1
  44. package/dist/base/forms.js +2 -2
  45. package/dist/base/inline-edit.js +14 -14
  46. package/dist/base/inline-edit.js.map +1 -1
  47. package/dist/base/item.js +1 -1
  48. package/dist/base/media-gallery.js +1 -1
  49. package/dist/base/metadata-list.js +1 -1
  50. package/dist/base/navigation.js +6 -6
  51. package/dist/base/popover-menu.js +1 -1
  52. package/dist/base/popover.js +1 -1
  53. package/dist/base/qr-code.js +1 -1
  54. package/dist/base/repeaters.js +171 -176
  55. package/dist/base/repeaters.js.map +1 -1
  56. package/dist/base/sheet.js +1 -1
  57. package/dist/base/sidebar.js +1 -1
  58. package/dist/base/signature-pad.js +6 -6
  59. package/dist/base/skeleton.js +1 -1
  60. package/dist/base/spinner.js +79 -2
  61. package/dist/base/spinner.js.map +1 -0
  62. package/dist/base/structure.js +1 -1
  63. package/dist/base/table.js +1 -1
  64. package/dist/base/text-inputs.js +2 -2
  65. package/dist/base/toaster.js +46 -45
  66. package/dist/base/toaster.js.map +1 -1
  67. package/dist/base/tree.js +1 -1
  68. package/dist/base/upload-queue.js +1 -1
  69. package/dist/base/upload.js +3 -3
  70. package/dist/base/value-inputs.js +1 -1
  71. package/dist/{batch-action-bar-BZGDG-Si.js → batch-action-bar-DnUJ21NQ.js} +6 -5
  72. package/dist/batch-action-bar-DnUJ21NQ.js.map +1 -0
  73. package/dist/blocks/admin.js +42 -42
  74. package/dist/blocks/admin.js.map +1 -1
  75. package/dist/blocks/ai.js +260 -240
  76. package/dist/blocks/ai.js.map +1 -1
  77. package/dist/blocks/analytics/usage-card.js +1 -1
  78. package/dist/blocks/analytics.js +620 -585
  79. package/dist/blocks/analytics.js.map +1 -1
  80. package/dist/blocks/collaboration.js +1 -1
  81. package/dist/blocks/commerce/receipt.js +1 -1
  82. package/dist/blocks/commerce.js +1152 -1109
  83. package/dist/blocks/commerce.js.map +1 -1
  84. package/dist/blocks/data-display.js +2 -2
  85. package/dist/blocks/onboarding.js +48 -39
  86. package/dist/blocks/onboarding.js.map +1 -1
  87. package/dist/blocks/planning.js +13 -12
  88. package/dist/blocks/planning.js.map +1 -1
  89. package/dist/blocks/timelines.js +1 -1
  90. package/dist/{breadcrumbs-D5t7I023.js → breadcrumbs-C-oqs1sQ.js} +5 -5
  91. package/dist/breadcrumbs-C-oqs1sQ.js.map +1 -0
  92. package/dist/{button-QYwiyhD2.js → button-DVzspB_G.js} +2 -2
  93. package/dist/{button-QYwiyhD2.js.map → button-DVzspB_G.js.map} +1 -1
  94. package/dist/{buttons-SbIcm1HJ.js → buttons-DPZekJFu.js} +20 -15
  95. package/dist/buttons-DPZekJFu.js.map +1 -0
  96. package/dist/cards-BaBZR-AU.js +68 -0
  97. package/dist/cards-BaBZR-AU.js.map +1 -0
  98. package/dist/{chart-QfrARkXl.js → chart-ZOYyK2xG.js} +58 -55
  99. package/dist/chart-ZOYyK2xG.js.map +1 -0
  100. package/dist/{checkbox-DhB6K0bK.js → checkbox-AWIhNhmo.js} +2 -2
  101. package/dist/{checkbox-DhB6K0bK.js.map → checkbox-AWIhNhmo.js.map} +1 -1
  102. package/dist/{choice-inputs-t6w3ATNz.js → choice-inputs-CNHvARCJ.js} +49 -45
  103. package/dist/choice-inputs-CNHvARCJ.js.map +1 -0
  104. package/dist/{code-block-Dgbu-CU3.js → code-block-DeneBJR_.js} +8 -8
  105. package/dist/code-block-DeneBJR_.js.map +1 -0
  106. package/dist/{collapsible-D8AEGU1-.js → collapsible-C-_l4hpy.js} +3 -3
  107. package/dist/{collapsible-D8AEGU1-.js.map → collapsible-C-_l4hpy.js.map} +1 -1
  108. package/dist/{collection-content-uK16Grv0.js → collection-content-By56pLog.js} +3 -3
  109. package/dist/{collection-content-uK16Grv0.js.map → collection-content-By56pLog.js.map} +1 -1
  110. package/dist/combobox-DaHESuiL.js +355 -0
  111. package/dist/combobox-DaHESuiL.js.map +1 -0
  112. package/dist/{combobox-DLl0bfiq.js → combobox-Dxo2fAYQ.js} +289 -279
  113. package/dist/combobox-Dxo2fAYQ.js.map +1 -0
  114. package/dist/{command-kNR20o7x.js → command-C25VMRII.js} +7 -7
  115. package/dist/{command-kNR20o7x.js.map → command-C25VMRII.js.map} +1 -1
  116. package/dist/{comments-BpDuCUUu.js → comments-DD0DUPwJ.js} +114 -105
  117. package/dist/comments-DD0DUPwJ.js.map +1 -0
  118. package/dist/components/base/badge/badge.recipes.d.ts +1 -1
  119. package/dist/components/base/buttons/loader-button.d.ts +2 -1
  120. package/dist/components/base/cards/card.recipes.d.ts +2 -3
  121. package/dist/components/base/cards/partials/smart-card-skeleton.d.ts +3 -13
  122. package/dist/components/base/cards/smart-card.types.d.ts +11 -4
  123. package/dist/components/base/chart/chart.d.ts +2 -5
  124. package/dist/components/base/combobox/combobox-field.d.ts +16 -0
  125. package/dist/components/base/combobox/combobox.strings.d.ts +7 -0
  126. package/dist/components/base/combobox/index.d.ts +30 -4
  127. package/dist/components/base/forms/form-sizing.d.ts +11 -3
  128. package/dist/components/base/navigation/pagination.d.ts +5 -2
  129. package/dist/components/base/popover/popover.recipes.d.ts +15 -1
  130. package/dist/components/base/table/index.d.ts +9 -2
  131. package/dist/components/base/text-inputs/input-group.d.ts +2 -2
  132. package/dist/components/blocks/ai/ai-shimmer/ai-shimmer.d.ts +1 -1
  133. package/dist/components/blocks/ai/ai-shimmer/types.d.ts +3 -0
  134. package/dist/components/blocks/commerce/fulfillment-group/types.d.ts +3 -1
  135. package/dist/components/blocks/data-display/inline-stat/inline-stat.d.ts +16 -8
  136. package/dist/components/features/activities/partials/activity-marker.d.ts +6 -3
  137. package/dist/components/features/appointment-calendar/appointment-calendar.d.ts +5 -0
  138. package/dist/components/features/appointment-calendar/appointment-calendar.types.d.ts +220 -0
  139. package/dist/components/features/appointment-calendar/appointment-calendar.utils.d.ts +41 -0
  140. package/dist/components/features/appointment-calendar/index.d.ts +3 -0
  141. package/dist/components/features/appointment-calendar/partials/appointment-agenda.d.ts +32 -0
  142. package/dist/components/features/appointment-calendar/partials/appointment-month.d.ts +13 -0
  143. package/dist/components/features/combobox/combobox.strings.d.ts +15 -1
  144. package/dist/components/features/combobox/types.d.ts +4 -0
  145. package/dist/components/features/media-library/media-library.strings.d.ts +2 -0
  146. package/dist/components/features/rich-text-editor/index.d.ts +1 -1
  147. package/dist/components/features/rich-text-editor/rich-text-editor.recipes.d.ts +6 -0
  148. package/dist/components/features/rich-text-editor/rich-text-editor.types.d.ts +9 -1
  149. package/dist/components/features/table/table-header.d.ts +1 -1
  150. package/dist/components/features/table/table.strings.d.ts +55 -1
  151. package/dist/components/features/table/table.types.d.ts +17 -4
  152. package/dist/components/features/theme-tweaker/theme-tweaker.types.d.ts +5 -0
  153. package/dist/components/primitives/number.d.ts +4 -2
  154. package/dist/components/primitives/value.d.ts +3 -1
  155. package/dist/components/typography/text-link.d.ts +4 -0
  156. package/dist/components/ui/combobox-dismiss.d.ts +16 -0
  157. package/dist/components/ui/combobox.d.ts +16 -7
  158. package/dist/components/ui/dialog.d.ts +1 -1
  159. package/dist/components/ui/item.d.ts +8 -8
  160. package/dist/components/ui/popover.d.ts +1 -1
  161. package/dist/components/ui/sheet.d.ts +1 -1
  162. package/dist/components/ui/tabs.d.ts +1 -1
  163. package/dist/{containers-DmWiJa2I.js → containers-Mu1LMGV1.js} +2 -2
  164. package/dist/{containers-DmWiJa2I.js.map → containers-Mu1LMGV1.js.map} +1 -1
  165. package/dist/{copyable-B3Gwgdqc.js → copyable-ClBuk_UK.js} +4 -4
  166. package/dist/{copyable-B3Gwgdqc.js.map → copyable-ClBuk_UK.js.map} +1 -1
  167. package/dist/{data-display-DafIvCl5.js → data-display-DT_khPl_.js} +98 -87
  168. package/dist/data-display-DT_khPl_.js.map +1 -0
  169. package/dist/{date-BgK3bTdo.js → date-DCrsDTZc.js} +5 -5
  170. package/dist/{date-BgK3bTdo.js.map → date-DCrsDTZc.js.map} +1 -1
  171. package/dist/{date-picker-CF-DtUpF.js → date-picker-B2K3ucWn.js} +594 -593
  172. package/dist/date-picker-B2K3ucWn.js.map +1 -0
  173. package/dist/date-pickers-Ds8gLaoP.js +175 -0
  174. package/dist/date-pickers-Ds8gLaoP.js.map +1 -0
  175. package/dist/{display-DsQTVzMz.js → display-hAc1HjpI.js} +49 -49
  176. package/dist/display-hAc1HjpI.js.map +1 -0
  177. package/dist/dropdown-menu-Cl4X7L5S.js +193 -0
  178. package/dist/dropdown-menu-Cl4X7L5S.js.map +1 -0
  179. package/dist/editable-text-recipe-Cn61kEcv.js +10 -0
  180. package/dist/editable-text-recipe-Cn61kEcv.js.map +1 -0
  181. package/dist/features/activities.js +398 -375
  182. package/dist/features/activities.js.map +1 -1
  183. package/dist/features/ai-chat.js +188 -179
  184. package/dist/features/ai-chat.js.map +1 -1
  185. package/dist/features/appointment-calendar.js +683 -0
  186. package/dist/features/appointment-calendar.js.map +1 -0
  187. package/dist/features/async-preview.js +109 -107
  188. package/dist/features/async-preview.js.map +1 -1
  189. package/dist/features/combobox.js +1 -1
  190. package/dist/features/comments.js +1 -1
  191. package/dist/features/data-view.js +137 -137
  192. package/dist/features/data-view.js.map +1 -1
  193. package/dist/features/email-composer.js +255 -255
  194. package/dist/features/email-composer.js.map +1 -1
  195. package/dist/features/event-calendar.js +254 -248
  196. package/dist/features/event-calendar.js.map +1 -1
  197. package/dist/features/filters.js +1 -1
  198. package/dist/features/global-search.js +35 -32
  199. package/dist/features/global-search.js.map +1 -1
  200. package/dist/features/kanban.js +118 -117
  201. package/dist/features/kanban.js.map +1 -1
  202. package/dist/features/map.js +233 -231
  203. package/dist/features/map.js.map +1 -1
  204. package/dist/features/media-library.js +789 -775
  205. package/dist/features/media-library.js.map +1 -1
  206. package/dist/features/mentions.js +1 -1
  207. package/dist/features/overlays.js +1 -1
  208. package/dist/features/products.js +922 -902
  209. package/dist/features/products.js.map +1 -1
  210. package/dist/features/questionnaire.js +28 -24
  211. package/dist/features/questionnaire.js.map +1 -1
  212. package/dist/features/resource-assignment.js +18 -15
  213. package/dist/features/resource-assignment.js.map +1 -1
  214. package/dist/features/resource.js +12 -12
  215. package/dist/features/resource.js.map +1 -1
  216. package/dist/features/rich-text-editor.js +2 -2
  217. package/dist/features/schema-form.js +15 -13
  218. package/dist/features/schema-form.js.map +1 -1
  219. package/dist/features/suggestions.js +3 -3
  220. package/dist/features/sync.js +11 -5
  221. package/dist/features/sync.js.map +1 -1
  222. package/dist/features/table.js +1 -1
  223. package/dist/features/theme-tweaker.js +493 -489
  224. package/dist/features/theme-tweaker.js.map +1 -1
  225. package/dist/feedback-BYIhtitP.js +239 -0
  226. package/dist/feedback-BYIhtitP.js.map +1 -0
  227. package/dist/{field-affordance-recipes-qQeIf4lG.js → field-affordance-recipes-DZhnIL_Y.js} +11 -18
  228. package/dist/field-affordance-recipes-DZhnIL_Y.js.map +1 -0
  229. package/dist/{filters-BkHH53uv.js → filters-DJVAveHA.js} +589 -580
  230. package/dist/filters-DJVAveHA.js.map +1 -0
  231. package/dist/{form-field-DUt4UxSV.js → form-field-CwH9y77i.js} +6 -5
  232. package/dist/form-field-CwH9y77i.js.map +1 -0
  233. package/dist/{form-sizing-By94KzXE.js → form-sizing-BdP_Mf5p.js} +39 -44
  234. package/dist/form-sizing-BdP_Mf5p.js.map +1 -0
  235. package/dist/{forms-Bzha-Y3B.js → forms-B9G_xwzi.js} +8 -8
  236. package/dist/{forms-Bzha-Y3B.js.map → forms-B9G_xwzi.js.map} +1 -1
  237. package/dist/{forms-numeric-C0bvjRPZ.js → forms-numeric-B_jraJaQ.js} +309 -309
  238. package/dist/forms-numeric-B_jraJaQ.js.map +1 -0
  239. package/dist/{header-BOefOKd1.js → header-BSfIEWbI.js} +160 -153
  240. package/dist/header-BSfIEWbI.js.map +1 -0
  241. package/dist/{hooks-9k_TtmKh.js → hooks-ClH9thn4.js} +2 -2
  242. package/dist/{hooks-9k_TtmKh.js.map → hooks-ClH9thn4.js.map} +1 -1
  243. package/dist/{icon-badge-CAuKupo9.js → icon-badge-DYKIwvOV.js} +4 -4
  244. package/dist/{icon-badge-CAuKupo9.js.map → icon-badge-DYKIwvOV.js.map} +1 -1
  245. package/dist/index.js +3 -3
  246. package/dist/input-CZw8iU99.js +21 -0
  247. package/dist/input-CZw8iU99.js.map +1 -0
  248. package/dist/input-DQdEd0YD.js +263 -0
  249. package/dist/input-DQdEd0YD.js.map +1 -0
  250. package/dist/{interaction-recipes-CHr0dJUs.js → interaction-recipes-XR9ZpVYL.js} +2 -1
  251. package/dist/interaction-recipes-XR9ZpVYL.js.map +1 -0
  252. package/dist/item-K5_ghvze.js +275 -0
  253. package/dist/item-K5_ghvze.js.map +1 -0
  254. package/dist/layout/app-shell.js +1 -1
  255. package/dist/layout/auth.js +1 -1
  256. package/dist/layout/containers.js +1 -1
  257. package/dist/layout/header.js +1 -1
  258. package/dist/layout/hooks.js +1 -1
  259. package/dist/layout/navigation.js +1 -1
  260. package/dist/layout/page.js +1 -1
  261. package/dist/layout/settings.js +1 -1
  262. package/dist/layout/sidebar.js +2 -2
  263. package/dist/layout/workspace.js +1 -1
  264. package/dist/layout.js +10 -10
  265. package/dist/lib/affordance-geometry.generated.d.ts +71 -0
  266. package/dist/lib/editable-text-recipe.d.ts +4 -4
  267. package/dist/lib/field-affordance-recipes.d.ts +2 -2
  268. package/dist/lib/interaction-recipes.d.ts +5 -0
  269. package/dist/lib/theme-mode-css.d.ts +7 -0
  270. package/dist/lib/tone-recipes.d.ts +8 -0
  271. package/dist/lib/ui-provider/types.d.ts +2 -2
  272. package/dist/lib/use-popup-focus-recovery.d.ts +8 -0
  273. package/dist/lib/utils.js +1 -1
  274. package/dist/{media-gallery-DcTtAaeC.js → media-gallery-3zIVLMWH.js} +8 -8
  275. package/dist/media-gallery-3zIVLMWH.js.map +1 -0
  276. package/dist/{mentions-D-uyCh01.js → mentions-CGlEJ15c.js} +144 -142
  277. package/dist/mentions-CGlEJ15c.js.map +1 -0
  278. package/dist/{message-CdHgIWKf.js → message-DZ_ruyUV.js} +6 -5
  279. package/dist/message-DZ_ruyUV.js.map +1 -0
  280. package/dist/{metadata-list-X5rYAKSB.js → metadata-list-8N16ZMW_.js} +130 -119
  281. package/dist/metadata-list-8N16ZMW_.js.map +1 -0
  282. package/dist/{navigation-D3KwXmaq.js → navigation-Bnotn4AQ.js} +19 -19
  283. package/dist/navigation-Bnotn4AQ.js.map +1 -0
  284. package/dist/{navigation-HJf5zxlH.js → navigation-BzhHI3lo.js} +36 -35
  285. package/dist/navigation-BzhHI3lo.js.map +1 -0
  286. package/dist/{navigation-row-recipes-BVowojQw.js → navigation-row-recipes-BFLCk_Aq.js} +2 -2
  287. package/dist/{navigation-row-recipes-BVowojQw.js.map → navigation-row-recipes-BFLCk_Aq.js.map} +1 -1
  288. package/dist/{number-DMhe-Vsk.js → number-DbV1Dija.js} +36 -34
  289. package/dist/{number-DMhe-Vsk.js.map → number-DbV1Dija.js.map} +1 -1
  290. package/dist/{overflow-tab-bar-sQHXLlwQ.js → overflow-tab-bar-CWY7Nogn.js} +105 -103
  291. package/dist/overflow-tab-bar-CWY7Nogn.js.map +1 -0
  292. package/dist/{overlays-I0axtYA6.js → overlays-tMkF-VAN.js} +282 -278
  293. package/dist/overlays-tMkF-VAN.js.map +1 -0
  294. package/dist/{page-B5dTH9gE.js → page-CL9YeH_V.js} +8 -8
  295. package/dist/{page-B5dTH9gE.js.map → page-CL9YeH_V.js.map} +1 -1
  296. package/dist/{page-header-commands-DjzFEq3E.js → page-header-commands-DOb6WsfD.js} +5 -5
  297. package/dist/{page-header-commands-DjzFEq3E.js.map → page-header-commands-DOb6WsfD.js.map} +1 -1
  298. package/dist/pagination-BL25hu2s.js +158 -0
  299. package/dist/pagination-BL25hu2s.js.map +1 -0
  300. package/dist/{popover-Di55PyAI.js → popover-gnTOhbFM.js} +69 -66
  301. package/dist/popover-gnTOhbFM.js.map +1 -0
  302. package/dist/popover-menu-Cn9rUkdc.js +100 -0
  303. package/dist/popover-menu-Cn9rUkdc.js.map +1 -0
  304. package/dist/{popover.recipes-Bdyhj2db.js → popover.recipes-D3j8R8Yp.js} +17 -10
  305. package/dist/popover.recipes-D3j8R8Yp.js.map +1 -0
  306. package/dist/{primitives-B-CkiEMU.js → primitives-BFK08r9M.js} +45 -44
  307. package/dist/primitives-BFK08r9M.js.map +1 -0
  308. package/dist/primitives.js +4 -4
  309. package/dist/{progress-rnS8-uAW.js → progress-B1VnCT0K.js} +5 -5
  310. package/dist/{progress-rnS8-uAW.js.map → progress-B1VnCT0K.js.map} +1 -1
  311. package/dist/{receipt-D0oswZ0p.js → receipt-BVSOH3Xo.js} +9 -6
  312. package/dist/{receipt-D0oswZ0p.js.map → receipt-BVSOH3Xo.js.map} +1 -1
  313. package/dist/{rich-text-DvGulsNJ.js → rich-text-GOUyKQ-s.js} +3 -3
  314. package/dist/{rich-text-DvGulsNJ.js.map → rich-text-GOUyKQ-s.js.map} +1 -1
  315. package/dist/{rich-text-editor-sMU_Scqm.js → rich-text-editor-cRLC-eBK.js} +418 -426
  316. package/dist/rich-text-editor-cRLC-eBK.js.map +1 -0
  317. package/dist/rich-text-editor-toolbar-DfXg0-VC.js +94 -0
  318. package/dist/rich-text-editor-toolbar-DfXg0-VC.js.map +1 -0
  319. package/dist/{scroll-area-Bt_vXY2b.js → scroll-area-DcI-M1UT.js} +2 -2
  320. package/dist/{scroll-area-Bt_vXY2b.js.map → scroll-area-DcI-M1UT.js.map} +1 -1
  321. package/dist/{separator-C8DlRGwF.js → separator-BDV-Y648.js} +3 -3
  322. package/dist/{separator-C8DlRGwF.js.map → separator-BDV-Y648.js.map} +1 -1
  323. package/dist/{separator-CYHnjsAb.js → separator-Bom7NsGO.js} +2 -2
  324. package/dist/{separator-CYHnjsAb.js.map → separator-Bom7NsGO.js.map} +1 -1
  325. package/dist/services/actions.js +1 -1
  326. package/dist/{settings-CQW3b-Cu.js → settings-ybnjVwbd.js} +20 -19
  327. package/dist/settings-ybnjVwbd.js.map +1 -0
  328. package/dist/{sheet-4SEvVYzA.js → sheet-ijlsjq-n.js} +76 -73
  329. package/dist/sheet-ijlsjq-n.js.map +1 -0
  330. package/dist/{sidebar-C7WWR29L.js → sidebar-Db6gkh3U.js} +183 -182
  331. package/dist/sidebar-Db6gkh3U.js.map +1 -0
  332. package/dist/{sidebar-d7Dg80ln.js → sidebar-DkTO4VTO.js} +14 -13
  333. package/dist/{sidebar-d7Dg80ln.js.map → sidebar-DkTO4VTO.js.map} +1 -1
  334. package/dist/{skeleton-Cz890JZF.js → skeleton-Byjnt7qr.js} +3 -3
  335. package/dist/{skeleton-Cz890JZF.js.map → skeleton-Byjnt7qr.js.map} +1 -1
  336. package/dist/smart-card-DiC5aac3.js +604 -0
  337. package/dist/smart-card-DiC5aac3.js.map +1 -0
  338. package/dist/{structure-DC2dygdA.js → structure-BmisBK-3.js} +2 -2
  339. package/dist/{structure-DC2dygdA.js.map → structure-BmisBK-3.js.map} +1 -1
  340. package/dist/style.css +1 -1
  341. package/dist/table-BweFy_P9.js +1530 -0
  342. package/dist/table-BweFy_P9.js.map +1 -0
  343. package/dist/{table-CIKyLUsy.js → table-DsfzoUia.js} +75 -63
  344. package/dist/table-DsfzoUia.js.map +1 -0
  345. package/dist/{tabs-DwBJfjxX.js → tabs-CDocW5D1.js} +14 -13
  346. package/dist/tabs-CDocW5D1.js.map +1 -0
  347. package/dist/text-inputs-f9Ia-aCi.js +353 -0
  348. package/dist/text-inputs-f9Ia-aCi.js.map +1 -0
  349. package/dist/theme-mode-css-BB-_RYab.js +14 -0
  350. package/dist/theme-mode-css-BB-_RYab.js.map +1 -0
  351. package/dist/theme-scope-BJ6eE2xt.js +50 -0
  352. package/dist/theme-scope-BJ6eE2xt.js.map +1 -0
  353. package/dist/theme.css +285 -228
  354. package/dist/themes/green.css +16 -12
  355. package/dist/timelines-CwM_9IhD.js +457 -0
  356. package/dist/timelines-CwM_9IhD.js.map +1 -0
  357. package/dist/{tone-recipes-CPoExcTE.js → tone-recipes-BPsRAvhu.js} +5 -2
  358. package/dist/tone-recipes-BPsRAvhu.js.map +1 -0
  359. package/dist/{tooltip-CsfgrfS7.js → tooltip-yiRJUFjp.js} +4 -4
  360. package/dist/{tooltip-CsfgrfS7.js.map → tooltip-yiRJUFjp.js.map} +1 -1
  361. package/dist/{tree-BiKhg8AY.js → tree-WnKQzwbq.js} +9 -9
  362. package/dist/{tree-BiKhg8AY.js.map → tree-WnKQzwbq.js.map} +1 -1
  363. package/dist/typography/rich-text.js +1 -1
  364. package/dist/{typography-DTRkE9zL.js → typography-UTnveOEy.js} +6 -6
  365. package/dist/typography-UTnveOEy.js.map +1 -0
  366. package/dist/typography.js +2 -2
  367. package/dist/{ui-provider-1D_NSYzO.js → ui-provider-C_U0Xma4.js} +3 -3
  368. package/dist/ui-provider-C_U0Xma4.js.map +1 -0
  369. package/dist/ui-provider.js +2 -2
  370. package/dist/{upload-BO8-CLN6.js → upload-CXyxmQBP.js} +13 -12
  371. package/dist/upload-CXyxmQBP.js.map +1 -0
  372. package/dist/{upload-queue-EOC8g1gf.js → upload-queue-Boscubn9.js} +11 -9
  373. package/dist/upload-queue-Boscubn9.js.map +1 -0
  374. package/dist/{usage-card-obRaBskq.js → usage-card-BhO5eqkX.js} +53 -37
  375. package/dist/usage-card-BhO5eqkX.js.map +1 -0
  376. package/dist/use-popup-focus-recovery-C0QPvgOR.js +36 -0
  377. package/dist/use-popup-focus-recovery-C0QPvgOR.js.map +1 -0
  378. package/dist/{utils-l5LpDw2z.js → utils-BRhFDwuU.js} +59 -44
  379. package/dist/utils-BRhFDwuU.js.map +1 -0
  380. package/dist/{value-inputs-TAYMX111.js → value-inputs-TaX4OjNk.js} +268 -252
  381. package/dist/value-inputs-TaX4OjNk.js.map +1 -0
  382. package/dist/{value-typography-b8wpz1eX.js → value-typography-BP8OG6h5.js} +2 -2
  383. package/dist/{value-typography-b8wpz1eX.js.map → value-typography-BP8OG6h5.js.map} +1 -1
  384. package/dist/{workspace-DH0v0KcB.js → workspace-B-OEm3Kf.js} +34 -33
  385. package/dist/workspace-B-OEm3Kf.js.map +1 -0
  386. package/docs/consumer-skill/SKILL.md +3 -3
  387. package/docs/consumer-skill/references/agents-md.md +1 -1
  388. package/docs/consumer-skill/references/composition.md +8 -6
  389. package/docs/consumer-skill/references/installation.md +6 -0
  390. package/docs/consumer-skill/references/integration.md +4 -3
  391. package/docs/consumer-skill/references/public-api.json +105 -2
  392. package/docs/consumer-skill/references/review.md +7 -0
  393. package/docs/consumer-skill/references/theming.md +71 -6
  394. package/docs/consumer-skill/references/tokens.json +1 -1
  395. package/docs/consumer-skill/references/workflows.md +26 -0
  396. package/docs/consumer-skill/scripts/composition-policy.mjs +3 -2
  397. package/docs/consumer-skill/scripts/surface-policy.mjs +11 -0
  398. package/package.json +8 -4
  399. package/dist/accordion-B6a3vVgA.js.map +0 -1
  400. package/dist/action-menu-TzCoSlwL.js +0 -280
  401. package/dist/action-menu-TzCoSlwL.js.map +0 -1
  402. package/dist/affordance-geometry.generated-B5iu-Mkr.js +0 -69
  403. package/dist/affordance-geometry.generated-B5iu-Mkr.js.map +0 -1
  404. package/dist/ai-artifact-BMJdv-6q.js +0 -1115
  405. package/dist/ai-artifact-BMJdv-6q.js.map +0 -1
  406. package/dist/attachment-BtfhGm8i.js +0 -245
  407. package/dist/attachment-BtfhGm8i.js.map +0 -1
  408. package/dist/auth-CYxKfo69.js.map +0 -1
  409. package/dist/avatar-BBnEJIx8.js.map +0 -1
  410. package/dist/badge-MrKVNzW9.js.map +0 -1
  411. package/dist/batch-action-bar-BZGDG-Si.js.map +0 -1
  412. package/dist/breadcrumbs-D5t7I023.js.map +0 -1
  413. package/dist/buttons-SbIcm1HJ.js.map +0 -1
  414. package/dist/cards-CiiHpKYd.js +0 -66
  415. package/dist/cards-CiiHpKYd.js.map +0 -1
  416. package/dist/chart-QfrARkXl.js.map +0 -1
  417. package/dist/choice-inputs-t6w3ATNz.js.map +0 -1
  418. package/dist/code-block-Dgbu-CU3.js.map +0 -1
  419. package/dist/combobox-2Ic8N9bL.js +0 -278
  420. package/dist/combobox-2Ic8N9bL.js.map +0 -1
  421. package/dist/combobox-DLl0bfiq.js.map +0 -1
  422. package/dist/comments-BpDuCUUu.js.map +0 -1
  423. package/dist/data-display-DafIvCl5.js.map +0 -1
  424. package/dist/date-picker-CF-DtUpF.js.map +0 -1
  425. package/dist/date-pickers-BmzxJl5l.js +0 -174
  426. package/dist/date-pickers-BmzxJl5l.js.map +0 -1
  427. package/dist/display-DsQTVzMz.js.map +0 -1
  428. package/dist/dropdown-menu-E2qmdC7o.js +0 -193
  429. package/dist/dropdown-menu-E2qmdC7o.js.map +0 -1
  430. package/dist/editable-text-recipe-Bkm6wKHp.js +0 -10
  431. package/dist/editable-text-recipe-Bkm6wKHp.js.map +0 -1
  432. package/dist/feedback-qNuMBtRH.js +0 -233
  433. package/dist/feedback-qNuMBtRH.js.map +0 -1
  434. package/dist/field-affordance-recipes-qQeIf4lG.js.map +0 -1
  435. package/dist/filters-BkHH53uv.js.map +0 -1
  436. package/dist/form-field-DUt4UxSV.js.map +0 -1
  437. package/dist/form-sizing-By94KzXE.js.map +0 -1
  438. package/dist/forms-numeric-C0bvjRPZ.js.map +0 -1
  439. package/dist/header-BOefOKd1.js.map +0 -1
  440. package/dist/input-DWhBBBww.js +0 -262
  441. package/dist/input-DWhBBBww.js.map +0 -1
  442. package/dist/input-Ddi_LSYv.js +0 -20
  443. package/dist/input-Ddi_LSYv.js.map +0 -1
  444. package/dist/interaction-recipes-CHr0dJUs.js.map +0 -1
  445. package/dist/item-DEmDiTlD.js +0 -265
  446. package/dist/item-DEmDiTlD.js.map +0 -1
  447. package/dist/media-gallery-DcTtAaeC.js.map +0 -1
  448. package/dist/mentions-D-uyCh01.js.map +0 -1
  449. package/dist/message-CdHgIWKf.js.map +0 -1
  450. package/dist/metadata-list-X5rYAKSB.js.map +0 -1
  451. package/dist/navigation-D3KwXmaq.js.map +0 -1
  452. package/dist/navigation-HJf5zxlH.js.map +0 -1
  453. package/dist/overflow-tab-bar-sQHXLlwQ.js.map +0 -1
  454. package/dist/overlays-I0axtYA6.js.map +0 -1
  455. package/dist/pagination-3bPA_a6K.js +0 -149
  456. package/dist/pagination-3bPA_a6K.js.map +0 -1
  457. package/dist/popover-Di55PyAI.js.map +0 -1
  458. package/dist/popover-menu-B71Tn2Qz.js +0 -99
  459. package/dist/popover-menu-B71Tn2Qz.js.map +0 -1
  460. package/dist/popover.recipes-Bdyhj2db.js.map +0 -1
  461. package/dist/primitives-B-CkiEMU.js.map +0 -1
  462. package/dist/rich-text-editor-sMU_Scqm.js.map +0 -1
  463. package/dist/rich-text-editor.recipes-CadiF_Uu.js +0 -88
  464. package/dist/rich-text-editor.recipes-CadiF_Uu.js.map +0 -1
  465. package/dist/settings-CQW3b-Cu.js.map +0 -1
  466. package/dist/sheet-4SEvVYzA.js.map +0 -1
  467. package/dist/sidebar-C7WWR29L.js.map +0 -1
  468. package/dist/smart-card-lFKxn5Hu.js +0 -595
  469. package/dist/smart-card-lFKxn5Hu.js.map +0 -1
  470. package/dist/spinner-fa3h1Aif.js +0 -80
  471. package/dist/spinner-fa3h1Aif.js.map +0 -1
  472. package/dist/table-CIKyLUsy.js.map +0 -1
  473. package/dist/table-CrcLN9Io.js +0 -1458
  474. package/dist/table-CrcLN9Io.js.map +0 -1
  475. package/dist/tabs-DwBJfjxX.js.map +0 -1
  476. package/dist/text-inputs-aaK9wcDT.js +0 -326
  477. package/dist/text-inputs-aaK9wcDT.js.map +0 -1
  478. package/dist/theme-scope-kStaAer0.js +0 -39
  479. package/dist/theme-scope-kStaAer0.js.map +0 -1
  480. package/dist/timelines-C_SBwHNP.js +0 -442
  481. package/dist/timelines-C_SBwHNP.js.map +0 -1
  482. package/dist/tone-recipes-CPoExcTE.js.map +0 -1
  483. package/dist/typography-DTRkE9zL.js.map +0 -1
  484. package/dist/ui-provider-1D_NSYzO.js.map +0 -1
  485. package/dist/upload-BO8-CLN6.js.map +0 -1
  486. package/dist/upload-queue-EOC8g1gf.js.map +0 -1
  487. package/dist/usage-card-obRaBskq.js.map +0 -1
  488. package/dist/utils-l5LpDw2z.js.map +0 -1
  489. package/dist/value-inputs-TAYMX111.js.map +0 -1
  490. package/dist/workspace-DH0v0KcB.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"map.js","names":["React","Map","_Fragment","ButtonGroup","Text","DropdownMenuSeparator","DropdownMenuTrigger","DropdownMenuGroup","DropdownMenuRadioGroup","DropdownMenuCheckboxItem","DropdownMenuLabel","DropdownMenuContent","DropdownMenu","DropdownMenuRadioItem","CommandItem","CommandEmpty","CommandList","CommandGroup","Command","PopoverTrigger","Popover","PopoverContent","InputGroup","InputGroupInput","InputGroupAddon","useDebounce","React$1","Fragment$1","defaultPlaceAutocompleteStrings","formatAddress","parts","properties","buildSearchUrl","url","query","lang","limit","bbox","lat","lon","zoom","locationBiasScale","searchPhoton","response","options","usePlaceSearch","results","setResults","isLoading","setIsLoading","error","setError","hasSearched","setHasSearched","retryAttempt","setRetryAttempt","onSearchErrorRef","onSearchError","debouncedQuery","debounceMs","bboxKey","current","abortController","fetchResults","features","searchPlaces","signal","addressOsmIds","id","feature","err","failure","attempt","formatPlaceAutocompleteString","template","params","key","match","PlaceAutocomplete","controlledValue","controlledOnValueChange","stringsProp","inputOnFocus","props","strings","useStrings","internalValue","setInternalValue","defaultValue","searchQuery","setSearchQuery","isListDismissed","setIsListDismissed","activeIndex","setActiveIndex","listId","anchorRef","popoverActionsRef","optionNodes","isControlled","displayValue","onResultsChangeRef","onResultsChange","hasNoResults","hasCommandList","showCommandList","selectPlace","address","onPlaceSelect","cn","className","event","flushSync","next","open","details","SearchIcon","index","newValue","Loader2Icon","Button","retry","formattedAddress","node","MapPinIcon","useMapColorScheme","read","useCallback","container","subscribe","observer","notify","useSyncExternalStore","ReactLeafletHooksContext","createContext","defaultMapStrings","MapStringsContext","useMapStrings","useContext","ReactLeafletRuntimeContext","ReactLeafletRuntime","lazy","mod","createRuntimeComponent","runtime","Component","select","LeafletMapContainer","LeafletTileLayer","LeafletMarker","LeafletPopup","LeafletTooltip","LeafletCircle","LeafletCircleMarker","LeafletPolyline","LeafletPolygon","LeafletRectangle","LeafletLayerGroup","LeafletFeatureGroup","createLazyComponent","factory","Suspense","LeafletMarkerClusterGroup","ReactLeafletHooksProvider","useLeafletMap","hooks","useLeafletMapEvents","handlers","assignRef","ref","value","Map$1","focusCleanup","useRef","handleMapRef","map","focusWithoutScroll","isMounted","setIsMounted","useState","useEffect","MapLayersContext","useMapLayersContext","MapTileLayer","nameProp","name","context","resolvedTheme","resolvedUrl","darkUrl","resolvedAttribution","darkAttribution","attribution","MapLayerGroup","disabled","MapFeatureGroup","MapLayers","tileLayers","setTileLayers","selectedTileLayer","setSelectedTileLayer","defaultTileLayer","layerGroups","setLayerGroups","activeLayerGroups","setActiveLayerGroups","defaultLayerGroups","registerTileLayer","prevTileLayers","layer","tileLayer","registerLayerGroup","prevLayerGroups","group","layerGroup","validDefaultValue","MapLayersControl","layersContext","handleLayerGroupToggle","checked","groupName","showTileLayersDropdown","showLayerGroupsDropdown","triggerProps","position","LayersIcon","tileLayersLabel","layerGroupsLabel","MapMarker","useLeaflet","markerRef","resolvedAriaLabel","ariaLabel","resolvedTitle","syncMarkerElement","element","marker","handleMarkerRef","L","renderToString","icon","bgPos","popupAnchor","tooltipAnchor","MapMarkerClusterGroup","iconNode","cluster","MapCircle","MapCircleMarker","MapPolyline","MapPolygon","MapRectangle","MapPopup","MapTooltip","ARROW_POSITION_CLASSES","DEFAULT_OFFSET","sideOffset","side","children","MapZoomControl","zoomLevel","setZoomLevel","MapControlContainer","PlusIcon","MinusIcon","MapFullscreenControl","isFullscreen","setIsFullscreen","fullscreenControl","handleEnter","handleExit","jsx","MinimizeIcon","MaximizeIcon","MapLocatePulseIcon","MapLocateControl","isLocating","setIsLocating","useDelayedLoadingState","location","setLocation","hasLocation","startLocating","onLocationFound","onLocationError","watch","stopLocating","trackingHandler","trackingTitle","trackingAriaLabel","locationMarker","LoaderCircleIcon","NavigationIcon","MapSearchControl","MapDrawContext","useMapDrawContext","MapDrawControl","featureGroupRef","editControlRef","deleteControlRef","activeMode","setActiveMode","layersCount","setLayersCount","updateLayersCount","handleDrawCreated","onLayersChange","handleDrawEditedOrDeleted","LeafletDraw","MapDrawShapeButton","drawContext","controlRef","isActive","drawMode","drawLabel","control","createDrawTool","handleClick","MapDrawMarker","MapDrawPolyline","mapDrawHandleIcon","useMapDrawHandleIcon","WaypointsIcon","MapDrawCircle","CircleIcon","MapDrawRectangle","SquareIcon","MapDrawPolygon","PentagonIcon","MapDrawActionButton","drawAction","hasFeatures","actionLabel","featureGroup","MapDrawEdit","PenLineIcon","MapDrawDelete","Trash2Icon","MapDrawUndo","isInEditMode","isInDeleteMode","undoLabel","handleUndo","Undo2Icon","containerRef","setL","setLeafletDraw","loadLeaflet","leaflet","leafletFullscreen","leafletDraw","L_object","showLoading","setShowLoading","timeoutRef","delay"],"sources":["../../src/components/features/map/place-autocomplete.tsx","../../src/components/features/map/use-map-color-scheme.ts","../../src/components/features/map/map.tsx"],"sourcesContent":["import { Button } from \"../../base/buttons\"\nimport { Text } from \"../../typography\"\nimport { useDebounce } from \"../../../hooks/use-debounce\"\nimport { DEFAULT_DEBOUNCE_MS } from \"../../../hooks/use-debounced-callback\"\nimport { useStrings, type StringsProp } from \"../../../lib/strings\"\nimport { cn } from \"../../../lib/utils\"\nimport {\n\t\tCommand,\n\t\tCommandEmpty,\n\t\tCommandGroup,\n\t\tCommandItem,\n\t\tCommandList,\n} from \"../../base/command\"\nimport {\n\t\tPopover,\n\t\tPopoverContent,\n\t\tPopoverTrigger,\n} from \"../../base/popover\"\nimport { InputGroup, InputGroupAddon, InputGroupInput } from '../../base/text-inputs';\nimport { Loader2Icon, MapPinIcon, SearchIcon } from \"lucide-react\"\nimport * as React from \"react\"\nimport { flushSync } from \"react-dom\"\n\ntype BBox = [number, number, number, number]\ntype Point = {\n\t\ttype: \"Point\"\n\t\tcoordinates: [number, number]\n}\ntype Feature<TGeometry, TProperties> = {\n\t\ttype: \"Feature\"\n\t\tgeometry: TGeometry\n\t\tproperties: TProperties\n\t\tbbox?: BBox\n}\ntype FeatureCollection<TGeometry, TProperties> = {\n\t\ttype: \"FeatureCollection\"\n\t\tfeatures: Array<Feature<TGeometry, TProperties>>\n\t\tbbox?: BBox\n}\n\ninterface PlaceFeatureProperties {\n\t\tosm_id: number\n\t\tosm_type: \"N\" | \"W\" | \"R\"\n\t\tosm_key: string\n\t\tosm_value: string\n\t\ttype: string\n\t\t/** Form field name, forwarded for native submits. */\n\t\tname?: string\n\t\thousenumber?: string\n\t\tstreet?: string\n\t\tlocality?: string\n\t\tdistrict?: string\n\t\tpostcode?: string\n\t\tcity?: string\n\t\tcounty?: string\n\t\tstate?: string\n\t\tcountry?: string\n\t\tcountrycode?: string\n\t\textent?: [number, number, number, number]\n\t\textra?: Record<string, string>\n}\ntype PlaceFeature = Feature<Point, PlaceFeatureProperties>\ntype PlaceFeatureCollection = FeatureCollection<Point, PlaceFeatureProperties>\n\ninterface PlaceAutocompleteStrings {\n\t\tsearchPlaceholder: string\n\t\t/** Announced while a place lookup is in flight. */\n\t\tloading: string\n\t\terror: string\n\t\t/** Action shown after a failed lookup. */\n\t\tretry?: string\n\t\tnoResults: string\n\t\tunknownPlace: string\n}\n\nconst defaultPlaceAutocompleteStrings: PlaceAutocompleteStrings = {\n\t\tsearchPlaceholder: \"Search\",\n\t\tloading: \"Searching places\",\n\t\terror: \"Error: {{message}}\",\n\t\tretry: \"Retry\",\n\t\tnoResults: \"Can't find {{query}}.\",\n\t\tunknownPlace: \"Unknown\",\n}\n\n/**\n * Query parameters for Photon geocoding API\n * @see https://github.com/komoot/photon#photon-api\n */\ninterface PlaceSearchOptions {\n\t\t/** Search text (address, place name, or POI) */\n\t\tquery: string\n\t\t/** Preferred language for results (e.g., \"en\", \"de\", \"fr\") */\n\t\tlang?: string\n\t\t/** Maximum number of results to return */\n\t\tlimit?: number\n\t\t/**\n\t\t * Bounding box used to restrict results.\n\t\t * Format: [minLongitude, minLatitude, maxLongitude, maxLatitude]\n\t\t */\n\t\tbbox?: BBox\n\t\t/** Latitude used to bias results toward a specific location */\n\t\tlat?: number\n\t\t/** Longitude used to bias results toward a specific location */\n\t\tlon?: number\n\t\t/**\n\t\t * Zoom level used for location biasing.\n\t\t * Higher values increase locality.\n\t\t */\n\t\tzoom?: number\n\t\t/**\n\t\t * Strength of the location bias.\n\t\t */\n\t\tlocationBiasScale?: number\n}\n\n/** Consumer-owned geocoding integration. Keep callback identity stable until its provider changes. */\ntype PlaceSearchCallback = (options: PlaceSearchOptions, signal: AbortSignal) => Promise<PlaceFeature[]>\n\ninterface PlaceAutocompleteProps\n\t\textends Omit<PlaceSearchOptions, \"query\">,\n\t\t\t\tOmit<React.ComponentProps<\"input\">, \"value\" | \"onChange\"> {\n\t\tdebounceMs?: number\n\t\t/** Current value. Controlled. */\n\t\tvalue?: string\n\t\t/** Initial value for uncontrolled use. */\n\t\tdefaultValue?: string\n\t\t/** Fired with the next text value. */\n\t\tonValueChange?: (value: string) => void\n\t\tonPlaceSelect?: (feature: PlaceFeature) => void\n\t\tonResultsChange?: (results: PlaceFeature[]) => void\n\t\t/** Overrides Photon. Memoize when its implementation captures consumer state. */\n\t\tsearchPlaces?: PlaceSearchCallback\n\t\t/** Reports a current lookup failure; cancelled or superseded failures are ignored. */\n\t\tonSearchError?: (error: Error) => void\n\t\t/** Overrides this surface's own copy. */\n\t\tstrings?: StringsProp<PlaceAutocompleteStrings>\n}\n\nfunction formatAddress(properties: PlaceFeatureProperties) {\n\t\tconst parts = []\n\n\t\tif (properties.name) {\n\t\t\t\tparts.push(properties.name)\n\t\t}\n\n\t\tif (properties.housenumber && properties.street) {\n\t\t\t\tparts.push(`${properties.housenumber} ${properties.street}`)\n\t\t} else if (properties.street) {\n\t\t\t\tparts.push(properties.street)\n\t\t}\n\n\t\tif (properties.city) {\n\t\t\t\tparts.push(properties.city)\n\t\t} else if (properties.locality) {\n\t\t\t\tparts.push(properties.locality)\n\t\t}\n\n\t\tif (properties.state && properties.state !== properties.city) {\n\t\t\t\tparts.push(properties.state)\n\t\t}\n\n\t\tif (properties.country) {\n\t\t\t\tparts.push(properties.country)\n\t\t}\n\n\t\treturn [...new Set(parts)].join(\", \")\n}\n\nfunction buildSearchUrl({\n\t\tquery,\n\t\tbbox,\n\t\tlang,\n\t\tlat,\n\t\tlimit,\n\t\tlocationBiasScale,\n\t\tlon,\n\t\tzoom,\n}: PlaceSearchOptions) {\n\t\tconst url = new URL(\"https://photon.komoot.io/api\")\n\t\turl.searchParams.set(\"q\", query)\n\n\t\tif (lang) {\n\t\t\t\turl.searchParams.set(\"lang\", lang)\n\t\t}\n\n\t\tif (limit) {\n\t\t\t\turl.searchParams.set(\"limit\", String(limit))\n\t\t}\n\n\t\tif (bbox) {\n\t\t\t\turl.searchParams.set(\"bbox\", bbox.join(\",\"))\n\t\t}\n\n\t\tif (lat !== undefined && lon !== undefined) {\n\t\t\t\turl.searchParams.set(\"lat\", String(lat))\n\t\t\t\turl.searchParams.set(\"lon\", String(lon))\n\t\t}\n\n\t\tif (zoom !== undefined) {\n\t\t\t\turl.searchParams.set(\"zoom\", String(zoom))\n\t\t}\n\n\t\tif (locationBiasScale !== undefined) {\n\t\t\t\turl.searchParams.set(\"location_bias_scale\", String(locationBiasScale))\n\t\t}\n\n\t\treturn String(url)\n}\n\nconst searchPhoton: PlaceSearchCallback = async (options, signal) => {\n\t\tconst response = await fetch(buildSearchUrl(options), { signal })\n\t\tif (!response.ok) {\n\t\t\t\tthrow new Error(`Photon API error: ${response.status} ${response.statusText}`)\n\t\t}\n\t\tconst data: PlaceFeatureCollection = await response.json()\n\t\treturn data.features\n}\n\nfunction usePlaceSearch({\n\t\tdebounceMs,\n\t\tquery,\n\t\tlang,\n\t\tlimit,\n\t\tbbox,\n\t\tlat,\n\t\tlon,\n\t\tzoom,\n\t\tlocationBiasScale,\n\t\tsearchPlaces = searchPhoton,\n\t\tonSearchError,\n}: {\n\t\tdebounceMs: number\n\t\tsearchPlaces?: PlaceSearchCallback\n\t\tonSearchError?: (error: Error) => void\n} & PlaceSearchOptions) {\n\t\tconst [results, setResults] = React.useState<PlaceFeature[]>([])\n\t\tconst [isLoading, setIsLoading] = React.useState(false)\n\t\tconst [error, setError] = React.useState<Error | null>(null)\n\t\tconst [hasSearched, setHasSearched] = React.useState(false)\n\t\tconst [retryAttempt, setRetryAttempt] = React.useState(0)\n\t\tconst onSearchErrorRef = React.useRef(onSearchError)\n\t\tReact.useEffect(() => { onSearchErrorRef.current = onSearchError }, [onSearchError])\n\n\t\tconst debouncedQuery = useDebounce(query, debounceMs)\n\t\t// Tuple values define the context; a consumer's inline bbox must not restart it.\n\t\tconst bboxKey = bbox?.join(',')\n\n\t\tReact.useEffect(() => {\n\t\t\t\tsetResults(current => current.length ? [] : current)\n\t\t\t\tsetError(null)\n\t\t\t\tif (!query.trim() || query !== debouncedQuery) {\n\t\t\t\t\t\tsetIsLoading(false)\n\t\t\t\t\t\tsetHasSearched(false)\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst abortController = new AbortController()\n\t\t\t\tconst { signal } = abortController\n\t\t\t\tsetIsLoading(true)\n\t\t\t\tsetHasSearched(true)\n\n\t\t\t\tasync function fetchResults() {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst features = await searchPlaces({\n\t\t\t\t\t\t\t\t\t\tquery: debouncedQuery, lang, limit,\n\t\t\t\t\t\t\t\t\t\tbbox: bboxKey ? bboxKey.split(',').map(Number) as BBox : undefined,\n\t\t\t\t\t\t\t\t\t\tlat, lon, zoom, locationBiasScale,\n\t\t\t\t\t\t\t\t}, signal)\n\t\t\t\t\t\t\t\tif (signal.aborted) return\n\t\t\t\t\t\t\t\tconst addressOsmIds = new Set<number>()\n\t\t\t\t\t\t\t\tsetResults(features.filter(feature => {\n\t\t\t\t\t\t\t\t\t\tconst id = feature.properties.osm_id\n\t\t\t\t\t\t\t\t\t\tif (addressOsmIds.has(id)) return false\n\t\t\t\t\t\t\t\t\t\taddressOsmIds.add(id)\n\t\t\t\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t\t\t}))\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tif (signal.aborted || (err instanceof Error && err.name === 'AbortError')) return\n\t\t\t\t\t\t\t\tconst failure = err instanceof Error ? err : new Error(String(err))\n\t\t\t\t\t\t\t\tsetError(failure)\n\t\t\t\t\t\t\t\tonSearchErrorRef.current?.(failure)\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\t\tif (!signal.aborted) setIsLoading(false)\n\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvoid fetchResults()\n\t\t\t\treturn () => abortController.abort()\n\t\t}, [query, debouncedQuery, lang, limit, bboxKey, lat, lon, zoom, locationBiasScale, searchPlaces, retryAttempt])\n\n\t\treturn { results, isLoading, error, hasSearched, retry: () => setRetryAttempt(attempt => attempt + 1) }\n}\n\nfunction formatPlaceAutocompleteString(\n\t\ttemplate: string,\n\t\tparams: Record<string, string>\n) {\n\t\treturn template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, key) => {\n\t\t\t\treturn params[key] ?? match\n\t\t})\n}\n\nfunction PlaceAutocomplete({\n\t\tdebounceMs = DEFAULT_DEBOUNCE_MS,\n\t\tlang,\n\t\tlimit = 5,\n\t\tbbox,\n\t\tlat,\n\t\tlon,\n\t\tzoom,\n\t\tlocationBiasScale,\n\t\tclassName,\n\t\tvalue: controlledValue,\n\t\tdefaultValue = \"\",\n\t\tonValueChange: controlledOnValueChange,\n\t\tonPlaceSelect,\n\t\tonResultsChange,\n\t\tsearchPlaces,\n\t\tonSearchError,\n\t\tstrings: stringsProp,\n\t\tonFocus: inputOnFocus,\n\t\t...props\n}: PlaceAutocompleteProps) {\n\t\tconst strings = useStrings(defaultPlaceAutocompleteStrings, stringsProp)\n\t\tconst [internalValue, setInternalValue] = React.useState(defaultValue)\n\t\tconst [searchQuery, setSearchQuery] = React.useState(\"\")\n\t\tconst [isListDismissed, setIsListDismissed] = React.useState(false)\n\t\tconst [activeIndex, setActiveIndex] = React.useState(-1)\n\t\tconst listId = React.useId()\n\t\tconst anchorRef = React.useRef<HTMLDivElement>(null)\n\t\tconst popoverActionsRef: React.ComponentProps<typeof Popover>['actionsRef'] = React.useRef(null)\n\t\tconst optionNodes = React.useRef(new Map<number, HTMLElement>())\n\n\t\tconst isControlled = controlledValue !== undefined\n\t\tconst displayValue = isControlled ? controlledValue : internalValue\n\n\t\tconst { results, isLoading, error, hasSearched, retry } = usePlaceSearch({\n\t\t\t\tquery: searchQuery,\n\t\t\t\tsearchPlaces,\n\t\t\t\tonSearchError,\n\t\t\t\tdebounceMs,\n\t\t\t\tlang,\n\t\t\t\tlimit,\n\t\t\t\tbbox,\n\t\t\t\tlat,\n\t\t\t\tlon,\n\t\t\t\tzoom,\n\t\t\t\tlocationBiasScale,\n\t\t})\n\n\t\tconst onResultsChangeRef = React.useRef(onResultsChange)\n\t\tReact.useEffect(() => { onResultsChangeRef.current = onResultsChange }, [onResultsChange])\n\t\tReact.useEffect(() => {\n\t\t\t\tonResultsChangeRef.current?.(results)\n\t\t}, [results])\n\n\t\tconst hasNoResults =\n\t\t\t\thasSearched && !isLoading && !error && results.length === 0\n\t\tconst hasCommandList = Boolean(error || hasNoResults || results.length > 0)\n\t\tconst showCommandList = hasCommandList && !isListDismissed\n\t\tconst selectPlace = (feature: PlaceFeature) => {\n\t\t\t\tconst address = formatAddress(feature.properties)\n\t\t\t\tif (!isControlled) setInternalValue(address)\n\t\t\t\tsetSearchQuery(\"\")\n\t\t\t\tsetIsListDismissed(true)\n\t\t\t\tsetActiveIndex(-1)\n\t\t\t\tcontrolledOnValueChange?.(address)\n\t\t\t\tonPlaceSelect?.(feature)\n\t\t}\n\t\tconst optionId = (index: number) => optionNodes.current.get(index)?.id\n\n\t\treturn (\n\t\t\t\t<Command\n inset=\"flush\"\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'place-autocomplete--component',\n\t\t\t\t\t\t\t\t// The input group owns the closed-state surface. Keep the\n\t\t\t\t\t\t\t\t// command root flush while inheriting canonical list and row\n\t\t\t\t\t\t\t\t// presentation from base/command.\n\t\t\t\t\t\t\t\t\"h-fit overflow-visible\",\n\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tvalue={activeIndex >= 0 ? String(results[activeIndex]?.properties.osm_id ?? '') : ''}\n\t\t\t\t\t\tonKeyDownCapture={(event) => {\n\t\t\t\t\t\t\tif (!(event.target instanceof HTMLInputElement)) return\n\t\t\t\t\t\t\tif (event.key === 'Tab' && showCommandList && (!error || event.shiftKey)) {\n\t\t\t\t\t\t\t\t// Remove closing popup guards before native Tab follows the page order.\n\t\t\t\t\t\t\t\t// A forward Tab on an error still reaches the popup's Retry action.\n\t\t\t\t\t\t\t\tflushSync(() => {\n\t\t\t\t\t\t\t\t\tsetIsListDismissed(true)\n\t\t\t\t\t\t\t\t\tsetActiveIndex(-1)\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tpopoverActionsRef.current?.unmount()\n\t\t\t\t\t\t\t} else if (event.key === 'Escape') {\n\t\t\t\t\t\t\t\tsetIsListDismissed(true)\n\t\t\t\t\t\t\t\tsetActiveIndex(-1)\n\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t} else if (results.length && ['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) {\n\t\t\t\t\t\t\t\tsetIsListDismissed(false)\n\t\t\t\t\t\t\t\tconst next = event.key === 'Home' ? 0 : event.key === 'End' ? results.length - 1 : activeIndex < 0 ? (event.key === 'ArrowDown' ? 0 : results.length - 1) : (activeIndex + (event.key === 'ArrowDown' ? 1 : -1) + results.length) % results.length\n\t\t\t\t\t\t\t\tsetActiveIndex(next)\n\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t} else if (event.key === 'Enter' && showCommandList && results[activeIndex]) {\n\t\t\t\t\t\t\t\tselectPlace(results[activeIndex])\n\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tshouldFilter={false}\n\t\t\t\t\t\tloop>\n\t\t\t\t\t\t<Popover\n\t\t\t\t\t\t\t\tactionsRef={popoverActionsRef}\n\t\t\t\t\t\t\t\topen={showCommandList}\n\t\t\t\t\t\t\t\tonOpenChange={(open, details) => {\n\t\t\t\t\t\t\t\t\t\t// The visible input is part of this composite, outside the portal.\n\t\t\t\t\t\t\t\t\t\tif (!open && details.reason === 'focus-out' && document.activeElement === anchorRef.current?.querySelector('input')) {\n\t\t\t\t\t\t\t\t\t\t\t\tdetails.cancel()\n\t\t\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (!open) setIsListDismissed(true)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div ref={anchorRef} className=\"place-autocomplete--anchor relative\">\n\t\t\t\t\t\t\t\t\t\t<PopoverTrigger\n\t\t\t\t\t\t\t\t\t\t\t\trender={<span />}\n\t\t\t\t\t\t\t\t\t\t\t\tnativeButton={false}\n\t\t\t\t\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"pointer-events-none absolute inset-0\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<InputGroup className=\"border-input! bg-popover! ring-0!\">\n\t\t\t\t\t\t\t\t\t\t\t\t<InputGroupAddon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SearchIcon />\n\t\t\t\t\t\t\t\t\t\t\t\t</InputGroupAddon>\n\t\t\t\t\t\t\t\t\t\t\t\t<InputGroupInput\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-autocomplete=\"list\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-expanded={showCommandList}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-controls={showCommandList ? listId : undefined}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-activedescendant={showCommandList && results[activeIndex] ? optionId(activeIndex) : undefined}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder={strings.searchPlaceholder}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={displayValue}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={(event) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst newValue = event.target.value\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (!isControlled) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetInternalValue(newValue)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsListDismissed(false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetSearchQuery(newValue)\n\t\t\t\t\t\t\t\t\t\tsetActiveIndex(-1)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolledOnValueChange?.(newValue)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonFocus={(event) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (hasCommandList) setIsListDismissed(false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinputOnFocus?.(event)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t{!!isLoading && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<InputGroupAddon align=\"inline-end\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Loader2Icon className=\"animate-spin\" aria-hidden=\"true\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"inherit\" className=\"sr-only\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{strings.loading}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</InputGroupAddon>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</InputGroup>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<PopoverContent\n\t\t\t\t\t\t\t\t\t\taria-label={strings.searchPlaceholder}\n\t\t\t\t\t\t\t\t\t\talign=\"start\"\n\t\t\t\t\t\t\t\t\t\tsideOffset={4}\n\t\t\t\t\t\t\t\t\t\tinitialFocus={false}\n\t\t\t\t\t\t\t\t\t\tfinalFocus={false}\n\t\t\t\t\t\t\t\t\t\tinset=\"flush\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"place-autocomplete--results w-[var(--anchor-width)] max-w-[var(--available-width)] gap-0 overflow-hidden\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<CommandList id={listId} label={strings.searchPlaceholder} className=\"max-h-72\">\n\t\t\t\t\t\t\t\t\t\t\t\t{!!error && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\" align=\"center\" className=\"block\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{formatPlaceAutocompleteString(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrings.error,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ message: error.message }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Button buttonStyle=\"ghost\" size=\"sm\" onClick={() => { anchorRef.current?.querySelector('input')?.focus(); setIsListDismissed(false); retry() }}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{strings.retry ?? defaultPlaceAutocompleteStrings.retry}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t{!!hasNoResults && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\" align=\"center\" className=\"block\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{formatPlaceAutocompleteString(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrings.noResults,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ query: displayValue }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t{results.length > 0 && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandGroup>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{results.map((feature, index) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst formattedAddress = formatAddress(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeature.properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={feature.properties.osm_id}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={String(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeature.properties.osm_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tref={(node) => { if (node) optionNodes.current.set(index, node); else optionNodes.current.delete(index) }}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonSelect={() => selectPlace(feature)}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<MapPinIcon />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"flex flex-col items-start text-start\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" weight=\"medium\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{feature.properties.name ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeature.properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.street ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrings.unknownPlace}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{formattedAddress}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandGroup>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</CommandList>\n\t\t\t\t\t\t\t\t</PopoverContent>\n\t\t\t\t\t\t</Popover>\n\t\t\t\t</Command>\n\t\t)\n}\n\nexport {\n\t\tPlaceAutocomplete,\n\t\tdefaultPlaceAutocompleteStrings,\n\t\ttype PlaceAutocompleteProps,\n\t\ttype PlaceAutocompleteStrings,\n\t\ttype PlaceFeature,\n\t\ttype PlaceSearchOptions,\n\t\ttype PlaceSearchCallback,\n}\n","import { useCallback, useSyncExternalStore } from 'react';\n\n/** Observe inherited CSS theme classes without adding a second theme store. */\nexport function useMapColorScheme(container: HTMLElement | null): 'light' | 'dark' {\n const read = useCallback(() => {\n for(let node=container;node;node=node.parentElement) {\n if(node.classList.contains('dark')) return 'dark';\n if(node.classList.contains('light')) return 'light';\n }\n return 'light';\n },[container]);\n const subscribe = useCallback((notify: () => void) => {\n const observer=new MutationObserver(notify);\n for(let node=container;node;node=node.parentElement) observer.observe(node,{attributes:true,attributeFilter:['class']});\n return () => observer.disconnect();\n },[container]);\n return useSyncExternalStore(subscribe,read,()=>'light');\n}\n","\"use client\"\n\nimport { cn } from \"../../../lib/utils\"\nimport { useStrings, type StringsProp } from \"../../../lib/strings\"\nimport { Button, ButtonGroup } from \"../../base/buttons\"\nimport {\n\t\tDropdownMenu,\n\t\tDropdownMenuCheckboxItem,\n\t\tDropdownMenuContent,\n\t\tDropdownMenuGroup,\n\t\tDropdownMenuLabel,\n\t\tDropdownMenuRadioGroup,\n\t\tDropdownMenuRadioItem,\n\t\tDropdownMenuSeparator,\n\t\tDropdownMenuTrigger,\n} from \"../../base/navigation/dropdown-menu\"\nimport {\n\t\tPlaceAutocomplete,\n\t\ttype PlaceAutocompleteProps,\n} from \"./place-autocomplete\"\nimport type {\n\t\tCircle,\n\t\tCircleMarker,\n\t\tDivIconOptions,\n\t\tDraw,\n\t\tDrawEvents,\n\t\tDrawMap,\n\t\tDrawOptions,\n\t\tEditToolbar,\n\t\tErrorEvent,\n\t\tFeatureGroup,\n\t\tLatLngExpression,\n\t\tLayerGroup,\n\t\tMap as LeafletMap,\n\t\tLocateOptions,\n\t\tLocationEvent,\n\t\tMarker,\n\t\tMarkerCluster,\n\t\tPointExpression,\n\t\tPolygon,\n\t\tPolyline,\n\t\tPopup,\n\t\tRectangle,\n\t\tTileLayer,\n\t\tTooltip,\n} from \"leaflet\"\nimport type * as LeafletDrawNamespace from \"leaflet-draw\"\nimport type * as LeafletNamespace from \"leaflet\"\nimport type {} from \"leaflet.markercluster\"\nimport {\n\t\tCircleIcon,\n\t\tLayersIcon,\n\t\tLoaderCircleIcon,\n\t\tMapPinIcon,\n\t\tMaximizeIcon,\n\t\tMinimizeIcon,\n\t\tMinusIcon,\n\t\tNavigationIcon,\n\t\tPenLineIcon,\n\t\tPentagonIcon,\n\t\tPlusIcon,\n\t\tSquareIcon,\n\t\tTrash2Icon,\n\t\tUndo2Icon,\n\t\tWaypointsIcon,\n} from \"lucide-react\"\nimport React, {\n\t\tSuspense,\n\t\tcreateContext,\n\t\tlazy,\n\t\tuseCallback,\n\t\tuseContext,\n\t\tuseEffect,\n\t\tuseRef,\n\t\tuseState,\n\t\ttype ComponentType,\n\t\ttype ReactNode,\n\t\ttype Ref,\n} from \"react\"\nimport { useMapColorScheme } from './use-map-color-scheme';\nimport { renderToString } from \"react-dom/server\"\nimport type {\n\t\tCircleMarkerProps,\n\t\tCircleProps,\n\t\tLayerGroupProps,\n\t\tMapContainerProps,\n\t\tMarkerProps,\n\t\tPolygonProps,\n\t\tPolylineProps,\n\t\tPopupProps,\n\t\tRectangleProps,\n\t\tTileLayerProps,\n\t\tTooltipProps,\n\t\tMarkerClusterGroupProps,\n} from \"./public-leaflet.types\"\n\ntype LeafletModule = typeof LeafletNamespace\ntype LeafletDrawModule = typeof LeafletDrawNamespace\ntype ReactLeafletModule = typeof import(\"react-leaflet\")\ntype ReactLeafletHooks = Pick<ReactLeafletModule, \"useMap\" | \"useMapEvents\">\n\nconst ReactLeafletHooksContext = createContext<ReactLeafletHooks | null>(null)\n\nexport interface MapStrings {\n\t\t/** Id of the tile layer shown first. */\n\t\tdefaultTileLayer: string\n\t\tmapType: string\n\t\tlayers: string\n\t\tselectLayers: string\n\t\tmarker: string\n\t\tzoomControls: string\n\t\tzoomIn: string\n\t\tzoomOut: string\n\t\tenterFullscreen: string\n\t\texitFullscreen: string\n\t\tlocating: string\n\t\tstopTracking: string\n\t\ttrackLocation: string\n\t\tstopLocationTracking: string\n\t\tstartLocationTracking: string\n\t\tcurrentLocation: string\n\t\tdrawMarker: string\n\t\tdrawPolyline: string\n\t\tdrawCircle: string\n\t\tdrawRectangle: string\n\t\tdrawPolygon: string\n\t\teditShapes: string\n\t\tremoveShapes: string\n\t\tundoEdit: string\n\t\tundoRemove: string\n\t\teditInstructions: string\n\t\tremoveInstructions: string\n}\n\nexport const defaultMapStrings: MapStrings = {\n\t\tdefaultTileLayer: \"Default\",\n\t\tmapType: \"Map type\",\n\t\tlayers: \"Layers\",\n\t\tselectLayers: \"Select layers\",\n\t\tmarker: \"Map marker\",\n\t\tzoomControls: \"Zoom controls\",\n\t\tzoomIn: \"Zoom in\",\n\t\tzoomOut: \"Zoom out\",\n\t\tenterFullscreen: \"Enter fullscreen\",\n\t\texitFullscreen: \"Exit fullscreen\",\n\t\tlocating: \"Locating…\",\n\t\tstopTracking: \"Stop tracking\",\n\t\ttrackLocation: \"Track location\",\n\t\tstopLocationTracking: \"Stop location tracking\",\n\t\tstartLocationTracking: \"Start location tracking\",\n\t\tcurrentLocation: \"Current location\",\n\t\tdrawMarker: \"Draw marker\",\n\t\tdrawPolyline: \"Draw polyline\",\n\t\tdrawCircle: \"Draw circle\",\n\t\tdrawRectangle: \"Draw rectangle\",\n\t\tdrawPolygon: \"Draw polygon\",\n\t\teditShapes: \"Edit shapes\",\n\t\tremoveShapes: \"Remove shapes\",\n\t\tundoEdit: \"Undo edit\",\n\t\tundoRemove: \"Undo remove\",\n\t\teditInstructions: \"Drag handles or markers to edit.\",\n\t\tremoveInstructions: \"Click on a shape to remove.\",\n}\n\nconst MapStringsContext = createContext<MapStrings>(defaultMapStrings)\n\nfunction useMapStrings() {\n\t\treturn useContext(MapStringsContext)\n}\n\n// Load the shared runtime before mounting MapContainer. Suspending below an\n// already initialized MapContainer disconnects its passive cleanup and removes\n// the Leaflet instance, leaving its visible markers attached to a stale map.\nconst ReactLeafletRuntimeContext = createContext<ReactLeafletModule | null>(null)\nconst ReactLeafletRuntime = lazy(async () => {\n\tconst mod = await import(\"react-leaflet\")\n\treturn { default: ({ children }: { children?: ReactNode }) => (\n\t\t<ReactLeafletRuntimeContext.Provider value={mod}>{children}</ReactLeafletRuntimeContext.Provider>\n\t) }\n})\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mirrors React ComponentType's generic constraint.\nfunction createRuntimeComponent<T extends ComponentType<any>>(select: (runtime: ReactLeafletModule) => T) {\n\treturn (props: React.ComponentProps<T>) => {\n\t\tconst runtime = useContext(ReactLeafletRuntimeContext)\n\t\tif (!runtime) throw new Error(\"Map primitives must be rendered within Map.\")\n\t\tconst Component = select(runtime)\n\t\treturn <Component {...props} />\n\t}\n}\n\nconst LeafletMapContainer = createRuntimeComponent(mod => mod.MapContainer)\nconst LeafletTileLayer = createRuntimeComponent(mod => mod.TileLayer)\nconst LeafletMarker = createRuntimeComponent(mod => mod.Marker)\nconst LeafletPopup = createRuntimeComponent(mod => mod.Popup)\nconst LeafletTooltip = createRuntimeComponent(mod => mod.Tooltip)\nconst LeafletCircle = createRuntimeComponent(mod => mod.Circle)\nconst LeafletCircleMarker = createRuntimeComponent(mod => mod.CircleMarker)\nconst LeafletPolyline = createRuntimeComponent(mod => mod.Polyline)\nconst LeafletPolygon = createRuntimeComponent(mod => mod.Polygon)\nconst LeafletRectangle = createRuntimeComponent(mod => mod.Rectangle)\nconst LeafletLayerGroup = createRuntimeComponent(mod => mod.LayerGroup)\nconst LeafletFeatureGroup = createRuntimeComponent(mod => mod.FeatureGroup)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mirrors React lazy's ComponentType constraint.\nfunction createLazyComponent<T extends ComponentType<any>>(factory: () => Promise<{ default: T }>) {\n\tconst Component = lazy(factory)\n\treturn (props: React.ComponentProps<T>) => <Suspense><Component {...props} /></Suspense>\n}\nconst LeafletMarkerClusterGroup = createLazyComponent(async () =>\n\timport(\"react-leaflet-markercluster\").then(mod => ({ default: mod.default }))\n)\n\nfunction ReactLeafletHooksProvider({ children }: { children?: ReactNode }) {\n\tconst mod = useContext(ReactLeafletRuntimeContext)\n\tif (!mod) throw new Error(\"Map controls must be rendered within Map.\")\n\treturn <ReactLeafletHooksContext.Provider value={mod}>{children}</ReactLeafletHooksContext.Provider>\n}\n\nfunction useLeafletMap() {\n\t\tconst hooks = useContext(ReactLeafletHooksContext)\n\t\tif (!hooks) {\n\t\t\t\tthrow new Error(\"Map controls must be rendered within Map.\")\n\t\t}\n\n\t\treturn hooks.useMap()\n}\n\nfunction useLeafletMapEvents(\n\t\thandlers: Parameters<ReactLeafletModule[\"useMapEvents\"]>[0]\n) {\n\t\tconst hooks = useContext(ReactLeafletHooksContext)\n\t\tif (!hooks) {\n\t\t\t\tthrow new Error(\"Map controls must be rendered within Map.\")\n\t\t}\n\n\t\treturn hooks.useMapEvents(handlers)\n}\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n\t\tif (!ref) return\n\n\t\tif (typeof ref === \"function\") {\n\t\t\t\tref(value)\n\t\t\t\treturn\n\t\t}\n\n\t\t;(ref as React.MutableRefObject<T | null>).current = value\n}\n\nfunction Map({\n\t\tzoom = 15,\n\t\tmaxZoom = 18,\n\t\tclassName,\n\t\tchildren,\n\t\tstrings: stringsProp,\n\t\tref,\n\t\t...props\n}: Omit<MapContainerProps, \"zoomControl\"> & {\n\t\tcenter: LatLngExpression\n\t\tref?: Ref<LeafletMap>\n\t\t/** Overrides the map's own copy. */\n\t\tstrings?: StringsProp<MapStrings>\n}) {\n\t\tconst strings = useStrings(defaultMapStrings, stringsProp)\n\t\tconst focusCleanup = useRef<(() => void) | null>(null)\n\t\tconst handleMapRef = useCallback((map: LeafletMap | null) => {\n\t\t\tfocusCleanup.current?.()\n\t\t\tfocusCleanup.current = null\n\t\t\tif (map?.options.keyboard) {\n\t\t\t\tconst container = map.getContainer()\n\t\t\t\t// Leaflet's keyboard mousedown handler uses plain focus and only\n\t\t\t\t// restores window scroll. Focus first without moving nested scrollers\n\t\t\t\t// so pointerup still lands on the marker pressed by pointerdown.\n\t\t\t\tconst focusWithoutScroll = () => {\n\t\t\t\t\tif (document.activeElement !== container) container.focus({ preventScroll: true })\n\t\t\t\t}\n\t\t\t\tcontainer.addEventListener(\"mousedown\", focusWithoutScroll, true)\n\t\t\t\tfocusCleanup.current = () => container.removeEventListener(\"mousedown\", focusWithoutScroll, true)\n\t\t\t}\n\t\t\tassignRef(ref, map)\n\t\t}, [ref])\n\t\t// Keep the optional runtime outside the server tree.\n\t\tconst [isMounted, setIsMounted] = useState(false)\n\t\tuseEffect(() => { setIsMounted(true) }, [])\n\t\tif (!isMounted) return null\n\t\treturn (\n\t\t\t\t<Suspense>\n\t\t\t\t<ReactLeafletRuntime>\n\t\t\t\t<LeafletMapContainer\n\t\t\t\t\t\tref={handleMapRef}\n\t\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t\tmaxZoom={maxZoom}\n\t\t\t\t\t\tattributionControl={false}\n\t\t\t\t\t\tzoomControl={false}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t// The themed background lives in `map.css`: Leaflet's own\n\t\t\t\t\t\t\t\t// `.leaflet-container { background: #ddd }` is unlayered, so it beats a\n\t\t\t\t\t\t\t\t// `bg-muted` utility on this element regardless of import order.\n\t\t\t\t\t\t\t\t'map--component',\n\t\t\t\t\t\t\t\t\"z-50 size-full min-h-0 flex-1 rounded-radius\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t<MapStringsContext.Provider value={strings}>\n\t\t\t\t\t\t\t\t<ReactLeafletHooksProvider>{children}</ReactLeafletHooksProvider>\n\t\t\t\t\t\t</MapStringsContext.Provider>\n\t\t\t\t</LeafletMapContainer>\n\t\t\t\t</ReactLeafletRuntime>\n\t\t\t\t</Suspense>\n\t\t)\n}\n\ninterface MapTileLayerOption {\n\t\t/** Form field name, forwarded for native submits. */\n\t\tname: string\n\t\t/** Tile URL template. */\n\t\turl: string\n\t\t/** Attribution shown for the tile layer. */\n\t\tattribution?: string\n}\n\ninterface MapLayerGroupOption\n\t\textends Pick<React.ComponentProps<typeof DropdownMenuCheckboxItem>, \"disabled\"> {\n\t\t/** Form field name, forwarded for native submits. */\n\t\tname: string\n}\n\ninterface MapLayersContextType {\n\t\tregisterTileLayer: (layer: MapTileLayerOption) => void\n\t\ttileLayers: MapTileLayerOption[]\n\t\tselectedTileLayer: string\n\t\tsetSelectedTileLayer: (name: string) => void\n\t\tregisterLayerGroup: (layer: MapLayerGroupOption) => void\n\t\tlayerGroups: MapLayerGroupOption[]\n\t\tactiveLayerGroups: string[]\n\t\tsetActiveLayerGroups: (names: string[]) => void\n}\n\nconst MapLayersContext = createContext<MapLayersContextType | null>(null)\n\nfunction useMapLayersContext() {\n\t\treturn useContext(MapLayersContext)\n}\n\nfunction MapTileLayer({\n\t\tname: nameProp,\n\t\turl,\n\t\tattribution,\n\t\tdarkUrl,\n\t\tdarkAttribution,\n\t\t...props\n}: Partial<TileLayerProps> & {\n\t\t/** Display name for the layer in the layer control. */\n\t\tname?: string\n\t\t/** Tile URL used when the dark theme is active. */\n\t\tdarkUrl?: string\n\t\t/** Attribution shown for the dark tile layer. */\n\t\tdarkAttribution?: string\n\t\tref?: Ref<TileLayer>\n}) {\n\t\tconst strings = useMapStrings()\n\t\tconst name = nameProp ?? strings.defaultTileLayer\n\t\tconst map = useLeafletMap()\n\t\tif (map.attributionControl) {\n\t\t\t\tmap.attributionControl.setPrefix(\"\")\n\t\t}\n\n\t\tconst context = useContext(MapLayersContext)\n\t\tconst DEFAULT_URL =\n\t\t\t\t\"https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png\"\n\t\tconst DEFAULT_DARK_URL =\n\t\t\t\t\"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png\"\n\n\t\tconst resolvedTheme = useMapColorScheme(map.getContainer())\n\t\tconst resolvedUrl =\n\t\t\t\tresolvedTheme === \"dark\"\n\t\t\t\t\t\t? (darkUrl ?? url ?? DEFAULT_DARK_URL)\n\t\t\t\t\t\t: (url ?? DEFAULT_URL)\n\t\tconst resolvedAttribution =\n\t\t\t\tresolvedTheme === \"dark\" && darkAttribution\n\t\t\t\t\t\t? darkAttribution\n\t\t\t\t\t\t: (attribution ??\n\t\t\t\t\t\t\t'&copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>, &copy; <a href=\"https://carto.com/attributions\">CARTO</a>')\n\n\t\tuseEffect(() => {\n\t\t\t\tif (context) {\n\t\t\t\t\t\tcontext.registerTileLayer({\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\turl: resolvedUrl,\n\t\t\t\t\t\t\t\tattribution: resolvedAttribution,\n\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t}, [context, name, resolvedAttribution, resolvedUrl])\n\n\t\tif (context && context.selectedTileLayer !== name) {\n\t\t\t\treturn null\n\t\t}\n\n\t\treturn (\n\t\t\t\t<LeafletTileLayer\n\t\t\t\t\t\turl={resolvedUrl}\n\t\t\t\t\t\tattribution={resolvedAttribution}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapLayerGroup({\n\t\tname,\n\t\tdisabled,\n\t\t...props\n}: LayerGroupProps & MapLayerGroupOption & { ref?: Ref<LayerGroup> }) {\n\t\tconst context = useMapLayersContext()\n\n\t\tuseEffect(() => {\n\t\t\t\tif (context) {\n\t\t\t\t\t\tcontext.registerLayerGroup({\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t}, [context, name, disabled])\n\n\t\tif (context && !context.activeLayerGroups.includes(name)) {\n\t\t\t\treturn null\n\t\t}\n\n\t\treturn <LeafletLayerGroup {...props} />\n}\n\nfunction MapFeatureGroup({\n\t\tname,\n\t\tdisabled,\n\t\t...props\n}: LayerGroupProps & MapLayerGroupOption & { ref?: Ref<FeatureGroup> }) {\n\t\tconst context = useMapLayersContext()\n\n\t\tuseEffect(() => {\n\t\t\t\tif (context) {\n\t\t\t\t\t\tcontext.registerLayerGroup({\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t}, [context, name, disabled])\n\n\t\tif (context && !context.activeLayerGroups.includes(name)) {\n\t\t\t\treturn null\n\t\t}\n\n\t\treturn <LeafletFeatureGroup {...props} />\n}\n\nfunction MapLayers({\n\t\tdefaultTileLayer,\n\t\tdefaultLayerGroups = [],\n\t\t...props\n}: Omit<React.ComponentProps<typeof MapLayersContext.Provider>, \"value\"> & {\n\t\t/** Name of the tile layer shown first. */\n\t\tdefaultTileLayer?: string\n\t\t/** Names of the overlay groups shown first. */\n\t\tdefaultLayerGroups?: string[]\n}) {\n\t\tconst [tileLayers, setTileLayers] = useState<MapTileLayerOption[]>([])\n\t\tconst [selectedTileLayer, setSelectedTileLayer] = useState<string>(\n\t\t\t\tdefaultTileLayer || \"\"\n\t\t)\n\t\tconst [layerGroups, setLayerGroups] = useState<MapLayerGroupOption[]>([])\n\t\tconst [activeLayerGroups, setActiveLayerGroups] =\n\t\t\t\tuseState<string[]>(defaultLayerGroups)\n\n\t\tfunction registerTileLayer(tileLayer: MapTileLayerOption) {\n\t\t\t\tsetTileLayers((prevTileLayers) => {\n\t\t\t\t\t\tif (prevTileLayers.some((layer) => layer.name === tileLayer.name)) {\n\t\t\t\t\t\t\t\treturn prevTileLayers\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn [...prevTileLayers, tileLayer]\n\t\t\t\t})\n\t\t}\n\n\t\tfunction registerLayerGroup(layerGroup: MapLayerGroupOption) {\n\t\t\t\tsetLayerGroups((prevLayerGroups) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tprevLayerGroups.some((group) => group.name === layerGroup.name)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn prevLayerGroups\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn [...prevLayerGroups, layerGroup]\n\t\t\t\t})\n\t\t}\n\n\t\tuseEffect(() => {\n\t\t\t\t// Error: Invalid defaultValue\n\t\t\t\tif (\n\t\t\t\t\t\tdefaultTileLayer &&\n\t\t\t\t\t\ttileLayers.length > 0 &&\n\t\t\t\t\t\t!tileLayers.some((tileLayer) => tileLayer.name === defaultTileLayer)\n\t\t\t\t) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Invalid defaultTileLayer \"${defaultTileLayer}\" provided to MapLayers. It must match a MapTileLayer's name prop.`\n\t\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\t// Set initial selected tile layer\n\t\t\t\tif (tileLayers.length > 0 && !selectedTileLayer) {\n\t\t\t\t\t\tconst validDefaultValue =\n\t\t\t\t\t\t\t\tdefaultTileLayer &&\n\t\t\t\t\t\t\t\ttileLayers.some((layer) => layer.name === defaultTileLayer)\n\t\t\t\t\t\t\t\t\t\t? defaultTileLayer\n\t\t\t\t\t\t\t\t\t\t: tileLayers[0].name\n\t\t\t\t\t\tsetSelectedTileLayer(validDefaultValue)\n\t\t\t\t}\n\n\t\t\t\t// Error: Invalid defaultActiveLayerGroups\n\t\t\t\tif (\n\t\t\t\t\t\tdefaultLayerGroups.length > 0 &&\n\t\t\t\t\t\tlayerGroups.length > 0 &&\n\t\t\t\t\t\tdefaultLayerGroups.some(\n\t\t\t\t\t\t\t\t(name) => !layerGroups.some((group) => group.name === name)\n\t\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Invalid defaultLayerGroups value provided to MapLayers. All names must match a MapLayerGroup's name prop.`\n\t\t\t\t\t\t)\n\t\t\t\t}\n\t\t}, [\n\t\t\t\ttileLayers,\n\t\t\t\tdefaultTileLayer,\n\t\t\t\tselectedTileLayer,\n\t\t\t\tlayerGroups,\n\t\t\t\tdefaultLayerGroups,\n\t\t])\n\n\t\treturn (\n\t\t\t\t<MapLayersContext.Provider\n\t\t\t\t\t\tvalue={{\n\t\t\t\t\t\t\t\tregisterTileLayer,\n\t\t\t\t\t\t\t\ttileLayers,\n\t\t\t\t\t\t\t\tselectedTileLayer,\n\t\t\t\t\t\t\t\tsetSelectedTileLayer,\n\t\t\t\t\t\t\t\tregisterLayerGroup,\n\t\t\t\t\t\t\t\tlayerGroups,\n\t\t\t\t\t\t\t\tactiveLayerGroups,\n\t\t\t\t\t\t\t\tsetActiveLayerGroups,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapLayersControl({\n\t\ttileLayersLabel,\n\t\tlayerGroupsLabel,\n\t\tposition = \"top-1 right-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"button\"> & {\n\t\t/** Heading for the tile-layer group in the layer control. */\n\t\ttileLayersLabel?: string\n\t\t/** Heading for the overlay group in the layer control. */\n\t\tlayerGroupsLabel?: string\n\t\t/** Corner the control is anchored to. */\n\t\tposition?: string\n}) {\n\t\tconst strings = useMapStrings()\n\t\tconst layersContext = useMapLayersContext()\n\t\tif (!layersContext) {\n\t\t\t\tthrow new Error(\"MapLayersControl must be used within MapLayers\")\n\t\t}\n\n\t\tconst {\n\t\t\t\ttileLayers,\n\t\t\t\tselectedTileLayer,\n\t\t\t\tsetSelectedTileLayer,\n\t\t\t\tlayerGroups,\n\t\t\t\tactiveLayerGroups,\n\t\t\t\tsetActiveLayerGroups,\n\t\t} = layersContext\n\n\t\tif (tileLayers.length === 0 && layerGroups.length === 0) {\n\t\t\t\treturn null\n\t\t}\n\n\t\tfunction handleLayerGroupToggle(name: string, checked: boolean) {\n\t\t\t\tsetActiveLayerGroups(\n\t\t\t\t\t\tchecked\n\t\t\t\t\t\t\t\t? [...activeLayerGroups, name]\n\t\t\t\t\t\t\t\t: activeLayerGroups.filter((groupName) => groupName !== name)\n\t\t\t\t)\n\t\t}\n\n\t\tconst showTileLayersDropdown = tileLayers.length > 1\n\t\tconst showLayerGroupsDropdown = layerGroups.length > 0\n\n\t\tif (!showTileLayersDropdown && !showLayerGroupsDropdown) {\n\t\t\t\treturn null\n\t\t}\n\n\t\treturn (\n\t\t\t\t<DropdownMenu>\n\t\t\t\t\t\t<DropdownMenuTrigger\n\t\t\t\t\t\t\t\trender={(triggerProps) => (\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t{...triggerProps}\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\t\t\t\t\taria-label={strings.selectLayers}\n\t\t\t\t\t\t\t\t\t\t\t\ttitle={strings.selectLayers}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"border-border absolute z-1000 border\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tposition,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttriggerProps.className\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<LayersIcon />\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<DropdownMenuContent align=\"end\" className=\"z-1000\">\n\t\t\t\t\t\t\t\t{!!showTileLayersDropdown && <>\n\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuRadioGroup\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={selectedTileLayer}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonValueChange={setSelectedTileLayer}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuLabel>{tileLayersLabel ?? strings.mapType}</DropdownMenuLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{tileLayers.map((tileLayer) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuRadioItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={tileLayer.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={tileLayer.name}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{tileLayer.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuRadioItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuRadioGroup>\n\t\t\t\t\t\t\t\t\t\t</>}\n\t\t\t\t\t\t\t\t{!!showTileLayersDropdown && !!showLayerGroupsDropdown && <DropdownMenuSeparator />}\n\t\t\t\t\t\t\t\t{!!showLayerGroupsDropdown && (\n\t\t\t\t\t\t\t\t\t\t<DropdownMenuGroup>\n\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{layerGroupsLabel ?? strings.layers}\n\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t{layerGroups.map((layerGroup) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuCheckboxItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={layerGroup.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tchecked={activeLayerGroups.includes(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlayerGroup.name\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={layerGroup.disabled}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonCheckedChange={(checked) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thandleLayerGroupToggle(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlayerGroup.name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tchecked\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{layerGroup.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuCheckboxItem>\n\t\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</DropdownMenuGroup>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</DropdownMenuContent>\n\t\t\t\t</DropdownMenu>\n\t\t)\n}\n\nfunction MapMarker({\n\t\ticon = <MapPinIcon className=\"size-icon-lg fill-background text-foreground\" />,\n\t\ticonAnchor = [12, 12],\n\t\tbgPos,\n\t\tpopupAnchor,\n\t\ttooltipAnchor,\n\t\tariaLabel,\n\t\tref,\n\t\t...props\n}: Omit<MarkerProps, \"icon\"> &\n\t\tPick<\n\t\t\t\tDivIconOptions,\n\t\t\t\t\"iconAnchor\" | \"bgPos\" | \"popupAnchor\" | \"tooltipAnchor\"\n\t\t> & {\n\t\t\t\ticon?: ReactNode\n\t\t\t\tariaLabel?: string\n\t\t\t\tref?: Ref<Marker>\n\t\t}) {\n\t\tconst { L } = useLeaflet()\n\t\tconst strings = useMapStrings()\n\t\tconst markerRef = useRef<Marker | null>(null)\n\t\tconst resolvedAriaLabel =\n\t\t\t\tariaLabel ??\n\t\t\t\t(typeof props.title === \"string\" && props.title.trim()\n\t\t\t\t\t\t? props.title\n\t\t\t\t\t\t: undefined) ??\n\t\t\t\tstrings.marker\n\t\tconst resolvedTitle =\n\t\t\t\ttypeof props.title === \"string\" && props.title.trim()\n\t\t\t\t\t\t? props.title\n\t\t\t\t\t\t: resolvedAriaLabel\n\t\tconst syncMarkerElement = useCallback(\n\t\t\t\t(marker: Marker | null) => {\n\t\t\t\t\t\tconst element = marker?.getElement()\n\t\t\t\t\t\tif (!element) return\n\n\t\t\t\t\t\telement.setAttribute(\"aria-label\", resolvedAriaLabel)\n\t\t\t\t\t\tif (!element.getAttribute(\"title\")) {\n\t\t\t\t\t\t\t\telement.setAttribute(\"title\", resolvedAriaLabel)\n\t\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t[resolvedAriaLabel]\n\t\t)\n\t\tconst handleMarkerRef = useCallback(\n\t\t\t\t(marker: Marker | null) => {\n\t\t\t\t\t\tmarkerRef.current = marker\n\t\t\t\t\t\tassignRef(ref, marker)\n\t\t\t\t\t\tsyncMarkerElement(marker)\n\t\t\t\t},\n\t\t\t\t[ref, syncMarkerElement]\n\t\t)\n\n\t\tuseEffect(() => {\n\t\t\t\tsyncMarkerElement(markerRef.current)\n\t\t}, [syncMarkerElement])\n\n\t\tif (!L) return null\n\n\t\treturn (\n\t\t\t\t<LeafletMarker\n\t\t\t\t\t\tref={handleMarkerRef}\n\t\t\t\t\t\ticon={L.divIcon({\n\t\t\t\t\t\t\t\t// Empty className stops leaflet's default `.leaflet-div-icon`\n\t\t\t\t\t\t\t\t// (white background + grey border rectangle) from being applied\n\t\t\t\t\t\t\t\t// around our SVG marker.\n\t\t\t\t\t\t\t\tclassName: \"\",\n\t\t\t\t\t\t\t\thtml: renderToString(icon),\n\t\t\t\t\t\t\t\ticonAnchor,\n\t\t\t\t\t\t\t\t...(bgPos ? { bgPos } : {}),\n\t\t\t\t\t\t\t\t...(popupAnchor ? { popupAnchor } : {}),\n\t\t\t\t\t\t\t\t...(tooltipAnchor ? { tooltipAnchor } : {}),\n\t\t\t\t\t\t})}\n\t\t\t\t\t\triseOnHover\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t\ttitle={resolvedTitle}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapMarkerClusterGroup({\n\t\tpolygonOptions = {\n\t\t\t\tclassName: \"fill-foreground stroke-foreground stroke-2\",\n\t\t},\n\t\tspiderLegPolylineOptions = {\n\t\t\t\tclassName: \"fill-foreground stroke-foreground stroke-2\",\n\t\t},\n\t\ticon,\n\t\t...props\n}: Omit<MarkerClusterGroupProps, \"iconCreateFunction\"> & {\n\t\tchildren: ReactNode\n\t\t/** Marker glyph. */\n\t\ticon?: (markerCount: number) => ReactNode\n}) {\n\t\tconst { L } = useLeaflet()\n\t\tif (!L) return null\n\n\t\tconst iconCreateFunction = icon\n\t\t\t\t? (cluster: MarkerCluster) => {\n\t\t\t\t\t\t\tconst markerCount = cluster.getChildCount()\n\t\t\t\t\t\t\tconst iconNode = icon(markerCount)\n\t\t\t\t\t\t\treturn L.divIcon({\n\t\t\t\t\t\t\t\t\thtml: renderToString(iconNode),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t: undefined\n\n\t\treturn (\n\t\t\t\t<LeafletMarkerClusterGroup\n\t\t\t\t\t\tpolygonOptions={polygonOptions}\n\t\t\t\t\t\tspiderLegPolylineOptions={spiderLegPolylineOptions}\n\t\t\t\t\t\ticonCreateFunction={iconCreateFunction}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapCircle({\n\t\tclassName,\n\t\t...props\n}: CircleProps & { ref?: Ref<Circle> }) {\n\t\treturn (\n\t\t\t\t<LeafletCircle\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapCircleMarker({\n\t\tclassName,\n\t\t...props\n}: CircleMarkerProps & { ref?: Ref<CircleMarker> }) {\n\t\treturn (\n\t\t\t\t<LeafletCircleMarker\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapPolyline({\n\t\tclassName,\n\t\t...props\n}: PolylineProps & { ref?: Ref<Polyline> }) {\n\t\treturn (\n\t\t\t\t<LeafletPolyline\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapPolygon({\n\t\tclassName,\n\t\t...props\n}: PolygonProps & { ref?: Ref<Polygon> }) {\n\t\treturn (\n\t\t\t\t<LeafletPolygon\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapRectangle({\n\t\tclassName,\n\t\t...props\n}: RectangleProps & { ref?: Ref<Rectangle> }) {\n\t\treturn (\n\t\t\t\t<LeafletRectangle\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapPopup({\n\t\tclassName,\n\t\t...props\n}: Omit<PopupProps, \"content\"> & { ref?: Ref<Popup> }) {\n\t\treturn (\n\t\t\t\t<LeafletPopup\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"map-popup--component border-border bg-popover text-popover-foreground animate-in fade-out-0 fade-in-0 zoom-out-95 zoom-in-95 slide-in-from-bottom-2 z-50 w-72 rounded-radius border p-surface font-sans shadow-md outline-hidden\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapTooltip({\n\t\tclassName,\n\t\tchildren,\n\t\tside = \"top\",\n\t\tsideOffset = 15,\n\t\t...props\n}: Omit<TooltipProps, \"offset\"> & {\n\t\t/** Which side of the trigger the surface opens on. */\n\t\tside?: \"top\" | \"right\" | \"bottom\" | \"left\"\n\t\t/** Distance from the trigger, in pixels. */\n\t\tsideOffset?: number\n\t\tref?: Ref<Tooltip>\n}) {\n\t\tconst ARROW_POSITION_CLASSES = {\n\t\t\t\ttop: \"bottom-0.5 left-1/2 -translate-x-1/2 translate-y-1/2\",\n\t\t\t\tbottom: \"top-0.5 left-1/2 -translate-x-1/2 -translate-y-1/2\",\n\t\t\t\tleft: \"right-0.5 top-1/2 translate-x-1/2 -translate-y-1/2\",\n\t\t\t\tright: \"left-0.5 top-1/2 -translate-x-1/2 -translate-y-1/2\",\n\t\t}\n\t\tconst DEFAULT_OFFSET = {\n\t\t\t\ttop: [0, -sideOffset] satisfies PointExpression,\n\t\t\t\tbottom: [0, sideOffset] satisfies PointExpression,\n\t\t\t\tleft: [-sideOffset, 0] satisfies PointExpression,\n\t\t\t\tright: [sideOffset, 0] satisfies PointExpression,\n\t\t}\n\n\t\treturn (\n\t\t\t\t<LeafletTooltip\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"animate-in fade-in-0 zoom-in-95 fade-out-0 zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 w-fit text-xs text-balance transition-opacity\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tdata-side={side}\n\t\t\t\t\t\tdirection={side}\n\t\t\t\t\t\toffset={DEFAULT_OFFSET[side]}\n\t\t\t\t\t\topacity={1}\n\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\"bg-foreground fill-foreground absolute z-50 size-2.5 rotate-45 rounded-[2px]\",\n\t\t\t\t\t\t\t\t\t\tARROW_POSITION_CLASSES[side]\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t/>\n\t\t\t\t</LeafletTooltip>\n\t\t)\n}\n\nfunction MapZoomControl({\n\t\tposition = \"top-1 left-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"div\"> & { position?: string }) {\n\t\tconst map = useLeafletMap()\n\t\tconst strings = useMapStrings()\n\t\tconst [zoomLevel, setZoomLevel] = useState(map.getZoom())\n\n\t\tuseLeafletMapEvents({\n\t\t\t\tzoomend: () => {\n\t\t\t\t\t\tsetZoomLevel(map.getZoom())\n\t\t\t\t},\n\t\t})\n\n\t\treturn (\n\t\t\t\t<MapControlContainer className={cn(position, className)}>\n\t\t\t\t\t\t<ButtonGroup\n\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\taria-label={strings.zoomControls}\n\t\t\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\t\t\t\taria-label={strings.zoomIn}\n\t\t\t\t\t\t\t\t\t\ttitle={strings.zoomIn}\n\t\t\t\t\t\t\t\t\t\tclassName=\"border-border border\"\n\t\t\t\t\t\t\t\t\t\tdisabled={zoomLevel >= map.getMaxZoom()}\n\t\t\t\t\t\t\t\t\t\tonClick={() => map.zoomIn()}>\n\t\t\t\t\t\t\t\t\t\t<PlusIcon />\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\t\t\t\taria-label={strings.zoomOut}\n\t\t\t\t\t\t\t\t\t\ttitle={strings.zoomOut}\n\t\t\t\t\t\t\t\t\t\tclassName=\"border-border border\"\n\t\t\t\t\t\t\t\t\t\tdisabled={zoomLevel <= map.getMinZoom()}\n\t\t\t\t\t\t\t\t\t\tonClick={() => map.zoomOut()}>\n\t\t\t\t\t\t\t\t\t\t<MinusIcon />\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t</MapControlContainer>\n\t\t)\n}\n\nfunction MapFullscreenControl({\n\t\tposition = \"top-1 right-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"button\"> & { position?: string }) {\n\t\tconst map = useLeafletMap()\n\t\tconst strings = useMapStrings()\n\t\tconst [isFullscreen, setIsFullscreen] = useState(false)\n\n\t\tconst { L } = useLeaflet()\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L) return\n\n\t\t\t\tconst fullscreenControl = new L.Control.FullScreen()\n\t\t\t\tfullscreenControl.addTo(map)\n\n\t\t\t\tconst container = fullscreenControl.getContainer()\n\t\t\t\tif (container) {\n\t\t\t\t\t\tcontainer.style.display = \"none\"\n\t\t\t\t}\n\n\t\t\t\tconst handleEnter = () => setIsFullscreen(true)\n\t\t\t\tconst handleExit = () => setIsFullscreen(false)\n\n\t\t\t\tmap.on(\"enterFullscreen\", handleEnter)\n\t\t\t\tmap.on(\"exitFullscreen\", handleExit)\n\n\t\t\t\treturn () => {\n\t\t\t\t\t\tfullscreenControl.remove()\n\t\t\t\t\t\tmap.off(\"enterFullscreen\", handleEnter)\n\t\t\t\t\t\tmap.off(\"exitFullscreen\", handleExit)\n\t\t\t\t}\n\t\t}, [L, map])\n\n\t\treturn (\n\t\t\t\t<MapControlContainer className={cn(position, className)}>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\t\tonClick={() => map.toggleFullscreen()}\n\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\tisFullscreen ? strings.exitFullscreen : strings.enterFullscreen\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttitle={isFullscreen ? strings.exitFullscreen : strings.enterFullscreen}\n\t\t\t\t\t\t\t\tclassName=\"border-border border\"\n\t\t\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t\t\t{isFullscreen ? <MinimizeIcon /> : <MaximizeIcon />}\n\t\t\t\t\t\t</Button>\n\t\t\t\t</MapControlContainer>\n\t\t)\n}\n\nfunction MapLocatePulseIcon() {\n\t\treturn (\n\t\t\t\t<div className=\"absolute -top-1 -right-1 flex size-icon-sm rounded-full\">\n\t\t\t\t\t\t<div className=\"bg-primary absolute inline-flex size-full animate-ping rounded-full opacity-75\" />\n\t\t\t\t\t\t<div className=\"bg-primary relative inline-flex size-icon-sm rounded-full\" />\n\t\t\t\t</div>\n\t\t)\n}\n\nfunction MapLocateControl({\n\t\twatch = false,\n\t\tonLocationFound,\n\t\tonLocationError,\n\t\tposition = \"right-1 bottom-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"button\"> &\n\t\tPick<LocateOptions, \"watch\"> & {\n\t\t\t\tonLocationFound?: (location: LocationEvent) => void\n\t\t\t\tonLocationError?: (error: ErrorEvent) => void\n\t\t} & { position?: string }) {\n\t\tconst map = useLeafletMap()\n\t\tconst strings = useMapStrings()\n\t\tconst [isLocating, setIsLocating] = useDelayedLoadingState(200)\n\t\tconst [location, setLocation] = useState<LatLngExpression | null>(null)\n\t\tconst hasLocation = location !== null\n\n\t\tconst startLocating = useCallback(() => {\n\t\t\t\tsetIsLocating(true)\n\t\t\t\tmap.locate({ setView: true, maxZoom: map.getMaxZoom(), watch })\n\t\t\t\tmap.on(\"locationfound\", (location: LocationEvent) => {\n\t\t\t\t\t\tsetLocation(location.latlng)\n\t\t\t\t\t\tsetIsLocating(false)\n\t\t\t\t\t\tonLocationFound?.(location)\n\t\t\t\t})\n\t\t\t\tmap.on(\"locationerror\", (error: ErrorEvent) => {\n\t\t\t\t\t\tsetLocation(null)\n\t\t\t\t\t\tsetIsLocating(false)\n\t\t\t\t\t\tonLocationError?.(error)\n\t\t\t\t})\n\t\t}, [map, onLocationError, onLocationFound, setIsLocating, watch])\n\n\t\tconst stopLocating = useCallback(() => {\n\t\t\t\tmap.stopLocate()\n\t\t\t\tmap.off(\"locationfound\")\n\t\t\t\tmap.off(\"locationerror\")\n\t\t\t\tsetLocation(null)\n\t\t\t\tsetIsLocating(false)\n\t\t}, [map, setIsLocating])\n\t\tconst trackingHandler = hasLocation ? stopLocating : startLocating\n\t\tconst trackingTitle = isLocating\n\t\t\t\t? strings.locating\n\t\t\t\t: hasLocation\n\t\t\t\t\t? strings.stopTracking\n\t\t\t\t\t: strings.trackLocation\n\t\tconst trackingAriaLabel = isLocating\n\t\t\t\t? strings.locating\n\t\t\t\t: hasLocation\n\t\t\t\t\t? strings.stopLocationTracking\n\t\t\t\t\t: strings.startLocationTracking\n\t\tconst locationMarker =\n\t\t\t\thasLocation && location ? (\n\t\t\t\t\t\t<MapMarker\n\t\t\t\t\t\t\t\tposition={location}\n\t\t\t\t\t\t\t\ticon={<MapLocatePulseIcon />}\n\t\t\t\t\t\t\t\tariaLabel={strings.currentLocation}\n\t\t\t\t\t\t/>\n\t\t\t\t) : null\n\n\t\tuseEffect(() => () => stopLocating(), [stopLocating])\n\n\t\treturn (\n\t\t\t\t<MapControlContainer className={cn(position, className)}>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\ttone={hasLocation ? \"primary\" : \"secondary\"}\n\t\t\t\t\t\t\t\tonClick={trackingHandler}\n\t\t\t\t\t\t\t\tdisabled={isLocating}\n\t\t\t\t\t\t\t\ttitle={trackingTitle}\n\t\t\t\t\t\t\t\taria-label={trackingAriaLabel}\n\t\t\t\t\t\t\t\tclassName=\"border-border border\"\n\t\t\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t\t\t{isLocating ? (\n\t\t\t\t\t\t\t\t\t\t<LoaderCircleIcon className=\"animate-spin\" />\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<NavigationIcon />\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{locationMarker}\n\t\t\t\t</MapControlContainer>\n\t\t)\n}\n\nfunction MapSearchControl({\n\t\tposition = \"top-1 left-1\",\n\t\tclassName,\n\t\t...props\n}: PlaceAutocompleteProps & { position?: string }) {\n\t\treturn (\n\t\t\t\t<MapControlContainer className={cn(\"z-1001 w-60\", position, className)}>\n\t\t\t\t\t\t<PlaceAutocomplete {...props} />\n\t\t\t\t</MapControlContainer>\n\t\t)\n}\n\ntype MapDrawShape = \"marker\" | \"polyline\" | \"circle\" | \"rectangle\" | \"polygon\"\ntype MapDrawAction = \"edit\" | \"delete\"\ntype MapDrawMode = MapDrawShape | MapDrawAction | null\ninterface MapDrawContextType {\n\t\treadonly featureGroup: L.FeatureGroup | null\n\t\tactiveMode: MapDrawMode\n\t\tsetActiveMode: (mode: MapDrawMode) => void\n\t\treadonly editControlRef: React.RefObject<EditToolbar.Edit | null>\n\t\treadonly deleteControlRef: React.RefObject<EditToolbar.Delete | null>\n\t\treadonly layersCount: number\n}\n\nconst MapDrawContext = createContext<MapDrawContextType | null>(null)\n\nfunction useMapDrawContext() {\n\t\treturn useContext(MapDrawContext)\n}\n\nfunction MapDrawControl({\n\t\tonLayersChange,\n\t\tposition = \"bottom-1 left-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"div\"> & {\n\t\tonLayersChange?: (layers: L.FeatureGroup) => void\n\t\t/** Corner the control is anchored to. */\n\t\tposition?: string\n}) {\n\t\tconst { L, LeafletDraw } = useLeaflet()\n\t\tconst map = useLeafletMap()\n\t\tconst featureGroupRef = useRef<L.FeatureGroup | null>(null)\n\t\tconst editControlRef = useRef<EditToolbar.Edit | null>(null)\n\t\tconst deleteControlRef = useRef<EditToolbar.Delete | null>(null)\n\t\tconst [activeMode, setActiveMode] = useState<MapDrawMode>(null)\n\t\tconst [layersCount, setLayersCount] = useState(0)\n\n\t\tconst updateLayersCount = useCallback(() => {\n\t\t\t\tif (featureGroupRef.current) {\n\t\t\t\t\t\tsetLayersCount(featureGroupRef.current.getLayers().length)\n\t\t\t\t}\n\t\t}, [])\n\n\t\tconst handleDrawCreated = useCallback((event: DrawEvents.Created) => {\n\t\t\t\tif (!featureGroupRef.current) return\n\t\t\t\tconst { layer } = event\n\t\t\t\tfeatureGroupRef.current.addLayer(layer)\n\t\t\t\tonLayersChange?.(featureGroupRef.current)\n\t\t\t\tupdateLayersCount()\n\t\t\t\tsetActiveMode(null)\n\t\t}, [onLayersChange, updateLayersCount])\n\n\t\tconst handleDrawEditedOrDeleted = useCallback(() => {\n\t\t\t\tif (!featureGroupRef.current) return\n\t\t\t\tonLayersChange?.(featureGroupRef.current)\n\t\t\t\tupdateLayersCount()\n\t\t\t\tsetActiveMode(null)\n\t\t}, [onLayersChange, updateLayersCount])\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L || !LeafletDraw || !map) return\n\n\t\t\t\tmap.on(\n\t\t\t\t\t\tL.Draw.Event.CREATED,\n\t\t\t\t\t\thandleDrawCreated as L.LeafletEventHandlerFn\n\t\t\t\t)\n\t\t\t\tmap.on(L.Draw.Event.EDITED, handleDrawEditedOrDeleted)\n\t\t\t\tmap.on(L.Draw.Event.DELETED, handleDrawEditedOrDeleted)\n\n\t\t\t\treturn () => {\n\t\t\t\t\t\tmap.off(\n\t\t\t\t\t\t\t\tL.Draw.Event.CREATED,\n\t\t\t\t\t\t\t\thandleDrawCreated as L.LeafletEventHandlerFn\n\t\t\t\t\t\t)\n\t\t\t\t\t\tmap.off(L.Draw.Event.EDITED, handleDrawEditedOrDeleted)\n\t\t\t\t\t\tmap.off(L.Draw.Event.DELETED, handleDrawEditedOrDeleted)\n\t\t\t\t}\n\t\t}, [L, LeafletDraw, map, handleDrawCreated, handleDrawEditedOrDeleted])\n\n\t\treturn (\n\t\t\t\t<MapDrawContext.Provider\n\t\t\t\t\t\tvalue={{\n\t\t\t\t\t\t\t\tfeatureGroup: featureGroupRef.current,\n\t\t\t\t\t\t\t\tactiveMode,\n\t\t\t\t\t\t\t\tsetActiveMode,\n\t\t\t\t\t\t\t\teditControlRef,\n\t\t\t\t\t\t\t\tdeleteControlRef,\n\t\t\t\t\t\t\t\tlayersCount,\n\t\t\t\t\t\t}}>\n\t\t\t\t\t\t<LeafletFeatureGroup ref={featureGroupRef} />\n\t\t\t\t\t\t<MapControlContainer className={cn(position, className)}>\n\t\t\t\t\t\t\t\t<ButtonGroup orientation=\"vertical\" {...props} />\n\t\t\t\t\t\t</MapControlContainer>\n\t\t\t\t</MapDrawContext.Provider>\n\t\t)\n}\n\nfunction MapDrawShapeButton<T extends Draw.Feature>({\n\t\tdrawMode,\n\t\tcreateDrawTool,\n\t\tclassName,\n\t\tchildren,\n\t\t...props\n}: React.ComponentProps<\"button\"> & {\n\t\tdrawMode: MapDrawShape\n\t\tcreateDrawTool: (L: LeafletModule, map: DrawMap) => T\n}) {\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext) {\n\t\t\t\tthrow new Error(\"MapDrawShapeButton must be used within MapDrawControl\")\n\t\t}\n\t\tconst { L } = useLeaflet()\n\t\tconst strings = useMapStrings()\n\t\tconst map = useLeafletMap()\n\t\tconst controlRef = useRef<T | null>(null)\n\t\tconst { activeMode, setActiveMode } = drawContext\n\t\tconst isActive = activeMode === drawMode\n\t\tconst drawLabels: Record<MapDrawShape, string> = {\n\t\t\t\tmarker: strings.drawMarker,\n\t\t\t\tpolyline: strings.drawPolyline,\n\t\t\t\tcircle: strings.drawCircle,\n\t\t\t\trectangle: strings.drawRectangle,\n\t\t\t\tpolygon: strings.drawPolygon,\n\t\t}\n\t\tconst drawLabel = drawLabels[drawMode]\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L || !isActive) {\n\t\t\t\t\t\tcontrolRef.current?.disable()\n\t\t\t\t\t\tcontrolRef.current = null\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst control = createDrawTool(L, map as DrawMap)\n\t\t\t\tcontrol.enable()\n\t\t\t\tcontrolRef.current = control\n\t\t\t\treturn () => {\n\t\t\t\t\t\tcontrol.disable()\n\t\t\t\t\t\tcontrolRef.current = null\n\t\t\t\t}\n\t\t}, [L, map, isActive, createDrawTool])\n\n\t\tfunction handleClick() {\n\t\t\t\tsetActiveMode(isActive ? null : drawMode)\n\t\t}\n\n\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\taria-label={drawLabel}\n\t\t\t\t\t\ttitle={drawLabel}\n\t\t\t\t\t\tclassName={cn(\"border-border border\", className)}\n\t\t\t\t\t\ttone={isActive ? \"primary\" : \"secondary\"}\n\t\t\t\t\t\tdisabled={activeMode === \"edit\" || activeMode === \"delete\"}\n\t\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t</Button>\n\t\t)\n}\n\nfunction MapDrawMarker({ ...props }: DrawOptions.MarkerOptions) {\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"marker\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Marker(map, {\n\t\t\t\t\t\t\t\t\t\ticon: L.divIcon({\n\t\t\t\t\t\t\t\t\t\t\t\tclassName: \"\", // For fixing the moving bug when going in and out the edit mode\n\t\t\t\t\t\t\t\t\t\t\t\ticonAnchor: [12, 12],\n\t\t\t\t\t\t\t\t\t\t\t\thtml: renderToString(<MapPinIcon className=\"size-icon-lg\" />),\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<MapPinIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawPolyline({\n\t\tshowLength = false,\n\t\tdrawError = {\n\t\t\t\tcolor: \"var(--color-destructive)\",\n\t\t},\n\t\tshapeOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\topacity: 1,\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: DrawOptions.PolylineOptions) {\n\t\tconst mapDrawHandleIcon = useMapDrawHandleIcon()\n\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"polyline\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Polyline(map, {\n\t\t\t\t\t\t\t\t\t\t...(mapDrawHandleIcon\n\t\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon: mapDrawHandleIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttouchIcon: mapDrawHandleIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\t\tshowLength,\n\t\t\t\t\t\t\t\t\t\tdrawError,\n\t\t\t\t\t\t\t\t\t\tshapeOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<WaypointsIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawCircle({\n\t\tshowRadius = false,\n\t\tshapeOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\topacity: 1,\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: DrawOptions.CircleOptions) {\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"circle\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Circle(map, {\n\t\t\t\t\t\t\t\t\t\tshowRadius,\n\t\t\t\t\t\t\t\t\t\tshapeOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<CircleIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawRectangle({\n\t\tshowArea = false,\n\t\tshapeOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\topacity: 1,\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: DrawOptions.RectangleOptions) {\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"rectangle\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Rectangle(map, {\n\t\t\t\t\t\t\t\t\t\tshowArea,\n\t\t\t\t\t\t\t\t\t\tshapeOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<SquareIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawPolygon({\n\t\tdrawError = {\n\t\t\t\tcolor: \"var(--color-destructive)\",\n\t\t},\n\t\tshapeOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\topacity: 1,\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: DrawOptions.PolygonOptions) {\n\t\tconst mapDrawHandleIcon = useMapDrawHandleIcon()\n\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"polygon\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Polygon(map, {\n\t\t\t\t\t\t\t\t\t\t...(mapDrawHandleIcon\n\t\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon: mapDrawHandleIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttouchIcon: mapDrawHandleIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\t\tdrawError,\n\t\t\t\t\t\t\t\t\t\tshapeOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<PentagonIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawActionButton<T extends EditToolbar.Edit | EditToolbar.Delete>({\n\t\tdrawAction,\n\t\tcreateDrawTool,\n\t\tcontrolRef,\n\t\tclassName,\n\t\tchildren,\n\t\t...props\n}: React.ComponentProps<\"button\"> & {\n\t\tdrawAction: MapDrawAction\n\t\tcreateDrawTool: (\n\t\t\t\tL: LeafletModule,\n\t\t\t\tmap: DrawMap,\n\t\t\t\tfeatureGroup: L.FeatureGroup\n\t\t) => T\n\t\tcontrolRef: React.RefObject<T | null>\n}) {\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"MapDrawActionButton must be used within MapDrawControl\"\n\t\t\t\t)\n\n\t\tconst { L } = useLeaflet()\n\t\tconst strings = useMapStrings()\n\t\tconst map = useLeafletMap()\n\t\tconst { featureGroup, activeMode, setActiveMode, layersCount } = drawContext\n\t\tconst isActive = activeMode === drawAction\n\t\tconst hasFeatures = layersCount > 0\n\t\tconst actionLabel = drawAction === \"edit\" ? strings.editShapes : strings.removeShapes\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L || !featureGroup || !isActive) {\n\t\t\t\t\t\tcontrolRef.current?.disable?.()\n\t\t\t\t\t\tcontrolRef.current = null\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst control = createDrawTool(L, map as DrawMap, featureGroup)\n\t\t\t\tcontrol.enable?.()\n\t\t\t\tcontrolRef.current = control\n\t\t\t\treturn () => {\n\t\t\t\t\t\tcontrol.disable?.()\n\t\t\t\t\t\tcontrolRef.current = null\n\t\t\t\t}\n\t\t}, [L, map, isActive, featureGroup, createDrawTool, controlRef])\n\n\t\tfunction handleClick() {\n\t\t\t\tcontrolRef.current?.save()\n\t\t\t\tsetActiveMode(isActive ? null : drawAction)\n\t\t}\n\n\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\taria-label={actionLabel}\n\t\t\t\t\t\ttitle={actionLabel}\n\t\t\t\t\t\ttone={isActive ? \"primary\" : \"secondary\"}\n\t\t\t\t\t\tdisabled={!hasFeatures}\n\t\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\t\tclassName={cn(\"border-border border\", className)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t</Button>\n\t\t)\n}\n\nfunction MapDrawEdit({\n\t\tselectedPathOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\tfillColor: \"var(--color-primary)\",\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: Omit<EditToolbar.EditHandlerOptions, \"featureGroup\">) {\n\t\tconst { L } = useLeaflet()\n\t\tconst strings = useMapStrings()\n\t\tconst mapDrawHandleIcon = useMapDrawHandleIcon()\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext) {\n\t\t\t\tthrow new Error(\"MapDrawEdit must be used within MapDrawControl\")\n\t\t}\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L || !mapDrawHandleIcon) return\n\n\t\t\t\tL.Edit.PolyVerticesEdit.mergeOptions({\n\t\t\t\t\t\ticon: mapDrawHandleIcon,\n\t\t\t\t\t\ttouchIcon: mapDrawHandleIcon,\n\t\t\t\t\t\tdrawError: {\n\t\t\t\t\t\t\t\tcolor: \"var(--color-destructive)\",\n\t\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tL.Edit.SimpleShape.mergeOptions({\n\t\t\t\t\t\tmoveIcon: mapDrawHandleIcon,\n\t\t\t\t\t\tresizeIcon: mapDrawHandleIcon,\n\t\t\t\t\t\ttouchMoveIcon: mapDrawHandleIcon,\n\t\t\t\t\t\ttouchResizeIcon: mapDrawHandleIcon,\n\t\t\t\t})\n\t\t\t\tL.drawLocal.edit.handlers.edit.tooltip = {\n\t\t\t\t\t\ttext: strings.editInstructions,\n\t\t\t\t\t\tsubtext: \"\",\n\t\t\t\t}\n\t\t\t\tL.drawLocal.edit.handlers.remove.tooltip = {\n\t\t\t\t\t\ttext: strings.removeInstructions,\n\t\t\t\t}\n\t\t}, [L, mapDrawHandleIcon, strings.editInstructions, strings.removeInstructions])\n\n\t\treturn (\n\t\t\t\t<MapDrawActionButton\n\t\t\t\t\t\tdrawAction=\"edit\"\n\t\t\t\t\t\tcontrolRef={drawContext.editControlRef}\n\t\t\t\t\t\tcreateDrawTool={(L, map, featureGroup) =>\n\t\t\t\t\t\t\t\tnew L.EditToolbar.Edit(map, {\n\t\t\t\t\t\t\t\t\t\tfeatureGroup,\n\t\t\t\t\t\t\t\t\t\tselectedPathOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<PenLineIcon />\n\t\t\t\t</MapDrawActionButton>\n\t\t)\n}\n\nfunction MapDrawDelete() {\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext) {\n\t\t\t\tthrow new Error(\"MapDrawDelete must be used within MapDrawControl\")\n\t\t}\n\n\t\treturn (\n\t\t\t\t<MapDrawActionButton\n\t\t\t\t\t\tdrawAction=\"delete\"\n\t\t\t\t\t\tcontrolRef={drawContext.deleteControlRef}\n\t\t\t\t\t\tcreateDrawTool={(L, map, featureGroup) =>\n\t\t\t\t\t\t\t\tnew L.EditToolbar.Delete(map, { featureGroup })\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<Trash2Icon />\n\t\t\t\t</MapDrawActionButton>\n\t\t)\n}\n\nfunction MapDrawUndo({ className, ...props }: React.ComponentProps<\"button\">) {\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext)\n\t\t\t\tthrow new Error(\"MapDrawUndo must be used within MapDrawControl\")\n\t\tconst strings = useMapStrings()\n\n\t\tconst {\n\t\t\t\tactiveMode,\n\t\t\t\tsetActiveMode,\n\t\t\t\teditControlRef,\n\t\t\t\tdeleteControlRef,\n\t\t\t\tlayersCount,\n\t\t} = drawContext\n\t\tconst isInEditMode = activeMode === \"edit\"\n\t\tconst isInDeleteMode = activeMode === \"delete\"\n\t\tconst isActive = (isInEditMode || isInDeleteMode) && layersCount > 0\n\t\tconst undoLabel = isInDeleteMode ? strings.undoRemove : strings.undoEdit\n\n\t\tfunction handleUndo() {\n\t\t\t\tif (isInEditMode) {\n\t\t\t\t\t\teditControlRef.current?.revertLayers()\n\t\t\t\t} else if (isInDeleteMode) {\n\t\t\t\t\t\tdeleteControlRef.current?.revertLayers()\n\t\t\t\t}\n\t\t\t\tsetActiveMode(null)\n\t\t}\n\n\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\taria-label={undoLabel}\n\t\t\t\t\t\ttitle={undoLabel}\n\t\t\t\t\t\tonClick={handleUndo}\n\t\t\t\t\t\tdisabled={!isActive}\n\t\t\t\t\t\tclassName={cn(\"border-border border\", className)}\n\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t<Undo2Icon />\n\t\t\t\t</Button>\n\t\t)\n}\n\nfunction MapControlContainer({\n\t\tclassName,\n\t\t...props\n}: React.ComponentPropsWithoutRef<\"div\">) {\n\t\tconst { L } = useLeaflet()\n\t\tconst containerRef = useRef<HTMLDivElement>(null)\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L) return\n\t\t\t\tconst element = containerRef.current\n\t\t\t\tif (!element) return\n\t\t\t\tL.DomEvent.disableClickPropagation(element)\n\t\t\t\tL.DomEvent.disableScrollPropagation(element)\n\t\t}, [L])\n\n\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\t\tref={containerRef}\n\t\t\t\t\t\tclassName={cn(\"absolute z-1000 size-fit cursor-default\", className)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction useMapDrawHandleIcon() {\n\t\tconst { L } = useLeaflet()\n\t\tif (!L) return null\n\n\t\treturn L.divIcon({\n\t\t\t\ticonAnchor: [8, 8],\n\t\t\t\thtml: renderToString(\n\t\t\t\t\t\t<CircleIcon className=\"fill-primary-accent stroke-primary-accent size-icon transition-transform hover:scale-110\" />\n\t\t\t\t),\n\t\t})\n}\n\nfunction useLeaflet() {\n\t\tconst [L, setL] = useState<LeafletModule | null>(null)\n\t\tconst [LeafletDraw, setLeafletDraw] = useState<LeafletDrawModule | null>(\n\t\t\t\tnull\n\t\t)\n\n\t\tuseEffect(() => {\n\t\t\t\tasync function loadLeaflet() {\n\t\t\t\t\t\tconst leaflet = await import(\"leaflet\")\n\t\t\t\t\t\tconst leafletFullscreen = await import(\"leaflet.fullscreen\")\n\t\t\t\t\t\tconst leafletDraw = await import(\"leaflet-draw\")\n\n\t\t\t\t\t\tconst L_object = leaflet.default\n\t\t\t\t\t\tif (L_object.Control && !L_object.Control.FullScreen) {\n\t\t\t\t\t\t\t\tL_object.Control.FullScreen =\n\t\t\t\t\t\t\t\t\t\tleafletFullscreen.default || leafletFullscreen\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsetLeafletDraw(leafletDraw)\n\t\t\t\t\t\tsetL(L_object)\n\t\t\t\t}\n\n\t\t\t\tif (L && LeafletDraw) return\n\t\t\t\tif (typeof window === \"undefined\") return\n\n\t\t\t\tvoid loadLeaflet()\n\t\t}, [L, LeafletDraw])\n\n\t\treturn { L, LeafletDraw }\n}\n\n/**\n * Delays the *appearance* of a loading indicator so a fast lookup never\n * flashes a spinner. Not a debounce: it neither collapses a burst of calls\n * nor defers the work itself, so `useDebouncedCallback` does not apply.\n */\nfunction useDelayedLoadingState(delay = 200) {\n\t\tconst [isLoading, setIsLoading] = useState(false)\n\t\tconst [showLoading, setShowLoading] = useState(false)\n\t\tconst timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n\t\tuseEffect(() => {\n\t\t\t\tif (isLoading) {\n\t\t\t\t\t\ttimeoutRef.current = setTimeout(() => {\n\t\t\t\t\t\t\t\tsetShowLoading(true)\n\t\t\t\t\t\t}, delay)\n\t\t\t\t} else {\n\t\t\t\t\t\tif (timeoutRef.current) {\n\t\t\t\t\t\t\t\tclearTimeout(timeoutRef.current)\n\t\t\t\t\t\t\t\ttimeoutRef.current = null\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetShowLoading(false)\n\t\t\t\t}\n\n\t\t\t\treturn () => {\n\t\t\t\t\t\tif (timeoutRef.current) {\n\t\t\t\t\t\t\t\tclearTimeout(timeoutRef.current)\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t}, [isLoading, delay])\n\n\t\treturn [showLoading, setIsLoading] as const\n}\n\nexport {\n\t\tMap,\n\t\tMapCircle,\n\t\tMapCircleMarker,\n\t\tMapControlContainer,\n\t\tMapDrawCircle,\n\t\tMapDrawControl,\n\t\tMapDrawDelete,\n\t\tMapDrawEdit,\n\t\tMapDrawMarker,\n\t\tMapDrawPolygon,\n\t\tMapDrawPolyline,\n\t\tMapDrawRectangle,\n\t\tMapDrawUndo,\n\t\tMapFeatureGroup,\n\t\tMapFullscreenControl,\n\t\tMapLayerGroup,\n\t\tMapLayers,\n\t\tMapLayersControl,\n\t\tMapLocateControl,\n\t\tMapMarker,\n\t\tMapMarkerClusterGroup,\n\t\tMapPolygon,\n\t\tMapPolyline,\n\t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EAAG;CAAY;AAC1B;AAOA,SAAS9B,GAAuB,IAAQ,KAAK;CAC3C,IAAM,CAACtO,GAAWC,KAAgBkI,EAAS,EAAK,GAC1C,CAAC6K,GAAaC,KAAkB9K,EAAS,EAAK,GAC9C+K,IAAarL,EAA6C,IAAI;CAsBpE,OApBAO,SACMpI,IACF,EAAW,UAAU,iBAAiB;EACpC,EAAe,EAAI;CACrB,GAAGmT,CAAK,KAER,AAEED,EAAW,aADX,aAAaA,EAAW,OAAO,GACV,OAEvBD,EAAe,EAAK,UAGT;EACX,AAAIC,EAAW,WACb,aAAaA,EAAW,OAAO;CAEnC,IACC,CAAClT,GAAWmT,CAAK,CAAC,GAEd,CAACH,GAAa/S,CAAY;AACnC"}
1
+ {"version":3,"file":"map.js","names":["React","Map","_Fragment","ButtonGroup","Text","popoverRecipes","DropdownMenuSeparator","DropdownMenuTrigger","DropdownMenuGroup","DropdownMenuCheckboxItem","DropdownMenuLabel","DropdownMenuContent","DropdownMenu","DropdownMenuRadioItem","layerRecipes","CommandItem","CommandEmpty","CommandList","CommandGroup","Command","PopoverTrigger","Popover","PopoverContent","InputGroup","InputGroupInput","InputGroupAddon","useDebounce","React$1","Fragment$1","defaultPlaceAutocompleteStrings","formatAddress","parts","properties","buildSearchUrl","url","query","lang","limit","bbox","lat","lon","zoom","locationBiasScale","searchPhoton","response","options","usePlaceSearch","results","setResults","isLoading","setIsLoading","error","setError","hasSearched","setHasSearched","retryAttempt","setRetryAttempt","onSearchErrorRef","onSearchError","debouncedQuery","debounceMs","bboxKey","current","abortController","fetchResults","features","searchPlaces","signal","addressOsmIds","id","feature","err","failure","attempt","formatPlaceAutocompleteString","template","params","key","match","PlaceAutocomplete","controlledValue","controlledOnValueChange","stringsProp","inputOnFocus","props","strings","useStrings","internalValue","setInternalValue","defaultValue","searchQuery","setSearchQuery","isListDismissed","setIsListDismissed","activeIndex","setActiveIndex","listId","anchorRef","popoverActionsRef","optionNodes","isControlled","displayValue","onResultsChangeRef","onResultsChange","hasNoResults","hasCommandList","showCommandList","selectPlace","address","onPlaceSelect","cn","className","event","flushSync","next","open","details","SearchIcon","index","newValue","Loader2Icon","Button","retry","formattedAddress","node","MapPinIcon","useMapColorScheme","read","useCallback","container","subscribe","observer","notify","useSyncExternalStore","ReactLeafletHooksContext","createContext","defaultMapStrings","MapStringsContext","useMapStrings","useContext","ReactLeafletRuntimeContext","ReactLeafletRuntime","lazy","mod","createRuntimeComponent","runtime","Component","select","LeafletMapContainer","LeafletTileLayer","LeafletMarker","LeafletPopup","LeafletTooltip","LeafletCircle","LeafletCircleMarker","LeafletPolyline","LeafletPolygon","LeafletRectangle","LeafletLayerGroup","LeafletFeatureGroup","createLazyComponent","factory","Suspense","LeafletMarkerClusterGroup","ReactLeafletHooksProvider","useLeafletMap","hooks","useLeafletMapEvents","handlers","assignRef","ref","value","Map$1","focusCleanup","useRef","handleMapRef","map","focusWithoutScroll","isMounted","setIsMounted","useState","useEffect","MapLayersContext","useMapLayersContext","MapTileLayer","nameProp","name","context","resolvedTheme","resolvedUrl","darkUrl","resolvedAttribution","darkAttribution","attribution","MapLayerGroup","disabled","MapFeatureGroup","MapLayers","tileLayers","setTileLayers","selectedTileLayer","setSelectedTileLayer","defaultTileLayer","layerGroups","setLayerGroups","activeLayerGroups","setActiveLayerGroups","defaultLayerGroups","registerTileLayer","prevTileLayers","layer","tileLayer","registerLayerGroup","prevLayerGroups","group","layerGroup","validDefaultValue","MapLayersControl","layersContext","handleLayerGroupToggle","checked","groupName","showTileLayersDropdown","showLayerGroupsDropdown","triggerProps","position","LayersIcon","DropdownMenuRadioGroup","tileLayersLabel","layerGroupsLabel","MapMarker","useLeaflet","markerRef","resolvedAriaLabel","ariaLabel","resolvedTitle","syncMarkerElement","element","marker","handleMarkerRef","L","renderToString","icon","bgPos","popupAnchor","tooltipAnchor","MapMarkerClusterGroup","iconNode","cluster","MapCircle","MapCircleMarker","MapPolyline","MapPolygon","MapRectangle","MapPopup","MapTooltip","ARROW_POSITION_CLASSES","DEFAULT_OFFSET","sideOffset","side","children","MapZoomControl","zoomLevel","setZoomLevel","MapControlContainer","PlusIcon","MinusIcon","MapFullscreenControl","isFullscreen","setIsFullscreen","fullscreenControl","handleEnter","handleExit","jsx","MinimizeIcon","MaximizeIcon","MapLocatePulseIcon","MapLocateControl","isLocating","setIsLocating","useDelayedLoadingState","location","setLocation","hasLocation","startLocating","onLocationFound","onLocationError","watch","stopLocating","trackingHandler","trackingTitle","trackingAriaLabel","locationMarker","LoaderCircleIcon","NavigationIcon","MapSearchControl","MapDrawContext","useMapDrawContext","MapDrawControl","featureGroupRef","editControlRef","deleteControlRef","activeMode","setActiveMode","layersCount","setLayersCount","updateLayersCount","handleDrawCreated","onLayersChange","handleDrawEditedOrDeleted","LeafletDraw","MapDrawShapeButton","drawContext","controlRef","isActive","drawMode","drawLabel","control","createDrawTool","handleClick","MapDrawMarker","MapDrawPolyline","mapDrawHandleIcon","useMapDrawHandleIcon","WaypointsIcon","MapDrawCircle","CircleIcon","MapDrawRectangle","SquareIcon","MapDrawPolygon","PentagonIcon","MapDrawActionButton","drawAction","hasFeatures","actionLabel","featureGroup","MapDrawEdit","PenLineIcon","MapDrawDelete","Trash2Icon","MapDrawUndo","isInEditMode","isInDeleteMode","undoLabel","handleUndo","Undo2Icon","containerRef","setL","setLeafletDraw","loadLeaflet","leaflet","leafletFullscreen","leafletDraw","L_object","showLoading","setShowLoading","timeoutRef","delay"],"sources":["../../src/components/features/map/place-autocomplete.tsx","../../src/components/features/map/use-map-color-scheme.ts","../../src/components/features/map/map.tsx"],"sourcesContent":["import { Button } from \"../../base/buttons\"\nimport { Text } from \"../../typography\"\nimport { useDebounce } from \"../../../hooks/use-debounce\"\nimport { DEFAULT_DEBOUNCE_MS } from \"../../../hooks/use-debounced-callback\"\nimport { useStrings, type StringsProp } from \"../../../lib/strings\"\nimport { cn } from \"../../../lib/utils\"\nimport {\n\t\tCommand,\n\t\tCommandEmpty,\n\t\tCommandGroup,\n\t\tCommandItem,\n\t\tCommandList,\n} from \"../../base/command\"\nimport {\n\t\tPopover,\n\t\tPopoverContent,\n\t\tPopoverTrigger,\n} from \"../../base/popover\"\nimport { InputGroup, InputGroupAddon, InputGroupInput } from '../../base/text-inputs';\nimport { Loader2Icon, MapPinIcon, SearchIcon } from \"lucide-react\"\nimport * as React from \"react\"\nimport { flushSync } from \"react-dom\"\n\ntype BBox = [number, number, number, number]\ntype Point = {\n\t\ttype: \"Point\"\n\t\tcoordinates: [number, number]\n}\ntype Feature<TGeometry, TProperties> = {\n\t\ttype: \"Feature\"\n\t\tgeometry: TGeometry\n\t\tproperties: TProperties\n\t\tbbox?: BBox\n}\ntype FeatureCollection<TGeometry, TProperties> = {\n\t\ttype: \"FeatureCollection\"\n\t\tfeatures: Array<Feature<TGeometry, TProperties>>\n\t\tbbox?: BBox\n}\n\ninterface PlaceFeatureProperties {\n\t\tosm_id: number\n\t\tosm_type: \"N\" | \"W\" | \"R\"\n\t\tosm_key: string\n\t\tosm_value: string\n\t\ttype: string\n\t\t/** Form field name, forwarded for native submits. */\n\t\tname?: string\n\t\thousenumber?: string\n\t\tstreet?: string\n\t\tlocality?: string\n\t\tdistrict?: string\n\t\tpostcode?: string\n\t\tcity?: string\n\t\tcounty?: string\n\t\tstate?: string\n\t\tcountry?: string\n\t\tcountrycode?: string\n\t\textent?: [number, number, number, number]\n\t\textra?: Record<string, string>\n}\ntype PlaceFeature = Feature<Point, PlaceFeatureProperties>\ntype PlaceFeatureCollection = FeatureCollection<Point, PlaceFeatureProperties>\n\ninterface PlaceAutocompleteStrings {\n\t\tsearchPlaceholder: string\n\t\t/** Announced while a place lookup is in flight. */\n\t\tloading: string\n\t\terror: string\n\t\t/** Action shown after a failed lookup. */\n\t\tretry?: string\n\t\tnoResults: string\n\t\tunknownPlace: string\n}\n\nconst defaultPlaceAutocompleteStrings: PlaceAutocompleteStrings = {\n\t\tsearchPlaceholder: \"Search\",\n\t\tloading: \"Searching places\",\n\t\terror: \"Error: {{message}}\",\n\t\tretry: \"Retry\",\n\t\tnoResults: \"Can't find {{query}}.\",\n\t\tunknownPlace: \"Unknown\",\n}\n\n/**\n * Query parameters for Photon geocoding API\n * @see https://github.com/komoot/photon#photon-api\n */\ninterface PlaceSearchOptions {\n\t\t/** Search text (address, place name, or POI) */\n\t\tquery: string\n\t\t/** Preferred language for results (e.g., \"en\", \"de\", \"fr\") */\n\t\tlang?: string\n\t\t/** Maximum number of results to return */\n\t\tlimit?: number\n\t\t/**\n\t\t * Bounding box used to restrict results.\n\t\t * Format: [minLongitude, minLatitude, maxLongitude, maxLatitude]\n\t\t */\n\t\tbbox?: BBox\n\t\t/** Latitude used to bias results toward a specific location */\n\t\tlat?: number\n\t\t/** Longitude used to bias results toward a specific location */\n\t\tlon?: number\n\t\t/**\n\t\t * Zoom level used for location biasing.\n\t\t * Higher values increase locality.\n\t\t */\n\t\tzoom?: number\n\t\t/**\n\t\t * Strength of the location bias.\n\t\t */\n\t\tlocationBiasScale?: number\n}\n\n/** Consumer-owned geocoding integration. Keep callback identity stable until its provider changes. */\ntype PlaceSearchCallback = (options: PlaceSearchOptions, signal: AbortSignal) => Promise<PlaceFeature[]>\n\ninterface PlaceAutocompleteProps\n\t\textends Omit<PlaceSearchOptions, \"query\">,\n\t\t\t\tOmit<React.ComponentProps<\"input\">, \"value\" | \"onChange\"> {\n\t\tdebounceMs?: number\n\t\t/** Current value. Controlled. */\n\t\tvalue?: string\n\t\t/** Initial value for uncontrolled use. */\n\t\tdefaultValue?: string\n\t\t/** Fired with the next text value. */\n\t\tonValueChange?: (value: string) => void\n\t\tonPlaceSelect?: (feature: PlaceFeature) => void\n\t\tonResultsChange?: (results: PlaceFeature[]) => void\n\t\t/** Overrides Photon. Memoize when its implementation captures consumer state. */\n\t\tsearchPlaces?: PlaceSearchCallback\n\t\t/** Reports a current lookup failure; cancelled or superseded failures are ignored. */\n\t\tonSearchError?: (error: Error) => void\n\t\t/** Overrides this surface's own copy. */\n\t\tstrings?: StringsProp<PlaceAutocompleteStrings>\n}\n\nfunction formatAddress(properties: PlaceFeatureProperties) {\n\t\tconst parts = []\n\n\t\tif (properties.name) {\n\t\t\t\tparts.push(properties.name)\n\t\t}\n\n\t\tif (properties.housenumber && properties.street) {\n\t\t\t\tparts.push(`${properties.housenumber} ${properties.street}`)\n\t\t} else if (properties.street) {\n\t\t\t\tparts.push(properties.street)\n\t\t}\n\n\t\tif (properties.city) {\n\t\t\t\tparts.push(properties.city)\n\t\t} else if (properties.locality) {\n\t\t\t\tparts.push(properties.locality)\n\t\t}\n\n\t\tif (properties.state && properties.state !== properties.city) {\n\t\t\t\tparts.push(properties.state)\n\t\t}\n\n\t\tif (properties.country) {\n\t\t\t\tparts.push(properties.country)\n\t\t}\n\n\t\treturn [...new Set(parts)].join(\", \")\n}\n\nfunction buildSearchUrl({\n\t\tquery,\n\t\tbbox,\n\t\tlang,\n\t\tlat,\n\t\tlimit,\n\t\tlocationBiasScale,\n\t\tlon,\n\t\tzoom,\n}: PlaceSearchOptions) {\n\t\tconst url = new URL(\"https://photon.komoot.io/api\")\n\t\turl.searchParams.set(\"q\", query)\n\n\t\tif (lang) {\n\t\t\t\turl.searchParams.set(\"lang\", lang)\n\t\t}\n\n\t\tif (limit) {\n\t\t\t\turl.searchParams.set(\"limit\", String(limit))\n\t\t}\n\n\t\tif (bbox) {\n\t\t\t\turl.searchParams.set(\"bbox\", bbox.join(\",\"))\n\t\t}\n\n\t\tif (lat !== undefined && lon !== undefined) {\n\t\t\t\turl.searchParams.set(\"lat\", String(lat))\n\t\t\t\turl.searchParams.set(\"lon\", String(lon))\n\t\t}\n\n\t\tif (zoom !== undefined) {\n\t\t\t\turl.searchParams.set(\"zoom\", String(zoom))\n\t\t}\n\n\t\tif (locationBiasScale !== undefined) {\n\t\t\t\turl.searchParams.set(\"location_bias_scale\", String(locationBiasScale))\n\t\t}\n\n\t\treturn String(url)\n}\n\nconst searchPhoton: PlaceSearchCallback = async (options, signal) => {\n\t\tconst response = await fetch(buildSearchUrl(options), { signal })\n\t\tif (!response.ok) {\n\t\t\t\tthrow new Error(`Photon API error: ${response.status} ${response.statusText}`)\n\t\t}\n\t\tconst data: PlaceFeatureCollection = await response.json()\n\t\treturn data.features\n}\n\nfunction usePlaceSearch({\n\t\tdebounceMs,\n\t\tquery,\n\t\tlang,\n\t\tlimit,\n\t\tbbox,\n\t\tlat,\n\t\tlon,\n\t\tzoom,\n\t\tlocationBiasScale,\n\t\tsearchPlaces = searchPhoton,\n\t\tonSearchError,\n}: {\n\t\tdebounceMs: number\n\t\tsearchPlaces?: PlaceSearchCallback\n\t\tonSearchError?: (error: Error) => void\n} & PlaceSearchOptions) {\n\t\tconst [results, setResults] = React.useState<PlaceFeature[]>([])\n\t\tconst [isLoading, setIsLoading] = React.useState(false)\n\t\tconst [error, setError] = React.useState<Error | null>(null)\n\t\tconst [hasSearched, setHasSearched] = React.useState(false)\n\t\tconst [retryAttempt, setRetryAttempt] = React.useState(0)\n\t\tconst onSearchErrorRef = React.useRef(onSearchError)\n\t\tReact.useEffect(() => { onSearchErrorRef.current = onSearchError }, [onSearchError])\n\n\t\tconst debouncedQuery = useDebounce(query, debounceMs)\n\t\t// Tuple values define the context; a consumer's inline bbox must not restart it.\n\t\tconst bboxKey = bbox?.join(',')\n\n\t\tReact.useEffect(() => {\n\t\t\t\tsetResults(current => current.length ? [] : current)\n\t\t\t\tsetError(null)\n\t\t\t\tif (!query.trim() || query !== debouncedQuery) {\n\t\t\t\t\t\tsetIsLoading(false)\n\t\t\t\t\t\tsetHasSearched(false)\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst abortController = new AbortController()\n\t\t\t\tconst { signal } = abortController\n\t\t\t\tsetIsLoading(true)\n\t\t\t\tsetHasSearched(true)\n\n\t\t\t\tasync function fetchResults() {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst features = await searchPlaces({\n\t\t\t\t\t\t\t\t\t\tquery: debouncedQuery, lang, limit,\n\t\t\t\t\t\t\t\t\t\tbbox: bboxKey ? bboxKey.split(',').map(Number) as BBox : undefined,\n\t\t\t\t\t\t\t\t\t\tlat, lon, zoom, locationBiasScale,\n\t\t\t\t\t\t\t\t}, signal)\n\t\t\t\t\t\t\t\tif (signal.aborted) return\n\t\t\t\t\t\t\t\tconst addressOsmIds = new Set<number>()\n\t\t\t\t\t\t\t\tsetResults(features.filter(feature => {\n\t\t\t\t\t\t\t\t\t\tconst id = feature.properties.osm_id\n\t\t\t\t\t\t\t\t\t\tif (addressOsmIds.has(id)) return false\n\t\t\t\t\t\t\t\t\t\taddressOsmIds.add(id)\n\t\t\t\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t\t\t}))\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tif (signal.aborted || (err instanceof Error && err.name === 'AbortError')) return\n\t\t\t\t\t\t\t\tconst failure = err instanceof Error ? err : new Error(String(err))\n\t\t\t\t\t\t\t\tsetError(failure)\n\t\t\t\t\t\t\t\tonSearchErrorRef.current?.(failure)\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\t\tif (!signal.aborted) setIsLoading(false)\n\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvoid fetchResults()\n\t\t\t\treturn () => abortController.abort()\n\t\t}, [query, debouncedQuery, lang, limit, bboxKey, lat, lon, zoom, locationBiasScale, searchPlaces, retryAttempt])\n\n\t\treturn { results, isLoading, error, hasSearched, retry: () => setRetryAttempt(attempt => attempt + 1) }\n}\n\nfunction formatPlaceAutocompleteString(\n\t\ttemplate: string,\n\t\tparams: Record<string, string>\n) {\n\t\treturn template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, key) => {\n\t\t\t\treturn params[key] ?? match\n\t\t})\n}\n\nfunction PlaceAutocomplete({\n\t\tdebounceMs = DEFAULT_DEBOUNCE_MS,\n\t\tlang,\n\t\tlimit = 5,\n\t\tbbox,\n\t\tlat,\n\t\tlon,\n\t\tzoom,\n\t\tlocationBiasScale,\n\t\tclassName,\n\t\tvalue: controlledValue,\n\t\tdefaultValue = \"\",\n\t\tonValueChange: controlledOnValueChange,\n\t\tonPlaceSelect,\n\t\tonResultsChange,\n\t\tsearchPlaces,\n\t\tonSearchError,\n\t\tstrings: stringsProp,\n\t\tonFocus: inputOnFocus,\n\t\t...props\n}: PlaceAutocompleteProps) {\n\t\tconst strings = useStrings(defaultPlaceAutocompleteStrings, stringsProp)\n\t\tconst [internalValue, setInternalValue] = React.useState(defaultValue)\n\t\tconst [searchQuery, setSearchQuery] = React.useState(\"\")\n\t\tconst [isListDismissed, setIsListDismissed] = React.useState(false)\n\t\tconst [activeIndex, setActiveIndex] = React.useState(-1)\n\t\tconst listId = React.useId()\n\t\tconst anchorRef = React.useRef<HTMLDivElement>(null)\n\t\tconst popoverActionsRef: React.ComponentProps<typeof Popover>['actionsRef'] = React.useRef(null)\n\t\tconst optionNodes = React.useRef(new Map<number, HTMLElement>())\n\n\t\tconst isControlled = controlledValue !== undefined\n\t\tconst displayValue = isControlled ? controlledValue : internalValue\n\n\t\tconst { results, isLoading, error, hasSearched, retry } = usePlaceSearch({\n\t\t\t\tquery: searchQuery,\n\t\t\t\tsearchPlaces,\n\t\t\t\tonSearchError,\n\t\t\t\tdebounceMs,\n\t\t\t\tlang,\n\t\t\t\tlimit,\n\t\t\t\tbbox,\n\t\t\t\tlat,\n\t\t\t\tlon,\n\t\t\t\tzoom,\n\t\t\t\tlocationBiasScale,\n\t\t})\n\n\t\tconst onResultsChangeRef = React.useRef(onResultsChange)\n\t\tReact.useEffect(() => { onResultsChangeRef.current = onResultsChange }, [onResultsChange])\n\t\tReact.useEffect(() => {\n\t\t\t\tonResultsChangeRef.current?.(results)\n\t\t}, [results])\n\n\t\tconst hasNoResults =\n\t\t\t\thasSearched && !isLoading && !error && results.length === 0\n\t\tconst hasCommandList = Boolean(error || hasNoResults || results.length > 0)\n\t\tconst showCommandList = hasCommandList && !isListDismissed\n\t\tconst selectPlace = (feature: PlaceFeature) => {\n\t\t\t\tconst address = formatAddress(feature.properties)\n\t\t\t\tif (!isControlled) setInternalValue(address)\n\t\t\t\tsetSearchQuery(\"\")\n\t\t\t\tsetIsListDismissed(true)\n\t\t\t\tsetActiveIndex(-1)\n\t\t\t\tcontrolledOnValueChange?.(address)\n\t\t\t\tonPlaceSelect?.(feature)\n\t\t}\n\t\tconst optionId = (index: number) => optionNodes.current.get(index)?.id\n\n\t\treturn (\n\t\t\t\t<Command\n inset=\"flush\"\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'place-autocomplete--component',\n\t\t\t\t\t\t\t\t// The input group owns the closed-state surface. Keep the\n\t\t\t\t\t\t\t\t// command root flush while inheriting canonical list and row\n\t\t\t\t\t\t\t\t// presentation from base/command.\n\t\t\t\t\t\t\t\t\"h-fit overflow-visible\",\n\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tvalue={activeIndex >= 0 ? String(results[activeIndex]?.properties.osm_id ?? '') : ''}\n\t\t\t\t\t\tonKeyDownCapture={(event) => {\n\t\t\t\t\t\t\tif (!(event.target instanceof HTMLInputElement)) return\n\t\t\t\t\t\t\tif (event.key === 'Tab' && showCommandList && (!error || event.shiftKey)) {\n\t\t\t\t\t\t\t\t// Remove closing popup guards before native Tab follows the page order.\n\t\t\t\t\t\t\t\t// A forward Tab on an error still reaches the popup's Retry action.\n\t\t\t\t\t\t\t\tflushSync(() => {\n\t\t\t\t\t\t\t\t\tsetIsListDismissed(true)\n\t\t\t\t\t\t\t\t\tsetActiveIndex(-1)\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tpopoverActionsRef.current?.unmount()\n\t\t\t\t\t\t\t} else if (event.key === 'Escape') {\n\t\t\t\t\t\t\t\tsetIsListDismissed(true)\n\t\t\t\t\t\t\t\tsetActiveIndex(-1)\n\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t} else if (results.length && ['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) {\n\t\t\t\t\t\t\t\tsetIsListDismissed(false)\n\t\t\t\t\t\t\t\tconst next = event.key === 'Home' ? 0 : event.key === 'End' ? results.length - 1 : activeIndex < 0 ? (event.key === 'ArrowDown' ? 0 : results.length - 1) : (activeIndex + (event.key === 'ArrowDown' ? 1 : -1) + results.length) % results.length\n\t\t\t\t\t\t\t\tsetActiveIndex(next)\n\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t} else if (event.key === 'Enter' && showCommandList && results[activeIndex]) {\n\t\t\t\t\t\t\t\tselectPlace(results[activeIndex])\n\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tshouldFilter={false}\n\t\t\t\t\t\tloop>\n\t\t\t\t\t\t<Popover\n\t\t\t\t\t\t\t\tactionsRef={popoverActionsRef}\n\t\t\t\t\t\t\t\topen={showCommandList}\n\t\t\t\t\t\t\t\tonOpenChange={(open, details) => {\n\t\t\t\t\t\t\t\t\t\t// The visible input is part of this composite, outside the portal.\n\t\t\t\t\t\t\t\t\t\tif (!open && details.reason === 'focus-out' && document.activeElement === anchorRef.current?.querySelector('input')) {\n\t\t\t\t\t\t\t\t\t\t\t\tdetails.cancel()\n\t\t\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (!open) setIsListDismissed(true)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div ref={anchorRef} className=\"place-autocomplete--anchor relative\">\n\t\t\t\t\t\t\t\t\t\t<PopoverTrigger\n\t\t\t\t\t\t\t\t\t\t\t\trender={<span />}\n\t\t\t\t\t\t\t\t\t\t\t\tnativeButton={false}\n\t\t\t\t\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"pointer-events-none absolute inset-0\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<InputGroup className=\"border-input! bg-popover! ring-0!\">\n\t\t\t\t\t\t\t\t\t\t\t\t<InputGroupAddon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SearchIcon />\n\t\t\t\t\t\t\t\t\t\t\t\t</InputGroupAddon>\n\t\t\t\t\t\t\t\t\t\t\t\t<InputGroupInput\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-autocomplete=\"list\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-expanded={showCommandList}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-controls={showCommandList ? listId : undefined}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-activedescendant={showCommandList && results[activeIndex] ? optionId(activeIndex) : undefined}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder={strings.searchPlaceholder}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={displayValue}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={(event) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst newValue = event.target.value\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (!isControlled) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetInternalValue(newValue)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsListDismissed(false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetSearchQuery(newValue)\n\t\t\t\t\t\t\t\t\t\tsetActiveIndex(-1)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolledOnValueChange?.(newValue)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonFocus={(event) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (hasCommandList) setIsListDismissed(false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinputOnFocus?.(event)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t{!!isLoading && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<InputGroupAddon align=\"inline-end\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Loader2Icon className=\"animate-spin\" aria-hidden=\"true\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"inherit\" className=\"sr-only\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{strings.loading}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</InputGroupAddon>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</InputGroup>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<PopoverContent\n\t\t\t\t\t\t\t\t\t\taria-label={strings.searchPlaceholder}\n\t\t\t\t\t\t\t\t\t\talign=\"start\"\n\t\t\t\t\t\t\t\t\t\tsideOffset={4}\n\t\t\t\t\t\t\t\t\t\tinitialFocus={false}\n\t\t\t\t\t\t\t\t\t\tfinalFocus={false}\n\t\t\t\t\t\t\t\t\t\tinset=\"flush\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"place-autocomplete--results w-[var(--anchor-width)] max-w-[var(--available-width)] gap-0 overflow-hidden\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<CommandList id={listId} label={strings.searchPlaceholder} className=\"max-h-72\">\n\t\t\t\t\t\t\t\t\t\t\t\t{!!error && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\" align=\"center\" className=\"block\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{formatPlaceAutocompleteString(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrings.error,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ message: error.message }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Button buttonStyle=\"ghost\" size=\"sm\" onClick={() => { anchorRef.current?.querySelector('input')?.focus(); setIsListDismissed(false); retry() }}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{strings.retry ?? defaultPlaceAutocompleteStrings.retry}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t{!!hasNoResults && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\" align=\"center\" className=\"block\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{formatPlaceAutocompleteString(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrings.noResults,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ query: displayValue }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t{results.length > 0 && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandGroup>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{results.map((feature, index) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst formattedAddress = formatAddress(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeature.properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={feature.properties.osm_id}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={String(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeature.properties.osm_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tref={(node) => { if (node) optionNodes.current.set(index, node); else optionNodes.current.delete(index) }}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonSelect={() => selectPlace(feature)}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<MapPinIcon />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"flex flex-col items-start text-start\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" weight=\"medium\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{feature.properties.name ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeature.properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.street ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrings.unknownPlace}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{formattedAddress}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandGroup>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</CommandList>\n\t\t\t\t\t\t\t\t</PopoverContent>\n\t\t\t\t\t\t</Popover>\n\t\t\t\t</Command>\n\t\t)\n}\n\nexport {\n\t\tPlaceAutocomplete,\n\t\tdefaultPlaceAutocompleteStrings,\n\t\ttype PlaceAutocompleteProps,\n\t\ttype PlaceAutocompleteStrings,\n\t\ttype PlaceFeature,\n\t\ttype PlaceSearchOptions,\n\t\ttype PlaceSearchCallback,\n}\n","import { useCallback, useSyncExternalStore } from 'react';\n\n/** Observe inherited CSS theme classes without adding a second theme store. */\nexport function useMapColorScheme(container: HTMLElement | null): 'light' | 'dark' {\n const read = useCallback(() => {\n for(let node=container;node;node=node.parentElement) {\n if(node.classList.contains('dark')) return 'dark';\n if(node.classList.contains('light')) return 'light';\n }\n return 'light';\n },[container]);\n const subscribe = useCallback((notify: () => void) => {\n const observer=new MutationObserver(notify);\n for(let node=container;node;node=node.parentElement) observer.observe(node,{attributes:true,attributeFilter:['class']});\n return () => observer.disconnect();\n },[container]);\n return useSyncExternalStore(subscribe,read,()=>'light');\n}\n","\"use client\"\n\nimport { cn } from \"../../../lib/utils\"\nimport { layerRecipes } from \"../../../lib/layer-recipes\"\nimport { popoverRecipes } from \"../../base/popover/popover.recipes\"\nimport { useStrings, type StringsProp } from \"../../../lib/strings\"\nimport { Button, ButtonGroup } from \"../../base/buttons\"\nimport {\n\t\tDropdownMenu,\n\t\tDropdownMenuCheckboxItem,\n\t\tDropdownMenuContent,\n\t\tDropdownMenuGroup,\n\t\tDropdownMenuLabel,\n\t\tDropdownMenuRadioGroup,\n\t\tDropdownMenuRadioItem,\n\t\tDropdownMenuSeparator,\n\t\tDropdownMenuTrigger,\n} from \"../../base/navigation/dropdown-menu\"\nimport {\n\t\tPlaceAutocomplete,\n\t\ttype PlaceAutocompleteProps,\n} from \"./place-autocomplete\"\nimport type {\n\t\tCircle,\n\t\tCircleMarker,\n\t\tDivIconOptions,\n\t\tDraw,\n\t\tDrawEvents,\n\t\tDrawMap,\n\t\tDrawOptions,\n\t\tEditToolbar,\n\t\tErrorEvent,\n\t\tFeatureGroup,\n\t\tLatLngExpression,\n\t\tLayerGroup,\n\t\tMap as LeafletMap,\n\t\tLocateOptions,\n\t\tLocationEvent,\n\t\tMarker,\n\t\tMarkerCluster,\n\t\tPointExpression,\n\t\tPolygon,\n\t\tPolyline,\n\t\tPopup,\n\t\tRectangle,\n\t\tTileLayer,\n\t\tTooltip,\n} from \"leaflet\"\nimport type * as LeafletDrawNamespace from \"leaflet-draw\"\nimport type * as LeafletNamespace from \"leaflet\"\nimport type {} from \"leaflet.markercluster\"\nimport {\n\t\tCircleIcon,\n\t\tLayersIcon,\n\t\tLoaderCircleIcon,\n\t\tMapPinIcon,\n\t\tMaximizeIcon,\n\t\tMinimizeIcon,\n\t\tMinusIcon,\n\t\tNavigationIcon,\n\t\tPenLineIcon,\n\t\tPentagonIcon,\n\t\tPlusIcon,\n\t\tSquareIcon,\n\t\tTrash2Icon,\n\t\tUndo2Icon,\n\t\tWaypointsIcon,\n} from \"lucide-react\"\nimport React, {\n\t\tSuspense,\n\t\tcreateContext,\n\t\tlazy,\n\t\tuseCallback,\n\t\tuseContext,\n\t\tuseEffect,\n\t\tuseRef,\n\t\tuseState,\n\t\ttype ComponentType,\n\t\ttype ReactNode,\n\t\ttype Ref,\n} from \"react\"\nimport { useMapColorScheme } from './use-map-color-scheme';\nimport { renderToString } from \"react-dom/server\"\nimport type {\n\t\tCircleMarkerProps,\n\t\tCircleProps,\n\t\tLayerGroupProps,\n\t\tMapContainerProps,\n\t\tMarkerProps,\n\t\tPolygonProps,\n\t\tPolylineProps,\n\t\tPopupProps,\n\t\tRectangleProps,\n\t\tTileLayerProps,\n\t\tTooltipProps,\n\t\tMarkerClusterGroupProps,\n} from \"./public-leaflet.types\"\n\ntype LeafletModule = typeof LeafletNamespace\ntype LeafletDrawModule = typeof LeafletDrawNamespace\ntype ReactLeafletModule = typeof import(\"react-leaflet\")\ntype ReactLeafletHooks = Pick<ReactLeafletModule, \"useMap\" | \"useMapEvents\">\n\nconst ReactLeafletHooksContext = createContext<ReactLeafletHooks | null>(null)\n\nexport interface MapStrings {\n\t\t/** Id of the tile layer shown first. */\n\t\tdefaultTileLayer: string\n\t\tmapType: string\n\t\tlayers: string\n\t\tselectLayers: string\n\t\tmarker: string\n\t\tzoomControls: string\n\t\tzoomIn: string\n\t\tzoomOut: string\n\t\tenterFullscreen: string\n\t\texitFullscreen: string\n\t\tlocating: string\n\t\tstopTracking: string\n\t\ttrackLocation: string\n\t\tstopLocationTracking: string\n\t\tstartLocationTracking: string\n\t\tcurrentLocation: string\n\t\tdrawMarker: string\n\t\tdrawPolyline: string\n\t\tdrawCircle: string\n\t\tdrawRectangle: string\n\t\tdrawPolygon: string\n\t\teditShapes: string\n\t\tremoveShapes: string\n\t\tundoEdit: string\n\t\tundoRemove: string\n\t\teditInstructions: string\n\t\tremoveInstructions: string\n}\n\nexport const defaultMapStrings: MapStrings = {\n\t\tdefaultTileLayer: \"Default\",\n\t\tmapType: \"Map type\",\n\t\tlayers: \"Layers\",\n\t\tselectLayers: \"Select layers\",\n\t\tmarker: \"Map marker\",\n\t\tzoomControls: \"Zoom controls\",\n\t\tzoomIn: \"Zoom in\",\n\t\tzoomOut: \"Zoom out\",\n\t\tenterFullscreen: \"Enter fullscreen\",\n\t\texitFullscreen: \"Exit fullscreen\",\n\t\tlocating: \"Locating…\",\n\t\tstopTracking: \"Stop tracking\",\n\t\ttrackLocation: \"Track location\",\n\t\tstopLocationTracking: \"Stop location tracking\",\n\t\tstartLocationTracking: \"Start location tracking\",\n\t\tcurrentLocation: \"Current location\",\n\t\tdrawMarker: \"Draw marker\",\n\t\tdrawPolyline: \"Draw polyline\",\n\t\tdrawCircle: \"Draw circle\",\n\t\tdrawRectangle: \"Draw rectangle\",\n\t\tdrawPolygon: \"Draw polygon\",\n\t\teditShapes: \"Edit shapes\",\n\t\tremoveShapes: \"Remove shapes\",\n\t\tundoEdit: \"Undo edit\",\n\t\tundoRemove: \"Undo remove\",\n\t\teditInstructions: \"Drag handles or markers to edit.\",\n\t\tremoveInstructions: \"Click on a shape to remove.\",\n}\n\nconst MapStringsContext = createContext<MapStrings>(defaultMapStrings)\n\nfunction useMapStrings() {\n\t\treturn useContext(MapStringsContext)\n}\n\n// Load the shared runtime before mounting MapContainer. Suspending below an\n// already initialized MapContainer disconnects its passive cleanup and removes\n// the Leaflet instance, leaving its visible markers attached to a stale map.\nconst ReactLeafletRuntimeContext = createContext<ReactLeafletModule | null>(null)\nconst ReactLeafletRuntime = lazy(async () => {\n\tconst mod = await import(\"react-leaflet\")\n\treturn { default: ({ children }: { children?: ReactNode }) => (\n\t\t<ReactLeafletRuntimeContext.Provider value={mod}>{children}</ReactLeafletRuntimeContext.Provider>\n\t) }\n})\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mirrors React ComponentType's generic constraint.\nfunction createRuntimeComponent<T extends ComponentType<any>>(select: (runtime: ReactLeafletModule) => T) {\n\treturn (props: React.ComponentProps<T>) => {\n\t\tconst runtime = useContext(ReactLeafletRuntimeContext)\n\t\tif (!runtime) throw new Error(\"Map primitives must be rendered within Map.\")\n\t\tconst Component = select(runtime)\n\t\treturn <Component {...props} />\n\t}\n}\n\nconst LeafletMapContainer = createRuntimeComponent(mod => mod.MapContainer)\nconst LeafletTileLayer = createRuntimeComponent(mod => mod.TileLayer)\nconst LeafletMarker = createRuntimeComponent(mod => mod.Marker)\nconst LeafletPopup = createRuntimeComponent(mod => mod.Popup)\nconst LeafletTooltip = createRuntimeComponent(mod => mod.Tooltip)\nconst LeafletCircle = createRuntimeComponent(mod => mod.Circle)\nconst LeafletCircleMarker = createRuntimeComponent(mod => mod.CircleMarker)\nconst LeafletPolyline = createRuntimeComponent(mod => mod.Polyline)\nconst LeafletPolygon = createRuntimeComponent(mod => mod.Polygon)\nconst LeafletRectangle = createRuntimeComponent(mod => mod.Rectangle)\nconst LeafletLayerGroup = createRuntimeComponent(mod => mod.LayerGroup)\nconst LeafletFeatureGroup = createRuntimeComponent(mod => mod.FeatureGroup)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mirrors React lazy's ComponentType constraint.\nfunction createLazyComponent<T extends ComponentType<any>>(factory: () => Promise<{ default: T }>) {\n\tconst Component = lazy(factory)\n\treturn (props: React.ComponentProps<T>) => <Suspense><Component {...props} /></Suspense>\n}\nconst LeafletMarkerClusterGroup = createLazyComponent(async () =>\n\timport(\"react-leaflet-markercluster\").then(mod => ({ default: mod.default }))\n)\n\nfunction ReactLeafletHooksProvider({ children }: { children?: ReactNode }) {\n\tconst mod = useContext(ReactLeafletRuntimeContext)\n\tif (!mod) throw new Error(\"Map controls must be rendered within Map.\")\n\treturn <ReactLeafletHooksContext.Provider value={mod}>{children}</ReactLeafletHooksContext.Provider>\n}\n\nfunction useLeafletMap() {\n\t\tconst hooks = useContext(ReactLeafletHooksContext)\n\t\tif (!hooks) {\n\t\t\t\tthrow new Error(\"Map controls must be rendered within Map.\")\n\t\t}\n\n\t\treturn hooks.useMap()\n}\n\nfunction useLeafletMapEvents(\n\t\thandlers: Parameters<ReactLeafletModule[\"useMapEvents\"]>[0]\n) {\n\t\tconst hooks = useContext(ReactLeafletHooksContext)\n\t\tif (!hooks) {\n\t\t\t\tthrow new Error(\"Map controls must be rendered within Map.\")\n\t\t}\n\n\t\treturn hooks.useMapEvents(handlers)\n}\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n\t\tif (!ref) return\n\n\t\tif (typeof ref === \"function\") {\n\t\t\t\tref(value)\n\t\t\t\treturn\n\t\t}\n\n\t\t;(ref as React.MutableRefObject<T | null>).current = value\n}\n\nfunction Map({\n\t\tzoom = 15,\n\t\tmaxZoom = 18,\n\t\tclassName,\n\t\tchildren,\n\t\tstrings: stringsProp,\n\t\tref,\n\t\t...props\n}: Omit<MapContainerProps, \"zoomControl\"> & {\n\t\tcenter: LatLngExpression\n\t\tref?: Ref<LeafletMap>\n\t\t/** Overrides the map's own copy. */\n\t\tstrings?: StringsProp<MapStrings>\n}) {\n\t\tconst strings = useStrings(defaultMapStrings, stringsProp)\n\t\tconst focusCleanup = useRef<(() => void) | null>(null)\n\t\tconst handleMapRef = useCallback((map: LeafletMap | null) => {\n\t\t\tfocusCleanup.current?.()\n\t\t\tfocusCleanup.current = null\n\t\t\tif (map?.options.keyboard) {\n\t\t\t\tconst container = map.getContainer()\n\t\t\t\t// Leaflet's keyboard mousedown handler uses plain focus and only\n\t\t\t\t// restores window scroll. Focus first without moving nested scrollers\n\t\t\t\t// so pointerup still lands on the marker pressed by pointerdown.\n\t\t\t\tconst focusWithoutScroll = () => {\n\t\t\t\t\tif (document.activeElement !== container) container.focus({ preventScroll: true })\n\t\t\t\t}\n\t\t\t\tcontainer.addEventListener(\"mousedown\", focusWithoutScroll, true)\n\t\t\t\tfocusCleanup.current = () => container.removeEventListener(\"mousedown\", focusWithoutScroll, true)\n\t\t\t}\n\t\t\tassignRef(ref, map)\n\t\t}, [ref])\n\t\t// Keep the optional runtime outside the server tree.\n\t\tconst [isMounted, setIsMounted] = useState(false)\n\t\tuseEffect(() => { setIsMounted(true) }, [])\n\t\tif (!isMounted) return null\n\t\treturn (\n\t\t\t\t<Suspense>\n\t\t\t\t<ReactLeafletRuntime>\n\t\t\t\t<LeafletMapContainer\n\t\t\t\t\t\tref={handleMapRef}\n\t\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t\tmaxZoom={maxZoom}\n\t\t\t\t\t\tattributionControl={false}\n\t\t\t\t\t\tzoomControl={false}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t// The themed background lives in `map.css`: Leaflet's own\n\t\t\t\t\t\t\t\t// `.leaflet-container { background: #ddd }` is unlayered, so it beats a\n\t\t\t\t\t\t\t\t// `bg-muted` utility on this element regardless of import order.\n\t\t\t\t\t\t\t\t'map--component',\n\t\t\t\t\t\t\t\t\"z-50 size-full min-h-0 flex-1 rounded-radius\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t<MapStringsContext.Provider value={strings}>\n\t\t\t\t\t\t\t\t<ReactLeafletHooksProvider>{children}</ReactLeafletHooksProvider>\n\t\t\t\t\t\t</MapStringsContext.Provider>\n\t\t\t\t</LeafletMapContainer>\n\t\t\t\t</ReactLeafletRuntime>\n\t\t\t\t</Suspense>\n\t\t)\n}\n\ninterface MapTileLayerOption {\n\t\t/** Form field name, forwarded for native submits. */\n\t\tname: string\n\t\t/** Tile URL template. */\n\t\turl: string\n\t\t/** Attribution shown for the tile layer. */\n\t\tattribution?: string\n}\n\ninterface MapLayerGroupOption\n\t\textends Pick<React.ComponentProps<typeof DropdownMenuCheckboxItem>, \"disabled\"> {\n\t\t/** Form field name, forwarded for native submits. */\n\t\tname: string\n}\n\ninterface MapLayersContextType {\n\t\tregisterTileLayer: (layer: MapTileLayerOption) => void\n\t\ttileLayers: MapTileLayerOption[]\n\t\tselectedTileLayer: string\n\t\tsetSelectedTileLayer: (name: string) => void\n\t\tregisterLayerGroup: (layer: MapLayerGroupOption) => void\n\t\tlayerGroups: MapLayerGroupOption[]\n\t\tactiveLayerGroups: string[]\n\t\tsetActiveLayerGroups: (names: string[]) => void\n}\n\nconst MapLayersContext = createContext<MapLayersContextType | null>(null)\n\nfunction useMapLayersContext() {\n\t\treturn useContext(MapLayersContext)\n}\n\nfunction MapTileLayer({\n\t\tname: nameProp,\n\t\turl,\n\t\tattribution,\n\t\tdarkUrl,\n\t\tdarkAttribution,\n\t\t...props\n}: Partial<TileLayerProps> & {\n\t\t/** Display name for the layer in the layer control. */\n\t\tname?: string\n\t\t/** Tile URL used when the dark theme is active. */\n\t\tdarkUrl?: string\n\t\t/** Attribution shown for the dark tile layer. */\n\t\tdarkAttribution?: string\n\t\tref?: Ref<TileLayer>\n}) {\n\t\tconst strings = useMapStrings()\n\t\tconst name = nameProp ?? strings.defaultTileLayer\n\t\tconst map = useLeafletMap()\n\t\tif (map.attributionControl) {\n\t\t\t\tmap.attributionControl.setPrefix(\"\")\n\t\t}\n\n\t\tconst context = useContext(MapLayersContext)\n\t\tconst DEFAULT_URL =\n\t\t\t\t\"https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png\"\n\t\tconst DEFAULT_DARK_URL =\n\t\t\t\t\"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png\"\n\n\t\tconst resolvedTheme = useMapColorScheme(map.getContainer())\n\t\tconst resolvedUrl =\n\t\t\t\tresolvedTheme === \"dark\"\n\t\t\t\t\t\t? (darkUrl ?? url ?? DEFAULT_DARK_URL)\n\t\t\t\t\t\t: (url ?? DEFAULT_URL)\n\t\tconst resolvedAttribution =\n\t\t\t\tresolvedTheme === \"dark\" && darkAttribution\n\t\t\t\t\t\t? darkAttribution\n\t\t\t\t\t\t: (attribution ??\n\t\t\t\t\t\t\t'&copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>, &copy; <a href=\"https://carto.com/attributions\">CARTO</a>')\n\n\t\tuseEffect(() => {\n\t\t\t\tif (context) {\n\t\t\t\t\t\tcontext.registerTileLayer({\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\turl: resolvedUrl,\n\t\t\t\t\t\t\t\tattribution: resolvedAttribution,\n\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t}, [context, name, resolvedAttribution, resolvedUrl])\n\n\t\tif (context && context.selectedTileLayer !== name) {\n\t\t\t\treturn null\n\t\t}\n\n\t\treturn (\n\t\t\t\t<LeafletTileLayer\n\t\t\t\t\t\turl={resolvedUrl}\n\t\t\t\t\t\tattribution={resolvedAttribution}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapLayerGroup({\n\t\tname,\n\t\tdisabled,\n\t\t...props\n}: LayerGroupProps & MapLayerGroupOption & { ref?: Ref<LayerGroup> }) {\n\t\tconst context = useMapLayersContext()\n\n\t\tuseEffect(() => {\n\t\t\t\tif (context) {\n\t\t\t\t\t\tcontext.registerLayerGroup({\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t}, [context, name, disabled])\n\n\t\tif (context && !context.activeLayerGroups.includes(name)) {\n\t\t\t\treturn null\n\t\t}\n\n\t\treturn <LeafletLayerGroup {...props} />\n}\n\nfunction MapFeatureGroup({\n\t\tname,\n\t\tdisabled,\n\t\t...props\n}: LayerGroupProps & MapLayerGroupOption & { ref?: Ref<FeatureGroup> }) {\n\t\tconst context = useMapLayersContext()\n\n\t\tuseEffect(() => {\n\t\t\t\tif (context) {\n\t\t\t\t\t\tcontext.registerLayerGroup({\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t}, [context, name, disabled])\n\n\t\tif (context && !context.activeLayerGroups.includes(name)) {\n\t\t\t\treturn null\n\t\t}\n\n\t\treturn <LeafletFeatureGroup {...props} />\n}\n\nfunction MapLayers({\n\t\tdefaultTileLayer,\n\t\tdefaultLayerGroups = [],\n\t\t...props\n}: Omit<React.ComponentProps<typeof MapLayersContext.Provider>, \"value\"> & {\n\t\t/** Name of the tile layer shown first. */\n\t\tdefaultTileLayer?: string\n\t\t/** Names of the overlay groups shown first. */\n\t\tdefaultLayerGroups?: string[]\n}) {\n\t\tconst [tileLayers, setTileLayers] = useState<MapTileLayerOption[]>([])\n\t\tconst [selectedTileLayer, setSelectedTileLayer] = useState<string>(\n\t\t\t\tdefaultTileLayer || \"\"\n\t\t)\n\t\tconst [layerGroups, setLayerGroups] = useState<MapLayerGroupOption[]>([])\n\t\tconst [activeLayerGroups, setActiveLayerGroups] =\n\t\t\t\tuseState<string[]>(defaultLayerGroups)\n\n\t\tfunction registerTileLayer(tileLayer: MapTileLayerOption) {\n\t\t\t\tsetTileLayers((prevTileLayers) => {\n\t\t\t\t\t\tif (prevTileLayers.some((layer) => layer.name === tileLayer.name)) {\n\t\t\t\t\t\t\t\treturn prevTileLayers\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn [...prevTileLayers, tileLayer]\n\t\t\t\t})\n\t\t}\n\n\t\tfunction registerLayerGroup(layerGroup: MapLayerGroupOption) {\n\t\t\t\tsetLayerGroups((prevLayerGroups) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tprevLayerGroups.some((group) => group.name === layerGroup.name)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn prevLayerGroups\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn [...prevLayerGroups, layerGroup]\n\t\t\t\t})\n\t\t}\n\n\t\tuseEffect(() => {\n\t\t\t\t// Error: Invalid defaultValue\n\t\t\t\tif (\n\t\t\t\t\t\tdefaultTileLayer &&\n\t\t\t\t\t\ttileLayers.length > 0 &&\n\t\t\t\t\t\t!tileLayers.some((tileLayer) => tileLayer.name === defaultTileLayer)\n\t\t\t\t) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Invalid defaultTileLayer \"${defaultTileLayer}\" provided to MapLayers. It must match a MapTileLayer's name prop.`\n\t\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\t// Set initial selected tile layer\n\t\t\t\tif (tileLayers.length > 0 && !selectedTileLayer) {\n\t\t\t\t\t\tconst validDefaultValue =\n\t\t\t\t\t\t\t\tdefaultTileLayer &&\n\t\t\t\t\t\t\t\ttileLayers.some((layer) => layer.name === defaultTileLayer)\n\t\t\t\t\t\t\t\t\t\t? defaultTileLayer\n\t\t\t\t\t\t\t\t\t\t: tileLayers[0].name\n\t\t\t\t\t\tsetSelectedTileLayer(validDefaultValue)\n\t\t\t\t}\n\n\t\t\t\t// Error: Invalid defaultActiveLayerGroups\n\t\t\t\tif (\n\t\t\t\t\t\tdefaultLayerGroups.length > 0 &&\n\t\t\t\t\t\tlayerGroups.length > 0 &&\n\t\t\t\t\t\tdefaultLayerGroups.some(\n\t\t\t\t\t\t\t\t(name) => !layerGroups.some((group) => group.name === name)\n\t\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Invalid defaultLayerGroups value provided to MapLayers. All names must match a MapLayerGroup's name prop.`\n\t\t\t\t\t\t)\n\t\t\t\t}\n\t\t}, [\n\t\t\t\ttileLayers,\n\t\t\t\tdefaultTileLayer,\n\t\t\t\tselectedTileLayer,\n\t\t\t\tlayerGroups,\n\t\t\t\tdefaultLayerGroups,\n\t\t])\n\n\t\treturn (\n\t\t\t\t<MapLayersContext.Provider\n\t\t\t\t\t\tvalue={{\n\t\t\t\t\t\t\t\tregisterTileLayer,\n\t\t\t\t\t\t\t\ttileLayers,\n\t\t\t\t\t\t\t\tselectedTileLayer,\n\t\t\t\t\t\t\t\tsetSelectedTileLayer,\n\t\t\t\t\t\t\t\tregisterLayerGroup,\n\t\t\t\t\t\t\t\tlayerGroups,\n\t\t\t\t\t\t\t\tactiveLayerGroups,\n\t\t\t\t\t\t\t\tsetActiveLayerGroups,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapLayersControl({\n\t\ttileLayersLabel,\n\t\tlayerGroupsLabel,\n\t\tposition = \"top-1 right-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"button\"> & {\n\t\t/** Heading for the tile-layer group in the layer control. */\n\t\ttileLayersLabel?: string\n\t\t/** Heading for the overlay group in the layer control. */\n\t\tlayerGroupsLabel?: string\n\t\t/** Corner the control is anchored to. */\n\t\tposition?: string\n}) {\n\t\tconst strings = useMapStrings()\n\t\tconst layersContext = useMapLayersContext()\n\t\tif (!layersContext) {\n\t\t\t\tthrow new Error(\"MapLayersControl must be used within MapLayers\")\n\t\t}\n\n\t\tconst {\n\t\t\t\ttileLayers,\n\t\t\t\tselectedTileLayer,\n\t\t\t\tsetSelectedTileLayer,\n\t\t\t\tlayerGroups,\n\t\t\t\tactiveLayerGroups,\n\t\t\t\tsetActiveLayerGroups,\n\t\t} = layersContext\n\n\t\tif (tileLayers.length === 0 && layerGroups.length === 0) {\n\t\t\t\treturn null\n\t\t}\n\n\t\tfunction handleLayerGroupToggle(name: string, checked: boolean) {\n\t\t\t\tsetActiveLayerGroups(\n\t\t\t\t\t\tchecked\n\t\t\t\t\t\t\t\t? [...activeLayerGroups, name]\n\t\t\t\t\t\t\t\t: activeLayerGroups.filter((groupName) => groupName !== name)\n\t\t\t\t)\n\t\t}\n\n\t\tconst showTileLayersDropdown = tileLayers.length > 1\n\t\tconst showLayerGroupsDropdown = layerGroups.length > 0\n\n\t\tif (!showTileLayersDropdown && !showLayerGroupsDropdown) {\n\t\t\t\treturn null\n\t\t}\n\n\t\treturn (\n\t\t\t\t<DropdownMenu>\n\t\t\t\t\t\t<DropdownMenuTrigger\n\t\t\t\t\t\t\t\trender={(triggerProps) => (\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t{...triggerProps}\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\t\t\t\t\taria-label={strings.selectLayers}\n\t\t\t\t\t\t\t\t\t\t\t\ttitle={strings.selectLayers}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"border-border absolute z-1000 border\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tposition,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttriggerProps.className\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<LayersIcon />\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<DropdownMenuContent align=\"end\" className=\"z-1000\">\n\t\t\t\t\t\t\t\t{!!showTileLayersDropdown && <>\n\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuRadioGroup\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={selectedTileLayer}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonValueChange={setSelectedTileLayer}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuLabel>{tileLayersLabel ?? strings.mapType}</DropdownMenuLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{tileLayers.map((tileLayer) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuRadioItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={tileLayer.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={tileLayer.name}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{tileLayer.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuRadioItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuRadioGroup>\n\t\t\t\t\t\t\t\t\t\t</>}\n\t\t\t\t\t\t\t\t{!!showTileLayersDropdown && !!showLayerGroupsDropdown && <DropdownMenuSeparator />}\n\t\t\t\t\t\t\t\t{!!showLayerGroupsDropdown && (\n\t\t\t\t\t\t\t\t\t\t<DropdownMenuGroup>\n\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{layerGroupsLabel ?? strings.layers}\n\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t{layerGroups.map((layerGroup) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuCheckboxItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={layerGroup.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tchecked={activeLayerGroups.includes(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlayerGroup.name\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={layerGroup.disabled}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonCheckedChange={(checked) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thandleLayerGroupToggle(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlayerGroup.name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tchecked\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{layerGroup.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuCheckboxItem>\n\t\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</DropdownMenuGroup>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</DropdownMenuContent>\n\t\t\t\t</DropdownMenu>\n\t\t)\n}\n\nfunction MapMarker({\n\t\ticon = <MapPinIcon className=\"size-icon-lg fill-background text-foreground\" />,\n\t\ticonAnchor = [12, 12],\n\t\tbgPos,\n\t\tpopupAnchor,\n\t\ttooltipAnchor,\n\t\tariaLabel,\n\t\tref,\n\t\t...props\n}: Omit<MarkerProps, \"icon\"> &\n\t\tPick<\n\t\t\t\tDivIconOptions,\n\t\t\t\t\"iconAnchor\" | \"bgPos\" | \"popupAnchor\" | \"tooltipAnchor\"\n\t\t> & {\n\t\t\t\ticon?: ReactNode\n\t\t\t\tariaLabel?: string\n\t\t\t\tref?: Ref<Marker>\n\t\t}) {\n\t\tconst { L } = useLeaflet()\n\t\tconst strings = useMapStrings()\n\t\tconst markerRef = useRef<Marker | null>(null)\n\t\tconst resolvedAriaLabel =\n\t\t\t\tariaLabel ??\n\t\t\t\t(typeof props.title === \"string\" && props.title.trim()\n\t\t\t\t\t\t? props.title\n\t\t\t\t\t\t: undefined) ??\n\t\t\t\tstrings.marker\n\t\tconst resolvedTitle =\n\t\t\t\ttypeof props.title === \"string\" && props.title.trim()\n\t\t\t\t\t\t? props.title\n\t\t\t\t\t\t: resolvedAriaLabel\n\t\tconst syncMarkerElement = useCallback(\n\t\t\t\t(marker: Marker | null) => {\n\t\t\t\t\t\tconst element = marker?.getElement()\n\t\t\t\t\t\tif (!element) return\n\n\t\t\t\t\t\telement.setAttribute(\"aria-label\", resolvedAriaLabel)\n\t\t\t\t\t\tif (!element.getAttribute(\"title\")) {\n\t\t\t\t\t\t\t\telement.setAttribute(\"title\", resolvedAriaLabel)\n\t\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t[resolvedAriaLabel]\n\t\t)\n\t\tconst handleMarkerRef = useCallback(\n\t\t\t\t(marker: Marker | null) => {\n\t\t\t\t\t\tmarkerRef.current = marker\n\t\t\t\t\t\tassignRef(ref, marker)\n\t\t\t\t\t\tsyncMarkerElement(marker)\n\t\t\t\t},\n\t\t\t\t[ref, syncMarkerElement]\n\t\t)\n\n\t\tuseEffect(() => {\n\t\t\t\tsyncMarkerElement(markerRef.current)\n\t\t}, [syncMarkerElement])\n\n\t\tif (!L) return null\n\n\t\treturn (\n\t\t\t\t<LeafletMarker\n\t\t\t\t\t\tref={handleMarkerRef}\n\t\t\t\t\t\ticon={L.divIcon({\n\t\t\t\t\t\t\t\t// Empty className stops leaflet's default `.leaflet-div-icon`\n\t\t\t\t\t\t\t\t// (white background + grey border rectangle) from being applied\n\t\t\t\t\t\t\t\t// around our SVG marker.\n\t\t\t\t\t\t\t\tclassName: \"\",\n\t\t\t\t\t\t\t\thtml: renderToString(icon),\n\t\t\t\t\t\t\t\ticonAnchor,\n\t\t\t\t\t\t\t\t...(bgPos ? { bgPos } : {}),\n\t\t\t\t\t\t\t\t...(popupAnchor ? { popupAnchor } : {}),\n\t\t\t\t\t\t\t\t...(tooltipAnchor ? { tooltipAnchor } : {}),\n\t\t\t\t\t\t})}\n\t\t\t\t\t\triseOnHover\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t\ttitle={resolvedTitle}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapMarkerClusterGroup({\n\t\tpolygonOptions = {\n\t\t\t\tclassName: \"fill-foreground stroke-foreground stroke-2\",\n\t\t},\n\t\tspiderLegPolylineOptions = {\n\t\t\t\tclassName: \"fill-foreground stroke-foreground stroke-2\",\n\t\t},\n\t\ticon,\n\t\t...props\n}: Omit<MarkerClusterGroupProps, \"iconCreateFunction\"> & {\n\t\tchildren: ReactNode\n\t\t/** Marker glyph. */\n\t\ticon?: (markerCount: number) => ReactNode\n}) {\n\t\tconst { L } = useLeaflet()\n\t\tif (!L) return null\n\n\t\tconst iconCreateFunction = icon\n\t\t\t\t? (cluster: MarkerCluster) => {\n\t\t\t\t\t\t\tconst markerCount = cluster.getChildCount()\n\t\t\t\t\t\t\tconst iconNode = icon(markerCount)\n\t\t\t\t\t\t\treturn L.divIcon({\n\t\t\t\t\t\t\t\t\thtml: renderToString(iconNode),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t: undefined\n\n\t\treturn (\n\t\t\t\t<LeafletMarkerClusterGroup\n\t\t\t\t\t\tpolygonOptions={polygonOptions}\n\t\t\t\t\t\tspiderLegPolylineOptions={spiderLegPolylineOptions}\n\t\t\t\t\t\ticonCreateFunction={iconCreateFunction}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapCircle({\n\t\tclassName,\n\t\t...props\n}: CircleProps & { ref?: Ref<Circle> }) {\n\t\treturn (\n\t\t\t\t<LeafletCircle\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapCircleMarker({\n\t\tclassName,\n\t\t...props\n}: CircleMarkerProps & { ref?: Ref<CircleMarker> }) {\n\t\treturn (\n\t\t\t\t<LeafletCircleMarker\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapPolyline({\n\t\tclassName,\n\t\t...props\n}: PolylineProps & { ref?: Ref<Polyline> }) {\n\t\treturn (\n\t\t\t\t<LeafletPolyline\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapPolygon({\n\t\tclassName,\n\t\t...props\n}: PolygonProps & { ref?: Ref<Polygon> }) {\n\t\treturn (\n\t\t\t\t<LeafletPolygon\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapRectangle({\n\t\tclassName,\n\t\t...props\n}: RectangleProps & { ref?: Ref<Rectangle> }) {\n\t\treturn (\n\t\t\t\t<LeafletRectangle\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapPopup({\n\t\tclassName,\n\t\t...props\n}: Omit<PopupProps, \"content\"> & { ref?: Ref<Popup> }) {\n\t\treturn (\n\t\t\t\t<LeafletPopup\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"map-popup--component\",\n\t\t\t\t\t\t\t\t// The shared anchored-surface chrome and display inset; Leaflet positions it.\n\t\t\t\t\t\t\t\tpopoverRecipes.surface,\n\t\t\t\t\t\t\t\tpopoverRecipes.display,\n\t\t\t\t\t\t\t\tlayerRecipes.overlay,\n\t\t\t\t\t\t\t\t\"animate-in fade-out-0 fade-in-0 zoom-out-95 zoom-in-95 slide-in-from-bottom-2 w-72 font-sans outline-hidden\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapTooltip({\n\t\tclassName,\n\t\tchildren,\n\t\tside = \"top\",\n\t\tsideOffset = 15,\n\t\t...props\n}: Omit<TooltipProps, \"offset\"> & {\n\t\t/** Which side of the trigger the surface opens on. */\n\t\tside?: \"top\" | \"right\" | \"bottom\" | \"left\"\n\t\t/** Distance from the trigger, in pixels. */\n\t\tsideOffset?: number\n\t\tref?: Ref<Tooltip>\n}) {\n\t\tconst ARROW_POSITION_CLASSES = {\n\t\t\t\ttop: \"bottom-0.5 left-1/2 -translate-x-1/2 translate-y-1/2\",\n\t\t\t\tbottom: \"top-0.5 left-1/2 -translate-x-1/2 -translate-y-1/2\",\n\t\t\t\tleft: \"right-0.5 top-1/2 translate-x-1/2 -translate-y-1/2\",\n\t\t\t\tright: \"left-0.5 top-1/2 -translate-x-1/2 -translate-y-1/2\",\n\t\t}\n\t\tconst DEFAULT_OFFSET = {\n\t\t\t\ttop: [0, -sideOffset] satisfies PointExpression,\n\t\t\t\tbottom: [0, sideOffset] satisfies PointExpression,\n\t\t\t\tleft: [-sideOffset, 0] satisfies PointExpression,\n\t\t\t\tright: [sideOffset, 0] satisfies PointExpression,\n\t\t}\n\n\t\treturn (\n\t\t\t\t<LeafletTooltip\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"animate-in fade-in-0 zoom-in-95 fade-out-0 zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 w-fit text-xs text-balance transition-opacity\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tdata-side={side}\n\t\t\t\t\t\tdirection={side}\n\t\t\t\t\t\toffset={DEFAULT_OFFSET[side]}\n\t\t\t\t\t\topacity={1}\n\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\"bg-foreground fill-foreground absolute z-50 size-2.5 rotate-45 rounded-[2px]\",\n\t\t\t\t\t\t\t\t\t\tARROW_POSITION_CLASSES[side]\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t/>\n\t\t\t\t</LeafletTooltip>\n\t\t)\n}\n\nfunction MapZoomControl({\n\t\tposition = \"top-1 left-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"div\"> & { position?: string }) {\n\t\tconst map = useLeafletMap()\n\t\tconst strings = useMapStrings()\n\t\tconst [zoomLevel, setZoomLevel] = useState(map.getZoom())\n\n\t\tuseLeafletMapEvents({\n\t\t\t\tzoomend: () => {\n\t\t\t\t\t\tsetZoomLevel(map.getZoom())\n\t\t\t\t},\n\t\t})\n\n\t\treturn (\n\t\t\t\t<MapControlContainer className={cn(position, className)}>\n\t\t\t\t\t\t<ButtonGroup\n\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\taria-label={strings.zoomControls}\n\t\t\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\t\t\t\taria-label={strings.zoomIn}\n\t\t\t\t\t\t\t\t\t\ttitle={strings.zoomIn}\n\t\t\t\t\t\t\t\t\t\tclassName=\"border-border border\"\n\t\t\t\t\t\t\t\t\t\tdisabled={zoomLevel >= map.getMaxZoom()}\n\t\t\t\t\t\t\t\t\t\tonClick={() => map.zoomIn()}>\n\t\t\t\t\t\t\t\t\t\t<PlusIcon />\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\t\t\t\taria-label={strings.zoomOut}\n\t\t\t\t\t\t\t\t\t\ttitle={strings.zoomOut}\n\t\t\t\t\t\t\t\t\t\tclassName=\"border-border border\"\n\t\t\t\t\t\t\t\t\t\tdisabled={zoomLevel <= map.getMinZoom()}\n\t\t\t\t\t\t\t\t\t\tonClick={() => map.zoomOut()}>\n\t\t\t\t\t\t\t\t\t\t<MinusIcon />\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t</MapControlContainer>\n\t\t)\n}\n\nfunction MapFullscreenControl({\n\t\tposition = \"top-1 right-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"button\"> & { position?: string }) {\n\t\tconst map = useLeafletMap()\n\t\tconst strings = useMapStrings()\n\t\tconst [isFullscreen, setIsFullscreen] = useState(false)\n\n\t\tconst { L } = useLeaflet()\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L) return\n\n\t\t\t\tconst fullscreenControl = new L.Control.FullScreen()\n\t\t\t\tfullscreenControl.addTo(map)\n\n\t\t\t\tconst container = fullscreenControl.getContainer()\n\t\t\t\tif (container) {\n\t\t\t\t\t\tcontainer.style.display = \"none\"\n\t\t\t\t}\n\n\t\t\t\tconst handleEnter = () => setIsFullscreen(true)\n\t\t\t\tconst handleExit = () => setIsFullscreen(false)\n\n\t\t\t\tmap.on(\"enterFullscreen\", handleEnter)\n\t\t\t\tmap.on(\"exitFullscreen\", handleExit)\n\n\t\t\t\treturn () => {\n\t\t\t\t\t\tfullscreenControl.remove()\n\t\t\t\t\t\tmap.off(\"enterFullscreen\", handleEnter)\n\t\t\t\t\t\tmap.off(\"exitFullscreen\", handleExit)\n\t\t\t\t}\n\t\t}, [L, map])\n\n\t\treturn (\n\t\t\t\t<MapControlContainer className={cn(position, className)}>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\t\tonClick={() => map.toggleFullscreen()}\n\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\tisFullscreen ? strings.exitFullscreen : strings.enterFullscreen\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttitle={isFullscreen ? strings.exitFullscreen : strings.enterFullscreen}\n\t\t\t\t\t\t\t\tclassName=\"border-border border\"\n\t\t\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t\t\t{isFullscreen ? <MinimizeIcon /> : <MaximizeIcon />}\n\t\t\t\t\t\t</Button>\n\t\t\t\t</MapControlContainer>\n\t\t)\n}\n\nfunction MapLocatePulseIcon() {\n\t\treturn (\n\t\t\t\t<div className=\"absolute -top-1 -right-1 flex size-icon-sm rounded-full\">\n\t\t\t\t\t\t<div className=\"bg-primary absolute inline-flex size-full animate-ping rounded-full opacity-75\" />\n\t\t\t\t\t\t<div className=\"bg-primary relative inline-flex size-icon-sm rounded-full\" />\n\t\t\t\t</div>\n\t\t)\n}\n\nfunction MapLocateControl({\n\t\twatch = false,\n\t\tonLocationFound,\n\t\tonLocationError,\n\t\tposition = \"right-1 bottom-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"button\"> &\n\t\tPick<LocateOptions, \"watch\"> & {\n\t\t\t\tonLocationFound?: (location: LocationEvent) => void\n\t\t\t\tonLocationError?: (error: ErrorEvent) => void\n\t\t} & { position?: string }) {\n\t\tconst map = useLeafletMap()\n\t\tconst strings = useMapStrings()\n\t\tconst [isLocating, setIsLocating] = useDelayedLoadingState(200)\n\t\tconst [location, setLocation] = useState<LatLngExpression | null>(null)\n\t\tconst hasLocation = location !== null\n\n\t\tconst startLocating = useCallback(() => {\n\t\t\t\tsetIsLocating(true)\n\t\t\t\tmap.locate({ setView: true, maxZoom: map.getMaxZoom(), watch })\n\t\t\t\tmap.on(\"locationfound\", (location: LocationEvent) => {\n\t\t\t\t\t\tsetLocation(location.latlng)\n\t\t\t\t\t\tsetIsLocating(false)\n\t\t\t\t\t\tonLocationFound?.(location)\n\t\t\t\t})\n\t\t\t\tmap.on(\"locationerror\", (error: ErrorEvent) => {\n\t\t\t\t\t\tsetLocation(null)\n\t\t\t\t\t\tsetIsLocating(false)\n\t\t\t\t\t\tonLocationError?.(error)\n\t\t\t\t})\n\t\t}, [map, onLocationError, onLocationFound, setIsLocating, watch])\n\n\t\tconst stopLocating = useCallback(() => {\n\t\t\t\tmap.stopLocate()\n\t\t\t\tmap.off(\"locationfound\")\n\t\t\t\tmap.off(\"locationerror\")\n\t\t\t\tsetLocation(null)\n\t\t\t\tsetIsLocating(false)\n\t\t}, [map, setIsLocating])\n\t\tconst trackingHandler = hasLocation ? stopLocating : startLocating\n\t\tconst trackingTitle = isLocating\n\t\t\t\t? strings.locating\n\t\t\t\t: hasLocation\n\t\t\t\t\t? strings.stopTracking\n\t\t\t\t\t: strings.trackLocation\n\t\tconst trackingAriaLabel = isLocating\n\t\t\t\t? strings.locating\n\t\t\t\t: hasLocation\n\t\t\t\t\t? strings.stopLocationTracking\n\t\t\t\t\t: strings.startLocationTracking\n\t\tconst locationMarker =\n\t\t\t\thasLocation && location ? (\n\t\t\t\t\t\t<MapMarker\n\t\t\t\t\t\t\t\tposition={location}\n\t\t\t\t\t\t\t\ticon={<MapLocatePulseIcon />}\n\t\t\t\t\t\t\t\tariaLabel={strings.currentLocation}\n\t\t\t\t\t\t/>\n\t\t\t\t) : null\n\n\t\tuseEffect(() => () => stopLocating(), [stopLocating])\n\n\t\treturn (\n\t\t\t\t<MapControlContainer className={cn(position, className)}>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\ttone={hasLocation ? \"primary\" : \"secondary\"}\n\t\t\t\t\t\t\t\tonClick={trackingHandler}\n\t\t\t\t\t\t\t\tdisabled={isLocating}\n\t\t\t\t\t\t\t\ttitle={trackingTitle}\n\t\t\t\t\t\t\t\taria-label={trackingAriaLabel}\n\t\t\t\t\t\t\t\tclassName=\"border-border border\"\n\t\t\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t\t\t{isLocating ? (\n\t\t\t\t\t\t\t\t\t\t<LoaderCircleIcon className=\"animate-spin\" />\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<NavigationIcon />\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{locationMarker}\n\t\t\t\t</MapControlContainer>\n\t\t)\n}\n\nfunction MapSearchControl({\n\t\tposition = \"top-1 left-1\",\n\t\tclassName,\n\t\t...props\n}: PlaceAutocompleteProps & { position?: string }) {\n\t\treturn (\n\t\t\t\t<MapControlContainer className={cn(\"z-1001 w-60\", position, className)}>\n\t\t\t\t\t\t<PlaceAutocomplete {...props} />\n\t\t\t\t</MapControlContainer>\n\t\t)\n}\n\ntype MapDrawShape = \"marker\" | \"polyline\" | \"circle\" | \"rectangle\" | \"polygon\"\ntype MapDrawAction = \"edit\" | \"delete\"\ntype MapDrawMode = MapDrawShape | MapDrawAction | null\ninterface MapDrawContextType {\n\t\treadonly featureGroup: L.FeatureGroup | null\n\t\tactiveMode: MapDrawMode\n\t\tsetActiveMode: (mode: MapDrawMode) => void\n\t\treadonly editControlRef: React.RefObject<EditToolbar.Edit | null>\n\t\treadonly deleteControlRef: React.RefObject<EditToolbar.Delete | null>\n\t\treadonly layersCount: number\n}\n\nconst MapDrawContext = createContext<MapDrawContextType | null>(null)\n\nfunction useMapDrawContext() {\n\t\treturn useContext(MapDrawContext)\n}\n\nfunction MapDrawControl({\n\t\tonLayersChange,\n\t\tposition = \"bottom-1 left-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"div\"> & {\n\t\tonLayersChange?: (layers: L.FeatureGroup) => void\n\t\t/** Corner the control is anchored to. */\n\t\tposition?: string\n}) {\n\t\tconst { L, LeafletDraw } = useLeaflet()\n\t\tconst map = useLeafletMap()\n\t\tconst featureGroupRef = useRef<L.FeatureGroup | null>(null)\n\t\tconst editControlRef = useRef<EditToolbar.Edit | null>(null)\n\t\tconst deleteControlRef = useRef<EditToolbar.Delete | null>(null)\n\t\tconst [activeMode, setActiveMode] = useState<MapDrawMode>(null)\n\t\tconst [layersCount, setLayersCount] = useState(0)\n\n\t\tconst updateLayersCount = useCallback(() => {\n\t\t\t\tif (featureGroupRef.current) {\n\t\t\t\t\t\tsetLayersCount(featureGroupRef.current.getLayers().length)\n\t\t\t\t}\n\t\t}, [])\n\n\t\tconst handleDrawCreated = useCallback((event: DrawEvents.Created) => {\n\t\t\t\tif (!featureGroupRef.current) return\n\t\t\t\tconst { layer } = event\n\t\t\t\tfeatureGroupRef.current.addLayer(layer)\n\t\t\t\tonLayersChange?.(featureGroupRef.current)\n\t\t\t\tupdateLayersCount()\n\t\t\t\tsetActiveMode(null)\n\t\t}, [onLayersChange, updateLayersCount])\n\n\t\tconst handleDrawEditedOrDeleted = useCallback(() => {\n\t\t\t\tif (!featureGroupRef.current) return\n\t\t\t\tonLayersChange?.(featureGroupRef.current)\n\t\t\t\tupdateLayersCount()\n\t\t\t\tsetActiveMode(null)\n\t\t}, [onLayersChange, updateLayersCount])\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L || !LeafletDraw || !map) return\n\n\t\t\t\tmap.on(\n\t\t\t\t\t\tL.Draw.Event.CREATED,\n\t\t\t\t\t\thandleDrawCreated as L.LeafletEventHandlerFn\n\t\t\t\t)\n\t\t\t\tmap.on(L.Draw.Event.EDITED, handleDrawEditedOrDeleted)\n\t\t\t\tmap.on(L.Draw.Event.DELETED, handleDrawEditedOrDeleted)\n\n\t\t\t\treturn () => {\n\t\t\t\t\t\tmap.off(\n\t\t\t\t\t\t\t\tL.Draw.Event.CREATED,\n\t\t\t\t\t\t\t\thandleDrawCreated as L.LeafletEventHandlerFn\n\t\t\t\t\t\t)\n\t\t\t\t\t\tmap.off(L.Draw.Event.EDITED, handleDrawEditedOrDeleted)\n\t\t\t\t\t\tmap.off(L.Draw.Event.DELETED, handleDrawEditedOrDeleted)\n\t\t\t\t}\n\t\t}, [L, LeafletDraw, map, handleDrawCreated, handleDrawEditedOrDeleted])\n\n\t\treturn (\n\t\t\t\t<MapDrawContext.Provider\n\t\t\t\t\t\tvalue={{\n\t\t\t\t\t\t\t\tfeatureGroup: featureGroupRef.current,\n\t\t\t\t\t\t\t\tactiveMode,\n\t\t\t\t\t\t\t\tsetActiveMode,\n\t\t\t\t\t\t\t\teditControlRef,\n\t\t\t\t\t\t\t\tdeleteControlRef,\n\t\t\t\t\t\t\t\tlayersCount,\n\t\t\t\t\t\t}}>\n\t\t\t\t\t\t<LeafletFeatureGroup ref={featureGroupRef} />\n\t\t\t\t\t\t<MapControlContainer className={cn(position, className)}>\n\t\t\t\t\t\t\t\t<ButtonGroup orientation=\"vertical\" {...props} />\n\t\t\t\t\t\t</MapControlContainer>\n\t\t\t\t</MapDrawContext.Provider>\n\t\t)\n}\n\nfunction MapDrawShapeButton<T extends Draw.Feature>({\n\t\tdrawMode,\n\t\tcreateDrawTool,\n\t\tclassName,\n\t\tchildren,\n\t\t...props\n}: React.ComponentProps<\"button\"> & {\n\t\tdrawMode: MapDrawShape\n\t\tcreateDrawTool: (L: LeafletModule, map: DrawMap) => T\n}) {\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext) {\n\t\t\t\tthrow new Error(\"MapDrawShapeButton must be used within MapDrawControl\")\n\t\t}\n\t\tconst { L } = useLeaflet()\n\t\tconst strings = useMapStrings()\n\t\tconst map = useLeafletMap()\n\t\tconst controlRef = useRef<T | null>(null)\n\t\tconst { activeMode, setActiveMode } = drawContext\n\t\tconst isActive = activeMode === drawMode\n\t\tconst drawLabels: Record<MapDrawShape, string> = {\n\t\t\t\tmarker: strings.drawMarker,\n\t\t\t\tpolyline: strings.drawPolyline,\n\t\t\t\tcircle: strings.drawCircle,\n\t\t\t\trectangle: strings.drawRectangle,\n\t\t\t\tpolygon: strings.drawPolygon,\n\t\t}\n\t\tconst drawLabel = drawLabels[drawMode]\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L || !isActive) {\n\t\t\t\t\t\tcontrolRef.current?.disable()\n\t\t\t\t\t\tcontrolRef.current = null\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst control = createDrawTool(L, map as DrawMap)\n\t\t\t\tcontrol.enable()\n\t\t\t\tcontrolRef.current = control\n\t\t\t\treturn () => {\n\t\t\t\t\t\tcontrol.disable()\n\t\t\t\t\t\tcontrolRef.current = null\n\t\t\t\t}\n\t\t}, [L, map, isActive, createDrawTool])\n\n\t\tfunction handleClick() {\n\t\t\t\tsetActiveMode(isActive ? null : drawMode)\n\t\t}\n\n\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\taria-label={drawLabel}\n\t\t\t\t\t\ttitle={drawLabel}\n\t\t\t\t\t\tclassName={cn(\"border-border border\", className)}\n\t\t\t\t\t\ttone={isActive ? \"primary\" : \"secondary\"}\n\t\t\t\t\t\tdisabled={activeMode === \"edit\" || activeMode === \"delete\"}\n\t\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t</Button>\n\t\t)\n}\n\nfunction MapDrawMarker({ ...props }: DrawOptions.MarkerOptions) {\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"marker\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Marker(map, {\n\t\t\t\t\t\t\t\t\t\ticon: L.divIcon({\n\t\t\t\t\t\t\t\t\t\t\t\tclassName: \"\", // For fixing the moving bug when going in and out the edit mode\n\t\t\t\t\t\t\t\t\t\t\t\ticonAnchor: [12, 12],\n\t\t\t\t\t\t\t\t\t\t\t\thtml: renderToString(<MapPinIcon className=\"size-icon-lg\" />),\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<MapPinIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawPolyline({\n\t\tshowLength = false,\n\t\tdrawError = {\n\t\t\t\tcolor: \"var(--color-destructive)\",\n\t\t},\n\t\tshapeOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\topacity: 1,\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: DrawOptions.PolylineOptions) {\n\t\tconst mapDrawHandleIcon = useMapDrawHandleIcon()\n\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"polyline\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Polyline(map, {\n\t\t\t\t\t\t\t\t\t\t...(mapDrawHandleIcon\n\t\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon: mapDrawHandleIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttouchIcon: mapDrawHandleIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\t\tshowLength,\n\t\t\t\t\t\t\t\t\t\tdrawError,\n\t\t\t\t\t\t\t\t\t\tshapeOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<WaypointsIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawCircle({\n\t\tshowRadius = false,\n\t\tshapeOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\topacity: 1,\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: DrawOptions.CircleOptions) {\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"circle\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Circle(map, {\n\t\t\t\t\t\t\t\t\t\tshowRadius,\n\t\t\t\t\t\t\t\t\t\tshapeOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<CircleIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawRectangle({\n\t\tshowArea = false,\n\t\tshapeOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\topacity: 1,\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: DrawOptions.RectangleOptions) {\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"rectangle\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Rectangle(map, {\n\t\t\t\t\t\t\t\t\t\tshowArea,\n\t\t\t\t\t\t\t\t\t\tshapeOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<SquareIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawPolygon({\n\t\tdrawError = {\n\t\t\t\tcolor: \"var(--color-destructive)\",\n\t\t},\n\t\tshapeOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\topacity: 1,\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: DrawOptions.PolygonOptions) {\n\t\tconst mapDrawHandleIcon = useMapDrawHandleIcon()\n\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"polygon\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Polygon(map, {\n\t\t\t\t\t\t\t\t\t\t...(mapDrawHandleIcon\n\t\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon: mapDrawHandleIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttouchIcon: mapDrawHandleIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\t\tdrawError,\n\t\t\t\t\t\t\t\t\t\tshapeOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<PentagonIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawActionButton<T extends EditToolbar.Edit | EditToolbar.Delete>({\n\t\tdrawAction,\n\t\tcreateDrawTool,\n\t\tcontrolRef,\n\t\tclassName,\n\t\tchildren,\n\t\t...props\n}: React.ComponentProps<\"button\"> & {\n\t\tdrawAction: MapDrawAction\n\t\tcreateDrawTool: (\n\t\t\t\tL: LeafletModule,\n\t\t\t\tmap: DrawMap,\n\t\t\t\tfeatureGroup: L.FeatureGroup\n\t\t) => T\n\t\tcontrolRef: React.RefObject<T | null>\n}) {\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"MapDrawActionButton must be used within MapDrawControl\"\n\t\t\t\t)\n\n\t\tconst { L } = useLeaflet()\n\t\tconst strings = useMapStrings()\n\t\tconst map = useLeafletMap()\n\t\tconst { featureGroup, activeMode, setActiveMode, layersCount } = drawContext\n\t\tconst isActive = activeMode === drawAction\n\t\tconst hasFeatures = layersCount > 0\n\t\tconst actionLabel = drawAction === \"edit\" ? strings.editShapes : strings.removeShapes\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L || !featureGroup || !isActive) {\n\t\t\t\t\t\tcontrolRef.current?.disable?.()\n\t\t\t\t\t\tcontrolRef.current = null\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst control = createDrawTool(L, map as DrawMap, featureGroup)\n\t\t\t\tcontrol.enable?.()\n\t\t\t\tcontrolRef.current = control\n\t\t\t\treturn () => {\n\t\t\t\t\t\tcontrol.disable?.()\n\t\t\t\t\t\tcontrolRef.current = null\n\t\t\t\t}\n\t\t}, [L, map, isActive, featureGroup, createDrawTool, controlRef])\n\n\t\tfunction handleClick() {\n\t\t\t\tcontrolRef.current?.save()\n\t\t\t\tsetActiveMode(isActive ? null : drawAction)\n\t\t}\n\n\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\taria-label={actionLabel}\n\t\t\t\t\t\ttitle={actionLabel}\n\t\t\t\t\t\ttone={isActive ? \"primary\" : \"secondary\"}\n\t\t\t\t\t\tdisabled={!hasFeatures}\n\t\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\t\tclassName={cn(\"border-border border\", className)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t</Button>\n\t\t)\n}\n\nfunction MapDrawEdit({\n\t\tselectedPathOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\tfillColor: \"var(--color-primary)\",\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: Omit<EditToolbar.EditHandlerOptions, \"featureGroup\">) {\n\t\tconst { L } = useLeaflet()\n\t\tconst strings = useMapStrings()\n\t\tconst mapDrawHandleIcon = useMapDrawHandleIcon()\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext) {\n\t\t\t\tthrow new Error(\"MapDrawEdit must be used within MapDrawControl\")\n\t\t}\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L || !mapDrawHandleIcon) return\n\n\t\t\t\tL.Edit.PolyVerticesEdit.mergeOptions({\n\t\t\t\t\t\ticon: mapDrawHandleIcon,\n\t\t\t\t\t\ttouchIcon: mapDrawHandleIcon,\n\t\t\t\t\t\tdrawError: {\n\t\t\t\t\t\t\t\tcolor: \"var(--color-destructive)\",\n\t\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tL.Edit.SimpleShape.mergeOptions({\n\t\t\t\t\t\tmoveIcon: mapDrawHandleIcon,\n\t\t\t\t\t\tresizeIcon: mapDrawHandleIcon,\n\t\t\t\t\t\ttouchMoveIcon: mapDrawHandleIcon,\n\t\t\t\t\t\ttouchResizeIcon: mapDrawHandleIcon,\n\t\t\t\t})\n\t\t\t\tL.drawLocal.edit.handlers.edit.tooltip = {\n\t\t\t\t\t\ttext: strings.editInstructions,\n\t\t\t\t\t\tsubtext: \"\",\n\t\t\t\t}\n\t\t\t\tL.drawLocal.edit.handlers.remove.tooltip = {\n\t\t\t\t\t\ttext: strings.removeInstructions,\n\t\t\t\t}\n\t\t}, [L, mapDrawHandleIcon, strings.editInstructions, strings.removeInstructions])\n\n\t\treturn (\n\t\t\t\t<MapDrawActionButton\n\t\t\t\t\t\tdrawAction=\"edit\"\n\t\t\t\t\t\tcontrolRef={drawContext.editControlRef}\n\t\t\t\t\t\tcreateDrawTool={(L, map, featureGroup) =>\n\t\t\t\t\t\t\t\tnew L.EditToolbar.Edit(map, {\n\t\t\t\t\t\t\t\t\t\tfeatureGroup,\n\t\t\t\t\t\t\t\t\t\tselectedPathOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<PenLineIcon />\n\t\t\t\t</MapDrawActionButton>\n\t\t)\n}\n\nfunction MapDrawDelete() {\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext) {\n\t\t\t\tthrow new Error(\"MapDrawDelete must be used within MapDrawControl\")\n\t\t}\n\n\t\treturn (\n\t\t\t\t<MapDrawActionButton\n\t\t\t\t\t\tdrawAction=\"delete\"\n\t\t\t\t\t\tcontrolRef={drawContext.deleteControlRef}\n\t\t\t\t\t\tcreateDrawTool={(L, map, featureGroup) =>\n\t\t\t\t\t\t\t\tnew L.EditToolbar.Delete(map, { featureGroup })\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<Trash2Icon />\n\t\t\t\t</MapDrawActionButton>\n\t\t)\n}\n\nfunction MapDrawUndo({ className, ...props }: React.ComponentProps<\"button\">) {\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext)\n\t\t\t\tthrow new Error(\"MapDrawUndo must be used within MapDrawControl\")\n\t\tconst strings = useMapStrings()\n\n\t\tconst {\n\t\t\t\tactiveMode,\n\t\t\t\tsetActiveMode,\n\t\t\t\teditControlRef,\n\t\t\t\tdeleteControlRef,\n\t\t\t\tlayersCount,\n\t\t} = drawContext\n\t\tconst isInEditMode = activeMode === \"edit\"\n\t\tconst isInDeleteMode = activeMode === \"delete\"\n\t\tconst isActive = (isInEditMode || isInDeleteMode) && layersCount > 0\n\t\tconst undoLabel = isInDeleteMode ? strings.undoRemove : strings.undoEdit\n\n\t\tfunction handleUndo() {\n\t\t\t\tif (isInEditMode) {\n\t\t\t\t\t\teditControlRef.current?.revertLayers()\n\t\t\t\t} else if (isInDeleteMode) {\n\t\t\t\t\t\tdeleteControlRef.current?.revertLayers()\n\t\t\t\t}\n\t\t\t\tsetActiveMode(null)\n\t\t}\n\n\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\taria-label={undoLabel}\n\t\t\t\t\t\ttitle={undoLabel}\n\t\t\t\t\t\tonClick={handleUndo}\n\t\t\t\t\t\tdisabled={!isActive}\n\t\t\t\t\t\tclassName={cn(\"border-border border\", className)}\n\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t<Undo2Icon />\n\t\t\t\t</Button>\n\t\t)\n}\n\nfunction MapControlContainer({\n\t\tclassName,\n\t\t...props\n}: React.ComponentPropsWithoutRef<\"div\">) {\n\t\tconst { L } = useLeaflet()\n\t\tconst containerRef = useRef<HTMLDivElement>(null)\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L) return\n\t\t\t\tconst element = containerRef.current\n\t\t\t\tif (!element) return\n\t\t\t\tL.DomEvent.disableClickPropagation(element)\n\t\t\t\tL.DomEvent.disableScrollPropagation(element)\n\t\t}, [L])\n\n\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\t\tref={containerRef}\n\t\t\t\t\t\tclassName={cn(\"absolute z-1000 size-fit cursor-default\", className)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction useMapDrawHandleIcon() {\n\t\tconst { L } = useLeaflet()\n\t\tif (!L) return null\n\n\t\treturn L.divIcon({\n\t\t\t\ticonAnchor: [8, 8],\n\t\t\t\thtml: renderToString(\n\t\t\t\t\t\t<CircleIcon className=\"fill-primary-accent stroke-primary-accent size-icon transition-transform hover:scale-110\" />\n\t\t\t\t),\n\t\t})\n}\n\nfunction useLeaflet() {\n\t\tconst [L, setL] = useState<LeafletModule | null>(null)\n\t\tconst [LeafletDraw, setLeafletDraw] = useState<LeafletDrawModule | null>(\n\t\t\t\tnull\n\t\t)\n\n\t\tuseEffect(() => {\n\t\t\t\tasync function loadLeaflet() {\n\t\t\t\t\t\tconst leaflet = await import(\"leaflet\")\n\t\t\t\t\t\tconst leafletFullscreen = await import(\"leaflet.fullscreen\")\n\t\t\t\t\t\tconst leafletDraw = await import(\"leaflet-draw\")\n\n\t\t\t\t\t\tconst L_object = leaflet.default\n\t\t\t\t\t\tif (L_object.Control && !L_object.Control.FullScreen) {\n\t\t\t\t\t\t\t\tL_object.Control.FullScreen =\n\t\t\t\t\t\t\t\t\t\tleafletFullscreen.default || leafletFullscreen\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsetLeafletDraw(leafletDraw)\n\t\t\t\t\t\tsetL(L_object)\n\t\t\t\t}\n\n\t\t\t\tif (L && LeafletDraw) return\n\t\t\t\tif (typeof window === \"undefined\") return\n\n\t\t\t\tvoid loadLeaflet()\n\t\t}, [L, LeafletDraw])\n\n\t\treturn { L, LeafletDraw }\n}\n\n/**\n * Delays the *appearance* of a loading indicator so a fast lookup never\n * flashes a spinner. Not a debounce: it neither collapses a burst of calls\n * nor defers the work itself, so `useDebouncedCallback` does not apply.\n */\nfunction useDelayedLoadingState(delay = 200) {\n\t\tconst [isLoading, setIsLoading] = useState(false)\n\t\tconst [showLoading, setShowLoading] = useState(false)\n\t\tconst timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n\t\tuseEffect(() => {\n\t\t\t\tif (isLoading) {\n\t\t\t\t\t\ttimeoutRef.current = setTimeout(() => {\n\t\t\t\t\t\t\t\tsetShowLoading(true)\n\t\t\t\t\t\t}, delay)\n\t\t\t\t} else {\n\t\t\t\t\t\tif (timeoutRef.current) {\n\t\t\t\t\t\t\t\tclearTimeout(timeoutRef.current)\n\t\t\t\t\t\t\t\ttimeoutRef.current = null\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetShowLoading(false)\n\t\t\t\t}\n\n\t\t\t\treturn () => {\n\t\t\t\t\t\tif (timeoutRef.current) {\n\t\t\t\t\t\t\t\tclearTimeout(timeoutRef.current)\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t}, [isLoading, delay])\n\n\t\treturn [showLoading, setIsLoading] as const\n}\n\nexport {\n\t\tMap,\n\t\tMapCircle,\n\t\tMapCircleMarker,\n\t\tMapControlContainer,\n\t\tMapDrawCircle,\n\t\tMapDrawControl,\n\t\tMapDrawDelete,\n\t\tMapDrawEdit,\n\t\tMapDrawMarker,\n\t\tMapDrawPolygon,\n\t\tMapDrawPolyline,\n\t\tMapDrawRectangle,\n\t\tMapDrawUndo,\n\t\tMapFeatureGroup,\n\t\tMapFullscreenControl,\n\t\tMapLayerGroup,\n\t\tMapLayers,\n\t\tMapLayersControl,\n\t\tMapLocateControl,\n\t\tMapMarker,\n\t\tMapMarkerClusterGroup,\n\t\tMapPolygon,\n\t\tMapPolyline,\n\t\tMapPopup,\n\t\tMapRectangle,\n\t\tMapSearchControl,\n\t\tMapTileLayer,\n\t\tMapTooltip,\n\t\tMapZoomControl,\n\t\tuseLeaflet,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2EA,IAAM6B,KAA4D;CAChE,mBAAmB;CACnB,SAAS;CACT,OAAO;CACP,OAAO;CACP,WAAW;CACX,cAAc;AAChB;AAwDA,SAASC,GAAc,GAAoC;CACzD,IAAMC,IAAQ,CAAC;CA0Bf,OAxBIC,EAAW,QACbD,EAAM,KAAKC,EAAW,IAAI,GAGxBA,EAAW,eAAeA,EAAW,SACvCD,EAAM,KAAK,GAAGC,EAAW,YAAY,GAAGA,EAAW,QAAQ,IAClDA,EAAW,UACpBD,EAAM,KAAKC,EAAW,MAAM,GAG1BA,EAAW,OACbD,EAAM,KAAKC,EAAW,IAAI,IACjBA,EAAW,YACpBD,EAAM,KAAKC,EAAW,QAAQ,GAG5BA,EAAW,SAASA,EAAW,UAAUA,EAAW,QACtDD,EAAM,KAAKC,EAAW,KAAK,GAGzBA,EAAW,WACbD,EAAM,KAAKC,EAAW,OAAO,GAGxB,CAAC,GAAG,IAAI,IAAID,CAAK,CAAC,CAAC,CAAC,KAAK,IAAI;AACtC;AAEA,SAASE,GAAe,EACtB,UACA,SACA,SACA,QACA,UACA,sBACA,QACA,WACqB;CACrB,IAAMC,IAAM,IAAI,IAAI,8BAA8B;CA4BlD,OA3BAA,EAAI,aAAa,IAAI,KAAKC,CAA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