From 688721440283580397f40203dc3920d6802fc645 Mon Sep 17 00:00:00 2001 From: Leon Date: Fri, 30 Jan 2026 10:01:19 +0100 Subject: [PATCH] feat: use only meilisearch for hunts --- .../Resources/Hunts/HuntsResource.php | 49 ++++++++- app/Http/Controllers/HuntsController.php | 101 ++++++++---------- app/Models/Hunts.php | 43 +++++++- composer.json | 1 + composer.lock | 78 +++++++++++++- config/scout.php | 21 +++- .../filament-map-picker-styles.css | 2 + .../filament-map-picker-scripts.js | 9 ++ 8 files changed, 238 insertions(+), 66 deletions(-) create mode 100644 public/css/dotswan/filament-map-picker/filament-map-picker-styles.css create mode 100644 public/js/dotswan/filament-map-picker/filament-map-picker-scripts.js diff --git a/app/Filament/Resources/Hunts/HuntsResource.php b/app/Filament/Resources/Hunts/HuntsResource.php index 2fd50e7..71434ec 100644 --- a/app/Filament/Resources/Hunts/HuntsResource.php +++ b/app/Filament/Resources/Hunts/HuntsResource.php @@ -23,7 +23,8 @@ use Filament\Schemas\Schema; use Filament\Tables; use Filament\Tables\Table; use Illuminate\Database\Eloquent\Builder; - +use Dotswan\MapPicker\Fields\Map; +use Filament\Resources\Forms\Form; class HuntsResource extends Resource { public static function getEloquentQuery(): Builder @@ -65,12 +66,50 @@ class HuntsResource extends Resource TextInput::make('city') ->required() ->maxLength(255), + Forms\Components\Hidden::make('latitude'), + Forms\Components\Hidden::make('longitude'), DateTimePicker::make('start_at'), DateTimePicker::make('end_at'), - TextInput::make('latitude') - ->numeric(), - TextInput::make('longitude') - ->numeric(), + + // Map + Map::make('location') + ->label('Location') + ->columnSpanFull() + // Basic Configuration + ->defaultLocation(latitude: 40.4168, longitude: -3.7038) + ->draggable(true) + ->clickable(true) // click to move marker + ->zoom(15) + ->minZoom(0) + ->maxZoom(28) + ->tilesUrl("https://tile.openstreetmap.org/{z}/{x}/{y}.png") + ->detectRetina(true) + + ->showFullscreenControl(false) + ->showZoomControl(true) + + // Location Features + ->showMyLocationButton(true) + ->boundaries(true, 49.5, -11, 61, 2) + ->rangeSelectField('distance') + + // Extra Customization + ->extraStyles([ + 'border-radius: 10px' + ]) + // State Management + ->afterStateUpdated(function ($set, ?array $state): void { + $set('latitude', $state['lat']); + $set('longitude', $state['lng']); + }) + ->afterStateHydrated(function ($state, $record, $set): void { + if ($record && $record->latitude && $record->longitude) { + $set('location', [ + 'lat' => $record->latitude, + 'lng' => $record->longitude, + ]); + } + }) ]); } diff --git a/app/Http/Controllers/HuntsController.php b/app/Http/Controllers/HuntsController.php index 06a2d80..12fb593 100644 --- a/app/Http/Controllers/HuntsController.php +++ b/app/Http/Controllers/HuntsController.php @@ -21,24 +21,17 @@ class HuntsController extends Controller { try { $searchTerm = $this->resolveSearchTerm($request); + + // Construire les filtres Meilisearch + $filters = $this->buildMeilisearchFilters($request); - if ($searchTerm !== null) { - $hunts = Hunts::search($searchTerm) - ->query(fn (Builder $query) => $this->applyHuntFilters( - $query->with('participants:id,avatar_uri'), - $request - )) - ->paginate(10); - - return response()->json($hunts); - } - - $query = $this->applyHuntFilters( - Hunts::with('participants:id,avatar_uri'), - $request - ); - - $hunts = $query->paginate(10); + // Toujours utiliser Meilisearch (avec ou sans terme de recherche) + $hunts = Hunts::search($searchTerm ?? '') + ->options([ + 'filter' => $filters, + ]) + ->query(fn ($query) => $query->with('participants:id,avatar_uri')) + ->paginate(10); return response()->json($hunts); } catch (\Throwable $e) { @@ -51,8 +44,14 @@ class HuntsController extends Controller } } - private function applyHuntFilters(Builder $query, Request $request): Builder + /** + * Build Meilisearch filter string from request parameters + */ + private function buildMeilisearchFilters(Request $request): string { + $filters = []; + + // Filtre "participating" (hunts auxquels l'utilisateur participe ou non) if ($request->has('participating')) { $participating = filter_var( $request->query('participating'), @@ -62,58 +61,44 @@ class HuntsController extends Controller $userId = auth('sanctum')->id(); - Log::info('Participating filter resolved', [ - 'participating' => $participating, - 'user_id' => $userId, - ]); - - if (! $userId) { + if ($userId) { if ($participating === true) { - $query->whereRaw('1 = 0'); - } - } else { - if ($participating === true) { - $query->whereHas('participants', function ($q) use ($userId) { - $q->where('user_id', $userId); - }); - } else { - $query->whereDoesntHave('participants', function ($q) use ($userId) { - $q->where('user_id', $userId); - }); + $filters[] = "participant_ids = {$userId}"; + } elseif ($participating === false) { + $filters[] = "participant_ids != {$userId}"; } + } elseif ($participating === true) { + // User non authentifié mais demande ses participations -> retourne rien + $filters[] = "id < 0"; // Impossible, retourne 0 résultat } } + // Filtre "active" (hunts actuellement actifs ou non) if ($request->has('active')) { - $now = Carbon::now(); + $now = Carbon::now()->timestamp; $active = filter_var($request->query('active'), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); if ($active === true) { - $query->where('start_at', '<=', $now) - ->where(function ($q) use ($now) { - $q->whereNull('end_at') - ->orWhere('end_at', '>=', $now); - }); + // Hunt actif : start_at <= now AND (end_at IS NULL OR end_at >= now) + $filters[] = "start_at_timestamp <= {$now}"; + $filters[] = "(end_at_timestamp >= {$now} OR end_at_timestamp IS NULL)"; } else { - $query->where(function ($q) use ($now) { - $q->whereNull('start_at') - ->orWhere('start_at', '>', $now) - ->orWhere(function ($q2) use ($now) { - $q2->whereNotNull('end_at') - ->where('end_at', '<', $now); - }); - }); + // Hunt inactif : start_at > now OU end_at < now + $filters[] = "(start_at_timestamp > {$now} OR end_at_timestamp < {$now})"; } } + // Filtre "city" (recherche par ville) if ($request->filled('city')) { $city = $request->query('city'); if (is_string($city)) { - $query->where('city', 'like', '%'.$city.'%'); + $city = addslashes($city); // Échapper les guillemets + $filters[] = "city = \"{$city}\""; } } + // Filtre "difficulty" (niveau de difficulté) if ($request->filled('difficulty')) { $difficulties = $request->query('difficulty'); @@ -128,35 +113,39 @@ class HuntsController extends Controller )); if (! empty($validDifficulties)) { - $query->whereIn('difficulty', $validDifficulties); + $difficultyFilters = array_map(fn($d) => "difficulty = \"{$d}\"", $validDifficulties); + $filters[] = '('.implode(' OR ', $difficultyFilters).')'; } } } + // Filtres de dates $startFrom = $this->parseDateFilter($request->query('start_from')); $startTo = $this->parseDateFilter($request->query('start_to')); $endFrom = $this->parseDateFilter($request->query('end_from')); $endTo = $this->parseDateFilter($request->query('end_to')); if ($startFrom) { - $query->where('start_at', '>=', $startFrom); + $filters[] = "start_at_timestamp >= {$startFrom->timestamp}"; } if ($startTo) { - $query->where('start_at', '<=', $startTo); + $filters[] = "start_at_timestamp <= {$startTo->timestamp}"; } if ($endFrom) { - $query->where('end_at', '>=', $endFrom); + $filters[] = "end_at_timestamp >= {$endFrom->timestamp}"; } if ($endTo) { - $query->where('end_at', '<=', $endTo); + $filters[] = "end_at_timestamp <= {$endTo->timestamp}"; } - return $query; + // Joindre tous les filtres avec AND + return implode(' AND ', $filters); } + private function resolveSearchTerm(Request $request): ?string { $searchTerm = $request->query('search') ?? $request->query('q'); diff --git a/app/Models/Hunts.php b/app/Models/Hunts.php index ac130b6..1d3249e 100644 --- a/app/Models/Hunts.php +++ b/app/Models/Hunts.php @@ -58,6 +58,31 @@ class Hunts extends Model ->withTimestamps(); } + /** + * Configure Meilisearch index settings + */ + public function searchableOptions(): array + { + return [ + 'filterableAttributes' => [ + 'city', + 'difficulty', + 'status', + 'is_public', + 'creator_id', + 'participant_ids', + 'start_at_timestamp', + 'end_at_timestamp', + 'created_at_timestamp', + ], + 'sortableAttributes' => [ + 'start_at_timestamp', + 'end_at_timestamp', + 'created_at_timestamp', + ], + ]; + } + /** * @return array{ * id: int, @@ -68,8 +93,15 @@ class Hunts extends Model * status: string, * difficulty: string, * is_public: bool, + * creator_id: int, + * latitude: float|null, + * longitude: float|null, * start_at: string|null, - * end_at: string|null + * end_at: string|null, + * start_at_timestamp: int|null, + * end_at_timestamp: int|null, + * created_at_timestamp: int, + * participant_ids: array * } */ public function toSearchableArray(): array @@ -86,8 +118,17 @@ class Hunts extends Model 'status' => $status, 'difficulty' => $difficulty, 'is_public' => $this->is_public, + 'creator_id' => $this->creator_id, + 'latitude' => $this->latitude, + 'longitude' => $this->longitude, 'start_at' => $this->start_at?->toAtomString(), 'end_at' => $this->end_at?->toAtomString(), + // Timestamps Unix pour les filtres de date dans Meilisearch + 'start_at_timestamp' => $this->start_at?->timestamp, + 'end_at_timestamp' => $this->end_at?->timestamp, + 'created_at_timestamp' => $this->created_at->timestamp, + // IDs des participants pour le filtre de participation + 'participant_ids' => $this->participants()->pluck('user_id')->toArray(), ]; } } diff --git a/composer.json b/composer.json index 7dc9b18..db777df 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ "require": { "php": "^8.2", "dedoc/scramble": "^0.13.5", + "dotswan/filament-map-picker": "*", "fakerphp/faker": "^1.23", "filament/filament": "^4.0", "http-interop/http-factory-guzzle": "*", diff --git a/composer.lock b/composer.lock index 6cda413..e6e2a31 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1b380d582f2a52b93929fa0d443b0384", + "content-hash": "8632b5fc1053d477088663c92da4db8c", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -937,6 +937,82 @@ ], "time": "2024-02-05T11:56:58+00:00" }, + { + "name": "dotswan/filament-map-picker", + "version": "v2.1.3", + "source": { + "type": "git", + "url": "https://github.com/dotswan/filament-map-picker.git", + "reference": "15bb9a4e32b66bfb8a34bbe98b9df4ec9d01da8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dotswan/filament-map-picker/zipball/15bb9a4e32b66bfb8a34bbe98b9df4ec9d01da8b", + "reference": "15bb9a4e32b66bfb8a34bbe98b9df4ec9d01da8b", + "shasum": "" + }, + "require": { + "filament/filament": "^4.0", + "illuminate/contracts": "^10.0 || ^11.0 || ^12.0", + "php": "^8.2", + "spatie/laravel-package-tools": "^1.19.0" + }, + "require-dev": { + "laravel/pint": "^1.0", + "nunomaduro/collision": "^7", + "orchestra/testbench": "^8.0|^9.0|^10.0", + "pestphp/pest": "^2.1|^3.1", + "pestphp/pest-plugin-arch": "^2.0", + "pestphp/pest-plugin-laravel": "^2.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "MapPicker": "Dotswan\\MapPicker\\Facades\\MapPicker" + }, + "providers": [ + "Dotswan\\MapPicker\\MapPickerServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Dotswan\\MapPicker\\": "src/", + "Dotswan\\MapPicker\\Database\\Factories\\": "database/factories/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dotswan", + "email": "tech@dotswan.com", + "role": "Developer" + } + ], + "description": "Easily pick and retrieve geo-coordinates using a map-based interface in your Filament applications.", + "homepage": "https://github.com/dotswan/filament-map-picker", + "keywords": [ + "dotswan", + "filament", + "filament-map-picker", + "filament-v4", + "filamentphp", + "laravel", + "map-picker" + ], + "support": { + "issues": "https://github.com/dotswan/filament-map-picker/issues", + "source": "https://github.com/dotswan/filament-map-picker" + }, + "time": "2025-12-25T07:10:54+00:00" + }, { "name": "dragonmantank/cron-expression", "version": "v3.6.0", diff --git a/config/scout.php b/config/scout.php index d4e2c6f..1866f34 100644 --- a/config/scout.php +++ b/config/scout.php @@ -140,9 +140,24 @@ return [ 'host' => env('MEILISEARCH_HOST', 'http://localhost:7700'), 'key' => env('MEILISEARCH_KEY'), 'index-settings' => [ - // 'users' => [ - // 'filterableAttributes'=> ['id', 'name', 'email'], - // ], + 'hunts' => [ + 'filterableAttributes' => [ + 'city', + 'difficulty', + 'status', + 'is_public', + 'creator_id', + 'participant_ids', + 'start_at_timestamp', + 'end_at_timestamp', + 'created_at_timestamp', + ], + 'sortableAttributes' => [ + 'start_at_timestamp', + 'end_at_timestamp', + 'created_at_timestamp', + ], + ], ], ], diff --git a/public/css/dotswan/filament-map-picker/filament-map-picker-styles.css b/public/css/dotswan/filament-map-picker/filament-map-picker-styles.css new file mode 100644 index 0000000..d23c80c --- /dev/null +++ b/public/css/dotswan/filament-map-picker/filament-map-picker-styles.css @@ -0,0 +1,2 @@ +/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.block{display:block}.hidden{display:none}.inline{display:inline}.table{display:table}.w-full{width:100%}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.resize{resize:both}.border{border-style:var(--tw-border-style);border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;top:0;left:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:0 0}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{-webkit-transform-origin:0 0;width:1600px;height:1600px}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{width:auto;padding:0;max-width:none!important;max-height:none!important}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:#33b5e566}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{box-sizing:border-box;z-index:800;width:0;height:0}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{z-index:800;pointer-events:visiblePainted;pointer-events:auto;position:relative}.leaflet-top,.leaflet-bottom{z-index:1000;pointer-events:none;position:absolute}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{outline-offset:1px;background:#ddd}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{background:#ffffff80;border:2px dotted #38f}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:.75rem;line-height:1.5}.leaflet-bar{border-radius:4px;box-shadow:0 1px 5px #000000a6}.leaflet-bar a{text-align:center;color:#000;background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;text-decoration:none;display:block}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom:none;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.leaflet-bar a.leaflet-disabled{cursor:default;color:#bbb;background-color:#f4f4f4}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-right-radius:2px;border-bottom-left-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{text-indent:1px;font:700 18px Lucida Console,Monaco,monospace}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{background:#fff;border-radius:5px;box-shadow:0 1px 5px #0006}.leaflet-control-layers-toggle{background-image:url(images/layers.png);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(images/layers-2x.png);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{color:#333;background:#fff;padding:6px 10px 6px 6px}.leaflet-control-layers-scrollbar{padding-right:5px;overflow:hidden scroll}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{font-size:1.08333em;display:block}.leaflet-control-layers-separator{border-top:1px solid #ddd;height:0;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(images/marker-icon.png)}.leaflet-container .leaflet-control-attribution{background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{color:#333;padding:0 5px;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{width:1em;height:.6669em;vertical-align:baseline!important;display:inline!important}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{white-space:nowrap;box-sizing:border-box;text-shadow:1px 1px #fff;background:#fffc;border:2px solid #777;border-top:none;padding:2px 5px 1px;line-height:1.1}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{background-clip:padding-box;border:2px solid #0003}.leaflet-popup{text-align:center;margin-bottom:20px;position:absolute}.leaflet-popup-content-wrapper{text-align:left;border-radius:12px;padding:1px}.leaflet-popup-content{min-height:1px;margin:13px 24px 13px 20px;font-size:1.08333em;line-height:1.3}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{pointer-events:none;width:40px;height:20px;margin-top:-1px;margin-left:-20px;position:absolute;left:50%;overflow:hidden}.leaflet-popup-tip{pointer-events:auto;width:17px;height:17px;margin:-10px auto 0;padding:1px;transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{color:#333;background:#fff;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{text-align:center;color:#757575;background:0 0;border:none;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;text-decoration:none;position:absolute;top:0;right:0}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";width:24px;filter:progid:DXImageTransform.Microsoft.Matrix(M11=.707107,M12=.707107,M21=-.707107,M22=.707107);margin:0 auto}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{color:#222;white-space:nowrap;-webkit-user-select:none;user-select:none;pointer-events:none;background-color:#fff;border:1px solid #fff;border-radius:3px;padding:6px;position:absolute;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{pointer-events:none;content:"";background:0 0;border:6px solid #0000;position:absolute}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{margin-left:-6px;left:50%}.leaflet-tooltip-top:before{border-top-color:#fff;margin-bottom:-12px;bottom:0}.leaflet-tooltip-bottom:before{border-bottom-color:#fff;margin-top:-12px;margin-left:-6px;top:0}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{margin-top:-6px;top:50%}.leaflet-tooltip-left:before{border-left-color:#fff;margin-right:-12px;right:0}.leaflet-tooltip-right:before{border-right-color:#fff;margin-left:-12px;left:0}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}.leaflet-control-fullscreen a{background:#fff url(fullscreen.png) 0 0/26px 52px no-repeat}.leaflet-touch .leaflet-control-fullscreen a{background-position:2px 2px}.leaflet-fullscreen-on .leaflet-control-fullscreen a{background-position:0 -26px}.leaflet-touch.leaflet-fullscreen-on .leaflet-control-fullscreen a{background-position:2px -24px}.leaflet-container:-webkit-full-screen{width:100%!important;height:100%!important}.leaflet-container.leaflet-fullscreen-on{width:100%!important;height:100%!important}.leaflet-pseudo-fullscreen{z-index:99999;width:100%!important;height:100%!important;position:fixed!important;top:0!important;left:0!important}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.leaflet-control-fullscreen a{background-image:url(fullscreen@2x.png)}}.marker-icon{background-color:#fff;border:1px solid #38f;border-radius:50%;outline:0;transition:opacity .3s;width:14px!important;height:14px!important;margin:-8px 0 0 -8px!important}.marker-icon-middle{opacity:.7;width:10px!important;height:10px!important;margin:-6px 0 0 -6px!important}.leaflet-pm-draggable{cursor:move!important}.cursor-marker{cursor:crosshair;pointer-events:none;opacity:0}.cursor-marker.visible{opacity:1!important}.geoman-draw-cursor,.geoman-draw-cursor .leaflet-interactive{cursor:crosshair}.rect-style-marker,.rect-start-marker{opacity:0}.rect-style-marker.visible,.rect-start-marker.visible{opacity:1!important}.vertexmarker-disabled{opacity:.7}.pm-text-marker{width:0;height:0}.pm-textarea{box-sizing:content-box;color:#000;resize:none;cursor:pointer;background-color:#fff;border:none;border-radius:3px;outline:0;padding-top:4px;padding-bottom:0;padding-left:7px}.leaflet-pm-draggable .pm-textarea{cursor:move}.pm-textarea:focus,.pm-textarea:focus-within,.pm-textarea:focus-visible,.pm-textarea:active{border:2px solid #000;outline:0}.pm-textarea.pm-disabled{-webkit-user-select:none;user-select:none;border:none}.pm-textarea.pm-hasfocus{cursor:auto}.leaflet-pm-toolbar .leaflet-buttons-control-button{box-sizing:border-box;z-index:3;padding:5px;position:relative}.leaflet-pm-toolbar .leaflet-pm-actions-container a.leaflet-pm-action:first-child:not(.pos-right),.leaflet-pm-toolbar .leaflet-pm-actions-container a.leaflet-pm-action:last-child.pos-right,.leaflet-pm-toolbar .button-container a.leaflet-buttons-control-button{border-radius:0}.leaflet-pm-toolbar .button-container:last-child a.leaflet-buttons-control-button{border-radius:0 0 2px 2px}.leaflet-pm-toolbar .button-container:first-child a.leaflet-buttons-control-button{border-radius:2px 2px 0 0}.leaflet-pm-toolbar .button-container:last-child a.leaflet-buttons-control-button{border-bottom:none}.leaflet-pm-toolbar .control-fa-icon{font-size:19px;line-height:24px}.leaflet-pm-toolbar .control-icon{box-sizing:border-box;background-position:50%;background-repeat:no-repeat;background-size:contain;width:100%;height:100%}.leaflet-pm-toolbar .leaflet-pm-icon-marker{background-image:url("data:image/svg+xml,%0A%0A %0A Atoms/Icons/Tools/Marker%0A Created with Sketch.%0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A")}.leaflet-pm-toolbar .leaflet-pm-icon-polygon{background-image:url("data:image/svg+xml,%0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A%0A")}.leaflet-pm-toolbar .leaflet-pm-icon-polyline{background-image:url("data:image/svg+xml,%0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A%0A")}.leaflet-pm-toolbar .leaflet-pm-icon-circle{background-image:url("data:image/svg+xml,%0A%0A %0A Atoms/Icons/Tools/Circle%0A Created with Sketch.%0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A")}.leaflet-pm-toolbar .leaflet-pm-icon-circle-marker{background-image:url("data:image/svg+xml,%0A%0A%0A%0A %0A")}.leaflet-pm-toolbar .leaflet-pm-icon-rectangle{background-image:url("data:image/svg+xml,%0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A%0A")}.leaflet-pm-toolbar .leaflet-pm-icon-delete{background-image:url("data:image/svg+xml,%0A%0A %0A Atoms/Icons/Tools/Eraser%0A Created with Sketch.%0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A")}.leaflet-pm-toolbar .leaflet-pm-icon-edit{background-image:url("data:image/svg+xml,%0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A%0A")}.leaflet-pm-toolbar .leaflet-pm-icon-drag{background-image:url("data:image/svg+xml,%0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A%0A")}.leaflet-pm-toolbar .leaflet-pm-icon-cut{background-image:url("data:image/svg+xml,%0A%0A %0A Atoms/Icons/Tools/Scissors%0A Created with Sketch.%0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A")}.leaflet-pm-toolbar .leaflet-pm-icon-snapping{background-image:url("data:image/svg+xml,%0A%0A %0A Atoms/Icons/Tools/Magnet%0A Created with Sketch.%0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A")}.leaflet-pm-toolbar .leaflet-pm-icon-rotate{background-image:url("data:image/svg+xml,%0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A %0A%0A")}.leaflet-pm-toolbar .leaflet-pm-icon-text{background-image:url("data:image/svg+xml,Text")}.leaflet-buttons-control-button:hover,.leaflet-buttons-control-button:focus{cursor:pointer;background-color:#f4f4f4}.active>.leaflet-buttons-control-button{box-shadow:inset 0 -1px 5px 2px #514d4d4f}.leaflet-buttons-control-text-hide{display:none}.button-container{position:relative}.button-container .leaflet-pm-actions-container{z-index:2;white-space:nowrap;direction:ltr;display:none;position:absolute;top:0;left:100%}.leaflet-right .leaflet-pm-toolbar .button-container .leaflet-pm-actions-container{left:auto;right:100%}.button-container.active .leaflet-pm-actions-container{display:block}.button-container .leaflet-pm-actions-container:not(.pos-right) a.leaflet-pm-action:last-child{border-right:0;border-radius:0 3px 3px 0}.button-container .leaflet-pm-actions-container.pos-right a.leaflet-pm-action:first-child{border-radius:3px 0 0 3px}.button-container .leaflet-pm-actions-container.pos-right a.leaflet-pm-action:last-child{border-right:0}.button-container .leaflet-pm-actions-container .leaflet-pm-action{color:#fff;-webkit-user-select:none;user-select:none;vertical-align:middle;background-color:#666;border-bottom:none;border-right:1px solid #eee;width:auto;height:29px;padding:0 10px;line-height:29px;display:inline-block}.leaflet-pm-toolbar .button-container:first-child.pos-right.active a.leaflet-buttons-control-button{border-top-left-radius:0}.leaflet-pm-toolbar .button-container:first-child.active:not(.pos-right) a.leaflet-buttons-control-button{border-top-right-radius:0}.button-container .leaflet-pm-actions-container .leaflet-pm-action:hover,.button-container .leaflet-pm-actions-container .leaflet-pm-action:focus{cursor:pointer;background-color:#777}.button-container .leaflet-pm-actions-container .leaflet-pm-action.active-action{background-color:#8e8e8e}.leaflet-pm-toolbar.activeChild{z-index:801}.leaflet-buttons-control-button.pm-disabled{background-color:#f4f4f4}.leaflet-buttons-control-button.pm-disabled>.control-icon{filter:opacity(.6)}.button-container .leaflet-pm-actions-container .pm-action-button-mode.control-icon{filter:brightness(0)invert();width:18px}.map-icon{stroke:#dbeafe}.map-location-button{cursor:pointer;z-index:23332;color:#c83a3a;border:none;border-radius:50%;justify-content:center;align-items:center;width:40px;height:40px;display:flex;position:absolute;bottom:20px;right:20px;box-shadow:0 2px 4px #0003;background-color:#eee!important}.map-location-button svg{fill:#333;width:24px;height:24px}.leaflet-pane,.leaflet-tile-pane,.leaflet-overlay-pane,.leaflet-shadow-pane,.leaflet-marker-pane,.leaflet-tooltip-pane,.leaflet-popup-pane,.leaflet-map-pane canvas,.leaflet-map-pane svg,.leaflet-control,.leaflet-top,.leaflet-bottom,.map-location-button{z-index:auto!important}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false} \ No newline at end of file diff --git a/public/js/dotswan/filament-map-picker/filament-map-picker-scripts.js b/public/js/dotswan/filament-map-picker/filament-map-picker-scripts.js new file mode 100644 index 0000000..ba3cedf --- /dev/null +++ b/public/js/dotswan/filament-map-picker/filament-map-picker-scripts.js @@ -0,0 +1,9 @@ +var Go=Object.create;var Qa=Object.defineProperty;var Zo=Object.getOwnPropertyDescriptor;var jo=Object.getOwnPropertyNames;var Uo=Object.getPrototypeOf,Vo=Object.prototype.hasOwnProperty;var Ho=(j,$,V)=>$ in j?Qa(j,$,{enumerable:!0,configurable:!0,writable:!0,value:V}):j[$]=V;var Ko=(j,$)=>()=>($||j(($={exports:{}}).exports,$),$.exports);var qo=(j,$,V,W)=>{if($&&typeof $=="object"||typeof $=="function")for(let J of jo($))!Vo.call(j,J)&&J!==V&&Qa(j,J,{get:()=>$[J],enumerable:!(W=Zo($,J))||W.enumerable});return j};var Wo=(j,$,V)=>(V=j!=null?Go(Uo(j)):{},qo($||!j||!j.__esModule?Qa(V,"default",{value:j,enumerable:!0}):V,j));var it=(j,$,V)=>Ho(j,typeof $!="symbol"?$+"":$,V);var po=Ko((na,co)=>{(function(j,$){typeof na=="object"&&typeof co<"u"?$(na):typeof define=="function"&&define.amd?define(["exports"],$):(j=typeof globalThis<"u"?globalThis:j||self,$(j.leaflet={}))})(na,function(j){"use strict";var $="1.9.4";function V(t){var n,o,u,c;for(o=1,u=arguments.length;o"u"||!L||!L.Mixin)){t=le(t)?t:[t];for(var n=0;n0?Math.floor(t):Math.ceil(t)};ut.prototype={clone:function(){return new ut(this.x,this.y)},add:function(t){return this.clone()._add(at(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(at(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new ut(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new ut(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=$n(this.x),this.y=$n(this.y),this},distanceTo:function(t){t=at(t);var n=t.x-this.x,o=t.y-this.y;return Math.sqrt(n*n+o*o)},equals:function(t){return t=at(t),t.x===this.x&&t.y===this.y},contains:function(t){return t=at(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+$t(this.x)+", "+$t(this.y)+")"}};function at(t,n,o){return t instanceof ut?t:le(t)?new ut(t[0],t[1]):t==null?t:typeof t=="object"&&"x"in t&&"y"in t?new ut(t.x,t.y):new ut(t,n,o)}function Pt(t,n){if(t)for(var o=n?[t,n]:t,u=0,c=o.length;u=this.min.x&&o.x<=this.max.x&&n.y>=this.min.y&&o.y<=this.max.y},intersects:function(t){t=zt(t);var n=this.min,o=this.max,u=t.min,c=t.max,m=c.x>=n.x&&u.x<=o.x,M=c.y>=n.y&&u.y<=o.y;return m&&M},overlaps:function(t){t=zt(t);var n=this.min,o=this.max,u=t.min,c=t.max,m=c.x>n.x&&u.xn.y&&u.y=n.lat&&c.lat<=o.lat&&u.lng>=n.lng&&c.lng<=o.lng},intersects:function(t){t=St(t);var n=this._southWest,o=this._northEast,u=t.getSouthWest(),c=t.getNorthEast(),m=c.lat>=n.lat&&u.lat<=o.lat,M=c.lng>=n.lng&&u.lng<=o.lng;return m&&M},overlaps:function(t){t=St(t);var n=this._southWest,o=this._northEast,u=t.getSouthWest(),c=t.getNorthEast(),m=c.lat>n.lat&&u.latn.lng&&u.lng1,fr=function(){var t=!1;try{var n=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",bt,n),window.removeEventListener("testPassiveEventSupport",bt,n)}catch{}return t}(),_r=function(){return!!document.createElement("canvas").getContext}(),dn=!!(document.createElementNS&&tr("svg").createSVGRect),_a=!!dn&&function(){var t=document.createElement("div");return t.innerHTML="",(t.firstChild&&t.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),ma=!dn&&function(){try{var t=document.createElement("div");t.innerHTML='';var n=t.firstChild;return n.style.behavior="url(#default#VML)",n&&typeof n.adj=="object"}catch{return!1}}(),mr=navigator.platform.indexOf("Mac")===0,ga=navigator.platform.indexOf("Linux")===0;function _e(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var et={ie:Ei,ielt9:er,edge:Bi,webkit:Pi,android:ir,android23:nr,androidStock:la,opera:un,chrome:rr,gecko:ar,safari:ha,phantom:or,opera12:ln,win:sr,ie3d:ur,webkit3d:Pe,gecko3d:lr,any3d:hr,mobile:xe,mobileWebkit:cr,mobileWebkit3d:hn,msPointer:dr,pointer:pr,touch:ca,touchNative:cn,mobileOpera:da,mobileGecko:pa,retina:fa,passiveEvents:fr,canvas:_r,svg:dn,vml:ma,inlineSvg:_a,mac:mr,linux:ga},pn=et.msPointer?"MSPointerDown":"pointerdown",gr=et.msPointer?"MSPointerMove":"pointermove",yr=et.msPointer?"MSPointerUp":"pointerup",vr=et.msPointer?"MSPointerCancel":"pointercancel",Ti={touchstart:pn,touchmove:gr,touchend:yr,touchcancel:vr},Lr={touchstart:fn,touchmove:We,touchend:We,touchcancel:We},qe={},br=!1;function ya(t,n,o){return n==="touchstart"&&Ca(),Lr[n]?(o=Lr[n].bind(this,o),t.addEventListener(Ti[n],o,!1),o):(console.warn("wrong event specified:",n),bt)}function va(t,n,o){if(!Ti[n]){console.warn("wrong event specified:",n);return}t.removeEventListener(Ti[n],o,!1)}function La(t){qe[t.pointerId]=t}function ba(t){qe[t.pointerId]&&(qe[t.pointerId]=t)}function Cr(t){delete qe[t.pointerId]}function Ca(){br||(document.addEventListener(pn,La,!0),document.addEventListener(gr,ba,!0),document.addEventListener(yr,Cr,!0),document.addEventListener(vr,Cr,!0),br=!0)}function We(t,n){if(n.pointerType!==(n.MSPOINTER_TYPE_MOUSE||"mouse")){n.touches=[];for(var o in qe)n.touches.push(qe[o]);n.changedTouches=[n],t(n)}}function fn(t,n){n.MSPOINTER_TYPE_TOUCH&&n.pointerType===n.MSPOINTER_TYPE_TOUCH&&Nt(n),We(t,n)}function xa(t){var n={},o,u;for(u in t)o=t[u],n[u]=o&&o.bind?o.bind(t):o;return t=n,n.type="dblclick",n.detail=2,n.isTrusted=!1,n._simulated=!0,n}var ka=200;function Ma(t,n){t.addEventListener("dblclick",n);var o=0,u;function c(m){if(m.detail!==1){u=m.detail;return}if(!(m.pointerType==="mouse"||m.sourceCapabilities&&!m.sourceCapabilities.firesTouchEvents)){var M=Er(m);if(!(M.some(function(G){return G instanceof HTMLLabelElement&&G.attributes.for})&&!M.some(function(G){return G instanceof HTMLInputElement||G instanceof HTMLSelectElement}))){var R=Date.now();R-o<=ka?(u++,u===2&&n(xa(m))):u=1,o=R}}}return t.addEventListener("click",c),{dblclick:n,simDblclick:c}}function wa(t,n){t.removeEventListener("dblclick",n.dblclick),t.removeEventListener("click",n.simDblclick)}var _n=Oi(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ci=Oi(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),xr=ci==="webkitTransition"||ci==="OTransition"?ci+"End":"transitionend";function kr(t){return typeof t=="string"?document.getElementById(t):t}function di(t,n){var o=t.style[n]||t.currentStyle&&t.currentStyle[n];if((!o||o==="auto")&&document.defaultView){var u=document.defaultView.getComputedStyle(t,null);o=u?u[n]:null}return o==="auto"?null:o}function gt(t,n,o){var u=document.createElement(t);return u.className=n||"",o&&o.appendChild(u),u}function Ct(t){var n=t.parentNode;n&&n.removeChild(t)}function Di(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function Re(t){var n=t.parentNode;n&&n.lastChild!==t&&n.appendChild(t)}function Ie(t){var n=t.parentNode;n&&n.firstChild!==t&&n.insertBefore(t,n.firstChild)}function mn(t,n){if(t.classList!==void 0)return t.classList.contains(n);var o=Ai(t);return o.length>0&&new RegExp("(^|\\s)"+n+"(\\s|$)").test(o)}function ht(t,n){if(t.classList!==void 0)for(var o=Ae(n),u=0,c=o.length;u0?2*window.devicePixelRatio:1;function Pr(t){return et.edge?t.wheelDeltaY/2:t.deltaY&&t.deltaMode===0?-t.deltaY/Pa:t.deltaY&&t.deltaMode===1?-t.deltaY*20:t.deltaY&&t.deltaMode===2?-t.deltaY*60:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?-t.detail*20:t.detail?t.detail/-32765*60:0}function Mn(t,n){var o=n.relatedTarget;if(!o)return!0;try{for(;o&&o!==t;)o=o.parentNode}catch{return!1}return o!==t}var Ta={__proto__:null,on:lt,off:xt,stopPropagation:Ge,disableScrollPropagation:Te,disableClickPropagation:mi,preventDefault:Nt,stop:Ze,getPropagationPath:Er,getMousePosition:Br,getWheelDelta:Pr,isExternalTarget:Mn,addListener:lt,removeListener:xt},Tr=li.extend({run:function(t,n,o,u){this.stop(),this._el=t,this._inProgress=!0,this._duration=o||.25,this._easeOutPower=1/Math.max(u||.5,.2),this._startPos=Ne(t),this._offset=n.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=qt(this._animate,this),this._step()},_step:function(t){var n=+new Date-this._startTime,o=this._duration*1e3;nthis.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,n){this._enforcingBounds=!0;var o=this.getCenter(),u=this._limitCenter(o,this._zoom,St(t));return o.equals(u)||this.panTo(u,n),this._enforcingBounds=!1,this},panInside:function(t,n){n=n||{};var o=at(n.paddingTopLeft||n.padding||[0,0]),u=at(n.paddingBottomRight||n.padding||[0,0]),c=this.project(this.getCenter()),m=this.project(t),M=this.getPixelBounds(),R=zt([M.min.add(o),M.max.subtract(u)]),G=R.getSize();if(!R.contains(m)){this._enforcingBounds=!0;var K=m.subtract(R.getCenter()),Y=R.extend(m).getSize().subtract(G);c.x+=K.x<0?-Y.x:Y.x,c.y+=K.y<0?-Y.y:Y.y,this.panTo(this.unproject(c),n),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=V({animate:!1,pan:!0},t===!0?{animate:!0}:t);var n=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var o=this.getSize(),u=n.divideBy(2).round(),c=o.divideBy(2).round(),m=u.subtract(c);return!m.x&&!m.y?this:(t.animate&&t.pan?this.panBy(m):(t.pan&&this._rawPanBy(m),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(J(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:n,newSize:o}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=V({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var n=J(this._handleGeolocationResponse,this),o=J(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(n,o,t):navigator.geolocation.getCurrentPosition(n,o,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){if(this._container._leaflet_id){var n=t.code,o=t.message||(n===1?"permission denied":n===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:n,message:"Geolocation error: "+o+"."})}},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var n=t.coords.latitude,o=t.coords.longitude,u=new vt(n,o),c=u.toBounds(t.coords.accuracy*2),m=this._locateOptions;if(m.setView){var M=this.getBoundsZoom(c);this.setView(u,m.maxZoom?Math.min(M,m.maxZoom):M)}var R={latlng:u,bounds:c,timestamp:t.timestamp};for(var G in t.coords)typeof t.coords[G]=="number"&&(R[G]=t.coords[G]);this.fire("locationfound",R)}},addHandler:function(t,n){if(!n)return this;var o=this[t]=new n(this);return this._handlers.push(o),this.options[t]&&o.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),Ct(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(jt(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var t;for(t in this._layers)this._layers[t].remove();for(t in this._panes)Ct(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,n){var o="leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),u=gt("div",o,n||this._mapPane);return t&&(this._panes[t]=u),u},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds(),n=this.unproject(t.getBottomLeft()),o=this.unproject(t.getTopRight());return new Wt(n,o)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,n,o){t=St(t),o=at(o||[0,0]);var u=this.getZoom()||0,c=this.getMinZoom(),m=this.getMaxZoom(),M=t.getNorthWest(),R=t.getSouthEast(),G=this.getSize().subtract(o),K=zt(this.project(R,u),this.project(M,u)).getSize(),Y=et.any3d?this.options.zoomSnap:1,rt=G.x/K.x,ct=G.y/K.y,Vt=n?Math.max(rt,ct):Math.min(rt,ct);return u=this.getScaleZoom(Vt,u),Y&&(u=Math.round(u/(Y/100))*(Y/100),u=n?Math.ceil(u/Y)*Y:Math.floor(u/Y)*Y),Math.max(c,Math.min(m,u))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new ut(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,n){var o=this._getTopLeftPoint(t,n);return new Pt(o,o.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(t===void 0?this.getZoom():t)},getPane:function(t){return typeof t=="string"?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,n){var o=this.options.crs;return n=n===void 0?this._zoom:n,o.scale(t)/o.scale(n)},getScaleZoom:function(t,n){var o=this.options.crs;n=n===void 0?this._zoom:n;var u=o.zoom(t*o.scale(n));return isNaN(u)?1/0:u},project:function(t,n){return n=n===void 0?this._zoom:n,this.options.crs.latLngToPoint(ft(t),n)},unproject:function(t,n){return n=n===void 0?this._zoom:n,this.options.crs.pointToLatLng(at(t),n)},layerPointToLatLng:function(t){var n=at(t).add(this.getPixelOrigin());return this.unproject(n)},latLngToLayerPoint:function(t){var n=this.project(ft(t))._round();return n._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(ft(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(St(t))},distance:function(t,n){return this.options.crs.distance(ft(t),ft(n))},containerPointToLayerPoint:function(t){return at(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return at(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var n=this.containerPointToLayerPoint(at(t));return this.layerPointToLatLng(n)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(ft(t)))},mouseEventToContainerPoint:function(t){return Br(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var n=this._container=kr(t);if(n){if(n._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");lt(n,"scroll",this._onScroll,this),this._containerId=I(n)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&et.any3d,ht(t,"leaflet-container"+(et.touch?" leaflet-touch":"")+(et.retina?" leaflet-retina":"")+(et.ielt9?" leaflet-oldie":"")+(et.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var n=di(t,"position");n!=="absolute"&&n!=="relative"&&n!=="fixed"&&n!=="sticky"&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),At(this._mapPane,new ut(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ht(t.markerPane,"leaflet-zoom-hide"),ht(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,n,o){At(this._mapPane,new ut(0,0));var u=!this._loaded;this._loaded=!0,n=this._limitZoom(n),this.fire("viewprereset");var c=this._zoom!==n;this._moveStart(c,o)._move(t,n)._moveEnd(c),this.fire("viewreset"),u&&this.fire("load")},_moveStart:function(t,n){return t&&this.fire("zoomstart"),n||this.fire("movestart"),this},_move:function(t,n,o,u){n===void 0&&(n=this._zoom);var c=this._zoom!==n;return this._zoom=n,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),u?o&&o.pinch&&this.fire("zoom",o):((c||o&&o.pinch)&&this.fire("zoom",o),this.fire("move",o)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return jt(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){At(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[I(this._container)]=this;var n=t?xt:lt;n(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&n(window,"resize",this._onResize,this),et.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){jt(this._resizeRequest),this._resizeRequest=qt(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,n){for(var o=[],u,c=n==="mouseout"||n==="mouseover",m=t.target||t.srcElement,M=!1;m;){if(u=this._targets[I(m)],u&&(n==="click"||n==="preclick")&&this._draggableMoved(u)){M=!0;break}if(u&&u.listens(n,!0)&&(c&&!Mn(m,t)||(o.push(u),c))||m===this._container)break;m=m.parentNode}return!o.length&&!M&&!c&&this.listens(n,!0)&&(o=[this]),o},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var n=t.target||t.srcElement;if(!(!this._loaded||n._leaflet_disable_events||t.type==="click"&&this._isClickDisabled(n))){var o=t.type;o==="mousedown"&&Ln(n),this._fireDOMEvent(t,o)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,n,o){if(t.type==="click"){var u=V({},t);u.type="preclick",this._fireDOMEvent(u,u.type,o)}var c=this._findEventTargets(t,n);if(o){for(var m=[],M=0;M0?Math.round(t-n)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(n))},_limitZoom:function(t){var n=this.getMinZoom(),o=this.getMaxZoom(),u=et.any3d?this.options.zoomSnap:1;return u&&(t=Math.round(t/u)*u),Math.max(n,Math.min(o,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Dt(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,n){var o=this._getCenterOffset(t)._trunc();return(n&&n.animate)!==!0&&!this.getSize().contains(o)?!1:(this.panBy(o,n),!0)},_createAnimProxy:function(){var t=this._proxy=gt("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",function(n){var o=_n,u=this._proxy.style[o];ze(this._proxy,this.project(n.center,n.zoom),this.getZoomScale(n.zoom,1)),u===this._proxy.style[o]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Ct(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var t=this.getCenter(),n=this.getZoom();ze(this._proxy,this.project(t,n),this.getZoomScale(n,1))},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,n,o){if(this._animatingZoom)return!0;if(o=o||{},!this._zoomAnimated||o.animate===!1||this._nothingToAnimate()||Math.abs(n-this._zoom)>this.options.zoomAnimationThreshold)return!1;var u=this.getZoomScale(n),c=this._getCenterOffset(t)._divideBy(1-1/u);return o.animate!==!0&&!this.getSize().contains(c)?!1:(qt(function(){this._moveStart(!0,o.noMoveStart||!1)._animateZoom(t,n,!0)},this),!0)},_animateZoom:function(t,n,o,u){this._mapPane&&(o&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=n,ht(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:n,noUpdate:u}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(J(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Dt(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Da(t,n){return new dt(t,n)}var ce=he.extend({options:{position:"topright"},initialize:function(t){Bt(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var n=this._map;return n&&n.removeControl(this),this.options.position=t,n&&n.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var n=this._container=this.onAdd(t),o=this.getPosition(),u=t._controlCorners[o];return ht(n,"leaflet-control"),o.indexOf("bottom")!==-1?u.insertBefore(n,u.firstChild):u.appendChild(n),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Ct(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),Ye=function(t){return new ce(t)};dt.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},n="leaflet-",o=this._controlContainer=gt("div",n+"control-container",this._container);function u(c,m){var M=n+c+" "+n+m;t[c+m]=gt("div",M,o)}u("top","left"),u("top","right"),u("bottom","left"),u("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)Ct(this._controlCorners[t]);Ct(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var _t=ce.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,n,o,u){return o1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=n&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var n=this._getLayer(I(t.target)),o=n.overlay?t.type==="add"?"overlayadd":"overlayremove":t.type==="add"?"baselayerchange":null;o&&this._map.fire(o,n)},_createRadioElement:function(t,n){var o='",u=document.createElement("div");return u.innerHTML=o,u.firstChild},_addItem:function(t){var n=document.createElement("label"),o=this._map.hasLayer(t.layer),u;t.overlay?(u=document.createElement("input"),u.type="checkbox",u.className="leaflet-control-layers-selector",u.defaultChecked=o):u=this._createRadioElement("leaflet-base-layers_"+I(this),o),this._layerControlInputs.push(u),u.layerId=I(t.layer),lt(u,"click",this._onInputClick,this);var c=document.createElement("span");c.innerHTML=" "+t.name;var m=document.createElement("span");n.appendChild(m),m.appendChild(u),m.appendChild(c);var M=t.overlay?this._overlaysList:this._baseLayersList;return M.appendChild(n),this._checkDisabledLayers(),n},_onInputClick:function(){if(!this._preventClick){var t=this._layerControlInputs,n,o,u=[],c=[];this._handlingClick=!0;for(var m=t.length-1;m>=0;m--)n=t[m],o=this._getLayer(n.layerId).layer,n.checked?u.push(o):n.checked||c.push(o);for(m=0;m=0;c--)n=t[c],o=this._getLayer(n.layerId).layer,n.disabled=o.options.minZoom!==void 0&&uo.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section;this._preventClick=!0,lt(t,"click",Nt),this.expand();var n=this;setTimeout(function(){xt(t,"click",Nt),n._preventClick=!1})}}),wn=function(t,n,o){return new _t(t,n,o)},Je=ce.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(t){var n="leaflet-control-zoom",o=gt("div",n+" leaflet-bar"),u=this.options;return this._zoomInButton=this._createButton(u.zoomInText,u.zoomInTitle,n+"-in",o,this._zoomIn),this._zoomOutButton=this._createButton(u.zoomOutText,u.zoomOutTitle,n+"-out",o,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),o},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,n,o,u,c){var m=gt("a",o,u);return m.innerHTML=t,m.href="#",m.title=n,m.setAttribute("role","button"),m.setAttribute("aria-label",n),mi(m),lt(m,"click",Ze),lt(m,"click",c,this),lt(m,"click",this._refocusOnMap,this),m},_updateDisabled:function(){var t=this._map,n="leaflet-disabled";Dt(this._zoomInButton,n),Dt(this._zoomOutButton,n),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||t._zoom===t.getMinZoom())&&(ht(this._zoomOutButton,n),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||t._zoom===t.getMaxZoom())&&(ht(this._zoomInButton,n),this._zoomInButton.setAttribute("aria-disabled","true"))}});dt.mergeOptions({zoomControl:!0}),dt.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Je,this.addControl(this.zoomControl))});var Sa=function(t){return new Je(t)},En=ce.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var n="leaflet-control-scale",o=gt("div",n),u=this.options;return this._addScales(u,n+"-line",o),t.on(u.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),o},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,n,o){t.metric&&(this._mScale=gt("div",n,o)),t.imperial&&(this._iScale=gt("div",n,o))},_update:function(){var t=this._map,n=t.getSize().y/2,o=t.distance(t.containerPointToLatLng([0,n]),t.containerPointToLatLng([this.options.maxWidth,n]));this._updateScales(o)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var n=this._getRoundNum(t),o=n<1e3?n+" m":n/1e3+" km";this._updateScale(this._mScale,o,n/t)},_updateImperial:function(t){var n=t*3.2808399,o,u,c;n>5280?(o=n/5280,u=this._getRoundNum(o),this._updateScale(this._iScale,u+" mi",u/o)):(c=this._getRoundNum(n),this._updateScale(this._iScale,c+" ft",c/n))},_updateScale:function(t,n,o){t.style.width=Math.round(this.options.maxWidth*o)+"px",t.innerHTML=n},_getRoundNum:function(t){var n=Math.pow(10,(Math.floor(t)+"").length-1),o=t/n;return o=o>=10?10:o>=5?5:o>=3?3:o>=2?2:1,n*o}}),Aa=function(t){return new En(t)},Bn='',Xe=ce.extend({options:{position:"bottomright",prefix:''+(et.inlineSvg?Bn+" ":"")+"Leaflet"},initialize:function(t){Bt(this,t),this._attributions={}},onAdd:function(t){t.attributionControl=this,this._container=gt("div","leaflet-control-attribution"),mi(this._container);for(var n in t._layers)t._layers[n].getAttribution&&this.addAttribution(t._layers[n].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",function(){this.removeAttribution(t.layer.getAttribution())},this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var n in this._attributions)this._attributions[n]&&t.push(n);var o=[];this.options.prefix&&o.push(this.options.prefix),t.length&&o.push(t.join(", ")),this._container.innerHTML=o.join(' ')}}});dt.mergeOptions({attributionControl:!0}),dt.addInitHook(function(){this.options.attributionControl&&new Xe().addTo(this)});var Oa=function(t){return new Xe(t)};ce.Layers=_t,ce.Zoom=Je,ce.Scale=En,ce.Attribution=Xe,Ye.layers=wn,Ye.zoom=Sa,Ye.scale=Aa,Ye.attribution=Oa;var Gt=he.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Gt.addTo=function(t,n){return t.addHandler(n,this),this};var Dr={Events:Qt},je=et.touch?"touchstart mousedown":"mousedown",De=li.extend({options:{clickTolerance:3},initialize:function(t,n,o,u){Bt(this,u),this._element=t,this._dragStartTarget=n||t,this._preventOutline=o},enable:function(){this._enabled||(lt(this._dragStartTarget,je,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(De._dragging===this&&this.finishDrag(!0),xt(this._dragStartTarget,je,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(this._enabled&&(this._moved=!1,!mn(this._element,"leaflet-zoom-anim"))){if(t.touches&&t.touches.length!==1){De._dragging===this&&this.finishDrag();return}if(!(De._dragging||t.shiftKey||t.which!==1&&t.button!==1&&!t.touches)&&(De._dragging=this,this._preventOutline&&Ln(this._element),yn(),pi(),!this._moving)){this.fire("down");var n=t.touches?t.touches[0]:t,o=Mr(this._element);this._startPoint=new ut(n.clientX,n.clientY),this._startPos=Ne(this._element),this._parentScale=bn(o);var u=t.type==="mousedown";lt(document,u?"mousemove":"touchmove",this._onMove,this),lt(document,u?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(t){if(this._enabled){if(t.touches&&t.touches.length>1){this._moved=!0;return}var n=t.touches&&t.touches.length===1?t.touches[0]:t,o=new ut(n.clientX,n.clientY)._subtract(this._startPoint);!o.x&&!o.y||Math.abs(o.x)+Math.abs(o.y)m&&(M=R,m=G);m>o&&(n[M]=1,Tn(t,n,o,u,M),Tn(t,n,o,M,c))}function Zt(t,n){for(var o=[t[0]],u=1,c=0,m=t.length;un&&(o.push(t[u]),c=u);return cn.max.x&&(o|=2),t.yn.max.y&&(o|=8),o}function $e(t,n){var o=n.x-t.x,u=n.y-t.y;return o*o+u*u}function ke(t,n,o,u){var c=n.x,m=n.y,M=o.x-c,R=o.y-m,G=M*M+R*R,K;return G>0&&(K=((t.x-c)*M+(t.y-m)*R)/G,K>1?(c=o.x,m=o.y):K>0&&(c+=M*K,m+=R*K)),M=t.x-c,R=t.y-m,u?M*M+R*R:new ut(c,m)}function Ft(t){return!le(t[0])||typeof t[0][0]!="object"&&typeof t[0][0]<"u"}function Ir(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ft(t)}function zr(t,n){var o,u,c,m,M,R,G,K;if(!t||t.length===0)throw new Error("latlngs not passed");Ft(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var Y=ft([0,0]),rt=St(t),ct=rt.getNorthWest().distanceTo(rt.getSouthWest())*rt.getNorthEast().distanceTo(rt.getNorthWest());ct<1700&&(Y=Pn(t));var Vt=t.length,It=[];for(o=0;ou){G=(m-u)/c,K=[R.x-G*(R.x-M.x),R.y-G*(R.y-M.y)];break}var Jt=n.unproject(at(K));return ft([Jt.lat+Y.lat,Jt.lng+Y.lng])}var An={__proto__:null,simplify:Or,pointToSegmentDistance:Fr,closestPointOnSegment:Ra,clipSegment:Dn,_getEdgeIntersection:Sn,_getBitCode:re,_sqClosestPointOnSegment:ke,isFlat:Ft,_flat:Ir,polylineCenter:zr},te={project:function(t){return new ut(t.lng,t.lat)},unproject:function(t){return new vt(t.y,t.x)},bounds:new Pt([-180,-90],[180,90])},zi={R:6378137,R_MINOR:6356752314245179e-9,bounds:new Pt([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(t){var n=Math.PI/180,o=this.R,u=t.lat*n,c=this.R_MINOR/o,m=Math.sqrt(1-c*c),M=m*Math.sin(u),R=Math.tan(Math.PI/4-u/2)/Math.pow((1-M)/(1+M),m/2);return u=-o*Math.log(Math.max(R,1e-10)),new ut(t.lng*n*o,u)},unproject:function(t){for(var n=180/Math.PI,o=this.R,u=this.R_MINOR/o,c=Math.sqrt(1-u*u),m=Math.exp(-t.y/o),M=Math.PI/2-2*Math.atan(m),R=0,G=.1,K;R<15&&Math.abs(G)>1e-7;R++)K=c*Math.sin(M),K=Math.pow((1-K)/(1+K),c/2),G=Math.PI/2-2*Math.atan(m*K)-M,M+=G;return new vt(M*n,t.x*n/o)}},Ni={__proto__:null,LonLat:te,Mercator:zi,SphericalMercator:rn},Ia=V({},Be,{code:"EPSG:3395",projection:zi,transformation:function(){var t=.5/(Math.PI*zi.R);return hi(t,.5,-t,.5)}()}),de=V({},Be,{code:"EPSG:4326",projection:te,transformation:hi(1/180,1,-1/180,.5)}),ge=V({},Ce,{projection:te,transformation:hi(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,n){var o=n.lng-t.lng,u=n.lat-t.lat;return Math.sqrt(o*o+u*u)},infinite:!0});Ce.Earth=Be,Ce.EPSG3395=Ia,Ce.EPSG3857=an,Ce.EPSG900913=sa,Ce.EPSG4326=de,Ce.Simple=ge;var Yt=li.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[I(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[I(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var n=t.target;if(n.hasLayer(this)){if(this._map=n,this._zoomAnimated=n._zoomAnimated,this.getEvents){var o=this.getEvents();n.on(o,this),this.once("remove",function(){n.off(o,this)},this)}this.onAdd(n),this.fire("add"),n.fire("layeradd",{layer:this})}}});dt.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var n=I(t);return this._layers[n]?this:(this._layers[n]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t),this)},removeLayer:function(t){var n=I(t);return this._layers[n]?(this._loaded&&t.onRemove(this),delete this._layers[n],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return I(t)in this._layers},eachLayer:function(t,n){for(var o in this._layers)t.call(n,this._layers[o]);return this},_addLayers:function(t){t=t?le(t)?t:[t]:[];for(var n=0,o=t.length;nthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&n[0]instanceof vt&&n[0].equals(n[o-1])&&n.pop(),n},_setLatLngs:function(t){ve.prototype._setLatLngs.call(this,t),Ft(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ft(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,n=this.options.weight,o=new ut(n,n);if(t=new Pt(t.min.subtract(o),t.max.add(o)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(t))){if(this.options.noClip){this._parts=this._rings;return}for(var u=0,c=this._rings.length,m;ut.y!=c.y>t.y&&t.x<(c.x-u.x)*(t.y-u.y)/(c.y-u.y)+u.x&&(n=!n);return n||ve.prototype._containsPoint.call(this,t,!0)}});function ja(t,n){return new ae(t,n)}var Me=ee.extend({initialize:function(t,n){Bt(this,n),this._layers={},t&&this.addData(t)},addData:function(t){var n=le(t)?t:t.features,o,u,c;if(n){for(o=0,u=n.length;o0&&c.push(c[0].slice()),c}function ii(t,n){return t.feature?V({},t.feature,{geometry:n}):vi(n)}function vi(t){return t.type==="Feature"||t.type==="FeatureCollection"?t:{type:"Feature",properties:{},geometry:t}}var zn={toGeoJSON:function(t){return ii(this,{type:"Point",coordinates:In(this.getLatLng(),t)})}};Gi.include(zn),ji.include(zn),Zi.include(zn),ve.include({toGeoJSON:function(t){var n=!Ft(this._latlngs),o=yi(this._latlngs,n?1:0,!1,t);return ii(this,{type:(n?"Multi":"")+"LineString",coordinates:o})}}),ae.include({toGeoJSON:function(t){var n=!Ft(this._latlngs),o=n&&!Ft(this._latlngs[0]),u=yi(this._latlngs,o?2:n?1:0,!0,t);return n||(u=[u]),ii(this,{type:(o?"Multi":"")+"Polygon",coordinates:u})}}),Ue.include({toMultiPoint:function(t){var n=[];return this.eachLayer(function(o){n.push(o.toGeoJSON(t).geometry.coordinates)}),ii(this,{type:"MultiPoint",coordinates:n})},toGeoJSON:function(t){var n=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(n==="MultiPoint")return this.toMultiPoint(t);var o=n==="GeometryCollection",u=[];return this.eachLayer(function(c){if(c.toGeoJSON){var m=c.toGeoJSON(t);if(o)u.push(m.geometry);else{var M=vi(m);M.type==="FeatureCollection"?u.push.apply(u,M.features):u.push(M)}}}),o?ii(this,{geometries:u,type:"GeometryCollection"}):{type:"FeatureCollection",features:u}}});function Gr(t,n){return new Me(t,n)}var Ua=Gr,Li=Yt.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,n,o){this._url=t,this._bounds=St(n),Bt(this,o)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(ht(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Ct(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&Re(this._image),this},bringToBack:function(){return this._map&&Ie(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=St(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t=this._url.tagName==="IMG",n=this._image=t?this._url:gt("img");if(ht(n,"leaflet-image-layer"),this._zoomAnimated&&ht(n,"leaflet-zoom-animated"),this.options.className&&ht(n,this.options.className),n.onselectstart=bt,n.onmousemove=bt,n.onload=J(this.fire,this,"load"),n.onerror=J(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(n.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t){this._url=n.src;return}n.src=this._url,n.alt=this.options.alt},_animateZoom:function(t){var n=this._map.getZoomScale(t.zoom),o=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;ze(this._image,o,n)},_reset:function(){var t=this._image,n=new Pt(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),o=n.getSize();At(t,n.min),t.style.width=o.x+"px",t.style.height=o.y+"px"},_updateOpacity:function(){ne(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)},getCenter:function(){return this._bounds.getCenter()}}),Nn=function(t,n,o){return new Li(t,n,o)},Gn=Li.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var t=this._url.tagName==="VIDEO",n=this._image=t?this._url:gt("video");if(ht(n,"leaflet-image-layer"),this._zoomAnimated&&ht(n,"leaflet-zoom-animated"),this.options.className&&ht(n,this.options.className),n.onselectstart=bt,n.onmousemove=bt,n.onloadeddata=J(this.fire,this,"load"),t){for(var o=n.getElementsByTagName("source"),u=[],c=0;c0?u:[n.src];return}le(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(n.style,"objectFit")&&(n.style.objectFit="fill"),n.autoplay=!!this.options.autoplay,n.loop=!!this.options.loop,n.muted=!!this.options.muted,n.playsInline=!!this.options.playsInline;for(var m=0;mc?(n.height=c+"px",ht(t,m)):Dt(t,m),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var n=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),o=this._getAnchor();At(this._container,n.add(o))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var t=this._map,n=parseInt(di(this._container,"marginBottom"),10)||0,o=this._container.offsetHeight+n,u=this._containerWidth,c=new ut(this._containerLeft,-o-this._containerBottom);c._add(Ne(this._container));var m=t.layerPointToContainerPoint(c),M=at(this.options.autoPanPadding),R=at(this.options.autoPanPaddingTopLeft||M),G=at(this.options.autoPanPaddingBottomRight||M),K=t.getSize(),Y=0,rt=0;m.x+u+G.x>K.x&&(Y=m.x+u-K.x+G.x),m.x-Y-R.x<0&&(Y=m.x-R.x),m.y+o+G.y>K.y&&(rt=m.y+o-K.y+G.y),m.y-rt-R.y<0&&(rt=m.y-R.y),(Y||rt)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([Y,rt]))}},_getAnchor:function(){return at(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Va=function(t,n){return new Hi(t,n)};dt.mergeOptions({closePopupOnClick:!0}),dt.include({openPopup:function(t,n,o){return this._initOverlay(Hi,t,n,o).openOn(this),this},closePopup:function(t){return t=arguments.length?t:this._popup,t&&t.close(),this}}),Yt.include({bindPopup:function(t,n){return this._popup=this._initOverlay(Hi,this._popup,t,n),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&(this instanceof ee||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){if(!(!this._popup||!this._map)){Ze(t);var n=t.layer||t.target;if(this._popup._source===n&&!(n instanceof ye)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng);return}this._popup._source=n,this.openPopup(t.latlng)}},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){t.originalEvent.keyCode===13&&this._openPopup(t)}});var Ki=pe.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){pe.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){pe.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=pe.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip",n=t+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=gt("div",n),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+I(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var n,o,u=this._map,c=this._container,m=u.latLngToContainerPoint(u.getCenter()),M=u.layerPointToContainerPoint(t),R=this.options.direction,G=c.offsetWidth,K=c.offsetHeight,Y=at(this.options.offset),rt=this._getAnchor();R==="top"?(n=G/2,o=K):R==="bottom"?(n=G/2,o=0):R==="center"?(n=G/2,o=K/2):R==="right"?(n=0,o=K/2):R==="left"?(n=G,o=K/2):M.xthis.options.maxZoom||ou?this._retainParent(c,m,M,u):!1)},_retainChildren:function(t,n,o,u){for(var c=2*t;c<2*t+2;c++)for(var m=2*n;m<2*n+2;m++){var M=new ut(c,m);M.z=o+1;var R=this._tileCoordsToKey(M),G=this._tiles[R];if(G&&G.active){G.retain=!0;continue}else G&&G.loaded&&(G.retain=!0);o+1this.options.maxZoom||this.options.minZoom!==void 0&&c1){this._setView(t,o);return}for(var rt=c.min.y;rt<=c.max.y;rt++)for(var ct=c.min.x;ct<=c.max.x;ct++){var Vt=new ut(ct,rt);if(Vt.z=this._tileZoom,!!this._isValidTile(Vt)){var It=this._tiles[this._tileCoordsToKey(Vt)];It?It.current=!0:M.push(Vt)}}if(M.sort(function(Jt,ai){return Jt.distanceTo(m)-ai.distanceTo(m)}),M.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var ue=document.createDocumentFragment();for(ct=0;cto.max.x)||!n.wrapLat&&(t.yo.max.y))return!1}if(!this.options.bounds)return!0;var u=this._tileCoordsToBounds(t);return St(this.options.bounds).overlaps(u)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var n=this._map,o=this.getTileSize(),u=t.scaleBy(o),c=u.add(o),m=n.unproject(u,t.z),M=n.unproject(c,t.z);return[m,M]},_tileCoordsToBounds:function(t){var n=this._tileCoordsToNwSe(t),o=new Wt(n[0],n[1]);return this.options.noWrap||(o=this._map.wrapLatLngBounds(o)),o},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var n=t.split(":"),o=new ut(+n[0],+n[1]);return o.z=+n[2],o},_removeTile:function(t){var n=this._tiles[t];n&&(Ct(n.el),delete this._tiles[t],this.fire("tileunload",{tile:n.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){ht(t,"leaflet-tile");var n=this.getTileSize();t.style.width=n.x+"px",t.style.height=n.y+"px",t.onselectstart=bt,t.onmousemove=bt,et.ielt9&&this.options.opacity<1&&ne(t,this.options.opacity)},_addTile:function(t,n){var o=this._getTilePos(t),u=this._tileCoordsToKey(t),c=this.createTile(this._wrapCoords(t),J(this._tileReady,this,t));this._initTile(c),this.createTile.length<2&&qt(J(this._tileReady,this,t,null,c)),At(c,o),this._tiles[u]={el:c,coords:t,current:!0},n.appendChild(c),this.fire("tileloadstart",{tile:c,coords:t})},_tileReady:function(t,n,o){n&&this.fire("tileerror",{error:n,tile:o,coords:t});var u=this._tileCoordsToKey(t);o=this._tiles[u],o&&(o.loaded=+new Date,this._map._fadeAnimated?(ne(o.el,0),jt(this._fadeFrame),this._fadeFrame=qt(this._updateOpacity,this)):(o.active=!0,this._pruneTiles()),n||(ht(o.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:o.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),et.ielt9||!this._map._fadeAnimated?qt(this._pruneTiles,this):setTimeout(J(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var n=new ut(this._wrapX?pt(t.x,this._wrapX):t.x,this._wrapY?pt(t.y,this._wrapY):t.y);return n.z=t.z,n},_pxBoundsToTileRange:function(t){var n=this.getTileSize();return new Pt(t.min.unscaleBy(n).floor(),t.max.unscaleBy(n).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function Ka(t){return new Ci(t)}var ni=Ci.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,n){this._url=t,n=Bt(this,n),n.detectRetina&&et.retina&&n.maxZoom>0?(n.tileSize=Math.floor(n.tileSize/2),n.zoomReverse?(n.zoomOffset--,n.minZoom=Math.min(n.maxZoom,n.minZoom+1)):(n.zoomOffset++,n.maxZoom=Math.max(n.minZoom,n.maxZoom-1)),n.minZoom=Math.max(0,n.minZoom)):n.zoomReverse?n.minZoom=Math.min(n.maxZoom,n.minZoom):n.maxZoom=Math.max(n.minZoom,n.maxZoom),typeof n.subdomains=="string"&&(n.subdomains=n.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(t,n){return this._url===t&&n===void 0&&(n=!0),this._url=t,n||this.redraw(),this},createTile:function(t,n){var o=document.createElement("img");return lt(o,"load",J(this._tileOnLoad,this,n,o)),lt(o,"error",J(this._tileOnError,this,n,o)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(o.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(o.referrerPolicy=this.options.referrerPolicy),o.alt="",o.src=this.getTileUrl(t),o},getTileUrl:function(t){var n={r:et.retina?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var o=this._globalTileRange.max.y-t.y;this.options.tms&&(n.y=o),n["-y"]=o}return si(this._url,V(n,this.options))},_tileOnLoad:function(t,n){et.ielt9?setTimeout(J(t,this,null,n),0):t(null,n)},_tileOnError:function(t,n,o){var u=this.options.errorTileUrl;u&&n.getAttribute("src")!==u&&(n.src=u),t(o,n)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,n=this.options.maxZoom,o=this.options.zoomReverse,u=this.options.zoomOffset;return o&&(t=n-t),t+u},_getSubdomain:function(t){var n=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[n]},_abortLoading:function(){var t,n;for(t in this._tiles)if(this._tiles[t].coords.z!==this._tileZoom&&(n=this._tiles[t].el,n.onload=bt,n.onerror=bt,!n.complete)){n.src=wi;var o=this._tiles[t].coords;Ct(n),delete this._tiles[t],this.fire("tileabort",{tile:n,coords:o})}},_removeTile:function(t){var n=this._tiles[t];if(n)return n.el.setAttribute("src",wi),Ci.prototype._removeTile.call(this,t)},_tileReady:function(t,n,o){if(!(!this._map||o&&o.getAttribute("src")===wi))return Ci.prototype._tileReady.call(this,t,n,o)}});function Ur(t,n){return new ni(t,n)}var Vr=ni.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,n){this._url=t;var o=V({},this.defaultWmsParams);for(var u in n)u in this.options||(o[u]=n[u]);n=Bt(this,n);var c=n.detectRetina&&et.retina?2:1,m=this.getTileSize();o.width=m.x*c,o.height=m.y*c,this.wmsParams=o},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var n=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[n]=this._crs.code,ni.prototype.onAdd.call(this,t)},getTileUrl:function(t){var n=this._tileCoordsToNwSe(t),o=this._crs,u=zt(o.project(n[0]),o.project(n[1])),c=u.min,m=u.max,M=(this._wmsVersion>=1.3&&this._crs===de?[c.y,c.x,m.y,m.x]:[c.x,c.y,m.x,m.y]).join(","),R=ni.prototype.getTileUrl.call(this,t);return R+Jn(this.wmsParams,R,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+M},setParams:function(t,n){return V(this.wmsParams,t),n||this.redraw(),this}});function qa(t,n){return new Vr(t,n)}ni.WMS=Vr,Ur.wms=qa;var Le=Yt.extend({options:{padding:.1},initialize:function(t){Bt(this,t),I(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),ht(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,n){var o=this._map.getZoomScale(n,this._zoom),u=this._map.getSize().multiplyBy(.5+this.options.padding),c=this._map.project(this._center,n),m=u.multiplyBy(-o).add(c).subtract(this._map._getNewPixelOrigin(t,n));et.any3d?ze(this._container,m,o):At(this._container,m)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var t in this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,n=this._map.getSize(),o=this._map.containerPointToLayerPoint(n.multiplyBy(-t)).round();this._bounds=new Pt(o,o.add(n.multiplyBy(1+t*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),qi=Le.extend({options:{tolerance:0},getEvents:function(){var t=Le.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Le.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");lt(t,"mousemove",this._onMouseMove,this),lt(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),lt(t,"mouseout",this._handleMouseOut,this),t._leaflet_disable_events=!0,this._ctx=t.getContext("2d")},_destroyContainer:function(){jt(this._redrawRequest),delete this._ctx,Ct(this._container),xt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var t;this._redrawBounds=null;for(var n in this._layers)t=this._layers[n],t._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Le.prototype._update.call(this);var t=this._bounds,n=this._container,o=t.getSize(),u=et.retina?2:1;At(n,t.min),n.width=u*o.x,n.height=u*o.y,n.style.width=o.x+"px",n.style.height=o.y+"px",et.retina&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){Le.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[I(t)]=t;var n=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=n),this._drawLast=n,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var n=t._order,o=n.next,u=n.prev;o?o.prev=u:this._drawLast=u,u?u.next=o:this._drawFirst=o,delete t._order,delete this._layers[I(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if(typeof t.options.dashArray=="string"){var n=t.options.dashArray.split(/[, ]+/),o=[],u,c;for(c=0;c')}}catch{}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Kr={_initContainer:function(){this._container=gt("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Le.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var n=t._container=xi("shape");ht(n,"leaflet-vml-shape "+(this.options.className||"")),n.coordsize="1 1",t._path=xi("path"),n.appendChild(t._path),this._updateStyle(t),this._layers[I(t)]=t},_addPath:function(t){var n=t._container;this._container.appendChild(n),t.options.interactive&&t.addInteractiveTarget(n)},_removePath:function(t){var n=t._container;Ct(n),t.removeInteractiveTarget(n),delete this._layers[I(t)]},_updateStyle:function(t){var n=t._stroke,o=t._fill,u=t.options,c=t._container;c.stroked=!!u.stroke,c.filled=!!u.fill,u.stroke?(n||(n=t._stroke=xi("stroke")),c.appendChild(n),n.weight=u.weight+"px",n.color=u.color,n.opacity=u.opacity,u.dashArray?n.dashStyle=le(u.dashArray)?u.dashArray.join(" "):u.dashArray.replace(/( *, *)/g," "):n.dashStyle="",n.endcap=u.lineCap.replace("butt","flat"),n.joinstyle=u.lineJoin):n&&(c.removeChild(n),t._stroke=null),u.fill?(o||(o=t._fill=xi("fill")),c.appendChild(o),o.color=u.fillColor||u.color,o.opacity=u.fillOpacity):o&&(c.removeChild(o),t._fill=null)},_updateCircle:function(t){var n=t._point.round(),o=Math.round(t._radius),u=Math.round(t._radiusY||o);this._setPath(t,t._empty()?"M0 0":"AL "+n.x+","+n.y+" "+o+","+u+" 0,"+65535*360)},_setPath:function(t,n){t._path.v=n},_bringToFront:function(t){Re(t._container)},_bringToBack:function(t){Ie(t._container)}},ri=et.vml?xi:tr,ki=Le.extend({_initContainer:function(){this._container=ri("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=ri("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Ct(this._container),xt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Le.prototype._update.call(this);var t=this._bounds,n=t.getSize(),o=this._container;(!this._svgSize||!this._svgSize.equals(n))&&(this._svgSize=n,o.setAttribute("width",n.x),o.setAttribute("height",n.y)),At(o,t.min),o.setAttribute("viewBox",[t.min.x,t.min.y,n.x,n.y].join(" ")),this.fire("update")}},_initPath:function(t){var n=t._path=ri("path");t.options.className&&ht(n,t.options.className),t.options.interactive&&ht(n,"leaflet-interactive"),this._updateStyle(t),this._layers[I(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){Ct(t._path),t.removeInteractiveTarget(t._path),delete this._layers[I(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var n=t._path,o=t.options;n&&(o.stroke?(n.setAttribute("stroke",o.color),n.setAttribute("stroke-opacity",o.opacity),n.setAttribute("stroke-width",o.weight),n.setAttribute("stroke-linecap",o.lineCap),n.setAttribute("stroke-linejoin",o.lineJoin),o.dashArray?n.setAttribute("stroke-dasharray",o.dashArray):n.removeAttribute("stroke-dasharray"),o.dashOffset?n.setAttribute("stroke-dashoffset",o.dashOffset):n.removeAttribute("stroke-dashoffset")):n.setAttribute("stroke","none"),o.fill?(n.setAttribute("fill",o.fillColor||o.color),n.setAttribute("fill-opacity",o.fillOpacity),n.setAttribute("fill-rule",o.fillRule||"evenodd")):n.setAttribute("fill","none"))},_updatePoly:function(t,n){this._setPath(t,on(t._parts,n))},_updateCircle:function(t){var n=t._point,o=Math.max(Math.round(t._radius),1),u=Math.max(Math.round(t._radiusY),1)||o,c="a"+o+","+u+" 0 1,0 ",m=t._empty()?"M0 0":"M"+(n.x-o)+","+n.y+c+o*2+",0 "+c+-o*2+",0 ";this._setPath(t,m)},_setPath:function(t,n){t._path.setAttribute("d",n)},_bringToFront:function(t){Re(t._path)},_bringToBack:function(t){Ie(t._path)}});et.vml&&ki.include(Kr);function qr(t){return et.svg||et.vml?new ki(t):null}dt.include({getRenderer:function(t){var n=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return n||(n=this._renderer=this._createRenderer()),this.hasLayer(n)||this.addLayer(n),n},_getPaneRenderer:function(t){if(t==="overlayPane"||t===void 0)return!1;var n=this._paneRenderers[t];return n===void 0&&(n=this._createRenderer({pane:t}),this._paneRenderers[t]=n),n},_createRenderer:function(t){return this.options.preferCanvas&&Hr(t)||qr(t)}});var Wi=ae.extend({initialize:function(t,n){ae.prototype.initialize.call(this,this._boundsToLatLngs(t),n)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return t=St(t),[t.getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function oe(t,n){return new Wi(t,n)}ki.create=ri,ki.pointsToPath=on,Me.geometryToLayer=ti,Me.coordsToLatLng=Rn,Me.coordsToLatLngs=Ui,Me.latLngToCoords=In,Me.latLngsToCoords=yi,Me.getFeature=ii,Me.asFeature=vi,dt.mergeOptions({boxZoom:!0});var Kt=Gt.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){lt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){xt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Ct(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||t.which!==1&&t.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),pi(),yn(),this._startPoint=this._map.mouseEventToContainerPoint(t),lt(document,{contextmenu:Ze,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=gt("div","leaflet-zoom-box",this._container),ht(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var n=new Pt(this._point,this._startPoint),o=n.getSize();At(this._box,n.min),this._box.style.width=o.x+"px",this._box.style.height=o.y+"px"},_finish:function(){this._moved&&(Ct(this._box),Dt(this._container,"leaflet-crosshair")),fi(),Fi(),xt(document,{contextmenu:Ze,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if(!(t.which!==1&&t.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(J(this._resetState,this),0);var n=new Wt(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(n).fire("boxzoomend",{boxZoomBounds:n})}},_onKeyDown:function(t){t.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});dt.addInitHook("addHandler","boxZoom",Kt),dt.mergeOptions({doubleClickZoom:!0});var jn=Gt.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var n=this._map,o=n.getZoom(),u=n.options.zoomDelta,c=t.originalEvent.shiftKey?o-u:o+u;n.options.doubleClickZoom==="center"?n.setZoom(c):n.setZoomAround(t.containerPoint,c)}});dt.addInitHook("addHandler","doubleClickZoom",jn),dt.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var se=Gt.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new De(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}ht(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Dt(this._map._container,"leaflet-grab"),Dt(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var n=St(this._map.options.maxBounds);this._offsetLimit=zt(this._map.latLngToContainerPoint(n.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(n.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var n=this._lastTime=+new Date,o=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(o),this._times.push(n),this._prunePositions(n)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),n=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=n.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,n){return t-(t-n)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var t=this._draggable._newPos.subtract(this._draggable._startPos),n=this._offsetLimit;t.xn.max.x&&(t.x=this._viscousLimit(t.x,n.max.x)),t.y>n.max.y&&(t.y=this._viscousLimit(t.y,n.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,n=Math.round(t/2),o=this._initialWorldOffset,u=this._draggable._newPos.x,c=(u-n+o)%t+n-o,m=(u+n+o)%t-n-o,M=Math.abs(c+o)0?m:-m))-n;this._delta=0,this._startTime=null,M&&(t.options.scrollWheelZoom==="center"?t.setZoom(n+M):t.setZoomAround(this._lastMousePos,n+M))}});dt.addInitHook("addHandler","scrollWheelZoom",Yi);var Un=600;dt.mergeOptions({tapHold:et.touchNative&&et.safari&&et.mobile,tapTolerance:15});var we=Gt.extend({addHooks:function(){lt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){xt(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(clearTimeout(this._holdTimeout),t.touches.length===1){var n=t.touches[0];this._startPos=this._newPos=new ut(n.clientX,n.clientY),this._holdTimeout=setTimeout(J(function(){this._cancel(),this._isTapValid()&&(lt(document,"touchend",Nt),lt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",n))},this),Un),lt(document,"touchend touchcancel contextmenu",this._cancel,this),lt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function t(){xt(document,"touchend",Nt),xt(document,"touchend touchcancel",t)},_cancel:function(){clearTimeout(this._holdTimeout),xt(document,"touchend touchcancel contextmenu",this._cancel,this),xt(document,"touchmove",this._onMove,this)},_onMove:function(t){var n=t.touches[0];this._newPos=new ut(n.clientX,n.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(t,n){var o=new MouseEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:n.screenX,screenY:n.screenY,clientX:n.clientX,clientY:n.clientY});o._simulated=!0,n.target.dispatchEvent(o)}});dt.addInitHook("addHandler","tapHold",we),dt.mergeOptions({touchZoom:et.touch,bounceAtZoomLimits:!0});var Rt=Gt.extend({addHooks:function(){ht(this._map._container,"leaflet-touch-zoom"),lt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Dt(this._map._container,"leaflet-touch-zoom"),xt(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var n=this._map;if(!(!t.touches||t.touches.length!==2||n._animatingZoom||this._zooming)){var o=n.mouseEventToContainerPoint(t.touches[0]),u=n.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=n.getSize()._divideBy(2),this._startLatLng=n.containerPointToLatLng(this._centerPoint),n.options.touchZoom!=="center"&&(this._pinchStartLatLng=n.containerPointToLatLng(o.add(u)._divideBy(2))),this._startDist=o.distanceTo(u),this._startZoom=n.getZoom(),this._moved=!1,this._zooming=!0,n._stop(),lt(document,"touchmove",this._onTouchMove,this),lt(document,"touchend touchcancel",this._onTouchEnd,this),Nt(t)}},_onTouchMove:function(t){if(!(!t.touches||t.touches.length!==2||!this._zooming)){var n=this._map,o=n.mouseEventToContainerPoint(t.touches[0]),u=n.mouseEventToContainerPoint(t.touches[1]),c=o.distanceTo(u)/this._startDist;if(this._zoom=n.getScaleZoom(c,this._startZoom),!n.options.bounceAtZoomLimits&&(this._zoomn.getMaxZoom()&&c>1)&&(this._zoom=n._limitZoom(this._zoom)),n.options.touchZoom==="center"){if(this._center=this._startLatLng,c===1)return}else{var m=o._add(u)._divideBy(2)._subtract(this._centerPoint);if(c===1&&m.x===0&&m.y===0)return;this._center=n.unproject(n.project(this._pinchStartLatLng,this._zoom).subtract(m),this._zoom)}this._moved||(n._moveStart(!0,!1),this._moved=!0),jt(this._animRequest);var M=J(n._move,n,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=qt(M,this,!0),Nt(t)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,jt(this._animRequest),xt(document,"touchmove",this._onTouchMove,this),xt(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});dt.addInitHook("addHandler","touchZoom",Rt),dt.BoxZoom=Kt,dt.DoubleClickZoom=jn,dt.Drag=se,dt.Keyboard=ot,dt.ScrollWheelZoom=Yi,dt.TapHold=we,dt.TouchZoom=Rt,j.Bounds=Pt,j.Browser=et,j.CRS=Ce,j.Canvas=qi,j.Circle=ji,j.CircleMarker=Zi,j.Class=he,j.Control=ce,j.DivIcon=jr,j.DivOverlay=pe,j.DomEvent=Ta,j.DomUtil=Ba,j.Draggable=De,j.Evented=li,j.FeatureGroup=ee,j.GeoJSON=Me,j.GridLayer=Ci,j.Handler=Gt,j.Icon=Qe,j.ImageOverlay=Li,j.LatLng=vt,j.LatLngBounds=Wt,j.Layer=Yt,j.LayerGroup=Ue,j.LineUtil=An,j.Map=dt,j.Marker=Gi,j.Mixin=Dr,j.Path=ye,j.Point=ut,j.PolyUtil=Fa,j.Polygon=ae,j.Polyline=ve,j.Popup=Hi,j.PosAnimation=Tr,j.Projection=Ni,j.Rectangle=Wi,j.Renderer=Le,j.SVG=ki,j.SVGOverlay=Zr,j.TileLayer=ni,j.Tooltip=Ki,j.Transformation=Ke,j.Util=Fe,j.VideoOverlay=Gn,j.bind=J,j.bounds=zt,j.canvas=Hr,j.circle=Ve,j.circleMarker=Ga,j.control=Ye,j.divIcon=Ha,j.extend=V,j.featureGroup=za,j.geoJSON=Gr,j.geoJson=Ua,j.gridLayer=Ka,j.icon=Fn,j.imageOverlay=Nn,j.latLng=ft,j.latLngBounds=St,j.layerGroup=On,j.map=Da,j.marker=Na,j.point=at,j.polygon=ja,j.polyline=Za,j.popup=Va,j.rectangle=oe,j.setOptions=Bt,j.stamp=I,j.svg=qr,j.svgOverlay=Vi,j.tileLayer=Ur,j.tooltip=bi,j.transformation=hi,j.version=$,j.videoOverlay=Zn;var Wr=window.L;j.noConflict=function(){return window.L=Wr,this},window.L=j})});var wt=Wo(po(),1);L.Control.Fullscreen=L.Control.extend({options:{position:"topleft",title:{false:"View Fullscreen",true:"Exit Fullscreen"}},onAdd:function(j){var $=L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");return this.link=L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",$),this.link.href="#",this._map=j,this._map.on("fullscreenchange",this._toggleTitle,this),this._toggleTitle(),L.DomEvent.on(this.link,"click",this._click,this),$},_click:function(j){L.DomEvent.stopPropagation(j),L.DomEvent.preventDefault(j),this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}});L.Map.include({isFullscreen:function(){return this._isFullscreen||!1},toggleFullscreen:function(j){var $=this.getContainer();this.isFullscreen()?j&&j.pseudoFullscreen?this._disablePseudoFullscreen($):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():this._disablePseudoFullscreen($):j&&j.pseudoFullscreen?this._enablePseudoFullscreen($):$.requestFullscreen?$.requestFullscreen():$.mozRequestFullScreen?$.mozRequestFullScreen():$.webkitRequestFullscreen?$.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):$.msRequestFullscreen?$.msRequestFullscreen():this._enablePseudoFullscreen($)},_enablePseudoFullscreen:function(j){L.DomUtil.addClass(j,"leaflet-pseudo-fullscreen"),this._setFullscreen(!0),this.fire("fullscreenchange")},_disablePseudoFullscreen:function(j){L.DomUtil.removeClass(j,"leaflet-pseudo-fullscreen"),this._setFullscreen(!1),this.fire("fullscreenchange")},_setFullscreen:function(j){this._isFullscreen=j;var $=this.getContainer();j?L.DomUtil.addClass($,"leaflet-fullscreen-on"):L.DomUtil.removeClass($,"leaflet-fullscreen-on"),this.invalidateSize()},_onFullscreenChange:function(j){var $=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement;$===this.getContainer()&&!this._isFullscreen?(this._setFullscreen(!0),this.fire("fullscreenchange")):$!==this.getContainer()&&this._isFullscreen&&(this._setFullscreen(!1),this.fire("fullscreenchange"))}});L.Map.mergeOptions({fullscreenControl:!1});L.Map.addInitHook(function(){this.options.fullscreenControl&&(this.fullscreenControl=new L.Control.Fullscreen(this.options.fullscreenControl),this.addControl(this.fullscreenControl));var j;if("onfullscreenchange"in document?j="fullscreenchange":"onmozfullscreenchange"in document?j="mozfullscreenchange":"onwebkitfullscreenchange"in document?j="webkitfullscreenchange":"onmsfullscreenchange"in document&&(j="MSFullscreenChange"),j){var $=L.bind(this._onFullscreenChange,this);this.whenReady(function(){L.DomEvent.on(document,j,$)}),this.on("unload",function(){L.DomEvent.off(document,j,$)})}});L.control.fullscreen=function(j){return new L.Control.Fullscreen(j)};(()=>{var lo,ho;var j=Object.create,$=Object.defineProperty,V=Object.getOwnPropertyDescriptor,W=Object.getOwnPropertyNames,J=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty,I=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports),st=(e,i,r,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of W(i))!Et.call(e,s)&&s!==r&&$(e,s,{get:()=>i[s],enumerable:!(a=V(i,s))||a.enumerable});return e},pt=(e,i,r)=>(r=e!=null?j(J(e)):{},st(i||!e||!e.__esModule?$(r,"default",{value:e,enumerable:!0}):r,e)),bt=I((e,i)=>{function r(){this.__data__=[],this.size=0}i.exports=r}),$t=I((e,i)=>{function r(a,s){return a===s||a!==a&&s!==s}i.exports=r}),He=I((e,i)=>{var r=$t();function a(s,l){for(var h=s.length;h--;)if(r(s[h][0],l))return h;return-1}i.exports=a}),Ae=I((e,i)=>{var r=He(),a=Array.prototype,s=a.splice;function l(h){var d=this.__data__,f=r(d,h);if(f<0)return!1;var _=d.length-1;return f==_?d.pop():s.call(d,f,1),--this.size,!0}i.exports=l}),Bt=I((e,i)=>{var r=He();function a(s){var l=this.__data__,h=r(l,s);return h<0?void 0:l[h][1]}i.exports=a}),Jn=I((e,i)=>{var r=He();function a(s){return r(this.__data__,s)>-1}i.exports=a}),aa=I((e,i)=>{var r=He();function a(s,l){var h=this.__data__,d=r(h,s);return d<0?(++this.size,h.push([s,l])):h[d][1]=l,this}i.exports=a}),si=I((e,i)=>{var r=bt(),a=Ae(),s=Bt(),l=Jn(),h=aa();function d(f){var _=-1,k=f==null?0:f.length;for(this.clear();++_{var r=si();function a(){this.__data__=new r,this.size=0}i.exports=a}),tn=I((e,i)=>{function r(a){var s=this.__data__,l=s.delete(a);return this.size=s.size,l}i.exports=r}),wi=I((e,i)=>{function r(a){return this.__data__.get(a)}i.exports=r}),en=I((e,i)=>{function r(a){return this.__data__.has(a)}i.exports=r}),nn=I((e,i)=>{var r=typeof global=="object"&&global&&global.Object===Object&&global;i.exports=r}),Oe=I((e,i)=>{var r=nn(),a=typeof self=="object"&&self&&self.Object===Object&&self,s=r||a||Function("return this")();i.exports=s}),ui=I((e,i)=>{var r=Oe(),a=r.Symbol;i.exports=a}),Xn=I((e,i)=>{var r=ui(),a=Object.prototype,s=a.hasOwnProperty,l=a.toString,h=r?r.toStringTag:void 0;function d(f){var _=s.call(f,h),k=f[h];try{f[h]=void 0;var w=!0}catch{}var z=l.call(f);return w&&(_?f[h]=k:delete f[h]),z}i.exports=d}),qt=I((e,i)=>{var r=Object.prototype,a=r.toString;function s(l){return a.call(l)}i.exports=s}),jt=I((e,i)=>{var r=ui(),a=Xn(),s=qt(),l="[object Null]",h="[object Undefined]",d=r?r.toStringTag:void 0;function f(_){return _==null?_===void 0?h:l:d&&d in Object(_)?a(_):s(_)}i.exports=f}),Fe=I((e,i)=>{function r(a){var s=typeof a;return a!=null&&(s=="object"||s=="function")}i.exports=r}),he=I((e,i)=>{var r=jt(),a=Fe(),s="[object AsyncFunction]",l="[object Function]",h="[object GeneratorFunction]",d="[object Proxy]";function f(_){if(!a(_))return!1;var k=r(_);return k==l||k==h||k==s||k==d}i.exports=f}),oa=I((e,i)=>{var r=Oe(),a=r["__core-js_shared__"];i.exports=a}),Qt=I((e,i)=>{var r=oa(),a=function(){var l=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""}();function s(l){return!!a&&a in l}i.exports=s}),li=I((e,i)=>{var r=Function.prototype,a=r.toString;function s(l){if(l!=null){try{return a.call(l)}catch{}try{return l+""}catch{}}return""}i.exports=s}),ut=I((e,i)=>{var r=he(),a=Qt(),s=Fe(),l=li(),h=/[\\^$.*+?()[\]{}|]/g,d=/^\[object .+?Constructor\]$/,f=Function.prototype,_=Object.prototype,k=f.toString,w=_.hasOwnProperty,z=RegExp("^"+k.call(w).replace(h,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function S(U){if(!s(U)||a(U))return!1;var q=r(U)?z:d;return q.test(l(U))}i.exports=S}),$n=I((e,i)=>{function r(a,s){return a?.[s]}i.exports=r}),at=I((e,i)=>{var r=ut(),a=$n();function s(l,h){var d=a(l,h);return r(d)?d:void 0}i.exports=s}),Pt=I((e,i)=>{var r=at(),a=Oe(),s=r(a,"Map");i.exports=s}),zt=I((e,i)=>{var r=at(),a=r(Object,"create");i.exports=a}),Wt=I((e,i)=>{var r=zt();function a(){this.__data__=r?r(null):{},this.size=0}i.exports=a}),St=I((e,i)=>{function r(a){var s=this.has(a)&&delete this.__data__[a];return this.size-=s?1:0,s}i.exports=r}),vt=I((e,i)=>{var r=zt(),a="__lodash_hash_undefined__",s=Object.prototype,l=s.hasOwnProperty;function h(d){var f=this.__data__;if(r){var _=f[d];return _===a?void 0:_}return l.call(f,d)?f[d]:void 0}i.exports=h}),ft=I((e,i)=>{var r=zt(),a=Object.prototype,s=a.hasOwnProperty;function l(h){var d=this.__data__;return r?d[h]!==void 0:s.call(d,h)}i.exports=l}),Ce=I((e,i)=>{var r=zt(),a="__lodash_hash_undefined__";function s(l,h){var d=this.__data__;return this.size+=this.has(l)?0:1,d[l]=r&&h===void 0?a:h,this}i.exports=s}),Be=I((e,i)=>{var r=Wt(),a=St(),s=vt(),l=ft(),h=Ce();function d(f){var _=-1,k=f==null?0:f.length;for(this.clear();++_{var r=Be(),a=si(),s=Pt();function l(){this.size=0,this.__data__={hash:new r,map:new(s||a),string:new r}}i.exports=l}),rn=I((e,i)=>{function r(a){var s=typeof a;return s=="string"||s=="number"||s=="symbol"||s=="boolean"?a!=="__proto__":a===null}i.exports=r}),Ke=I((e,i)=>{var r=rn();function a(s,l){var h=s.__data__;return r(l)?h[typeof l=="string"?"string":"hash"]:h.map}i.exports=a}),hi=I((e,i)=>{var r=Ke();function a(s){var l=r(this,s).delete(s);return this.size-=l?1:0,l}i.exports=a}),an=I((e,i)=>{var r=Ke();function a(s){return r(this,s).get(s)}i.exports=a}),sa=I((e,i)=>{var r=Ke();function a(s){return r(this,s).has(s)}i.exports=a}),tr=I((e,i)=>{var r=Ke();function a(s,l){var h=r(this,s),d=h.size;return h.set(s,l),this.size+=h.size==d?0:1,this}i.exports=a}),on=I((e,i)=>{var r=Qn(),a=hi(),s=an(),l=sa(),h=tr();function d(f){var _=-1,k=f==null?0:f.length;for(this.clear();++_{var r=si(),a=Pt(),s=on(),l=200;function h(d,f){var _=this.__data__;if(_ instanceof r){var k=_.__data__;if(!a||k.length{var r=si(),a=le(),s=tn(),l=wi(),h=en(),d=sn();function f(_){var k=this.__data__=new r(_);this.size=k.size}f.prototype.clear=a,f.prototype.delete=s,f.prototype.get=l,f.prototype.has=h,f.prototype.set=d,i.exports=f}),er=I((e,i)=>{var r=at(),a=function(){try{var s=r(Object,"defineProperty");return s({},"",{}),s}catch{}}();i.exports=a}),Bi=I((e,i)=>{var r=er();function a(s,l,h){l=="__proto__"&&r?r(s,l,{configurable:!0,enumerable:!0,value:h,writable:!0}):s[l]=h}i.exports=a}),Pi=I((e,i)=>{var r=Bi(),a=$t();function s(l,h,d){(d!==void 0&&!a(l[h],d)||d===void 0&&!(h in l))&&r(l,h,d)}i.exports=s}),ir=I((e,i)=>{function r(a){return function(s,l,h){for(var d=-1,f=Object(s),_=h(s),k=_.length;k--;){var w=_[a?k:++d];if(l(f[w],w,f)===!1)break}return s}}i.exports=r}),nr=I((e,i)=>{var r=ir(),a=r();i.exports=a}),ua=I((e,i)=>{var r=Oe(),a=typeof e=="object"&&e&&!e.nodeType&&e,s=a&&typeof i=="object"&&i&&!i.nodeType&&i,l=s&&s.exports===a,h=l?r.Buffer:void 0,d=h?h.allocUnsafe:void 0;function f(_,k){if(k)return _.slice();var w=_.length,z=d?d(w):new _.constructor(w);return _.copy(z),z}i.exports=f}),la=I((e,i)=>{var r=Oe(),a=r.Uint8Array;i.exports=a}),un=I((e,i)=>{var r=la();function a(s){var l=new s.constructor(s.byteLength);return new r(l).set(new r(s)),l}i.exports=a}),rr=I((e,i)=>{var r=un();function a(s,l){var h=l?r(s.buffer):s.buffer;return new s.constructor(h,s.byteOffset,s.length)}i.exports=a}),ar=I((e,i)=>{function r(a,s){var l=-1,h=a.length;for(s||(s=Array(h));++l{var r=Fe(),a=Object.create,s=function(){function l(){}return function(h){if(!r(h))return{};if(a)return a(h);l.prototype=h;var d=new l;return l.prototype=void 0,d}}();i.exports=s}),or=I((e,i)=>{function r(a,s){return function(l){return a(s(l))}}i.exports=r}),ln=I((e,i)=>{var r=or(),a=r(Object.getPrototypeOf,Object);i.exports=a}),sr=I((e,i)=>{var r=Object.prototype;function a(s){var l=s&&s.constructor,h=typeof l=="function"&&l.prototype||r;return s===h}i.exports=a}),ur=I((e,i)=>{var r=ha(),a=ln(),s=sr();function l(h){return typeof h.constructor=="function"&&!s(h)?r(a(h)):{}}i.exports=l}),Pe=I((e,i)=>{function r(a){return a!=null&&typeof a=="object"}i.exports=r}),lr=I((e,i)=>{var r=jt(),a=Pe(),s="[object Arguments]";function l(h){return a(h)&&r(h)==s}i.exports=l}),hr=I((e,i)=>{var r=lr(),a=Pe(),s=Object.prototype,l=s.hasOwnProperty,h=s.propertyIsEnumerable,d=r(function(){return arguments}())?r:function(f){return a(f)&&l.call(f,"callee")&&!h.call(f,"callee")};i.exports=d}),xe=I((e,i)=>{var r=Array.isArray;i.exports=r}),cr=I((e,i)=>{var r=9007199254740991;function a(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=r}i.exports=a}),hn=I((e,i)=>{var r=he(),a=cr();function s(l){return l!=null&&a(l.length)&&!r(l)}i.exports=s}),dr=I((e,i)=>{var r=hn(),a=Pe();function s(l){return a(l)&&r(l)}i.exports=s}),pr=I((e,i)=>{function r(){return!1}i.exports=r}),cn=I((e,i)=>{var r=Oe(),a=pr(),s=typeof e=="object"&&e&&!e.nodeType&&e,l=s&&typeof i=="object"&&i&&!i.nodeType&&i,h=l&&l.exports===s,d=h?r.Buffer:void 0,f=d?d.isBuffer:void 0,_=f||a;i.exports=_}),ca=I((e,i)=>{var r=jt(),a=ln(),s=Pe(),l="[object Object]",h=Function.prototype,d=Object.prototype,f=h.toString,_=d.hasOwnProperty,k=f.call(Object);function w(z){if(!s(z)||r(z)!=l)return!1;var S=a(z);if(S===null)return!0;var U=_.call(S,"constructor")&&S.constructor;return typeof U=="function"&&U instanceof U&&f.call(U)==k}i.exports=w}),da=I((e,i)=>{var r=jt(),a=cr(),s=Pe(),l="[object Arguments]",h="[object Array]",d="[object Boolean]",f="[object Date]",_="[object Error]",k="[object Function]",w="[object Map]",z="[object Number]",S="[object Object]",U="[object RegExp]",q="[object Set]",Q="[object String]",mt="[object WeakMap]",x="[object ArrayBuffer]",E="[object DataView]",D="[object Float32Array]",Z="[object Float64Array]",A="[object Int8Array]",N="[object Int16Array]",p="[object Int32Array]",g="[object Uint8Array]",v="[object Uint8ClampedArray]",y="[object Uint16Array]",b="[object Uint32Array]",C={};C[D]=C[Z]=C[A]=C[N]=C[p]=C[g]=C[v]=C[y]=C[b]=!0,C[l]=C[h]=C[x]=C[d]=C[E]=C[f]=C[_]=C[k]=C[w]=C[z]=C[S]=C[U]=C[q]=C[Q]=C[mt]=!1;function P(B){return s(B)&&a(B.length)&&!!C[r(B)]}i.exports=P}),pa=I((e,i)=>{function r(a){return function(s){return a(s)}}i.exports=r}),fa=I((e,i)=>{var r=nn(),a=typeof e=="object"&&e&&!e.nodeType&&e,s=a&&typeof i=="object"&&i&&!i.nodeType&&i,l=s&&s.exports===a,h=l&&r.process,d=function(){try{var f=s&&s.require&&s.require("util").types;return f||h&&h.binding&&h.binding("util")}catch{}}();i.exports=d}),fr=I((e,i)=>{var r=da(),a=pa(),s=fa(),l=s&&s.isTypedArray,h=l?a(l):r;i.exports=h}),_r=I((e,i)=>{function r(a,s){if(!(s==="constructor"&&typeof a[s]=="function")&&s!="__proto__")return a[s]}i.exports=r}),dn=I((e,i)=>{var r=Bi(),a=$t(),s=Object.prototype,l=s.hasOwnProperty;function h(d,f,_){var k=d[f];(!(l.call(d,f)&&a(k,_))||_===void 0&&!(f in d))&&r(d,f,_)}i.exports=h}),_a=I((e,i)=>{var r=dn(),a=Bi();function s(l,h,d,f){var _=!d;d||(d={});for(var k=-1,w=h.length;++k{function r(a,s){for(var l=-1,h=Array(a);++l{var r=9007199254740991,a=/^(?:0|[1-9]\d*)$/;function s(l,h){var d=typeof l;return h=h??r,!!h&&(d=="number"||d!="symbol"&&a.test(l))&&l>-1&&l%1==0&&l{var r=ma(),a=hr(),s=xe(),l=cn(),h=mr(),d=fr(),f=Object.prototype,_=f.hasOwnProperty;function k(w,z){var S=s(w),U=!S&&a(w),q=!S&&!U&&l(w),Q=!S&&!U&&!q&&d(w),mt=S||U||q||Q,x=mt?r(w.length,String):[],E=x.length;for(var D in w)(z||_.call(w,D))&&!(mt&&(D=="length"||q&&(D=="offset"||D=="parent")||Q&&(D=="buffer"||D=="byteLength"||D=="byteOffset")||h(D,E)))&&x.push(D);return x}i.exports=k}),_e=I((e,i)=>{function r(a){var s=[];if(a!=null)for(var l in Object(a))s.push(l);return s}i.exports=r}),et=I((e,i)=>{var r=Fe(),a=sr(),s=_e(),l=Object.prototype,h=l.hasOwnProperty;function d(f){if(!r(f))return s(f);var _=a(f),k=[];for(var w in f)w=="constructor"&&(_||!h.call(f,w))||k.push(w);return k}i.exports=d}),pn=I((e,i)=>{var r=ga(),a=et(),s=hn();function l(h){return s(h)?r(h,!0):a(h)}i.exports=l}),gr=I((e,i)=>{var r=_a(),a=pn();function s(l){return r(l,a(l))}i.exports=s}),yr=I((e,i)=>{var r=Pi(),a=ua(),s=rr(),l=ar(),h=ur(),d=hr(),f=xe(),_=dr(),k=cn(),w=he(),z=Fe(),S=ca(),U=fr(),q=_r(),Q=gr();function mt(x,E,D,Z,A,N,p){var g=q(x,D),v=q(E,D),y=p.get(v);if(y){r(x,D,y);return}var b=N?N(g,v,D+"",x,E,p):void 0,C=b===void 0;if(C){var P=f(v),B=!P&&k(v),T=!P&&!B&&U(v);b=v,P||B||T?f(g)?b=g:_(g)?b=l(g):B?(C=!1,b=a(v,!0)):T?(C=!1,b=s(v,!0)):b=[]:S(v)||d(v)?(b=g,d(g)?b=Q(g):(!z(g)||w(g))&&(b=h(v))):C=!1}C&&(p.set(v,b),A(b,v,Z,N,p),p.delete(v)),r(x,D,b)}i.exports=mt}),vr=I((e,i)=>{var r=Ei(),a=Pi(),s=nr(),l=yr(),h=Fe(),d=pn(),f=_r();function _(k,w,z,S,U){k!==w&&s(w,function(q,Q){if(U||(U=new r),h(q))l(k,w,Q,z,_,S,U);else{var mt=S?S(f(k,Q),q,Q+"",k,w,U):void 0;mt===void 0&&(mt=q),a(k,Q,mt)}},d)}i.exports=_}),Ti=I((e,i)=>{function r(a){return a}i.exports=r}),Lr=I((e,i)=>{function r(a,s,l){switch(l.length){case 0:return a.call(s);case 1:return a.call(s,l[0]);case 2:return a.call(s,l[0],l[1]);case 3:return a.call(s,l[0],l[1],l[2])}return a.apply(s,l)}i.exports=r}),qe=I((e,i)=>{var r=Lr(),a=Math.max;function s(l,h,d){return h=a(h===void 0?l.length-1:h,0),function(){for(var f=arguments,_=-1,k=a(f.length-h,0),w=Array(k);++_{function r(a){return function(){return a}}i.exports=r}),ya=I((e,i)=>{var r=br(),a=er(),s=Ti(),l=a?function(h,d){return a(h,"toString",{configurable:!0,enumerable:!1,value:r(d),writable:!0})}:s;i.exports=l}),va=I((e,i)=>{var r=800,a=16,s=Date.now;function l(h){var d=0,f=0;return function(){var _=s(),k=a-(_-f);if(f=_,k>0){if(++d>=r)return arguments[0]}else d=0;return h.apply(void 0,arguments)}}i.exports=l}),La=I((e,i)=>{var r=ya(),a=va(),s=a(r);i.exports=s}),ba=I((e,i)=>{var r=Ti(),a=qe(),s=La();function l(h,d){return s(a(h,d,r),h+"")}i.exports=l}),Cr=I((e,i)=>{var r=$t(),a=hn(),s=mr(),l=Fe();function h(d,f,_){if(!l(_))return!1;var k=typeof f;return(k=="number"?a(_)&&s(f,_.length):k=="string"&&f in _)?r(_[f],d):!1}i.exports=h}),Ca=I((e,i)=>{var r=ba(),a=Cr();function s(l){return r(function(h,d){var f=-1,_=d.length,k=_>1?d[_-1]:void 0,w=_>2?d[2]:void 0;for(k=l.length>3&&typeof k=="function"?(_--,k):void 0,w&&a(d[0],d[1],w)&&(k=_<3?void 0:k,_=1),h=Object(h);++f<_;){var z=d[f];z&&l(h,z,f,k)}return h})}i.exports=s}),We=I((e,i)=>{var r=vr(),a=Ca(),s=a(function(l,h,d){r(l,h,d)});i.exports=s}),fn=I((e,i)=>{var r=jt(),a=Pe(),s="[object Symbol]";function l(h){return typeof h=="symbol"||a(h)&&r(h)==s}i.exports=l}),xa=I((e,i)=>{var r=xe(),a=fn(),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,l=/^\w*$/;function h(d,f){if(r(d))return!1;var _=typeof d;return _=="number"||_=="symbol"||_=="boolean"||d==null||a(d)?!0:l.test(d)||!s.test(d)||f!=null&&d in Object(f)}i.exports=h}),ka=I((e,i)=>{var r=on(),a="Expected a function";function s(l,h){if(typeof l!="function"||h!=null&&typeof h!="function")throw new TypeError(a);var d=function(){var f=arguments,_=h?h.apply(this,f):f[0],k=d.cache;if(k.has(_))return k.get(_);var w=l.apply(this,f);return d.cache=k.set(_,w)||k,w};return d.cache=new(s.Cache||r),d}s.Cache=r,i.exports=s}),Ma=I((e,i)=>{var r=ka(),a=500;function s(l){var h=r(l,function(f){return d.size===a&&d.clear(),f}),d=h.cache;return h}i.exports=s}),wa=I((e,i)=>{var r=Ma(),a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g,l=r(function(h){var d=[];return h.charCodeAt(0)===46&&d.push(""),h.replace(a,function(f,_,k,w){d.push(k?w.replace(s,"$1"):_||f)}),d});i.exports=l}),_n=I((e,i)=>{function r(a,s){for(var l=-1,h=a==null?0:a.length,d=Array(h);++l{var r=ui(),a=_n(),s=xe(),l=fn(),h=1/0,d=r?r.prototype:void 0,f=d?d.toString:void 0;function _(k){if(typeof k=="string")return k;if(s(k))return a(k,_)+"";if(l(k))return f?f.call(k):"";var w=k+"";return w=="0"&&1/k==-h?"-0":w}i.exports=_}),xr=I((e,i)=>{var r=ci();function a(s){return s==null?"":r(s)}i.exports=a}),kr=I((e,i)=>{var r=xe(),a=xa(),s=wa(),l=xr();function h(d,f){return r(d)?d:a(d,f)?[d]:s(l(d))}i.exports=h}),di=I((e,i)=>{var r=fn(),a=1/0;function s(l){if(typeof l=="string"||r(l))return l;var h=l+"";return h=="0"&&1/l==-a?"-0":h}i.exports=s}),gt=I((e,i)=>{var r=kr(),a=di();function s(l,h){h=r(h,l);for(var d=0,f=h.length;l!=null&&d{var r=gt();function a(s,l,h){var d=s==null?void 0:r(s,l);return d===void 0?h:d}i.exports=a}),Di=I((e,i)=>{(function(r,a){typeof e=="object"&&typeof i<"u"?i.exports=a():typeof define=="function"&&define.amd?define(a):(r=r||self).RBush=a()})(e,function(){"use strict";function r(x,E,D,Z,A){(function N(p,g,v,y,b){for(;y>v;){if(y-v>600){var C=y-v+1,P=g-v+1,B=Math.log(C),T=.5*Math.exp(2*B/3),F=.5*Math.sqrt(B*T*(C-T)/C)*(P-C/2<0?-1:1),O=Math.max(v,Math.floor(g-P*T/C+F)),H=Math.min(y,Math.floor(g+(C-P)*T/C+F));N(p,g,O,H,b)}var X=p[g],tt=v,nt=y;for(a(p,v,g),b(p[y],X)>0&&a(p,v,y);tt0;)nt--}b(p[v],X)===0?a(p,v,nt):a(p,++nt,y),nt<=g&&(v=nt+1),g<=nt&&(y=nt-1)}})(x,E,D||0,Z||x.length-1,A||s)}function a(x,E,D){var Z=x[E];x[E]=x[D],x[D]=Z}function s(x,E){return xE?1:0}var l=function(x){x===void 0&&(x=9),this._maxEntries=Math.max(4,x),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function h(x,E,D){if(!D)return E.indexOf(x);for(var Z=0;Z=x.minX&&E.maxY>=x.minY}function Q(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function mt(x,E,D,Z,A){for(var N=[E,D];N.length;)if(!((D=N.pop())-(E=N.pop())<=Z)){var p=E+Math.ceil((D-E)/Z/2)*Z;r(x,p,E,D,A),N.push(E,p,p,D)}}return l.prototype.all=function(){return this._all(this.data,[])},l.prototype.search=function(x){var E=this.data,D=[];if(!q(x,E))return D;for(var Z=this.toBBox,A=[];E;){for(var N=0;N=0&&A[E].children.length>this._maxEntries;)this._split(A,E),E--;this._adjustParentBBoxes(Z,A,E)},l.prototype._split=function(x,E){var D=x[E],Z=D.children.length,A=this._minEntries;this._chooseSplitAxis(D,A,Z);var N=this._chooseSplitIndex(D,A,Z),p=Q(D.children.splice(N,D.children.length-N));p.height=D.height,p.leaf=D.leaf,d(D,this.toBBox),d(p,this.toBBox),E?x[E-1].children.push(p):this._splitRoot(D,p)},l.prototype._splitRoot=function(x,E){this.data=Q([x,E]),this.data.height=x.height+1,this.data.leaf=!1,d(this.data,this.toBBox)},l.prototype._chooseSplitIndex=function(x,E,D){for(var Z,A,N,p,g,v,y,b=1/0,C=1/0,P=E;P<=D-E;P++){var B=f(x,0,P,this.toBBox),T=f(x,P,D,this.toBBox),F=(A=B,N=T,p=void 0,g=void 0,v=void 0,y=void 0,p=Math.max(A.minX,N.minX),g=Math.max(A.minY,N.minY),v=Math.min(A.maxX,N.maxX),y=Math.min(A.maxY,N.maxY),Math.max(0,v-p)*Math.max(0,y-g)),O=z(B)+z(T);F=E;b--){var C=x.children[b];_(p,x.leaf?A(C):C),g+=S(p)}return g},l.prototype._adjustParentBBoxes=function(x,E,D){for(var Z=D;Z>=0;Z--)_(E[Z],x)},l.prototype._condense=function(x){for(var E=x.length-1,D=void 0;E>=0;E--)x[E].children.length===0?E>0?(D=x[E-1].children).splice(D.indexOf(x[E]),1):this.clear():d(x[E],this.toBBox)},l})}),Re=I(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.earthRadius=63710088e-1,e.factors={centimeters:e.earthRadius*100,centimetres:e.earthRadius*100,degrees:e.earthRadius/111325,feet:e.earthRadius*3.28084,inches:e.earthRadius*39.37,kilometers:e.earthRadius/1e3,kilometres:e.earthRadius/1e3,meters:e.earthRadius,metres:e.earthRadius,miles:e.earthRadius/1609.344,millimeters:e.earthRadius*1e3,millimetres:e.earthRadius*1e3,nauticalmiles:e.earthRadius/1852,radians:1,yards:e.earthRadius*1.0936},e.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e.earthRadius,yards:1.0936133},e.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function i(y,b,C){C===void 0&&(C={});var P={type:"Feature"};return(C.id===0||C.id)&&(P.id=C.id),C.bbox&&(P.bbox=C.bbox),P.properties=b||{},P.geometry=y,P}e.feature=i;function r(y,b,C){switch(C===void 0&&(C={}),y){case"Point":return a(b).geometry;case"LineString":return d(b).geometry;case"Polygon":return l(b).geometry;case"MultiPoint":return w(b).geometry;case"MultiLineString":return k(b).geometry;case"MultiPolygon":return z(b).geometry;default:throw new Error(y+" is invalid")}}e.geometry=r;function a(y,b,C){if(C===void 0&&(C={}),!y)throw new Error("coordinates is required");if(!Array.isArray(y))throw new Error("coordinates must be an Array");if(y.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!N(y[0])||!N(y[1]))throw new Error("coordinates must contain numbers");var P={type:"Point",coordinates:y};return i(P,b,C)}e.point=a;function s(y,b,C){return C===void 0&&(C={}),_(y.map(function(P){return a(P,b)}),C)}e.points=s;function l(y,b,C){C===void 0&&(C={});for(var P=0,B=y;P=0))throw new Error("precision must be a positive number");var C=Math.pow(10,b||0);return Math.round(y*C)/C}e.round=U;function q(y,b){b===void 0&&(b="kilometers");var C=e.factors[b];if(!C)throw new Error(b+" units is invalid");return y*C}e.radiansToLength=q;function Q(y,b){b===void 0&&(b="kilometers");var C=e.factors[b];if(!C)throw new Error(b+" units is invalid");return y/C}e.lengthToRadians=Q;function mt(y,b){return E(Q(y,b))}e.lengthToDegrees=mt;function x(y){var b=y%360;return b<0&&(b+=360),b}e.bearingToAzimuth=x;function E(y){var b=y%(2*Math.PI);return b*180/Math.PI}e.radiansToDegrees=E;function D(y){var b=y%360;return b*Math.PI/180}e.degreesToRadians=D;function Z(y,b,C){if(b===void 0&&(b="kilometers"),C===void 0&&(C="kilometers"),!(y>=0))throw new Error("length must be a positive number");return q(Q(y,b),C)}e.convertLength=Z;function A(y,b,C){if(b===void 0&&(b="meters"),C===void 0&&(C="kilometers"),!(y>=0))throw new Error("area must be a positive number");var P=e.areaFactors[b];if(!P)throw new Error("invalid original units");var B=e.areaFactors[C];if(!B)throw new Error("invalid final units");return y/P*B}e.convertArea=A;function N(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}e.isNumber=N;function p(y){return!!y&&y.constructor===Object}e.isObject=p;function g(y){if(!y)throw new Error("bbox is required");if(!Array.isArray(y))throw new Error("bbox must be an Array");if(y.length!==4&&y.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");y.forEach(function(b){if(!N(b))throw new Error("bbox must only contain numbers")})}e.validateBBox=g;function v(y){if(!y)throw new Error("id is required");if(["string","number"].indexOf(typeof y)===-1)throw new Error("id must be a number or a string")}e.validateId=v}),Ie=I(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=Re();function r(E,D,Z){if(E!==null)for(var A,N,p,g,v,y,b,C=0,P=0,B,T=E.type,F=T==="FeatureCollection",O=T==="Feature",H=F?E.features.length:1,X=0;Xy||F>b||O>C){v=P,y=A,b=F,C=O,p=0;return}var H=i.lineString([v,P],Z.properties);if(D(H,A,N,O,p)===!1)return!1;p++,v=P})===!1)return!1}}})}function U(E,D,Z){var A=Z,N=!1;return S(E,function(p,g,v,y,b){N===!1&&Z===void 0?A=p:A=D(A,p,g,v,y,b),N=!0}),A}function q(E,D){if(!E)throw new Error("geojson is required");w(E,function(Z,A,N){if(Z.geometry!==null){var p=Z.geometry.type,g=Z.geometry.coordinates;switch(p){case"LineString":if(D(Z,A,N,0,0)===!1)return!1;break;case"Polygon":for(var v=0;v{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=Ie();function r(a){var s=[1/0,1/0,-1/0,-1/0];return i.coordEach(a,function(l){s[0]>l[0]&&(s[0]=l[0]),s[1]>l[1]&&(s[1]=l[1]),s[2]{var r=Di(),a=Re(),s=Ie(),l=mn().default,h=s.featureEach,d=s.coordEach,f=a.polygon,_=a.featureCollection;function k(w){var z=new r(w);return z.insert=function(S){if(S.type!=="Feature")throw new Error("invalid feature");return S.bbox=S.bbox?S.bbox:l(S),r.prototype.insert.call(this,S)},z.load=function(S){var U=[];return Array.isArray(S)?S.forEach(function(q){if(q.type!=="Feature")throw new Error("invalid features");q.bbox=q.bbox?q.bbox:l(q),U.push(q)}):h(S,function(q){if(q.type!=="Feature")throw new Error("invalid features");q.bbox=q.bbox?q.bbox:l(q),U.push(q)}),r.prototype.load.call(this,U)},z.remove=function(S,U){if(S.type!=="Feature")throw new Error("invalid feature");return S.bbox=S.bbox?S.bbox:l(S),r.prototype.remove.call(this,S,U)},z.clear=function(){return r.prototype.clear.call(this)},z.search=function(S){var U=r.prototype.search.call(this,this.toBBox(S));return _(U)},z.collides=function(S){return r.prototype.collides.call(this,this.toBBox(S))},z.all=function(){var S=r.prototype.all.call(this);return _(S)},z.toJSON=function(){return r.prototype.toJSON.call(this)},z.fromJSON=function(S){return r.prototype.fromJSON.call(this,S)},z.toBBox=function(S){var U;if(S.bbox)U=S.bbox;else if(Array.isArray(S)&&S.length===4)U=S;else if(Array.isArray(S)&&S.length===6)U=[S[0],S[1],S[3],S[4]];else if(S.type==="Feature")U=l(S);else if(S.type==="FeatureCollection")U=l(S);else throw new Error("invalid geojson");return{minX:U[0],minY:U[1],maxX:U[2],maxY:U[3]}},z}i.exports=k,i.exports.default=k});Array.prototype.findIndex=Array.prototype.findIndex||function(e){if(this===null)throw new TypeError("Array.prototype.findIndex called on null or undefined");if(typeof e!="function")throw new TypeError("callback must be a function");for(var i=Object(this),r=i.length>>>0,a=arguments[1],s=0;s>>0,a=arguments[1],s=0;s>>0;if(a===0)return!1;var s=i|0,l=Math.max(s>=0?s:a-Math.abs(s),0);function h(d,f){return d===f||typeof d=="number"&&typeof f=="number"&&isNaN(d)&&isNaN(f)}for(;l{this._isRelevantForEdit(r)&&r.pm.enable(i)}),this.throttledReInitEdit||(this.throttledReInitEdit=L.Util.throttle(this.handleLayerAdditionInGlobalEditMode,100,this)),this._addedLayersEdit={},this.map.on("layeradd",this._layerAddedEdit,this),this.map.on("layeradd",this.throttledReInitEdit,this),this._fireGlobalEditModeToggled(!0)},disableGlobalEditMode(){this._globalEditModeEnabled=!1,L.PM.Utils.findLayers(this.map).forEach(e=>{e.pm.disable()}),this.map.off("layeradd",this._layerAddedEdit,this),this.map.off("layeradd",this.throttledReInitEdit,this),this.Toolbar.toggleButton("editMode",this.globalEditModeEnabled()),this._fireGlobalEditModeToggled(!1)},globalEditEnabled(){return this.globalEditModeEnabled()},globalEditModeEnabled(){return this._globalEditModeEnabled},toggleGlobalEditMode(e=this.globalOptions){this.globalEditModeEnabled()?this.disableGlobalEditMode():this.enableGlobalEditMode(e)},handleLayerAdditionInGlobalEditMode(){let e=this._addedLayersEdit;if(this._addedLayersEdit={},this.globalEditModeEnabled())for(let i in e){let r=e[i];this._isRelevantForEdit(r)&&r.pm.enable({...this.globalOptions})}},_layerAddedEdit({layer:e}){this._addedLayersEdit[L.stamp(e)]=e},_isRelevantForEdit(e){return e.pm&&!(e instanceof L.LayerGroup)&&(!L.PM.optIn&&!e.options.pmIgnore||L.PM.optIn&&e.options.pmIgnore===!1)&&!e._pmTempLayer&&e.pm.options.allowEditing}},Nt=mi,Ze={_globalDragModeEnabled:!1,enableGlobalDragMode(){let e=L.PM.Utils.findLayers(this.map);this._globalDragModeEnabled=!0,this._addedLayersDrag={},e.forEach(i=>{this._isRelevantForDrag(i)&&i.pm.enableLayerDrag()}),this.throttledReInitDrag||(this.throttledReInitDrag=L.Util.throttle(this.reinitGlobalDragMode,100,this)),this.map.on("layeradd",this._layerAddedDrag,this),this.map.on("layeradd",this.throttledReInitDrag,this),this.Toolbar.toggleButton("dragMode",this.globalDragModeEnabled()),this._fireGlobalDragModeToggled(!0)},disableGlobalDragMode(){let e=L.PM.Utils.findLayers(this.map);this._globalDragModeEnabled=!1,e.forEach(i=>{i.pm.disableLayerDrag()}),this.map.off("layeradd",this._layerAddedDrag,this),this.map.off("layeradd",this.throttledReInitDrag,this),this.Toolbar.toggleButton("dragMode",this.globalDragModeEnabled()),this._fireGlobalDragModeToggled(!1)},globalDragModeEnabled(){return!!this._globalDragModeEnabled},toggleGlobalDragMode(){this.globalDragModeEnabled()?this.disableGlobalDragMode():this.enableGlobalDragMode()},reinitGlobalDragMode(){let e=this._addedLayersDrag;if(this._addedLayersDrag={},this.globalDragModeEnabled())for(let i in e){let r=e[i];this._isRelevantForDrag(r)&&r.pm.enableLayerDrag()}},_layerAddedDrag({layer:e}){this._addedLayersDrag[L.stamp(e)]=e},_isRelevantForDrag(e){return e.pm&&!(e instanceof L.LayerGroup)&&(!L.PM.optIn&&!e.options.pmIgnore||L.PM.optIn&&e.options.pmIgnore===!1)&&!e._pmTempLayer&&e.pm.options.draggable}},Er=Ze,Br={_globalRemovalModeEnabled:!1,enableGlobalRemovalMode(){this._globalRemovalModeEnabled=!0,this.map.eachLayer(e=>{this._isRelevantForRemoval(e)&&(e.pm.enabled()&&e.pm.disable(),e.on("click",this.removeLayer,this))}),this.throttledReInitRemoval||(this.throttledReInitRemoval=L.Util.throttle(this.handleLayerAdditionInGlobalRemovalMode,100,this)),this._addedLayersRemoval={},this.map.on("layeradd",this._layerAddedRemoval,this),this.map.on("layeradd",this.throttledReInitRemoval,this),this.Toolbar.toggleButton("removalMode",this.globalRemovalModeEnabled()),this._fireGlobalRemovalModeToggled(!0)},disableGlobalRemovalMode(){this._globalRemovalModeEnabled=!1,this.map.eachLayer(e=>{e.off("click",this.removeLayer,this)}),this.map.off("layeradd",this._layerAddedRemoval,this),this.map.off("layeradd",this.throttledReInitRemoval,this),this.Toolbar.toggleButton("removalMode",this.globalRemovalModeEnabled()),this._fireGlobalRemovalModeToggled(!1)},globalRemovalEnabled(){return this.globalRemovalModeEnabled()},globalRemovalModeEnabled(){return!!this._globalRemovalModeEnabled},toggleGlobalRemovalMode(){this.globalRemovalModeEnabled()?this.disableGlobalRemovalMode():this.enableGlobalRemovalMode()},removeLayer(e){let i=e.target;this._isRelevantForRemoval(i)&&!i.pm.dragging()&&(i.removeFrom(this.map.pm._getContainingLayer()),i.remove(),i instanceof L.LayerGroup?(this._fireRemoveLayerGroup(i),this._fireRemoveLayerGroup(this.map,i)):(i.pm._fireRemove(i),i.pm._fireRemove(this.map,i)))},_isRelevantForRemoval(e){return e.pm&&!(e instanceof L.LayerGroup)&&(!L.PM.optIn&&!e.options.pmIgnore||L.PM.optIn&&e.options.pmIgnore===!1)&&!e._pmTempLayer&&e.pm.options.allowRemoval},handleLayerAdditionInGlobalRemovalMode(){let e=this._addedLayersRemoval;if(this._addedLayersRemoval={},this.globalRemovalModeEnabled())for(let i in e){let r=e[i];this._isRelevantForRemoval(r)&&(r.pm.enabled()&&r.pm.disable(),r.on("click",this.removeLayer,this))}},_layerAddedRemoval({layer:e}){this._addedLayersRemoval[L.stamp(e)]=e}},Pa=Br,Pr={_globalRotateModeEnabled:!1,enableGlobalRotateMode(){this._globalRotateModeEnabled=!0,L.PM.Utils.findLayers(this.map).filter(e=>e instanceof L.Polyline).forEach(e=>{this._isRelevantForRotate(e)&&e.pm.enableRotate()}),this.throttledReInitRotate||(this.throttledReInitRotate=L.Util.throttle(this.handleLayerAdditionInGlobalRotateMode,100,this)),this._addedLayersRotate={},this.map.on("layeradd",this._layerAddedRotate,this),this.map.on("layeradd",this.throttledReInitRotate,this),this.Toolbar.toggleButton("rotateMode",this.globalRotateModeEnabled()),this._fireGlobalRotateModeToggled()},disableGlobalRotateMode(){this._globalRotateModeEnabled=!1,L.PM.Utils.findLayers(this.map).filter(e=>e instanceof L.Polyline).forEach(e=>{e.pm.disableRotate()}),this.map.off("layeradd",this._layerAddedRotate,this),this.map.off("layeradd",this.throttledReInitRotate,this),this.Toolbar.toggleButton("rotateMode",this.globalRotateModeEnabled()),this._fireGlobalRotateModeToggled()},globalRotateModeEnabled(){return!!this._globalRotateModeEnabled},toggleGlobalRotateMode(){this.globalRotateModeEnabled()?this.disableGlobalRotateMode():this.enableGlobalRotateMode()},_isRelevantForRotate(e){return e.pm&&e instanceof L.Polyline&&!(e instanceof L.LayerGroup)&&(!L.PM.optIn&&!e.options.pmIgnore||L.PM.optIn&&e.options.pmIgnore===!1)&&!e._pmTempLayer&&e.pm.options.allowRotation},handleLayerAdditionInGlobalRotateMode(){let e=this._addedLayersRotate;if(this._addedLayersRotate={},this.globalRotateModeEnabled())for(let i in e){let r=e[i];this._isRelevantForRemoval(r)&&r.pm.enableRotate()}},_layerAddedRotate({layer:e}){this._addedLayersRotate[L.stamp(e)]=e}},Mn=Pr,Ta=pt(We()),Tr={_fireDrawStart(e="Draw",i={}){this.__fire(this._map,"pm:drawstart",{shape:this._shape,workingLayer:this._layer},e,i)},_fireDrawEnd(e="Draw",i={}){this.__fire(this._map,"pm:drawend",{shape:this._shape},e,i)},_fireCreate(e,i="Draw",r={}){this.__fire(this._map,"pm:create",{shape:this._shape,marker:e,layer:e},i,r)},_fireCenterPlaced(e="Draw",i={}){let r=e==="Draw"?this._layer:void 0,a=e!=="Draw"?this._layer:void 0;this.__fire(this._layer,"pm:centerplaced",{shape:this._shape,workingLayer:r,layer:a,latlng:this._layer.getLatLng()},e,i)},_fireCut(e,i,r,a="Draw",s={}){this.__fire(e,"pm:cut",{shape:this._shape,layer:i,originalLayer:r},a,s)},_fireEdit(e=this._layer,i="Edit",r={}){this.__fire(e,"pm:edit",{layer:this._layer,shape:this.getShape()},i,r)},_fireEnable(e="Edit",i={}){this.__fire(this._layer,"pm:enable",{layer:this._layer,shape:this.getShape()},e,i)},_fireDisable(e="Edit",i={}){this.__fire(this._layer,"pm:disable",{layer:this._layer,shape:this.getShape()},e,i)},_fireUpdate(e="Edit",i={}){this.__fire(this._layer,"pm:update",{layer:this._layer,shape:this.getShape()},e,i)},_fireMarkerDragStart(e,i=void 0,r="Edit",a={}){this.__fire(this._layer,"pm:markerdragstart",{layer:this._layer,markerEvent:e,shape:this.getShape(),indexPath:i},r,a)},_fireMarkerDrag(e,i=void 0,r="Edit",a={}){this.__fire(this._layer,"pm:markerdrag",{layer:this._layer,markerEvent:e,shape:this.getShape(),indexPath:i},r,a)},_fireMarkerDragEnd(e,i=void 0,r=void 0,a="Edit",s={}){this.__fire(this._layer,"pm:markerdragend",{layer:this._layer,markerEvent:e,shape:this.getShape(),indexPath:i,intersectionReset:r},a,s)},_fireDragStart(e="Edit",i={}){this.__fire(this._layer,"pm:dragstart",{layer:this._layer,shape:this.getShape()},e,i)},_fireDrag(e,i="Edit",r={}){this.__fire(this._layer,"pm:drag",{...e,shape:this.getShape()},i,r)},_fireDragEnd(e="Edit",i={}){this.__fire(this._layer,"pm:dragend",{layer:this._layer,shape:this.getShape()},e,i)},_fireDragEnable(e="Edit",i={}){this.__fire(this._layer,"pm:dragenable",{layer:this._layer,shape:this.getShape()},e,i)},_fireDragDisable(e="Edit",i={}){this.__fire(this._layer,"pm:dragdisable",{layer:this._layer,shape:this.getShape()},e,i)},_fireRemove(e,i=e,r="Edit",a={}){this.__fire(e,"pm:remove",{layer:i,shape:this.getShape()},r,a)},_fireVertexAdded(e,i,r,a="Edit",s={}){this.__fire(this._layer,"pm:vertexadded",{layer:this._layer,workingLayer:this._layer,marker:e,indexPath:i,latlng:r,shape:this.getShape()},a,s)},_fireVertexRemoved(e,i,r="Edit",a={}){this.__fire(this._layer,"pm:vertexremoved",{layer:this._layer,marker:e,indexPath:i,shape:this.getShape()},r,a)},_fireVertexClick(e,i,r="Edit",a={}){this.__fire(this._layer,"pm:vertexclick",{layer:this._layer,markerEvent:e,indexPath:i,shape:this.getShape()},r,a)},_fireIntersect(e,i=this._layer,r="Edit",a={}){this.__fire(i,"pm:intersect",{layer:this._layer,intersection:e,shape:this.getShape()},r,a)},_fireLayerReset(e,i,r="Edit",a={}){this.__fire(this._layer,"pm:layerreset",{layer:this._layer,markerEvent:e,indexPath:i,shape:this.getShape()},r,a)},_fireChange(e,i="Edit",r={}){this.__fire(this._layer,"pm:change",{layer:this._layer,latlngs:e,shape:this.getShape()},i,r)},_fireTextChange(e,i="Edit",r={}){this.__fire(this._layer,"pm:textchange",{layer:this._layer,text:e,shape:this.getShape()},i,r)},_fireTextFocus(e="Edit",i={}){this.__fire(this._layer,"pm:textfocus",{layer:this._layer,shape:this.getShape()},e,i)},_fireTextBlur(e="Edit",i={}){this.__fire(this._layer,"pm:textblur",{layer:this._layer,shape:this.getShape()},e,i)},_fireSnapDrag(e,i,r="Snapping",a={}){this.__fire(e,"pm:snapdrag",i,r,a)},_fireSnap(e,i,r="Snapping",a={}){this.__fire(e,"pm:snap",i,r,a)},_fireUnsnap(e,i,r="Snapping",a={}){this.__fire(e,"pm:unsnap",i,r,a)},_fireRotationEnable(e,i,r="Rotation",a={}){this.__fire(e,"pm:rotateenable",{layer:this._layer,helpLayer:this._rotatePoly,shape:this.getShape()},r,a)},_fireRotationDisable(e,i="Rotation",r={}){this.__fire(e,"pm:rotatedisable",{layer:this._layer,shape:this.getShape()},i,r)},_fireRotationStart(e,i,r="Rotation",a={}){this.__fire(e,"pm:rotatestart",{layer:this._rotationLayer,helpLayer:this._layer,startAngle:this._startAngle,originLatLngs:i},r,a)},_fireRotation(e,i,r,a=this._rotationLayer,s="Rotation",l={}){this.__fire(e,"pm:rotate",{layer:a,helpLayer:this._layer,startAngle:this._startAngle,angle:a.pm.getAngle(),angleDiff:i,oldLatLngs:r,newLatLngs:a.getLatLngs()},s,l)},_fireRotationEnd(e,i,r,a="Rotation",s={}){this.__fire(e,"pm:rotateend",{layer:this._rotationLayer,helpLayer:this._layer,startAngle:i,angle:this._rotationLayer.pm.getAngle(),originLatLngs:r,newLatLngs:this._rotationLayer.getLatLngs()},a,s)},_fireActionClick(e,i,r,a="Toolbar",s={}){this.__fire(this._map,"pm:actionclick",{text:e.text,action:e,btnName:i,button:r},a,s)},_fireButtonClick(e,i,r="Toolbar",a={}){this.__fire(this._map,"pm:buttonclick",{btnName:e,button:i},r,a)},_fireLangChange(e,i,r,a,s="Global",l={}){this.__fire(this.map,"pm:langchange",{oldLang:e,activeLang:i,fallback:r,translations:a},s,l)},_fireGlobalDragModeToggled(e,i="Global",r={}){this.__fire(this.map,"pm:globaldragmodetoggled",{enabled:e,map:this.map},i,r)},_fireGlobalEditModeToggled(e,i="Global",r={}){this.__fire(this.map,"pm:globaleditmodetoggled",{enabled:e,map:this.map},i,r)},_fireGlobalRemovalModeToggled(e,i="Global",r={}){this.__fire(this.map,"pm:globalremovalmodetoggled",{enabled:e,map:this.map},i,r)},_fireGlobalCutModeToggled(e="Global",i={}){this.__fire(this._map,"pm:globalcutmodetoggled",{enabled:!!this._enabled,map:this._map},e,i)},_fireGlobalDrawModeToggled(e="Global",i={}){this.__fire(this._map,"pm:globaldrawmodetoggled",{enabled:this._enabled,shape:this._shape,map:this._map},e,i)},_fireGlobalRotateModeToggled(e="Global",i={}){this.__fire(this.map,"pm:globalrotatemodetoggled",{enabled:this.globalRotateModeEnabled(),map:this.map},e,i)},_fireRemoveLayerGroup(e,i=e,r="Edit",a={}){this.__fire(e,"pm:remove",{layer:i,shape:void 0},r,a)},_fireKeyeventEvent(e,i,r,a="Global",s={}){this.__fire(this.map,"pm:keyevent",{event:e,eventType:i,focusOn:r},a,s)},__fire(e,i,r,a,s={}){r=(0,Ta.default)(r,s,{source:a}),L.PM.Utils._fireEvent(e,i,r)}},dt=Tr,Da=()=>({_lastEvents:{keydown:void 0,keyup:void 0,current:void 0},_initKeyListener(e){this.map=e,L.DomEvent.on(document,"keydown keyup",this._onKeyListener,this),L.DomEvent.on(window,"blur",this._onBlur,this),e.once("unload",this._unbindKeyListenerEvents,this)},_unbindKeyListenerEvents(){L.DomEvent.off(document,"keydown keyup",this._onKeyListener,this),L.DomEvent.off(window,"blur",this._onBlur,this)},_onKeyListener(e){let i="document";this.map.getContainer().contains(e.target)&&(i="map");let r={event:e,eventType:e.type,focusOn:i};this._lastEvents[e.type]=r,this._lastEvents.current=r,this.map.pm._fireKeyeventEvent(e,e.type,i)},_onBlur(e){e.altKey=!1;let i={event:e,eventType:e.type,focusOn:"document"};this._lastEvents[e.type]=i,this._lastEvents.current=i},getLastKeyEvent(e="current"){return this._lastEvents[e]},isShiftKeyPressed(){return this._lastEvents.current?.event.shiftKey},isAltKeyPressed(){return this._lastEvents.current?.event.altKey},isCtrlKeyPressed(){return this._lastEvents.current?.event.ctrlKey},isMetaKeyPressed(){return this._lastEvents.current?.event.metaKey},getPressedKey(){return this._lastEvents.current?.event.key}}),ce=Da,Ye=pt(Ct());function _t(e){let i=L.PM.activeLang;return(0,Ye.default)(Te[i],e)||(0,Ye.default)(Te.en,e)||e}function wn(e){for(let i=0;i{if(r.length!==0){let a=Array.isArray(r)?Je(r):r;Array.isArray(a)?a.length!==0&&i.push(a):i.push(a)}return i},[])}function Sa(e,i,r){let a={a:L.CRS.Earth.R,b:63567523142e-4,f:.0033528106647474805},{a:s,b:l,f:h}=a,d=e.lng,f=e.lat,_=r,k=Math.PI,w=i*k/180,z=Math.sin(w),S=Math.cos(w),U=(1-h)*Math.tan(f*k/180),q=1/Math.sqrt(1+U*U),Q=U*q,mt=Math.atan2(U,S),x=q*z,E=1-x*x,D=E*(s*s-l*l)/(l*l),Z=1+D/16384*(4096+D*(-768+D*(320-175*D))),A=D/1024*(256+D*(-128+D*(74-47*D))),N=_/(l*Z),p=2*Math.PI,g,v,y;for(;Math.abs(N-p)>1e-12;){g=Math.cos(2*mt+N),v=Math.sin(N),y=Math.cos(N);let H=A*v*(g+A/4*(y*(-1+2*g*g)-A/6*g*(-3+4*v*v)*(-3+4*g*g)));p=N,N=_/(l*Z)+H}let b=Q*v-q*y*S,C=Math.atan2(Q*y+q*v*S,(1-h)*Math.sqrt(x*x+b*b)),P=Math.atan2(v*z,q*y-Q*v*S),B=h/16*E*(4+h*(4-3*E)),T=P-(1-B)*h*x*(N+B*v*(g+B*y*(-1+2*g*g))),F=d+T*180/k,O=C*180/k;return L.latLng(F,O)}function En(e,i,r,a,s=!0){let l,h,d,f=[];for(let _=0;_180?q:Q,L.latLng([S*s,U])}function Bn(e,i,r){let a=e.latLngToContainerPoint(i),s=e.latLngToContainerPoint(r),l=Math.atan2(s.y-a.y,s.x-a.x)*180/Math.PI+90;return l+=l<0?360:0,l}function Xe(e,i,r,a){let s=Bn(e,i,r);return Aa(i,s,a)}function Oa(e,i,r="asc"){if(!i||Object.keys(i).length===0)return(f,_)=>f-_;let a=Object.keys(i),s,l=a.length-1,h={};for(;l>=0;)s=a[l],h[s.toLowerCase()]=i[s],l-=1;function d(f){if(f instanceof L.Marker)return"Marker";if(f instanceof L.Circle)return"Circle";if(f instanceof L.CircleMarker)return"CircleMarker";if(f instanceof L.Rectangle)return"Rectangle";if(f instanceof L.Polygon)return"Polygon";if(f instanceof L.Polyline)return"Line"}return(f,_)=>{let k,w;if(e==="instanceofShape"){if(k=d(f.layer).toLowerCase(),w=d(_.layer).toLowerCase(),!k||!w)return 0}else{if(!f.hasOwnProperty(e)||!_.hasOwnProperty(e))return 0;k=f[e].toLowerCase(),w=_[e].toLowerCase()}let z=k in h?h[k]:Number.MAX_SAFE_INTEGER,S=w in h?h[w]:Number.MAX_SAFE_INTEGER,U=0;return zS&&(U=1),r==="desc"?U*-1:U}}function Gt(e,i=e.getLatLngs()){return e instanceof L.Polygon?L.polygon(i).getLatLngs():L.polyline(i).getLatLngs()}function Dr(e,i){if(i.options.crs?.projection?.MAX_LATITUDE){let r=i.options.crs?.projection?.MAX_LATITUDE;e.lat=Math.max(Math.min(r,e.lat),-r)}return e}function je(e){return e.options.renderer||e._map&&(e._map._getPaneRenderer(e.options.pane)||e._map.options.renderer||e._map._renderer)||e._renderer}var De=L.Class.extend({includes:[Nt,Er,Pa,Mn,dt],initialize(e){this.map=e,this.Draw=new L.PM.Draw(e),this.Toolbar=new L.PM.Toolbar(e),this.Keyboard=ce(),this.globalOptions={snappable:!0,layerGroup:void 0,snappingOrder:["Marker","CircleMarker","Circle","Line","Polygon","Rectangle"],panes:{vertexPane:"markerPane",layerPane:"overlayPane",markerPane:"markerPane"},draggable:!0},this.Keyboard._initKeyListener(e)},setLang(e="en",i,r="en"){if(e=e.trim().toLowerCase(),!/^[a-z]{2}$/.test(e)){let s=e.replace(/[-_\s]/g,"-").replace(/^(\w{2})$/,"$1-").match(/([a-z]{2})-?([a-z]{2})?/);if(s){let l=[`${s[1]}_${s[2]}`,`${s[1]}`];for(let h of l)if(Te[h]){e=h;break}}}let a=L.PM.activeLang;i&&(Te[e]=(0,Si.default)(Te[r],i)),L.PM.activeLang=e,this.map.pm.Toolbar.reinit(),this._fireLangChange(a,e,r,Te[e])},addControls(e){this.Toolbar.addControls(e)},removeControls(){this.Toolbar.removeControls()},toggleControls(){this.Toolbar.toggleControls()},controlsVisible(){return this.Toolbar.isVisible},enableDraw(e="Polygon",i){e==="Poly"&&(e="Polygon"),this.Draw.enable(e,i)},disableDraw(e="Polygon"){e==="Poly"&&(e="Polygon"),this.Draw.disable(e)},setPathOptions(e,i={}){let r=i.ignoreShapes||[],a=i.merge||!1;this.map.pm.Draw.shapes.forEach(s=>{r.indexOf(s)===-1&&this.map.pm.Draw[s].setPathOptions(e,a)})},getGlobalOptions(){return this.globalOptions},setGlobalOptions(e){let i=(0,Si.default)(this.globalOptions,e);i.editable&&(i.resizeableCircleMarker=i.editable,delete i.editable);let r=!1;this.map.pm.Draw.CircleMarker.enabled()&&!!this.map.pm.Draw.CircleMarker.options.resizeableCircleMarker!=!!i.resizeableCircleMarker&&(this.map.pm.Draw.CircleMarker.disable(),r=!0);let a=!1;this.map.pm.Draw.Circle.enabled()&&!!this.map.pm.Draw.Circle.options.resizeableCircle!=!!i.resizeableCircle&&(this.map.pm.Draw.Circle.disable(),a=!0),this.map.pm.Draw.shapes.forEach(s=>{this.map.pm.Draw[s].setOptions(i)}),r&&this.map.pm.Draw.CircleMarker.enable(),a&&this.map.pm.Draw.Circle.enable(),L.PM.Utils.findLayers(this.map).forEach(s=>{s.pm.setOptions(i)}),this.map.fire("pm:globaloptionschanged"),this.globalOptions=i,this.applyGlobalOptions()},applyGlobalOptions(){L.PM.Utils.findLayers(this.map).forEach(e=>{e.pm.enabled()&&e.pm.applyOptions()})},globalDrawModeEnabled(){return!!this.Draw.getActiveShape()},globalCutModeEnabled(){return!!this.Draw.Cut.enabled()},enableGlobalCutMode(e){return this.Draw.Cut.enable(e)},toggleGlobalCutMode(e){return this.Draw.Cut.toggle(e)},disableGlobalCutMode(){return this.Draw.Cut.disable()},getGeomanLayers(e=!1){let i=L.PM.Utils.findLayers(this.map);if(!e)return i;let r=L.featureGroup();return r._pmTempLayer=!0,i.forEach(a=>{r.addLayer(a)}),r},getGeomanDrawLayers(e=!1){let i=L.PM.Utils.findLayers(this.map).filter(a=>a._drawnByGeoman===!0);if(!e)return i;let r=L.featureGroup();return r._pmTempLayer=!0,i.forEach(a=>{r.addLayer(a)}),r},_getContainingLayer(){return this.globalOptions.layerGroup&&this.globalOptions.layerGroup instanceof L.LayerGroup?this.globalOptions.layerGroup:this.map},_isCRSSimple(){return this.map.options.crs===L.CRS.Simple},_touchEventCounter:0,_addTouchEvents(e){this._touchEventCounter===0&&(L.DomEvent.on(e,"touchmove",this._canvasTouchMove,this),L.DomEvent.on(e,"touchstart touchend touchcancel",this._canvasTouchClick,this)),this._touchEventCounter+=1},_removeTouchEvents(e){this._touchEventCounter===1&&(L.DomEvent.off(e,"touchmove",this._canvasTouchMove,this),L.DomEvent.off(e,"touchstart touchend touchcancel",this._canvasTouchClick,this)),this._touchEventCounter=this._touchEventCounter<=1?0:this._touchEventCounter-1},_canvasTouchMove(e){je(this.map)._onMouseMove(this._createMouseEvent("mousemove",e))},_canvasTouchClick(e){let i="";e.type==="touchstart"||e.type==="pointerdown"?i="mousedown":(e.type==="touchend"||e.type==="pointerup"||e.type==="touchcancel"||e.type==="pointercancel")&&(i="mouseup"),i&&je(this.map)._onClick(this._createMouseEvent(i,e))},_createMouseEvent(e,i){let r,a=i.touches[0]||i.changedTouches[0];try{r=new MouseEvent(e,{bubbles:i.bubbles,cancelable:i.cancelable,view:i.view,detail:a.detail,screenX:a.screenX,screenY:a.screenY,clientX:a.clientX,clientY:a.clientY,ctrlKey:i.ctrlKey,altKey:i.altKey,shiftKey:i.shiftKey,metaKey:i.metaKey,button:i.button,relatedTarget:i.relatedTarget})}catch{r=document.createEvent("MouseEvents"),r.initMouseEvent(e,i.bubbles,i.cancelable,i.view,a.detail,a.screenX,a.screenY,a.clientX,a.clientY,i.ctrlKey,i.altKey,i.shiftKey,i.metaKey,i.button,i.relatedTarget)}return r}}),Sr=De,Ar=L.Control.extend({includes:[dt],options:{position:"topleft",disableByOtherButtons:!0},initialize(e){this._button=L.Util.extend({},this.options,e)},onAdd(e){return this._map=e,this._map.pm.Toolbar.options.oneBlock?this._container=this._map.pm.Toolbar._createContainer(this.options.position):this._button.tool==="edit"?this._container=this._map.pm.Toolbar.editContainer:this._button.tool==="options"?this._container=this._map.pm.Toolbar.optionsContainer:this._button.tool==="custom"?this._container=this._map.pm.Toolbar.customContainer:this._container=this._map.pm.Toolbar.drawContainer,this._renderButton(),this._container},_renderButton(){let e=this.buttonsDomNode;this.buttonsDomNode=this._makeButton(this._button),e?e.replaceWith(this.buttonsDomNode):this._container.appendChild(this.buttonsDomNode)},onRemove(){return this.buttonsDomNode.remove(),this._container},getText(){return this._button.text},getIconUrl(){return this._button.iconUrl},destroy(){this._button={},this._update()},toggle(e){return typeof e=="boolean"?this._button.toggleStatus=e:this._button.toggleStatus=!this._button.toggleStatus,this._applyStyleClasses(),this._updateActiveAction(this._button),this._button.toggleStatus},toggled(){return this._button.toggleStatus},onCreate(){this.toggle(!1)},disable(){this.toggle(!1),this._button.disabled=!0,this._updateDisabled()},enable(){this._button.disabled=!1,this._updateDisabled(),this._updateActiveAction(this._button)},_triggerClick(e){e&&e.preventDefault(),!this._button.disabled&&(this._button.onClick(e,{button:this,event:e}),this._clicked(e),this._button.afterClick(e,{button:this,event:e}))},_makeButton(e){let i=this.options.position.indexOf("right")>-1?"pos-right":"",r=L.DomUtil.create("div",`button-container ${i}`,this._container);e.title&&r.setAttribute("title",e.title);let a=L.DomUtil.create("a","leaflet-buttons-control-button",r);a.setAttribute("role","button"),a.setAttribute("tabindex","0"),a.href="#";let s=L.DomUtil.create("div",`leaflet-pm-actions-container ${i}`,r),l=e.actions,h={cancel:{text:_t("actions.cancel"),title:_t("actions.cancel"),onClick(){this._triggerClick()}},finishMode:{text:_t("actions.finish"),title:_t("actions.finish"),onClick(){this._triggerClick()}},removeLastVertex:{text:_t("actions.removeLastVertex"),title:_t("actions.removeLastVertex"),onClick(){this._map.pm.Draw[e.jsClass]._removeLastVertex()}},finish:{text:_t("actions.finish"),title:_t("actions.finish"),onClick(f){this._map.pm.Draw[e.jsClass]._finishShape(f)}}};e._preparedActions=l.map(f=>{let _=typeof f=="string"?f:f.name,k;if(h[_])k=h[_];else if(f.text)k=f;else return k;let w=L.DomUtil.create("a",`leaflet-pm-action ${i} action-${_}`,s);if(w.setAttribute("role","button"),w.setAttribute("tabindex","0"),w.href="#",k.title&&(w.title=k.title),w.innerHTML=k.text,L.DomEvent.disableClickPropagation(w),L.DomEvent.on(w,"click",L.DomEvent.stop),k._node=w,!e.disabled&&k.onClick){let z=S=>{S.preventDefault();let U="",{buttons:q}=this._map.pm.Toolbar;for(let Q in q)if(q[Q]._button===e){U=Q;break}this._fireActionClick(k,U,e)};L.DomEvent.addListener(w,"click",z,this),L.DomEvent.addListener(w,"click",k.onClick,this),L.DomEvent.addListener(w,"click",()=>this._updateActiveAction(e))}return k}),this._updateActiveAction(e),e.toggleStatus&&L.DomUtil.addClass(r,"active");let d=L.DomUtil.create("div","control-icon",a);return e.iconUrl&&d.setAttribute("src",e.iconUrl),e.className&&L.DomUtil.addClass(d,e.className),L.DomEvent.disableClickPropagation(a),L.DomEvent.on(a,"click",L.DomEvent.stop),e.disabled||(L.DomEvent.addListener(a,"click",this._onBtnClick,this),L.DomEvent.addListener(a,"click",this._triggerClick,this)),e.disabled&&(L.DomUtil.addClass(a,"pm-disabled"),a.setAttribute("aria-disabled","true")),r},_applyStyleClasses(){this._container&&(!this._button.toggleStatus||this._button.cssToggle===!1?(L.DomUtil.removeClass(this.buttonsDomNode,"active"),L.DomUtil.removeClass(this._container,"activeChild")):(L.DomUtil.addClass(this.buttonsDomNode,"active"),L.DomUtil.addClass(this._container,"activeChild")))},_onBtnClick(){if(this._button.disabled)return;this._button.disableOtherButtons&&this._map.pm.Toolbar.triggerClickOnToggledButtons(this);let e="",{buttons:i}=this._map.pm.Toolbar;for(let r in i)if(i[r]._button===this._button){e=r;break}this._fireButtonClick(e,this._button)},_clicked(){this._button.doToggle&&this.toggle()},_updateDisabled(){if(!this._container)return;let e="pm-disabled",i=this.buttonsDomNode.children[0];this._button.disabled?(L.DomUtil.addClass(i,e),i.setAttribute("aria-disabled","true")):(L.DomUtil.removeClass(i,e),i.setAttribute("aria-disabled","false"))},_updateActiveAction(e){e._preparedActions?.forEach(i=>{i?._node&&(i.isActive&&i.isActive.call(this)?L.DomUtil.addClass(i._node,"active-action"):L.DomUtil.removeClass(i._node,"active-action"))})}}),Pn=Ar;L.Control.PMButton=Pn;var Fa=L.Class.extend({options:{drawMarker:!0,drawRectangle:!0,drawPolyline:!0,drawPolygon:!0,drawCircle:!0,drawCircleMarker:!0,drawText:!0,editMode:!0,dragMode:!0,cutPolygon:!0,removalMode:!0,rotateMode:!0,snappingOption:!0,drawControls:!0,editControls:!0,optionsControls:!0,customControls:!0,oneBlock:!1,position:"topleft",positions:{draw:"",edit:"",options:"",custom:""}},customButtons:[],initialize(e){this.customButtons=[],this.options.positions={draw:"",edit:"",options:"",custom:""},this.init(e)},reinit(){let e=this.isVisible;this.removeControls(),this._defineButtons(),e&&this.addControls()},init(e){this.map=e,this.buttons={},this.isVisible=!1,this.drawContainer=L.DomUtil.create("div","leaflet-pm-toolbar leaflet-pm-draw leaflet-bar leaflet-control"),this.editContainer=L.DomUtil.create("div","leaflet-pm-toolbar leaflet-pm-edit leaflet-bar leaflet-control"),this.optionsContainer=L.DomUtil.create("div","leaflet-pm-toolbar leaflet-pm-options leaflet-bar leaflet-control"),this.customContainer=L.DomUtil.create("div","leaflet-pm-toolbar leaflet-pm-custom leaflet-bar leaflet-control"),this._defineButtons()},_createContainer(e){let i=`${e}Container`;return this[i]||(this[i]=L.DomUtil.create("div",`leaflet-pm-toolbar leaflet-pm-${e} leaflet-bar leaflet-control`)),this[i]},getButtons(){return this.buttons},addControls(e=this.options){typeof e.editPolygon<"u"&&(e.editMode=e.editPolygon),typeof e.deleteLayer<"u"&&(e.removalMode=e.deleteLayer),L.Util.setOptions(this,e),this.applyIconStyle(),this.isVisible=!0,this._showHideButtons()},applyIconStyle(){let e=this.getButtons(),i={geomanIcons:{drawMarker:"control-icon leaflet-pm-icon-marker",drawPolyline:"control-icon leaflet-pm-icon-polyline",drawRectangle:"control-icon leaflet-pm-icon-rectangle",drawPolygon:"control-icon leaflet-pm-icon-polygon",drawCircle:"control-icon leaflet-pm-icon-circle",drawCircleMarker:"control-icon leaflet-pm-icon-circle-marker",editMode:"control-icon leaflet-pm-icon-edit",dragMode:"control-icon leaflet-pm-icon-drag",cutPolygon:"control-icon leaflet-pm-icon-cut",removalMode:"control-icon leaflet-pm-icon-delete",drawText:"control-icon leaflet-pm-icon-text"}};for(let r in e){let a=e[r];L.Util.setOptions(a,{className:i.geomanIcons[r]})}},removeControls(){let e=this.getButtons();for(let i in e)e[i].remove();this.isVisible=!1},toggleControls(e=this.options){this.isVisible?this.removeControls():this.addControls(e)},_addButton(e,i){return this.buttons[e]=i,this.options[e]=!!this.options[e]||!1,this.buttons[e]},triggerClickOnToggledButtons(e){for(let i in this.buttons){let r=this.buttons[i];r._button.disableByOtherButtons&&r!==e&&r.toggled()&&r._triggerClick()}},toggleButton(e,i,r=!0){e==="editPolygon"&&(e="editMode"),e==="deleteLayer"&&(e="removalMode");let a=e;return r&&this.triggerClickOnToggledButtons(this.buttons[a]),this.buttons[a]?this.buttons[a].toggle(i):!1},_defineButtons(){let e={className:"control-icon leaflet-pm-icon-marker",title:_t("buttonTitles.drawMarkerButton"),jsClass:"Marker",onClick:()=>{},afterClick:(z,S)=>{this.map.pm.Draw[S.button._button.jsClass].toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,actions:["cancel"]},i={title:_t("buttonTitles.drawPolyButton"),className:"control-icon leaflet-pm-icon-polygon",jsClass:"Polygon",onClick:()=>{},afterClick:(z,S)=>{this.map.pm.Draw[S.button._button.jsClass].toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,actions:["finish","removeLastVertex","cancel"]},r={className:"control-icon leaflet-pm-icon-polyline",title:_t("buttonTitles.drawLineButton"),jsClass:"Line",onClick:()=>{},afterClick:(z,S)=>{this.map.pm.Draw[S.button._button.jsClass].toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,actions:["finish","removeLastVertex","cancel"]},a={title:_t("buttonTitles.drawCircleButton"),className:"control-icon leaflet-pm-icon-circle",jsClass:"Circle",onClick:()=>{},afterClick:(z,S)=>{this.map.pm.Draw[S.button._button.jsClass].toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,actions:["cancel"]},s={title:_t("buttonTitles.drawCircleMarkerButton"),className:"control-icon leaflet-pm-icon-circle-marker",jsClass:"CircleMarker",onClick:()=>{},afterClick:(z,S)=>{this.map.pm.Draw[S.button._button.jsClass].toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,actions:["cancel"]},l={title:_t("buttonTitles.drawRectButton"),className:"control-icon leaflet-pm-icon-rectangle",jsClass:"Rectangle",onClick:()=>{},afterClick:(z,S)=>{this.map.pm.Draw[S.button._button.jsClass].toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,actions:["cancel"]},h={title:_t("buttonTitles.editButton"),className:"control-icon leaflet-pm-icon-edit",onClick:()=>{},afterClick:()=>{this.map.pm.toggleGlobalEditMode()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,tool:"edit",actions:["finishMode"]},d={title:_t("buttonTitles.dragButton"),className:"control-icon leaflet-pm-icon-drag",onClick:()=>{},afterClick:()=>{this.map.pm.toggleGlobalDragMode()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,tool:"edit",actions:["finishMode"]},f={title:_t("buttonTitles.cutButton"),className:"control-icon leaflet-pm-icon-cut",jsClass:"Cut",onClick:()=>{},afterClick:(z,S)=>{this.map.pm.Draw[S.button._button.jsClass].toggle({snappable:!0,cursorMarker:!0,allowSelfIntersection:!1})},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,tool:"edit",actions:["finish","removeLastVertex","cancel"]},_={title:_t("buttonTitles.deleteButton"),className:"control-icon leaflet-pm-icon-delete",onClick:()=>{},afterClick:()=>{this.map.pm.toggleGlobalRemovalMode()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,tool:"edit",actions:["finishMode"]},k={title:_t("buttonTitles.rotateButton"),className:"control-icon leaflet-pm-icon-rotate",onClick:()=>{},afterClick:()=>{this.map.pm.toggleGlobalRotateMode()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,tool:"edit",actions:["finishMode"]},w={className:"control-icon leaflet-pm-icon-text",title:_t("buttonTitles.drawTextButton"),jsClass:"Text",onClick:()=>{},afterClick:(z,S)=>{this.map.pm.Draw[S.button._button.jsClass].toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,actions:["cancel"]};this._addButton("drawMarker",new L.Control.PMButton(e)),this._addButton("drawPolyline",new L.Control.PMButton(r)),this._addButton("drawRectangle",new L.Control.PMButton(l)),this._addButton("drawPolygon",new L.Control.PMButton(i)),this._addButton("drawCircle",new L.Control.PMButton(a)),this._addButton("drawCircleMarker",new L.Control.PMButton(s)),this._addButton("drawText",new L.Control.PMButton(w)),this._addButton("editMode",new L.Control.PMButton(h)),this._addButton("dragMode",new L.Control.PMButton(d)),this._addButton("cutPolygon",new L.Control.PMButton(f)),this._addButton("removalMode",new L.Control.PMButton(_)),this._addButton("rotateMode",new L.Control.PMButton(k))},_showHideButtons(){if(!this.isVisible)return;this.removeControls(),this.isVisible=!0;let e=this.getButtons(),i=[];this.options.drawControls===!1&&(i=i.concat(Object.keys(e).filter(r=>!e[r]._button.tool))),this.options.editControls===!1&&(i=i.concat(Object.keys(e).filter(r=>e[r]._button.tool==="edit"))),this.options.optionsControls===!1&&(i=i.concat(Object.keys(e).filter(r=>e[r]._button.tool==="options"))),this.options.customControls===!1&&(i=i.concat(Object.keys(e).filter(r=>e[r]._button.tool==="custom")));for(let r in e)if(this.options[r]&&i.indexOf(r)===-1){let a=e[r]._button.tool;a||(a="draw"),e[r].setPosition(this._getBtnPosition(a)),e[r].addTo(this.map)}},_getBtnPosition(e){return this.options.positions&&this.options.positions[e]?this.options.positions[e]:this.options.position},setBlockPosition(e,i){this.options.positions[e]=i,this._showHideButtons(),this.changeControlOrder()},getBlockPositions(){return this.options.positions},copyDrawControl(e,i){if(i)typeof i!="object"&&(i={name:i});else throw new TypeError("Button has no name");let r=this._btnNameMapping(e);if(!i.name)throw new TypeError("Button has no name");if(this.buttons[i.name])throw new TypeError("Button with this name already exists");let a=this.map.pm.Draw.createNewDrawInstance(i.name,r);i={...this.buttons[r]._button,...i};let s=this.createCustomControl(i);return{drawInstance:a,control:s}},createCustomControl(e){if(!e.name)throw new TypeError("Button has no name");if(this.buttons[e.name])throw new TypeError("Button with this name already exists");e.onClick||(e.onClick=()=>{}),e.afterClick||(e.afterClick=()=>{}),e.toggle!==!1&&(e.toggle=!0),e.block&&(e.block=e.block.toLowerCase()),(!e.block||e.block==="draw")&&(e.block=""),e.className?e.className.indexOf("control-icon")===-1&&(e.className=`control-icon ${e.className}`):e.className="control-icon";let i={tool:e.block,className:e.className,title:e.title||"",jsClass:e.name,onClick:e.onClick,afterClick:e.afterClick,doToggle:e.toggle,toggleStatus:!1,disableOtherButtons:e.disableOtherButtons??!0,disableByOtherButtons:e.disableByOtherButtons??!0,cssToggle:e.toggle,position:this.options.position,actions:e.actions||[],disabled:!!e.disabled};this.options[e.name]!==!1&&(this.options[e.name]=!0);let r=this._addButton(e.name,new L.Control.PMButton(i));return this.changeControlOrder(),r},controlExists(e){return!!this.getButton(e)},getButton(e){return this.getButtons()[e]},getButtonsInBlock(e){let i={};if(e)for(let r in this.getButtons()){let a=this.getButtons()[r];(a._button.tool===e||e==="draw"&&!a._button.tool)&&(i[r]=a)}return i},changeControlOrder(e=[]){let i=this._shapeMapping(),r=[];e.forEach(l=>{i[l]?r.push(i[l]):r.push(l)});let a=this.getButtons(),s={};r.forEach(l=>{a[l]&&(s[l]=a[l])}),Object.keys(a).filter(l=>!a[l]._button.tool||a[l]._button.tool==="draw").forEach(l=>{r.indexOf(l)===-1&&(s[l]=a[l])}),Object.keys(a).filter(l=>a[l]._button.tool==="edit").forEach(l=>{r.indexOf(l)===-1&&(s[l]=a[l])}),Object.keys(a).filter(l=>a[l]._button.tool==="options").forEach(l=>{r.indexOf(l)===-1&&(s[l]=a[l])}),Object.keys(a).filter(l=>a[l]._button.tool==="custom").forEach(l=>{r.indexOf(l)===-1&&(s[l]=a[l])}),Object.keys(a).forEach(l=>{r.indexOf(l)===-1&&(s[l]=a[l])}),this.map.pm.Toolbar.buttons=s,this._showHideButtons()},getControlOrder(){let e=this.getButtons(),i=[];for(let r in e)i.push(r);return i},changeActionsOfControl(e,i){let r=this._btnNameMapping(e);if(!r)throw new TypeError("No name passed");if(!i)throw new TypeError("No actions passed");if(!this.buttons[r])throw new TypeError("Button with this name not exists");this.buttons[r]._button.actions=i,this.changeControlOrder()},setButtonDisabled(e,i){let r=this._btnNameMapping(e);i?this.buttons[r].disable():this.buttons[r].enable()},_shapeMapping(){return{Marker:"drawMarker",Circle:"drawCircle",Polygon:"drawPolygon",Rectangle:"drawRectangle",Polyline:"drawPolyline",Line:"drawPolyline",CircleMarker:"drawCircleMarker",Edit:"editMode",Drag:"dragMode",Cut:"cutPolygon",Removal:"removalMode",Rotate:"rotateMode",Text:"drawText"}},_btnNameMapping(e){let i=this._shapeMapping();return i[e]?i[e]:e}}),Or=Fa,Fr=pt(We()),Ra={_initSnappableMarkers(){this.options.snapDistance=this.options.snapDistance||30,this.options.snapSegment=this.options.snapSegment===void 0?!0:this.options.snapSegment,this._assignEvents(this._markers),this._layer.off("pm:dragstart",this._unsnap,this),this._layer.on("pm:dragstart",this._unsnap,this)},_disableSnapping(){this._layer.off("pm:dragstart",this._unsnap,this)},_assignEvents(e){e.forEach(i=>{if(Array.isArray(i)){this._assignEvents(i);return}i.off("drag",this._handleSnapping,this),i.on("drag",this._handleSnapping,this),i.off("dragend",this._cleanupSnapping,this),i.on("dragend",this._cleanupSnapping,this)})},_cleanupSnapping(e){if(e){let i=e.target;i._snapped=!1}delete this._snapList,this.throttledList&&(this._map.off("layeradd",this.throttledList,this),this.throttledList=void 0),this._map.off("layerremove",this._handleSnapLayerRemoval,this),this.debugIndicatorLines&&this.debugIndicatorLines.forEach(i=>{i.remove()})},_handleThrottleSnapping(){this.throttledList&&this._createSnapList()},_handleSnapping(e){let i=e.target;if(i._snapped=!1,this.throttledList||(this.throttledList=L.Util.throttle(this._handleThrottleSnapping,100,this)),e?.originalEvent?.altKey||this._map?.pm?.Keyboard.isAltKeyPressed()||(this._snapList===void 0&&(this._createSnapList(),this._map.off("layeradd",this.throttledList,this),this._map.on("layeradd",this.throttledList,this)),this._snapList.length<=0))return!1;let r=this._calcClosestLayer(i.getLatLng(),this._snapList);if(Object.keys(r).length===0)return!1;let a=r.layer instanceof L.Marker||r.layer instanceof L.CircleMarker||!this.options.snapSegment,s;a?s=r.latlng:s=this._checkPrioritiySnapping(r);let l=this.options.snapDistance,h={marker:i,shape:this._shape,snapLatLng:s,segment:r.segment,layer:this._layer,workingLayer:this._layer,layerInteractedWith:r.layer,distance:r.distance};if(this._fireSnapDrag(h.marker,h),this._fireSnapDrag(this._layer,h),r.distance{this._snapLatLng=s,this._fireSnap(i,h),this._fireSnap(this._layer,h)},f=this._snapLatLng||{},_=s||{};(f.lat!==_.lat||f.lng!==_.lng)&&d()}else this._snapLatLng&&(this._unsnap(h),i._snapped=!1,i._snapInfo=void 0,this._fireUnsnap(h.marker,h),this._fireUnsnap(this._layer,h));return!0},_createSnapList(){let e=[],i=[],r=this._map;r.off("layerremove",this._handleSnapLayerRemoval,this),r.on("layerremove",this._handleSnapLayerRemoval,this),r.eachLayer(a=>{if((a instanceof L.Polyline||a instanceof L.Marker||a instanceof L.CircleMarker||a instanceof L.ImageOverlay)&&a.options.snapIgnore!==!0){if(a.options.snapIgnore===void 0&&(!L.PM.optIn&&a.options.pmIgnore===!0||L.PM.optIn&&a.options.pmIgnore!==!1))return;(a instanceof L.Circle||a instanceof L.CircleMarker)&&a.pm&&a.pm._hiddenPolyCircle?e.push(a.pm._hiddenPolyCircle):a instanceof L.ImageOverlay&&(a=L.rectangle(a.getBounds())),e.push(a);let s=L.polyline([],{color:"red",pmIgnore:!0});s._pmTempLayer=!0,i.push(s),(a instanceof L.Circle||a instanceof L.CircleMarker)&&i.push(s)}}),e=e.filter(a=>this._layer!==a),e=e.filter(a=>a._latlng||a._latlngs&&wn(a._latlngs)),e=e.filter(a=>!a._pmTempLayer),this._otherSnapLayers?(this._otherSnapLayers.forEach(()=>{let a=L.polyline([],{color:"red",pmIgnore:!0});a._pmTempLayer=!0,i.push(a)}),this._snapList=e.concat(this._otherSnapLayers)):this._snapList=e,this.debugIndicatorLines=i},_handleSnapLayerRemoval({layer:e}){if(!e._leaflet_id)return;let i=this._snapList.findIndex(r=>r._leaflet_id===e._leaflet_id);i>-1&&this._snapList.splice(i,1)},_calcClosestLayer(e,i){return this._calcClosestLayers(e,i,1)[0]},_calcClosestLayers(e,i,r=1){let a=[],s={};i.forEach((h,d)=>{if(h._parentCopy&&h._parentCopy===this._layer||h.getLatLngs?.().flat(5).length<2)return;let f=this._calcLayerDistances(e,h);if(f.distance=Math.floor(f.distance),this.debugIndicatorLines){if(!this.debugIndicatorLines[d]){let _=L.polyline([],{color:"red",pmIgnore:!0});_._pmTempLayer=!0,this.debugIndicatorLines[d]=_}this.debugIndicatorLines[d].setLatLngs([e,f.latlng])}r===1&&(s.distance===void 0||f.distance-5<=s.distance)?(f.distance+5h.distance-d.distance)),r===-1&&(r=a.length);let l=this._getClosestLayerByPriority(a,r);return L.Util.isArray(l)?l:[l]},_calcLayerDistances(e,i){let r=this._map,a=i instanceof L.Marker||i instanceof L.CircleMarker,s=i instanceof L.Polygon,l=e;if(a){let h=i.getLatLng();return{latlng:{...h},distance:this._getDistance(r,h,l)}}return this._calcLatLngDistances(l,i.getLatLngs(),r,s)},_calcLatLngDistances(e,i,r,a=!1){let s,l,h,d=f=>{f.forEach((_,k)=>{if(Array.isArray(_)){d(_);return}if(this.options.snapSegment){let w=_,z;a?z=k+1===f.length?0:k+1:z=k+1===f.length?void 0:k+1;let S=f[z];if(S){let U=this._getDistanceToSegment(r,e,w,S);(l===void 0||Uh._leaflet_id-d._leaflet_id);let r=["Marker","CircleMarker","Circle","Line","Polygon","Rectangle"],a=this._map.pm.globalOptions.snappingOrder||[],s=0,l={};return a.concat(r).forEach(h=>{l[h]||(s+=1,l[h]=s)}),e.sort(Oa("instanceofShape",l)),i===1?e[0]||{}:e.slice(0,i)},_checkPrioritiySnapping(e){let i=this._map,r=e.segment[0],a=e.segment[1],s=e.latlng,l=s;if(this.options.snapVertex){let h=this._getDistance(i,r,s),d=this._getDistance(i,a,s),f=h{this[r]=new L.PM.Draw[r](this._map)}),this.Marker.setOptions({continueDrawing:!0}),this.CircleMarker.setOptions({continueDrawing:!0})},setPathOptions(e,i=!1){i?this.options.pathOptions=(0,Fr.default)(this.options.pathOptions,e):this.options.pathOptions=e},getShapes(){return this.shapes},getShape(){return this._shape},enable(e,i){if(!e)throw new Error(`Error: Please pass a shape as a parameter. Possible shapes are: ${this.getShapes().join(",")}`);this.disable(),this[e].enable(i)},disable(){this.shapes.forEach(e=>{this[e].disable()})},addControls(){this.shapes.forEach(e=>{this[e].addButton()})},getActiveShape(){let e;return this.shapes.forEach(i=>{this[i]._enabled&&(e=i)}),e},_setGlobalDrawMode(){this._shape==="Cut"?this._fireGlobalCutModeToggled():this._fireGlobalDrawModeToggled();let e=[];this._map.eachLayer(i=>{(i instanceof L.Polyline||i instanceof L.Marker||i instanceof L.Circle||i instanceof L.CircleMarker||i instanceof L.ImageOverlay)&&(i._pmTempLayer||e.push(i))}),this._enabled?e.forEach(i=>{L.PM.Utils.disablePopup(i)}):e.forEach(i=>{L.PM.Utils.enablePopup(i)})},createNewDrawInstance(e,i){let r=this._getShapeFromBtnName(i);if(this[e])throw new TypeError("Draw Type already exists");if(!L.PM.Draw[r])throw new TypeError(`There is no class L.PM.Draw.${r}`);return this[e]=new L.PM.Draw[r](this._map),this[e].toolbarButtonName=e,this[e]._shape=e,this.shapes.push(e),this[i]&&this[e].setOptions(this[i].options),this[e].setOptions(this[e].options),this[e]},_getShapeFromBtnName(e){let i={drawMarker:"Marker",drawCircle:"Circle",drawPolygon:"Polygon",drawPolyline:"Line",drawRectangle:"Rectangle",drawCircleMarker:"CircleMarker",editMode:"Edit",dragMode:"Drag",cutPolygon:"Cut",removalMode:"Removal",rotateMode:"Rotate",drawText:"Text"};return i[e]?i[e]:this[e]?this[e]._shape:e},_finishLayer(e){e.pm&&(e.pm.setOptions(this.options),e.pm._shape=this._shape,e.pm._map=this._map),this._addDrawnLayerProp(e)},_addDrawnLayerProp(e){e._drawnByGeoman=!0},_setPane(e,i){i==="layerPane"?e.options.pane=this._map.pm.globalOptions.panes&&this._map.pm.globalOptions.panes.layerPane||"overlayPane":i==="vertexPane"?e.options.pane=this._map.pm.globalOptions.panes&&this._map.pm.globalOptions.panes.vertexPane||"markerPane":i==="markerPane"&&(e.options.pane=this._map.pm.globalOptions.panes&&this._map.pm.globalOptions.panes.markerPane||"markerPane")},_isFirstLayer(){return(this._map||this._layer._map).pm.getGeomanLayers().length===0}}),Zt=Tn;Zt.Marker=Zt.extend({initialize(e){this._map=e,this._shape="Marker",this.toolbarButtonName="drawMarker"},enable(e){L.Util.setOptions(this,e),this._enabled=!0,this._map.getContainer().classList.add("geoman-draw-cursor"),this._map.on("click",this._createMarker,this),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!0),this._hintMarker=L.marker(this._map.getCenter(),this.options.markerStyle),this._setPane(this._hintMarker,"markerPane"),this._hintMarker._pmTempLayer=!0,this._hintMarker.addTo(this._map),this.options.tooltips&&this._hintMarker.bindTooltip(_t("tooltips.placeMarker"),{permanent:!0,offset:L.point(0,10),direction:"bottom",opacity:.8}).openTooltip(),this._layer=this._hintMarker,this._map.on("mousemove",this._syncHintMarker,this),this.options.markerEditable&&this._map.eachLayer(i=>{this.isRelevantMarker(i)&&i.pm.enable()}),this._fireDrawStart(),this._setGlobalDrawMode()},disable(){this._enabled&&(this._enabled=!1,this._map.getContainer().classList.remove("geoman-draw-cursor"),this._map.off("click",this._createMarker,this),this._hintMarker.remove(),this._map.off("mousemove",this._syncHintMarker,this),this._map.eachLayer(e=>{this.isRelevantMarker(e)&&e.pm.disable()}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this.options.snappable&&this._cleanupSnapping(),this._fireDrawEnd(),this._setGlobalDrawMode())},enabled(){return this._enabled},toggle(e){this.enabled()?this.disable():this.enable(e)},isRelevantMarker(e){return e instanceof L.Marker&&e.pm&&!e._pmTempLayer&&!e.pm._initTextMarker},_syncHintMarker(e){if(this._hintMarker.setLatLng(e.latlng),this.options.snappable){let i=e;i.target=this._hintMarker,this._handleSnapping(i)}this._fireChange(this._hintMarker.getLatLng(),"Draw")},_createMarker(e){if(!e.latlng||this.options.requireSnapToFinish&&!this._hintMarker._snapped&&!this._isFirstLayer())return;this._hintMarker._snapped||this._hintMarker.setLatLng(e.latlng);let i=this._hintMarker.getLatLng(),r=new L.Marker(i,this.options.markerStyle);this._setPane(r,"markerPane"),this._finishLayer(r),r.pm||(r.options.draggable=!1),r.addTo(this._map.pm._getContainingLayer()),r.pm&&this.options.markerEditable?r.pm.enable():r.dragging&&r.dragging.disable(),this._fireCreate(r),this._cleanupSnapping(),this.options.continueDrawing||this.disable()},setStyle(){this.options.markerStyle?.icon&&this._hintMarker?.setIcon(this.options.markerStyle.icon)}});var Ut=63710088e-1,Dn={centimeters:Ut*100,centimetres:Ut*100,degrees:Ut/111325,feet:Ut*3.28084,inches:Ut*39.37,kilometers:Ut/1e3,kilometres:Ut/1e3,meters:Ut,metres:Ut,miles:Ut/1609.344,millimeters:Ut*1e3,millimetres:Ut*1e3,nauticalmiles:Ut/1852,radians:1,yards:Ut*1.0936},Sn={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Ut,yards:1.0936133};function re(e,i,r){r===void 0&&(r={});var a={type:"Feature"};return(r.id===0||r.id)&&(a.id=r.id),r.bbox&&(a.bbox=r.bbox),a.properties=i||{},a.geometry=e,a}function $e(e,i,r){if(r===void 0&&(r={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!zi(e[0])||!zi(e[1]))throw new Error("coordinates must contain numbers");var a={type:"Point",coordinates:e};return re(a,i,r)}function ke(e,i,r){if(r===void 0&&(r={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var a={type:"LineString",coordinates:e};return re(a,i,r)}function Ft(e,i){i===void 0&&(i={});var r={type:"FeatureCollection"};return i.id&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.features=e,r}function Ir(e,i){i===void 0&&(i="kilometers");var r=Dn[i];if(!r)throw new Error(i+" units is invalid");return e*r}function zr(e,i){i===void 0&&(i="kilometers");var r=Dn[i];if(!r)throw new Error(i+" units is invalid");return e/r}function An(e){var i=e%(2*Math.PI);return i*180/Math.PI}function te(e){var i=e%360;return i*Math.PI/180}function zi(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Ni(e){var i,r,a={type:"FeatureCollection",features:[]};if(e.type==="Feature"?r=e.geometry:r=e,r.type==="LineString")i=[r.coordinates];else if(r.type==="MultiLineString")i=r.coordinates;else if(r.type==="MultiPolygon")i=[].concat.apply([],r.coordinates);else if(r.type==="Polygon")i=r.coordinates;else throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");return i.forEach(function(s){i.forEach(function(l){for(var h=0;h=0&&_<=1&&(S.onLine1=!0),k>=0&&k<=1&&(S.onLine2=!0),S.onLine1&&S.onLine2?[S.x,S.y]:!1)}Zt.Line=Zt.extend({initialize(e){this._map=e,this._shape="Line",this.toolbarButtonName="drawPolyline",this._doesSelfIntersect=!1},enable(e){L.Util.setOptions(this,e),this._enabled=!0,this._markers=[],this._layerGroup=new L.FeatureGroup,this._layerGroup._pmTempLayer=!0,this._layerGroup.addTo(this._map),this._layer=L.polyline([],{...this.options.templineStyle,pmIgnore:!1}),this._setPane(this._layer,"layerPane"),this._layer._pmTempLayer=!0,this._layerGroup.addLayer(this._layer),this._hintline=L.polyline([],this.options.hintlineStyle),this._setPane(this._hintline,"layerPane"),this._hintline._pmTempLayer=!0,this._layerGroup.addLayer(this._hintline),this._hintMarker=L.marker(this._map.getCenter(),{interactive:!1,zIndexOffset:100,icon:L.divIcon({className:"marker-icon cursor-marker"})}),this._setPane(this._hintMarker,"vertexPane"),this._hintMarker._pmTempLayer=!0,this._layerGroup.addLayer(this._hintMarker),this.options.cursorMarker&&L.DomUtil.addClass(this._hintMarker._icon,"visible"),this.options.tooltips&&this._hintMarker.bindTooltip(_t("tooltips.firstVertex"),{permanent:!0,offset:L.point(0,10),direction:"bottom",opacity:.8}).openTooltip(),this._map.getContainer().classList.add("geoman-draw-cursor"),this._map.on("click",this._createVertex,this),this.options.finishOn&&this.options.finishOn!=="snap"&&this._map.on(this.options.finishOn,this._finishShape,this),this.options.finishOn==="dblclick"&&(this.tempMapDoubleClickZoomState=this._map.doubleClickZoom._enabled,this.tempMapDoubleClickZoomState&&this._map.doubleClickZoom.disable()),this._map.on("mousemove",this._syncHintMarker,this),this._hintMarker.on("move",this._syncHintLine,this),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!0),this._otherSnapLayers=[],this.isRed=!1,this._fireDrawStart(),this._setGlobalDrawMode()},disable(){this._enabled&&(this._enabled=!1,this._map.getContainer().classList.remove("geoman-draw-cursor"),this._map.off("click",this._createVertex,this),this._map.off("mousemove",this._syncHintMarker,this),this.options.finishOn&&this.options.finishOn!=="snap"&&this._map.off(this.options.finishOn,this._finishShape,this),this.tempMapDoubleClickZoomState&&this._map.doubleClickZoom.enable(),this._map.removeLayer(this._layerGroup),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this.options.snappable&&this._cleanupSnapping(),this._fireDrawEnd(),this._setGlobalDrawMode())},enabled(){return this._enabled},toggle(e){this.enabled()?this.disable():this.enable(e)},_syncHintLine(){let e=this._layer.getLatLngs();if(e.length>0){let i=e[e.length-1];this._hintline.setLatLngs([i,this._hintMarker.getLatLng()])}},_syncHintMarker(e){if(this._hintMarker.setLatLng(e.latlng),this.options.snappable){let r=e;r.target=this._hintMarker,this._handleSnapping(r)}this.options.allowSelfIntersection||this._handleSelfIntersection(!0,this._hintMarker.getLatLng());let i=this._layer._defaultShape().slice();i.push(this._hintMarker.getLatLng()),this._change(i)},hasSelfIntersection(){return Ni(this._layer.toGeoJSON(15)).features.length>0},_handleSelfIntersection(e,i){let r=L.polyline(this._layer.getLatLngs());e&&(i||(i=this._hintMarker.getLatLng()),r.addLatLng(i));let a=Ni(r.toGeoJSON(15));this._doesSelfIntersect=a.features.length>0,this._doesSelfIntersect?this.isRed||(this.isRed=!0,this._hintline.setStyle({color:"#f00000ff"}),this._fireIntersect(a,this._map,"Draw")):this._hintline.isEmpty()||(this.isRed=!1,this._hintline.setStyle(this.options.hintlineStyle))},_createVertex(e){if(!this.options.allowSelfIntersection&&(this._handleSelfIntersection(!0,e.latlng),this._doesSelfIntersect))return;this._hintMarker._snapped||this._hintMarker.setLatLng(e.latlng);let i=this._hintMarker.getLatLng(),r=this._layer.getLatLngs(),a=r[r.length-1];if(i.equals(r[0])||r.length>0&&i.equals(a)){this._finishShape();return}this._layer._latlngInfo=this._layer._latlngInfo||[],this._layer._latlngInfo.push({latlng:i,snapInfo:this._hintMarker._snapInfo}),this._layer.addLatLng(i);let s=this._createMarker(i);this._setTooltipText(),this._setHintLineAfterNewVertex(i),this._fireVertexAdded(s,void 0,i,"Draw"),this._change(this._layer.getLatLngs()),this.options.finishOn==="snap"&&this._hintMarker._snapped&&this._finishShape(e)},_setHintLineAfterNewVertex(e){this._hintline.setLatLngs([e,e])},_removeLastVertex(){let e=this._markers;if(e.length<=1){this.disable();return}let i=this._layer.getLatLngs(),r=e[e.length-1],{indexPath:a}=L.PM.Utils.findDeepMarkerIndex(e,r);e.pop(),this._layerGroup.removeLayer(r);let s=e[e.length-1],l=i.indexOf(s.getLatLng());i=i.slice(0,l+1),this._layer.setLatLngs(i),this._layer._latlngInfo.pop(),this._syncHintLine(),this._setTooltipText(),this._fireVertexRemoved(r,a,"Draw"),this._change(this._layer.getLatLngs())},_finishShape(){if(!this.options.allowSelfIntersection&&(this._handleSelfIntersection(!1),this._doesSelfIntersect)||this.options.requireSnapToFinish&&!this._hintMarker._snapped&&!this._isFirstLayer())return;let e=this._layer.getLatLngs();if(e.length<=1)return;let i=L.polyline(e,this.options.pathOptions);this._setPane(i,"layerPane"),this._finishLayer(i),i.addTo(this._map.pm._getContainingLayer()),this._fireCreate(i),this.options.snappable&&this._cleanupSnapping();let r=this._hintMarker.getLatLng();this.disable(),this.options.continueDrawing&&(this.enable(),this._hintMarker.setLatLng(r))},_createMarker(e){let i=new L.Marker(e,{draggable:!1,icon:L.divIcon({className:"marker-icon"})});return this._setPane(i,"vertexPane"),i._pmTempLayer=!0,this._layerGroup.addLayer(i),this._markers.push(i),i.on("click",this._finishShape,this),i},_setTooltipText(){let{length:e}=this._layer.getLatLngs().flat(),i="";e<=1?i=_t("tooltips.continueLine"):i=_t("tooltips.finishLine"),this._hintMarker.setTooltipContent(i)},_change(e){this._fireChange(e,"Draw")},setStyle(){this._layer?.setStyle(this.options.templineStyle),this._hintline?.setStyle(this.options.hintlineStyle)}}),Zt.Polygon=Zt.Line.extend({initialize(e){this._map=e,this._shape="Polygon",this.toolbarButtonName="drawPolygon"},enable(e){L.PM.Draw.Line.prototype.enable.call(this,e),this._layer.pm._shape="Polygon"},_createMarker(e){let i=new L.Marker(e,{draggable:!1,icon:L.divIcon({className:"marker-icon"})});return this._setPane(i,"vertexPane"),i._pmTempLayer=!0,this._layerGroup.addLayer(i),this._markers.push(i),this._layer.getLatLngs().flat().length===1?(i.on("click",this._finishShape,this),this._tempSnapLayerIndex=this._otherSnapLayers.push(i)-1,this.options.snappable&&this._cleanupSnapping()):i.on("click",()=>1),i},_setTooltipText(){let{length:e}=this._layer.getLatLngs().flat(),i="";e<=2?i=_t("tooltips.continueLine"):i=_t("tooltips.finishPoly"),this._hintMarker.setTooltipContent(i)},_finishShape(){if(!this.options.allowSelfIntersection&&(this._handleSelfIntersection(!0,this._layer.getLatLngs()[0]),this._doesSelfIntersect)||this.options.requireSnapToFinish&&!this._hintMarker._snapped&&!this._isFirstLayer())return;let e=this._layer.getLatLngs();if(e.length<=2)return;let i=L.polygon(e,this.options.pathOptions);this._setPane(i,"layerPane"),this._finishLayer(i),i.addTo(this._map.pm._getContainingLayer()),this._fireCreate(i),this._cleanupSnapping(),this._otherSnapLayers.splice(this._tempSnapLayerIndex,1),delete this._tempSnapLayerIndex;let r=this._hintMarker.getLatLng();this.disable(),this.options.continueDrawing&&(this.enable(),this._hintMarker.setLatLng(r))}}),Zt.Rectangle=Zt.extend({initialize(e){this._map=e,this._shape="Rectangle",this.toolbarButtonName="drawRectangle"},enable(e){if(L.Util.setOptions(this,e),this._enabled=!0,this._layerGroup=new L.FeatureGroup,this._layerGroup._pmTempLayer=!0,this._layerGroup.addTo(this._map),this._layer=L.rectangle([[0,0],[0,0]],this.options.pathOptions),this._setPane(this._layer,"layerPane"),this._layer._pmTempLayer=!0,this._startMarker=L.marker(this._map.getCenter(),{icon:L.divIcon({className:"marker-icon rect-start-marker"}),draggable:!1,zIndexOffset:-100,opacity:this.options.cursorMarker?1:0}),this._setPane(this._startMarker,"vertexPane"),this._startMarker._pmTempLayer=!0,this._layerGroup.addLayer(this._startMarker),this._hintMarker=L.marker(this._map.getCenter(),{zIndexOffset:150,icon:L.divIcon({className:"marker-icon cursor-marker"})}),this._setPane(this._hintMarker,"vertexPane"),this._hintMarker._pmTempLayer=!0,this._layerGroup.addLayer(this._hintMarker),this.options.cursorMarker&&L.DomUtil.addClass(this._hintMarker._icon,"visible"),this.options.tooltips&&this._hintMarker.bindTooltip(_t("tooltips.firstVertex"),{permanent:!0,offset:L.point(0,10),direction:"bottom",opacity:.8}).openTooltip(),this.options.cursorMarker){this._styleMarkers=[];for(let i=0;i<2;i+=1){let r=L.marker(this._map.getCenter(),{icon:L.divIcon({className:"marker-icon rect-style-marker"}),draggable:!1,zIndexOffset:100});this._setPane(r,"vertexPane"),r._pmTempLayer=!0,this._layerGroup.addLayer(r),this._styleMarkers.push(r)}}this._map.getContainer().classList.add("geoman-draw-cursor"),this._map.on("click",this._placeStartingMarkers,this),this._map.on("mousemove",this._syncHintMarker,this),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!0),this._otherSnapLayers=[],this._fireDrawStart(),this._setGlobalDrawMode()},disable(){this._enabled&&(this._enabled=!1,this._map.getContainer().classList.remove("geoman-draw-cursor"),this._map.off("click",this._finishShape,this),this._map.off("click",this._placeStartingMarkers,this),this._map.off("mousemove",this._syncHintMarker,this),this._map.removeLayer(this._layerGroup),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this.options.snappable&&this._cleanupSnapping(),this._fireDrawEnd(),this._setGlobalDrawMode())},enabled(){return this._enabled},toggle(e){this.enabled()?this.disable():this.enable(e)},_placeStartingMarkers(e){this._hintMarker._snapped||this._hintMarker.setLatLng(e.latlng);let i=this._hintMarker.getLatLng();L.DomUtil.addClass(this._startMarker._icon,"visible"),this._startMarker.setLatLng(i),this.options.cursorMarker&&this._styleMarkers&&this._styleMarkers.forEach(r=>{L.DomUtil.addClass(r._icon,"visible"),r.setLatLng(i)}),this._map.off("click",this._placeStartingMarkers,this),this._map.on("click",this._finishShape,this),this._hintMarker.setTooltipContent(_t("tooltips.finishRect")),this._setRectangleOrigin()},_setRectangleOrigin(){let e=this._startMarker.getLatLng();e&&(this._layerGroup.addLayer(this._layer),this._layer.setLatLngs([e,e]),this._hintMarker.on("move",this._syncRectangleSize,this))},_syncHintMarker(e){if(this._hintMarker.setLatLng(e.latlng),this.options.snappable){let r=e;r.target=this._hintMarker,this._handleSnapping(r)}let i=this._layerGroup&&this._layerGroup.hasLayer(this._layer)?this._layer.getLatLngs():[this._hintMarker.getLatLng()];this._fireChange(i,"Draw")},_syncRectangleSize(){let e=Dr(this._startMarker.getLatLng(),this._map),i=Dr(this._hintMarker.getLatLng(),this._map),r=L.PM.Utils._getRotatedRectangle(e,i,this.options.rectangleAngle||0,this._map);if(this._layer.setLatLngs(r),this.options.cursorMarker&&this._styleMarkers){let a=[];r.forEach(s=>{!s.equals(e,1e-8)&&!s.equals(i,1e-8)&&a.push(s)}),a.forEach((s,l)=>{try{this._styleMarkers[l].setLatLng(s)}catch{}})}},_findCorners(){let e=this._layer.getLatLngs()[0];return L.PM.Utils._getRotatedRectangle(e[0],e[2],this.options.rectangleAngle||0,this._map)},_finishShape(e){this._hintMarker._snapped||this._hintMarker.setLatLng(e.latlng);let i=this._hintMarker.getLatLng(),r=this._startMarker.getLatLng();if(this.options.requireSnapToFinish&&!this._hintMarker._snapped&&!this._isFirstLayer()||r.equals(i))return;let a=L.rectangle([r,i],this.options.pathOptions);if(this.options.rectangleAngle){let l=L.PM.Utils._getRotatedRectangle(r,i,this.options.rectangleAngle||0,this._map);a.setLatLngs(l),a.pm&&a.pm._setAngle(this.options.rectangleAngle||0)}this._setPane(a,"layerPane"),this._finishLayer(a),a.addTo(this._map.pm._getContainingLayer()),this._fireCreate(a);let s=this._hintMarker.getLatLng();this.disable(),this.options.continueDrawing&&(this.enable(),this._hintMarker.setLatLng(s))},setStyle(){this._layer?.setStyle(this.options.pathOptions)}}),Zt.CircleMarker=Zt.extend({initialize(e){this._map=e,this._shape="CircleMarker",this.toolbarButtonName="drawCircleMarker",this._layerIsDragging=!1,this._BaseCircleClass=L.CircleMarker,this._minRadiusOption="minRadiusCircleMarker",this._maxRadiusOption="maxRadiusCircleMarker",this._editableOption="resizeableCircleMarker",this._defaultRadius=10},enable(e){if(L.Util.setOptions(this,e),this.options.editable&&(this.options.resizeableCircleMarker=this.options.editable,delete this.options.editable),this._enabled=!0,this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!0),this._map.getContainer().classList.add("geoman-draw-cursor"),this.options[this._editableOption]){let i={};L.extend(i,this.options.templineStyle),i.radius=0,this._layerGroup=new L.FeatureGroup,this._layerGroup._pmTempLayer=!0,this._layerGroup.addTo(this._map),this._layer=new this._BaseCircleClass(this._map.getCenter(),i),this._setPane(this._layer,"layerPane"),this._layer._pmTempLayer=!0,this._centerMarker=L.marker(this._map.getCenter(),{icon:L.divIcon({className:"marker-icon"}),draggable:!1,zIndexOffset:100}),this._setPane(this._centerMarker,"vertexPane"),this._centerMarker._pmTempLayer=!0,this._hintMarker=L.marker(this._map.getCenter(),{zIndexOffset:110,icon:L.divIcon({className:"marker-icon cursor-marker"})}),this._setPane(this._hintMarker,"vertexPane"),this._hintMarker._pmTempLayer=!0,this._layerGroup.addLayer(this._hintMarker),this.options.cursorMarker&&L.DomUtil.addClass(this._hintMarker._icon,"visible"),this.options.tooltips&&this._hintMarker.bindTooltip(_t("tooltips.startCircle"),{permanent:!0,offset:L.point(0,10),direction:"bottom",opacity:.8}).openTooltip(),this._hintline=L.polyline([],this.options.hintlineStyle),this._setPane(this._hintline,"layerPane"),this._hintline._pmTempLayer=!0,this._layerGroup.addLayer(this._hintline),this._map.on("click",this._placeCenterMarker,this)}else this._map.on("click",this._createMarker,this),this._hintMarker=new this._BaseCircleClass(this._map.getCenter(),{radius:this._defaultRadius,...this.options.templineStyle}),this._setPane(this._hintMarker,"layerPane"),this._hintMarker._pmTempLayer=!0,this._hintMarker.addTo(this._map),this._layer=this._hintMarker,this.options.tooltips&&this._hintMarker.bindTooltip(_t("tooltips.placeCircleMarker"),{permanent:!0,offset:L.point(0,10),direction:"bottom",opacity:.8}).openTooltip();this._map.on("mousemove",this._syncHintMarker,this),this._extendingEnable(),this._otherSnapLayers=[],this._fireDrawStart(),this._setGlobalDrawMode()},_extendingEnable(){!this.options[this._editableOption]&&this.options.markerEditable&&this._map.eachLayer(e=>{this.isRelevantMarker(e)&&e.pm.enable()}),this._layer.bringToBack()},disable(){this._enabled&&(this._enabled=!1,this._map.getContainer().classList.remove("geoman-draw-cursor"),this.options[this._editableOption]?(this._map.off("click",this._finishShape,this),this._map.off("click",this._placeCenterMarker,this),this._map.removeLayer(this._layerGroup)):(this._map.off("click",this._createMarker,this),this._extendingDisable(),this._hintMarker.remove()),this._map.off("mousemove",this._syncHintMarker,this),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this.options.snappable&&this._cleanupSnapping(),this._fireDrawEnd(),this._setGlobalDrawMode())},_extendingDisable(){this._map.eachLayer(e=>{this.isRelevantMarker(e)&&e.pm.disable()})},enabled(){return this._enabled},toggle(e){this.enabled()?this.disable():this.enable(e)},_placeCenterMarker(e){this._hintMarker._snapped||this._hintMarker.setLatLng(e.latlng),this._layerGroup.addLayer(this._layer),this._layerGroup.addLayer(this._centerMarker);let i=this._hintMarker.getLatLng();this._centerMarker.setLatLng(i),this._map.off("click",this._placeCenterMarker,this),this._map.on("click",this._finishShape,this),this._placeCircleCenter()},_placeCircleCenter(){let e=this._centerMarker.getLatLng();e&&(this._layer.setLatLng(e),this._hintMarker.on("move",this._syncHintLine,this),this._hintMarker.on("move",this._syncCircleRadius,this),this._hintMarker.setTooltipContent(_t("tooltips.finishCircle")),this._fireCenterPlaced(),this._fireChange(this._layer.getLatLng(),"Draw"))},_syncHintLine(){let e=this._centerMarker.getLatLng(),i=this._getNewDestinationOfHintMarker();this._hintline.setLatLngs([e,i])},_syncCircleRadius(){let e=this._centerMarker.getLatLng(),i=this._hintMarker.getLatLng(),r=this._distanceCalculation(e,i);this.options[this._minRadiusOption]&&rthis.options[this._maxRadiusOption]?this._layer.setRadius(this.options[this._maxRadiusOption]):this._layer.setRadius(r)},_syncHintMarker(e){if(this._hintMarker.setLatLng(e.latlng),this._hintMarker.setLatLng(this._getNewDestinationOfHintMarker()),this.options.snappable){let r=e;r.target=this._hintMarker,this._handleSnapping(r)}this._handleHintMarkerSnapping();let i=this._layerGroup&&this._layerGroup.hasLayer(this._centerMarker)?this._centerMarker.getLatLng():this._hintMarker.getLatLng();this._fireChange(i,"Draw")},isRelevantMarker(e){return e instanceof L.CircleMarker&&!(e instanceof L.Circle)&&e.pm&&!e._pmTempLayer},_createMarker(e){if(this.options.requireSnapToFinish&&!this._hintMarker._snapped&&!this._isFirstLayer()||!e.latlng||this._layerIsDragging)return;this._hintMarker._snapped||this._hintMarker.setLatLng(e.latlng);let i=this._hintMarker.getLatLng(),r=new this._BaseCircleClass(i,{radius:this._defaultRadius,...this.options.pathOptions});this._setPane(r,"layerPane"),this._finishLayer(r),r.addTo(this._map.pm._getContainingLayer()),this._extendingCreateMarker(r),this._fireCreate(r),this._cleanupSnapping(),this.options.continueDrawing||this.disable()},_extendingCreateMarker(e){e.pm&&this.options.markerEditable&&e.pm.enable()},_finishShape(e){if(this.options.requireSnapToFinish&&!this._hintMarker._snapped&&!this._isFirstLayer())return;this._hintMarker._snapped||this._hintMarker.setLatLng(e.latlng);let i=this._centerMarker.getLatLng(),r=this._defaultRadius;if(this.options[this._editableOption]){let h=this._hintMarker.getLatLng();r=this._distanceCalculation(i,h),this.options[this._minRadiusOption]&&rthis.options[this._maxRadiusOption]&&(r=this.options[this._maxRadiusOption])}let a={...this.options.pathOptions,radius:r},s=new this._BaseCircleClass(i,a);this._setPane(s,"layerPane"),this._finishLayer(s),s.addTo(this._map.pm._getContainingLayer()),s.pm&&s.pm._updateHiddenPolyCircle(),this._fireCreate(s);let l=this._hintMarker.getLatLng();this.disable(),this.options.continueDrawing&&(this.enable(),this._hintMarker.setLatLng(l))},_getNewDestinationOfHintMarker(){let e=this._hintMarker.getLatLng();if(this.options[this._editableOption]){if(!this._layerGroup.hasLayer(this._centerMarker))return e;let i=this._centerMarker.getLatLng(),r=this._distanceCalculation(i,e);this.options[this._minRadiusOption]&&rthis.options[this._maxRadiusOption]&&(e=Xe(this._map,i,e,this._getMaxDistanceInMeter()))}return e},_getMinDistanceInMeter(){return L.PM.Utils.pxRadiusToMeterRadius(this.options[this._minRadiusOption],this._map,this._centerMarker.getLatLng())},_getMaxDistanceInMeter(){return L.PM.Utils.pxRadiusToMeterRadius(this.options[this._maxRadiusOption],this._map,this._centerMarker.getLatLng())},_handleHintMarkerSnapping(){if(this.options[this._editableOption]){if(this._hintMarker._snapped){let e=this._centerMarker.getLatLng(),i=this._hintMarker.getLatLng(),r=this._distanceCalculation(e,i);this._layerGroup.hasLayer(this._centerMarker)&&(this.options[this._minRadiusOption]&&rthis.options[this._maxRadiusOption]&&this._hintMarker.setLatLng(this._hintMarker._orgLatLng))}this._hintMarker.setLatLng(this._getNewDestinationOfHintMarker())}},setStyle(){let e={};L.extend(e,this.options.templineStyle),this.options[this._editableOption]&&(e.radius=0),this._layer?.setStyle(e),this._hintline?.setStyle(this.options.hintlineStyle)},_distanceCalculation(e,i){return this._map.project(e).distanceTo(this._map.project(i))}}),Zt.Circle=Zt.CircleMarker.extend({initialize(e){this._map=e,this._shape="Circle",this.toolbarButtonName="drawCircle",this._BaseCircleClass=L.Circle,this._minRadiusOption="minRadiusCircle",this._maxRadiusOption="maxRadiusCircle",this._editableOption="resizeableCircle",this._defaultRadius=100},_extendingEnable(){},_extendingDisable(){},_extendingCreateMarker(){},isRelevantMarker(){},_getMinDistanceInMeter(){return this.options[this._minRadiusOption]},_getMaxDistanceInMeter(){return this.options[this._maxRadiusOption]},_distanceCalculation(e,i){return this._map.distance(e,i)}});function de(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ge(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Yt(e){return e.type==="Feature"?e.geometry:e}function Ue(e,i){return e.type==="FeatureCollection"?"FeatureCollection":e.type==="GeometryCollection"?"GeometryCollection":e.type==="Feature"&&e.geometry!==null?e.geometry.type:e.type}function On(e,i,r){if(e!==null)for(var a,s,l,h,d,f,_,k=0,w=0,z,S=e.type,U=S==="FeatureCollection",q=S==="Feature",Q=U?e.features.length:1,mt=0;mts?r:s,_=a>l?a:l;return[h,d,f,_]}var ye=gi,Zi=pt(ht(),1);function Ga(e,i){var r={},a=[];if(e.type==="LineString"&&(e=re(e)),i.type==="LineString"&&(i=re(i)),e.type==="Feature"&&i.type==="Feature"&&e.geometry!==null&&i.geometry!==null&&e.geometry.type==="LineString"&&i.geometry.type==="LineString"&&e.geometry.coordinates.length===2&&i.geometry.coordinates.length===2){var s=ji(e,i);return s&&a.push(s),Ft(a)}var l=(0,Zi.default)();return l.load(ye(i)),ee(ye(e),function(h){ee(l.search(h),function(d){var f=ji(h,d);if(f){var _=ge(f).join(",");r[_]||(r[_]=!0,a.push(f))}})}),Ft(a)}function ji(e,i){var r=ge(e),a=ge(i);if(r.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(a.length!==2)throw new Error(" line2 must only contain 2 coordinates");var s=r[0][0],l=r[0][1],h=r[1][0],d=r[1][1],f=a[0][0],_=a[0][1],k=a[1][0],w=a[1][1],z=(w-_)*(h-s)-(k-f)*(d-l),S=(k-f)*(l-_)-(w-_)*(s-f),U=(h-s)*(l-_)-(d-l)*(s-f);if(z===0)return null;var q=S/z,Q=U/z;if(q>=0&&q<=1&&Q>=0&&Q<=1){var mt=s+q*(h-s),x=l+q*(d-l);return $e([mt,x])}return null}var Ve=Ga,ve=pt(ht(),1);function Za(e,i,r){r===void 0&&(r={});var a=de(e),s=de(i),l=te(s[1]-a[1]),h=te(s[0]-a[0]),d=te(a[1]),f=te(s[1]),_=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(h/2),2)*Math.cos(d)*Math.cos(f);return Ir(2*Math.atan2(Math.sqrt(_),Math.sqrt(1-_)),r.units)}var ae=Za;function ja(e){var i=e[0],r=e[1],a=e[2],s=e[3],l=ae(e.slice(0,2),[a,r]),h=ae(e.slice(0,2),[i,s]);if(l>=h){var d=(r+s)/2;return[i,d-(a-i)/2,a,d+(a-i)/2]}else{var f=(i+a)/2;return[f-(s-r)/2,r,f+(s-r)/2,s]}}var Me=ja;function ti(e){var i=[1/0,1/0,-1/0,-1/0];return On(e,function(r){i[0]>r[0]&&(i[0]=r[0]),i[1]>r[1]&&(i[1]=r[1]),i[2] is required");if(typeof r!="number")throw new Error(" must be a number");if(typeof a!="number")throw new Error(" must be a number");(s===!1||s===void 0)&&(e=JSON.parse(JSON.stringify(e)));var l=Math.pow(10,r);return On(e,function(h){Ui(h,l,a)}),e}function Ui(e,i,r){e.length>r&&e.splice(r,e.length);for(var a=0;a0&&(Q=q.features[0],Q.properties.dist=ae(i,Q,r),Q.properties.location=s+ae(f,Q,r)),f.properties.dist1&&r.push(ke(k)),Ft(r)}function Gn(e,i){if(!i.features.length)throw new Error("lines must contain features");if(i.features.length===1)return i.features[0];var r,a=1/0;return ee(i,function(s){var l=Gr(s,e),h=l.properties.dist;he[1]!=_>e[1]&&e[0]<(f-h)*(e[1]-d)/(_-d)+h;w&&(a=!a)}return a}function Hi(e,i){return i[0]<=e[0]&&i[1]<=e[1]&&i[2]>=e[0]&&i[3]>=e[1]}function Va(e,i,r){r===void 0&&(r={});for(var a=de(e),s=ge(i),l=0;l"u"?null:r.epsilon))return!0}return!1}function Ki(e,i,r,a,s){var l=r[0],h=r[1],d=e[0],f=e[1],_=i[0],k=i[1],w=r[0]-d,z=r[1]-f,S=_-d,U=k-f,q=w*U-z*S;if(s!==null){if(Math.abs(q)>s)return!1}else if(q!==0)return!1;if(a){if(a==="start")return Math.abs(S)>=Math.abs(U)?S>0?d0?f=Math.abs(U)?S>0?d<=l&&l<_:_0?f<=h&&h=Math.abs(U)?S>0?d0?f=Math.abs(U)?S>0?d<=l&&l<=_:_<=l&&l<=d:U>0?f<=h&&h<=k:k<=h&&h<=f;return!1}var bi=Va;function jr(e,i){var r=Yt(e),a=Yt(i),s=r.type,l=a.type,h=r.coordinates,d=a.coordinates;switch(s){case"Point":switch(l){case"Point":return qi(h,d);default:throw new Error("feature2 "+l+" geometry not supported")}case"MultiPoint":switch(l){case"Point":return Ha(r,a);case"MultiPoint":return Ci(r,a);default:throw new Error("feature2 "+l+" geometry not supported")}case"LineString":switch(l){case"Point":return bi(a,r,{ignoreEndVertices:!0});case"LineString":return Ur(r,a);case"MultiPoint":return Ka(r,a);default:throw new Error("feature2 "+l+" geometry not supported")}case"Polygon":switch(l){case"Point":return Vi(a,r,{ignoreBoundary:!0});case"LineString":return Vr(r,a);case"Polygon":return qa(r,a);case"MultiPoint":return ni(r,a);default:throw new Error("feature2 "+l+" geometry not supported")}default:throw new Error("feature1 "+s+" geometry not supported")}}function Ha(e,i){var r,a=!1;for(r=0;ri[0]||e[2]i[1]||e[3]()=>e,ri=e=>{let i=e?(r,a)=>a.minus(r).abs().isLessThanOrEqualTo(e):Kr(!1);return(r,a)=>i(r,a)?0:r.comparedTo(a)};function ki(e){let i=e?(r,a,s,l,h)=>r.exponentiatedBy(2).isLessThanOrEqualTo(l.minus(a).exponentiatedBy(2).plus(h.minus(s).exponentiatedBy(2)).times(e)):Kr(!1);return(r,a,s)=>{let l=r.x,h=r.y,d=s.x,f=s.y,_=h.minus(f).times(a.x.minus(d)).minus(l.minus(d).times(a.y.minus(f)));return i(_,l,h,d,f)?0:_.comparedTo(0)}}var qr=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Wi=Math.ceil,oe=Math.floor,Kt="[BigNumber Error] ",jn=Kt+"Number primitive has more than 15 significant digits: ",se=1e14,ot=14,Yi=9007199254740991,Un=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],we=1e7,Rt=1e9;function Wr(e){var i,r,a,s=x.prototype={constructor:x,toString:null,valueOf:null},l=new x(1),h=20,d=4,f=-7,_=21,k=-1e7,w=1e7,z=!1,S=1,U=0,q={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},Q="0123456789abcdefghijklmnopqrstuvwxyz",mt=!0;function x(p,g){var v,y,b,C,P,B,T,F,O=this;if(!(O instanceof x))return new x(p,g);if(g==null){if(p&&p._isBigNumber===!0){O.s=p.s,!p.c||p.e>w?O.c=O.e=null:p.e=10;P/=10,C++);C>w?O.c=O.e=null:(O.e=C,O.c=[p]);return}F=String(p)}else{if(!qr.test(F=String(p)))return a(O,F,B);O.s=F.charCodeAt(0)==45?(F=F.slice(1),-1):1}(C=F.indexOf("."))>-1&&(F=F.replace(".","")),(P=F.search(/e/i))>0?(C<0&&(C=P),C+=+F.slice(P+1),F=F.substring(0,P)):C<0&&(C=F.length)}else{if(u(g,2,Q.length,"Base"),g==10&&mt)return O=new x(p),A(O,h+O.e+1,d);if(F=String(p),B=typeof p=="number"){if(p*0!=0)return a(O,F,B,g);if(O.s=1/p<0?(F=F.slice(1),-1):1,x.DEBUG&&F.replace(/^0\.0*|\./,"").length>15)throw Error(jn+p)}else O.s=F.charCodeAt(0)===45?(F=F.slice(1),-1):1;for(v=Q.slice(0,g),C=P=0,T=F.length;PC){C=T;continue}}else if(!b&&(F==F.toUpperCase()&&(F=F.toLowerCase())||F==F.toLowerCase()&&(F=F.toUpperCase()))){b=!0,P=-1,C=0;continue}return a(O,String(p),B,g)}B=!1,F=r(F,g,10,O.s),(C=F.indexOf("."))>-1?F=F.replace(".",""):C=F.length}for(P=0;F.charCodeAt(P)===48;P++);for(T=F.length;F.charCodeAt(--T)===48;);if(F=F.slice(P,++T)){if(T-=P,B&&x.DEBUG&&T>15&&(p>Yi||p!==oe(p)))throw Error(jn+O.s*p);if((C=C-P-1)>w)O.c=O.e=null;else if(C=-Rt&&b<=Rt&&b===oe(b)){if(y[0]===0){if(b===0&&y.length===1)return!0;break t}if(g=(b+1)%ot,g<1&&(g+=ot),String(y[0]).length==g){for(g=0;g=se||v!==oe(v))break t;if(v!==0)return!0}}}else if(y===null&&b===null&&(C===null||C===1||C===-1))return!0;throw Error(Kt+"Invalid BigNumber: "+p)},x.maximum=x.max=function(){return D(arguments,-1)},x.minimum=x.min=function(){return D(arguments,1)},x.random=function(){var p=9007199254740992,g=Math.random()*p&2097151?function(){return oe(Math.random()*p)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(v){var y,b,C,P,B,T=0,F=[],O=new x(l);if(v==null?v=h:u(v,0,Rt),P=Wi(v/ot),z)if(crypto.getRandomValues){for(y=crypto.getRandomValues(new Uint32Array(P*=2));T>>11),B>=9e15?(b=crypto.getRandomValues(new Uint32Array(2)),y[T]=b[0],y[T+1]=b[1]):(F.push(B%1e14),T+=2);T=P/2}else if(crypto.randomBytes){for(y=crypto.randomBytes(P*=7);T=9e15?crypto.randomBytes(7).copy(y,T):(F.push(B%1e14),T+=7);T=P/7}else throw z=!1,Error(Kt+"crypto unavailable");if(!z)for(;T=10;B/=10,T++);Tb-1&&(B[P+1]==null&&(B[P+1]=0),B[P+1]+=B[P]/b|0,B[P]%=b)}return B.reverse()}return function(v,y,b,C,P){var B,T,F,O,H,X,tt,nt,Lt=v.indexOf("."),kt=h,yt=d;for(Lt>=0&&(O=U,U=0,v=v.replace(".",""),nt=new x(y),X=nt.pow(v.length-Lt),U=O,nt.c=g(M(n(X.c),X.e,"0"),10,b,p),nt.e=nt.c.length),tt=g(v,y,b,P?(B=Q,p):(B=p,Q)),F=O=tt.length;tt[--O]==0;tt.pop());if(!tt[0])return B.charAt(0);if(Lt<0?--F:(X.c=tt,X.e=F,X.s=C,X=i(X,nt,kt,yt,b),tt=X.c,H=X.r,F=X.e),T=F+kt+1,Lt=tt[T],O=b/2,H=H||T<0||tt[T+1]!=null,H=yt<4?(Lt!=null||H)&&(yt==0||yt==(X.s<0?3:2)):Lt>O||Lt==O&&(yt==4||H||yt==6&&tt[T-1]&1||yt==(X.s<0?8:7)),T<1||!tt[0])v=H?M(B.charAt(1),-kt,B.charAt(0)):B.charAt(0);else{if(tt.length=T,H)for(--b;++tt[--T]>b;)tt[T]=0,T||(++F,tt=[1].concat(tt));for(O=tt.length;!tt[--O];);for(Lt=0,v="";Lt<=O;v+=B.charAt(tt[Lt++]));v=M(v,F,B.charAt(0))}return v}}(),i=function(){function p(y,b,C){var P,B,T,F,O=0,H=y.length,X=b%we,tt=b/we|0;for(y=y.slice();H--;)T=y[H]%we,F=y[H]/we|0,P=tt*T+F*X,B=X*T+P%we*we+O,O=(B/C|0)+(P/we|0)+tt*F,y[H]=B%C;return O&&(y=[O].concat(y)),y}function g(y,b,C,P){var B,T;if(C!=P)T=C>P?1:-1;else for(B=T=0;Bb[B]?1:-1;break}return T}function v(y,b,C,P){for(var B=0;C--;)y[C]-=B,B=y[C]1;y.splice(0,1));}return function(y,b,C,P,B){var T,F,O,H,X,tt,nt,Lt,kt,yt,Mt,Xt,ia,Xa,$a,Se,Wn,be=y.s==b.s?1:-1,ie=y.c,Ot=b.c;if(!ie||!ie[0]||!Ot||!Ot[0])return new x(!y.s||!b.s||(ie?Ot&&ie[0]==Ot[0]:!Ot)?NaN:ie&&ie[0]==0||!Ot?be*0:be/0);for(Lt=new x(be),kt=Lt.c=[],F=y.e-b.e,be=C+F+1,B||(B=se,F=t(y.e/ot)-t(b.e/ot),be=be/ot|0),O=0;Ot[O]==(ie[O]||0);O++);if(Ot[O]>(ie[O]||0)&&F--,be<0)kt.push(1),H=!0;else{for(Xa=ie.length,Se=Ot.length,O=0,be+=2,X=oe(B/(Ot[0]+1)),X>1&&(Ot=p(Ot,X,B),ie=p(ie,X,B),Se=Ot.length,Xa=ie.length),ia=Se,yt=ie.slice(0,Se),Mt=yt.length;Mt=B/2&&$a++;do{if(X=0,T=g(Ot,yt,Se,Mt),T<0){if(Xt=yt[0],Se!=Mt&&(Xt=Xt*B+(yt[1]||0)),X=oe(Xt/$a),X>1)for(X>=B&&(X=B-1),tt=p(Ot,X,B),nt=tt.length,Mt=yt.length;g(tt,yt,nt,Mt)==1;)X--,v(tt,Se=10;be/=10,O++);A(Lt,C+(Lt.e=O+F*ot-1)+1,P,H)}else Lt.e=F,Lt.r=+H;return Lt}}();function E(p,g,v,y){var b,C,P,B,T;if(v==null?v=d:u(v,0,8),!p.c)return p.toString();if(b=p.c[0],P=p.e,g==null)T=n(p.c),T=y==1||y==2&&(P<=f||P>=_)?m(T,P):M(T,P,"0");else if(p=A(new x(p),g,v),C=p.e,T=n(p.c),B=T.length,y==1||y==2&&(g<=C||C<=f)){for(;BB){if(--g>0)for(T+=".";g--;T+="0");}else if(g+=C-B,g>0)for(C+1==B&&(T+=".");g--;T+="0");return p.s<0&&b?"-"+T:T}function D(p,g){for(var v,y,b=1,C=new x(p[0]);b=10;b/=10,y++);return(v=y+v*ot-1)>w?p.c=p.e=null:v=10;B/=10,b++);if(C=g-b,C<0)C+=ot,P=g,T=H[F=0],O=oe(T/X[b-P-1]%10);else if(F=Wi((C+1)/ot),F>=H.length)if(y){for(;H.length<=F;H.push(0));T=O=0,b=1,C%=ot,P=C-ot+1}else break t;else{for(T=B=H[F],b=1;B>=10;B/=10,b++);C%=ot,P=C-ot+b,O=P<0?0:oe(T/X[b-P-1]%10)}if(y=y||g<0||H[F+1]!=null||(P<0?T:T%X[b-P-1]),y=v<4?(O||y)&&(v==0||v==(p.s<0?3:2)):O>5||O==5&&(v==4||y||v==6&&(C>0?P>0?T/X[b-P]:0:H[F-1])%10&1||v==(p.s<0?8:7)),g<1||!H[0])return H.length=0,y?(g-=p.e+1,H[0]=X[(ot-g%ot)%ot],p.e=-g||0):H[0]=p.e=0,p;if(C==0?(H.length=F,B=1,F--):(H.length=F+1,B=X[ot-C],H[F]=P>0?oe(T/X[b-P]%X[P])*B:0),y)for(;;)if(F==0){for(C=1,P=H[0];P>=10;P/=10,C++);for(P=H[0]+=B,B=1;P>=10;P/=10,B++);C!=B&&(p.e++,H[0]==se&&(H[0]=1));break}else{if(H[F]+=B,H[F]!=se)break;H[F--]=0,B=1}for(C=H.length;H[--C]===0;H.pop());}p.e>w?p.c=p.e=null:p.e=_?m(g,v):M(g,v,"0"),p.s<0?"-"+g:g)}return s.absoluteValue=s.abs=function(){var p=new x(this);return p.s<0&&(p.s=1),p},s.comparedTo=function(p,g){return o(this,new x(p,g))},s.decimalPlaces=s.dp=function(p,g){var v,y,b,C=this;if(p!=null)return u(p,0,Rt),g==null?g=d:u(g,0,8),A(new x(C),p+C.e+1,g);if(!(v=C.c))return null;if(y=((b=v.length-1)-t(this.e/ot))*ot,b=v[b])for(;b%10==0;b/=10,y--);return y<0&&(y=0),y},s.dividedBy=s.div=function(p,g){return i(this,new x(p,g),h,d)},s.dividedToIntegerBy=s.idiv=function(p,g){return i(this,new x(p,g),0,1)},s.exponentiatedBy=s.pow=function(p,g){var v,y,b,C,P,B,T,F,O,H=this;if(p=new x(p),p.c&&!p.isInteger())throw Error(Kt+"Exponent not an integer: "+N(p));if(g!=null&&(g=new x(g)),B=p.e>14,!H.c||!H.c[0]||H.c[0]==1&&!H.e&&H.c.length==1||!p.c||!p.c[0])return O=new x(Math.pow(+N(H),B?p.s*(2-c(p)):+N(p))),g?O.mod(g):O;if(T=p.s<0,g){if(g.c?!g.c[0]:!g.s)return new x(NaN);y=!T&&H.isInteger()&&g.isInteger(),y&&(H=H.mod(g))}else{if(p.e>9&&(H.e>0||H.e<-1||(H.e==0?H.c[0]>1||B&&H.c[1]>=24e7:H.c[0]<8e13||B&&H.c[0]<=9999975e7)))return C=H.s<0&&c(p)?-0:0,H.e>-1&&(C=1/C),new x(T?1/C:C);U&&(C=Wi(U/ot+2))}for(B?(v=new x(.5),T&&(p.s=1),F=c(p)):(b=Math.abs(+N(p)),F=b%2),O=new x(l);;){if(F){if(O=O.times(H),!O.c)break;C?O.c.length>C&&(O.c.length=C):y&&(O=O.mod(g))}if(b){if(b=oe(b/2),b===0)break;F=b%2}else if(p=p.times(v),A(p,p.e+1,1),p.e>14)F=c(p);else{if(b=+N(p),b===0)break;F=b%2}H=H.times(H),C?H.c&&H.c.length>C&&(H.c.length=C):y&&(H=H.mod(g))}return y?O:(T&&(O=l.div(O)),g?O.mod(g):C?A(O,U,d,P):O)},s.integerValue=function(p){var g=new x(this);return p==null?p=d:u(p,0,8),A(g,g.e+1,p)},s.isEqualTo=s.eq=function(p,g){return o(this,new x(p,g))===0},s.isFinite=function(){return!!this.c},s.isGreaterThan=s.gt=function(p,g){return o(this,new x(p,g))>0},s.isGreaterThanOrEqualTo=s.gte=function(p,g){return(g=o(this,new x(p,g)))===1||g===0},s.isInteger=function(){return!!this.c&&t(this.e/ot)>this.c.length-2},s.isLessThan=s.lt=function(p,g){return o(this,new x(p,g))<0},s.isLessThanOrEqualTo=s.lte=function(p,g){return(g=o(this,new x(p,g)))===-1||g===0},s.isNaN=function(){return!this.s},s.isNegative=function(){return this.s<0},s.isPositive=function(){return this.s>0},s.isZero=function(){return!!this.c&&this.c[0]==0},s.minus=function(p,g){var v,y,b,C,P=this,B=P.s;if(p=new x(p,g),g=p.s,!B||!g)return new x(NaN);if(B!=g)return p.s=-g,P.plus(p);var T=P.e/ot,F=p.e/ot,O=P.c,H=p.c;if(!T||!F){if(!O||!H)return O?(p.s=-g,p):new x(H?P:NaN);if(!O[0]||!H[0])return H[0]?(p.s=-g,p):new x(O[0]?P:d==3?-0:0)}if(T=t(T),F=t(F),O=O.slice(),B=T-F){for((C=B<0)?(B=-B,b=O):(F=T,b=H),b.reverse(),g=B;g--;b.push(0));b.reverse()}else for(y=(C=(B=O.length)<(g=H.length))?B:g,B=g=0;g0)for(;g--;O[v++]=0);for(g=se-1;y>B;){if(O[--y]=0;){for(v=0,X=Xt[b]%kt,tt=Xt[b]/kt|0,P=T,C=b+P;C>b;)F=Mt[--P]%kt,O=Mt[P]/kt|0,B=tt*F+O*X,F=X*F+B%kt*kt+nt[C]+v,v=(F/Lt|0)+(B/kt|0)+tt*O,nt[C--]=F%Lt;nt[C]=v}return v?++y:nt.splice(0,1),Z(p,nt,y)},s.negated=function(){var p=new x(this);return p.s=-p.s||null,p},s.plus=function(p,g){var v,y=this,b=y.s;if(p=new x(p,g),g=p.s,!b||!g)return new x(NaN);if(b!=g)return p.s=-g,y.minus(p);var C=y.e/ot,P=p.e/ot,B=y.c,T=p.c;if(!C||!P){if(!B||!T)return new x(b/0);if(!B[0]||!T[0])return T[0]?p:new x(B[0]?y:b*0)}if(C=t(C),P=t(P),B=B.slice(),b=C-P){for(b>0?(P=C,v=T):(b=-b,v=B),v.reverse();b--;v.push(0));v.reverse()}for(b=B.length,g=T.length,b-g<0&&(v=T,T=B,B=v,g=b),b=0;g;)b=(B[--g]=B[g]+T[g]+b)/se|0,B[g]=se===B[g]?0:B[g]%se;return b&&(B=[b].concat(B),++P),Z(p,B,P)},s.precision=s.sd=function(p,g){var v,y,b,C=this;if(p!=null&&p!==!!p)return u(p,1,Rt),g==null?g=d:u(g,0,8),A(new x(C),p,g);if(!(v=C.c))return null;if(b=v.length-1,y=b*ot+1,b=v[b]){for(;b%10==0;b/=10,y--);for(b=v[0];b>=10;b/=10,y++);}return p&&C.e+1>y&&(y=C.e+1),y},s.shiftedBy=function(p){return u(p,-Yi,Yi),this.times("1e"+p)},s.squareRoot=s.sqrt=function(){var p,g,v,y,b,C=this,P=C.c,B=C.s,T=C.e,F=h+4,O=new x("0.5");if(B!==1||!P||!P[0])return new x(!B||B<0&&(!P||P[0])?NaN:P?C:1/0);if(B=Math.sqrt(+N(C)),B==0||B==1/0?(g=n(P),(g.length+T)%2==0&&(g+="0"),B=Math.sqrt(+g),T=t((T+1)/2)-(T<0||T%2),B==1/0?g="5e"+T:(g=B.toExponential(),g=g.slice(0,g.indexOf("e")+1)+T),v=new x(g)):v=new x(B+""),v.c[0]){for(T=v.e,B=T+F,B<3&&(B=0);;)if(b=v,v=O.times(b.plus(i(C,b,F,1))),n(b.c).slice(0,B)===(g=n(v.c)).slice(0,B))if(v.e0&&nt>0){for(C=nt%B||B,O=tt.substr(0,C);C0&&(O+=F+tt.slice(C)),X&&(O="-"+O)}y=H?O+(v.decimalSeparator||"")+((T=+v.fractionGroupSize)?H.replace(new RegExp("\\d{"+T+"}\\B","g"),"$&"+(v.fractionGroupSeparator||"")):H):O}return(v.prefix||"")+y+(v.suffix||"")},s.toFraction=function(p){var g,v,y,b,C,P,B,T,F,O,H,X,tt=this,nt=tt.c;if(p!=null&&(B=new x(p),!B.isInteger()&&(B.c||B.s!==1)||B.lt(l)))throw Error(Kt+"Argument "+(B.isInteger()?"out of range: ":"not an integer: ")+N(B));if(!nt)return new x(tt);for(g=new x(l),F=v=new x(l),y=T=new x(l),X=n(nt),C=g.e=X.length-tt.e-1,g.c[0]=Un[(P=C%ot)<0?ot+P:P],p=!p||B.comparedTo(g)>0?C>0?g:F:B,P=w,w=1/0,B=new x(X),T.c[0]=0;O=i(B,g,0,1),b=v.plus(O.times(y)),b.comparedTo(p)!=1;)v=y,y=b,F=T.plus(O.times(b=F)),T=b,g=B.minus(O.times(b=g)),B=b;return b=i(p.minus(v),y,0,1),T=T.plus(b.times(F)),v=v.plus(b.times(y)),T.s=F.s=tt.s,C=C*2,H=i(F,y,C,d).minus(tt).abs().comparedTo(i(T,v,C,d).minus(tt).abs())<1?[F,y]:[T,v],w=P,H},s.toNumber=function(){return+N(this)},s.toPrecision=function(p,g){return p!=null&&u(p,1,Rt),E(this,p,g,2)},s.toString=function(p){var g,v=this,y=v.s,b=v.e;return b===null?y?(g="Infinity",y<0&&(g="-"+g)):g="NaN":(p==null?g=b<=f||b>=_?m(n(v.c),b):M(n(v.c),b,"0"):p===10&&mt?(v=A(new x(v),h+b+1,d),g=M(n(v.c),v.e,"0")):(u(p,2,Q.length,"Base"),g=r(M(n(v.c),b,"0"),10,p,y,!0)),y<0&&v.c[0]&&(g="-"+g)),g},s.valueOf=s.toJSON=function(){return N(this)},s._isBigNumber=!0,s[Symbol.toStringTag]="BigNumber",s[Symbol.for("nodejs.util.inspect.custom")]=s.valueOf,e!=null&&x.set(e),x}function t(e){var i=e|0;return e>0||e===i?i:i-1}function n(e){for(var i,r,a=1,s=e.length,l=e[0]+"";a_^r?1:-1;for(d=(f=s.length)<(_=l.length)?f:_,h=0;hl[h]^r?1:-1;return f==_?0:f>_^r?1:-1}function u(e,i,r,a){if(er||e!==oe(e))throw Error(Kt+(a||"Argument")+(typeof e=="number"?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function c(e){var i=e.c.length-1;return t(e.e/ot)==i&&e.c[i]%2!=0}function m(e,i){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(i<0?"e":"e+")+i}function M(e,i,r){var a,s;if(i<0){for(s=r+".";++i;s+=r);e=s+e}else if(a=e.length,++i>a){for(s=r,i-=a;--i;s+=r);e+=s}else i0){let _=h.left;if(_==null||(f=d(_.key,e),f>0&&(h.left=_.right,_.right=h,h=_,_=h.left,_==null)))break;r==null?a=h:r.left=h,r=h,h=_}else if(f<0){let _=h.right;if(_==null||(f=d(_.key,e),f<0&&(h.right=_.left,_.left=h,h=_,_=h.right,_==null)))break;s==null?l=h:s.right=h,s=h,h=_}else break;return s!=null&&(s.right=h.left,h.left=l),r!=null&&(r.left=h.right,h.right=a),this.root!==h&&(this.root=h,this.splayCount++),f}splayMin(e){let i=e,r=i.left;for(;r!=null;){let a=r;i.left=a.right,a.right=i,i=a,r=i.left}return i}splayMax(e){let i=e,r=i.right;for(;r!=null;){let a=r;i.right=a.left,a.left=i,i=a,r=i.right}return i}_delete(e){if(this.root==null||this.splay(e)!=0)return null;let i=this.root,r=i,a=i.left;if(this.size--,a==null)this.root=i.right;else{let s=i.right;i=this.splayMax(a),i.right=s,this.root=i}return this.modificationCount++,r}addNewRoot(e,i){this.size++,this.modificationCount++;let r=this.root;if(r==null){this.root=e;return}i<0?(e.left=r,e.right=r.right,r.right=null):(e.right=r,e.left=r.left,r.left=null),this.root=e}_first(){let e=this.root;return e==null?null:(this.root=this.splayMin(e),this.root)}_last(){let e=this.root;return e==null?null:(this.root=this.splayMax(e),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(e){return this.validKey(e)&&this.splay(e)==0}defaultCompare(){return(e,i)=>ei?1:0}wrap(){return{getRoot:()=>this.root,setRoot:e=>{this.root=e},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:e=>{this.splayCount=e},splay:e=>this.splay(e),has:e=>this.has(e)}}},ct=class Yn extends rt{constructor(r,a){super();it(this,"root",null);it(this,"compare");it(this,"validKey");it(this,lo,"[object Set]");this.compare=r??this.defaultCompare(),this.validKey=a??(s=>s!=null&&s!=null)}delete(r){return this.validKey(r)?this._delete(r)!=null:!1}deleteAll(r){for(let a of r)this.delete(a)}forEach(r){let a=this[Symbol.iterator](),s;for(;s=a.next(),!s.done;)r(s.value,s.value,this)}add(r){let a=this.splay(r);return a!=0&&this.addNewRoot(new Y(r),a),this}addAndReturn(r){let a=this.splay(r);return a!=0&&this.addNewRoot(new Y(r),a),this.root.key}addAll(r){for(let a of r)this.add(a)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(this.size==0)throw"Bad state: No element";return this._first().key}last(){if(this.size==0)throw"Bad state: No element";return this._last().key}lastBefore(r){if(r==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(r)<0)return this.root.key;let a=this.root.left;if(a==null)return null;let s=a.right;for(;s!=null;)a=s,s=a.right;return a.key}firstAfter(r){if(r==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(r)>0)return this.root.key;let a=this.root.right;if(a==null)return null;let s=a.left;for(;s!=null;)a=s,s=a.left;return a.key}retainAll(r){let a=new Yn(this.compare,this.validKey),s=this.modificationCount;for(let l of r){if(s!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(l)&&this.splay(l)==0&&a.add(this.root.key)}a.size!=this.size&&(this.root=a.root,this.size=a.size,this.modificationCount++)}lookup(r){return!this.validKey(r)||this.splay(r)!=0?null:this.root.key}intersection(r){let a=new Yn(this.compare,this.validKey);for(let s of this)r.has(s)&&a.add(s);return a}difference(r){let a=new Yn(this.compare,this.validKey);for(let s of this)r.has(s)||a.add(s);return a}union(r){let a=this.clone();return a.addAll(r),a}clone(){let r=new Yn(this.compare,this.validKey);return r.size=this.size,r.root=this.copyNode(this.root),r}copyNode(r){if(r==null)return null;function a(l,h){let d,f;do{if(d=l.left,f=l.right,d!=null){let _=new Y(d.key);h.left=_,a(d,_)}if(f!=null){let _=new Y(f.key);h.right=_,l=f,h=_}}while(f!=null)}let s=new Y(r.key);return a(r,s),s}toSet(){return this.clone()}entries(){return new ue(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[(ho=Symbol.iterator,lo=Symbol.toStringTag,ho)](){return new It(this.wrap())}},Vt=class{constructor(e){it(this,"tree");it(this,"path",new Array);it(this,"modificationCount",null);it(this,"splayCount");this.tree=e,this.splayCount=e.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;let e=this.path[this.path.length-1];return this.getValue(e)}rebuildPath(e){this.path.splice(0,this.path.length),this.tree.splay(e),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(e){for(;e!=null;)this.path.push(e),e=e.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let r=this.tree.getRoot();for(;r!=null;)this.path.push(r),r=r.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let e=this.path[this.path.length-1],i=e.right;if(i!=null){for(;i!=null;)this.path.push(i),i=i.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===e;)e=this.path.pop();return this.path.length>0}},It=class extends Vt{getValue(e){return e.key}},ue=class extends Vt{getValue(e){return[e.key,e.key]}},Jt=e=>e,ai=e=>{if(e){let i=new ct(ri(e)),r=new ct(ri(e)),a=(l,h)=>h.addAndReturn(l),s=l=>({x:a(l.x,i),y:a(l.y,r)});return s({x:new G(0),y:new G(0)}),s}return Jt},Vn=e=>({set:i=>{Ee=Vn(i)},reset:()=>Vn(e),compare:ri(e),snap:ai(e),orient:ki(e)}),Ee=Vn(),Mi=(e,i)=>e.ll.x.isLessThanOrEqualTo(i.x)&&i.x.isLessThanOrEqualTo(e.ur.x)&&e.ll.y.isLessThanOrEqualTo(i.y)&&i.y.isLessThanOrEqualTo(e.ur.y),Ji=(e,i)=>{if(i.ur.x.isLessThan(e.ll.x)||e.ur.x.isLessThan(i.ll.x)||i.ur.y.isLessThan(e.ll.y)||e.ur.y.isLessThan(i.ll.y))return null;let r=e.ll.x.isLessThan(i.ll.x)?i.ll.x:e.ll.x,a=e.ur.x.isLessThan(i.ur.x)?e.ur.x:i.ur.x,s=e.ll.y.isLessThan(i.ll.y)?i.ll.y:e.ll.y,l=e.ur.y.isLessThan(i.ur.y)?e.ur.y:i.ur.y;return{ll:{x:r,y:s},ur:{x:a,y:l}}},Xi=(e,i)=>e.x.times(i.y).minus(e.y.times(i.x)),Hn=(e,i)=>e.x.times(i.x).plus(e.y.times(i.y)),Tt=e=>Hn(e,e).sqrt(),$i=(e,i,r)=>{let a={x:i.x.minus(e.x),y:i.y.minus(e.y)},s={x:r.x.minus(e.x),y:r.y.minus(e.y)};return Xi(s,a).div(Tt(s)).div(Tt(a))},Wa=(e,i,r)=>{let a={x:i.x.minus(e.x),y:i.y.minus(e.y)},s={x:r.x.minus(e.x),y:r.y.minus(e.y)};return Hn(s,a).div(Tt(s)).div(Tt(a))},Yr=(e,i,r)=>i.y.isZero()?null:{x:e.x.plus(i.x.div(i.y).times(r.minus(e.y))),y:r},Jr=(e,i,r)=>i.x.isZero()?null:{x:r,y:e.y.plus(i.y.div(i.x).times(r.minus(e.x)))},Kn=(e,i,r,a)=>{if(i.x.isZero())return Jr(r,a,e.x);if(a.x.isZero())return Jr(e,i,r.x);if(i.y.isZero())return Yr(r,a,e.y);if(a.y.isZero())return Yr(e,i,r.y);let s=Xi(i,a);if(s.isZero())return null;let l={x:r.x.minus(e.x),y:r.y.minus(e.y)},h=Xi(l,i).div(s),d=Xi(l,a).div(s),f=e.x.plus(d.times(i.x)),_=r.x.plus(h.times(a.x)),k=e.y.plus(d.times(i.y)),w=r.y.plus(h.times(a.y)),z=f.plus(_).div(2),S=k.plus(w).div(2);return{x:z,y:S}},fe=class fo{constructor(i,r){it(this,"point");it(this,"isLeft");it(this,"segment");it(this,"otherSE");it(this,"consumedBy");i.events===void 0?i.events=[this]:i.events.push(this),this.point=i,this.isLeft=r}static compare(i,r){let a=fo.comparePoints(i.point,r.point);return a!==0?a:(i.point!==r.point&&i.link(r),i.isLeft!==r.isLeft?i.isLeft?1:-1:Xr.compare(i.segment,r.segment))}static comparePoints(i,r){return i.x.isLessThan(r.x)?-1:i.x.isGreaterThan(r.x)?1:i.y.isLessThan(r.y)?-1:i.y.isGreaterThan(r.y)?1:0}link(i){if(i.point===this.point)throw new Error("Tried to link already linked events");let r=i.point.events;for(let a=0,s=r.length;a{let l=s.otherSE;r.set(s,{sine:$i(this.point,i.point,l.point),cosine:Wa(this.point,i.point,l.point)})};return(s,l)=>{r.has(s)||a(s),r.has(l)||a(l);let{sine:h,cosine:d}=r.get(s),{sine:f,cosine:_}=r.get(l);return h.isGreaterThanOrEqualTo(0)&&f.isGreaterThanOrEqualTo(0)?d.isLessThan(_)?1:d.isGreaterThan(_)?-1:0:h.isLessThan(0)&&f.isLessThan(0)?d.isLessThan(_)?-1:d.isGreaterThan(_)?1:0:f.isLessThan(h)?-1:f.isGreaterThan(h)?1:0}}},Ya=0,Xr=class ra{constructor(i,r,a,s){it(this,"id");it(this,"leftSE");it(this,"rightSE");it(this,"rings");it(this,"windings");it(this,"ringOut");it(this,"consumedBy");it(this,"prev");it(this,"_prevInResult");it(this,"_beforeState");it(this,"_afterState");it(this,"_isInResult");this.id=++Ya,this.leftSE=i,i.segment=this,i.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=i,this.rings=a,this.windings=s}static compare(i,r){let a=i.leftSE.point.x,s=r.leftSE.point.x,l=i.rightSE.point.x,h=r.rightSE.point.x;if(h.isLessThan(a))return 1;if(l.isLessThan(s))return-1;let d=i.leftSE.point.y,f=r.leftSE.point.y,_=i.rightSE.point.y,k=r.rightSE.point.y;if(a.isLessThan(s)){if(f.isLessThan(d)&&f.isLessThan(_))return 1;if(f.isGreaterThan(d)&&f.isGreaterThan(_))return-1;let w=i.comparePoint(r.leftSE.point);if(w<0)return 1;if(w>0)return-1;let z=r.comparePoint(i.rightSE.point);return z!==0?z:-1}if(a.isGreaterThan(s)){if(d.isLessThan(f)&&d.isLessThan(k))return-1;if(d.isGreaterThan(f)&&d.isGreaterThan(k))return 1;let w=r.comparePoint(i.leftSE.point);if(w!==0)return w;let z=i.comparePoint(r.rightSE.point);return z<0?1:z>0?-1:1}if(d.isLessThan(f))return-1;if(d.isGreaterThan(f))return 1;if(l.isLessThan(h)){let w=r.comparePoint(i.rightSE.point);if(w!==0)return w}if(l.isGreaterThan(h)){let w=i.comparePoint(r.rightSE.point);if(w<0)return 1;if(w>0)return-1}if(!l.eq(h)){let w=_.minus(d),z=l.minus(a),S=k.minus(f),U=h.minus(s);if(w.isGreaterThan(z)&&S.isLessThan(U))return 1;if(w.isLessThan(z)&&S.isGreaterThan(U))return-1}return l.isGreaterThan(h)?1:l.isLessThan(h)||_.isLessThan(k)?-1:_.isGreaterThan(k)?1:i.idr.id?1:0}static fromRing(i,r,a){let s,l,h,d=fe.comparePoints(i,r);if(d<0)s=i,l=r,h=1;else if(d>0)s=r,l=i,h=-1;else throw new Error(`Tried to create degenerate segment at [${i.x}, ${i.y}]`);let f=new fe(s,!0),_=new fe(l,!1);return new ra(f,_,[a],[h])}replaceRightSE(i){this.rightSE=i,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let i=this.leftSE.point.y,r=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:i.isLessThan(r)?i:r},ur:{x:this.rightSE.point.x,y:i.isGreaterThan(r)?i:r}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(i){return i.x.eq(this.leftSE.point.x)&&i.y.eq(this.leftSE.point.y)||i.x.eq(this.rightSE.point.x)&&i.y.eq(this.rightSE.point.y)}comparePoint(i){return Ee.orient(this.leftSE.point,i,this.rightSE.point)}getIntersection(i){let r=this.bbox(),a=i.bbox(),s=Ji(r,a);if(s===null)return null;let l=this.leftSE.point,h=this.rightSE.point,d=i.leftSE.point,f=i.rightSE.point,_=Mi(r,d)&&this.comparePoint(d)===0,k=Mi(a,l)&&i.comparePoint(l)===0,w=Mi(r,f)&&this.comparePoint(f)===0,z=Mi(a,h)&&i.comparePoint(h)===0;if(k&&_)return z&&!w?h:!z&&w?f:null;if(k)return w&&l.x.eq(f.x)&&l.y.eq(f.y)?null:l;if(_)return z&&h.x.eq(d.x)&&h.y.eq(d.y)?null:d;if(z&&w)return null;if(z)return h;if(w)return f;let S=Kn(l,this.vector(),d,i.vector());return S===null||!Mi(s,S)?null:Ee.snap(S)}split(i){let r=[],a=i.events!==void 0,s=new fe(i,!0),l=new fe(i,!1),h=this.rightSE;this.replaceRightSE(l),r.push(l),r.push(s);let d=new ra(s,h,this.rings.slice(),this.windings.slice());return fe.comparePoints(d.leftSE.point,d.rightSE.point)>0&&d.swapEvents(),fe.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),a&&(s.checkForConsuming(),l.checkForConsuming()),r}swapEvents(){let i=this.rightSE;this.rightSE=this.leftSE,this.leftSE=i,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let r=0,a=this.windings.length;r0){let l=r;r=a,a=l}if(r.prev===a){let l=r;r=a,a=l}for(let l=0,h=a.rings.length;ls.length===1&&s[0].isSubject;this._isInResult=a(i)!==a(r);break}}return this._isInResult}},eo=class{constructor(e,i,r){it(this,"poly");it(this,"isExterior");it(this,"segments");it(this,"bbox");if(!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=i,this.isExterior=r,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let a=Ee.snap({x:new G(e[0][0]),y:new G(e[0][1])});this.bbox={ll:{x:a.x,y:a.y},ur:{x:a.x,y:a.y}};let s=a;for(let l=1,h=e.length;l0&&(i=h)}let r=i.segment.prevInResult(),a=r?r.prevInResult():null;for(;;){if(!r)return null;if(!a)return r.ringOut;if(a.ringOut!==r.ringOut)return a.ringOut?.enclosingRing()!==r.ringOut?r.ringOut:r.ringOut?.enclosingRing();r=a.prevInResult(),a=r?r.prevInResult():null}}},no=class{constructor(e){it(this,"exteriorRing");it(this,"interiorRings");this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){let e=this.exteriorRing.getGeom();if(e===null)return null;let i=[e];for(let r=0,a=this.interiorRings.length;r0?(this.tree.delete(i),r.push(e)):(this.segments.push(i),i.prev=a)}else{if(a&&s){let l=a.getIntersection(s);if(l!==null){if(!a.isAnEndpoint(l)){let h=this._splitSafely(a,l);for(let d=0,f=h.length;d$r.run("intersection",e,i),bo=(e,...i)=>$r.run("difference",e,i),Yo=Ee.set;function Qr(e){let i={type:"Feature"};return i.geometry=e,i}function ta(e){return e.type==="Feature"?e.geometry:e}function ro(e){return e&&e.geometry&&e.geometry.coordinates?e.geometry.coordinates:e}function Co(e){return Qr({type:"LineString",coordinates:e})}function xo(e){return Qr({type:"MultiLineString",coordinates:e})}function ao(e){return Qr({type:"Polygon",coordinates:e})}function oo(e){return Qr({type:"MultiPolygon",coordinates:e})}function ko(e,i){let r=ta(e),a=ta(i),s=Lo(r.coordinates,a.coordinates);return s.length===0?null:s.length===1?ao(s[0]):oo(s)}function Mo(e,i){let r=ta(e),a=ta(i),s=bo(r.coordinates,a.coordinates);return s.length===0?null:s.length===1?ao(s[0]):oo(s)}function so(e){return Array.isArray(e)?1+so(e[0]):-1}function wo(e){e instanceof L.Polyline&&(e=e.toGeoJSON(15));let i=ro(e),r=so(i),a=[];return r>1?i.forEach(s=>{a.push(Co(s))}):a.push(e),a}function Eo(e){let i=[];return e.eachLayer(r=>{i.push(ro(r.toGeoJSON(15)))}),xo(i)}Zt.Cut=Zt.Polygon.extend({initialize(e){this._map=e,this._shape="Cut",this.toolbarButtonName="cutPolygon"},_finishShape(){if(this._editedLayers=[],!this.options.allowSelfIntersection&&(this._handleSelfIntersection(!0,this._layer.getLatLngs()[0]),this._doesSelfIntersect)||this.options.requireSnapToFinish&&!this._hintMarker._snapped&&!this._isFirstLayer())return;let e=this._layer.getLatLngs();if(e.length<=2)return;let i=L.polygon(e,this.options.pathOptions);i._latlngInfos=this._layer._latlngInfo,this.cut(i),this._cleanupSnapping(),this._otherSnapLayers.splice(this._tempSnapLayerIndex,1),delete this._tempSnapLayerIndex,this._editedLayers.forEach(({layer:a,originalLayer:s})=>{this._fireCut(s,a,s),this._fireCut(this._map,a,s),s.pm._fireEdit()}),this._editedLayers=[];let r=this._hintMarker.getLatLng();this.disable(),this.options.continueDrawing&&(this.enable(),this._hintMarker.setLatLng(r))},cut(e){let i=this._map._layers,r=e._latlngInfos||[];Object.keys(i).map(a=>i[a]).filter(a=>a.pm).filter(a=>!a._pmTempLayer).filter(a=>!L.PM.optIn&&!a.options.pmIgnore||L.PM.optIn&&a.options.pmIgnore===!1).filter(a=>a instanceof L.Polyline).filter(a=>a!==e).filter(a=>a.pm.options.allowCutting).filter(a=>this.options.layersToCut&&L.Util.isArray(this.options.layersToCut)&&this.options.layersToCut.length>0?this.options.layersToCut.indexOf(a)>-1:!0).filter(a=>!this._layerGroup.hasLayer(a)).filter(a=>{try{let s=!!Ve(e.toGeoJSON(15),a.toGeoJSON(15)).features.length>0;return s||a instanceof L.Polyline&&!(a instanceof L.Polygon)?s:!!ko(e.toGeoJSON(15),a.toGeoJSON(15))}catch{return a instanceof L.Polygon&&console.error("You can't cut polygons with self-intersections"),!1}}).forEach(a=>{let s;if(a instanceof L.Polygon){s=L.polygon(a.getLatLngs());let f=s.getLatLngs();r.forEach(_=>{if(_&&_.snapInfo){let{latlng:k}=_,w=this._calcClosestLayer(k,[s]);if(w&&w.segment&&w.distance1?(0,xi.default)(f,U):f).splice(q,0,k)}}}})}else s=a;let l=this._cutLayer(e,s),h=L.geoJSON(l,a.options);h.getLayers().length===1&&([h]=h.getLayers()),this._setPane(h,"layerPane");let d=h.addTo(this._map.pm._getContainingLayer());if(d.pm.enable(a.pm.options),d.pm.disable(),a._pmTempLayer=!0,e._pmTempLayer=!0,a.remove(),a.removeFrom(this._map.pm._getContainingLayer()),e.remove(),e.removeFrom(this._map.pm._getContainingLayer()),d.getLayers&&d.getLayers().length===0&&this._map.pm.removeLayer({target:d}),d instanceof L.LayerGroup?(d.eachLayer(f=>{this._addDrawnLayerProp(f)}),this._addDrawnLayerProp(d)):this._addDrawnLayerProp(d),this.options.layersToCut&&L.Util.isArray(this.options.layersToCut)&&this.options.layersToCut.length>0){let f=this.options.layersToCut.indexOf(a);f>-1&&this.options.layersToCut.splice(f,1)}this._editedLayers.push({layer:d,originalLayer:a})})},_cutLayer(e,i){let r=L.geoJSON(),a;if(i instanceof L.Polygon)a=Mo(i.toGeoJSON(15),e.toGeoJSON(15));else{let s=wo(i);s.forEach(l=>{let h=Zr(l,e.toGeoJSON(15)),d;h&&h.features.length>0?d=L.geoJSON(h):d=L.geoJSON(l),d.getLayers().forEach(f=>{jr(e.toGeoJSON(15),f.toGeoJSON(15))||f.addTo(r)})}),s.length>1?a=Eo(r):a=r.toGeoJSON(15)}return a},_change:L.Util.falseFn}),Zt.Text=Zt.extend({initialize(e){this._map=e,this._shape="Text",this.toolbarButtonName="drawText"},enable(e){L.Util.setOptions(this,e),this._enabled=!0,this._map.on("click",this._createMarker,this),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!0),this._hintMarker=L.marker(this._map.getCenter(),{interactive:!1,zIndexOffset:100,icon:L.divIcon({className:"marker-icon cursor-marker"})}),this._setPane(this._hintMarker,"vertexPane"),this._hintMarker._pmTempLayer=!0,this._hintMarker.addTo(this._map),this.options.cursorMarker&&L.DomUtil.addClass(this._hintMarker._icon,"visible"),this.options.tooltips&&this._hintMarker.bindTooltip(_t("tooltips.placeText"),{permanent:!0,offset:L.point(0,10),direction:"bottom",opacity:.8}).openTooltip(),this._layer=this._hintMarker,this._map.on("mousemove",this._syncHintMarker,this),this._map.getContainer().classList.add("geoman-draw-cursor"),this._fireDrawStart(),this._setGlobalDrawMode()},disable(){this._enabled&&(this._enabled=!1,this._map.off("click",this._createMarker,this),this._hintMarker?.remove(),this._map.getContainer().classList.remove("geoman-draw-cursor"),this._map.off("mousemove",this._syncHintMarker,this),this._map.off("mousemove",this._showHintMarker,this),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this.options.snappable&&this._cleanupSnapping(),this._fireDrawEnd(),this._setGlobalDrawMode())},enabled(){return this._enabled},toggle(e){this.enabled()?this.disable():this.enable(e)},_syncHintMarker(e){if(this._hintMarker.setLatLng(e.latlng),this.options.snappable){let i=e;i.target=this._hintMarker,this._handleSnapping(i)}},_createMarker(e){if(!e.latlng||this.options.requireSnapToFinish&&!this._hintMarker._snapped&&!this._isFirstLayer())return;this._hintMarker._snapped||this._hintMarker.setLatLng(e.latlng);let i=this._hintMarker.getLatLng();if(this.textArea=this._createTextArea(),this.options.textOptions?.className){let s=this.options.textOptions.className.split(" ");this.textArea.classList.add(...s)}let r=this._createTextIcon(this.textArea),a=new L.Marker(i,{textMarker:!0,_textMarkerOverPM:!0,icon:r});if(this._setPane(a,"markerPane"),this._finishLayer(a),a.pm||(a.options.draggable=!1),a.addTo(this._map.pm._getContainingLayer()),a.pm){a.pm.textArea=this.textArea,L.setOptions(a.pm,{removeIfEmpty:this.options.textOptions?.removeIfEmpty??!0});let s=this.options.textOptions?.focusAfterDraw??!0;a.pm._createTextMarker(s),this.options.textOptions?.text&&a.pm.setText(this.options.textOptions.text)}this._fireCreate(a),this._cleanupSnapping(),this.disable(),this.options.continueDrawing&&this._map.once("mousemove",this._showHintMarkerAfterMoving,this)},_showHintMarkerAfterMoving(e){this.enable(),this._hintMarker.setLatLng(e.latlng)},_createTextArea(){let e=document.createElement("textarea");return e.readOnly=!0,e.classList.add("pm-textarea","pm-disabled"),e},_createTextIcon(e){return L.divIcon({className:"pm-text-marker",html:e})}});var Bo={enableLayerDrag(){if(!this.options.draggable||!this._layer._map)return;this.disable(),this._layerDragEnabled=!0,this._map||(this._map=this._layer._map),(this._layer instanceof L.Marker||this._layer instanceof L.ImageOverlay)&&L.DomEvent.on(this._getDOMElem(),"dragstart",this._stopDOMImageDrag),this._layer.dragging&&this._layer.dragging.disable(),this._tempDragCoord=null,je(this._layer)instanceof L.Canvas?(this._layer.on("mouseout",this.removeDraggingClass,this),this._layer.on("mouseover",this.addDraggingClass,this)):this.addDraggingClass(),this._originalMapDragState=this._layer._map.dragging._enabled,this._safeToCacheDragState=!0;let e=this._getDOMElem();e&&(je(this._layer)instanceof L.Canvas?(this._layer.on("touchstart mousedown",this._dragMixinOnMouseDown,this),this._map.pm._addTouchEvents(e)):L.DomEvent.on(e,"touchstart mousedown",this._simulateMouseDownEvent,this)),this._fireDragEnable()},disableLayerDrag(){this._layerDragEnabled=!1,je(this._layer)instanceof L.Canvas?(this._layer.off("mouseout",this.removeDraggingClass,this),this._layer.off("mouseover",this.addDraggingClass,this)):this.removeDraggingClass(),this._originalMapDragState&&this._dragging&&this._map.dragging.enable(),this._safeToCacheDragState=!1,this._layer.dragging&&this._layer.dragging.disable();let e=this._getDOMElem();e&&(je(this._layer)instanceof L.Canvas?(this._layer.off("touchstart mousedown",this._dragMixinOnMouseDown,this),this._map.pm._removeTouchEvents(e)):L.DomEvent.off(e,"touchstart mousedown",this._simulateMouseDownEvent,this)),this._layerDragged&&this._fireUpdate(),this._layerDragged=!1,this._fireDragDisable()},dragging(){return this._dragging},layerDragEnabled(){return!!this._layerDragEnabled},_simulateMouseDownEvent(e){let i=e.touches?e.touches[0]:e,r={originalEvent:i,target:this._layer};return r.containerPoint=this._map.mouseEventToContainerPoint(i),r.latlng=this._map.containerPointToLatLng(r.containerPoint),this._dragMixinOnMouseDown(r),!1},_simulateMouseMoveEvent(e){let i=e.touches?e.touches[0]:e,r={originalEvent:i,target:this._layer};return r.containerPoint=this._map.mouseEventToContainerPoint(i),r.latlng=this._map.containerPointToLatLng(r.containerPoint),this._dragMixinOnMouseMove(r),!1},_simulateMouseUpEvent(e){let i={originalEvent:e.touches?e.touches[0]:e,target:this._layer};return e.type.indexOf("touch")===-1&&(i.containerPoint=this._map.mouseEventToContainerPoint(e),i.latlng=this._map.containerPointToLatLng(i.containerPoint)),this._dragMixinOnMouseUp(i),!1},_dragMixinOnMouseDown(e){if(e.originalEvent.button>0)return;this._overwriteEventIfItComesFromMarker(e);let i=e._fromLayerSync,r=this._syncLayers("_dragMixinOnMouseDown",e);if(this._layer instanceof L.Marker&&(this.options.snappable&&!i&&!r?this._initSnappableMarkers():this._disableSnapping()),this._layer instanceof L.CircleMarker){let a="resizeableCircleMarker";this._layer instanceof L.Circle&&(a="resizeableCircle"),this.options.snappable&&!i&&!r?this._layer.pm.options[a]||this._initSnappableMarkersDrag():this._layer.pm.options[a]?this._layer.pm._disableSnapping():this._layer.pm._disableSnappingDrag()}this._safeToCacheDragState&&(this._originalMapDragState=this._layer._map.dragging._enabled,this._safeToCacheDragState=!1),this._tempDragCoord=e.latlng,L.DomEvent.on(this._map.getContainer(),"touchend mouseup",this._simulateMouseUpEvent,this),L.DomEvent.on(this._map.getContainer(),"touchmove mousemove",this._simulateMouseMoveEvent,this)},_dragMixinOnMouseMove(e){this._overwriteEventIfItComesFromMarker(e);let i=this._getDOMElem();this._syncLayers("_dragMixinOnMouseMove",e),this._dragging||(this._dragging=!0,L.DomUtil.addClass(i,"leaflet-pm-dragging"),this._layer instanceof L.Marker||this._layer.bringToFront(),this._originalMapDragState&&this._map.dragging.disable(),this._fireDragStart()),this._tempDragCoord||(this._tempDragCoord=e.latlng),this._onLayerDrag(e),this._layer instanceof L.CircleMarker&&this._layer.pm._updateHiddenPolyCircle()},_dragMixinOnMouseUp(e){let i=this._getDOMElem();return this._syncLayers("_dragMixinOnMouseUp",e),this._originalMapDragState&&this._map.dragging.enable(),this._safeToCacheDragState=!0,L.DomEvent.off(this._map.getContainer(),"touchmove mousemove",this._simulateMouseMoveEvent,this),L.DomEvent.off(this._map.getContainer(),"touchend mouseup",this._simulateMouseUpEvent,this),this._dragging?(this._layer instanceof L.CircleMarker&&this._layer.pm._updateHiddenPolyCircle(),this._layerDragged=!0,window.setTimeout(()=>{this._dragging=!1,i&&L.DomUtil.removeClass(i,"leaflet-pm-dragging"),this._fireDragEnd(),this._fireEdit(),this._layerEdited=!0},10),!0):!1},_onLayerDrag(e){let{latlng:i}=e,r={lat:i.lat-this._tempDragCoord.lat,lng:i.lng-this._tempDragCoord.lng},a=s=>s.map(l=>{if(Array.isArray(l))return a(l);let h={lat:l.lat+r.lat,lng:l.lng+r.lng};return(l.alt||l.alt===0)&&(h.alt=l.alt),h});if(this._layer instanceof L.Circle&&this._layer.options.resizeableCircle||this._layer instanceof L.CircleMarker&&this._layer.options.resizeableCircleMarker){let s=a([this._layer.getLatLng()]);this._layer.setLatLng(s[0]),this._fireChange(this._layer.getLatLng(),"Edit")}else if(this._layer instanceof L.CircleMarker||this._layer instanceof L.Marker){let s=this._layer.getLatLng();this._layer._snapped&&(s=this._layer._orgLatLng);let l=a([s]);this._layer.setLatLng(l[0]),this._fireChange(this._layer.getLatLng(),"Edit")}else if(this._layer instanceof L.ImageOverlay){let s=a([this._layer.getBounds().getNorthWest(),this._layer.getBounds().getSouthEast()]);this._layer.setBounds(s),this._fireChange(this._layer.getBounds(),"Edit")}else{let s=a(this._layer.getLatLngs());this._layer.setLatLngs(s),this._fireChange(this._layer.getLatLngs(),"Edit")}this._tempDragCoord=i,e.layer=this._layer,this._fireDrag(e)},addDraggingClass(){let e=this._getDOMElem();e&&L.DomUtil.addClass(e,"leaflet-pm-draggable")},removeDraggingClass(){let e=this._getDOMElem();e&&L.DomUtil.removeClass(e,"leaflet-pm-draggable")},_getDOMElem(){let e=null;return this._layer._path?e=this._layer._path:this._layer._renderer&&this._layer._renderer._container?e=this._layer._renderer._container:this._layer._image?e=this._layer._image:this._layer._icon&&(e=this._layer._icon),e},_overwriteEventIfItComesFromMarker(e){e.target.getLatLng&&(!e.target._radius||e.target._radius<=10)&&(e.containerPoint=this._map.mouseEventToContainerPoint(e.originalEvent),e.latlng=this._map.containerPointToLatLng(e.containerPoint))},_syncLayers(e,i){if(this.enabled())return!1;if(!i._fromLayerSync&&this._layer===i.target&&this.options.syncLayersOnDrag){i._fromLayerSync=!0;let r=[];if(L.Util.isArray(this.options.syncLayersOnDrag))r=this.options.syncLayersOnDrag,this.options.syncLayersOnDrag.forEach(a=>{a instanceof L.LayerGroup&&(r=r.concat(a.pm.getLayers(!0)))});else if(this.options.syncLayersOnDrag===!0&&this._parentLayerGroup)for(let a in this._parentLayerGroup){let s=this._parentLayerGroup[a];s.pm&&(r=s.pm.getLayers(!0))}return L.Util.isArray(r)&&r.length>0&&(r=r.filter(a=>!!a.pm).filter(a=>!!a.pm.options.draggable),r.forEach(a=>{a!==this._layer&&a.pm[e]&&(a._snapped=!1,a.pm[e](i))})),r.length>0}return!1},_stopDOMImageDrag(e){return e.preventDefault(),!1}},Po=Bo,To=pt(Ct());function Do(e,i,r,a){return r.unproject(i.transform(r.project(e,a)),a)}function uo(e,i,r){let a=r.getMaxZoom();if(a===1/0&&(a=r.getZoom()),L.Util.isArray(e)){let s=[];return e.forEach(l=>{s.push(uo(l,i,r))}),s}return e instanceof L.LatLng?Do(e,i,r,a):null}function Qi(e,i){i instanceof L.Layer&&(i=i.getLatLng());let r=e.getMaxZoom();return r===1/0&&(r=e.getZoom()),e.project(i,r)}function ea(e,i){let r=e.getMaxZoom();return r===1/0&&(r=e.getZoom()),e.unproject(i,r)}var So={_onRotateStart(e){this._preventRenderingMarkers(!0),this._rotationOriginLatLng=this._getRotationCenter().clone(),this._rotationOriginPoint=Qi(this._map,this._rotationOriginLatLng),this._rotationStartPoint=Qi(this._map,e.target.getLatLng()),this._initialRotateLatLng=Gt(this._layer),this._startAngle=this.getAngle();let i=Gt(this._rotationLayer,this._rotationLayer.pm._rotateOrgLatLng);this._fireRotationStart(this._rotationLayer,i),this._fireRotationStart(this._map,i)},_onRotate(e){let i=Qi(this._map,e.target.getLatLng()),r=this._rotationStartPoint,a=this._rotationOriginPoint,s=Math.atan2(i.y-a.y,i.x-a.x)-Math.atan2(r.y-a.y,r.x-a.x);this._layer.setLatLngs(this._rotateLayer(s,this._initialRotateLatLng,this._rotationOriginLatLng,L.PM.Matrix.init(),this._map));let l=this;function h(k,w=[],z=-1){if(z>-1&&w.push(z),L.Util.isArray(k[0]))k.forEach((S,U)=>h(S,w.slice(),U));else{let S=w.length>0?(0,To.default)(l._markers,w):l._markers[0];k.forEach((U,q)=>{S[q].setLatLng(U)})}}h(this._layer.getLatLngs());let d=Gt(this._rotationLayer);this._rotationLayer.setLatLngs(this._rotateLayer(s,this._rotationLayer.pm._rotateOrgLatLng,this._rotationOriginLatLng,L.PM.Matrix.init(),this._map));let f=s*180/Math.PI;f=f<0?f+360:f;let _=f+this._startAngle;this._setAngle(_),this._rotationLayer.pm._setAngle(_),this._fireRotation(this._rotationLayer,f,d),this._fireRotation(this._map,f,d),this._rotationLayer.pm._fireChange(this._rotationLayer.getLatLngs(),"Rotation")},_onRotateEnd(){let e=this._startAngle;delete this._rotationOriginLatLng,delete this._rotationOriginPoint,delete this._rotationStartPoint,delete this._initialRotateLatLng,delete this._startAngle;let i=Gt(this._rotationLayer,this._rotationLayer.pm._rotateOrgLatLng);this._rotationLayer.pm._rotateOrgLatLng=Gt(this._rotationLayer),this._fireRotationEnd(this._rotationLayer,e,i),this._fireRotationEnd(this._map,e,i),this._rotationLayer.pm._fireEdit(this._rotationLayer,"Rotation"),this._preventRenderingMarkers(!1),this._layerRotated=!0},_rotateLayer(e,i,r,a,s){let l=Qi(s,r);return this._matrix=a.clone().rotate(e,l).flip(),uo(i,this._matrix,s)},_setAngle(e){e=e<0?e+360:e,this._angle=e%360},_getRotationCenter(){if(this._rotationCenter)return this._rotationCenter;let e=L.polygon(this._layer.getLatLngs(),{stroke:!1,fill:!1,pmIgnore:!0}).addTo(this._layer._map),i=e.getCenter();return e.removeFrom(this._layer._map),i},enableRotate(){if(!this.options.allowRotation){this.disableRotate();return}this.rotateEnabled()&&this.disableRotate(),this._layer instanceof L.Rectangle&&this._angle===void 0&&this.setInitAngle(Bn(this._layer._map,this._layer.getLatLngs()[0][0],this._layer.getLatLngs()[0][1])||0);let e={fill:!1,stroke:!1,pmIgnore:!1,snapIgnore:!0};this._rotatePoly=L.polygon(this._layer.getLatLngs(),e),this._rotatePoly._pmTempLayer=!0,this._rotatePoly.addTo(this._layer._map),this._rotatePoly.pm._setAngle(this.getAngle()),this._rotatePoly.pm.setRotationCenter(this.getRotationCenter()),this._rotatePoly.pm.setOptions(this._layer._map.pm.getGlobalOptions()),this._rotatePoly.pm.setOptions({rotate:!0,snappable:!1,hideMiddleMarkers:!0}),this._rotatePoly.pm._rotationLayer=this._layer,this._rotatePoly.pm.enable(),this._rotateOrgLatLng=Gt(this._layer),this._rotateEnabled=!0,this._layer.on("remove",this.disableRotate,this),this._fireRotationEnable(this._layer),this._fireRotationEnable(this._layer._map)},disableRotate(){this.rotateEnabled()&&(this._rotatePoly.pm._layerRotated&&this._fireUpdate(),this._rotatePoly.pm._layerRotated=!1,this._rotatePoly.pm.disable(),this._rotatePoly.remove(),this._rotatePoly.pm.setOptions({rotate:!1}),this._rotatePoly=void 0,this._rotateOrgLatLng=void 0,this._layer.off("remove",this.disableRotate,this),this._rotateEnabled=!1,this._fireRotationDisable(this._layer),this._fireRotationDisable(this._layer._map))},rotateEnabled(){return!!this._rotateEnabled},rotateLayer(e){let i=this.getAngle(),r=this._layer.getLatLngs(),a=e*(Math.PI/180);this._layer.setLatLngs(this._rotateLayer(a,this._layer.getLatLngs(),this._getRotationCenter(),L.PM.Matrix.init(),this._layer._map)),this._rotateOrgLatLng=L.polygon(this._layer.getLatLngs()).getLatLngs(),this._setAngle(this.getAngle()+e),this.rotateEnabled()&&this._rotatePoly&&this._rotatePoly.pm.enabled()&&(this._rotatePoly.setLatLngs(this._rotateLayer(a,this._rotatePoly.getLatLngs(),this._getRotationCenter(),L.PM.Matrix.init(),this._rotatePoly._map)),this._rotatePoly.pm._initMarkers());let s=this.getAngle()-i;s=s<0?s+360:s,this._startAngle=i,this._fireRotation(this._layer,s,r,this._layer),this._fireRotation(this._map||this._layer._map,s,r,this._layer),delete this._startAngle,this._fireChange(this._layer.getLatLngs(),"Rotation")},rotateLayerToAngle(e){let i=e-this.getAngle();this.rotateLayer(i)},getAngle(){return this._angle||0},setInitAngle(e){this._setAngle(e)},getRotationCenter(){return this._getRotationCenter()},setRotationCenter(e){this._rotationCenter=e,this._rotatePoly&&this._rotatePoly.pm.setRotationCenter(e)}},Ao=So,Oo=L.Class.extend({includes:[Po,Rr,Ao,dt],options:{snappable:!0,snapDistance:20,allowSelfIntersection:!0,allowSelfIntersectionEdit:!1,preventMarkerRemoval:!1,removeLayerBelowMinVertexCount:!0,limitMarkersToCount:-1,hideMiddleMarkers:!1,snapSegment:!0,syncLayersOnDrag:!1,draggable:!0,allowEditing:!0,allowRemoval:!0,allowCutting:!0,allowRotation:!0,addVertexOn:"click",removeVertexOn:"contextmenu",removeVertexValidation:void 0,addVertexValidation:void 0,moveVertexValidation:void 0,resizeableCircleMarker:!1,resizeableCircle:!0,snapMiddle:!1,snapVertex:!0},setOptions(e){L.Util.setOptions(this,e)},getOptions(){return this.options},applyOptions(){},isPolygon(){return this._layer instanceof L.Polygon},getShape(){return this._shape},_setPane(e,i){i==="layerPane"?e.options.pane=this._map.pm.globalOptions.panes&&this._map.pm.globalOptions.panes.layerPane||"overlayPane":i==="vertexPane"?e.options.pane=this._map.pm.globalOptions.panes&&this._map.pm.globalOptions.panes.vertexPane||"markerPane":i==="markerPane"&&(e.options.pane=this._map.pm.globalOptions.panes&&this._map.pm.globalOptions.panes.markerPane||"markerPane")},remove(){(this._map||this._layer._map).pm.removeLayer({target:this._layer})},_vertexValidation(e,i){let r=i.target,a={layer:this._layer,marker:r,event:i},s="";return e==="move"?s="moveVertexValidation":e==="add"?s="addVertexValidation":e==="remove"&&(s="removeVertexValidation"),this.options[s]&&typeof this.options[s]=="function"&&!this.options[s](a)?(e==="move"&&(r._cancelDragEventChain=r.getLatLng()),!1):(r._cancelDragEventChain=null,!0)},_vertexValidationDrag(e){return e._cancelDragEventChain?(e._latlng=e._cancelDragEventChain,e.update(),!1):!0},_vertexValidationDragEnd(e){return e._cancelDragEventChain?(e._cancelDragEventChain=null,!1):!0}}),Ht=Oo;Ht.LayerGroup=L.Class.extend({initialize(e){this._layerGroup=e,this._layers=this.getLayers(),this._getMap(),this._layers.forEach(a=>this._initLayer(a));let i=a=>{if(a.layer._pmTempLayer)return;this._layers=this.getLayers();let s=this._layers.filter(l=>!l.pm._parentLayerGroup||!(this._layerGroup._leaflet_id in l.pm._parentLayerGroup));s.forEach(l=>{this._initLayer(l)}),s.length>0&&this._getMap()&&this._getMap().pm.globalEditModeEnabled()&&this.enabled()&&this.enable(this.getOptions())};this._layerGroup.on("layeradd",L.Util.throttle(i,100,this),this),this._layerGroup.on("layerremove",a=>{this._removeLayerFromGroup(a.target)},this);let r=a=>{a.target._pmTempLayer||(this._layers=this.getLayers())};this._layerGroup.on("layerremove",L.Util.throttle(r,100,this),this)},enable(e,i=[]){i.length===0&&(this._layers=this.getLayers()),this._options=e,this._layers.forEach(r=>{r instanceof L.LayerGroup?i.indexOf(r._leaflet_id)===-1&&(i.push(r._leaflet_id),r.pm.enable(e,i)):r.pm.enable(e)})},disable(e=[]){e.length===0&&(this._layers=this.getLayers()),this._layers.forEach(i=>{i instanceof L.LayerGroup?e.indexOf(i._leaflet_id)===-1&&(e.push(i._leaflet_id),i.pm.disable(e)):i.pm.disable()})},enabled(e=[]){return e.length===0&&(this._layers=this.getLayers()),!!this._layers.find(i=>i instanceof L.LayerGroup?e.indexOf(i._leaflet_id)===-1?(e.push(i._leaflet_id),i.pm.enabled(e)):!1:i.pm.enabled())},toggleEdit(e,i=[]){i.length===0&&(this._layers=this.getLayers()),this._options=e,this._layers.forEach(r=>{r instanceof L.LayerGroup?i.indexOf(r._leaflet_id)===-1&&(i.push(r._leaflet_id),r.pm.toggleEdit(e,i)):r.pm.toggleEdit(e)})},_initLayer(e){let i=L.Util.stamp(this._layerGroup);e.pm._parentLayerGroup||(e.pm._parentLayerGroup={}),e.pm._parentLayerGroup[i]=this._layerGroup},_removeLayerFromGroup(e){if(e.pm&&e.pm._layerGroup){let i=L.Util.stamp(this._layerGroup);delete e.pm._layerGroup[i]}},dragging(){return this._layers=this.getLayers(),this._layers?!!this._layers.find(e=>e.pm.dragging()):!1},getOptions(){return this.options},_getMap(){return this._map||this._layers.find(e=>!!e._map)?._map||null},getLayers(e=!1,i=!0,r=!0,a=[]){let s=[];return e?this._layerGroup.getLayers().forEach(l=>{s.push(l),l instanceof L.LayerGroup&&a.indexOf(l._leaflet_id)===-1&&(a.push(l._leaflet_id),s=s.concat(l.pm.getLayers(!0,!0,!0,a)))}):s=this._layerGroup.getLayers(),r&&(s=s.filter(l=>!(l instanceof L.LayerGroup))),i&&(s=s.filter(l=>!!l.pm),s=s.filter(l=>!l._pmTempLayer),s=s.filter(l=>!L.PM.optIn&&!l.options.pmIgnore||L.PM.optIn&&l.options.pmIgnore===!1)),s},setOptions(e,i=[]){i.length===0&&(this._layers=this.getLayers()),this.options=e,this._layers.forEach(r=>{r.pm&&(r instanceof L.LayerGroup?i.indexOf(r._leaflet_id)===-1&&(i.push(r._leaflet_id),r.pm.setOptions(e,i)):r.pm.setOptions(e))})}}),Ht.Marker=Ht.extend({_shape:"Marker",initialize(e){this._layer=e,this._enabled=!1,this._layer.on("dragend",this._onDragEnd,this)},enable(e={draggable:!0}){if(L.Util.setOptions(this,e),!this.options.allowEditing||!this._layer._map){this.disable();return}this._map=this._layer._map,this.enabled()&&this.disable(),this.applyOptions(),this._layer.on("remove",this.disable,this),this._enabled=!0,this._fireEnable()},disable(){this.enabled()&&(this.disableLayerDrag(),this._layer.off("remove",this.disable,this),this._layer.off("contextmenu",this._removeMarker,this),this._layerEdited&&this._fireUpdate(),this._layerEdited=!1,this._fireDisable(),this._enabled=!1)},enabled(){return this._enabled},toggleEdit(e){this.enabled()?this.disable():this.enable(e)},applyOptions(){this.options.snappable?this._initSnappableMarkers():this._disableSnapping(),this.options.draggable?this.enableLayerDrag():this.disableLayerDrag(),this.options.preventMarkerRemoval||this._layer.on("contextmenu",this._removeMarker,this)},_removeMarker(e){let i=e.target;i.remove(),this._fireRemove(i),this._fireRemove(this._map,i)},_onDragEnd(){this._fireEdit(),this._layerEdited=!0},_initSnappableMarkers(){let e=this._layer;this.options.snapDistance=this.options.snapDistance||30,this.options.snapSegment=this.options.snapSegment===void 0?!0:this.options.snapSegment,e.off("pm:drag",this._handleSnapping,this),e.on("pm:drag",this._handleSnapping,this),e.off("pm:dragend",this._cleanupSnapping,this),e.on("pm:dragend",this._cleanupSnapping,this),e.off("pm:dragstart",this._unsnap,this),e.on("pm:dragstart",this._unsnap,this)},_disableSnapping(){let e=this._layer;e.off("pm:drag",this._handleSnapping,this),e.off("pm:dragend",this._cleanupSnapping,this),e.off("pm:dragstart",this._unsnap,this)}});var oi=pt(Ct()),Fo={filterMarkerGroup(){this.markerCache=[],this.createCache(),this._layer.on("pm:edit",this.createCache,this),this.applyLimitFilters({}),this.throttledApplyLimitFilters||(this.throttledApplyLimitFilters=L.Util.throttle(this.applyLimitFilters,100,this)),this._layer.on("pm:disable",this._removeMarkerLimitEvents,this),this._layer.on("remove",this._removeMarkerLimitEvents,this),this.options.limitMarkersToCount>-1&&(this._layer.on("pm:vertexremoved",this._initMarkers,this),this._map.on("mousemove",this.throttledApplyLimitFilters,this))},_removeMarkerLimitEvents(){this._map.off("mousemove",this.throttledApplyLimitFilters,this),this._layer.off("pm:edit",this.createCache,this),this._layer.off("pm:disable",this._removeMarkerLimitEvents,this),this._layer.off("pm:vertexremoved",this._initMarkers,this)},createCache(){let e=[...this._markerGroup.getLayers(),...this.markerCache];this.markerCache=e.filter((i,r,a)=>a.indexOf(i)===r)},_removeFromCache(e){let i=this.markerCache.indexOf(e);i>-1&&this.markerCache.splice(i,1)},renderLimits(e){this.markerCache.forEach(i=>{e.includes(i)?this._markerGroup.addLayer(i):this._markerGroup.removeLayer(i)})},applyLimitFilters({latlng:e={lat:0,lng:0}}){if(this._preventRenderMarkers)return;let i=[...this._filterClosestMarkers(e)];this.renderLimits(i)},_filterClosestMarkers(e){let i=[...this.markerCache],r=this.options.limitMarkersToCount;return r===-1?i:(i.sort((a,s)=>{let l=a._latlng.distanceTo(e),h=s._latlng.distanceTo(e);return l-h}),i.filter((a,s)=>r>-1?s{if(Array.isArray(a[0]))return a.map(r,this);let s=a.map(this._createMarker,this);return this.options.hideMiddleMarkers!==!0&&a.map((l,h)=>{let d=this.isPolygon()?(h+1)%a.length:h+1;return this._createMiddleMarker(s[h],s[d])}),s};this._markers=r(i),this.filterMarkerGroup(),e.addLayer(this._markerGroup)},_createMarker(e){let i=new L.Marker(e,{draggable:!0,icon:L.divIcon({className:"marker-icon"})});return this._setPane(i,"vertexPane"),i._pmTempLayer=!0,this.options.rotate?(i.on("dragstart",this._onRotateStart,this),i.on("drag",this._onRotate,this),i.on("dragend",this._onRotateEnd,this)):(i.on("click",this._onVertexClick,this),i.on("dragstart",this._onMarkerDragStart,this),i.on("move",this._onMarkerDrag,this),i.on("dragend",this._onMarkerDragEnd,this),this.options.preventMarkerRemoval||i.on(this.options.removeVertexOn,this._removeMarker,this)),this._markerGroup.addLayer(i),i},_createMiddleMarker(e,i){if(!e||!i)return!1;let r=L.PM.Utils.calcMiddleLatLng(this._map,e.getLatLng(),i.getLatLng()),a=this._createMarker(r),s=L.divIcon({className:"marker-icon marker-icon-middle"});return a.setIcon(s),a.leftM=e,a.rightM=i,e._middleMarkerNext=a,i._middleMarkerPrev=a,a.on(this.options.addVertexOn,this._onMiddleMarkerClick,this),a.on("movestart",this._onMiddleMarkerMoveStart,this),a},_onMiddleMarkerClick(e){let i=e.target;if(!this._vertexValidation("add",e))return;let r=L.divIcon({className:"marker-icon"});i.setIcon(r),this._addMarker(i,i.leftM,i.rightM)},_onMiddleMarkerMoveStart(e){let i=e.target;if(i.on("moveend",this._onMiddleMarkerMoveEnd,this),!this._vertexValidation("add",e)){i.on("move",this._onMiddleMarkerMovePrevent,this);return}i._dragging=!0,this._addMarker(i,i.leftM,i.rightM)},_onMiddleMarkerMovePrevent(e){let i=e.target;this._vertexValidationDrag(i)},_onMiddleMarkerMoveEnd(e){let i=e.target;if(i.off("move",this._onMiddleMarkerMovePrevent,this),i.off("moveend",this._onMiddleMarkerMoveEnd,this),!this._vertexValidationDragEnd(i))return;let r=L.divIcon({className:"marker-icon"});i.setIcon(r),setTimeout(()=>{delete i._dragging},100)},_addMarker(e,i,r){e.off("movestart",this._onMiddleMarkerMoveStart,this),e.off(this.options.addVertexOn,this._onMiddleMarkerClick,this);let a=e.getLatLng(),s=this._layer._latlngs;delete e.leftM,delete e.rightM;let{indexPath:l,index:h,parentPath:d}=L.PM.Utils.findDeepMarkerIndex(this._markers,i),f=l.length>1?(0,oi.default)(s,d):s,_=l.length>1?(0,oi.default)(this._markers,d):this._markers;f.splice(h+1,0,a),_.splice(h+1,0,e),this._layer.setLatLngs(s),this.options.hideMiddleMarkers!==!0&&(this._createMiddleMarker(i,e),this._createMiddleMarker(e,r)),this._fireEdit(),this._layerEdited=!0,this._fireChange(this._layer.getLatLngs(),"Edit"),this._fireVertexAdded(e,L.PM.Utils.findDeepMarkerIndex(this._markers,e).indexPath,a),this.options.snappable&&this._initSnappableMarkers()},hasSelfIntersection(){return Ni(this._layer.toGeoJSON(15)).features.length>0},_handleSelfIntersectionOnVertexRemoval(){this._handleLayerStyle(!0)&&(this._layer.setLatLngs(this._coordsBeforeEdit),this._coordsBeforeEdit=null,this._initMarkers())},_handleLayerStyle(e){let i=this._layer,r,a;if(this.options.allowSelfIntersection?r=!1:(a=Ni(this._layer.toGeoJSON(15)),r=a.features.length>0),r){if(!this.options.allowSelfIntersection&&this.options.allowSelfIntersectionEdit&&this._updateDisabledMarkerStyle(this._markers,!0),this.isRed)return r;e?this._flashLayer():(i.setStyle({color:"#f00000ff"}),this.isRed=!0),this._fireIntersect(a)}else i.setStyle({color:this.cachedColor}),this.isRed=!1,!this.options.allowSelfIntersection&&this.options.allowSelfIntersectionEdit&&this._updateDisabledMarkerStyle(this._markers,!1);return r},_flashLayer(){this.cachedColor||(this.cachedColor=this._layer.options.color),this._layer.setStyle({color:"#f00000ff"}),this.isRed=!0,window.setTimeout(()=>{this._layer.setStyle({color:this.cachedColor}),this.isRed=!1},200)},_updateDisabledMarkerStyle(e,i){e.forEach(r=>{Array.isArray(r)?this._updateDisabledMarkerStyle(r,i):r._icon&&(i&&!this._checkMarkerAllowedToDrag(r)?L.DomUtil.addClass(r._icon,"vertexmarker-disabled"):L.DomUtil.removeClass(r._icon,"vertexmarker-disabled"))})},_removeMarker(e){let i=e.target;if(!this._vertexValidation("remove",e))return;this.options.allowSelfIntersection||(this._coordsBeforeEdit=Gt(this._layer,this._layer.getLatLngs()));let r=this._layer.getLatLngs(),{indexPath:a,index:s,parentPath:l}=L.PM.Utils.findDeepMarkerIndex(this._markers,i);if(!a)return;let h=a.length>1?(0,oi.default)(r,l):r,d=a.length>1?(0,oi.default)(this._markers,l):this._markers,f=l[l.length-1]>0&&this._layer instanceof L.Polygon;if(!this.options.removeLayerBelowMinVertexCount&&!f&&(h.length<=2||this.isPolygon()&&h.length<=3)){this._flashLayer();return}h.splice(s,1),this._layer.setLatLngs(r),this.isPolygon()&&h.length<=2&&h.splice(0,h.length);let _=!1;if(h.length<=1&&(h.splice(0,h.length),l.length>1&&a.length>1&&(r=Je(r)),this._layer.setLatLngs(r),this._initMarkers(),_=!0),wn(r)||this._layer.remove(),r=Je(r),this._layer.setLatLngs(r),this._markers=Je(this._markers),!_&&(d=a.length>1?(0,oi.default)(this._markers,l):this._markers,i._middleMarkerPrev&&(this._markerGroup.removeLayer(i._middleMarkerPrev),this._removeFromCache(i._middleMarkerPrev)),i._middleMarkerNext&&(this._markerGroup.removeLayer(i._middleMarkerNext),this._removeFromCache(i._middleMarkerNext)),this._markerGroup.removeLayer(i),this._removeFromCache(i),d)){let k,w;if(this.isPolygon()?(k=(s+1)%d.length,w=(s+(d.length-1))%d.length):(w=s-1<0?void 0:s-1,k=s+1>=d.length?void 0:s+1),k!==w){let z=d[w],S=d[k];this.options.hideMiddleMarkers!==!0&&this._createMiddleMarker(z,S)}d.splice(s,1)}this._fireEdit(),this._layerEdited=!0,this._fireVertexRemoved(i,a),this._fireChange(this._layer.getLatLngs(),"Edit")},updatePolygonCoordsFromMarkerDrag(e){let i=this._layer.getLatLngs(),r=e.getLatLng(),{indexPath:a,index:s,parentPath:l}=L.PM.Utils.findDeepMarkerIndex(this._markers,e);(a.length>1?(0,oi.default)(i,l):i).splice(s,1,r),this._layer.setLatLngs(i)},_getNeighborMarkers(e){let{indexPath:i,index:r,parentPath:a}=L.PM.Utils.findDeepMarkerIndex(this._markers,e),s=i.length>1?(0,oi.default)(this._markers,a):this._markers,l=(r+1)%s.length,h=(r+(s.length-1))%s.length,d=s[h],f=s[l];return{prevMarker:d,nextMarker:f}},_checkMarkerAllowedToDrag(e){let{prevMarker:i,nextMarker:r}=this._getNeighborMarkers(e),a=L.polyline([i.getLatLng(),e.getLatLng()]),s=L.polyline([e.getLatLng(),r.getLatLng()]),l=Ve(this._layer.toGeoJSON(15),a.toGeoJSON(15)).features.length,h=Ve(this._layer.toGeoJSON(15),s.toGeoJSON(15)).features.length;return e.getLatLng()===this._markers[0][0].getLatLng()?h+=1:e.getLatLng()===this._markers[0][this._markers[0].length-1].getLatLng()&&(l+=1),!(l<=2&&h<=2)},_onMarkerDragStart(e){let i=e.target;if(this.cachedColor||(this.cachedColor=this._layer.options.color),!this._vertexValidation("move",e))return;let{indexPath:r}=L.PM.Utils.findDeepMarkerIndex(this._markers,i);this._fireMarkerDragStart(e,r),this.options.allowSelfIntersection||(this._coordsBeforeEdit=Gt(this._layer,this._layer.getLatLngs())),!this.options.allowSelfIntersection&&this.options.allowSelfIntersectionEdit&&this.hasSelfIntersection()?this._markerAllowedToDrag=this._checkMarkerAllowedToDrag(i):this._markerAllowedToDrag=null},_onMarkerDrag(e){let i=e.target;if(!this._vertexValidationDrag(i))return;let{indexPath:r,index:a,parentPath:s}=L.PM.Utils.findDeepMarkerIndex(this._markers,i);if(!r)return;if(!this.options.allowSelfIntersection&&this.options.allowSelfIntersectionEdit&&this.hasSelfIntersection()&&this._markerAllowedToDrag===!1){this._layer.setLatLngs(this._coordsBeforeEdit),this._initMarkers(),this._handleLayerStyle();return}this.updatePolygonCoordsFromMarkerDrag(i);let l=r.length>1?(0,oi.default)(this._markers,s):this._markers,h=(a+1)%l.length,d=(a+(l.length-1))%l.length,f=i.getLatLng(),_=l[d].getLatLng(),k=l[h].getLatLng();if(i._middleMarkerNext){let w=L.PM.Utils.calcMiddleLatLng(this._map,f,k);i._middleMarkerNext.setLatLng(w)}if(i._middleMarkerPrev){let w=L.PM.Utils.calcMiddleLatLng(this._map,f,_);i._middleMarkerPrev.setLatLng(w)}this.options.allowSelfIntersection||this._handleLayerStyle(),this._fireMarkerDrag(e,r),this._fireChange(this._layer.getLatLngs(),"Edit")},_onMarkerDragEnd(e){let i=e.target;if(!this._vertexValidationDragEnd(i))return;let{indexPath:r}=L.PM.Utils.findDeepMarkerIndex(this._markers,i),a=!this.options.allowSelfIntersection&&this.hasSelfIntersection();a&&this.options.allowSelfIntersectionEdit&&this._markerAllowedToDrag&&(a=!1);let s=!this.options.allowSelfIntersection&&a;if(this._fireMarkerDragEnd(e,r,s),s){this._layer.setLatLngs(this._coordsBeforeEdit),this._coordsBeforeEdit=null,this._initMarkers(),this.options.snappable&&this._initSnappableMarkers(),this._handleLayerStyle(),this._fireLayerReset(e,r);return}!this.options.allowSelfIntersection&&this.options.allowSelfIntersectionEdit&&this._handleLayerStyle(),this._fireEdit(),this._layerEdited=!0,this._fireChange(this._layer.getLatLngs(),"Edit")},_onVertexClick(e){let i=e.target;if(i._dragging)return;let{indexPath:r}=L.PM.Utils.findDeepMarkerIndex(this._markers,i);this._fireVertexClick(e,r)}}),Ht.Polygon=Ht.Line.extend({_shape:"Polygon",_checkMarkerAllowedToDrag(e){let{prevMarker:i,nextMarker:r}=this._getNeighborMarkers(e),a=L.polyline([i.getLatLng(),e.getLatLng()]),s=L.polyline([e.getLatLng(),r.getLatLng()]),l=Ve(this._layer.toGeoJSON(15),a.toGeoJSON(15)).features.length,h=Ve(this._layer.toGeoJSON(15),s.toGeoJSON(15)).features.length;return!(l<=2&&h<=2)}}),Ht.Rectangle=Ht.Polygon.extend({_shape:"Rectangle",_initMarkers(){let e=this._map,i=this._findCorners();this._markerGroup&&this._markerGroup.clearLayers(),this._markerGroup=new L.FeatureGroup,this._markerGroup._pmTempLayer=!0,e.addLayer(this._markerGroup),this._markers=[],this._markers[0]=i.map(this._createMarker,this),[this._cornerMarkers]=this._markers,this._layer.getLatLngs()[0].forEach((r,a)=>{let s=this._cornerMarkers.find(l=>l._index===a);s&&s.setLatLng(r)})},applyOptions(){this.options.snappable?this._initSnappableMarkers():this._disableSnapping(),this._addMarkerEvents()},_createMarker(e,i){let r=new L.Marker(e,{draggable:!0,icon:L.divIcon({className:"marker-icon"})});return this._setPane(r,"vertexPane"),r._origLatLng=e,r._index=i,r._pmTempLayer=!0,r.on("click",this._onVertexClick,this),this._markerGroup.addLayer(r),r},_addMarkerEvents(){this._markers[0].forEach(e=>{e.on("dragstart",this._onMarkerDragStart,this),e.on("drag",this._onMarkerDrag,this),e.on("dragend",this._onMarkerDragEnd,this),this.options.preventMarkerRemoval||e.on("contextmenu",this._removeMarker,this)})},_removeMarker(){return null},_onMarkerDragStart(e){if(!this._vertexValidation("move",e))return;let i=e.target,r=this._cornerMarkers;i._oppositeCornerLatLng=r.find(s=>s._index===(i._index+2)%4).getLatLng(),i._snapped=!1;let{indexPath:a}=L.PM.Utils.findDeepMarkerIndex(this._markers,i);this._fireMarkerDragStart(e,a)},_onMarkerDrag(e){let i=e.target;if(!this._vertexValidationDrag(i)||i._index===void 0)return;this._adjustRectangleForMarkerMove(i);let{indexPath:r}=L.PM.Utils.findDeepMarkerIndex(this._markers,i);this._fireMarkerDrag(e,r),this._fireChange(this._layer.getLatLngs(),"Edit")},_onMarkerDragEnd(e){let i=e.target;if(!this._vertexValidationDragEnd(i))return;this._cornerMarkers.forEach(a=>{delete a._oppositeCornerLatLng});let{indexPath:r}=L.PM.Utils.findDeepMarkerIndex(this._markers,i);this._fireMarkerDragEnd(e,r),this._fireEdit(),this._layerEdited=!0,this._fireChange(this._layer.getLatLngs(),"Edit")},_adjustRectangleForMarkerMove(e){L.extend(e._origLatLng,e._latlng);let i=L.PM.Utils._getRotatedRectangle(e.getLatLng(),e._oppositeCornerLatLng,this.getAngle(),this._map);this._layer.setLatLngs(i),this._adjustAllMarkers(e),this._layer.redraw()},_adjustAllMarkers(e){let i=this._layer.getLatLngs()[0];if(i&&i.length!==4&&i.length>0)i.forEach((r,a)=>{this._cornerMarkers[a].setLatLng(r)}),this._cornerMarkers.slice(i.length).forEach(r=>{r.setLatLng(i[0])});else if(!i||!i.length)console.error("The layer has no LatLngs");else{let r=i.findIndex(a=>e.getLatLng().equals(a));r>-1?(this._cornerMarkers[(e._index+1)%4].setLatLng(i[(r+1)%4]),this._cornerMarkers[(e._index+2)%4].setLatLng(i[(r+2)%4]),this._cornerMarkers[(e._index+3)%4].setLatLng(i[(r+3)%4])):this._cornerMarkers.forEach(a=>{a.setLatLng(i[a._index])})}},_findCorners(){this._angle===void 0&&this.setInitAngle(Bn(this._map,this._layer.getLatLngs()[0][0],this._layer.getLatLngs()[0][1])||0);let e=this._layer.getLatLngs()[0];return L.PM.Utils._getRotatedRectangle(e[0],e[2],this.getAngle(),this._map||this)}}),Ht.CircleMarker=Ht.extend({_shape:"CircleMarker",initialize(e){this._layer=e,this._enabled=!1,this._minRadiusOption="minRadiusCircleMarker",this._maxRadiusOption="maxRadiusCircleMarker",this._editableOption="resizeableCircleMarker",this._updateHiddenPolyCircle()},enable(e={draggable:!0,snappable:!0}){if(L.Util.setOptions(this,e),this.options.editable&&(this.options.resizeableCircleMarker=this.options.editable,delete this.options.editable),!this.options.allowEditing||!this._layer._map){this.disable();return}this._map=this._layer._map,this.enabled()&&this.disable(),this.applyOptions(),this._layer.on("remove",this.disable,this),this._enabled=!0,this._extendingEnable(),this._updateHiddenPolyCircle(),this._fireEnable()},_extendingEnable(){this._layer.on("pm:dragstart",this._onDragStart,this),this._layer.on("pm:drag",this._onMarkerDrag,this),this._layer.on("pm:dragend",this._onMarkerDragEnd,this)},disable(){this.dragging()||(this._map||(this._map=this._layer._map),this._map&&this.enabled()&&(this.layerDragEnabled()&&this.disableLayerDrag(),this._helperLayers&&(this._helperLayers.clearLayers(),this._helperLayers.removeFrom(this._map)),this.options[this._editableOption]?(this._map.off("move",this._syncMarkers,this),this._outerMarker.off("drag",this._handleOuterMarkerSnapping,this)):this._map.off("move",this._updateHiddenPolyCircle,this),this._extendingDisable(),this._layer.off("remove",this.disable,this),this._layerEdited&&this._fireUpdate(),this._layerEdited=!1,this._fireDisable(),this._enabled=!1))},_extendingDisable(){this._layer.off("contextmenu",this._removeMarker,this)},enabled(){return this._enabled},toggleEdit(e){this.enabled()?this.disable():this.enable(e)},applyOptions(){this.options[this._editableOption]?(this._initMarkers(),this._map.on("move",this._syncMarkers,this),this.options.snappable?(this._initSnappableMarkers(),this._outerMarker.on("drag",this._handleOuterMarkerSnapping,this),this._outerMarker.on("move",this._syncHintLine,this),this._outerMarker.on("move",this._syncCircleRadius,this)):this._disableSnapping()):(this.options.draggable&&this.enableLayerDrag(),this._map.on("move",this._updateHiddenPolyCircle,this),this.options.snappable?this._initSnappableMarkersDrag():this._disableSnappingDrag()),this._extendingApplyOptions()},_extendingApplyOptions(){this.options.preventMarkerRemoval||this._layer.on("contextmenu",this._removeMarker,this)},_initMarkers(){let e=this._map;this._helperLayers&&(this._helperLayers.removeFrom(e),this._helperLayers.clearLayers()),this._helperLayers=new L.FeatureGroup,this._helperLayers._pmTempLayer=!0,this._helperLayers.addTo(e);let i=this._layer.getLatLng(),r=this._layer._radius,a=this._getLatLngOnCircle(i,r);this._centerMarker=this._createCenterMarker(i),this._outerMarker=this._createOuterMarker(a),this._markers=[this._centerMarker,this._outerMarker],this._createHintLine(this._centerMarker,this._outerMarker)},_getLatLngOnCircle(e,i){let r=this._map.project(e),a=L.point(r.x+i,r.y);return this._map.unproject(a)},_createHintLine(e,i){let r=e.getLatLng(),a=i.getLatLng();this._hintline=L.polyline([r,a],this.options.hintlineStyle),this._setPane(this._hintline,"layerPane"),this._hintline._pmTempLayer=!0,this._helperLayers.addLayer(this._hintline)},_createCenterMarker(e){let i=this._createMarker(e);return this.options.draggable?(L.DomUtil.addClass(i._icon,"leaflet-pm-draggable"),i.on("move",this._moveCircle,this)):i.dragging.disable(),i},_createOuterMarker(e){let i=this._createMarker(e);return i.on("drag",this._resizeCircle,this),i},_createMarker(e){let i=new L.Marker(e,{draggable:!0,icon:L.divIcon({className:"marker-icon"})});return this._setPane(i,"vertexPane"),i._origLatLng=e,i._pmTempLayer=!0,i.on("dragstart",this._onMarkerDragStart,this),i.on("drag",this._onMarkerDrag,this),i.on("dragend",this._onMarkerDragEnd,this),i.on("click",this._onVertexClick,this),this._helperLayers.addLayer(i),i},_moveCircle(e){if(e.target._cancelDragEventChain)return;let i=this._centerMarker.getLatLng();this._layer.setLatLng(i);let r=this._layer._radius,a=this._getLatLngOnCircle(i,r);this._outerMarker._latlng=a,this._outerMarker.update(),this._syncHintLine(),this._updateHiddenPolyCircle(),this._fireCenterPlaced("Edit"),this._fireChange(this._layer.getLatLng(),"Edit")},_syncMarkers(){let e=this._layer.getLatLng(),i=this._layer._radius,r=this._getLatLngOnCircle(e,i);this._outerMarker.setLatLng(r),this._centerMarker.setLatLng(e),this._syncHintLine(),this._updateHiddenPolyCircle()},_resizeCircle(){this._outerMarker.setLatLng(this._getNewDestinationOfOuterMarker()),this._syncHintLine(),this._syncCircleRadius()},_syncCircleRadius(){let e=this._centerMarker.getLatLng(),i=this._outerMarker.getLatLng(),r=this._distanceCalculation(e,i);this.options[this._minRadiusOption]&&rthis.options[this._maxRadiusOption]?this._layer.setRadius(this.options[this._maxRadiusOption]):this._layer.setRadius(r),this._updateHiddenPolyCircle(),this._fireChange(this._layer.getLatLng(),"Edit")},_syncHintLine(){let e=this._centerMarker.getLatLng(),i=this._outerMarker.getLatLng();this._hintline.setLatLngs([e,i])},_removeMarker(){this.options[this._editableOption]&&this.disable(),this._layer.remove(),this._fireRemove(this._layer),this._fireRemove(this._map,this._layer)},_onDragStart(){this._map.pm.Draw.CircleMarker._layerIsDragging=!0},_onMarkerDragStart(e){this._vertexValidation("move",e)&&this._fireMarkerDragStart(e)},_onMarkerDrag(e){let i=e.target;i instanceof L.Marker&&!this._vertexValidationDrag(i)||this._fireMarkerDrag(e)},_onMarkerDragEnd(e){this._extedingMarkerDragEnd();let i=e.target;this._vertexValidationDragEnd(i)&&(this.options[this._editableOption]&&(this._fireEdit(),this._layerEdited=!0),this._fireMarkerDragEnd(e))},_extedingMarkerDragEnd(){this._map.pm.Draw.CircleMarker._layerIsDragging=!1},_initSnappableMarkersDrag(){let e=this._layer;this.options.snapDistance=this.options.snapDistance||30,this.options.snapSegment=this.options.snapSegment===void 0?!0:this.options.snapSegment,e.off("pm:drag",this._handleSnapping,this),e.on("pm:drag",this._handleSnapping,this),e.off("pm:dragend",this._cleanupSnapping,this),e.on("pm:dragend",this._cleanupSnapping,this),e.off("pm:dragstart",this._unsnap,this),e.on("pm:dragstart",this._unsnap,this)},_disableSnappingDrag(){let e=this._layer;e.off("pm:drag",this._handleSnapping,this),e.off("pm:dragend",this._cleanupSnapping,this),e.off("pm:dragstart",this._unsnap,this)},_updateHiddenPolyCircle(){let e=this._layer._map||this._map;if(e){let i=L.PM.Utils.pxRadiusToMeterRadius(this._layer.getRadius(),e,this._layer.getLatLng()),r=L.circle(this._layer.getLatLng(),this._layer.options);r.setRadius(i);let a=e&&e.pm._isCRSSimple();this._hiddenPolyCircle?this._hiddenPolyCircle.setLatLngs(L.PM.Utils.circleToPolygon(r,200,!a).getLatLngs()):this._hiddenPolyCircle=L.PM.Utils.circleToPolygon(r,200,!a),this._hiddenPolyCircle._parentCopy||(this._hiddenPolyCircle._parentCopy=this._layer)}},_getNewDestinationOfOuterMarker(){let e=this._centerMarker.getLatLng(),i=this._outerMarker.getLatLng(),r=this._distanceCalculation(e,i);return this.options[this._minRadiusOption]&&rthis.options[this._maxRadiusOption]&&(i=Xe(this._map,e,i,this._getMaxDistanceInMeter(e))),i},_handleOuterMarkerSnapping(){if(this._outerMarker._snapped){let e=this._centerMarker.getLatLng(),i=this._outerMarker.getLatLng(),r=this._distanceCalculation(e,i);this.options[this._minRadiusOption]&&rthis.options[this._maxRadiusOption]&&this._outerMarker.setLatLng(this._outerMarker._orgLatLng)}this._outerMarker.setLatLng(this._getNewDestinationOfOuterMarker())},_distanceCalculation(e,i){return this._map.project(e).distanceTo(this._map.project(i))},_getMinDistanceInMeter(e){return L.PM.Utils.pxRadiusToMeterRadius(this.options[this._minRadiusOption],this._map,e)},_getMaxDistanceInMeter(e){return L.PM.Utils.pxRadiusToMeterRadius(this.options[this._maxRadiusOption],this._map,e)},_onVertexClick(e){e.target._dragging||this._fireVertexClick(e,void 0)}}),Ht.Circle=Ht.CircleMarker.extend({_shape:"Circle",initialize(e){this._layer=e,this._enabled=!1,this._minRadiusOption="minRadiusCircle",this._maxRadiusOption="maxRadiusCircle",this._editableOption="resizeableCircle",this._updateHiddenPolyCircle()},enable(e){L.PM.Edit.CircleMarker.prototype.enable.call(this,e||{})},_extendingEnable(){},_extendingDisable(){this._layer.off("remove",this.disable,this);let e=this._layer._path?this._layer._path:this._layer._renderer._container;L.DomUtil.removeClass(e,"leaflet-pm-draggable")},_extendingApplyOptions(){},_syncMarkers(){},_removeMarker(){},_onDragStart(){},_extedingMarkerDragEnd(){},_updateHiddenPolyCircle(){let e=this._map&&this._map.pm._isCRSSimple();this._hiddenPolyCircle?this._hiddenPolyCircle.setLatLngs(L.PM.Utils.circleToPolygon(this._layer,200,!e).getLatLngs()):this._hiddenPolyCircle=L.PM.Utils.circleToPolygon(this._layer,200,!e),this._hiddenPolyCircle._parentCopy||(this._hiddenPolyCircle._parentCopy=this._layer)},_distanceCalculation(e,i){return this._map.distance(e,i)},_getMinDistanceInMeter(){return this.options[this._minRadiusOption]},_getMaxDistanceInMeter(){return this.options[this._maxRadiusOption]},_onVertexClick(e){e.target._dragging||this._fireVertexClick(e,void 0)}}),Ht.ImageOverlay=Ht.extend({_shape:"ImageOverlay",initialize(e){this._layer=e,this._enabled=!1},toggleEdit(e){this.enabled()?this.disable():this.enable(e)},enabled(){return this._enabled},enable(e={draggable:!0,snappable:!0}){if(L.Util.setOptions(this,e),this._map=this._layer._map,!!this._map){if(!this.options.allowEditing){this.disable();return}this.enabled()||this.disable(),this.enableLayerDrag(),this._layer.on("remove",this.disable,this),this._enabled=!0,this._otherSnapLayers=this._findCorners(),this._fireEnable()}},disable(){this._dragging||(this._map||(this._map=this._layer._map),this.disableLayerDrag(),this._layer.off("remove",this.disable,this),this.enabled()||(this._layerEdited&&this._fireUpdate(),this._layerEdited=!1,this._fireDisable()),this._enabled=!1)},_findCorners(){let e=this._layer.getBounds(),i=e.getNorthWest(),r=e.getNorthEast(),a=e.getSouthEast(),s=e.getSouthWest();return[i,r,a,s]}}),Ht.Text=Ht.extend({_shape:"Text",initialize(e){this._layer=e,this._enabled=!1},enable(e){if(L.Util.setOptions(this,e),!!this.textArea){if(!this.options.allowEditing||!this._layer._map){this.disable();return}this._map=this._layer._map,this.enabled()&&this.disable(),this.applyOptions(),this._safeToCacheDragState=!0,this._focusChange(),this.textArea.readOnly=!1,this.textArea.classList.remove("pm-disabled"),this._layer.on("remove",this.disable,this),L.DomEvent.on(this.textArea,"input",this._autoResize,this),L.DomEvent.on(this.textArea,"focus",this._focusChange,this),L.DomEvent.on(this.textArea,"blur",this._focusChange,this),this._layer.on("dblclick",L.DomEvent.stop),L.DomEvent.off(this.textArea,"mousedown",this._preventTextSelection),this._enabled=!0,this._fireEnable()}},disable(){if(!this.enabled())return;this._layer.off("remove",this.disable,this),L.DomEvent.off(this.textArea,"input",this._autoResize,this),L.DomEvent.off(this.textArea,"focus",this._focusChange,this),L.DomEvent.off(this.textArea,"blur",this._focusChange,this),L.DomEvent.off(document,"click",this._documentClick,this),this._focusChange(),this.textArea.readOnly=!0,this.textArea.classList.add("pm-disabled");let e=document.activeElement;this.textArea.focus(),this.textArea.selectionStart=0,this.textArea.selectionEnd=0,L.DomEvent.on(this.textArea,"mousedown",this._preventTextSelection),e.focus(),this._disableOnBlurActive=!1,this._layerEdited&&this._fireUpdate(),this._layerEdited=!1,this._fireDisable(),this._enabled=!1},enabled(){return this._enabled},toggleEdit(e){this.enabled()?this.disable():this.enable(e)},applyOptions(){this.options.snappable?this._initSnappableMarkers():this._disableSnapping()},_initSnappableMarkers(){let e=this._layer;this.options.snapDistance=this.options.snapDistance||30,this.options.snapSegment=this.options.snapSegment===void 0?!0:this.options.snapSegment,e.off("pm:drag",this._handleSnapping,this),e.on("pm:drag",this._handleSnapping,this),e.off("pm:dragend",this._cleanupSnapping,this),e.on("pm:dragend",this._cleanupSnapping,this),e.off("pm:dragstart",this._unsnap,this),e.on("pm:dragstart",this._unsnap,this)},_disableSnapping(){let e=this._layer;e.off("pm:drag",this._handleSnapping,this),e.off("pm:dragend",this._cleanupSnapping,this),e.off("pm:dragstart",this._unsnap,this)},_autoResize(){this.textArea.style.height="1px",this.textArea.style.width="1px";let e=this.textArea.scrollHeight>21?this.textArea.scrollHeight:21,i=this.textArea.scrollWidth>16?this.textArea.scrollWidth:16;this.textArea.style.height=`${e}px`,this.textArea.style.width=`${i}px`,this._layer.options.text=this.getText(),this._fireTextChange(this.getText())},_disableOnBlur(){this._disableOnBlurActive=!0,setTimeout(()=>{this.enabled()&&L.DomEvent.on(document,"click",this._documentClick,this)},100)},_documentClick(e){e.target!==this.textArea&&(this.disable(),!this.getText()&&this.options.removeIfEmpty&&this.remove())},_focusChange(e={}){let i=this._hasFocus;this._hasFocus=e.type==="focus",!i!=!this._hasFocus&&(this._hasFocus?(this._applyFocus(),this._focusText=this.getText(),this._fireTextFocus()):(this._removeFocus(),this._fireTextBlur(),this._focusText!==this.getText()&&(this._fireEdit(),this._layerEdited=!0)))},_applyFocus(){this.textArea.classList.add("pm-hasfocus"),this._map.dragging&&(this._safeToCacheDragState&&(this._originalMapDragState=this._map.dragging._enabled,this._safeToCacheDragState=!1),this._map.dragging.disable())},_removeFocus(){this._map.dragging&&(this._originalMapDragState&&this._map.dragging.enable(),this._safeToCacheDragState=!0),this.textArea.classList.remove("pm-hasfocus")},focus(){if(!this.enabled())throw new TypeError("Layer is not enabled");this.textArea.focus()},blur(){if(!this.enabled())throw new TypeError("Layer is not enabled");this.textArea.blur(),this._disableOnBlurActive&&this.disable()},hasFocus(){return this._hasFocus},getElement(){return this.textArea},setText(e){e&&(this.textArea.value=e),this._autoResize()},getText(){return this.textArea.value},_initTextMarker(){if(this.textArea=L.PM.Draw.Text.prototype._createTextArea.call(this),this.options.className){let i=this.options.className.split(" ");this.textArea.classList.add(...i)}let e=L.PM.Draw.Text.prototype._createTextIcon.call(this,this.textArea);this._layer.setIcon(e),this._layer.once("add",this._createTextMarker,this)},_createTextMarker(e=!1){this._layer.off("add",this._createTextMarker,this),this._layer.getElement().tabIndex=-1,this.textArea.wrap="off",this.textArea.style.overflow="hidden",this.textArea.style.height=L.DomUtil.getStyle(this.textArea,"font-size"),this.textArea.style.width="1px",this._layer.options.text&&this.setText(this._layer.options.text),this._autoResize(),e===!0&&(this.enable(),this.focus(),this._disableOnBlur())},_preventTextSelection(e){e.preventDefault()}});var Ja=function(e,i,r,a,s,l){this._matrix=[e,i,r,a,s,l]};Ja.init=()=>new L.PM.Matrix(1,0,0,1,0,0),Ja.prototype={transform(e){return this._transform(e.clone())},_transform(e){let i=this._matrix,{x:r,y:a}=e;return e.x=i[0]*r+i[1]*a+i[4],e.y=i[2]*r+i[3]*a+i[5],e},untransform(e){let i=this._matrix;return new L.Point((e.x/i[0]-i[4])/i[0],(e.y/i[2]-i[5])/i[2])},clone(){let e=this._matrix;return new L.PM.Matrix(e[0],e[1],e[2],e[3],e[4],e[5])},translate(e){if(e===void 0)return new L.Point(this._matrix[4],this._matrix[5]);let i,r;return typeof e=="number"?(i=e,r=e):(i=e.x,r=e.y),this._add(1,0,0,1,i,r)},scale(e,i){if(e===void 0)return new L.Point(this._matrix[0],this._matrix[3]);let r,a;return i=i||L.point(0,0),typeof e=="number"?(r=e,a=e):(r=e.x,a=e.y),this._add(r,0,0,a,i.x,i.y)._add(1,0,0,1,-i.x,-i.y)},rotate(e,i){let r=Math.cos(e),a=Math.sin(e);return i=i||new L.Point(0,0),this._add(r,a,-a,r,i.x,i.y)._add(1,0,0,1,-i.x,-i.y)},flip(){return this._matrix[1]*=-1,this._matrix[2]*=-1,this},_add(e,i,r,a,s,l){let h=[[],[],[]],d=this._matrix,f=[[d[0],d[2],d[4]],[d[1],d[3],d[5]],[0,0,1]],_=[[e,r,s],[i,a,l],[0,0,1]],k;e&&e instanceof L.PM.Matrix&&(d=e._matrix,_=[[d[0],d[2],d[4]],[d[1],d[3],d[5]],[0,0,1]]);for(let w=0;w<3;w+=1)for(let z=0;z<3;z+=1){k=0;for(let S=0;S<3;S+=1)k+=f[w][S]*_[S][z];h[w][z]=k}return this._matrix=[h[0][0],h[1][0],h[0][1],h[1][1],h[0][2],h[1][2]],this}};var Io=Ja,zo={calcMiddleLatLng(e,i,r){let a=e.project(i),s=e.project(r);return e.unproject(a._add(s)._divideBy(2))},findLayers(e){let i=[];return e.eachLayer(r=>{(r instanceof L.Polyline||r instanceof L.Marker||r instanceof L.Circle||r instanceof L.CircleMarker||r instanceof L.ImageOverlay)&&i.push(r)}),i=i.filter(r=>!!r.pm),i=i.filter(r=>!r._pmTempLayer),i=i.filter(r=>!L.PM.optIn&&!r.options.pmIgnore||L.PM.optIn&&r.options.pmIgnore===!1),i},circleToPolygon(e,i=60,r=!0){let a=e.getLatLng(),s=e.getRadius(),l=En(a,s,i,0,r),h=[];for(let d=0;d{l.fire(i,r,a)})},getAllParentGroups(e){let i=[],r=[],a=s=>{for(let l in s._eventParents)if(i.indexOf(l)===-1){i.push(l);let h=s._eventParents[l];r.push(h),a(h)}};return!e._pmLastGroupFetch||!e._pmLastGroupFetch.time||new Date().getTime()-e._pmLastGroupFetch.time>1e3?(a(e),e._pmLastGroupFetch={time:new Date().getTime(),groups:r,groupIds:i},{groupIds:i,groups:r}):{groups:e._pmLastGroupFetch.groups,groupIds:e._pmLastGroupFetch.groupIds}},createGeodesicPolygon:En,getTranslation:_t,findDeepCoordIndex(e,i,r=!0){let a,s=h=>(d,f)=>{let _=h.concat(f);if(r){if(d.lat&&d.lat===i.lat&&d.lng===i.lng)return a=_,!0}else if(d.lat&&L.latLng(d).equals(i))return a=_,!0;return Array.isArray(d)&&d.some(s(_))};e.some(s([]));let l={};return a&&(l={indexPath:a,index:a[a.length-1],parentPath:a.slice(0,a.length-1)}),l},findDeepMarkerIndex(e,i){let r,a=l=>(h,d)=>{let f=l.concat(d);return h._leaflet_id===i._leaflet_id?(r=f,!0):Array.isArray(h)&&h.some(a(f))};e.some(a([]));let s={};return r&&(s={indexPath:r,index:r[r.length-1],parentPath:r.slice(0,r.length-1)}),s},_getIndexFromSegment(e,i){if(i&&i.length===2){let r=this.findDeepCoordIndex(e,i[0]),a=this.findDeepCoordIndex(e,i[1]),s=Math.max(r.index,a.index);return(r.index===0||a.index===0)&&s!==1&&(s+=1),{indexA:r,indexB:a,newIndex:s,indexPath:r.indexPath,parentPath:r.parentPath}}return null},_getRotatedRectangle(e,i,r,a){let s=Qi(a,e),l=Qi(a,i),h=r*Math.PI/180,d=Math.cos(h),f=Math.sin(h),_=(l.x-s.x)*d+(l.y-s.y)*f,k=(l.y-s.y)*d-(l.x-s.x)*f,w=_*d+s.x,z=_*f+s.y,S=-k*f+s.x,U=k*d+s.y,q=ea(a,s),Q=ea(a,{x:w,y:z}),mt=ea(a,l),x=ea(a,{x:S,y:U});return[q,Q,mt,x]},pxRadiusToMeterRadius(e,i,r){let a=i.project(r),s=L.point(a.x+e,a.y);return i.distance(i.unproject(s),r)}},No=zo;L.PM=L.PM||{version:Dt.version,Map:Sr,Toolbar:Or,Draw:Zt,Edit:Ht,Utils:No,Matrix:Io,activeLang:"en",optIn:!1,initialize(e){this.addInitHooks(e)},setOptIn(e){this.optIn=!!e},addInitHooks(){function e(){this.pm=void 0,L.PM.optIn?this.options.pmIgnore===!1&&(this.pm=new L.PM.Map(this)):this.options.pmIgnore||(this.pm=new L.PM.Map(this)),this.pm&&this.pm.setGlobalOptions({})}L.Map.addInitHook(e);function i(){this.pm=void 0,L.PM.optIn?this.options.pmIgnore===!1&&(this.pm=new L.PM.Edit.LayerGroup(this)):this.options.pmIgnore||(this.pm=new L.PM.Edit.LayerGroup(this))}L.LayerGroup.addInitHook(i);function r(){this.pm=void 0,L.PM.optIn?this.options.pmIgnore===!1&&(this.options.textMarker?(this.pm=new L.PM.Edit.Text(this),this.options._textMarkerOverPM||this.pm._initTextMarker(),delete this.options._textMarkerOverPM):this.pm=new L.PM.Edit.Marker(this)):this.options.pmIgnore||(this.options.textMarker?(this.pm=new L.PM.Edit.Text(this),this.options._textMarkerOverPM||this.pm._initTextMarker(),delete this.options._textMarkerOverPM):this.pm=new L.PM.Edit.Marker(this))}L.Marker.addInitHook(r);function a(){this.pm=void 0,L.PM.optIn?this.options.pmIgnore===!1&&(this.pm=new L.PM.Edit.CircleMarker(this)):this.options.pmIgnore||(this.pm=new L.PM.Edit.CircleMarker(this))}L.CircleMarker.addInitHook(a);function s(){this.pm=void 0,L.PM.optIn?this.options.pmIgnore===!1&&(this.pm=new L.PM.Edit.Line(this)):this.options.pmIgnore||(this.pm=new L.PM.Edit.Line(this))}L.Polyline.addInitHook(s);function l(){this.pm=void 0,L.PM.optIn?this.options.pmIgnore===!1&&(this.pm=new L.PM.Edit.Polygon(this)):this.options.pmIgnore||(this.pm=new L.PM.Edit.Polygon(this))}L.Polygon.addInitHook(l);function h(){this.pm=void 0,L.PM.optIn?this.options.pmIgnore===!1&&(this.pm=new L.PM.Edit.Rectangle(this)):this.options.pmIgnore||(this.pm=new L.PM.Edit.Rectangle(this))}L.Rectangle.addInitHook(h);function d(){this.pm=void 0,L.PM.optIn?this.options.pmIgnore===!1&&(this.pm=new L.PM.Edit.Circle(this)):this.options.pmIgnore||(this.pm=new L.PM.Edit.Circle(this))}L.Circle.addInitHook(d);function f(){this.pm=void 0,L.PM.optIn?this.options.pmIgnore===!1&&(this.pm=new L.PM.Edit.ImageOverlay(this)):this.options.pmIgnore||(this.pm=new L.PM.Edit.ImageOverlay(this))}L.ImageOverlay.addInitHook(f)},reInitLayer(e){e instanceof L.LayerGroup&&e.eachLayer(i=>{this.reInitLayer(i)}),e.pm||L.PM.optIn&&e.options.pmIgnore!==!1||e.options.pmIgnore||(e instanceof L.Map?e.pm=new L.PM.Map(e):e instanceof L.Marker?e.options.textMarker?(e.pm=new L.PM.Edit.Text(e),e.pm._initTextMarker(),e.pm._createTextMarker(!1)):e.pm=new L.PM.Edit.Marker(e):e instanceof L.Circle?e.pm=new L.PM.Edit.Circle(e):e instanceof L.CircleMarker?e.pm=new L.PM.Edit.CircleMarker(e):e instanceof L.Rectangle?e.pm=new L.PM.Edit.Rectangle(e):e instanceof L.Polygon?e.pm=new L.PM.Edit.Polygon(e):e instanceof L.Polyline?e.pm=new L.PM.Edit.Line(e):e instanceof L.LayerGroup?e.pm=new L.PM.Edit.LayerGroup(e):e instanceof L.ImageOverlay&&(e.pm=new L.PM.Edit.ImageOverlay(e)))}},L.version==="1.7.1"&&L.Canvas.include({_onClick(e){let i=this._map.mouseEventToLayerPoint(e),r,a;for(let s=this._drawFirst;s;s=s.next)r=s.layer,r.options.interactive&&r._containsPoint(i)&&(!(e.type==="click"||e.type==="preclick")||!this._map._draggableMoved(r))&&(a=r);a&&(L.DomEvent.fakeStop(e),this._fireEvent([a],e))}}),L.PM.initialize()})();document.addEventListener("livewire:init",()=>{let j=($,V)=>({map:null,tile:null,marker:null,rangeCircle:null,drawItems:null,rangeSelectFieldStatePath:null,formRestorationHiddenInput:null,debouncedUpdate:null,debounce:function(W,J){let Et;return function(...st){let pt=()=>{clearTimeout(Et),W(...st)};clearTimeout(Et),Et=setTimeout(pt,J)}},createMap:function(W){let J=this;if(this.map=wt.map(W,V.controls),V.bounds){let I=wt.latLng(V.bounds.sw.lat,V.bounds.sw.lng),st=wt.latLng(V.bounds.ne.lat,V.bounds.ne.lng),pt=wt.latLngBounds(I,st);this.map.setMaxBounds(pt),this.map.fitBounds(pt),this.map.on("drag",function(){J.map.panInsideBounds(pt,{animate:!1})})}this.map.on("load",()=>{setTimeout(()=>this.map.invalidateSize(!0),0),V.showMarker&&!V.clickable&&this.marker.setLatLng(this.map.getCenter())}),V.draggable||this.map.dragging.disable(),V.clickable&&this.map.on("click",function(I){J.setCoordinates(I.latlng)}),this.tile=wt.tileLayer(V.tilesUrl,{attribution:V.attribution,minZoom:V.minZoom,maxZoom:V.maxZoom,tileSize:V.tileSize,zoomOffset:V.zoomOffset,detectRetina:V.detectRetina}).addTo(this.map),V.showMarker&&(this.marker=wt.marker(this.getCoordinates(),{icon:this.createMarkerIcon(),draggable:!1,autoPan:!0}).addTo(this.map),this.setMarkerRange(),V.clickable||this.map.on("move",()=>this.setCoordinates(this.map.getCenter()))),V.clickable||this.map.on("moveend",()=>this.updateLocation()),this.map.on("locationfound",function(){J.map.setZoom(V.controls.zoom)});let Et=this.getCoordinates();if(!Et.lat&&!Et.lng?this.map.locate({setView:!0,maxZoom:V.controls.maxZoom,enableHighAccuracy:!0,watch:!1}):this.map.setView(new wt.LatLng(Et.lat,Et.lng)),V.showMyLocationButton&&this.addLocationButton(),V.liveLocation.send&&V.liveLocation.realtime&&setInterval(()=>{this.fetchCurrentLocation()},V.liveLocation.miliseconds),this.map.on("zoomend",function(I){J.setFormRestorationState(!1,J.map.getZoom())}),V.geoMan.show){this.map.pm.addControls({snappable:V.geoMan.snappable,snapDistance:V.geoMan.snapDistance,position:V.geoMan.position,drawCircleMarker:V.geoMan.drawCircleMarker,rotateMode:V.geoMan.rotateMode,drawRectangle:V.geoMan.drawRectangle,drawText:V.geoMan.drawText,drawMarker:V.geoMan.drawMarker,drawPolygon:V.geoMan.drawPolygon,drawPolyline:V.geoMan.drawPolyline,drawCircle:V.geoMan.drawCircle,editMode:V.geoMan.editMode,dragMode:V.geoMan.dragMode,cutPolygon:V.geoMan.cutPolygon,editPolygon:V.geoMan.editPolygon,deleteLayer:V.geoMan.deleteLayer}),this.drawItems=new wt.FeatureGroup().addTo(this.map),this.map.on("pm:create",st=>{if(st.layer&&st.layer.pm){if(st.layer.pm.enable(),st.shape==="Circle"){let pt=st.layer.getLatLng(),bt=st.layer.getRadius();st.layer.circleData={center:pt,radius:bt}}st.layer.on("pm:edit",()=>{this.updateGeoJson()}),this.drawItems.addLayer(st.layer),this.updateGeoJson()}}),this.map.on("pm:edit",st=>{st.layer&&st.layer.getRadius&&(st.layer.circleData={center:st.layer.getLatLng(),radius:st.layer.getRadius()}),this.updateGeoJson()}),this.map.on("pm:remove",st=>{try{this.drawItems.removeLayer(st.layer),this.updateGeoJson()}catch(pt){console.error("Error during removal of layer:",pt)}});let I=this.getGeoJson();I&&(this.drawItems=wt.geoJSON(I,{pointToLayer:(st,pt)=>{if(st.properties&&st.properties.type==="Circle"){let bt=wt.circle(pt,{radius:st.properties.radius,color:V.geoMan.color||"#3388ff",fillColor:V.geoMan.filledColor||"#cad9ec",fillOpacity:.4});return bt.circleData={center:pt,radius:st.properties.radius},bt}return wt.circleMarker(pt,{radius:15,color:"#3388ff",fillColor:"#3388ff",fillOpacity:.6})},style:function(st){if(st.geometry.type==="Polygon")return{color:V.geoMan.color||"#3388ff",fillColor:V.geoMan.filledColor||"blue",weight:2,fillOpacity:.4}},onEachFeature:(st,pt)=>{typeof st.properties.title<"u"?pt.bindPopup(st.properties.title):st.geometry.type==="Polygon"?pt.bindPopup("Polygon Area"):st.geometry.type==="Point"&&pt.bindPopup("Point Location"),V.geoMan.editable&&(st.geometry.type==="Polygon"?pt.pm.enable({allowSelfIntersection:!1}):st.geometry.type==="Point"&&pt.pm.enable({draggable:!0})),pt.on("pm:edit",()=>{this.updateGeoJson()})}}).addTo(this.map),V.geoMan.editable&&this.drawItems.eachLayer(st=>{st.pm.enable({allowSelfIntersection:!1})}),this.map.fitBounds(this.drawItems.getBounds()))}},createMarkerIcon(){if(V.markerIconUrl)return wt.icon({iconUrl:V.markerIconUrl,iconSize:V.markerIconSize,iconAnchor:V.markerIconAnchor,className:V.markerIconClassName});let J=``;return wt.divIcon({html:V.markerHtml||J,className:V.markerIconClassName,iconSize:V.markerIconSize,iconAnchor:V.markerIconAnchor})},initFormRestoration:function(){this.formRestorationHiddenInput=this.$refs?.formRestorationInput||document.getElementById(this.config.statePath+"_fmrest"),window.addEventListener("pageshow",W=>{let J=this.getFormRestorationState();if(J){let Et=new wt.LatLng(J.lat,J.lng);V.zoom=J.zoom,V.controls.zoom=J.zoom,this.setCoordinates(Et)}})},setFormRestorationState:function(W=null,J=null){W=W||this.getFormRestorationState()||this.getCoordinates(),this.map&&(W.zoom=J??this.map.getZoom()),this.formRestorationHiddenInput&&(this.formRestorationHiddenInput.value=JSON.stringify(W))},getFormRestorationState:function(){return this.formRestorationHiddenInput&&this.formRestorationHiddenInput.value?JSON.parse(this.formRestorationHiddenInput.value):!1},updateGeoJson:function(){try{let W={type:"FeatureCollection",features:[]};this.drawItems.eachLayer(J=>{if(J.getRadius){let Et=J.circleData||{center:J.getLatLng(),radius:J.getRadius()};W.features.push({type:"Feature",properties:{type:"Circle",radius:Et.radius},geometry:{type:"Point",coordinates:[Et.center.lng,Et.center.lat]}})}else{let Et=J.toGeoJSON();W.features.push(Et)}}),$.set(this.config.statePath,{lat:this.marker?this.marker.getLatLng().lat:this.map.getCenter().lat,lng:this.marker?this.marker.getLatLng().lng:this.map.getCenter().lng,geojson:W},!0)}catch(W){console.error("Error updating GeoJSON:",W)}},getGeoJson:function(){return($.get(this.config.statePath)??{}).geojson},updateLocation:function(){let W=this.getCoordinates(),J=this.map.getCenter();V.clickable&&(J=this.marker.getLatLng());let Et=V.minChange||1e-5;(Math.abs(W.lng-J.lng)>Et||Math.abs(W.lat-J.lat)>Et)&&(this.setCoordinates(J),this.setMarkerRange())},removeMap:function(W){this.marker&&(this.marker.remove(),this.marker=null),this.tile.remove(),this.tile=null,this.map.off(),this.map.remove(),this.map=null},getCoordinates:function(){let W=this.getCoordsFromState();return W.hasOwnProperty("lat")&&W.hasOwnProperty("lng")&&W.lat!==null&&W.lng!==null||(W={lat:V.default.lat,lng:V.default.lng}),W},getCoordsFromState:function(){let W=$.get(this.config.statePath);return typeof W=="string"&&(W=JSON.parse(W)),W!==null&&W.hasOwnProperty("lat")&&W.hasOwnProperty("lng")?W:{}},setCoordinates:function(W){return this.setFormRestorationState(W),V.type==="field"&&$.set(V.statePath,{lat:W.lat,lng:W.lng}),this.config.liveLocation.send&&$.refresh(),W},attach:function(W,J=null){J&&(this.$refs=J),this.createMap(W),new IntersectionObserver(I=>{I.forEach(st=>{st.intersectionRatio>0?this.map||this.createMap(W):this.removeMap(W)})},{root:null,rootMargin:"0px",threshold:1}).observe(W)},fetchCurrentLocation:function(){"geolocation"in navigator?navigator.geolocation.getCurrentPosition(async W=>{let J=new wt.LatLng(W.coords.latitude,W.coords.longitude);await this.map.flyTo(J),this.updateLocation(),this.updateMarker()},W=>{console.error("Error fetching current location:",W)}):alert("Geolocation is not supported by this browser.")},addLocationButton:function(){let W=document.createElement("button");W.innerHTML='',W.type="button",W.classList.add("map-location-button"),W.onclick=()=>this.fetchCurrentLocation(),this.map.getContainer().appendChild(W)},setMarkerRange:function(W){if(this.config.clickable&&!this.marker||!this.config.rangeSelectFieldStatePath)return;let J=parseInt($.get(this.rangeSelectFieldStatePath)||0);W||(W=this.getCoordinates());let Et={color:"blue",fillColor:"#f03",fillOpacity:.5,radius:J};this.rangeCircle&&this.rangeCircle.remove(),this.rangeCircle=wt.circle(W,Et).addTo(this.map)},init:function(){this.$wire=$,this.config=V,this.rangeSelectFieldStatePath=V.rangeSelectFieldStatePath,this.initFormRestoration();let W=this;$.on("refreshMap",this.refreshMap.bind(this)),$.watch(V.statePath,J=>{typeof J=="string"&&(J=JSON.parse(J)),W.updateMarker(J)}),$.watch(V.rangeSelectFieldStatePath,J=>{W.updateMarker()})},updateMarker:function(W){this.config.showMarker&&this.marker&&(W||(W=this.getCoordinates()),W.lat&&(this.marker.setLatLng(W),this.setMarkerRange(W)))},refreshMap:function(){this.map.flyTo(this.getCoordinates()),this.updateMarker()}});window.mapPicker=j,window.dispatchEvent(new CustomEvent("map-script-loaded"))}); +/*! Bundled license information: + +leaflet/dist/leaflet-src.js: + (* @preserve + * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com + * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade + *) +*/