From 62e3003fa211fac847f46eaaac8913e0d5363450 Mon Sep 17 00:00:00 2001 From: Jonathon Leight Date: Thu, 6 Aug 2026 17:47:49 -0400 Subject: [PATCH] Add license checks --- .claude/CLAUDE.md | 27 +- .config/mise/config.toml | 11 + .woodpecker/licenses.yaml | 21 + THIRD-PARTY-NOTICES.md | 581 ++++++++++++++++++ cmd/licenses/main.go | 337 ++++++++++ go.mod | 1 + go.sum | 2 + internal/licenses/licenses_test.go | 328 ++++++++++ internal/licenses/manifest.go | 280 +++++++++ internal/licenses/notices.go | 219 +++++++ internal/licenses/texts/bootstrap-5.3.7.txt | 21 + internal/licenses/texts/htmx-2.0.10.txt | 13 + internal/licenses/texts/leaflet-1.9.4.txt | 26 + .../texts/leaflet-geoman-free-2.20.0.txt | 21 + .../texts/leaflet.markercluster-1.5.3.txt | 20 + internal/licenses/texts/tabler-1.4.0.txt | 21 + internal/licenses/texts/tabler-icons.txt | 21 + internal/web/static/leaflet-geoman.css | 6 + internal/web/static/leaflet-geoman.js | 6 + internal/web/static/leaflet.css | 5 + internal/web/static/leaflet.markercluster.css | 7 +- internal/web/templates/icons.html | 10 + 22 files changed, 1981 insertions(+), 3 deletions(-) create mode 100644 .woodpecker/licenses.yaml create mode 100644 THIRD-PARTY-NOTICES.md create mode 100644 cmd/licenses/main.go create mode 100644 internal/licenses/licenses_test.go create mode 100644 internal/licenses/manifest.go create mode 100644 internal/licenses/notices.go create mode 100644 internal/licenses/texts/bootstrap-5.3.7.txt create mode 100644 internal/licenses/texts/htmx-2.0.10.txt create mode 100644 internal/licenses/texts/leaflet-1.9.4.txt create mode 100644 internal/licenses/texts/leaflet-geoman-free-2.20.0.txt create mode 100644 internal/licenses/texts/leaflet.markercluster-1.5.3.txt create mode 100644 internal/licenses/texts/tabler-1.4.0.txt create mode 100644 internal/licenses/texts/tabler-icons.txt diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md index 0405f42..bee8b4e 100644 --- a/.claude/CLAUDE.md +++ b/.claude/CLAUDE.md @@ -127,13 +127,36 @@ markup for it. The one that has already bitten us: left-aligned. **Add `text-start`.** `TestFullWidthFlexButtonsAreTextStart`, in the same file, enforces it. -### 5. CI is the gate, not the first line +### 5. Third-party licensing is a gate — permissive only +We ship a binary and an image, so every dependency has to be one whose license +we can actually comply with. Dependencies stay permissive — copyleft terms +(GPL, LGPL, AGPL, MPL, SSPL) would reach back and constrain how MeshTender +itself may be licensed and distributed. The allowed set is `AllowedSPDX` in +`internal/licenses/manifest.go`; adding to it is a legal decision, not a build +fix. This applies to the test tree too. + +- `mise run licenses` scans the Go module graph (binary + test + `browser` tag) + with `google/licensecheck` **and** the non-Go manifest, then verifies + `THIRD-PARTY-NOTICES.md` is current. `--update` regenerates it. CI gates on it + (`.woodpecker/licenses.yaml`). +- Anything third-party that Go tooling can't see — vendored front-end files, + bundled code, icon artwork, the base image, external services — lives in + `internal/licenses/manifest.go` with its version, SHA-256, upstream source, and + committed license text. The tests there verify the declared SPDX ID against the + actual text, pin file hashes, require attribution banners, and **fail if a file + in `internal/web/static/` is neither declared nor listed as first-party**. Don't + work around that last one — it's what stops a new library escaping the audit. +- **Minifiers strip copyright banners; MIT and BSD require they stay.** When you + update a vendored asset, keep or restore the banner (with the copyright line, + not just the license name) and refresh the manifest hash. + +### 6. CI is the gate, not the first line Woodpecker (`.woodpecker/`): `test` + `lint` + `vuln` (govulncheck) must pass before `build`; `deploy` follows `build` on `main`. A reachable CVE blocks the build. Catch problems locally first; if CI catches something you didn't, close the local-testing gap. -### 6. Git hygiene — stage one batch at a time, don't commit +### 7. Git hygiene — stage one batch at a time, don't commit This is a single-developer project with no PR workflow. **Stage your changes but do NOT commit or push** — the developer commits from a git GUI. Stage exactly the files for one logical change with explicit `git add …` (never `-A`/`.`). diff --git a/.config/mise/config.toml b/.config/mise/config.toml index 4dd128d..0dd9847 100644 --- a/.config/mise/config.toml +++ b/.config/mise/config.toml @@ -15,6 +15,17 @@ run = "go run ./cmd/meshtender" [tasks.lint] run = "golangci-lint run" +# Audits every third-party dependency: scans the Go module graph (including +# test-only and browser-tagged deps) plus the non-Go manifest in +# internal/licenses, and fails if anything is not permissively licensed or if +# THIRD-PARTY-NOTICES.md has drifted. Copyleft terms would constrain how +# MeshTender itself may be licensed, so this is a licensing gate, not a lint. +[tasks.licenses] +usage = ''' +flag "-u --update" help="Rewrite THIRD-PARTY-NOTICES.md instead of only checking it" +''' +run = 'go run ./cmd/licenses ${usage_update:+--update}' + [tasks.seed] run = "go run ./cmd/meshtender --seed" diff --git a/.woodpecker/licenses.yaml b/.woodpecker/licenses.yaml new file mode 100644 index 0000000..8c32788 --- /dev/null +++ b/.woodpecker/licenses.yaml @@ -0,0 +1,21 @@ +# Audits third-party dependency licensing on every push and pull request. +# +# Copyleft terms would reach back and constrain how MeshTender itself may be +# licensed and distributed — so a GPL/LGPL/AGPL/MPL dependency is a licensing +# conflict, not a style problem. This step scans the +# whole Go module graph (binary, test-only, and browser-tagged) plus the non-Go +# manifest in internal/licenses, and also fails when THIRD-PARTY-NOTICES.md has +# drifted from what the dependencies actually are. +# +# The offline half of these checks also runs inside `go test ./...`; this step +# adds the module-graph scan, which needs a module cache. +when: + - event: [push, pull_request] + +steps: + licenses: + image: golang:1.26.5 + commands: + - go run ./cmd/licenses + +depends_on: [] diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md new file mode 100644 index 0000000..be68f85 --- /dev/null +++ b/THIRD-PARTY-NOTICES.md @@ -0,0 +1,581 @@ +# Third-Party Notices + +This file covers the third-party software MeshTender depends on, all of +which is permissively licensed. It makes no statement about MeshTender's +own license. + +**This file is generated. Do not edit it by hand** — run `mise run licenses --update`. +Front-end and artwork entries come from `internal/licenses/manifest.go`; the Go +module list is scanned from the module graph. + + + +## Vendored front-end assets and artwork + +The following third-party code and artwork is redistributed as part of +MeshTender — compiled into the binary via `go:embed` and served to browsers. + +### htmx 2.0.10 — 0BSD + +- Homepage: +- Source: https://cdn.jsdelivr.net/npm/htmx.org@2.0.10/dist/htmx.min.js +- File: `internal/web/static/htmx.min.js` (sha256 `71ea67185bfa8c98c39d31717c6fce5d852370fcdfd129db4543774d3145c0de`) + +``` +Zero-Clause BSD +============= + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE +FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +``` + +### Leaflet 1.9.4 — BSD-2-Clause + +- Homepage: +- Source: https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/ +- File: `internal/web/static/leaflet.js` (sha256 `db49d009c841f5ca34a888c96511ae936fd9f5533e90d8b2c4d57596f4e5641a`) +- File: `internal/web/static/leaflet.css` (sha256 `498bd934faeb2cb455d6db2d9304d18d5aea69afe43fd2ac933c3f3753724617`) +- Modified: leaflet.css carries a hand-restored @preserve banner; upstream ships the stylesheet without one. Body is byte-identical to upstream. + +``` +BSD 2-Clause License + +Copyright (c) 2010-2023, Volodymyr Agafonkin +Copyright (c) 2010-2011, CloudMade +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +``` + +### Leaflet-Geoman 2.20.0 — MIT + +- Homepage: +- Source: https://cdn.jsdelivr.net/npm/@geoman-io/leaflet-geoman-free@2.20.0/dist/ +- File: `internal/web/static/leaflet-geoman.js` (sha256 `50bce5ec0c880d7edc912254f645aa77364fd6c29d66ef92296f855b8b615498`) +- File: `internal/web/static/leaflet-geoman.css` (sha256 `51e45cbdf47dccb437bb34c9aa96b2017957a2471e17f41a72f4ec15a3b8c3f2`) +- Modified: Both files carry hand-restored banners: the upstream esbuild bundle strips its own. Bodies are byte-identical to leaflet-geoman.min.js and leaflet-geoman.css upstream. +- Note: This is the free MIT package (@geoman-io/leaflet-geoman-free). Geoman also sells a commercially licensed product — do not upgrade into it. + +``` +MIT License + +Copyright (c) 2017 Sumit Kumar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +``` + +### Leaflet.markercluster 1.5.3 — MIT + +- Homepage: +- Source: https://cdn.jsdelivr.net/npm/leaflet.markercluster@1.5.3/dist/ +- File: `internal/web/static/leaflet.markercluster.js` (sha256 `b687c3bd8b9239b1dbe4bc4241c2940426cf15ca8543c73e5d4e31e3346fab25`) +- File: `internal/web/static/leaflet.markercluster.css` (sha256 `882ea5266422a7ff57e5641f78a7e8464f81b575f0665634808d60ae6f5ed41d`) +- Modified: The stylesheet is upstream MarkerCluster.css + MarkerCluster.Default.css concatenated, plus a banner; the script is upstream plus a banner. Both bodies are byte-identical to upstream. + +``` +Copyright 2012 David Leaver + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` + +### Tabler 1.4.0 — MIT + +- Homepage: +- Source: https://cdn.jsdelivr.net/npm/@tabler/core@1.4.0/dist/ +- File: `internal/web/static/tabler.min.js` (sha256 `b60c76160e97624574dbb8cf10abe6aee9a6493b60096fdfc15dd1dd2bd99eb9`) +- File: `internal/web/static/tabler.min.css` (sha256 `7ef750bd10546a695d0b12767ad8048bd8f3ec5de7daefb1067f9d0daa3d1c9a`) +- Note: These two files are byte-identical to the public MIT @tabler/core@1.4.0 npm artifacts, verified by SHA-256. Tabler's paid add-ons (Illustrations, Emails, Avatars) are a Personal License that forbids open-source redistribution — nothing from them may enter this repository. The license text here is from the tabler/tabler dev branch: upstream publishes no v1.4.0 git tag and the npm package ships no LICENSE file. + +``` +The MIT License (MIT) + +Copyright (c) 2018-2026 The Tabler Authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +``` + +### Bootstrap 5.3.7 — MIT + +- Homepage: +- Source: bundled inside @tabler/core@1.4.0 dist/js/tabler.min.js +- Note: Not vendored directly: Tabler's bundle embeds Bootstrap, which its own banner declares partway through tabler.min.js. It ships to every user, so it is attributed here. + +``` +The MIT License (MIT) + +Copyright (c) 2011-2025 The Bootstrap Authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +``` + +### Tabler Icons — MIT + +- Homepage: +- Source: https://github.com/tabler/tabler-icons (icon path data, various versions) +- File: `internal/web/templates/icons.html` (sha256 `cb067527ea3b67de4525ff2d44dc7591a19424fb4ae347f8dfcfe0b66bbdedaf`) +- Modified: Icon path data copied into Go template definitions rather than vendored as SVG files; the transparent 24x24 guard path upstream emits is dropped. +- Note: 45 of the 46 icons are Tabler Icons; several are renamed locally (antenna<-antenna-bars-5, copy<-squares, list<-list-details, plug<-plug-connected, terminal<-terminal-2, alert<-alert-triangle, brand-signal<-message-circle-2). Version is unpinned because the set was collected across releases. icon-logo is first-party MeshTender artwork, not Tabler's. + +``` +MIT License + +Copyright (c) 2020-2026 Paweł Kuna + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +``` + +## Base image and external services + +These are not compiled into the binary. The base image is redistributed as +part of the published container; the service is called by the browser at runtime. + +### distroless static-debian12 — Apache-2.0 + +- Homepage: +- Source: gcr.io/distroless/static-debian12:nonroot (Dockerfile runtime stage) +- Note: Runtime base image, redistributed as part of the published container. The distroless project is Apache-2.0; the image layer also carries Debian-packaged CA certificates and tzdata under their own upstream licenses (Mozilla's CA bundle is MPL-2.0, applying to the certificate data we redistribute unmodified, not to MeshTender). + +### CARTO basemaps + +- Homepage: +- Source: https://{s}.basemaps.cartocdn.com (allowlisted in the CSP img-src) +- Note: Raster map tiles fetched by the browser at runtime; no code is redistributed, so no license applies. Attribution ("(c) OpenStreetMap (c) CARTO") is rendered by meshmap.js and regionmap.js. Terms of use are CARTO's and are not verified by any test here — re-read them before relying on unauthenticated basemap access, especially for a commercially licensed deployment. + + + +## Go modules + + + +Go module dependencies, scanned from the module graph with +[licensecheck](https://github.com/google/licensecheck). Each module's own +license file is the authoritative text; the copyright lines below are +reproduced from it to satisfy the attribution clauses. + +### Linked into the MeshTender binary + +Redistributed in compiled form. Their notices are reproduced here. + +- **filippo.io/edwards25519** v1.2.0 — BSD-3-Clause + Copyright (c) 2009 The Go Authors. All rights reserved. + copyright notice, this list of conditions and the following disclaimer +- **github.com/alexedwards/scs/pgxstore** v0.0.0-20251002162104-209de6e426de — MIT + Copyright (c) 2016 Alex Edwards +- **github.com/alexedwards/scs/v2** v2.9.0 — MIT + Copyright (c) 2016 Alex Edwards +- **github.com/andybalholm/brotli** v1.2.2 — MIT + Copyright (c) 2009 The Go Authors. All rights reserved. + Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. + copyright notice, this list of conditions and the following disclaimer +- **github.com/aymerick/douceur** v0.2.0 — MIT + Copyright (c) 2015 Aymerick JEHANNE +- **github.com/brianvoe/gofakeit/v7** v7.15.0 — MIT + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + Copyright (c) [year] [fullname] +- **github.com/coder/websocket** v1.8.15 — ISC + Copyright (c) 2025 Coder + copyright notice and this permission notice appear in all copies. +- **github.com/fxamacker/cbor/v2** v2.9.2 — MIT + Copyright (c) 2019-present Faye Amacker +- **github.com/go-chi/chi/v5** v5.3.1 — MIT + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + Copyright (c) 2015-present Peter Kieltyka (https://github.com/pkieltyka), Google Inc. +- **github.com/go-viper/mapstructure/v2** v2.5.0 — MIT + Copyright (c) 2013 Mitchell Hashimoto +- **github.com/go-webauthn/webauthn** v0.17.4 — BSD-3-Clause + Copyright (c) 2025 github.com/go-webauthn/webauthn authors. +- **github.com/go-webauthn/x** v0.2.6 — BSD-3-Clause + Copyright (c) 2014 CloudFlare Inc. + Copyright (c) 2021-2023 github.com/go-webauthn authors. +- **github.com/golang-jwt/jwt/v5** v5.3.1 — MIT + Copyright (c) 2012 Dave Grijalva + Copyright (c) 2021 golang-jwt maintainers +- **github.com/google/go-tpm** v0.9.8 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright [yyyy] [name of copyright owner] + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/google/uuid** v1.6.0 — BSD-3-Clause + Copyright (c) 2009,2014 Google Inc. All rights reserved. + copyright notice, this list of conditions and the following disclaimer +- **github.com/gorilla/css** v1.0.1 — BSD-3-Clause + Copyright (c) 2023 The Gorilla Authors. All rights reserved. + copyright notice, this list of conditions and the following disclaimer +- **github.com/jackc/pgpassfile** v1.0.0 — MIT + Copyright (c) 2019 Jack Christensen +- **github.com/jackc/pgservicefile** v0.0.0-20240606120523-5a60cdf6a761 — MIT + Copyright (c) 2020 Jack Christensen +- **github.com/jackc/pgx/v5** v5.10.0 — MIT + Copyright (c) 2013-2021 Jack Christensen +- **github.com/jackc/puddle/v2** v2.2.2 — MIT + Copyright (c) 2018 Jack Christensen +- **github.com/meshcore-go/meshcore-go** v1.0.9 — MIT + Copyright (c) 2026 meshcore-go +- **github.com/mfridman/interpolate** v0.0.2 — MIT + Copyright (c) 2014-2017 Buildkite Pty Ltd + Copyright (c) 2023 Michael Fridman +- **github.com/microcosm-cc/bluemonday** v1.0.27 — BSD-3-Clause + Copyright (c) 2014, David Kitchen +- **github.com/peterstace/simplefeatures** v0.59.0 — MIT + Copyright (c) 2019 the contributors. +- **github.com/philhofer/fwd** v1.2.0 — MIT + Copyright (c) 2014-2015, Philip Hofer +- **github.com/pressly/goose/v3** v3.27.2 — MIT + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +- **github.com/resend/resend-go/v3** v3.12.0 — MIT + Copyright (c) 2023 Derich Pacheco +- **github.com/sethvargo/go-retry** v0.3.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright [yyyy] [name of copyright owner] + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/skip2/go-qrcode** v0.0.0-20200617195104-da1b6568686e — MIT + Copyright (c) 2014 Tom Harwood +- **github.com/tinylib/msgp** v1.6.4 — MIT + Copyright (c) 2014 Philip Hofer +- **github.com/x448/float16** v0.8.4 — MIT + Copyright (c) 2019 Montgomery Edwards⁴⁴⁸ and Faye Amacker +- **github.com/yuin/goldmark** v1.8.2 — MIT + Copyright (c) 2019 Yusuke Inuzuka +- **go.uber.org/multierr** v1.11.0 — MIT + Copyright (c) 2017-2021 Uber Technologies, Inc. +- **golang.org/x/crypto** v0.54.0 — BSD-3-Clause + Copyright 2009 The Go Authors. + copyright notice, this list of conditions and the following disclaimer +- **golang.org/x/net** v0.57.0 — BSD-3-Clause + Copyright 2009 The Go Authors. + copyright notice, this list of conditions and the following disclaimer +- **golang.org/x/sync** v0.22.0 — BSD-3-Clause + Copyright 2009 The Go Authors. + copyright notice, this list of conditions and the following disclaimer +- **golang.org/x/sys** v0.47.0 — BSD-3-Clause + Copyright 2009 The Go Authors. + copyright notice, this list of conditions and the following disclaimer +- **golang.org/x/text** v0.40.0 — BSD-3-Clause + Copyright 2009 The Go Authors. + copyright notice, this list of conditions and the following disclaimer + +### Build, test, and tooling only + +Not present in the shipped binary or container. Listed for completeness. + +- **dario.cat/mergo** v1.0.2 — BSD-3-Clause + Copyright (c) 2012 The Go Authors. All rights reserved. + Copyright (c) 2013 Dario Castañé. All rights reserved. + copyright notice, this list of conditions and the following disclaimer +- **github.com/cenkalti/backoff/v4** v4.3.0 — MIT + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + Copyright (c) 2014 Cenk Altı +- **github.com/cespare/xxhash/v2** v2.3.0 — MIT + Copyright (c) 2016 Caleb Spare +- **github.com/chromedp/cdproto** v0.0.0-20260704091341-6ca7914c3938 — MIT + Copyright (c) 2016-2025 Kenneth Shaw +- **github.com/chromedp/chromedp** v0.15.1 — MIT + Copyright (c) 2016-2025 Kenneth Shaw +- **github.com/chromedp/sysutil** v1.1.0 — MIT + Copyright (c) 2016-2017 Kenneth Shaw +- **github.com/containerd/errdefs** v1.0.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright The containerd Authors + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/containerd/errdefs/pkg** v0.3.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright The containerd Authors + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/containerd/log** v0.1.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright The containerd Authors + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/containerd/platforms** v0.2.1 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright The containerd Authors + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/cpuguy83/dockercfg** v0.3.2 — MIT + Copyright (c) 2020 Brian Goff +- **github.com/davecgh/go-spew** v1.1.1 — ISC + Copyright (c) 2012-2016 Dave Collins + copyright notice and this permission notice appear in all copies. +- **github.com/distribution/reference** v0.6.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright {yyyy} {name of copyright owner} + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/docker/go-connections** v0.7.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright 2015 Docker, Inc. + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/docker/go-units** v0.5.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright 2015 Docker, Inc. + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/ebitengine/purego** v0.10.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright {yyyy} {name of copyright owner} + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/felixge/httpsnoop** v1.0.4 — MIT + Copyright (c) 2016 Felix Geisendörfer (felix@debuggable.com) +- **github.com/go-json-experiment/json** v0.0.0-20260214004413-d219187c3433 — BSD-3-Clause + Copyright (c) 2020 The Go Authors. All rights reserved. + copyright notice, this list of conditions and the following disclaimer +- **github.com/go-logr/logr** v1.4.3 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright {yyyy} {name of copyright owner} + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/go-logr/stdr** v1.2.2 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright [yyyy] [name of copyright owner] + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/gobwas/httphead** v0.1.0 — MIT + Copyright (c) 2017 Sergey Kamardin +- **github.com/gobwas/pool** v0.2.1 — MIT + Copyright (c) 2017-2019 Sergey Kamardin +- **github.com/gobwas/ws** v1.4.0 — MIT + Copyright (c) 2017-2021 Sergey Kamardin +- **github.com/google/licensecheck** v0.3.1 — BSD-3-Clause + Copyright (c) 2019 The Go Authors. All rights reserved. + copyright notice, this list of conditions and the following disclaimer +- **github.com/klauspost/compress** v1.18.5 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright (c) 2011 The Snappy-Go Authors. All rights reserved. + Copyright (c) 2012 The Go Authors. All rights reserved. + Copyright (c) 2015 Klaus Post + Copyright (c) 2015, Pierre Curto + Copyright (c) 2016 Caleb Spare + Copyright (c) 2016 Evan Huus + Copyright (c) 2019 Klaus Post. All rights reserved. + Copyright (c) 2023 Klaus Post + Copyright 2016 The filepathx Authors + Copyright 2016-2017 The New York Times Company + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work + copyright notice, this list of conditions and the following disclaimer +- **github.com/magiconair/properties** v1.8.10 — BSD-2-Clause + Copyright (c) 2013-2020, Frank Schroeder +- **github.com/moby/docker-image-spec** v1.3.1 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright [yyyy] [name of copyright owner] + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/moby/go-archive** v0.2.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright [yyyy] [name of copyright owner] + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/moby/moby/api** v1.55.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright [yyyy] [name of copyright owner] + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/moby/moby/client** v0.5.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright [yyyy] [name of copyright owner] + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/moby/patternmatcher** v0.6.1 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright 2012-2017 Docker, Inc. + Copyright 2013-2018 Docker, Inc. + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/moby/sys/sequential** v0.6.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright [yyyy] [name of copyright owner] + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/moby/sys/user** v0.4.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright [yyyy] [name of copyright owner] + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/moby/term** v0.5.2 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright 2013-2018 Docker, Inc. + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/opencontainers/go-digest** v1.0.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright 2016 Docker, Inc. + Copyright 2019, 2020 OCI Contributors + copyright and certain other rights. Our licenses are + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work + copyright--then that use is not regulated by the license. Our +- **github.com/opencontainers/image-spec** v1.1.1 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright 2016 The Linux Foundation. + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **github.com/pmezard/go-difflib** v1.0.0 — BSD-3-Clause + Copyright (c) 2013, Patrick Mezard +- **github.com/shirou/gopsutil/v4** v4.26.5 — BSD-3-Clause + Copyright (c) 2009 The Go Authors. All rights reserved. + Copyright (c) 2014, WAKAYAMA Shirou + copyright notice, this list of conditions and the following disclaimer +- **github.com/sirupsen/logrus** v1.9.4 — MIT + Copyright (c) 2014 Simon Eskildsen +- **github.com/stretchr/testify** v1.11.1 — MIT + Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors. +- **github.com/testcontainers/testcontainers-go** v0.43.0 — MIT + Copyright (c) 2017-2019 Gianluca Arbezzano +- **github.com/testcontainers/testcontainers-go/modules/postgres** v0.43.0 — MIT + Copyright (c) 2017-2019 Gianluca Arbezzano +- **github.com/tklauser/go-sysconf** v0.3.16 — BSD-3-Clause + Copyright (c) 2018-2022, Tobias Klauser +- **go.opentelemetry.io/auto/sdk** v1.2.1 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright [yyyy] [name of copyright owner] + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work +- **go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp** v0.68.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright 2009 The Go Authors. + Copyright [yyyy] [name of copyright owner] + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work + copyright notice, this list of conditions and the following disclaimer +- **go.opentelemetry.io/otel** v1.43.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright 2009 The Go Authors. + Copyright [yyyy] [name of copyright owner] + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work + copyright notice, this list of conditions and the following disclaimer +- **go.opentelemetry.io/otel/metric** v1.43.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright 2009 The Go Authors. + Copyright [yyyy] [name of copyright owner] + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work + copyright notice, this list of conditions and the following disclaimer +- **go.opentelemetry.io/otel/trace** v1.43.0 — Apache-2.0 + (c) You must retain, in the Source form of any Derivative Works + Copyright 2009 The Go Authors. + Copyright [yyyy] [name of copyright owner] + copyright license to reproduce, prepare Derivative Works of, + copyright notice that is included in or attached to the work + copyright notice, this list of conditions and the following disclaimer +- **gopkg.in/yaml.v3** v3.0.1 — Apache-2.0 + Copyright (c) 2006-2010 Kirill Simonov + Copyright (c) 2006-2011 Kirill Simonov + Copyright (c) 2011-2019 Canonical Ltd + Copyright 2011-2016 Canonical Ltd. + copyright staring in 2011 when the project was ported over: + + diff --git a/cmd/licenses/main.go b/cmd/licenses/main.go new file mode 100644 index 0000000..3bcf757 --- /dev/null +++ b/cmd/licenses/main.go @@ -0,0 +1,337 @@ +// Command licenses audits every third-party dependency and keeps +// THIRD-PARTY-NOTICES.md current. +// +// It scans the Go module graph — resolving each module to its license file and +// identifying that file with github.com/google/licensecheck — and combines the +// result with the non-Go manifest in internal/licenses. Anything whose license +// is not on the permissive allowlist fails the run: copyleft terms would reach +// back and constrain how MeshTender itself may be licensed and distributed, so +// they are excluded as a matter of policy rather than preference. +// +// Run it through mise: +// +// mise run licenses # check; non-zero exit on a problem or on drift +// mise run licenses --update # rewrite THIRD-PARTY-NOTICES.md +// +// The Go-module half of the notices file can only be regenerated where a module +// cache exists, which is why the offline test in internal/licenses checks the +// manifest-derived half and CI runs this command for the rest. +package main + +import ( + "encoding/json" + "errors" + "flag" + "fmt" + "io/fs" + "os" + "os/exec" + "path/filepath" + "sort" + "strings" + + "github.com/google/licensecheck" + "github.com/jleight/meshtender/internal/licenses" +) + +// minCoverage mirrors the threshold the package test uses. +const minCoverage = 90.0 + +func main() { + update := flag.Bool("update", false, "rewrite THIRD-PARTY-NOTICES.md instead of only checking it") + flag.Parse() + + if err := run(*update); err != nil { + fmt.Fprintf(os.Stderr, "licenses: %v\n", err) + os.Exit(1) + } +} + +func run(update bool) error { + root, err := repoRoot() + if err != nil { + return err + } + + mods, problems, err := scanModules(root) + if err != nil { + return err + } + + inBinary := 0 + for _, m := range mods { + if m.InBinary { + inBinary++ + } + } + fmt.Printf("Go modules scanned: %d (%d linked into the binary, %d build/test only)\n", + len(mods), inBinary, len(mods)-inBinary) + fmt.Printf("Manifest entries (non-Go): %d\n", len(licenses.Deps)) + + for _, d := range licenses.Deps { + if d.SPDX != "" && !licenses.AllowedSPDX[d.SPDX] { + problems = append(problems, fmt.Sprintf("%s declares non-permissive %s", d.Label(), d.SPDX)) + } + } + + byLicense := map[string]int{} + for _, m := range mods { + byLicense[m.SPDX]++ + } + var ids []string + for id := range byLicense { + ids = append(ids, id) + } + sort.Strings(ids) + fmt.Println("\nGo module licenses:") + for _, id := range ids { + fmt.Printf(" %-32s %d\n", id, byLicense[id]) + } + + if len(problems) > 0 { + fmt.Fprintln(os.Stderr, "\nProblems:") + for _, p := range problems { + fmt.Fprintf(os.Stderr, " - %s\n", p) + } + return fmt.Errorf("%d dependency problem(s); every dependency must be "+ + "permissively licensed", len(problems)) + } + + doc, err := licenses.Notices(licenses.GoSection(mods)) + if err != nil { + return err + } + + path := filepath.Join(root, licenses.NoticesPath) + if update { + if err := os.WriteFile(path, []byte(doc), 0o644); err != nil { //nolint:gosec // G306: THIRD-PARTY-NOTICES.md is a committed, world-readable document + return fmt.Errorf("writing %s: %w", licenses.NoticesPath, err) + } + fmt.Printf("\nWrote %s\n", licenses.NoticesPath) + return nil + } + + existing, err := os.ReadFile(path) //nolint:gosec // G304: path is repoRoot() + a constant filename, not user input + if err != nil { + return fmt.Errorf("reading %s: %w (run `mise run licenses --update`)", licenses.NoticesPath, err) + } + if string(existing) != doc { + return fmt.Errorf("%s is out of date — run `mise run licenses --update` and commit the result", + licenses.NoticesPath) + } + + fmt.Printf("\n%s is current. All dependencies are permissively licensed.\n", licenses.NoticesPath) + return nil +} + +func repoRoot() (string, error) { + dir, err := os.Getwd() + if err != nil { + return "", err + } + for { + if _, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil { + return dir, nil + } + parent := filepath.Dir(dir) + if parent == dir { + return "", errors.New("no go.mod found above the working directory") + } + dir = parent + } +} + +// scanModules resolves every module in the build to its license. It asks the go +// tool three questions: which modules the shipped binary links, which the tests +// add, and which the browser-tagged e2e suite adds on top of that — so a +// dependency cannot hide behind a build tag. +func scanModules(root string) ([]licenses.GoModule, []string, error) { + binary, err := listModules(root, []string{"list", "-deps", "-json", "./cmd/meshtender"}) + if err != nil { + return nil, nil, fmt.Errorf("listing binary dependencies: %w", err) + } + all, err := listModules(root, []string{"list", "-deps", "-test", "-json", "./..."}) + if err != nil { + return nil, nil, fmt.Errorf("listing all dependencies: %w", err) + } + browser, err := listModules(root, []string{"list", "-deps", "-test", "-tags", "browser", "-json", "./..."}) + if err != nil { + return nil, nil, fmt.Errorf("listing browser-tagged dependencies: %w", err) + } + for path, dir := range browser { + if _, ok := all[path]; !ok { + all[path] = dir + } + } + + var mods []licenses.GoModule + var problems []string + + paths := make([]string, 0, len(all)) + for path := range all { + paths = append(paths, path) + } + sort.Strings(paths) + + for _, path := range paths { + info := all[path] + spdx, copyrights, err := identify(info.Dir) + if err != nil { + problems = append(problems, fmt.Sprintf("%s: %v", path, err)) + spdx = "UNKNOWN" + } + if spdx != "UNKNOWN" && !licenses.AllowedSPDX[spdx] { + problems = append(problems, fmt.Sprintf("%s %s is %s, which is not permissive", path, info.Version, spdx)) + } + _, shipped := binary[path] + mods = append(mods, licenses.GoModule{ + Path: path, + Version: info.Version, + SPDX: spdx, + Copyrights: copyrights, + InBinary: shipped, + }) + } + + return mods, problems, nil +} + +type moduleInfo struct { + Version string + Dir string +} + +// listModules runs a `go list -json` invocation and collects the modules behind +// the packages it reports, skipping the standard library and this module itself. +func listModules(root string, args []string) (map[string]moduleInfo, error) { + cmd := exec.Command("go", args...) //nolint:gosec // G204: args are the literal `go list` invocations in scanModules, never external input + cmd.Dir = root + cmd.Stderr = os.Stderr + out, err := cmd.Output() + if err != nil { + return nil, err + } + + type pkg struct { + Module *struct { + Path string + Version string + Dir string + Main bool + } + } + + mods := map[string]moduleInfo{} + dec := json.NewDecoder(strings.NewReader(string(out))) + for { + var p pkg + if err := dec.Decode(&p); err != nil { + break + } + if p.Module == nil || p.Module.Main || p.Module.Dir == "" { + continue + } + mods[p.Module.Path] = moduleInfo{Version: p.Module.Version, Dir: p.Module.Dir} + } + return mods, nil +} + +// identify finds a module's license file and reads its SPDX ID and copyright +// lines out of it. +func identify(dir string) (string, []string, error) { + var best licensecheck.Coverage + var bestIDs []string + var copyrights []string + found := false + + err := filepath.WalkDir(dir, func(p string, d fs.DirEntry, err error) error { + if err != nil { + return nil //nolint:nilerr // an unreadable entry is not fatal to the scan + } + if d.IsDir() { + switch d.Name() { + case "testdata", "vendor", ".git": + return fs.SkipDir + } + return nil + } + if !isLicenseFile(d.Name()) { + return nil + } + b, readErr := os.ReadFile(p) //nolint:gosec // G304: p comes from WalkDir over the module cache directory + if readErr != nil { + return nil + } + found = true + cov := licensecheck.Scan(b) + if cov.Percent > best.Percent { + best = cov + bestIDs = nil + for _, m := range cov.Match { + bestIDs = append(bestIDs, m.ID) + } + } + copyrights = append(copyrights, copyrightLines(string(b))...) + return nil + }) + if err != nil { + return "", nil, err + } + if !found { + return "", nil, errors.New("no license file found in the module") + } + if best.Percent < minCoverage || len(bestIDs) == 0 { + return "", dedupe(copyrights), fmt.Errorf("license not recognized (best coverage %.0f%%)", best.Percent) + } + + // Prefer a permissive match when a module offers a dual license. + sort.Strings(bestIDs) + for _, id := range bestIDs { + if licenses.AllowedSPDX[id] { + return id, dedupe(copyrights), nil + } + } + return bestIDs[0], dedupe(copyrights), nil +} + +func isLicenseFile(name string) bool { + u := strings.ToUpper(name) + for _, suffix := range []string{".MD", ".TXT", ".CODE"} { + u = strings.TrimSuffix(u, suffix) + } + return strings.HasPrefix(u, "LICENSE") || strings.HasPrefix(u, "LICENCE") || + strings.HasPrefix(u, "COPYING") || u == "NOTICE" +} + +func copyrightLines(text string) []string { + var out []string + for _, line := range strings.Split(text, "\n") { + line = strings.TrimSpace(line) + lower := strings.ToLower(line) + if !strings.HasPrefix(lower, "copyright") && !strings.HasPrefix(lower, "(c)") { + continue + } + // Skip the boilerplate sentence from MIT/BSD bodies, which is not a notice. + if strings.Contains(lower, "above copyright notice") || strings.Contains(lower, "shall be included") { + continue + } + if line != "" { + out = append(out, line) + } + } + return out +} + +func dedupe(in []string) []string { + seen := map[string]bool{} + var out []string + for _, s := range in { + if seen[s] { + continue + } + seen[s] = true + out = append(out, s) + } + sort.Strings(out) + return out +} diff --git a/go.mod b/go.mod index 5024a8e..6eeda8e 100644 --- a/go.mod +++ b/go.mod @@ -12,6 +12,7 @@ require ( github.com/coder/websocket v1.8.15 github.com/go-chi/chi/v5 v5.3.1 github.com/go-webauthn/webauthn v0.17.4 + github.com/google/licensecheck v0.3.1 github.com/jackc/pgx/v5 v5.10.0 github.com/meshcore-go/meshcore-go v1.0.9 github.com/microcosm-cc/bluemonday v1.0.27 diff --git a/go.sum b/go.sum index 8e29a10..bfb70cd 100644 --- a/go.sum +++ b/go.sum @@ -92,6 +92,8 @@ github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo= github.com/google/go-tpm v0.9.8/go.mod h1:h9jEsEECg7gtLis0upRBQU+GhYVH6jMjrFxI8u6bVUY= github.com/google/go-tpm-tools v0.3.13-0.20230620182252-4639ecce2aba h1:qJEJcuLzH5KDR0gKc0zcktin6KSAwL7+jWKBYceddTc= github.com/google/go-tpm-tools v0.3.13-0.20230620182252-4639ecce2aba/go.mod h1:EFYHy8/1y2KfgTAsx7Luu7NGhoxtuVHnNo8jE7FikKc= +github.com/google/licensecheck v0.3.1 h1:QoxgoDkaeC4nFrtGN1jV7IPmDCHFNIVh54e5hSt6sPs= +github.com/google/licensecheck v0.3.1/go.mod h1:ORkR35t/JjW+emNKtfJDII0zlciG9JgbT7SmsohlHmY= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= diff --git a/internal/licenses/licenses_test.go b/internal/licenses/licenses_test.go new file mode 100644 index 0000000..86ef90d --- /dev/null +++ b/internal/licenses/licenses_test.go @@ -0,0 +1,328 @@ +package licenses + +import ( + "bytes" + "crypto/sha256" + "encoding/hex" + "fmt" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/google/licensecheck" +) + +// minCoverage is how much of a license text licensecheck must recognize before +// we trust the declared SPDX ID. Real license files score 97-100%; a truncated +// or hand-mangled one scores far lower, which is exactly what we want to catch. +const minCoverage = 90.0 + +// repoRoot walks up from the test's working directory to the module root. +func repoRoot(t *testing.T) string { + t.Helper() + dir, err := os.Getwd() + if err != nil { + t.Fatalf("getwd: %v", err) + } + for { + if _, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil { + return dir + } + parent := filepath.Dir(dir) + if parent == dir { + t.Fatal("could not find go.mod above the test directory") + } + dir = parent + } +} + +// TestManifestEntriesAreWellFormed checks the shape of each entry, so the later +// tests can assume the fields they need are populated. +func TestManifestEntriesAreWellFormed(t *testing.T) { + seen := map[string]bool{} + for _, d := range Deps { + if d.Name == "" { + t.Fatal("a manifest entry has no Name") + } + if seen[d.Label()] { + t.Errorf("%s: duplicate manifest entry", d.Label()) + } + seen[d.Label()] = true + + if d.Kind == "" { + t.Errorf("%s: no Kind", d.Label()) + } + if d.Source == "" { + t.Errorf("%s: no Source — provenance must be recorded", d.Label()) + } + + if d.ShipsCode() { + if d.LicenseText == "" { + t.Errorf("%s: ships code or artwork but declares no LicenseText", d.Label()) + } + if d.SPDX == "" { + t.Errorf("%s: ships code or artwork but declares no SPDX ID", d.Label()) + } + } else { + if d.LicenseText != "" { + t.Errorf("%s: kind %q should not carry a license text", d.Label(), d.Kind) + } + if len(d.Files) != 0 { + t.Errorf("%s: kind %q should not claim vendored files", d.Label(), d.Kind) + } + if d.Note == "" { + t.Errorf("%s: kind %q must explain itself in Note", d.Label(), d.Kind) + } + } + + if d.Kind == KindAsset && len(d.Files) == 0 { + t.Errorf("%s: declared as a vendored asset but claims no files", d.Label()) + } + } +} + +// TestDeclaredSPDXMatchesLicenseText is the core check: it reads the committed +// license text and asserts licensecheck agrees with the SPDX ID we claim. This +// is what makes the manifest evidence rather than an assertion — a wrong, +// swapped, or truncated license text fails here. +func TestDeclaredSPDXMatchesLicenseText(t *testing.T) { + for _, d := range Deps { + if !d.ShipsCode() { + continue + } + t.Run(d.Label(), func(t *testing.T) { + text, err := d.Text() + if err != nil { + t.Fatal(err) + } + cov := licensecheck.Scan([]byte(text)) + if cov.Percent < minCoverage { + t.Fatalf("license text recognized at only %.0f%% (want >= %.0f%%); is texts/%s truncated or modified?", + cov.Percent, minCoverage, d.LicenseText) + } + var got []string + for _, m := range cov.Match { + if m.ID == d.SPDX { + return // declared ID confirmed by the text + } + got = append(got, m.ID) + } + t.Fatalf("declares %s but texts/%s reads as %v (coverage %.0f%%)", + d.SPDX, d.LicenseText, got, cov.Percent) + }) + } +} + +// TestAllDependenciesArePermissive guards the licensing model: copyleft terms +// would constrain how MeshTender itself may be licensed and distributed, so no +// dependency may carry them. +func TestAllDependenciesArePermissive(t *testing.T) { + for _, d := range Deps { + if d.SPDX == "" { + continue // services carry no license + } + if !AllowedSPDX[d.SPDX] { + t.Errorf("%s declares %s, which is not on the permissive allowlist. "+ + "A copyleft dependency is a licensing conflict, not a build failure "+ + "to wave through.", d.Label(), d.SPDX) + } + } +} + +// TestVendoredFilesMatchAuditedHashes pins each file to the content that was +// actually reviewed, so an upgrade cannot land without updating the manifest +// (and therefore without re-checking the license and version). +func TestVendoredFilesMatchAuditedHashes(t *testing.T) { + root := repoRoot(t) + for _, d := range Deps { + for _, f := range d.Files { + t.Run(f.Path, func(t *testing.T) { + b, err := os.ReadFile(filepath.Join(root, f.Path)) + if err != nil { + t.Fatalf("%s declares %s: %v", d.Label(), f.Path, err) + } + sum := sha256.Sum256(b) + if got := hex.EncodeToString(sum[:]); got != f.SHA256 { + t.Errorf("%s changed since it was audited for %s\n want %s\n got %s\n"+ + "If this was an intentional upgrade, re-check the upstream license and "+ + "version, then run `mise run licenses --update`.", f.Path, d.Label(), f.SHA256, got) + } + }) + } + } +} + +// TestNoticeBearingFilesCarryAttribution enforces the actual legal obligation: +// MIT and the BSD licenses require the copyright notice travel with copies, and +// minifiers strip banners. Requiring the version string in the banner also +// catches a file swapped for a different release. +func TestNoticeBearingFilesCarryAttribution(t *testing.T) { + const bannerWindow = 4096 + + root := repoRoot(t) + for _, d := range Deps { + for _, f := range d.Files { + if !f.Notice { + continue + } + t.Run(f.Path, func(t *testing.T) { + b, err := os.ReadFile(filepath.Join(root, f.Path)) + if err != nil { + t.Fatal(err) + } + head := string(b) + if len(head) > bannerWindow { + head = head[:bannerWindow] + } + lower := strings.ToLower(head) + + if !strings.Contains(lower, "copyright") && !strings.Contains(lower, "(c)") { + t.Errorf("%s carries no copyright notice in its first %d bytes; %s is %s and "+ + "requires the notice be retained in redistributed copies", + f.Path, bannerWindow, d.Label(), d.SPDX) + } + if !strings.Contains(lower, strings.ToLower(d.Name)) { + t.Errorf("%s has a banner that does not name %q", f.Path, d.Name) + } + if d.Version != "" && !strings.Contains(head, d.Version) { + t.Errorf("%s has a banner that does not state version %s; either the banner is "+ + "stale or the file was upgraded without updating the manifest", f.Path, d.Version) + } + }) + } + } +} + +// TestEveryStaticFileIsAccountedFor is the check that keeps this manifest +// honest over time. Without it, the next vendored library is simply absent from +// the audit and nothing notices. +func TestEveryStaticFileIsAccountedFor(t *testing.T) { + root := repoRoot(t) + staticDir := filepath.Join(root, "internal", "web", "static") + + claimed := map[string]string{} // base name -> owning dependency + for _, d := range Deps { + for _, f := range d.Files { + claimed[filepath.Base(f.Path)] = d.Label() + } + } + firstParty := map[string]bool{} + for _, name := range FirstPartyStatic { + firstParty[name] = true + } + + entries, err := os.ReadDir(staticDir) + if err != nil { + t.Fatalf("reading %s: %v", staticDir, err) + } + + for _, e := range entries { + if e.IsDir() { + continue + } + name := e.Name() + switch { + case claimed[name] != "": + // vendored and declared + case firstParty[name]: + // ours + default: + t.Errorf("internal/web/static/%s is neither declared in internal/licenses/manifest.go "+ + "nor listed in FirstPartyStatic. If it is third-party, add a manifest entry with its "+ + "license; if we wrote it, add it to FirstPartyStatic.", name) + } + } + + // A stale FirstPartyStatic entry is worth knowing about too: it means a file + // was deleted or renamed and the list drifted. + present := map[string]bool{} + for _, e := range entries { + present[e.Name()] = true + } + for _, name := range FirstPartyStatic { + if !present[name] { + t.Errorf("FirstPartyStatic lists %q, which no longer exists in internal/web/static", name) + } + } +} + +// TestNoticesFileIsCurrent proves the published notices file still matches the +// manifest. Only the assets half is checked here: the Go-module half needs the +// module cache, so `mise run licenses` (and the CI step running it) owns that. +func TestNoticesFileIsCurrent(t *testing.T) { + root := repoRoot(t) + path := filepath.Join(root, NoticesPath) + + doc, err := os.ReadFile(path) + if err != nil { + t.Fatalf("reading %s: %v (run `mise run licenses --update`)", NoticesPath, err) + } + + got, err := Section(string(doc), AssetsBegin, AssetsEnd) + if err != nil { + t.Fatalf("%s: %v", NoticesPath, err) + } + want, err := AssetsSection() + if err != nil { + t.Fatal(err) + } + if got != strings.TrimSpace(want) { + t.Errorf("%s is out of date with internal/licenses/manifest.go — run `mise run licenses --update`", NoticesPath) + } + + goSection, err := Section(string(doc), GoBegin, GoEnd) + if err != nil { + t.Fatalf("%s: %v", NoticesPath, err) + } + if goSection == "" { + t.Errorf("%s has an empty Go module section — run `mise run licenses --update`", NoticesPath) + } +} + +// TestNoticesUsesUnixLineEndings is a regression test. Leaflet's license file +// ships with CRLF, and the generator used to copy those bytes straight into the +// Markdown. The committed file then got normalized to LF by an editor, so it no +// longer matched the generator's output and TestNoticesFileIsCurrent failed on +// every run with no way to fix it by regenerating. A mixed-line-ending +// generated file is a trap; assert it never comes back. +func TestNoticesUsesUnixLineEndings(t *testing.T) { + assets, err := AssetsSection() + if err != nil { + t.Fatal(err) + } + if strings.Contains(assets, "\r") { + t.Error("AssetsSection emits a carriage return; embedded license text must be normalized to LF before it reaches the Markdown") + } + + doc, err := os.ReadFile(filepath.Join(repoRoot(t), NoticesPath)) + if err != nil { + t.Fatalf("reading %s: %v", NoticesPath, err) + } + if bytes.Contains(doc, []byte("\r")) { + t.Errorf("%s contains a carriage return — run `mise run licenses --update`", NoticesPath) + } +} + +// TestReadmeVendoredVersionsMatchManifest keeps the README's version table from +// drifting, since it is the second place a version is written down. +func TestReadmeVendoredVersionsMatchManifest(t *testing.T) { + root := repoRoot(t) + b, err := os.ReadFile(filepath.Join(root, "README.md")) + if err != nil { + t.Fatalf("reading README.md: %v", err) + } + readme := string(b) + + for _, d := range Deps { + if d.Kind != KindAsset || d.Version == "" { + continue + } + // The table renders as: | [Name](url) | version | files | + row := fmt.Sprintf("| %s |", d.Version) + if !strings.Contains(readme, row) { + t.Errorf("README.md has no vendored-assets table row stating version %s for %s; "+ + "the table and the manifest disagree", d.Version, d.Name) + } + } +} diff --git a/internal/licenses/manifest.go b/internal/licenses/manifest.go new file mode 100644 index 0000000..d0a941b --- /dev/null +++ b/internal/licenses/manifest.go @@ -0,0 +1,280 @@ +// Package licenses is the manifest of every third-party dependency that Go +// tooling cannot see: the front-end libraries vendored into +// internal/web/static, third-party code bundled inside those libraries, icon +// artwork copied into our templates, the container base image, and the one +// external service the app talks to at runtime. +// +// Go modules are deliberately NOT listed here — the module graph already names +// them and every module ships its own license file. `mise run licenses` scans +// them and writes their section of the generated THIRD-PARTY-NOTICES.md. +// +// The tests in this package are what make the manifest load-bearing rather than +// documentation: they verify each declared SPDX ID against the committed +// license text (via github.com/google/licensecheck), that every declared file +// still hashes to what was audited, that files needing an attribution notice +// carry one, and — most importantly — that nothing third-party in +// internal/web/static escapes the manifest entirely. +package licenses + +import ( + "embed" + "fmt" +) + +// texts holds the verbatim upstream license text for each dependency. Fetch +// these with `mise run licenses --refresh`; never hand-edit them, because the +// tests scan them to confirm the declared SPDX ID is really what the text says. +// +//go:embed texts/*.txt +var texts embed.FS + +// Kind describes what sort of dependency an entry is, which decides which +// checks apply to it. +type Kind string + +const ( + // KindAsset is a third-party file served to the browser out of + // internal/web/static. + KindAsset Kind = "asset" + + // KindBundled is third-party code embedded inside another vendored asset. + // It has no file of its own, so only its license text is checked — but it + // still ships to users and still needs attribution. + KindBundled Kind = "bundled" + + // KindArtwork is third-party art (icon paths) copied into our templates + // rather than vendored as a whole file. + KindArtwork Kind = "artwork" + + // KindImage is a container base image referenced by the Dockerfile. We + // redistribute it as part of the published image. + KindImage Kind = "image" + + // KindService is an external service the app calls at runtime. It ships no + // code, so there is no license to scan — only terms to point at. + KindService Kind = "service" +) + +// File is one vendored file, pinned to the content that was audited. +type File struct { + // Path is relative to the repository root. + Path string + + // SHA256 is the hash of the file as committed. For most files that is + // byte-identical to the upstream artifact; where our vendoring process + // modifies it (a restored banner, a stripped sourceMappingURL comment, or + // two upstream stylesheets concatenated), Dep.Modified says so. + SHA256 string + + // Notice marks a file that must carry a copyright banner naming the + // dependency, because its license requires the notice travel with copies. + Notice bool +} + +// Dep is one third-party dependency outside the Go module graph. +type Dep struct { + Name string + Version string // empty when upstream publishes no version we can pin + SPDX string // must agree with what licensecheck reads from LicenseText + Homepage string + Kind Kind + + // Source is where the artifact came from, so provenance is a fact in the + // repo rather than an investigation later. + Source string + + // LicenseText names a file in texts/. Required for everything that ships + // code or art; empty for images and services. + LicenseText string + + // Files are the vendored files this dependency accounts for. Empty for + // bundled code, images, and services. + Files []File + + // Modified explains how the committed files differ from upstream, or is + // empty when they are byte-identical. + Modified string + + // Note carries anything a future reader needs: why an entry exists, what + // terms apply, what to watch out for. + Note string +} + +// Deps is the manifest. Adding a vendored library means adding it here — the +// tests fail otherwise. +var Deps = []Dep{ + { + Name: "htmx", + Version: "2.0.10", + SPDX: "0BSD", + Homepage: "https://htmx.org", + Kind: KindAsset, + Source: "https://cdn.jsdelivr.net/npm/htmx.org@2.0.10/dist/htmx.min.js", + LicenseText: "htmx-2.0.10.txt", + // 0BSD imposes no attribution requirement at all, so Notice is false: + // the upstream build ships no banner and none is owed. + Files: []File{ + {Path: "internal/web/static/htmx.min.js", SHA256: "71ea67185bfa8c98c39d31717c6fce5d852370fcdfd129db4543774d3145c0de"}, + }, + }, + { + Name: "Leaflet", + Version: "1.9.4", + SPDX: "BSD-2-Clause", + Homepage: "https://leafletjs.com", + Kind: KindAsset, + Source: "https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/", + LicenseText: "leaflet-1.9.4.txt", + Files: []File{ + {Path: "internal/web/static/leaflet.js", SHA256: "db49d009c841f5ca34a888c96511ae936fd9f5533e90d8b2c4d57596f4e5641a", Notice: true}, + {Path: "internal/web/static/leaflet.css", SHA256: "498bd934faeb2cb455d6db2d9304d18d5aea69afe43fd2ac933c3f3753724617", Notice: true}, + }, + Modified: "leaflet.css carries a hand-restored @preserve banner; upstream ships the stylesheet without one. Body is byte-identical to upstream.", + }, + { + Name: "Leaflet-Geoman", + Version: "2.20.0", + SPDX: "MIT", + Homepage: "https://geoman.io", + Kind: KindAsset, + Source: "https://cdn.jsdelivr.net/npm/@geoman-io/leaflet-geoman-free@2.20.0/dist/", + LicenseText: "leaflet-geoman-free-2.20.0.txt", + Files: []File{ + {Path: "internal/web/static/leaflet-geoman.js", SHA256: "50bce5ec0c880d7edc912254f645aa77364fd6c29d66ef92296f855b8b615498", Notice: true}, + {Path: "internal/web/static/leaflet-geoman.css", SHA256: "51e45cbdf47dccb437bb34c9aa96b2017957a2471e17f41a72f4ec15a3b8c3f2", Notice: true}, + }, + Modified: "Both files carry hand-restored banners: the upstream esbuild bundle strips its own. Bodies are byte-identical to leaflet-geoman.min.js and leaflet-geoman.css upstream.", + Note: "This is the free MIT package (@geoman-io/leaflet-geoman-free). Geoman also sells a commercially licensed product — do not upgrade into it.", + }, + { + Name: "Leaflet.markercluster", + Version: "1.5.3", + SPDX: "MIT", + Homepage: "https://github.com/Leaflet/Leaflet.markercluster", + Kind: KindAsset, + Source: "https://cdn.jsdelivr.net/npm/leaflet.markercluster@1.5.3/dist/", + LicenseText: "leaflet.markercluster-1.5.3.txt", + Files: []File{ + {Path: "internal/web/static/leaflet.markercluster.js", SHA256: "b687c3bd8b9239b1dbe4bc4241c2940426cf15ca8543c73e5d4e31e3346fab25", Notice: true}, + {Path: "internal/web/static/leaflet.markercluster.css", SHA256: "882ea5266422a7ff57e5641f78a7e8464f81b575f0665634808d60ae6f5ed41d", Notice: true}, + }, + Modified: "The stylesheet is upstream MarkerCluster.css + MarkerCluster.Default.css concatenated, plus a banner; the script is upstream plus a banner. Both bodies are byte-identical to upstream.", + }, + { + Name: "Tabler", + Version: "1.4.0", + SPDX: "MIT", + Homepage: "https://tabler.io", + Kind: KindAsset, + Source: "https://cdn.jsdelivr.net/npm/@tabler/core@1.4.0/dist/", + LicenseText: "tabler-1.4.0.txt", + Files: []File{ + {Path: "internal/web/static/tabler.min.js", SHA256: "b60c76160e97624574dbb8cf10abe6aee9a6493b60096fdfc15dd1dd2bd99eb9", Notice: true}, + {Path: "internal/web/static/tabler.min.css", SHA256: "7ef750bd10546a695d0b12767ad8048bd8f3ec5de7daefb1067f9d0daa3d1c9a", Notice: true}, + }, + Note: "These two files are byte-identical to the public MIT @tabler/core@1.4.0 npm artifacts, verified by SHA-256. Tabler's paid add-ons (Illustrations, Emails, Avatars) are a Personal License that forbids open-source redistribution — nothing from them may enter this repository. The license text here is from the tabler/tabler dev branch: upstream publishes no v1.4.0 git tag and the npm package ships no LICENSE file.", + }, + { + Name: "Bootstrap", + Version: "5.3.7", + SPDX: "MIT", + Homepage: "https://getbootstrap.com", + Kind: KindBundled, + Source: "bundled inside @tabler/core@1.4.0 dist/js/tabler.min.js", + LicenseText: "bootstrap-5.3.7.txt", + Note: "Not vendored directly: Tabler's bundle embeds Bootstrap, which its own banner declares partway through tabler.min.js. It ships to every user, so it is attributed here.", + }, + { + Name: "Tabler Icons", + SPDX: "MIT", + Homepage: "https://tabler.io/icons", + Kind: KindArtwork, + Source: "https://github.com/tabler/tabler-icons (icon path data, various versions)", + LicenseText: "tabler-icons.txt", + Files: []File{ + {Path: "internal/web/templates/icons.html", SHA256: "cb067527ea3b67de4525ff2d44dc7591a19424fb4ae347f8dfcfe0b66bbdedaf", Notice: true}, + }, + Modified: "Icon path data copied into Go template definitions rather than vendored as SVG files; the transparent 24x24 guard path upstream emits is dropped.", + Note: "45 of the 46 icons are Tabler Icons; several are renamed locally (antenna<-antenna-bars-5, copy<-squares, list<-list-details, plug<-plug-connected, terminal<-terminal-2, alert<-alert-triangle, brand-signal<-message-circle-2). Version is unpinned because the set was collected across releases. icon-logo is first-party MeshTender artwork, not Tabler's.", + }, + { + Name: "distroless static-debian12", + SPDX: "Apache-2.0", + Homepage: "https://github.com/GoogleContainerTools/distroless", + Kind: KindImage, + Source: "gcr.io/distroless/static-debian12:nonroot (Dockerfile runtime stage)", + Note: "Runtime base image, redistributed as part of the published container. The distroless project is Apache-2.0; the image layer also carries Debian-packaged CA certificates and tzdata under their own upstream licenses (Mozilla's CA bundle is MPL-2.0, applying to the certificate data we redistribute unmodified, not to MeshTender).", + }, + { + Name: "CARTO basemaps", + Homepage: "https://carto.com", + Kind: KindService, + Source: "https://{s}.basemaps.cartocdn.com (allowlisted in the CSP img-src)", + Note: "Raster map tiles fetched by the browser at runtime; no code is redistributed, so no license applies. Attribution (\"(c) OpenStreetMap (c) CARTO\") is rendered by meshmap.js and regionmap.js. Terms of use are CARTO's and are not verified by any test here — re-read them before relying on unauthenticated basemap access, especially for a commercially licensed deployment.", + }, +} + +// FirstPartyStatic lists the files in internal/web/static that we wrote +// ourselves. Anything in that directory which is neither listed here nor +// claimed by a Deps entry fails TestEveryStaticFileIsAccountedFor — that check +// is what stops the next vendored library from slipping in unaudited. +var FirstPartyStatic = []string{ + "app.css", + "console-config.js", + "console.js", + "favicon.svg", + "link-editor.js", + "listfilter.js", + "meshmap.js", + "regionmap.js", + "serial-setup.js", + "timezone-picker.js", + "ui.js", + "webauthn.js", +} + +// AllowedSPDX is the set of licenses a dependency may carry. Everything here is +// permissive: copyleft terms (GPL, LGPL, AGPL, MPL, SSPL) would reach back and +// constrain how MeshTender itself may be licensed and distributed, so a +// copyleft dependency is a licensing conflict rather than a preference. Adding +// to this list is a legal decision, not a build fix. +var AllowedSPDX = map[string]bool{ + "0BSD": true, + "Apache-2.0": true, + "BSD-2-Clause": true, + "BSD-3-Clause": true, + "ISC": true, + "MIT": true, + "Unlicense": true, +} + +// LicenseText returns the verbatim upstream license text for a dependency. +func (d Dep) Text() (string, error) { + if d.LicenseText == "" { + return "", fmt.Errorf("licenses: %s declares no license text", d.Name) + } + b, err := texts.ReadFile("texts/" + d.LicenseText) + if err != nil { + return "", fmt.Errorf("licenses: reading text for %s: %w", d.Name, err) + } + return string(b), nil +} + +// Label names a dependency for humans, with its version when we have one. +func (d Dep) Label() string { + if d.Version == "" { + return d.Name + } + return d.Name + " " + d.Version +} + +// ShipsCode reports whether an entry carries code or art we redistribute, and +// therefore must have a scannable license text. +func (d Dep) ShipsCode() bool { + switch d.Kind { + case KindAsset, KindBundled, KindArtwork: + return true + default: + return false + } +} diff --git a/internal/licenses/notices.go b/internal/licenses/notices.go new file mode 100644 index 0000000..8bf11b5 --- /dev/null +++ b/internal/licenses/notices.go @@ -0,0 +1,219 @@ +package licenses + +import ( + "fmt" + "strings" +) + +// NoticesPath is where the generated notices file lives, relative to the +// repository root. +const NoticesPath = "THIRD-PARTY-NOTICES.md" + +// The generated file is split into two marked sections so each has an owner. +// The assets section derives entirely from this package's manifest, so the +// tests can regenerate and compare it with no network and no module cache. The +// Go-module section needs `go list` plus the module cache, so cmd/licenses owns +// it and CI is what proves it current. +const ( + AssetsBegin = "" + AssetsEnd = "" + GoBegin = "" + GoEnd = "" +) + +// Section extracts the text between two markers, exclusive of the markers. +func Section(doc, begin, end string) (string, error) { + i := strings.Index(doc, begin) + if i < 0 { + return "", fmt.Errorf("licenses: marker %q not found", begin) + } + i += len(begin) + j := strings.Index(doc[i:], end) + if j < 0 { + return "", fmt.Errorf("licenses: marker %q not found after %q", end, begin) + } + return strings.TrimSpace(doc[i : i+j]), nil +} + +// AssetsSection renders the manifest as Markdown. It is a pure function of +// Deps, which is what lets the test assert the committed file matches. +func AssetsSection() (string, error) { + var b strings.Builder + + shipping, referenced := splitByKind(Deps) + + b.WriteString("## Vendored front-end assets and artwork\n\n") + b.WriteString("The following third-party code and artwork is redistributed as part of\n") + b.WriteString("MeshTender — compiled into the binary via `go:embed` and served to browsers.\n") + + for _, d := range shipping { + if err := writeDep(&b, d, true); err != nil { + return "", err + } + } + + b.WriteString("\n## Base image and external services\n\n") + b.WriteString("These are not compiled into the binary. The base image is redistributed as\n") + b.WriteString("part of the published container; the service is called by the browser at runtime.\n") + + for _, d := range referenced { + if err := writeDep(&b, d, false); err != nil { + return "", err + } + } + + return strings.TrimSpace(b.String()), nil +} + +func splitByKind(deps []Dep) (shipping, referenced []Dep) { + for _, d := range deps { + if d.ShipsCode() { + shipping = append(shipping, d) + } else { + referenced = append(referenced, d) + } + } + return shipping, referenced +} + +func writeDep(b *strings.Builder, d Dep, withText bool) error { + fmt.Fprintf(b, "\n### %s", d.Label()) + if d.SPDX != "" { + fmt.Fprintf(b, " — %s", d.SPDX) + } + b.WriteString("\n\n") + + if d.Homepage != "" { + fmt.Fprintf(b, "- Homepage: <%s>\n", d.Homepage) + } + if d.Source != "" { + fmt.Fprintf(b, "- Source: %s\n", d.Source) + } + for _, f := range d.Files { + fmt.Fprintf(b, "- File: `%s` (sha256 `%s`)\n", f.Path, f.SHA256) + } + if d.Modified != "" { + fmt.Fprintf(b, "- Modified: %s\n", d.Modified) + } + if d.Note != "" { + fmt.Fprintf(b, "- Note: %s\n", d.Note) + } + + if !withText { + return nil + } + text, err := d.Text() + if err != nil { + return err + } + b.WriteString("\n```\n") + b.WriteString(normalizeEOL(strings.TrimSpace(text))) + b.WriteString("\n```\n") + return nil +} + +// normalizeEOL rewrites CRLF to LF. Some upstream license files ship with +// Windows line endings (Leaflet's does), and Dep.Text deliberately returns them +// verbatim so the SPDX check reads exactly what upstream published. Writing +// those bytes straight into the Markdown, though, leaves the generated file +// with mixed line endings — which any editor or `git add` with autocrlf will +// silently normalize, permanently desynchronizing the committed file from what +// the generator produces and failing the drift check forever. That already +// happened once. Normalizing here keeps the notices file pure LF, while the +// embedded texts/ files stay byte-faithful to upstream. +func normalizeEOL(s string) string { + return strings.ReplaceAll(s, "\r\n", "\n") +} + +// GoModule is one module from the Go dependency graph, as scanned by +// cmd/licenses. +type GoModule struct { + Path string + Version string + SPDX string + Copyrights []string + // InBinary distinguishes modules linked into the shipped binary from those + // only used by tests and tooling. Both are listed; only the first group + // carries redistribution obligations. + InBinary bool +} + +// GoSection renders scanned modules as Markdown, grouped by whether they ship. +func GoSection(mods []GoModule) string { + var b strings.Builder + + b.WriteString("Go module dependencies, scanned from the module graph with\n") + b.WriteString("[licensecheck](https://github.com/google/licensecheck). Each module's own\n") + b.WriteString("license file is the authoritative text; the copyright lines below are\n") + b.WriteString("reproduced from it to satisfy the attribution clauses.\n") + + groups := []struct { + title string + blurb string + inBinary bool + }{ + { + "Linked into the MeshTender binary", + "Redistributed in compiled form. Their notices are reproduced here.", + true, + }, + { + "Build, test, and tooling only", + "Not present in the shipped binary or container. Listed for completeness.", + false, + }, + } + + for _, g := range groups { + var rows []GoModule + for _, m := range mods { + if m.InBinary == g.inBinary { + rows = append(rows, m) + } + } + if len(rows) == 0 { + continue + } + fmt.Fprintf(&b, "\n### %s\n\n%s\n\n", g.title, g.blurb) + for _, m := range rows { + fmt.Fprintf(&b, "- **%s** %s — %s", m.Path, m.Version, m.SPDX) + if len(m.Copyrights) > 0 { + fmt.Fprintf(&b, " \n %s", strings.Join(m.Copyrights, " \n ")) + } + b.WriteString("\n") + } + } + + return strings.TrimSpace(b.String()) +} + +// Notices assembles the whole file from the manifest and a scanned Go section. +// Passing an empty goSection preserves nothing — callers that only want to +// refresh the assets half should read the existing file and pass its Go section +// back in. +func Notices(goSection string) (string, error) { + assets, err := AssetsSection() + if err != nil { + return "", err + } + + var b strings.Builder + b.WriteString("# Third-Party Notices\n\n") + b.WriteString("This file covers the third-party software MeshTender depends on, all of\n") + b.WriteString("which is permissively licensed. It makes no statement about MeshTender's\n") + b.WriteString("own license.\n\n") + b.WriteString("**This file is generated. Do not edit it by hand** — run `mise run licenses --update`.\n") + b.WriteString("Front-end and artwork entries come from `internal/licenses/manifest.go`; the Go\n") + b.WriteString("module list is scanned from the module graph.\n\n") + + b.WriteString(AssetsBegin + "\n\n") + b.WriteString(assets + "\n\n") + b.WriteString(AssetsEnd + "\n\n") + + b.WriteString("## Go modules\n\n") + b.WriteString(GoBegin + "\n\n") + b.WriteString(strings.TrimSpace(goSection) + "\n\n") + b.WriteString(GoEnd + "\n") + + return b.String(), nil +} diff --git a/internal/licenses/texts/bootstrap-5.3.7.txt b/internal/licenses/texts/bootstrap-5.3.7.txt new file mode 100644 index 0000000..fa7c00b --- /dev/null +++ b/internal/licenses/texts/bootstrap-5.3.7.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2011-2025 The Bootstrap Authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/internal/licenses/texts/htmx-2.0.10.txt b/internal/licenses/texts/htmx-2.0.10.txt new file mode 100644 index 0000000..d3061a3 --- /dev/null +++ b/internal/licenses/texts/htmx-2.0.10.txt @@ -0,0 +1,13 @@ +Zero-Clause BSD +============= + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE +FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/internal/licenses/texts/leaflet-1.9.4.txt b/internal/licenses/texts/leaflet-1.9.4.txt new file mode 100644 index 0000000..bcb3ba1 --- /dev/null +++ b/internal/licenses/texts/leaflet-1.9.4.txt @@ -0,0 +1,26 @@ +BSD 2-Clause License + +Copyright (c) 2010-2023, Volodymyr Agafonkin +Copyright (c) 2010-2011, CloudMade +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/internal/licenses/texts/leaflet-geoman-free-2.20.0.txt b/internal/licenses/texts/leaflet-geoman-free-2.20.0.txt new file mode 100644 index 0000000..46fab5b --- /dev/null +++ b/internal/licenses/texts/leaflet-geoman-free-2.20.0.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Sumit Kumar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/internal/licenses/texts/leaflet.markercluster-1.5.3.txt b/internal/licenses/texts/leaflet.markercluster-1.5.3.txt new file mode 100644 index 0000000..19af068 --- /dev/null +++ b/internal/licenses/texts/leaflet.markercluster-1.5.3.txt @@ -0,0 +1,20 @@ +Copyright 2012 David Leaver + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/internal/licenses/texts/tabler-1.4.0.txt b/internal/licenses/texts/tabler-1.4.0.txt new file mode 100644 index 0000000..aa69649 --- /dev/null +++ b/internal/licenses/texts/tabler-1.4.0.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018-2026 The Tabler Authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/internal/licenses/texts/tabler-icons.txt b/internal/licenses/texts/tabler-icons.txt new file mode 100644 index 0000000..3e82379 --- /dev/null +++ b/internal/licenses/texts/tabler-icons.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020-2026 Paweł Kuna + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/internal/web/static/leaflet-geoman.css b/internal/web/static/leaflet-geoman.css index 500b4e3..a383b3f 100644 --- a/internal/web/static/leaflet-geoman.css +++ b/internal/web/static/leaflet-geoman.css @@ -1,3 +1,9 @@ +/* @preserve + * Leaflet-Geoman (leaflet-geoman-free) 2.20.0 stylesheet, https://geoman.io + * (c) 2017 Sumit Kumar, MIT License. + * Banner restored by hand: the upstream esbuild bundle ships none. + * Vendored (self-hosted per CSP); see THIRD-PARTY-NOTICES.md. + */ /* src/css/layers.css */ .marker-icon { background-color: #ffffff; diff --git a/internal/web/static/leaflet-geoman.js b/internal/web/static/leaflet-geoman.js index 619f4a9..0d4a6dc 100644 --- a/internal/web/static/leaflet-geoman.js +++ b/internal/web/static/leaflet-geoman.js @@ -1 +1,7 @@ +/*! @preserve + * Leaflet-Geoman (leaflet-geoman-free) 2.20.0, https://geoman.io + * (c) 2017 Sumit Kumar, MIT License. + * Banner restored by hand: the upstream esbuild bundle ships none. + * Vendored (self-hosted per CSP); see THIRD-PARTY-NOTICES.md. + */ "use strict";(()=>{var Ol=Object.create;var Yi=Object.defineProperty;var Il=Object.getOwnPropertyDescriptor;var Al=Object.getOwnPropertyNames;var Gl=Object.getPrototypeOf,ql=Object.prototype.hasOwnProperty;var B=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}};var Nl=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Al(e))!ql.call(t,n)&&n!==i&&Yi(t,n,{get:()=>e[n],enumerable:!(r=Il(e,n))||r.enumerable});return t};var wt=(t,e,i)=>(i=t!=null?Ol(Gl(t)):{},Nl(e||!t||!t.__esModule?Yi(i,"default",{value:t,enumerable:!0}):i,t));var Zi=B((d_,$i)=>{function Fl(){this.__data__=[],this.size=0}$i.exports=Fl});var se=B((g_,Wi)=>{function jl(t,e){return t===e||t!==t&&e!==e}Wi.exports=jl});var ae=B((m_,Qi)=>{var Vl=se();function Ul(t,e){for(var i=t.length;i--;)if(Vl(t[i][0],e))return i;return-1}Qi.exports=Ul});var er=B((__,tr)=>{var Kl=ae(),Hl=Array.prototype,Xl=Hl.splice;function Yl(t){var e=this.__data__,i=Kl(e,t);if(i<0)return!1;var r=e.length-1;return i==r?e.pop():Xl.call(e,i,1),--this.size,!0}tr.exports=Yl});var rr=B((y_,ir)=>{var Jl=ae();function $l(t){var e=this.__data__,i=Jl(e,t);return i<0?void 0:e[i][1]}ir.exports=$l});var sr=B((L_,nr)=>{var Zl=ae();function Wl(t){return Zl(this.__data__,t)>-1}nr.exports=Wl});var or=B((b_,ar)=>{var Ql=ae();function th(t,e){var i=this.__data__,r=Ql(i,t);return r<0?(++this.size,i.push([t,e])):i[r][1]=e,this}ar.exports=th});var oe=B((k_,lr)=>{var eh=Zi(),ih=er(),rh=rr(),nh=sr(),sh=or();function jt(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e{var ah=oe();function oh(){this.__data__=new ah,this.size=0}hr.exports=oh});var pr=B((v_,ur)=>{function lh(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i}ur.exports=lh});var dr=B((x_,fr)=>{function hh(t){return this.__data__.get(t)}fr.exports=hh});var mr=B((w_,gr)=>{function ch(t){return this.__data__.has(t)}gr.exports=ch});var ti=B((C_,_r)=>{var uh=typeof global=="object"&&global&&global.Object===Object&&global;_r.exports=uh});var It=B((E_,yr)=>{var ph=ti(),fh=typeof self=="object"&&self&&self.Object===Object&&self,dh=ph||fh||Function("return this")();yr.exports=dh});var Se=B((P_,Lr)=>{var gh=It(),mh=gh.Symbol;Lr.exports=mh});var vr=B((S_,Mr)=>{var br=Se(),kr=Object.prototype,_h=kr.hasOwnProperty,yh=kr.toString,le=br?br.toStringTag:void 0;function Lh(t){var e=_h.call(t,le),i=t[le];try{t[le]=void 0;var r=!0}catch{}var n=yh.call(t);return r&&(e?t[le]=i:delete t[le]),n}Mr.exports=Lh});var wr=B((T_,xr)=>{var bh=Object.prototype,kh=bh.toString;function Mh(t){return kh.call(t)}xr.exports=Mh});var Vt=B((B_,Pr)=>{var Cr=Se(),vh=vr(),xh=wr(),wh="[object Null]",Ch="[object Undefined]",Er=Cr?Cr.toStringTag:void 0;function Eh(t){return t==null?t===void 0?Ch:wh:Er&&Er in Object(t)?vh(t):xh(t)}Pr.exports=Eh});var Ct=B((D_,Sr)=>{function Ph(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}Sr.exports=Ph});var Te=B((R_,Tr)=>{var Sh=Vt(),Th=Ct(),Bh="[object AsyncFunction]",Dh="[object Function]",Rh="[object GeneratorFunction]",Oh="[object Proxy]";function Ih(t){if(!Th(t))return!1;var e=Sh(t);return e==Dh||e==Rh||e==Bh||e==Oh}Tr.exports=Ih});var Dr=B((O_,Br)=>{var Ah=It(),Gh=Ah["__core-js_shared__"];Br.exports=Gh});var Ir=B((I_,Or)=>{var ei=Dr(),Rr=(function(){var t=/[^.]+$/.exec(ei&&ei.keys&&ei.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function qh(t){return!!Rr&&Rr in t}Or.exports=qh});var Gr=B((A_,Ar)=>{var Nh=Function.prototype,zh=Nh.toString;function Fh(t){if(t!=null){try{return zh.call(t)}catch{}try{return t+""}catch{}}return""}Ar.exports=Fh});var Nr=B((G_,qr)=>{var jh=Te(),Vh=Ir(),Uh=Ct(),Kh=Gr(),Hh=/[\\^$.*+?()[\]{}|]/g,Xh=/^\[object .+?Constructor\]$/,Yh=Function.prototype,Jh=Object.prototype,$h=Yh.toString,Zh=Jh.hasOwnProperty,Wh=RegExp("^"+$h.call(Zh).replace(Hh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Qh(t){if(!Uh(t)||Vh(t))return!1;var e=jh(t)?Wh:Xh;return e.test(Kh(t))}qr.exports=Qh});var Fr=B((q_,zr)=>{function tc(t,e){return t?.[e]}zr.exports=tc});var Be=B((N_,jr)=>{var ec=Nr(),ic=Fr();function rc(t,e){var i=ic(t,e);return ec(i)?i:void 0}jr.exports=rc});var ii=B((z_,Vr)=>{var nc=Be(),sc=It(),ac=nc(sc,"Map");Vr.exports=ac});var he=B((F_,Ur)=>{var oc=Be(),lc=oc(Object,"create");Ur.exports=lc});var Xr=B((j_,Hr)=>{var Kr=he();function hc(){this.__data__=Kr?Kr(null):{},this.size=0}Hr.exports=hc});var Jr=B((V_,Yr)=>{function cc(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}Yr.exports=cc});var Zr=B((U_,$r)=>{var uc=he(),pc="__lodash_hash_undefined__",fc=Object.prototype,dc=fc.hasOwnProperty;function gc(t){var e=this.__data__;if(uc){var i=e[t];return i===pc?void 0:i}return dc.call(e,t)?e[t]:void 0}$r.exports=gc});var Qr=B((K_,Wr)=>{var mc=he(),_c=Object.prototype,yc=_c.hasOwnProperty;function Lc(t){var e=this.__data__;return mc?e[t]!==void 0:yc.call(e,t)}Wr.exports=Lc});var en=B((H_,tn)=>{var bc=he(),kc="__lodash_hash_undefined__";function Mc(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=bc&&e===void 0?kc:e,this}tn.exports=Mc});var nn=B((X_,rn)=>{var vc=Xr(),xc=Jr(),wc=Zr(),Cc=Qr(),Ec=en();function Ut(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e{var sn=nn(),Pc=oe(),Sc=ii();function Tc(){this.size=0,this.__data__={hash:new sn,map:new(Sc||Pc),string:new sn}}an.exports=Tc});var hn=B((J_,ln)=>{function Bc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}ln.exports=Bc});var ce=B(($_,cn)=>{var Dc=hn();function Rc(t,e){var i=t.__data__;return Dc(e)?i[typeof e=="string"?"string":"hash"]:i.map}cn.exports=Rc});var pn=B((Z_,un)=>{var Oc=ce();function Ic(t){var e=Oc(this,t).delete(t);return this.size-=e?1:0,e}un.exports=Ic});var dn=B((W_,fn)=>{var Ac=ce();function Gc(t){return Ac(this,t).get(t)}fn.exports=Gc});var mn=B((Q_,gn)=>{var qc=ce();function Nc(t){return qc(this,t).has(t)}gn.exports=Nc});var yn=B((ty,_n)=>{var zc=ce();function Fc(t,e){var i=zc(this,t),r=i.size;return i.set(t,e),this.size+=i.size==r?0:1,this}_n.exports=Fc});var ri=B((ey,Ln)=>{var jc=on(),Vc=pn(),Uc=dn(),Kc=mn(),Hc=yn();function Kt(t){var e=-1,i=t==null?0:t.length;for(this.clear();++e{var Xc=oe(),Yc=ii(),Jc=ri(),$c=200;function Zc(t,e){var i=this.__data__;if(i instanceof Xc){var r=i.__data__;if(!Yc||r.length<$c-1)return r.push([t,e]),this.size=++i.size,this;i=this.__data__=new Jc(r)}return i.set(t,e),this.size=i.size,this}bn.exports=Zc});var vn=B((ry,Mn)=>{var Wc=oe(),Qc=cr(),tu=pr(),eu=dr(),iu=mr(),ru=kn();function Ht(t){var e=this.__data__=new Wc(t);this.size=e.size}Ht.prototype.clear=Qc;Ht.prototype.delete=tu;Ht.prototype.get=eu;Ht.prototype.has=iu;Ht.prototype.set=ru;Mn.exports=Ht});var ni=B((ny,xn)=>{var nu=Be(),su=(function(){try{var t=nu(Object,"defineProperty");return t({},"",{}),t}catch{}})();xn.exports=su});var De=B((sy,Cn)=>{var wn=ni();function au(t,e,i){e=="__proto__"&&wn?wn(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}Cn.exports=au});var si=B((ay,En)=>{var ou=De(),lu=se();function hu(t,e,i){(i!==void 0&&!lu(t[e],i)||i===void 0&&!(e in t))&&ou(t,e,i)}En.exports=hu});var Sn=B((oy,Pn)=>{function cu(t){return function(e,i,r){for(var n=-1,s=Object(e),a=r(e),o=a.length;o--;){var h=a[t?o:++n];if(i(s[h],h,s)===!1)break}return e}}Pn.exports=cu});var Bn=B((ly,Tn)=>{var uu=Sn(),pu=uu();Tn.exports=pu});var An=B((ue,Xt)=>{var fu=It(),In=typeof ue=="object"&&ue&&!ue.nodeType&&ue,Dn=In&&typeof Xt=="object"&&Xt&&!Xt.nodeType&&Xt,du=Dn&&Dn.exports===In,Rn=du?fu.Buffer:void 0,On=Rn?Rn.allocUnsafe:void 0;function gu(t,e){if(e)return t.slice();var i=t.length,r=On?On(i):new t.constructor(i);return t.copy(r),r}Xt.exports=gu});var qn=B((hy,Gn)=>{var mu=It(),_u=mu.Uint8Array;Gn.exports=_u});var Fn=B((cy,zn)=>{var Nn=qn();function yu(t){var e=new t.constructor(t.byteLength);return new Nn(e).set(new Nn(t)),e}zn.exports=yu});var Vn=B((uy,jn)=>{var Lu=Fn();function bu(t,e){var i=e?Lu(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}jn.exports=bu});var Kn=B((py,Un)=>{function ku(t,e){var i=-1,r=t.length;for(e||(e=Array(r));++i{var Mu=Ct(),Hn=Object.create,vu=(function(){function t(){}return function(e){if(!Mu(e))return{};if(Hn)return Hn(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}})();Xn.exports=vu});var $n=B((dy,Jn)=>{function xu(t,e){return function(i){return t(e(i))}}Jn.exports=xu});var ai=B((gy,Zn)=>{var wu=$n(),Cu=wu(Object.getPrototypeOf,Object);Zn.exports=Cu});var oi=B((my,Wn)=>{var Eu=Object.prototype;function Pu(t){var e=t&&t.constructor,i=typeof e=="function"&&e.prototype||Eu;return t===i}Wn.exports=Pu});var ts=B((_y,Qn)=>{var Su=Yn(),Tu=ai(),Bu=oi();function Du(t){return typeof t.constructor=="function"&&!Bu(t)?Su(Tu(t)):{}}Qn.exports=Du});var At=B((yy,es)=>{function Ru(t){return t!=null&&typeof t=="object"}es.exports=Ru});var rs=B((Ly,is)=>{var Ou=Vt(),Iu=At(),Au="[object Arguments]";function Gu(t){return Iu(t)&&Ou(t)==Au}is.exports=Gu});var li=B((by,as)=>{var ns=rs(),qu=At(),ss=Object.prototype,Nu=ss.hasOwnProperty,zu=ss.propertyIsEnumerable,Fu=ns((function(){return arguments})())?ns:function(t){return qu(t)&&Nu.call(t,"callee")&&!zu.call(t,"callee")};as.exports=Fu});var Yt=B((ky,os)=>{var ju=Array.isArray;os.exports=ju});var hi=B((My,ls)=>{var Vu=9007199254740991;function Uu(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Vu}ls.exports=Uu});var Re=B((vy,hs)=>{var Ku=Te(),Hu=hi();function Xu(t){return t!=null&&Hu(t.length)&&!Ku(t)}hs.exports=Xu});var us=B((xy,cs)=>{var Yu=Re(),Ju=At();function $u(t){return Ju(t)&&Yu(t)}cs.exports=$u});var fs=B((wy,ps)=>{function Zu(){return!1}ps.exports=Zu});var ci=B((pe,Jt)=>{var Wu=It(),Qu=fs(),ms=typeof pe=="object"&&pe&&!pe.nodeType&&pe,ds=ms&&typeof Jt=="object"&&Jt&&!Jt.nodeType&&Jt,tp=ds&&ds.exports===ms,gs=tp?Wu.Buffer:void 0,ep=gs?gs.isBuffer:void 0,ip=ep||Qu;Jt.exports=ip});var Ls=B((Cy,ys)=>{var rp=Vt(),np=ai(),sp=At(),ap="[object Object]",op=Function.prototype,lp=Object.prototype,_s=op.toString,hp=lp.hasOwnProperty,cp=_s.call(Object);function up(t){if(!sp(t)||rp(t)!=ap)return!1;var e=np(t);if(e===null)return!0;var i=hp.call(e,"constructor")&&e.constructor;return typeof i=="function"&&i instanceof i&&_s.call(i)==cp}ys.exports=up});var ks=B((Ey,bs)=>{var pp=Vt(),fp=hi(),dp=At(),gp="[object Arguments]",mp="[object Array]",_p="[object Boolean]",yp="[object Date]",Lp="[object Error]",bp="[object Function]",kp="[object Map]",Mp="[object Number]",vp="[object Object]",xp="[object RegExp]",wp="[object Set]",Cp="[object String]",Ep="[object WeakMap]",Pp="[object ArrayBuffer]",Sp="[object DataView]",Tp="[object Float32Array]",Bp="[object Float64Array]",Dp="[object Int8Array]",Rp="[object Int16Array]",Op="[object Int32Array]",Ip="[object Uint8Array]",Ap="[object Uint8ClampedArray]",Gp="[object Uint16Array]",qp="[object Uint32Array]",J={};J[Tp]=J[Bp]=J[Dp]=J[Rp]=J[Op]=J[Ip]=J[Ap]=J[Gp]=J[qp]=!0;J[gp]=J[mp]=J[Pp]=J[_p]=J[Sp]=J[yp]=J[Lp]=J[bp]=J[kp]=J[Mp]=J[vp]=J[xp]=J[wp]=J[Cp]=J[Ep]=!1;function Np(t){return dp(t)&&fp(t.length)&&!!J[pp(t)]}bs.exports=Np});var vs=B((Py,Ms)=>{function zp(t){return function(e){return t(e)}}Ms.exports=zp});var ws=B((fe,$t)=>{var Fp=ti(),xs=typeof fe=="object"&&fe&&!fe.nodeType&&fe,de=xs&&typeof $t=="object"&&$t&&!$t.nodeType&&$t,jp=de&&de.exports===xs,ui=jp&&Fp.process,Vp=(function(){try{var t=de&&de.require&&de.require("util").types;return t||ui&&ui.binding&&ui.binding("util")}catch{}})();$t.exports=Vp});var pi=B((Sy,Ps)=>{var Up=ks(),Kp=vs(),Cs=ws(),Es=Cs&&Cs.isTypedArray,Hp=Es?Kp(Es):Up;Ps.exports=Hp});var fi=B((Ty,Ss)=>{function Xp(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}Ss.exports=Xp});var Bs=B((By,Ts)=>{var Yp=De(),Jp=se(),$p=Object.prototype,Zp=$p.hasOwnProperty;function Wp(t,e,i){var r=t[e];(!(Zp.call(t,e)&&Jp(r,i))||i===void 0&&!(e in t))&&Yp(t,e,i)}Ts.exports=Wp});var Rs=B((Dy,Ds)=>{var Qp=Bs(),tf=De();function ef(t,e,i,r){var n=!i;i||(i={});for(var s=-1,a=e.length;++s{function rf(t,e){for(var i=-1,r=Array(t);++i{var nf=9007199254740991,sf=/^(?:0|[1-9]\d*)$/;function af(t,e){var i=typeof t;return e=e??nf,!!e&&(i=="number"||i!="symbol"&&sf.test(t))&&t>-1&&t%1==0&&t{var of=Is(),lf=li(),hf=Yt(),cf=ci(),uf=di(),pf=pi(),ff=Object.prototype,df=ff.hasOwnProperty;function gf(t,e){var i=hf(t),r=!i&&lf(t),n=!i&&!r&&cf(t),s=!i&&!r&&!n&&pf(t),a=i||r||n||s,o=a?of(t.length,String):[],h=o.length;for(var l in t)(e||df.call(t,l))&&!(a&&(l=="length"||n&&(l=="offset"||l=="parent")||s&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||uf(l,h)))&&o.push(l);return o}Gs.exports=gf});var zs=B((Ay,Ns)=>{function mf(t){var e=[];if(t!=null)for(var i in Object(t))e.push(i);return e}Ns.exports=mf});var js=B((Gy,Fs)=>{var _f=Ct(),yf=oi(),Lf=zs(),bf=Object.prototype,kf=bf.hasOwnProperty;function Mf(t){if(!_f(t))return Lf(t);var e=yf(t),i=[];for(var r in t)r=="constructor"&&(e||!kf.call(t,r))||i.push(r);return i}Fs.exports=Mf});var gi=B((qy,Vs)=>{var vf=qs(),xf=js(),wf=Re();function Cf(t){return wf(t)?vf(t,!0):xf(t)}Vs.exports=Cf});var Ks=B((Ny,Us)=>{var Ef=Rs(),Pf=gi();function Sf(t){return Ef(t,Pf(t))}Us.exports=Sf});var Zs=B((zy,$s)=>{var Hs=si(),Tf=An(),Bf=Vn(),Df=Kn(),Rf=ts(),Xs=li(),Ys=Yt(),Of=us(),If=ci(),Af=Te(),Gf=Ct(),qf=Ls(),Nf=pi(),Js=fi(),zf=Ks();function Ff(t,e,i,r,n,s,a){var o=Js(t,i),h=Js(e,i),l=a.get(h);if(l){Hs(t,i,l);return}var d=s?s(o,h,i+"",t,e,a):void 0,f=d===void 0;if(f){var k=Ys(h),w=!k&&If(h),S=!k&&!w&&Nf(h);d=h,k||w||S?Ys(o)?d=o:Of(o)?d=Df(o):w?(f=!1,d=Tf(h,!0)):S?(f=!1,d=Bf(h,!0)):d=[]:qf(h)||Xs(h)?(d=o,Xs(o)?d=zf(o):(!Gf(o)||Af(o))&&(d=Rf(h))):f=!1}f&&(a.set(h,d),n(d,h,r,s,a),a.delete(h)),Hs(t,i,d)}$s.exports=Ff});var ta=B((Fy,Qs)=>{var jf=vn(),Vf=si(),Uf=Bn(),Kf=Zs(),Hf=Ct(),Xf=gi(),Yf=fi();function Ws(t,e,i,r,n){t!==e&&Uf(e,function(s,a){if(n||(n=new jf),Hf(s))Kf(t,e,a,i,Ws,r,n);else{var o=r?r(Yf(t,a),s,a+"",t,e,n):void 0;o===void 0&&(o=s),Vf(t,a,o)}},Xf)}Qs.exports=Ws});var mi=B((jy,ea)=>{function Jf(t){return t}ea.exports=Jf});var ra=B((Vy,ia)=>{function $f(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}ia.exports=$f});var aa=B((Uy,sa)=>{var Zf=ra(),na=Math.max;function Wf(t,e,i){return e=na(e===void 0?t.length-1:e,0),function(){for(var r=arguments,n=-1,s=na(r.length-e,0),a=Array(s);++n{function Qf(t){return function(){return t}}oa.exports=Qf});var ua=B((Hy,ca)=>{var td=la(),ha=ni(),ed=mi(),id=ha?function(t,e){return ha(t,"toString",{configurable:!0,enumerable:!1,value:td(e),writable:!0})}:ed;ca.exports=id});var fa=B((Xy,pa)=>{var rd=800,nd=16,sd=Date.now;function ad(t){var e=0,i=0;return function(){var r=sd(),n=nd-(r-i);if(i=r,n>0){if(++e>=rd)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}pa.exports=ad});var ga=B((Yy,da)=>{var od=ua(),ld=fa(),hd=ld(od);da.exports=hd});var _a=B((Jy,ma)=>{var cd=mi(),ud=aa(),pd=ga();function fd(t,e){return pd(ud(t,e,cd),t+"")}ma.exports=fd});var La=B(($y,ya)=>{var dd=se(),gd=Re(),md=di(),_d=Ct();function yd(t,e,i){if(!_d(i))return!1;var r=typeof e;return(r=="number"?gd(i)&&md(e,i.length):r=="string"&&e in i)?dd(i[e],t):!1}ya.exports=yd});var ka=B((Zy,ba)=>{var Ld=_a(),bd=La();function kd(t){return Ld(function(e,i){var r=-1,n=i.length,s=n>1?i[n-1]:void 0,a=n>2?i[2]:void 0;for(s=t.length>3&&typeof s=="function"?(n--,s):void 0,a&&bd(i[0],i[1],a)&&(s=n<3?void 0:s,n=1),e=Object(e);++r{var Md=ta(),vd=ka(),xd=vd(function(t,e,i){Md(t,e,i)});Ma.exports=xd});var Ie=B((ab,eo)=>{var sg=Vt(),ag=At(),og="[object Symbol]";function lg(t){return typeof t=="symbol"||ag(t)&&sg(t)==og}eo.exports=lg});var ro=B((ob,io)=>{var hg=Yt(),cg=Ie(),ug=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,pg=/^\w*$/;function fg(t,e){if(hg(t))return!1;var i=typeof t;return i=="number"||i=="symbol"||i=="boolean"||t==null||cg(t)?!0:pg.test(t)||!ug.test(t)||e!=null&&t in Object(e)}io.exports=fg});var ao=B((lb,so)=>{var no=ri(),dg="Expected a function";function yi(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(dg);var i=function(){var r=arguments,n=e?e.apply(this,r):r[0],s=i.cache;if(s.has(n))return s.get(n);var a=t.apply(this,r);return i.cache=s.set(n,a)||s,a};return i.cache=new(yi.Cache||no),i}yi.Cache=no;so.exports=yi});var lo=B((hb,oo)=>{var gg=ao(),mg=500;function _g(t){var e=gg(t,function(r){return i.size===mg&&i.clear(),r}),i=e.cache;return e}oo.exports=_g});var co=B((cb,ho)=>{var yg=lo(),Lg=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bg=/\\(\\)?/g,kg=yg(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Lg,function(i,r,n,s){e.push(n?s.replace(bg,"$1"):r||i)}),e});ho.exports=kg});var po=B((ub,uo)=>{function Mg(t,e){for(var i=-1,r=t==null?0:t.length,n=Array(r);++i{var fo=Se(),vg=po(),xg=Yt(),wg=Ie(),Cg=1/0,go=fo?fo.prototype:void 0,mo=go?go.toString:void 0;function _o(t){if(typeof t=="string")return t;if(xg(t))return vg(t,_o)+"";if(wg(t))return mo?mo.call(t):"";var e=t+"";return e=="0"&&1/t==-Cg?"-0":e}yo.exports=_o});var ko=B((fb,bo)=>{var Eg=Lo();function Pg(t){return t==null?"":Eg(t)}bo.exports=Pg});var vo=B((db,Mo)=>{var Sg=Yt(),Tg=ro(),Bg=co(),Dg=ko();function Rg(t,e){return Sg(t)?t:Tg(t,e)?[t]:Bg(Dg(t))}Mo.exports=Rg});var wo=B((gb,xo)=>{var Og=Ie(),Ig=1/0;function Ag(t){if(typeof t=="string"||Og(t))return t;var e=t+"";return e=="0"&&1/t==-Ig?"-0":e}xo.exports=Ag});var Eo=B((mb,Co)=>{var Gg=vo(),qg=wo();function Ng(t,e){e=Gg(e,t);for(var i=0,r=e.length;t!=null&&i{var zg=Eo();function Fg(t,e,i){var r=t==null?void 0:zg(t,e);return r===void 0?i:r}Po.exports=Fg});var Fo=B((Ei,Pi)=>{(function(t,e){typeof Ei=="object"&&typeof Pi<"u"?Pi.exports=e():typeof define=="function"&&define.amd?define(e):(t=t||self).RBush=e()})(Ei,function(){"use strict";function t(g,M,m,O,R){(function I(G,q,c,u,p){for(;u>c;){if(u-c>600){var y=u-c+1,_=q-c+1,v=Math.log(y),E=.5*Math.exp(2*v/3),b=.5*Math.sqrt(v*E*(y-E)/y)*(_-y/2<0?-1:1),x=Math.max(c,Math.floor(q-_*E/y+b)),P=Math.min(u,Math.floor(q+(y-_)*E/y+b));I(G,q,x,P,p)}var C=G[q],T=c,N=u;for(e(G,c,q),p(G[u],C)>0&&e(G,c,u);T0;)N--}p(G[c],C)===0?e(G,c,N):e(G,++N,u),N<=q&&(c=N+1),q<=N&&(u=N-1)}})(g,M,m||0,O||g.length-1,R||i)}function e(g,M,m){var O=g[M];g[M]=g[m],g[m]=O}function i(g,M){return gM?1:0}var r=function(g){g===void 0&&(g=9),this._maxEntries=Math.max(4,g),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function n(g,M,m){if(!m)return M.indexOf(g);for(var O=0;O=g.minX&&M.maxY>=g.minY}function S(g){return{children:g,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function A(g,M,m,O,R){for(var I=[M,m];I.length;)if(!((m=I.pop())-(M=I.pop())<=O)){var G=M+Math.ceil((m-M)/O/2)*O;t(g,G,M,m,R),I.push(M,G,G,m)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(g){var M=this.data,m=[];if(!w(g,M))return m;for(var O=this.toBBox,R=[];M;){for(var I=0;I=0&&R[M].children.length>this._maxEntries;)this._split(R,M),M--;this._adjustParentBBoxes(O,R,M)},r.prototype._split=function(g,M){var m=g[M],O=m.children.length,R=this._minEntries;this._chooseSplitAxis(m,R,O);var I=this._chooseSplitIndex(m,R,O),G=S(m.children.splice(I,m.children.length-I));G.height=m.height,G.leaf=m.leaf,s(m,this.toBBox),s(G,this.toBBox),M?g[M-1].children.push(G):this._splitRoot(m,G)},r.prototype._splitRoot=function(g,M){this.data=S([g,M]),this.data.height=g.height+1,this.data.leaf=!1,s(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(g,M,m){for(var O,R,I,G,q,c,u,p=1/0,y=1/0,_=M;_<=m-M;_++){var v=a(g,0,_,this.toBBox),E=a(g,_,m,this.toBBox),b=(R=v,I=E,G=void 0,q=void 0,c=void 0,u=void 0,G=Math.max(R.minX,I.minX),q=Math.max(R.minY,I.minY),c=Math.min(R.maxX,I.maxX),u=Math.min(R.maxY,I.maxY),Math.max(0,c-G)*Math.max(0,u-q)),x=d(v)+d(E);b=M;p--){var y=g.children[p];o(G,g.leaf?R(y):y),q+=f(G)}return q},r.prototype._adjustParentBBoxes=function(g,M,m){for(var O=m;O>=0;O--)o(M[O],g)},r.prototype._condense=function(g){for(var M=g.length-1,m=void 0;M>=0;M--)g[M].children.length===0?M>0?(m=g[M-1].children).splice(m.indexOf(g[M]),1):this.clear():s(g[M],this.toBBox)},r})});Array.prototype.findIndex=Array.prototype.findIndex||function(t){if(this===null)throw new TypeError("Array.prototype.findIndex called on null or undefined");if(typeof t!="function")throw new TypeError("callback must be a function");for(var e=Object(this),i=e.length>>>0,r=arguments[1],n=0;n>>0,r=arguments[1],n=0;n>>0;if(r===0)return!1;var n=e|0,s=Math.max(n>=0?n:r-Math.abs(n),0);function a(o,h){return o===h||typeof o=="number"&&typeof h=="number"&&isNaN(o)&&isNaN(h)}for(;s=20.0.0"},packageManager:"pnpm@10.30.3",scripts:{start:"pnpm run dev",dev:"cross-env DEV=true node bundle.mjs",build:"node bundle.mjs",test:"cypress run --browser chrome","test:unit":"vitest run","test:unit:watch":"vitest","test:unit:coverage":"vitest run --coverage","test:all":"pnpm run test:unit && pnpm run test",cypress:"cypress open",prepare:"pnpm run build && husky",lint:"oxlint src demo --fix && oxfmt --write src demo","lint:check":"oxlint src demo && oxfmt --check src demo",typecheck:"tsc --noEmit"},repository:{type:"git",url:"git://github.com/geoman-io/leaflet-geoman.git"},author:{name:"Geoman.io",email:"sales@geoman.io",url:"http://geoman.io"},license:"MIT",bugs:{url:"https://github.com/geoman-io/leaflet-geoman/issues"},homepage:"https://geoman.io","lint-staged":{"*.js":"oxlint --fix","*.{js,css}":"oxfmt --write"}};var Mi=wt(Oe());var va={tooltips:{placeMarker:"Click to place marker",placeMarkerTouch:"Tap the map to place a marker",firstVertex:"Click to place first vertex",continueLine:"Click to continue drawing",finishLine:"Click any existing marker to finish",finishPoly:"Click first marker to finish",finishRect:"Click to finish",startCircle:"Click to place circle center",finishCircle:"Click to finish circle",placeCircleMarker:"Click to place circle marker",placeText:"Click to place text",selectFirstLayerFor:"Select first layer for {action}",selectSecondLayerFor:"Select second layer for {action}"},actions:{finish:"Finish",cancel:"Cancel",removeLastVertex:"Remove Last Vertex"},buttonTitles:{drawMarkerButton:"Draw Marker",drawPolyButton:"Draw Polygons",drawLineButton:"Draw Polyline",drawCircleButton:"Draw Circle",drawRectButton:"Draw Rectangle",editButton:"Edit Layers",dragButton:"Drag Layers",cutButton:"Cut Layers",deleteButton:"Remove Layers",drawCircleMarkerButton:"Draw Circle Marker",snappingButton:"Snap dragged marker to other layers and vertices",pinningButton:"Pin shared vertices together",rotateButton:"Rotate Layers",drawTextButton:"Draw Text",scaleButton:"Scale Layers",autoTracingButton:"Auto trace Line",snapGuidesButton:"Show SnapGuides",unionButton:"Union layers",differenceButton:"Subtract layers"},measurements:{totalLength:"Length",segmentLength:"Segment length",area:"Area",radius:"Radius",perimeter:"Perimeter",height:"Height",width:"Width",coordinates:"Position",coordinatesMarker:"Position Marker"}};var xa={tooltips:{placeMarker:"Platziere den Marker mit Klick",placeMarkerTouch:"Tippe auf die Karte, um einen Marker zu platzieren",firstVertex:"Platziere den ersten Marker mit Klick",continueLine:"Klicke, um weiter zu zeichnen",finishLine:"Beende mit Klick auf existierenden Marker",finishPoly:"Beende mit Klick auf ersten Marker",finishRect:"Beende mit Klick",startCircle:"Platziere das Kreiszentrum mit Klick",finishCircle:"Beende den Kreis mit Klick",placeCircleMarker:"Platziere den Kreismarker mit Klick",placeText:"Platziere den Text mit Klick"},actions:{finish:"Beenden",cancel:"Abbrechen",removeLastVertex:"Letzten Vertex l\xF6schen"},buttonTitles:{drawMarkerButton:"Marker zeichnen",drawPolyButton:"Polygon zeichnen",drawLineButton:"Polyline zeichnen",drawCircleButton:"Kreis zeichnen",drawRectButton:"Rechteck zeichnen",editButton:"Layer editieren",dragButton:"Layer bewegen",cutButton:"Layer schneiden",deleteButton:"Layer l\xF6schen",drawCircleMarkerButton:"Kreismarker zeichnen",snappingButton:"Bewegter Layer an andere Layer oder Vertexe einhacken",pinningButton:"Vertexe an der gleichen Position verkn\xFCpfen",rotateButton:"Layer drehen",drawTextButton:"Text zeichnen",scaleButton:"Layer skalieren",autoTracingButton:"Linie automatisch nachzeichen"},measurements:{totalLength:"L\xE4nge",segmentLength:"Segment L\xE4nge",area:"Fl\xE4che",radius:"Radius",perimeter:"Umfang",height:"H\xF6he",width:"Breite",coordinates:"Position",coordinatesMarker:"Position Marker"}};var wa={tooltips:{placeMarker:"Clicca per posizionare un Marker",placeMarkerTouch:"Tocca la mappa per posizionare un marker",firstVertex:"Clicca per posizionare il primo vertice",continueLine:"Clicca per continuare a disegnare",finishLine:"Clicca qualsiasi marker esistente per terminare",finishPoly:"Clicca il primo marker per terminare",finishRect:"Clicca per terminare",startCircle:"Clicca per posizionare il punto centrale del cerchio",finishCircle:"Clicca per terminare il cerchio",placeCircleMarker:"Clicca per posizionare un Marker del cherchio"},actions:{finish:"Termina",cancel:"Annulla",removeLastVertex:"Rimuovi l'ultimo vertice"},buttonTitles:{drawMarkerButton:"Disegna Marker",drawPolyButton:"Disegna Poligoni",drawLineButton:"Disegna Polilinea",drawCircleButton:"Disegna Cerchio",drawRectButton:"Disegna Rettangolo",editButton:"Modifica Livelli",dragButton:"Sposta Livelli",cutButton:"Ritaglia Livelli",deleteButton:"Elimina Livelli",drawCircleMarkerButton:"Disegna Marker del Cerchio",snappingButton:"Snap ha trascinato il pennarello su altri strati e vertici",pinningButton:"Pin condiviso vertici insieme",rotateButton:"Ruota livello"}};var Ca={tooltips:{placeMarker:"Klik untuk menempatkan marker",placeMarkerTouch:"Ketuk peta untuk menempatkan marker",firstVertex:"Klik untuk menempatkan vertex pertama",continueLine:"Klik untuk meneruskan digitasi",finishLine:"Klik pada sembarang marker yang ada untuk mengakhiri",finishPoly:"Klik marker pertama untuk mengakhiri",finishRect:"Klik untuk mengakhiri",startCircle:"Klik untuk menempatkan titik pusat lingkaran",finishCircle:"Klik untuk mengakhiri lingkaran",placeCircleMarker:"Klik untuk menempatkan penanda lingkarann"},actions:{finish:"Selesai",cancel:"Batal",removeLastVertex:"Hilangkan Vertex Terakhir"},buttonTitles:{drawMarkerButton:"Digitasi Marker",drawPolyButton:"Digitasi Polygon",drawLineButton:"Digitasi Polyline",drawCircleButton:"Digitasi Lingkaran",drawRectButton:"Digitasi Segi Empat",editButton:"Edit Layer",dragButton:"Geser Layer",cutButton:"Potong Layer",deleteButton:"Hilangkan Layer",drawCircleMarkerButton:"Digitasi Penanda Lingkaran",snappingButton:"Jepretkan penanda yang ditarik ke lapisan dan simpul lain",pinningButton:"Sematkan simpul bersama bersama",rotateButton:"Putar lapisan"}};var Ea={tooltips:{placeMarker:"Adaug\u0103 un punct",placeMarkerTouch:"Atinge\u021Bi harta pentru a plasa un punct",firstVertex:"Apas\u0103 aici pentru a ad\u0103uga primul Vertex",continueLine:"Apas\u0103 aici pentru a continua desenul",finishLine:"Apas\u0103 pe orice obiect pentru a finisa desenul",finishPoly:"Apas\u0103 pe primul obiect pentru a finisa",finishRect:"Apas\u0103 pentru a finisa",startCircle:"Apas\u0103 pentru a desena un cerc",finishCircle:"Apas\u0103 pentru a finisa un cerc",placeCircleMarker:"Adaug\u0103 un punct"},actions:{finish:"Termin\u0103",cancel:"Anuleaz\u0103",removeLastVertex:"\u0218terge ultimul Vertex"},buttonTitles:{drawMarkerButton:"Adaug\u0103 o bulin\u0103",drawPolyButton:"Deseneaz\u0103 un poligon",drawLineButton:"Deseneaz\u0103 o linie",drawCircleButton:"Deseneaz\u0103 un cerc",drawRectButton:"Deseneaz\u0103 un dreptunghi",editButton:"Editeaz\u0103 straturile",dragButton:"Mut\u0103 straturile",cutButton:"Taie straturile",deleteButton:"\u0218terge straturile",drawCircleMarkerButton:"Deseneaz\u0103 marcatorul cercului",snappingButton:"Fixa\u021Bi marcatorul glisat pe alte straturi \u0219i v\xE2rfuri",pinningButton:"Fixa\u021Bi v\xE2rfurile partajate \xEEmpreun\u0103",rotateButton:"Roti\u021Bi stratul"}};var Pa={tooltips:{placeMarker:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u043D\u0430\u043D\u0435\u0441\u0442\u0438 \u043C\u0430\u0440\u043A\u0435\u0440",placeMarkerTouch:"\u041A\u043E\u0441\u043D\u0438\u0442\u0435\u0441\u044C \u043A\u0430\u0440\u0442\u044B, \u0447\u0442\u043E\u0431\u044B \u0440\u0430\u0437\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u043C\u0430\u0440\u043A\u0435\u0440",firstVertex:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u043D\u0430\u043D\u0435\u0441\u0442\u0438 \u043F\u0435\u0440\u0432\u044B\u0439 \u043E\u0431\u044A\u0435\u043A\u0442",continueLine:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C \u0440\u0438\u0441\u043E\u0432\u0430\u043D\u0438\u0435",finishLine:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \u043B\u044E\u0431\u043E\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0439 \u043C\u0430\u0440\u043A\u0435\u0440 \u0434\u043B\u044F \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F",finishPoly:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u0435\u0440\u0432\u0443\u044E \u0442\u043E\u0447\u043A\u0443, \u0447\u0442\u043E\u0431\u044B \u0437\u0430\u043A\u043E\u043D\u0447\u0438\u0442\u044C",finishRect:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u0437\u0430\u043A\u043E\u043D\u0447\u0438\u0442\u044C",startCircle:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0446\u0435\u043D\u0442\u0440 \u043A\u0440\u0443\u0433\u0430",finishCircle:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u0437\u0430\u0434\u0430\u0442\u044C \u0440\u0430\u0434\u0438\u0443\u0441",placeCircleMarker:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u043D\u0430\u043D\u0435\u0441\u0442\u0438 \u043A\u0440\u0443\u0433\u043E\u0432\u043E\u0439 \u043C\u0430\u0440\u043A\u0435\u0440"},actions:{finish:"\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044C",cancel:"\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C",removeLastVertex:"\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435"},buttonTitles:{drawMarkerButton:"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043C\u0430\u0440\u043A\u0435\u0440",drawPolyButton:"\u0420\u0438\u0441\u043E\u0432\u0430\u0442\u044C \u043F\u043E\u043B\u0438\u0433\u043E\u043D",drawLineButton:"\u0420\u0438\u0441\u043E\u0432\u0430\u0442\u044C \u043A\u0440\u0438\u0432\u0443\u044E",drawCircleButton:"\u0420\u0438\u0441\u043E\u0432\u0430\u0442\u044C \u043A\u0440\u0443\u0433",drawRectButton:"\u0420\u0438\u0441\u043E\u0432\u0430\u0442\u044C \u043F\u0440\u044F\u043C\u043E\u0443\u0433\u043E\u043B\u044C\u043D\u0438\u043A",editButton:"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u043B\u043E\u0439",dragButton:"\u041F\u0435\u0440\u0435\u043D\u0435\u0441\u0442\u0438 \u0441\u043B\u043E\u0439",cutButton:"\u0412\u044B\u0440\u0435\u0437\u0430\u0442\u044C \u0441\u043B\u043E\u0439",deleteButton:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u043B\u043E\u0439",drawCircleMarkerButton:"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043A\u0440\u0443\u0433\u043E\u0432\u043E\u0439 \u043C\u0430\u0440\u043A\u0435\u0440",snappingButton:"\u041F\u0440\u0438\u0432\u044F\u0437\u0430\u0442\u044C \u043F\u0435\u0440\u0435\u0442\u0430\u0441\u043A\u0438\u0432\u0430\u0435\u043C\u044B\u0439 \u043C\u0430\u0440\u043A\u0435\u0440 \u043A \u0434\u0440\u0443\u0433\u0438\u043C \u0441\u043B\u043E\u044F\u043C \u0438 \u0432\u0435\u0440\u0448\u0438\u043D\u0430\u043C",pinningButton:"\u0421\u0432\u044F\u0437\u0430\u0442\u044C \u043E\u0431\u0449\u0438\u0435 \u0442\u043E\u0447\u043A\u0438 \u0432\u043C\u0435\u0441\u0442\u0435",rotateButton:"\u041F\u043E\u0432\u043E\u0440\u043E\u0442 \u0441\u043B\u043E\u044F"}};var Sa={tooltips:{placeMarker:"Presiona para colocar un marcador",placeMarkerTouch:"Toca el mapa para colocar un marcador",firstVertex:"Presiona para colocar el primer v\xE9rtice",continueLine:"Presiona para continuar dibujando",finishLine:"Presiona cualquier marcador existente para finalizar",finishPoly:"Presiona el primer marcador para finalizar",finishRect:"Presiona para finalizar",startCircle:"Presiona para colocar el centro del c\xEDrculo",finishCircle:"Presiona para finalizar el c\xEDrculo",placeCircleMarker:"Presiona para colocar un marcador de c\xEDrculo"},actions:{finish:"Finalizar",cancel:"Cancelar",removeLastVertex:"Eliminar \xFAltimo v\xE9rtice"},buttonTitles:{drawMarkerButton:"Dibujar Marcador",drawPolyButton:"Dibujar Pol\xEDgono",drawLineButton:"Dibujar L\xEDnea",drawCircleButton:"Dibujar C\xEDrculo",drawRectButton:"Dibujar Rect\xE1ngulo",editButton:"Editar Capas",dragButton:"Arrastrar Capas",cutButton:"Cortar Capas",deleteButton:"Eliminar Capas",drawCircleMarkerButton:"Dibujar Marcador de C\xEDrculo",snappingButton:"El marcador de Snap arrastrado a otras capas y v\xE9rtices",pinningButton:"Fijar juntos los v\xE9rtices compartidos",rotateButton:"Rotar capa"}};var Ta={tooltips:{placeMarker:"Klik om een marker te plaatsen",placeMarkerTouch:"Tik op de kaart om een marker te plaatsen",firstVertex:"Klik om het eerste punt te plaatsen",continueLine:"Klik om te blijven tekenen",finishLine:"Klik op een bestaand punt om te be\xEBindigen",finishPoly:"Klik op het eerst punt om te be\xEBindigen",finishRect:"Klik om te be\xEBindigen",startCircle:"Klik om het middelpunt te plaatsen",finishCircle:"Klik om de cirkel te be\xEBindigen",placeCircleMarker:"Klik om een marker te plaatsen"},actions:{finish:"Bewaar",cancel:"Annuleer",removeLastVertex:"Verwijder laatste punt"},buttonTitles:{drawMarkerButton:"Plaats Marker",drawPolyButton:"Teken een vlak",drawLineButton:"Teken een lijn",drawCircleButton:"Teken een cirkel",drawRectButton:"Teken een vierkant",editButton:"Bewerk",dragButton:"Verplaats",cutButton:"Knip",deleteButton:"Verwijder",drawCircleMarkerButton:"Plaats Marker",snappingButton:"Snap gesleepte marker naar andere lagen en hoekpunten",pinningButton:"Speld gedeelde hoekpunten samen",rotateButton:"Laag roteren"}};var Ba={tooltips:{placeMarker:"Cliquez pour placer un marqueur",placeMarkerTouch:"Appuyez sur la carte pour placer un marqueur",firstVertex:"Cliquez pour placer le premier sommet",continueLine:"Cliquez pour continuer \xE0 dessiner",finishLine:"Cliquez sur n'importe quel marqueur pour terminer",finishPoly:"Cliquez sur le premier marqueur pour terminer",finishRect:"Cliquez pour terminer",startCircle:"Cliquez pour placer le centre du cercle",finishCircle:"Cliquez pour finir le cercle",placeCircleMarker:"Cliquez pour placer le marqueur circulaire"},actions:{finish:"Terminer",cancel:"Annuler",removeLastVertex:"Retirer le dernier sommet"},buttonTitles:{drawMarkerButton:"Placer des marqueurs",drawPolyButton:"Dessiner des polygones",drawLineButton:"Dessiner des polylignes",drawCircleButton:"Dessiner un cercle",drawRectButton:"Dessiner un rectangle",editButton:"\xC9diter des calques",dragButton:"D\xE9placer des calques",cutButton:"Couper des calques",deleteButton:"Supprimer des calques",drawCircleMarkerButton:"Dessiner un marqueur circulaire",snappingButton:"Glisser le marqueur vers d'autres couches et sommets",pinningButton:"\xC9pingler ensemble les sommets partag\xE9s",rotateButton:"Tourner des calques"}};var Da={tooltips:{placeMarker:"\u5355\u51FB\u653E\u7F6E\u6807\u8BB0",placeMarkerTouch:"\u70B9\u51FB\u5730\u56FE\u653E\u7F6E\u6807\u8BB0",firstVertex:"\u5355\u51FB\u653E\u7F6E\u9996\u4E2A\u9876\u70B9",continueLine:"\u5355\u51FB\u7EE7\u7EED\u7ED8\u5236",finishLine:"\u5355\u51FB\u4EFB\u4F55\u5B58\u5728\u7684\u6807\u8BB0\u4EE5\u5B8C\u6210",finishPoly:"\u5355\u51FB\u7B2C\u4E00\u4E2A\u6807\u8BB0\u4EE5\u5B8C\u6210",finishRect:"\u5355\u51FB\u5B8C\u6210",startCircle:"\u5355\u51FB\u653E\u7F6E\u5706\u5FC3",finishCircle:"\u5355\u51FB\u5B8C\u6210\u5706\u5F62",placeCircleMarker:"\u70B9\u51FB\u653E\u7F6E\u5706\u5F62\u6807\u8BB0"},actions:{finish:"\u5B8C\u6210",cancel:"\u53D6\u6D88",removeLastVertex:"\u79FB\u9664\u6700\u540E\u7684\u9876\u70B9"},buttonTitles:{drawMarkerButton:"\u7ED8\u5236\u6807\u8BB0",drawPolyButton:"\u7ED8\u5236\u591A\u8FB9\u5F62",drawLineButton:"\u7ED8\u5236\u7EBF\u6BB5",drawCircleButton:"\u7ED8\u5236\u5706\u5F62",drawRectButton:"\u7ED8\u5236\u957F\u65B9\u5F62",editButton:"\u7F16\u8F91\u56FE\u5C42",dragButton:"\u62D6\u62FD\u56FE\u5C42",cutButton:"\u526A\u5207\u56FE\u5C42",deleteButton:"\u5220\u9664\u56FE\u5C42",drawCircleMarkerButton:"\u753B\u5706\u5708\u6807\u8BB0",snappingButton:"\u5C06\u62D6\u52A8\u7684\u6807\u8BB0\u6355\u6349\u5230\u5176\u4ED6\u56FE\u5C42\u548C\u9876\u70B9",pinningButton:"\u5C06\u5171\u4EAB\u9876\u70B9\u56FA\u5B9A\u5728\u4E00\u8D77",rotateButton:"\u65CB\u8F6C\u56FE\u5C42"}};var Ra={tooltips:{placeMarker:"\u55AE\u64CA\u653E\u7F6E\u6A19\u8A18",placeMarkerTouch:"\u9EDE\u64CA\u5730\u5716\u653E\u7F6E\u6A19\u8A18",firstVertex:"\u55AE\u64CA\u653E\u7F6E\u7B2C\u4E00\u500B\u9802\u9EDE",continueLine:"\u55AE\u64CA\u7E7C\u7E8C\u7E6A\u88FD",finishLine:"\u55AE\u64CA\u4EFB\u4F55\u5B58\u5728\u7684\u6A19\u8A18\u4EE5\u5B8C\u6210",finishPoly:"\u55AE\u64CA\u7B2C\u4E00\u500B\u6A19\u8A18\u4EE5\u5B8C\u6210",finishRect:"\u55AE\u64CA\u5B8C\u6210",startCircle:"\u55AE\u64CA\u653E\u7F6E\u5713\u5FC3",finishCircle:"\u55AE\u64CA\u5B8C\u6210\u5713\u5F62",placeCircleMarker:"\u9EDE\u64CA\u653E\u7F6E\u5713\u5F62\u6A19\u8A18"},actions:{finish:"\u5B8C\u6210",cancel:"\u53D6\u6D88",removeLastVertex:"\u79FB\u9664\u6700\u5F8C\u4E00\u500B\u9802\u9EDE"},buttonTitles:{drawMarkerButton:"\u653E\u7F6E\u6A19\u8A18",drawPolyButton:"\u7E6A\u88FD\u591A\u908A\u5F62",drawLineButton:"\u7E6A\u88FD\u7DDA\u6BB5",drawCircleButton:"\u7E6A\u88FD\u5713\u5F62",drawRectButton:"\u7E6A\u88FD\u65B9\u5F62",editButton:"\u7DE8\u8F2F\u5716\u5F62",dragButton:"\u79FB\u52D5\u5716\u5F62",cutButton:"\u88C1\u5207\u5716\u5F62",deleteButton:"\u522A\u9664\u5716\u5F62",drawCircleMarkerButton:"\u756B\u5713\u5708\u6A19\u8A18",snappingButton:"\u5C07\u62D6\u52D5\u7684\u6A19\u8A18\u5C0D\u9F4A\u5230\u5176\u4ED6\u5716\u5C64\u548C\u9802\u9EDE",pinningButton:"\u5C07\u5171\u4EAB\u9802\u9EDE\u56FA\u5B9A\u5728\u4E00\u8D77",rotateButton:"\u65CB\u8F49\u5716\u5F62"}};var Oa={tooltips:{placeMarker:"Clique para posicionar o marcador",placeMarkerTouch:"Toque no mapa para posicionar um marcador",firstVertex:"Clique para posicionar o primeiro v\xE9rtice",continueLine:"Clique para continuar desenhando",finishLine:"Clique em qualquer marcador existente para finalizar",finishPoly:"Clique no primeiro marcador para finalizar",finishRect:"Clique para finalizar",startCircle:"Clique para posicionar o centro do c\xEDrculo",finishCircle:"Clique para finalizar o c\xEDrculo",placeCircleMarker:"Clique para posicionar o marcador circular",placeText:"Clique para inserir texto"},actions:{finish:"Finalizar",cancel:"Cancelar",removeLastVertex:"Remover \xFAltimo v\xE9rtice"},buttonTitles:{drawMarkerButton:"Desenhar Marcador",drawPolyButton:"Desenhar Pol\xEDgonos",drawLineButton:"Desenhar Linha Poligonal",drawCircleButton:"Desenhar C\xEDrculo",drawRectButton:"Desenhar Ret\xE2ngulo",editButton:"Editar Camadas",dragButton:"Arrastar Camadas",cutButton:"Recortar Camadas",deleteButton:"Remover Camadas",drawCircleMarkerButton:"Desenhar Marcador de C\xEDrculo",snappingButton:"Ajustar marcador arrastado a outras camadas e v\xE9rtices",pinningButton:"Unir v\xE9rtices compartilhados",rotateButton:"Rotacionar Camadas",drawTextButton:"Desenhar Texto",scaleButton:"Redimensionar Camadas",autoTracingButton:"Tra\xE7ado Autom\xE1tico de Linha"},measurements:{totalLength:"Comprimento",segmentLength:"Comprimento do Segmento",area:"\xC1rea",radius:"Raio",perimeter:"Per\xEDmetro",height:"Altura",width:"Largura",coordinates:"Posi\xE7\xE3o",coordinatesMarker:"Marcador de Posi\xE7\xE3o"}};var _i={tooltips:{placeMarker:"Clique para colocar marcador",placeMarkerTouch:"Toque no mapa para colocar um marcador",firstVertex:"Clique para colocar primeiro v\xE9rtice",continueLine:"Clique para continuar a desenhar",finishLine:"Clique num marcador existente para terminar",finishPoly:"Clique no primeiro marcador para terminar",finishRect:"Clique para terminar",startCircle:"Clique para colocar o centro do c\xEDrculo",finishCircle:"Clique para terminar o c\xEDrculo",placeCircleMarker:"Clique para colocar marcador de c\xEDrculo",placeText:"Clique para colocar texto"},actions:{finish:"Terminar",cancel:"Cancelar",removeLastVertex:"Remover \xDAltimo V\xE9rtice"},buttonTitles:{drawMarkerButton:"Desenhar Marcador",drawPolyButton:"Desenhar Pol\xEDgonos",drawLineButton:"Desenhar Polilinha",drawCircleButton:"Desenhar C\xEDrculo",drawRectButton:"Desenhar Ret\xE2ngulo",editButton:"Editar Camadas",dragButton:"Arrastar Camadas",cutButton:"Cortar Camadas",deleteButton:"Remover Camadas",drawCircleMarkerButton:"Desenhar Marcador de C\xEDrculo",snappingButton:"Ajustar marcador arrastado a outras camadas e v\xE9rtices",pinningButton:"Unir v\xE9rtices partilhados",rotateButton:"Rodar Camadas",drawTextButton:"Desenhar Texto",scaleButton:"Escalar Camadas",autoTracingButton:"Tra\xE7ado Autom\xE1tico de Linha"},measurements:{totalLength:"Comprimento",segmentLength:"Comprimento do Segmento",area:"\xC1rea",radius:"Raio",perimeter:"Per\xEDmetro",height:"Altura",width:"Largura",coordinates:"Posi\xE7\xE3o",coordinatesMarker:"Marcador de Posi\xE7\xE3o"}};var Ia={tooltips:{placeMarker:"Kliknij, aby umie\u015Bci\u0107 znacznik",placeMarkerTouch:"Dotknij map\u0119, aby umie\u015Bci\u0107 znacznik",firstVertex:"Kliknij, aby umie\u015Bci\u0107 pierwszy wierzcho\u0142ek",continueLine:"Kliknij, aby kontynuowa\u0107 rysowanie",finishLine:"Kliknij dowolny istniej\u0105cy znacznik, aby zako\u0144czy\u0107",finishPoly:"Kliknij pierwszy znacznik, aby zako\u0144czy\u0107",finishRect:"Kliknij, aby zako\u0144czy\u0107",startCircle:"Kliknij, aby umie\u015Bci\u0107 \u015Brodek okr\u0119gu",finishCircle:"Kliknij, aby zako\u0144czy\u0107 okr\u0105g",placeCircleMarker:"Kliknij, aby umie\u015Bci\u0107 znacznik okr\u0119gu",placeText:"Kliknij, aby umie\u015Bci\u0107 tekst"},actions:{finish:"Zako\u0144cz",cancel:"Anuluj",removeLastVertex:"Usu\u0144 ostatni wierzcho\u0142ek"},buttonTitles:{drawMarkerButton:"Rysuj znacznik",drawPolyButton:"Rysuj wielok\u0105t",drawLineButton:"Rysuj lini\u0119",drawCircleButton:"Rysuj okr\u0105g",drawRectButton:"Rysuj prostok\u0105t",editButton:"Edytuj warstwy",dragButton:"Przeci\u0105gnij warstwy",cutButton:"Wytnij warstwy",deleteButton:"Usu\u0144 warstwy",drawCircleMarkerButton:"Rysuj znacznik okr\u0105g\u0142y",snappingButton:"Przyci\u0105gnij przenoszony znacznik do innych warstw i wierzcho\u0142k\xF3w",pinningButton:"Przypnij wsp\xF3lne wierzcho\u0142ki razem",rotateButton:"Obr\xF3\u0107 warstwy",drawTextButton:"Rysuj tekst",scaleButton:"Skaluj warstwy",autoTracingButton:"Automatyczne \u015Bledzenie linii"},measurements:{totalLength:"D\u0142ugo\u015B\u0107",segmentLength:"D\u0142ugo\u015B\u0107 odcinka",area:"Obszar",radius:"Promie\u0144",perimeter:"Obw\xF3d",height:"Wysoko\u015B\u0107",width:"Szeroko\u015B\u0107",coordinates:"Pozycja",coordinatesMarker:"Znacznik pozycji"}};var Aa={tooltips:{placeMarker:"Klicka f\xF6r att placera mark\xF6r",placeMarkerTouch:"Tryck p\xE5 kartan f\xF6r att placera en mark\xF6r",firstVertex:"Klicka f\xF6r att placera f\xF6rsta h\xF6rnet",continueLine:"Klicka f\xF6r att forts\xE4tta rita",finishLine:"Klicka p\xE5 en existerande punkt f\xF6r att slutf\xF6ra",finishPoly:"Klicka p\xE5 den f\xF6rsta punkten f\xF6r att slutf\xF6ra",finishRect:"Klicka f\xF6r att slutf\xF6ra",startCircle:"Klicka f\xF6r att placera cirkelns centrum",finishCircle:"Klicka f\xF6r att slutf\xF6ra cirkeln",placeCircleMarker:"Klicka f\xF6r att placera cirkelmark\xF6r"},actions:{finish:"Slutf\xF6r",cancel:"Avbryt",removeLastVertex:"Ta bort sista h\xF6rnet"},buttonTitles:{drawMarkerButton:"Rita Mark\xF6r",drawPolyButton:"Rita Polygoner",drawLineButton:"Rita Linje",drawCircleButton:"Rita Cirkel",drawRectButton:"Rita Rektangel",editButton:"Redigera Lager",dragButton:"Dra Lager",cutButton:"Klipp i Lager",deleteButton:"Ta bort Lager",drawCircleMarkerButton:"Rita Cirkelmark\xF6r",snappingButton:"Sn\xE4pp dra mark\xF6ren till andra lager och h\xF6rn",pinningButton:"F\xE4st delade h\xF6rn tillsammans",rotateButton:"Rotera lagret"}};var Ga={tooltips:{placeMarker:"\u039A\u03AC\u03BD\u03C4\u03B5 \u03BA\u03BB\u03B9\u03BA \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03C4\u03BF\u03C0\u03BF\u03B8\u03B5\u03C4\u03AE\u03C3\u03B5\u03C4\u03B5 \u0394\u03B5\u03AF\u03BA\u03C4\u03B7",placeMarkerTouch:"\u03A0\u03B1\u03C4\u03AE\u03C3\u03C4\u03B5 \u03C3\u03C4\u03BF \u03C7\u03AC\u03C1\u03C4\u03B7 \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03C4\u03BF\u03C0\u03BF\u03B8\u03B5\u03C4\u03AE\u03C3\u03B5\u03C4\u03B5 \u03B4\u03B5\u03AF\u03BA\u03C4\u03B7",firstVertex:"\u039A\u03AC\u03BD\u03C4\u03B5 \u03BA\u03BB\u03B9\u03BA \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03C4\u03BF\u03C0\u03BF\u03B8\u03B5\u03C4\u03AE\u03C3\u03B5\u03C4\u03B5 \u03C4\u03BF \u03C0\u03C1\u03CE\u03C4\u03BF \u03C3\u03B7\u03BC\u03B5\u03AF\u03BF",continueLine:"\u039A\u03AC\u03BD\u03C4\u03B5 \u03BA\u03BB\u03B9\u03BA \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03C3\u03C5\u03BD\u03B5\u03C7\u03AF\u03C3\u03B5\u03C4\u03B5 \u03BD\u03B1 \u03C3\u03C7\u03B5\u03B4\u03B9\u03AC\u03B6\u03B5\u03C4\u03B5",finishLine:"\u039A\u03AC\u03BD\u03C4\u03B5 \u03BA\u03BB\u03B9\u03BA \u03C3\u03B5 \u03BF\u03C0\u03BF\u03B9\u03BF\u03BD\u03B4\u03AE\u03C0\u03BF\u03C4\u03B5 \u03C5\u03C0\u03AC\u03C1\u03C7\u03BF\u03BD \u03C3\u03B7\u03BC\u03B5\u03AF\u03BF \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03BF\u03BB\u03BF\u03BA\u03BB\u03B7\u03C1\u03C9\u03B8\u03B5\u03AF",finishPoly:"\u039A\u03AC\u03BD\u03C4\u03B5 \u03BA\u03BB\u03B9\u03BA \u03C3\u03C4\u03BF \u03C0\u03C1\u03CE\u03C4\u03BF \u03C3\u03B7\u03BC\u03B5\u03AF\u03BF \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03C3\u03B5\u03C4\u03B5",finishRect:"\u039A\u03AC\u03BD\u03C4\u03B5 \u03BA\u03BB\u03B9\u03BA \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03C3\u03B5\u03C4\u03B5",startCircle:"\u039A\u03AC\u03BD\u03C4\u03B5 \u03BA\u03BB\u03B9\u03BA \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03C4\u03BF\u03C0\u03BF\u03B8\u03B5\u03C4\u03AE\u03C3\u03B5\u03C4\u03B5 \u03BA\u03AD\u03BD\u03C4\u03C1\u03BF \u039A\u03CD\u03BA\u03BB\u03BF\u03C5",finishCircle:"\u039A\u03AC\u03BD\u03C4\u03B5 \u03BA\u03BB\u03B9\u03BA \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03BF\u03BB\u03BF\u03BA\u03BB\u03B7\u03C1\u03CE\u03C3\u03B5\u03C4\u03B5 \u03C4\u03BF\u03BD \u039A\u03CD\u03BA\u03BB\u03BF",placeCircleMarker:"\u039A\u03AC\u03BD\u03C4\u03B5 \u03BA\u03BB\u03B9\u03BA \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03C4\u03BF\u03C0\u03BF\u03B8\u03B5\u03C4\u03AE\u03C3\u03B5\u03C4\u03B5 \u039A\u03C5\u03BA\u03BB\u03B9\u03BA\u03CC \u0394\u03B5\u03AF\u03BA\u03C4\u03B7"},actions:{finish:"\u03A4\u03AD\u03BB\u03BF\u03C2",cancel:"\u0391\u03BA\u03CD\u03C1\u03C9\u03C3\u03B7",removeLastVertex:"\u039A\u03B1\u03C4\u03AC\u03C1\u03B3\u03B7\u03C3\u03B7 \u03C4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03BF\u03C5 \u03C3\u03B7\u03BC\u03B5\u03AF\u03BF\u03C5"},buttonTitles:{drawMarkerButton:"\u03A3\u03C7\u03B5\u03B4\u03AF\u03B1\u03C3\u03B7 \u0394\u03B5\u03AF\u03BA\u03C4\u03B7",drawPolyButton:"\u03A3\u03C7\u03B5\u03B4\u03AF\u03B1\u03C3\u03B7 \u03A0\u03BF\u03BB\u03C5\u03B3\u03CE\u03BD\u03BF\u03C5",drawLineButton:"\u03A3\u03C7\u03B5\u03B4\u03AF\u03B1\u03C3\u03B7 \u0393\u03C1\u03B1\u03BC\u03BC\u03AE\u03C2",drawCircleButton:"\u03A3\u03C7\u03B5\u03B4\u03AF\u03B1\u03C3\u03B7 \u039A\u03CD\u03BA\u03BB\u03BF\u03C5",drawRectButton:"\u03A3\u03C7\u03B5\u03B4\u03AF\u03B1\u03C3\u03B7 \u039F\u03C1\u03B8\u03BF\u03B3\u03C9\u03BD\u03AF\u03BF\u03C5",editButton:"\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1 \u0395\u03C0\u03B9\u03C0\u03AD\u03B4\u03C9\u03BD",dragButton:"\u039C\u03B5\u03C4\u03B1\u03C6\u03BF\u03C1\u03AC \u0395\u03C0\u03B9\u03C0\u03AD\u03B4\u03C9\u03BD",cutButton:"\u0391\u03C0\u03BF\u03BA\u03BF\u03C0\u03AE \u0395\u03C0\u03B9\u03C0\u03AD\u03B4\u03C9\u03BD",deleteButton:"\u039A\u03B1\u03C4\u03AC\u03C1\u03B3\u03B7\u03C3\u03B7 \u0395\u03C0\u03B9\u03C0\u03AD\u03B4\u03C9\u03BD",drawCircleMarkerButton:"\u03A3\u03C7\u03B5\u03B4\u03AF\u03B1\u03C3\u03B7 \u039A\u03C5\u03BA\u03BB\u03B9\u03BA\u03BF\u03CD \u0394\u03B5\u03AF\u03BA\u03C4\u03B7",snappingButton:"\u03A0\u03C1\u03BF\u03C3\u03BA\u03CC\u03BB\u03BB\u03B7\u03C3\u03B7 \u03C4\u03BF\u03C5 \u0394\u03B5\u03AF\u03BA\u03C4\u03B7 \u03BC\u03B5\u03C4\u03B1\u03C6\u03BF\u03C1\u03AC\u03C2 \u03C3\u03B5 \u03AC\u03BB\u03BB\u03B1 \u0395\u03C0\u03AF\u03C0\u03B5\u03B4\u03B1 \u03BA\u03B1\u03B9 \u039A\u03BF\u03C1\u03C5\u03C6\u03AD\u03C2",pinningButton:"\u03A0\u03B5\u03C1\u03B9\u03BA\u03BF\u03C0\u03AE \u03BA\u03BF\u03B9\u03BD\u03CE\u03BD \u03BA\u03BF\u03C1\u03C5\u03C6\u03CE\u03BD \u03BC\u03B1\u03B6\u03AF",rotateButton:"\u03A0\u03B5\u03C1\u03B9\u03C3\u03C4\u03C1\u03AD\u03C8\u03C4\u03B5 \u03C4\u03BF \u03C3\u03C4\u03C1\u03CE\u03BC\u03B1"}};var qa={tooltips:{placeMarker:"Kattintson a jel\xF6l\u0151 elhelyez\xE9s\xE9hez",placeMarkerTouch:"\xC9rintse meg a t\xE9rk\xE9pet a jel\xF6l\u0151 elhelyez\xE9s\xE9hez",firstVertex:"Kattintson az els\u0151 pont elhelyez\xE9s\xE9hez",continueLine:"Kattintson a k\xF6vetkez\u0151 pont elhelyez\xE9s\xE9hez",finishLine:"A befejez\xE9shez kattintson egy megl\xE9v\u0151 pontra",finishPoly:"A befejez\xE9shez kattintson az els\u0151 pontra",finishRect:"Kattintson a befejez\xE9shez",startCircle:"Kattintson a k\xF6r k\xF6z\xE9ppontj\xE1nak elhelyez\xE9s\xE9hez",finishCircle:"Kattintson a k\xF6r befejez\xE9s\xE9hez",placeCircleMarker:"Kattintson a k\xF6rjel\xF6l\u0151 elhelyez\xE9s\xE9hez"},actions:{finish:"Befejez\xE9s",cancel:"M\xE9gse",removeLastVertex:"Utols\xF3 pont elt\xE1vol\xEDt\xE1sa"},buttonTitles:{drawMarkerButton:"Jel\xF6l\u0151 rajzol\xE1sa",drawPolyButton:"Poligon rajzol\xE1sa",drawLineButton:"Vonal rajzol\xE1sa",drawCircleButton:"K\xF6r rajzol\xE1sa",drawRectButton:"N\xE9gyzet rajzol\xE1sa",editButton:"Elemek szerkeszt\xE9se",dragButton:"Elemek mozgat\xE1sa",cutButton:"Elemek v\xE1g\xE1sa",deleteButton:"Elemek t\xF6rl\xE9se",drawCircleMarkerButton:"K\xF6r jel\xF6l\u0151 rajzol\xE1sa",snappingButton:"Kapcsolja a jel\xF6lt\u0151t m\xE1sik elemhez vagy ponthoz",pinningButton:"K\xF6z\xF6s pontok \xF6sszek\xF6t\xE9se",rotateButton:"F\xF3lia elforgat\xE1sa"}};var Na={tooltips:{placeMarker:"Tryk for at placere en mark\xF8r",placeMarkerTouch:"Tryk p\xE5 kortet for at placere en mark\xF8r",firstVertex:"Tryk for at placere det f\xF8rste punkt",continueLine:"Tryk for at forts\xE6tte linjen",finishLine:"Tryk p\xE5 et eksisterende punkt for at afslutte",finishPoly:"Tryk p\xE5 det f\xF8rste punkt for at afslutte",finishRect:"Tryk for at afslutte",startCircle:"Tryk for at placere cirklens center",finishCircle:"Tryk for at afslutte cirklen",placeCircleMarker:"Tryk for at placere en cirkelmark\xF8r"},actions:{finish:"Afslut",cancel:"Afbryd",removeLastVertex:"Fjern sidste punkt"},buttonTitles:{drawMarkerButton:"Placer mark\xF8r",drawPolyButton:"Tegn polygon",drawLineButton:"Tegn linje",drawCircleButton:"Tegn cirkel",drawRectButton:"Tegn firkant",editButton:"Rediger",dragButton:"Tr\xE6k",cutButton:"Klip",deleteButton:"Fjern",drawCircleMarkerButton:"Tegn cirkelmark\xF8r",snappingButton:"Fastg\xF8r trukket mark\xF8r til andre elementer",pinningButton:"Sammenl\xE6g delte elementer",rotateButton:"Roter laget"}};var za={tooltips:{placeMarker:"Klikk for \xE5 plassere punkt",placeMarkerTouch:"Trykk p\xE5 kartet for \xE5 plassere et punkt",firstVertex:"Klikk for \xE5 plassere f\xF8rste punkt",continueLine:"Klikk for \xE5 tegne videre",finishLine:"Klikk p\xE5 et eksisterende punkt for \xE5 fullf\xF8re",finishPoly:"Klikk f\xF8rste punkt for \xE5 fullf\xF8re",finishRect:"Klikk for \xE5 fullf\xF8re",startCircle:"Klikk for \xE5 sette sirkel midtpunkt",finishCircle:"Klikk for \xE5 fullf\xF8re sirkel",placeCircleMarker:"Klikk for \xE5 plassere sirkel",placeText:"Klikk for \xE5 plassere tekst"},actions:{finish:"Fullf\xF8r",cancel:"Kanseller",removeLastVertex:"Fjern forrige punkt"},buttonTitles:{drawMarkerButton:"Tegn punkt",drawPolyButton:"Tegn flate",drawLineButton:"Tegn linje",drawCircleButton:"Tegn sirkel",drawRectButton:"Tegn rektangel",editButton:"Rediger objekter",dragButton:"Dra objekter",cutButton:"Kutt objekter",deleteButton:"Fjern objekter",drawCircleMarkerButton:"Tegn sirkel-punkt",snappingButton:"Fest dratt punkt til andre objekter og punkt",pinningButton:"Pin delte punkter sammen",rotateButton:"Rot\xE9r objekter",drawTextButton:"Tegn tekst",scaleButton:"Skal\xE9r objekter",autoTracingButton:"Automatisk sporing av linje"},measurements:{totalLength:"Lengde",segmentLength:"Segmentlengde",area:"Omr\xE5de",radius:"Radius",perimeter:"Omriss",height:"H\xF8yde",width:"Bredde",coordinates:"Posisjon",coordinatesMarker:"Posisjonsmark\xF8r"}};var Fa={tooltips:{placeMarker:"\u06A9\u0644\u06CC\u06A9 \u0628\u0631\u0627\u06CC \u062C\u0627\u0646\u0645\u0627\u06CC\u06CC \u0646\u0634\u0627\u0646",placeMarkerTouch:"\u0631\u0648\u06CC \u0646\u0642\u0634\u0647 \u0636\u0631\u0628\u0647 \u0628\u0632\u0646\u06CC\u062F \u062A\u0627 \u0646\u0634\u0627\u0646 \u0628\u06AF\u0630\u0627\u0631\u06CC\u062F",firstVertex:"\u06A9\u0644\u06CC\u06A9 \u0628\u0631\u0627\u06CC \u0631\u0633\u0645 \u0627\u0648\u0644\u06CC\u0646 \u0631\u0623\u0633",continueLine:"\u06A9\u0644\u06CC\u06A9 \u0628\u0631\u0627\u06CC \u0627\u062F\u0627\u0645\u0647 \u0631\u0633\u0645",finishLine:"\u06A9\u0644\u06CC\u06A9 \u0631\u0648\u06CC \u0647\u0631 \u0646\u0634\u0627\u0646 \u0645\u0648\u062C\u0648\u062F \u0628\u0631\u0627\u06CC \u067E\u0627\u06CC\u0627\u0646",finishPoly:"\u06A9\u0644\u06CC\u06A9 \u0631\u0648\u06CC \u0627\u0648\u0644\u06CC\u0646 \u0646\u0634\u0627\u0646 \u0628\u0631\u0627\u06CC \u067E\u0627\u06CC\u0627\u0646",finishRect:"\u06A9\u0644\u06CC\u06A9 \u0628\u0631\u0627\u06CC \u067E\u0627\u06CC\u0627\u0646",startCircle:"\u06A9\u0644\u06CC\u06A9 \u0628\u0631\u0627\u06CC \u0631\u0633\u0645 \u0645\u0631\u06A9\u0632 \u062F\u0627\u06CC\u0631\u0647",finishCircle:"\u06A9\u0644\u06CC\u06A9 \u0628\u0631\u0627\u06CC \u067E\u0627\u06CC\u0627\u0646 \u0631\u0633\u0645 \u062F\u0627\u06CC\u0631\u0647",placeCircleMarker:"\u06A9\u0644\u06CC\u06A9 \u0628\u0631\u0627\u06CC \u0631\u0633\u0645 \u0646\u0634\u0627\u0646 \u062F\u0627\u06CC\u0631\u0647",placeText:"\u06A9\u0644\u06CC\u06A9 \u0628\u0631\u0627\u06CC \u0646\u0648\u0634\u062A\u0646 \u0645\u062A\u0646"},actions:{finish:"\u067E\u0627\u06CC\u0627\u0646",cancel:"\u0644\u0641\u0648",removeLastVertex:"\u062D\u0630\u0641 \u0622\u062E\u0631\u06CC\u0646 \u0631\u0623\u0633"},buttonTitles:{drawMarkerButton:"\u062F\u0631\u062C \u0646\u0634\u0627\u0646",drawPolyButton:"\u0631\u0633\u0645 \u0686\u0646\u062F\u0636\u0644\u0639\u06CC",drawLineButton:"\u0631\u0633\u0645 \u062E\u0637",drawCircleButton:"\u0631\u0633\u0645 \u062F\u0627\u06CC\u0631\u0647",drawRectButton:"\u0631\u0633\u0645 \u0686\u0647\u0627\u0631\u0636\u0644\u0639\u06CC",editButton:"\u0648\u06CC\u0631\u0627\u06CC\u0634 \u0644\u0627\u06CC\u0647\u200C\u0647\u0627",dragButton:"\u062C\u0627\u0628\u062C\u0627\u06CC\u06CC \u0644\u0627\u06CC\u0647\u200C\u0647\u0627",cutButton:"\u0628\u0631\u0634 \u0644\u0627\u06CC\u0647\u200C\u0647\u0627",deleteButton:"\u062D\u0630\u0641 \u0644\u0627\u06CC\u0647\u200C\u0647\u0627",drawCircleMarkerButton:"\u0631\u0633\u0645 \u0646\u0634\u0627\u0646 \u062F\u0627\u06CC\u0631\u0647",snappingButton:"\u0646\u0634\u0627\u0646\u06AF\u0631 \u0631\u0627 \u0628\u0647 \u0644\u0627\u06CC\u0647\u200C\u0647\u0627 \u0648 \u0631\u0626\u0648\u0633 \u062F\u06CC\u06AF\u0631 \u0628\u06A9\u0634\u06CC\u062F",pinningButton:"\u0631\u0626\u0648\u0633 \u0645\u0634\u062A\u0631\u06A9 \u0631\u0627 \u0628\u0627 \u0647\u0645 \u067E\u06CC\u0646 \u06A9\u0646\u06CC\u062F",rotateButton:"\u0686\u0631\u062E\u0634 \u0644\u0627\u06CC\u0647",drawTextButton:"\u0631\u0633\u0645 \u0645\u062A\u0646",scaleButton:"\u0645\u0642\u06CC\u0627\u0633\u200C\u06AF\u0630\u0627\u0631\u06CC",autoTracingButton:"\u0631\u062F\u06CC\u0627\u0628 \u062E\u0648\u062F\u06A9\u0627\u0631"},measurements:{totalLength:"\u0637\u0648\u0644",segmentLength:"\u0637\u0648\u0644 \u0628\u062E\u0634",area:"\u0646\u0627\u062D\u06CC\u0647",radius:"\u0634\u0639\u0627\u0639",perimeter:"\u0645\u062D\u06CC\u0637",height:"\u0627\u0631\u062A\u0641\u0627\u0639",width:"\u0639\u0631\u0636",coordinates:"\u0645\u0648\u0642\u0639\u06CC\u062A",coordinatesMarker:"\u0645\u0648\u0642\u0639\u06CC\u062A \u0646\u0634\u0627\u0646"}};var ja={tooltips:{placeMarker:"\u041D\u0430\u0442\u0438\u0441\u043D\u0456\u0442\u044C, \u0449\u043E\u0431 \u043D\u0430\u043D\u0435\u0441\u0442\u0438 \u043C\u0430\u0440\u043A\u0435\u0440",placeMarkerTouch:"\u0422\u043E\u0440\u043A\u043D\u0456\u0442\u044C\u0441\u044F \u043A\u0430\u0440\u0442\u0438, \u0449\u043E\u0431 \u0440\u043E\u0437\u043C\u0456\u0441\u0442\u0438\u0442\u0438 \u043C\u0430\u0440\u043A\u0435\u0440",firstVertex:"\u041D\u0430\u0442\u0438\u0441\u043D\u0456\u0442\u044C, \u0449\u043E\u0431 \u043D\u0430\u043D\u0435\u0441\u0442\u0438 \u043F\u0435\u0440\u0448\u0443 \u0432\u0435\u0440\u0448\u0438\u043D\u0443",continueLine:"\u041D\u0430\u0442\u0438\u0441\u043D\u0456\u0442\u044C, \u0449\u043E\u0431 \u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0438\u0442\u0438 \u043C\u0430\u043B\u044E\u0432\u0430\u0442\u0438",finishLine:"\u041D\u0430\u0442\u0438\u0441\u043D\u0456\u0442\u044C \u0431\u0443\u0434\u044C-\u044F\u043A\u0438\u0439 \u0456\u0441\u043D\u0443\u044E\u0447\u0438\u0439 \u043C\u0430\u0440\u043A\u0435\u0440 \u0434\u043B\u044F \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043D\u044F",finishPoly:"\u0412\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u043F\u0435\u0440\u0448\u0438\u0439 \u043C\u0430\u0440\u043A\u0435\u0440, \u0449\u043E\u0431 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0438",finishRect:"\u041D\u0430\u0442\u0438\u0441\u043D\u0456\u0442\u044C, \u0449\u043E\u0431 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0438",startCircle:"\u041D\u0430\u0442\u0438\u0441\u043D\u0456\u0442\u044C, \u0449\u043E\u0431 \u0434\u043E\u0434\u0430\u0442\u0438 \u0446\u0435\u043D\u0442\u0440 \u043A\u043E\u043B\u0430",finishCircle:"\u041D\u0430\u0442\u0438\u0441\u043D\u0456\u0442\u044C, \u0449\u043E\u0431 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0438 \u043A\u043E\u043B\u043E",placeCircleMarker:"\u041D\u0430\u0442\u0438\u0441\u043D\u0456\u0442\u044C, \u0449\u043E\u0431 \u043D\u0430\u043D\u0435\u0441\u0442\u0438 \u043A\u0440\u0443\u0433\u043E\u0432\u0438\u0439 \u043C\u0430\u0440\u043A\u0435\u0440"},actions:{finish:"\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0438",cancel:"\u0412\u0456\u0434\u043C\u0456\u043D\u0438\u0442\u0438",removeLastVertex:"\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u044E \u0432\u0435\u0440\u0448\u0438\u043D\u0443"},buttonTitles:{drawMarkerButton:"\u041C\u0430\u043B\u044E\u0432\u0430\u0442\u0438 \u043C\u0430\u0440\u043A\u0435\u0440",drawPolyButton:"\u041C\u0430\u043B\u044E\u0432\u0430\u0442\u0438 \u043F\u043E\u043B\u0456\u0433\u043E\u043D",drawLineButton:"\u041C\u0430\u043B\u044E\u0432\u0430\u0442\u0438 \u043A\u0440\u0438\u0432\u0443",drawCircleButton:"\u041C\u0430\u043B\u044E\u0432\u0430\u0442\u0438 \u043A\u043E\u043B\u043E",drawRectButton:"\u041C\u0430\u043B\u044E\u0432\u0430\u0442\u0438 \u043F\u0440\u044F\u043C\u043E\u043A\u0443\u0442\u043D\u0438\u043A",editButton:"\u0420\u0435\u0434\u0430\u0433\u0443\u0432\u0430\u0442\u0438 \u0448\u0430\u0440\u0438",dragButton:"\u041F\u0435\u0440\u0435\u043D\u0435\u0441\u0442\u0438 \u0448\u0430\u0440\u0438",cutButton:"\u0412\u0438\u0440\u0456\u0437\u0430\u0442\u0438 \u0448\u0430\u0440\u0438",deleteButton:"\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0448\u0430\u0440\u0438",drawCircleMarkerButton:"\u041C\u0430\u043B\u044E\u0432\u0430\u0442\u0438 \u043A\u0440\u0443\u0433\u043E\u0432\u0438\u0439 \u043C\u0430\u0440\u043A\u0435\u0440",snappingButton:"\u041F\u0440\u0438\u0432\u2019\u044F\u0437\u0430\u0442\u0438 \u043F\u0435\u0440\u0435\u0442\u044F\u0433\u043D\u0443\u0442\u0438\u0439 \u043C\u0430\u0440\u043A\u0435\u0440 \u0434\u043E \u0456\u043D\u0448\u0438\u0445 \u0448\u0430\u0440\u0456\u0432 \u0442\u0430 \u0432\u0435\u0440\u0448\u0438\u043D",pinningButton:"\u0417\u0432'\u044F\u0437\u0430\u0442\u0438 \u0441\u043F\u0456\u043B\u044C\u043D\u0456 \u0432\u0435\u0440\u0448\u0438\u043D\u0438 \u0440\u0430\u0437\u043E\u043C",rotateButton:"\u041F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u0438 \u0448\u0430\u0440"}};var Va={tooltips:{placeMarker:"\u0130\u015Faret\xE7i yerle\u015Ftirmek i\xE7in t\u0131klay\u0131n",placeMarkerTouch:"\u0130\u015Faret\xE7i yerle\u015Ftirmek i\xE7in haritaya dokunun",firstVertex:"\u0130lk tepe noktas\u0131n\u0131 yerle\u015Ftirmek i\xE7in t\u0131klay\u0131n",continueLine:"\xC7izime devam etmek i\xE7in t\u0131klay\u0131n",finishLine:"Bitirmek i\xE7in mevcut herhangi bir i\u015Faret\xE7iyi t\u0131klay\u0131n",finishPoly:"Bitirmek i\xE7in ilk i\u015Faret\xE7iyi t\u0131klay\u0131n",finishRect:"Bitirmek i\xE7in t\u0131klay\u0131n",startCircle:"Daire merkezine yerle\u015Ftirmek i\xE7in t\u0131klay\u0131n",finishCircle:"Daireyi bitirmek i\xE7in t\u0131klay\u0131n",placeCircleMarker:"Daire i\u015Faret\xE7isi yerle\u015Ftirmek i\xE7in t\u0131klay\u0131n"},actions:{finish:"Bitir",cancel:"\u0130ptal",removeLastVertex:"Son k\xF6\u015Feyi kald\u0131r"},buttonTitles:{drawMarkerButton:"\xC7izim \u0130\u015Faret\xE7isi",drawPolyButton:"\xC7okgenler \xE7iz",drawLineButton:"\xC7oklu \xE7izgi \xE7iz",drawCircleButton:"\xC7ember \xE7iz",drawRectButton:"Dikd\xF6rtgen \xE7iz",editButton:"Katmanlar\u0131 d\xFCzenle",dragButton:"Katmanlar\u0131 s\xFCr\xFCkle",cutButton:"Katmanlar\u0131 kes",deleteButton:"Katmanlar\u0131 kald\u0131r",drawCircleMarkerButton:"Daire i\u015Faret\xE7isi \xE7iz",snappingButton:"S\xFCr\xFCklenen i\u015Faret\xE7iyi di\u011Fer katmanlara ve k\xF6\u015Felere yap\u0131\u015Ft\u0131r",pinningButton:"Payla\u015F\u0131lan k\xF6\u015Feleri birbirine sabitle",rotateButton:"Katman\u0131 d\xF6nd\xFCr"}};var Ua={tooltips:{placeMarker:"Kliknut\xEDm vytvo\u0159\xEDte zna\u010Dku",placeMarkerTouch:"Klepnut\xEDm na mapu um\xEDst\xEDte zna\u010Dku",firstVertex:"Kliknut\xEDm vytvo\u0159\xEDte prvn\xED objekt",continueLine:"Kliknut\xEDm pokra\u010Dujte v kreslen\xED",finishLine:"Kliknut\xED na libovolnou existuj\xEDc\xED zna\u010Dku pro dokon\u010Den\xED",finishPoly:"Vyberte prvn\xED bod pro dokon\u010Den\xED",finishRect:"Klikn\u011Bte pro dokon\u010Den\xED",startCircle:"Kliknut\xEDm p\u0159idejte st\u0159ed kruhu",finishCircle:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u0437\u0430\u0434\u0430\u0442\u044C \u0440\u0430\u0434\u0438\u0443\u0441",placeCircleMarker:"Kliknut\xEDm nastavte polom\u011Br"},actions:{finish:"Dokon\u010Dit",cancel:"Zru\u0161it",removeLastVertex:"Zru\u0161it posledn\xED akci"},buttonTitles:{drawMarkerButton:"P\u0159idat zna\u010Dku",drawPolyButton:"Nakreslit polygon",drawLineButton:"Nakreslit k\u0159ivku",drawCircleButton:"Nakreslit kruh",drawRectButton:"Nakreslit obd\xE9ln\xEDk",editButton:"Upravit vrstvu",dragButton:"P\u0159eneste vrstvu",cutButton:"Vyjmout vrstvu",deleteButton:"Smazat vrstvu",drawCircleMarkerButton:"P\u0159idat kruhovou zna\u010Dku",snappingButton:"Nav\xE1zat ta\u017Enou zna\u010Dku k dal\u0161\xEDm vrstv\xE1m a vrchol\u016Fm",pinningButton:"Spojit spole\u010Dn\xE9 body dohromady",rotateButton:"Oto\u010Dte vrstvu"}};var Ka={tooltips:{placeMarker:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30DE\u30FC\u30AB\u30FC\u3092\u914D\u7F6E",placeMarkerTouch:"\u5730\u56F3\u3092\u30BF\u30C3\u30D7\u3057\u3066\u30DE\u30FC\u30AB\u30FC\u3092\u914D\u7F6E",firstVertex:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u6700\u521D\u306E\u9802\u70B9\u3092\u914D\u7F6E",continueLine:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u63CF\u753B\u3092\u7D9A\u3051\u308B",finishLine:"\u4EFB\u610F\u306E\u30DE\u30FC\u30AB\u30FC\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u7D42\u4E86",finishPoly:"\u6700\u521D\u306E\u30DE\u30FC\u30AB\u30FC\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u7D42\u4E86",finishRect:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u7D42\u4E86",startCircle:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u5186\u306E\u4E2D\u5FC3\u3092\u914D\u7F6E",finishCircle:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u5186\u306E\u63CF\u753B\u3092\u7D42\u4E86",placeCircleMarker:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u5186\u30DE\u30FC\u30AB\u30FC\u3092\u914D\u7F6E",placeText:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30C6\u30AD\u30B9\u30C8\u3092\u914D\u7F6E"},actions:{finish:"\u7D42\u4E86",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",removeLastVertex:"\u6700\u5F8C\u306E\u9802\u70B9\u3092\u524A\u9664"},buttonTitles:{drawMarkerButton:"\u30DE\u30FC\u30AB\u30FC\u3092\u63CF\u753B",drawPolyButton:"\u30DD\u30EA\u30B4\u30F3\u3092\u63CF\u753B",drawLineButton:"\u6298\u308C\u7DDA\u3092\u63CF\u753B",drawCircleButton:"\u5186\u3092\u63CF\u753B",drawRectButton:"\u77E9\u5F62\u3092\u63CF\u753B",editButton:"\u30EC\u30A4\u30E4\u30FC\u3092\u7DE8\u96C6",dragButton:"\u30EC\u30A4\u30E4\u30FC\u3092\u30C9\u30E9\u30C3\u30B0",cutButton:"\u30EC\u30A4\u30E4\u30FC\u3092\u5207\u308A\u53D6\u308A",deleteButton:"\u30EC\u30A4\u30E4\u30FC\u3092\u524A\u9664",drawCircleMarkerButton:"\u5186\u30DE\u30FC\u30AB\u30FC\u3092\u63CF\u753B",snappingButton:"\u30C9\u30E9\u30C3\u30B0\u3057\u305F\u30DE\u30FC\u30AB\u30FC\u3092\u4ED6\u306E\u30EC\u30A4\u30E4\u30FC\u3084\u9802\u70B9\u306B\u30B9\u30CA\u30C3\u30D7\u3059\u308B",pinningButton:"\u5171\u6709\u3059\u308B\u9802\u70B9\u3092\u540C\u6642\u306B\u52D5\u304B\u3059",rotateButton:"\u30EC\u30A4\u30E4\u30FC\u3092\u56DE\u8EE2",drawTextButton:"\u30C6\u30AD\u30B9\u30C8\u3092\u63CF\u753B"}};var Ha={tooltips:{placeMarker:"Klikkaa asettaaksesi merkin",placeMarkerTouch:"Napauta karttaa asettaaksesi merkin",firstVertex:"Klikkaa asettaakseni ensimm\xE4isen osuuden",continueLine:"Klikkaa jatkaaksesi piirt\xE4mist\xE4",finishLine:"Klikkaa olemassa olevaa merkki\xE4 lopettaaksesi",finishPoly:"Klikkaa ensimm\xE4ist\xE4 merkki\xE4 lopettaaksesi",finishRect:"Klikkaa lopettaaksesi",startCircle:"Klikkaa asettaaksesi ympyr\xE4n keskipisteen",finishCircle:"Klikkaa lopettaaksesi ympyr\xE4n",placeCircleMarker:"Klikkaa asettaaksesi ympyr\xE4merkin",placeText:"Klikkaa asettaaksesi tekstin"},actions:{finish:"Valmis",cancel:"Peruuta",removeLastVertex:"Poista viimeinen osuus"},buttonTitles:{drawMarkerButton:"Piirr\xE4 merkkej\xE4",drawPolyButton:"Piirr\xE4 monikulmioita",drawLineButton:"Piirr\xE4 viivoja",drawCircleButton:"Piirr\xE4 ympyr\xE4",drawRectButton:"Piirr\xE4 neliskulmioita",editButton:"Muokkaa",dragButton:"Siirr\xE4",cutButton:"Leikkaa",deleteButton:"Poista",drawCircleMarkerButton:"Piirr\xE4 ympyr\xE4merkki",snappingButton:"Kiinnit\xE4 siirrett\xE4v\xE4 merkki toisiin muotoihin",pinningButton:"Kiinnit\xE4 jaetut muodot yhteen",rotateButton:"K\xE4\xE4nn\xE4",drawTextButton:"Piirr\xE4 teksti\xE4"}};var Xa={tooltips:{placeMarker:"\uB9C8\uCEE4 \uC704\uCE58\uB97C \uD074\uB9AD\uD558\uC138\uC694",placeMarkerTouch:"\uC9C0\uB3C4\uB97C \uD0ED\uD558\uC5EC \uB9C8\uCEE4\uB97C \uBC30\uCE58\uD558\uC138\uC694",firstVertex:"\uCCAB\uBC88\uC9F8 \uAF2D\uC9C0\uC810 \uC704\uCE58\uC744 \uD074\uB9AD\uD558\uC138\uC694",continueLine:"\uACC4\uC18D \uADF8\uB9AC\uB824\uBA74 \uD074\uB9AD\uD558\uC138\uC694",finishLine:"\uB05D\uB0B4\uB824\uBA74 \uAE30\uC874 \uB9C8\uCEE4\uB97C \uD074\uB9AD\uD558\uC138\uC694",finishPoly:"\uB05D\uB0B4\uB824\uBA74 \uCC98\uC74C \uB9C8\uCEE4\uB97C \uD074\uB9AD\uD558\uC138\uC694",finishRect:"\uB05D\uB0B4\uB824\uBA74 \uD074\uB9AD\uD558\uC138\uC694",startCircle:"\uC6D0\uC758 \uC911\uC2EC\uC774 \uB420 \uC704\uCE58\uB97C \uD074\uB9AD\uD558\uC138\uC694",finishCircle:"\uC6D0\uC744 \uB05D\uB0B4\uB824\uBA74 \uD074\uB9AD\uD558\uC138\uC694",placeCircleMarker:"\uC6D0 \uB9C8\uCEE4 \uC704\uCE58\uB97C \uD074\uB9AD\uD558\uC138\uC694",placeText:"\uD14D\uC2A4\uD2B8 \uC704\uCE58\uB97C \uD074\uB9AD\uD558\uC138\uC694"},actions:{finish:"\uB05D\uB0B4\uAE30",cancel:"\uCDE8\uC18C",removeLastVertex:"\uB9C8\uC9C0\uB9C9 \uAF2D\uC9C0\uC810 \uC81C\uAC70"},buttonTitles:{drawMarkerButton:"\uB9C8\uCEE4 \uADF8\uB9AC\uAE30",drawPolyButton:"\uB2E4\uAC01\uD615 \uADF8\uB9AC\uAE30",drawLineButton:"\uB2E4\uAC01\uC120 \uADF8\uB9AC\uAE30",drawCircleButton:"\uC6D0 \uADF8\uB9AC\uAE30",drawRectButton:"\uC9C1\uC0AC\uAC01\uD615 \uADF8\uB9AC\uAE30",editButton:"\uB808\uC774\uC5B4 \uD3B8\uC9D1\uD558\uAE30",dragButton:"\uB808\uC774\uC5B4 \uB04C\uAE30",cutButton:"\uB808\uC774\uC5B4 \uC790\uB974\uAE30",deleteButton:"\uB808\uC774\uC5B4 \uC81C\uAC70\uD558\uAE30",drawCircleMarkerButton:"\uC6D0 \uB9C8\uCEE4 \uADF8\uB9AC\uAE30",snappingButton:"\uC7A1\uC544\uB048 \uB9C8\uCEE4\uB97C \uB2E4\uB978 \uB808\uC774\uC5B4 \uBC0F \uAF2D\uC9C0\uC810\uC5D0 \uB4E4\uB7EC\uBD99\uAC8C \uD558\uAE30",pinningButton:"\uACF5\uC720 \uAF2D\uC9C0\uC810\uC744 \uD568\uAED8 \uCC0D\uAE30",rotateButton:"\uB808\uC774\uC5B4 \uD68C\uC804\uD558\uAE30",drawTextButton:"\uD14D\uC2A4\uD2B8 \uADF8\uB9AC\uAE30"}};var Ya={tooltips:{placeMarker:"\u041C\u0430\u0440\u043A\u0435\u0440\u0434\u0438 \u0436\u0430\u0439\u0433\u0430\u0448\u0442\u044B\u0440\u0443\u0443 \u04AF\u0447\u04AF\u043D \u0431\u0430\u0441\u044B\u04A3\u044B\u0437",placeMarkerTouch:"\u041C\u0430\u0440\u043A\u0435\u0440\u0434\u0438 \u0436\u0430\u0439\u0433\u0430\u0448\u0442\u044B\u0440\u0443\u0443 \u04AF\u0447\u04AF\u043D \u043A\u0430\u0440\u0442\u0430\u0433\u0430 \u0442\u0438\u0439\u0438\u04A3\u0438\u0437",firstVertex:"\u0411\u0438\u0440\u0438\u043D\u0447\u0438 \u0447\u043E\u043A\u0443\u043D\u0443 \u0436\u0430\u0439\u0433\u0430\u0448\u0442\u044B\u0440\u0443\u0443\u043D\u0443 \u04AF\u0447\u04AF\u043D \u0431\u0430\u0441\u044B\u04A3\u044B\u0437",continueLine:"\u0421\u04AF\u0440\u04E9\u0442 \u0442\u0430\u0440\u0442\u0443\u0443\u043D\u0443 \u0443\u043B\u0430\u043D\u0442\u0443\u0443 \u04AF\u0447\u04AF\u043D \u0431\u0430\u0441\u044B\u04A3\u044B\u0437",finishLine:"\u0410\u044F\u043A\u0442\u043E\u043E \u04AF\u0447\u04AF\u043D \u0443\u0447\u0443\u0440\u0434\u0430\u0433\u044B \u043C\u0430\u0440\u043A\u0435\u0440\u0434\u0438 \u0431\u0430\u0441\u044B\u04A3\u044B\u0437",finishPoly:"\u0411\u04AF\u0442\u04AF\u0440\u04AF\u04AF \u04AF\u0447\u04AF\u043D \u0431\u0438\u0440\u0438\u043D\u0447\u0438 \u043C\u0430\u0440\u043A\u0435\u0440\u0434\u0438 \u0431\u0430\u0441\u044B\u04A3\u044B\u0437",finishRect:"\u0411\u04AF\u0442\u04AF\u0440\u04AF\u04AF \u04AF\u0447\u04AF\u043D \u0431\u0430\u0441\u044B\u04A3\u044B\u0437",startCircle:"\u0410\u0439\u043B\u0430\u043D\u0430\u043D\u044B\u043D \u0431\u043E\u0440\u0431\u043E\u0440\u0443\u043D \u0436\u0430\u0439\u0433\u0430\u0448\u0442\u044B\u0440\u0443\u0443\u043D\u0443 \u04AF\u0447\u04AF\u043D \u0431\u0430\u0441\u044B\u04A3\u044B\u0437",finishCircle:"\u0410\u0439\u043B\u0430\u043D\u0430\u043D\u044B \u0431\u04AF\u0442\u04AF\u0440\u04AF\u04AF \u04AF\u0447\u04AF\u043D \u0431\u0430\u0441\u044B\u04A3\u044B\u0437",placeCircleMarker:"\u0422\u0435\u0433\u0435\u0440\u0435\u043A \u043C\u0430\u0440\u043A\u0435\u0440\u0434\u0438 \u0436\u0430\u0439\u0433\u0430\u0448\u0442\u044B\u0440\u0443\u0443 \u04AF\u0447\u04AF\u043D \u0431\u0430\u0441\u044B\u04A3\u044B\u0437",placeText:"\u0422\u0435\u043A\u0441\u0442\u0442\u0438 \u0436\u0430\u0439\u0433\u0430\u0448\u0442\u044B\u0440\u0443\u0443 \u04AF\u0447\u04AF\u043D \u0431\u0430\u0441\u044B\u04A3\u044B\u0437"},actions:{finish:"\u0410\u044F\u0433\u044B",cancel:"\u0416\u043E\u043A \u043A\u044B\u043B\u0443\u0443",removeLastVertex:"\u0410\u043A\u044B\u0440\u043A\u044B \u0447\u043E\u043A\u0443\u043D\u0443 \u04E9\u0447\u04AF\u0440\u04AF\u04AF"},buttonTitles:{drawMarkerButton:"\u041C\u0430\u0440\u043A\u0435\u0440\u0434\u0438 \u0447\u0438\u0437\u0443\u0443",drawPolyButton:"\u041F\u043E\u043B\u0438\u0433\u043E\u043D \u0447\u0438\u0437\u0443\u0443",drawLineButton:"\u041F\u043E\u043B\u0438\u043B\u0438\u043D\u0438\u044F \u0447\u0438\u0437\u0443\u0443",drawCircleButton:"\u0414\u0430\u0439\u044B\u043D\u0434\u044B \u0447\u0438\u0437\u0443\u0443",drawRectButton:"\u041F\u0440\u044F\u043C\u043E\u0443\u0433\u043E\u043B\u044C\u043D\u0438\u043A \u0447\u0438\u0437\u0443\u0443",editButton:"\u0421\u043B\u043E\u043E\u043F\u0442\u0443 \u0442\u04AF\u0437\u04E9\u0442\u04AF\u04AF",dragButton:"\u0421\u043B\u043E\u043E\u043F\u0442\u0443 \u043A\u0430\u0440\u0430\u043F \u0441\u04AF\u0439\u043B\u04E9\u04AF",cutButton:"\u0421\u043B\u043E\u043E\u043F\u0442\u0443\u043D \u0431\u0430\u0448\u044B\u043D \u043A\u0435\u0441\u04AF\u04AF",deleteButton:"\u0421\u043B\u043E\u043E\u043F\u0442\u0443\u043D \u04E9\u0447\u04AF\u0440\u04AF\u04AF",drawCircleMarkerButton:"\u0414\u0430\u0439\u044B\u043D\u0434\u044B \u043C\u0430\u0440\u043A\u0435\u0440\u0434\u0438 \u0447\u0438\u0437\u0443\u0443",snappingButton:"\u0411\u0430\u0448\u043A\u0430 \u0441\u043B\u043E\u043E\u043F\u0442\u043E\u0440\u0434\u0443\u043D \u0436\u0430\u043D\u0430 \u0432\u0435\u0440\u0442\u0435\u043A\u0441\u0442\u0435\u0440\u0434\u0438\u043D \u0430\u0440\u0430\u0441\u044B\u043D\u0430 \u0447\u0435\u043A\u0438\u043B\u0434\u04E9\u04E9",pinningButton:"\u0411\u04E9\u043B\u04AF\u0448\u043A\u04E9\u043D \u0432\u0435\u0440\u0442\u0435\u043A\u0441\u0442\u0435\u0440\u0434\u0438 \u0431\u0438\u0440\u0433\u0435 \u0442\u0443\u0442\u0443\u0448\u0442\u0443\u0440\u0443\u0443",rotateButton:"\u0421\u043B\u043E\u043E\u043F\u0442\u0443\u043D \u04E9\u0437\u0433\u04E9\u0440\u0442\u04AF\u04AF",drawTextButton:"\u0422\u0435\u043A\u0441\u0442 \u0447\u0438\u0437\u0443\u0443",scaleButton:"\u0421\u043B\u043E\u043E\u043F\u0442\u0443\u043D \u04E9\u043B\u0447\u04E9\u043C\u04AF\u043D \u04E9\u0437\u0433\u04E9\u0440\u0442\u04AF\u04AF",autoTracingButton:"\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0442\u044B\u043A \u0442\u0438\u0437\u043C\u0435\u0433\u0438 \u0447\u0438\u0437\u0443\u0443"},measurements:{totalLength:"\u0423\u0437\u0443\u043D\u0434\u0443\u043A",segmentLength:"\u0421\u0435\u0433\u043C\u0435\u043D\u0442 \u0443\u0437\u0443\u043D\u0434\u0443\u0433\u0443",area:"\u0410\u0439\u043C\u0430\u043A",radius:"\u0420\u0430\u0434\u0438\u0443\u0441",perimeter:"\u041F\u0435\u0440\u0438\u043C\u0435\u0442\u0440",height:"\u0414\u0438\u0430\u043C\u0435\u0442\u0440",width:"\u041A\u0435\u043D\u0447\u0438\u043B\u0438\u043A",coordinates:"\u041A\u043E\u043E\u0440\u0434\u0438\u043D\u0430\u0442\u0442\u0430\u0440",coordinatesMarker:"\u041C\u0430\u0440\u043A\u0435\u0440\u0434\u0438\u043D \u043A\u043E\u043E\u0440\u0434\u0438\u043D\u0430\u0442\u0442\u0430\u0440\u044B"}};var Wd=_i,Et={en:va,de:xa,it:wa,id:Ca,ro:Ea,ru:Pa,es:Sa,nl:Ta,fr:Ba,pt:Wd,pt_br:Oa,pt_pt:_i,zh:Da,zh_tw:Ra,pl:Ia,sv:Aa,el:Ga,hu:qa,da:Na,no:za,fa:Fa,ua:ja,tr:Va,cz:Ua,ja:Ka,fi:Ha,ko:Xa,ky:Ya};var Qd={_globalEditModeEnabled:!1,enableGlobalEditMode(t){let e={...t};this._globalEditModeEnabled=!0,this.Toolbar.toggleButton("editMode",this.globalEditModeEnabled()),L.PM.Utils.findLayers(this.map).forEach(r=>{this._isRelevantForEdit(r)&&r.pm.enable(e)}),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(t=this.globalOptions){this.globalEditModeEnabled()?this.disableGlobalEditMode():this.enableGlobalEditMode(t)},handleLayerAdditionInGlobalEditMode(){let t=this._addedLayersEdit;if(this._addedLayersEdit={},this.globalEditModeEnabled())for(let e in t){let i=t[e];this._isRelevantForEdit(i)&&i.pm.enable({...this.globalOptions})}},_layerAddedEdit({layer:t}){this._addedLayersEdit[L.stamp(t)]=t},_isRelevantForEdit(t){return t.pm&&!(t instanceof L.LayerGroup)&&(!L.PM.optIn&&!t.options.pmIgnore||L.PM.optIn&&t.options.pmIgnore===!1)&&!t._pmTempLayer&&t.pm.options.allowEditing}},Ja=Qd;var tg={_globalDragModeEnabled:!1,enableGlobalDragMode(){let t=L.PM.Utils.findLayers(this.map);this._globalDragModeEnabled=!0,this._addedLayersDrag={},t.forEach(e=>{this._isRelevantForDrag(e)&&e.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 t=L.PM.Utils.findLayers(this.map);this._globalDragModeEnabled=!1,t.forEach(e=>{e.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 t=this._addedLayersDrag;if(this._addedLayersDrag={},this.globalDragModeEnabled())for(let e in t){let i=t[e];this._isRelevantForDrag(i)&&i.pm.enableLayerDrag()}},_layerAddedDrag({layer:t}){this._addedLayersDrag[L.stamp(t)]=t},_isRelevantForDrag(t){return t.pm&&!(t instanceof L.LayerGroup)&&(!L.PM.optIn&&!t.options.pmIgnore||L.PM.optIn&&t.options.pmIgnore===!1)&&!t._pmTempLayer&&t.pm.options.draggable}},$a=tg;var eg={_globalRemovalModeEnabled:!1,enableGlobalRemovalMode(){this._globalRemovalModeEnabled=!0,this.map.eachLayer(t=>{this._isRelevantForRemoval(t)&&(t.pm.enabled()&&t.pm.disable(),t.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(t=>{t.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(t){let e=t.target;this._isRelevantForRemoval(e)&&!e.pm.dragging()&&(e.removeFrom(this.map.pm._getContainingLayer()),e.remove(),e instanceof L.LayerGroup?(this._fireRemoveLayerGroup(e),this._fireRemoveLayerGroup(this.map,e)):(e.pm._fireRemove(e),e.pm._fireRemove(this.map,e)))},_isRelevantForRemoval(t){return t.pm&&!(t instanceof L.LayerGroup)&&(!L.PM.optIn&&!t.options.pmIgnore||L.PM.optIn&&t.options.pmIgnore===!1)&&!t._pmTempLayer&&t.pm.options.allowRemoval},handleLayerAdditionInGlobalRemovalMode(){let t=this._addedLayersRemoval;if(this._addedLayersRemoval={},this.globalRemovalModeEnabled())for(let e in t){let i=t[e];this._isRelevantForRemoval(i)&&(i.pm.enabled()&&i.pm.disable(),i.on("click",this.removeLayer,this))}},_layerAddedRemoval({layer:t}){this._addedLayersRemoval[L.stamp(t)]=t}},Za=eg;var ig={_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(t){return t.pm&&t instanceof L.Polyline&&!(t instanceof L.LayerGroup)&&(!L.PM.optIn&&!t.options.pmIgnore||L.PM.optIn&&t.options.pmIgnore===!1)&&!t._pmTempLayer&&t.pm.options.allowRotation},handleLayerAdditionInGlobalRotateMode(){let t=this._addedLayersRotate;if(this._addedLayersRotate={},this.globalRotateModeEnabled())for(let e in t){let i=t[e];this._isRelevantForRemoval(i)&&i.pm.enableRotate()}},_layerAddedRotate({layer:t}){this._addedLayersRotate[L.stamp(t)]=t}},Wa=ig;var Qa=wt(Oe()),rg={_fireDrawStart(t="Draw",e={}){this.__fire(this._map,"pm:drawstart",{shape:this._shape,workingLayer:this._layer},t,e)},_fireDrawEnd(t="Draw",e={}){this.__fire(this._map,"pm:drawend",{shape:this._shape},t,e)},_fireCreate(t,e="Draw",i={}){this.__fire(this._map,"pm:create",{shape:this._shape,marker:t,layer:t},e,i)},_fireCenterPlaced(t="Draw",e={}){let i=t==="Draw"?this._layer:void 0,r=t!=="Draw"?this._layer:void 0;this.__fire(this._layer,"pm:centerplaced",{shape:this._shape,workingLayer:i,layer:r,latlng:this._layer.getLatLng()},t,e)},_fireCut(t,e,i,r="Draw",n={}){this.__fire(t,"pm:cut",{shape:this._shape,layer:e,originalLayer:i},r,n)},_fireEdit(t=this._layer,e="Edit",i={}){this.__fire(t,"pm:edit",{layer:this._layer,shape:this.getShape()},e,i)},_fireEnable(t="Edit",e={}){this.__fire(this._layer,"pm:enable",{layer:this._layer,shape:this.getShape()},t,e)},_fireDisable(t="Edit",e={}){this.__fire(this._layer,"pm:disable",{layer:this._layer,shape:this.getShape()},t,e)},_fireUpdate(t="Edit",e={}){this.__fire(this._layer,"pm:update",{layer:this._layer,shape:this.getShape()},t,e)},_fireMarkerDragStart(t,e=void 0,i="Edit",r={}){this.__fire(this._layer,"pm:markerdragstart",{layer:this._layer,markerEvent:t,shape:this.getShape(),indexPath:e},i,r)},_fireMarkerDrag(t,e=void 0,i="Edit",r={}){this.__fire(this._layer,"pm:markerdrag",{layer:this._layer,markerEvent:t,shape:this.getShape(),indexPath:e},i,r)},_fireMarkerDragEnd(t,e=void 0,i=void 0,r="Edit",n={}){this.__fire(this._layer,"pm:markerdragend",{layer:this._layer,markerEvent:t,shape:this.getShape(),indexPath:e,intersectionReset:i},r,n)},_fireDragStart(t="Edit",e={}){this.__fire(this._layer,"pm:dragstart",{layer:this._layer,shape:this.getShape()},t,e)},_fireDrag(t,e="Edit",i={}){this.__fire(this._layer,"pm:drag",{...t,shape:this.getShape()},e,i)},_fireDragEnd(t="Edit",e={}){this.__fire(this._layer,"pm:dragend",{layer:this._layer,shape:this.getShape()},t,e)},_fireDragEnable(t="Edit",e={}){this.__fire(this._layer,"pm:dragenable",{layer:this._layer,shape:this.getShape()},t,e)},_fireDragDisable(t="Edit",e={}){this.__fire(this._layer,"pm:dragdisable",{layer:this._layer,shape:this.getShape()},t,e)},_fireRemove(t,e=t,i="Edit",r={}){this.__fire(t,"pm:remove",{layer:e,shape:this.getShape()},i,r)},_fireVertexAdded(t,e,i,r="Edit",n={}){this.__fire(this._layer,"pm:vertexadded",{layer:this._layer,workingLayer:this._layer,marker:t,indexPath:e,latlng:i,shape:this.getShape()},r,n)},_fireVertexRemoved(t,e,i="Edit",r={}){this.__fire(this._layer,"pm:vertexremoved",{layer:this._layer,marker:t,indexPath:e,shape:this.getShape()},i,r)},_fireVertexClick(t,e,i="Edit",r={}){this.__fire(this._layer,"pm:vertexclick",{layer:this._layer,markerEvent:t,indexPath:e,shape:this.getShape()},i,r)},_fireIntersect(t,e=this._layer,i="Edit",r={}){this.__fire(e,"pm:intersect",{layer:this._layer,intersection:t,shape:this.getShape()},i,r)},_fireLayerReset(t,e,i="Edit",r={}){this.__fire(this._layer,"pm:layerreset",{layer:this._layer,markerEvent:t,indexPath:e,shape:this.getShape()},i,r)},_fireChange(t,e="Edit",i={}){this.__fire(this._layer,"pm:change",{layer:this._layer,latlngs:t,shape:this.getShape()},e,i)},_fireTextChange(t,e="Edit",i={}){this.__fire(this._layer,"pm:textchange",{layer:this._layer,text:t,shape:this.getShape()},e,i)},_fireTextFocus(t="Edit",e={}){this.__fire(this._layer,"pm:textfocus",{layer:this._layer,shape:this.getShape()},t,e)},_fireTextBlur(t="Edit",e={}){this.__fire(this._layer,"pm:textblur",{layer:this._layer,shape:this.getShape()},t,e)},_fireSnapDrag(t,e,i="Snapping",r={}){this.__fire(t,"pm:snapdrag",e,i,r)},_fireSnap(t,e,i="Snapping",r={}){this.__fire(t,"pm:snap",e,i,r)},_fireUnsnap(t,e,i="Snapping",r={}){this.__fire(t,"pm:unsnap",e,i,r)},_fireRotationEnable(t,e,i="Rotation",r={}){this.__fire(t,"pm:rotateenable",{layer:this._layer,helpLayer:this._rotatePoly,shape:this.getShape()},i,r)},_fireRotationDisable(t,e="Rotation",i={}){this.__fire(t,"pm:rotatedisable",{layer:this._layer,shape:this.getShape()},e,i)},_fireRotationStart(t,e,i="Rotation",r={}){this.__fire(t,"pm:rotatestart",{layer:this._rotationLayer,helpLayer:this._layer,startAngle:this._startAngle,originLatLngs:e},i,r)},_fireRotation(t,e,i,r=this._rotationLayer,n="Rotation",s={}){this.__fire(t,"pm:rotate",{layer:r,helpLayer:this._layer,startAngle:this._startAngle,angle:r.pm.getAngle(),angleDiff:e,oldLatLngs:i,newLatLngs:r.getLatLngs()},n,s)},_fireRotationEnd(t,e,i,r="Rotation",n={}){this.__fire(t,"pm:rotateend",{layer:this._rotationLayer,helpLayer:this._layer,startAngle:e,angle:this._rotationLayer.pm.getAngle(),originLatLngs:i,newLatLngs:this._rotationLayer.getLatLngs()},r,n)},_fireActionClick(t,e,i,r="Toolbar",n={}){this.__fire(this._map,"pm:actionclick",{text:t.text,action:t,btnName:e,button:i},r,n)},_fireButtonClick(t,e,i="Toolbar",r={}){this.__fire(this._map,"pm:buttonclick",{btnName:t,button:e},i,r)},_fireLangChange(t,e,i,r,n="Global",s={}){this.__fire(this.map,"pm:langchange",{oldLang:t,activeLang:e,fallback:i,translations:r},n,s)},_fireGlobalDragModeToggled(t,e="Global",i={}){this.__fire(this.map,"pm:globaldragmodetoggled",{enabled:t,map:this.map},e,i)},_fireGlobalEditModeToggled(t,e="Global",i={}){this.__fire(this.map,"pm:globaleditmodetoggled",{enabled:t,map:this.map},e,i)},_fireGlobalRemovalModeToggled(t,e="Global",i={}){this.__fire(this.map,"pm:globalremovalmodetoggled",{enabled:t,map:this.map},e,i)},_fireGlobalCutModeToggled(t="Global",e={}){this.__fire(this._map,"pm:globalcutmodetoggled",{enabled:!!this._enabled,map:this._map},t,e)},_fireGlobalDrawModeToggled(t="Global",e={}){this.__fire(this._map,"pm:globaldrawmodetoggled",{enabled:this._enabled,shape:this._shape,map:this._map},t,e)},_fireGlobalRotateModeToggled(t="Global",e={}){this.__fire(this.map,"pm:globalrotatemodetoggled",{enabled:this.globalRotateModeEnabled(),map:this.map},t,e)},_fireRemoveLayerGroup(t,e=t,i="Edit",r={}){this.__fire(t,"pm:remove",{layer:e,shape:void 0},i,r)},_fireKeyeventEvent(t,e,i,r="Global",n={}){this.__fire(this.map,"pm:keyevent",{event:t,eventType:e,focusOn:i},r,n)},__fire(t,e,i,r,n={}){i=(0,Qa.default)(i,n,{source:r}),L.PM.Utils._fireEvent(t,e,i)}},Pt=rg;var ng=()=>({_lastEvents:{keydown:void 0,keyup:void 0,current:void 0},_initKeyListener(t){this.map=t,L.DomEvent.on(document,"keydown keyup",this._onKeyListener,this),L.DomEvent.on(window,"blur",this._onBlur,this),t.once("unload",this._unbindKeyListenerEvents,this)},_handleEscapeKey(t){let e=this.map.pm;return!e.getGlobalOptions().exitModeOnEscape||!(e.globalDrawModeEnabled()||e.globalEditModeEnabled()||e.globalDragModeEnabled()||e.globalRemovalModeEnabled()||e.globalRotateModeEnabled()||e.globalCutModeEnabled())?!1:(t.preventDefault(),e.globalDrawModeEnabled()&&e.disableDraw(),e.globalEditModeEnabled()&&e.disableGlobalEditMode(),e.globalDragModeEnabled()&&e.disableGlobalDragMode(),e.globalRemovalModeEnabled()&&e.disableGlobalRemovalMode(),e.globalRotateModeEnabled()&&e.disableGlobalRotateMode(),e.globalCutModeEnabled()&&e.disableGlobalCutMode(),!0)},_handleEnterKey(t){let e=this.map.pm;if(!e.getGlobalOptions().finishOnEnter)return!1;let r=e.Draw.getActiveShape();if(!r)return!1;let n=e.Draw[r];return!n||!n._finishShape||!this._canFinishShape(n,r)?!1:(t.preventDefault(),n._finishShape(),!0)},_canFinishShape(t,e){if(["Marker","CircleMarker","Text"].includes(e))return!1;if(e==="Rectangle")return t._startMarker!==void 0;if(e==="Circle")return t._centerMarker&&t._layerGroup?.hasLayer(t._centerMarker);if(t._layer&&t._layer.getLatLngs){let i=t._layer.getLatLngs();if(e==="Line")return(i.flat?i.flat():i).length>=2;if(e==="Polygon"||e==="Cut")return i.length>=3}return!1},_unbindKeyListenerEvents(){L.DomEvent.off(document,"keydown keyup",this._onKeyListener,this),L.DomEvent.off(window,"blur",this._onBlur,this)},_onKeyListener(t){let e="document";this.map.getContainer().contains(t.target)&&(e="map");let i={event:t,eventType:t.type,focusOn:e};this._lastEvents[t.type]=i,this._lastEvents.current=i,this.map.pm._fireKeyeventEvent(t,t.type,e),t.type==="keydown"&&(t.key==="Escape"&&this._handleEscapeKey(t),t.key==="Enter"&&this._handleEnterKey(t))},_onBlur(t){t.altKey=!1;let e={event:t,eventType:t.type,focusOn:"document"};this._lastEvents[t.type]=e,this._lastEvents.current=e},getLastKeyEvent(t="current"){return this._lastEvents[t]},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}}),to=ng;var Li=wt(ge());function F(t){let e=L.PM.activeLang;return(0,Li.default)(Et[e],t)||(0,Li.default)(Et.en,t)||t}function So(){return window.matchMedia?!window.matchMedia("(pointer: coarse)").matches:!0}function me(t){for(let e=0;e{if(i.length!==0){let r=Array.isArray(i)?_e(i):i;Array.isArray(r)?r.length!==0&&e.push(r):e.push(r)}return e},[])}function jg(t,e,i){let r={a:L.CRS.Earth.R,b:63567523142e-4,f:.0033528106647474805},{a:n,b:s,f:a}=r,o=t.lng,h=t.lat,l=i,d=Math.PI,f=e*d/180,k=Math.sin(f),w=Math.cos(f),S=(1-a)*Math.tan(h*d/180),A=1/Math.sqrt(1+S*S),g=S*A,M=Math.atan2(S,w),m=A*k,O=1-m*m,R=O*(n*n-s*s)/(s*s),I=1+R/16384*(4096+R*(-768+R*(320-175*R))),G=R/1024*(256+R*(-128+R*(74-47*R))),q=l/(s*I),c=2*Math.PI,u,p,y;for(;Math.abs(q-c)>1e-12;){u=Math.cos(2*M+q),p=Math.sin(q),y=Math.cos(q);let T=G*p*(u+G/4*(y*(-1+2*u*u)-G/6*u*(-3+4*p*p)*(-3+4*u*u)));c=q,q=l/(s*I)+T}let _=g*p-A*y*w,v=Math.atan2(g*y+A*p*w,(1-a)*Math.sqrt(m*m+_*_)),E=Math.atan2(p*k,A*y-g*p*w),b=a/16*O*(4+a*(4-3*O)),x=E-(1-b)*a*m*(q+b*p*(u+b*y*(-1+2*u*u))),P=o+x*180/d,C=v*180/d;return L.latLng(P,C)}function bi(t,e,i,r,n=!0){let s,a,o,h=[];for(let l=0;l180?A:g,L.latLng([w*n,S])}function ye(t,e,i){let r=t.latLngToContainerPoint(e),n=t.latLngToContainerPoint(i),s=Math.atan2(n.y-r.y,n.x-r.x)*180/Math.PI+90;return s+=s<0?360:0,s}function Zt(t,e,i,r){let n=ye(t,e,i);return Vg(e,n,r)}function To(t,e,i="asc"){if(!e||Object.keys(e).length===0)return(h,l)=>h-l;let r=Object.keys(e),n,s=r.length-1,a={};for(;s>=0;)n=r[s],a[n.toLowerCase()]=e[n],s-=1;function o(h){if(h instanceof L.Marker)return"Marker";if(h instanceof L.Circle)return"Circle";if(h instanceof L.CircleMarker)return"CircleMarker";if(h instanceof L.Rectangle)return"Rectangle";if(h instanceof L.Polygon)return"Polygon";if(h instanceof L.Polyline)return"Line"}return(h,l)=>{let d,f;if(t==="instanceofShape"){if(d=o(h.layer).toLowerCase(),f=o(l.layer).toLowerCase(),!d||!f)return 0}else{if(!h.hasOwnProperty(t)||!l.hasOwnProperty(t))return 0;d=h[t].toLowerCase(),f=l[t].toLowerCase()}let k=d in a?a[d]:Number.MAX_SAFE_INTEGER,w=f in a?a[f]:Number.MAX_SAFE_INTEGER,S=0;return kw&&(S=1),i==="desc"?S*-1:S}}function Lt(t,e=t.getLatLngs()){return t instanceof L.Polygon?L.polygon(e).getLatLngs():L.polyline(e).getLatLngs()}function ki(t,e){if(e.options.crs?.projection?.MAX_LATITUDE){let i=e.options.crs?.projection?.MAX_LATITUDE;t.lat=Math.max(Math.min(i,t.lat),-i)}return t}function St(t){return t.options.renderer||t._map&&(t._map._getPaneRenderer(t.options.pane)||t._map.options.renderer||t._map._renderer)||t._renderer}function Bo(t,e){if(t=t.trim().toLowerCase(),e[t])return t;let r=t.replace(/[-_\s]/g,"_").match(/^([a-z]{2,3})(?:_([a-z]{2,3}))?$/);if(r){let n=[];r[2]&&n.push(`${r[1]}_${r[2]}`),n.push(r[1]);for(let s of n)if(e[s])return s}return t}var Ug=L.Class.extend({includes:[Ja,$a,Za,Wa,Pt],initialize(t){this.map=t,this.Draw=new L.PM.Draw(t),this.Toolbar=new L.PM.Toolbar(t),this.Keyboard=to(),this.globalOptions={snappable:!0,layerGroup:void 0,snappingOrder:["Marker","CircleMarker","Circle","Line","Polygon","Rectangle"],panes:{vertexPane:"markerPane",layerPane:"overlayPane",markerPane:"markerPane"},draggable:!0,exitModeOnEscape:!1,finishOnEnter:!1},this.Keyboard._initKeyListener(t)},setLang(t="en",e,i="en"){t=Bo(t,Et);let r=L.PM.activeLang;e&&(Et[t]=(0,Mi.default)(Et[i],e)),L.PM.activeLang=t,this.map.pm.Toolbar.reinit(),this._fireLangChange(r,t,i,Et[t])},addControls(t){this.Toolbar.addControls(t)},removeControls(){this.Toolbar.removeControls()},toggleControls(){this.Toolbar.toggleControls()},controlsVisible(){return this.Toolbar.isVisible},enableDraw(t="Polygon",e){t==="Poly"&&(t="Polygon"),this.Draw.enable(t,e)},disableDraw(t="Polygon"){t==="Poly"&&(t="Polygon"),this.Draw.disable(t)},setPathOptions(t,e={}){let i=e.ignoreShapes||[],r=e.merge||!1;this.map.pm.Draw.shapes.forEach(n=>{i.indexOf(n)===-1&&this.map.pm.Draw[n].setPathOptions(t,r)})},getGlobalOptions(){return this.globalOptions},setGlobalOptions(t){let e=(0,Mi.default)(this.globalOptions,t);e.editable&&(e.resizeableCircleMarker=e.editable,delete e.editable);let i=!1;this.map.pm.Draw.CircleMarker.enabled()&&!!this.map.pm.Draw.CircleMarker.options.resizeableCircleMarker!=!!e.resizeableCircleMarker&&(this.map.pm.Draw.CircleMarker.disable(),i=!0);let r=!1;this.map.pm.Draw.Circle.enabled()&&!!this.map.pm.Draw.Circle.options.resizeableCircle!=!!e.resizeableCircle&&(this.map.pm.Draw.Circle.disable(),r=!0),this.map.pm.Draw.shapes.forEach(s=>{this.map.pm.Draw[s].setOptions(e)}),i&&this.map.pm.Draw.CircleMarker.enable(),r&&this.map.pm.Draw.Circle.enable(),L.PM.Utils.findLayers(this.map).forEach(s=>{s.pm.setOptions(e)}),this.map.fire("pm:globaloptionschanged"),this.globalOptions=e,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(t){return this.Draw.Cut.enable(t)},toggleGlobalCutMode(t){return this.Draw.Cut.toggle(t)},disableGlobalCutMode(){return this.Draw.Cut.disable()},getGeomanLayers(t=!1){let e=L.PM.Utils.findLayers(this.map);if(!t)return e;let i=L.featureGroup();return i._pmTempLayer=!0,e.forEach(r=>{i.addLayer(r)}),i},getGeomanDrawLayers(t=!1){let e=L.PM.Utils.findLayers(this.map).filter(r=>r._drawnByGeoman===!0);if(!t)return e;let i=L.featureGroup();return i._pmTempLayer=!0,e.forEach(r=>{i.addLayer(r)}),i},_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(t){this._touchEventCounter===0&&(L.DomEvent.on(t,"touchmove",this._canvasTouchMove,this),L.DomEvent.on(t,"touchstart touchend touchcancel",this._canvasTouchClick,this)),this._touchEventCounter+=1},_removeTouchEvents(t){this._touchEventCounter===1&&(L.DomEvent.off(t,"touchmove",this._canvasTouchMove,this),L.DomEvent.off(t,"touchstart touchend touchcancel",this._canvasTouchClick,this)),this._touchEventCounter=this._touchEventCounter<=1?0:this._touchEventCounter-1},_canvasTouchMove(t){St(this.map)._onMouseMove(this._createMouseEvent("mousemove",t))},_canvasTouchClick(t){let e="";t.type==="touchstart"||t.type==="pointerdown"?e="mousedown":(t.type==="touchend"||t.type==="pointerup"||t.type==="touchcancel"||t.type==="pointercancel")&&(e="mouseup"),e&&St(this.map)._onClick(this._createMouseEvent(e,t))},_createMouseEvent(t,e){let i,r=e.touches[0]||e.changedTouches[0];try{i=new MouseEvent(t,{bubbles:e.bubbles,cancelable:e.cancelable,view:e.view,detail:r.detail,screenX:r.screenX,screenY:r.screenY,clientX:r.clientX,clientY:r.clientY,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,button:e.button,relatedTarget:e.relatedTarget})}catch{i=document.createEvent("MouseEvents"),i.initMouseEvent(t,e.bubbles,e.cancelable,e.view,r.detail,r.screenX,r.screenY,r.clientX,r.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}return i}}),Do=Ug;var Kg=L.Control.extend({includes:[Pt],options:{position:"topleft",disableByOtherButtons:!0},initialize(t){this._button=L.Util.extend({},this.options,t)},onAdd(t){return this._map=t,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 t=this.buttonsDomNode;this.buttonsDomNode=this._makeButton(this._button),t?t.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(t){return typeof t=="boolean"?this._button.toggleStatus=t: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(t){t&&t.preventDefault(),!this._button.disabled&&(this._button.onClick(t,{button:this,event:t}),this._clicked(t),this._button.afterClick(t,{button:this,event:t}))},_makeButton(t){let e=this.options.position.indexOf("right")>-1?"pos-right":"",i=L.DomUtil.create("div",`button-container ${e}`,this._container);t.title&&i.setAttribute("title",t.title);let r=L.DomUtil.create("a","leaflet-buttons-control-button",i);r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.href="#";let n=L.DomUtil.create("div",`leaflet-pm-actions-container ${e}`,i),s=t.actions,a={cancel:{text:F("actions.cancel"),title:F("actions.cancel"),onClick(){this._triggerClick()}},finishMode:{text:F("actions.finish"),title:F("actions.finish"),onClick(){this._triggerClick()}},removeLastVertex:{text:F("actions.removeLastVertex"),title:F("actions.removeLastVertex"),onClick(){this._map.pm.Draw[t.jsClass]._removeLastVertex()}},finish:{text:F("actions.finish"),title:F("actions.finish"),onClick(h){this._map.pm.Draw[t.jsClass]._finishShape(h)}}};t._preparedActions=s.map(h=>{let l=typeof h=="string"?h:h.name,d;if(a[l])d=a[l];else if(h.text)d=h;else return d;let f=L.DomUtil.create("a",`leaflet-pm-action ${e} action-${l}`,n);if(f.setAttribute("role","button"),f.setAttribute("tabindex","0"),f.href="#",d.title&&(f.title=d.title),f.innerHTML=d.text,L.DomEvent.disableClickPropagation(f),L.DomEvent.on(f,"click",L.DomEvent.stop),d._node=f,!t.disabled&&d.onClick){let k=w=>{w.preventDefault();let S="",{buttons:A}=this._map.pm.Toolbar;for(let g in A)if(A[g]._button===t){S=g;break}this._fireActionClick(d,S,t)};L.DomEvent.addListener(f,"click",k,this),L.DomEvent.addListener(f,"click",d.onClick,this),L.DomEvent.addListener(f,"click",()=>this._updateActiveAction(t))}return d}),this._updateActiveAction(t),t.toggleStatus&&L.DomUtil.addClass(i,"active");let o=L.DomUtil.create("div","control-icon",r);return t.iconUrl&&o.setAttribute("src",t.iconUrl),t.className&&L.DomUtil.addClass(o,t.className),L.DomEvent.disableClickPropagation(r),L.DomEvent.on(r,"click",L.DomEvent.stop),t.disabled||(L.DomEvent.addListener(r,"click",this._onBtnClick,this),L.DomEvent.addListener(r,"click",this._triggerClick,this)),t.disabled&&(L.DomUtil.addClass(r,"pm-disabled"),r.setAttribute("aria-disabled","true")),i},_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 t="",{buttons:e}=this._map.pm.Toolbar;for(let i in e)if(e[i]._button===this._button){t=i;break}this._fireButtonClick(t,this._button)},_clicked(){this._button.doToggle&&this.toggle()},_updateDisabled(){if(!this._container)return;let t="pm-disabled",e=this.buttonsDomNode.children[0];this._button.disabled?(L.DomUtil.addClass(e,t),e.setAttribute("aria-disabled","true")):(L.DomUtil.removeClass(e,t),e.setAttribute("aria-disabled","false"))},_updateActiveAction(t){t._preparedActions?.forEach(e=>{e?._node&&(e.isActive&&e.isActive.call(this)?L.DomUtil.addClass(e._node,"active-action"):L.DomUtil.removeClass(e._node,"active-action"))})}}),Ro=Kg;L.Control.PMButton=Ro;var Hg=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(t){this.customButtons=[],this.options.positions={draw:"",edit:"",options:"",custom:""},this.init(t)},reinit(){let t=this.isVisible;this.removeControls(),this._defineButtons(),t&&this.addControls()},init(t){this.map=t,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(t){let e=`${t}Container`;return this[e]||(this[e]=L.DomUtil.create("div",`leaflet-pm-toolbar leaflet-pm-${t} leaflet-bar leaflet-control`)),this[e]},getButtons(){return this.buttons},addControls(t=this.options){typeof t.editPolygon<"u"&&(t.editMode=t.editPolygon),typeof t.deleteLayer<"u"&&(t.removalMode=t.deleteLayer),L.Util.setOptions(this,t),this.applyIconStyle(),this.isVisible=!0,this._showHideButtons()},applyIconStyle(){let t=this.getButtons(),e={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 i in t){let r=t[i];L.Util.setOptions(r,{className:e.geomanIcons[i]})}},removeControls(){let t=this.getButtons();for(let e in t)t[e].remove();this.isVisible=!1},deleteControl(t){let e=this._btnNameMapping(t);this.buttons[e]&&(this.buttons[e].remove(),delete this.buttons[e])},toggleControls(t=this.options){this.isVisible?this.removeControls():this.addControls(t)},_addButton(t,e){return this.buttons[t]=e,this.options[t]=!!this.options[t]||!1,this.buttons[t]},triggerClickOnToggledButtons(t){for(let e in this.buttons){let i=this.buttons[e];i._button.disableByOtherButtons&&i!==t&&i.toggled()&&i._triggerClick()}},toggleButton(t,e,i=!0){t==="editPolygon"&&(t="editMode"),t==="deleteLayer"&&(t="removalMode");let r=t;return i&&this.triggerClickOnToggledButtons(this.buttons[r]),this.buttons[r]?this.buttons[r].toggle(e):!1},_defineButtons(){let t={className:"control-icon leaflet-pm-icon-marker",title:F("buttonTitles.drawMarkerButton"),jsClass:"Marker",onClick:()=>{},afterClick:(k,w)=>{this.map.pm.Draw[w.button._button.jsClass].toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,actions:["cancel"]},e={title:F("buttonTitles.drawPolyButton"),className:"control-icon leaflet-pm-icon-polygon",jsClass:"Polygon",onClick:()=>{},afterClick:(k,w)=>{this.map.pm.Draw[w.button._button.jsClass].toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,actions:["finish","removeLastVertex","cancel"]},i={className:"control-icon leaflet-pm-icon-polyline",title:F("buttonTitles.drawLineButton"),jsClass:"Line",onClick:()=>{},afterClick:(k,w)=>{this.map.pm.Draw[w.button._button.jsClass].toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,actions:["finish","removeLastVertex","cancel"]},r={title:F("buttonTitles.drawCircleButton"),className:"control-icon leaflet-pm-icon-circle",jsClass:"Circle",onClick:()=>{},afterClick:(k,w)=>{this.map.pm.Draw[w.button._button.jsClass].toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,actions:["cancel"]},n={title:F("buttonTitles.drawCircleMarkerButton"),className:"control-icon leaflet-pm-icon-circle-marker",jsClass:"CircleMarker",onClick:()=>{},afterClick:(k,w)=>{this.map.pm.Draw[w.button._button.jsClass].toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,actions:["cancel"]},s={title:F("buttonTitles.drawRectButton"),className:"control-icon leaflet-pm-icon-rectangle",jsClass:"Rectangle",onClick:()=>{},afterClick:(k,w)=>{this.map.pm.Draw[w.button._button.jsClass].toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,actions:["cancel"]},a={title:F("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"]},o={title:F("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"]},h={title:F("buttonTitles.cutButton"),className:"control-icon leaflet-pm-icon-cut",jsClass:"Cut",onClick:()=>{},afterClick:(k,w)=>{this.map.pm.Draw[w.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"]},l={title:F("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"]},d={title:F("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"]},f={className:"control-icon leaflet-pm-icon-text",title:F("buttonTitles.drawTextButton"),jsClass:"Text",onClick:()=>{},afterClick:(k,w)=>{this.map.pm.Draw[w.button._button.jsClass].toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position,actions:["cancel"]};this._addButton("drawMarker",new L.Control.PMButton(t)),this._addButton("drawPolyline",new L.Control.PMButton(i)),this._addButton("drawRectangle",new L.Control.PMButton(s)),this._addButton("drawPolygon",new L.Control.PMButton(e)),this._addButton("drawCircle",new L.Control.PMButton(r)),this._addButton("drawCircleMarker",new L.Control.PMButton(n)),this._addButton("drawText",new L.Control.PMButton(f)),this._addButton("editMode",new L.Control.PMButton(a)),this._addButton("dragMode",new L.Control.PMButton(o)),this._addButton("cutPolygon",new L.Control.PMButton(h)),this._addButton("removalMode",new L.Control.PMButton(l)),this._addButton("rotateMode",new L.Control.PMButton(d))},_showHideButtons(){if(!this.isVisible)return;this.removeControls(),this.isVisible=!0;let t=this.getButtons(),e=[];this.options.drawControls===!1&&(e=e.concat(Object.keys(t).filter(i=>!t[i]._button.tool))),this.options.editControls===!1&&(e=e.concat(Object.keys(t).filter(i=>t[i]._button.tool==="edit"))),this.options.optionsControls===!1&&(e=e.concat(Object.keys(t).filter(i=>t[i]._button.tool==="options"))),this.options.customControls===!1&&(e=e.concat(Object.keys(t).filter(i=>t[i]._button.tool==="custom")));for(let i in t)if(this.options[i]&&e.indexOf(i)===-1){let r=t[i]._button.tool;r||(r="draw"),t[i].setPosition(this._getBtnPosition(r)),t[i].addTo(this.map)}},_getBtnPosition(t){return this.options.positions&&this.options.positions[t]?this.options.positions[t]:this.options.position},setBlockPosition(t,e){this.options.positions[t]=e,this._showHideButtons(),this.changeControlOrder()},getBlockPositions(){return this.options.positions},copyDrawControl(t,e){if(e)typeof e!="object"&&(e={name:e});else throw new TypeError("Button has no name");let i=this._btnNameMapping(t);if(!e.name)throw new TypeError("Button has no name");if(this.buttons[e.name])throw new TypeError("Button with this name already exists");let r=this.map.pm.Draw.createNewDrawInstance(e.name,i);e={...this.buttons[i]._button,...e};let s=this.createCustomControl(e);return{drawInstance:r,control:s}},createCustomControl(t){if(!t.name)throw new TypeError("Button has no name");if(this.buttons[t.name])throw new TypeError("Button with this name already exists");t.onClick||(t.onClick=()=>{}),t.afterClick||(t.afterClick=()=>{}),t.toggle!==!1&&(t.toggle=!0),t.block&&(t.block=t.block.toLowerCase()),(!t.block||t.block==="draw")&&(t.block=""),t.className?t.className.indexOf("control-icon")===-1&&(t.className=`control-icon ${t.className}`):t.className="control-icon";let e={tool:t.block,className:t.className,title:t.title||"",jsClass:t.name,onClick:t.onClick,afterClick:t.afterClick,doToggle:t.toggle,toggleStatus:!1,disableOtherButtons:t.disableOtherButtons??!0,disableByOtherButtons:t.disableByOtherButtons??!0,cssToggle:t.toggle,position:this.options.position,actions:t.actions||[],disabled:!!t.disabled};this.options[t.name]!==!1&&(this.options[t.name]=!0);let i=this._addButton(t.name,new L.Control.PMButton(e));return this.changeControlOrder(),i},controlExists(t){return!!this.getButton(t)},getButton(t){return this.getButtons()[t]},getButtonsInBlock(t){let e={};if(t)for(let i in this.getButtons()){let r=this.getButtons()[i];(r._button.tool===t||t==="draw"&&!r._button.tool)&&(e[i]=r)}return e},changeControlOrder(t=[]){let e=this._shapeMapping(),i=[];t.forEach(l=>{e[l]?i.push(e[l]):i.push(l)});let r=this.getButtons(),n={};i.forEach(l=>{r[l]&&(n[l]=r[l])}),Object.keys(r).filter(l=>!r[l]._button.tool||r[l]._button.tool==="draw").forEach(l=>{i.indexOf(l)===-1&&(n[l]=r[l])}),Object.keys(r).filter(l=>r[l]._button.tool==="edit").forEach(l=>{i.indexOf(l)===-1&&(n[l]=r[l])}),Object.keys(r).filter(l=>r[l]._button.tool==="options").forEach(l=>{i.indexOf(l)===-1&&(n[l]=r[l])}),Object.keys(r).filter(l=>r[l]._button.tool==="custom").forEach(l=>{i.indexOf(l)===-1&&(n[l]=r[l])}),Object.keys(r).forEach(l=>{i.indexOf(l)===-1&&(n[l]=r[l])}),this.map.pm.Toolbar.buttons=n,this._showHideButtons()},getControlOrder(){let t=this.getButtons(),e=[];for(let i in t)e.push(i);return e},changeActionsOfControl(t,e){let i=this._btnNameMapping(t);if(!i)throw new TypeError("No name passed");if(!e)throw new TypeError("No actions passed");if(!this.buttons[i])throw new TypeError("Button with this name not exists");this.buttons[i]._button.actions=e,this.changeControlOrder()},setButtonDisabled(t,e){let i=this._btnNameMapping(t);e?this.buttons[i].disable():this.buttons[i].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(t){let e=this._shapeMapping();return e[t]?e[t]:t}}),Oo=Hg;var Io=wt(Oe());var Xg={_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(t){t.forEach(e=>{if(Array.isArray(e)){this._assignEvents(e);return}e.off("drag",this._handleSnapping,this),e.on("drag",this._handleSnapping,this),e.off("dragend",this._cleanupSnapping,this),e.on("dragend",this._cleanupSnapping,this)})},_cleanupSnapping(t){if(t){let e=t.target;e._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(e=>{e.remove()})},_handleThrottleSnapping(){this.throttledList&&this._createSnapList()},_handleSnapping(t,e=!1){let i=t.target;if(i._snapped=!1,this.throttledList||(this.throttledList=L.Util.throttle(this._handleThrottleSnapping,100,this)),t?.originalEvent?.altKey||this._map?.pm?.Keyboard.isAltKeyPressed())return!1;let r;if(e){if(!this._otherSnapLayers||this._otherSnapLayers.length===0)return!1;r=this._otherSnapLayers}else this._snapList===void 0&&(this._createSnapList(),this._map.off("layeradd",this.throttledList,this),this._map.on("layeradd",this.throttledList,this)),r=this._snapList;if(r.length<=0)return!1;let n=this._calcClosestLayer(i.getLatLng(),r);if(Object.keys(n).length===0)return!1;let s=n.layer instanceof L.Marker||n.layer instanceof L.CircleMarker||!this.options.snapSegment,a;s?a=n.latlng:a=this._checkPrioritiySnapping(n);let o=this.options.snapDistance,h={marker:i,shape:this._shape,snapLatLng:a,segment:n.segment,layer:this._layer,workingLayer:this._layer,layerInteractedWith:n.layer,distance:n.distance};if(this._fireSnapDrag(h.marker,h),this._fireSnapDrag(this._layer,h),n.distance{this._snapLatLng=a,this._fireSnap(i,h),this._fireSnap(this._layer,h)},d=this._snapLatLng||{},f=a||{};(d.lat!==f.lat||d.lng!==f.lng)&&l()}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 t=[],e=[],i=this._map;i.off("layerremove",this._handleSnapLayerRemoval,this),i.on("layerremove",this._handleSnapLayerRemoval,this),i.eachLayer(r=>{if((r instanceof L.Polyline||r instanceof L.Marker||r instanceof L.CircleMarker||r instanceof L.ImageOverlay)&&r.options.snapIgnore!==!0){if(r.options.snapIgnore===void 0&&(!L.PM.optIn&&r.options.pmIgnore===!0||L.PM.optIn&&r.options.pmIgnore!==!1))return;(r instanceof L.Circle||r instanceof L.CircleMarker)&&r.pm&&r.pm._hiddenPolyCircle?t.push(r.pm._hiddenPolyCircle):r instanceof L.ImageOverlay&&(r=L.rectangle(r.getBounds())),t.push(r);let n=L.polyline([],{color:"red",pmIgnore:!0});n._pmTempLayer=!0,e.push(n),(r instanceof L.Circle||r instanceof L.CircleMarker)&&e.push(n)}}),t=t.filter(r=>this._layer!==r),t=t.filter(r=>r._latlng||r._latlngs&&me(r._latlngs)),t=t.filter(r=>!r._pmTempLayer),this._otherSnapLayers?(this._otherSnapLayers.forEach(()=>{let r=L.polyline([],{color:"red",pmIgnore:!0});r._pmTempLayer=!0,e.push(r)}),this._snapList=t.concat(this._otherSnapLayers)):this._snapList=t,this.debugIndicatorLines=e},_handleSnapLayerRemoval({layer:t}){if(!t._leaflet_id)return;let e=this._snapList.findIndex(i=>i._leaflet_id===t._leaflet_id);e>-1&&this._snapList.splice(e,1)},_calcClosestLayer(t,e){return this._calcClosestLayers(t,e,1)[0]},_calcClosestLayers(t,e,i=1){let r=[],n={};e.forEach((a,o)=>{if(a._parentCopy&&a._parentCopy===this._layer||a.getLatLngs?.().flat(5).length<2)return;let h=this._calcLayerDistances(t,a);if(h.distance=Math.floor(h.distance),this.debugIndicatorLines){if(!this.debugIndicatorLines[o]){let l=L.polyline([],{color:"red",pmIgnore:!0});l._pmTempLayer=!0,this.debugIndicatorLines[o]=l}this.debugIndicatorLines[o].setLatLngs([t,h.latlng])}i===1&&(n.distance===void 0||h.distance-5<=n.distance)?(h.distance+5a.distance-o.distance)),i===-1&&(i=r.length);let s=this._getClosestLayerByPriority(r,i);return L.Util.isArray(s)?s:[s]},_calcLayerDistances(t,e){let i=this._map,r=e instanceof L.Marker||e instanceof L.CircleMarker,n=e instanceof L.Polygon,s=t;if(r){let a=e.getLatLng();return{latlng:{...a},distance:this._getDistance(i,a,s)}}return this._calcLatLngDistances(s,e.getLatLngs(),i,n)},_calcLatLngDistances(t,e,i,r=!1){let n,s,a,o=h=>{h.forEach((l,d)=>{if(Array.isArray(l)){o(l);return}if(this.options.snapSegment){let f=l,k;r?k=d+1===h.length?0:d+1:k=d+1===h.length?void 0:d+1;let w=h[k];if(w){let S=this._getDistanceToSegment(i,t,f,w);(s===void 0||Sa._leaflet_id-o._leaflet_id);let i=["Marker","CircleMarker","Circle","Line","Polygon","Rectangle"],r=this._map.pm.globalOptions.snappingOrder||[],n=0,s={};return r.concat(i).forEach(a=>{s[a]||(n+=1,s[a]=n)}),t.sort(To("instanceofShape",s)),e===1?t[0]||{}:t.slice(0,e)},_checkPrioritiySnapping(t){let e=this._map,i=t.segment[0],r=t.segment[1],n=t.latlng,s=n;if(this.options.snapVertex){let a=this._getDistance(e,i,n),o=this._getDistance(e,r,n),h=a{this[i]=new L.PM.Draw[i](this._map)}),this.Marker.setOptions({continueDrawing:!0}),this.CircleMarker.setOptions({continueDrawing:!0})},setPathOptions(t,e=!1){e?this.options.pathOptions=(0,Io.default)(this.options.pathOptions,t):this.options.pathOptions=t},getShapes(){return this.shapes},getShape(){return this._shape},enable(t,e){if(!t)throw new Error(`Error: Please pass a shape as a parameter. Possible shapes are: ${this.getShapes().join(",")}`);this.disable(),this[t].enable(e)},disable(){this.shapes.forEach(t=>{this[t].disable()})},addControls(){this.shapes.forEach(t=>{this[t].addButton()})},getActiveShape(){let t;return this.shapes.forEach(e=>{this[e]._enabled&&(t=e)}),t},_setGlobalDrawMode(){this._shape==="Cut"?this._fireGlobalCutModeToggled():this._fireGlobalDrawModeToggled();let t=[];this._map.eachLayer(e=>{(e instanceof L.Polyline||e instanceof L.Marker||e instanceof L.Circle||e instanceof L.CircleMarker||e instanceof L.ImageOverlay)&&(e._pmTempLayer||t.push(e))}),this._enabled?t.forEach(e=>{L.PM.Utils.disablePopup(e)}):t.forEach(e=>{L.PM.Utils.enablePopup(e)})},createNewDrawInstance(t,e){let i=this._getShapeFromBtnName(e);if(this[t])throw new TypeError("Draw Type already exists");if(!L.PM.Draw[i])throw new TypeError(`There is no class L.PM.Draw.${i}`);return this[t]=new L.PM.Draw[i](this._map),this[t].toolbarButtonName=t,this[t]._shape=t,this.shapes.push(t),this[e]&&this[t].setOptions(this[e].options),this[t].setOptions(this[t].options),this[t]},_getShapeFromBtnName(t){let e={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 e[t]?e[t]:this[t]?this[t]._shape:t},_finishLayer(t){t.pm&&(t.pm.setOptions(this.options),t.pm._shape=this._shape,t.pm._map=this._map),this._addDrawnLayerProp(t)},_addDrawnLayerProp(t){t._drawnByGeoman=!0},_setPane(t,e){e==="layerPane"?t.options.pane=this._map.pm.globalOptions.panes&&this._map.pm.globalOptions.panes.layerPane||"overlayPane":e==="vertexPane"?t.options.pane=this._map.pm.globalOptions.panes&&this._map.pm.globalOptions.panes.vertexPane||"markerPane":e==="markerPane"&&(t.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}}),Y=Yg;Y.Marker=Y.extend({initialize(t){this._map=t,this._shape="Marker",this.toolbarButtonName="drawMarker",this._layerIsDragging=!1},enable(t){L.Util.setOptions(this,t),this._enabled=!0,this._isTouchDevice=!So(),this._map.getContainer().classList.add("geoman-draw-cursor"),this._map.on("click",this._createMarker,this),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!0),this._isTouchDevice?(this._createTouchHint(),this._hintMarker=L.marker(this._map.getCenter(),{...this.options.markerStyle,opacity:0,interactive:!1}),this._setPane(this._hintMarker,"markerPane"),this._hintMarker._pmTempLayer=!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(F("tooltips.placeMarker"),{permanent:!0,offset:L.point(0,10),direction:"bottom",opacity:.8}).openTooltip(),this._map.on("mousemove",this._syncHintMarker,this)),this._layer=this._hintMarker,this.options.markerEditable&&this._map.eachLayer(e=>{this.isRelevantMarker(e)&&e.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._isTouchDevice?(this._removeTouchHint(),this._hintMarker=null):(this._hintMarker.remove(),this._map.off("mousemove",this._syncHintMarker,this)),this._map.eachLayer(t=>{this.isRelevantMarker(t)&&t.pm.disable()}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this.options.snappable&&this._cleanupSnapping(),this._fireDrawEnd(),this._setGlobalDrawMode())},enabled(){return this._enabled},toggle(t){this.enabled()?this.disable():this.enable(t)},isRelevantMarker(t){return t instanceof L.Marker&&t.pm&&!t._pmTempLayer&&!t.pm._initTextMarker},_syncHintMarker(t){if(this._hintMarker.setLatLng(t.latlng),this.options.snappable){let e=t;e.target=this._hintMarker,this._handleSnapping(e)}this._fireChange(this._hintMarker.getLatLng(),"Draw")},_createMarker(t){if(!t.latlng||this._layerIsDragging||this.options.requireSnapToFinish&&!this._hintMarker._snapped&&!this._isFirstLayer())return;this._hintMarker._snapped||this._hintMarker.setLatLng(t.latlng);let e=this._hintMarker.getLatLng(),i=new L.Marker(e,this.options.markerStyle);this._setPane(i,"markerPane"),this._finishLayer(i),i.pm||(i.options.draggable=!1),i.addTo(this._map.pm._getContainingLayer()),i.pm&&this.options.markerEditable?i.pm.enable():i.dragging&&i.dragging.disable(),this._fireCreate(i),this._cleanupSnapping(),this.options.continueDrawing||this.disable()},setStyle(){this.options.markerStyle?.icon&&this._hintMarker?.setIcon(this.options.markerStyle.icon)},_createTouchHint(){this.options.tooltips&&(this._touchHint=L.DomUtil.create("div","leaflet-pm-touch-hint"),this._touchHint.textContent=F("tooltips.placeMarkerTouch"),this._map.getContainer().appendChild(this._touchHint))},_removeTouchHint(){this._touchHint&&this._touchHint.parentNode&&(this._touchHint.parentNode.removeChild(this._touchHint),this._touchHint=null)}});var lt=63710088e-1,Jg={centimeters:lt*100,centimetres:lt*100,degrees:360/(2*Math.PI),feet:lt*3.28084,inches:lt*39.37,kilometers:lt/1e3,kilometres:lt/1e3,meters:lt,metres:lt,miles:lt/1609.344,millimeters:lt*1e3,millimetres:lt*1e3,nauticalmiles:lt/1852,radians:1,yards:lt*1.0936};function ct(t,e,i={}){let r={type:"Feature"};return(i.id===0||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=e||{},r.geometry=t,r}function bt(t,e,i={}){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ao(t[0])||!Ao(t[1]))throw new Error("coordinates must contain numbers");return ct({type:"Point",coordinates:t},e,i)}function Tt(t,e,i={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return ct({type:"LineString",coordinates:t},e,i)}function rt(t,e={}){let i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function Go(t,e="kilometers"){let i=Jg[e];if(!i)throw new Error(e+" units is invalid");return t*i}function vi(t){return t%(2*Math.PI)*180/Math.PI}function Bt(t){return t%360*Math.PI/180}function Ao(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function xi(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function $g(t){let e,i,r={type:"FeatureCollection",features:[]};if(t.type==="Feature"?i=t.geometry:i=t,i.type==="LineString")e=[i.coordinates];else if(i.type==="MultiLineString")e=i.coordinates;else if(i.type==="MultiPolygon")e=[].concat(...i.coordinates);else if(i.type==="Polygon")e=i.coordinates;else throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");return e.forEach(n=>{e.forEach(s=>{for(let a=0;a=0&&l<=1&&(w.onLine1=!0),d>=0&&d<=1&&(w.onLine2=!0),w.onLine1&&w.onLine2?[w.x,w.y]:!1)}var Wt=$g;Y.Line=Y.extend({initialize(t){this._map=t,this._shape="Line",this.toolbarButtonName="drawPolyline",this._doesSelfIntersect=!1},enable(t){L.Util.setOptions(this,t),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(F("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(t){this.enabled()?this.disable():this.enable(t)},_syncHintLine(){let t=this._layer.getLatLngs();if(t.length>0){let e=t[t.length-1];this._hintline.setLatLngs([e,this._hintMarker.getLatLng()])}},_syncHintMarker(t){if(this._hintMarker.setLatLng(t.latlng),this.options.snappable){let i=t;i.target=this._hintMarker,this._handleSnapping(i)}else if(this._otherSnapLayers&&this._otherSnapLayers.length>0){let i=t;i.target=this._hintMarker,this._handleSnapping(i,!0)}this.options.allowSelfIntersection||this._handleSelfIntersection(!0,this._hintMarker.getLatLng());let e=this._layer._defaultShape().slice();e.push(this._hintMarker.getLatLng()),this._change(e)},hasSelfIntersection(){return Wt(this._layer.toGeoJSON(15)).features.length>0},_handleSelfIntersection(t,e){let i=L.polyline(this._layer.getLatLngs());t&&(e||(e=this._hintMarker.getLatLng()),i.addLatLng(e));let r=Wt(i.toGeoJSON(15));this._doesSelfIntersect=r.features.length>0,this._doesSelfIntersect?this.isRed||(this.isRed=!0,this._hintline.setStyle({color:"#f00000ff"}),this._fireIntersect(r,this._map,"Draw")):this._hintline.isEmpty()||(this.isRed=!1,this._hintline.setStyle(this.options.hintlineStyle))},_createVertex(t){if(!this.options.allowSelfIntersection&&(this._handleSelfIntersection(!0,t.latlng),this._doesSelfIntersect))return;this._hintMarker._snapped||this._hintMarker.setLatLng(t.latlng);let e=this._hintMarker.getLatLng(),i=this._layer.getLatLngs(),r=i[i.length-1];if(e.equals(i[0])||i.length>0&&e.equals(r)){this._finishShape();return}this._layer._latlngInfo=this._layer._latlngInfo||[],this._layer._latlngInfo.push({latlng:e,snapInfo:this._hintMarker._snapInfo}),this._layer.addLatLng(e);let n=this._createMarker(e);this._setTooltipText(),this._setHintLineAfterNewVertex(e),this._fireVertexAdded(n,void 0,e,"Draw"),this._change(this._layer.getLatLngs()),this.options.finishOn==="snap"&&this._hintMarker._snapped&&this._finishShape(t)},_setHintLineAfterNewVertex(t){this._hintline.setLatLngs([t,t])},_removeLastVertex(){let t=this._markers;if(t.length<=1){this.disable();return}let e=this._layer.getLatLngs(),i=t[t.length-1],{indexPath:r}=L.PM.Utils.findDeepMarkerIndex(t,i);t.pop(),this._layerGroup.removeLayer(i);let n=t[t.length-1],s=e.indexOf(n.getLatLng());e=e.slice(0,s+1),this._layer.setLatLngs(e),this._layer._latlngInfo.pop(),this._syncHintLine(),this._setTooltipText(),this._fireVertexRemoved(i,r,"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 t=this._layer.getLatLngs();if(t.length<=1)return;let e=L.polyline(t,this.options.pathOptions);this._setPane(e,"layerPane"),this._finishLayer(e),e.addTo(this._map.pm._getContainingLayer()),this._fireCreate(e),this.options.snappable&&this._cleanupSnapping();let i=this._hintMarker.getLatLng();this.disable(),this.options.continueDrawing&&(this.enable(),this._hintMarker.setLatLng(i))},_createMarker(t){let e=new L.Marker(t,{draggable:!1,icon:L.divIcon({className:"marker-icon"})});return this._setPane(e,"vertexPane"),e._pmTempLayer=!0,this._layerGroup.addLayer(e),this._markers.push(e),e.on("click",this._finishShape,this),e},_setTooltipText(){let{length:t}=this._layer.getLatLngs().flat(),e="";t<=1?e=F("tooltips.continueLine"):e=F("tooltips.finishLine"),this._hintMarker.setTooltipContent(e)},_change(t){this._fireChange(t,"Draw")},setStyle(){this._layer?.setStyle(this.options.templineStyle),this._hintline?.setStyle(this.options.hintlineStyle)}});Y.Polygon=Y.Line.extend({initialize(t){this._map=t,this._shape="Polygon",this.toolbarButtonName="drawPolygon"},enable(t){L.PM.Draw.Line.prototype.enable.call(this,t),this._layer.pm._shape="Polygon"},_createMarker(t){let e=new L.Marker(t,{draggable:!1,icon:L.divIcon({className:"marker-icon"})});return this._setPane(e,"vertexPane"),e._pmTempLayer=!0,this._layerGroup.addLayer(e),this._markers.push(e),this._layer.getLatLngs().flat().length===1?(e.on("click",this._finishShape,this),this._tempSnapLayerIndex=this._otherSnapLayers.push(e)-1,this.options.snappable&&this._cleanupSnapping()):e.on("click",()=>1),e},_setTooltipText(){let{length:t}=this._layer.getLatLngs().flat(),e="";t<=2?e=F("tooltips.continueLine"):e=F("tooltips.finishPoly"),this._hintMarker.setTooltipContent(e)},_finishShape(){if(!this.options.allowSelfIntersection&&(this._handleSelfIntersection(!0,this._layer.getLatLngs()[0]),this._doesSelfIntersect)||this.options.requireSnapToFinish&&!this._hintMarker._snapped&&!this._isFirstLayer())return;let t=this._layer.getLatLngs();if(t.length<=2)return;let e=L.polygon(t,this.options.pathOptions);this._setPane(e,"layerPane"),this._finishLayer(e),e.addTo(this._map.pm._getContainingLayer()),this._fireCreate(e),this._cleanupSnapping(),this._otherSnapLayers.splice(this._tempSnapLayerIndex,1),delete this._tempSnapLayerIndex;let i=this._hintMarker.getLatLng();this.disable(),this.options.continueDrawing&&(this.enable(),this._hintMarker.setLatLng(i))}});Y.Rectangle=Y.extend({initialize(t){this._map=t,this._shape="Rectangle",this.toolbarButtonName="drawRectangle"},enable(t){if(L.Util.setOptions(this,t),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(F("tooltips.firstVertex"),{permanent:!0,offset:L.point(0,10),direction:"bottom",opacity:.8}).openTooltip(),this.options.cursorMarker){this._styleMarkers=[];for(let e=0;e<2;e+=1){let i=L.marker(this._map.getCenter(),{icon:L.divIcon({className:"marker-icon rect-style-marker"}),draggable:!1,zIndexOffset:100});this._setPane(i,"vertexPane"),i._pmTempLayer=!0,this._layerGroup.addLayer(i),this._styleMarkers.push(i)}}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(t){this.enabled()?this.disable():this.enable(t)},_placeStartingMarkers(t){this._hintMarker._snapped||this._hintMarker.setLatLng(t.latlng);let e=this._hintMarker.getLatLng();L.DomUtil.addClass(this._startMarker._icon,"visible"),this._startMarker.setLatLng(e),this.options.cursorMarker&&this._styleMarkers&&this._styleMarkers.forEach(i=>{L.DomUtil.addClass(i._icon,"visible"),i.setLatLng(e)}),this._map.off("click",this._placeStartingMarkers,this),this._map.on("click",this._finishShape,this),this._hintMarker.setTooltipContent(F("tooltips.finishRect")),this._setRectangleOrigin()},_setRectangleOrigin(){let t=this._startMarker.getLatLng();t&&(this._layerGroup.addLayer(this._layer),this._layer.setLatLngs([t,t]),this._hintMarker.on("move",this._syncRectangleSize,this))},_syncHintMarker(t){if(this._hintMarker.setLatLng(t.latlng),this.options.snappable){let i=t;i.target=this._hintMarker,this._handleSnapping(i)}let e=this._layerGroup&&this._layerGroup.hasLayer(this._layer)?this._layer.getLatLngs():[this._hintMarker.getLatLng()];this._fireChange(e,"Draw")},_syncRectangleSize(){let t=ki(this._startMarker.getLatLng(),this._map),e=ki(this._hintMarker.getLatLng(),this._map),i=L.PM.Utils._getRotatedRectangle(t,e,this.options.rectangleAngle||0,this._map);if(this._layer.setLatLngs(i),this.options.cursorMarker&&this._styleMarkers){let r=[];i.forEach(n=>{!n.equals(t,1e-8)&&!n.equals(e,1e-8)&&r.push(n)}),r.forEach((n,s)=>{try{this._styleMarkers[s].setLatLng(n)}catch{}})}},_findCorners(){let t=this._layer.getLatLngs()[0];return L.PM.Utils._getRotatedRectangle(t[0],t[2],this.options.rectangleAngle||0,this._map)},_finishShape(t){t?.latlng&&!this._hintMarker._snapped&&this._hintMarker.setLatLng(t.latlng);let e=this._hintMarker.getLatLng(),i=this._startMarker.getLatLng();if(this.options.requireSnapToFinish&&!this._hintMarker._snapped&&!this._isFirstLayer()||i.equals(e))return;let r=L.rectangle([i,e],this.options.pathOptions);if(this.options.rectangleAngle){let s=L.PM.Utils._getRotatedRectangle(i,e,this.options.rectangleAngle||0,this._map);r.setLatLngs(s),r.pm&&r.pm._setAngle(this.options.rectangleAngle||0)}this._setPane(r,"layerPane"),this._finishLayer(r),r.addTo(this._map.pm._getContainingLayer()),this._fireCreate(r);let n=this._hintMarker.getLatLng();this.disable(),this.options.continueDrawing&&(this.enable(),this._hintMarker.setLatLng(n))},setStyle(){this._layer?.setStyle(this.options.pathOptions)}});Y.CircleMarker=Y.extend({initialize(t){this._map=t,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(t){if(L.Util.setOptions(this,t),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 e={};L.extend(e,this.options.templineStyle),e.radius=0,this._layerGroup=new L.FeatureGroup,this._layerGroup._pmTempLayer=!0,this._layerGroup.addTo(this._map),this._layer=new this._BaseCircleClass(this._map.getCenter(),e),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(F("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(F("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(t=>{this.isRelevantMarker(t)&&t.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(t=>{this.isRelevantMarker(t)&&t.pm.disable()})},enabled(){return this._enabled},toggle(t){this.enabled()?this.disable():this.enable(t)},_placeCenterMarker(t){this._hintMarker._snapped||this._hintMarker.setLatLng(t.latlng),this._layerGroup.addLayer(this._layer),this._layerGroup.addLayer(this._centerMarker);let e=this._hintMarker.getLatLng();this._centerMarker.setLatLng(e),this._map.off("click",this._placeCenterMarker,this),this._map.on("click",this._finishShape,this),this._placeCircleCenter()},_placeCircleCenter(){let t=this._centerMarker.getLatLng();t&&(this._layer.setLatLng(t),this._hintMarker.on("move",this._syncHintLine,this),this._hintMarker.on("move",this._syncCircleRadius,this),this._hintMarker.setTooltipContent(F("tooltips.finishCircle")),this._fireCenterPlaced(),this._fireChange(this._layer.getLatLng(),"Draw"))},_syncHintLine(){let t=this._centerMarker.getLatLng(),e=this._getNewDestinationOfHintMarker();this._hintline.setLatLngs([t,e])},_syncCircleRadius(){let t=this._centerMarker.getLatLng(),e=this._hintMarker.getLatLng(),i=this._distanceCalculation(t,e);this.options[this._minRadiusOption]&&ithis.options[this._maxRadiusOption]?this._layer.setRadius(this.options[this._maxRadiusOption]):this._layer.setRadius(i)},_syncHintMarker(t){if(this._hintMarker.setLatLng(t.latlng),this._hintMarker.setLatLng(this._getNewDestinationOfHintMarker()),this.options.snappable){let i=t;i.target=this._hintMarker,this._handleSnapping(i)}this._handleHintMarkerSnapping();let e=this._layerGroup&&this._layerGroup.hasLayer(this._centerMarker)?this._centerMarker.getLatLng():this._hintMarker.getLatLng();this._fireChange(e,"Draw")},isRelevantMarker(t){return t instanceof L.CircleMarker&&!(t instanceof L.Circle)&&t.pm&&!t._pmTempLayer},_createMarker(t){if(this.options.requireSnapToFinish&&!this._hintMarker._snapped&&!this._isFirstLayer()||!t.latlng||this._layerIsDragging)return;this._hintMarker._snapped||this._hintMarker.setLatLng(t.latlng);let e=this._hintMarker.getLatLng(),i=new this._BaseCircleClass(e,{radius:this._defaultRadius,...this.options.pathOptions});this._setPane(i,"layerPane"),this._finishLayer(i),i.addTo(this._map.pm._getContainingLayer()),this._extendingCreateMarker(i),this._fireCreate(i),this._cleanupSnapping(),this.options.continueDrawing||this.disable()},_extendingCreateMarker(t){t.pm&&this.options.markerEditable&&t.pm.enable()},_finishShape(t){if(this.options.requireSnapToFinish&&!this._hintMarker._snapped&&!this._isFirstLayer())return;t?.latlng&&!this._hintMarker._snapped&&this._hintMarker.setLatLng(t.latlng);let e=this._centerMarker.getLatLng(),i=this._defaultRadius;if(this.options[this._editableOption]){let a=this._hintMarker.getLatLng();i=this._distanceCalculation(e,a),this.options[this._minRadiusOption]&&ithis.options[this._maxRadiusOption]&&(i=this.options[this._maxRadiusOption])}let r={...this.options.pathOptions,radius:i},n=new this._BaseCircleClass(e,r);this._setPane(n,"layerPane"),this._finishLayer(n),n.addTo(this._map.pm._getContainingLayer()),n.pm&&n.pm._updateHiddenPolyCircle(),this._fireCreate(n);let s=this._hintMarker.getLatLng();this.disable(),this.options.continueDrawing&&(this.enable(),this._hintMarker.setLatLng(s))},_getNewDestinationOfHintMarker(){let t=this._hintMarker.getLatLng();if(this.options[this._editableOption]){if(!this._layerGroup.hasLayer(this._centerMarker))return t;let e=this._centerMarker.getLatLng(),i=this._distanceCalculation(e,t);this.options[this._minRadiusOption]&&ithis.options[this._maxRadiusOption]&&(t=Zt(this._map,e,t,this._getMaxDistanceInMeter()))}return t},_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 t=this._centerMarker.getLatLng(),e=this._hintMarker.getLatLng(),i=this._distanceCalculation(t,e);this._layerGroup.hasLayer(this._centerMarker)&&(this.options[this._minRadiusOption]&&ithis.options[this._maxRadiusOption]&&this._hintMarker.setLatLng(this._hintMarker._orgLatLng))}this._hintMarker.setLatLng(this._getNewDestinationOfHintMarker())}},setStyle(){let t={};L.extend(t,this.options.templineStyle),this.options[this._editableOption]&&(t.radius=0),this._layer?.setStyle(t),this._hintline?.setStyle(this.options.hintlineStyle)},_distanceCalculation(t,e){return this._map.project(t).distanceTo(this._map.project(e))}});Y.Circle=Y.CircleMarker.extend({initialize(t){this._map=t,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(t,e){return this._map.distance(t,e)}});var ze=class{constructor(e=[],i=Wg){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let e=this.data[0],i=this.data.pop();return this.length--,this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:i,compare:r}=this,n=i[e];for(;e>0;){let s=e-1>>1,a=i[s];if(r(n,a)>=0)break;i[e]=a,e=s}i[e]=n}_down(e){let{data:i,compare:r}=this,n=this.length>>1,s=i[e];for(;e=0)break;i[e]=o,e=a}i[e]=s}};function Wg(t,e){return te?1:0}function No(t,e){return t.p.x>e.p.x?1:t.p.xe.p.y?1:-1:1}function Qg(t,e){return t.rightSweepEvent.p.x>e.rightSweepEvent.p.x?1:t.rightSweepEvent.p.x0?(d.isLeftEndpoint=!0,l.isLeftEndpoint=!1):(l.isLeftEndpoint=!0,d.isLeftEndpoint=!1),e.push(l),e.push(d),a=o,Ne=Ne+1}}Ge=Ge+1}var wi=class{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}};function em(t,e){if(t===null||e===null||t.leftSweepEvent.ringId===e.leftSweepEvent.ringId&&(t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.rightSweepEvent)||t.leftSweepEvent.isSamePoint(e.leftSweepEvent)||t.leftSweepEvent.isSamePoint(e.rightSweepEvent)))return!1;let i=t.leftSweepEvent.p.x,r=t.leftSweepEvent.p.y,n=t.rightSweepEvent.p.x,s=t.rightSweepEvent.p.y,a=e.leftSweepEvent.p.x,o=e.leftSweepEvent.p.y,h=e.rightSweepEvent.p.x,l=e.rightSweepEvent.p.y,d=(l-o)*(n-i)-(h-a)*(s-r),f=(h-a)*(r-o)-(l-o)*(i-a),k=(n-i)*(r-o)-(s-r)*(i-a);if(d===0)return!1;let w=f/d,S=k/d;if(w>=0&&w<=1&&S>=0&&S<=1){let A=i+w*(n-i),g=r+w*(s-r);return[A,g]}return!1}function im(t,e){e=e||!1;let i=[],r=new ze([],Qg);for(;t.length;){let n=t.pop();if(n.isLeftEndpoint){let s=new wi(n);for(let a=0;a{let d=l.join(",");h[d]||(h[d]=!0,o.push(l))})}else o=a;return rt(o.map(h=>bt(h)))}var Dt=Ci;var Vo=wt(Fo(),1);function Le(t,e,i){if(t!==null)for(var r,n,s,a,o,h,l,d=0,f=0,k,w=t.type,S=w==="FeatureCollection",A=w==="Feature",g=S?t.features.length:1,M=0;M{i[0]>r[0]&&(i[0]=r[0]),i[1]>r[1]&&(i[1]=r[1]),i[2] is required");if(typeof i!="number")throw new Error(" must be a number");if(typeof r!="number")throw new Error(" must be a number");(n===!1||n===void 0)&&(t=JSON.parse(JSON.stringify(t)));var s=Math.pow(10,i);return Le(t,function(a){om(a,s,r)}),t}function om(t,e,i){t.length>i&&t.splice(i,t.length);for(var r=0;r=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return[...t];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function mt(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function ee(t){return t.type==="Feature"?t.geometry:t}function Bi(t,e){return t.type==="FeatureCollection"?"FeatureCollection":t.type==="GeometryCollection"?"GeometryCollection":t.type==="Feature"&&t.geometry!==null?t.geometry.type:t.type}function Ko(t){if(!t)throw new Error("geojson is required");let e=[];return te(t,i=>{lm(i,e)}),rt(e)}function lm(t,e){let i=[],r=t.geometry;if(r!==null){switch(r.type){case"Polygon":i=mt(r);break;case"LineString":i=[mt(r)]}i.forEach(n=>{hm(n,t.properties).forEach(a=>{a.id=e.length,e.push(a)})})}}function hm(t,e){let i=[];return t.reduce((r,n)=>{let s=Tt([r,n],e);return s.bbox=cm(r,n),i.push(s),n}),i}function cm(t,e){let i=t[0],r=t[1],n=e[0],s=e[1],a=in?i:n,l=r>s?r:s;return[a,o,h,l]}function je(t,e,i={}){var r=st(t),n=st(e),s=Bt(n[1]-r[1]),a=Bt(n[0]-r[0]),o=Bt(r[1]),h=Bt(n[1]),l=Math.pow(Math.sin(s/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(o)*Math.cos(h);return Go(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),i.units)}var um=Object.defineProperty,pm=Object.defineProperties,fm=Object.getOwnPropertyDescriptors,Ho=Object.getOwnPropertySymbols,dm=Object.prototype.hasOwnProperty,gm=Object.prototype.propertyIsEnumerable,Xo=(t,e,i)=>e in t?um(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,mm=(t,e)=>{for(var i in e||(e={}))dm.call(e,i)&&Xo(t,i,e[i]);if(Ho)for(var i of Ho(e))gm.call(e,i)&&Xo(t,i,e[i]);return t},_m=(t,e)=>pm(t,fm(e));function Jo(t,e,i={}){if(!t||!e)throw new Error("lines and inputPoint are required arguments");let r=st(e),n=bt([1/0,1/0],{lineStringIndex:-1,segmentIndex:-1,totalDistance:-1,lineDistance:-1,segmentDistance:-1,pointDistance:1/0,multiFeatureIndex:-1,index:-1,location:-1,dist:1/0}),s=0,a=0,o=-1;return te(t,function(h,l,d){o!==d&&(o=d,a=0);let f=mt(h);for(let k=0;k0?[[...e],!0]:[[...i],!1];let o=be(a,s);if(o[0]===0&&o[1]===0&&o[2]===0)return[[...e],!0];let h=be(o,a),l=Yo(h),d=[-l[0],-l[1],-l[2]],f=Gt(s,l)>Gt(s,d)?l:d,k=Yo(a),w=Gt(be(r,f),k),S=Gt(be(f,n),k);return w>=0&&S>=0?[Lm(f),!1]:Gt(r,s)>Gt(n,s)?[[...t],!1]:[[...e],!0]}function Ii(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");let i=Bi(t),r=Bi(e);if(i!=="LineString")throw new Error("line must be LineString");if(r==="FeatureCollection")throw new Error("splitter cannot be a FeatureCollection");if(r==="GeometryCollection")throw new Error("splitter cannot be a GeometryCollection");var n=Uo(e,{precision:7});switch(t.type!=="Feature"&&(t=ct(t)),r){case"Point":return Oi(t,n);case"MultiPoint":return $o(t,n);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return $o(t,Ci(t,n,{ignoreSelfIntersections:!0}))}}function $o(t,e){var i=[],r=Ti();return te(e,function(n){if(i.forEach(function(o,h){o.id=h}),!i.length)i=Oi(t,n).features,r.load(rt(i));else{var s=r.search(n);if(s.features.length){var a=Zo(n,s);i=i.filter(function(o){return o.id!==a.id}),r.remove(a),Qt(Oi(a,n),function(o){i.push(o),r.insert(o)})}}}),rt(i)}function Oi(t,e){var i=[],r=mt(t)[0],n=mt(t)[t.geometry.coordinates.length-1];if(Ri(r,st(e))||Ri(n,st(e)))return rt([t]);var s=Ti(),a=Ko(t);s.load(a);var o=s.search(e);if(!o.features.length)return rt([t]);var h=Zo(e,o),l=[r],d=jo(a,function(f,k,w){var S=mt(k)[1],A=st(e);return w===h.id?(f.push(A),i.push(Tt(f)),Ri(A,S)?[A]:[A,S]):(f.push(S),f)},l);return d.length>1&&i.push(Tt(d)),rt(i)}function Zo(t,e){if(!e.features.length)throw new Error("lines must contain features");if(e.features.length===1)return e.features[0];var i,r=1/0;return Qt(e,function(n){var s=Jo(n,t),a=s.properties.pointDistance;al==d>-l?(s=l,l=e[++f]):(s=d,d=r[++k]);let w=0;if(fl==d>-l?(a=l+s,o=s-(a-l),l=e[++f]):(a=d+s,o=s-(a-d),d=r[++k]),s=a,o!==0&&(n[w++]=o);fl==d>-l?(a=s+l,h=a-s,o=s-(a-h)+(l-h),l=e[++f]):(a=s+d,h=a-s,o=s-(a-h)+(d-h),d=r[++k]),s=a,o!==0&&(n[w++]=o);for(;f=E||-v>=E||(f=t-u,o=t-(u+f)+(f-n),f=i-p,l=i-(p+f)+(f-n),f=e-y,h=e-(y+f)+(f-s),f=r-_,d=r-(_+f)+(f-s),o===0&&h===0&&l===0&&d===0)||(E=vm*a+ke*Math.abs(v),v+=u*d+_*o-(y*l+p*h),v>=E||-v>=E))return v;R=o*_,k=Q*o,w=k-(k-o),S=o-w,k=Q*_,A=k-(k-_),g=_-A,I=S*g-(R-w*A-S*A-w*g),G=h*p,k=Q*h,w=k-(k-h),S=h-w,k=Q*p,A=k-(k-p),g=p-A,q=S*g-(G-w*A-S*A-w*g),M=I-q,f=I-M,at[0]=I-(M+f)+(f-q),m=R+M,f=m-R,O=R-(m-f)+(M-f),M=O-G,f=O-M,at[1]=O-(M+f)+(f-G),c=m+M,f=c-m,at[2]=m-(c-f)+(M-f),at[3]=c;let b=qt(4,ie,4,at,Qo);R=u*d,k=Q*u,w=k-(k-u),S=u-w,k=Q*d,A=k-(k-d),g=d-A,I=S*g-(R-w*A-S*A-w*g),G=y*l,k=Q*y,w=k-(k-y),S=y-w,k=Q*l,A=k-(k-l),g=l-A,q=S*g-(G-w*A-S*A-w*g),M=I-q,f=I-M,at[0]=I-(M+f)+(f-q),m=R+M,f=m-R,O=R-(m-f)+(M-f),M=O-G,f=O-M,at[1]=O-(M+f)+(f-G),c=m+M,f=c-m,at[2]=m-(c-f)+(M-f),at[3]=c;let x=qt(b,Qo,4,at,tl);R=o*d,k=Q*o,w=k-(k-o),S=o-w,k=Q*d,A=k-(k-d),g=d-A,I=S*g-(R-w*A-S*A-w*g),G=h*l,k=Q*h,w=k-(k-h),S=h-w,k=Q*l,A=k-(k-l),g=l-A,q=S*g-(G-w*A-S*A-w*g),M=I-q,f=I-M,at[0]=I-(M+f)+(f-q),m=R+M,f=m-R,O=R-(m-f)+(M-f),M=O-G,f=O-M,at[1]=O-(M+f)+(f-G),c=m+M,f=c-m,at[2]=m-(c-f)+(M-f),at[3]=c;let P=qt(x,tl,4,at,el);return el[P-1]}function Ai(t,e,i,r,n,s){let a=(e-s)*(i-n),o=(t-n)*(r-s),h=a-o,l=Math.abs(a+o);return Math.abs(h)>=km*l?h:-xm(t,e,i,r,n,s,l)}var Kk=(7+56*V)*V,Hk=(3+28*V)*V,Xk=(26+288*V)*V*V,Yk=D(4),Jk=D(4),$k=D(4),Zk=D(4),Wk=D(4),Qk=D(4),tM=D(4),eM=D(4),iM=D(4),rM=D(8),nM=D(8),sM=D(8),aM=D(4),oM=D(8),lM=D(8),hM=D(16),cM=D(12),uM=D(192),pM=D(192);var gM=(10+96*V)*V,mM=(4+48*V)*V,_M=(44+576*V)*V*V,yM=D(4),LM=D(4),bM=D(4),kM=D(4),MM=D(4),vM=D(4),xM=D(4),wM=D(4),CM=D(8),EM=D(8),PM=D(8),SM=D(8),TM=D(8),BM=D(8),DM=D(8),RM=D(8),OM=D(8),IM=D(4),AM=D(4),GM=D(4),qM=D(8),NM=D(16),zM=D(16),FM=D(16),jM=D(32),VM=D(32),UM=D(48),KM=D(64),HM=D(1152),XM=D(1152);var ZM=(16+224*V)*V,WM=(5+72*V)*V,QM=(71+1408*V)*V*V,tv=D(4),ev=D(4),iv=D(4),rv=D(4),nv=D(4),sv=D(4),av=D(4),ov=D(4),lv=D(4),hv=D(4),cv=D(24),uv=D(24),pv=D(24),fv=D(24),dv=D(24),gv=D(24),mv=D(24),_v=D(24),yv=D(24),Lv=D(24),bv=D(1152),kv=D(1152),Mv=D(1152),vv=D(1152),xv=D(1152),wv=D(2304),Cv=D(2304),Ev=D(3456),Pv=D(5760),Sv=D(8),Tv=D(8),Bv=D(8),Dv=D(16),Rv=D(24),Ov=D(48),Iv=D(48),Av=D(96),Gv=D(192),qv=D(384),Nv=D(384),zv=D(384),Fv=D(768);var jv=D(96),Vv=D(96),Uv=D(96),Kv=D(1152);function rl(t,e){var i,r,n=0,s,a,o,h,l,d,f,k=t[0],w=t[1],S=e.length;for(i=0;i=0||a<=0&&h>=0)return 0}else if(l>=0&&o<=0||l<=0&&o>=0){if(s=Ai(a,h,o,l,0,0),s===0)return 0;(s>0&&l>0&&o<=0||s<0&&l<=0&&o>0)&&n++}d=f,o=l,a=h}}return n%2!==0}function Nt(t,e,i={}){if(!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");let r=st(t),n=ee(e),s=n.type,a=e.bbox,o=n.coordinates;if(a&&Cm(r,a)===!1)return!1;s==="Polygon"&&(o=[o]);let h=!1;for(var l=0;l=t[0]&&e[3]>=t[1]}function re(t,e,i={}){let r=st(t),n=mt(e);for(let s=0;s"u"?null:i.epsilon))return!0}return!1}function Em(t,e,i,r,n){let s=i[0],a=i[1],o=t[0],h=t[1],l=e[0],d=e[1],f=i[0]-o,k=i[1]-h,w=l-o,S=d-h,A=f*S-k*w;if(n!==null){if(Math.abs(A)>n)return!1}else if(A!==0)return!1;if(Math.abs(w)===Math.abs(S)&&Math.abs(w)===0)return r?!1:i[0]===t[0]&&i[1]===t[1];if(r){if(r==="start")return Math.abs(w)>=Math.abs(S)?w>0?o0?h=Math.abs(S)?w>0?o<=s&&s0?h<=a&&a=Math.abs(S)?w>0?o0?h=Math.abs(S)?w>0?o<=s&&s<=l:l<=s&&s<=o:S>0?h<=a&&a<=d:d<=a&&a<=h;return!1}function Pm(t,e){let i=ee(t),r=ee(e),n=i.type,s=r.type,a=i.coordinates,o=r.coordinates;switch(n){case"Point":if(s==="Point")return qi(a,o);throw new Error("feature2 "+s+" geometry not supported");case"MultiPoint":switch(s){case"Point":return Bm(i,r);case"MultiPoint":return Dm(i,r);default:throw new Error("feature2 "+s+" geometry not supported")}case"LineString":switch(s){case"Point":return re(r,i,{ignoreEndVertices:!0});case"LineString":return Im(i,r);case"MultiPoint":return Rm(i,r);default:throw new Error("feature2 "+s+" geometry not supported")}case"Polygon":switch(s){case"Point":return Nt(r,i,{ignoreBoundary:!0});case"LineString":return Gm(i,r);case"Polygon":return Gi(i,r);case"MultiPoint":return Om(i,r);case"MultiPolygon":return Tm(i,r);default:throw new Error("feature2 "+s+" geometry not supported")}case"MultiPolygon":if(s==="Polygon")return Sm(i,r);throw new Error("feature2 "+s+" geometry not supported");default:throw new Error("feature1 "+n+" geometry not supported")}}function Sm(t,e){return t.coordinates.some(i=>Gi({type:"Polygon",coordinates:i},e))}function Tm(t,e){return e.coordinates.every(i=>Gi(t,{type:"Polygon",coordinates:i}))}function Bm(t,e){let i,r=!1;for(i=0;ie[0]||t[2]e[1]||t[3]f?C.c=C.e=null:c.e=10;E/=10,v++);v>f?C.c=C.e=null:(C.e=v,C.c=[c]);return}P=String(c)}else{if(!Nm.test(P=String(c)))return r(C,P,b);C.s=P.charCodeAt(0)==45?(P=P.slice(1),-1):1}(v=P.indexOf("."))>-1&&(P=P.replace(".","")),(E=P.search(/e/i))>0?(v<0&&(v=E),v+=+P.slice(E+1),P=P.substring(0,E)):v<0&&(v=P.length)}else{if($(u,2,g.length,"Base"),u==10&&M)return C=new m(c),G(C,a+C.e+1,o);if(P=String(c),b=typeof c=="number"){if(c*0!=0)return r(C,P,b,u);if(C.s=1/c<0?(P=P.slice(1),-1):1,m.DEBUG&&P.replace(/^0\.0*|\./,"").length>15)throw Error(al+c)}else C.s=P.charCodeAt(0)===45?(P=P.slice(1),-1):1;for(p=g.slice(0,u),v=E=0,x=P.length;Ev){v=x;continue}}else if(!_&&(P==P.toUpperCase()&&(P=P.toLowerCase())||P==P.toLowerCase()&&(P=P.toUpperCase()))){_=!0,E=-1,v=0;continue}return r(C,String(c),b,u)}b=!1,P=i(P,u,10,C.s),(v=P.indexOf("."))>-1?P=P.replace(".",""):v=P.length}for(E=0;P.charCodeAt(E)===48;E++);for(x=P.length;P.charCodeAt(--x)===48;);if(P=P.slice(E,++x)){if(x-=E,b&&m.DEBUG&&x>15&&(c>zi||c!==ft(c)))throw Error(al+C.s*c);if((v=v-E-1)>f)C.c=C.e=null;else if(v=-et&&_<=et&&_===ft(_)){if(y[0]===0){if(_===0&&y.length===1)return!0;break t}if(u=(_+1)%j,u<1&&(u+=j),String(y[0]).length==u){for(u=0;u=_t||p!==ft(p))break t;if(p!==0)return!0}}}else if(y===null&&_===null&&(v===null||v===1||v===-1))return!0;throw Error(ot+"Invalid BigNumber: "+c)},m.maximum=m.max=function(){return R(arguments,-1)},m.minimum=m.min=function(){return R(arguments,1)},m.random=(function(){var c=9007199254740992,u=Math.random()*c&2097151?function(){return ft(Math.random()*c)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(p){var y,_,v,E,b,x=0,P=[],C=new m(s);if(p==null?p=a:$(p,0,et),E=Ni(p/j),k)if(crypto.getRandomValues){for(y=crypto.getRandomValues(new Uint32Array(E*=2));x>>11),b>=9e15?(_=crypto.getRandomValues(new Uint32Array(2)),y[x]=_[0],y[x+1]=_[1]):(P.push(b%1e14),x+=2);x=E/2}else if(crypto.randomBytes){for(y=crypto.randomBytes(E*=7);x=9e15?crypto.randomBytes(7).copy(y,x):(P.push(b%1e14),x+=7);x=E/7}else throw k=!1,Error(ot+"crypto unavailable");if(!k)for(;x=10;b/=10,x++);x_-1&&(b[E+1]==null&&(b[E+1]=0),b[E+1]+=b[E]/_|0,b[E]%=_)}return b.reverse()}return function(p,y,_,v,E){var b,x,P,C,T,N,z,K,Z=p.indexOf("."),tt=a,U=o;for(Z>=0&&(C=S,S=0,p=p.replace(".",""),K=new m(y),N=K.pow(p.length-Z),S=C,K.c=u(Mt(pt(N.c),N.e,"0"),10,_,c),K.e=K.c.length),z=u(p,y,_,E?(b=g,c):(b=c,g)),P=C=z.length;z[--C]==0;z.pop());if(!z[0])return b.charAt(0);if(Z<0?--P:(N.c=z,N.e=P,N.s=v,N=e(N,K,tt,U,_),z=N.c,T=N.r,P=N.e),x=P+tt+1,Z=z[x],C=_/2,T=T||x<0||z[x+1]!=null,T=U<4?(Z!=null||T)&&(U==0||U==(N.s<0?3:2)):Z>C||Z==C&&(U==4||T||U==6&&z[x-1]&1||U==(N.s<0?8:7)),x<1||!z[0])p=T?Mt(b.charAt(1),-tt,b.charAt(0)):b.charAt(0);else{if(z.length=x,T)for(--_;++z[--x]>_;)z[x]=0,x||(++P,z=[1].concat(z));for(C=z.length;!z[--C];);for(Z=0,p="";Z<=C;p+=b.charAt(z[Z++]));p=Mt(p,P,b.charAt(0))}return p}})(),e=(function(){function c(y,_,v){var E,b,x,P,C=0,T=y.length,N=_%Rt,z=_/Rt|0;for(y=y.slice();T--;)x=y[T]%Rt,P=y[T]/Rt|0,E=z*x+P*N,b=N*x+E%Rt*Rt+C,C=(b/v|0)+(E/Rt|0)+z*P,y[T]=b%v;return C&&(y=[C].concat(y)),y}function u(y,_,v,E){var b,x;if(v!=E)x=v>E?1:-1;else for(b=x=0;b_[b]?1:-1;break}return x}function p(y,_,v,E){for(var b=0;v--;)y[v]-=b,b=y[v]<_[v]?1:0,y[v]=b*E+y[v]-_[v];for(;!y[0]&&y.length>1;y.splice(0,1));}return function(y,_,v,E,b){var x,P,C,T,N,z,K,Z,tt,U,H,it,Pe,We,Qe,yt,ne,ht=y.s==_.s?1:-1,nt=y.c,W=_.c;if(!nt||!nt[0]||!W||!W[0])return new m(!y.s||!_.s||(nt?W&&nt[0]==W[0]:!W)?NaN:nt&&nt[0]==0||!W?ht*0:ht/0);for(Z=new m(ht),tt=Z.c=[],P=y.e-_.e,ht=v+P+1,b||(b=_t,P=dt(y.e/j)-dt(_.e/j),ht=ht/j|0),C=0;W[C]==(nt[C]||0);C++);if(W[C]>(nt[C]||0)&&P--,ht<0)tt.push(1),T=!0;else{for(We=nt.length,yt=W.length,C=0,ht+=2,N=ft(b/(W[0]+1)),N>1&&(W=c(W,N,b),nt=c(nt,N,b),yt=W.length,We=nt.length),Pe=yt,U=nt.slice(0,yt),H=U.length;H=b/2&&Qe++;do{if(N=0,x=u(W,U,yt,H),x<0){if(it=U[0],yt!=H&&(it=it*b+(U[1]||0)),N=ft(it/Qe),N>1)for(N>=b&&(N=b-1),z=c(W,N,b),K=z.length,H=U.length;u(z,U,K,H)==1;)N--,p(z,yt=10;ht/=10,C++);G(Z,v+(Z.e=C+P*j-1)+1,E,T)}else Z.e=P,Z.r=+T;return Z}})();function O(c,u,p,y){var _,v,E,b,x;if(p==null?p=o:$(p,0,8),!c.c)return c.toString();if(_=c.c[0],E=c.e,u==null)x=pt(c.c),x=y==1||y==2&&(E<=h||E>=l)?Ue(x,E):Mt(x,E,"0");else if(c=G(new m(c),u,p),v=c.e,x=pt(c.c),b=x.length,y==1||y==2&&(u<=v||v<=h)){for(;bE),x=Mt(x,v,"0"),v+1>b){if(--u>0)for(x+=".";u--;x+="0");}else if(u+=v-b,u>0)for(v+1==b&&(x+=".");u--;x+="0");return c.s<0&&_?"-"+x:x}function R(c,u){for(var p,y,_=1,v=new m(c[0]);_=10;_/=10,y++);return(p=y+p*j-1)>f?c.c=c.e=null:p=10;b/=10,_++);if(v=u-_,v<0)v+=j,E=u,x=T[P=0],C=ft(x/N[_-E-1]%10);else if(P=Ni((v+1)/j),P>=T.length)if(y){for(;T.length<=P;T.push(0));x=C=0,_=1,v%=j,E=v-j+1}else break t;else{for(x=b=T[P],_=1;b>=10;b/=10,_++);v%=j,E=v-j+_,C=E<0?0:ft(x/N[_-E-1]%10)}if(y=y||u<0||T[P+1]!=null||(E<0?x:x%N[_-E-1]),y=p<4?(C||y)&&(p==0||p==(c.s<0?3:2)):C>5||C==5&&(p==4||y||p==6&&(v>0?E>0?x/N[_-E]:0:T[P-1])%10&1||p==(c.s<0?8:7)),u<1||!T[0])return T.length=0,y?(u-=c.e+1,T[0]=N[(j-u%j)%j],c.e=-u||0):T[0]=c.e=0,c;if(v==0?(T.length=P,b=1,P--):(T.length=P+1,b=N[j-v],T[P]=E>0?ft(x/N[_-E]%N[E])*b:0),y)for(;;)if(P==0){for(v=1,E=T[0];E>=10;E/=10,v++);for(E=T[0]+=b,b=1;E>=10;E/=10,b++);v!=b&&(c.e++,T[0]==_t&&(T[0]=1));break}else{if(T[P]+=b,T[P]!=_t)break;T[P--]=0,b=1}for(v=T.length;T[--v]===0;T.pop());}c.e>f?c.c=c.e=null:c.e=l?Ue(u,p):Mt(u,p,"0"),c.s<0?"-"+u:u)}return n.absoluteValue=n.abs=function(){var c=new m(this);return c.s<0&&(c.s=1),c},n.comparedTo=function(c,u){return zt(this,new m(c,u))},n.decimalPlaces=n.dp=function(c,u){var p,y,_,v=this;if(c!=null)return $(c,0,et),u==null?u=o:$(u,0,8),G(new m(v),c+v.e+1,u);if(!(p=v.c))return null;if(y=((_=p.length-1)-dt(this.e/j))*j,_=p[_])for(;_%10==0;_/=10,y--);return y<0&&(y=0),y},n.dividedBy=n.div=function(c,u){return e(this,new m(c,u),a,o)},n.dividedToIntegerBy=n.idiv=function(c,u){return e(this,new m(c,u),0,1)},n.exponentiatedBy=n.pow=function(c,u){var p,y,_,v,E,b,x,P,C,T=this;if(c=new m(c),c.c&&!c.isInteger())throw Error(ot+"Exponent not an integer: "+q(c));if(u!=null&&(u=new m(u)),b=c.e>14,!T.c||!T.c[0]||T.c[0]==1&&!T.e&&T.c.length==1||!c.c||!c.c[0])return C=new m(Math.pow(+q(T),b?c.s*(2-Ve(c)):+q(c))),u?C.mod(u):C;if(x=c.s<0,u){if(u.c?!u.c[0]:!u.s)return new m(NaN);y=!x&&T.isInteger()&&u.isInteger(),y&&(T=T.mod(u))}else{if(c.e>9&&(T.e>0||T.e<-1||(T.e==0?T.c[0]>1||b&&T.c[1]>=24e7:T.c[0]<8e13||b&&T.c[0]<=9999975e7)))return v=T.s<0&&Ve(c)?-0:0,T.e>-1&&(v=1/v),new m(x?1/v:v);S&&(v=Ni(S/j+2))}for(b?(p=new m(.5),x&&(c.s=1),P=Ve(c)):(_=Math.abs(+q(c)),P=_%2),C=new m(s);;){if(P){if(C=C.times(T),!C.c)break;v?C.c.length>v&&(C.c.length=v):y&&(C=C.mod(u))}if(_){if(_=ft(_/2),_===0)break;P=_%2}else if(c=c.times(p),G(c,c.e+1,1),c.e>14)P=Ve(c);else{if(_=+q(c),_===0)break;P=_%2}T=T.times(T),v?T.c&&T.c.length>v&&(T.c.length=v):y&&(T=T.mod(u))}return y?C:(x&&(C=s.div(C)),u?C.mod(u):v?G(C,S,o,E):C)},n.integerValue=function(c){var u=new m(this);return c==null?c=o:$(c,0,8),G(u,u.e+1,c)},n.isEqualTo=n.eq=function(c,u){return zt(this,new m(c,u))===0},n.isFinite=function(){return!!this.c},n.isGreaterThan=n.gt=function(c,u){return zt(this,new m(c,u))>0},n.isGreaterThanOrEqualTo=n.gte=function(c,u){return(u=zt(this,new m(c,u)))===1||u===0},n.isInteger=function(){return!!this.c&&dt(this.e/j)>this.c.length-2},n.isLessThan=n.lt=function(c,u){return zt(this,new m(c,u))<0},n.isLessThanOrEqualTo=n.lte=function(c,u){return(u=zt(this,new m(c,u)))===-1||u===0},n.isNaN=function(){return!this.s},n.isNegative=function(){return this.s<0},n.isPositive=function(){return this.s>0},n.isZero=function(){return!!this.c&&this.c[0]==0},n.minus=function(c,u){var p,y,_,v,E=this,b=E.s;if(c=new m(c,u),u=c.s,!b||!u)return new m(NaN);if(b!=u)return c.s=-u,E.plus(c);var x=E.e/j,P=c.e/j,C=E.c,T=c.c;if(!x||!P){if(!C||!T)return C?(c.s=-u,c):new m(T?E:NaN);if(!C[0]||!T[0])return T[0]?(c.s=-u,c):new m(C[0]?E:o==3?-0:0)}if(x=dt(x),P=dt(P),C=C.slice(),b=x-P){for((v=b<0)?(b=-b,_=C):(P=x,_=T),_.reverse(),u=b;u--;_.push(0));_.reverse()}else for(y=(v=(b=C.length)<(u=T.length))?b:u,b=u=0;u0)for(;u--;C[p++]=0);for(u=_t-1;y>b;){if(C[--y]=0;){for(p=0,N=it[_]%tt,z=it[_]/tt|0,E=x,v=_+E;v>_;)P=H[--E]%tt,C=H[E]/tt|0,b=z*P+C*N,P=N*P+b%tt*tt+K[v]+p,p=(P/Z|0)+(b/tt|0)+z*C,K[v--]=P%Z;K[v]=p}return p?++y:K.splice(0,1),I(c,K,y)},n.negated=function(){var c=new m(this);return c.s=-c.s||null,c},n.plus=function(c,u){var p,y=this,_=y.s;if(c=new m(c,u),u=c.s,!_||!u)return new m(NaN);if(_!=u)return c.s=-u,y.minus(c);var v=y.e/j,E=c.e/j,b=y.c,x=c.c;if(!v||!E){if(!b||!x)return new m(_/0);if(!b[0]||!x[0])return x[0]?c:new m(b[0]?y:_*0)}if(v=dt(v),E=dt(E),b=b.slice(),_=v-E){for(_>0?(E=v,p=x):(_=-_,p=b),p.reverse();_--;p.push(0));p.reverse()}for(_=b.length,u=x.length,_-u<0&&(p=x,x=b,b=p,u=_),_=0;u;)_=(b[--u]=b[u]+x[u]+_)/_t|0,b[u]=_t===b[u]?0:b[u]%_t;return _&&(b=[_].concat(b),++E),I(c,b,E)},n.precision=n.sd=function(c,u){var p,y,_,v=this;if(c!=null&&c!==!!c)return $(c,1,et),u==null?u=o:$(u,0,8),G(new m(v),c,u);if(!(p=v.c))return null;if(_=p.length-1,y=_*j+1,_=p[_]){for(;_%10==0;_/=10,y--);for(_=p[0];_>=10;_/=10,y++);}return c&&v.e+1>y&&(y=v.e+1),y},n.shiftedBy=function(c){return $(c,-zi,zi),this.times("1e"+c)},n.squareRoot=n.sqrt=function(){var c,u,p,y,_,v=this,E=v.c,b=v.s,x=v.e,P=a+4,C=new m("0.5");if(b!==1||!E||!E[0])return new m(!b||b<0&&(!E||E[0])?NaN:E?v:1/0);if(b=Math.sqrt(+q(v)),b==0||b==1/0?(u=pt(E),(u.length+x)%2==0&&(u+="0"),b=Math.sqrt(+u),x=dt((x+1)/2)-(x<0||x%2),b==1/0?u="5e"+x:(u=b.toExponential(),u=u.slice(0,u.indexOf("e")+1)+x),p=new m(u)):p=new m(b+""),p.c[0]){for(x=p.e,b=x+P,b<3&&(b=0);;)if(_=p,p=C.times(_.plus(e(v,_,P,1))),pt(_.c).slice(0,b)===(u=pt(p.c)).slice(0,b))if(p.e0&&K>0){for(v=K%b||b,C=z.substr(0,v);v0&&(C+=P+z.slice(v)),N&&(C="-"+C)}y=T?C+(p.decimalSeparator||"")+((x=+p.fractionGroupSize)?T.replace(new RegExp("\\d{"+x+"}\\B","g"),"$&"+(p.fractionGroupSeparator||"")):T):C}return(p.prefix||"")+y+(p.suffix||"")},n.toFraction=function(c){var u,p,y,_,v,E,b,x,P,C,T,N,z=this,K=z.c;if(c!=null&&(b=new m(c),!b.isInteger()&&(b.c||b.s!==1)||b.lt(s)))throw Error(ot+"Argument "+(b.isInteger()?"out of range: ":"not an integer: ")+q(b));if(!K)return new m(z);for(u=new m(s),P=p=new m(s),y=x=new m(s),N=pt(K),v=u.e=N.length-z.e-1,u.c[0]=Fi[(E=v%j)<0?j+E:E],c=!c||b.comparedTo(u)>0?v>0?u:P:b,E=f,f=1/0,b=new m(N),x.c[0]=0;C=e(b,u,0,1),_=p.plus(C.times(y)),_.comparedTo(c)!=1;)p=y,y=_,P=x.plus(C.times(_=P)),x=_,u=b.minus(C.times(_=u)),b=_;return _=e(c.minus(p),y,0,1),x=x.plus(_.times(P)),p=p.plus(_.times(y)),x.s=P.s=z.s,v=v*2,T=e(P,y,v,o).minus(z).abs().comparedTo(e(x,p,v,o).minus(z).abs())<1?[P,y]:[x,p],f=E,T},n.toNumber=function(){return+q(this)},n.toPrecision=function(c,u){return c!=null&&$(c,1,et),O(this,c,u,2)},n.toString=function(c){var u,p=this,y=p.s,_=p.e;return _===null?y?(u="Infinity",y<0&&(u="-"+u)):u="NaN":(c==null?u=_<=h||_>=l?Ue(pt(p.c),_):Mt(pt(p.c),_,"0"):c===10&&M?(p=G(new m(p),a+_+1,o),u=Mt(pt(p.c),p.e,"0")):($(c,2,g.length,"Base"),u=i(Mt(pt(p.c),_,"0"),10,c,y,!0)),y<0&&p.c[0]&&(u="-"+u)),u},n.valueOf=n.toJSON=function(){return q(this)},n._isBigNumber=!0,n[Symbol.toStringTag]="BigNumber",n[Symbol.for("nodejs.util.inspect.custom")]=n.valueOf,t!=null&&m.set(t),m}function dt(t){var e=t|0;return t>0||t===e?e:e-1}function pt(t){for(var e,i,r=1,n=t.length,s=t[0]+"";rl^i?1:-1;for(o=(h=n.length)<(l=s.length)?h:l,a=0;as[a]^i?1:-1;return h==l?0:h>l^i?1:-1}function $(t,e,i,r){if(ti||t!==ft(t))throw Error(ot+(r||"Argument")+(typeof t=="number"?ti?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function Ve(t){var e=t.c.length-1;return dt(t.e/j)==e&&t.c[e]%2!=0}function Ue(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function Mt(t,e,i){var r,n;if(e<0){for(n=i+".";++e;n+=i);t=n+t}else if(r=t.length,++e>r){for(n=i,e-=r;--e;n+=i);t+=n}else e0){let l=a.left;if(l==null||(h=o(l.key,t),h>0&&(a.left=l.right,l.right=a,a=l,l=a.left,l==null)))break;i==null?r=a:i.left=a,i=a,a=l}else if(h<0){let l=a.right;if(l==null||(h=o(l.key,t),h<0&&(a.right=l.left,l.left=a,a=l,l=a.right,l==null)))break;n==null?s=a:n.right=a,n=a,a=l}else break;return n!=null&&(n.right=a.left,a.left=s),i!=null&&(i.left=a.right,a.right=r),this.root!==a&&(this.root=a,this.splayCount++),h}splayMin(t){let e=t,i=e.left;for(;i!=null;){let r=i;e.left=r.right,r.right=e,e=r,i=e.left}return e}splayMax(t){let e=t,i=e.right;for(;i!=null;){let r=i;e.right=r.left,r.left=e,e=r,i=e.right}return e}_delete(t){if(this.root==null||this.splay(t)!=0)return null;let i=this.root,r=i,n=i.left;if(this.size--,n==null)this.root=i.right;else{let s=i.right;i=this.splayMax(n),i.right=s,this.root=i}return this.modificationCount++,r}addNewRoot(t,e){this.size++,this.modificationCount++;let i=this.root;if(i==null){this.root=t;return}e<0?(t.left=i,t.right=i.right,i.right=null):(t.right=i,t.left=i.left,i.left=null),this.root=t}_first(){let t=this.root;return t==null?null:(this.root=this.splayMin(t),this.root)}_last(){let t=this.root;return t==null?null:(this.root=this.splayMax(t),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(t){return this.validKey(t)&&this.splay(t)==0}defaultCompare(){return(t,e)=>te?1:0}wrap(){return{getRoot:()=>this.root,setRoot:t=>{this.root=t},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:t=>{this.splayCount=t},splay:t=>this.splay(t),has:t=>this.has(t)}}};var Ft=class xe extends jm{root=null;compare;validKey;constructor(e,i){super(),this.compare=e??this.defaultCompare(),this.validKey=i??(r=>r!=null&&r!=null)}delete(e){return this.validKey(e)?this._delete(e)!=null:!1}deleteAll(e){for(let i of e)this.delete(i)}forEach(e){let i=this[Symbol.iterator](),r;for(;r=i.next(),!r.done;)e(r.value,r.value,this)}add(e){let i=this.splay(e);return i!=0&&this.addNewRoot(new ve(e),i),this}addAndReturn(e){let i=this.splay(e);return i!=0&&this.addNewRoot(new ve(e),i),this.root.key}addAll(e){for(let i of e)this.add(i)}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(e){if(e==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(e)<0)return this.root.key;let r=this.root.left;if(r==null)return null;let n=r.right;for(;n!=null;)r=n,n=r.right;return r.key}firstAfter(e){if(e==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(e)>0)return this.root.key;let r=this.root.right;if(r==null)return null;let n=r.left;for(;n!=null;)r=n,n=r.left;return r.key}retainAll(e){let i=new xe(this.compare,this.validKey),r=this.modificationCount;for(let n of e){if(r!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(n)&&this.splay(n)==0&&i.add(this.root.key)}i.size!=this.size&&(this.root=i.root,this.size=i.size,this.modificationCount++)}lookup(e){return!this.validKey(e)||this.splay(e)!=0?null:this.root.key}intersection(e){let i=new xe(this.compare,this.validKey);for(let r of this)e.has(r)&&i.add(r);return i}difference(e){let i=new xe(this.compare,this.validKey);for(let r of this)e.has(r)||i.add(r);return i}union(e){let i=this.clone();return i.addAll(e),i}clone(){let e=new xe(this.compare,this.validKey);return e.size=this.size,e.root=this.copyNode(this.root),e}copyNode(e){if(e==null)return null;function i(n,s){let a,o;do{if(a=n.left,o=n.right,a!=null){let h=new ve(a.key);s.left=h,i(a,h)}if(o!=null){let h=new ve(o.key);s.right=h,n=o,s=h}}while(o!=null)}let r=new ve(e.key);return i(e,r),r}toSet(){return this.clone()}entries(){return new Um(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Vm(this.wrap())}[Symbol.toStringTag]="[object Set]"},ll=class{tree;path=new Array;modificationCount=null;splayCount;constructor(t){this.tree=t,this.splayCount=t.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 t=this.path[this.path.length-1];return this.getValue(t)}rebuildPath(t){this.path.splice(0,this.path.length),this.tree.splay(t),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(t){for(;t!=null;)this.path.push(t),t=t.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let i=this.tree.getRoot();for(;i!=null;)this.path.push(i),i=i.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 t=this.path[this.path.length-1],e=t.right;if(e!=null){for(;e!=null;)this.path.push(e),e=e.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===t;)t=this.path.pop();return this.path.length>0}},Vm=class extends ll{getValue(t){return t.key}},Um=class extends ll{getValue(t){return[t.key,t.key]}};var dl=t=>()=>t,ji=t=>{let e=t?(i,r)=>r.minus(i).abs().isLessThanOrEqualTo(t):dl(!1);return(i,r)=>e(i,r)?0:i.comparedTo(r)};function Km(t){let e=t?(i,r,n,s,a)=>i.exponentiatedBy(2).isLessThanOrEqualTo(s.minus(r).exponentiatedBy(2).plus(a.minus(n).exponentiatedBy(2)).times(t)):dl(!1);return(i,r,n)=>{let s=i.x,a=i.y,o=n.x,h=n.y,l=a.minus(h).times(r.x.minus(o)).minus(s.minus(o).times(r.y.minus(h)));return e(l,s,a,o,h)?0:l.comparedTo(0)}}var Hm=t=>t,Xm=t=>{if(t){let e=new Ft(ji(t)),i=new Ft(ji(t)),r=(s,a)=>a.addAndReturn(s),n=s=>({x:r(s.x,e),y:r(s.y,i)});return n({x:new gt(0),y:new gt(0)}),n}return Hm},Vi=t=>({set:e=>{vt=Vi(e)},reset:()=>Vi(t),compare:ji(t),snap:Xm(t),orient:Km(t)}),vt=Vi(),we=(t,e)=>t.ll.x.isLessThanOrEqualTo(e.x)&&e.x.isLessThanOrEqualTo(t.ur.x)&&t.ll.y.isLessThanOrEqualTo(e.y)&&e.y.isLessThanOrEqualTo(t.ur.y),Ui=(t,e)=>{if(e.ur.x.isLessThan(t.ll.x)||t.ur.x.isLessThan(e.ll.x)||e.ur.y.isLessThan(t.ll.y)||t.ur.y.isLessThan(e.ll.y))return null;let i=t.ll.x.isLessThan(e.ll.x)?e.ll.x:t.ll.x,r=t.ur.x.isLessThan(e.ur.x)?t.ur.x:e.ur.x,n=t.ll.y.isLessThan(e.ll.y)?e.ll.y:t.ll.y,s=t.ur.y.isLessThan(e.ur.y)?t.ur.y:e.ur.y;return{ll:{x:i,y:n},ur:{x:r,y:s}}},Ke=(t,e)=>t.x.times(e.y).minus(t.y.times(e.x)),gl=(t,e)=>t.x.times(e.x).plus(t.y.times(e.y)),Xe=t=>gl(t,t).sqrt(),Ym=(t,e,i)=>{let r={x:e.x.minus(t.x),y:e.y.minus(t.y)},n={x:i.x.minus(t.x),y:i.y.minus(t.y)};return Ke(n,r).div(Xe(n)).div(Xe(r))},Jm=(t,e,i)=>{let r={x:e.x.minus(t.x),y:e.y.minus(t.y)},n={x:i.x.minus(t.x),y:i.y.minus(t.y)};return gl(n,r).div(Xe(n)).div(Xe(r))},hl=(t,e,i)=>e.y.isZero()?null:{x:t.x.plus(e.x.div(e.y).times(i.minus(t.y))),y:i},cl=(t,e,i)=>e.x.isZero()?null:{x:i,y:t.y.plus(e.y.div(e.x).times(i.minus(t.x)))},$m=(t,e,i,r)=>{if(e.x.isZero())return cl(i,r,t.x);if(r.x.isZero())return cl(t,e,i.x);if(e.y.isZero())return hl(i,r,t.y);if(r.y.isZero())return hl(t,e,i.y);let n=Ke(e,r);if(n.isZero())return null;let s={x:i.x.minus(t.x),y:i.y.minus(t.y)},a=Ke(s,e).div(n),o=Ke(s,r).div(n),h=t.x.plus(o.times(e.x)),l=i.x.plus(a.times(r.x)),d=t.y.plus(o.times(e.y)),f=i.y.plus(a.times(r.y)),k=h.plus(l).div(2),w=d.plus(f).div(2);return{x:k,y:w}},kt=class ml{point;isLeft;segment;otherSE;consumedBy;static compare(e,i){let r=ml.comparePoints(e.point,i.point);return r!==0?r:(e.point!==i.point&&e.link(i),e.isLeft!==i.isLeft?e.isLeft?1:-1:Je.compare(e.segment,i.segment))}static comparePoints(e,i){return e.x.isLessThan(i.x)?-1:e.x.isGreaterThan(i.x)?1:e.y.isLessThan(i.y)?-1:e.y.isGreaterThan(i.y)?1:0}constructor(e,i){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=i}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");let i=e.point.events;for(let r=0,n=i.length;r{let s=n.otherSE;i.set(n,{sine:Ym(this.point,e.point,s.point),cosine:Jm(this.point,e.point,s.point)})};return(n,s)=>{i.has(n)||r(n),i.has(s)||r(s);let{sine:a,cosine:o}=i.get(n),{sine:h,cosine:l}=i.get(s);return a.isGreaterThanOrEqualTo(0)&&h.isGreaterThanOrEqualTo(0)?o.isLessThan(l)?1:o.isGreaterThan(l)?-1:0:a.isLessThan(0)&&h.isLessThan(0)?o.isLessThan(l)?-1:o.isGreaterThan(l)?1:0:h.isLessThan(a)?-1:h.isGreaterThan(a)?1:0}}},Zm=class Ki{events;poly;_isExteriorRing;_enclosingRing;static factory(e){let i=[];for(let r=0,n=e.length;r0&&(e=a)}let i=e.segment.prevInResult(),r=i?i.prevInResult():null;for(;;){if(!i)return null;if(!r)return i.ringOut;if(r.ringOut!==i.ringOut)return r.ringOut?.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut?.enclosingRing();i=r.prevInResult(),r=i?i.prevInResult():null}}},ul=class{exteriorRing;interiorRings;constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){let t=this.exteriorRing.getGeom();if(t===null)return null;let e=[t];for(let i=0,r=this.interiorRings.length;i0?(this.tree.delete(e),i.push(t)):(this.segments.push(e),e.prev=r)}else{if(r&&n){let s=r.getIntersection(n);if(s!==null){if(!r.isAnEndpoint(s)){let a=this._splitSafely(r,s);for(let o=0,h=a.length;o0)return-1;let k=i.comparePoint(e.rightSE.point);return k!==0?k:-1}if(r.isGreaterThan(n)){if(o.isLessThan(h)&&o.isLessThan(d))return-1;if(o.isGreaterThan(h)&&o.isGreaterThan(d))return 1;let f=i.comparePoint(e.leftSE.point);if(f!==0)return f;let k=e.comparePoint(i.rightSE.point);return k<0?1:k>0?-1:1}if(o.isLessThan(h))return-1;if(o.isGreaterThan(h))return 1;if(s.isLessThan(a)){let f=i.comparePoint(e.rightSE.point);if(f!==0)return f}if(s.isGreaterThan(a)){let f=e.comparePoint(i.rightSE.point);if(f<0)return 1;if(f>0)return-1}if(!s.eq(a)){let f=l.minus(o),k=s.minus(r),w=d.minus(h),S=a.minus(n);if(f.isGreaterThan(k)&&w.isLessThan(S))return 1;if(f.isLessThan(k)&&w.isGreaterThan(S))return-1}return s.isGreaterThan(a)?1:s.isLessThan(a)||l.isLessThan(d)?-1:l.isGreaterThan(d)?1:e.idi.id?1:0}constructor(e,i,r,n){this.id=++e_,this.leftSE=e,e.segment=this,e.otherSE=i,this.rightSE=i,i.segment=this,i.otherSE=e,this.rings=r,this.windings=n}static fromRing(e,i,r){let n,s,a,o=kt.comparePoints(e,i);if(o<0)n=e,s=i,a=1;else if(o>0)n=i,s=e,a=-1;else throw new Error(`Tried to create degenerate segment at [${e.x}, ${e.y}]`);let h=new kt(n,!0),l=new kt(s,!1);return new He(h,l,[r],[a])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let e=this.leftSE.point.y,i=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e.isLessThan(i)?e:i},ur:{x:this.rightSE.point.x,y:e.isGreaterThan(i)?e:i}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(e){return e.x.eq(this.leftSE.point.x)&&e.y.eq(this.leftSE.point.y)||e.x.eq(this.rightSE.point.x)&&e.y.eq(this.rightSE.point.y)}comparePoint(e){return vt.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){let i=this.bbox(),r=e.bbox(),n=Ui(i,r);if(n===null)return null;let s=this.leftSE.point,a=this.rightSE.point,o=e.leftSE.point,h=e.rightSE.point,l=we(i,o)&&this.comparePoint(o)===0,d=we(r,s)&&e.comparePoint(s)===0,f=we(i,h)&&this.comparePoint(h)===0,k=we(r,a)&&e.comparePoint(a)===0;if(d&&l)return k&&!f?a:!k&&f?h:null;if(d)return f&&s.x.eq(h.x)&&s.y.eq(h.y)?null:s;if(l)return k&&a.x.eq(o.x)&&a.y.eq(o.y)?null:o;if(k&&f)return null;if(k)return a;if(f)return h;let w=$m(s,this.vector(),o,e.vector());return w===null||!we(n,w)?null:vt.snap(w)}split(e){let i=[],r=e.events!==void 0,n=new kt(e,!0),s=new kt(e,!1),a=this.rightSE;this.replaceRightSE(s),i.push(s),i.push(n);let o=new He(n,a,this.rings.slice(),this.windings.slice());return kt.comparePoints(o.leftSE.point,o.rightSE.point)>0&&o.swapEvents(),kt.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(n.checkForConsuming(),s.checkForConsuming()),i}swapEvents(){let e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let i=0,r=this.windings.length;i0){let s=i;i=r,r=s}if(i.prev===r){let s=i;i=r,r=s}for(let s=0,a=r.rings.length;sn.length===1&&n[0].isSubject;this._isInResult=r(e)!==r(i);break}}return this._isInResult}},pl=class{poly;isExterior;segments;bbox;constructor(t,e,i){if(!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=i,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let r=vt.snap({x:new gt(t[0][0]),y:new gt(t[0][1])});this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let n=r;for(let s=1,a=t.length;sYe.run("intersection",t,e);var yl=(t,...e)=>Ye.run("difference",t,e),D0=vt.set;function Ze(t){let e={type:"Feature"};return e.geometry=t,e}function $e(t){return t.type==="Feature"?t.geometry:t}function Ll(t){return t&&t.geometry&&t.geometry.coordinates?t.geometry.coordinates:t}function n_(t){return Ze({type:"LineString",coordinates:t})}function s_(t){return Ze({type:"MultiLineString",coordinates:t})}function bl(t){return Ze({type:"Polygon",coordinates:t})}function kl(t){return Ze({type:"MultiPolygon",coordinates:t})}function Ml(t,e){let i=$e(t),r=$e(e),n=_l(i.coordinates,r.coordinates);return n.length===0?null:n.length===1?bl(n[0]):kl(n)}function vl(t,e){let i=$e(t),r=$e(e),n=yl(i.coordinates,r.coordinates);return n.length===0?null:n.length===1?bl(n[0]):kl(n)}function xl(t){return Array.isArray(t)?1+xl(t[0]):-1}function wl(t){t instanceof L.Polyline&&(t=t.toGeoJSON(15));let e=Ll(t),i=xl(e),r=[];return i>1?e.forEach(n=>{r.push(n_(n))}):r.push(t),r}function Cl(t){let e=[];return t.eachLayer(i=>{e.push(Ll(i.toGeoJSON(15)))}),s_(e)}Y.Cut=Y.Polygon.extend({initialize(t){this._map=t,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 t=this._layer.getLatLngs();if(t.length<=2)return;let e=L.polygon(t,this.options.pathOptions);e._latlngInfos=this._layer._latlngInfo,this.cut(e),this._cleanupSnapping(),this._otherSnapLayers.splice(this._tempSnapLayerIndex,1),delete this._tempSnapLayerIndex,this._editedLayers.forEach(({layer:r,originalLayer:n})=>{this._fireCut(n,r,n),this._fireCut(this._map,r,n),n.pm._fireEdit()}),this._editedLayers=[];let i=this._hintMarker.getLatLng();this.disable(),this.options.continueDrawing&&(this.enable(),this._hintMarker.setLatLng(i))},cut(t){let e=this._map._layers,i=t._latlngInfos||[];Object.keys(e).map(n=>e[n]).filter(n=>n.pm).filter(n=>!n._pmTempLayer).filter(n=>!L.PM.optIn&&!n.options.pmIgnore||L.PM.optIn&&n.options.pmIgnore===!1).filter(n=>n instanceof L.Polyline).filter(n=>n!==t).filter(n=>n.pm.options.allowCutting).filter(n=>this.options.layersToCut&&L.Util.isArray(this.options.layersToCut)&&this.options.layersToCut.length>0?this.options.layersToCut.indexOf(n)>-1:!0).filter(n=>!this._layerGroup.hasLayer(n)).filter(n=>{try{let s=!!Dt(t.toGeoJSON(15),n.toGeoJSON(15)).features.length>0;return s||n instanceof L.Polyline&&!(n instanceof L.Polygon)?s:!!Ml(t.toGeoJSON(15),n.toGeoJSON(15))}catch{return n instanceof L.Polygon&&console.error("You can't cut polygons with self-intersections"),!1}}).forEach(n=>{let s;if(n instanceof L.Polygon){s=L.polygon(n.getLatLngs());let l=s.getLatLngs();i.forEach(d=>{if(d&&d.snapInfo){let{latlng:f}=d,k=this._calcClosestLayer(f,[s]);if(k&&k.segment&&k.distance1?(0,El.default)(l,A):l).splice(g,0,f)}}}})}else s=n;let a=this._cutLayer(t,s),o=L.geoJSON(a,n.options);o.getLayers().length===1&&([o]=o.getLayers()),this._setPane(o,"layerPane");let h=o.addTo(this._map.pm._getContainingLayer());if(h.pm.enable(n.pm.options),h.pm.disable(),n._pmTempLayer=!0,t._pmTempLayer=!0,n.remove(),n.removeFrom(this._map.pm._getContainingLayer()),t.remove(),t.removeFrom(this._map.pm._getContainingLayer()),h.getLayers&&h.getLayers().length===0&&this._map.pm.removeLayer({target:h}),h instanceof L.LayerGroup?(h.eachLayer(l=>{this._addDrawnLayerProp(l)}),this._addDrawnLayerProp(h)):this._addDrawnLayerProp(h),this.options.layersToCut&&L.Util.isArray(this.options.layersToCut)&&this.options.layersToCut.length>0){let l=this.options.layersToCut.indexOf(n);l>-1&&this.options.layersToCut.splice(l,1)}this._editedLayers.push({layer:h,originalLayer:n})})},_cutLayer(t,e){let i=L.geoJSON(),r;if(e instanceof L.Polygon)r=vl(e.toGeoJSON(15),t.toGeoJSON(15));else{let n=wl(e);n.forEach(s=>{let a=Wo(s,t.toGeoJSON(15)),o;a&&a.features.length>0?o=L.geoJSON(a):o=L.geoJSON(s),o.getLayers().forEach(h=>{sl(t.toGeoJSON(15),h.toGeoJSON(15))||h.addTo(i)})}),n.length>1?r=Cl(i):r=i.toGeoJSON(15)}return r},_change:L.Util.falseFn});Y.Text=Y.extend({initialize(t){this._map=t,this._shape="Text",this.toolbarButtonName="drawText"},enable(t){L.Util.setOptions(this,t),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(F("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._showHintMarkerAfterMoving,this),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this.options.snappable&&this._cleanupSnapping(),this._fireDrawEnd(),this._setGlobalDrawMode())},enabled(){return this._enabled},toggle(t){this.enabled()?this.disable():this.enable(t)},_syncHintMarker(t){if(this._hintMarker.setLatLng(t.latlng),this.options.snappable){let e=t;e.target=this._hintMarker,this._handleSnapping(e)}},_createMarker(t){if(!t.latlng||this.options.requireSnapToFinish&&!this._hintMarker._snapped&&!this._isFirstLayer())return;this._hintMarker._snapped||this._hintMarker.setLatLng(t.latlng);let e=this._hintMarker.getLatLng();if(this.textArea=this._createTextArea(),this.options.textOptions?.className){let n=this.options.textOptions.className.split(" ");this.textArea.classList.add(...n)}let i=this._createTextIcon(this.textArea),r=new L.Marker(e,{textMarker:!0,_textMarkerOverPM:!0,icon:i});if(this._setPane(r,"markerPane"),this._finishLayer(r),r.pm||(r.options.draggable=!1),r.addTo(this._map.pm._getContainingLayer()),r.pm){r.pm.textArea=this.textArea,L.setOptions(r.pm,{removeIfEmpty:this.options.textOptions?.removeIfEmpty??!0});let n=this.options.textOptions?.focusAfterDraw??!0;r.pm._createTextMarker(n),this.options.textOptions?.text&&r.pm.setText(this.options.textOptions.text)}this._fireCreate(r),this._cleanupSnapping(),this.disable(),this.options.continueDrawing&&this._map.once("mousemove",this._showHintMarkerAfterMoving,this)},_showHintMarkerAfterMoving(t){this.enable(),this._hintMarker.setLatLng(t.latlng)},_createTextArea(){let t=document.createElement("textarea");return t.readOnly=!0,t.classList.add("pm-textarea","pm-disabled"),t},_createTextIcon(t){return L.divIcon({className:"pm-text-marker",html:t})}});var a_={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,St(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 t=this._getDOMElem();t&&(St(this._layer)instanceof L.Canvas?(this._layer.on("touchstart mousedown",this._dragMixinOnMouseDown,this),this._map.pm._addTouchEvents(t)):L.DomEvent.on(t,"touchstart mousedown",this._simulateMouseDownEvent,this)),this._fireDragEnable()},disableLayerDrag(){this._layerDragEnabled=!1,St(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 t=this._getDOMElem();t&&(St(this._layer)instanceof L.Canvas?(this._layer.off("touchstart mousedown",this._dragMixinOnMouseDown,this),this._map.pm._removeTouchEvents(t)):L.DomEvent.off(t,"touchstart mousedown",this._simulateMouseDownEvent,this)),this._layerDragged&&this._fireUpdate(),this._layerDragged=!1,this._fireDragDisable()},dragging(){return this._dragging},layerDragEnabled(){return!!this._layerDragEnabled},_simulateMouseDownEvent(t){let e=t.touches?t.touches[0]:t,i={originalEvent:e,target:this._layer};return i.containerPoint=this._map.mouseEventToContainerPoint(e),i.latlng=this._map.containerPointToLatLng(i.containerPoint),this._dragMixinOnMouseDown(i),!1},_simulateMouseMoveEvent(t){let e=t.touches?t.touches[0]:t,i={originalEvent:e,target:this._layer};return i.containerPoint=this._map.mouseEventToContainerPoint(e),i.latlng=this._map.containerPointToLatLng(i.containerPoint),this._dragMixinOnMouseMove(i),!1},_simulateMouseUpEvent(t){let i={originalEvent:t.touches?t.touches[0]:t,target:this._layer};return t.type.indexOf("touch")===-1&&(i.containerPoint=this._map.mouseEventToContainerPoint(t),i.latlng=this._map.containerPointToLatLng(i.containerPoint)),this._dragMixinOnMouseUp(i),!1},_dragMixinOnMouseDown(t){if(t.originalEvent.button>0)return;this._overwriteEventIfItComesFromMarker(t);let e=t._fromLayerSync,i=this._syncLayers("_dragMixinOnMouseDown",t);if(this._layer instanceof L.Marker&&(this.options.snappable&&!e&&!i?this._initSnappableMarkers():this._disableSnapping()),this._layer instanceof L.CircleMarker){let r="resizeableCircleMarker";this._layer instanceof L.Circle&&(r="resizeableCircle"),this.options.snappable&&!e&&!i?this._layer.pm.options[r]||this._initSnappableMarkersDrag():this._layer.pm.options[r]?this._layer.pm._disableSnapping():this._layer.pm._disableSnappingDrag()}this._safeToCacheDragState&&(this._originalMapDragState=this._layer._map.dragging._enabled,this._safeToCacheDragState=!1),this._tempDragCoord=t.latlng,L.DomEvent.on(this._map.getContainer(),"touchend mouseup",this._simulateMouseUpEvent,this),L.DomEvent.on(this._map.getContainer(),"touchmove mousemove",this._simulateMouseMoveEvent,this)},_dragMixinOnMouseMove(t){this._overwriteEventIfItComesFromMarker(t);let e=this._getDOMElem();this._syncLayers("_dragMixinOnMouseMove",t),this._dragging||(this._dragging=!0,L.DomUtil.addClass(e,"leaflet-pm-dragging"),this._layer instanceof L.Marker||this._layer.bringToFront(),this._originalMapDragState&&this._map.dragging.disable(),this._fireDragStart()),this._tempDragCoord||(this._tempDragCoord=t.latlng),this._onLayerDrag(t),this._layer instanceof L.CircleMarker&&this._layer.pm._updateHiddenPolyCircle()},_dragMixinOnMouseUp(t){let e=this._getDOMElem();return this._syncLayers("_dragMixinOnMouseUp",t),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,e&&L.DomUtil.removeClass(e,"leaflet-pm-dragging"),this._fireDragEnd(),this._fireEdit(),this._layerEdited=!0},10),!0):!1},_onLayerDrag(t){let{latlng:e}=t,i={lat:e.lat-this._tempDragCoord.lat,lng:e.lng-this._tempDragCoord.lng},r=n=>n.map(s=>{if(Array.isArray(s))return r(s);let a={lat:s.lat+i.lat,lng:s.lng+i.lng};return(s.alt||s.alt===0)&&(a.alt=s.alt),a});if(this._layer instanceof L.Circle&&this._layer.options.resizeableCircle||this._layer instanceof L.CircleMarker&&this._layer.options.resizeableCircleMarker){let n=r([this._layer.getLatLng()]);this._layer.setLatLng(n[0]),this._fireChange(this._layer.getLatLng(),"Edit")}else if(this._layer instanceof L.CircleMarker||this._layer instanceof L.Marker){let n=this._layer.getLatLng();this._layer._snapped&&(n=this._layer._orgLatLng);let s=r([n]);this._layer.setLatLng(s[0]),this._fireChange(this._layer.getLatLng(),"Edit")}else if(this._layer instanceof L.ImageOverlay){let n=r([this._layer.getBounds().getNorthWest(),this._layer.getBounds().getSouthEast()]);this._layer.setBounds(n),this._fireChange(this._layer.getBounds(),"Edit")}else{let n=r(this._layer.getLatLngs());this._layer.setLatLngs(n),this._fireChange(this._layer.getLatLngs(),"Edit")}this._tempDragCoord=e,t.layer=this._layer,this._fireDrag(t)},addDraggingClass(){let t=this._getDOMElem();t&&L.DomUtil.addClass(t,"leaflet-pm-draggable")},removeDraggingClass(){let t=this._getDOMElem();t&&L.DomUtil.removeClass(t,"leaflet-pm-draggable")},_getDOMElem(){let t=null;return this._layer._path?t=this._layer._path:this._layer._renderer&&this._layer._renderer._container?t=this._layer._renderer._container:this._layer._image?t=this._layer._image:this._layer._icon&&(t=this._layer._icon),t},_overwriteEventIfItComesFromMarker(t){t.target.getLatLng&&(!t.target._radius||t.target._radius<=10)&&(t.containerPoint=this._map.mouseEventToContainerPoint(t.originalEvent),t.latlng=this._map.containerPointToLatLng(t.containerPoint))},_syncLayers(t,e){if(this.enabled())return!1;if(!e._fromLayerSync&&this._layer===e.target&&this.options.syncLayersOnDrag){e._fromLayerSync=!0;let i=[];if(L.Util.isArray(this.options.syncLayersOnDrag))i=this.options.syncLayersOnDrag,this.options.syncLayersOnDrag.forEach(r=>{r instanceof L.LayerGroup&&(i=i.concat(r.pm.getLayers(!0)))});else if(this.options.syncLayersOnDrag===!0&&this._parentLayerGroup)for(let r in this._parentLayerGroup){let n=this._parentLayerGroup[r];n.pm&&(i=n.pm.getLayers(!0))}return L.Util.isArray(i)&&i.length>0&&(i=i.filter(r=>!!r.pm).filter(r=>!!r.pm.options.draggable),i.forEach(r=>{r!==this._layer&&r.pm[t]&&(r._snapped=!1,r.pm[t](e))})),i.length>0}return!1},_stopDOMImageDrag(t){return t.preventDefault(),!1}},Pl=a_;var Sl=wt(ge());function o_(t,e,i,r){return i.unproject(e.transform(i.project(t,r)),r)}function Hi(t,e,i){let r=i.getMaxZoom();if(r===1/0&&(r=i.getZoom()),L.Util.isArray(t)){let n=[];return t.forEach(s=>{n.push(Hi(s,e,i))}),n}return t instanceof L.LatLng?o_(t,e,i,r):null}function Ot(t,e){e instanceof L.Layer&&(e=e.getLatLng());let i=t.getMaxZoom();return i===1/0&&(i=t.getZoom()),t.project(e,i)}function Ee(t,e){let i=t.getMaxZoom();return i===1/0&&(i=t.getZoom()),t.unproject(e,i)}var l_={_onRotateStart(t){this._preventRenderingMarkers(!0),this._rotationOriginLatLng=this._getRotationCenter().clone(),this._rotationOriginPoint=Ot(this._map,this._rotationOriginLatLng),this._rotationStartPoint=Ot(this._map,t.target.getLatLng()),this._initialRotateLatLng=Lt(this._layer),this._startAngle=this.getAngle();let e=Lt(this._rotationLayer,this._rotationLayer.pm._rotateOrgLatLng);this._fireRotationStart(this._rotationLayer,e),this._fireRotationStart(this._map,e)},_onRotate(t){let e=Ot(this._map,t.target.getLatLng()),i=this._rotationStartPoint,r=this._rotationOriginPoint,n=Math.atan2(e.y-r.y,e.x-r.x)-Math.atan2(i.y-r.y,i.x-r.x);this._layer.setLatLngs(this._rotateLayer(n,this._initialRotateLatLng,this._rotationOriginLatLng,L.PM.Matrix.init(),this._map));let s=this;function a(d,f=[],k=-1){if(k>-1&&f.push(k),L.Util.isArray(d[0]))d.forEach((w,S)=>a(w,f.slice(),S));else{let w=f.length>0?(0,Sl.default)(s._markers,f):s._markers[0];d.forEach((S,A)=>{w[A].setLatLng(S)})}}a(this._layer.getLatLngs());let o=Lt(this._rotationLayer);this._rotationLayer.setLatLngs(this._rotateLayer(n,this._rotationLayer.pm._rotateOrgLatLng,this._rotationOriginLatLng,L.PM.Matrix.init(),this._map));let h=n*180/Math.PI;h=h<0?h+360:h;let l=h+this._startAngle;this._setAngle(l),this._rotationLayer.pm._setAngle(l),this._fireRotation(this._rotationLayer,h,o),this._fireRotation(this._map,h,o),this._rotationLayer.pm._fireChange(this._rotationLayer.getLatLngs(),"Rotation")},_onRotateEnd(){let t=this._startAngle;delete this._rotationOriginLatLng,delete this._rotationOriginPoint,delete this._rotationStartPoint,delete this._initialRotateLatLng,delete this._startAngle;let e=Lt(this._rotationLayer,this._rotationLayer.pm._rotateOrgLatLng);this._rotationLayer.pm._rotateOrgLatLng=Lt(this._rotationLayer),this._fireRotationEnd(this._rotationLayer,t,e),this._fireRotationEnd(this._map,t,e),this._rotationLayer.pm._fireEdit(this._rotationLayer,"Rotation"),this._preventRenderingMarkers(!1),this._layerRotated=!0},_rotateLayer(t,e,i,r,n){let s=Ot(n,i);return this._matrix=r.clone().rotate(t,s).flip(),Hi(e,this._matrix,n)},_setAngle(t){t=t<0?t+360:t,this._angle=t%360},_getRotationCenter(){if(this._rotationCenter)return this._rotationCenter;let t=L.polygon(this._layer.getLatLngs(),{stroke:!1,fill:!1,pmIgnore:!0}).addTo(this._layer._map),e=t.getCenter();return t.removeFrom(this._layer._map),e},enableRotate(){if(!this.options.allowRotation){this.disableRotate();return}this.rotateEnabled()&&this.disableRotate(),this._layer instanceof L.Rectangle&&this._angle===void 0&&this.setInitAngle(ye(this._layer._map,this._layer.getLatLngs()[0][0],this._layer.getLatLngs()[0][1])||0);let t={fill:!1,stroke:!1,pmIgnore:!1,snapIgnore:!0};this._rotatePoly=L.polygon(this._layer.getLatLngs(),t),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=Lt(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(t){let e=this.getAngle(),i=this._layer.getLatLngs(),r=t*(Math.PI/180);this._layer.setLatLngs(this._rotateLayer(r,this._layer.getLatLngs(),this._getRotationCenter(),L.PM.Matrix.init(),this._layer._map)),this._rotateOrgLatLng=L.polygon(this._layer.getLatLngs()).getLatLngs(),this._setAngle(this.getAngle()+t),this.rotateEnabled()&&this._rotatePoly&&this._rotatePoly.pm.enabled()&&(this._rotatePoly.setLatLngs(this._rotateLayer(r,this._rotatePoly.getLatLngs(),this._getRotationCenter(),L.PM.Matrix.init(),this._rotatePoly._map)),this._rotatePoly.pm._initMarkers());let n=this.getAngle()-e;n=n<0?n+360:n,this._startAngle=e,this._fireRotation(this._layer,n,i,this._layer),this._fireRotation(this._map||this._layer._map,n,i,this._layer),delete this._startAngle,this._fireChange(this._layer.getLatLngs(),"Rotation")},rotateLayerToAngle(t){let e=t-this.getAngle();this.rotateLayer(e)},getAngle(){return this._angle||0},setInitAngle(t){this._setAngle(t)},getRotationCenter(){return this._getRotationCenter()},setRotationCenter(t){this._rotationCenter=t,this._rotatePoly&&this._rotatePoly.pm.setRotationCenter(t)}},Tl=l_;var h_=L.Class.extend({includes:[Pl,Ae,Tl,Pt],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(t){L.Util.setOptions(this,t)},getOptions(){return this.options},applyOptions(){},isPolygon(){return this._layer instanceof L.Polygon},getShape(){return this._shape},_setPane(t,e){e==="layerPane"?t.options.pane=this._map.pm.globalOptions.panes&&this._map.pm.globalOptions.panes.layerPane||"overlayPane":e==="vertexPane"?t.options.pane=this._map.pm.globalOptions.panes&&this._map.pm.globalOptions.panes.vertexPane||"markerPane":e==="markerPane"&&(t.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(t,e){let i=e.target,r={layer:this._layer,marker:i,event:e},n="";return t==="move"?n="moveVertexValidation":t==="add"?n="addVertexValidation":t==="remove"&&(n="removeVertexValidation"),this.options[n]&&typeof this.options[n]=="function"&&!this.options[n](r)?(t==="move"&&(i._cancelDragEventChain=i.getLatLng()),!1):(i._cancelDragEventChain=null,!0)},_vertexValidationDrag(t){return t._cancelDragEventChain?(t._latlng=t._cancelDragEventChain,t.update(),!1):!0},_vertexValidationDragEnd(t){return t._cancelDragEventChain?(t._cancelDragEventChain=null,!1):!0}}),X=h_;X.LayerGroup=L.Class.extend({initialize(t){this._layerGroup=t,this._layers=this.getLayers(),this._getMap(),this._layers.forEach(r=>this._initLayer(r));let e=r=>{if(r.layer._pmTempLayer)return;this._layers=this.getLayers();let n=this._layers.filter(s=>!s.pm._parentLayerGroup||!(this._layerGroup._leaflet_id in s.pm._parentLayerGroup));n.forEach(s=>{this._initLayer(s)}),n.length>0&&this._getMap()&&this._getMap().pm.globalEditModeEnabled()&&this.enabled()&&this.enable(this.getOptions())};this._layerGroup.on("layeradd",L.Util.throttle(e,100,this),this),this._layerGroup.on("layerremove",r=>{this._removeLayerFromGroup(r.target)},this);let i=r=>{r.target._pmTempLayer||(this._layers=this.getLayers())};this._layerGroup.on("layerremove",L.Util.throttle(i,100,this),this)},enable(t,e=[]){e.length===0&&(this._layers=this.getLayers()),this._options=t,this._layers.forEach(i=>{i instanceof L.LayerGroup?e.indexOf(i._leaflet_id)===-1&&(e.push(i._leaflet_id),i.pm.enable(t,e)):i.pm.enable(t)})},disable(t=[]){t.length===0&&(this._layers=this.getLayers()),this._layers.forEach(e=>{e instanceof L.LayerGroup?t.indexOf(e._leaflet_id)===-1&&(t.push(e._leaflet_id),e.pm.disable(t)):e.pm.disable()})},enabled(t=[]){return t.length===0&&(this._layers=this.getLayers()),!!this._layers.find(i=>i instanceof L.LayerGroup?t.indexOf(i._leaflet_id)===-1?(t.push(i._leaflet_id),i.pm.enabled(t)):!1:i.pm.enabled())},toggleEdit(t,e=[]){e.length===0&&(this._layers=this.getLayers()),this._options=t,this._layers.forEach(i=>{i instanceof L.LayerGroup?e.indexOf(i._leaflet_id)===-1&&(e.push(i._leaflet_id),i.pm.toggleEdit(t,e)):i.pm.toggleEdit(t)})},_initLayer(t){let e=L.Util.stamp(this._layerGroup);t.pm._parentLayerGroup||(t.pm._parentLayerGroup={}),t.pm._parentLayerGroup[e]=this._layerGroup},_removeLayerFromGroup(t){if(t.pm&&t.pm._layerGroup){let e=L.Util.stamp(this._layerGroup);delete t.pm._layerGroup[e]}},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(t=>!!t._map)?._map||null},getLayers(t=!1,e=!0,i=!0,r=[]){let n=[];return t?this._layerGroup.getLayers().forEach(s=>{n.push(s),s instanceof L.LayerGroup&&r.indexOf(s._leaflet_id)===-1&&(r.push(s._leaflet_id),n=n.concat(s.pm.getLayers(!0,!0,!0,r)))}):n=this._layerGroup.getLayers(),i&&(n=n.filter(s=>!(s instanceof L.LayerGroup))),e&&(n=n.filter(s=>!!s.pm),n=n.filter(s=>!s._pmTempLayer),n=n.filter(s=>!L.PM.optIn&&!s.options.pmIgnore||L.PM.optIn&&s.options.pmIgnore===!1)),n},setOptions(t,e=[]){e.length===0&&(this._layers=this.getLayers()),this.options=t,this._layers.forEach(i=>{i.pm&&(i instanceof L.LayerGroup?e.indexOf(i._leaflet_id)===-1&&(e.push(i._leaflet_id),i.pm.setOptions(t,e)):i.pm.setOptions(t))})}});X.Marker=X.extend({_shape:"Marker",initialize(t){this._layer=t,this._enabled=!1,this._layer.on("dragend",this._onDragEnd,this)},enable(t={draggable:!0}){if(L.Util.setOptions(this,t),!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._layer.on("pm:dragstart",this._onDragStart,this),this._layer.on("pm:dragend",this._onMarkerDragEnd,this),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(t){this.enabled()?this.disable():this.enable(t)},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(t){let e=t.target;e.remove(),this._fireRemove(e),this._fireRemove(this._map,e)},_onDragStart(){this._map.pm.Draw.Marker._layerIsDragging=!0},_onMarkerDragEnd(){this._map.pm.Draw.Marker._layerIsDragging=!1},_onDragEnd(){this._fireEdit(),this._layerEdited=!0},_initSnappableMarkers(){let t=this._layer;this.options.snapDistance=this.options.snapDistance||30,this.options.snapSegment=this.options.snapSegment===void 0?!0:this.options.snapSegment,t.off("pm:drag",this._handleSnapping,this),t.on("pm:drag",this._handleSnapping,this),t.off("pm:dragend",this._cleanupSnapping,this),t.on("pm:dragend",this._cleanupSnapping,this),t.off("pm:dragstart",this._unsnap,this),t.on("pm:dragstart",this._unsnap,this)},_disableSnapping(){let t=this._layer;t.off("pm:drag",this._handleSnapping,this),t.off("pm:dragend",this._cleanupSnapping,this),t.off("pm:dragstart",this._unsnap,this)}});var xt=wt(ge());var c_={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 t=[...this._markerGroup.getLayers(),...this.markerCache];this.markerCache=t.filter((e,i,r)=>r.indexOf(e)===i)},_removeFromCache(t){let e=this.markerCache.indexOf(t);e>-1&&this.markerCache.splice(e,1)},renderLimits(t){this.markerCache.forEach(e=>{t.includes(e)?this._markerGroup.addLayer(e):this._markerGroup.removeLayer(e)})},applyLimitFilters({latlng:t={lat:0,lng:0}}){if(this._preventRenderMarkers)return;let i=[...this._filterClosestMarkers(t)];this.renderLimits(i)},_filterClosestMarkers(t){let e=[...this.markerCache],i=this.options.limitMarkersToCount;return i===-1?e:(e.sort((n,s)=>{let a=n._latlng.distanceTo(t),o=s._latlng.distanceTo(t);return a-o}),e.filter((n,s)=>i>-1?s{if(Array.isArray(r[0]))return r.map(i,this);let n=r.map(this._createMarker,this);return this.options.hideMiddleMarkers!==!0&&r.map((s,a)=>{let o=this.isPolygon()?(a+1)%r.length:a+1;return this._createMiddleMarker(n[a],n[o])}),n};this._markers=i(e),this.filterMarkerGroup(),t.addLayer(this._markerGroup)},_createMarker(t){let e=new L.Marker(t,{draggable:!0,icon:L.divIcon({className:"marker-icon"})});return this._setPane(e,"vertexPane"),e._pmTempLayer=!0,this.options.rotate?(e.on("dragstart",this._onRotateStart,this),e.on("drag",this._onRotate,this),e.on("dragend",this._onRotateEnd,this)):(e.on("click",this._onVertexClick,this),e.on("dragstart",this._onMarkerDragStart,this),e.on("move",this._onMarkerDrag,this),e.on("dragend",this._onMarkerDragEnd,this),this.options.preventMarkerRemoval||e.on(this.options.removeVertexOn,this._removeMarker,this)),this._markerGroup.addLayer(e),e},_createMiddleMarker(t,e){if(!t||!e)return!1;let i=L.PM.Utils.calcMiddleLatLng(this._map,t.getLatLng(),e.getLatLng()),r=this._createMarker(i),n=L.divIcon({className:"marker-icon marker-icon-middle"});return r.setIcon(n),r.leftM=t,r.rightM=e,t._middleMarkerNext=r,e._middleMarkerPrev=r,r.on(this.options.addVertexOn,this._onMiddleMarkerClick,this),r.on("movestart",this._onMiddleMarkerMoveStart,this),r},_onMiddleMarkerClick(t){let e=t.target;if(!this._vertexValidation("add",t))return;let i=L.divIcon({className:"marker-icon"});e.setIcon(i),this._addMarker(e,e.leftM,e.rightM)},_onMiddleMarkerMoveStart(t){let e=t.target;if(e.on("moveend",this._onMiddleMarkerMoveEnd,this),!this._vertexValidation("add",t)){e.on("move",this._onMiddleMarkerMovePrevent,this);return}e._dragging=!0,this._addMarker(e,e.leftM,e.rightM)},_onMiddleMarkerMovePrevent(t){let e=t.target;this._vertexValidationDrag(e)},_onMiddleMarkerMoveEnd(t){let e=t.target;if(e.off("move",this._onMiddleMarkerMovePrevent,this),e.off("moveend",this._onMiddleMarkerMoveEnd,this),!this._vertexValidationDragEnd(e))return;let i=L.divIcon({className:"marker-icon"});e.setIcon(i),setTimeout(()=>{delete e._dragging},100)},_addMarker(t,e,i){t.off("movestart",this._onMiddleMarkerMoveStart,this),t.off(this.options.addVertexOn,this._onMiddleMarkerClick,this);let r=t.getLatLng(),n=this._layer._latlngs;delete t.leftM,delete t.rightM;let{indexPath:s,index:a,parentPath:o}=L.PM.Utils.findDeepMarkerIndex(this._markers,e),h=s.length>1?(0,xt.default)(n,o):n,l=s.length>1?(0,xt.default)(this._markers,o):this._markers;h.splice(a+1,0,r),l.splice(a+1,0,t),this._layer.setLatLngs(n),this.options.hideMiddleMarkers!==!0&&(this._createMiddleMarker(e,t),this._createMiddleMarker(t,i)),this._fireEdit(),this._layerEdited=!0,this._fireChange(this._layer.getLatLngs(),"Edit"),this._fireVertexAdded(t,L.PM.Utils.findDeepMarkerIndex(this._markers,t).indexPath,r),this.options.snappable&&this._initSnappableMarkers()},hasSelfIntersection(){return Wt(this._layer.toGeoJSON(15)).features.length>0},_handleSelfIntersectionOnVertexRemoval(){this._handleLayerStyle(!0)&&(this._layer.setLatLngs(this._coordsBeforeEdit),this._coordsBeforeEdit=null,this._initMarkers())},_handleLayerStyle(t){let e=this._layer,i,r;if(this.options.allowSelfIntersection?i=!1:(r=Wt(this._layer.toGeoJSON(15)),i=r.features.length>0),i){if(!this.options.allowSelfIntersection&&this.options.allowSelfIntersectionEdit&&this._updateDisabledMarkerStyle(this._markers,!0),this.isRed)return i;t?this._flashLayer():(e.setStyle({color:"#f00000ff"}),this.isRed=!0),this._fireIntersect(r)}else e.setStyle({color:this.cachedColor}),this.isRed=!1,!this.options.allowSelfIntersection&&this.options.allowSelfIntersectionEdit&&this._updateDisabledMarkerStyle(this._markers,!1);return i},_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(t,e){t.forEach(i=>{Array.isArray(i)?this._updateDisabledMarkerStyle(i,e):i._icon&&(e&&!this._checkMarkerAllowedToDrag(i)?L.DomUtil.addClass(i._icon,"vertexmarker-disabled"):L.DomUtil.removeClass(i._icon,"vertexmarker-disabled"))})},_removeMarker(t){let e=t.target;if(!this._vertexValidation("remove",t))return;this.options.allowSelfIntersection||(this._coordsBeforeEdit=Lt(this._layer,this._layer.getLatLngs()));let i=this._layer.getLatLngs(),{indexPath:r,index:n,parentPath:s}=L.PM.Utils.findDeepMarkerIndex(this._markers,e);if(!r)return;let a=r.length>1?(0,xt.default)(i,s):i,o=r.length>1?(0,xt.default)(this._markers,s):this._markers,h=s[s.length-1]>0&&this._layer instanceof L.Polygon;if(!this.options.removeLayerBelowMinVertexCount&&!h&&(a.length<=2||this.isPolygon()&&a.length<=3)){this._flashLayer();return}a.splice(n,1),this._layer.setLatLngs(i),this.isPolygon()&&a.length<=2&&a.splice(0,a.length);let l=!1;if(a.length<=1&&(a.splice(0,a.length),s.length>1&&r.length>1&&(i=_e(i)),this._layer.setLatLngs(i),this._initMarkers(),l=!0),me(i)||this._layer.remove(),i=_e(i),this._layer.setLatLngs(i),this._markers=_e(this._markers),!l&&(o=r.length>1?(0,xt.default)(this._markers,s):this._markers,e._middleMarkerPrev&&(this._markerGroup.removeLayer(e._middleMarkerPrev),this._removeFromCache(e._middleMarkerPrev)),e._middleMarkerNext&&(this._markerGroup.removeLayer(e._middleMarkerNext),this._removeFromCache(e._middleMarkerNext)),this._markerGroup.removeLayer(e),this._removeFromCache(e),o)){let d,f;if(this.isPolygon()?(d=(n+1)%o.length,f=(n+(o.length-1))%o.length):(f=n-1<0?void 0:n-1,d=n+1>=o.length?void 0:n+1),d!==f){let k=o[f],w=o[d];this.options.hideMiddleMarkers!==!0&&this._createMiddleMarker(k,w)}o.splice(n,1)}this._fireEdit(),this._layerEdited=!0,this._fireVertexRemoved(e,r),this._fireChange(this._layer.getLatLngs(),"Edit")},updatePolygonCoordsFromMarkerDrag(t){let e=this._layer.getLatLngs(),i=t.getLatLng(),{indexPath:r,index:n,parentPath:s}=L.PM.Utils.findDeepMarkerIndex(this._markers,t),a=r.length>1?(0,xt.default)(e,s):e;i.alt=a[n].alt,a.splice(n,1,i),this._layer.setLatLngs(e)},_getNeighborMarkers(t){let{indexPath:e,index:i,parentPath:r}=L.PM.Utils.findDeepMarkerIndex(this._markers,t),n=e.length>1?(0,xt.default)(this._markers,r):this._markers,s=(i+1)%n.length,a=(i+(n.length-1))%n.length,o=n[a],h=n[s];return{prevMarker:o,nextMarker:h}},_checkMarkerAllowedToDrag(t){let{prevMarker:e,nextMarker:i}=this._getNeighborMarkers(t),r=L.polyline([e.getLatLng(),t.getLatLng()]),n=L.polyline([t.getLatLng(),i.getLatLng()]),a=Dt(this._layer.toGeoJSON(15),r.toGeoJSON(15)).features.filter(l=>{let d=l.geometry.coordinates,f=L.latLng(d[1],d[0]);return!f.equals(e.getLatLng())&&!f.equals(t.getLatLng())}).length,h=Dt(this._layer.toGeoJSON(15),n.toGeoJSON(15)).features.filter(l=>{let d=l.geometry.coordinates,f=L.latLng(d[1],d[0]);return!f.equals(i.getLatLng())&&!f.equals(t.getLatLng())}).length;return!(a<1&&h<1)},_onMarkerDragStart(t){let e=t.target;if(this._preventRenderingMarkers(!0),this.cachedColor||(this.cachedColor=this._layer.options.color),!this._vertexValidation("move",t))return;let{indexPath:i}=L.PM.Utils.findDeepMarkerIndex(this._markers,e);this._fireMarkerDragStart(t,i),this.options.allowSelfIntersection||(this._coordsBeforeEdit=Lt(this._layer,this._layer.getLatLngs())),!this.options.allowSelfIntersection&&this.options.allowSelfIntersectionEdit&&this.hasSelfIntersection()?this._markerAllowedToDrag=this._checkMarkerAllowedToDrag(e):this._markerAllowedToDrag=null},_onMarkerDrag(t){let e=t.target;if(!this._vertexValidationDrag(e))return;let{indexPath:i,index:r,parentPath:n}=L.PM.Utils.findDeepMarkerIndex(this._markers,e);if(!i)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(e);let s=i.length>1?(0,xt.default)(this._markers,n):this._markers,a=(r+1)%s.length,o=(r+(s.length-1))%s.length,h=e.getLatLng(),l=s[o].getLatLng(),d=s[a].getLatLng();if(e._middleMarkerNext){let f=L.PM.Utils.calcMiddleLatLng(this._map,h,d);e._middleMarkerNext.setLatLng(f)}if(e._middleMarkerPrev){let f=L.PM.Utils.calcMiddleLatLng(this._map,h,l);e._middleMarkerPrev.setLatLng(f)}this.options.allowSelfIntersection||this._handleLayerStyle(),this._fireMarkerDrag(t,i),this._fireChange(this._layer.getLatLngs(),"Edit")},_onMarkerDragEnd(t){let e=t.target;if(this._preventRenderingMarkers(!1),!this._vertexValidationDragEnd(e))return;let{indexPath:i}=L.PM.Utils.findDeepMarkerIndex(this._markers,e),r=!this.options.allowSelfIntersection&&this.hasSelfIntersection();r&&this.options.allowSelfIntersectionEdit&&this._markerAllowedToDrag&&(r=!1);let n=!this.options.allowSelfIntersection&&r;if(this._fireMarkerDragEnd(t,i,n),n){this._layer.setLatLngs(this._coordsBeforeEdit),this._coordsBeforeEdit=null,this._initMarkers(),this.options.snappable&&this._initSnappableMarkers(),this._handleLayerStyle(),this._fireLayerReset(t,i);return}!this.options.allowSelfIntersection&&this.options.allowSelfIntersectionEdit&&this._handleLayerStyle(),this._fireEdit(),this._layerEdited=!0,this._fireChange(this._layer.getLatLngs(),"Edit")},_onVertexClick(t){let e=t.target;if(e._dragging)return;let{indexPath:i}=L.PM.Utils.findDeepMarkerIndex(this._markers,e);this._fireVertexClick(t,i)}});X.Polygon=X.Line.extend({_shape:"Polygon",_checkMarkerAllowedToDrag(t){let{prevMarker:e,nextMarker:i}=this._getNeighborMarkers(t),r=L.polyline([e.getLatLng(),t.getLatLng()]),n=L.polyline([t.getLatLng(),i.getLatLng()]),a=Dt(this._layer.toGeoJSON(15),r.toGeoJSON(15)).features.filter(l=>{let d=l.geometry.coordinates,f=L.latLng(d[1],d[0]);return!f.equals(e.getLatLng())&&!f.equals(t.getLatLng())}).length,h=Dt(this._layer.toGeoJSON(15),n.toGeoJSON(15)).features.filter(l=>{let d=l.geometry.coordinates,f=L.latLng(d[1],d[0]);return!f.equals(i.getLatLng())&&!f.equals(t.getLatLng())}).length;return!(a<1&&h<1)}});X.Rectangle=X.Polygon.extend({_shape:"Rectangle",_initMarkers(){let t=this._map,e=this._findCorners();this._markerGroup&&this._markerGroup.clearLayers(),this._markerGroup=new L.FeatureGroup,this._markerGroup._pmTempLayer=!0,t.addLayer(this._markerGroup),this._markers=[],this._markers[0]=e.map(this._createMarker,this),[this._cornerMarkers]=this._markers,this._layer.getLatLngs()[0].forEach((i,r)=>{let n=this._cornerMarkers.find(s=>s._index===r);n&&n.setLatLng(i)})},applyOptions(){this.options.snappable?this._initSnappableMarkers():this._disableSnapping(),this._addMarkerEvents()},_createMarker(t,e){let i=new L.Marker(t,{draggable:!0,icon:L.divIcon({className:"marker-icon"})});return this._setPane(i,"vertexPane"),i._origLatLng=t,i._index=e,i._pmTempLayer=!0,i.on("click",this._onVertexClick,this),this._markerGroup.addLayer(i),i},_addMarkerEvents(){this._markers[0].forEach(t=>{t.on("dragstart",this._onMarkerDragStart,this),t.on("drag",this._onMarkerDrag,this),t.on("dragend",this._onMarkerDragEnd,this),this.options.preventMarkerRemoval||t.on("contextmenu",this._removeMarker,this)})},_removeMarker(){return null},_onMarkerDragStart(t){if(!this._vertexValidation("move",t))return;let e=t.target,i=this._cornerMarkers;e._oppositeCornerLatLng=i.find(n=>n._index===(e._index+2)%4).getLatLng(),e._snapped=!1;let{indexPath:r}=L.PM.Utils.findDeepMarkerIndex(this._markers,e);this._fireMarkerDragStart(t,r)},_onMarkerDrag(t){let e=t.target;if(!this._vertexValidationDrag(e)||e._index===void 0)return;this._adjustRectangleForMarkerMove(e);let{indexPath:i}=L.PM.Utils.findDeepMarkerIndex(this._markers,e);this._fireMarkerDrag(t,i),this._fireChange(this._layer.getLatLngs(),"Edit")},_onMarkerDragEnd(t){let e=t.target;if(!this._vertexValidationDragEnd(e))return;this._cornerMarkers.forEach(r=>{delete r._oppositeCornerLatLng});let{indexPath:i}=L.PM.Utils.findDeepMarkerIndex(this._markers,e);this._fireMarkerDragEnd(t,i),this._fireEdit(),this._layerEdited=!0,this._fireChange(this._layer.getLatLngs(),"Edit")},_adjustRectangleForMarkerMove(t){L.extend(t._origLatLng,t._latlng);let e=L.PM.Utils._getRotatedRectangle(t.getLatLng(),t._oppositeCornerLatLng,this.getAngle(),this._map);this._layer.setLatLngs(e),this._adjustAllMarkers(t),this._layer.redraw()},_adjustAllMarkers(t){let e=this._layer.getLatLngs()[0];if(e&&e.length!==4&&e.length>0)e.forEach((r,n)=>{this._cornerMarkers[n].setLatLng(r)}),this._cornerMarkers.slice(e.length).forEach(r=>{r.setLatLng(e[0])});else if(!e||!e.length)console.error("The layer has no LatLngs");else{let i=e.findIndex(r=>t.getLatLng().equals(r));i>-1?(this._cornerMarkers[(t._index+1)%4].setLatLng(e[(i+1)%4]),this._cornerMarkers[(t._index+2)%4].setLatLng(e[(i+2)%4]),this._cornerMarkers[(t._index+3)%4].setLatLng(e[(i+3)%4])):this._cornerMarkers.forEach(r=>{r.setLatLng(e[r._index])})}},_findCorners(){this._angle===void 0&&this.setInitAngle(ye(this._map,this._layer.getLatLngs()[0][0],this._layer.getLatLngs()[0][1])||0);let t=this._layer.getLatLngs()[0];return L.PM.Utils._getRotatedRectangle(t[0],t[2],this.getAngle(),this._map||this)}});X.CircleMarker=X.extend({_shape:"CircleMarker",initialize(t){this._layer=t,this._enabled=!1,this._minRadiusOption="minRadiusCircleMarker",this._maxRadiusOption="maxRadiusCircleMarker",this._editableOption="resizeableCircleMarker",this._updateHiddenPolyCircle()},enable(t={draggable:!0,snappable:!0}){if(L.Util.setOptions(this,t),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(t){this.enabled()?this.disable():this.enable(t)},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 t=this._map;this._helperLayers&&(this._helperLayers.removeFrom(t),this._helperLayers.clearLayers()),this._helperLayers=new L.FeatureGroup,this._helperLayers._pmTempLayer=!0,this._helperLayers.addTo(t);let e=this._layer.getLatLng(),i=this._layer._radius,r=this._getLatLngOnCircle(e,i);this._centerMarker=this._createCenterMarker(e),this._outerMarker=this._createOuterMarker(r),this._markers=[this._centerMarker,this._outerMarker],this._createHintLine(this._centerMarker,this._outerMarker)},_getLatLngOnCircle(t,e){let i=this._map.project(t),r=L.point(i.x+e,i.y);return this._map.unproject(r)},_createHintLine(t,e){let i=t.getLatLng(),r=e.getLatLng();this._hintline=L.polyline([i,r],this.options.hintlineStyle),this._setPane(this._hintline,"layerPane"),this._hintline._pmTempLayer=!0,this._helperLayers.addLayer(this._hintline)},_createCenterMarker(t){let e=this._createMarker(t);return this.options.draggable?(L.DomUtil.addClass(e._icon,"leaflet-pm-draggable"),e.on("move",this._moveCircle,this)):e.dragging.disable(),e},_createOuterMarker(t){let e=this._createMarker(t);return e.on("drag",this._resizeCircle,this),e},_createMarker(t){let e=new L.Marker(t,{draggable:!0,icon:L.divIcon({className:"marker-icon"})});return this._setPane(e,"vertexPane"),e._origLatLng=t,e._pmTempLayer=!0,e.on("dragstart",this._onMarkerDragStart,this),e.on("drag",this._onMarkerDrag,this),e.on("dragend",this._onMarkerDragEnd,this),e.on("click",this._onVertexClick,this),this._helperLayers.addLayer(e),e},_moveCircle(t){if(t.target._cancelDragEventChain)return;let i=this._centerMarker.getLatLng();this._layer.setLatLng(i);let r=this._layer._radius,n=this._getLatLngOnCircle(i,r);this._outerMarker._latlng=n,this._outerMarker.update(),this._syncHintLine(),this._updateHiddenPolyCircle(),this._fireCenterPlaced("Edit"),this._fireChange(this._layer.getLatLng(),"Edit")},_syncMarkers(){let t=this._layer.getLatLng(),e=this._layer._radius,i=this._getLatLngOnCircle(t,e);this._outerMarker.setLatLng(i),this._centerMarker.setLatLng(t),this._syncHintLine(),this._updateHiddenPolyCircle()},_resizeCircle(){this._outerMarker.setLatLng(this._getNewDestinationOfOuterMarker()),this._syncHintLine(),this._syncCircleRadius()},_syncCircleRadius(){let t=this._centerMarker.getLatLng(),e=this._outerMarker.getLatLng(),i=this._distanceCalculation(t,e);this.options[this._minRadiusOption]&&ithis.options[this._maxRadiusOption]?this._layer.setRadius(this.options[this._maxRadiusOption]):this._layer.setRadius(i),this._updateHiddenPolyCircle(),this._fireChange(this._layer.getLatLng(),"Edit")},_syncHintLine(){let t=this._centerMarker.getLatLng(),e=this._outerMarker.getLatLng();this._hintline.setLatLngs([t,e])},_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(t){this._vertexValidation("move",t)&&this._fireMarkerDragStart(t)},_onMarkerDrag(t){let e=t.target;e instanceof L.Marker&&!this._vertexValidationDrag(e)||this._fireMarkerDrag(t)},_onMarkerDragEnd(t){this._extedingMarkerDragEnd();let e=t.target;this._vertexValidationDragEnd(e)&&(this.options[this._editableOption]&&(this._fireEdit(),this._layerEdited=!0),this._fireMarkerDragEnd(t))},_extedingMarkerDragEnd(){this._map.pm.Draw.CircleMarker._layerIsDragging=!1},_initSnappableMarkersDrag(){let t=this._layer;this.options.snapDistance=this.options.snapDistance||30,this.options.snapSegment=this.options.snapSegment===void 0?!0:this.options.snapSegment,t.off("pm:drag",this._handleSnapping,this),t.on("pm:drag",this._handleSnapping,this),t.off("pm:dragend",this._cleanupSnapping,this),t.on("pm:dragend",this._cleanupSnapping,this),t.off("pm:dragstart",this._unsnap,this),t.on("pm:dragstart",this._unsnap,this)},_disableSnappingDrag(){let t=this._layer;t.off("pm:drag",this._handleSnapping,this),t.off("pm:dragend",this._cleanupSnapping,this),t.off("pm:dragstart",this._unsnap,this)},_updateHiddenPolyCircle(){let t=this._layer._map||this._map;if(t){let e=L.PM.Utils.pxRadiusToMeterRadius(this._layer.getRadius(),t,this._layer.getLatLng()),i=L.circle(this._layer.getLatLng(),this._layer.options);i.setRadius(e);let r=t&&t.pm._isCRSSimple();this._hiddenPolyCircle?this._hiddenPolyCircle.setLatLngs(L.PM.Utils.circleToPolygon(i,200,!r).getLatLngs()):this._hiddenPolyCircle=L.PM.Utils.circleToPolygon(i,200,!r),this._hiddenPolyCircle._parentCopy||(this._hiddenPolyCircle._parentCopy=this._layer)}},_getNewDestinationOfOuterMarker(){let t=this._centerMarker.getLatLng(),e=this._outerMarker.getLatLng(),i=this._distanceCalculation(t,e);return this.options[this._minRadiusOption]&&ithis.options[this._maxRadiusOption]&&(e=Zt(this._map,t,e,this._getMaxDistanceInMeter(t))),e},_handleOuterMarkerSnapping(){if(this._outerMarker._snapped){let t=this._centerMarker.getLatLng(),e=this._outerMarker.getLatLng(),i=this._distanceCalculation(t,e);this.options[this._minRadiusOption]&&ithis.options[this._maxRadiusOption]&&this._outerMarker.setLatLng(this._outerMarker._orgLatLng)}this._outerMarker.setLatLng(this._getNewDestinationOfOuterMarker())},_distanceCalculation(t,e){return this._map.project(t).distanceTo(this._map.project(e))},_getMinDistanceInMeter(t){return L.PM.Utils.pxRadiusToMeterRadius(this.options[this._minRadiusOption],this._map,t)},_getMaxDistanceInMeter(t){return L.PM.Utils.pxRadiusToMeterRadius(this.options[this._maxRadiusOption],this._map,t)},_onVertexClick(t){t.target._dragging||this._fireVertexClick(t,void 0)}});X.Circle=X.CircleMarker.extend({_shape:"Circle",initialize(t){this._layer=t,this._enabled=!1,this._minRadiusOption="minRadiusCircle",this._maxRadiusOption="maxRadiusCircle",this._editableOption="resizeableCircle",this._updateHiddenPolyCircle()},enable(t){L.PM.Edit.CircleMarker.prototype.enable.call(this,t||{})},_extendingEnable(){},_extendingDisable(){this._layer.off("remove",this.disable,this);let t=this._layer._path?this._layer._path:this._layer._renderer._container;L.DomUtil.removeClass(t,"leaflet-pm-draggable")},_extendingApplyOptions(){},_syncMarkers(){},_removeMarker(){},_onDragStart(){},_extedingMarkerDragEnd(){},_updateHiddenPolyCircle(){let t=this._map&&this._map.pm._isCRSSimple();this._hiddenPolyCircle?this._hiddenPolyCircle.setLatLngs(L.PM.Utils.circleToPolygon(this._layer,200,!t).getLatLngs()):this._hiddenPolyCircle=L.PM.Utils.circleToPolygon(this._layer,200,!t),this._hiddenPolyCircle._parentCopy||(this._hiddenPolyCircle._parentCopy=this._layer)},_distanceCalculation(t,e){return this._map.distance(t,e)},_getMinDistanceInMeter(){return this.options[this._minRadiusOption]},_getMaxDistanceInMeter(){return this.options[this._maxRadiusOption]},_onVertexClick(t){t.target._dragging||this._fireVertexClick(t,void 0)}});X.ImageOverlay=X.extend({_shape:"ImageOverlay",initialize(t){this._layer=t,this._enabled=!1},toggleEdit(t){this.enabled()?this.disable():this.enable(t)},enabled(){return this._enabled},enable(t={draggable:!0,snappable:!0}){if(L.Util.setOptions(this,t),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 t=this._layer.getBounds(),e=t.getNorthWest(),i=t.getNorthEast(),r=t.getSouthEast(),n=t.getSouthWest();return[e,i,r,n]}});X.Text=X.extend({_shape:"Text",initialize(t){this._layer=t,this._enabled=!1},enable(t){if(L.Util.setOptions(this,t),!!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),document.removeEventListener("click",this._documentClickThis,{capture:!0}),this._focusChange(),this.textArea.readOnly=!0,this.textArea.classList.add("pm-disabled");let t=document.activeElement;this.textArea.focus(),this.textArea.selectionStart=0,this.textArea.selectionEnd=0,L.DomEvent.on(this.textArea,"mousedown",this._preventTextSelection),t.focus(),this._disableOnBlurActive=!1,this._layerEdited&&this._fireUpdate(),this._layerEdited=!1,this._fireDisable(),this._enabled=!1},enabled(){return this._enabled},toggleEdit(t){this.enabled()?this.disable():this.enable(t)},applyOptions(){this.options.snappable?this._initSnappableMarkers():this._disableSnapping()},_initSnappableMarkers(){let t=this._layer;this.options.snapDistance=this.options.snapDistance||30,this.options.snapSegment=this.options.snapSegment===void 0?!0:this.options.snapSegment,t.off("pm:drag",this._handleSnapping,this),t.on("pm:drag",this._handleSnapping,this),t.off("pm:dragend",this._cleanupSnapping,this),t.on("pm:dragend",this._cleanupSnapping,this),t.off("pm:dragstart",this._unsnap,this),t.on("pm:dragstart",this._unsnap,this)},_disableSnapping(){let t=this._layer;t.off("pm:drag",this._handleSnapping,this),t.off("pm:dragend",this._cleanupSnapping,this),t.off("pm:dragstart",this._unsnap,this)},_autoResize(){this.textArea.style.height="1px",this.textArea.style.width="1px";let t=this.textArea.scrollHeight>21?this.textArea.scrollHeight:21,e=this.textArea.scrollWidth>16?this.textArea.scrollWidth:16;this.textArea.style.height=`${t}px`,this.textArea.style.width=`${e}px`,this._layer.options.text=this.getText(),this._fireTextChange(this.getText())},_disableOnBlur(){this._disableOnBlurActive=!0,setTimeout(()=>{this.enabled()&&(this._documentClickThis=this._documentClickThis||this._documentClick.bind(this),document.addEventListener("click",this._documentClickThis,{capture:!0}))},100)},_documentClick(t){t.target!==this.textArea&&(this.disable(),!this.getText()&&this.options.removeIfEmpty&&this.remove())},_focusChange(t={}){let e=this._hasFocus;this._hasFocus=t.type==="focus",!e!=!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(t){t&&(this.textArea.value=t),this._autoResize()},getText(){return this.textArea.value},_initTextMarker(){if(this.textArea=L.PM.Draw.Text.prototype._createTextArea.call(this),this.options.className){let e=this.options.className.split(" ");this.textArea.classList.add(...e)}let t=L.PM.Draw.Text.prototype._createTextIcon.call(this,this.textArea);this._layer.setIcon(t),this._layer.once("add",this._createTextMarker,this)},_createTextMarker(t=!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(),t===!0&&(this.enable(),this.focus(),this._disableOnBlur())},_preventTextSelection(t){t.preventDefault()}});var Xi=function(e,i,r,n,s,a){this._matrix=[e,i,r,n,s,a]};Xi.init=()=>new L.PM.Matrix(1,0,0,1,0,0);Xi.prototype={transform(t){return this._transform(t.clone())},_transform(t){let e=this._matrix,{x:i,y:r}=t;return t.x=e[0]*i+e[1]*r+e[4],t.y=e[2]*i+e[3]*r+e[5],t},untransform(t){let e=this._matrix;return new L.Point((t.x/e[0]-e[4])/e[0],(t.y/e[2]-e[5])/e[2])},clone(){let t=this._matrix;return new L.PM.Matrix(t[0],t[1],t[2],t[3],t[4],t[5])},translate(t){if(t===void 0)return new L.Point(this._matrix[4],this._matrix[5]);let e,i;return typeof t=="number"?(e=t,i=t):(e=t.x,i=t.y),this._add(1,0,0,1,e,i)},scale(t,e){if(t===void 0)return new L.Point(this._matrix[0],this._matrix[3]);let i,r;return e=e||L.point(0,0),typeof t=="number"?(i=t,r=t):(i=t.x,r=t.y),this._add(i,0,0,r,e.x,e.y)._add(1,0,0,1,-e.x,-e.y)},rotate(t,e){let i=Math.cos(t),r=Math.sin(t);return e=e||new L.Point(0,0),this._add(i,r,-r,i,e.x,e.y)._add(1,0,0,1,-e.x,-e.y)},flip(){return this._matrix[1]*=-1,this._matrix[2]*=-1,this},_add(t,e,i,r,n,s){let a=[[],[],[]],o=this._matrix,h=[[o[0],o[2],o[4]],[o[1],o[3],o[5]],[0,0,1]],l=[[t,i,n],[e,r,s],[0,0,1]],d;t&&t instanceof L.PM.Matrix&&(o=t._matrix,l=[[o[0],o[2],o[4]],[o[1],o[3],o[5]],[0,0,1]]);for(let f=0;f<3;f+=1)for(let k=0;k<3;k+=1){d=0;for(let w=0;w<3;w+=1)d+=h[f][w]*l[w][k];a[f][k]=d}return this._matrix=[a[0][0],a[1][0],a[0][1],a[1][1],a[0][2],a[1][2]],this}};var Dl=Xi;var u_={calcMiddleLatLng(t,e,i){let r=t.project(e),n=t.project(i);return t.unproject(r._add(n)._divideBy(2))},findLayers(t){let e=[];return t.eachLayer(i=>{(i instanceof L.Polyline||i instanceof L.Marker||i instanceof L.Circle||i instanceof L.CircleMarker||i instanceof L.ImageOverlay)&&e.push(i)}),e=e.filter(i=>!!i.pm),e=e.filter(i=>!i._pmTempLayer),e=e.filter(i=>!L.PM.optIn&&!i.options.pmIgnore||L.PM.optIn&&i.options.pmIgnore===!1),e},circleToPolygon(t,e=60,i=!0){let r=t.getLatLng(),n=t.getRadius(),s=bi(r,n,e,0,i),a=[];for(let o=0;o{s.fire(e,i,r)})},getAllParentGroups(t){let e=[],i=[],r=n=>{for(let s in n._eventParents)if(e.indexOf(s)===-1){e.push(s);let a=n._eventParents[s];i.push(a),r(a)}};return!t._pmLastGroupFetch||!t._pmLastGroupFetch.time||new Date().getTime()-t._pmLastGroupFetch.time>1e3?(r(t),t._pmLastGroupFetch={time:new Date().getTime(),groups:i,groupIds:e},{groupIds:e,groups:i}):{groups:t._pmLastGroupFetch.groups,groupIds:t._pmLastGroupFetch.groupIds}},createGeodesicPolygon:bi,getTranslation:F,findDeepCoordIndex(t,e,i=!0){let r,n=a=>(o,h)=>{let l=a.concat(h);if(i){if(o.lat&&o.lat===e.lat&&o.lng===e.lng)return r=l,!0}else if(o.lat&&L.latLng(o).equals(e))return r=l,!0;return Array.isArray(o)&&o.some(n(l))};t.some(n([]));let s={};return r&&(s={indexPath:r,index:r[r.length-1],parentPath:r.slice(0,r.length-1)}),s},findDeepMarkerIndex(t,e){let i,r=s=>(a,o)=>{let h=s.concat(o);return a._leaflet_id===e._leaflet_id?(i=h,!0):Array.isArray(a)&&a.some(r(h))};t.some(r([]));let n={};return i&&(n={indexPath:i,index:i[i.length-1],parentPath:i.slice(0,i.length-1)}),n},_getIndexFromSegment(t,e){if(e&&e.length===2){let i=this.findDeepCoordIndex(t,e[0]),r=this.findDeepCoordIndex(t,e[1]),n=Math.max(i.index,r.index);return(i.index===0||r.index===0)&&n!==1&&(n+=1),{indexA:i,indexB:r,newIndex:n,indexPath:i.indexPath,parentPath:i.parentPath}}return null},_getRotatedRectangle(t,e,i,r){let n=Ot(r,t),s=Ot(r,e),a=i*Math.PI/180,o=Math.cos(a),h=Math.sin(a),l=(s.x-n.x)*o+(s.y-n.y)*h,d=(s.y-n.y)*o-(s.x-n.x)*h,f=l*o+n.x,k=l*h+n.y,w=-d*h+n.x,S=d*o+n.y,A=Ee(r,n),g=Ee(r,{x:f,y:k}),M=Ee(r,s),m=Ee(r,{x:w,y:S});return[A,g,M,m]},pxRadiusToMeterRadius(t,e,i){let r=e.project(i),n=L.point(r.x+t,r.y);return e.distance(e.unproject(n),i)}},Rl=u_;L.PM=L.PM||{version:Ji.version,Map:Do,Toolbar:Oo,Draw:Y,Edit:X,Utils:Rl,Matrix:Dl,activeLang:"en",optIn:!1,initialize(t){this.addInitHooks(t)},setOptIn(t){this.optIn=!!t},addInitHooks(){function t(){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(t);function e(){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(e);function i(){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(i);function r(){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(r);function n(){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(n);function s(){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(s);function a(){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(a);function o(){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(o);function h(){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(h)},reInitLayer(t){t instanceof L.LayerGroup&&t.eachLayer(e=>{this.reInitLayer(e)}),t.pm||L.PM.optIn&&t.options.pmIgnore!==!1||t.options.pmIgnore||(t instanceof L.Map?t.pm=new L.PM.Map(t):t instanceof L.Marker?t.options.textMarker?(t.pm=new L.PM.Edit.Text(t),t.pm._initTextMarker(),t.pm._createTextMarker(!1)):t.pm=new L.PM.Edit.Marker(t):t instanceof L.Circle?t.pm=new L.PM.Edit.Circle(t):t instanceof L.CircleMarker?t.pm=new L.PM.Edit.CircleMarker(t):t instanceof L.Rectangle?t.pm=new L.PM.Edit.Rectangle(t):t instanceof L.Polygon?t.pm=new L.PM.Edit.Polygon(t):t instanceof L.Polyline?t.pm=new L.PM.Edit.Line(t):t instanceof L.LayerGroup?t.pm=new L.PM.Edit.LayerGroup(t):t instanceof L.ImageOverlay&&(t.pm=new L.PM.Edit.ImageOverlay(t)))}};L.version==="1.7.1"&&L.Canvas.include({_onClick(t){let e=this._map.mouseEventToLayerPoint(t),i,r;for(let n=this._drawFirst;n;n=n.next)i=n.layer,i.options.interactive&&i._containsPoint(e)&&(!(t.type==="click"||t.type==="preclick")||!this._map._draggableMoved(i))&&(r=i);r&&(L.DomEvent.fakeStop(t),this._fireEvent([r],t))}});L.PM.initialize();})(); diff --git a/internal/web/static/leaflet.css b/internal/web/static/leaflet.css index 2961b76..264c3fb 100644 --- a/internal/web/static/leaflet.css +++ b/internal/web/static/leaflet.css @@ -1,3 +1,8 @@ +/* @preserve + * Leaflet 1.9.4 stylesheet (leaflet.css), https://leafletjs.com + * (c) 2010-2023 Volodymyr Agafonkin, (c) 2010-2011 CloudMade + * BSD-2-Clause. Vendored (self-hosted per CSP); see THIRD-PARTY-NOTICES.md. + */ /* required styles */ .leaflet-pane, diff --git a/internal/web/static/leaflet.markercluster.css b/internal/web/static/leaflet.markercluster.css index fd7e4b4..0a8ea97 100644 --- a/internal/web/static/leaflet.markercluster.css +++ b/internal/web/static/leaflet.markercluster.css @@ -1,4 +1,9 @@ -/* @preserve Leaflet.markercluster 1.5.3 styles (MarkerCluster.css + MarkerCluster.Default.css), MIT License. Vendored. */ +/* @preserve + * Leaflet.markercluster 1.5.3 styles, https://github.com/Leaflet/Leaflet.markercluster + * Copyright 2012 David Leaver, MIT License. + * Upstream MarkerCluster.css + MarkerCluster.Default.css concatenated. + * Vendored (self-hosted per CSP); see THIRD-PARTY-NOTICES.md. + */ .leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow { -webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in; -moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in; diff --git a/internal/web/templates/icons.html b/internal/web/templates/icons.html index 593dbb7..c0515f5 100644 --- a/internal/web/templates/icons.html +++ b/internal/web/templates/icons.html @@ -1,5 +1,15 @@ {{/* Tabler inline SVG icons. Render with {{template "icon-NAME" .}}; the dot is an optional extra class string appended to the default "icon" class. */}} +{{/* Third-party notice — every icon below except icon-logo is Tabler Icons: + Tabler Icons, Copyright (c) 2020-2026 Pawel Kuna, MIT License. + https://tabler.io/icons — see THIRD-PARTY-NOTICES.md for the full text. + The path data is copied verbatim from upstream (minus the transparent 24x24 + guard path), collected across releases, so a few are renamed locally: + antenna<-antenna-bars-5, copy<-squares, list<-list-details, + plug<-plug-connected, terminal<-terminal-2, alert<-alert-triangle, and + brand-signal<-message-circle-2 (Tabler has no Signal mark). + Adding an icon? Take it from Tabler Icons and keep this notice accurate; + internal/licenses enforces that this file carries it. */}} {{/* icon-logo is the MeshTender brand mark (traced from the source artwork). It is a fill-based icon rather than a stroke icon, so it sets fill="currentColor". */}} {{define "icon-logo"}}{{end}}