themelia-react-ui 2.0.4 → 2.0.6
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.
- package/CHANGELOG.md +211 -0
- package/MIGRATION.md +119 -0
- package/README.md +122 -20
- package/dist/{accordion-96o0pN62.js → accordion-0tQUZ20r.js} +13 -13
- package/dist/accordion-0tQUZ20r.js.map +1 -0
- package/dist/{action-menu-CHgs8vmj.js → action-menu-C0gjzLyE.js} +48 -45
- package/dist/action-menu-C0gjzLyE.js.map +1 -0
- package/dist/{affordance-geometry.generated-B8yGOr8-.js → affordance-geometry.generated-P-aVJisu.js} +36 -36
- package/dist/affordance-geometry.generated-P-aVJisu.js.map +1 -0
- package/dist/{ai-artifact-BZUGwBq6.js → ai-artifact-CGGpQryR.js} +281 -230
- package/dist/ai-artifact-CGGpQryR.js.map +1 -0
- package/dist/app-shell-EHuuRDGy.js +321 -0
- package/dist/app-shell-EHuuRDGy.js.map +1 -0
- package/dist/{attachment-DkoqHPPl.js → attachment-BCpA4e7i.js} +10 -10
- package/dist/{attachment-DkoqHPPl.js.map → attachment-BCpA4e7i.js.map} +1 -1
- package/dist/{auth-D2FVZ1MH.js → auth-B0girIk_.js} +49 -52
- package/dist/auth-B0girIk_.js.map +1 -0
- package/dist/{avatar-DWO_HHhB.js → avatar-B9Jnp-T-.js} +8 -8
- package/dist/avatar-B9Jnp-T-.js.map +1 -0
- package/dist/{badge-DErMA7ul.js → badge-wWauMgAt.js} +5 -5
- package/dist/{badge-DErMA7ul.js.map → badge-wWauMgAt.js.map} +1 -1
- package/dist/base/accordion.js +1 -1
- package/dist/base/action-menu.js +1 -1
- package/dist/base/attachment.js +1 -1
- package/dist/base/avatar.js +1 -1
- package/dist/base/badge.js +1 -1
- package/dist/base/batch-action-bar.js +1 -1
- package/dist/base/buttons.js +1 -1
- package/dist/base/cards.js +2 -2
- package/dist/base/carousel.js +3 -3
- package/dist/base/cascader.js +2 -372
- package/dist/base/chart.js +1 -1
- package/dist/base/choice-inputs.js +2 -2
- package/dist/base/code-block.js +1 -1
- package/dist/base/combobox.js +2 -2
- package/dist/base/command.js +1 -1
- package/dist/base/copyable.js +1 -1
- package/dist/base/date-pickers.js +2 -2
- package/dist/base/display.js +6 -6
- package/dist/base/feedback.js +4 -4
- package/dist/base/forms-numeric.js +1 -1
- package/dist/base/forms.js +2 -2
- package/dist/base/inline-edit.js +10 -10
- package/dist/base/item.js +1 -1
- package/dist/base/media-gallery.js +1 -1
- package/dist/base/metadata-list.js +1 -1
- package/dist/base/navigation.js +7 -7
- package/dist/base/popover-menu.js +1 -1
- package/dist/base/popover.js +1 -1
- package/dist/base/qr-code.js +1 -1
- package/dist/base/repeaters.js +200 -193
- package/dist/base/repeaters.js.map +1 -1
- package/dist/base/sheet.js +1 -1
- package/dist/base/sidebar.js +2 -2
- package/dist/base/signature-pad.js +8 -8
- package/dist/base/signature-pad.js.map +1 -1
- package/dist/base/skeleton.js +1 -1
- package/dist/base/spinner.js +6 -6
- package/dist/base/spinner.js.map +1 -1
- package/dist/base/structure.js +1 -1
- package/dist/base/table.js +1 -1
- package/dist/base/text-inputs.js +2 -2
- package/dist/base/toaster.js +36 -36
- package/dist/base/toaster.js.map +1 -1
- package/dist/base/tree.js +1 -1
- package/dist/base/upload-queue.js +1 -1
- package/dist/base/upload.js +3 -3
- package/dist/base/value-inputs.js +1 -1
- package/dist/{batch-action-bar-CdfIkCsV.js → batch-action-bar-BoqWIIpV.js} +7 -7
- package/dist/batch-action-bar-BoqWIIpV.js.map +1 -0
- package/dist/blocks/admin.js +21 -21
- package/dist/blocks/admin.js.map +1 -1
- package/dist/blocks/ai.js +267 -247
- package/dist/blocks/ai.js.map +1 -1
- package/dist/blocks/analytics/usage-card.js +1 -1
- package/dist/blocks/analytics.js +537 -543
- package/dist/blocks/analytics.js.map +1 -1
- package/dist/blocks/collaboration.js +1 -1
- package/dist/blocks/commerce/receipt.js +1 -1
- package/dist/blocks/commerce.js +1330 -1250
- package/dist/blocks/commerce.js.map +1 -1
- package/dist/blocks/data-display.js +2 -2
- package/dist/blocks/onboarding.js +6 -6
- package/dist/blocks/onboarding.js.map +1 -1
- package/dist/blocks/planning.js +11 -11
- package/dist/blocks/timelines.js +1 -1
- package/dist/{breadcrumbs-B-WFKecD.js → breadcrumbs-Bp9Ke7kd.js} +7 -7
- package/dist/breadcrumbs-Bp9Ke7kd.js.map +1 -0
- package/dist/{button-DkmK-z8E.js → button-ChBovTx0.js} +3 -3
- package/dist/button-ChBovTx0.js.map +1 -0
- package/dist/{buttons-BbfzgczK.js → buttons-DeW0bQeK.js} +16 -16
- package/dist/buttons-DeW0bQeK.js.map +1 -0
- package/dist/cards-CNXnmvV5.js +69 -0
- package/dist/cards-CNXnmvV5.js.map +1 -0
- package/dist/cascader-CrAl9zD5.js +439 -0
- package/dist/cascader-CrAl9zD5.js.map +1 -0
- package/dist/chart-I7ROnsl8.js +162 -0
- package/dist/chart-I7ROnsl8.js.map +1 -0
- package/dist/{checkbox-CzYUTPeJ.js → checkbox-MoyHIAPs.js} +3 -3
- package/dist/{checkbox-CzYUTPeJ.js.map → checkbox-MoyHIAPs.js.map} +1 -1
- package/dist/choice-inputs-DHGtx0QV.js +789 -0
- package/dist/choice-inputs-DHGtx0QV.js.map +1 -0
- package/dist/{code-block-CGNaUtAE.js → code-block-BSJyq9e-.js} +9 -9
- package/dist/code-block-BSJyq9e-.js.map +1 -0
- package/dist/{collapsible-Do4G0zcC.js → collapsible-BzJ91LUG.js} +5 -5
- package/dist/{collapsible-Do4G0zcC.js.map → collapsible-BzJ91LUG.js.map} +1 -1
- package/dist/{collection-content-C0e8SsTm.js → collection-content-CSnwtOTH.js} +3 -3
- package/dist/{collection-content-C0e8SsTm.js.map → collection-content-CSnwtOTH.js.map} +1 -1
- package/dist/combobox-Bcvu5J8O.js +363 -0
- package/dist/combobox-Bcvu5J8O.js.map +1 -0
- package/dist/combobox-C2JiSQPc.js +915 -0
- package/dist/combobox-C2JiSQPc.js.map +1 -0
- package/dist/{command-D8NrBj-b.js → command-9e52NPgK.js} +11 -11
- package/dist/command-9e52NPgK.js.map +1 -0
- package/dist/{comments-Di4w0H_S.js → comments-BsgErEqd.js} +44 -39
- package/dist/comments-BsgErEqd.js.map +1 -0
- package/dist/components/base/action-menu/action-menu.d.ts +7 -1
- package/dist/components/base/buttons/button-group.recipes.d.ts +2 -2
- package/dist/components/base/cards/card.recipes.d.ts +6 -4
- package/dist/components/base/cards/partials/card-primitives.d.ts +9 -2
- package/dist/components/base/cards/partials/smart-card-header-row.d.ts +3 -1
- package/dist/components/base/cards/smart-card.types.d.ts +3 -4
- package/dist/components/base/cascader/cascader-panel.d.ts +76 -0
- package/dist/components/base/chart/chart.d.ts +6 -1
- package/dist/components/base/choice-inputs/choice-types.d.ts +5 -1
- package/dist/components/base/choice-inputs/pill-radio-group.d.ts +7 -6
- package/dist/components/base/combobox/combobox-field.d.ts +2 -2
- package/dist/components/base/combobox/index.d.ts +4 -2
- package/dist/components/base/date-pickers/date-picker-internals.d.ts +3 -1
- package/dist/components/base/date-pickers/datepicker.types.d.ts +10 -4
- package/dist/components/base/date-pickers/time-picker.d.ts +17 -3
- package/dist/components/base/feedback/alert.d.ts +1 -1
- package/dist/components/base/feedback/state-display.d.ts +5 -1
- package/dist/components/base/feedback/state-display.strings.d.ts +9 -0
- package/dist/components/base/forms/form-field.d.ts +7 -2
- package/dist/components/base/forms/form-sizing.d.ts +7 -7
- package/dist/components/base/forms/workflow.d.ts +7 -1
- package/dist/components/base/forms-numeric/coordinates-input.d.ts +8 -1
- package/dist/components/base/forms-numeric/decimal-input.d.ts +2 -2
- package/dist/components/base/forms-numeric/dimensions-input.d.ts +4 -1
- package/dist/components/base/forms-numeric/numeric-composite-field.d.ts +12 -0
- package/dist/components/base/forms-numeric/weight-input.d.ts +6 -1
- package/dist/components/base/metadata-list/metadata-list.d.ts +1 -1
- package/dist/components/base/navigation/dropdown-menu.d.ts +1 -1
- package/dist/components/base/navigation/language-switcher.d.ts +12 -4
- package/dist/components/base/navigation/page-header/page-header-commands.d.ts +14 -7
- package/dist/components/base/navigation/page-header/page-header.d.ts +10 -3
- package/dist/components/base/popover/popover.d.ts +3 -3
- package/dist/components/base/popover/popover.recipes.d.ts +10 -6
- package/dist/components/base/repeaters/key-value-editor.d.ts +2 -1
- package/dist/components/base/sheet/sheet.d.ts +2 -0
- package/dist/components/base/sidebar/index.d.ts +1 -1
- package/dist/components/base/sidebar/sidebar.d.ts +29 -5
- package/dist/components/base/toaster/index.d.ts +1 -0
- package/dist/components/base/upload/avatar-upload.d.ts +2 -1
- package/dist/components/base/upload/image-upload.d.ts +2 -1
- package/dist/components/blocks/ai/ai-citation/types.d.ts +2 -0
- package/dist/components/blocks/ai/ai-file-tree/types.d.ts +1 -1
- package/dist/components/blocks/ai/ai-reasoning/types.d.ts +2 -0
- package/dist/components/blocks/ai/ai-sources/types.d.ts +2 -0
- package/dist/components/blocks/ai/ai-tool-call/types.d.ts +5 -1
- package/dist/components/blocks/ai/ai.strings.d.ts +2 -0
- package/dist/components/blocks/analytics/metric/metric.d.ts +4 -0
- package/dist/components/blocks/analytics/metric-comparison/metric-comparison.d.ts +4 -0
- package/dist/components/blocks/analytics/metric-grid/metric-grid.d.ts +4 -5
- package/dist/components/blocks/analytics/types.d.ts +2 -2
- package/dist/components/blocks/analytics/usage-card/usage-card.strings.d.ts +2 -0
- package/dist/components/blocks/commerce/cart-summary/cart-summary.d.ts +1 -1
- package/dist/components/blocks/commerce/cart-summary/types.d.ts +3 -1
- package/dist/components/blocks/commerce/discount-stack/discount-stack.d.ts +1 -1
- package/dist/components/blocks/commerce/discount-stack/types.d.ts +3 -1
- package/dist/components/blocks/commerce/fulfillment-group/fulfillment-group.d.ts +1 -1
- package/dist/components/blocks/commerce/fulfillment-group/types.d.ts +11 -2
- package/dist/components/blocks/commerce/index.d.ts +7 -6
- package/dist/components/blocks/commerce/inventory-section/inventory-section.d.ts +1 -1
- package/dist/components/blocks/commerce/inventory-section/types.d.ts +7 -2
- package/dist/components/blocks/commerce/invoice-header/index.d.ts +2 -1
- package/dist/components/blocks/commerce/invoice-header/invoice-header.d.ts +1 -1
- package/dist/components/blocks/commerce/invoice-header/types.d.ts +20 -6
- package/dist/components/blocks/commerce/invoice-line-items/invoice-line-items.d.ts +1 -1
- package/dist/components/blocks/commerce/invoice-line-items/types.d.ts +24 -7
- package/dist/components/blocks/commerce/invoice-mini/index.d.ts +2 -1
- package/dist/components/blocks/commerce/invoice-mini/types.d.ts +7 -1
- package/dist/components/blocks/commerce/order-customer/order-customer.d.ts +1 -1
- package/dist/components/blocks/commerce/order-customer/types.d.ts +9 -1
- package/dist/components/blocks/commerce/order-status/types.d.ts +4 -0
- package/dist/components/blocks/commerce/refund-status/refund-status.d.ts +1 -1
- package/dist/components/blocks/commerce/refund-status/types.d.ts +3 -1
- package/dist/components/blocks/commerce/shipment-tracking/shipment-tracking.d.ts +1 -1
- package/dist/components/blocks/commerce/shipment-tracking/types.d.ts +3 -1
- package/dist/components/blocks/commerce/tax-breakdown/tax-breakdown.d.ts +1 -1
- package/dist/components/blocks/commerce/tax-breakdown/types.d.ts +3 -1
- package/dist/components/blocks/data-display/empty-state/empty-state.types.d.ts +4 -3
- package/dist/components/features/activities/activities.types.d.ts +26 -13
- package/dist/components/features/activities/hooks/use-activity-resources.d.ts +2 -1
- package/dist/components/features/activities/partials/activity-marker.d.ts +7 -3
- package/dist/components/features/activities/partials/activity-row.d.ts +24 -0
- package/dist/components/features/ai-chat/hooks/use-ai-chat-scroll.d.ts +1 -1
- package/dist/components/features/appointment-calendar/appointment-calendar.d.ts +1 -1
- package/dist/components/features/appointment-calendar/appointment-calendar.types.d.ts +4 -2
- package/dist/components/features/combobox/async-resource-combobox.d.ts +2 -2
- package/dist/components/features/combobox/combobox.d.ts +2 -2
- package/dist/components/features/combobox/hooks/use-combobox-core.d.ts +2 -1
- package/dist/components/features/combobox/hooks/use-combobox-state.d.ts +1 -0
- package/dist/components/features/combobox/hooks/use-load-more.d.ts +1 -0
- package/dist/components/features/combobox/types.d.ts +37 -8
- package/dist/components/features/email-composer/types.d.ts +3 -1
- package/dist/components/features/event-calendar/colors.d.ts +2 -2
- package/dist/components/features/event-calendar/event-calendar.types.d.ts +4 -0
- package/dist/components/features/filters/facets/date-facet.d.ts +4 -2
- package/dist/components/features/filters/facets/range-facet.d.ts +12 -0
- package/dist/components/features/filters/facets/select-facet.d.ts +2 -1
- package/dist/components/features/filters/filters.strings.d.ts +4 -0
- package/dist/components/features/filters/filters.types.d.ts +6 -3
- package/dist/components/features/filters/partials/date-filter-content.d.ts +3 -2
- package/dist/components/features/filters/partials/filter-editor-header.d.ts +16 -0
- package/dist/components/features/filters/partials/filter-popover-content.d.ts +5 -3
- package/dist/components/features/filters/partials/nested-filter-options.d.ts +21 -0
- package/dist/components/features/filters/partials/range-filter-content.d.ts +12 -0
- package/dist/components/features/filters/partials/regular-filter-content.d.ts +2 -1
- package/dist/components/features/filters/utils/filter-utils.d.ts +25 -3
- package/dist/components/features/global-search/global-search.types.d.ts +2 -0
- package/dist/components/features/global-search/partials/global-search-input.d.ts +10 -0
- package/dist/components/features/global-search/partials/global-search-result-row.d.ts +7 -1
- package/dist/components/features/media-library/hooks/use-media-library.d.ts +1 -1
- package/dist/components/features/media-library/media-library.d.ts +1 -1
- package/dist/components/features/media-library/media-library.strings.d.ts +8 -0
- package/dist/components/features/media-library/media-library.types.d.ts +50 -12
- package/dist/components/features/media-library/partials/media-library-partials.d.ts +4 -4
- package/dist/components/features/mentions/hooks/use-mentions.d.ts +16 -1
- package/dist/components/features/mentions/partials/mention-inline-suggestions.d.ts +5 -1
- package/dist/components/features/mentions/utils/split-html-by-mentions.d.ts +1 -7
- package/dist/components/features/overlays/hooks/use-overlay-visibility.d.ts +2 -2
- package/dist/components/features/products/components/product-options-matrix.d.ts +1 -1
- package/dist/components/features/products/components/product-variant-editor.d.ts +1 -1
- package/dist/components/features/products/components/product-variants-manager.d.ts +1 -1
- package/dist/components/features/products/products.strings.d.ts +9 -1
- package/dist/components/features/products/products.types.d.ts +45 -8
- package/dist/components/features/questionnaire/questionnaire.types.d.ts +3 -0
- package/dist/components/features/resource/resource.d.ts +6 -2
- package/dist/components/features/resource/resource.types.d.ts +14 -1
- package/dist/components/features/rich-text-editor/form-rich-text-editor.d.ts +1 -1
- package/dist/components/features/rich-text-editor/partials/caret-helpers.d.ts +1 -1
- package/dist/components/features/rich-text-editor/partials/editor-field-aria.d.ts +14 -0
- package/dist/components/features/rich-text-editor/partials/image-uploads.d.ts +1 -1
- package/dist/components/features/rich-text-editor/partials/rich-text-editor-toolbar.d.ts +3 -1
- package/dist/components/features/rich-text-editor/rich-text-editor.recipes.d.ts +12 -2
- package/dist/components/features/rich-text-editor/rich-text-editor.types.d.ts +17 -3
- package/dist/components/features/schema-form/hooks/use-schema-form.d.ts +5 -1
- package/dist/components/features/schema-form/partials/schema-form-field.d.ts +3 -1
- package/dist/components/features/schema-form/schema-form.utils.d.ts +1 -1
- package/dist/components/features/suggestions/suggestions.types.d.ts +1 -1
- package/dist/components/features/table/data-table.d.ts +1 -1
- package/dist/components/features/table/index.d.ts +1 -0
- package/dist/components/features/table/partials/resource-cell.d.ts +22 -5
- package/dist/components/features/table/table-body.d.ts +1 -1
- package/dist/components/features/table/table-helpers.d.ts +6 -3
- package/dist/components/features/table/table.strings.d.ts +3 -0
- package/dist/components/features/table/table.types.d.ts +18 -2
- package/dist/components/layout/app-shell/app-shell.types.d.ts +35 -6
- package/dist/components/layout/app-shell/index.d.ts +1 -1
- package/dist/components/layout/app-shell/shell-regions.d.ts +27 -0
- package/dist/components/layout/app-shell/sidebar-inset-layout.d.ts +1 -1
- package/dist/components/layout/app-shell/stacked-layout.d.ts +1 -1
- package/dist/components/layout/app-shell/topbar-sidebar-layout.d.ts +1 -1
- package/dist/components/layout/containers/two-column-layout.d.ts +2 -0
- package/dist/components/layout/header/header.recipes.d.ts +6 -0
- package/dist/components/layout/header/header.types.d.ts +9 -8
- package/dist/components/layout/layout.types.d.ts +5 -3
- package/dist/components/layout/navigation/section-nav/section-nav.d.ts +5 -0
- package/dist/components/layout/navigation/side-nav.d.ts +3 -2
- package/dist/components/layout/normalize-layout-path.d.ts +1 -0
- package/dist/components/layout/page/index.d.ts +2 -1
- package/dist/components/layout/page/page.d.ts +1 -0
- package/dist/components/layout/page/page.strings.d.ts +11 -0
- package/dist/components/layout/page/page.types.d.ts +69 -17
- package/dist/components/layout/page/partials/page-header.d.ts +1 -1
- package/dist/components/layout/settings/settings.d.ts +10 -3
- package/dist/components/layout/sidebar/app-sidebar.d.ts +1 -1
- package/dist/components/layout/sidebar/components/sidebar-grouped-navigation.d.ts +1 -1
- package/dist/components/layout/sidebar/components/sidebar-navigation.d.ts +1 -1
- package/dist/components/layout/sidebar/index.d.ts +2 -1
- package/dist/components/layout/sidebar/sidebar-navigation-rail.d.ts +38 -0
- package/dist/components/layout/sidebar/sidebar.context.d.ts +6 -7
- package/dist/components/layout/sidebar/sidebar.types.d.ts +50 -10
- package/dist/components/layout/sidebar/sidebar.utils.d.ts +9 -1
- package/dist/components/layout/workspace/workspace.types.d.ts +8 -1
- package/dist/components/primitives/link.d.ts +3 -2
- package/dist/components/primitives/money.d.ts +1 -1
- package/dist/components/primitives/number.d.ts +1 -1
- package/dist/components/typography/rich-text/rich-text-tree.d.ts +7 -5
- package/dist/components/ui/alert-dialog.d.ts +2 -2
- package/dist/components/ui/combobox.d.ts +1 -1
- package/dist/components/ui/dialog.d.ts +2 -2
- package/dist/components/ui/overlay-layer.d.ts +18 -0
- package/dist/components/ui/sheet.d.ts +5 -1
- package/dist/components/ui/sidebar-state.d.ts +82 -0
- package/dist/components/ui/sidebar.d.ts +5 -17
- package/dist/{containers-CRmHf7GP.js → containers-CSdc32h9.js} +26 -18
- package/dist/containers-CSdc32h9.js.map +1 -0
- package/dist/{control-group-recipes-DBXmfh2E.js → control-group-recipes-fMuFo0H7.js} +6 -6
- package/dist/control-group-recipes-fMuFo0H7.js.map +1 -0
- package/dist/{copyable-CnGCZdX4.js → copyable-3fdHfMR3.js} +7 -7
- package/dist/{copyable-CnGCZdX4.js.map → copyable-3fdHfMR3.js.map} +1 -1
- package/dist/{data-display-D4oujtx0.js → data-display-Cmj-xZYl.js} +271 -279
- package/dist/data-display-Cmj-xZYl.js.map +1 -0
- package/dist/{date-Q7jnXxpk.js → date-Br0FicVv.js} +5 -5
- package/dist/{date-Q7jnXxpk.js.map → date-Br0FicVv.js.map} +1 -1
- package/dist/date-picker-CyQlFYsP.js +1617 -0
- package/dist/date-picker-CyQlFYsP.js.map +1 -0
- package/dist/date-pickers-tj2MXmXd.js +185 -0
- package/dist/date-pickers-tj2MXmXd.js.map +1 -0
- package/dist/{display-BB4BL_-K.js → display-CT_N2a3w.js} +9 -9
- package/dist/{display-BB4BL_-K.js.map → display-CT_N2a3w.js.map} +1 -1
- package/dist/dropdown-menu-C08iIugv.js +194 -0
- package/dist/dropdown-menu-C08iIugv.js.map +1 -0
- package/dist/features/activities.js +388 -326
- package/dist/features/activities.js.map +1 -1
- package/dist/features/ai-chat.js +46 -32
- package/dist/features/ai-chat.js.map +1 -1
- package/dist/features/appointment-calendar.js +130 -130
- package/dist/features/appointment-calendar.js.map +1 -1
- package/dist/features/async-preview.js +11 -10
- package/dist/features/async-preview.js.map +1 -1
- package/dist/features/combobox.js +1 -1
- package/dist/features/comments.js +1 -1
- package/dist/features/data-view.js +13 -13
- package/dist/features/data-view.js.map +1 -1
- package/dist/features/email-composer.js +243 -239
- package/dist/features/email-composer.js.map +1 -1
- package/dist/features/event-calendar.js +197 -199
- package/dist/features/event-calendar.js.map +1 -1
- package/dist/features/filters.js +2 -2
- package/dist/features/global-search.js +168 -143
- package/dist/features/global-search.js.map +1 -1
- package/dist/features/kanban.js +19 -30
- package/dist/features/kanban.js.map +1 -1
- package/dist/features/map/style.css +15 -0
- package/dist/features/map.js +369 -343
- package/dist/features/map.js.map +1 -1
- package/dist/features/media-library.js +1202 -975
- package/dist/features/media-library.js.map +1 -1
- package/dist/features/mentions.js +2 -2
- package/dist/features/overlays.js +1 -1
- package/dist/features/products.js +1270 -1183
- package/dist/features/products.js.map +1 -1
- package/dist/features/questionnaire.js +160 -153
- package/dist/features/questionnaire.js.map +1 -1
- package/dist/features/resource-assignment.js +8 -8
- package/dist/features/resource.js +119 -113
- package/dist/features/resource.js.map +1 -1
- package/dist/features/rich-text-editor.js +28 -19
- package/dist/features/rich-text-editor.js.map +1 -1
- package/dist/features/schema-form.js +297 -256
- package/dist/features/schema-form.js.map +1 -1
- package/dist/features/suggestions.js +57 -50
- package/dist/features/suggestions.js.map +1 -1
- package/dist/features/sync.js +3 -3
- package/dist/features/table.js +1 -1
- package/dist/features/theme-tweaker.js +470 -470
- package/dist/features/theme-tweaker.js.map +1 -1
- package/dist/feedback-Dzo1xtAU.js +246 -0
- package/dist/feedback-Dzo1xtAU.js.map +1 -0
- package/dist/{field-affordance-recipes-DjwGx8eM.js → field-affordance-recipes-D6H7tVJi.js} +5 -5
- package/dist/field-affordance-recipes-D6H7tVJi.js.map +1 -0
- package/dist/field-control-attributes-B6i335wr.js +18 -0
- package/dist/field-control-attributes-B6i335wr.js.map +1 -0
- package/dist/{field-state-recipes-BVA2CWHo.js → field-state-recipes-7sza8QbC.js} +4 -2
- package/dist/{field-state-recipes-BVA2CWHo.js.map → field-state-recipes-7sza8QbC.js.map} +1 -1
- package/dist/filters-Dl80yYtN.js +2415 -0
- package/dist/filters-Dl80yYtN.js.map +1 -0
- package/dist/form-field-CAPdwdnZ.js +74 -0
- package/dist/form-field-CAPdwdnZ.js.map +1 -0
- package/dist/{form-sizing-NXgjkmBG.js → form-sizing-CgcrUbLU.js} +5 -5
- package/dist/form-sizing-CgcrUbLU.js.map +1 -0
- package/dist/{forms-BV5m5aQF.js → forms-B3W8CH7-.js} +17 -13
- package/dist/forms-B3W8CH7-.js.map +1 -0
- package/dist/forms-numeric-CwjQJe-O.js +991 -0
- package/dist/forms-numeric-CwjQJe-O.js.map +1 -0
- package/dist/{header-BA697l4a.js → header-ZIIsRKxP.js} +145 -141
- package/dist/header-ZIIsRKxP.js.map +1 -0
- package/dist/header.recipes-BigdJjw1.js +6 -0
- package/dist/header.recipes-BigdJjw1.js.map +1 -0
- package/dist/hooks/use-files.d.ts +2 -0
- package/dist/{hooks-BQ-L7Uu2.js → hooks-BitHSh-Y.js} +27 -15
- package/dist/hooks-BitHSh-Y.js.map +1 -0
- package/dist/{icon-badge-COWbCCWu.js → icon-badge-npxF1SLX.js} +4 -4
- package/dist/{icon-badge-COWbCCWu.js.map → icon-badge-npxF1SLX.js.map} +1 -1
- package/dist/index.js +4 -5
- package/dist/{input-Cdw4k0fb.js → input-7KAc7XQL.js} +9 -9
- package/dist/{input-Cdw4k0fb.js.map → input-7KAc7XQL.js.map} +1 -1
- package/dist/input-DIREVYHs.js +21 -0
- package/dist/input-DIREVYHs.js.map +1 -0
- package/dist/{interaction-recipes-XR9ZpVYL.js → interaction-recipes-4wZ2tvfb.js} +2 -2
- package/dist/{interaction-recipes-XR9ZpVYL.js.map → interaction-recipes-4wZ2tvfb.js.map} +1 -1
- package/dist/item-FfWnaYST.js +278 -0
- package/dist/item-FfWnaYST.js.map +1 -0
- package/dist/layout/app-shell.js +1 -1
- package/dist/layout/auth.js +1 -1
- package/dist/layout/containers.js +1 -1
- package/dist/layout/header.js +1 -1
- package/dist/layout/hooks.js +1 -1
- package/dist/layout/navigation.js +1 -1
- package/dist/layout/page.js +2 -2
- package/dist/layout/settings.js +1 -1
- package/dist/layout/sidebar.js +3 -3
- package/dist/layout/workspace.js +1 -1
- package/dist/layout.js +12 -12
- package/dist/layout.types-E_GAApzO.js +30 -0
- package/dist/layout.types-E_GAApzO.js.map +1 -0
- package/dist/lib/affordance-geometry.generated.d.ts +35 -35
- package/dist/lib/control-group-recipes.d.ts +5 -5
- package/dist/lib/field-affordance-recipes.d.ts +2 -2
- package/dist/lib/field-control-attributes.d.ts +11 -0
- package/dist/lib/field-state-recipes.d.ts +2 -0
- package/dist/lib/format.d.ts +1 -0
- package/dist/lib/motion-recipes.d.ts +3 -0
- package/dist/lib/navigation-row-recipes.d.ts +7 -7
- package/dist/lib/overlay-anatomy-recipes.d.ts +3 -3
- package/dist/lib/portal-recipes.d.ts +3 -0
- package/dist/lib/surface-recipes.d.ts +1 -1
- package/dist/lib/token-merge.generated.d.ts +18 -15
- package/dist/lib/utils.js +1 -1
- package/dist/map-demo-tile.svg +1 -1
- package/dist/{media-gallery-CSl5W1Fy.js → media-gallery-C81DAnKI.js} +6 -6
- package/dist/{media-gallery-CSl5W1Fy.js.map → media-gallery-C81DAnKI.js.map} +1 -1
- package/dist/{mentions-RKOQaaIB.js → mentions-qOnedSt4.js} +237 -168
- package/dist/mentions-qOnedSt4.js.map +1 -0
- package/dist/message-BJHnn43M.js +135 -0
- package/dist/message-BJHnn43M.js.map +1 -0
- package/dist/{metadata-list-qVV7AVxa.js → metadata-list-XkqZ_UXH.js} +64 -64
- package/dist/metadata-list-XkqZ_UXH.js.map +1 -0
- package/dist/{motion-recipes-ChBg4HBq.js → motion-recipes-DitYv6P2.js} +10 -2
- package/dist/motion-recipes-DitYv6P2.js.map +1 -0
- package/dist/navigation-BgtPJAhi.js +288 -0
- package/dist/navigation-BgtPJAhi.js.map +1 -0
- package/dist/navigation-Bt-v7rWP.js +261 -0
- package/dist/navigation-Bt-v7rWP.js.map +1 -0
- package/dist/{navigation-row-recipes-WZEs-hYo.js → navigation-row-recipes-BGVLvU_O.js} +9 -9
- package/dist/navigation-row-recipes-BGVLvU_O.js.map +1 -0
- package/dist/normalize-layout-path-BmEgg6fu.js +14 -0
- package/dist/normalize-layout-path-BmEgg6fu.js.map +1 -0
- package/dist/{number-E_OiIfJz.js → number-CYqBcrSj.js} +79 -87
- package/dist/number-CYqBcrSj.js.map +1 -0
- package/dist/overflow-tab-bar-BQCA2Zn2.js +172 -0
- package/dist/overflow-tab-bar-BQCA2Zn2.js.map +1 -0
- package/dist/overlays-CC8zI3Du.js +1017 -0
- package/dist/overlays-CC8zI3Du.js.map +1 -0
- package/dist/page-BoQ1VaFJ.js +331 -0
- package/dist/page-BoQ1VaFJ.js.map +1 -0
- package/dist/page-header-commands-DIKspJfx.js +193 -0
- package/dist/page-header-commands-DIKspJfx.js.map +1 -0
- package/dist/{pagination-Ch8X_47u.js → pagination-Br8TdV9A.js} +7 -7
- package/dist/{pagination-Ch8X_47u.js.map → pagination-Br8TdV9A.js.map} +1 -1
- package/dist/popover-k8TdUcAt.js +201 -0
- package/dist/popover-k8TdUcAt.js.map +1 -0
- package/dist/{popover-menu-BYaCdFhf.js → popover-menu-yn-o0kyA.js} +7 -7
- package/dist/{popover-menu-BYaCdFhf.js.map → popover-menu-yn-o0kyA.js.map} +1 -1
- package/dist/{popover.recipes-D3j8R8Yp.js → popover.recipes-DJ0AkUan.js} +19 -12
- package/dist/popover.recipes-DJ0AkUan.js.map +1 -0
- package/dist/portal-recipes-DyUXqUtD.js +9 -0
- package/dist/portal-recipes-DyUXqUtD.js.map +1 -0
- package/dist/{primitives-Du64iDbb.js → primitives-BkkQjYl7.js} +23 -18
- package/dist/primitives-BkkQjYl7.js.map +1 -0
- package/dist/primitives.js +4 -4
- package/dist/{progress-BvF2oCdV.js → progress-DZFXXzPs.js} +9 -9
- package/dist/{progress-BvF2oCdV.js.map → progress-DZFXXzPs.js.map} +1 -1
- package/dist/{receipt-D789Jwyy.js → receipt-C7LhOg7Q.js} +7 -7
- package/dist/receipt-C7LhOg7Q.js.map +1 -0
- package/dist/rich-text-BnTzZjIo.js +45 -0
- package/dist/rich-text-BnTzZjIo.js.map +1 -0
- package/dist/{rich-text-editor-Cm1dpUpQ.js → rich-text-editor-CAurDwT5.js} +501 -424
- package/dist/rich-text-editor-CAurDwT5.js.map +1 -0
- package/dist/rich-text-editor-toolbar-DbXig7Jk.js +99 -0
- package/dist/rich-text-editor-toolbar-DbXig7Jk.js.map +1 -0
- package/dist/rich-text-tree-BqyQ_7-R.js +66 -0
- package/dist/rich-text-tree-BqyQ_7-R.js.map +1 -0
- package/dist/{sanitize-html-DsQmI48u.js → sanitize-html-BWkH4dLM.js} +29 -16
- package/dist/sanitize-html-BWkH4dLM.js.map +1 -0
- package/dist/{scroll-area-La5RXsEk.js → scroll-area-Bj6CRUif.js} +2 -2
- package/dist/{scroll-area-La5RXsEk.js.map → scroll-area-Bj6CRUif.js.map} +1 -1
- package/dist/{separator-DAEV0w65.js → separator-B9ewiCGO.js} +2 -2
- package/dist/{separator-DAEV0w65.js.map → separator-B9ewiCGO.js.map} +1 -1
- package/dist/{separator-GNfPG-90.js → separator-DM6gs2vu.js} +3 -3
- package/dist/{separator-GNfPG-90.js.map → separator-DM6gs2vu.js.map} +1 -1
- package/dist/services/actions.js +1 -1
- package/dist/settings-DZPHgpx4.js +155 -0
- package/dist/settings-DZPHgpx4.js.map +1 -0
- package/dist/sheet-C4DHsgLk.js +250 -0
- package/dist/sheet-C4DHsgLk.js.map +1 -0
- package/dist/sidebar-C8BnDwTH.js +709 -0
- package/dist/sidebar-C8BnDwTH.js.map +1 -0
- package/dist/sidebar-CmD6a-HK.js +1004 -0
- package/dist/sidebar-CmD6a-HK.js.map +1 -0
- package/dist/skeleton-DDgdhmu9.js +265 -0
- package/dist/skeleton-DDgdhmu9.js.map +1 -0
- package/dist/smart-card-B6vLxqa_.js +617 -0
- package/dist/smart-card-B6vLxqa_.js.map +1 -0
- package/dist/{structure-C0V0_Fyf.js → structure-DZJ2wbAU.js} +2 -2
- package/dist/{structure-C0V0_Fyf.js.map → structure-DZJ2wbAU.js.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/{surface-recipes-BKRVW8Os.js → surface-recipes-C8mNycaY.js} +2 -2
- package/dist/{surface-recipes-BKRVW8Os.js.map → surface-recipes-C8mNycaY.js.map} +1 -1
- package/dist/{table-DH7rozUv.js → table-CBonSdTp.js} +573 -519
- package/dist/table-CBonSdTp.js.map +1 -0
- package/dist/{table-CpvnzJn9.js → table-CXSPHH25.js} +75 -71
- package/dist/table-CXSPHH25.js.map +1 -0
- package/dist/tabs-C4Kr_hCr.js +192 -0
- package/dist/tabs-C4Kr_hCr.js.map +1 -0
- package/dist/{text-inputs-DXItiR0O.js → text-inputs-jdkS3ReG.js} +18 -18
- package/dist/text-inputs-jdkS3ReG.js.map +1 -0
- package/dist/theme.css +40 -37
- package/dist/{timelines-DmtztAY_.js → timelines-CoPwdJP0.js} +13 -12
- package/dist/timelines-CoPwdJP0.js.map +1 -0
- package/dist/tooltip-31NwIpTo.js +113 -0
- package/dist/tooltip-31NwIpTo.js.map +1 -0
- package/dist/{tree-CV11PURP.js → tree-CeYVzdFE.js} +9 -9
- package/dist/{tree-CV11PURP.js.map → tree-CeYVzdFE.js.map} +1 -1
- package/dist/typography/rich-text.js +1 -1
- package/dist/{typography-CSyJrh28.js → typography-C7-YMW1S.js} +12 -12
- package/dist/{typography-CSyJrh28.js.map → typography-C7-YMW1S.js.map} +1 -1
- package/dist/typography.js +1 -1
- package/dist/ui-provider-C-74NVLc.js +178 -0
- package/dist/ui-provider-C-74NVLc.js.map +1 -0
- package/dist/ui-provider.js +2 -3
- package/dist/{upload-C9SA0X-8.js → upload-Hdm5gObf.js} +309 -296
- package/dist/upload-Hdm5gObf.js.map +1 -0
- package/dist/{upload-queue-DhQJiSRc.js → upload-queue-D0sYPuqo.js} +16 -14
- package/dist/upload-queue-D0sYPuqo.js.map +1 -0
- package/dist/{usage-card-DVTRDmGz.js → usage-card-9s8hLDfn.js} +24 -17
- package/dist/usage-card-9s8hLDfn.js.map +1 -0
- package/dist/{utils-CF3c95Io.js → utils-DhuoqFy4.js} +255 -165
- package/dist/utils-DhuoqFy4.js.map +1 -0
- package/dist/value-inputs-D3aPgq9H.js +980 -0
- package/dist/value-inputs-D3aPgq9H.js.map +1 -0
- package/dist/{value-typography-ClupF0Gz.js → value-typography-uSzzG9Gf.js} +32 -26
- package/dist/value-typography-uSzzG9Gf.js.map +1 -0
- package/dist/{workspace-9EFVXUyk.js → workspace-CC8Vchiu.js} +51 -50
- package/dist/workspace-CC8Vchiu.js.map +1 -0
- package/docs/consumer-skill/SKILL.md +4 -3
- package/docs/consumer-skill/agents/themelia-ui-designer.md +96 -0
- package/docs/consumer-skill/examples/app-layout.tsx +52 -1
- package/docs/consumer-skill/examples/commerce-lines.tsx +271 -0
- package/docs/consumer-skill/examples/custom-composition.tsx +21 -0
- package/docs/consumer-skill/examples/detail.tsx +5 -4
- package/docs/consumer-skill/examples/edit.tsx +3 -3
- package/docs/consumer-skill/examples/editable-sections.tsx +38 -0
- package/docs/consumer-skill/examples/index-table.tsx +4 -4
- package/docs/consumer-skill/examples/manifest.json +38 -1
- package/docs/consumer-skill/examples/product-media.tsx +41 -0
- package/docs/consumer-skill/examples/product-parts.tsx +81 -0
- package/docs/consumer-skill/examples/rhf-edit-page.tsx +1 -1
- package/docs/consumer-skill/examples/rhf-overlay-form.tsx +24 -11
- package/docs/consumer-skill/examples/token-domain-structure.tsx +68 -0
- package/docs/consumer-skill/references/agents-md.md +21 -19
- package/docs/consumer-skill/references/analytics.md +33 -1
- package/docs/consumer-skill/references/commerce-composition.md +97 -0
- package/docs/consumer-skill/references/component-contracts.json +21249 -14205
- package/docs/consumer-skill/references/composition-mapping.md +17 -3
- package/docs/consumer-skill/references/composition.md +177 -32
- package/docs/consumer-skill/references/critique-rubric.md +98 -0
- package/docs/consumer-skill/references/custom-composition.md +261 -0
- package/docs/consumer-skill/references/data-reading.md +79 -0
- package/docs/consumer-skill/references/design-contract.md +12 -9
- package/docs/consumer-skill/references/discovery.md +27 -3
- package/docs/consumer-skill/references/domain-structures.md +124 -0
- package/docs/consumer-skill/references/installation.md +62 -8
- package/docs/consumer-skill/references/integration.md +59 -1
- package/docs/consumer-skill/references/product-composition.md +94 -0
- package/docs/consumer-skill/references/public-api.json +3044 -445
- package/docs/consumer-skill/references/review.md +87 -10
- package/docs/consumer-skill/references/rhf-workflows.md +79 -0
- package/docs/consumer-skill/references/screen-archetypes.md +19 -7
- package/docs/consumer-skill/references/screen-decisions.md +126 -0
- package/docs/consumer-skill/references/theming.md +24 -20
- package/docs/consumer-skill/references/tokens.json +9 -9
- package/docs/consumer-skill/references/view-craft.md +153 -0
- package/docs/consumer-skill/references/view-spec.md +73 -0
- package/docs/consumer-skill/references/workflows.md +7 -1
- package/docs/consumer-skill/scripts/composition-policy.mjs +176 -26
- package/docs/consumer-skill/scripts/composition-schema.mjs +1 -1
- package/docs/consumer-skill/scripts/composition.mjs +61 -5
- package/docs/consumer-skill/scripts/discovery.mjs +54 -0
- package/docs/consumer-skill/scripts/inspect-component.mjs +1 -1
- package/docs/consumer-skill/scripts/inspection.mjs +73 -18
- package/docs/consumer-skill/scripts/setup-skills.mjs +79 -7
- package/docs/consumer-skill/scripts/surface-policy.mjs +5 -5
- package/docs/consumer-skills/themelia-components/SKILL.md +14 -13
- package/docs/consumer-skills/themelia-composition/SKILL.md +16 -17
- package/docs/consumer-skills/themelia-design/SKILL.md +55 -0
- package/docs/consumer-skills/themelia-foundation/SKILL.md +2 -1
- package/docs/consumer-skills/themelia-tokenization/SKILL.md +24 -17
- package/package.json +4 -2
- package/templates/admin-shell-template.tsx +1 -2
- package/templates/customers-template.tsx +18 -16
- package/dist/accordion-96o0pN62.js.map +0 -1
- package/dist/action-menu-CHgs8vmj.js.map +0 -1
- package/dist/affordance-geometry.generated-B8yGOr8-.js.map +0 -1
- package/dist/ai-artifact-BZUGwBq6.js.map +0 -1
- package/dist/app-shell-D63ATkIK.js +0 -237
- package/dist/app-shell-D63ATkIK.js.map +0 -1
- package/dist/auth-D2FVZ1MH.js.map +0 -1
- package/dist/avatar-DWO_HHhB.js.map +0 -1
- package/dist/base/cascader.js.map +0 -1
- package/dist/batch-action-bar-CdfIkCsV.js.map +0 -1
- package/dist/breadcrumbs-B-WFKecD.js.map +0 -1
- package/dist/button-DkmK-z8E.js.map +0 -1
- package/dist/buttons-BbfzgczK.js.map +0 -1
- package/dist/cards-4JTWqvVe.js +0 -68
- package/dist/cards-4JTWqvVe.js.map +0 -1
- package/dist/chart-C19flDQb.js +0 -155
- package/dist/chart-C19flDQb.js.map +0 -1
- package/dist/choice-inputs-JLtij2y4.js +0 -776
- package/dist/choice-inputs-JLtij2y4.js.map +0 -1
- package/dist/code-block-CGNaUtAE.js.map +0 -1
- package/dist/combobox-CBJDs6w_.js +0 -877
- package/dist/combobox-CBJDs6w_.js.map +0 -1
- package/dist/combobox-hbhSS18O.js +0 -355
- package/dist/combobox-hbhSS18O.js.map +0 -1
- package/dist/command-D8NrBj-b.js.map +0 -1
- package/dist/comments-Di4w0H_S.js.map +0 -1
- package/dist/containers-CRmHf7GP.js.map +0 -1
- package/dist/control-group-recipes-DBXmfh2E.js.map +0 -1
- package/dist/data-display-D4oujtx0.js.map +0 -1
- package/dist/date-picker-zOt1oNss.js +0 -1542
- package/dist/date-picker-zOt1oNss.js.map +0 -1
- package/dist/date-pickers-cj8IXbDC.js +0 -179
- package/dist/date-pickers-cj8IXbDC.js.map +0 -1
- package/dist/dropdown-menu-CjY8Vt7W.js +0 -193
- package/dist/dropdown-menu-CjY8Vt7W.js.map +0 -1
- package/dist/feedback-DZNL5Lg1.js +0 -239
- package/dist/feedback-DZNL5Lg1.js.map +0 -1
- package/dist/field-affordance-recipes-DjwGx8eM.js.map +0 -1
- package/dist/filters-BcT-uoFy.js +0 -2209
- package/dist/filters-BcT-uoFy.js.map +0 -1
- package/dist/form-field-CsgRmdit.js +0 -63
- package/dist/form-field-CsgRmdit.js.map +0 -1
- package/dist/form-sizing-NXgjkmBG.js.map +0 -1
- package/dist/forms-BV5m5aQF.js.map +0 -1
- package/dist/forms-numeric-Cd33AKbD.js +0 -906
- package/dist/forms-numeric-Cd33AKbD.js.map +0 -1
- package/dist/header-BA697l4a.js.map +0 -1
- package/dist/hooks-BQ-L7Uu2.js.map +0 -1
- package/dist/input-DOPL5_QE.js +0 -21
- package/dist/input-DOPL5_QE.js.map +0 -1
- package/dist/item-BvZ2DR_x.js +0 -277
- package/dist/item-BvZ2DR_x.js.map +0 -1
- package/dist/layout.types-Cn7aUzJp.js +0 -20
- package/dist/layout.types-Cn7aUzJp.js.map +0 -1
- package/dist/mentions-RKOQaaIB.js.map +0 -1
- package/dist/message-INU2xsxu.js +0 -128
- package/dist/message-INU2xsxu.js.map +0 -1
- package/dist/metadata-list-qVV7AVxa.js.map +0 -1
- package/dist/motion-recipes-ChBg4HBq.js.map +0 -1
- package/dist/navigation-BQNcg1jT.js +0 -269
- package/dist/navigation-BQNcg1jT.js.map +0 -1
- package/dist/navigation-DLF3E1IC.js +0 -145
- package/dist/navigation-DLF3E1IC.js.map +0 -1
- package/dist/navigation-row-recipes-WZEs-hYo.js.map +0 -1
- package/dist/number-E_OiIfJz.js.map +0 -1
- package/dist/overflow-tab-bar-CrbqMteP.js +0 -284
- package/dist/overflow-tab-bar-CrbqMteP.js.map +0 -1
- package/dist/overlays-BlKynmde.js +0 -1004
- package/dist/overlays-BlKynmde.js.map +0 -1
- package/dist/page-CIwNUtGr.js +0 -227
- package/dist/page-CIwNUtGr.js.map +0 -1
- package/dist/page-header-commands-DFMlNYzN.js +0 -128
- package/dist/page-header-commands-DFMlNYzN.js.map +0 -1
- package/dist/popover-uwzX2vo7.js +0 -198
- package/dist/popover-uwzX2vo7.js.map +0 -1
- package/dist/popover.recipes-D3j8R8Yp.js.map +0 -1
- package/dist/primitives-Du64iDbb.js.map +0 -1
- package/dist/receipt-D789Jwyy.js.map +0 -1
- package/dist/rich-text-CLJEf76s.js +0 -78
- package/dist/rich-text-CLJEf76s.js.map +0 -1
- package/dist/rich-text-editor-Cm1dpUpQ.js.map +0 -1
- package/dist/rich-text-editor-toolbar-L__e4x47.js +0 -94
- package/dist/rich-text-editor-toolbar-L__e4x47.js.map +0 -1
- package/dist/safe-image-src-C6kQSMBZ.js +0 -17
- package/dist/safe-image-src-C6kQSMBZ.js.map +0 -1
- package/dist/sanitize-html-DsQmI48u.js.map +0 -1
- package/dist/settings-BA2iboic.js +0 -174
- package/dist/settings-BA2iboic.js.map +0 -1
- package/dist/sheet-DoAxTb2J.js +0 -213
- package/dist/sheet-DoAxTb2J.js.map +0 -1
- package/dist/sidebar-ByqKR_W5.js +0 -512
- package/dist/sidebar-ByqKR_W5.js.map +0 -1
- package/dist/sidebar-D2iSnGJ7.js +0 -619
- package/dist/sidebar-D2iSnGJ7.js.map +0 -1
- package/dist/skeleton-CUj8O5Bd.js +0 -264
- package/dist/skeleton-CUj8O5Bd.js.map +0 -1
- package/dist/smart-card-CqkzQsK-.js +0 -614
- package/dist/smart-card-CqkzQsK-.js.map +0 -1
- package/dist/table-CpvnzJn9.js.map +0 -1
- package/dist/table-DH7rozUv.js.map +0 -1
- package/dist/tabs-eqVsJZWO.js +0 -191
- package/dist/tabs-eqVsJZWO.js.map +0 -1
- package/dist/text-inputs-DXItiR0O.js.map +0 -1
- package/dist/theme-scope-BJ6eE2xt.js +0 -50
- package/dist/theme-scope-BJ6eE2xt.js.map +0 -1
- package/dist/timelines-DmtztAY_.js.map +0 -1
- package/dist/tooltip-B4hjKtoV.js +0 -111
- package/dist/tooltip-B4hjKtoV.js.map +0 -1
- package/dist/ui-provider-CQCuCBcy.js +0 -136
- package/dist/ui-provider-CQCuCBcy.js.map +0 -1
- package/dist/upload-C9SA0X-8.js.map +0 -1
- package/dist/upload-queue-DhQJiSRc.js.map +0 -1
- package/dist/usage-card-DVTRDmGz.js.map +0 -1
- package/dist/use-mobile-vaLKwgyf.js +0 -15
- package/dist/use-mobile-vaLKwgyf.js.map +0 -1
- package/dist/utils-CF3c95Io.js.map +0 -1
- package/dist/value-inputs-C0o70p-U.js +0 -980
- package/dist/value-inputs-C0o70p-U.js.map +0 -1
- package/dist/value-typography-ClupF0Gz.js.map +0 -1
- package/dist/workspace-9EFVXUyk.js.map +0 -1
package/dist/features/map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.js","names":["React","Map","_Fragment","ButtonGroup","Text","popoverRecipes","DropdownMenuSeparator","DropdownMenuTrigger","DropdownMenuGroup","DropdownMenuCheckboxItem","DropdownMenuLabel","DropdownMenuContent","DropdownMenu","DropdownMenuRadioItem","layerRecipes","CommandItem","CommandEmpty","CommandList","CommandGroup","Command","PopoverTrigger","Popover","PopoverContent","InputGroup","InputGroupInput","InputGroupAddon","useDebounce","React$1","Fragment$1","defaultPlaceAutocompleteStrings","formatAddress","parts","properties","buildSearchUrl","url","query","lang","limit","bbox","lat","lon","zoom","locationBiasScale","searchPhoton","response","options","usePlaceSearch","results","setResults","isLoading","setIsLoading","error","setError","hasSearched","setHasSearched","retryAttempt","setRetryAttempt","onSearchErrorRef","onSearchError","debouncedQuery","debounceMs","bboxKey","current","abortController","fetchResults","features","searchPlaces","signal","addressOsmIds","id","feature","err","failure","attempt","formatPlaceAutocompleteString","template","params","key","match","PlaceAutocomplete","controlledValue","controlledOnValueChange","stringsProp","inputOnFocus","props","strings","useStrings","internalValue","setInternalValue","defaultValue","searchQuery","setSearchQuery","isListDismissed","setIsListDismissed","activeIndex","setActiveIndex","listId","anchorRef","popoverActionsRef","optionNodes","isControlled","displayValue","onResultsChangeRef","onResultsChange","hasNoResults","hasCommandList","showCommandList","selectPlace","address","onPlaceSelect","cn","className","event","flushSync","next","open","details","SearchIcon","index","newValue","Loader2Icon","Button","retry","formattedAddress","node","MapPinIcon","useMapColorScheme","read","useCallback","container","subscribe","observer","notify","useSyncExternalStore","ReactLeafletHooksContext","createContext","defaultMapStrings","MapStringsContext","useMapStrings","useContext","ReactLeafletRuntimeContext","ReactLeafletRuntime","lazy","mod","createRuntimeComponent","runtime","Component","select","LeafletMapContainer","LeafletTileLayer","LeafletMarker","LeafletPopup","LeafletTooltip","LeafletCircle","LeafletCircleMarker","LeafletPolyline","LeafletPolygon","LeafletRectangle","LeafletLayerGroup","LeafletFeatureGroup","createLazyComponent","factory","Suspense","LeafletMarkerClusterGroup","ReactLeafletHooksProvider","useLeafletMap","hooks","useLeafletMapEvents","handlers","assignRef","ref","value","Map$1","focusCleanup","useRef","handleMapRef","map","focusWithoutScroll","isMounted","setIsMounted","useState","useEffect","MapLayersContext","useMapLayersContext","MapTileLayer","nameProp","name","context","resolvedTheme","resolvedUrl","darkUrl","resolvedAttribution","darkAttribution","attribution","MapLayerGroup","disabled","MapFeatureGroup","MapLayers","tileLayers","setTileLayers","selectedTileLayer","setSelectedTileLayer","defaultTileLayer","layerGroups","setLayerGroups","activeLayerGroups","setActiveLayerGroups","defaultLayerGroups","registerTileLayer","prevTileLayers","layer","tileLayer","registerLayerGroup","prevLayerGroups","group","layerGroup","validDefaultValue","MapLayersControl","layersContext","handleLayerGroupToggle","checked","groupName","showTileLayersDropdown","showLayerGroupsDropdown","triggerProps","position","LayersIcon","DropdownMenuRadioGroup","tileLayersLabel","layerGroupsLabel","MapMarker","useLeaflet","markerRef","resolvedAriaLabel","ariaLabel","resolvedTitle","syncMarkerElement","element","marker","handleMarkerRef","L","renderToString","icon","bgPos","popupAnchor","tooltipAnchor","MapMarkerClusterGroup","iconNode","cluster","MapCircle","MapCircleMarker","MapPolyline","MapPolygon","MapRectangle","MapPopup","MapTooltip","ARROW_POSITION_CLASSES","DEFAULT_OFFSET","sideOffset","side","children","MapZoomControl","zoomLevel","setZoomLevel","MapControlContainer","PlusIcon","MinusIcon","MapFullscreenControl","isFullscreen","setIsFullscreen","fullscreenControl","handleEnter","handleExit","jsx","MinimizeIcon","MaximizeIcon","MapLocatePulseIcon","MapLocateControl","isLocating","setIsLocating","useDelayedLoadingState","location","setLocation","hasLocation","startLocating","onLocationFound","onLocationError","watch","stopLocating","trackingHandler","trackingTitle","trackingAriaLabel","locationMarker","LoaderCircleIcon","NavigationIcon","MapSearchControl","MapDrawContext","useMapDrawContext","MapDrawControl","featureGroupRef","editControlRef","deleteControlRef","activeMode","setActiveMode","layersCount","setLayersCount","updateLayersCount","handleDrawCreated","onLayersChange","handleDrawEditedOrDeleted","LeafletDraw","MapDrawShapeButton","drawContext","controlRef","isActive","drawMode","drawLabel","control","createDrawTool","handleClick","MapDrawMarker","MapDrawPolyline","mapDrawHandleIcon","useMapDrawHandleIcon","WaypointsIcon","MapDrawCircle","CircleIcon","MapDrawRectangle","SquareIcon","MapDrawPolygon","PentagonIcon","MapDrawActionButton","drawAction","hasFeatures","actionLabel","featureGroup","MapDrawEdit","PenLineIcon","MapDrawDelete","Trash2Icon","MapDrawUndo","isInEditMode","isInDeleteMode","undoLabel","handleUndo","Undo2Icon","containerRef","setL","setLeafletDraw","loadLeaflet","leaflet","leafletFullscreen","leafletDraw","L_object","showLoading","setShowLoading","timeoutRef","delay"],"sources":["../../src/components/features/map/place-autocomplete.tsx","../../src/components/features/map/use-map-color-scheme.ts","../../src/components/features/map/map.tsx"],"sourcesContent":["import { Button } from \"../../base/buttons\"\nimport { Text } from \"../../typography\"\nimport { useDebounce } from \"../../../hooks/use-debounce\"\nimport { DEFAULT_DEBOUNCE_MS } from \"../../../hooks/use-debounced-callback\"\nimport { useStrings, type StringsProp } from \"../../../lib/strings\"\nimport { cn } from \"../../../lib/utils\"\nimport {\n\t\tCommand,\n\t\tCommandEmpty,\n\t\tCommandGroup,\n\t\tCommandItem,\n\t\tCommandList,\n} from \"../../base/command\"\nimport {\n\t\tPopover,\n\t\tPopoverContent,\n\t\tPopoverTrigger,\n} from \"../../base/popover\"\nimport { InputGroup, InputGroupAddon, InputGroupInput } from '../../base/text-inputs';\nimport { Loader2Icon, MapPinIcon, SearchIcon } from \"lucide-react\"\nimport * as React from \"react\"\nimport { flushSync } from \"react-dom\"\n\ntype BBox = [number, number, number, number]\ntype Point = {\n\t\ttype: \"Point\"\n\t\tcoordinates: [number, number]\n}\ntype Feature<TGeometry, TProperties> = {\n\t\ttype: \"Feature\"\n\t\tgeometry: TGeometry\n\t\tproperties: TProperties\n\t\tbbox?: BBox\n}\ntype FeatureCollection<TGeometry, TProperties> = {\n\t\ttype: \"FeatureCollection\"\n\t\tfeatures: Array<Feature<TGeometry, TProperties>>\n\t\tbbox?: BBox\n}\n\ninterface PlaceFeatureProperties {\n\t\tosm_id: number\n\t\tosm_type: \"N\" | \"W\" | \"R\"\n\t\tosm_key: string\n\t\tosm_value: string\n\t\ttype: string\n\t\t/** Form field name, forwarded for native submits. */\n\t\tname?: string\n\t\thousenumber?: string\n\t\tstreet?: string\n\t\tlocality?: string\n\t\tdistrict?: string\n\t\tpostcode?: string\n\t\tcity?: string\n\t\tcounty?: string\n\t\tstate?: string\n\t\tcountry?: string\n\t\tcountrycode?: string\n\t\textent?: [number, number, number, number]\n\t\textra?: Record<string, string>\n}\ntype PlaceFeature = Feature<Point, PlaceFeatureProperties>\ntype PlaceFeatureCollection = FeatureCollection<Point, PlaceFeatureProperties>\n\ninterface PlaceAutocompleteStrings {\n\t\tsearchPlaceholder: string\n\t\t/** Announced while a place lookup is in flight. */\n\t\tloading: string\n\t\terror: string\n\t\t/** Action shown after a failed lookup. */\n\t\tretry?: string\n\t\tnoResults: string\n\t\tunknownPlace: string\n}\n\nconst defaultPlaceAutocompleteStrings: PlaceAutocompleteStrings = {\n\t\tsearchPlaceholder: \"Search\",\n\t\tloading: \"Searching places\",\n\t\terror: \"Error: {{message}}\",\n\t\tretry: \"Retry\",\n\t\tnoResults: \"Can't find {{query}}.\",\n\t\tunknownPlace: \"Unknown\",\n}\n\n/**\n * Query parameters for Photon geocoding API\n * @see https://github.com/komoot/photon#photon-api\n */\ninterface PlaceSearchOptions {\n\t\t/** Search text (address, place name, or POI) */\n\t\tquery: string\n\t\t/** Preferred language for results (e.g., \"en\", \"de\", \"fr\") */\n\t\tlang?: string\n\t\t/** Maximum number of results to return */\n\t\tlimit?: number\n\t\t/**\n\t\t * Bounding box used to restrict results.\n\t\t * Format: [minLongitude, minLatitude, maxLongitude, maxLatitude]\n\t\t */\n\t\tbbox?: BBox\n\t\t/** Latitude used to bias results toward a specific location */\n\t\tlat?: number\n\t\t/** Longitude used to bias results toward a specific location */\n\t\tlon?: number\n\t\t/**\n\t\t * Zoom level used for location biasing.\n\t\t * Higher values increase locality.\n\t\t */\n\t\tzoom?: number\n\t\t/**\n\t\t * Strength of the location bias.\n\t\t */\n\t\tlocationBiasScale?: number\n}\n\n/** Consumer-owned geocoding integration. Keep callback identity stable until its provider changes. */\ntype PlaceSearchCallback = (options: PlaceSearchOptions, signal: AbortSignal) => Promise<PlaceFeature[]>\n\ninterface PlaceAutocompleteProps\n\t\textends Omit<PlaceSearchOptions, \"query\">,\n\t\t\t\tOmit<React.ComponentProps<\"input\">, \"value\" | \"onChange\"> {\n\t\tdebounceMs?: number\n\t\t/** Current value. Controlled. */\n\t\tvalue?: string\n\t\t/** Initial value for uncontrolled use. */\n\t\tdefaultValue?: string\n\t\t/** Fired with the next text value. */\n\t\tonValueChange?: (value: string) => void\n\t\tonPlaceSelect?: (feature: PlaceFeature) => void\n\t\tonResultsChange?: (results: PlaceFeature[]) => void\n\t\t/** Overrides Photon. Memoize when its implementation captures consumer state. */\n\t\tsearchPlaces?: PlaceSearchCallback\n\t\t/** Reports a current lookup failure; cancelled or superseded failures are ignored. */\n\t\tonSearchError?: (error: Error) => void\n\t\t/** Overrides this surface's own copy. */\n\t\tstrings?: StringsProp<PlaceAutocompleteStrings>\n}\n\nfunction formatAddress(properties: PlaceFeatureProperties) {\n\t\tconst parts = []\n\n\t\tif (properties.name) {\n\t\t\t\tparts.push(properties.name)\n\t\t}\n\n\t\tif (properties.housenumber && properties.street) {\n\t\t\t\tparts.push(`${properties.housenumber} ${properties.street}`)\n\t\t} else if (properties.street) {\n\t\t\t\tparts.push(properties.street)\n\t\t}\n\n\t\tif (properties.city) {\n\t\t\t\tparts.push(properties.city)\n\t\t} else if (properties.locality) {\n\t\t\t\tparts.push(properties.locality)\n\t\t}\n\n\t\tif (properties.state && properties.state !== properties.city) {\n\t\t\t\tparts.push(properties.state)\n\t\t}\n\n\t\tif (properties.country) {\n\t\t\t\tparts.push(properties.country)\n\t\t}\n\n\t\treturn [...new Set(parts)].join(\", \")\n}\n\nfunction buildSearchUrl({\n\t\tquery,\n\t\tbbox,\n\t\tlang,\n\t\tlat,\n\t\tlimit,\n\t\tlocationBiasScale,\n\t\tlon,\n\t\tzoom,\n}: PlaceSearchOptions) {\n\t\tconst url = new URL(\"https://photon.komoot.io/api\")\n\t\turl.searchParams.set(\"q\", query)\n\n\t\tif (lang) {\n\t\t\t\turl.searchParams.set(\"lang\", lang)\n\t\t}\n\n\t\tif (limit) {\n\t\t\t\turl.searchParams.set(\"limit\", String(limit))\n\t\t}\n\n\t\tif (bbox) {\n\t\t\t\turl.searchParams.set(\"bbox\", bbox.join(\",\"))\n\t\t}\n\n\t\tif (lat !== undefined && lon !== undefined) {\n\t\t\t\turl.searchParams.set(\"lat\", String(lat))\n\t\t\t\turl.searchParams.set(\"lon\", String(lon))\n\t\t}\n\n\t\tif (zoom !== undefined) {\n\t\t\t\turl.searchParams.set(\"zoom\", String(zoom))\n\t\t}\n\n\t\tif (locationBiasScale !== undefined) {\n\t\t\t\turl.searchParams.set(\"location_bias_scale\", String(locationBiasScale))\n\t\t}\n\n\t\treturn String(url)\n}\n\nconst searchPhoton: PlaceSearchCallback = async (options, signal) => {\n\t\tconst response = await fetch(buildSearchUrl(options), { signal })\n\t\tif (!response.ok) {\n\t\t\t\tthrow new Error(`Photon API error: ${response.status} ${response.statusText}`)\n\t\t}\n\t\tconst data: PlaceFeatureCollection = await response.json()\n\t\treturn data.features\n}\n\nfunction usePlaceSearch({\n\t\tdebounceMs,\n\t\tquery,\n\t\tlang,\n\t\tlimit,\n\t\tbbox,\n\t\tlat,\n\t\tlon,\n\t\tzoom,\n\t\tlocationBiasScale,\n\t\tsearchPlaces = searchPhoton,\n\t\tonSearchError,\n}: {\n\t\tdebounceMs: number\n\t\tsearchPlaces?: PlaceSearchCallback\n\t\tonSearchError?: (error: Error) => void\n} & PlaceSearchOptions) {\n\t\tconst [results, setResults] = React.useState<PlaceFeature[]>([])\n\t\tconst [isLoading, setIsLoading] = React.useState(false)\n\t\tconst [error, setError] = React.useState<Error | null>(null)\n\t\tconst [hasSearched, setHasSearched] = React.useState(false)\n\t\tconst [retryAttempt, setRetryAttempt] = React.useState(0)\n\t\tconst onSearchErrorRef = React.useRef(onSearchError)\n\t\tReact.useEffect(() => { onSearchErrorRef.current = onSearchError }, [onSearchError])\n\n\t\tconst debouncedQuery = useDebounce(query, debounceMs)\n\t\t// Tuple values define the context; a consumer's inline bbox must not restart it.\n\t\tconst bboxKey = bbox?.join(',')\n\n\t\tReact.useEffect(() => {\n\t\t\t\tsetResults(current => current.length ? [] : current)\n\t\t\t\tsetError(null)\n\t\t\t\tif (!query.trim() || query !== debouncedQuery) {\n\t\t\t\t\t\tsetIsLoading(false)\n\t\t\t\t\t\tsetHasSearched(false)\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst abortController = new AbortController()\n\t\t\t\tconst { signal } = abortController\n\t\t\t\tsetIsLoading(true)\n\t\t\t\tsetHasSearched(true)\n\n\t\t\t\tasync function fetchResults() {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst features = await searchPlaces({\n\t\t\t\t\t\t\t\t\t\tquery: debouncedQuery, lang, limit,\n\t\t\t\t\t\t\t\t\t\tbbox: bboxKey ? bboxKey.split(',').map(Number) as BBox : undefined,\n\t\t\t\t\t\t\t\t\t\tlat, lon, zoom, locationBiasScale,\n\t\t\t\t\t\t\t\t}, signal)\n\t\t\t\t\t\t\t\tif (signal.aborted) return\n\t\t\t\t\t\t\t\tconst addressOsmIds = new Set<number>()\n\t\t\t\t\t\t\t\tsetResults(features.filter(feature => {\n\t\t\t\t\t\t\t\t\t\tconst id = feature.properties.osm_id\n\t\t\t\t\t\t\t\t\t\tif (addressOsmIds.has(id)) return false\n\t\t\t\t\t\t\t\t\t\taddressOsmIds.add(id)\n\t\t\t\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t\t\t}))\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tif (signal.aborted || (err instanceof Error && err.name === 'AbortError')) return\n\t\t\t\t\t\t\t\tconst failure = err instanceof Error ? err : new Error(String(err))\n\t\t\t\t\t\t\t\tsetError(failure)\n\t\t\t\t\t\t\t\tonSearchErrorRef.current?.(failure)\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\t\tif (!signal.aborted) setIsLoading(false)\n\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvoid fetchResults()\n\t\t\t\treturn () => abortController.abort()\n\t\t}, [query, debouncedQuery, lang, limit, bboxKey, lat, lon, zoom, locationBiasScale, searchPlaces, retryAttempt])\n\n\t\treturn { results, isLoading, error, hasSearched, retry: () => setRetryAttempt(attempt => attempt + 1) }\n}\n\nfunction formatPlaceAutocompleteString(\n\t\ttemplate: string,\n\t\tparams: Record<string, string>\n) {\n\t\treturn template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, key) => {\n\t\t\t\treturn params[key] ?? match\n\t\t})\n}\n\nfunction PlaceAutocomplete({\n\t\tdebounceMs = DEFAULT_DEBOUNCE_MS,\n\t\tlang,\n\t\tlimit = 5,\n\t\tbbox,\n\t\tlat,\n\t\tlon,\n\t\tzoom,\n\t\tlocationBiasScale,\n\t\tclassName,\n\t\tvalue: controlledValue,\n\t\tdefaultValue = \"\",\n\t\tonValueChange: controlledOnValueChange,\n\t\tonPlaceSelect,\n\t\tonResultsChange,\n\t\tsearchPlaces,\n\t\tonSearchError,\n\t\tstrings: stringsProp,\n\t\tonFocus: inputOnFocus,\n\t\t...props\n}: PlaceAutocompleteProps) {\n\t\tconst strings = useStrings(defaultPlaceAutocompleteStrings, stringsProp)\n\t\tconst [internalValue, setInternalValue] = React.useState(defaultValue)\n\t\tconst [searchQuery, setSearchQuery] = React.useState(\"\")\n\t\tconst [isListDismissed, setIsListDismissed] = React.useState(false)\n\t\tconst [activeIndex, setActiveIndex] = React.useState(-1)\n\t\tconst listId = React.useId()\n\t\tconst anchorRef = React.useRef<HTMLDivElement>(null)\n\t\tconst popoverActionsRef: React.ComponentProps<typeof Popover>['actionsRef'] = React.useRef(null)\n\t\tconst optionNodes = React.useRef(new Map<number, HTMLElement>())\n\n\t\tconst isControlled = controlledValue !== undefined\n\t\tconst displayValue = isControlled ? controlledValue : internalValue\n\n\t\tconst { results, isLoading, error, hasSearched, retry } = usePlaceSearch({\n\t\t\t\tquery: searchQuery,\n\t\t\t\tsearchPlaces,\n\t\t\t\tonSearchError,\n\t\t\t\tdebounceMs,\n\t\t\t\tlang,\n\t\t\t\tlimit,\n\t\t\t\tbbox,\n\t\t\t\tlat,\n\t\t\t\tlon,\n\t\t\t\tzoom,\n\t\t\t\tlocationBiasScale,\n\t\t})\n\n\t\tconst onResultsChangeRef = React.useRef(onResultsChange)\n\t\tReact.useEffect(() => { onResultsChangeRef.current = onResultsChange }, [onResultsChange])\n\t\tReact.useEffect(() => {\n\t\t\t\tonResultsChangeRef.current?.(results)\n\t\t}, [results])\n\n\t\tconst hasNoResults =\n\t\t\t\thasSearched && !isLoading && !error && results.length === 0\n\t\tconst hasCommandList = Boolean(error || hasNoResults || results.length > 0)\n\t\tconst showCommandList = hasCommandList && !isListDismissed\n\t\tconst selectPlace = (feature: PlaceFeature) => {\n\t\t\t\tconst address = formatAddress(feature.properties)\n\t\t\t\tif (!isControlled) setInternalValue(address)\n\t\t\t\tsetSearchQuery(\"\")\n\t\t\t\tsetIsListDismissed(true)\n\t\t\t\tsetActiveIndex(-1)\n\t\t\t\tcontrolledOnValueChange?.(address)\n\t\t\t\tonPlaceSelect?.(feature)\n\t\t}\n\t\tconst optionId = (index: number) => optionNodes.current.get(index)?.id\n\n\t\treturn (\n\t\t\t\t<Command\n inset=\"flush\"\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'place-autocomplete--component',\n\t\t\t\t\t\t\t\t// The input group owns the closed-state surface. Keep the\n\t\t\t\t\t\t\t\t// command root flush while inheriting canonical list and row\n\t\t\t\t\t\t\t\t// presentation from base/command.\n\t\t\t\t\t\t\t\t\"h-fit overflow-visible\",\n\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tvalue={activeIndex >= 0 ? String(results[activeIndex]?.properties.osm_id ?? '') : ''}\n\t\t\t\t\t\tonKeyDownCapture={(event) => {\n\t\t\t\t\t\t\tif (!(event.target instanceof HTMLInputElement)) return\n\t\t\t\t\t\t\tif (event.key === 'Tab' && showCommandList && (!error || event.shiftKey)) {\n\t\t\t\t\t\t\t\t// Remove closing popup guards before native Tab follows the page order.\n\t\t\t\t\t\t\t\t// A forward Tab on an error still reaches the popup's Retry action.\n\t\t\t\t\t\t\t\tflushSync(() => {\n\t\t\t\t\t\t\t\t\tsetIsListDismissed(true)\n\t\t\t\t\t\t\t\t\tsetActiveIndex(-1)\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tpopoverActionsRef.current?.unmount()\n\t\t\t\t\t\t\t} else if (event.key === 'Escape') {\n\t\t\t\t\t\t\t\tsetIsListDismissed(true)\n\t\t\t\t\t\t\t\tsetActiveIndex(-1)\n\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t} else if (results.length && ['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) {\n\t\t\t\t\t\t\t\tsetIsListDismissed(false)\n\t\t\t\t\t\t\t\tconst next = event.key === 'Home' ? 0 : event.key === 'End' ? results.length - 1 : activeIndex < 0 ? (event.key === 'ArrowDown' ? 0 : results.length - 1) : (activeIndex + (event.key === 'ArrowDown' ? 1 : -1) + results.length) % results.length\n\t\t\t\t\t\t\t\tsetActiveIndex(next)\n\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t} else if (event.key === 'Enter' && showCommandList && results[activeIndex]) {\n\t\t\t\t\t\t\t\tselectPlace(results[activeIndex])\n\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tshouldFilter={false}\n\t\t\t\t\t\tloop>\n\t\t\t\t\t\t<Popover\n\t\t\t\t\t\t\t\tactionsRef={popoverActionsRef}\n\t\t\t\t\t\t\t\topen={showCommandList}\n\t\t\t\t\t\t\t\tonOpenChange={(open, details) => {\n\t\t\t\t\t\t\t\t\t\t// The visible input is part of this composite, outside the portal.\n\t\t\t\t\t\t\t\t\t\tif (!open && details.reason === 'focus-out' && document.activeElement === anchorRef.current?.querySelector('input')) {\n\t\t\t\t\t\t\t\t\t\t\t\tdetails.cancel()\n\t\t\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (!open) setIsListDismissed(true)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div ref={anchorRef} className=\"place-autocomplete--anchor relative\">\n\t\t\t\t\t\t\t\t\t\t<PopoverTrigger\n\t\t\t\t\t\t\t\t\t\t\t\trender={<span />}\n\t\t\t\t\t\t\t\t\t\t\t\tnativeButton={false}\n\t\t\t\t\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"pointer-events-none absolute inset-0\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<InputGroup className=\"border-input! bg-popover! ring-0!\">\n\t\t\t\t\t\t\t\t\t\t\t\t<InputGroupAddon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SearchIcon />\n\t\t\t\t\t\t\t\t\t\t\t\t</InputGroupAddon>\n\t\t\t\t\t\t\t\t\t\t\t\t<InputGroupInput\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-autocomplete=\"list\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-expanded={showCommandList}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-controls={showCommandList ? listId : undefined}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-activedescendant={showCommandList && results[activeIndex] ? optionId(activeIndex) : undefined}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder={strings.searchPlaceholder}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={displayValue}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={(event) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst newValue = event.target.value\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (!isControlled) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetInternalValue(newValue)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsListDismissed(false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetSearchQuery(newValue)\n\t\t\t\t\t\t\t\t\t\tsetActiveIndex(-1)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolledOnValueChange?.(newValue)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonFocus={(event) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (hasCommandList) setIsListDismissed(false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinputOnFocus?.(event)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t{!!isLoading && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<InputGroupAddon align=\"inline-end\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Loader2Icon className=\"animate-spin\" aria-hidden=\"true\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"inherit\" className=\"sr-only\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{strings.loading}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</InputGroupAddon>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</InputGroup>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<PopoverContent\n\t\t\t\t\t\t\t\t\t\taria-label={strings.searchPlaceholder}\n\t\t\t\t\t\t\t\t\t\talign=\"start\"\n\t\t\t\t\t\t\t\t\t\tsideOffset={4}\n\t\t\t\t\t\t\t\t\t\tinitialFocus={false}\n\t\t\t\t\t\t\t\t\t\tfinalFocus={false}\n\t\t\t\t\t\t\t\t\t\tinset=\"flush\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"place-autocomplete--results w-[var(--anchor-width)] max-w-[var(--available-width)] gap-0 overflow-hidden\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<CommandList id={listId} label={strings.searchPlaceholder} className=\"max-h-72\">\n\t\t\t\t\t\t\t\t\t\t\t\t{!!error && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\" align=\"center\" className=\"block\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{formatPlaceAutocompleteString(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrings.error,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ message: error.message }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Button buttonStyle=\"ghost\" size=\"sm\" onClick={() => { anchorRef.current?.querySelector('input')?.focus(); setIsListDismissed(false); retry() }}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{strings.retry ?? defaultPlaceAutocompleteStrings.retry}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t{!!hasNoResults && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\" align=\"center\" className=\"block\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{formatPlaceAutocompleteString(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrings.noResults,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ query: displayValue }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t{results.length > 0 && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandGroup>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{results.map((feature, index) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst formattedAddress = formatAddress(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeature.properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={feature.properties.osm_id}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={String(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeature.properties.osm_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tref={(node) => { if (node) optionNodes.current.set(index, node); else optionNodes.current.delete(index) }}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonSelect={() => selectPlace(feature)}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<MapPinIcon />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"flex flex-col items-start text-start\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" weight=\"medium\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{feature.properties.name ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeature.properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.street ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrings.unknownPlace}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{formattedAddress}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandGroup>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</CommandList>\n\t\t\t\t\t\t\t\t</PopoverContent>\n\t\t\t\t\t\t</Popover>\n\t\t\t\t</Command>\n\t\t)\n}\n\nexport {\n\t\tPlaceAutocomplete,\n\t\tdefaultPlaceAutocompleteStrings,\n\t\ttype PlaceAutocompleteProps,\n\t\ttype PlaceAutocompleteStrings,\n\t\ttype PlaceFeature,\n\t\ttype PlaceSearchOptions,\n\t\ttype PlaceSearchCallback,\n}\n","import { useCallback, useSyncExternalStore } from 'react';\n\n/** Observe inherited CSS theme classes without adding a second theme store. */\nexport function useMapColorScheme(container: HTMLElement | null): 'light' | 'dark' {\n const read = useCallback(() => {\n for(let node=container;node;node=node.parentElement) {\n if(node.classList.contains('dark')) return 'dark';\n if(node.classList.contains('light')) return 'light';\n }\n return 'light';\n },[container]);\n const subscribe = useCallback((notify: () => void) => {\n const observer=new MutationObserver(notify);\n for(let node=container;node;node=node.parentElement) observer.observe(node,{attributes:true,attributeFilter:['class']});\n return () => observer.disconnect();\n },[container]);\n return useSyncExternalStore(subscribe,read,()=>'light');\n}\n","\"use client\"\n\nimport { cn } from \"../../../lib/utils\"\nimport { layerRecipes } from \"../../../lib/layer-recipes\"\nimport { popoverRecipes } from \"../../base/popover/popover.recipes\"\nimport { useStrings, type StringsProp } from \"../../../lib/strings\"\nimport { Button, ButtonGroup } from \"../../base/buttons\"\nimport {\n\t\tDropdownMenu,\n\t\tDropdownMenuCheckboxItem,\n\t\tDropdownMenuContent,\n\t\tDropdownMenuGroup,\n\t\tDropdownMenuLabel,\n\t\tDropdownMenuRadioGroup,\n\t\tDropdownMenuRadioItem,\n\t\tDropdownMenuSeparator,\n\t\tDropdownMenuTrigger,\n} from \"../../base/navigation/dropdown-menu\"\nimport {\n\t\tPlaceAutocomplete,\n\t\ttype PlaceAutocompleteProps,\n} from \"./place-autocomplete\"\nimport type {\n\t\tCircle,\n\t\tCircleMarker,\n\t\tDivIconOptions,\n\t\tDraw,\n\t\tDrawEvents,\n\t\tDrawMap,\n\t\tDrawOptions,\n\t\tEditToolbar,\n\t\tErrorEvent,\n\t\tFeatureGroup,\n\t\tLatLngExpression,\n\t\tLayerGroup,\n\t\tMap as LeafletMap,\n\t\tLocateOptions,\n\t\tLocationEvent,\n\t\tMarker,\n\t\tMarkerCluster,\n\t\tPointExpression,\n\t\tPolygon,\n\t\tPolyline,\n\t\tPopup,\n\t\tRectangle,\n\t\tTileLayer,\n\t\tTooltip,\n} from \"leaflet\"\nimport type * as LeafletDrawNamespace from \"leaflet-draw\"\nimport type * as LeafletNamespace from \"leaflet\"\nimport type {} from \"leaflet.markercluster\"\nimport {\n\t\tCircleIcon,\n\t\tLayersIcon,\n\t\tLoaderCircleIcon,\n\t\tMapPinIcon,\n\t\tMaximizeIcon,\n\t\tMinimizeIcon,\n\t\tMinusIcon,\n\t\tNavigationIcon,\n\t\tPenLineIcon,\n\t\tPentagonIcon,\n\t\tPlusIcon,\n\t\tSquareIcon,\n\t\tTrash2Icon,\n\t\tUndo2Icon,\n\t\tWaypointsIcon,\n} from \"lucide-react\"\nimport React, {\n\t\tSuspense,\n\t\tcreateContext,\n\t\tlazy,\n\t\tuseCallback,\n\t\tuseContext,\n\t\tuseEffect,\n\t\tuseRef,\n\t\tuseState,\n\t\ttype ComponentType,\n\t\ttype ReactNode,\n\t\ttype Ref,\n} from \"react\"\nimport { useMapColorScheme } from './use-map-color-scheme';\nimport { renderToString } from \"react-dom/server\"\nimport type {\n\t\tCircleMarkerProps,\n\t\tCircleProps,\n\t\tLayerGroupProps,\n\t\tMapContainerProps,\n\t\tMarkerProps,\n\t\tPolygonProps,\n\t\tPolylineProps,\n\t\tPopupProps,\n\t\tRectangleProps,\n\t\tTileLayerProps,\n\t\tTooltipProps,\n\t\tMarkerClusterGroupProps,\n} from \"./public-leaflet.types\"\n\ntype LeafletModule = typeof LeafletNamespace\ntype LeafletDrawModule = typeof LeafletDrawNamespace\ntype ReactLeafletModule = typeof import(\"react-leaflet\")\ntype ReactLeafletHooks = Pick<ReactLeafletModule, \"useMap\" | \"useMapEvents\">\n\nconst ReactLeafletHooksContext = createContext<ReactLeafletHooks | null>(null)\n\nexport interface MapStrings {\n\t\t/** Id of the tile layer shown first. */\n\t\tdefaultTileLayer: string\n\t\tmapType: string\n\t\tlayers: string\n\t\tselectLayers: string\n\t\tmarker: string\n\t\tzoomControls: string\n\t\tzoomIn: string\n\t\tzoomOut: string\n\t\tenterFullscreen: string\n\t\texitFullscreen: string\n\t\tlocating: string\n\t\tstopTracking: string\n\t\ttrackLocation: string\n\t\tstopLocationTracking: string\n\t\tstartLocationTracking: string\n\t\tcurrentLocation: string\n\t\tdrawMarker: string\n\t\tdrawPolyline: string\n\t\tdrawCircle: string\n\t\tdrawRectangle: string\n\t\tdrawPolygon: string\n\t\teditShapes: string\n\t\tremoveShapes: string\n\t\tundoEdit: string\n\t\tundoRemove: string\n\t\teditInstructions: string\n\t\tremoveInstructions: string\n}\n\nexport const defaultMapStrings: MapStrings = {\n\t\tdefaultTileLayer: \"Default\",\n\t\tmapType: \"Map type\",\n\t\tlayers: \"Layers\",\n\t\tselectLayers: \"Select layers\",\n\t\tmarker: \"Map marker\",\n\t\tzoomControls: \"Zoom controls\",\n\t\tzoomIn: \"Zoom in\",\n\t\tzoomOut: \"Zoom out\",\n\t\tenterFullscreen: \"Enter fullscreen\",\n\t\texitFullscreen: \"Exit fullscreen\",\n\t\tlocating: \"Locating…\",\n\t\tstopTracking: \"Stop tracking\",\n\t\ttrackLocation: \"Track location\",\n\t\tstopLocationTracking: \"Stop location tracking\",\n\t\tstartLocationTracking: \"Start location tracking\",\n\t\tcurrentLocation: \"Current location\",\n\t\tdrawMarker: \"Draw marker\",\n\t\tdrawPolyline: \"Draw polyline\",\n\t\tdrawCircle: \"Draw circle\",\n\t\tdrawRectangle: \"Draw rectangle\",\n\t\tdrawPolygon: \"Draw polygon\",\n\t\teditShapes: \"Edit shapes\",\n\t\tremoveShapes: \"Remove shapes\",\n\t\tundoEdit: \"Undo edit\",\n\t\tundoRemove: \"Undo remove\",\n\t\teditInstructions: \"Drag handles or markers to edit.\",\n\t\tremoveInstructions: \"Click on a shape to remove.\",\n}\n\nconst MapStringsContext = createContext<MapStrings>(defaultMapStrings)\n\nfunction useMapStrings() {\n\t\treturn useContext(MapStringsContext)\n}\n\n// Load the shared runtime before mounting MapContainer. Suspending below an\n// already initialized MapContainer disconnects its passive cleanup and removes\n// the Leaflet instance, leaving its visible markers attached to a stale map.\nconst ReactLeafletRuntimeContext = createContext<ReactLeafletModule | null>(null)\nconst ReactLeafletRuntime = lazy(async () => {\n\tconst mod = await import(\"react-leaflet\")\n\treturn { default: ({ children }: { children?: ReactNode }) => (\n\t\t<ReactLeafletRuntimeContext.Provider value={mod}>{children}</ReactLeafletRuntimeContext.Provider>\n\t) }\n})\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mirrors React ComponentType's generic constraint.\nfunction createRuntimeComponent<T extends ComponentType<any>>(select: (runtime: ReactLeafletModule) => T) {\n\treturn (props: React.ComponentProps<T>) => {\n\t\tconst runtime = useContext(ReactLeafletRuntimeContext)\n\t\tif (!runtime) throw new Error(\"Map primitives must be rendered within Map.\")\n\t\tconst Component = select(runtime)\n\t\treturn <Component {...props} />\n\t}\n}\n\nconst LeafletMapContainer = createRuntimeComponent(mod => mod.MapContainer)\nconst LeafletTileLayer = createRuntimeComponent(mod => mod.TileLayer)\nconst LeafletMarker = createRuntimeComponent(mod => mod.Marker)\nconst LeafletPopup = createRuntimeComponent(mod => mod.Popup)\nconst LeafletTooltip = createRuntimeComponent(mod => mod.Tooltip)\nconst LeafletCircle = createRuntimeComponent(mod => mod.Circle)\nconst LeafletCircleMarker = createRuntimeComponent(mod => mod.CircleMarker)\nconst LeafletPolyline = createRuntimeComponent(mod => mod.Polyline)\nconst LeafletPolygon = createRuntimeComponent(mod => mod.Polygon)\nconst LeafletRectangle = createRuntimeComponent(mod => mod.Rectangle)\nconst LeafletLayerGroup = createRuntimeComponent(mod => mod.LayerGroup)\nconst LeafletFeatureGroup = createRuntimeComponent(mod => mod.FeatureGroup)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mirrors React lazy's ComponentType constraint.\nfunction createLazyComponent<T extends ComponentType<any>>(factory: () => Promise<{ default: T }>) {\n\tconst Component = lazy(factory)\n\treturn (props: React.ComponentProps<T>) => <Suspense><Component {...props} /></Suspense>\n}\nconst LeafletMarkerClusterGroup = createLazyComponent(async () =>\n\timport(\"react-leaflet-markercluster\").then(mod => ({ default: mod.default }))\n)\n\nfunction ReactLeafletHooksProvider({ children }: { children?: ReactNode }) {\n\tconst mod = useContext(ReactLeafletRuntimeContext)\n\tif (!mod) throw new Error(\"Map controls must be rendered within Map.\")\n\treturn <ReactLeafletHooksContext.Provider value={mod}>{children}</ReactLeafletHooksContext.Provider>\n}\n\nfunction useLeafletMap() {\n\t\tconst hooks = useContext(ReactLeafletHooksContext)\n\t\tif (!hooks) {\n\t\t\t\tthrow new Error(\"Map controls must be rendered within Map.\")\n\t\t}\n\n\t\treturn hooks.useMap()\n}\n\nfunction useLeafletMapEvents(\n\t\thandlers: Parameters<ReactLeafletModule[\"useMapEvents\"]>[0]\n) {\n\t\tconst hooks = useContext(ReactLeafletHooksContext)\n\t\tif (!hooks) {\n\t\t\t\tthrow new Error(\"Map controls must be rendered within Map.\")\n\t\t}\n\n\t\treturn hooks.useMapEvents(handlers)\n}\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n\t\tif (!ref) return\n\n\t\tif (typeof ref === \"function\") {\n\t\t\t\tref(value)\n\t\t\t\treturn\n\t\t}\n\n\t\t;(ref as React.MutableRefObject<T | null>).current = value\n}\n\nfunction Map({\n\t\tzoom = 15,\n\t\tmaxZoom = 18,\n\t\tclassName,\n\t\tchildren,\n\t\tstrings: stringsProp,\n\t\tref,\n\t\t...props\n}: Omit<MapContainerProps, \"zoomControl\"> & {\n\t\tcenter: LatLngExpression\n\t\tref?: Ref<LeafletMap>\n\t\t/** Overrides the map's own copy. */\n\t\tstrings?: StringsProp<MapStrings>\n}) {\n\t\tconst strings = useStrings(defaultMapStrings, stringsProp)\n\t\tconst focusCleanup = useRef<(() => void) | null>(null)\n\t\tconst handleMapRef = useCallback((map: LeafletMap | null) => {\n\t\t\tfocusCleanup.current?.()\n\t\t\tfocusCleanup.current = null\n\t\t\tif (map?.options.keyboard) {\n\t\t\t\tconst container = map.getContainer()\n\t\t\t\t// Leaflet's keyboard mousedown handler uses plain focus and only\n\t\t\t\t// restores window scroll. Focus first without moving nested scrollers\n\t\t\t\t// so pointerup still lands on the marker pressed by pointerdown.\n\t\t\t\tconst focusWithoutScroll = () => {\n\t\t\t\t\tif (document.activeElement !== container) container.focus({ preventScroll: true })\n\t\t\t\t}\n\t\t\t\tcontainer.addEventListener(\"mousedown\", focusWithoutScroll, true)\n\t\t\t\tfocusCleanup.current = () => container.removeEventListener(\"mousedown\", focusWithoutScroll, true)\n\t\t\t}\n\t\t\tassignRef(ref, map)\n\t\t}, [ref])\n\t\t// Keep the optional runtime outside the server tree.\n\t\tconst [isMounted, setIsMounted] = useState(false)\n\t\tuseEffect(() => { setIsMounted(true) }, [])\n\t\tif (!isMounted) return null\n\t\treturn (\n\t\t\t\t<Suspense>\n\t\t\t\t<ReactLeafletRuntime>\n\t\t\t\t<LeafletMapContainer\n\t\t\t\t\t\tref={handleMapRef}\n\t\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t\tmaxZoom={maxZoom}\n\t\t\t\t\t\tattributionControl={false}\n\t\t\t\t\t\tzoomControl={false}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t// The themed background lives in `map.css`: Leaflet's own\n\t\t\t\t\t\t\t\t// `.leaflet-container { background: #ddd }` is unlayered, so it beats a\n\t\t\t\t\t\t\t\t// `bg-muted` utility on this element regardless of import order.\n\t\t\t\t\t\t\t\t'map--component',\n\t\t\t\t\t\t\t\t\"z-50 size-full min-h-0 flex-1 rounded-radius\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t<MapStringsContext.Provider value={strings}>\n\t\t\t\t\t\t\t\t<ReactLeafletHooksProvider>{children}</ReactLeafletHooksProvider>\n\t\t\t\t\t\t</MapStringsContext.Provider>\n\t\t\t\t</LeafletMapContainer>\n\t\t\t\t</ReactLeafletRuntime>\n\t\t\t\t</Suspense>\n\t\t)\n}\n\ninterface MapTileLayerOption {\n\t\t/** Form field name, forwarded for native submits. */\n\t\tname: string\n\t\t/** Tile URL template. */\n\t\turl: string\n\t\t/** Attribution shown for the tile layer. */\n\t\tattribution?: string\n}\n\ninterface MapLayerGroupOption\n\t\textends Pick<React.ComponentProps<typeof DropdownMenuCheckboxItem>, \"disabled\"> {\n\t\t/** Form field name, forwarded for native submits. */\n\t\tname: string\n}\n\ninterface MapLayersContextType {\n\t\tregisterTileLayer: (layer: MapTileLayerOption) => void\n\t\ttileLayers: MapTileLayerOption[]\n\t\tselectedTileLayer: string\n\t\tsetSelectedTileLayer: (name: string) => void\n\t\tregisterLayerGroup: (layer: MapLayerGroupOption) => void\n\t\tlayerGroups: MapLayerGroupOption[]\n\t\tactiveLayerGroups: string[]\n\t\tsetActiveLayerGroups: (names: string[]) => void\n}\n\nconst MapLayersContext = createContext<MapLayersContextType | null>(null)\n\nfunction useMapLayersContext() {\n\t\treturn useContext(MapLayersContext)\n}\n\nfunction MapTileLayer({\n\t\tname: nameProp,\n\t\turl,\n\t\tattribution,\n\t\tdarkUrl,\n\t\tdarkAttribution,\n\t\t...props\n}: Partial<TileLayerProps> & {\n\t\t/** Display name for the layer in the layer control. */\n\t\tname?: string\n\t\t/** Tile URL used when the dark theme is active. */\n\t\tdarkUrl?: string\n\t\t/** Attribution shown for the dark tile layer. */\n\t\tdarkAttribution?: string\n\t\tref?: Ref<TileLayer>\n}) {\n\t\tconst strings = useMapStrings()\n\t\tconst name = nameProp ?? strings.defaultTileLayer\n\t\tconst map = useLeafletMap()\n\t\tif (map.attributionControl) {\n\t\t\t\tmap.attributionControl.setPrefix(\"\")\n\t\t}\n\n\t\tconst context = useContext(MapLayersContext)\n\t\tconst DEFAULT_URL =\n\t\t\t\t\"https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png\"\n\t\tconst DEFAULT_DARK_URL =\n\t\t\t\t\"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png\"\n\n\t\tconst resolvedTheme = useMapColorScheme(map.getContainer())\n\t\tconst resolvedUrl =\n\t\t\t\tresolvedTheme === \"dark\"\n\t\t\t\t\t\t? (darkUrl ?? url ?? DEFAULT_DARK_URL)\n\t\t\t\t\t\t: (url ?? DEFAULT_URL)\n\t\tconst resolvedAttribution =\n\t\t\t\tresolvedTheme === \"dark\" && darkAttribution\n\t\t\t\t\t\t? darkAttribution\n\t\t\t\t\t\t: (attribution ??\n\t\t\t\t\t\t\t'© <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>, © <a href=\"https://carto.com/attributions\">CARTO</a>')\n\n\t\tuseEffect(() => {\n\t\t\t\tif (context) {\n\t\t\t\t\t\tcontext.registerTileLayer({\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\turl: resolvedUrl,\n\t\t\t\t\t\t\t\tattribution: resolvedAttribution,\n\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t}, [context, name, resolvedAttribution, resolvedUrl])\n\n\t\tif (context && context.selectedTileLayer !== name) {\n\t\t\t\treturn null\n\t\t}\n\n\t\treturn (\n\t\t\t\t<LeafletTileLayer\n\t\t\t\t\t\turl={resolvedUrl}\n\t\t\t\t\t\tattribution={resolvedAttribution}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapLayerGroup({\n\t\tname,\n\t\tdisabled,\n\t\t...props\n}: LayerGroupProps & MapLayerGroupOption & { ref?: Ref<LayerGroup> }) {\n\t\tconst context = useMapLayersContext()\n\n\t\tuseEffect(() => {\n\t\t\t\tif (context) {\n\t\t\t\t\t\tcontext.registerLayerGroup({\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t}, [context, name, disabled])\n\n\t\tif (context && !context.activeLayerGroups.includes(name)) {\n\t\t\t\treturn null\n\t\t}\n\n\t\treturn <LeafletLayerGroup {...props} />\n}\n\nfunction MapFeatureGroup({\n\t\tname,\n\t\tdisabled,\n\t\t...props\n}: LayerGroupProps & MapLayerGroupOption & { ref?: Ref<FeatureGroup> }) {\n\t\tconst context = useMapLayersContext()\n\n\t\tuseEffect(() => {\n\t\t\t\tif (context) {\n\t\t\t\t\t\tcontext.registerLayerGroup({\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t}, [context, name, disabled])\n\n\t\tif (context && !context.activeLayerGroups.includes(name)) {\n\t\t\t\treturn null\n\t\t}\n\n\t\treturn <LeafletFeatureGroup {...props} />\n}\n\nfunction MapLayers({\n\t\tdefaultTileLayer,\n\t\tdefaultLayerGroups = [],\n\t\t...props\n}: Omit<React.ComponentProps<typeof MapLayersContext.Provider>, \"value\"> & {\n\t\t/** Name of the tile layer shown first. */\n\t\tdefaultTileLayer?: string\n\t\t/** Names of the overlay groups shown first. */\n\t\tdefaultLayerGroups?: string[]\n}) {\n\t\tconst [tileLayers, setTileLayers] = useState<MapTileLayerOption[]>([])\n\t\tconst [selectedTileLayer, setSelectedTileLayer] = useState<string>(\n\t\t\t\tdefaultTileLayer || \"\"\n\t\t)\n\t\tconst [layerGroups, setLayerGroups] = useState<MapLayerGroupOption[]>([])\n\t\tconst [activeLayerGroups, setActiveLayerGroups] =\n\t\t\t\tuseState<string[]>(defaultLayerGroups)\n\n\t\tfunction registerTileLayer(tileLayer: MapTileLayerOption) {\n\t\t\t\tsetTileLayers((prevTileLayers) => {\n\t\t\t\t\t\tif (prevTileLayers.some((layer) => layer.name === tileLayer.name)) {\n\t\t\t\t\t\t\t\treturn prevTileLayers\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn [...prevTileLayers, tileLayer]\n\t\t\t\t})\n\t\t}\n\n\t\tfunction registerLayerGroup(layerGroup: MapLayerGroupOption) {\n\t\t\t\tsetLayerGroups((prevLayerGroups) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tprevLayerGroups.some((group) => group.name === layerGroup.name)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn prevLayerGroups\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn [...prevLayerGroups, layerGroup]\n\t\t\t\t})\n\t\t}\n\n\t\tuseEffect(() => {\n\t\t\t\t// Error: Invalid defaultValue\n\t\t\t\tif (\n\t\t\t\t\t\tdefaultTileLayer &&\n\t\t\t\t\t\ttileLayers.length > 0 &&\n\t\t\t\t\t\t!tileLayers.some((tileLayer) => tileLayer.name === defaultTileLayer)\n\t\t\t\t) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Invalid defaultTileLayer \"${defaultTileLayer}\" provided to MapLayers. It must match a MapTileLayer's name prop.`\n\t\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\t// Set initial selected tile layer\n\t\t\t\tif (tileLayers.length > 0 && !selectedTileLayer) {\n\t\t\t\t\t\tconst validDefaultValue =\n\t\t\t\t\t\t\t\tdefaultTileLayer &&\n\t\t\t\t\t\t\t\ttileLayers.some((layer) => layer.name === defaultTileLayer)\n\t\t\t\t\t\t\t\t\t\t? defaultTileLayer\n\t\t\t\t\t\t\t\t\t\t: tileLayers[0].name\n\t\t\t\t\t\tsetSelectedTileLayer(validDefaultValue)\n\t\t\t\t}\n\n\t\t\t\t// Error: Invalid defaultActiveLayerGroups\n\t\t\t\tif (\n\t\t\t\t\t\tdefaultLayerGroups.length > 0 &&\n\t\t\t\t\t\tlayerGroups.length > 0 &&\n\t\t\t\t\t\tdefaultLayerGroups.some(\n\t\t\t\t\t\t\t\t(name) => !layerGroups.some((group) => group.name === name)\n\t\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Invalid defaultLayerGroups value provided to MapLayers. All names must match a MapLayerGroup's name prop.`\n\t\t\t\t\t\t)\n\t\t\t\t}\n\t\t}, [\n\t\t\t\ttileLayers,\n\t\t\t\tdefaultTileLayer,\n\t\t\t\tselectedTileLayer,\n\t\t\t\tlayerGroups,\n\t\t\t\tdefaultLayerGroups,\n\t\t])\n\n\t\treturn (\n\t\t\t\t<MapLayersContext.Provider\n\t\t\t\t\t\tvalue={{\n\t\t\t\t\t\t\t\tregisterTileLayer,\n\t\t\t\t\t\t\t\ttileLayers,\n\t\t\t\t\t\t\t\tselectedTileLayer,\n\t\t\t\t\t\t\t\tsetSelectedTileLayer,\n\t\t\t\t\t\t\t\tregisterLayerGroup,\n\t\t\t\t\t\t\t\tlayerGroups,\n\t\t\t\t\t\t\t\tactiveLayerGroups,\n\t\t\t\t\t\t\t\tsetActiveLayerGroups,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapLayersControl({\n\t\ttileLayersLabel,\n\t\tlayerGroupsLabel,\n\t\tposition = \"top-1 right-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"button\"> & {\n\t\t/** Heading for the tile-layer group in the layer control. */\n\t\ttileLayersLabel?: string\n\t\t/** Heading for the overlay group in the layer control. */\n\t\tlayerGroupsLabel?: string\n\t\t/** Corner the control is anchored to. */\n\t\tposition?: string\n}) {\n\t\tconst strings = useMapStrings()\n\t\tconst layersContext = useMapLayersContext()\n\t\tif (!layersContext) {\n\t\t\t\tthrow new Error(\"MapLayersControl must be used within MapLayers\")\n\t\t}\n\n\t\tconst {\n\t\t\t\ttileLayers,\n\t\t\t\tselectedTileLayer,\n\t\t\t\tsetSelectedTileLayer,\n\t\t\t\tlayerGroups,\n\t\t\t\tactiveLayerGroups,\n\t\t\t\tsetActiveLayerGroups,\n\t\t} = layersContext\n\n\t\tif (tileLayers.length === 0 && layerGroups.length === 0) {\n\t\t\t\treturn null\n\t\t}\n\n\t\tfunction handleLayerGroupToggle(name: string, checked: boolean) {\n\t\t\t\tsetActiveLayerGroups(\n\t\t\t\t\t\tchecked\n\t\t\t\t\t\t\t\t? [...activeLayerGroups, name]\n\t\t\t\t\t\t\t\t: activeLayerGroups.filter((groupName) => groupName !== name)\n\t\t\t\t)\n\t\t}\n\n\t\tconst showTileLayersDropdown = tileLayers.length > 1\n\t\tconst showLayerGroupsDropdown = layerGroups.length > 0\n\n\t\tif (!showTileLayersDropdown && !showLayerGroupsDropdown) {\n\t\t\t\treturn null\n\t\t}\n\n\t\treturn (\n\t\t\t\t<DropdownMenu>\n\t\t\t\t\t\t<DropdownMenuTrigger\n\t\t\t\t\t\t\t\trender={(triggerProps) => (\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t{...triggerProps}\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\t\t\t\t\taria-label={strings.selectLayers}\n\t\t\t\t\t\t\t\t\t\t\t\ttitle={strings.selectLayers}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"border-border absolute z-1000 border\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tposition,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttriggerProps.className\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<LayersIcon />\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<DropdownMenuContent align=\"end\" className=\"z-1000\">\n\t\t\t\t\t\t\t\t{!!showTileLayersDropdown && <>\n\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuRadioGroup\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={selectedTileLayer}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonValueChange={setSelectedTileLayer}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuLabel>{tileLayersLabel ?? strings.mapType}</DropdownMenuLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{tileLayers.map((tileLayer) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuRadioItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={tileLayer.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={tileLayer.name}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{tileLayer.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuRadioItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuRadioGroup>\n\t\t\t\t\t\t\t\t\t\t</>}\n\t\t\t\t\t\t\t\t{!!showTileLayersDropdown && !!showLayerGroupsDropdown && <DropdownMenuSeparator />}\n\t\t\t\t\t\t\t\t{!!showLayerGroupsDropdown && (\n\t\t\t\t\t\t\t\t\t\t<DropdownMenuGroup>\n\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{layerGroupsLabel ?? strings.layers}\n\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t{layerGroups.map((layerGroup) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuCheckboxItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={layerGroup.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tchecked={activeLayerGroups.includes(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlayerGroup.name\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={layerGroup.disabled}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonCheckedChange={(checked) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thandleLayerGroupToggle(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlayerGroup.name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tchecked\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{layerGroup.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuCheckboxItem>\n\t\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</DropdownMenuGroup>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</DropdownMenuContent>\n\t\t\t\t</DropdownMenu>\n\t\t)\n}\n\nfunction MapMarker({\n\t\ticon = <MapPinIcon className=\"size-icon-lg fill-background text-foreground\" />,\n\t\ticonAnchor = [12, 12],\n\t\tbgPos,\n\t\tpopupAnchor,\n\t\ttooltipAnchor,\n\t\tariaLabel,\n\t\tref,\n\t\t...props\n}: Omit<MarkerProps, \"icon\"> &\n\t\tPick<\n\t\t\t\tDivIconOptions,\n\t\t\t\t\"iconAnchor\" | \"bgPos\" | \"popupAnchor\" | \"tooltipAnchor\"\n\t\t> & {\n\t\t\t\ticon?: ReactNode\n\t\t\t\tariaLabel?: string\n\t\t\t\tref?: Ref<Marker>\n\t\t}) {\n\t\tconst { L } = useLeaflet()\n\t\tconst strings = useMapStrings()\n\t\tconst markerRef = useRef<Marker | null>(null)\n\t\tconst resolvedAriaLabel =\n\t\t\t\tariaLabel ??\n\t\t\t\t(typeof props.title === \"string\" && props.title.trim()\n\t\t\t\t\t\t? props.title\n\t\t\t\t\t\t: undefined) ??\n\t\t\t\tstrings.marker\n\t\tconst resolvedTitle =\n\t\t\t\ttypeof props.title === \"string\" && props.title.trim()\n\t\t\t\t\t\t? props.title\n\t\t\t\t\t\t: resolvedAriaLabel\n\t\tconst syncMarkerElement = useCallback(\n\t\t\t\t(marker: Marker | null) => {\n\t\t\t\t\t\tconst element = marker?.getElement()\n\t\t\t\t\t\tif (!element) return\n\n\t\t\t\t\t\telement.setAttribute(\"aria-label\", resolvedAriaLabel)\n\t\t\t\t\t\tif (!element.getAttribute(\"title\")) {\n\t\t\t\t\t\t\t\telement.setAttribute(\"title\", resolvedAriaLabel)\n\t\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t[resolvedAriaLabel]\n\t\t)\n\t\tconst handleMarkerRef = useCallback(\n\t\t\t\t(marker: Marker | null) => {\n\t\t\t\t\t\tmarkerRef.current = marker\n\t\t\t\t\t\tassignRef(ref, marker)\n\t\t\t\t\t\tsyncMarkerElement(marker)\n\t\t\t\t},\n\t\t\t\t[ref, syncMarkerElement]\n\t\t)\n\n\t\tuseEffect(() => {\n\t\t\t\tsyncMarkerElement(markerRef.current)\n\t\t}, [syncMarkerElement])\n\n\t\tif (!L) return null\n\n\t\treturn (\n\t\t\t\t<LeafletMarker\n\t\t\t\t\t\tref={handleMarkerRef}\n\t\t\t\t\t\ticon={L.divIcon({\n\t\t\t\t\t\t\t\t// Empty className stops leaflet's default `.leaflet-div-icon`\n\t\t\t\t\t\t\t\t// (white background + grey border rectangle) from being applied\n\t\t\t\t\t\t\t\t// around our SVG marker.\n\t\t\t\t\t\t\t\tclassName: \"\",\n\t\t\t\t\t\t\t\thtml: renderToString(icon),\n\t\t\t\t\t\t\t\ticonAnchor,\n\t\t\t\t\t\t\t\t...(bgPos ? { bgPos } : {}),\n\t\t\t\t\t\t\t\t...(popupAnchor ? { popupAnchor } : {}),\n\t\t\t\t\t\t\t\t...(tooltipAnchor ? { tooltipAnchor } : {}),\n\t\t\t\t\t\t})}\n\t\t\t\t\t\triseOnHover\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t\ttitle={resolvedTitle}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapMarkerClusterGroup({\n\t\tpolygonOptions = {\n\t\t\t\tclassName: \"fill-foreground stroke-foreground stroke-2\",\n\t\t},\n\t\tspiderLegPolylineOptions = {\n\t\t\t\tclassName: \"fill-foreground stroke-foreground stroke-2\",\n\t\t},\n\t\ticon,\n\t\t...props\n}: Omit<MarkerClusterGroupProps, \"iconCreateFunction\"> & {\n\t\tchildren: ReactNode\n\t\t/** Marker glyph. */\n\t\ticon?: (markerCount: number) => ReactNode\n}) {\n\t\tconst { L } = useLeaflet()\n\t\tif (!L) return null\n\n\t\tconst iconCreateFunction = icon\n\t\t\t\t? (cluster: MarkerCluster) => {\n\t\t\t\t\t\t\tconst markerCount = cluster.getChildCount()\n\t\t\t\t\t\t\tconst iconNode = icon(markerCount)\n\t\t\t\t\t\t\treturn L.divIcon({\n\t\t\t\t\t\t\t\t\thtml: renderToString(iconNode),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t: undefined\n\n\t\treturn (\n\t\t\t\t<LeafletMarkerClusterGroup\n\t\t\t\t\t\tpolygonOptions={polygonOptions}\n\t\t\t\t\t\tspiderLegPolylineOptions={spiderLegPolylineOptions}\n\t\t\t\t\t\ticonCreateFunction={iconCreateFunction}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapCircle({\n\t\tclassName,\n\t\t...props\n}: CircleProps & { ref?: Ref<Circle> }) {\n\t\treturn (\n\t\t\t\t<LeafletCircle\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapCircleMarker({\n\t\tclassName,\n\t\t...props\n}: CircleMarkerProps & { ref?: Ref<CircleMarker> }) {\n\t\treturn (\n\t\t\t\t<LeafletCircleMarker\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapPolyline({\n\t\tclassName,\n\t\t...props\n}: PolylineProps & { ref?: Ref<Polyline> }) {\n\t\treturn (\n\t\t\t\t<LeafletPolyline\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapPolygon({\n\t\tclassName,\n\t\t...props\n}: PolygonProps & { ref?: Ref<Polygon> }) {\n\t\treturn (\n\t\t\t\t<LeafletPolygon\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapRectangle({\n\t\tclassName,\n\t\t...props\n}: RectangleProps & { ref?: Ref<Rectangle> }) {\n\t\treturn (\n\t\t\t\t<LeafletRectangle\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapPopup({\n\t\tclassName,\n\t\t...props\n}: Omit<PopupProps, \"content\"> & { ref?: Ref<Popup> }) {\n\t\treturn (\n\t\t\t\t<LeafletPopup\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"map-popup--component\",\n\t\t\t\t\t\t\t\t// The shared anchored-surface chrome and display inset; Leaflet positions it.\n\t\t\t\t\t\t\t\tpopoverRecipes.surface,\n\t\t\t\t\t\t\t\tpopoverRecipes.display,\n\t\t\t\t\t\t\t\tlayerRecipes.overlay,\n\t\t\t\t\t\t\t\t\"animate-in fade-out-0 fade-in-0 zoom-out-95 zoom-in-95 slide-in-from-bottom-2 w-72 font-sans outline-hidden\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapTooltip({\n\t\tclassName,\n\t\tchildren,\n\t\tside = \"top\",\n\t\tsideOffset = 15,\n\t\t...props\n}: Omit<TooltipProps, \"offset\"> & {\n\t\t/** Which side of the trigger the surface opens on. */\n\t\tside?: \"top\" | \"right\" | \"bottom\" | \"left\"\n\t\t/** Distance from the trigger, in pixels. */\n\t\tsideOffset?: number\n\t\tref?: Ref<Tooltip>\n}) {\n\t\tconst ARROW_POSITION_CLASSES = {\n\t\t\t\ttop: \"bottom-0.5 left-1/2 -translate-x-1/2 translate-y-1/2\",\n\t\t\t\tbottom: \"top-0.5 left-1/2 -translate-x-1/2 -translate-y-1/2\",\n\t\t\t\tleft: \"right-0.5 top-1/2 translate-x-1/2 -translate-y-1/2\",\n\t\t\t\tright: \"left-0.5 top-1/2 -translate-x-1/2 -translate-y-1/2\",\n\t\t}\n\t\tconst DEFAULT_OFFSET = {\n\t\t\t\ttop: [0, -sideOffset] satisfies PointExpression,\n\t\t\t\tbottom: [0, sideOffset] satisfies PointExpression,\n\t\t\t\tleft: [-sideOffset, 0] satisfies PointExpression,\n\t\t\t\tright: [sideOffset, 0] satisfies PointExpression,\n\t\t}\n\n\t\treturn (\n\t\t\t\t<LeafletTooltip\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"animate-in fade-in-0 zoom-in-95 fade-out-0 zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 w-fit text-xs text-balance transition-opacity\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tdata-side={side}\n\t\t\t\t\t\tdirection={side}\n\t\t\t\t\t\toffset={DEFAULT_OFFSET[side]}\n\t\t\t\t\t\topacity={1}\n\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\"bg-foreground fill-foreground absolute z-50 size-2.5 rotate-45 rounded-[2px]\",\n\t\t\t\t\t\t\t\t\t\tARROW_POSITION_CLASSES[side]\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t/>\n\t\t\t\t</LeafletTooltip>\n\t\t)\n}\n\nfunction MapZoomControl({\n\t\tposition = \"top-1 left-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"div\"> & { position?: string }) {\n\t\tconst map = useLeafletMap()\n\t\tconst strings = useMapStrings()\n\t\tconst [zoomLevel, setZoomLevel] = useState(map.getZoom())\n\n\t\tuseLeafletMapEvents({\n\t\t\t\tzoomend: () => {\n\t\t\t\t\t\tsetZoomLevel(map.getZoom())\n\t\t\t\t},\n\t\t})\n\n\t\treturn (\n\t\t\t\t<MapControlContainer className={cn(position, className)}>\n\t\t\t\t\t\t<ButtonGroup\n\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\taria-label={strings.zoomControls}\n\t\t\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\t\t\t\taria-label={strings.zoomIn}\n\t\t\t\t\t\t\t\t\t\ttitle={strings.zoomIn}\n\t\t\t\t\t\t\t\t\t\tclassName=\"border-border border\"\n\t\t\t\t\t\t\t\t\t\tdisabled={zoomLevel >= map.getMaxZoom()}\n\t\t\t\t\t\t\t\t\t\tonClick={() => map.zoomIn()}>\n\t\t\t\t\t\t\t\t\t\t<PlusIcon />\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\t\t\t\taria-label={strings.zoomOut}\n\t\t\t\t\t\t\t\t\t\ttitle={strings.zoomOut}\n\t\t\t\t\t\t\t\t\t\tclassName=\"border-border border\"\n\t\t\t\t\t\t\t\t\t\tdisabled={zoomLevel <= map.getMinZoom()}\n\t\t\t\t\t\t\t\t\t\tonClick={() => map.zoomOut()}>\n\t\t\t\t\t\t\t\t\t\t<MinusIcon />\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t</MapControlContainer>\n\t\t)\n}\n\nfunction MapFullscreenControl({\n\t\tposition = \"top-1 right-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"button\"> & { position?: string }) {\n\t\tconst map = useLeafletMap()\n\t\tconst strings = useMapStrings()\n\t\tconst [isFullscreen, setIsFullscreen] = useState(false)\n\n\t\tconst { L } = useLeaflet()\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L) return\n\n\t\t\t\tconst fullscreenControl = new L.Control.FullScreen()\n\t\t\t\tfullscreenControl.addTo(map)\n\n\t\t\t\tconst container = fullscreenControl.getContainer()\n\t\t\t\tif (container) {\n\t\t\t\t\t\tcontainer.style.display = \"none\"\n\t\t\t\t}\n\n\t\t\t\tconst handleEnter = () => setIsFullscreen(true)\n\t\t\t\tconst handleExit = () => setIsFullscreen(false)\n\n\t\t\t\tmap.on(\"enterFullscreen\", handleEnter)\n\t\t\t\tmap.on(\"exitFullscreen\", handleExit)\n\n\t\t\t\treturn () => {\n\t\t\t\t\t\tfullscreenControl.remove()\n\t\t\t\t\t\tmap.off(\"enterFullscreen\", handleEnter)\n\t\t\t\t\t\tmap.off(\"exitFullscreen\", handleExit)\n\t\t\t\t}\n\t\t}, [L, map])\n\n\t\treturn (\n\t\t\t\t<MapControlContainer className={cn(position, className)}>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\t\tonClick={() => map.toggleFullscreen()}\n\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\tisFullscreen ? strings.exitFullscreen : strings.enterFullscreen\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttitle={isFullscreen ? strings.exitFullscreen : strings.enterFullscreen}\n\t\t\t\t\t\t\t\tclassName=\"border-border border\"\n\t\t\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t\t\t{isFullscreen ? <MinimizeIcon /> : <MaximizeIcon />}\n\t\t\t\t\t\t</Button>\n\t\t\t\t</MapControlContainer>\n\t\t)\n}\n\nfunction MapLocatePulseIcon() {\n\t\treturn (\n\t\t\t\t<div className=\"absolute -top-1 -right-1 flex size-icon-sm rounded-full\">\n\t\t\t\t\t\t<div className=\"bg-primary absolute inline-flex size-full animate-ping rounded-full opacity-75\" />\n\t\t\t\t\t\t<div className=\"bg-primary relative inline-flex size-icon-sm rounded-full\" />\n\t\t\t\t</div>\n\t\t)\n}\n\nfunction MapLocateControl({\n\t\twatch = false,\n\t\tonLocationFound,\n\t\tonLocationError,\n\t\tposition = \"right-1 bottom-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"button\"> &\n\t\tPick<LocateOptions, \"watch\"> & {\n\t\t\t\tonLocationFound?: (location: LocationEvent) => void\n\t\t\t\tonLocationError?: (error: ErrorEvent) => void\n\t\t} & { position?: string }) {\n\t\tconst map = useLeafletMap()\n\t\tconst strings = useMapStrings()\n\t\tconst [isLocating, setIsLocating] = useDelayedLoadingState(200)\n\t\tconst [location, setLocation] = useState<LatLngExpression | null>(null)\n\t\tconst hasLocation = location !== null\n\n\t\tconst startLocating = useCallback(() => {\n\t\t\t\tsetIsLocating(true)\n\t\t\t\tmap.locate({ setView: true, maxZoom: map.getMaxZoom(), watch })\n\t\t\t\tmap.on(\"locationfound\", (location: LocationEvent) => {\n\t\t\t\t\t\tsetLocation(location.latlng)\n\t\t\t\t\t\tsetIsLocating(false)\n\t\t\t\t\t\tonLocationFound?.(location)\n\t\t\t\t})\n\t\t\t\tmap.on(\"locationerror\", (error: ErrorEvent) => {\n\t\t\t\t\t\tsetLocation(null)\n\t\t\t\t\t\tsetIsLocating(false)\n\t\t\t\t\t\tonLocationError?.(error)\n\t\t\t\t})\n\t\t}, [map, onLocationError, onLocationFound, setIsLocating, watch])\n\n\t\tconst stopLocating = useCallback(() => {\n\t\t\t\tmap.stopLocate()\n\t\t\t\tmap.off(\"locationfound\")\n\t\t\t\tmap.off(\"locationerror\")\n\t\t\t\tsetLocation(null)\n\t\t\t\tsetIsLocating(false)\n\t\t}, [map, setIsLocating])\n\t\tconst trackingHandler = hasLocation ? stopLocating : startLocating\n\t\tconst trackingTitle = isLocating\n\t\t\t\t? strings.locating\n\t\t\t\t: hasLocation\n\t\t\t\t\t? strings.stopTracking\n\t\t\t\t\t: strings.trackLocation\n\t\tconst trackingAriaLabel = isLocating\n\t\t\t\t? strings.locating\n\t\t\t\t: hasLocation\n\t\t\t\t\t? strings.stopLocationTracking\n\t\t\t\t\t: strings.startLocationTracking\n\t\tconst locationMarker =\n\t\t\t\thasLocation && location ? (\n\t\t\t\t\t\t<MapMarker\n\t\t\t\t\t\t\t\tposition={location}\n\t\t\t\t\t\t\t\ticon={<MapLocatePulseIcon />}\n\t\t\t\t\t\t\t\tariaLabel={strings.currentLocation}\n\t\t\t\t\t\t/>\n\t\t\t\t) : null\n\n\t\tuseEffect(() => () => stopLocating(), [stopLocating])\n\n\t\treturn (\n\t\t\t\t<MapControlContainer className={cn(position, className)}>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\ttone={hasLocation ? \"primary\" : \"secondary\"}\n\t\t\t\t\t\t\t\tonClick={trackingHandler}\n\t\t\t\t\t\t\t\tdisabled={isLocating}\n\t\t\t\t\t\t\t\ttitle={trackingTitle}\n\t\t\t\t\t\t\t\taria-label={trackingAriaLabel}\n\t\t\t\t\t\t\t\tclassName=\"border-border border\"\n\t\t\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t\t\t{isLocating ? (\n\t\t\t\t\t\t\t\t\t\t<LoaderCircleIcon className=\"animate-spin\" />\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<NavigationIcon />\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{locationMarker}\n\t\t\t\t</MapControlContainer>\n\t\t)\n}\n\nfunction MapSearchControl({\n\t\tposition = \"top-1 left-1\",\n\t\tclassName,\n\t\t...props\n}: PlaceAutocompleteProps & { position?: string }) {\n\t\treturn (\n\t\t\t\t<MapControlContainer className={cn(\"z-1001 w-60\", position, className)}>\n\t\t\t\t\t\t<PlaceAutocomplete {...props} />\n\t\t\t\t</MapControlContainer>\n\t\t)\n}\n\ntype MapDrawShape = \"marker\" | \"polyline\" | \"circle\" | \"rectangle\" | \"polygon\"\ntype MapDrawAction = \"edit\" | \"delete\"\ntype MapDrawMode = MapDrawShape | MapDrawAction | null\ninterface MapDrawContextType {\n\t\treadonly featureGroup: L.FeatureGroup | null\n\t\tactiveMode: MapDrawMode\n\t\tsetActiveMode: (mode: MapDrawMode) => void\n\t\treadonly editControlRef: React.RefObject<EditToolbar.Edit | null>\n\t\treadonly deleteControlRef: React.RefObject<EditToolbar.Delete | null>\n\t\treadonly layersCount: number\n}\n\nconst MapDrawContext = createContext<MapDrawContextType | null>(null)\n\nfunction useMapDrawContext() {\n\t\treturn useContext(MapDrawContext)\n}\n\nfunction MapDrawControl({\n\t\tonLayersChange,\n\t\tposition = \"bottom-1 left-1\",\n\t\tclassName,\n\t\t...props\n}: React.ComponentProps<\"div\"> & {\n\t\tonLayersChange?: (layers: L.FeatureGroup) => void\n\t\t/** Corner the control is anchored to. */\n\t\tposition?: string\n}) {\n\t\tconst { L, LeafletDraw } = useLeaflet()\n\t\tconst map = useLeafletMap()\n\t\tconst featureGroupRef = useRef<L.FeatureGroup | null>(null)\n\t\tconst editControlRef = useRef<EditToolbar.Edit | null>(null)\n\t\tconst deleteControlRef = useRef<EditToolbar.Delete | null>(null)\n\t\tconst [activeMode, setActiveMode] = useState<MapDrawMode>(null)\n\t\tconst [layersCount, setLayersCount] = useState(0)\n\n\t\tconst updateLayersCount = useCallback(() => {\n\t\t\t\tif (featureGroupRef.current) {\n\t\t\t\t\t\tsetLayersCount(featureGroupRef.current.getLayers().length)\n\t\t\t\t}\n\t\t}, [])\n\n\t\tconst handleDrawCreated = useCallback((event: DrawEvents.Created) => {\n\t\t\t\tif (!featureGroupRef.current) return\n\t\t\t\tconst { layer } = event\n\t\t\t\tfeatureGroupRef.current.addLayer(layer)\n\t\t\t\tonLayersChange?.(featureGroupRef.current)\n\t\t\t\tupdateLayersCount()\n\t\t\t\tsetActiveMode(null)\n\t\t}, [onLayersChange, updateLayersCount])\n\n\t\tconst handleDrawEditedOrDeleted = useCallback(() => {\n\t\t\t\tif (!featureGroupRef.current) return\n\t\t\t\tonLayersChange?.(featureGroupRef.current)\n\t\t\t\tupdateLayersCount()\n\t\t\t\tsetActiveMode(null)\n\t\t}, [onLayersChange, updateLayersCount])\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L || !LeafletDraw || !map) return\n\n\t\t\t\tmap.on(\n\t\t\t\t\t\tL.Draw.Event.CREATED,\n\t\t\t\t\t\thandleDrawCreated as L.LeafletEventHandlerFn\n\t\t\t\t)\n\t\t\t\tmap.on(L.Draw.Event.EDITED, handleDrawEditedOrDeleted)\n\t\t\t\tmap.on(L.Draw.Event.DELETED, handleDrawEditedOrDeleted)\n\n\t\t\t\treturn () => {\n\t\t\t\t\t\tmap.off(\n\t\t\t\t\t\t\t\tL.Draw.Event.CREATED,\n\t\t\t\t\t\t\t\thandleDrawCreated as L.LeafletEventHandlerFn\n\t\t\t\t\t\t)\n\t\t\t\t\t\tmap.off(L.Draw.Event.EDITED, handleDrawEditedOrDeleted)\n\t\t\t\t\t\tmap.off(L.Draw.Event.DELETED, handleDrawEditedOrDeleted)\n\t\t\t\t}\n\t\t}, [L, LeafletDraw, map, handleDrawCreated, handleDrawEditedOrDeleted])\n\n\t\treturn (\n\t\t\t\t<MapDrawContext.Provider\n\t\t\t\t\t\tvalue={{\n\t\t\t\t\t\t\t\tfeatureGroup: featureGroupRef.current,\n\t\t\t\t\t\t\t\tactiveMode,\n\t\t\t\t\t\t\t\tsetActiveMode,\n\t\t\t\t\t\t\t\teditControlRef,\n\t\t\t\t\t\t\t\tdeleteControlRef,\n\t\t\t\t\t\t\t\tlayersCount,\n\t\t\t\t\t\t}}>\n\t\t\t\t\t\t<LeafletFeatureGroup ref={featureGroupRef} />\n\t\t\t\t\t\t<MapControlContainer className={cn(position, className)}>\n\t\t\t\t\t\t\t\t<ButtonGroup orientation=\"vertical\" {...props} />\n\t\t\t\t\t\t</MapControlContainer>\n\t\t\t\t</MapDrawContext.Provider>\n\t\t)\n}\n\nfunction MapDrawShapeButton<T extends Draw.Feature>({\n\t\tdrawMode,\n\t\tcreateDrawTool,\n\t\tclassName,\n\t\tchildren,\n\t\t...props\n}: React.ComponentProps<\"button\"> & {\n\t\tdrawMode: MapDrawShape\n\t\tcreateDrawTool: (L: LeafletModule, map: DrawMap) => T\n}) {\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext) {\n\t\t\t\tthrow new Error(\"MapDrawShapeButton must be used within MapDrawControl\")\n\t\t}\n\t\tconst { L } = useLeaflet()\n\t\tconst strings = useMapStrings()\n\t\tconst map = useLeafletMap()\n\t\tconst controlRef = useRef<T | null>(null)\n\t\tconst { activeMode, setActiveMode } = drawContext\n\t\tconst isActive = activeMode === drawMode\n\t\tconst drawLabels: Record<MapDrawShape, string> = {\n\t\t\t\tmarker: strings.drawMarker,\n\t\t\t\tpolyline: strings.drawPolyline,\n\t\t\t\tcircle: strings.drawCircle,\n\t\t\t\trectangle: strings.drawRectangle,\n\t\t\t\tpolygon: strings.drawPolygon,\n\t\t}\n\t\tconst drawLabel = drawLabels[drawMode]\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L || !isActive) {\n\t\t\t\t\t\tcontrolRef.current?.disable()\n\t\t\t\t\t\tcontrolRef.current = null\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst control = createDrawTool(L, map as DrawMap)\n\t\t\t\tcontrol.enable()\n\t\t\t\tcontrolRef.current = control\n\t\t\t\treturn () => {\n\t\t\t\t\t\tcontrol.disable()\n\t\t\t\t\t\tcontrolRef.current = null\n\t\t\t\t}\n\t\t}, [L, map, isActive, createDrawTool])\n\n\t\tfunction handleClick() {\n\t\t\t\tsetActiveMode(isActive ? null : drawMode)\n\t\t}\n\n\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\taria-label={drawLabel}\n\t\t\t\t\t\ttitle={drawLabel}\n\t\t\t\t\t\tclassName={cn(\"border-border border\", className)}\n\t\t\t\t\t\ttone={isActive ? \"primary\" : \"secondary\"}\n\t\t\t\t\t\tdisabled={activeMode === \"edit\" || activeMode === \"delete\"}\n\t\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t</Button>\n\t\t)\n}\n\nfunction MapDrawMarker({ ...props }: DrawOptions.MarkerOptions) {\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"marker\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Marker(map, {\n\t\t\t\t\t\t\t\t\t\ticon: L.divIcon({\n\t\t\t\t\t\t\t\t\t\t\t\tclassName: \"\", // For fixing the moving bug when going in and out the edit mode\n\t\t\t\t\t\t\t\t\t\t\t\ticonAnchor: [12, 12],\n\t\t\t\t\t\t\t\t\t\t\t\thtml: renderToString(<MapPinIcon className=\"size-icon-lg\" />),\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<MapPinIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawPolyline({\n\t\tshowLength = false,\n\t\tdrawError = {\n\t\t\t\tcolor: \"var(--color-destructive)\",\n\t\t},\n\t\tshapeOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\topacity: 1,\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: DrawOptions.PolylineOptions) {\n\t\tconst mapDrawHandleIcon = useMapDrawHandleIcon()\n\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"polyline\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Polyline(map, {\n\t\t\t\t\t\t\t\t\t\t...(mapDrawHandleIcon\n\t\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon: mapDrawHandleIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttouchIcon: mapDrawHandleIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\t\tshowLength,\n\t\t\t\t\t\t\t\t\t\tdrawError,\n\t\t\t\t\t\t\t\t\t\tshapeOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<WaypointsIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawCircle({\n\t\tshowRadius = false,\n\t\tshapeOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\topacity: 1,\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: DrawOptions.CircleOptions) {\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"circle\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Circle(map, {\n\t\t\t\t\t\t\t\t\t\tshowRadius,\n\t\t\t\t\t\t\t\t\t\tshapeOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<CircleIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawRectangle({\n\t\tshowArea = false,\n\t\tshapeOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\topacity: 1,\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: DrawOptions.RectangleOptions) {\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"rectangle\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Rectangle(map, {\n\t\t\t\t\t\t\t\t\t\tshowArea,\n\t\t\t\t\t\t\t\t\t\tshapeOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<SquareIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawPolygon({\n\t\tdrawError = {\n\t\t\t\tcolor: \"var(--color-destructive)\",\n\t\t},\n\t\tshapeOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\topacity: 1,\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: DrawOptions.PolygonOptions) {\n\t\tconst mapDrawHandleIcon = useMapDrawHandleIcon()\n\n\t\treturn (\n\t\t\t\t<MapDrawShapeButton\n\t\t\t\t\t\tdrawMode=\"polygon\"\n\t\t\t\t\t\tcreateDrawTool={(L, map) =>\n\t\t\t\t\t\t\t\tnew L.Draw.Polygon(map, {\n\t\t\t\t\t\t\t\t\t\t...(mapDrawHandleIcon\n\t\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon: mapDrawHandleIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttouchIcon: mapDrawHandleIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\t\tdrawError,\n\t\t\t\t\t\t\t\t\t\tshapeOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<PentagonIcon />\n\t\t\t\t</MapDrawShapeButton>\n\t\t)\n}\n\nfunction MapDrawActionButton<T extends EditToolbar.Edit | EditToolbar.Delete>({\n\t\tdrawAction,\n\t\tcreateDrawTool,\n\t\tcontrolRef,\n\t\tclassName,\n\t\tchildren,\n\t\t...props\n}: React.ComponentProps<\"button\"> & {\n\t\tdrawAction: MapDrawAction\n\t\tcreateDrawTool: (\n\t\t\t\tL: LeafletModule,\n\t\t\t\tmap: DrawMap,\n\t\t\t\tfeatureGroup: L.FeatureGroup\n\t\t) => T\n\t\tcontrolRef: React.RefObject<T | null>\n}) {\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"MapDrawActionButton must be used within MapDrawControl\"\n\t\t\t\t)\n\n\t\tconst { L } = useLeaflet()\n\t\tconst strings = useMapStrings()\n\t\tconst map = useLeafletMap()\n\t\tconst { featureGroup, activeMode, setActiveMode, layersCount } = drawContext\n\t\tconst isActive = activeMode === drawAction\n\t\tconst hasFeatures = layersCount > 0\n\t\tconst actionLabel = drawAction === \"edit\" ? strings.editShapes : strings.removeShapes\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L || !featureGroup || !isActive) {\n\t\t\t\t\t\tcontrolRef.current?.disable?.()\n\t\t\t\t\t\tcontrolRef.current = null\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst control = createDrawTool(L, map as DrawMap, featureGroup)\n\t\t\t\tcontrol.enable?.()\n\t\t\t\tcontrolRef.current = control\n\t\t\t\treturn () => {\n\t\t\t\t\t\tcontrol.disable?.()\n\t\t\t\t\t\tcontrolRef.current = null\n\t\t\t\t}\n\t\t}, [L, map, isActive, featureGroup, createDrawTool, controlRef])\n\n\t\tfunction handleClick() {\n\t\t\t\tcontrolRef.current?.save()\n\t\t\t\tsetActiveMode(isActive ? null : drawAction)\n\t\t}\n\n\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\taria-label={actionLabel}\n\t\t\t\t\t\ttitle={actionLabel}\n\t\t\t\t\t\ttone={isActive ? \"primary\" : \"secondary\"}\n\t\t\t\t\t\tdisabled={!hasFeatures}\n\t\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\t\tclassName={cn(\"border-border border\", className)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t</Button>\n\t\t)\n}\n\nfunction MapDrawEdit({\n\t\tselectedPathOptions = {\n\t\t\t\tcolor: \"var(--color-primary)\",\n\t\t\t\tfillColor: \"var(--color-primary)\",\n\t\t\t\tweight: 2,\n\t\t},\n\t\t...props\n}: Omit<EditToolbar.EditHandlerOptions, \"featureGroup\">) {\n\t\tconst { L } = useLeaflet()\n\t\tconst strings = useMapStrings()\n\t\tconst mapDrawHandleIcon = useMapDrawHandleIcon()\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext) {\n\t\t\t\tthrow new Error(\"MapDrawEdit must be used within MapDrawControl\")\n\t\t}\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L || !mapDrawHandleIcon) return\n\n\t\t\t\tL.Edit.PolyVerticesEdit.mergeOptions({\n\t\t\t\t\t\ticon: mapDrawHandleIcon,\n\t\t\t\t\t\ttouchIcon: mapDrawHandleIcon,\n\t\t\t\t\t\tdrawError: {\n\t\t\t\t\t\t\t\tcolor: \"var(--color-destructive)\",\n\t\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tL.Edit.SimpleShape.mergeOptions({\n\t\t\t\t\t\tmoveIcon: mapDrawHandleIcon,\n\t\t\t\t\t\tresizeIcon: mapDrawHandleIcon,\n\t\t\t\t\t\ttouchMoveIcon: mapDrawHandleIcon,\n\t\t\t\t\t\ttouchResizeIcon: mapDrawHandleIcon,\n\t\t\t\t})\n\t\t\t\tL.drawLocal.edit.handlers.edit.tooltip = {\n\t\t\t\t\t\ttext: strings.editInstructions,\n\t\t\t\t\t\tsubtext: \"\",\n\t\t\t\t}\n\t\t\t\tL.drawLocal.edit.handlers.remove.tooltip = {\n\t\t\t\t\t\ttext: strings.removeInstructions,\n\t\t\t\t}\n\t\t}, [L, mapDrawHandleIcon, strings.editInstructions, strings.removeInstructions])\n\n\t\treturn (\n\t\t\t\t<MapDrawActionButton\n\t\t\t\t\t\tdrawAction=\"edit\"\n\t\t\t\t\t\tcontrolRef={drawContext.editControlRef}\n\t\t\t\t\t\tcreateDrawTool={(L, map, featureGroup) =>\n\t\t\t\t\t\t\t\tnew L.EditToolbar.Edit(map, {\n\t\t\t\t\t\t\t\t\t\tfeatureGroup,\n\t\t\t\t\t\t\t\t\t\tselectedPathOptions,\n\t\t\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<PenLineIcon />\n\t\t\t\t</MapDrawActionButton>\n\t\t)\n}\n\nfunction MapDrawDelete() {\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext) {\n\t\t\t\tthrow new Error(\"MapDrawDelete must be used within MapDrawControl\")\n\t\t}\n\n\t\treturn (\n\t\t\t\t<MapDrawActionButton\n\t\t\t\t\t\tdrawAction=\"delete\"\n\t\t\t\t\t\tcontrolRef={drawContext.deleteControlRef}\n\t\t\t\t\t\tcreateDrawTool={(L, map, featureGroup) =>\n\t\t\t\t\t\t\t\tnew L.EditToolbar.Delete(map, { featureGroup })\n\t\t\t\t\t\t}>\n\t\t\t\t\t\t<Trash2Icon />\n\t\t\t\t</MapDrawActionButton>\n\t\t)\n}\n\nfunction MapDrawUndo({ className, ...props }: React.ComponentProps<\"button\">) {\n\t\tconst drawContext = useMapDrawContext()\n\t\tif (!drawContext)\n\t\t\t\tthrow new Error(\"MapDrawUndo must be used within MapDrawControl\")\n\t\tconst strings = useMapStrings()\n\n\t\tconst {\n\t\t\t\tactiveMode,\n\t\t\t\tsetActiveMode,\n\t\t\t\teditControlRef,\n\t\t\t\tdeleteControlRef,\n\t\t\t\tlayersCount,\n\t\t} = drawContext\n\t\tconst isInEditMode = activeMode === \"edit\"\n\t\tconst isInDeleteMode = activeMode === \"delete\"\n\t\tconst isActive = (isInEditMode || isInDeleteMode) && layersCount > 0\n\t\tconst undoLabel = isInDeleteMode ? strings.undoRemove : strings.undoEdit\n\n\t\tfunction handleUndo() {\n\t\t\t\tif (isInEditMode) {\n\t\t\t\t\t\teditControlRef.current?.revertLayers()\n\t\t\t\t} else if (isInDeleteMode) {\n\t\t\t\t\t\tdeleteControlRef.current?.revertLayers()\n\t\t\t\t}\n\t\t\t\tsetActiveMode(null)\n\t\t}\n\n\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\taria-label={undoLabel}\n\t\t\t\t\t\ttitle={undoLabel}\n\t\t\t\t\t\tonClick={handleUndo}\n\t\t\t\t\t\tdisabled={!isActive}\n\t\t\t\t\t\tclassName={cn(\"border-border border\", className)}\n\t\t\t\t\t\t{...props}>\n\t\t\t\t\t\t<Undo2Icon />\n\t\t\t\t</Button>\n\t\t)\n}\n\nfunction MapControlContainer({\n\t\tclassName,\n\t\t...props\n}: React.ComponentPropsWithoutRef<\"div\">) {\n\t\tconst { L } = useLeaflet()\n\t\tconst containerRef = useRef<HTMLDivElement>(null)\n\n\t\tuseEffect(() => {\n\t\t\t\tif (!L) return\n\t\t\t\tconst element = containerRef.current\n\t\t\t\tif (!element) return\n\t\t\t\tL.DomEvent.disableClickPropagation(element)\n\t\t\t\tL.DomEvent.disableScrollPropagation(element)\n\t\t}, [L])\n\n\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\t\tref={containerRef}\n\t\t\t\t\t\tclassName={cn(\"absolute z-1000 size-fit cursor-default\", className)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction useMapDrawHandleIcon() {\n\t\tconst { L } = useLeaflet()\n\t\tif (!L) return null\n\n\t\treturn L.divIcon({\n\t\t\t\ticonAnchor: [8, 8],\n\t\t\t\thtml: renderToString(\n\t\t\t\t\t\t<CircleIcon className=\"fill-primary-accent stroke-primary-accent size-icon transition-transform hover:scale-110\" />\n\t\t\t\t),\n\t\t})\n}\n\nfunction useLeaflet() {\n\t\tconst [L, setL] = useState<LeafletModule | null>(null)\n\t\tconst [LeafletDraw, setLeafletDraw] = useState<LeafletDrawModule | null>(\n\t\t\t\tnull\n\t\t)\n\n\t\tuseEffect(() => {\n\t\t\t\tasync function loadLeaflet() {\n\t\t\t\t\t\tconst leaflet = await import(\"leaflet\")\n\t\t\t\t\t\tconst leafletFullscreen = await import(\"leaflet.fullscreen\")\n\t\t\t\t\t\tconst leafletDraw = await import(\"leaflet-draw\")\n\n\t\t\t\t\t\tconst L_object = leaflet.default\n\t\t\t\t\t\tif (L_object.Control && !L_object.Control.FullScreen) {\n\t\t\t\t\t\t\t\tL_object.Control.FullScreen =\n\t\t\t\t\t\t\t\t\t\tleafletFullscreen.default || leafletFullscreen\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsetLeafletDraw(leafletDraw)\n\t\t\t\t\t\tsetL(L_object)\n\t\t\t\t}\n\n\t\t\t\tif (L && LeafletDraw) return\n\t\t\t\tif (typeof window === \"undefined\") return\n\n\t\t\t\tvoid loadLeaflet()\n\t\t}, [L, LeafletDraw])\n\n\t\treturn { L, LeafletDraw }\n}\n\n/**\n * Delays the *appearance* of a loading indicator so a fast lookup never\n * flashes a spinner. Not a debounce: it neither collapses a burst of calls\n * nor defers the work itself, so `useDebouncedCallback` does not apply.\n */\nfunction useDelayedLoadingState(delay = 200) {\n\t\tconst [isLoading, setIsLoading] = useState(false)\n\t\tconst [showLoading, setShowLoading] = useState(false)\n\t\tconst timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n\t\tuseEffect(() => {\n\t\t\t\tif (isLoading) {\n\t\t\t\t\t\ttimeoutRef.current = setTimeout(() => {\n\t\t\t\t\t\t\t\tsetShowLoading(true)\n\t\t\t\t\t\t}, delay)\n\t\t\t\t} else {\n\t\t\t\t\t\tif (timeoutRef.current) {\n\t\t\t\t\t\t\t\tclearTimeout(timeoutRef.current)\n\t\t\t\t\t\t\t\ttimeoutRef.current = null\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetShowLoading(false)\n\t\t\t\t}\n\n\t\t\t\treturn () => {\n\t\t\t\t\t\tif (timeoutRef.current) {\n\t\t\t\t\t\t\t\tclearTimeout(timeoutRef.current)\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t}, [isLoading, delay])\n\n\t\treturn [showLoading, setIsLoading] as const\n}\n\nexport {\n\t\tMap,\n\t\tMapCircle,\n\t\tMapCircleMarker,\n\t\tMapControlContainer,\n\t\tMapDrawCircle,\n\t\tMapDrawControl,\n\t\tMapDrawDelete,\n\t\tMapDrawEdit,\n\t\tMapDrawMarker,\n\t\tMapDrawPolygon,\n\t\tMapDrawPolyline,\n\t\tMapDrawRectangle,\n\t\tMapDrawUndo,\n\t\tMapFeatureGroup,\n\t\tMapFullscreenControl,\n\t\tMapLayerGroup,\n\t\tMapLayers,\n\t\tMapLayersControl,\n\t\tMapLocateControl,\n\t\tMapMarker,\n\t\tMapMarkerClusterGroup,\n\t\tMapPolygon,\n\t\tMapPolyline,\n\t\tMapPopup,\n\t\tMapRectangle,\n\t\tMapSearchControl,\n\t\tMapTileLayer,\n\t\tMapTooltip,\n\t\tMapZoomControl,\n\t\tuseLeaflet,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2EA,IAAM6B,KAA4D;CAChE,mBAAmB;CACnB,SAAS;CACT,OAAO;CACP,OAAO;CACP,WAAW;CACX,cAAc;AAChB;AAwDA,SAASC,G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AAU,iBAAiB;EACpC,EAAe,EAAI;CACrB,GAAGoT,CAAK,KAER,AAEED,EAAW,aADX,aAAaA,EAAW,OAAO,GACV,OAEvBD,EAAe,EAAK,UAGT;EACX,AAAIC,EAAW,WACb,aAAaA,EAAW,OAAO;CAEnC,IACC,CAACnT,GAAWoT,CAAK,CAAC,GAEd,CAACH,GAAahT,CAAY;AACnC"}
|
|
1
|
+
{"version":3,"file":"map.js","names":["React","Map","_Fragment","ButtonGroup","Text","resolveTextClassNames","elevationRecipes","popoverRecipes","DropdownMenuSeparator","DropdownMenuTrigger","DropdownMenuGroup","DropdownMenuRadioGroup","DropdownMenuCheckboxItem","DropdownMenuLabel","DropdownMenuContent","DropdownMenu","DropdownMenuRadioItem","layerRecipes","CommandItem","CommandEmpty","CommandList","CommandGroup","Command","PopoverTrigger","Popover","PopoverContent","InputGroup","InputGroupInput","InputGroupAddon","useDebounce","React$1","Fragment$1","defaultPlaceAutocompleteStrings","formatAddress","parts","properties","buildSearchUrl","url","query","lang","limit","bbox","lat","lon","zoom","locationBiasScale","searchPhoton","response","options","usePlaceSearch","results","setResults","isLoading","setIsLoading","error","setError","hasSearched","setHasSearched","retryAttempt","setRetryAttempt","onSearchErrorRef","onSearchError","debouncedQuery","debounceMs","bboxKey","current","abortController","fetchResults","features","searchPlaces","signal","addressOsmIds","id","feature","err","failure","attempt","formatPlaceAutocompleteString","template","params","key","match","PlaceAutocomplete","controlledValue","controlledOnValueChange","stringsProp","inputOnFocus","props","strings","useStrings","internalValue","setInternalValue","defaultValue","searchQuery","setSearchQuery","isListDismissed","setIsListDismissed","activeIndex","setActiveIndex","listId","anchorRef","popoverActionsRef","optionNodes","isControlled","displayValue","onResultsChangeRef","onResultsChange","hasNoResults","hasCommandList","showCommandList","selectPlace","address","onPlaceSelect","cn","className","event","flushSync","next","open","details","SearchIcon","index","newValue","Loader2Icon","Button","retry","formattedAddress","node","MapPinIcon","useMapColorScheme","read","useCallback","container","subscribe","observer","notify","useSyncExternalStore","mapControlSurface","mapControlActiveSurface","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","DEFAULT_OFFSET","sideOffset","side","MapZoomControl","zoomLevel","setZoomLevel","MapControlContainer","PlusIcon","MinusIcon","MapFullscreenControl","isFullscreen","setIsFullscreen","fullscreenControl","handleEnter","handleExit","jsx","MinimizeIcon","MaximizeIcon","MapLocatePulseIcon","MapLocateControl","isLocating","setIsLocating","useDelayedLoadingState","watching","setWatching","location","setLocation","stopRequestRef","callbacks","isTracking","onLocationFound","onLocationError","startLocating","detach","handleFound","handleError","stopRequest","watch","continuesWatching","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","createDrawToolRef","createDrawTool","isActive","drawMode","drawLabel","control","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","useMemo","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 bg-transparent text-inherit\",\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>\n\t\t\t\t\t\t\t\t\t\t\t\t<InputGroupAddon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SearchIcon />\n\t\t\t\t\t\t\t\t\t\t\t\t</InputGroupAddon>\n\t\t\t\t\t\t\t\t\t\t\t\t<InputGroupInput\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-autocomplete=\"list\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-expanded={showCommandList}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-controls={showCommandList ? listId : undefined}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-activedescendant={showCommandList && results[activeIndex] ? optionId(activeIndex) : undefined}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder={strings.searchPlaceholder}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={displayValue}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={(event) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst newValue = event.target.value\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (!isControlled) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetInternalValue(newValue)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsListDismissed(false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetSearchQuery(newValue)\n\t\t\t\t\t\t\t\t\t\tsetActiveIndex(-1)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolledOnValueChange?.(newValue)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonFocus={(event) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (hasCommandList) setIsListDismissed(false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinputOnFocus?.(event)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t{!!isLoading && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<InputGroupAddon align=\"inline-end\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Loader2Icon className=\"animate-spin\" aria-hidden=\"true\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"inherit\" className=\"sr-only\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{strings.loading}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</InputGroupAddon>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</InputGroup>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<PopoverContent\n\t\t\t\t\t\t\t\t\t\taria-label={strings.searchPlaceholder}\n\t\t\t\t\t\t\t\t\t\talign=\"start\"\n\t\t\t\t\t\t\t\t\t\tsideOffset={4}\n\t\t\t\t\t\t\t\t\t\tinitialFocus={false}\n\t\t\t\t\t\t\t\t\t\tfinalFocus={false}\n\t\t\t\t\t\t\t\t\t\tinset=\"flush\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"place-autocomplete--results w-[var(--anchor-width)] max-w-[var(--available-width)] gap-0 overflow-hidden\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<CommandList id={listId} label={strings.searchPlaceholder} className=\"max-h-72\">\n\t\t\t\t\t\t\t\t\t\t\t\t{!!error && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\" align=\"center\" className=\"block\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{formatPlaceAutocompleteString(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrings.error,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ message: error.message }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Button buttonStyle=\"ghost\" size=\"sm\" onClick={() => { anchorRef.current?.querySelector('input')?.focus(); setIsListDismissed(false); retry() }}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{strings.retry ?? defaultPlaceAutocompleteStrings.retry}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t{!!hasNoResults && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\" align=\"center\" className=\"block\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{formatPlaceAutocompleteString(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrings.noResults,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ query: displayValue }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandEmpty>\n\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t{results.length > 0 && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandGroup>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{results.map((feature, index) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst formattedAddress = formatAddress(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeature.properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CommandItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={feature.properties.osm_id}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={String(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeature.properties.osm_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tref={(node) => { if (node) optionNodes.current.set(index, node); else optionNodes.current.delete(index) }}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonSelect={() => selectPlace(feature)}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<MapPinIcon />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"flex flex-col items-start text-start\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" weight=\"medium\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{feature.properties.name ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeature.properties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.street ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrings.unknownPlace}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{formattedAddress}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</CommandGroup>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</CommandList>\n\t\t\t\t\t\t\t\t</PopoverContent>\n\t\t\t\t\t\t</Popover>\n\t\t\t\t</Command>\n\t\t)\n}\n\nexport {\n\t\tPlaceAutocomplete,\n\t\tdefaultPlaceAutocompleteStrings,\n\t\ttype PlaceAutocompleteProps,\n\t\ttype PlaceAutocompleteStrings,\n\t\ttype PlaceFeature,\n\t\ttype PlaceSearchOptions,\n\t\ttype PlaceSearchCallback,\n}\n","import { useCallback, useSyncExternalStore } from 'react';\n\n/** Observe inherited CSS theme classes without adding a second theme store. */\nexport function useMapColorScheme(container: HTMLElement | null): 'light' | 'dark' {\n const read = useCallback(() => {\n for(let node=container;node;node=node.parentElement) {\n if(node.classList.contains('dark')) return 'dark';\n if(node.classList.contains('light')) return 'light';\n }\n return 'light';\n },[container]);\n const subscribe = useCallback((notify: () => void) => {\n const observer=new MutationObserver(notify);\n for(let node=container;node;node=node.parentElement) observer.observe(node,{attributes:true,attributeFilter:['class']});\n return () => observer.disconnect();\n },[container]);\n return useSyncExternalStore(subscribe,read,()=>'light');\n}\n","\"use client\"\n\nimport { cn } from \"../../../lib/utils\"\nimport { layerRecipes } from \"../../../lib/layer-recipes\"\nimport { elevationRecipes } from \"../../../lib/surface-recipes\"\nimport { popoverRecipes } from \"../../base/popover/popover.recipes\"\nimport { resolveTextClassNames } from \"../../typography/text.styles\"\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\tuseMemo,\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\n/**\n * Floating map controls sit over arbitrary tiles, so each one is an outline\n * button (the shared control boundary) on an opaque card surface with the card\n * elevation for small controls over media; hover and press keep the button's own\n * fills. An active tool keeps its solid primary fill and the same elevation.\n */\nconst mapControlSurface = cn(\"bg-card\", elevationRecipes.card)\nconst mapControlActiveSurface = elevationRecipes.card\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-surface\",\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'© <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>, © <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\tbuttonStyle=\"outline\"\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\tmapControlSurface,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"absolute z-1000\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tposition,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttriggerProps.className\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<LayersIcon />\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<DropdownMenuContent align=\"end\" className=\"z-1000\">\n\t\t\t\t\t\t\t\t{!!showTileLayersDropdown && <>\n\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuRadioGroup\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={selectedTileLayer}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonValueChange={setSelectedTileLayer}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuLabel>{tileLayersLabel ?? strings.mapType}</DropdownMenuLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{tileLayers.map((tileLayer) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuRadioItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={tileLayer.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={tileLayer.name}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{tileLayer.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuRadioItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuRadioGroup>\n\t\t\t\t\t\t\t\t\t\t</>}\n\t\t\t\t\t\t\t\t{!!showTileLayersDropdown && !!showLayerGroupsDropdown && <DropdownMenuSeparator />}\n\t\t\t\t\t\t\t\t{!!showLayerGroupsDropdown && (\n\t\t\t\t\t\t\t\t\t\t<DropdownMenuGroup>\n\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{layerGroupsLabel ?? strings.layers}\n\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t{layerGroups.map((layerGroup) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuCheckboxItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={layerGroup.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tchecked={activeLayerGroups.includes(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlayerGroup.name\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={layerGroup.disabled}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonCheckedChange={(checked) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thandleLayerGroupToggle(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlayerGroup.name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tchecked\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{layerGroup.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuCheckboxItem>\n\t\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</DropdownMenuGroup>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</DropdownMenuContent>\n\t\t\t\t</DropdownMenu>\n\t\t)\n}\n\nfunction MapMarker({\n\t\ticon = <MapPinIcon className=\"size-icon-lg fill-background text-foreground\" />,\n\t\ticonAnchor = [12, 12],\n\t\tbgPos,\n\t\tpopupAnchor,\n\t\ttooltipAnchor,\n\t\tariaLabel,\n\t\tref,\n\t\t...props\n}: Omit<MarkerProps, \"icon\"> &\n\t\tPick<\n\t\t\t\tDivIconOptions,\n\t\t\t\t\"iconAnchor\" | \"bgPos\" | \"popupAnchor\" | \"tooltipAnchor\"\n\t\t> & {\n\t\t\t\ticon?: ReactNode\n\t\t\t\tariaLabel?: string\n\t\t\t\tref?: Ref<Marker>\n\t\t}) {\n\t\tconst { L } = useLeaflet()\n\t\tconst strings = useMapStrings()\n\t\tconst markerRef = useRef<Marker | null>(null)\n\t\tconst resolvedAriaLabel =\n\t\t\t\tariaLabel ??\n\t\t\t\t(typeof props.title === \"string\" && props.title.trim()\n\t\t\t\t\t\t? props.title\n\t\t\t\t\t\t: undefined) ??\n\t\t\t\tstrings.marker\n\t\tconst resolvedTitle =\n\t\t\t\ttypeof props.title === \"string\" && props.title.trim()\n\t\t\t\t\t\t? props.title\n\t\t\t\t\t\t: resolvedAriaLabel\n\t\tconst syncMarkerElement = useCallback(\n\t\t\t\t(marker: Marker | null) => {\n\t\t\t\t\t\tconst element = marker?.getElement()\n\t\t\t\t\t\tif (!element) return\n\n\t\t\t\t\t\telement.setAttribute(\"aria-label\", resolvedAriaLabel)\n\t\t\t\t\t\tif (!element.getAttribute(\"title\")) {\n\t\t\t\t\t\t\t\telement.setAttribute(\"title\", resolvedAriaLabel)\n\t\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t[resolvedAriaLabel]\n\t\t)\n\t\tconst handleMarkerRef = useCallback(\n\t\t\t\t(marker: Marker | null) => {\n\t\t\t\t\t\tmarkerRef.current = marker\n\t\t\t\t\t\tassignRef(ref, marker)\n\t\t\t\t\t\tsyncMarkerElement(marker)\n\t\t\t\t},\n\t\t\t\t[ref, syncMarkerElement]\n\t\t)\n\n\t\tuseEffect(() => {\n\t\t\t\tsyncMarkerElement(markerRef.current)\n\t\t}, [syncMarkerElement])\n\n\t\tif (!L) return null\n\n\t\treturn (\n\t\t\t\t<LeafletMarker\n\t\t\t\t\t\tref={handleMarkerRef}\n\t\t\t\t\t\ticon={L.divIcon({\n\t\t\t\t\t\t\t\t// Empty className stops leaflet's default `.leaflet-div-icon`\n\t\t\t\t\t\t\t\t// (white background + grey border rectangle) from being applied\n\t\t\t\t\t\t\t\t// around our SVG marker.\n\t\t\t\t\t\t\t\tclassName: \"\",\n\t\t\t\t\t\t\t\thtml: renderToString(icon),\n\t\t\t\t\t\t\t\ticonAnchor,\n\t\t\t\t\t\t\t\t...(bgPos ? { bgPos } : {}),\n\t\t\t\t\t\t\t\t...(popupAnchor ? { popupAnchor } : {}),\n\t\t\t\t\t\t\t\t...(tooltipAnchor ? { tooltipAnchor } : {}),\n\t\t\t\t\t\t})}\n\t\t\t\t\t\triseOnHover\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t\ttitle={resolvedTitle}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapMarkerClusterGroup({\n\t\tpolygonOptions = {\n\t\t\t\tclassName: \"fill-foreground stroke-foreground stroke-2\",\n\t\t},\n\t\tspiderLegPolylineOptions = {\n\t\t\t\tclassName: \"fill-foreground stroke-foreground stroke-2\",\n\t\t},\n\t\ticon,\n\t\t...props\n}: Omit<MarkerClusterGroupProps, \"iconCreateFunction\"> & {\n\t\tchildren: ReactNode\n\t\t/** Marker glyph. */\n\t\ticon?: (markerCount: number) => ReactNode\n}) {\n\t\tconst { L } = useLeaflet()\n\t\tif (!L) return null\n\n\t\tconst iconCreateFunction = icon\n\t\t\t\t? (cluster: MarkerCluster) => {\n\t\t\t\t\t\t\tconst markerCount = cluster.getChildCount()\n\t\t\t\t\t\t\tconst iconNode = icon(markerCount)\n\t\t\t\t\t\t\treturn L.divIcon({\n\t\t\t\t\t\t\t\t\thtml: renderToString(iconNode),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t: undefined\n\n\t\treturn (\n\t\t\t\t<LeafletMarkerClusterGroup\n\t\t\t\t\t\tpolygonOptions={polygonOptions}\n\t\t\t\t\t\tspiderLegPolylineOptions={spiderLegPolylineOptions}\n\t\t\t\t\t\ticonCreateFunction={iconCreateFunction}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapCircle({\n\t\tclassName,\n\t\t...props\n}: CircleProps & { ref?: Ref<Circle> }) {\n\t\treturn (\n\t\t\t\t<LeafletCircle\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapCircleMarker({\n\t\tclassName,\n\t\t...props\n}: CircleMarkerProps & { ref?: Ref<CircleMarker> }) {\n\t\treturn (\n\t\t\t\t<LeafletCircleMarker\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapPolyline({\n\t\tclassName,\n\t\t...props\n}: PolylineProps & { ref?: Ref<Polyline> }) {\n\t\treturn (\n\t\t\t\t<LeafletPolyline\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapPolygon({\n\t\tclassName,\n\t\t...props\n}: PolygonProps & { ref?: Ref<Polygon> }) {\n\t\treturn (\n\t\t\t\t<LeafletPolygon\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapRectangle({\n\t\tclassName,\n\t\t...props\n}: RectangleProps & { ref?: Ref<Rectangle> }) {\n\t\treturn (\n\t\t\t\t<LeafletRectangle\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"fill-foreground stroke-foreground stroke-2\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapPopup({\n\t\tclassName,\n\t\t...props\n}: Omit<PopupProps, \"content\"> & { ref?: Ref<Popup> }) {\n\t\treturn (\n\t\t\t\t<LeafletPopup\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"map-popup--component\",\n\t\t\t\t\t\t\t\t// The shared anchored-surface chrome and display inset; Leaflet positions it.\n\t\t\t\t\t\t\t\tpopoverRecipes.surface,\n\t\t\t\t\t\t\t\tpopoverRecipes.display,\n\t\t\t\t\t\t\t\tlayerRecipes.overlay,\n\t\t\t\t\t\t\t\t\"animate-in fade-out-0 fade-in-0 zoom-out-95 zoom-in-95 slide-in-from-bottom-2 w-72 font-sans outline-hidden\",\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t)\n}\n\nfunction MapTooltip({\n\t\tclassName,\n\t\tchildren,\n\t\tside = \"top\",\n\t\tsideOffset = 15,\n\t\t...props\n}: Omit<TooltipProps, \"offset\"> & {\n\t\t/** Which side of the trigger the surface opens on. */\n\t\tside?: \"top\" | \"right\" | \"bottom\" | \"left\"\n\t\t/** Distance from the trigger, in pixels. */\n\t\tsideOffset?: number\n\t\tref?: Ref<Tooltip>\n}) {\n\t\tconst 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\"map-tooltip--component 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 z-50 w-fit max-w-xs text-balance transition-opacity rounded-radius-xs border-0 bg-inverse-background px-space-md py-space-xs shadow-none\",\n\t\t\t\t\t\t\t\tresolveTextClassNames({ type: 'inverse', size: 'xs', lineHeight: 'snug' }),\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</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\tbuttonStyle=\"outline\"\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={mapControlSurface}\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\tbuttonStyle=\"outline\"\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={mapControlSurface}\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\tbuttonStyle=\"outline\"\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={mapControlSurface}\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 [watching, setWatching] = useState(false)\n\t\tconst [location, setLocation] = useState<LatLngExpression | null>(null)\n\t\tconst stopRequestRef = useRef<(() => void) | null>(null)\n\t\tconst callbacks = useRef({ onLocationFound, onLocationError })\n\t\tconst isTracking = watching || location !== null\n\n\t\tuseEffect(() => {\n\t\t\t\tcallbacks.current = { onLocationFound, onLocationError }\n\t\t}, [onLocationFound, onLocationError])\n\n\t\tconst startLocating = useCallback(() => {\n\t\t\t\tif (stopRequestRef.current) return\n\n\t\t\t\tfunction detach() {\n\t\t\t\t\t\tmap.off(\"locationfound\", handleFound)\n\t\t\t\t\t\tmap.off(\"locationerror\", handleError)\n\t\t\t\t\t\tstopRequestRef.current = null\n\t\t\t\t}\n\n\t\t\t\tfunction stopRequest() {\n\t\t\t\t\t\tdetach()\n\t\t\t\t\t\tmap.stopLocate()\n\t\t\t\t}\n\n\t\t\t\tfunction handleFound(location: LocationEvent) {\n\t\t\t\t\t\tif (watch) setWatching(true)\n\t\t\t\t\t\telse detach()\n\t\t\t\t\t\tsetLocation(location.latlng)\n\t\t\t\t\t\tsetIsLocating(false)\n\t\t\t\t\t\tcallbacks.current.onLocationFound?.(location)\n\t\t\t\t}\n\n\t\t\t\tfunction handleError(error: ErrorEvent) {\n\t\t\t\t\t\t// Position unavailable and timeout can recover on the same watch.\n\t\t\t\t\t\tconst continuesWatching = watch && (error.code === 2 || error.code === 3)\n\t\t\t\t\t\tif (!continuesWatching) {\n\t\t\t\t\t\t\t\tif (watch) stopRequest()\n\t\t\t\t\t\t\t\telse detach()\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetWatching(continuesWatching)\n\t\t\t\t\t\tsetLocation(null)\n\t\t\t\t\t\tsetIsLocating(false)\n\t\t\t\t\t\tcallbacks.current.onLocationError?.(error)\n\t\t\t\t}\n\n\t\t\t\tstopRequestRef.current = stopRequest\n\t\t\t\tmap.on(\"locationfound\", handleFound)\n\t\t\t\tmap.on(\"locationerror\", handleError)\n\t\t\t\tsetIsLocating(true)\n\t\t\t\tmap.locate({ setView: true, maxZoom: map.getMaxZoom(), watch })\n\t\t}, [map, setIsLocating, watch])\n\n\t\tconst stopLocating = useCallback(() => {\n\t\t\t\tstopRequestRef.current?.()\n\t\t\t\tsetWatching(false)\n\t\t\t\tsetLocation(null)\n\t\t\t\tsetIsLocating(false)\n\t\t}, [setIsLocating])\n\t\tconst trackingHandler = isTracking ? stopLocating : startLocating\n\t\tconst trackingTitle = isLocating\n\t\t\t\t? strings.locating\n\t\t\t\t: isTracking\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: isTracking\n\t\t\t\t\t? strings.stopLocationTracking\n\t\t\t\t\t: strings.startLocationTracking\n\t\tconst locationMarker =\n\t\t\t\tlocation ? (\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(() => {\n\t\t\t\tsetWatching(false)\n\t\t\t\tsetLocation(null)\n\t\t\t\tsetIsLocating(false)\n\t\t\t\treturn () => stopRequestRef.current?.()\n\t\t}, [map, setIsLocating])\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={isTracking ? \"primary\" : \"secondary\"}\n\t\t\t\t\t\t\t\tbuttonStyle={isTracking ? \"solid\" : \"outline\"}\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={isTracking ? mapControlActiveSurface : mapControlSurface}\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 createDrawToolRef = useRef(createDrawTool)\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\tcreateDrawToolRef.current = createDrawTool\n\t\t}, [createDrawTool])\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 = createDrawToolRef.current(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])\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(isActive ? mapControlActiveSurface : mapControlSurface, className)}\n\t\t\t\t\t\ttone={isActive ? \"primary\" : \"secondary\"}\n\t\t\t\t\t\tbuttonStyle={isActive ? \"solid\" : \"outline\"}\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 createDrawToolRef = useRef(createDrawTool)\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\tcreateDrawToolRef.current = createDrawTool\n\t\t}, [createDrawTool])\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 = createDrawToolRef.current(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, 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\tbuttonStyle={isActive ? \"solid\" : \"outline\"}\n\t\t\t\t\t\tdisabled={!hasFeatures}\n\t\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\t\tclassName={cn(isActive ? mapControlActiveSurface : mapControlSurface, 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\tbuttonStyle=\"outline\"\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(mapControlSurface, 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\n\t\treturn useMemo(() => {\n\t\t\t\tif (!L) return null\n\t\t\t\treturn L.divIcon({\n\t\t\t\t\t\ticonAnchor: [8, 8],\n\t\t\t\t\t\thtml: renderToString(\n\t\t\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\t\t),\n\t\t\t\t})\n\t\t}, [L])\n}\n\nfunction useLeaflet() {\n\t\tconst [L, setL] = useState<LeafletModule | null>(null)\n\t\tconst [LeafletDraw, setLeafletDraw] = useState<LeafletDrawModule | null>(\n\t\t\t\tnull\n\t\t)\n\n\t\tuseEffect(() => {\n\t\t\t\tasync function loadLeaflet() {\n\t\t\t\t\t\tconst leaflet = await import(\"leaflet\")\n\t\t\t\t\t\tconst leafletFullscreen = await import(\"leaflet.fullscreen\")\n\t\t\t\t\t\tconst leafletDraw = await import(\"leaflet-draw\")\n\n\t\t\t\t\t\tconst L_object = leaflet.default\n\t\t\t\t\t\tif (L_object.Control && !L_object.Control.FullScreen) {\n\t\t\t\t\t\t\t\tL_object.Control.FullScreen =\n\t\t\t\t\t\t\t\t\t\tleafletFullscreen.default || leafletFullscreen\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsetLeafletDraw(leafletDraw)\n\t\t\t\t\t\tsetL(L_object)\n\t\t\t\t}\n\n\t\t\t\tif (L && LeafletDraw) return\n\t\t\t\tif (typeof window === \"undefined\") return\n\n\t\t\t\tvoid loadLeaflet()\n\t\t}, [L, LeafletDraw])\n\n\t\treturn { L, LeafletDraw }\n}\n\n/**\n * Delays the *appearance* of a loading indicator so a fast lookup never\n * flashes a spinner. Not a debounce: it neither collapses a burst of calls\n * nor defers the work itself, so `useDebouncedCallback` does not apply.\n */\nfunction useDelayedLoadingState(delay = 200) {\n\t\tconst [isLoading, setIsLoading] = useState(false)\n\t\tconst [showLoading, setShowLoading] = useState(false)\n\t\tconst timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n\t\tuseEffect(() => {\n\t\t\t\tif (isLoading) {\n\t\t\t\t\t\ttimeoutRef.current = setTimeout(() => {\n\t\t\t\t\t\t\t\tsetShowLoading(true)\n\t\t\t\t\t\t}, delay)\n\t\t\t\t} else {\n\t\t\t\t\t\tif (timeoutRef.current) {\n\t\t\t\t\t\t\t\tclearTimeout(timeoutRef.current)\n\t\t\t\t\t\t\t\ttimeoutRef.current = null\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetShowLoading(false)\n\t\t\t\t}\n\n\t\t\t\treturn () => {\n\t\t\t\t\t\tif (timeoutRef.current) {\n\t\t\t\t\t\t\t\tclearTimeout(timeoutRef.current)\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t}, [isLoading, delay])\n\n\t\treturn [showLoading, setIsLoading] as const\n}\n\nexport {\n\t\tMap,\n\t\tMapCircle,\n\t\tMapCircleMarker,\n\t\tMapControlContainer,\n\t\tMapDrawCircle,\n\t\tMapDrawControl,\n\t\tMapDrawDelete,\n\t\tMapDrawEdit,\n\t\tMapDrawMarker,\n\t\tMapDrawPolygon,\n\t\tMapDrawPolyline,\n\t\tMapDrawRectangle,\n\t\tMapDrawUndo,\n\t\tMapFeatureGroup,\n\t\tMapFullscreenControl,\n\t\tMapLayerGroup,\n\t\tMapLayers,\n\t\tMapLayersControl,\n\t\tMapLocateControl,\n\t\tMapMarker,\n\t\tMapMarkerClusterGroup,\n\t\tMapPolygon,\n\t\tMapPolyline,\n\t\tMapPopup,\n\t\tMapRectangle,\n\t\tMapSearchControl,\n\t\tMapTileLayer,\n\t\tMapTooltip,\n\t\tMapZoomControl,\n\t\tuseLeaflet,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2EA,IAAMgC,KAA4D;CAChE,mBAAmB;CACnB,SAAS;CACT,OAAO;CACP,OAAO;CACP,WAAW;CACX,cAAc;AAChB;AAwDA,SAASC,GAAc,GAAoC;CACzD,IAAMC,IAAQ,CAAC;CA0Bf,OAxBIC,EAAW,QACbD,EAAM,KAAKC,EAAW,IAAI,GAGxBA,EAAW,eAAeA,EAAW,SACvCD,EAAM,KAAK,GAAGC,EAAW,YAAY,GAAGA,EAAW,QAAQ,IAClDA,EAAW,UACpBD,EAAM,KAAKC,EAAW,MAAM,GAG1BA,EAAW,OACbD,EAAM,KAAKC,EAAW,IAAI,IACjBA,EAAW,YACpBD,EAAM,KAAKC,EAAW,QAAQ,GAG5BA,EAAW,SAASA,EAAW,UAAUA,EAAW,QACtDD,EAAM,KAAKC,EAAW,KAAK,GAGzBA,EAAW,WACbD,EAAM,KAAKC,EAAW,OAAO,GAGxB,CAAC,GAAG,IAAI,IAAID,CAAK,CAA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