themelia-react-ui 1.0.1 → 2.0.0

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 (640) hide show
  1. package/CHANGELOG.md +417 -0
  2. package/README.md +67 -16
  3. package/dist/{accordion-B-5Focs8.js → accordion-CQXVcd7Q.js} +15 -15
  4. package/dist/accordion-CQXVcd7Q.js.map +1 -0
  5. package/dist/action-menu-BTpyPWJ2.js +264 -0
  6. package/dist/action-menu-BTpyPWJ2.js.map +1 -0
  7. package/dist/affordance-geometry.generated-CCIXb2A1.js +68 -0
  8. package/dist/affordance-geometry.generated-CCIXb2A1.js.map +1 -0
  9. package/dist/{ai-artifact-B5tPpXnS.js → ai-artifact-2PQ2fItc.js} +206 -215
  10. package/dist/ai-artifact-2PQ2fItc.js.map +1 -0
  11. package/dist/{app-shell-at8Kt4l_.js → app-shell-BE_j8-AT.js} +11 -10
  12. package/dist/app-shell-BE_j8-AT.js.map +1 -0
  13. package/dist/{attachment-BO2R47wn.js → attachment-q69dlt5Y.js} +14 -14
  14. package/dist/attachment-q69dlt5Y.js.map +1 -0
  15. package/dist/auth-M3vGMgDR.js +723 -0
  16. package/dist/auth-M3vGMgDR.js.map +1 -0
  17. package/dist/{avatar-Bpzty83c.js → avatar-djdaaQ_s.js} +15 -13
  18. package/dist/avatar-djdaaQ_s.js.map +1 -0
  19. package/dist/{badge-BZXZT9wd.js → badge-0tATj-tW.js} +9 -9
  20. package/dist/badge-0tATj-tW.js.map +1 -0
  21. package/dist/base/accordion.js +1 -1
  22. package/dist/base/action-menu.js +1 -1
  23. package/dist/base/attachment.js +1 -1
  24. package/dist/base/avatar.js +1 -1
  25. package/dist/base/badge.js +1 -1
  26. package/dist/base/buttons.js +3 -2
  27. package/dist/base/cards.js +3 -3
  28. package/dist/base/carousel.js +33 -35
  29. package/dist/base/carousel.js.map +1 -1
  30. package/dist/base/cascader.js +246 -222
  31. package/dist/base/cascader.js.map +1 -1
  32. package/dist/base/chart.js +1 -1
  33. package/dist/base/choice-inputs.js +2 -2
  34. package/dist/base/code-block.js +1 -1
  35. package/dist/base/combobox.js +1 -1
  36. package/dist/base/command.js +1 -1
  37. package/dist/base/copyable.js +1 -1
  38. package/dist/base/date-pickers.js +3 -3
  39. package/dist/base/display.js +7 -7
  40. package/dist/base/feedback.js +4 -4
  41. package/dist/base/forms-numeric.js +1 -1
  42. package/dist/base/forms.js +2 -2
  43. package/dist/base/inline-edit.js +94 -92
  44. package/dist/base/inline-edit.js.map +1 -1
  45. package/dist/base/item.js +1 -1
  46. package/dist/base/media-gallery.js +1 -1
  47. package/dist/base/navigation.js +6 -6
  48. package/dist/base/popover-menu.js +1 -1
  49. package/dist/base/popover.js +1 -1
  50. package/dist/base/qr-code.js +7 -4
  51. package/dist/base/qr-code.js.map +1 -1
  52. package/dist/base/repeaters.js +53 -53
  53. package/dist/base/repeaters.js.map +1 -1
  54. package/dist/base/sheet.js +1 -1
  55. package/dist/base/sidebar.js +1 -1
  56. package/dist/base/signature-pad.js +84 -82
  57. package/dist/base/signature-pad.js.map +1 -1
  58. package/dist/base/skeleton.js +1 -1
  59. package/dist/base/spinner.js +1 -1
  60. package/dist/base/structure.js +1 -1
  61. package/dist/base/table.js +1 -1
  62. package/dist/base/text-inputs.js +2 -2
  63. package/dist/base/toaster.js +7 -7
  64. package/dist/base/toaster.js.map +1 -1
  65. package/dist/base/tree.js +1 -1
  66. package/dist/base/upload-queue.js +1 -1
  67. package/dist/base/upload.js +3 -3
  68. package/dist/base/value-inputs.js +1 -1
  69. package/dist/blocks/admin.js +228 -219
  70. package/dist/blocks/admin.js.map +1 -1
  71. package/dist/blocks/ai.js +182 -212
  72. package/dist/blocks/ai.js.map +1 -1
  73. package/dist/blocks/analytics/usage-card.js +1 -1
  74. package/dist/blocks/analytics.js +665 -620
  75. package/dist/blocks/analytics.js.map +1 -1
  76. package/dist/blocks/collaboration.js +2 -2
  77. package/dist/blocks/commerce/receipt.js +1 -1
  78. package/dist/blocks/commerce.js +1439 -1553
  79. package/dist/blocks/commerce.js.map +1 -1
  80. package/dist/blocks/data-display.js +1 -1
  81. package/dist/blocks/onboarding.js +6 -6
  82. package/dist/blocks/onboarding.js.map +1 -1
  83. package/dist/blocks/planning.js +88 -97
  84. package/dist/blocks/planning.js.map +1 -1
  85. package/dist/blocks/timelines.js +1 -1
  86. package/dist/{breadcrumbs-DdQ_I5ra.js → breadcrumbs-BG_FfMK4.js} +10 -9
  87. package/dist/breadcrumbs-BG_FfMK4.js.map +1 -0
  88. package/dist/button-BS3KDg00.js +674 -0
  89. package/dist/button-BS3KDg00.js.map +1 -0
  90. package/dist/{button-BS6l5JUw.js → button-R9CCoH7A.js} +3 -3
  91. package/dist/button-R9CCoH7A.js.map +1 -0
  92. package/dist/buttons-DS0ZIwJ_.js +99 -0
  93. package/dist/buttons-DS0ZIwJ_.js.map +1 -0
  94. package/dist/{cards-Cum56XOF.js → cards-QoJ4syG9.js} +12 -12
  95. package/dist/{cards-Cum56XOF.js.map → cards-QoJ4syG9.js.map} +1 -1
  96. package/dist/chart-DwYRKKc-.js +152 -0
  97. package/dist/chart-DwYRKKc-.js.map +1 -0
  98. package/dist/checkbox-B7ygNTYp.js +35 -0
  99. package/dist/checkbox-B7ygNTYp.js.map +1 -0
  100. package/dist/choice-inputs-DrJ17tpL.js +752 -0
  101. package/dist/choice-inputs-DrJ17tpL.js.map +1 -0
  102. package/dist/{code-block-xHKbAJDj.js → code-block-CD0B7M93.js} +27 -27
  103. package/dist/code-block-CD0B7M93.js.map +1 -0
  104. package/dist/{collapsible-DsnktFNv.js → collapsible-oMUGM4tr.js} +3 -3
  105. package/dist/{collapsible-DsnktFNv.js.map → collapsible-oMUGM4tr.js.map} +1 -1
  106. package/dist/{collection-content-C4fthJV_.js → collection-content-Ys-OZOkY.js} +3 -3
  107. package/dist/{collection-content-C4fthJV_.js.map → collection-content-Ys-OZOkY.js.map} +1 -1
  108. package/dist/combobox-6dvVny2q.js +272 -0
  109. package/dist/combobox-6dvVny2q.js.map +1 -0
  110. package/dist/combobox-CB7039j7.js +865 -0
  111. package/dist/combobox-CB7039j7.js.map +1 -0
  112. package/dist/{command-C0xe7u9B.js → command-kPMPjIxJ.js} +35 -31
  113. package/dist/command-kPMPjIxJ.js.map +1 -0
  114. package/dist/{comments-DviPLnwy.js → comments-You0Bzbr.js} +434 -409
  115. package/dist/comments-You0Bzbr.js.map +1 -0
  116. package/dist/components/base/accordion/accordion-variants.d.ts +3 -3
  117. package/dist/components/base/action-menu/action-menu.d.ts +7 -2
  118. package/dist/components/base/avatar/stacked-avatars.d.ts +5 -4
  119. package/dist/components/base/badge/badge.d.ts +1 -1
  120. package/dist/components/base/badge/badge.recipes.d.ts +4 -4
  121. package/dist/components/base/buttons/base-button.d.ts +7 -0
  122. package/dist/components/base/buttons/button-group.recipes.d.ts +2 -2
  123. package/dist/components/base/buttons/button.recipes.d.ts +10 -19
  124. package/dist/components/base/buttons/button.variants.d.ts +1 -0
  125. package/dist/components/base/buttons/loader-button.d.ts +3 -1
  126. package/dist/components/base/buttons/text-button.d.ts +2 -2
  127. package/dist/components/base/buttons/use-pending-button-focus.d.ts +3 -0
  128. package/dist/components/base/cards/card.recipes.d.ts +13 -5
  129. package/dist/components/base/cards/partials/card-primitives.d.ts +9 -4
  130. package/dist/components/base/cards/smart-card.types.d.ts +1 -1
  131. package/dist/components/base/carousel/carousel.d.ts +3 -1
  132. package/dist/components/base/chart/chart.d.ts +7 -7
  133. package/dist/components/base/choice-inputs/checkbox.d.ts +6 -7
  134. package/dist/components/base/choice-inputs/choice-types.d.ts +10 -1
  135. package/dist/components/base/choice-inputs/pill-radio-group.d.ts +9 -0
  136. package/dist/components/base/choice-inputs/select-popup.d.ts +9 -1
  137. package/dist/components/base/choice-inputs/switch-card.d.ts +1 -1
  138. package/dist/components/base/date-pickers/date-picker-field.d.ts +23 -0
  139. package/dist/components/base/date-pickers/date-picker.recipes.d.ts +5 -18
  140. package/dist/components/base/date-pickers/datepicker.types.d.ts +16 -3
  141. package/dist/components/base/display/alert-dialog.d.ts +8 -2
  142. package/dist/components/base/display/content-block.d.ts +4 -2
  143. package/dist/components/base/display/date-block.d.ts +1 -1
  144. package/dist/components/base/display/dialog.d.ts +12 -5
  145. package/dist/components/base/display/surface-title.d.ts +6 -1
  146. package/dist/components/base/feedback/alert.d.ts +1 -1
  147. package/dist/components/base/feedback/state-display.d.ts +5 -4
  148. package/dist/components/base/forms/form-field.d.ts +1 -0
  149. package/dist/components/base/forms/form-sizing.d.ts +35 -3
  150. package/dist/components/base/forms/workflow.d.ts +2 -0
  151. package/dist/components/base/forms-numeric/coordinates-input.d.ts +3 -0
  152. package/dist/components/base/forms-numeric/rounding-mode-select.d.ts +4 -1
  153. package/dist/components/base/navigation/dropdown-menu.d.ts +2 -2
  154. package/dist/components/base/navigation/language-switcher.d.ts +4 -1
  155. package/dist/components/base/navigation/overflow-tab-bar.d.ts +7 -0
  156. package/dist/components/base/navigation/page-header/page-header.d.ts +4 -1
  157. package/dist/components/base/navigation/tabs.d.ts +3 -5
  158. package/dist/components/base/popover/popover.recipes.d.ts +3 -3
  159. package/dist/components/base/qr-code/qr-code.d.ts +2 -0
  160. package/dist/components/base/sheet/index.d.ts +29 -1
  161. package/dist/components/base/sheet/sheet.d.ts +14 -5
  162. package/dist/components/base/spinner/spinner.d.ts +3 -2
  163. package/dist/components/base/structure/structure.types.d.ts +1 -1
  164. package/dist/components/base/table/index.d.ts +1 -1
  165. package/dist/components/base/text-inputs/clear-native-field.d.ts +2 -0
  166. package/dist/components/base/text-inputs/input-group.d.ts +2 -2
  167. package/dist/components/base/text-inputs/input-trailing-action.d.ts +3 -0
  168. package/dist/components/base/upload/upload.recipes.d.ts +11 -0
  169. package/dist/components/base/value-inputs/date-time-input.d.ts +4 -2
  170. package/dist/components/base/value-inputs/tags-input.d.ts +2 -0
  171. package/dist/components/blocks/admin/api-key-list/api-key-list.types.d.ts +1 -1
  172. package/dist/components/blocks/analytics/format-metric-value.d.ts +11 -1
  173. package/dist/components/blocks/analytics/index.d.ts +1 -1
  174. package/dist/components/blocks/analytics/types.d.ts +1 -1
  175. package/dist/components/blocks/analytics/use-metric-format-options.d.ts +3 -0
  176. package/dist/components/blocks/collaboration/message/message.recipes.d.ts +12 -0
  177. package/dist/components/blocks/commerce/address-card/address-card.d.ts +1 -1
  178. package/dist/components/blocks/commerce/address-card/types.d.ts +3 -1
  179. package/dist/components/blocks/commerce/booking-calendar-event-card/booking-calendar-event-card.d.ts +4 -0
  180. package/dist/components/blocks/commerce/booking-calendar-event-card/booking-calendar-event-card.types.d.ts +2 -2
  181. package/dist/components/blocks/commerce/discount-stack/types.d.ts +1 -1
  182. package/dist/components/blocks/commerce/inventory-section/types.d.ts +4 -1
  183. package/dist/components/blocks/commerce/loyalty-points/types.d.ts +1 -1
  184. package/dist/components/blocks/commerce/order-status/types.d.ts +4 -0
  185. package/dist/components/blocks/commerce/payment-method/payment-method.d.ts +1 -1
  186. package/dist/components/blocks/commerce/payment-method/types.d.ts +3 -1
  187. package/dist/components/blocks/commerce/seo-listing/seo-listing-card.d.ts +1 -1
  188. package/dist/components/blocks/commerce/seo-listing/types.d.ts +3 -1
  189. package/dist/components/blocks/commerce/vendor-profile/types.d.ts +4 -1
  190. package/dist/components/blocks/data-display/dense-info-card/dense-info.strings.d.ts +4 -1
  191. package/dist/components/blocks/data-display/empty-state/partials/illustrations/document-stack.d.ts +1 -4
  192. package/dist/components/blocks/data-display/empty-state/partials/illustrations/inbox-clean.d.ts +1 -4
  193. package/dist/components/blocks/data-display/empty-state/partials/illustrations/index.d.ts +3 -3
  194. package/dist/components/blocks/data-display/empty-state/partials/illustrations/stacked-cards.d.ts +1 -6
  195. package/dist/components/blocks/data-display/inline-stat/inline-stat.d.ts +4 -1
  196. package/dist/components/features/combobox/components/error-message.d.ts +1 -1
  197. package/dist/components/features/comments/hooks/use-attachment-upload.d.ts +5 -0
  198. package/dist/components/features/filters/facets/search-facet.d.ts +0 -12
  199. package/dist/components/features/filters/facets/tags-facet.d.ts +1 -1
  200. package/dist/components/features/global-search/partials/global-search-idle-state.d.ts +1 -1
  201. package/dist/components/features/media-library/media-library.d.ts +1 -1
  202. package/dist/components/features/media-library/media-library.types.d.ts +9 -1
  203. package/dist/components/features/media-library/partials/media-library-partials.d.ts +1 -1
  204. package/dist/components/features/overlays/alert-dialog.d.ts +1 -1
  205. package/dist/components/features/overlays/drawer.d.ts +1 -1
  206. package/dist/components/features/overlays/hooks/use-overlay-actions.d.ts +2 -2
  207. package/dist/components/features/overlays/hooks/use-overlay-visibility.d.ts +11 -4
  208. package/dist/components/features/overlays/hooks/use-pending-overlay-focus.d.ts +2 -0
  209. package/dist/components/features/overlays/overlay-tone-icon.d.ts +37 -0
  210. package/dist/components/features/overlays/overlays.types.d.ts +46 -22
  211. package/dist/components/features/products/components/product-variants-manager.d.ts +1 -1
  212. package/dist/components/features/products/partials/index.d.ts +1 -1
  213. package/dist/components/features/products/partials/product-metric-tile.d.ts +6 -0
  214. package/dist/components/features/products/partials/product-tone.d.ts +11 -1
  215. package/dist/components/features/products/products.types.d.ts +2 -1
  216. package/dist/components/features/rich-text-editor/rich-text-editor.recipes.d.ts +2 -1
  217. package/dist/components/features/table/data-table.d.ts +1 -1
  218. package/dist/components/features/table/partials/cell-renderers.d.ts +1 -1
  219. package/dist/components/features/table/table.types.d.ts +1 -1
  220. package/dist/components/features/theme-tweaker/theme-provider-settings.d.ts +3 -1
  221. package/dist/components/layout/auth/auth.types.d.ts +1 -0
  222. package/dist/components/layout/page/index.d.ts +1 -1
  223. package/dist/components/layout/page/page.d.ts +0 -1
  224. package/dist/components/layout/page/page.types.d.ts +62 -6
  225. package/dist/components/layout/page/partials/page-header-commands.d.ts +13 -0
  226. package/dist/components/layout/page/partials/page-header.d.ts +1 -1
  227. package/dist/components/layout/sidebar/sidebar.context.d.ts +1 -1
  228. package/dist/components/layout/sidebar/sidebar.types.d.ts +4 -0
  229. package/dist/components/layout/workspace/workspace.types.d.ts +3 -0
  230. package/dist/components/primitives/date.d.ts +16 -3
  231. package/dist/components/primitives/dimensions.d.ts +6 -0
  232. package/dist/components/primitives/duration.d.ts +6 -0
  233. package/dist/components/primitives/file-size.d.ts +6 -0
  234. package/dist/components/primitives/index.d.ts +1 -1
  235. package/dist/components/primitives/initials.d.ts +11 -2
  236. package/dist/components/primitives/link.d.ts +7 -0
  237. package/dist/components/primitives/money.d.ts +29 -7
  238. package/dist/components/primitives/number.d.ts +17 -0
  239. package/dist/components/primitives/value-typography.d.ts +54 -0
  240. package/dist/components/primitives/value.d.ts +31 -6
  241. package/dist/components/typography/heading.d.ts +13 -2
  242. package/dist/components/typography/index.d.ts +1 -1
  243. package/dist/components/typography/label.d.ts +3 -0
  244. package/dist/components/typography/running-text.d.ts +12 -0
  245. package/dist/components/typography/text-link.d.ts +23 -1
  246. package/dist/components/typography/text.d.ts +12 -0
  247. package/dist/components/typography/text.styles.d.ts +37 -5
  248. package/dist/components/ui/button.d.ts +1 -1
  249. package/dist/components/ui/checkbox.d.ts +5 -0
  250. package/dist/components/ui/overlay.recipes.d.ts +15 -2
  251. package/dist/components/ui/popover.d.ts +1 -1
  252. package/dist/components/ui/select.d.ts +3 -1
  253. package/dist/components/ui/sidebar.d.ts +1 -1
  254. package/dist/components/ui/switch.d.ts +5 -0
  255. package/dist/components/ui/table.d.ts +2 -1
  256. package/dist/container.recipes-D9t8MHR3.js +27 -0
  257. package/dist/container.recipes-D9t8MHR3.js.map +1 -0
  258. package/dist/{containers-6s-ucRQQ.js → containers-D_L4mTVb.js} +34 -57
  259. package/dist/containers-D_L4mTVb.js.map +1 -0
  260. package/dist/control-group-recipes-DBXmfh2E.js +21 -0
  261. package/dist/control-group-recipes-DBXmfh2E.js.map +1 -0
  262. package/dist/{copyable-B7SBXJMr.js → copyable-DDjTeW_j.js} +6 -6
  263. package/dist/{copyable-B7SBXJMr.js.map → copyable-DDjTeW_j.js.map} +1 -1
  264. package/dist/data-display-3xWQUnMA.js +1335 -0
  265. package/dist/data-display-3xWQUnMA.js.map +1 -0
  266. package/dist/date-picker-DrDFj8Lo.js +1527 -0
  267. package/dist/date-picker-DrDFj8Lo.js.map +1 -0
  268. package/dist/date-pickers-CnFCb0n2.js +174 -0
  269. package/dist/date-pickers-CnFCb0n2.js.map +1 -0
  270. package/dist/date-uf3z37Nm.js +144 -0
  271. package/dist/date-uf3z37Nm.js.map +1 -0
  272. package/dist/{display-CFM5myut.js → display-DrdvPwF0.js} +25 -25
  273. package/dist/display-DrdvPwF0.js.map +1 -0
  274. package/dist/{dropdown-menu-BlnyHr-9.js → dropdown-menu-CURh59jb.js} +22 -15
  275. package/dist/dropdown-menu-CURh59jb.js.map +1 -0
  276. package/dist/features/activities.js +177 -163
  277. package/dist/features/activities.js.map +1 -1
  278. package/dist/features/ai-chat.js +187 -183
  279. package/dist/features/ai-chat.js.map +1 -1
  280. package/dist/features/async-preview.js +9 -9
  281. package/dist/features/async-preview.js.map +1 -1
  282. package/dist/features/combobox.js +1 -1
  283. package/dist/features/comments.js +1 -1
  284. package/dist/features/data-view.js +25 -23
  285. package/dist/features/data-view.js.map +1 -1
  286. package/dist/features/email-composer/engine.js +1 -1
  287. package/dist/features/email-composer.js +353 -355
  288. package/dist/features/email-composer.js.map +1 -1
  289. package/dist/features/event-calendar.js +346 -354
  290. package/dist/features/event-calendar.js.map +1 -1
  291. package/dist/features/filters.js +1 -1
  292. package/dist/features/global-search.js +225 -227
  293. package/dist/features/global-search.js.map +1 -1
  294. package/dist/features/kanban.js +29 -29
  295. package/dist/features/kanban.js.map +1 -1
  296. package/dist/features/map.js +59 -58
  297. package/dist/features/map.js.map +1 -1
  298. package/dist/features/media-library.js +898 -900
  299. package/dist/features/media-library.js.map +1 -1
  300. package/dist/features/mentions.js +1 -1
  301. package/dist/features/overlays.js +1 -1
  302. package/dist/features/products.js +1412 -1444
  303. package/dist/features/products.js.map +1 -1
  304. package/dist/features/questionnaire.js +51 -49
  305. package/dist/features/questionnaire.js.map +1 -1
  306. package/dist/features/resource-assignment.js +103 -97
  307. package/dist/features/resource-assignment.js.map +1 -1
  308. package/dist/features/resource.js +13 -13
  309. package/dist/features/resource.js.map +1 -1
  310. package/dist/features/rich-text-editor.js +2 -2
  311. package/dist/features/schema-form.js +187 -183
  312. package/dist/features/schema-form.js.map +1 -1
  313. package/dist/features/suggestions.js +3 -3
  314. package/dist/features/sync.js +7 -7
  315. package/dist/features/sync.js.map +1 -1
  316. package/dist/features/table.js +1 -1
  317. package/dist/features/theme-tweaker.js +508 -503
  318. package/dist/features/theme-tweaker.js.map +1 -1
  319. package/dist/{feedback-DWUkgEjR.js → feedback-C7nR0UtT.js} +30 -31
  320. package/dist/feedback-C7nR0UtT.js.map +1 -0
  321. package/dist/field-affordance-recipes-CkOCdE2y.js +46 -0
  322. package/dist/field-affordance-recipes-CkOCdE2y.js.map +1 -0
  323. package/dist/{field-state-recipes-CBTRt9Bt.js → field-state-recipes-C-MFBX_8.js} +5 -5
  324. package/dist/field-state-recipes-C-MFBX_8.js.map +1 -0
  325. package/dist/{filters-BhsUtsxW.js → filters-Da-gNPsE.js} +760 -765
  326. package/dist/filters-Da-gNPsE.js.map +1 -0
  327. package/dist/{form-field-Bn7ZH1rA.js → form-field-VZRULhUK.js} +20 -12
  328. package/dist/form-field-VZRULhUK.js.map +1 -0
  329. package/dist/form-sizing-uWP4lzVh.js +126 -0
  330. package/dist/form-sizing-uWP4lzVh.js.map +1 -0
  331. package/dist/{forms-B7pzS25o.js → forms-DDeEnXSY.js} +38 -38
  332. package/dist/forms-DDeEnXSY.js.map +1 -0
  333. package/dist/forms-numeric-D3CO60IF.js +905 -0
  334. package/dist/forms-numeric-D3CO60IF.js.map +1 -0
  335. package/dist/{header-C59QZyxV.js → header-2ycNqGOR.js} +42 -37
  336. package/dist/header-2ycNqGOR.js.map +1 -0
  337. package/dist/{hooks-CM1Vp9Pe.js → hooks-DQ5SPwZw.js} +2 -2
  338. package/dist/{hooks-CM1Vp9Pe.js.map → hooks-DQ5SPwZw.js.map} +1 -1
  339. package/dist/{http-CLTVJc5I.js → http-CdEIHyQf.js} +2 -2
  340. package/dist/http-CdEIHyQf.js.map +1 -0
  341. package/dist/{icon-badge-Dv0RYQwj.js → icon-badge-DKlaKXoo.js} +4 -4
  342. package/dist/{icon-badge-Dv0RYQwj.js.map → icon-badge-DKlaKXoo.js.map} +1 -1
  343. package/dist/index.js +2 -2
  344. package/dist/input-BoLm9Hks.js +20 -0
  345. package/dist/input-BoLm9Hks.js.map +1 -0
  346. package/dist/input-DhQdBnV3.js +255 -0
  347. package/dist/input-DhQdBnV3.js.map +1 -0
  348. package/dist/item-xzh8Df65.js +264 -0
  349. package/dist/item-xzh8Df65.js.map +1 -0
  350. package/dist/layout/app-shell.js +1 -1
  351. package/dist/layout/auth.js +1 -1
  352. package/dist/layout/containers.js +1 -1
  353. package/dist/layout/header.js +1 -1
  354. package/dist/layout/hooks.js +1 -1
  355. package/dist/layout/navigation.js +1 -1
  356. package/dist/layout/page.js +1 -1
  357. package/dist/layout/settings.js +1 -1
  358. package/dist/layout/sidebar.js +2 -2
  359. package/dist/layout/workspace.js +1 -1
  360. package/dist/layout.js +10 -10
  361. package/dist/lib/affordance-geometry.generated.d.ts +46 -10
  362. package/dist/lib/control-group-recipes.d.ts +22 -0
  363. package/dist/lib/field-affordance-recipes.d.ts +70 -2
  364. package/dist/lib/field-state-recipes.d.ts +6 -4
  365. package/dist/lib/format.d.ts +9 -0
  366. package/dist/lib/money-format.d.ts +30 -0
  367. package/dist/lib/navigation-row-recipes.d.ts +3 -2
  368. package/dist/lib/overlay-anatomy-recipes.d.ts +2 -2
  369. package/dist/lib/surface-recipes.d.ts +13 -8
  370. package/dist/lib/token-merge.generated.d.ts +144 -2
  371. package/dist/lib/track-recipes.d.ts +1 -1
  372. package/dist/lib/ui-provider/provider.d.ts +7 -2
  373. package/dist/lib/ui-provider/store.d.ts +6 -2
  374. package/dist/lib/ui-provider/types.d.ts +9 -4
  375. package/dist/lib/use-prefers-reduced-motion.d.ts +2 -0
  376. package/dist/lib/utils.js +1 -1
  377. package/dist/media-gallery-DQUQ0m3O.js +201 -0
  378. package/dist/media-gallery-DQUQ0m3O.js.map +1 -0
  379. package/dist/{mentions-B8Ko-fhS.js → mentions-DwnO1hh4.js} +40 -39
  380. package/dist/{mentions-B8Ko-fhS.js.map → mentions-DwnO1hh4.js.map} +1 -1
  381. package/dist/message-YfFmbXNP.js +127 -0
  382. package/dist/message-YfFmbXNP.js.map +1 -0
  383. package/dist/{navigation-BUIn2Qxx.js → navigation-Cbp5V8gG.js} +27 -28
  384. package/dist/navigation-Cbp5V8gG.js.map +1 -0
  385. package/dist/navigation-Cs1npsPm.js +300 -0
  386. package/dist/navigation-Cs1npsPm.js.map +1 -0
  387. package/dist/{navigation-row-recipes-GVh11KiT.js → navigation-row-recipes-DlU-4QYO.js} +3 -3
  388. package/dist/navigation-row-recipes-DlU-4QYO.js.map +1 -0
  389. package/dist/number-CKRBYmZK.js +352 -0
  390. package/dist/number-CKRBYmZK.js.map +1 -0
  391. package/dist/overlay.recipes-CNO2S9V6.js +34 -0
  392. package/dist/overlay.recipes-CNO2S9V6.js.map +1 -0
  393. package/dist/overlays-DhZO7N-I.js +994 -0
  394. package/dist/overlays-DhZO7N-I.js.map +1 -0
  395. package/dist/page-C6R_8jFt.js +325 -0
  396. package/dist/page-C6R_8jFt.js.map +1 -0
  397. package/dist/{page-header-DQRa0jug.js → page-header-hUTzcRZX.js} +12 -12
  398. package/dist/page-header-hUTzcRZX.js.map +1 -0
  399. package/dist/{pagination-C29vvt3I.js → pagination-Cm0jqa3I.js} +21 -21
  400. package/dist/pagination-Cm0jqa3I.js.map +1 -0
  401. package/dist/{popover-CoLDEg19.js → popover-Dcv_9jxr.js} +23 -22
  402. package/dist/popover-Dcv_9jxr.js.map +1 -0
  403. package/dist/{popover-menu-GLIQTJTx.js → popover-menu-DnRFKnHP.js} +6 -6
  404. package/dist/{popover-menu-GLIQTJTx.js.map → popover-menu-DnRFKnHP.js.map} +1 -1
  405. package/dist/{popover.recipes-zgBhMlUu.js → popover.recipes-wmbvL8Ah.js} +5 -5
  406. package/dist/popover.recipes-wmbvL8Ah.js.map +1 -0
  407. package/dist/primitives-BHrwQXFC.js +379 -0
  408. package/dist/primitives-BHrwQXFC.js.map +1 -0
  409. package/dist/primitives.js +5 -5
  410. package/dist/{progress-BOe8l_FZ.js → progress-Br9WTFya.js} +12 -11
  411. package/dist/progress-Br9WTFya.js.map +1 -0
  412. package/dist/{receipt-BM8xsGFy.js → receipt-CV89q1fs.js} +8 -8
  413. package/dist/{receipt-BM8xsGFy.js.map → receipt-CV89q1fs.js.map} +1 -1
  414. package/dist/rich-text-editor-CF8QYt5p.js +574 -0
  415. package/dist/rich-text-editor-CF8QYt5p.js.map +1 -0
  416. package/dist/{rich-text-editor.recipes-DxvOE0Lp.js → rich-text-editor.recipes-CnrbmTS1.js} +35 -26
  417. package/dist/rich-text-editor.recipes-CnrbmTS1.js.map +1 -0
  418. package/dist/{rich-text-B7sBAdDG.js → rich-text-j-FGAeZW.js} +4 -4
  419. package/dist/{rich-text-B7sBAdDG.js.map → rich-text-j-FGAeZW.js.map} +1 -1
  420. package/dist/{scroll-area-BheMQ270.js → scroll-area-DRdr16Pt.js} +3 -3
  421. package/dist/scroll-area-DRdr16Pt.js.map +1 -0
  422. package/dist/{separator-DO0EbCEm.js → separator-BMEvwnSX.js} +2 -2
  423. package/dist/{separator-DO0EbCEm.js.map → separator-BMEvwnSX.js.map} +1 -1
  424. package/dist/{separator-Gk_WXH-l.js → separator-Do5GWDYi.js} +4 -4
  425. package/dist/separator-Do5GWDYi.js.map +1 -0
  426. package/dist/services/actions/action-adapters.d.ts +4 -0
  427. package/dist/services/actions.js +8 -3
  428. package/dist/services/actions.js.map +1 -1
  429. package/dist/{settings-BnCyyPOJ.js → settings-DHk0L2MF.js} +20 -19
  430. package/dist/settings-DHk0L2MF.js.map +1 -0
  431. package/dist/sheet-DRFNY1_D.js +207 -0
  432. package/dist/sheet-DRFNY1_D.js.map +1 -0
  433. package/dist/sidebar-Cb8WzOvE.js +511 -0
  434. package/dist/sidebar-Cb8WzOvE.js.map +1 -0
  435. package/dist/{sidebar-DPR7fmqN.js → sidebar-Crc9M9JV.js} +220 -201
  436. package/dist/sidebar-Crc9M9JV.js.map +1 -0
  437. package/dist/{skeleton-CmT1ppqb.js → skeleton-DVMXr15h.js} +5 -5
  438. package/dist/{skeleton-CmT1ppqb.js.map → skeleton-DVMXr15h.js.map} +1 -1
  439. package/dist/smart-card-Bek-TwUp.js +599 -0
  440. package/dist/smart-card-Bek-TwUp.js.map +1 -0
  441. package/dist/{spinner-BY9HbUEh.js → spinner-CmTAbEp0.js} +8 -6
  442. package/dist/spinner-CmTAbEp0.js.map +1 -0
  443. package/dist/{structure-MvKVq-oL.js → structure-hzCW-XsV.js} +3 -3
  444. package/dist/{structure-MvKVq-oL.js.map → structure-hzCW-XsV.js.map} +1 -1
  445. package/dist/{structure.recipes-Bqhf9oIh.js → structure.recipes-EPz60cU8.js} +37 -19
  446. package/dist/structure.recipes-EPz60cU8.js.map +1 -0
  447. package/dist/style.css +1 -1
  448. package/dist/surface-recipes-DOdoBXGm.js +28 -0
  449. package/dist/surface-recipes-DOdoBXGm.js.map +1 -0
  450. package/dist/table-D6zKeYQX.js +162 -0
  451. package/dist/table-D6zKeYQX.js.map +1 -0
  452. package/dist/table-Dn4XSrSB.js +1444 -0
  453. package/dist/table-Dn4XSrSB.js.map +1 -0
  454. package/dist/tabs-Dk8E_knt.js +189 -0
  455. package/dist/tabs-Dk8E_knt.js.map +1 -0
  456. package/dist/text-inputs-BFpku0Qd.js +331 -0
  457. package/dist/text-inputs-BFpku0Qd.js.map +1 -0
  458. package/dist/{text.styles-BwB7vAF2.js → text.styles-g4He6UIW.js} +26 -15
  459. package/dist/text.styles-g4He6UIW.js.map +1 -0
  460. package/dist/theme.css +90 -124
  461. package/dist/themes/green.css +24 -0
  462. package/dist/{timelines-B9ICkQcV.js → timelines-CxuAFIc2.js} +97 -104
  463. package/dist/timelines-CxuAFIc2.js.map +1 -0
  464. package/dist/track-recipes-CDcKmndW.js +10 -0
  465. package/dist/track-recipes-CDcKmndW.js.map +1 -0
  466. package/dist/{tree-BdWSaoFT.js → tree-BotPlyiD.js} +13 -13
  467. package/dist/{tree-BdWSaoFT.js.map → tree-BotPlyiD.js.map} +1 -1
  468. package/dist/typography/rich-text.js +1 -1
  469. package/dist/typography-CAr3dQhX.js +116 -0
  470. package/dist/typography-CAr3dQhX.js.map +1 -0
  471. package/dist/typography.js +2 -2
  472. package/dist/{ui-provider-CftIB6TY.js → ui-provider-D2_TeLqw.js} +22 -22
  473. package/dist/ui-provider-D2_TeLqw.js.map +1 -0
  474. package/dist/ui-provider.js +1 -1
  475. package/dist/{upload-D8Za5x_c.js → upload-B0WHW7ak.js} +278 -274
  476. package/dist/upload-B0WHW7ak.js.map +1 -0
  477. package/dist/{upload-queue-hIIYBLS7.js → upload-queue-BHZ_wBfd.js} +72 -75
  478. package/dist/upload-queue-BHZ_wBfd.js.map +1 -0
  479. package/dist/{usage-card-DnmnJ58D.js → usage-card-U0YBLTNT.js} +31 -33
  480. package/dist/usage-card-U0YBLTNT.js.map +1 -0
  481. package/dist/utils-Cospvlj1.js +4445 -0
  482. package/dist/utils-Cospvlj1.js.map +1 -0
  483. package/dist/value-inputs-CjfzGMsN.js +854 -0
  484. package/dist/value-inputs-CjfzGMsN.js.map +1 -0
  485. package/dist/value-typography-Deb3yQZg.js +116 -0
  486. package/dist/value-typography-Deb3yQZg.js.map +1 -0
  487. package/dist/{workspace-C1PZmk8L.js → workspace-YoFjXi6i.js} +97 -105
  488. package/dist/workspace-YoFjXi6i.js.map +1 -0
  489. package/docs/consumer-skill/SKILL.md +123 -119
  490. package/docs/consumer-skill/examples/analytics.tsx +34 -0
  491. package/docs/consumer-skill/examples/app-layout.tsx +42 -14
  492. package/docs/consumer-skill/examples/detail.tsx +20 -5
  493. package/docs/consumer-skill/examples/edit.tsx +1 -1
  494. package/docs/consumer-skill/examples/layout-blocks.tsx +20 -0
  495. package/docs/consumer-skill/examples/manifest.json +37 -3
  496. package/docs/consumer-skill/examples/scoped-directory.tsx +2 -2
  497. package/docs/consumer-skill/examples/website.tsx +56 -0
  498. package/docs/consumer-skill/references/analytics.md +70 -0
  499. package/docs/consumer-skill/references/composition.md +195 -9
  500. package/docs/consumer-skill/references/design-contract.md +33 -7
  501. package/docs/consumer-skill/references/discovery.md +80 -5
  502. package/docs/consumer-skill/references/installation.md +22 -0
  503. package/docs/consumer-skill/references/integration.md +46 -1
  504. package/docs/consumer-skill/references/public-api.json +2083 -237
  505. package/docs/consumer-skill/references/review.md +74 -6
  506. package/docs/consumer-skill/references/theming.md +59 -8
  507. package/docs/consumer-skill/references/tokens.json +180 -9
  508. package/docs/consumer-skill/references/workflows.md +34 -0
  509. package/docs/consumer-skill/scripts/check-composition.mjs +1 -1
  510. package/docs/consumer-skill/scripts/composition-policy.mjs +271 -18
  511. package/docs/consumer-skill/scripts/discovery.mjs +69 -9
  512. package/docs/consumer-skill/scripts/pin-button-defaults.mjs +95 -0
  513. package/docs/consumer-skill/scripts/surface-policy.mjs +44 -0
  514. package/package.json +11 -6
  515. package/dist/accordion-B-5Focs8.js.map +0 -1
  516. package/dist/action-menu-Cx3SdfbN.js +0 -265
  517. package/dist/action-menu-Cx3SdfbN.js.map +0 -1
  518. package/dist/affordance-geometry.generated-D8Jcfb0G.js +0 -32
  519. package/dist/affordance-geometry.generated-D8Jcfb0G.js.map +0 -1
  520. package/dist/ai-artifact-B5tPpXnS.js.map +0 -1
  521. package/dist/app-shell-at8Kt4l_.js.map +0 -1
  522. package/dist/attachment-BO2R47wn.js.map +0 -1
  523. package/dist/auth-OFwWSAap.js +0 -704
  524. package/dist/auth-OFwWSAap.js.map +0 -1
  525. package/dist/avatar-Bpzty83c.js.map +0 -1
  526. package/dist/badge-BZXZT9wd.js.map +0 -1
  527. package/dist/breadcrumbs-DdQ_I5ra.js.map +0 -1
  528. package/dist/button-BS6l5JUw.js.map +0 -1
  529. package/dist/buttons-Co6GavvM.js +0 -674
  530. package/dist/buttons-Co6GavvM.js.map +0 -1
  531. package/dist/chart-DVfcwQu6.js +0 -149
  532. package/dist/chart-DVfcwQu6.js.map +0 -1
  533. package/dist/checkbox-BavDRjF7.js +0 -34
  534. package/dist/checkbox-BavDRjF7.js.map +0 -1
  535. package/dist/choice-inputs-CC7XqPQO.js +0 -619
  536. package/dist/choice-inputs-CC7XqPQO.js.map +0 -1
  537. package/dist/code-block-xHKbAJDj.js.map +0 -1
  538. package/dist/combobox-DEbdr-3u.js +0 -273
  539. package/dist/combobox-DEbdr-3u.js.map +0 -1
  540. package/dist/combobox-xv3yJbzl.js +0 -850
  541. package/dist/combobox-xv3yJbzl.js.map +0 -1
  542. package/dist/command-C0xe7u9B.js.map +0 -1
  543. package/dist/comments-DviPLnwy.js.map +0 -1
  544. package/dist/containers-6s-ucRQQ.js.map +0 -1
  545. package/dist/data-display-cWIRdeaf.js +0 -1129
  546. package/dist/data-display-cWIRdeaf.js.map +0 -1
  547. package/dist/date-BFNMnrS5.js +0 -140
  548. package/dist/date-BFNMnrS5.js.map +0 -1
  549. package/dist/date-picker-CA6ogMQB.js +0 -1521
  550. package/dist/date-picker-CA6ogMQB.js.map +0 -1
  551. package/dist/date-pickers-BPIKLdsD.js +0 -224
  552. package/dist/date-pickers-BPIKLdsD.js.map +0 -1
  553. package/dist/display-CFM5myut.js.map +0 -1
  554. package/dist/dropdown-menu-BlnyHr-9.js.map +0 -1
  555. package/dist/feedback-DWUkgEjR.js.map +0 -1
  556. package/dist/field-affordance-recipes-IjzPrCTw.js +0 -17
  557. package/dist/field-affordance-recipes-IjzPrCTw.js.map +0 -1
  558. package/dist/field-state-recipes-CBTRt9Bt.js.map +0 -1
  559. package/dist/filters-BhsUtsxW.js.map +0 -1
  560. package/dist/form-field-Bn7ZH1rA.js.map +0 -1
  561. package/dist/form-sizing-BWs70_a2.js +0 -100
  562. package/dist/form-sizing-BWs70_a2.js.map +0 -1
  563. package/dist/format-iamDSqs2.js +0 -110
  564. package/dist/format-iamDSqs2.js.map +0 -1
  565. package/dist/forms-B7pzS25o.js.map +0 -1
  566. package/dist/forms-numeric-BUBxELBv.js +0 -867
  567. package/dist/forms-numeric-BUBxELBv.js.map +0 -1
  568. package/dist/header-C59QZyxV.js.map +0 -1
  569. package/dist/http-CLTVJc5I.js.map +0 -1
  570. package/dist/input-WwYQZJzG.js +0 -202
  571. package/dist/input-WwYQZJzG.js.map +0 -1
  572. package/dist/input-ci9fIgFH.js +0 -20
  573. package/dist/input-ci9fIgFH.js.map +0 -1
  574. package/dist/item-pJ0GsOiJ.js +0 -257
  575. package/dist/item-pJ0GsOiJ.js.map +0 -1
  576. package/dist/media-gallery-DhDRgnVZ.js +0 -200
  577. package/dist/media-gallery-DhDRgnVZ.js.map +0 -1
  578. package/dist/message-COsdEvXT.js +0 -108
  579. package/dist/message-COsdEvXT.js.map +0 -1
  580. package/dist/navigation-BUIn2Qxx.js.map +0 -1
  581. package/dist/navigation-DBEu4POU.js +0 -267
  582. package/dist/navigation-DBEu4POU.js.map +0 -1
  583. package/dist/navigation-row-recipes-GVh11KiT.js.map +0 -1
  584. package/dist/number-BNT_BIzJ.js +0 -269
  585. package/dist/number-BNT_BIzJ.js.map +0 -1
  586. package/dist/overlay.recipes-BxW5FIfK.js +0 -6
  587. package/dist/overlay.recipes-BxW5FIfK.js.map +0 -1
  588. package/dist/overlays-B11wZka6.js +0 -982
  589. package/dist/overlays-B11wZka6.js.map +0 -1
  590. package/dist/page-BV6ioQg3.js +0 -202
  591. package/dist/page-BV6ioQg3.js.map +0 -1
  592. package/dist/page-header-DQRa0jug.js.map +0 -1
  593. package/dist/pagination-C29vvt3I.js.map +0 -1
  594. package/dist/popover-CoLDEg19.js.map +0 -1
  595. package/dist/popover.recipes-zgBhMlUu.js.map +0 -1
  596. package/dist/primitives-DKPOGVpj.js +0 -330
  597. package/dist/primitives-DKPOGVpj.js.map +0 -1
  598. package/dist/progress-BOe8l_FZ.js.map +0 -1
  599. package/dist/rich-text-editor-CoVrTiSv.js +0 -575
  600. package/dist/rich-text-editor-CoVrTiSv.js.map +0 -1
  601. package/dist/rich-text-editor.recipes-DxvOE0Lp.js.map +0 -1
  602. package/dist/scroll-area-BheMQ270.js.map +0 -1
  603. package/dist/select-B2mb-qN2.js +0 -108
  604. package/dist/select-B2mb-qN2.js.map +0 -1
  605. package/dist/separator-Gk_WXH-l.js.map +0 -1
  606. package/dist/settings-BnCyyPOJ.js.map +0 -1
  607. package/dist/sheet-B-q914Ad.js +0 -205
  608. package/dist/sheet-B-q914Ad.js.map +0 -1
  609. package/dist/sidebar-C_2p3Tfj.js +0 -501
  610. package/dist/sidebar-C_2p3Tfj.js.map +0 -1
  611. package/dist/sidebar-DPR7fmqN.js.map +0 -1
  612. package/dist/smart-card-CYLn46e6.js +0 -578
  613. package/dist/smart-card-CYLn46e6.js.map +0 -1
  614. package/dist/spinner-BY9HbUEh.js.map +0 -1
  615. package/dist/structure.recipes-Bqhf9oIh.js.map +0 -1
  616. package/dist/surface-recipes-CQfRr-VL.js +0 -27
  617. package/dist/surface-recipes-CQfRr-VL.js.map +0 -1
  618. package/dist/table-BS39xnlq.js +0 -1424
  619. package/dist/table-BS39xnlq.js.map +0 -1
  620. package/dist/table-DnlAJ-xR.js +0 -146
  621. package/dist/table-DnlAJ-xR.js.map +0 -1
  622. package/dist/tabs-B5cNMWiP.js +0 -187
  623. package/dist/tabs-B5cNMWiP.js.map +0 -1
  624. package/dist/text-inputs-Dh9XGyiS.js +0 -331
  625. package/dist/text-inputs-Dh9XGyiS.js.map +0 -1
  626. package/dist/text.styles-BwB7vAF2.js.map +0 -1
  627. package/dist/timelines-B9ICkQcV.js.map +0 -1
  628. package/dist/track-recipes-LLPNVwFg.js +0 -10
  629. package/dist/track-recipes-LLPNVwFg.js.map +0 -1
  630. package/dist/typography-Cv8MT-82.js +0 -96
  631. package/dist/typography-Cv8MT-82.js.map +0 -1
  632. package/dist/ui-provider-CftIB6TY.js.map +0 -1
  633. package/dist/upload-D8Za5x_c.js.map +0 -1
  634. package/dist/upload-queue-hIIYBLS7.js.map +0 -1
  635. package/dist/usage-card-DnmnJ58D.js.map +0 -1
  636. package/dist/utils-C2EKeIw3.js +0 -72
  637. package/dist/utils-C2EKeIw3.js.map +0 -1
  638. package/dist/value-inputs-DX2dbxjj.js +0 -824
  639. package/dist/value-inputs-DX2dbxjj.js.map +0 -1
  640. package/dist/workspace-C1PZmk8L.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-md\",\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-md 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\tMapPopup,\n\t\tMapRectangle,\n\t\tMapSearch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B,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","Text","Button","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","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","ButtonGroup","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\tMapMarkerCluster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