@gisfun/maplibre-gl-components 0.15.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1960 -0
- package/dist/ControlGrid-DN5md8hp.cjs +19636 -0
- package/dist/ControlGrid-rVNG7B9O.js +170422 -0
- package/dist/DuckDBConverter-B98M0DFs.cjs +23 -0
- package/dist/DuckDBConverter-RPq48-t0.js +434 -0
- package/dist/ShapefileConverter-AjbEjEyq.cjs +1 -0
- package/dist/ShapefileConverter-trvt8J3z.js +125 -0
- package/dist/decoder-CLokFc0V.js +8 -0
- package/dist/decoder-D9LU4bUo.cjs +1 -0
- package/dist/deflate-BA1jZeSX.js +10 -0
- package/dist/deflate-DEdCz12a.cjs +1 -0
- package/dist/geojson-BQSVgKFt.cjs +1 -0
- package/dist/geojson-BSUuDj5k.js +2551 -0
- package/dist/geotiff-De1w1lBy.cjs +8 -0
- package/dist/geotiff-o_Fq1Na4.js +3108 -0
- package/dist/index-8ZZtuDTp.js +705 -0
- package/dist/index-B-Nr9y7J.cjs +84 -0
- package/dist/index-B5NoFrpY.js +8892 -0
- package/dist/index-Bi1MMPUx.js +4163 -0
- package/dist/index-C9fk_HKR.js +167 -0
- package/dist/index-CBBRBJvR.cjs +274 -0
- package/dist/index-CZxPF1qt.js +4 -0
- package/dist/index-CiDPSJ9T.cjs +1 -0
- package/dist/index-CjM_nbxd.cjs +107 -0
- package/dist/index-DQXdX5y1.js +4666 -0
- package/dist/index-Dh1kpCb6.cjs +1 -0
- package/dist/index-IrsIiQNM.cjs +4 -0
- package/dist/index.cjs +3819 -0
- package/dist/index.mjs +19580 -0
- package/dist/jpeg-CF9OGQg_.js +533 -0
- package/dist/jpeg-JSQOxGHy.cjs +1 -0
- package/dist/lerc-7LlQoT6u.js +1032 -0
- package/dist/lerc-BIsodce9.cjs +1 -0
- package/dist/lzw-BZniWIYG.js +84 -0
- package/dist/lzw-BhML-BvT.cjs +1 -0
- package/dist/main-dist-Bymiy5aM.cjs +2 -0
- package/dist/main-dist-Cv8AKwrY.js +629 -0
- package/dist/maplibre-geoman.es-Bxdg-2EU.cjs +129 -0
- package/dist/maplibre-geoman.es-CFgM2ajb.js +22827 -0
- package/dist/maplibre-gl-components.css +1 -0
- package/dist/packbits-B9b7gX2c.cjs +1 -0
- package/dist/packbits-DWY5O-FG.js +24 -0
- package/dist/pako.esm-Bx5X36Wo.js +1074 -0
- package/dist/pako.esm-DZC2QrbJ.cjs +1 -0
- package/dist/raw-C3ARbSFo.cjs +1 -0
- package/dist/raw-DUslI1gr.js +9 -0
- package/dist/react.cjs +1 -0
- package/dist/react.mjs +1306 -0
- package/dist/types/index.d.ts +44 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/adapters/AddVectorAdapter.d.ts +66 -0
- package/dist/types/lib/adapters/AddVectorAdapter.d.ts.map +1 -0
- package/dist/types/lib/adapters/CogLayerAdapter.d.ts +126 -0
- package/dist/types/lib/adapters/CogLayerAdapter.d.ts.map +1 -0
- package/dist/types/lib/adapters/PMTilesLayerAdapter.d.ts +78 -0
- package/dist/types/lib/adapters/PMTilesLayerAdapter.d.ts.map +1 -0
- package/dist/types/lib/adapters/StacLayerAdapter.d.ts +71 -0
- package/dist/types/lib/adapters/StacLayerAdapter.d.ts.map +1 -0
- package/dist/types/lib/adapters/ZarrLayerAdapter.d.ts +72 -0
- package/dist/types/lib/adapters/ZarrLayerAdapter.d.ts.map +1 -0
- package/dist/types/lib/adapters/index.d.ts +7 -0
- package/dist/types/lib/adapters/index.d.ts.map +1 -0
- package/dist/types/lib/addControlGrid.d.ts +80 -0
- package/dist/types/lib/addControlGrid.d.ts.map +1 -0
- package/dist/types/lib/colormaps/diverging.d.ts +30 -0
- package/dist/types/lib/colormaps/diverging.d.ts.map +1 -0
- package/dist/types/lib/colormaps/index.d.ts +32 -0
- package/dist/types/lib/colormaps/index.d.ts.map +1 -0
- package/dist/types/lib/colormaps/misc.d.ts +38 -0
- package/dist/types/lib/colormaps/misc.d.ts.map +1 -0
- package/dist/types/lib/colormaps/sequential.d.ts +22 -0
- package/dist/types/lib/colormaps/sequential.d.ts.map +1 -0
- package/dist/types/lib/converters/DuckDBConverter.d.ts +112 -0
- package/dist/types/lib/converters/DuckDBConverter.d.ts.map +1 -0
- package/dist/types/lib/converters/ShapefileConverter.d.ts +56 -0
- package/dist/types/lib/converters/ShapefileConverter.d.ts.map +1 -0
- package/dist/types/lib/converters/index.d.ts +8 -0
- package/dist/types/lib/converters/index.d.ts.map +1 -0
- package/dist/types/lib/converters/types.d.ts +75 -0
- package/dist/types/lib/converters/types.d.ts.map +1 -0
- package/dist/types/lib/core/AddVector.d.ts +116 -0
- package/dist/types/lib/core/AddVector.d.ts.map +1 -0
- package/dist/types/lib/core/Basemap.d.ts +206 -0
- package/dist/types/lib/core/Basemap.d.ts.map +1 -0
- package/dist/types/lib/core/BasemapReact.d.ts +32 -0
- package/dist/types/lib/core/BasemapReact.d.ts.map +1 -0
- package/dist/types/lib/core/BookmarkControl.d.ts +180 -0
- package/dist/types/lib/core/BookmarkControl.d.ts.map +1 -0
- package/dist/types/lib/core/ChoroplethControl.d.ts +105 -0
- package/dist/types/lib/core/ChoroplethControl.d.ts.map +1 -0
- package/dist/types/lib/core/CogLayer.d.ts +139 -0
- package/dist/types/lib/core/CogLayer.d.ts.map +1 -0
- package/dist/types/lib/core/CogLayerReact.d.ts +32 -0
- package/dist/types/lib/core/CogLayerReact.d.ts.map +1 -0
- package/dist/types/lib/core/Colorbar.d.ts +133 -0
- package/dist/types/lib/core/Colorbar.d.ts.map +1 -0
- package/dist/types/lib/core/ColorbarGuiControl.d.ts +79 -0
- package/dist/types/lib/core/ColorbarGuiControl.d.ts.map +1 -0
- package/dist/types/lib/core/ColorbarReact.d.ts +34 -0
- package/dist/types/lib/core/ColorbarReact.d.ts.map +1 -0
- package/dist/types/lib/core/ControlGrid.d.ts +125 -0
- package/dist/types/lib/core/ControlGrid.d.ts.map +1 -0
- package/dist/types/lib/core/ControlGridReact.d.ts +32 -0
- package/dist/types/lib/core/ControlGridReact.d.ts.map +1 -0
- package/dist/types/lib/core/HtmlControl.d.ts +140 -0
- package/dist/types/lib/core/HtmlControl.d.ts.map +1 -0
- package/dist/types/lib/core/HtmlControlReact.d.ts +32 -0
- package/dist/types/lib/core/HtmlControlReact.d.ts.map +1 -0
- package/dist/types/lib/core/HtmlGuiControl.d.ts +68 -0
- package/dist/types/lib/core/HtmlGuiControl.d.ts.map +1 -0
- package/dist/types/lib/core/InspectControl.d.ts +202 -0
- package/dist/types/lib/core/InspectControl.d.ts.map +1 -0
- package/dist/types/lib/core/InspectControlReact.d.ts +32 -0
- package/dist/types/lib/core/InspectControlReact.d.ts.map +1 -0
- package/dist/types/lib/core/Legend.d.ts +142 -0
- package/dist/types/lib/core/Legend.d.ts.map +1 -0
- package/dist/types/lib/core/LegendGuiControl.d.ts +69 -0
- package/dist/types/lib/core/LegendGuiControl.d.ts.map +1 -0
- package/dist/types/lib/core/LegendReact.d.ts +34 -0
- package/dist/types/lib/core/LegendReact.d.ts.map +1 -0
- package/dist/types/lib/core/MeasureControl.d.ts +211 -0
- package/dist/types/lib/core/MeasureControl.d.ts.map +1 -0
- package/dist/types/lib/core/MinimapControl.d.ts +77 -0
- package/dist/types/lib/core/MinimapControl.d.ts.map +1 -0
- package/dist/types/lib/core/MinimapControlReact.d.ts +32 -0
- package/dist/types/lib/core/MinimapControlReact.d.ts.map +1 -0
- package/dist/types/lib/core/PMTilesLayer.d.ts +119 -0
- package/dist/types/lib/core/PMTilesLayer.d.ts.map +1 -0
- package/dist/types/lib/core/PrintControl.d.ts +226 -0
- package/dist/types/lib/core/PrintControl.d.ts.map +1 -0
- package/dist/types/lib/core/SearchControl.d.ts +172 -0
- package/dist/types/lib/core/SearchControl.d.ts.map +1 -0
- package/dist/types/lib/core/SearchControlReact.d.ts +32 -0
- package/dist/types/lib/core/SearchControlReact.d.ts.map +1 -0
- package/dist/types/lib/core/StacLayer.d.ts +107 -0
- package/dist/types/lib/core/StacLayer.d.ts.map +1 -0
- package/dist/types/lib/core/StacSearch.d.ts +109 -0
- package/dist/types/lib/core/StacSearch.d.ts.map +1 -0
- package/dist/types/lib/core/Terrain.d.ts +165 -0
- package/dist/types/lib/core/Terrain.d.ts.map +1 -0
- package/dist/types/lib/core/TerrainReact.d.ts +32 -0
- package/dist/types/lib/core/TerrainReact.d.ts.map +1 -0
- package/dist/types/lib/core/VectorDataset.d.ts +228 -0
- package/dist/types/lib/core/VectorDataset.d.ts.map +1 -0
- package/dist/types/lib/core/VectorDatasetReact.d.ts +31 -0
- package/dist/types/lib/core/VectorDatasetReact.d.ts.map +1 -0
- package/dist/types/lib/core/ViewStateControl.d.ts +205 -0
- package/dist/types/lib/core/ViewStateControl.d.ts.map +1 -0
- package/dist/types/lib/core/ViewStateControlReact.d.ts +32 -0
- package/dist/types/lib/core/ViewStateControlReact.d.ts.map +1 -0
- package/dist/types/lib/core/ZarrLayer.d.ts +110 -0
- package/dist/types/lib/core/ZarrLayer.d.ts.map +1 -0
- package/dist/types/lib/core/types.d.ts +2793 -0
- package/dist/types/lib/core/types.d.ts.map +1 -0
- package/dist/types/lib/hooks/index.d.ts +13 -0
- package/dist/types/lib/hooks/index.d.ts.map +1 -0
- package/dist/types/lib/hooks/useBasemap.d.ts +43 -0
- package/dist/types/lib/hooks/useBasemap.d.ts.map +1 -0
- package/dist/types/lib/hooks/useCogLayer.d.ts +44 -0
- package/dist/types/lib/hooks/useCogLayer.d.ts.map +1 -0
- package/dist/types/lib/hooks/useColorbar.d.ts +36 -0
- package/dist/types/lib/hooks/useColorbar.d.ts.map +1 -0
- package/dist/types/lib/hooks/useControlGrid.d.ts +41 -0
- package/dist/types/lib/hooks/useControlGrid.d.ts.map +1 -0
- package/dist/types/lib/hooks/useHtmlControl.d.ts +39 -0
- package/dist/types/lib/hooks/useHtmlControl.d.ts.map +1 -0
- package/dist/types/lib/hooks/useInspectControl.d.ts +49 -0
- package/dist/types/lib/hooks/useInspectControl.d.ts.map +1 -0
- package/dist/types/lib/hooks/useLegend.d.ts +41 -0
- package/dist/types/lib/hooks/useLegend.d.ts.map +1 -0
- package/dist/types/lib/hooks/useMinimapControl.d.ts +35 -0
- package/dist/types/lib/hooks/useMinimapControl.d.ts.map +1 -0
- package/dist/types/lib/hooks/useSearchControl.d.ts +43 -0
- package/dist/types/lib/hooks/useSearchControl.d.ts.map +1 -0
- package/dist/types/lib/hooks/useTerrain.d.ts +43 -0
- package/dist/types/lib/hooks/useTerrain.d.ts.map +1 -0
- package/dist/types/lib/hooks/useVectorDataset.d.ts +35 -0
- package/dist/types/lib/hooks/useVectorDataset.d.ts.map +1 -0
- package/dist/types/lib/hooks/useViewState.d.ts +43 -0
- package/dist/types/lib/hooks/useViewState.d.ts.map +1 -0
- package/dist/types/lib/utils/color.d.ts +47 -0
- package/dist/types/lib/utils/color.d.ts.map +1 -0
- package/dist/types/lib/utils/fileHelpers.d.ts +207 -0
- package/dist/types/lib/utils/fileHelpers.d.ts.map +1 -0
- package/dist/types/lib/utils/helpers.d.ts +48 -0
- package/dist/types/lib/utils/helpers.d.ts.map +1 -0
- package/dist/types/lib/utils/index.d.ts +4 -0
- package/dist/types/lib/utils/index.d.ts.map +1 -0
- package/dist/types/lib/utils/providers.d.ts +46 -0
- package/dist/types/lib/utils/providers.d.ts.map +1 -0
- package/dist/types/react.d.ts +15 -0
- package/dist/types/react.d.ts.map +1 -0
- package/dist/webimage-CBRffWZD.cjs +1 -0
- package/dist/webimage-ibSPOLHJ.js +19 -0
- package/package.json +137 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _l=require("maplibre-gl"),jm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AYht+mLYpUHOwgopChOtlFRRxrFYpQIdQKrTqYXPoHTRqSFBdHwbXg4M9i1cHFWVcHV0EQ/AFxdnBSdJESv0sKLWK847iH97735e47QGhWmWaFEoCm22YmlRRz+VWx5xUhmmGMIi4zy5iTpDR8x9c9Any/i/Ms/7o/R79asBgQEIkTzDBt4g3imU3b4LxPHGVlWSU+J54w6YLEj1xXPH7jXHJZ4JlRM5uZJ44Si6UuVrqYlU2NeJo4pmo65Qs5j1XOW5y1ap2178lfGCnoK8tcpzWCFBaxBAkiFNRRQRU24rTrpFjI0HnSxz/s+iVyKeSqgJFjATVokF0/+B/87q1VnJr0kiJJIPziOB9jQM8u0Go4zvex47ROgOAzcKV3/LUmMPtJeqOjxY6AgW3g4rqjKXvA5Q4w9GTIpuxKQVpCsQi8n9E35YHBW6Bvzetb+xynD0CWepW+AQ4OgfESZa/7vLu3u2//1rT79wN2rHKoBaSKHQAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAN1wAADdcBQiibeAAAAAd0SU1FB+gEBAUlKJesuC4AABWbSURBVHja7Z3fcxTHEce/t1ohYekA2QaBDBgocGLHNmW7Kg4pV9l5SeUleci/4b9H/0aeU3mJXXEF5yEmEOw4hgKFH7JBtpEQwhLS3eVhunV9w+7tHWh3e2Z7q64OyZJ18+Mz3+7pme4W7Bn6tBdXWwD4lYj3FMA0gCkAswCOAJihrw8AOAfgdwDOAmgDmKDf3YunB6ADYB3AdQB/BnANwEMAWwA2ANwH8Ii+3gSwA6BLv8vvvfWPD/VslPOflnVBLhQQYKQCiEl6zQCYB/AigGMA3gBwGMB+guQQgFfpfZKg2sunC2AbwCqA/9H7FoCfAKwA+ArAtwB+BHCPoNmmFwOzw6AAgMFigIyrFhMChgMERJu+PkJQHCNI5un7qfi9F+i9VUJf88TeBvCY3js06TcIih8Jkq9IUTZIde6R2myI3zNVMUBGAiOlST1NrwMAjgM4BeAtAUKbIJklxZim35WAJSXB4UPSlROcINkkRXlEcKwLcP4NYAnAHQJlk17bUlUMlIYDkgHGPpr8BwEcJWVYAPA2AXKcwGAza0ooRiL6s1Vx//Yy3rtCUbaEebVOYCwBuAJgmZTmOwBrBNETA6XBgAwBYw7ACYLhbYLjRYLlIP3MpOest2oAYhxgep5zvk0QrBEUPxIkVwia2wAeGCgNBGQEME4DeIcAOUHm1bRwztMaVWIv1WVHOOubZGbdJkAuAbhpoDQIELErlRSAcZq+nhNqMeEpReh91vOUpSNU5QGBcbMAlG5Tdr1aDYGjRROdYxZFYOzzHO4Y+8o3w3YIgCJQOLbSaYKatBoAR0JKsB/Ay2Q+nRkRjKaYoL0RQblBZtj3cPGWbQDdmCFpRQyGVI0DcFuybwL4FVx0+6SBMRYot+Ci9p8DuAq3dfwwdjVpRQxHCheoO0xKcY7geJNgaRsYY4GyTlBcJUiukbKswAUqd2KEpBUhHBM06WfgotznAVwgQE6TmbWffiYxMEYCpUsA/ETm1U0C5CKAy3DR+g36mU5MkLQiAsM3qeYJjg/pfZ6+P4X+wUEDYzxQOmRSPYSLyF8G8Cm934vR5GpFBEeWSXWB4DiGwXNSMDieCRJg8LzXtwTHxVhNrlZEcMzCRb59k+owgZOaauypmuwQCCsZJtcy3HZw8JCkEcHxCoB3AXxkJlUli2oqVHmGFqIZsRDdZUjai6vBBhXTwOHgo+gMx2/ofcEzqQyMvYfEP7YzhcGjOCBINgBshwpJGigciYBjwYPjFQFHYnCUDgovQKzi/rMsIAkuqJgGCscU+kfSz5NZxXDMmr9ROSS8YPmQsLrwUfqt0CBpBQrHS+SE/xzArwmSBYNDjfP+iJTjMoC/A/ianPgf4LaBg4GkFRAcLbjI9xyA1wH8Fu6G31m4yLjtVOmC5DFc5P063A3GvwD4D9yxlScIZHcrCQgO9jmOknK8Re9Hvd0Tg6N+5z0tGKtJAC1xDcEAeU44UuGQnyez6iz6x0ZsG1cfJBPon6A+65nCuwuadkiSQODIinMcMTiCgeTIsM0UzZCkyjvZh0PGOV4wOILwbydorBbQP67Cz24wMeO/GSAF6iE71o9z2G5VWJDIhc536u8A2Ggvrqp02lPFcEzBHV+wOEeckPBu1xYrSHtxVd1R+UQhHGxaHYA7bHghy7kzOIL0SfzNlgs0xge0+iOpwo7kTpyHCwaew2BaT4MjfCXxx3eFlKSrzR9RoyCe33EsZ4Wxs1XhQ5LkWAjHeONFk4okiuBIPL+DbwIexuCRdXvCh2SiYKwTLZAkSuDgSHnuqmJwRAlJnrWgJtKuxcSSAaU8v8Oe+CDJ8kdkALjZCuKZVi+jn7dqYGcDcWY19EsX5L3kz8YGiL9jyWmZXtZiaqVKVpFZuIyHfgfFYlrllSfojdFPdZZXqMIf4QVyDS5Dyjr6JRt6jQMk4wj7GfSPrquR2D2Cwi9BwAEyruxUpPI8ieROntbSC89rYp+luXAHlGurvbjaqiuAmNa8erANegIuV+5JuIyHIZtWWdnT/SI2G/DS4xT0Eacz4qPiecV7QuwzGR9p0xx4By5TCt8dqU1FagEkQz1O02uOvhdivMNP18n1N7LKoN2HuzwkA2S9HLOKt0NfR7+Sblb5t0mEm0aV2+rPh9t1q0haY4f46nEi0F2rvITPsoJTViHNFfTTdfZG6KcryC8gKitghZpvOGtO1K4ilQMygnqEMqhFJQOWMFgD0C/FvAWvDPOQnZ4HBJQsQX0VT9dQDLmUQ968qFVFUiUrRWjqIZ3tvFoaS/S1rCK74znrow42A8WmyAO4JNJchfc6ATKs5kkSCCSqVKRSQCJQDz+J8yMUly3z65Dv7nCNuhpSv3VF32yLv79GCnWL/nZW1Sz2VbRfMFOnIqmCFSIU9cjKSbsEV3WpsPDlOED4j/i9ngcM1xfMUjEG5Qypi8xRDOWQqFGRyjpJRM33w12a+RDAH+HO4cyhX15Zs0nVwWDOp4tk3txCTRVhCyr3noSLK8g7NbN4uq67tofLVT+gfv4TXJmFu3A1SirLq1W1giRkNx8lxzIE9fDriy8D+ALAJzR4XIqsllLJ9Hd6BMq25xc9FDtn/Nn44tmkYkh8FXkbwH8hEs/FaGLxsYJpsfuye3JT6UCxv8G1xLlozCcEyTKZW9vsY9QV8c0AhQOUm56pt4N+5vtp6DzO45/wXqA5M00K3qnKzKoEkIwj7bLBE8rh4AyBN5BdA6MDRak0BShyQ+GugGMD7tTsGfQzUmqFJGtBXYNLhF2Js55W2FiWzOMkmUep8YlSOLq0+t4H8E8AnwH4BoFUUVr/+FCvvbjKO2eP4M42bdFnfw3ABwDeo3HYr9Tc8k3ya7RjV5mzXvrkzEjEcIpeB5WaV9LneEjK8RmAfwD4EoMFK1Xnl2U1wWDJtC+pLZ9R2x5KE1GpmXVQzJtKEzykFa8E83B5Wo8rdc6lWbJBPsc1Uo5lAKu0CgdTyTXD5OLP/Q21ja+5tqHvZLBvebwFd4btB1KRbhUTt8qVoE2QtBWrh5++/yKZVWuhwZEBCgc416hNmTUFlapILXOnKvtfVoSSW4xanXJ/K3clZDhyIFlB9o5cB/puL9Y2f0r9IxnZ2Y8oVQ/2O4ZOnBjqfgtIhi0EmvwRX0WOoMLs8GlFELL/8QY1cEqZgkjTaikA02OvTcmsBWxS0QLG92L4mP9VuMOapQcNkwro5+uiL8LdX9CWW5cd1ydwRxtuwB0fuS9NjhjUI2N3S8Z5rlPbdytAKVkU/DIYfAemkpwFpQGSUd+j0oY9w2q6AXfQ7xLc2ard7c+Y4PAgkdvZt6jtuydnlZlZuQttmWZW2QriS+M8dAUHffW4icGTo1HCkQFJXvs1pRuqxVSvwsRi+/Yw9CWgzlIPjSto0/ugVTCXggSEG8WX8aehKzBYpB69mNUjwx8JQUUYkmkMJvcI1sSqvEGmHtGrSKULbimAZMQ/KpPEMdVjGy6qvESvRqnHEBXh/lhD/1CgFkgy51RZjnpSMnwyp9Nh6Ip/8Gnd7+CyjzRVPfJU5Ar1zSYqvKCkbU6V7YNwinttDro8cvEjXLCMt3UbpR4ZKsLbvpyuiFOk1t0nWVZJ6XdZkhIbw///FP00mZrMK44kf0sTYRM6zyHVsXBsop/wTp4k0GRmyVzFKGtuVXWaV5NzzubVFlwE+Su4Y+2aTAkNpuc99LNBbinqmxaeznYflpM+RFG0rJJsSqzDS2rQRPMqw8xiX4TzCWty1CudU0lD54LMUsLJ3Uw9rH8aD0hIK6RKhW1aHzVRQeS9D78EgT3WR40HRB7zXjH/o9AP4Qwujdzha6KJxSskV31qamBwlL6SfdT1+tAAacAE6JrvUeiLdJvcP4lNAnusjwwQe+wxQOyxxwCxp+qnZYDY4NuT3TeVnXkyQHROAG2HKLX1T2WnZg0QXYqh8Ri+iifnNqjWGiIGSEmQZF7kqiKdfkDzQvNtUAPEBl+FeaU1XVN0gGhLhKw9mbYW51xjuqZK51RSUUO0HekIoRyDBgXRmq6psiMwScl0azwUWGs6/QAddG2VwCo9RJmU3JDMY+UKQNGeM7juvtFYrqKWY/hlNlrrpZu8rPOaS1JX2Tey9LK2chWVz6lSAMm5dKMtjaVMp881uCebamYNqWWvqVxF7pwq67JbUlGDNtGvSqrFWfdrcJ+Azsq7VTvmM9QX2mrZS+f8Cc2p0hfcJLYGPYOjLmtwz9GuTaNURKjHPuoD7g9ttewrX3CrUpANhY66v2K+02AV0d4XtZnsZQOiOTuGv2qeplejVCRDPZ7qByWLRS1zqTRAAsnSZyoSRh/Ulg0zqYh8rVn6ilbPJGYVobYlAahHbfMoqZN8xSpyEv1t3yghEXDwtu5J5epRiyVSlYJoztLnq8gZAGfhIsi79yBigkT4HXzs/wi1+Yxi9ahlDpUKSEDZwmVk/RSACwDOwwXLZiP0R2R7F6itF6jt2tpbazb+pMIVQHO2cDY3+J7IeQAfAXiXJtALACZiUBFqAyvHArXxI2qzvBujqa21zZ+0xhVgjuzfnpLB8CeOVL/d08jtxdVOqDl8BRxDFwKF6lGbBVKlgoRQ0SnP9DgNF1WeClVJPDgOUptCMCVrrXhVuoKsf3yo115czasJOKtsxeLPMUE7OfMAzgF4Da48MuBKI2+1F1c7CCAjvOeQMxwL1KZz1MYZMQ7aqoHl1kysou+TihuaWVUW+kp7ye3PMwA+APA+gF/AHQEP4oJVxgWoY9SG96lNZyC2s6G3VF5tVXerPKXp1yW/A711yRmSabgt0PcA/B7AHwD8EsBxYZKojJOIOAebjMfps/+B2vIetW0aOpPDSd/jDmqq216Fky7NrG0yUZbo9aqYaD1lgySd9qPIrve+DHerbbu9uNrVYHIJ1WAVzNqtmifl0HpJTKqHnC9rqLiWfVrzivAzAC9Bb9odhmQ/nk40x6bLfTIBngDYoYWgclAEGPy59hEERzJ2q2aUmlXqLI7KAPFURNqUGp31PJ+kDeAVz66/DuAWOfEbVYOSA8YM3Db6SbgIub9bNaEcDt85H/BZq1x80pobzrsSh6ArJpIHSUvY85z04QaASwBuAridBwovEnsIBYaAcQJuG/cdcsRPoZ9CVHsCuDznfBM11ElMa+gAua/9Je2qvAz92Q1bos/YD2kTLKcJkCxQtmlguwQLxgXGA0ICO4F+fi8fjNP09RxBLe+Wa47jqHDOawEksJhIHiS+E+xPTgZliUB5SO3jK8d8TVQCM46C8c7UNL0O0N8+lQHGDClLijDKGKhxzutUkDz78qByMyvPL8kzb5Zo9WMT4Z5QlG0MJtPrFQDJGwSTAsp59DOyvE2AZIHRQlhpVVWFA1IlnXCWBnsf+kkCEAAkLRq0LFBepV069rX4mMQG3HmiUe5V+1kO2+jnFH4D/ZxeR2mBCRkMVc55bYAMiYmcFLZ9L6CBzQNlFm4Le4vMybcIDD50599r6OWolMxEz2lSOWUq+xbT4m+HCIY657xuBZGO2G2y2eVVz8kABzgLlCka3IO0EcHm1QaZRY9HVBAZpGQzi2Mycss25Az1/pyo1TmvFRChIk9ot+cmvU4EqiJ5oMidpin084TN0YTvjDD4/P+Y8pxtP+N6yHdVWD14PtTunNetILGqiA8KPFh4kCUw4+5iIRIoiubCbSg4q1db3EFcx/VV5AF9T9sp371QlUS8UmGKDXtNCuVIEF/h0cJ5UOf5tlThyhGTihSpC2BVrdSqR60K0kAVsScw9agdkBBWEHuaPfa1A2IqYuqhVT20KIipiKmH2jFXAYipiKmHRvXQpCCmIqYeKsdaDSCmIqYe2tRDm4KYiph6qBtjVYCMoCJdgyR4OLqhqIdGBclbYW7BHRXXVFfEnmczrXZoLG+FYCGoAyRDRW7AZQ65D+AnuBOw9oT5dGgM79OY3tCsHkD9Z7GKVOQR3LHnz9G/Mcf5nEK4Y23PoGm1BeB7AFdpTJcgcu1q/OAqs4jQShJkh9oz8oJ3lcZ2C0BXaxLwRHnHDpNkc9jDdMyDMpnVAuKVb5NOnTns4TvmA2OouYSEagURppY57HE65l3t9VXSADrYHHZzzE1BnsFhvwm9RXjsCdgxDwqQHKm+Ri8ztcwxN0CEw85JxW5mrUimIuaYN1ZBLDZijrkBsgedb5DUrh6dmBaxoAApiI2Yw67HtMo1g0NSjyAVpCA2UpTr1p5yAeFT2Pdi2UhJAx8M3kK8iH5cZIL+HVP2wVBMq8dwpR4u05gMbMWHph6h+iC+w75CA/IpvQ8rKWBPOXAUjkWIcAQLiICkcNUySCrxO+T2+0Uai29pbDqhwhE0IDHbvYE9WQFcLjcXvD8YNCDerpYFEOszrbKOAAUVEIxVQaSpZWe16jWt/IWpEzocUQBSIPVmall/GyAjntWqrRBkhOpRqNgxqEdUCjLCsXi7gbh3plVU0fJhTxrhIGZJ/2G4moBc+swCiM8OSKN2DWPyQfJMraf25U1Fnsu0ii5a3hhAMkytvMiuQfLsfkd00fJGASIgGbbamT/yfH5HVNHypvkgRfay+SN704/RRMsbpyCeP7Jj/khpfkcU0fJGAuKZWuaPlON3dGKGI3pAzB8xv8N8EPNHzO8wBTF/xPwOA8T8EfM7DJAA/JGm3h/hAGvj/Y7GAjKifd1poNPeE+rReL+j0YAU+CPLaGaWRpklZrnpfkfTFSTPH/kEwBc0QZrktEuzc5n64JMm+x3ySdHQZ/3jQ7324qqcGJxHK4Xb+uVt3wnEu/070kLRVDgaDUiOaZHCJZ07TO8MSYwFeoY55U01Nc3EyvFHRnFOe5HBMdJmRZPVo/GACEiGraSxQeLDkeeUd5sOhwEymtN+NzJzQ5qVd80pNx/keZx2floAjiP8pNhZO1Z/NafcAHnW1ZXhiGFnq0kqaSZWyU57oX0e2EQa2c8y9TBAxoUk9J2tkdtjcBgg40ASw86W7VgZIKVCMqrN3lMOh+1YmZNeDiRDdrYA4BUAs6IfW8rhsB0rA6SUyebvbOVB0lL6mSUctmNlgOy5imAIJNpiJMNiHQNwmHoYIGVDoi1GMrLfZHCYk16G0645RmKxDgNEHSRaYiQW6zBAVEGiKUZisQ4DRCUkGmIkFuswJ121415njMRiHQaI+mecGMleQlIEh8U6DBA1KoKKIRkLDlMPA6RJkBgcBohBYnAYIAbJeJAYHAaIQWJwGCAGyXiQGBwGiEGSA4nBYYAYJDmQGBwGiEGSAwkMDgPEIBkOicFhgBgkGZDM0L83DA4DxCDpP1xi4Sh9/R2ASwaHAdJkSPjuRgJgEv167QBwFcDfAPwLdhuw1sfug9QAiXDCH8Pd+Psa7v7GHXpdpu/do58xOGp6/g9eQPkxBqxc0wAAAABJRU5ErkJggg==";let Lu;try{Lu="free"}catch{Lu=process.env.VITE_GEOMAN_VERSION||null}const rt="gm",ae=`_${rt}`,nt=Lu==="pro",Wf={draw:{marker:{type:"draw",eventType:"toggle",targetMode:"marker",settings:{exclusive:!0}},circle_marker:{type:"draw",eventType:"toggle",targetMode:"circle_marker",settings:{exclusive:!0}},text_marker:{type:"draw",eventType:"toggle",targetMode:"text_marker",settings:{exclusive:!0}},circle:{type:"draw",eventType:"toggle",targetMode:"circle",settings:{exclusive:!0}},ellipse:{type:"draw",eventType:"toggle",targetMode:"ellipse",settings:{exclusive:!0}},line:{type:"draw",eventType:"toggle",targetMode:"line",settings:{exclusive:!0}},rectangle:{type:"draw",eventType:"toggle",targetMode:"rectangle",settings:{exclusive:!0}},polygon:{type:"draw",eventType:"toggle",targetMode:"polygon",settings:{exclusive:!0}},freehand:{type:"draw",eventType:"toggle",targetMode:"freehand",settings:{exclusive:!0}},custom_shape:{type:"draw",eventType:"toggle",targetMode:"custom_shape",settings:{exclusive:!0}}},edit:{drag:{type:"edit",eventType:"toggle",targetMode:"drag",settings:{exclusive:!0}},change:{type:"edit",eventType:"toggle",targetMode:"change",settings:{exclusive:!0}},rotate:{type:"edit",eventType:"toggle",targetMode:"rotate",settings:{exclusive:!0}},scale:{type:"edit",eventType:"toggle",targetMode:"scale",settings:{exclusive:!0}},copy:{type:"edit",eventType:"toggle",targetMode:"copy",settings:{exclusive:!0}},cut:{type:"edit",eventType:"toggle",targetMode:"cut",settings:{exclusive:!0}},split:{type:"edit",eventType:"toggle",targetMode:"split",settings:{exclusive:!0}},union:{type:"edit",eventType:"toggle",targetMode:"union",settings:{exclusive:!0}},difference:{type:"edit",eventType:"toggle",targetMode:"difference",settings:{exclusive:!0}},line_simplification:{type:"edit",eventType:"toggle",targetMode:"line_simplification",settings:{exclusive:!0}},lasso:{type:"edit",eventType:"toggle",targetMode:"lasso",settings:{exclusive:!0}},delete:{type:"edit",eventType:"toggle",targetMode:"delete",settings:{exclusive:!0}}},helper:{shape_markers:{type:"helper",eventType:"toggle",targetMode:"shape_markers",settings:{exclusive:!1,enabledBy:["drag","change","rotate","scale","line_simplification"]}},snapping:{type:"helper",eventType:"toggle",targetMode:"snapping",settings:{exclusive:!1}},pin:{type:"helper",eventType:"toggle",targetMode:"pin",settings:{exclusive:!1}},snap_guides:{type:"helper",eventType:"toggle",targetMode:"snap_guides",settings:{exclusive:!1}},measurements:{type:"helper",eventType:"toggle",targetMode:"measurements",settings:{exclusive:!1}},auto_trace:{type:"helper",eventType:"toggle",targetMode:"auto_trace",settings:{exclusive:!1}},geofencing:{type:"helper",eventType:"toggle",targetMode:"geofencing",settings:{exclusive:!1}},zoom_to_features:{type:"helper",eventType:"click",targetMode:"zoom_to_features",settings:{exclusive:!1}},click_to_edit:{type:"helper",eventType:"toggle",targetMode:"click_to_edit",settings:{exclusive:!1}}}},qm=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
2
|
+
<path fill="currentColor"
|
|
3
|
+
d="m22.775 29.562 6.75-6.75-5.625-5.625-3.6 3.6-3.15-3.15 3.6-3.6-5.626-5.55-6.75 6.75zm25.95 26.101 6.75-6.825-5.624-5.625-3.6 3.6-3.15-3.15 3.6-3.6-5.55-5.55-6.75 6.75zm.6-46.126 5.25 5.25ZM16.7 59.039H5v-11.7l14.55-14.551L2 15.237l13.05-13.2 17.7 17.624L46.1 6.312q.676-.676 1.5-.976.826-.3 1.65-.3.826 0 1.65.3.826.3 1.5.976l5.326 5.325q.675.675.975 1.5.3.825.3 1.65t-.3 1.65q-.3.825-.975 1.5l-13.35 13.35L62 48.913l-13.125 13.05-17.551-17.55Zm-7.2-4.5h5.25l29.476-29.552-5.25-5.25L9.5 49.288Zm32.1-32.178-2.625-2.625 5.25 5.25Z"/>
|
|
4
|
+
</svg>`,Zf=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
5
|
+
<path fill="none" d="M0 0h24v24H0Z"/>
|
|
6
|
+
<circle cx="32" cy="32" r="26" fill="currentColor" fill-opacity=".15" stroke="currentColor" stroke-width="7"/>
|
|
7
|
+
<circle cx="32" cy="32" r="5" fill="currentColor"/>
|
|
8
|
+
</svg>`,Ym=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
9
|
+
<path fill="none" d="M0 0h24v24H0Z"/>
|
|
10
|
+
<circle cx="32" cy="32" r="26" fill="currentColor" fill-opacity=".15" stroke="currentColor" stroke-width="7"/>
|
|
11
|
+
<path stroke="currentColor" stroke-dasharray="3" stroke-width="4" d="M6 32h52M32 6v52"/>
|
|
12
|
+
</svg>`,zm=`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
13
|
+
<svg
|
|
14
|
+
viewBox="0 0 64 64"
|
|
15
|
+
version="1.1"
|
|
16
|
+
id="svg2"
|
|
17
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
19
|
+
<defs
|
|
20
|
+
id="defs2" />
|
|
21
|
+
<path
|
|
22
|
+
fill="none"
|
|
23
|
+
d="M 0,0 H 24 V 24 H 0 Z"
|
|
24
|
+
id="path1"
|
|
25
|
+
style="display:inline" />
|
|
26
|
+
<ellipse
|
|
27
|
+
cx="32"
|
|
28
|
+
cy="32"
|
|
29
|
+
fill="currentColor"
|
|
30
|
+
fill-opacity="0.15"
|
|
31
|
+
stroke="currentColor"
|
|
32
|
+
stroke-width="7"
|
|
33
|
+
id="circle1"
|
|
34
|
+
rx="26.787416"
|
|
35
|
+
ry="15.158148" />
|
|
36
|
+
<path
|
|
37
|
+
stroke="currentColor"
|
|
38
|
+
stroke-dasharray="3"
|
|
39
|
+
stroke-width="4"
|
|
40
|
+
d="M 6.4966994,32 H 58 M 32,18.552705 v 30.15073"
|
|
41
|
+
id="path2"
|
|
42
|
+
style="stroke-width:3;stroke-dasharray:3;stroke-dashoffset:0" />
|
|
43
|
+
</svg>
|
|
44
|
+
`,Jm=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
45
|
+
<path
|
|
46
|
+
fill="currentColor"
|
|
47
|
+
d="M32 61.4 19.85 49.42l3.28-3.235 6.634 6.542V34.205H10.98l6.26 6.174-3.279 3.234L2.185 32l11.852-11.686 3.28 3.234-6.336 6.247h18.783V11.273l-6.261 6.174-3.28-3.234L32 2.6l11.777 11.613-3.28 3.234-6.26-6.174v18.522h18.782l-6.26-6.174 3.279-3.234L61.815 32 50.038 43.613l-3.28-3.234 6.261-6.174H34.236v18.522l6.634-6.542 3.28 3.234z"
|
|
48
|
+
/>
|
|
49
|
+
</svg>
|
|
50
|
+
`,Hm=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
51
|
+
<line x1="8" y1="50" x2="24" y2="20" stroke="currentColor" stroke-width="8"/>
|
|
52
|
+
<line x1="24" y1="20" x2="40" y2="54" stroke="currentColor" stroke-width="8"/>
|
|
53
|
+
<line x1="40" y1="54" x2="54" y2="10" stroke="currentColor" stroke-width="8"/>
|
|
54
|
+
<circle cx="8" cy="50" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
55
|
+
<circle cx="24" cy="20" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
56
|
+
<circle cx="40" cy="54" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
57
|
+
<circle cx="54" cy="10" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
58
|
+
</svg>
|
|
59
|
+
`,Vm=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 64 64">
|
|
60
|
+
<path d="M32 62.81s23.107-21.898 23.107-38.512a23.107 23.107 0 0 0-46.214 0C8.893 40.912 32 62.809 32 62.809m0-26.958a11.554 11.554 0 1 1 0-23.107 11.554 11.554 0 0 1 0 23.107"/>
|
|
61
|
+
</svg>
|
|
62
|
+
`,Xm=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
63
|
+
<!-- Polygon -->
|
|
64
|
+
<polygon points="8,28 40,6 55,35 51,55 18,54" fill="none" stroke="currentColor" stroke-width="8"/>
|
|
65
|
+
|
|
66
|
+
<!-- Vertex Circles -->
|
|
67
|
+
<circle cx="9" cy="28" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
68
|
+
<circle cx="40" cy="8" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
69
|
+
<circle cx="55" cy="35" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
70
|
+
<circle cx="50" cy="55" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
71
|
+
<circle cx="18" cy="54" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
72
|
+
</svg>
|
|
73
|
+
`,$m=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
74
|
+
<!-- Rectangle -->
|
|
75
|
+
<polygon points="10,10 54,10 54,54 10,54" fill="none" stroke="currentColor" stroke-width="8"/>
|
|
76
|
+
|
|
77
|
+
<!-- Vertex Circles -->
|
|
78
|
+
<circle cx="10" cy="10" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
79
|
+
<circle cx="54" cy="10" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
80
|
+
<circle cx="54" cy="54" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
81
|
+
<circle cx="10" cy="54" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
82
|
+
</svg>
|
|
83
|
+
`,Wm=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
84
|
+
<path fill="currentColor"
|
|
85
|
+
d="M39.063 42.14 22.288 28.12 7.96 44.603l11.338 9.854h9.059zm-3.498 12.317h25.941v5.465h-44.25L4.377 48.726a5.465 5.465 0 0 1-.542-7.711L34.311 5.958a5.465 5.465 0 0 1 7.712-.538l16.496 14.343a5.465 5.465 0 0 1 .541 7.709z"/>
|
|
86
|
+
</svg>`,Zm=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
87
|
+
<path fill="currentColor"
|
|
88
|
+
d="M58.709 17.724c-.3-.6-.601-.901-.902-1.502l-.3-.601c-.301-.601-.602-.902-.902-1.503l-.3-.601c-.301-.601-.602-.902-1.203-1.503l-.6-.901 8.414-9.317-13.825.3-13.824.301 1.502 13.524 1.503 13.524 9.617-10.819v.3l.3.602c.301.3.301.6.602.6l.3.602c0 .6 0 .901.3 1.202.903 2.104 1.804 4.208 2.105 6.311.6 4.208 0 8.716-1.804 12.623l-.6 1.202-.301.3-.902 1.503-.3.601c-.601.601-1.202 1.503-1.804 2.104-1.502 1.503-3.305 3.005-5.109 3.907-1.803 1.202-3.907 1.803-6.311 2.404-2.104.301-4.508.601-6.612.301-2.404-.3-4.508-.902-6.612-1.503-2.103-.901-3.907-2.104-5.71-3.606l-1.202-1.202-.601-.902-.601-.601c-.3-.3-.601-.601-.601-.902l-.902-1.202-.3-.3-.602-1.203c0-.3-.3-.3-.3-.6l-.902-1.503-.3-.601-.902-2.705q-.901-3.607-.901-7.213V27.04c0-.601 0-.901.3-1.202l.3-1.803.602-1.803c.901-2.405 2.103-4.509 3.606-6.612q2.254-3.156 5.41-5.41c.6-.3.901-1.202.3-1.803-.3-.3-.6-.601-.901-.601h-.601l-.3.3c-2.706 1.202-4.81 3.006-6.913 4.809-2.104 2.104-3.607 4.508-5.11 7.213-2.704 5.41-3.606 11.42-2.404 17.431.3 1.503.601 2.705.902 4.207l.902 2.405c.3.3.6.6.6 1.202l.602 1.202c0 .3.3.601.3.601l.902 1.503c.3.601.6.901.901 1.503l.301.6c.3.301.601.902.902 1.203l2.103 1.803c2.104 2.104 4.809 3.907 7.514 5.41q4.057 2.254 9.016 2.705c1.503.3 3.005.3 4.508.3 1.803 0 3.306 0 4.809-.3 3.005-.602 6.311-1.503 9.016-3.006l.6-.3c.602-.3.903-.601 1.504-.902l2.103-1.202c.601-.3.902-.601 1.203-.902l.6-.6a3.622 3.622 0 0 0 1.503-1.504l.3-.3c.902-.902 2.105-2.104 2.706-3.005l1.803-2.705 1.202-1.804c3.005-5.71 4.208-12.322 3.306-18.633-.601-3.306-1.503-6.612-3.005-9.317z"/>
|
|
89
|
+
</svg>
|
|
90
|
+
`,Km=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
91
|
+
<path fill="none" d="M0 0h24v24H0Z"/>
|
|
92
|
+
<path fill="currentColor"
|
|
93
|
+
d="M6.962 3.385h50.076a3.577 3.577 0 0 1 3.577 3.577v50.076a3.577 3.577 0 0 1-3.577 3.577H6.962a3.577 3.577 0 0 1-3.577-3.577V6.962a3.577 3.577 0 0 1 3.577-3.577Zm3.577 7.154v42.922h42.922V10.539Zm7.154 7.154h28.614v7.153H17.693Zm0 14.307h28.614v7.154H17.693Z"/>
|
|
94
|
+
</svg>
|
|
95
|
+
`,Qm=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
96
|
+
<path stroke="currentColor" fill="currentColor" stroke-width="2"
|
|
97
|
+
d="M44.095 2.247a2.285 2.285 0 0 0-.135.04L12.025 12.762a2.285 2.285 0 0 0-1.497 1.588l-7.772 29.4a2.285 2.285 0 0 0 1.213 2.641L35.397 61.6a2.285 2.285 0 0 0 2.873-.754l22.64-32.582a2.285 2.285 0 0 0 .05-2.534L46.6 3.23a2.285 2.285 0 0 0-2.504-.982ZM43.7 7.182l12.203 19.12-5.167 1.76 1.052 3.09 2.031-.693L38.07 53.122l.01-1.375-3.262-.023-.034 4.5-27.13-13.127 6.975-26.38Zm3.946 21.932-6.18 2.105 1.052 3.09 6.18-2.105zm-9.27 3.157-2.329.793a1.632 1.632 0 0 0-1.105 1.534l-.03 4.068 3.265.024.02-2.91 1.232-.419zm-3.488 9.66-.047 6.529 3.264.023.048-6.528z"/>
|
|
98
|
+
</svg>
|
|
99
|
+
`,ev=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
100
|
+
<path fill="currentColor" fill-rule="evenodd"
|
|
101
|
+
d="M19.435 3.417c-4.478 0-8.96 1.693-12.343 5.076-6.766 6.766-6.766 17.913 0 24.679h.006c2.754 2.749 5.563 5.561 8.357 8.357 1.857 1.859 3.696 3.696 5.553 5.553l.949.949 1.892 1.898 9.496-9.49-1.898-1.898-6.502-6.502c-2.796-2.797-5.6-5.606-8.363-8.362-1.65-1.653-1.652-4.042 0-5.694 1.653-1.653 4.047-1.653 5.7 0l8.357 8.362 6.502 6.502 1.898 1.893 9.49-9.49-1.893-1.893-6.507-6.502-8.357-8.362c-3.384-3.383-7.86-5.076-12.337-5.076Zm0 2.68c3.789 0 7.577 1.432 10.439 4.294l8.357 8.362-5.694 5.694-8.357-8.362a6.7 6.7 0 0 0-9.496 0 6.697 6.697 0 0 0 0 9.49c2.76 2.755 5.566 5.564 8.363 8.362l-5.694 5.694c-2.795-2.796-5.601-5.607-8.357-8.357H8.99c-5.724-5.724-5.724-15.16 0-20.883 2.861-2.862 6.655-4.294 10.444-4.294ZM57.709 29.03a4.266 4.266 0 0 0-4.268 4.268c0 1.594.881 2.973 2.176 3.707-.714 4.997-1.424 10.107-2.176 15.037-.934 0-1.792.309-2.495.818l-7.115-5.07a4.25 4.25 0 0 0 .115-.965 4.27 4.27 0 1 0-4.268 4.268 4.23 4.23 0 0 0 2.732-1.012l6.973 4.965a4.22 4.22 0 0 0-.215 1.269 4.27 4.27 0 0 0 4.273 4.268 4.266 4.266 0 0 0 4.268-4.268 4.247 4.247 0 0 0-1.657-3.356l2.208-15.446c2.095-.273 3.722-2.045 3.722-4.215a4.27 4.27 0 0 0-4.273-4.268z"
|
|
102
|
+
/>
|
|
103
|
+
</svg>
|
|
104
|
+
`,tv=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
105
|
+
<path fill="currentColor"
|
|
106
|
+
d="M1.585 1.585V13.75h5.17v1.52H8.58v-1.52h5.17V1.585Zm3.041 3.041h6.083v6.083H4.626Zm9.429 2.13V8.58h3.65V6.755Zm5.475 0V8.58h3.65V6.755Zm5.474 0V8.58h3.65V6.755Zm5.475 0V8.58h3.65V6.755Zm5.475 0V8.58h3.65V6.755Zm5.475 0v1.597a1.521 1.521 0 0 0-.325.152l-15.686 9.758a1.52 1.52 0 0 0-.199 2.437l23.512 20.553a1.52 1.52 0 0 0 2.477-.78l4.212-17.037v.352h1.825v-3.65H55.42v1.524a1.52 1.52 0 0 0-.222-.296L43.002 8.741a1.521 1.521 0 0 0-.182-.16h2.259V6.754Zm5.475 0V8.58h3.65V6.755Zm5.474 0V8.58h3.65V6.755Zm3.042 2.432v3.65h1.825v-3.65Zm-13.752 2.549 10.757 11.137-3.57 14.446-20.087-17.559Zm13.752 2.926v3.65h1.825v-3.65ZM6.755 17.096v3.65H8.58v-3.65zm0 5.475v3.65h1.628a1.52 1.52 0 0 0 1.02.909l12.683 3.406 7.905 12.694c.168.27.417.481.712.602l13.39 4.576a1.52 1.52 0 0 0 1.157-2.814l-12.936-4.389L24.35 28.42a1.52 1.52 0 0 0-.896-.664L10.19 24.193a1.52 1.52 0 0 0-1.61.557v-2.178zm48.665 3.042v3.65h1.825v-3.65ZM6.755 28.046v3.65H8.58v-3.65zm48.665 3.042v3.65h1.825v-3.65ZM6.755 33.52v3.65H8.58v-3.65zm48.665 3.041v3.65h1.825v-3.65ZM6.755 38.996v3.65H8.58v-3.65zm48.665 3.041v3.65h1.825v-3.65zm-35.382.913c-3.454 0-6.287 2.833-6.287 6.287 0 3.076 2.248 5.654 5.179 6.183h-1.225v1.825h3.65V55.42h-.206c2.712-.5 4.777-2.796 5.055-5.59l.002-.002a1.52 1.52 0 0 0 0-1.18c-.314-3.168-2.922-5.698-6.168-5.698zM6.755 44.47v3.65H8.58v-3.65zm13.283 1.521a3.223 3.223 0 0 1 3.246 3.246 3.223 3.223 0 0 1-3.246 3.246 3.223 3.223 0 0 1-3.246-3.246 3.223 3.223 0 0 1 3.246-3.246zm35.382 1.52v2.738h-5.17v12.166h12.165V50.25h-5.17v-2.737ZM6.755 49.946v3.65H8.58v-3.65zm46.536 3.346h6.083v6.083H53.29ZM6.755 55.42v1.825h3.65V55.42H7.668Zm5.475 0v1.825h3.65V55.42zm10.95 0v1.825h3.65V55.42zm5.474 0v1.825h3.65V55.42zm5.475 0v1.825h3.65V55.42zm5.475 0v1.825h3.65V55.42zm5.475 0v1.825h3.65V55.42z"/>
|
|
107
|
+
</svg>
|
|
108
|
+
`,mt={marker:Vm,circle:Ym,ellipse:zm,circle_marker:Zf,text_marker:Km,line:Hm,rectangle:$m,polygon:Xm,drag:Jm,change:qm,rotate:Zm,cut:Qm,delete:Wm,snapping:ev,zoom_to_features:tv},Ko=t=>[{type:"circle",paint:{"circle-radius":t.circleMarkerRadius,"circle-color":t.fillColor,"circle-opacity":t.fillOpacity,"circle-stroke-color":t.lineColor,"circle-stroke-width":t.lineWidth,"circle-stroke-opacity":t.lineOpacity}}],Ii=t=>[{type:"circle",paint:{"circle-radius":7,"circle-color":"#ffffff","circle-opacity":1,"circle-stroke-color":t.lineColor,"circle-stroke-width":2,"circle-stroke-opacity":1}}],Qo=t=>[{type:"line",paint:{"line-color":t.lineColor,"line-opacity":t.lineOpacity,"line-width":t.lineWidth}}],eu=()=>[{type:"symbol",layout:{"icon-image":"default-marker","icon-size":.18,"icon-allow-overlap":!0,"icon-anchor":"bottom"}}],Zt=t=>[{type:"fill",paint:{"fill-color":t.fillColor,"fill-opacity":t.fillOpacity}},{type:"line",paint:{"line-color":t.lineColor,"line-opacity":t.lineOpacity,"line-width":t.lineWidth}}],tu=t=>[{type:"circle",paint:{"circle-radius":6,"circle-color":"#ffffff","circle-opacity":.6,"circle-stroke-color":t.lineColor,"circle-stroke-width":2,"circle-stroke-opacity":1}}],nu=()=>[{type:"line",paint:{"line-color":"#00979f","line-width":1.8,"line-dasharray":[2,1]}}],it=`__${rt}_`,Gt=`${it}id`,Xc=6e4,Q={...nt&&{standby:`${rt}_standby`},main:`${rt}_main`,temporary:`${rt}_temporary`},ru=()=>[{type:"symbol",layout:{"text-field":["get",`${it}text`],"text-justify":"center"},paint:{"text-color":"black","text-halo-color":"#fff","text-halo-width":2}}],Ge={[Q.main]:{lineColor:"#278cda",lineOpacity:.8,lineWidth:3,fillColor:"#4fb3ff",fillOpacity:.4,circleMarkerRadius:10},[Q.temporary]:{lineColor:"#ff5600",lineOpacity:.8,lineWidth:3,fillColor:"#4fb3ff",fillOpacity:.4,circleMarkerRadius:10},...nt&&{[Q.standby]:{lineColor:"#787878",lineOpacity:.8,lineWidth:3,fillColor:"#a5a5a5",fillOpacity:.4,circleMarkerRadius:10}}},Kf={polygon:{[Q.main]:Zt(Ge[Q.main]),[Q.temporary]:Zt(Ge[Q.temporary]),...nt&&{[Q.standby]:Zt(Ge[Q.standby])}},ellipse:{[Q.main]:Zt(Ge[Q.main]),[Q.temporary]:Zt(Ge[Q.temporary]),...nt&&{[Q.standby]:Zt(Ge[Q.standby])}},rectangle:{[Q.main]:Zt(Ge[Q.main]),[Q.temporary]:Zt(Ge[Q.temporary]),...nt&&{[Q.standby]:Zt(Ge[Q.standby])}},circle:{[Q.main]:Zt(Ge[Q.main]),[Q.temporary]:Zt(Ge[Q.temporary]),...nt&&{[Q.standby]:Zt(Ge[Q.standby])}},circle_marker:{[Q.main]:Ko(Ge[Q.main]),[Q.temporary]:Ko(Ge[Q.temporary]),...nt&&{[Q.standby]:Ko(Ge[Q.standby])}},line:{[Q.main]:Qo(Ge[Q.main]),[Q.temporary]:Qo(Ge[Q.temporary]),...nt&&{[Q.standby]:Qo(Ge[Q.standby])}},marker:{[Q.temporary]:eu(),[Q.main]:eu(),...nt&&{[Q.standby]:eu()}},text_marker:{[Q.main]:ru(),[Q.temporary]:ru(),...nt&&{[Q.standby]:ru()}},dom_marker:{[Q.main]:[],[Q.temporary]:[],...nt&&{[Q.standby]:[]}},center_marker:{[Q.main]:Ii(Ge[Q.main]),[Q.temporary]:Ii(Ge[Q.temporary]),...nt&&{[Q.standby]:Ii(Ge[Q.standby])}},vertex_marker:{[Q.main]:Ii(Ge[Q.main]),[Q.temporary]:Ii(Ge[Q.temporary]),...nt&&{[Q.standby]:Ii(Ge[Q.standby])}},edge_marker:{[Q.main]:tu(Ge[Q.main]),[Q.temporary]:tu(Ge[Q.temporary]),...nt&&{[Q.standby]:tu(Ge[Q.standby])}},snap_guide:{[Q.main]:nu(),[Q.temporary]:nu(),...nt&&{[Q.standby]:nu()}}},nv=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#0A95F0" class="bi bi-geo-alt-fill"
|
|
109
|
+
viewBox="0 0 16 16">
|
|
110
|
+
<path d="M8 16s6-5.686 6-10A6 6 0 0 0 2 6c0 4.314 6 10 6 10m0-7a3 3 0 1 1 0-6 3 3 0 0 1 0 6"/>
|
|
111
|
+
</svg>
|
|
112
|
+
`,rv=`<svg xmlns="http://www.w3.org/2000/svg" width="21" height="21">
|
|
113
|
+
<circle cx="10.5" cy="10.5" r="9.213" fill="#fff" stroke="#278cda" stroke-width="2.303"/>
|
|
114
|
+
</svg>
|
|
115
|
+
`,iv={settings:{throttlingDelay:10,awaitDataUpdatesOnEvents:!0,useDefaultLayers:!0,controlsPosition:"top-left",controlsUiEnabledByDefault:!0,controlsCollapsible:!1,controlsStyles:{controlGroupClass:"maplibregl-ctrl maplibregl-ctrl-group",controlContainerClass:"gm-control-container",controlButtonClass:"gm-control-button"},idGenerator:null,markerIcons:{default:nv,control:rv}},layerStyles:Kf,controls:{draw:{marker:{title:"Marker",icon:mt.marker,uiEnabled:!0,active:!1},circle_marker:{title:"Circle Marker",icon:mt.circle_marker,uiEnabled:!0,active:!1},text_marker:{title:"Text Marker",icon:mt.text_marker,uiEnabled:!0,active:!1},circle:{title:"Circle",icon:mt.circle,uiEnabled:!0,active:!1},ellipse:{title:"Ellipse",icon:mt.ellipse,uiEnabled:!0,active:!1},line:{title:"Line",icon:mt.line,uiEnabled:!0,active:!1},rectangle:{title:"Rectangle",icon:mt.rectangle,uiEnabled:!0,active:!1},polygon:{title:"Polygon",icon:mt.polygon,uiEnabled:!0,active:!1}},edit:{drag:{title:"Drag",icon:mt.drag,uiEnabled:!0,active:!1},change:{title:"Change",icon:mt.change,uiEnabled:!0,active:!1},rotate:{title:"Rotate",icon:mt.rotate,uiEnabled:!0,active:!1},cut:{title:"Cut",icon:mt.cut,uiEnabled:!0,active:!1},delete:{title:"Delete",icon:mt.delete,uiEnabled:!0,active:!1}},helper:{shape_markers:{title:"Shape markers",icon:null,uiEnabled:!1,active:!1},snapping:{title:"Snapping",icon:mt.snapping,uiEnabled:!0,active:!1},zoom_to_features:{title:"Zoom to features",icon:mt.zoom_to_features,uiEnabled:!0,active:!1}}}};var Qf=typeof global=="object"&&global&&global.Object===Object&&global,sv=typeof self=="object"&&self&&self.Object===Object&&self,Nn=Qf||sv||Function("return this")(),an=Nn.Symbol,eg=Object.prototype,av=eg.hasOwnProperty,ov=eg.toString,ds=an?an.toStringTag:void 0;function uv(t){var e=av.call(t,ds),r=t[ds];try{t[ds]=void 0;var s=!0}catch{}var u=ov.call(t);return s&&(e?t[ds]=r:delete t[ds]),u}var lv=Object.prototype,cv=lv.toString;function hv(t){return cv.call(t)}var fv="[object Null]",gv="[object Undefined]",$c=an?an.toStringTag:void 0;function ai(t){return t==null?t===void 0?gv:fv:$c&&$c in Object(t)?uv(t):hv(t)}function Hn(t){return t!=null&&typeof t=="object"}var dv="[object Symbol]";function ji(t){return typeof t=="symbol"||Hn(t)&&ai(t)==dv}function Di(t,e){for(var r=-1,s=t==null?0:t.length,u=Array(s);++r<s;)u[r]=e(t[r],r,t);return u}var Mt=Array.isArray,Wc=an?an.prototype:void 0,Zc=Wc?Wc.toString:void 0;function tg(t){if(typeof t=="string")return t;if(Mt(t))return Di(t,tg)+"";if(ji(t))return Zc?Zc.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var pv=/\s/;function mv(t){for(var e=t.length;e--&&pv.test(t.charAt(e)););return e}var vv=/^\s+/;function yv(t){return t&&t.slice(0,mv(t)+1).replace(vv,"")}function Nt(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Kc=NaN,_v=/^[-+]0x[0-9a-f]+$/i,kv=/^0b[01]+$/i,Ev=/^0o[0-7]+$/i,xv=parseInt;function Qc(t){if(typeof t=="number")return t;if(ji(t))return Kc;if(Nt(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Nt(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=yv(t);var r=kv.test(t);return r||Ev.test(t)?xv(t.slice(2),r?2:8):_v.test(t)?Kc:+t}function po(t){return t}var wv="[object AsyncFunction]",bv="[object Function]",Sv="[object GeneratorFunction]",Iv="[object Proxy]";function kl(t){if(!Nt(t))return!1;var e=ai(t);return e==bv||e==Sv||e==wv||e==Iv}var iu=Nn["__core-js_shared__"],eh=(function(){var t=/[^.]+$/.exec(iu&&iu.keys&&iu.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Mv(t){return!!eh&&eh in t}var Nv=Function.prototype,Lv=Nv.toString;function oi(t){if(t!=null){try{return Lv.call(t)}catch{}try{return t+""}catch{}}return""}var Cv=/[\\^$.*+?()[\]{}|]/g,Av=/^\[object .+?Constructor\]$/,Tv=Function.prototype,Pv=Object.prototype,Ov=Tv.toString,Rv=Pv.hasOwnProperty,Dv=RegExp("^"+Ov.call(Rv).replace(Cv,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Fv(t){if(!Nt(t)||Mv(t))return!1;var e=kl(t)?Dv:Av;return e.test(oi(t))}function Gv(t,e){return t?.[e]}function ui(t,e){var r=Gv(t,e);return Fv(r)?r:void 0}var Cu=ui(Nn,"WeakMap"),th=Object.create,Bv=(function(){function t(){}return function(e){if(!Nt(e))return{};if(th)return th(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})();function Uv(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function jv(){}function qv(t,e){var r=-1,s=t.length;for(e||(e=Array(s));++r<s;)e[r]=t[r];return e}var Yv=800,zv=16,Jv=Date.now;function Hv(t){var e=0,r=0;return function(){var s=Jv(),u=zv-(s-r);if(r=s,u>0){if(++e>=Yv)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Vv(t){return function(){return t}}var Ha=(function(){try{var t=ui(Object,"defineProperty");return t({},"",{}),t}catch{}})(),Xv=Ha?function(t,e){return Ha(t,"toString",{configurable:!0,enumerable:!1,value:Vv(e),writable:!0})}:po,$v=Hv(Xv);function Wv(t,e){for(var r=-1,s=t==null?0:t.length;++r<s&&e(t[r],r,t)!==!1;);return t}function Zv(t,e,r,s){for(var u=t.length,c=r+-1;++c<u;)if(e(t[c],c,t))return c;return-1}function Kv(t){return t!==t}function Qv(t,e,r){for(var s=r-1,u=t.length;++s<u;)if(t[s]===e)return s;return-1}function ey(t,e,r){return e===e?Qv(t,e,r):Zv(t,Kv,r)}function ng(t,e){var r=t==null?0:t.length;return!!r&&ey(t,e,0)>-1}var ty=9007199254740991,ny=/^(?:0|[1-9]\d*)$/;function mo(t,e){var r=typeof t;return e=e??ty,!!e&&(r=="number"||r!="symbol"&&ny.test(t))&&t>-1&&t%1==0&&t<e}function Ks(t,e,r){e=="__proto__"&&Ha?Ha(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function Qs(t,e){return t===e||t!==t&&e!==e}var ry=Object.prototype,iy=ry.hasOwnProperty;function El(t,e,r){var s=t[e];(!(iy.call(t,e)&&Qs(s,r))||r===void 0&&!(e in t))&&Ks(t,e,r)}function sy(t,e,r,s){var u=!r;r||(r={});for(var c=-1,f=e.length;++c<f;){var h=e[c],d=void 0;d===void 0&&(d=t[h]),u?Ks(r,h,d):El(r,h,d)}return r}var nh=Math.max;function ay(t,e,r){return e=nh(e===void 0?t.length-1:e,0),function(){for(var s=arguments,u=-1,c=nh(s.length-e,0),f=Array(c);++u<c;)f[u]=s[e+u];u=-1;for(var h=Array(e+1);++u<e;)h[u]=s[u];return h[e]=r(f),Uv(t,this,h)}}function xl(t,e){return $v(ay(t,e,po),t+"")}var oy=9007199254740991;function wl(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=oy}function Ki(t){return t!=null&&wl(t.length)&&!kl(t)}function Au(t,e,r){if(!Nt(r))return!1;var s=typeof e;return(s=="number"?Ki(r)&&mo(e,r.length):s=="string"&&e in r)?Qs(r[e],t):!1}function rg(t){return xl(function(e,r){var s=-1,u=r.length,c=u>1?r[u-1]:void 0,f=u>2?r[2]:void 0;for(c=t.length>3&&typeof c=="function"?(u--,c):void 0,f&&Au(r[0],r[1],f)&&(c=u<3?void 0:c,u=1),e=Object(e);++s<u;){var h=r[s];h&&t(e,h,s,c)}return e})}var uy=Object.prototype;function bl(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||uy;return t===r}function ly(t,e){for(var r=-1,s=Array(t);++r<t;)s[r]=e(r);return s}var cy="[object Arguments]";function rh(t){return Hn(t)&&ai(t)==cy}var ig=Object.prototype,hy=ig.hasOwnProperty,fy=ig.propertyIsEnumerable,Ys=rh((function(){return arguments})())?rh:function(t){return Hn(t)&&hy.call(t,"callee")&&!fy.call(t,"callee")};function gy(){return!1}var sg=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ih=sg&&typeof module=="object"&&module&&!module.nodeType&&module,dy=ih&&ih.exports===sg,sh=dy?Nn.Buffer:void 0,py=sh?sh.isBuffer:void 0,zs=py||gy,my="[object Arguments]",vy="[object Array]",yy="[object Boolean]",_y="[object Date]",ky="[object Error]",Ey="[object Function]",xy="[object Map]",wy="[object Number]",by="[object Object]",Sy="[object RegExp]",Iy="[object Set]",My="[object String]",Ny="[object WeakMap]",Ly="[object ArrayBuffer]",Cy="[object DataView]",Ay="[object Float32Array]",Ty="[object Float64Array]",Py="[object Int8Array]",Oy="[object Int16Array]",Ry="[object Int32Array]",Dy="[object Uint8Array]",Fy="[object Uint8ClampedArray]",Gy="[object Uint16Array]",By="[object Uint32Array]",Ye={};Ye[Ay]=Ye[Ty]=Ye[Py]=Ye[Oy]=Ye[Ry]=Ye[Dy]=Ye[Fy]=Ye[Gy]=Ye[By]=!0;Ye[my]=Ye[vy]=Ye[Ly]=Ye[yy]=Ye[Cy]=Ye[_y]=Ye[ky]=Ye[Ey]=Ye[xy]=Ye[wy]=Ye[by]=Ye[Sy]=Ye[Iy]=Ye[My]=Ye[Ny]=!1;function Uy(t){return Hn(t)&&wl(t.length)&&!!Ye[ai(t)]}function vo(t){return function(e){return t(e)}}var ag=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ds=ag&&typeof module=="object"&&module&&!module.nodeType&&module,jy=Ds&&Ds.exports===ag,su=jy&&Qf.process,qi=(function(){try{var t=Ds&&Ds.require&&Ds.require("util").types;return t||su&&su.binding&&su.binding("util")}catch{}})(),ah=qi&&qi.isTypedArray,Sl=ah?vo(ah):Uy,qy=Object.prototype,Yy=qy.hasOwnProperty;function og(t,e){var r=Mt(t),s=!r&&Ys(t),u=!r&&!s&&zs(t),c=!r&&!s&&!u&&Sl(t),f=r||s||u||c,h=f?ly(t.length,String):[],d=h.length;for(var p in t)(e||Yy.call(t,p))&&!(f&&(p=="length"||u&&(p=="offset"||p=="parent")||c&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||mo(p,d)))&&h.push(p);return h}function ug(t,e){return function(r){return t(e(r))}}var zy=ug(Object.keys,Object),Jy=Object.prototype,Hy=Jy.hasOwnProperty;function Vy(t){if(!bl(t))return zy(t);var e=[];for(var r in Object(t))Hy.call(t,r)&&r!="constructor"&&e.push(r);return e}function yo(t){return Ki(t)?og(t):Vy(t)}function Xy(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var $y=Object.prototype,Wy=$y.hasOwnProperty;function Zy(t){if(!Nt(t))return Xy(t);var e=bl(t),r=[];for(var s in t)s=="constructor"&&(e||!Wy.call(t,s))||r.push(s);return r}function lg(t){return Ki(t)?og(t,!0):Zy(t)}var Ky=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Qy=/^\w*$/;function Il(t,e){if(Mt(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||ji(t)?!0:Qy.test(t)||!Ky.test(t)||e!=null&&t in Object(e)}var Js=ui(Object,"create");function e0(){this.__data__=Js?Js(null):{},this.size=0}function t0(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var n0="__lodash_hash_undefined__",r0=Object.prototype,i0=r0.hasOwnProperty;function s0(t){var e=this.__data__;if(Js){var r=e[t];return r===n0?void 0:r}return i0.call(e,t)?e[t]:void 0}var a0=Object.prototype,o0=a0.hasOwnProperty;function u0(t){var e=this.__data__;return Js?e[t]!==void 0:o0.call(e,t)}var l0="__lodash_hash_undefined__";function c0(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Js&&e===void 0?l0:e,this}function Kr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var s=t[e];this.set(s[0],s[1])}}Kr.prototype.clear=e0;Kr.prototype.delete=t0;Kr.prototype.get=s0;Kr.prototype.has=u0;Kr.prototype.set=c0;function h0(){this.__data__=[],this.size=0}function _o(t,e){for(var r=t.length;r--;)if(Qs(t[r][0],e))return r;return-1}var f0=Array.prototype,g0=f0.splice;function d0(t){var e=this.__data__,r=_o(e,t);if(r<0)return!1;var s=e.length-1;return r==s?e.pop():g0.call(e,r,1),--this.size,!0}function p0(t){var e=this.__data__,r=_o(e,t);return r<0?void 0:e[r][1]}function m0(t){return _o(this.__data__,t)>-1}function v0(t,e){var r=this.__data__,s=_o(r,t);return s<0?(++this.size,r.push([t,e])):r[s][1]=e,this}function fr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var s=t[e];this.set(s[0],s[1])}}fr.prototype.clear=h0;fr.prototype.delete=d0;fr.prototype.get=p0;fr.prototype.has=m0;fr.prototype.set=v0;var Hs=ui(Nn,"Map");function y0(){this.size=0,this.__data__={hash:new Kr,map:new(Hs||fr),string:new Kr}}function _0(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function ko(t,e){var r=t.__data__;return _0(e)?r[typeof e=="string"?"string":"hash"]:r.map}function k0(t){var e=ko(this,t).delete(t);return this.size-=e?1:0,e}function E0(t){return ko(this,t).get(t)}function x0(t){return ko(this,t).has(t)}function w0(t,e){var r=ko(this,t),s=r.size;return r.set(t,e),this.size+=r.size==s?0:1,this}function gr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var s=t[e];this.set(s[0],s[1])}}gr.prototype.clear=y0;gr.prototype.delete=k0;gr.prototype.get=E0;gr.prototype.has=x0;gr.prototype.set=w0;var b0="Expected a function";function Ml(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(b0);var r=function(){var s=arguments,u=e?e.apply(this,s):s[0],c=r.cache;if(c.has(u))return c.get(u);var f=t.apply(this,s);return r.cache=c.set(u,f)||c,f};return r.cache=new(Ml.Cache||gr),r}Ml.Cache=gr;var S0=500;function I0(t){var e=Ml(t,function(s){return r.size===S0&&r.clear(),s}),r=e.cache;return e}var M0=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,N0=/\\(\\)?/g,L0=I0(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(M0,function(r,s,u,c){e.push(u?c.replace(N0,"$1"):s||r)}),e});function C0(t){return t==null?"":tg(t)}function Nl(t,e){return Mt(t)?t:Il(t,e)?[t]:L0(C0(t))}function ea(t){if(typeof t=="string"||ji(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function Ll(t,e){e=Nl(e,t);for(var r=0,s=e.length;t!=null&&r<s;)t=t[ea(e[r++])];return r&&r==s?t:void 0}function Yi(t,e,r){var s=t==null?void 0:Ll(t,e);return s===void 0?r:s}function cg(t,e){for(var r=-1,s=e.length,u=t.length;++r<s;)t[u+r]=e[r];return t}var oh=an?an.isConcatSpreadable:void 0;function A0(t){return Mt(t)||Ys(t)||!!(oh&&t&&t[oh])}function T0(t,e,r,s,u){var c=-1,f=t.length;for(r||(r=A0),u||(u=[]);++c<f;){var h=t[c];r(h)?cg(u,h):u[u.length]=h}return u}var hg=ug(Object.getPrototypeOf,Object),P0="[object Object]",O0=Function.prototype,R0=Object.prototype,fg=O0.toString,D0=R0.hasOwnProperty,F0=fg.call(Object);function gg(t){if(!Hn(t)||ai(t)!=P0)return!1;var e=hg(t);if(e===null)return!0;var r=D0.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&fg.call(r)==F0}function G0(){this.__data__=new fr,this.size=0}function B0(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}function U0(t){return this.__data__.get(t)}function j0(t){return this.__data__.has(t)}var q0=200;function Y0(t,e){var r=this.__data__;if(r instanceof fr){var s=r.__data__;if(!Hs||s.length<q0-1)return s.push([t,e]),this.size=++r.size,this;r=this.__data__=new gr(s)}return r.set(t,e),this.size=r.size,this}function In(t){var e=this.__data__=new fr(t);this.size=e.size}In.prototype.clear=G0;In.prototype.delete=B0;In.prototype.get=U0;In.prototype.has=j0;In.prototype.set=Y0;var dg=typeof exports=="object"&&exports&&!exports.nodeType&&exports,uh=dg&&typeof module=="object"&&module&&!module.nodeType&&module,z0=uh&&uh.exports===dg,lh=z0?Nn.Buffer:void 0,ch=lh?lh.allocUnsafe:void 0;function pg(t,e){if(e)return t.slice();var r=t.length,s=ch?ch(r):new t.constructor(r);return t.copy(s),s}function J0(t,e){for(var r=-1,s=t==null?0:t.length,u=0,c=[];++r<s;){var f=t[r];e(f,r,t)&&(c[u++]=f)}return c}function H0(){return[]}var V0=Object.prototype,X0=V0.propertyIsEnumerable,hh=Object.getOwnPropertySymbols,$0=hh?function(t){return t==null?[]:(t=Object(t),J0(hh(t),function(e){return X0.call(t,e)}))}:H0;function W0(t,e,r){var s=e(t);return Mt(t)?s:cg(s,r(t))}function Tu(t){return W0(t,yo,$0)}var Pu=ui(Nn,"DataView"),Ou=ui(Nn,"Promise"),Fi=ui(Nn,"Set"),fh="[object Map]",Z0="[object Object]",gh="[object Promise]",dh="[object Set]",ph="[object WeakMap]",mh="[object DataView]",K0=oi(Pu),Q0=oi(Hs),e_=oi(Ou),t_=oi(Fi),n_=oi(Cu),yn=ai;(Pu&&yn(new Pu(new ArrayBuffer(1)))!=mh||Hs&&yn(new Hs)!=fh||Ou&&yn(Ou.resolve())!=gh||Fi&&yn(new Fi)!=dh||Cu&&yn(new Cu)!=ph)&&(yn=function(t){var e=ai(t),r=e==Z0?t.constructor:void 0,s=r?oi(r):"";if(s)switch(s){case K0:return mh;case Q0:return fh;case e_:return gh;case t_:return dh;case n_:return ph}return e});var r_=Object.prototype,i_=r_.hasOwnProperty;function s_(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&i_.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Va=Nn.Uint8Array;function Cl(t){var e=new t.constructor(t.byteLength);return new Va(e).set(new Va(t)),e}function a_(t,e){var r=Cl(t.buffer);return new t.constructor(r,t.byteOffset,t.byteLength)}var o_=/\w*$/;function u_(t){var e=new t.constructor(t.source,o_.exec(t));return e.lastIndex=t.lastIndex,e}var vh=an?an.prototype:void 0,yh=vh?vh.valueOf:void 0;function l_(t){return yh?Object(yh.call(t)):{}}function mg(t,e){var r=e?Cl(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var c_="[object Boolean]",h_="[object Date]",f_="[object Map]",g_="[object Number]",d_="[object RegExp]",p_="[object Set]",m_="[object String]",v_="[object Symbol]",y_="[object ArrayBuffer]",__="[object DataView]",k_="[object Float32Array]",E_="[object Float64Array]",x_="[object Int8Array]",w_="[object Int16Array]",b_="[object Int32Array]",S_="[object Uint8Array]",I_="[object Uint8ClampedArray]",M_="[object Uint16Array]",N_="[object Uint32Array]";function L_(t,e,r){var s=t.constructor;switch(e){case y_:return Cl(t);case c_:case h_:return new s(+t);case __:return a_(t);case k_:case E_:case x_:case w_:case b_:case S_:case I_:case M_:case N_:return mg(t,r);case f_:return new s;case g_:case m_:return new s(t);case d_:return u_(t);case p_:return new s;case v_:return l_(t)}}function vg(t){return typeof t.constructor=="function"&&!bl(t)?Bv(hg(t)):{}}var C_="[object Map]";function A_(t){return Hn(t)&&yn(t)==C_}var _h=qi&&qi.isMap,T_=_h?vo(_h):A_,P_="[object Set]";function O_(t){return Hn(t)&&yn(t)==P_}var kh=qi&&qi.isSet,R_=kh?vo(kh):O_,D_=1,yg="[object Arguments]",F_="[object Array]",G_="[object Boolean]",B_="[object Date]",U_="[object Error]",_g="[object Function]",j_="[object GeneratorFunction]",q_="[object Map]",Y_="[object Number]",kg="[object Object]",z_="[object RegExp]",J_="[object Set]",H_="[object String]",V_="[object Symbol]",X_="[object WeakMap]",$_="[object ArrayBuffer]",W_="[object DataView]",Z_="[object Float32Array]",K_="[object Float64Array]",Q_="[object Int8Array]",e1="[object Int16Array]",t1="[object Int32Array]",n1="[object Uint8Array]",r1="[object Uint8ClampedArray]",i1="[object Uint16Array]",s1="[object Uint32Array]",Be={};Be[yg]=Be[F_]=Be[$_]=Be[W_]=Be[G_]=Be[B_]=Be[Z_]=Be[K_]=Be[Q_]=Be[e1]=Be[t1]=Be[q_]=Be[Y_]=Be[kg]=Be[z_]=Be[J_]=Be[H_]=Be[V_]=Be[n1]=Be[r1]=Be[i1]=Be[s1]=!0;Be[U_]=Be[_g]=Be[X_]=!1;function Ra(t,e,r,s,u,c){var f,h=e&D_;if(f!==void 0)return f;if(!Nt(t))return t;var d=Mt(t);if(d)f=s_(t);else{var p=yn(t),y=p==_g||p==j_;if(zs(t))return pg(t,h);if(p==kg||p==yg||y&&!u)f=y?{}:vg(t);else{if(!Be[p])return u?t:{};f=L_(t,p,h)}}c||(c=new In);var v=c.get(t);if(v)return v;c.set(t,f),R_(t)?t.forEach(function(b){f.add(Ra(b,e,r,b,t,c))}):T_(t)&&t.forEach(function(b,N){f.set(N,Ra(b,e,r,N,t,c))});var E=Tu,S=d?void 0:E(t);return Wv(S||t,function(b,N){S&&(N=b,b=t[N]),El(f,N,Ra(b,e,r,N,t,c))}),f}var a1=1,o1=4;function Ht(t){return Ra(t,a1|o1)}var u1="__lodash_hash_undefined__";function l1(t){return this.__data__.set(t,u1),this}function c1(t){return this.__data__.has(t)}function zi(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new gr;++e<r;)this.add(t[e])}zi.prototype.add=zi.prototype.push=l1;zi.prototype.has=c1;function h1(t,e){for(var r=-1,s=t==null?0:t.length;++r<s;)if(e(t[r],r,t))return!0;return!1}function Xa(t,e){return t.has(e)}var f1=1,g1=2;function Eg(t,e,r,s,u,c){var f=r&f1,h=t.length,d=e.length;if(h!=d&&!(f&&d>h))return!1;var p=c.get(t),y=c.get(e);if(p&&y)return p==e&&y==t;var v=-1,E=!0,S=r&g1?new zi:void 0;for(c.set(t,e),c.set(e,t);++v<h;){var b=t[v],N=e[v];if(s)var O=f?s(N,b,v,e,t,c):s(b,N,v,t,e,c);if(O!==void 0){if(O)continue;E=!1;break}if(S){if(!h1(e,function(D,L){if(!Xa(S,L)&&(b===D||u(b,D,r,s,c)))return S.push(L)})){E=!1;break}}else if(!(b===N||u(b,N,r,s,c))){E=!1;break}}return c.delete(t),c.delete(e),E}function d1(t){var e=-1,r=Array(t.size);return t.forEach(function(s,u){r[++e]=[u,s]}),r}function Al(t){var e=-1,r=Array(t.size);return t.forEach(function(s){r[++e]=s}),r}var p1=1,m1=2,v1="[object Boolean]",y1="[object Date]",_1="[object Error]",k1="[object Map]",E1="[object Number]",x1="[object RegExp]",w1="[object Set]",b1="[object String]",S1="[object Symbol]",I1="[object ArrayBuffer]",M1="[object DataView]",Eh=an?an.prototype:void 0,au=Eh?Eh.valueOf:void 0;function N1(t,e,r,s,u,c,f){switch(r){case M1:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case I1:return!(t.byteLength!=e.byteLength||!c(new Va(t),new Va(e)));case v1:case y1:case E1:return Qs(+t,+e);case _1:return t.name==e.name&&t.message==e.message;case x1:case b1:return t==e+"";case k1:var h=d1;case w1:var d=s&p1;if(h||(h=Al),t.size!=e.size&&!d)return!1;var p=f.get(t);if(p)return p==e;s|=m1,f.set(t,e);var y=Eg(h(t),h(e),s,u,c,f);return f.delete(t),y;case S1:if(au)return au.call(t)==au.call(e)}return!1}var L1=1,C1=Object.prototype,A1=C1.hasOwnProperty;function T1(t,e,r,s,u,c){var f=r&L1,h=Tu(t),d=h.length,p=Tu(e),y=p.length;if(d!=y&&!f)return!1;for(var v=d;v--;){var E=h[v];if(!(f?E in e:A1.call(e,E)))return!1}var S=c.get(t),b=c.get(e);if(S&&b)return S==e&&b==t;var N=!0;c.set(t,e),c.set(e,t);for(var O=f;++v<d;){E=h[v];var D=t[E],L=e[E];if(s)var q=f?s(L,D,E,e,t,c):s(D,L,E,t,e,c);if(!(q===void 0?D===L||u(D,L,r,s,c):q)){N=!1;break}O||(O=E=="constructor")}if(N&&!O){var H=t.constructor,J=e.constructor;H!=J&&"constructor"in t&&"constructor"in e&&!(typeof H=="function"&&H instanceof H&&typeof J=="function"&&J instanceof J)&&(N=!1)}return c.delete(t),c.delete(e),N}var P1=1,xh="[object Arguments]",wh="[object Array]",ya="[object Object]",O1=Object.prototype,bh=O1.hasOwnProperty;function R1(t,e,r,s,u,c){var f=Mt(t),h=Mt(e),d=f?wh:yn(t),p=h?wh:yn(e);d=d==xh?ya:d,p=p==xh?ya:p;var y=d==ya,v=p==ya,E=d==p;if(E&&zs(t)){if(!zs(e))return!1;f=!0,y=!1}if(E&&!y)return c||(c=new In),f||Sl(t)?Eg(t,e,r,s,u,c):N1(t,e,d,r,s,u,c);if(!(r&P1)){var S=y&&bh.call(t,"__wrapped__"),b=v&&bh.call(e,"__wrapped__");if(S||b){var N=S?t.value():t,O=b?e.value():e;return c||(c=new In),u(N,O,r,s,c)}}return E?(c||(c=new In),T1(t,e,r,s,u,c)):!1}function Eo(t,e,r,s,u){return t===e?!0:t==null||e==null||!Hn(t)&&!Hn(e)?t!==t&&e!==e:R1(t,e,r,s,Eo,u)}var D1=1,F1=2;function G1(t,e,r,s){var u=r.length,c=u;if(t==null)return!c;for(t=Object(t);u--;){var f=r[u];if(f[2]?f[1]!==t[f[0]]:!(f[0]in t))return!1}for(;++u<c;){f=r[u];var h=f[0],d=t[h],p=f[1];if(f[2]){if(d===void 0&&!(h in t))return!1}else{var y=new In,v;if(!(v===void 0?Eo(p,d,D1|F1,s,y):v))return!1}}return!0}function xg(t){return t===t&&!Nt(t)}function B1(t){for(var e=yo(t),r=e.length;r--;){var s=e[r],u=t[s];e[r]=[s,u,xg(u)]}return e}function wg(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function U1(t){var e=B1(t);return e.length==1&&e[0][2]?wg(e[0][0],e[0][1]):function(r){return r===t||G1(r,t,e)}}function j1(t,e){return t!=null&&e in Object(t)}function q1(t,e,r){e=Nl(e,t);for(var s=-1,u=e.length,c=!1;++s<u;){var f=ea(e[s]);if(!(c=t!=null&&r(t,f)))break;t=t[f]}return c||++s!=u?c:(u=t==null?0:t.length,!!u&&wl(u)&&mo(f,u)&&(Mt(t)||Ys(t)))}function Y1(t,e){return t!=null&&q1(t,e,j1)}var z1=1,J1=2;function H1(t,e){return Il(t)&&xg(e)?wg(ea(t),e):function(r){var s=Yi(r,t);return s===void 0&&s===e?Y1(r,t):Eo(e,s,z1|J1)}}function V1(t){return function(e){return e?.[t]}}function X1(t){return function(e){return Ll(e,t)}}function $1(t){return Il(t)?V1(ea(t)):X1(t)}function bg(t){return typeof t=="function"?t:t==null?po:typeof t=="object"?Mt(t)?H1(t[0],t[1]):U1(t):$1(t)}function W1(t,e,r,s){for(var u=-1,c=t==null?0:t.length;++u<c;){var f=t[u];e(s,f,r(f),t)}return s}function Z1(t){return function(e,r,s){for(var u=-1,c=Object(e),f=s(e),h=f.length;h--;){var d=f[++u];if(r(c[d],d,c)===!1)break}return e}}var Sg=Z1();function K1(t,e){return t&&Sg(t,e,yo)}function Q1(t,e){return function(r,s){if(r==null)return r;if(!Ki(r))return t(r,s);for(var u=r.length,c=-1,f=Object(r);++c<u&&s(f[c],c,f)!==!1;);return r}}var Ig=Q1(K1);function ek(t,e,r,s){return Ig(t,function(u,c,f){e(s,u,r(u),f)}),s}function Mg(t,e){return function(r,s){var u=Mt(r)?W1:ek,c=e?e():{};return u(r,t,bg(s),c)}}var tk=Object.prototype,nk=tk.hasOwnProperty,rk=Mg(function(t,e,r){nk.call(t,r)?++t[r]:Ks(t,r,1)}),ou=function(){return Nn.Date.now()},ik="Expected a function",sk=Math.max,ak=Math.min;function Ng(t,e,r){var s,u,c,f,h,d,p=0,y=!1,v=!1,E=!0;if(typeof t!="function")throw new TypeError(ik);e=Qc(e)||0,Nt(r)&&(y=!!r.leading,v="maxWait"in r,c=v?sk(Qc(r.maxWait)||0,e):c,E="trailing"in r?!!r.trailing:E);function S(z){var $=s,k=u;return s=u=void 0,p=z,f=t.apply(k,$),f}function b(z){return p=z,h=setTimeout(D,e),y?S(z):f}function N(z){var $=z-d,k=z-p,w=e-$;return v?ak(w,c-k):w}function O(z){var $=z-d,k=z-p;return d===void 0||$>=e||$<0||v&&k>=c}function D(){var z=ou();if(O(z))return L(z);h=setTimeout(D,N(z))}function L(z){return h=void 0,E&&s?S(z):(s=u=void 0,f)}function q(){h!==void 0&&clearTimeout(h),p=0,s=d=u=h=void 0}function H(){return h===void 0?f:L(ou())}function J(){var z=ou(),$=O(z);if(s=arguments,u=this,d=z,$){if(h===void 0)return b(d);if(v)return clearTimeout(h),h=setTimeout(D,e),S(d)}return h===void 0&&(h=setTimeout(D,e)),f}return J.cancel=q,J.flush=H,J}function Ru(t,e,r){(r!==void 0&&!Qs(t[e],r)||r===void 0&&!(e in t))&&Ks(t,e,r)}function Lg(t){return Hn(t)&&Ki(t)}function Du(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}function ok(t){return sy(t,lg(t))}function uk(t,e,r,s,u,c,f){var h=Du(t,r),d=Du(e,r),p=f.get(d);if(p){Ru(t,r,p);return}var y=c?c(h,d,r+"",t,e,f):void 0,v=y===void 0;if(v){var E=Mt(d),S=!E&&zs(d),b=!E&&!S&&Sl(d);y=d,E||S||b?Mt(h)?y=h:Lg(h)?y=qv(h):S?(v=!1,y=pg(d,!0)):b?(v=!1,y=mg(d,!0)):y=[]:gg(d)||Ys(d)?(y=h,Ys(h)?y=ok(h):(!Nt(h)||kl(h))&&(y=vg(d))):v=!1}v&&(f.set(d,y),u(y,d,s,c,f),f.delete(d)),Ru(t,r,y)}function Tl(t,e,r,s,u){t!==e&&Sg(e,function(c,f){if(u||(u=new In),Nt(c))uk(t,e,f,r,Tl,s,u);else{var h=s?s(Du(t,f),c,f+"",t,e,u):void 0;h===void 0&&(h=c),Ru(t,f,h)}},lg)}var lk=rg(function(t,e,r,s){Tl(t,e,r,s)});function ck(t,e,r){for(var s=-1,u=t==null?0:t.length;++s<u;)if(r(e,t[s]))return!0;return!1}function hk(t,e){var r=-1,s=Ki(t)?Array(t.length):[];return Ig(t,function(u,c,f){s[++r]=e(u,c,f)}),s}function fk(t,e){return Di(e,function(r){return t[r]})}function gk(t){return t==null?[]:fk(t,yo(t))}var dk=Math.min;function pk(t,e,r){for(var s=ng,u=t[0].length,c=t.length,f=c,h=Array(c),d=1/0,p=[];f--;){var y=t[f];d=dk(y.length,d),h[f]=u>=120&&y.length>=120?new zi(f&&y):void 0}y=t[0];var v=-1,E=h[0];e:for(;++v<u&&p.length<d;){var S=y[v],b=S;if(S=S!==0?S:0,!(E?Xa(E,b):s(p,b))){for(f=c;--f;){var N=h[f];if(!(N?Xa(N,b):s(t[f],b)))continue e}E&&E.push(b),p.push(S)}}return p}function mk(t){return Lg(t)?t:[]}var vk=xl(function(t){var e=Di(t,mk);return e.length&&e[0]===t[0]?pk(e):[]});function Qi(t,e){return Eo(t,e)}var yk=Mg(function(t,e,r){Ks(t,r,e)}),_k=rg(function(t,e,r){Tl(t,e,r)});function kk(t,e,r,s){if(!Nt(t))return t;e=Nl(e,t);for(var u=-1,c=e.length,f=c-1,h=t;h!=null&&++u<c;){var d=ea(e[u]),p=r;if(d==="__proto__"||d==="constructor"||d==="prototype")return t;if(u!=f){var y=h[d];p=void 0,p===void 0&&(p=Nt(y)?y:mo(e[u+1])?[]:{})}El(h,d,p),h=h[d]}return t}function Ek(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}function xk(t,e){if(t!==e){var r=t!==void 0,s=t===null,u=t===t,c=ji(t),f=e!==void 0,h=e===null,d=e===e,p=ji(e);if(!h&&!p&&!c&&t>e||c&&f&&d&&!h&&!p||s&&f&&d||!r&&d||!u)return 1;if(!s&&!c&&!p&&t<e||p&&r&&u&&!s&&!c||h&&r&&u||!f&&u||!d)return-1}return 0}function wk(t,e,r){for(var s=-1,u=t.criteria,c=e.criteria,f=u.length,h=r.length;++s<f;){var d=xk(u[s],c[s]);if(d){if(s>=h)return d;var p=r[s];return d*(p=="desc"?-1:1)}}return t.index-e.index}function bk(t,e,r){e.length?e=Di(e,function(c){return Mt(c)?function(f){return Ll(f,c.length===1?c[0]:c)}:c}):e=[po];var s=-1;e=Di(e,vo(bg));var u=hk(t,function(c,f,h){var d=Di(e,function(p){return p(c)});return{criteria:d,index:++s,value:c}});return Ek(u,function(c,f){return wk(c,f,r)})}function Sk(t,e,r){return t==null?t:kk(t,e,r)}var Sh=xl(function(t,e){if(t==null)return[];var r=e.length;return r>1&&Au(t,e[0],e[1])?e=[]:r>2&&Au(e[0],e[1],e[2])&&(e=[e[0]]),bk(t,T0(e),[])}),Ik="Expected a function";function Cg(t,e,r){var s=!0,u=!0;if(typeof t!="function")throw new TypeError(Ik);return Nt(r)&&(s="leading"in r?!!r.leading:s,u="trailing"in r?!!r.trailing:u),Ng(t,e,{leading:s,maxWait:e,trailing:u})}var Mk=1/0,Nk=Fi&&1/Al(new Fi([,-0]))[1]==Mk?function(t){return new Fi(t)}:jv,Lk=200;function Ck(t,e,r){var s=-1,u=ng,c=t.length,f=!0,h=[],d=h;if(r)f=!1,u=ck;else if(c>=Lk){var p=Nk(t);if(p)return Al(p);f=!1,u=Xa,d=new zi}else d=h;e:for(;++s<c;){var y=t[s],v=y;if(y=r||y!==0?y:0,f&&v===v){for(var E=d.length;E--;)if(d[E]===v)continue e;h.push(y)}else u(d,v,r)||(d!==h&&d.push(v),h.push(y))}return h}function Ih(t,e){return e=typeof e=="function"?e:void 0,t&&t.length?Ck(t,void 0,e):[]}function Ag(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Fu={exports:{}},Ak=Fu.exports,Mh;function Tk(){return Mh||(Mh=1,(function(t){(function(e,r){t.exports?t.exports=r():e.log=r()})(Ak,function(){var e=function(){},r="undefined",s=typeof window!==r&&typeof window.navigator!==r&&/Trident\/|MSIE /.test(window.navigator.userAgent),u=["trace","debug","info","warn","error"],c={},f=null;function h(N,O){var D=N[O];if(typeof D.bind=="function")return D.bind(N);try{return Function.prototype.bind.call(D,N)}catch{return function(){return Function.prototype.apply.apply(D,[N,arguments])}}}function d(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function p(N){return N==="debug"&&(N="log"),typeof console===r?!1:N==="trace"&&s?d:console[N]!==void 0?h(console,N):console.log!==void 0?h(console,"log"):e}function y(){for(var N=this.getLevel(),O=0;O<u.length;O++){var D=u[O];this[D]=O<N?e:this.methodFactory(D,N,this.name)}if(this.log=this.debug,typeof console===r&&N<this.levels.SILENT)return"No console available for logging"}function v(N){return function(){typeof console!==r&&(y.call(this),this[N].apply(this,arguments))}}function E(N,O,D){return p(N)||v.apply(this,arguments)}function S(N,O){var D=this,L,q,H,J="loglevel";typeof N=="string"?J+=":"+N:typeof N=="symbol"&&(J=void 0);function z(P){var T=(u[P]||"silent").toUpperCase();if(!(typeof window===r||!J)){try{window.localStorage[J]=T;return}catch{}try{window.document.cookie=encodeURIComponent(J)+"="+T+";"}catch{}}}function $(){var P;if(!(typeof window===r||!J)){try{P=window.localStorage[J]}catch{}if(typeof P===r)try{var T=window.document.cookie,G=encodeURIComponent(J),R=T.indexOf(G+"=");R!==-1&&(P=/^([^;]+)/.exec(T.slice(R+G.length+1))[1])}catch{}return D.levels[P]===void 0&&(P=void 0),P}}function k(){if(!(typeof window===r||!J)){try{window.localStorage.removeItem(J)}catch{}try{window.document.cookie=encodeURIComponent(J)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function w(P){var T=P;if(typeof T=="string"&&D.levels[T.toUpperCase()]!==void 0&&(T=D.levels[T.toUpperCase()]),typeof T=="number"&&T>=0&&T<=D.levels.SILENT)return T;throw new TypeError("log.setLevel() called with invalid level: "+P)}D.name=N,D.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},D.methodFactory=O||E,D.getLevel=function(){return H??q??L},D.setLevel=function(P,T){return H=w(P),T!==!1&&z(H),y.call(D)},D.setDefaultLevel=function(P){q=w(P),$()||D.setLevel(P,!1)},D.resetLevel=function(){H=null,k(),y.call(D)},D.enableAll=function(P){D.setLevel(D.levels.TRACE,P)},D.disableAll=function(P){D.setLevel(D.levels.SILENT,P)},D.rebuild=function(){if(f!==D&&(L=w(f.getLevel())),y.call(D),f===D)for(var P in c)c[P].rebuild()},L=w(f?f.getLevel():"WARN");var I=$();I!=null&&(H=w(I)),y.call(D)}f=new S,f.getLogger=function(N){if(typeof N!="symbol"&&typeof N!="string"||N==="")throw new TypeError("You must supply a name when creating a logger.");var O=c[N];return O||(O=c[N]=new S(N,f.methodFactory)),O};var b=typeof window!==r?window.log:void 0;return f.noConflict=function(){return typeof window!==r&&window.log===f&&(window.log=b),f},f.getLoggers=function(){return c},f.default=f,f})})(Fu)),Fu.exports}var Pk=Tk();const te=Ag(Pk),Ok=(t,e)=>{let r=null;try{t.forEach(s=>{if(e(s))throw r=s,new Error("found")})}catch{}return r};function Gu(t,e,r=[]){e(t,r),Array.isArray(t)?t.forEach((s,u)=>Gu(s,e,[...r,u])):gg(t)?Object.entries(t).forEach(([s,u])=>Gu(u,e,[...r,s])):t!==null&&typeof t=="object"&&te.warn(`forEachDeep: unknown collection type (${t}), path "${r.join(".")}"`)}const Rk=t=>{const e=["shape_markers"],r=t.settings.controlsUiEnabledByDefault;Gu(t,(s,u)=>{const c=u.at(2);if(u.length===4&&u.at(-1)==="uiEnabled"){if(e.includes(c))return;Sk(t,u,r)}})},Bu=()=>Ht(iv),Dk=!1;var Pl=Array.isArray,Fk=Array.prototype.indexOf,Ji=Array.prototype.includes,xo=Array.from,Tg=Object.defineProperty,Fs=Object.getOwnPropertyDescriptor,Gk=Object.getOwnPropertyDescriptors,Bk=Object.prototype,Uk=Array.prototype,Pg=Object.getPrototypeOf,Nh=Object.isExtensible;function jk(t){return typeof t=="function"}const _n=()=>{};function qk(t){for(var e=0;e<t.length;e++)t[e]()}function Og(){var t,e,r=new Promise((s,u)=>{t=s,e=u});return{promise:r,resolve:t,reject:e}}function $a(t,e){if(Array.isArray(t))return t;if(!(Symbol.iterator in t))return Array.from(t);const r=[];for(const s of t)if(r.push(s),r.length===e)break;return r}const gt=2,Wa=4,wo=8,Rg=1<<24,Zn=16,Ln=32,li=64,Ol=128,rn=512,ct=1024,Lt=2048,dr=4096,Jt=8192,Mr=16384,bo=32768,Qr=65536,Lh=1<<17,Dg=1<<18,es=1<<19,Yk=1<<20,sr=1<<25,ei=32768,Uu=1<<21,Rl=1<<22,Nr=1<<23,Gs=Symbol("$state"),zk=Symbol(""),Pi=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"};function Fg(t){return t===this.v}function Gg(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Bg(t){return!Gg(t,this.v)}function Ug(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Jk(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Hk(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Vk(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Xk(t){throw new Error("https://svelte.dev/e/effect_orphan")}function $k(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Wk(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Zk(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Kk(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Qk(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}let eE=!1;const tE=1,nE=2,jg=4,rE=8,iE=16,sE=1,aE=2,oE=4,uE=1,lE=2,ft=Symbol(),cE="http://www.w3.org/1999/xhtml";let vt=null;function Hi(t){vt=t}function qg(t){return hE().get(t)}function ts(t,e=!1,r){vt={p:vt,i:!1,c:null,e:null,s:t,x:null,l:null}}function ns(t){var e=vt,r=e.e;if(r!==null){e.e=null;for(var s of r)gd(s)}return e.i=!0,vt=e.p,{}}function Yg(){return!0}function hE(t){return vt===null&&Ug(),vt.c??=new Map(fE(vt)||void 0)}function fE(t){let e=t.p;for(;e!==null;){const r=e.c;if(r!==null)return r;e=e.p}return null}let Oi=[];function gE(){var t=Oi;Oi=[],qk(t)}function Lr(t){if(Oi.length===0){var e=Oi;queueMicrotask(()=>{e===Oi&&gE()})}Oi.push(t)}function dE(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function pE(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Ss(t){if(typeof t!="object"||t===null||Gs in t)return t;const e=Pg(t);if(e!==Bk&&e!==Uk)return t;var r=new Map,s=Pl(t),u=jn(0),c=Wr,f=h=>{if(Wr===c)return h();var d=Ne,p=Wr;on(null),Rh(c);var y=h();return on(d),Rh(p),y};return s&&r.set("length",jn(t.length)),new Proxy(t,{defineProperty(h,d,p){(!("value"in p)||p.configurable===!1||p.enumerable===!1||p.writable===!1)&&Wk();var y=r.get(d);return y===void 0?y=f(()=>{var v=jn(p.value);return r.set(d,v),v}):It(y,p.value,!0),!0},deleteProperty(h,d){var p=r.get(d);if(p===void 0){if(d in h){const y=f(()=>jn(ft));r.set(d,y),Bs(u)}}else It(p,ft),Bs(u);return!0},get(h,d,p){if(d===Gs)return t;var y=r.get(d),v=d in h;if(y===void 0&&(!v||Fs(h,d)?.writable)&&(y=f(()=>{var S=Ss(v?h[d]:ft),b=jn(S);return b}),r.set(d,y)),y!==void 0){var E=ye(y);return E===ft?void 0:E}return Reflect.get(h,d,p)},getOwnPropertyDescriptor(h,d){var p=Reflect.getOwnPropertyDescriptor(h,d);if(p&&"value"in p){var y=r.get(d);y&&(p.value=ye(y))}else if(p===void 0){var v=r.get(d),E=v?.v;if(v!==void 0&&E!==ft)return{enumerable:!0,configurable:!0,value:E,writable:!0}}return p},has(h,d){if(d===Gs)return!0;var p=r.get(d),y=p!==void 0&&p.v!==ft||Reflect.has(h,d);if(p!==void 0||Oe!==null&&(!y||Fs(h,d)?.writable)){p===void 0&&(p=f(()=>{var E=y?Ss(h[d]):ft,S=jn(E);return S}),r.set(d,p));var v=ye(p);if(v===ft)return!1}return y},set(h,d,p,y){var v=r.get(d),E=d in h;if(s&&d==="length")for(var S=p;S<v.v;S+=1){var b=r.get(S+"");b!==void 0?It(b,ft):S in h&&(b=f(()=>jn(ft)),r.set(S+"",b))}if(v===void 0)(!E||Fs(h,d)?.writable)&&(v=f(()=>jn(void 0)),It(v,Ss(p)),r.set(d,v));else{E=v.v!==ft;var N=f(()=>Ss(p));It(v,N)}var O=Reflect.getOwnPropertyDescriptor(h,d);if(O?.set&&O.set.call(y,p),!E){if(s&&typeof d=="string"){var D=r.get("length"),L=Number(d);Number.isInteger(L)&&L>=D.v&&It(D,L+1)}Bs(u)}return!0},ownKeys(h){ye(u);var d=Reflect.ownKeys(h).filter(v=>{var E=r.get(v);return E===void 0||E.v!==ft});for(var[p,y]of r)y.v!==ft&&!(p in h)&&d.push(p);return d},setPrototypeOf(){Zk()}})}function Ch(t){try{if(t!==null&&typeof t=="object"&&Gs in t)return t[Gs]}catch{}return t}function mE(t,e){return Object.is(Ch(t),Ch(e))}var Ah,zg,Jg,Hg;function vE(){if(Ah===void 0){Ah=window,zg=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;Jg=Fs(e,"firstChild").get,Hg=Fs(e,"nextSibling").get,Nh(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Nh(r)&&(r.__t=void 0)}}function Cr(t=""){return document.createTextNode(t)}function Sr(t){return Jg.call(t)}function ta(t){return Hg.call(t)}function xn(t,e){return Sr(t)}function Mn(t,e=!1){{var r=Sr(t);return r instanceof Comment&&r.data===""?ta(r):r}}function Vs(t,e=1,r=!1){let s=t;for(;e--;)s=ta(s);return s}function yE(t){t.textContent=""}function Vg(){return!1}function Xg(t){var e=Oe;if(e===null)return Ne.f|=Nr,t;if((e.f&bo)===0){if((e.f&Ol)===0)throw t;e.b.error(t)}else Vi(t,e)}function Vi(t,e){for(;e!==null;){if((e.f&Ol)!==0)try{e.b.error(t);return}catch(r){t=r}e=e.parent}throw t}const _E=-7169;function st(t,e){t.f=t.f&_E|e}function Dl(t){(t.f&rn)!==0||t.deps===null?st(t,ct):st(t,dr)}function $g(t){if(t!==null)for(const e of t)(e.f>)===0||(e.f&ei)===0||(e.f^=ei,$g(e.deps))}function Wg(t,e,r){(t.f&Lt)!==0?e.add(t):(t.f&dr)!==0&&r.add(t),$g(t.deps),st(t,ct)}const _a=new Set;let Ue=null,ju=null,kn=null,mn=[],Fl=null,qu=!1;class Ar{committed=!1;current=new Map;previous=new Map;#e=new Set;#a=new Set;#t=0;#i=0;#s=null;#r=new Set;#n=new Set;skipped_effects=new Set;is_fork=!1;#o=!1;is_deferred(){return this.is_fork||this.#i>0}process(e){mn=[],this.apply();var r=[],s=[];for(const u of e)this.#u(u,r,s);if(this.is_deferred()){this.#l(s),this.#l(r);for(const u of this.skipped_effects)Qg(u)}else{for(const u of this.#e)u();this.#e.clear(),this.#t===0&&this.#c(),ju=this,Ue=null,Th(s),Th(r),ju=null,this.#s?.resolve()}kn=null}#u(e,r,s){e.f^=ct;for(var u=e.first,c=null;u!==null;){var f=u.f,h=(f&(Ln|li))!==0,d=h&&(f&ct)!==0,p=d||(f&Jt)!==0||this.skipped_effects.has(u);if(!p&&u.fn!==null){h?u.f^=ct:c!==null&&(f&(Wa|wo|Rg))!==0?c.b.defer_effect(u):(f&Wa)!==0?r.push(u):ra(u)&&((f&Zn)!==0&&this.#n.add(u),Xs(u));var y=u.first;if(y!==null){u=y;continue}}var v=u.parent;for(u=u.next;u===null&&v!==null;)v===c&&(c=null),u=v.next,v=v.parent}}#l(e){for(var r=0;r<e.length;r+=1)Wg(e[r],this.#r,this.#n)}capture(e,r){r!==ft&&!this.previous.has(e)&&this.previous.set(e,r),(e.f&Nr)===0&&(this.current.set(e,e.v),kn?.set(e,e.v))}activate(){Ue=this,this.apply()}deactivate(){Ue===this&&(Ue=null,kn=null)}flush(){if(this.activate(),mn.length>0){if(kE(),Ue!==null&&Ue!==this)return}else this.#t===0&&this.process([]);this.deactivate()}discard(){for(const e of this.#a)e(this);this.#a.clear()}#c(){if(_a.size>1){this.previous.clear();var e=kn,r=!0;for(const u of _a){if(u===this){r=!1;continue}const c=[];for(const[h,d]of this.current){if(u.current.has(h))if(r&&d!==u.current.get(h))u.current.set(h,d);else continue;c.push(h)}if(c.length===0)continue;const f=[...u.current.keys()].filter(h=>!this.current.has(h));if(f.length>0){var s=mn;mn=[];const h=new Set,d=new Map;for(const p of c)Zg(p,f,h,d);if(mn.length>0){Ue=u,u.apply();for(const p of mn)u.#u(p,[],[]);u.deactivate()}mn=s}}Ue=null,kn=e}this.committed=!0,_a.delete(this)}increment(e){this.#t+=1,e&&(this.#i+=1)}decrement(e){this.#t-=1,e&&(this.#i-=1),!this.#o&&(this.#o=!0,Lr(()=>{this.#o=!1,this.is_deferred()?mn.length>0&&this.flush():this.revive()}))}revive(){for(const e of this.#r)this.#n.delete(e),st(e,Lt),cr(e);for(const e of this.#n)st(e,dr),cr(e);this.flush()}oncommit(e){this.#e.add(e)}ondiscard(e){this.#a.add(e)}settled(){return(this.#s??=Og()).promise}static ensure(){if(Ue===null){const e=Ue=new Ar;_a.add(Ue),Lr(()=>{Ue===e&&e.flush()})}return Ue}apply(){}}function kE(){qu=!0;try{for(var t=0;mn.length>0;){var e=Ar.ensure();if(t++>1e3){var r,s;EE()}e.process(mn),Tr.clear()}}finally{qu=!1,Fl=null}}function EE(){try{$k()}catch(t){Vi(t,Fl)}}let rr=null;function Th(t){var e=t.length;if(e!==0){for(var r=0;r<e;){var s=t[r++];if((s.f&(Mr|Jt))===0&&ra(s)&&(rr=new Set,Xs(s),s.deps===null&&s.first===null&&s.nodes===null&&(s.teardown===null&&s.ac===null?_d(s):s.fn=null),rr?.size>0)){Tr.clear();for(const u of rr){if((u.f&(Mr|Jt))!==0)continue;const c=[u];let f=u.parent;for(;f!==null;)rr.has(f)&&(rr.delete(f),c.push(f)),f=f.parent;for(let h=c.length-1;h>=0;h--){const d=c[h];(d.f&(Mr|Jt))===0&&Xs(d)}}rr.clear()}}rr=null}}function Zg(t,e,r,s){if(!r.has(t)&&(r.add(t),t.reactions!==null))for(const u of t.reactions){const c=u.f;(c>)!==0?Zg(u,e,r,s):(c&(Rl|Zn))!==0&&(c&Lt)===0&&Kg(u,e,s)&&(st(u,Lt),cr(u))}}function Kg(t,e,r){const s=r.get(t);if(s!==void 0)return s;if(t.deps!==null)for(const u of t.deps){if(Ji.call(e,u))return!0;if((u.f>)!==0&&Kg(u,e,r))return r.set(u,!0),!0}return r.set(t,!1),!1}function cr(t){for(var e=Fl=t;e.parent!==null;){e=e.parent;var r=e.f;if(qu&&e===Oe&&(r&Zn)!==0&&(r&Dg)===0)return;if((r&(li|Ln))!==0){if((r&ct)===0)return;e.f^=ct}}mn.push(e)}function Qg(t){if(!((t.f&Ln)!==0&&(t.f&ct)!==0)){st(t,ct);for(var e=t.first;e!==null;)Qg(e),e=e.next}}function xE(t){let e=0,r=ti(0),s;return()=>{Ul()&&(ye(r),pd(()=>(e===0&&(s=ia(()=>t(()=>Bs(r)))),e+=1,()=>{Lr(()=>{e-=1,e===0&&(s?.(),s=void 0,Bs(r))})})))}}var wE=Qr|es|Ol;function bE(t,e,r){new SE(t,e,r)}class SE{parent;is_pending=!1;#e;#a=null;#t;#i;#s;#r=null;#n=null;#o=null;#u=null;#l=null;#c=0;#f=0;#d=!1;#g=!1;#p=new Set;#m=new Set;#h=null;#E=xE(()=>(this.#h=ti(this.#c),()=>{this.#h=null}));constructor(e,r,s){this.#e=e,this.#t=r,this.#i=s,this.parent=Oe.b,this.is_pending=!!this.#t.pending,this.#s=ql(()=>{Oe.b=this;{var u=this.#_();try{this.#r=vn(()=>s(u))}catch(c){this.error(c)}this.#f>0?this.#y():this.is_pending=!1}return()=>{this.#l?.remove()}},wE)}#x(){try{this.#r=vn(()=>this.#i(this.#e))}catch(e){this.error(e)}}#w(){const e=this.#t.pending;e&&(this.#n=vn(()=>e(this.#e)),Lr(()=>{var r=this.#_();this.#r=this.#v(()=>(Ar.ensure(),vn(()=>this.#i(r)))),this.#f>0?this.#y():(Zr(this.#n,()=>{this.#n=null}),this.is_pending=!1)}))}#_(){var e=this.#e;return this.is_pending&&(this.#l=Cr(),this.#e.before(this.#l),e=this.#l),e}defer_effect(e){Wg(e,this.#p,this.#m)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#t.pending}#v(e){var r=Oe,s=Ne,u=vt;Vn(this.#s),on(this.#s),Hi(this.#s.ctx);try{return e()}catch(c){return Xg(c),null}finally{Vn(r),on(s),Hi(u)}}#y(){const e=this.#t.pending;this.#r!==null&&(this.#u=document.createDocumentFragment(),this.#u.append(this.#l),xd(this.#r,this.#u)),this.#n===null&&(this.#n=vn(()=>e(this.#e)))}#k(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#k(e);return}if(this.#f+=e,this.#f===0){this.is_pending=!1;for(const r of this.#p)st(r,Lt),cr(r);for(const r of this.#m)st(r,dr),cr(r);this.#p.clear(),this.#m.clear(),this.#n&&Zr(this.#n,()=>{this.#n=null}),this.#u&&(this.#e.before(this.#u),this.#u=null)}}update_pending_count(e){this.#k(e),this.#c+=e,!(!this.#h||this.#d)&&(this.#d=!0,Lr(()=>{this.#d=!1,this.#h&&Xi(this.#h,this.#c)}))}get_effect_pending(){return this.#E(),ye(this.#h)}error(e){var r=this.#t.onerror;let s=this.#t.failed;if(this.#g||!r&&!s)throw e;this.#r&&(Bt(this.#r),this.#r=null),this.#n&&(Bt(this.#n),this.#n=null),this.#o&&(Bt(this.#o),this.#o=null);var u=!1,c=!1;const f=()=>{if(u){pE();return}u=!0,c&&Qk(),Ar.ensure(),this.#c=0,this.#o!==null&&Zr(this.#o,()=>{this.#o=null}),this.is_pending=this.has_pending_snippet(),this.#r=this.#v(()=>(this.#g=!1,vn(()=>this.#i(this.#e)))),this.#f>0?this.#y():this.is_pending=!1};Lr(()=>{try{c=!0,r?.(e,f),c=!1}catch(h){Vi(h,this.#s&&this.#s.parent)}s&&(this.#o=this.#v(()=>{Ar.ensure(),this.#g=!0;try{return vn(()=>{s(this.#e,()=>e,()=>f)})}catch(h){return Vi(h,this.#s.parent),null}finally{this.#g=!1}}))})}}function IE(t,e,r,s){const u=Gl;var c=t.filter(E=>!E.settled);if(r.length===0&&c.length===0){s(e.map(u));return}var f=Ue,h=Oe,d=ME(),p=c.length===1?c[0].promise:c.length>1?Promise.all(c.map(E=>E.promise)):null;function y(E){d();try{s(E)}catch(S){(h.f&Mr)===0&&Vi(S,h)}f?.deactivate(),Yu()}if(r.length===0){p.then(()=>y(e.map(u)));return}function v(){d(),Promise.all(r.map(E=>NE(E))).then(E=>y([...e.map(u),...E])).catch(E=>Vi(E,h))}p?p.then(v):v()}function ME(){var t=Oe,e=Ne,r=vt,s=Ue;return function(u=!0){Vn(t),on(e),Hi(r),u&&s?.activate()}}function Yu(){Vn(null),on(null),Hi(null)}function Gl(t){var e=gt|Lt,r=Ne!==null&&(Ne.f>)!==0?Ne:null;return Oe!==null&&(Oe.f|=es),{ctx:vt,deps:null,effects:null,equals:Fg,f:e,fn:t,reactions:null,rv:0,v:ft,wv:0,parent:r??Oe,ac:null}}function NE(t,e,r){let s=Oe;s===null&&Jk();var u=s.b,c=void 0,f=ti(ft),h=!Ne,d=new Map;return BE(()=>{var p=Og();c=p.promise;try{Promise.resolve(t()).then(p.resolve,p.reject).then(()=>{y===Ue&&y.committed&&y.deactivate(),Yu()})}catch(S){p.reject(S),Yu()}var y=Ue;if(h){var v=u.is_rendered();u.update_pending_count(1),y.increment(v),d.get(y)?.reject(Pi),d.delete(y),d.set(y,p)}const E=(S,b=void 0)=>{if(y.activate(),b)b!==Pi&&(f.f|=Nr,Xi(f,b));else{(f.f&Nr)!==0&&(f.f^=Nr),Xi(f,S);for(const[N,O]of d){if(d.delete(N),N===y)break;O.reject(Pi)}}h&&(u.update_pending_count(-1),y.decrement(v))};p.promise.then(E,S=>E(null,S||"unknown"))}),jl(()=>{for(const p of d.values())p.reject(Pi)}),new Promise(p=>{function y(v){function E(){v===c?p(f):y(c)}v.then(E,E)}y(c)})}function En(t){const e=Gl(t);return ad(e),e}function LE(t){const e=Gl(t);return e.equals=Bg,e}function ed(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r<e.length;r+=1)Bt(e[r])}}function CE(t){for(var e=t.parent;e!==null;){if((e.f>)===0)return(e.f&Mr)===0?e:null;e=e.parent}return null}function Bl(t){var e,r=Oe;Vn(CE(t));try{t.f&=~ei,ed(t),e=cd(t)}finally{Vn(r)}return e}function td(t){var e=Bl(t);if(!t.equals(e)&&(t.wv=ud(),(!Ue?.is_fork||t.deps===null)&&(t.v=e,t.deps===null))){st(t,ct);return}ni||(kn!==null?(Ul()||Ue?.is_fork)&&kn.set(t,e):Dl(t))}let zu=new Set;const Tr=new Map;let nd=!1;function ti(t,e){var r={f:0,v:t,reactions:null,equals:Fg,rv:0,wv:0};return r}function jn(t,e){const r=ti(t);return ad(r),r}function rd(t,e=!1,r=!0){const s=ti(t);return e||(s.equals=Bg),s}function It(t,e,r=!1){Ne!==null&&(!wn||(Ne.f&Lh)!==0)&&Yg()&&(Ne.f&(gt|Zn|Rl|Lh))!==0&&(sn===null||!Ji.call(sn,t))&&Kk();let s=r?Ss(e):e;return Xi(t,s)}function Xi(t,e){if(!t.equals(e)){var r=t.v;ni?Tr.set(t,e):Tr.set(t,r),t.v=e;var s=Ar.ensure();if(s.capture(t,r),(t.f>)!==0){const u=t;(t.f&Lt)!==0&&Bl(u),Dl(u)}t.wv=ud(),id(t,Lt),Oe!==null&&(Oe.f&ct)!==0&&(Oe.f&(Ln|li))===0&&(tn===null?PE([t]):tn.push(t)),!s.is_fork&&zu.size>0&&!nd&&AE()}return e}function AE(){nd=!1;for(const t of zu)(t.f&ct)!==0&&st(t,dr),ra(t)&&Xs(t);zu.clear()}function Bs(t){It(t,t.v+1)}function id(t,e){var r=t.reactions;if(r!==null)for(var s=r.length,u=0;u<s;u++){var c=r[u],f=c.f,h=(f&Lt)===0;if(h&&st(c,e),(f>)!==0){var d=c;kn?.delete(d),(f&ei)===0&&(f&rn&&(c.f|=ei),id(d,dr))}else h&&((f&Zn)!==0&&rr!==null&&rr.add(c),cr(c))}}let Ph=!1;function TE(){Ph||(Ph=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{if(!t.defaultPrevented)for(const e of t.target.elements)e.__on_r?.()})},{capture:!0}))}function na(t){var e=Ne,r=Oe;on(null),Vn(null);try{return t()}finally{on(e),Vn(r)}}function sd(t,e,r,s=r){t.addEventListener(e,()=>na(r));const u=t.__on_r;u?t.__on_r=()=>{u(),s(!0)}:t.__on_r=()=>s(!0),TE()}let Da=!1,ni=!1;function Oh(t){ni=t}let Ne=null,wn=!1;function on(t){Ne=t}let Oe=null;function Vn(t){Oe=t}let sn=null;function ad(t){Ne!==null&&(sn===null?sn=[t]:sn.push(t))}let Ft=null,qt=0,tn=null;function PE(t){tn=t}let od=1,$r=0,Wr=$r;function Rh(t){Wr=t}function ud(){return++od}function ra(t){var e=t.f;if((e&Lt)!==0)return!0;if(e>&&(t.f&=~ei),(e&dr)!==0){for(var r=t.deps,s=r.length,u=0;u<s;u++){var c=r[u];if(ra(c)&&td(c),c.wv>t.wv)return!0}(e&rn)!==0&&kn===null&&st(t,ct)}return!1}function ld(t,e,r=!0){var s=t.reactions;if(s!==null&&!(sn!==null&&Ji.call(sn,t)))for(var u=0;u<s.length;u++){var c=s[u];(c.f>)!==0?ld(c,e,!1):e===c&&(r?st(c,Lt):(c.f&ct)!==0&&st(c,dr),cr(c))}}function cd(t){var e=Ft,r=qt,s=tn,u=Ne,c=sn,f=vt,h=wn,d=Wr,p=t.f;Ft=null,qt=0,tn=null,Ne=(p&(Ln|li))===0?t:null,sn=null,Hi(t.ctx),wn=!1,Wr=++$r,t.ac!==null&&(na(()=>{t.ac.abort(Pi)}),t.ac=null);try{t.f|=Uu;var y=t.fn,v=y(),E=t.deps,S=Ue?.is_fork;if(Ft!==null){var b;if(S||Za(t,qt),E!==null&&qt>0)for(E.length=qt+Ft.length,b=0;b<Ft.length;b++)E[qt+b]=Ft[b];else t.deps=E=Ft;if(Ul()&&(t.f&rn)!==0)for(b=qt;b<E.length;b++)(E[b].reactions??=[]).push(t)}else!S&&E!==null&&qt<E.length&&(Za(t,qt),E.length=qt);if(Yg()&&tn!==null&&!wn&&E!==null&&(t.f&(gt|dr|Lt))===0)for(b=0;b<tn.length;b++)ld(tn[b],t);if(u!==null&&u!==t){if($r++,u.deps!==null)for(let N=0;N<r;N+=1)u.deps[N].rv=$r;if(e!==null)for(const N of e)N.rv=$r;tn!==null&&(s===null?s=tn:s.push(...tn))}return(t.f&Nr)!==0&&(t.f^=Nr),v}catch(N){return Xg(N)}finally{t.f^=Uu,Ft=e,qt=r,tn=s,Ne=u,sn=c,Hi(f),wn=h,Wr=d}}function OE(t,e){let r=e.reactions;if(r!==null){var s=Fk.call(r,t);if(s!==-1){var u=r.length-1;u===0?r=e.reactions=null:(r[s]=r[u],r.pop())}}if(r===null&&(e.f>)!==0&&(Ft===null||!Ji.call(Ft,e))){var c=e;(c.f&rn)!==0&&(c.f^=rn,c.f&=~ei),Dl(c),ed(c),Za(c,0)}}function Za(t,e){var r=t.deps;if(r!==null)for(var s=e;s<r.length;s++)OE(t,r[s])}function Xs(t){var e=t.f;if((e&Mr)===0){st(t,ct);var r=Oe,s=Da;Oe=t,Da=!0;try{(e&(Zn|Rg))!==0?UE(t):vd(t),md(t);var u=cd(t);t.teardown=typeof u=="function"?u:null,t.wv=od;var c;Dk&&eE&&(t.f&Lt)!==0&&t.deps}finally{Da=s,Oe=r}}}function ye(t){var e=t.f,r=(e>)!==0;if(Ne!==null&&!wn){var s=Oe!==null&&(Oe.f&Mr)!==0;if(!s&&(sn===null||!Ji.call(sn,t))){var u=Ne.deps;if((Ne.f&Uu)!==0)t.rv<$r&&(t.rv=$r,Ft===null&&u!==null&&u[qt]===t?qt++:Ft===null?Ft=[t]:Ft.push(t));else{(Ne.deps??=[]).push(t);var c=t.reactions;c===null?t.reactions=[Ne]:Ji.call(c,Ne)||c.push(Ne)}}}if(ni&&Tr.has(t))return Tr.get(t);if(r){var f=t;if(ni){var h=f.v;return((f.f&ct)===0&&f.reactions!==null||fd(f))&&(h=Bl(f)),Tr.set(f,h),h}var d=(f.f&rn)===0&&!wn&&Ne!==null&&(Da||(Ne.f&rn)!==0),p=f.deps===null;ra(f)&&(d&&(f.f|=rn),td(f)),d&&!p&&hd(f)}if(kn?.has(t))return kn.get(t);if((t.f&Nr)!==0)throw t.v;return t.v}function hd(t){if(t.deps!==null){t.f|=rn;for(const e of t.deps)(e.reactions??=[]).push(t),(e.f>)!==0&&(e.f&rn)===0&&hd(e)}}function fd(t){if(t.v===ft)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(Tr.has(e)||(e.f>)!==0&&fd(e))return!0;return!1}function ia(t){var e=wn;try{return wn=!0,t()}finally{wn=e}}function RE(t){Oe===null&&(Ne===null&&Xk(),Vk()),ni&&Hk()}function DE(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function pr(t,e,r){var s=Oe;s!==null&&(s.f&Jt)!==0&&(t|=Jt);var u={ctx:vt,deps:null,nodes:null,f:t|Lt|rn,first:null,fn:e,last:null,next:null,parent:s,b:s&&s.b,prev:null,teardown:null,wv:0,ac:null};if(r)try{Xs(u),u.f|=bo}catch(h){throw Bt(u),h}else e!==null&&cr(u);var c=u;if(r&&c.deps===null&&c.teardown===null&&c.nodes===null&&c.first===c.last&&(c.f&es)===0&&(c=c.first,(t&Zn)!==0&&(t&Qr)!==0&&c!==null&&(c.f|=Qr)),c!==null&&(c.parent=s,s!==null&&DE(c,s),Ne!==null&&(Ne.f>)!==0&&(t&li)===0)){var f=Ne;(f.effects??=[]).push(c)}return u}function Ul(){return Ne!==null&&!wn}function jl(t){const e=pr(wo,null,!1);return st(e,ct),e.teardown=t,e}function FE(t){RE();var e=Oe.f,r=!Ne&&(e&Ln)!==0&&(e&bo)===0;if(r){var s=vt;(s.e??=[]).push(t)}else return gd(t)}function gd(t){return pr(Wa|Yk,t,!1)}function GE(t){Ar.ensure();const e=pr(li|es,t,!0);return(r={})=>new Promise(s=>{r.outro?Zr(e,()=>{Bt(e),s(void 0)}):(Bt(e),s(void 0))})}function dd(t){return pr(Wa,t,!1)}function BE(t){return pr(Rl|es,t,!0)}function pd(t,e=0){return pr(wo|e,t,!0)}function bn(t,e=[],r=[],s=[]){IE(s,e,r,u=>{pr(wo,()=>t(...u.map(ye)),!0)})}function ql(t,e=0){var r=pr(Zn|e,t,!0);return r}function vn(t){return pr(Ln|es,t,!0)}function md(t){var e=t.teardown;if(e!==null){const r=ni,s=Ne;Oh(!0),on(null);try{e.call(null)}finally{Oh(r),on(s)}}}function vd(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){const u=r.ac;u!==null&&na(()=>{u.abort(Pi)});var s=r.next;(r.f&li)!==0?r.parent=null:Bt(r,e),r=s}}function UE(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&Ln)===0&&Bt(e),e=r}}function Bt(t,e=!0){var r=!1;(e||(t.f&Dg)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(yd(t.nodes.start,t.nodes.end),r=!0),vd(t,e&&!r),Za(t,0),st(t,Mr);var s=t.nodes&&t.nodes.t;if(s!==null)for(const c of s)c.stop();md(t);var u=t.parent;u!==null&&u.first!==null&&_d(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function yd(t,e){for(;t!==null;){var r=t===e?null:ta(t);t.remove(),t=r}}function _d(t){var e=t.parent,r=t.prev,s=t.next;r!==null&&(r.next=s),s!==null&&(s.prev=r),e!==null&&(e.first===t&&(e.first=s),e.last===t&&(e.last=r))}function Zr(t,e,r=!0){var s=[];kd(t,s,!0);var u=()=>{r&&Bt(t),e&&e()},c=s.length;if(c>0){var f=()=>--c||u();for(var h of s)h.out(f)}else u()}function kd(t,e,r){if((t.f&Jt)===0){t.f^=Jt;var s=t.nodes&&t.nodes.t;if(s!==null)for(const h of s)(h.is_global||r)&&e.push(h);for(var u=t.first;u!==null;){var c=u.next,f=(u.f&Qr)!==0||(u.f&Ln)!==0&&(t.f&Zn)!==0;kd(u,e,f?r:!1),u=c}}}function Yl(t){Ed(t,!0)}function Ed(t,e){if((t.f&Jt)!==0){t.f^=Jt,(t.f&ct)===0&&(st(t,Lt),cr(t));for(var r=t.first;r!==null;){var s=r.next,u=(r.f&Qr)!==0||(r.f&Ln)!==0;Ed(r,u?e:!1),r=s}var c=t.nodes&&t.nodes.t;if(c!==null)for(const f of c)(f.is_global||e)&&f.in()}}function xd(t,e){if(t.nodes)for(var r=t.nodes.start,s=t.nodes.end;r!==null;){var u=r===s?null:ta(r);e.append(r),r=u}}const jE=["touchstart","touchmove"];function qE(t){return jE.includes(t)}const wd=new Set,Ju=new Set;function So(t){for(var e=0;e<t.length;e++)wd.add(t[e]);for(var r of Ju)r(t)}let Dh=null;function ka(t){var e=this,r=e.ownerDocument,s=t.type,u=t.composedPath?.()||[],c=u[0]||t.target;Dh=t;var f=0,h=Dh===t&&t.__root;if(h){var d=u.indexOf(h);if(d!==-1&&(e===document||e===window)){t.__root=e;return}var p=u.indexOf(e);if(p===-1)return;d<=p&&(f=d)}if(c=u[f]||t.target,c!==e){Tg(t,"currentTarget",{configurable:!0,get(){return c||r}});var y=Ne,v=Oe;on(null),Vn(null);try{for(var E,S=[];c!==null;){var b=c.assignedSlot||c.parentNode||c.host||null;try{var N=c["__"+s];N!=null&&(!c.disabled||t.target===c)&&N.call(c,t)}catch(O){E?S.push(O):E=O}if(t.cancelBubble||b===e||b===null)break;c=b}if(E){for(let O of S)queueMicrotask(()=>{throw O});throw E}}finally{t.__root=e,delete t.currentTarget,on(y),Vn(v)}}}function bd(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("<!>","<!---->"),e.content}function $s(t,e){var r=Oe;r.nodes===null&&(r.nodes={start:t,end:e,a:null,t:null})}function cn(t,e){var r=(e&uE)!==0,s=(e&lE)!==0,u,c=!t.startsWith("<!>");return()=>{u===void 0&&(u=bd(c?t:"<!>"+t),r||(u=Sr(u)));var f=s||zg?document.importNode(u,!0):u.cloneNode(!0);if(r){var h=Sr(f),d=f.lastChild;$s(h,d)}else $s(f,f);return f}}function Fh(t=""){{var e=Cr(t+"");return $s(e,e),e}}function or(){var t=document.createDocumentFragment(),e=document.createComment(""),r=Cr();return t.append(e,r),$s(e,r),t}function Ve(t,e){t!==null&&t.before(e)}let Hu=!0;function Gi(t,e){var r=e==null?"":typeof e=="object"?e+"":e;r!==(t.__t??=t.nodeValue)&&(t.__t=r,t.nodeValue=r+"")}function YE(t,e){return zE(t,e)}const Mi=new Map;function zE(t,{target:e,anchor:r,props:s={},events:u,context:c,intro:f=!0}){vE();var h=new Set,d=v=>{for(var E=0;E<v.length;E++){var S=v[E];if(!h.has(S)){h.add(S);var b=qE(S);e.addEventListener(S,ka,{passive:b});var N=Mi.get(S);N===void 0?(document.addEventListener(S,ka,{passive:b}),Mi.set(S,1)):Mi.set(S,N+1)}}};d(xo(wd)),Ju.add(d);var p=void 0,y=GE(()=>{var v=r??e.appendChild(Cr());return bE(v,{pending:()=>{}},E=>{if(c){ts({});var S=vt;S.c=c}u&&(s.$$events=u),Hu=f,p=t(E,s)||{},Hu=!0,c&&ns()}),()=>{for(var E of h){e.removeEventListener(E,ka);var S=Mi.get(E);--S===0?(document.removeEventListener(E,ka),Mi.delete(E)):Mi.set(E,S)}Ju.delete(d),v!==r&&v.parentNode?.removeChild(v)}});return Vu.set(p,y),p}let Vu=new WeakMap;function JE(t,e){const r=Vu.get(t);return r?(Vu.delete(t),r(e)):Promise.resolve()}class HE{anchor;#e=new Map;#a=new Map;#t=new Map;#i=new Set;#s=!0;constructor(e,r=!0){this.anchor=e,this.#s=r}#r=()=>{var e=Ue;if(this.#e.has(e)){var r=this.#e.get(e),s=this.#a.get(r);if(s)Yl(s),this.#i.delete(r);else{var u=this.#t.get(r);u&&(this.#a.set(r,u.effect),this.#t.delete(r),u.fragment.lastChild.remove(),this.anchor.before(u.fragment),s=u.effect)}for(const[c,f]of this.#e){if(this.#e.delete(c),c===e)break;const h=this.#t.get(f);h&&(Bt(h.effect),this.#t.delete(f))}for(const[c,f]of this.#a){if(c===r||this.#i.has(c))continue;const h=()=>{if(Array.from(this.#e.values()).includes(c)){var d=document.createDocumentFragment();xd(f,d),d.append(Cr()),this.#t.set(c,{effect:f,fragment:d})}else Bt(f);this.#i.delete(c),this.#a.delete(c)};this.#s||!s?(this.#i.add(c),Zr(f,h,!1)):h()}}};#n=e=>{this.#e.delete(e);const r=Array.from(this.#e.values());for(const[s,u]of this.#t)r.includes(s)||(Bt(u.effect),this.#t.delete(s))};ensure(e,r){var s=Ue,u=Vg();r&&!this.#a.has(e)&&!this.#t.has(e)&&this.#a.set(e,vn(()=>r(this.anchor))),this.#e.set(s,e),u||this.#r()}}function Yt(t,e,r=!1){var s=new HE(t),u=r?Qr:0;function c(f,h){s.ensure(f,h)}ql(()=>{var f=!1;e((h,d=!0)=>{f=!0,c(d,h)}),f||c(!1,null)},u)}function VE(t,e){return e}function XE(t,e,r){for(var s=[],u=e.length,c,f=e.length,h=0;h<u;h++){let v=e[h];Zr(v,()=>{if(c){if(c.pending.delete(v),c.done.add(v),c.pending.size===0){var E=t.outrogroups;Xu(xo(c.done)),E.delete(c),E.size===0&&(t.outrogroups=null)}}else f-=1},!1)}if(f===0){var d=s.length===0&&r!==null;if(d){var p=r,y=p.parentNode;yE(y),y.append(p),t.items.clear()}Xu(e,!d)}else c={pending:new Set(e),done:new Set},(t.outrogroups??=new Set).add(c)}function Xu(t,e=!0){for(var r=0;r<t.length;r++)Bt(t[r],e)}var Gh;function Ws(t,e,r,s,u,c=null){var f=t,h=new Map,d=(e&jg)!==0;if(d){var p=t;f=p.appendChild(Cr())}var y=null,v=LE(()=>{var D=r();return Pl(D)?D:D==null?[]:xo(D)}),E,S=!0;function b(){O.fallback=y,$E(O,E,f,e,s),y!==null&&(E.length===0?(y.f&sr)===0?Yl(y):(y.f^=sr,Is(y,null,f)):Zr(y,()=>{y=null}))}var N=ql(()=>{E=ye(v);for(var D=E.length,L=new Set,q=Ue,H=Vg(),J=0;J<D;J+=1){var z=E[J],$=s(z,J),k=S?null:h.get($);k?(k.v&&Xi(k.v,z),k.i&&Xi(k.i,J),H&&q.skipped_effects.delete(k.e)):(k=WE(h,S?f:Gh??=Cr(),z,$,J,u,e,r),S||(k.e.f|=sr),h.set($,k)),L.add($)}if(D===0&&c&&!y&&(S?y=vn(()=>c(f)):(y=vn(()=>c(Gh??=Cr())),y.f|=sr)),!S)if(H){for(const[w,I]of h)L.has(w)||q.skipped_effects.add(I.e);q.oncommit(b),q.ondiscard(()=>{})}else b();ye(v)}),O={effect:N,items:h,outrogroups:null,fallback:y};S=!1}function ps(t){for(;t!==null&&(t.f&Ln)===0;)t=t.next;return t}function $E(t,e,r,s,u){var c=(s&rE)!==0,f=e.length,h=t.items,d=ps(t.effect.first),p,y=null,v,E=[],S=[],b,N,O,D;if(c)for(D=0;D<f;D+=1)b=e[D],N=u(b,D),O=h.get(N).e,(O.f&sr)===0&&(O.nodes?.a?.measure(),(v??=new Set).add(O));for(D=0;D<f;D+=1){if(b=e[D],N=u(b,D),O=h.get(N).e,t.outrogroups!==null)for(const I of t.outrogroups)I.pending.delete(O),I.done.delete(O);if((O.f&sr)!==0)if(O.f^=sr,O===d)Is(O,null,r);else{var L=y?y.next:d;O===t.effect.last&&(t.effect.last=O.prev),O.prev&&(O.prev.next=O.next),O.next&&(O.next.prev=O.prev),xr(t,y,O),xr(t,O,L),Is(O,L,r),y=O,E=[],S=[],d=ps(y.next);continue}if((O.f&Jt)!==0&&(Yl(O),c&&(O.nodes?.a?.unfix(),(v??=new Set).delete(O))),O!==d){if(p!==void 0&&p.has(O)){if(E.length<S.length){var q=S[0],H;y=q.prev;var J=E[0],z=E[E.length-1];for(H=0;H<E.length;H+=1)Is(E[H],q,r);for(H=0;H<S.length;H+=1)p.delete(S[H]);xr(t,J.prev,z.next),xr(t,y,J),xr(t,z,q),d=q,y=z,D-=1,E=[],S=[]}else p.delete(O),Is(O,d,r),xr(t,O.prev,O.next),xr(t,O,y===null?t.effect.first:y.next),xr(t,y,O),y=O;continue}for(E=[],S=[];d!==null&&d!==O;)(p??=new Set).add(d),S.push(d),d=ps(d.next);if(d===null)continue}(O.f&sr)===0&&E.push(O),y=O,d=ps(O.next)}if(t.outrogroups!==null){for(const I of t.outrogroups)I.pending.size===0&&(Xu(xo(I.done)),t.outrogroups?.delete(I));t.outrogroups.size===0&&(t.outrogroups=null)}if(d!==null||p!==void 0){var $=[];if(p!==void 0)for(O of p)(O.f&Jt)===0&&$.push(O);for(;d!==null;)(d.f&Jt)===0&&d!==t.fallback&&$.push(d),d=ps(d.next);var k=$.length;if(k>0){var w=(s&jg)!==0&&f===0?r:null;if(c){for(D=0;D<k;D+=1)$[D].nodes?.a?.measure();for(D=0;D<k;D+=1)$[D].nodes?.a?.fix()}XE(t,$,w)}}c&&Lr(()=>{if(v!==void 0)for(O of v)O.nodes?.a?.apply()})}function WE(t,e,r,s,u,c,f,h){var d=(f&tE)!==0?(f&iE)===0?rd(r,!1,!1):ti(r):null,p=(f&nE)!==0?ti(u):null;return{v:d,i:p,e:vn(()=>(c(e,d??r,p??u,h),()=>{t.delete(s)}))}}function Is(t,e,r){if(t.nodes)for(var s=t.nodes.start,u=t.nodes.end,c=e&&(e.f&sr)===0?e.nodes.start:r;s!==null;){var f=ta(s);if(c.before(s),s===u)return;s=f}}function xr(t,e,r){e===null?t.effect.first=r:e.next=r,r===null?t.effect.last=e:r.prev=e}function Sd(t,e,r=!1,s=!1,u=!1){var c=t,f="";bn(()=>{var h=Oe;if(f!==(f=e()??"")&&(h.nodes!==null&&(yd(h.nodes.start,h.nodes.end),h.nodes=null),f!=="")){var d=f+"";r?d=`<svg>${d}</svg>`:s&&(d=`<math>${d}</math>`);var p=bd(d);if((r||s)&&(p=Sr(p)),$s(Sr(p),p.lastChild),r||s)for(;Sr(p);)c.before(Sr(p));else c.before(p)}})}const ZE=()=>performance.now(),ir={tick:(t=>requestAnimationFrame(t)),now:()=>ZE(),tasks:new Set};function Id(){const t=ir.now();ir.tasks.forEach(e=>{e.c(t)||(ir.tasks.delete(e),e.f())}),ir.tasks.size!==0&&ir.tick(Id)}function KE(t){let e;return ir.tasks.size===0&&ir.tick(Id),{promise:new Promise(r=>{ir.tasks.add(e={c:t,f:r})}),abort(){ir.tasks.delete(e)}}}function Ka(t,e){na(()=>{t.dispatchEvent(new CustomEvent(e))})}function QE(t){if(t==="float")return"cssFloat";if(t==="offset")return"cssOffset";if(t.startsWith("--"))return t;const e=t.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("")}function Bh(t){const e={},r=t.split(";");for(const s of r){const[u,c]=s.split(":");if(!u||c===void 0)break;const f=QE(u.trim());e[f]=c.trim()}return e}const ex=t=>t;function Uh(t,e,r,s){var u=(t&sE)!==0,c=(t&aE)!==0,f=u&&c,h=(t&oE)!==0,d=f?"both":u?"in":"out",p,y=e.inert,v=e.style.overflow,E,S;function b(){return na(()=>p??=r()(e,s?.()??{},{direction:d}))}var N={is_global:h,in(){if(e.inert=y,!u){S?.abort(),S?.reset?.();return}c||E?.abort(),E=$u(e,b(),S,1,()=>{Ka(e,"introend"),E?.abort(),E=p=void 0,e.style.overflow=v})},out(q){if(!c){q?.(),p=void 0;return}e.inert=!0,S=$u(e,b(),E,0,()=>{Ka(e,"outroend"),q?.()})},stop:()=>{E?.abort(),S?.abort()}},O=Oe;if((O.nodes.t??=[]).push(N),u&&Hu){var D=h;if(!D){for(var L=O.parent;L&&(L.f&Qr)!==0;)for(;(L=L.parent)&&(L.f&Zn)===0;);D=!L||(L.f&bo)!==0}D&&dd(()=>{ia(()=>N.in())})}}function $u(t,e,r,s,u){var c=s===1;if(jk(e)){var f,h=!1;return Lr(()=>{if(!h){var O=e({direction:c?"in":"out"});f=$u(t,O,r,s,u)}}),{abort:()=>{h=!0,f?.abort()},deactivate:()=>f.deactivate(),reset:()=>f.reset(),t:()=>f.t()}}if(r?.deactivate(),!e?.duration&&!e?.delay)return Ka(t,c?"introstart":"outrostart"),u(),{abort:_n,deactivate:_n,reset:_n,t:()=>s};const{delay:d=0,css:p,tick:y,easing:v=ex}=e;var E=[];if(c&&r===void 0&&(y&&y(0,1),p)){var S=Bh(p(0,1));E.push(S,S)}var b=()=>1-s,N=t.animate(E,{duration:d,fill:"forwards"});return N.onfinish=()=>{N.cancel(),Ka(t,c?"introstart":"outrostart");var O=r?.t()??1-s;r?.abort();var D=s-O,L=e.duration*Math.abs(D),q=[];if(L>0){var H=!1;if(p)for(var J=Math.ceil(L/16.666666666666668),z=0;z<=J;z+=1){var $=O+D*v(z/J),k=Bh(p($,1-$));q.push(k),H||=k.overflow==="hidden"}H&&(t.style.overflow="hidden"),b=()=>{var w=N.currentTime;return O+D*v(w/L)},y&&KE(()=>{if(N.playState!=="running")return!1;var w=b();return y(w,1-w),!0})}N=t.animate(q,{duration:L,fill:"forwards"}),N.onfinish=()=>{b=()=>s,y?.(s,1-s),u()}},{abort:()=>{N&&(N.cancel(),N.effect=null,N.onfinish=_n)},deactivate:()=>{u=_n},reset:()=>{s===0&&y?.(1,0)},t:()=>b()}}function Md(t){var e,r,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var u=t.length;for(e=0;e<u;e++)t[e]&&(r=Md(t[e]))&&(s&&(s+=" "),s+=r)}else for(r in t)t[r]&&(s&&(s+=" "),s+=r);return s}function tx(){for(var t,e,r=0,s="",u=arguments.length;r<u;r++)(t=arguments[r])&&(e=Md(t))&&(s&&(s+=" "),s+=e);return s}function nx(t){return typeof t=="object"?tx(t):t??""}const jh=[...`
|
|
116
|
+
\r\f \v\uFEFF`];function rx(t,e,r){var s=t==null?"":""+t;if(e&&(s=s?s+" "+e:e),r){for(var u in r)if(r[u])s=s?s+" "+u:u;else if(s.length)for(var c=u.length,f=0;(f=s.indexOf(u,f))>=0;){var h=f+c;(f===0||jh.includes(s[f-1]))&&(h===s.length||jh.includes(s[h]))?s=(f===0?"":s.substring(0,f))+s.substring(h+1):f=h}}return s===""?null:s}function Us(t,e,r,s,u,c){var f=t.__className;if(f!==r||f===void 0){var h=rx(r,s,c);h==null?t.removeAttribute("class"):t.className=h,t.__className=r}else if(c&&u!==c)for(var d in c){var p=!!c[d];(u==null||p!==!!u[d])&&t.classList.toggle(d,p)}return c}function Nd(t,e,r=!1){if(t.multiple){if(e==null)return;if(!Pl(e))return dE();for(var s of t.options)s.selected=e.includes(js(s));return}for(s of t.options){var u=js(s);if(mE(u,e)){s.selected=!0;return}}(!r||e!==void 0)&&(t.selectedIndex=-1)}function ix(t){var e=new MutationObserver(()=>{Nd(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),jl(()=>{e.disconnect()})}function sx(t,e,r=e){var s=new WeakSet,u=!0;sd(t,"change",c=>{var f=c?"[selected]":":checked",h;if(t.multiple)h=[].map.call(t.querySelectorAll(f),js);else{var d=t.querySelector(f)??t.querySelector("option:not([disabled])");h=d&&js(d)}r(h),Ue!==null&&s.add(Ue)}),dd(()=>{var c=e();if(t===document.activeElement){var f=ju??Ue;if(s.has(f))return}if(Nd(t,c,u),u&&c===void 0){var h=t.querySelector(":checked");h!==null&&(c=js(h),r(c))}t.__value=c,u=!1}),ix(t)}function js(t){return"__value"in t?t.__value:t.value}const ax=Symbol("is custom element"),ox=Symbol("is html");function Ir(t,e,r,s){var u=ux(t);u[e]!==(u[e]=r)&&(e==="loading"&&(t[zk]=r),r==null?t.removeAttribute(e):typeof r!="string"&&lx(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function ux(t){return t.__attributes??={[ax]:t.nodeName.includes("-"),[ox]:t.namespaceURI===cE}}var qh=new Map;function lx(t){var e=t.getAttribute("is")||t.nodeName,r=qh.get(e);if(r)return r;qh.set(e,r=[]);for(var s,u=t,c=Element.prototype;c!==u;){s=Gk(u);for(var f in s)s[f].set&&r.push(f);u=Pg(u)}return r}function cx(t,e,r=e){sd(t,"change",s=>{var u=s?t.defaultChecked:t.checked;r(u)}),ia(e)==null&&r(t.checked),pd(()=>{var s=e();t.checked=!!s})}let Wu=Symbol();function Ld(t,e,r){const s=r[e]??={store:null,source:rd(void 0),unsubscribe:_n};if(s.store!==t&&!(Wu in r))if(s.unsubscribe(),s.store=t??null,t==null)s.source.v=void 0,s.unsubscribe=_n;else{var u=!0;s.unsubscribe=Ad(t,c=>{u?s.source.v=c:It(s.source,c)}),u=!1}return t&&Wu in r?gx(t):ye(s.source)}function Cd(){const t={};function e(){jl(()=>{for(var r in t)t[r].unsubscribe();Tg(t,Wu,{enumerable:!1,value:!0})})}return[t,e]}function hx(t){vt===null&&Ug(),FE(()=>{const e=ia(t);if(typeof e=="function")return e})}function Ad(t,e,r){if(t==null)return e(void 0),_n;const s=ia(()=>t.subscribe(e,r));return s.unsubscribe?()=>s.unsubscribe():s}const Ni=[];function fx(t,e=_n){let r=null;const s=new Set;function u(h){if(Gg(t,h)&&(t=h,r)){const d=!Ni.length;for(const p of s)p[1](),Ni.push(p,t);if(d){for(let p=0;p<Ni.length;p+=2)Ni[p][0](Ni[p+1]);Ni.length=0}}}function c(h){u(h(t))}function f(h,d=_n){const p=[h,d];return s.add(p),s.size===1&&(r=e(u,c)||_n),h(t),()=>{s.delete(p),s.size===0&&r&&(r(),r=null)}}return{set:u,update:c,subscribe:f}}function gx(t){let e;return Ad(t,r=>e=r)(),e}const dx={controls:Ht(Wf),options:Bu().controls,settings:Bu().settings},zl=fx(dx),px="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(px);const mx=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 64 64">
|
|
117
|
+
<path d="M7.474 17.988h49.045L31.996 46.012zm-3.85 3.37 24.522 28.019a5.113 5.113 0 0 0 7.7 0l24.523-28.02c2.894-3.308.542-8.482-3.85-8.482H7.474a5.113 5.113 0 0 0-3.85 8.482"/>
|
|
118
|
+
</svg>
|
|
119
|
+
`,vx=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 64 64">
|
|
120
|
+
<path d="M7.474 46.012h49.045L31.996 17.988Zm-3.85-3.37 24.522-28.019a5.113 5.113 0 0 1 7.7 0l24.523 28.02c2.894 3.308.542 8.482-3.85 8.482H7.474a5.113 5.113 0 0 1-3.85-8.482"/>
|
|
121
|
+
</svg>
|
|
122
|
+
`;var yx=cn("<option> </option>"),_x=cn('<label class="svelte-18zciyf"> </label> <select class="svelte-18zciyf"></select>',1),kx=cn('<label class="svelte-18zciyf"><input type="checkbox" class="svelte-18zciyf"/> </label>'),Ex=cn('<div class="action-option svelte-18zciyf"><!></div>');function xx(t,e){ts(e,!0);let r=jn("");hx(()=>{e.actionOption&&(e.actionOption.type==="select"?It(r,e.actionOption.value.value,!0):e.actionOption.type==="toggle"&&It(r,e.actionOption.value,!0))});const s=h=>{if(!e.actionInstance||!e.actionOption){te.error("Can't apply option value",e.actionInstance,e.actionOption);return}if(e.actionOption?.type==="toggle"){const d=h.target;It(r,d.checked,!0)}else if(e.actionOption?.type==="select"){const d=h.target;It(r,d.value,!0)}e.actionInstance.applyOptionValue(e.name,ye(r))};var u=or(),c=Mn(u);{var f=h=>{var d=Ex(),p=xn(d);{var y=E=>{var S=_x(),b=Mn(S),N=xn(b),O=Vs(b,2);O.__change=s,Ws(O,21,()=>e.actionOption.choices,VE,(D,L)=>{var q=yx(),H=xn(q),J={};bn(()=>{Gi(H,ye(L).title),J!==(J=ye(L).value)&&(q.value=(q.__value=ye(L).value)??"")}),Ve(D,q)}),bn(()=>{Ir(b,"for",e.name),Gi(N,e.actionOption.label),Ir(O,"id",e.name)}),sx(O,()=>ye(r),D=>It(r,D)),Ve(E,S)},v=E=>{var S=or(),b=Mn(S);{var N=O=>{var D=kx(),L=xn(D);L.__change=s;var q=Vs(L);bn(H=>{Ir(D,"for",e.name),Ir(L,"id",H),Gi(q,` ${e.actionOption.label??""}`)},[()=>String(e.name)]),cx(L,()=>ye(r),H=>It(r,H)),Ve(O,D)};Yt(b,O=>{e.actionOption.type==="toggle"&&typeof ye(r)=="boolean"&&O(N)},!0)}Ve(E,S)};Yt(p,E=>{e.actionOption.type==="select"?E(y):E(v,!1)})}Ve(h,d)};Yt(c,h=>{e.actionOption&&h(f)})}Ve(t,u),ns()}So(["change"]);var wx=cn('<button type="submit" class="sub-action svelte-1xmw7n6"> </button>');function bx(t,e){ts(e,!0);const r=f=>{if(f.preventDefault(),!e.actionInstance||!e.subAction){te.error("Can't run a SubAction",e.actionInstance,e.subAction);return}e.subAction.method()};var s=or(),u=Mn(s);{var c=f=>{var h=wx();h.__click=r;var d=xn(h);bn(()=>{Ir(h,"id",`subaction-${e.name}`),Ir(h,"title",e.subAction.label),Gi(d,e.subAction.label)}),Ve(f,h)};Yt(u,f=>{e.subAction&&f(c)})}Ve(t,s),ns()}So(["click"]);var Sx=cn("<!> <!>",1);function Ix(t,e){ts(e,!0);const r=qg("gm"),s=En(()=>e.control.type),u=En(()=>e.control.targetMode),c=En(()=>ye(s)&&ye(u)&&r.actionInstances[`${ye(s)}__${ye(u)}`]||null);var f=or(),h=Mn(f);{var d=p=>{var y=Sx(),v=Mn(y);Ws(v,17,()=>Object.entries(ye(c).options),([S,b])=>S,(S,b)=>{var N=En(()=>$a(ye(b),2));let O=()=>ye(N)[0],D=()=>ye(N)[1];xx(S,{get name(){return O()},get actionInstance(){return ye(c)},get actionOption(){return D()}})});var E=Vs(v,2);Ws(E,17,()=>Object.entries(ye(c).actions),([S,b])=>S,(S,b)=>{var N=En(()=>$a(ye(b),2));let O=()=>ye(N)[0],D=()=>ye(N)[1];bx(S,{get name(){return O()},get actionInstance(){return ye(c)},get subAction(){return D()}})}),Ve(p,y)};Yt(h,p=>{ye(c)&&p(d)})}Ve(t,f),ns()}const{entries:Td,setPrototypeOf:Yh,isFrozen:Mx,getPrototypeOf:Nx,getOwnPropertyDescriptor:Lx}=Object;let{freeze:Ct,seal:un,create:Zu}=Object,{apply:Ku,construct:Qu}=typeof Reflect<"u"&&Reflect;Ct||(Ct=function(t){return t});un||(un=function(t){return t});Ku||(Ku=function(t,e){for(var r=arguments.length,s=new Array(r>2?r-2:0),u=2;u<r;u++)s[u-2]=arguments[u];return t.apply(e,s)});Qu||(Qu=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),s=1;s<e;s++)r[s-1]=arguments[s];return new t(...r)});const Ea=At(Array.prototype.forEach),Cx=At(Array.prototype.lastIndexOf),zh=At(Array.prototype.pop),ms=At(Array.prototype.push),Ax=At(Array.prototype.splice),Fa=At(String.prototype.toLowerCase),uu=At(String.prototype.toString),lu=At(String.prototype.match),vs=At(String.prototype.replace),Tx=At(String.prototype.indexOf),Px=At(String.prototype.trim),pn=At(Object.prototype.hasOwnProperty),bt=At(RegExp.prototype.test),ys=Ox(TypeError);function At(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var r=arguments.length,s=new Array(r>1?r-1:0),u=1;u<r;u++)s[u-1]=arguments[u];return Ku(t,e,s)}}function Ox(t){return function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return Qu(t,r)}}function we(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fa;Yh&&Yh(t,null);let s=e.length;for(;s--;){let u=e[s];if(typeof u=="string"){const c=r(u);c!==u&&(Mx(e)||(e[s]=c),u=c)}t[u]=!0}return t}function Rx(t){for(let e=0;e<t.length;e++)pn(t,e)||(t[e]=null);return t}function Un(t){const e=Zu(null);for(const[r,s]of Td(t))pn(t,r)&&(Array.isArray(s)?e[r]=Rx(s):s&&typeof s=="object"&&s.constructor===Object?e[r]=Un(s):e[r]=s);return e}function _s(t,e){for(;t!==null;){const s=Lx(t,e);if(s){if(s.get)return At(s.get);if(typeof s.value=="function")return At(s.value)}t=Nx(t)}function r(){return null}return r}const Jh=Ct(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),cu=Ct(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),hu=Ct(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Dx=Ct(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),fu=Ct(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Fx=Ct(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Hh=Ct(["#text"]),Vh=Ct(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),gu=Ct(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Xh=Ct(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xa=Ct(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Gx=un(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Bx=un(/<%[\w\W]*|[\w\W]*%>/gm),Ux=un(/\$\{[\w\W]*/gm),jx=un(/^data-[\-\w.\u00B7-\uFFFF]+$/),qx=un(/^aria-[\-\w]+$/),Pd=un(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Yx=un(/^(?:\w+script|data):/i),zx=un(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Od=un(/^html$/i),Jx=un(/^[a-z][.\w]*(-[.\w]+)+$/i);var $h=Object.freeze({__proto__:null,ARIA_ATTR:qx,ATTR_WHITESPACE:zx,CUSTOM_ELEMENT:Jx,DATA_ATTR:jx,DOCTYPE_NAME:Od,ERB_EXPR:Bx,IS_ALLOWED_URI:Pd,IS_SCRIPT_OR_DATA:Yx,MUSTACHE_EXPR:Gx,TMPLIT_EXPR:Ux});const ks={element:1,text:3,progressingInstruction:7,comment:8,document:9},Hx=function(){return typeof window>"u"?null:window},Vx=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";e&&e.hasAttribute(s)&&(r=e.getAttribute(s));const u="dompurify"+(r?"#"+r:"");try{return t.createPolicy(u,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+u+" could not be created."),null}},Wh=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Rd(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Hx();const e=F=>Rd(F);if(e.version="3.3.1",e.removed=[],!t||!t.document||t.document.nodeType!==ks.document||!t.Element)return e.isSupported=!1,e;let{document:r}=t;const s=r,u=s.currentScript,{DocumentFragment:c,HTMLTemplateElement:f,Node:h,Element:d,NodeFilter:p,NamedNodeMap:y=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:v,DOMParser:E,trustedTypes:S}=t,b=d.prototype,N=_s(b,"cloneNode"),O=_s(b,"remove"),D=_s(b,"nextSibling"),L=_s(b,"childNodes"),q=_s(b,"parentNode");if(typeof f=="function"){const F=r.createElement("template");F.content&&F.content.ownerDocument&&(r=F.content.ownerDocument)}let H,J="";const{implementation:z,createNodeIterator:$,createDocumentFragment:k,getElementsByTagName:w}=r,{importNode:I}=s;let P=Wh();e.isSupported=typeof Td=="function"&&typeof q=="function"&&z&&z.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:T,ERB_EXPR:G,TMPLIT_EXPR:R,DATA_ATTR:C,ARIA_ATTR:B,IS_SCRIPT_OR_DATA:U,ATTR_WHITESPACE:Y,CUSTOM_ELEMENT:W}=$h;let{IS_ALLOWED_URI:Z}=$h,ne=null;const oe=we({},[...Jh,...cu,...hu,...fu,...Hh]);let le=null;const ie=we({},[...Vh,...gu,...Xh,...xa]);let ue=Object.seal(Zu(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ke=null,Le=null;const V=Object.seal(Zu(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Cn=!0,Se=!0,fe=!1,A=!0,Ce=!1,qe=!0,xe=!1,fi=!1,Br=!1,vr=!1,re=!1,Ur=!1,as=!0,An=!1;const Go="user-content-";let _e=!0,hn=!1,fn={},Tt=null;const me=we({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let gi=null;const be=we({},["audio","video","img","source","image","track"]);let ve=null;const ua=we({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Pt="http://www.w3.org/1998/Math/MathML",di="http://www.w3.org/2000/svg",de="http://www.w3.org/1999/xhtml";let yr=de,os=!1,jr=null;const Ot=we({},[Pt,di,de],uu);let Tn=we({},["mi","mo","mn","ms","mtext"]),yt=we({},["annotation-xml"]);const la=we({},["title","style","font","a","script"]);let Pn=null;const Bo=["application/xhtml+xml","text/html"],ca="text/html";let De=null,se=null;const pi=r.createElement("form"),qr=function(F){return F instanceof RegExp||F instanceof Function},Qn=function(){let F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(se&&se===F)){if((!F||typeof F!="object")&&(F={}),F=Un(F),Pn=Bo.indexOf(F.PARSER_MEDIA_TYPE)===-1?ca:F.PARSER_MEDIA_TYPE,De=Pn==="application/xhtml+xml"?uu:Fa,ne=pn(F,"ALLOWED_TAGS")?we({},F.ALLOWED_TAGS,De):oe,le=pn(F,"ALLOWED_ATTR")?we({},F.ALLOWED_ATTR,De):ie,jr=pn(F,"ALLOWED_NAMESPACES")?we({},F.ALLOWED_NAMESPACES,uu):Ot,ve=pn(F,"ADD_URI_SAFE_ATTR")?we(Un(ua),F.ADD_URI_SAFE_ATTR,De):ua,gi=pn(F,"ADD_DATA_URI_TAGS")?we(Un(be),F.ADD_DATA_URI_TAGS,De):be,Tt=pn(F,"FORBID_CONTENTS")?we({},F.FORBID_CONTENTS,De):me,ke=pn(F,"FORBID_TAGS")?we({},F.FORBID_TAGS,De):Un({}),Le=pn(F,"FORBID_ATTR")?we({},F.FORBID_ATTR,De):Un({}),fn=pn(F,"USE_PROFILES")?F.USE_PROFILES:!1,Cn=F.ALLOW_ARIA_ATTR!==!1,Se=F.ALLOW_DATA_ATTR!==!1,fe=F.ALLOW_UNKNOWN_PROTOCOLS||!1,A=F.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ce=F.SAFE_FOR_TEMPLATES||!1,qe=F.SAFE_FOR_XML!==!1,xe=F.WHOLE_DOCUMENT||!1,vr=F.RETURN_DOM||!1,re=F.RETURN_DOM_FRAGMENT||!1,Ur=F.RETURN_TRUSTED_TYPE||!1,Br=F.FORCE_BODY||!1,as=F.SANITIZE_DOM!==!1,An=F.SANITIZE_NAMED_PROPS||!1,_e=F.KEEP_CONTENT!==!1,hn=F.IN_PLACE||!1,Z=F.ALLOWED_URI_REGEXP||Pd,yr=F.NAMESPACE||de,Tn=F.MATHML_TEXT_INTEGRATION_POINTS||Tn,yt=F.HTML_INTEGRATION_POINTS||yt,ue=F.CUSTOM_ELEMENT_HANDLING||{},F.CUSTOM_ELEMENT_HANDLING&&qr(F.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ue.tagNameCheck=F.CUSTOM_ELEMENT_HANDLING.tagNameCheck),F.CUSTOM_ELEMENT_HANDLING&&qr(F.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ue.attributeNameCheck=F.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),F.CUSTOM_ELEMENT_HANDLING&&typeof F.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ue.allowCustomizedBuiltInElements=F.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ce&&(Se=!1),re&&(vr=!0),fn&&(ne=we({},Hh),le=[],fn.html===!0&&(we(ne,Jh),we(le,Vh)),fn.svg===!0&&(we(ne,cu),we(le,gu),we(le,xa)),fn.svgFilters===!0&&(we(ne,hu),we(le,gu),we(le,xa)),fn.mathMl===!0&&(we(ne,fu),we(le,Xh),we(le,xa))),F.ADD_TAGS&&(typeof F.ADD_TAGS=="function"?V.tagCheck=F.ADD_TAGS:(ne===oe&&(ne=Un(ne)),we(ne,F.ADD_TAGS,De))),F.ADD_ATTR&&(typeof F.ADD_ATTR=="function"?V.attributeCheck=F.ADD_ATTR:(le===ie&&(le=Un(le)),we(le,F.ADD_ATTR,De))),F.ADD_URI_SAFE_ATTR&&we(ve,F.ADD_URI_SAFE_ATTR,De),F.FORBID_CONTENTS&&(Tt===me&&(Tt=Un(Tt)),we(Tt,F.FORBID_CONTENTS,De)),F.ADD_FORBID_CONTENTS&&(Tt===me&&(Tt=Un(Tt)),we(Tt,F.ADD_FORBID_CONTENTS,De)),_e&&(ne["#text"]=!0),xe&&we(ne,["html","head","body"]),ne.table&&(we(ne,["tbody"]),delete ke.tbody),F.TRUSTED_TYPES_POLICY){if(typeof F.TRUSTED_TYPES_POLICY.createHTML!="function")throw ys('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof F.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ys('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');H=F.TRUSTED_TYPES_POLICY,J=H.createHTML("")}else H===void 0&&(H=Vx(S,u)),H!==null&&typeof J=="string"&&(J=H.createHTML(""));Ct&&Ct(F),se=F}},us=we({},[...cu,...hu,...Dx]),mi=we({},[...fu,...Fx]),ha=function(F){let he=q(F);(!he||!he.tagName)&&(he={namespaceURI:yr,tagName:"template"});const ee=Fa(F.tagName),Te=Fa(he.tagName);return jr[F.namespaceURI]?F.namespaceURI===di?he.namespaceURI===de?ee==="svg":he.namespaceURI===Pt?ee==="svg"&&(Te==="annotation-xml"||Tn[Te]):!!us[ee]:F.namespaceURI===Pt?he.namespaceURI===de?ee==="math":he.namespaceURI===di?ee==="math"&&yt[Te]:!!mi[ee]:F.namespaceURI===de?he.namespaceURI===di&&!yt[Te]||he.namespaceURI===Pt&&!Tn[Te]?!1:!mi[ee]&&(la[ee]||!us[ee]):!!(Pn==="application/xhtml+xml"&&jr[F.namespaceURI]):!1},_t=function(F){ms(e.removed,{element:F});try{q(F).removeChild(F)}catch{O(F)}},On=function(F,he){try{ms(e.removed,{attribute:he.getAttributeNode(F),from:he})}catch{ms(e.removed,{attribute:null,from:he})}if(he.removeAttribute(F),F==="is")if(vr||re)try{_t(he)}catch{}else try{he.setAttribute(F,"")}catch{}},Yr=function(F){let he=null,ee=null;if(Br)F="<remove></remove>"+F;else{const Re=lu(F,/^[\r\n\t ]+/);ee=Re&&Re[0]}Pn==="application/xhtml+xml"&&yr===de&&(F='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+F+"</body></html>");const Te=H?H.createHTML(F):F;if(yr===de)try{he=new E().parseFromString(Te,Pn)}catch{}if(!he||!he.documentElement){he=z.createDocument(yr,"template",null);try{he.documentElement.innerHTML=os?J:Te}catch{}}const et=he.body||he.documentElement;return F&&ee&&et.insertBefore(r.createTextNode(ee),et.childNodes[0]||null),yr===de?w.call(he,xe?"html":"body")[0]:xe?he.documentElement:et},fa=function(F){return $.call(F.ownerDocument||F,F,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},vi=function(F){return F instanceof v&&(typeof F.nodeName!="string"||typeof F.textContent!="string"||typeof F.removeChild!="function"||!(F.attributes instanceof y)||typeof F.removeAttribute!="function"||typeof F.setAttribute!="function"||typeof F.namespaceURI!="string"||typeof F.insertBefore!="function"||typeof F.hasChildNodes!="function")},ga=function(F){return typeof h=="function"&&F instanceof h};function Je(F,he,ee){Ea(F,Te=>{Te.call(e,he,ee,se)})}const yi=function(F){let he=null;if(Je(P.beforeSanitizeElements,F,null),vi(F))return _t(F),!0;const ee=De(F.nodeName);if(Je(P.uponSanitizeElement,F,{tagName:ee,allowedTags:ne}),qe&&F.hasChildNodes()&&!ga(F.firstElementChild)&&bt(/<[/\w!]/g,F.innerHTML)&&bt(/<[/\w!]/g,F.textContent)||F.nodeType===ks.progressingInstruction||qe&&F.nodeType===ks.comment&&bt(/<[/\w]/g,F.data))return _t(F),!0;if(!(V.tagCheck instanceof Function&&V.tagCheck(ee))&&(!ne[ee]||ke[ee])){if(!ke[ee]&&Rn(ee)&&(ue.tagNameCheck instanceof RegExp&&bt(ue.tagNameCheck,ee)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(ee)))return!1;if(_e&&!Tt[ee]){const Te=q(F)||F.parentNode,et=L(F)||F.childNodes;if(et&&Te){const Re=et.length;for(let kt=Re-1;kt>=0;--kt){const Et=N(et[kt],!0);Et.__removalCount=(F.__removalCount||0)+1,Te.insertBefore(Et,D(F))}}}return _t(F),!0}return F instanceof d&&!ha(F)||(ee==="noscript"||ee==="noembed"||ee==="noframes")&&bt(/<\/no(script|embed|frames)/i,F.innerHTML)?(_t(F),!0):(Ce&&F.nodeType===ks.text&&(he=F.textContent,Ea([T,G,R],Te=>{he=vs(he,Te," ")}),F.textContent!==he&&(ms(e.removed,{element:F.cloneNode()}),F.textContent=he)),Je(P.afterSanitizeElements,F,null),!1)},_r=function(F,he,ee){if(as&&(he==="id"||he==="name")&&(ee in r||ee in pi))return!1;if(!(Se&&!Le[he]&&bt(C,he))&&!(Cn&&bt(B,he))&&!(V.attributeCheck instanceof Function&&V.attributeCheck(he,F))){if(!le[he]||Le[he]){if(!(Rn(F)&&(ue.tagNameCheck instanceof RegExp&&bt(ue.tagNameCheck,F)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(F))&&(ue.attributeNameCheck instanceof RegExp&&bt(ue.attributeNameCheck,he)||ue.attributeNameCheck instanceof Function&&ue.attributeNameCheck(he,F))||he==="is"&&ue.allowCustomizedBuiltInElements&&(ue.tagNameCheck instanceof RegExp&&bt(ue.tagNameCheck,ee)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(ee))))return!1}else if(!ve[he]&&!bt(Z,vs(ee,Y,""))&&!((he==="src"||he==="xlink:href"||he==="href")&&F!=="script"&&Tx(ee,"data:")===0&&gi[F])&&!(fe&&!bt(U,vs(ee,Y,"")))&&ee)return!1}return!0},Rn=function(F){return F!=="annotation-xml"&&lu(F,W)},Dn=function(F){Je(P.beforeSanitizeAttributes,F,null);const{attributes:he}=F;if(!he||vi(F))return;const ee={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:le,forceKeepAttr:void 0};let Te=he.length;for(;Te--;){const et=he[Te],{name:Re,namespaceURI:kt,value:Et}=et,xt=De(Re),_i=Et;let tt=Re==="value"?_i:Px(_i);if(ee.attrName=xt,ee.attrValue=tt,ee.keepAttr=!0,ee.forceKeepAttr=void 0,Je(P.uponSanitizeAttribute,F,ee),tt=ee.attrValue,An&&(xt==="id"||xt==="name")&&(On(Re,F),tt=Go+tt),qe&&bt(/((--!?|])>)|<\/(style|title|textarea)/i,tt)){On(Re,F);continue}if(xt==="attributename"&&lu(tt,"href")){On(Re,F);continue}if(ee.forceKeepAttr)continue;if(!ee.keepAttr){On(Re,F);continue}if(!A&&bt(/\/>/i,tt)){On(Re,F);continue}Ce&&Ea([T,G,R],kr=>{tt=vs(tt,kr," ")});const Rt=De(F.nodeName);if(!_r(Rt,xt,tt)){On(Re,F);continue}if(H&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!kt)switch(S.getAttributeType(Rt,xt)){case"TrustedHTML":{tt=H.createHTML(tt);break}case"TrustedScriptURL":{tt=H.createScriptURL(tt);break}}if(tt!==_i)try{kt?F.setAttributeNS(kt,Re,tt):F.setAttribute(Re,tt),vi(F)?_t(F):zh(e.removed)}catch{On(Re,F)}}Je(P.afterSanitizeAttributes,F,null)},ls=function F(he){let ee=null;const Te=fa(he);for(Je(P.beforeSanitizeShadowDOM,he,null);ee=Te.nextNode();)Je(P.uponSanitizeShadowNode,ee,null),yi(ee),Dn(ee),ee.content instanceof c&&F(ee.content);Je(P.afterSanitizeShadowDOM,he,null)};return e.sanitize=function(F){let he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ee=null,Te=null,et=null,Re=null;if(os=!F,os&&(F="<!-->"),typeof F!="string"&&!ga(F))if(typeof F.toString=="function"){if(F=F.toString(),typeof F!="string")throw ys("dirty is not a string, aborting")}else throw ys("toString is not a function");if(!e.isSupported)return F;if(fi||Qn(he),e.removed=[],typeof F=="string"&&(hn=!1),hn){if(F.nodeName){const xt=De(F.nodeName);if(!ne[xt]||ke[xt])throw ys("root node is forbidden and cannot be sanitized in-place")}}else if(F instanceof h)ee=Yr("<!---->"),Te=ee.ownerDocument.importNode(F,!0),Te.nodeType===ks.element&&Te.nodeName==="BODY"||Te.nodeName==="HTML"?ee=Te:ee.appendChild(Te);else{if(!vr&&!Ce&&!xe&&F.indexOf("<")===-1)return H&&Ur?H.createHTML(F):F;if(ee=Yr(F),!ee)return vr?null:Ur?J:""}ee&&Br&&_t(ee.firstChild);const kt=fa(hn?F:ee);for(;et=kt.nextNode();)yi(et),Dn(et),et.content instanceof c&&ls(et.content);if(hn)return F;if(vr){if(re)for(Re=k.call(ee.ownerDocument);ee.firstChild;)Re.appendChild(ee.firstChild);else Re=ee;return(le.shadowroot||le.shadowrootmode)&&(Re=I.call(s,Re,!0)),Re}let Et=xe?ee.outerHTML:ee.innerHTML;return xe&&ne["!doctype"]&&ee.ownerDocument&&ee.ownerDocument.doctype&&ee.ownerDocument.doctype.name&&bt(Od,ee.ownerDocument.doctype.name)&&(Et="<!DOCTYPE "+ee.ownerDocument.doctype.name+`>
|
|
123
|
+
`+Et),Ce&&Ea([T,G,R],xt=>{Et=vs(Et,xt," ")}),H&&Ur?H.createHTML(Et):Et},e.setConfig=function(){let F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Qn(F),fi=!0},e.clearConfig=function(){se=null,fi=!1},e.isValidAttribute=function(F,he,ee){se||Qn({});const Te=De(F),et=De(he);return _r(Te,et,ee)},e.addHook=function(F,he){typeof he=="function"&&ms(P[F],he)},e.removeHook=function(F,he){if(he!==void 0){const ee=Cx(P[F],he);return ee===-1?void 0:Ax(P[F],ee,1)[0]}return zh(P[F])},e.removeHooks=function(F){P[F]=[]},e.removeAllHooks=function(){P=Wh()},e}var Dd=Rd(),Xx=cn("<div><!></div>"),$x=cn('<div><button type="button"><!></button> <!></div>');function Wx(t,e){ts(e,!0);const r=()=>Ld(zl,"$controlsStore",s),[s,u]=Cd(),c=En(()=>e.controlOptions?.icon?Dd.sanitize(e.controlOptions.icon.trim()):null),f=qg("gm"),h=f.control.getDefaultPosition(),d=()=>{e.control&&e.controlOptions?f.options.toggleMode(e.control.type,e.control.targetMode):te.error("Control or controlOptions not defined",e.control,e.controlOptions)};var p=or(),y=Mn(p);{var v=E=>{var S=$x(),b=xn(S);let N;b.__click=d;var O=xn(b);{var D=J=>{var z=or(),$=Mn(z);Sd($,()=>ye(c)),Ve(J,z)},L=J=>{var z=or(),$=Mn(z);{var k=I=>{var P=Fh();bn(T=>Gi(P,T),[()=>e.controlOptions.title.slice(0,2)]),Ve(I,P)},w=I=>{var P=Fh();bn(()=>Gi(P,e.control.targetMode)),Ve(I,P)};Yt($,I=>{e.controlOptions.title?I(k):I(w,!1)},!0)}Ve(J,z)};Yt(O,J=>{e.controlOptions.icon?J(D):J(L,!1)})}var q=Vs(b,2);{var H=J=>{var z=Xx();let $;var k=xn(z);Ix(k,{get control(){return e.control}}),bn(w=>$=Us(z,1,"control-menu svelte-1q85gr9",null,$,w),[()=>({"menu-right":h.endsWith("left"),"menu-left":h.endsWith("right")})]),Ve(J,z)};Yt(q,J=>{e.controlOptions.active&&J(H)})}bn(()=>{Us(S,1,nx(r().settings.controlsStyles.controlContainerClass),"svelte-1q85gr9"),Ir(b,"id",`id_${e.control.type}_${e.control.targetMode}`),N=Us(b,1,`${r().settings.controlsStyles.controlButtonClass} ${e.control.type}-${e.control.targetMode}`,"svelte-1q85gr9",N,{active:e.controlOptions.active}),Ir(b,"title",e.controlOptions.title)}),Ve(E,S)};Yt(y,E=>{e.control&&e.controlOptions&&e.controlOptions.uiEnabled&&E(v)})}Ve(t,p),ns(),u()}So(["click"]);function Zx(t){const e=t-1;return e*e*e+1}function Zh(t,{delay:e=0,duration:r=400,easing:s=Zx,axis:u="y"}={}){const c=getComputedStyle(t),f=+c.opacity,h=u==="y"?"height":"width",d=parseFloat(c[h]),p=u==="y"?["top","bottom"]:["left","right"],y=p.map(D=>`${D[0].toUpperCase()}${D.slice(1)}`),v=parseFloat(c[`padding${y[0]}`]),E=parseFloat(c[`padding${y[1]}`]),S=parseFloat(c[`margin${y[0]}`]),b=parseFloat(c[`margin${y[1]}`]),N=parseFloat(c[`border${y[0]}Width`]),O=parseFloat(c[`border${y[1]}Width`]);return{delay:e,duration:r,easing:s,css:D=>`overflow: hidden;opacity: ${Math.min(D*20,1)*f};${h}: ${D*d}px;padding-${p[0]}: ${D*v}px;padding-${p[1]}: ${D*E}px;margin-${p[0]}: ${D*S}px;margin-${p[1]}: ${D*b}px;border-${p[0]}-width: ${D*N}px;border-${p[1]}-width: ${D*O}px;min-${h}: 0`}}var Kx=cn('<div><button class="gm-control-button"><!></button></div>'),Qx=cn("<div></div>"),ew=cn("<div></div>"),tw=cn('<div class="gm-reactive-controls"><!> <!></div>');function nw(t,e){ts(e,!0);const r=()=>Ld(zl,"$controlsStore",s),[s,u]=Cd();let c=jn(!0),f=En(()=>r().settings.controlsCollapsible),h=En(()=>r().settings.controlsStyles);const d=(L,q)=>r().controls?.[L]?.[q]||null,p=(L,q)=>Object.entries(q).some(([H,J])=>d(L,H)&&J&&J.uiEnabled),y=()=>{It(c,!ye(c))},v=()=>Dd.sanitize(ye(c)?mx:vx),E=L=>Object.entries(L).map(([q,H],J)=>({key:q,options:H,originalIndex:J})).sort((q,H)=>{const J=q.options.order??1/0,z=H.options.order??1/0;return J!==z?J-z:q.originalIndex-H.originalIndex}).map(({key:q,options:H})=>[q,H]);var S=tw(),b=xn(S);{var N=L=>{var q=Kx(),H=xn(q);H.__click=y;var J=xn(H);Sd(J,v),bn(()=>Us(q,1,`${ye(h).controlGroupClass} group-settings`)),Ve(L,q)};Yt(b,L=>{ye(f)&&L(N)})}var O=Vs(b,2);{var D=L=>{var q=ew();Ws(q,5,()=>Object.entries(r().options),([H,J])=>H,(H,J)=>{var z=En(()=>$a(ye(J),2));let $=()=>ye(z)[0],k=()=>ye(z)[1];var w=or(),I=Mn(w);{var P=T=>{var G=Qx();Ws(G,21,()=>E(k()),([R,C])=>R,(R,C)=>{var B=En(()=>$a(ye(C),2));let U=()=>ye(B)[0],Y=()=>ye(B)[1];const W=En(()=>d($(),U()));var Z=or(),ne=Mn(Z);{var oe=le=>{Wx(le,{get control(){return ye(W)},get controlOptions(){return Y()}})};Yt(ne,le=>{ye(W)&&le(oe)})}Ve(R,Z)}),bn(()=>Us(G,1,`${ye(h).controlGroupClass} group-${$()}`)),Ve(T,G)};Yt(I,T=>{p($(),k())&&T(P)})}Ve(H,w)}),Uh(1,q,()=>Zh,()=>({duration:180})),Uh(2,q,()=>Zh,()=>({duration:140})),Ve(L,q)};Yt(O,L=>{ye(c)&&L(D)})}Ve(t,S),ns(),u()}So(["click"]);class rw{gm;constructor(e){this.gm=e}}const Ze=t=>Object.keys(t),el=t=>Object.values(t),ur=(t,e)=>e.includes(t);class iw extends rw{controls=Ht(Wf);reactiveControls=null;container=void 0;eventHandlers={[`${ae}:draw`]:this.handleModeEvent.bind(this),[`${ae}:edit`]:this.handleModeEvent.bind(this),[`${ae}:helper`]:this.handleModeEvent.bind(this)};onAdd(){if(this.createControls(),this.gm.events.bus.attachEvents(this.eventHandlers),!this.container)throw new Error("Controls container is not initialized");return this.container}createControls(e=void 0){if(this.controlsAdded()){te.warn("Can't add controls: controls already added");return}this.container=e||this.createHtmlContainer(),this.createReactivePanel()}onRemove(){this.gm.events.bus.detachEvents(this.eventHandlers),this.reactiveControls&&(JE(this.reactiveControls),this.reactiveControls=null),this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=void 0}handleModeEvent(e){return Fo(e)?(["mode_started","mode_ended"].includes(e.action)&&this.updateReactivePanel(),{next:!0}):{next:!0}}controlsAdded(){return!!this.reactiveControls}createReactivePanel(){if(!this.container){te.error("Can't create reactive panel: container is not initialized");return}this.syncModeStates();const e=new Map;e.set("gm",this.gm),this.reactiveControls=YE(nw,{target:this.container,context:e}),this.updateReactivePanel()}updateReactivePanel(){zl.update(()=>({controls:this.controls,options:this.gm.options.controls,settings:this.gm.options.settings}))}createHtmlContainer(){const e=document.createElement("div");return e.classList.add("geoman-controls"),e}syncModeStates(){this.eachControlWithOptions(({control:e})=>{this.gm.options.syncModeState(e.type,e.targetMode)})}eachControlWithOptions(e){return Ze(this.controls).forEach(r=>{const s=this.controls[r];return Object.keys(s).forEach(u=>{const c=u,f=this.getControl({modeType:r,modeName:c}),h=this.gm.options.getControlOptions({modeType:r,modeName:c});f&&h&&e({control:f,controlOptions:h})})})}getControl({modeType:e,modeName:r}){return e&&r&&this.controls[e][r]||null}getDefaultPosition(){return this.gm.options.settings.controlsPosition}}class sw{gm;globalEventsListener=null;constructor(e){this.gm=e}get map(){return this.gm.mapAdapter.getMapInstance()}async processEvent(e,r){await this.fireToMap({type:"system",eventName:e.split(":")[1],payload:{...r,level:"user"}}),r.action==="mode_start"||r.action==="mode_end"?await this.forwardModeToggledEvent(r):r.action==="feature_created"?await this.forwardFeatureCreated(r):r.action==="feature_removed"?await this.forwardFeatureRemoved(r):r.action==="feature_updated"?await this.forwardFeatureUpdated(r):r.action==="feature_edit_start"?await this.forwardFeatureEditStart(r):r.action==="feature_edit_end"?await this.forwardFeatureEditEnd(r):(r.action==="loaded"||r.action==="unloaded")&&await this.forwardGeomanLoaded(r)}async forwardModeToggledEvent(e){const r=e.action==="mode_start";if(e.actionType==="draw"){const s="globaldrawmodetoggled",u={name:`${rt}:${s}`,actionType:e.actionType,action:e.action,enabled:r,shape:e.mode,map:this.map};await this.fireToMap({type:"converted",eventName:s,payload:u});const c=r?"drawstart":"drawend",f={name:`${rt}:${c}`,actionType:e.actionType,action:e.action,shape:e.mode,map:this.map};await this.fireToMap({type:"converted",eventName:c,payload:f})}else if(e.actionType==="edit"){const s=`global${this.getConvertedEditModeName(e.mode)}modetoggled`,u={name:`${rt}:${s}`,actionType:e.actionType,action:e.action,enabled:r,map:this.map};await this.fireToMap({type:"converted",eventName:s,payload:u})}else if(e.actionType==="helper"){const s=`global${e.mode}modetoggled`,u={name:`${rt}:${s}`,actionType:e.actionType,action:e.action,enabled:r,map:this.map};await this.fireToMap({type:"converted",eventName:s,payload:u})}}async forwardFeatureCreated(e){const r={name:`${rt}:create`,actionType:e.actionType,action:e.action,shape:e.mode,feature:e.featureData,map:this.map};await this.fireToMap({type:"converted",eventName:"create",payload:r})}async forwardFeatureRemoved(e){const r={name:`${rt}:remove`,actionType:e.actionType,action:e.action,shape:e.mode,feature:e.featureData,map:this.map};await this.fireToMap({type:"converted",eventName:"remove",payload:r})}async forwardFeatureUpdated(e){const r=this.getConvertedEditModeName(e.mode),s=["lasso"],u={name:`${rt}:${r}`,actionType:e.actionType,action:e.action,map:this.map};e.sourceFeatures.length===1&&!s.includes(e.mode)?u.originalFeature=e.sourceFeatures[0]:u.originalFeatures=e.sourceFeatures,e.targetFeatures.length===1&&!s.includes(e.mode)?(u.feature=e.targetFeatures[0],u.shape=u.feature.shape):u.features=e.targetFeatures,await this.fireToMap({type:"converted",eventName:`${r}`,payload:u})}async forwardFeatureEditStart(e){const r=this.getConvertedEditModeName(e.mode),s={name:`${rt}:${r}start`,actionType:e.actionType,action:e.action,shape:e.feature.shape,feature:e.feature,map:this.map};await this.fireToMap({type:"converted",eventName:`${r}start`,payload:s})}async forwardFeatureEditEnd(e){const r=this.getConvertedEditModeName(e.mode),s={name:`${rt}:${r}end`,actionType:e.actionType,action:e.action,shape:e.feature.shape,feature:e.feature,map:this.map};await this.fireToMap({type:"converted",eventName:`${r}end`,payload:s})}async forwardGeomanLoaded(e){const r={name:`${rt}:${e.action}`,actionType:e.actionType,action:e.action,map:this.map,[rt]:this.gm};await this.fireToMap({type:"converted",eventName:`${r.action}`,payload:r})}async fireToMap({type:e,eventName:r,payload:s}){const u=`${e==="system"?ae:rt}:${r}`;if(this.gm.options.settings.awaitDataUpdatesOnEvents&&"feature"in s&&s.feature?.source){const c=s.feature.source.id;await this.gm.features.updateManager.waitForPendingUpdates(c)}this.globalEventsListener?.(s),this.gm.mapAdapter.fire(u,s)}getConvertedEditModeName(e){return e==="change"?"edit":e}}const Jl=t=>Xn(t)&&t.name===`${ae}:control:switch`,Xn=t=>!!(t&&typeof t=="object"&&["level","name","actionType","action"].every(e=>e in t)),aw=t=>!!(t&&typeof t=="object"&&["type","originalEvent","target"].every(e=>e in t));class ow{gm;forwarder;mapEventHandlers={};gmEventHandlers={};constructor(e){this.gm=e,this.forwarder=new sw(e)}pendingForward=Promise.resolve();fireEvent(e,r){const s=this.gmEventHandlers[e];if(!s)return;const{controlHandler:u}=s;u(r),this.pendingForward=this.pendingForward.then(()=>this.forwarder.processEvent(e,r))}attachEvents(e){Ze(e).forEach(r=>{const s=e[r];s&&this.on(r,s)})}detachEvents(e){Ze(e).forEach(r=>{const s=e[r];s&&this.off(r,s)})}detachAllEvents(){Ze(this.gmEventHandlers).forEach(e=>{Array.from(this.gmEventHandlers[e]?.handlers||[]).forEach(r=>{this.off(e,r)})}),Ze(this.mapEventHandlers).forEach(e=>{Array.from(this.mapEventHandlers[e]?.handlers||[]).forEach(r=>{this.off(e,r)})})}on(e,r){e.startsWith(ae)?this.onGmEvent(e,r):this.onMapEvent(e,r)}onGmEvent(e,r){this.gmEventHandlers[e]||(this.gmEventHandlers[e]=this.createEventSection(e)),this.gmEventHandlers[e]?.handlers.unshift(r)}onMapEvent(e,r){if(!this.mapEventHandlers[e]){const s=this.createEventSection(e);this.gm.mapAdapter.on(e,s.controlHandler),this.mapEventHandlers[e]=s}this.mapEventHandlers[e]?.handlers.unshift(r)}off(e,r){e.startsWith(`${ae}`)?this.offGmEvent(e,r):this.offMapEvent(e,r)}offGmEvent(e,r){const s=this.gmEventHandlers[e]?.handlers||[],u=s.findIndex(c=>r===c);u===-1?te.warn("MapEvents: handler not found",e,r):(s.splice(u,1),s.length===0&&delete this.gmEventHandlers[e])}offMapEvent(e,r){const s=this.mapEventHandlers[e]?.handlers||[],u=s.findIndex(c=>r===c);if(u===-1)te.warn("MapEvents: handler not found",e,r);else if(s.splice(u,1),s.length===0){const c=this.mapEventHandlers[e]?.controlHandler;c&&this.gm.mapAdapter.off(e,c),delete this.mapEventHandlers[e]}}createEventSection(e){return{handlers:[],controlHandler:r=>{let s;if(Xn(r)&&e.startsWith(`${ae}`)?s=this.gmEventHandlers[e]:s=this.mapEventHandlers[e],!s){te.debug(`No handlers for eventName: "${e}"`);return}s.handlers.some(u=>{let c;return Xn(r)||aw(r)?c=u(r):te.error("EventsBus: unknown event type",r),c&&typeof c=="object"&&"next"in c?!c.next:(te.error('EventsBus: handler should return an object with a "next" property'),!1)})}}}}class Io{gm;constructor(e){this.gm=e}trackExclusiveModes(e){if(e.action!=="mode_start")return;const{sectionName:r,modeName:s}=this.getControlIds(e)||{};this.getControl(e)?.settings.exclusive&&this.gm.control.eachControlWithOptions(u=>{const c=u.control.type,f=u.control.targetMode;c===r&&f===s||u.controlOptions.active&&u.control.settings.exclusive&&this.gm.options.disableMode(c,f)})}trackRelatedModes(e){Fo(e)&&this.gm.control.eachControlWithOptions(r=>{const s=r.control,{type:u,targetMode:c}=s;s.settings.enabledBy?.includes(e.mode)&&(e.action==="mode_start"?(this.gm.options.isModeEnabled(u,c)&&this.gm.options.disableMode(u,c),this.gm.options.enableMode(u,c)):e.action==="mode_end"?this.gm.options.disableMode(u,c):te.error("Unknown mode action",e.action))})}getControl(e){const{modeName:r,sectionName:s}=this.getControlIds(e)||{};return r&&s?this.gm.control.getControl({modeType:s,modeName:r}):null}getControlOptions(e){const{modeName:r,sectionName:s}=this.getControlIds(e)||{};return r&&s?this.gm.options.getControlOptions({modeType:s,modeName:r}):null}getControlIds(e){let r=null,s=null;return e.action==="mode_start"?(r=e.actionType,s=e.mode):Jl(e)&&(r=e.section,s=e.mode),r&&s?{sectionName:r,modeName:s}:null}}class uw extends Io{eventHandlers={[`${ae}:control`]:this.handleControlEvent.bind(this)};constructor(e,r){super(e),r.attachEvents(this.eventHandlers)}handleControlEvent(e){return Jl(e)?(this.getControl(e)||te.error("Control not found, event payload",e),{next:!0}):{next:!0}}}const lw=["draw","edit","helper"],Yn=["marker","circle","circle_marker","ellipse","text_marker","line","rectangle","polygon"],Fd=["dom_marker","vertex_marker","center_marker","edge_marker","snap_guide"],Gd=[...Yn,...Fd],Bd=["freehand","custom_shape"],Hl=[...Yn,...Bd],Vl=["shape_markers","pin","snapping","snap_guides","measurements","auto_trace","geofencing","zoom_to_features","click_to_edit"],Xl=["drag","change","rotate","scale","copy","cut","split","union","difference","line_simplification","lasso","delete"],cw=t=>Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number",du={id:t=>typeof t=="string"||typeof t=="number",shape:t=>typeof t=="string"&&ur(t,Gd),center:t=>cw(t),xSemiAxis:t=>typeof t=="number",ySemiAxis:t=>typeof t=="number",angle:t=>typeof t=="number",text:t=>typeof t=="string",disableEdit:t=>typeof t=="boolean"};class Mo{isMarkerInstanceAvailable(){return this.markerInstance?!0:(te.error("Marker instance is not available"),!1)}}var ot=63710088e-1,Ud={centimeters:ot*100,centimetres:ot*100,degrees:360/(2*Math.PI),feet:ot*3.28084,inches:ot*39.37,kilometers:ot/1e3,kilometres:ot/1e3,meters:ot,metres:ot,miles:ot/1609.344,millimeters:ot*1e3,millimetres:ot*1e3,nauticalmiles:ot/1852,radians:1,yards:ot*1.0936};function ln(t,e,r={}){const s={type:"Feature"};return(r.id===0||r.id)&&(s.id=r.id),r.bbox&&(s.bbox=r.bbox),s.properties=e||{},s.geometry=t,s}function Sn(t,e,r={}){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(!Qa(t[0])||!Qa(t[1]))throw new Error("coordinates must contain numbers");return ln({type:"Point",coordinates:t},e,r)}function Pr(t,e,r={}){for(const s of t){if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(s[s.length-1].length!==s[0].length)throw new Error("First and last Position are not equivalent.");for(let u=0;u<s[s.length-1].length;u++)if(s[s.length-1][u]!==s[0][u])throw new Error("First and last Position are not equivalent.")}return ln({type:"Polygon",coordinates:t},e,r)}function Or(t,e,r={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return ln({type:"LineString",coordinates:t},e,r)}function Qe(t,e={}){const r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function hw(t,e,r={}){return ln({type:"MultiLineString",coordinates:t},e,r)}function jd(t,e,r={}){return ln({type:"MultiPolygon",coordinates:t},e,r)}function $l(t,e="kilometers"){const r=Ud[e];if(!r)throw new Error(e+" units is invalid");return t*r}function Wl(t,e="kilometers"){const r=Ud[e];if(!r)throw new Error(e+" units is invalid");return t/r}function ri(t){return t%(2*Math.PI)*180/Math.PI}function ut(t){return t%360*Math.PI/180}function qd(t,e="kilometers",r="kilometers"){if(!(t>=0))throw new Error("length must be a positive number");return $l(Wl(t,e),r)}function Qa(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function No(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Dr(t,e,r){if(t!==null)for(var s,u,c,f,h,d,p,y=0,v=0,E,S=t.type,b=S==="FeatureCollection",N=S==="Feature",O=b?t.features.length:1,D=0;D<O;D++){p=b?t.features[D].geometry:N?t.geometry:t,E=p?p.type==="GeometryCollection":!1,h=E?p.geometries.length:1;for(var L=0;L<h;L++){var q=0,H=0;if(f=E?p.geometries[L]:p,f!==null){d=f.coordinates;var J=f.type;switch(y=r&&(J==="Polygon"||J==="MultiPolygon")?1:0,J){case null:break;case"Point":if(e(d,v,D,q,H)===!1)return!1;v++,q++;break;case"LineString":case"MultiPoint":for(s=0;s<d.length;s++){if(e(d[s],v,D,q,H)===!1)return!1;v++,J==="MultiPoint"&&q++}J==="LineString"&&q++;break;case"Polygon":case"MultiLineString":for(s=0;s<d.length;s++){for(u=0;u<d[s].length-y;u++){if(e(d[s][u],v,D,q,H)===!1)return!1;v++}J==="MultiLineString"&&q++,J==="Polygon"&&H++}J==="Polygon"&&q++;break;case"MultiPolygon":for(s=0;s<d.length;s++){for(H=0,u=0;u<d[s].length;u++){for(c=0;c<d[s][u].length-y;c++){if(e(d[s][u][c],v,D,q,H)===!1)return!1;v++}H++}q++}break;case"GeometryCollection":for(s=0;s<f.geometries.length;s++)if(Dr(f.geometries[s],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function $n(t,e){if(t.type==="Feature")e(t,0);else if(t.type==="FeatureCollection")for(var r=0;r<t.features.length&&e(t.features[r],r)!==!1;r++);}function fw(t,e,r){var s=r;return $n(t,function(u,c){c===0&&r===void 0?s=u:s=e(s,u,c)}),s}function ci(t,e){var r,s,u,c,f,h,d,p,y,v,E=0,S=t.type==="FeatureCollection",b=t.type==="Feature",N=S?t.features.length:1;for(r=0;r<N;r++){for(h=S?t.features[r].geometry:b?t.geometry:t,p=S?t.features[r].properties:b?t.properties:{},y=S?t.features[r].bbox:b?t.bbox:void 0,v=S?t.features[r].id:b?t.id:void 0,d=h?h.type==="GeometryCollection":!1,f=d?h.geometries.length:1,u=0;u<f;u++){if(c=d?h.geometries[u]:h,c===null){if(e(null,E,p,y,v)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(c,E,p,y,v)===!1)return!1;break}case"GeometryCollection":{for(s=0;s<c.geometries.length;s++)if(e(c.geometries[s],E,p,y,v)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}E++}}function gw(t,e,r){var s=r;return ci(t,function(u,c,f,h,d){s=e(s,u,c,f,h,d)}),s}function Rr(t,e){ci(t,function(r,s,u,c,f){var h=r===null?null:r.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return e(ln(r,u,{bbox:c,id:f}),s,0)===!1?!1:void 0}var d;switch(h){case"MultiPoint":d="Point";break;case"MultiLineString":d="LineString";break;case"MultiPolygon":d="Polygon";break}for(var p=0;p<r.coordinates.length;p++){var y=r.coordinates[p],v={type:d,coordinates:y};if(e(ln(v,u),s,p)===!1)return!1}})}function ar(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const r=[1/0,1/0,-1/0,-1/0];return Dr(t,s=>{r[0]>s[0]&&(r[0]=s[0]),r[1]>s[1]&&(r[1]=s[1]),r[2]<s[0]&&(r[2]=s[0]),r[3]<s[1]&&(r[3]=s[1])}),r}var Yd=ar;function Ke(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return[...t.geometry.coordinates];if(t.type==="Point")return[...t.coordinates]}if(Array.isArray(t)&&t.length>=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 zt(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 sa(t){return t.type==="Feature"?t.geometry:t}function Kh(t,e){return t.type==="FeatureCollection"?"FeatureCollection":t.type==="GeometryCollection"?"GeometryCollection":t.type==="Feature"&&t.geometry!==null?t.geometry.type:t.type}function zd(t,e,r,s={}){const u=Ke(t),c=ut(u[0]),f=ut(u[1]),h=ut(r),d=Wl(e,s.units),p=Math.asin(Math.sin(f)*Math.cos(d)+Math.cos(f)*Math.sin(d)*Math.cos(h)),y=c+Math.atan2(Math.sin(h)*Math.sin(d)*Math.cos(f),Math.cos(d)-Math.sin(f)*Math.sin(p)),v=ri(y),E=ri(p);return u[2]!==void 0?Sn([v,E,u[2]],s.properties):Sn([v,E],s.properties)}function dw(t,e,r={}){const s=r.steps||64,u=r.properties?r.properties:!Array.isArray(t)&&t.type==="Feature"&&t.properties?t.properties:{},c=[];for(let f=0;f<s;f++)c.push(zd(t,e,f*-360/s,r).geometry.coordinates);return c.push(c[0]),Pr([c],u)}var pw=dw;function Jd(t,e={}){let r=0,s=0,u=0;return Dr(t,function(c){r+=c[0],s+=c[1],u++},!0),Sn([r/u,s/u],e.properties)}var tl=Jd;function mw(t,e,r={}){let s;return r.final?s=Qh(Ke(e),Ke(t)):s=Qh(Ke(t),Ke(e)),s>180?-(360-s):s}function Qh(t,e){const r=ut(t[1]),s=ut(e[1]);let u=ut(e[0]-t[0]);u>Math.PI&&(u-=2*Math.PI),u<-Math.PI&&(u+=2*Math.PI);const c=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),f=Math.atan2(u,c);return(ri(f)+360)%360}function vw(t,e,r={}){const s=Ke(t),u=Ke(e);u[0]+=u[0]-s[0]>180?-360:s[0]-u[0]>180?360:0;const c=yw(s,u);return qd(c,"meters",r.units)}function yw(t,e,r){r=r===void 0?ot:Number(r);const s=r,u=t[1]*Math.PI/180,c=e[1]*Math.PI/180,f=c-u;let h=Math.abs(e[0]-t[0])*Math.PI/180;h>Math.PI&&(h-=2*Math.PI);const d=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(u/2+Math.PI/4)),p=Math.abs(d)>1e-11?f/d:Math.cos(u);return Math.sqrt(f*f+p*p*h*h)*s}function _w(t,e,r,s={}){const u=e<0;let c=qd(Math.abs(e),s.units,"meters");u&&(c=-Math.abs(c));const f=Ke(t),h=kw(f,c,r);return h[0]+=h[0]-f[0]>180?-360:f[0]-h[0]>180?360:0,Sn(h,s.properties)}function kw(t,e,r,s){s=s===void 0?ot:Number(s);const u=e/s,c=t[0]*Math.PI/180,f=ut(t[1]),h=ut(r),d=u*Math.cos(h);let p=f+d;Math.abs(p)>Math.PI/2&&(p=p>0?Math.PI-p:-Math.PI-p);const y=Math.log(Math.tan(p/2+Math.PI/4)/Math.tan(f/2+Math.PI/4)),v=Math.abs(y)>1e-11?d/y:Math.cos(f),E=u*Math.sin(h)/v;return[((c+E)*180/Math.PI+540)%360-180,p*180/Math.PI]}function Lo(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Hd(t);case"FeatureCollection":return Ew(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Zl(t);default:throw new Error("unknown GeoJSON type")}}function Hd(t){const e={type:"Feature"};return Object.keys(t).forEach(r=>{switch(r){case"type":case"properties":case"geometry":return;default:e[r]=t[r]}}),e.properties=Vd(t.properties),t.geometry==null?e.geometry=null:e.geometry=Zl(t.geometry),e}function Vd(t){const e={};return t&&Object.keys(t).forEach(r=>{const s=t[r];typeof s=="object"?s===null?e[r]=null:Array.isArray(s)?e[r]=s.map(u=>u):e[r]=Vd(s):e[r]=s}),e}function Ew(t){const e={type:"FeatureCollection"};return Object.keys(t).forEach(r=>{switch(r){case"type":case"features":return;default:e[r]=t[r]}}),e.features=t.features.map(r=>Hd(r)),e}function Zl(t){const e={type:t.type};return t.bbox&&(e.bbox=t.bbox),t.type==="GeometryCollection"?(e.geometries=t.geometries.map(r=>Zl(r)),e):(e.coordinates=Xd(t.coordinates),e)}function Xd(t){const e=t;return typeof e[0]!="object"?e.slice():e.map(r=>Xd(r))}var xw=Lo;function $d(t,e,r){if(r=r||{},!No(r))throw new Error("options is invalid");const s=r.pivot,u=r.mutate;if(!t)throw new Error("geojson is required");if(e==null||isNaN(e))throw new Error("angle is required");if(e===0)return t;const c=s??Jd(t);return(u===!1||u===void 0)&&(t=Lo(t)),Dr(t,function(f){const h=mw(c,f)+e,d=vw(c,f),p=zt(_w(c,d,h));f[0]=p[0],f[1]=p[1]}),t}var ww=$d;function ef(t,e,r,s){s=s||{};let u=s.steps||64;const c=s.units||"kilometers";let f=s.angle||0;const h=s.pivot||t,d=s.properties||{};if(!t)throw new Error("center is required");if(!e)throw new Error("xSemiAxis is required");if(!r)throw new Error("ySemiAxis is required");if(!No(s))throw new Error("options must be an object");if(!Qa(u))throw new Error("steps must be a number");if(!Qa(f))throw new Error("angle must be a number");const p=Ke($d(Sn(Ke(t)),f,{pivot:h}));f=-90+f,u=Math.ceil(u/4);const y=[],v=[],E=e,S=r,b=S,N=(E-S)/(Math.PI/2),O=(E+S)*Math.PI/4,D=.5,L=u;let q=0,H=0;for(let z=0;z<u;z++)H+=q,N===0?q=O/L/b:q=(-(N*H+b)+Math.sqrt(Math.pow(N*H+b,2)-4*(D*N)*-(O/L)))/(2*(D*N)),H!=0&&y.push(H);v.push(0);for(let z=0;z<y.length;z++)v.push(y[z]);v.push(Math.PI/2);for(let z=0;z<y.length;z++)v.push(Math.PI-y[y.length-z-1]);v.push(Math.PI);for(let z=0;z<y.length;z++)v.push(Math.PI+y[z]);v.push(3*Math.PI/2);for(let z=0;z<y.length;z++)v.push(2*Math.PI-y[y.length-z-1]);v.push(0);const J=[];for(const z of v){const $=Math.atan2(S*Math.sin(z),E*Math.cos(z)),k=Math.sqrt(Math.pow(E,2)*Math.pow(S,2)/(Math.pow(E*Math.sin($),2)+Math.pow(S*Math.cos($),2)));J.push(zd(p,k,f+ri($),{units:c}).geometry.coordinates)}return Pr([J],d)}function Wd(t,e,r={}){if(r.final===!0)return bw(t,e);const s=Ke(t),u=Ke(e),c=ut(s[0]),f=ut(u[0]),h=ut(s[1]),d=ut(u[1]),p=Math.sin(f-c)*Math.cos(d),y=Math.cos(h)*Math.sin(d)-Math.sin(h)*Math.cos(d)*Math.cos(f-c);return ri(Math.atan2(p,y))}function bw(t,e){let r=Wd(e,t);return r=(r+180)%360,r}var eo=Wd;function Bi(t,e,r={}){var s=Ke(t),u=Ke(e),c=ut(u[1]-s[1]),f=ut(u[0]-s[0]),h=ut(s[1]),d=ut(u[1]),p=Math.pow(Math.sin(c/2),2)+Math.pow(Math.sin(f/2),2)*Math.cos(h)*Math.cos(d);return $l(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),r.units)}var Zd=Bi;function nl(t,e={}){const r=sa(t);switch(!e.properties&&t.type==="Feature"&&(e.properties=t.properties),r.type){case"Polygon":return Sw(r,e);case"MultiPolygon":return Iw(r,e);default:throw new Error("invalid poly")}}function Sw(t,e={}){const r=sa(t).coordinates,s=e.properties?e.properties:t.type==="Feature"?t.properties:{};return Kd(r,s)}function Iw(t,e={}){const r=sa(t).coordinates,s=e.properties?e.properties:t.type==="Feature"?t.properties:{},u=[];return r.forEach(c=>{u.push(Kd(c,s))}),Qe(u)}function Kd(t,e){return t.length>1?hw(t,e):Or(t[0],e)}const rl=(t,e)=>t[0]===e[0]&&t[1]===e[1],Qd=t=>t.type==="Feature"&&t.geometry.type==="LineString",Kl=t=>t.type==="Feature"&&t.geometry.type==="Polygon",Ql=t=>t.type==="Feature"&&t.geometry.type==="MultiPolygon",Ga=(t,e)=>({lng:e[0]-t[0],lat:e[1]-t[1]}),to=t=>Array.isArray(t)&&t.length>=2&&t.length<=3&&t.every(e=>typeof e=="number"),rs=(t,e,r=!1)=>{let s=0;const u=["features","geometries","geometry","coordinates"],c=(f,h,d=!1)=>{to(f)?(e({coordinate:f,path:h},s),s+=1):Array.isArray(f)?f.forEach((p,y)=>{d&&r&&y===f.length-1&&to(p)||c(p,[...h,y],d)}):typeof f=="object"&&f!==null&&Ze(f).forEach(p=>{const y=f[p];if(u.includes(p)&&y){const v="type"in f&&f.type,E=v==="Polygon"||v==="MultiPolygon";c(y,[...h,p],E)}})};c(t,[])},ep=(t,e)=>{let r={coordinate:[0,0],path:[]},s=-1;try{rs(t,(u,c)=>{if(e[0]===u.coordinate[0]&&e[1]===u.coordinate[1])throw s=c,r=u,new Error("stop")})}catch{if(r)return{index:s,coordinate:r.coordinate,path:r.path}}return null},ec=(t,e)=>{let r=0;const s=["features","geometries","geometry","coordinates"],u=(c,f,h,d)=>{to(c)&&to(f)?(e({start:{coordinate:[...c],path:h},end:{coordinate:[...f],path:d}},r),r+=1):Array.isArray(c)?c.forEach((p,y)=>{u(p,c[y+1],[...h,y],[...h,y+1])}):typeof c=="object"&&c!==null&&Ze(c).forEach(p=>{const y=c[p];s.includes(p)&&y&&u(y,void 0,[...h,p],[])})};u(t,void 0,[],[])},Co=(t,e)=>{let r={absCoordIndex:-1,featureIndex:-1,multiFeatureIndex:-1,geometryIndex:-1};try{Dr(t,(s,u,c,f,h)=>{if(s[0]===e[0]&&s[1]===e[1])throw r={absCoordIndex:u,featureIndex:c,multiFeatureIndex:f,geometryIndex:h},new Error("found")})}catch{}return r},Ai=(t,e)=>{const[r,s]=t,[u,c]=e,f=Math.min(r,u),h=Math.min(s,c),d=Math.max(r,u),p=Math.max(s,c);return[f,h,d,p]},il=(t,e)=>{const r=Ai(t,e),s=[r[0],r[1]],u=[r[2],r[3]],c=s[0],f=s[1],h=u[0],d=u[1];return{type:"Feature",properties:{shape:"rectangle"},geometry:{type:"Polygon",coordinates:[[[c,f],[h,f],[h,d],[c,d],[c,f]]]}}},no=t=>[t.geometry.coordinates[0],t.geometry.coordinates[1]],tc=t=>{const e=Yd(t);return[[e[0],e[1]],[e[2],e[3]]]},Ba=t=>{let e=0;return Dr(t,()=>{e+=1},!0),e},Mw=t=>{const e=[];return Dr(t,r=>{e.push([r[0],r[1]])},!0),e},nc=t=>{const e=Mw(t);return e.some(r=>!Qi(e[0],r))},rc=t=>{let e=null;try{rs(t,r=>{throw e=r.coordinate,new Error("found")})}catch{return e}return null},qs=(t,e)=>Math.sqrt((t[0]-e[0])**2+(t[1]-e[1])**2),tp=(t,e,r)=>{const[s,u]=[t[0],t[1]],[c,f]=[e[0],e[1]],[h,d]=[r[0],r[1]],p=c-s,y=f-u,v=h-s,E=d-u,S=v*p+E*y,b=p*p+y*y;let N=S/b;return N=Math.max(0,Math.min(1,N)),[s+N*p,u+N*y]},Nw=(t,e)=>{const{absCoordIndex:r}=Co(t,e);return r!==-1?(t.geometry.coordinates.splice(r,1),!0):!1},Lw=(t,e)=>{const r=Co(t,e);if(r.absCoordIndex!==-1){const s=[r.geometryIndex],u=Yi(t.geometry.coordinates,s),c=u.findIndex(f=>Qi(f,e));return u.length<=4?(t.geometry.coordinates.splice(r.geometryIndex,1),!0):(u.splice(c,1),c===0&&(u[u.length-1]=[...u[0]]),!0)}return!1},Cw=(t,e)=>{const r=Co(t,e);if(r.absCoordIndex!==-1){const s=[r.multiFeatureIndex,r.geometryIndex],u=Yi(t.geometry.coordinates,s),c=u.findIndex(f=>Qi(f,e));if(u.length<=4){s.pop();const f=Yi(t.geometry.coordinates,r.multiFeatureIndex);return f.splice(r.geometryIndex,1),f.length===0&&t.geometry.coordinates.splice(r.multiFeatureIndex,1),!0}return u.splice(c,1),c===0&&(u[u.length-1]=[...u[0]]),!0}return!1},Aw=(t,e)=>Qd(t)?Nw(t,e):Kl(t)?Lw(t,e):Ql(t)?Cw(t,e):!1,np=(t,e="marker")=>({type:"Feature",properties:{shape:e},geometry:{type:"Point",coordinates:t}}),ic=({center:t,radius:e,steps:r=80})=>{const s=pw(t,e,{steps:r,units:"meters"});return s.geometry.coordinates[0][0]=[...s.geometry.coordinates[0][0]],s},tf=({center:t,xSemiAxisLngLat:e,rimLngLat:r})=>{let s=Bi(t,e,{units:"meters"});s===0&&(s=1);const u=eo(t,e)-90;let c=0;if(r){const f=-u*Math.PI/180,h=-(eo(t,r)-90)*Math.PI/180,d=Bi(t,r,{units:"meters"}),p=d*Math.cos(h),y=d*Math.sin(h),v=p*Math.cos(f)+y*Math.sin(f),E=p*-Math.sin(f)+y*Math.cos(f),S=v*v/(s*s);c=Math.abs(E)/Math.sqrt(1-S),isNaN(c)&&(c=0)}return{xSemiAxis:s,ySemiAxis:c,angle:u}},rp=80,Ao=({center:t,xSemiAxis:e,ySemiAxis:r,angle:s,properties:u={}})=>{const c={steps:rp,angle:s,units:"meters"};if(r===void 0||r===0){const h=ef(t,e,1,c);return Or(h.geometry.coordinates[0].slice(0,41),{shape:"line"})}const f=ef(t,e,r,{...c,properties:{...u,[`${it}shape`]:"ellipse",[`${it}center`]:t,[`${it}xSemiAxis`]:e,[`${it}ySemiAxis`]:r,[`${it}angle`]:s}});return f.geometry.coordinates[0][0]=[...f.geometry.coordinates[0][0]],f},Tw=["circle","ellipse","rectangle"];class Ui{gm;id="no-id";parent=null;markers;source;_geoJson=null;constructor(e){this.gm=e.gm,this.id=e.id,this.source=e.source,this.parent=e.parent,this.markers=new Map;const r={...e.geoJsonShapeFeature,properties:{...this.parseExtraProperties(e.geoJsonShapeFeature),...this.parseGmShapeProperties(e.geoJsonShapeFeature)}};if(e.skipSourceUpdate){if(this._geoJson={...r,id:this.id},this.shape==="circle"){const s=no(tl(this._geoJson));this._geoJson.properties[`${it}center`]=s}}else this.addGeoJson(r)}get shape(){const e=this.getShapeProperty("shape");if(typeof e=="string"&&ur(e,Gd))return e;throw new Error(`Wrong shape type: "${e}"`)}set shape(e){this.setShapeProperty("shape",e)}get temporary(){return this.source.id===Q.temporary}get sourceName(){return this.source.id}getShapeProperty(e,r){const s=r?.properties||this._geoJson?.properties||{},u=du[e],c=s[`${it}${e}`]??s[e];if(u&&u(c))return c}setShapeProperty(e,r){if(!this._geoJson){te.error("FeatureData.setShapeProperty(): geojson is not set");return}this._geoJson.properties[`${it}${e}`]=r,this._updateAllProperties(this._geoJson.properties)}deleteShapeProperty(e){if(!this._geoJson){te.error("FeatureData.deleteShapeProperty(): geojson is not set");return}delete this._geoJson.properties[`${it}${e}`],this._updateAllProperties(this._geoJson.properties)}parseGmShapeProperties(e){const r=this.getShapeProperty("shape",e)||this.gm.features.getFeatureShapeByGeoJson(e);r||te.error(`FeatureData.importGmShapeProperties(): unknown shape: ${r}`);const s={...Object.fromEntries(Ze(du).map(u=>[u,this.getShapeProperty(u,e)])),id:this.id,shape:r||void 0};return Object.fromEntries(Ze(s).filter(u=>s[u]!==void 0).map(u=>[`${it}${u}`,s[u]]))}parseExtraProperties(e){const r=Ht(e.properties)||{};return Ze(du).forEach(s=>{delete r[s],delete r[`${it}${s}`]}),r}getGeoJson(){if(this._geoJson)return this._geoJson;throw new Error(`Missing GeoJSON for feature: "${this.shape}:${this.id}"`)}addGeoJson(e){if(this._geoJson={...e,id:this.id},this.shape==="circle"){const r=no(tl(this._geoJson));this._geoJson.properties[`${it}center`]=r}this.gm.features.updateManager.updateSource({diff:{add:[this._geoJson]},sourceName:this.sourceName})}removeGeoJson(){if(!this._geoJson)throw new Error(`Feature not found: "${this.id}"`);this.gm.features.updateManager.updateSource({diff:{remove:[this.id]},sourceName:this.sourceName})}removeMarkers(){this.markers.forEach(e=>{e.instance instanceof Mo?e.instance.remove():this.gm.features.delete(e.instance)}),this.markers=new Map}updateGeometry(e){const r=this.getGeoJson();if(!r)throw new Error(`Feature not found: "${this.id}"`);this._geoJson={...r,geometry:e};const s={update:[this._geoJson]};this.gm.features.updateManager.updateSource({diff:s,sourceName:this.sourceName})}updateGeoJsonGeometry(e){this.updateGeometry(e)}updateProperties(e){if(!this._geoJson)throw new Error(`Feature not found: "${this.id}"`);const r=this.parseGmShapeProperties(this._geoJson),s=new Set(Object.keys(r)),u={};for(const[h,d]of Object.entries(this._geoJson.properties))h in e||(u[h]=d);for(const[h,d]of Object.entries(e))s.has(h)||d!==void 0&&(u[h]=d);Object.assign(u,r),this._geoJson.properties=u;const c={...u};for(const[h,d]of Object.entries(e))s.has(h)||d===void 0&&(c[h]=void 0);const f={update:[{...this._geoJson,properties:c}]};this.gm.features.updateManager.updateSource({diff:f,sourceName:this.sourceName})}setProperties(e){if(!this._geoJson)throw new Error(`Feature not found: "${this.id}"`);const r=this.parseGmShapeProperties(this._geoJson),s={};for(const[c,f]of Object.entries(e))f!==void 0&&!(c in r)&&(s[c]=f);this._geoJson.properties={...s,...r};const u={update:[this._geoJson]};this.gm.features.updateManager.updateSource({diff:u,sourceName:this.sourceName})}_updateAllProperties(e){if(!this._geoJson)throw new Error(`Feature not found: "${this.id}"`);this._geoJson.properties={...this._geoJson.properties,...e};const r={update:[this._geoJson]};this.gm.features.updateManager.updateSource({diff:r,sourceName:this.sourceName})}updateGeoJsonProperties(e){this._updateAllProperties(e)}setGeoJsonCustomProperties(e){this.setProperties(e||{})}updateGeoJsonCustomProperties(e){this.updateProperties(e||{})}deleteGeoJsonCustomProperties(e){const r={};for(const s of e)r[s]=void 0;this.updateProperties(r)}convertToPolygon(){return this.isConvertableToPolygon()?(this.shape="polygon",this.deleteShapeProperty("center"),this.deleteShapeProperty("angle"),this.deleteShapeProperty("xSemiAxis"),this.deleteShapeProperty("ySemiAxis"),!0):!1}isConvertableToPolygon(){return Tw.includes(this.shape)}changeSource({sourceName:e,atomic:r}){if(this.source.id===e){te.error(`FeatureData.changeSource: feature "${this.id}" already has the source "${e}"`);return}const s=this.gm.features.sources[e];if(!s){te.error(`FeatureData.changeSource: missing source "${e}"`);return}const u=this.getGeoJson();if(!u){te.error("FeatureData.changeSource: missing shape GeoJSON");return}this.removeGeoJson(),this.source=s,this.addGeoJson(u),this.markers.forEach(c=>{c.instance instanceof Ui&&c.instance.changeSource({sourceName:e,atomic:r})})}fireFeatureUpdatedEvent({mode:e}){const r={name:`${ae}:edit:feature_updated`,level:"system",actionType:"edit",action:"feature_updated",mode:e,sourceFeatures:[this],targetFeatures:[this],markerData:null};this.gm.events.fire(`${ae}:edit`,r)}delete(){this.removeGeoJson(),this.removeMarkers()}}const To=t=>Xn(t)&&t.actionType==="helper",Pw=t=>Xn(t)&&t.name===`${ae}:helper:geofencing_violation`;class Po{gm;options={};settings={};actions={};flags={featureCreateAllowed:!0,featureUpdateAllowed:!0,actionInProgress:!1};internalEventHandlers={[`${ae}:helper`]:this.handleHelperEvent.bind(this)};constructor(e){this.gm=e}get snappingHelper(){return this.gm.actionInstances.helper__snapping||null}startAction(){this.gm.events.bus.attachEvents(this.internalEventHandlers),this.gm.events.bus.attachEvents(this.eventHandlers),this.onStartAction()}endAction(){this.onEndAction(),this.gm.events.bus.detachEvents(this.eventHandlers),this.gm.events.bus.detachEvents(this.internalEventHandlers)}getOptionValue(e){const r=this.options[e];if(!r)throw new Error(`Option ${e} not found`);if(["toggle","hidden"].includes(r.type))return r.value;if(r.type==="select")return r.value.value;throw new Error(`Unknown option type: ${JSON.stringify(r)}`)}getSettingValue(e){if(e in this.settings)return this.settings[e]}applyOptionValue(e,r){const s=this.options[e];if(!s){te.error("Option not found",e,r);return}if(s.type==="toggle"&&typeof r=="boolean")s.value=r;else if(s.type==="select"){const u=s.choices.find(c=>c.value===r);u&&(s.value=u)}else s.type==="hidden"?s.value=r:te.error("Can't apply option value",e,r,s)}handleHelperEvent(e){return Pw(e)?this.handleGeofencingViolationEvent(e):{next:!0}}handleGeofencingViolationEvent(e){return e.actionType==="draw"?this.flags.featureCreateAllowed=!1:e.actionType==="edit"&&(this.flags.featureUpdateAllowed=!1),{next:!0}}}const Oo=t=>Xn(t)&&t.actionType==="draw",ip=t=>Xn(t)&&(t.name===`${ae}:draw:shape`||t.name===`${ae}:draw:shape_with_data`),sc=t=>ip(t)&&t.variant==="line_drawer";class Kn extends Po{actionType="draw";shape=null;featureData=null;saveFeature(){if(this.featureData){const e=this.featureData.getGeoJson();this.removeTmpFeature(),this.gm.features.createFeature({sourceName:Q.main,shapeGeoJson:e})}else te.error("BaseDraw.saveFeature: no featureData to save")}removeTmpFeature(){this.featureData&&(this.featureData.temporary||te.error("Not a temporary feature to remove",this.featureData),this.gm.features.delete(this.featureData),this.featureData=null)}fireBeforeFeatureCreate({geoJsonFeatures:e,forceMode:r=void 0}){this.flags.featureCreateAllowed=!0;const s={name:`${ae}:feature:before_create`,level:"system",actionType:"draw",mode:r||this.mode,action:"before_create",geoJsonFeatures:e};this.gm.events.fire(`${ae}:${this.actionType}`,s)}fireMarkerPointerStartEvent(){if(!this.gm.markerPointer.marker||!this.shape)return;const e=this.gm.markerPointer.marker,r={name:`${ae}:draw:shape_with_data`,level:"system",variant:null,actionType:"draw",mode:this.shape,action:"start",markerData:{type:"dom",instance:e,position:{coordinate:e.getLngLat(),path:[-1]}},featureData:this.featureData};this.gm.events.fire(`${ae}:draw`,r)}fireMarkerPointerUpdateEvent(){if(!this.gm.markerPointer.marker||!this.shape)return;const e=this.gm.markerPointer.marker,r={name:`${ae}:draw:shape_with_data`,level:"system",variant:null,actionType:"draw",mode:this.shape,action:"update",markerData:{type:"dom",instance:e,position:{coordinate:e.getLngLat(),path:[-1]}},featureData:this.featureData};this.gm.events.fire(`${ae}:draw`,r)}fireMarkerPointerFinishEvent(){if(!this.shape)return;const e={name:`${ae}:draw:shape`,level:"system",variant:null,actionType:"draw",mode:this.shape,action:"finish"};this.gm.events.fire(`${ae}:draw`,e)}forwardLineDrawerEvent(e){if(!sc(e)||!this.shape)return{next:!0};if(e.action==="start"||e.action==="update"){const r={name:`${ae}:draw:shape_with_data`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:e.action,featureData:e.featureData,markerData:e.markerData};this.gm.events.fire(`${ae}:draw`,r)}else if(e.action==="finish"||e.action==="cancel"){const r={name:`${ae}:draw:shape`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:e.action};this.gm.events.fire(`${ae}:draw`,r)}return{next:!0}}fireStartEvent(e,r=null){if(!this.shape)return;const s={name:`${ae}:draw:shape_with_data`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:"start",featureData:e,markerData:r};this.gm.events.fire(`${ae}:draw`,s)}fireUpdateEvent(e,r=null){if(!this.shape)return;const s={name:`${ae}:draw:shape_with_data`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:"update",featureData:e,markerData:r};this.gm.events.fire(`${ae}:draw`,s)}fireFinishEvent(){if(!this.shape)return;const e={name:`${ae}:draw:shape`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:"finish"};this.gm.events.fire(`${ae}:draw`,e)}}class ac extends Kn{mode="circle";shape="circle";eventHandlers={mousemove:this.onMouseMove.bind(this),click:this.onMouseClick.bind(this)};circleCenterPoint=null;circleCenterLngLat=null;onStartAction(){this.gm.markerPointer.enable()}onEndAction(){this.removeTmpFeature(),this.gm.markerPointer.disable(),this.fireFinishEvent()}getFeatureGeoJson(e){return{type:"Feature",properties:{shape:this.shape},geometry:{type:"Point",coordinates:e}}}getControlMarkerData(){const e=this.gm.markerPointer.marker;return e?{type:"dom",instance:e,position:{coordinate:e.getLngLat(),path:[-1]}}:null}createFeature(){const e=this.gm.features.createFeature({shapeGeoJson:this.getFeatureGeoJson(this.circleCenterLngLat||[0,0]),sourceName:Q.temporary});return e&&this.circleCenterLngLat&&e.setShapeProperty("center",this.circleCenterLngLat),e}createMarker(){const e=document.createElement("div");e.innerHTML=Zf;const r=e.firstChild;return r.style.color="#278cda",r.style.width="28px",r.style.height="28px",r.style.pointerEvents="none",this.gm.mapAdapter.createDomMarker({draggable:!1,anchor:"center",element:r},[0,0])}}class Ow extends ac{mode="circle_marker";shape="circle_marker";onStartAction(){this.gm.markerPointer.enable({customMarker:this.createMarker()})}onEndAction(){this.fireMarkerPointerFinishEvent(),super.onEndAction()}onMouseMove(){return this.fireMarkerPointerUpdateEvent(),{next:!0}}onMouseClick(e){const r=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();return this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getFeatureGeoJson(r)]}),this.flags.featureCreateAllowed&&(this.featureData=this.createFeature(),this.circleCenterLngLat=r,this.circleCenterPoint=this.gm.mapAdapter.project(this.circleCenterLngLat),this.updateFeaturePosition(this.circleCenterLngLat),this.saveFeature()),{next:!1}}updateFeaturePosition(e){if(!this.featureData)return;const r=this.getFeatureGeoJson(e);this.featureData.updateGeoJsonGeometry(r.geometry)}}const Rw=()=>window.PointerEvent&&"maxTouchPoints"in navigator?navigator.maxTouchPoints>0?!window.matchMedia("(hover: hover)").matches:!1:matchMedia("(hover: none)").matches||"ontouchstart"in window?!0:"msMaxTouchPoints"in navigator&&typeof navigator.msMaxTouchPoints=="number"&&navigator.msMaxTouchPoints>0,Fr=(t,e,r=10)=>{const s={...t};return Ze(t).forEach(u=>{const c=t[u];typeof c=="function"?s[u]=Cg(c.bind(e),r,{leading:!0,trailing:!1}):te.error("convertToThrottled: item is not a function",t[u])}),s},Dw=(t,e,r=10)=>{const s={...t};return Ze(t).forEach(u=>{const c=t[u];typeof c=="function"?s[u]=Ng(c.bind(e),r,{leading:!1,trailing:!0}):te.error("convertToDebounced: item is not a function",t[u])}),s},nf=async(t,e)=>{const r="Promise race timeout";await Promise.race([t,new Promise((s,u)=>{setTimeout(()=>u(new Error(`Timeout ${Xc/1e3} seconds: ${e||r}`)),Xc)})])},Fw=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","touchstart","touchend","touchmove","touchcancel"],sp=t=>!!(t&&typeof t=="object"&&"once"in t&&typeof t.once=="function"),We=(t,e={warning:!1})=>{if(!t)return e.warning&&te.warn("Empty event",t),!1;const r=typeof t=="object"&&"lngLat"in t&&"point"in t&&"type"in t&&"originalEvent"in t&&typeof t.type=="string"&&Fw.includes(t.type);return!r&&e.warning&&te.warn("Not a pointer event",t),r},Gw=t=>t.originalEvent.ctrlKey||t.originalEvent.shiftKey||t.originalEvent.altKey||t.originalEvent.metaKey,Bw=t=>{const e=["symbol","fill","line","circle"];return!!t&&typeof t=="object"&&"type"in t&&e.includes(t.type)};class Uw extends ac{mode="circle";shape="circle";throttledMethods=Fr({updateFeatureGeoJson:this.updateFeatureGeoJson},this,this.gm.options.settings.throttlingDelay);onMouseClick(e){if(!We(e))return{next:!0};const r=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();if(this.circleCenterPoint&&this.circleCenterLngLat)this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getCircleGeoJson(this.circleCenterLngLat,r)]}),this.flags.featureCreateAllowed&&(this.saveCircleFeature(r),this.circleCenterLngLat=null,this.circleCenterPoint=null,this.fireFinishEvent());else if(this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getFeatureGeoJson(r)]}),this.flags.featureCreateAllowed){this.circleCenterLngLat=r,this.circleCenterPoint=this.gm.mapAdapter.project(this.circleCenterLngLat),this.featureData=this.createFeature();const s=this.getControlMarkerData();this.featureData&&s&&this.fireStartEvent(this.featureData,s)}return{next:!1}}onMouseMove(){if(this.circleCenterLngLat&&this.gm.markerPointer.marker){const e=this.gm.markerPointer.marker.getLngLat();this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getCircleGeoJson(this.circleCenterLngLat,e)]}),this.flags.featureCreateAllowed&&this.throttledMethods.updateFeatureGeoJson(e)}return this.circleCenterPoint||this.fireMarkerPointerUpdateEvent(),{next:!1}}updateFeatureGeoJson(e){if(this.featureData&&this.circleCenterLngLat){const r=this.getCircleGeoJson(this.circleCenterLngLat,e);this.featureData.updateGeoJsonGeometry(r.geometry);const s=this.getControlMarkerData();s&&this.fireUpdateEvent(this.featureData,s)}}saveCircleFeature(e){if(this.circleCenterLngLat&&this.featureData){const r=this.gm.markerPointer.marker?.getLngLat()||e;this.updateFeatureGeoJson(r),this.featureData.setShapeProperty("center",this.circleCenterLngLat),this.isFeatureGeoJsonValid()?this.saveFeature():this.removeTmpFeature()}}isFeatureGeoJsonValid(){return this.featureData?nc(this.featureData.getGeoJson()):!1}getCircleGeoJson(e,r){const s=this.gm.mapAdapter.getDistance(e,r);return{...ic({center:e,radius:s}),properties:{shape:this.shape}}}}class mr extends Po{actionType="helper"}const ap=t=>!!t&&typeof t=="object"&&t instanceof mr&&"removeSnapGuides"in t&&"updateSnapGuides"in t&&t.mode==="snap_guides"&&typeof t.removeSnapGuides=="function"&&typeof t.updateSnapGuides=="function",jw=t=>!!t&&typeof t=="object"&&t instanceof mr&&"getShortestPath"in t&&t.mode==="auto_trace"&&typeof t.getShortestPath=="function",qw=t=>!!t&&typeof t=="object"&&t instanceof mr&&"getSharedMarkers"in t&&t.mode==="pin"&&typeof t.getSharedMarkers=="function";function Yw(t,e={}){var r,s,u,c=e.properties,f=(r=e.autoComplete)!=null?r:!0,h=(s=e.orderCoords)!=null?s:!0,d=(u=e.mutate)!=null?u:!1;if(d||(t=Lo(t)),t.type==="FeatureCollection"){var p=[];return t.features.forEach(function(y){p.push(zt(rf(y,{},f,h)))}),jd(p,c)}else return rf(t,c,f,h)}function rf(t,e,r,s){e=e||(t.type==="Feature"?t.properties:{});var u=sa(t),c=u.coordinates,f=u.type;if(!c.length)throw new Error("line must contain coordinates");switch(f){case"LineString":return r&&(c=sf(c)),Pr([c],e);case"MultiLineString":var h=[],d=0;return c.forEach(function(p){if(r&&(p=sf(p)),s){var y=zw(ar(Or(p)));y>d?(h.unshift(p),d=y):h.push(p)}else h.push(p)}),Pr(h,e);default:throw new Error("geometry type "+f+" is not supported")}}function sf(t){var e=t[0],r=e[0],s=e[1],u=t[t.length-1],c=u[0],f=u[1];return(r!==c||s!==f)&&t.push(e),t}function zw(t){var e=t[0],r=t[1],s=t[2],u=t[3];return Math.abs(e-s)*Math.abs(r-u)}var oc=Yw;class Ro extends Kn{mode="line";snappingKey="line_drawer";drawOptions;shapeLngLats=[];throttledMethods=Fr({onMouseMove:this.onMouseMove},this,this.gm.options.settings.throttlingDelay);eventHandlers={[`${ae}:helper`]:this.handleGmHelperEvent.bind(this),click:this.onMouseClick.bind(this),mousemove:this.throttledMethods.onMouseMove.bind(this)};drawerEventHandlers={firstMarkerClick:null,lastMarkerClick:null,nMarkerClick:null};constructor(e,r={snappingMarkers:"none",targetShape:"line"}){super(e),this.drawOptions=r}get snapGuidesInstance(){const e=this.gm.actionInstances.helper__snap_guides;return ap(e)?e:null}get autoTraceEnabled(){return this.gm.options.controls.helper.auto_trace?.active||!1}get autoTraceHelperInstance(){return this.autoTraceEnabled&&Object.values(this.gm.actionInstances).find(jw)||null}onStartAction(){this.gm.markerPointer.enable()}onEndAction(){this.gm.markerPointer.disable(),this.endShape(),this.snapGuidesInstance?.removeSnapGuides(),this.clearDrawerHandlers()}clearDrawerHandlers(){this.drawerEventHandlers.firstMarkerClick=null,this.drawerEventHandlers.lastMarkerClick=null,this.drawerEventHandlers.nMarkerClick=null}handleGmHelperEvent(e){return To(e)?(e.mode==="snap_guides"&&e.action==="mode_start"&&this.updateSnapGuides(),{next:!0}):(te.error("LineDrawer.handleGmHelperEvent: invalid event",e),{next:!0})}updateSnapGuides(){if(this.snapGuidesInstance){const e=this.featureData?.getGeoJson();e&&e.geometry.coordinates.pop(),this.snapGuidesInstance.updateSnapGuides(e||null,this.shapeLngLats.at(-1)||null,!0)}}on(e,r){this.drawerEventHandlers[e]=r}onMouseClick(e){if(!We(e,{warning:!0}))return{next:!0};const r=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();if(this.featureData){const s=this.getClickedMarkerInfo(e);this.handleNextVertex(r,s)}else this.isFeatureAllowed(np(r))&&this.startShape(r);return this.updateSnapGuides(),{next:!0}}handleNextVertex(e,r){if(!this.featureData){te.error("LineDrawer.handleNextVertex: no featureData");return}const s=this.featureData.markers.size,u=this.getMarkerClickEventData(r.index);r.index<s-1&&this.addPoint(e,r),r.index!==-1&&(r.index===0?this.drawerEventHandlers.firstMarkerClick?.(u):r.index>0&&r.index===s-1&&this.drawerEventHandlers.lastMarkerClick?.(u),r.index>=0&&this.drawerEventHandlers.nMarkerClick?.(u))}getMarkerClickEventData(e){const r=this.getFeatureGeoJson({withControlMarker:!1});return{markerIndex:e,shapeCoordinates:this.getShapeCoordinates({withControlMarker:!1}),geoJson:r,bounds:tc(r)}}onMouseMove(e){return We(e,{warning:!0})?(this.featureData&&this.shapeLngLats.length&&this.updateFeatureSource(),{next:!0}):{next:!0}}startShape(e){this.shapeLngLats=[e],this.featureData=this.gm.features.createFeature({shapeGeoJson:this.getFeatureGeoJson({withControlMarker:!0}),sourceName:Q.temporary});const r={type:"dom",instance:this.createMarker(e),position:{coordinate:e,path:["geometry","coordinates",0]}};this.featureData&&(this.featureData.markers.set(r.position.path.join("."),r),this.setSnapping(),this.fireStartEvent(this.featureData,r)),this.gm.mapAdapter.disableMapInteractions(["doubleClickZoom"])}endShape(){const e=this.getFeatureGeoJson({withControlMarker:!1});this.removeSnapping(),this.removeTmpFeature(),this.shapeLngLats=[],this.gm.mapAdapter.enableMapInteractions(["doubleClickZoom"]),this.fireStopEvent(e)}setSnapping(){if(!this.snappingHelper)return;const e=this.drawOptions.snappingMarkers;e==="none"?this.snappingHelper.setCustomSnappingCoordinates(this.snappingKey,[]):e==="all"&&this.shapeLngLats.length?this.snappingHelper.setCustomSnappingCoordinates(this.snappingKey,this.shapeLngLats):e==="first"&&this.shapeLngLats.length?this.snappingHelper.setCustomSnappingCoordinates(this.snappingKey,[this.shapeLngLats[0]]):e==="last"&&this.shapeLngLats.length?this.snappingHelper.setCustomSnappingCoordinates(this.snappingKey,[this.shapeLngLats[this.shapeLngLats.length-1]]):te.error("LineDrawer.setSnapping: invalid data",e,this.shapeLngLats)}removeSnapping(){this.snappingHelper&&this.snappingHelper.clearCustomSnappingCoordinates(this.snappingKey)}getClickedMarkerInfo(e){if(!this.featureData)return{index:-1,path:null};let r=0,s=null;try{this.featureData.markers.forEach((u,c)=>{if(u.instance instanceof Mo){const f=u.instance.getElement()||null,h=e.originalEvent.target,d=h instanceof Element?h:null;if(f&&f.contains(d))throw s=c,new Error("stop")}r+=1})}catch{if(s)return{index:r,path:s}}return{index:-1,path:null}}addPoint(e,r){const s=this.featureData;if(!s){te.error("LineDrawer.addPoint: no featureData");return}const u=this.getAddedLngLats(e,r),c=this.getFeatureGeoJsonWithType({withControlMarker:!0,coordinates:this.shapeLngLats.concat(u)});this.isFeatureAllowed(c)&&(u.forEach(f=>{this.shapeLngLats.push(f);const h=this.addMarker(f,s);this.fireUpdateEvent(s,h)}),this.updateFeatureSource())}isFeatureAllowed(e){return this.gm.getActiveDrawModes().length?(this.fireBeforeFeatureCreate({geoJsonFeatures:[e]}),this.flags.featureCreateAllowed):!0}getAddedLngLats(e,r){if(!this.featureData)return te.error("LineDrawer.getCurrentLngLats: no featureData"),[];const s=this.getMarkerInfoLngLat(r)||e;return[...this.getAutoTracePath(s)?.slice(1,-1)||[],s]}getAutoTracePath(e){const r=this.shapeLngLats.at(-1);return this.autoTraceEnabled&&this.autoTraceHelperInstance&&r&&this.autoTraceHelperInstance.getShortestPath(r,e)||null}getMarkerInfoLngLat(e){if(this.featureData&&e.path){const r=this.featureData.markers.get(e.path);if(r&&r.type==="dom")return r.instance.getLngLat();te.error("LineDrawer.addPoint: no markerData",e)}return null}addMarker(e,r){const s={type:"dom",instance:this.createMarker(e),position:{coordinate:e,path:["geometry","coordinates",this.shapeLngLats.length]}};return r.markers.set(s.position.path.join("."),{type:"dom",instance:s.instance,position:{coordinate:e,path:[]}}),s}createMarker(e){return this.gm.mapAdapter.createDomMarker({element:this.gm.createSvgMarkerElement("control",{pointerEvents:"auto",cursor:"pointer"}),anchor:"center"},e)}updateFeatureSource(){if(this.featureData&&(this.featureData.updateGeoJsonGeometry(this.getFeatureGeoJson({withControlMarker:!0}).geometry),this.gm.markerPointer.marker)){const e={type:"dom",instance:this.gm.markerPointer.marker,position:{coordinate:this.gm.markerPointer.marker.getLngLat(),path:["geometry","coordinates",this.shapeLngLats.length]}};this.fireUpdateEvent(this.featureData,e)}}getFeatureGeoJson({withControlMarker:e,coordinates:r=void 0}){return{type:"Feature",properties:{shape:"line"},geometry:{type:"LineString",coordinates:r||this.getShapeCoordinates({withControlMarker:e})}}}getFeatureGeoJsonWithType({withControlMarker:e,coordinates:r=void 0}){const s=this.getFeatureGeoJson({withControlMarker:e,coordinates:r});return this.drawOptions.targetShape==="polygon"&&s.geometry.coordinates.length>3?oc(s,{properties:s.properties}):s}getShapeCoordinates({withControlMarker:e}){const r=[...this.shapeLngLats];return e&&this.gm.markerPointer.marker&&r.push(this.gm.markerPointer.marker.getLngLat()),r}fireStartEvent(e,r){const s={name:`${ae}:draw:shape_with_data`,level:"system",actionType:"draw",mode:"line",variant:"line_drawer",action:"start",featureData:e,markerData:r};this.gm.events.fire(`${ae}:draw`,s)}fireUpdateEvent(e,r){const s={name:`${ae}:draw:shape_with_data`,level:"system",actionType:"draw",mode:"line",variant:"line_drawer",action:"update",featureData:e,markerData:r};this.gm.events.fire(`${ae}:draw`,s)}fireStopEvent(e){const r={name:`${ae}:draw:shape_with_data`,level:"system",actionType:"draw",mode:"line",action:"finish",variant:"line_drawer",geoJsonFeature:e,markerData:null,featureData:null};this.gm.events.fire(`${ae}:draw`,r)}}class Jw extends Kn{mode="line";shape="line";lineDrawer=new Ro(this.gm,{snappingMarkers:"first",targetShape:"line"});eventHandlers={[`${ae}:draw`]:this.forwardLineDrawerEvent.bind(this),mousemove:this.onMouseMove.bind(this)};onStartAction(){this.lineDrawer.startAction(),this.lineDrawer.on("nMarkerClick",this.lineFinished.bind(this))}onEndAction(){this.lineDrawer.endAction()}onMouseMove(e){return We(e)?(this.lineDrawer.featureData||this.fireMarkerPointerUpdateEvent(),{next:!0}):{next:!0}}lineFinished(e){this.lineDrawer.endShape();let r=e.shapeCoordinates;return e.markerIndex>0&&(r=r.slice(0,e.markerIndex+1)),r.length<2?null:this.gm.features.createFeature({shapeGeoJson:this.getFeatureGeoJson(r),sourceName:Q.main})}getFeatureGeoJson(e){return{type:"Feature",properties:{shape:this.shape},geometry:{type:"LineString",coordinates:e}}}}class Hw extends Kn{mode="marker";shape="marker";eventHandlers={click:this.onMouseClick.bind(this),mousemove:this.onMouseMove.bind(this)};onStartAction(){const e=this.createMarker();this.gm.markerPointer.enable({customMarker:e}),this.fireMarkerPointerStartEvent()}onEndAction(){this.gm.markerPointer.disable(),this.fireMarkerPointerFinishEvent()}onMouseClick(e){return We(e)&&(this.featureData=this.createFeature(e),this.featureData&&this.saveFeature()),{next:!1}}onMouseMove(e){return!We(e)||!this.gm.markerPointer.marker?{next:!0}:(this.fireMarkerPointerUpdateEvent(),{next:!0})}createFeature(e){const r=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray(),s=this.getFeatureGeoJson(r);return s&&(this.fireBeforeFeatureCreate({geoJsonFeatures:[s]}),this.flags.featureCreateAllowed)?this.gm.features.createFeature({shapeGeoJson:s,sourceName:Q.temporary}):null}getFeatureGeoJson(e){return{type:"Feature",properties:{shape:this.shape},geometry:{type:"Point",coordinates:e}}}createMarker(e=Q.temporary){const r=this.gm.options.layerStyles.marker[e]?.find(d=>d.type==="symbol"),s=r?.paint&&"icon-opacity"in r.paint?r.paint["icon-opacity"]:void 0,u=r?.layout&&"icon-size"in r.layout?r.layout["icon-size"]:void 0,c=36,f=`${u!==void 0?Math.round(c*(u/.18)):c}px`,h=this.gm.createSvgMarkerElement("default",{width:f,height:f,pointerEvents:"none",...s!==void 0&&{opacity:String(s)}});return this.gm.mapAdapter.createDomMarker({draggable:!1,anchor:"bottom",element:h},[0,0])}}function Vw(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return $n(t,r=>{var s;switch((s=r.geometry)==null?void 0:s.type){case"Point":e.MultiPoint.coordinates.push(r.geometry.coordinates),e.MultiPoint.properties.push(r.properties);break;case"MultiPoint":e.MultiPoint.coordinates.push(...r.geometry.coordinates),e.MultiPoint.properties.push(r.properties);break;case"LineString":e.MultiLineString.coordinates.push(r.geometry.coordinates),e.MultiLineString.properties.push(r.properties);break;case"MultiLineString":e.MultiLineString.coordinates.push(...r.geometry.coordinates),e.MultiLineString.properties.push(r.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(r.geometry.coordinates),e.MultiPolygon.properties.push(r.properties);break;case"MultiPolygon":e.MultiPolygon.coordinates.push(...r.geometry.coordinates),e.MultiPolygon.properties.push(r.properties);break}}),Qe(Object.keys(e).filter(function(r){return e[r].coordinates.length}).sort().map(function(r){var s={type:r,coordinates:e[r].coordinates},u={collectedProperties:e[r].properties};return ln(s,u)}))}var Xw=Vw;function $w(t,e,r,s,u){op(t,e,r||0,s||t.length-1,u||Ww)}function op(t,e,r,s,u){for(;s>r;){if(s-r>600){var c=s-r+1,f=e-r+1,h=Math.log(c),d=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*d*(c-d)/c)*(f-c/2<0?-1:1),y=Math.max(r,Math.floor(e-f*d/c+p)),v=Math.min(s,Math.floor(e+(c-f)*d/c+p));op(t,e,y,v,u)}var E=t[e],S=r,b=s;for(Es(t,r,e),u(t[s],E)>0&&Es(t,r,s);S<b;){for(Es(t,S,b),S++,b--;u(t[S],E)<0;)S++;for(;u(t[b],E)>0;)b--}u(t[r],E)===0?Es(t,r,b):(b++,Es(t,b,s)),b<=e&&(r=b+1),e<=b&&(s=b-1)}}function Es(t,e,r){var s=t[e];t[e]=t[r],t[r]=s}function Ww(t,e){return t<e?-1:t>e?1:0}let uc=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const r=[];if(!ba(t,e))return r;const s=this.toBBox,u=[];for(;e;){for(let c=0;c<e.children.length;c++){const f=e.children[c],h=e.leaf?s(f):f;ba(t,h)&&(e.leaf?r.push(f):mu(t,h)?this._all(f,r):u.push(f))}e=u.pop()}return r}collides(t){let e=this.data;if(!ba(t,e))return!1;const r=[];for(;e;){for(let s=0;s<e.children.length;s++){const u=e.children[s],c=e.leaf?this.toBBox(u):u;if(ba(t,c)){if(e.leaf||mu(t,c))return!0;r.push(u)}}e=r.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let r=0;r<t.length;r++)this.insert(t[r]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const r=this.data;this.data=e,e=r}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Ti([]),this}remove(t,e){if(!t)return this;let r=this.data;const s=this.toBBox(t),u=[],c=[];let f,h,d;for(;r||u.length;){if(r||(r=u.pop(),h=u[u.length-1],f=c.pop(),d=!0),r.leaf){const p=Zw(t,r.children,e);if(p!==-1)return r.children.splice(p,1),u.push(r),this._condense(u),this}!d&&!r.leaf&&mu(r,s)?(u.push(r),c.push(f),f=0,h=r,r=r.children[0]):h?(f++,r=h.children[f],d=!1):r=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const r=[];for(;t;)t.leaf?e.push(...t.children):r.push(...t.children),t=r.pop();return e}_build(t,e,r,s){const u=r-e+1;let c=this._maxEntries,f;if(u<=c)return f=Ti(t.slice(e,r+1)),Li(f,this.toBBox),f;s||(s=Math.ceil(Math.log(u)/Math.log(c)),c=Math.ceil(u/Math.pow(c,s-1))),f=Ti([]),f.leaf=!1,f.height=s;const h=Math.ceil(u/c),d=h*Math.ceil(Math.sqrt(c));af(t,e,r,d,this.compareMinX);for(let p=e;p<=r;p+=d){const y=Math.min(p+d-1,r);af(t,p,y,h,this.compareMinY);for(let v=p;v<=y;v+=h){const E=Math.min(v+h-1,y);f.children.push(this._build(t,v,E,s-1))}}return Li(f,this.toBBox),f}_chooseSubtree(t,e,r,s){for(;s.push(e),!(e.leaf||s.length-1===r);){let u=1/0,c=1/0,f;for(let h=0;h<e.children.length;h++){const d=e.children[h],p=pu(d),y=eb(t,d)-p;y<c?(c=y,u=p<u?p:u,f=d):y===c&&p<u&&(u=p,f=d)}e=f||e.children[0]}return e}_insert(t,e,r){const s=r?t:this.toBBox(t),u=[],c=this._chooseSubtree(s,this.data,e,u);for(c.children.push(t),Ns(c,s);e>=0&&u[e].children.length>this._maxEntries;)this._split(u,e),e--;this._adjustParentBBoxes(s,u,e)}_split(t,e){const r=t[e],s=r.children.length,u=this._minEntries;this._chooseSplitAxis(r,u,s);const c=this._chooseSplitIndex(r,u,s),f=Ti(r.children.splice(c,r.children.length-c));f.height=r.height,f.leaf=r.leaf,Li(r,this.toBBox),Li(f,this.toBBox),e?t[e-1].children.push(f):this._splitRoot(r,f)}_splitRoot(t,e){this.data=Ti([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Li(this.data,this.toBBox)}_chooseSplitIndex(t,e,r){let s,u=1/0,c=1/0;for(let f=e;f<=r-e;f++){const h=Ms(t,0,f,this.toBBox),d=Ms(t,f,r,this.toBBox),p=tb(h,d),y=pu(h)+pu(d);p<u?(u=p,s=f,c=y<c?y:c):p===u&&y<c&&(c=y,s=f)}return s||r-e}_chooseSplitAxis(t,e,r){const s=t.leaf?this.compareMinX:Kw,u=t.leaf?this.compareMinY:Qw,c=this._allDistMargin(t,e,r,s),f=this._allDistMargin(t,e,r,u);c<f&&t.children.sort(s)}_allDistMargin(t,e,r,s){t.children.sort(s);const u=this.toBBox,c=Ms(t,0,e,u),f=Ms(t,r-e,r,u);let h=wa(c)+wa(f);for(let d=e;d<r-e;d++){const p=t.children[d];Ns(c,t.leaf?u(p):p),h+=wa(c)}for(let d=r-e-1;d>=e;d--){const p=t.children[d];Ns(f,t.leaf?u(p):p),h+=wa(f)}return h}_adjustParentBBoxes(t,e,r){for(let s=r;s>=0;s--)Ns(e[s],t)}_condense(t){for(let e=t.length-1,r;e>=0;e--)t[e].children.length===0?e>0?(r=t[e-1].children,r.splice(r.indexOf(t[e]),1)):this.clear():Li(t[e],this.toBBox)}};function Zw(t,e,r){if(!r)return e.indexOf(t);for(let s=0;s<e.length;s++)if(r(t,e[s]))return s;return-1}function Li(t,e){Ms(t,0,t.children.length,e,t)}function Ms(t,e,r,s,u){u||(u=Ti(null)),u.minX=1/0,u.minY=1/0,u.maxX=-1/0,u.maxY=-1/0;for(let c=e;c<r;c++){const f=t.children[c];Ns(u,t.leaf?s(f):f)}return u}function Ns(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function Kw(t,e){return t.minX-e.minX}function Qw(t,e){return t.minY-e.minY}function pu(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function wa(t){return t.maxX-t.minX+(t.maxY-t.minY)}function eb(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function tb(t,e){const r=Math.max(t.minX,e.minX),s=Math.max(t.minY,e.minY),u=Math.min(t.maxX,e.maxX),c=Math.min(t.maxY,e.maxY);return Math.max(0,u-r)*Math.max(0,c-s)}function mu(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function ba(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Ti(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function af(t,e,r,s,u){const c=[e,r];for(;c.length;){if(r=c.pop(),e=c.pop(),r-e<=s)continue;const f=e+Math.ceil((r-e)/s/2)*s;$w(t,f,e,r,u),c.push(e,f,f,r)}}function nb(t){return gw(t,(e,r)=>e+rb(r),0)}function rb(t){let e=0,r;switch(t.type){case"Polygon":return of(t.coordinates);case"MultiPolygon":for(r=0;r<t.coordinates.length;r++)e+=of(t.coordinates[r]);return e;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}function of(t){let e=0;if(t&&t.length>0){e+=Math.abs(uf(t[0]));for(let r=1;r<t.length;r++)e-=Math.abs(uf(t[r]))}return e}var ib=ot*ot/2,vu=Math.PI/180;function uf(t){const e=t.length-1;if(e<=2)return 0;let r=0,s=0;for(;s<e;){const u=t[s],c=t[s+1===e?0:s+1],f=t[s+2>=e?(s+2)%e:s+2],h=u[0]*vu,d=c[1]*vu,p=f[0]*vu;r+=(p-h)*Math.sin(d),s++}return r*ib}const lr=11102230246251565e-32,pt=134217729,sb=(3+8*lr)*lr;function yu(t,e,r,s,u){let c,f,h,d,p=e[0],y=s[0],v=0,E=0;y>p==y>-p?(c=p,p=e[++v]):(c=y,y=s[++E]);let S=0;if(v<t&&E<r)for(y>p==y>-p?(f=p+c,h=c-(f-p),p=e[++v]):(f=y+c,h=c-(f-y),y=s[++E]),c=f,h!==0&&(u[S++]=h);v<t&&E<r;)y>p==y>-p?(f=c+p,d=f-c,h=c-(f-d)+(p-d),p=e[++v]):(f=c+y,d=f-c,h=c-(f-d)+(y-d),y=s[++E]),c=f,h!==0&&(u[S++]=h);for(;v<t;)f=c+p,d=f-c,h=c-(f-d)+(p-d),p=e[++v],c=f,h!==0&&(u[S++]=h);for(;E<r;)f=c+y,d=f-c,h=c-(f-d)+(y-d),y=s[++E],c=f,h!==0&&(u[S++]=h);return(c!==0||S===0)&&(u[S++]=c),S}function ab(t,e){let r=e[0];for(let s=1;s<t;s++)r+=e[s];return r}function aa(t){return new Float64Array(t)}const ob=(3+16*lr)*lr,ub=(2+12*lr)*lr,lb=(9+64*lr)*lr*lr,Ci=aa(4),lf=aa(8),cf=aa(12),hf=aa(16),St=aa(4);function cb(t,e,r,s,u,c,f){let h,d,p,y,v,E,S,b,N,O,D,L,q,H,J,z,$,k;const w=t-u,I=r-u,P=e-c,T=s-c;H=w*T,E=pt*w,S=E-(E-w),b=w-S,E=pt*T,N=E-(E-T),O=T-N,J=b*O-(H-S*N-b*N-S*O),z=P*I,E=pt*P,S=E-(E-P),b=P-S,E=pt*I,N=E-(E-I),O=I-N,$=b*O-(z-S*N-b*N-S*O),D=J-$,v=J-D,Ci[0]=J-(D+v)+(v-$),L=H+D,v=L-H,q=H-(L-v)+(D-v),D=q-z,v=q-D,Ci[1]=q-(D+v)+(v-z),k=L+D,v=k-L,Ci[2]=L-(k-v)+(D-v),Ci[3]=k;let G=ab(4,Ci),R=ub*f;if(G>=R||-G>=R||(v=t-w,h=t-(w+v)+(v-u),v=r-I,p=r-(I+v)+(v-u),v=e-P,d=e-(P+v)+(v-c),v=s-T,y=s-(T+v)+(v-c),h===0&&d===0&&p===0&&y===0)||(R=lb*f+sb*Math.abs(G),G+=w*y+T*h-(P*p+I*d),G>=R||-G>=R))return G;H=h*T,E=pt*h,S=E-(E-h),b=h-S,E=pt*T,N=E-(E-T),O=T-N,J=b*O-(H-S*N-b*N-S*O),z=d*I,E=pt*d,S=E-(E-d),b=d-S,E=pt*I,N=E-(E-I),O=I-N,$=b*O-(z-S*N-b*N-S*O),D=J-$,v=J-D,St[0]=J-(D+v)+(v-$),L=H+D,v=L-H,q=H-(L-v)+(D-v),D=q-z,v=q-D,St[1]=q-(D+v)+(v-z),k=L+D,v=k-L,St[2]=L-(k-v)+(D-v),St[3]=k;const C=yu(4,Ci,4,St,lf);H=w*y,E=pt*w,S=E-(E-w),b=w-S,E=pt*y,N=E-(E-y),O=y-N,J=b*O-(H-S*N-b*N-S*O),z=P*p,E=pt*P,S=E-(E-P),b=P-S,E=pt*p,N=E-(E-p),O=p-N,$=b*O-(z-S*N-b*N-S*O),D=J-$,v=J-D,St[0]=J-(D+v)+(v-$),L=H+D,v=L-H,q=H-(L-v)+(D-v),D=q-z,v=q-D,St[1]=q-(D+v)+(v-z),k=L+D,v=k-L,St[2]=L-(k-v)+(D-v),St[3]=k;const B=yu(C,lf,4,St,cf);H=h*y,E=pt*h,S=E-(E-h),b=h-S,E=pt*y,N=E-(E-y),O=y-N,J=b*O-(H-S*N-b*N-S*O),z=d*p,E=pt*d,S=E-(E-d),b=d-S,E=pt*p,N=E-(E-p),O=p-N,$=b*O-(z-S*N-b*N-S*O),D=J-$,v=J-D,St[0]=J-(D+v)+(v-$),L=H+D,v=L-H,q=H-(L-v)+(D-v),D=q-z,v=q-D,St[1]=q-(D+v)+(v-z),k=L+D,v=k-L,St[2]=L-(k-v)+(D-v),St[3]=k;const U=yu(B,cf,4,St,hf);return hf[U-1]}function hb(t,e,r,s,u,c){const f=(e-c)*(r-u),h=(t-u)*(s-c),d=f-h,p=Math.abs(f+h);return Math.abs(d)>=ob*p?d:-cb(t,e,r,s,u,c,p)}function fb(t,e){var r,s,u=0,c,f,h,d,p,y,v,E=t[0],S=t[1],b=e.length;for(r=0;r<b;r++){s=0;var N=e[r],O=N.length-1;if(y=N[0],y[0]!==N[O][0]&&y[1]!==N[O][1])throw new Error("First and last coordinates in a ring must be the same");for(f=y[0]-E,h=y[1]-S,s;s<O;s++){if(v=N[s+1],d=v[0]-E,p=v[1]-S,h===0&&p===0){if(d<=0&&f>=0||f<=0&&d>=0)return 0}else if(p>=0&&h<=0||p<=0&&h>=0){if(c=hb(f,d,h,p,0,0),c===0)return 0;(c>0&&p>0&&h<=0||c<0&&p<=0&&h>0)&&u++}y=v,h=p,f=d}}return u%2!==0}function ii(t,e,r={}){if(!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");const s=Ke(t),u=sa(e),c=u.type,f=e.bbox;let h=u.coordinates;if(f&&gb(s,f)===!1)return!1;c==="Polygon"&&(h=[h]);let d=!1;for(var p=0;p<h.length;++p){const y=fb(s,h[p]);if(y===0)return!r.ignoreBoundary;y&&(d=!0)}return d}function gb(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}function db(t,e){if(t.geometry.type!=="Polygon")throw new Error("The input feature must be a Polygon");for(var r=t.geometry.coordinates,s=[],u={},c=[],f=0;f<r.length;f++)for(var h=0;h<r[f].length-1;h++)c.push(S(f,h));var d=new uc;d.load(c);for(var p=0;p<r.length;p++)for(var y=0;y<r[p].length-1;y++){var v=d.search(S(p,y));v.forEach(function(b){var N=b.ring,O=b.edge;E(p,y,N,O)})}return s;function E(b,N,O,D){var L=r[b][N],q=r[b][N+1],H=r[O][D],J=r[O][D+1],z=pb(L,q,H,J);if(z!==null){var $,k;if(q[0]!==L[0]?$=(z[0]-L[0])/(q[0]-L[0]):$=(z[1]-L[1])/(q[1]-L[1]),J[0]!==H[0]?k=(z[0]-H[0])/(J[0]-H[0]):k=(z[1]-H[1])/(J[1]-H[1]),!($>=1||$<=0||k>=1||k<=0)){var w=z,I=!u[w.toString()];I&&(u[w.toString()]=!0),e&&s.push(e(z,b,N,L,q,$,O,D,H,J,k,I))}}}function S(b,N){var O=r[b][N],D=r[b][N+1],L,q,H,J;return O[0]<D[0]?(L=O[0],q=D[0]):(L=D[0],q=O[0]),O[1]<D[1]?(H=O[1],J=D[1]):(H=D[1],J=O[1]),{minX:L,minY:H,maxX:q,maxY:J,ring:b,edge:N}}}function pb(t,e,r,s){if(Ls(t,r)||Ls(t,s)||Ls(e,r)||Ls(s,r))return null;var u=t[0],c=t[1],f=e[0],h=e[1],d=r[0],p=r[1],y=s[0],v=s[1],E=(u-f)*(p-v)-(c-h)*(d-y);if(E===0)return null;var S=((u*h-c*f)*(d-y)-(u-f)*(d*v-p*y))/E,b=((u*h-c*f)*(p-v)-(c-h)*(d*v-p*y))/E;return[S,b]}function Ls(t,e){if(!t||!e||t.length!==e.length)return!1;for(var r=0,s=t.length;r<s;r++)if(t[r]instanceof Array&&e[r]instanceof Array){if(!Ls(t[r],e[r]))return!1}else if(t[r]!==e[r])return!1;return!0}function mb(t){if(t.type!="Feature")throw new Error("The input must a geojson object of type Feature");if(t.geometry===void 0||t.geometry==null)throw new Error("The input must a geojson object with a non-empty geometry");if(t.geometry.type!="Polygon")throw new Error("The input must be a geojson Polygon");for(var e=t.geometry.coordinates.length,r=[],s=0;s<e;s++){var u=t.geometry.coordinates[s];Cs(u[0],u[u.length-1])||u.push(u[0]);for(var c=0;c<u.length-1;c++)r.push(u[c])}if(!yb(r))throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");var f=r.length,h=db(t,function(oe,le,ie,ue,ke,Le,V,Cn,Se,fe,A,Ce){return[oe,le,ie,ue,ke,Le,V,Cn,Se,fe,A,Ce]}),d=h.length;if(d==0){for(var p=[],s=0;s<e;s++)p.push(Pr([t.geometry.coordinates[s]],{parent:-1,winding:vb(t.geometry.coordinates[s])}));let oe=Qe(p);return W(oe),Z(oe),oe}for(var y=[],v=[],s=0;s<e;s++){y.push([]);for(var c=0;c<t.geometry.coordinates[s].length-1;c++)y[s].push([new ff(t.geometry.coordinates[s][Ri(c+1,t.geometry.coordinates[s].length-1)],1,[s,c],[s,Ri(c+1,t.geometry.coordinates[s].length-1)],void 0)]),v.push(new gf(t.geometry.coordinates[s][c],[s,Ri(c-1,t.geometry.coordinates[s].length-1)],[s,c],void 0,void 0,!1,!0))}for(var s=0;s<d;s++)y[h[s][1]][h[s][2]].push(new ff(h[s][0],h[s][5],[h[s][1],h[s][2]],[h[s][6],h[s][7]],void 0)),h[s][11]&&v.push(new gf(h[s][0],[h[s][1],h[s][2]],[h[s][6],h[s][7]],void 0,void 0,!0,!0));for(var E=v.length,s=0;s<y.length;s++)for(var c=0;c<y[s].length;c++)y[s][c].sort(function(ie,ue){return ie.param<ue.param?-1:1});for(var S=[],s=0;s<E;s++)S.push({minX:v[s].coord[0],minY:v[s].coord[1],maxX:v[s].coord[0],maxY:v[s].coord[1],index:s});var b=new uc;b.load(S);for(var s=0;s<y.length;s++)for(var c=0;c<y[s].length;c++)for(var N=0;N<y[s][c].length;N++){let ie;N==y[s][c].length-1?ie=y[s][Ri(c+1,t.geometry.coordinates[s].length-1)][0].coord:ie=y[s][c][N+1].coord;var O=b.search({minX:ie[0],minY:ie[1],maxX:ie[0],maxY:ie[1]})[0];y[s][c][N].nxtIsectAlongEdgeIn=O.index}for(var s=0;s<y.length;s++)for(var c=0;c<y[s].length;c++)for(var N=0;N<y[s][c].length;N++){let ue=y[s][c][N].coord;var O=b.search({minX:ue[0],minY:ue[1],maxX:ue[0],maxY:ue[1]})[0],D=O.index;D<f?v[D].nxtIsectAlongRingAndEdge2=y[s][c][N].nxtIsectAlongEdgeIn:Cs(v[D].ringAndEdge1,y[s][c][N].ringAndEdgeIn)?v[D].nxtIsectAlongRingAndEdge1=y[s][c][N].nxtIsectAlongEdgeIn:v[D].nxtIsectAlongRingAndEdge2=y[s][c][N].nxtIsectAlongEdgeIn}for(var L=[],s=0,c=0;c<e;c++){for(var q=s,N=0;N<t.geometry.coordinates[c].length-1;N++)v[s].coord[0]<v[q].coord[0]&&(q=s),s++;for(var H=v[q].nxtIsectAlongRingAndEdge2,N=0;N<v.length;N++)if(v[N].nxtIsectAlongRingAndEdge1==q||v[N].nxtIsectAlongRingAndEdge2==q){var J=N;break}var z=Ua([v[J].coord,v[q].coord,v[H].coord],!0)?1:-1;L.push({isect:q,parent:-1,winding:z})}L.sort(function(oe,le){return v[oe.isect].coord>v[le.isect].coord?-1:1});for(var p=[];L.length>0;){var $=L.pop(),k=$.isect,w=$.parent,I=$.winding,P=p.length,T=[v[k].coord],G=k;if(v[k].ringAndEdge1Walkable)var R=v[k].ringAndEdge1,C=v[k].nxtIsectAlongRingAndEdge1;else var R=v[k].ringAndEdge2,C=v[k].nxtIsectAlongRingAndEdge2;for(;!Cs(v[k].coord,v[C].coord);){T.push(v[C].coord);for(var B=void 0,s=0;s<L.length;s++)if(L[s].isect==C){B=s;break}if(B!=null&&L.splice(B,1),Cs(R,v[C].ringAndEdge1)){if(R=v[C].ringAndEdge2,v[C].ringAndEdge2Walkable=!1,v[C].ringAndEdge1Walkable){var U={isect:C};Ua([v[G].coord,v[C].coord,v[v[C].nxtIsectAlongRingAndEdge2].coord],I==1)?(U.parent=w,U.winding=-I):(U.parent=P,U.winding=I),L.push(U)}G=C,C=v[C].nxtIsectAlongRingAndEdge2}else{if(R=v[C].ringAndEdge1,v[C].ringAndEdge1Walkable=!1,v[C].ringAndEdge2Walkable){var U={isect:C};Ua([v[G].coord,v[C].coord,v[v[C].nxtIsectAlongRingAndEdge1].coord],I==1)?(U.parent=w,U.winding=-I):(U.parent=P,U.winding=I),L.push(U)}G=C,C=v[C].nxtIsectAlongRingAndEdge1}}T.push(v[C].coord),p.push(Pr([T],{index:P,parent:w,winding:I,netWinding:void 0}))}let Y=Qe(p);W(Y),Z(Y);function W(oe){for(var le=[],ie=0;ie<oe.features.length;ie++)oe.features[ie].properties.parent==-1&&le.push(ie);if(le.length>1)for(var ie=0;ie<le.length;ie++){for(var ue=-1,ke=1/0,Le=0;Le<oe.features.length;Le++)le[ie]!=Le&&ii(oe.features[le[ie]].geometry.coordinates[0][0],oe.features[Le],{ignoreBoundary:!0})&&nb(oe.features[Le])<ke&&(ue=Le);oe.features[le[ie]].properties.parent=ue}}function Z(oe){for(var le=0;le<oe.features.length;le++)if(oe.features[le].properties.parent==-1){var ie=oe.features[le].properties.winding;oe.features[le].properties.netWinding=ie,ne(oe,le,ie)}}function ne(oe,le,ie){for(var ue=0;ue<oe.features.length;ue++)if(oe.features[ue].properties.parent==le){var ke=ie+oe.features[ue].properties.winding;oe.features[ue].properties.netWinding=ke,ne(oe,ue,ke)}}return Y}var ff=class{constructor(t,e,r,s,u){this.coord=t,this.param=e,this.ringAndEdgeIn=r,this.ringAndEdgeOut=s,this.nxtIsectAlongEdgeIn=u}},gf=class{constructor(t,e,r,s,u,c,f){this.coord=t,this.ringAndEdge1=e,this.ringAndEdge2=r,this.nxtIsectAlongRingAndEdge1=s,this.nxtIsectAlongRingAndEdge2=u,this.ringAndEdge1Walkable=c,this.ringAndEdge2Walkable=f}};function Ua(t,e){if(typeof e>"u"&&(e=!0),t.length!=3)throw new Error("This function requires an array of three points [x,y]");var r=(t[1][0]-t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0]);return r>=0==e}function vb(t){for(var e=0,r=0;r<t.length-1;r++)t[r][0]<t[e][0]&&(e=r);if(Ua([t[Ri(e-1,t.length-1)],t[e],t[Ri(e+1,t.length-1)]],!0))var s=1;else var s=-1;return s}function Cs(t,e){if(!t||!e||t.length!=e.length)return!1;for(var r=0,s=t.length;r<s;r++)if(t[r]instanceof Array&&e[r]instanceof Array){if(!Cs(t[r],e[r]))return!1}else if(t[r]!=e[r])return!1;return!0}function Ri(t,e){return(t%e+e)%e}function yb(t){for(var e={},r=1,s=0,u=t.length;s<u;++s){if(Object.prototype.hasOwnProperty.call(e,t[s].toString())){r=0;break}e[t[s].toString()]=1}return r}function _b(t){var e=[];return Rr(t,function(r){r.geometry.type==="Polygon"&&$n(mb(r),function(s){e.push(Pr(s.geometry.coordinates,r.properties))})}),Qe(e)}var kb=_b;class Eb extends Kn{mode="polygon";shape="polygon";lineDrawer=new Ro(this.gm,{snappingMarkers:"first",targetShape:"polygon"});eventHandlers={[`${ae}:draw`]:this.forwardLineDrawerEvent.bind(this),mousemove:this.onMouseMove.bind(this)};onEndAction(){this.lineDrawer.endAction()}onStartAction(){this.lineDrawer.startAction(),this.lineDrawer.on("firstMarkerClick",this.polygonFinished.bind(this))}onMouseMove(e){return We(e)?(this.lineDrawer.featureData||this.fireMarkerPointerUpdateEvent(),{next:!0}):{next:!0}}polygonFinished(e){if(this.lineDrawer.endShape(),e.shapeCoordinates.length<3)return;const r=this.fixShapeGeoJson(oc(e.geoJson));r&&this.gm.features.createFeature({shapeGeoJson:{...r,properties:{shape:this.shape}},sourceName:Q.main})}fixShapeGeoJson(e){try{return xw(Xw(kb(e))).features[0]}catch{return null}}}class xb extends Kn{mode="rectangle";shape="rectangle";startLngLat=null;eventHandlers={mousemove:this.onMouseMove.bind(this),click:this.onMouseClick.bind(this)};throttledMethods=Fr({updateFeaturePosition:this.updateFeaturePosition},this,this.gm.options.settings.throttlingDelay);onStartAction(){this.gm.markerPointer.enable()}onEndAction(){this.removeTmpFeature(),this.startLngLat=null,this.gm.markerPointer.disable(),this.fireFinishEvent()}onMouseClick(e){if(!We(e,{warning:!0}))return{next:!1};const r=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();if(this.startLngLat){const s=this.getFeatureGeoJson(Ai(this.startLngLat,r));this.fireBeforeFeatureCreate({geoJsonFeatures:[s]}),this.flags.featureCreateAllowed&&this.finishShape(r)}else{const s=this.getFeatureGeoJson(Ai(r,r));if(this.fireBeforeFeatureCreate({geoJsonFeatures:[s]}),this.flags.featureCreateAllowed){const u=this.startShape(r);if(u){const c=this.getControlMarkerData(["geometry","coordinates",4]);this.fireStartEvent(u,c)}}}return{next:!1}}onMouseMove(e){if(!We(e,{warning:!0}))return{next:!1};if(!this.startLngLat)return this.fireMarkerPointerUpdateEvent(),{next:!1};const r=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray(),s=Ai(this.startLngLat,r),u=this.getFeatureGeoJson(s);return this.fireBeforeFeatureCreate({geoJsonFeatures:[u]}),this.flags.featureCreateAllowed&&this.throttledMethods.updateFeaturePosition(s),{next:!1}}startShape(e){this.startLngLat=e;const r=Ai(this.startLngLat,this.startLngLat);return this.featureData=this.createFeature(r),this.featureData}finishShape(e){if(this.startLngLat){const r=Ai(this.startLngLat,e);this.throttledMethods.updateFeaturePosition(r)}this.featureData&&(this.isFeatureGeoJsonValid()?this.saveFeature():this.removeTmpFeature()),this.startLngLat=null,this.fireFinishEvent()}createFeature(e){return this.gm.features.createFeature({shapeGeoJson:this.getFeatureGeoJson(e),sourceName:Q.temporary})}isFeatureGeoJsonValid(){return this.featureData?nc(this.featureData.getGeoJson()):!1}getFeatureGeoJson(e){return{...il([e[0],e[1]],[e[2],e[3]]),properties:{shape:this.shape}}}updateFeaturePosition(e){if(!this.featureData)return;const r=il([e[0],e[1]],[e[2],e[3]]);this.featureData.updateGeoJsonGeometry(r.geometry);const s=this.getControlMarkerData(["geometry","coordinates",4]);this.fireUpdateEvent(this.featureData,s)}getControlMarkerData(e){const r=this.gm.markerPointer.marker;return r?{type:"dom",instance:r,position:{coordinate:r.getLngLat(),path:e}}:null}fireStartEvent(e,r){const s={name:`${ae}:draw:shape_with_data`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:"start",featureData:e,markerData:r};this.gm.events.fire(`${ae}:draw`,s)}fireUpdateEvent(e,r){const s={name:`${ae}:draw:shape_with_data`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:"update",featureData:e,markerData:r};this.gm.events.fire(`${ae}:draw`,s)}fireFinishEvent(){const e={name:`${ae}:draw:shape`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:"finish"};this.gm.events.fire(`${ae}:draw`,e)}}class wb extends Kn{mode="text_marker";shape="text_marker";textarea=null;eventHandlers={click:this.onMouseClick.bind(this),mousemove:this.onMouseMove.bind(this)};onStartAction(){this.gm.markerPointer.enable({invisibleMarker:!0})}onEndAction(){this.removeTextarea(),this.removeTmpFeature(),this.featureData=null,this.gm.markerPointer.disable(),this.fireMarkerPointerFinishEvent()}onMouseMove(e){return We(e,{warning:!0})?(this.fireMarkerPointerUpdateEvent(),{next:!0}):{next:!0}}onMouseClick(e){if(!We(e,{warning:!0}))return{next:!0};if(this.textarea)this.endShape(),this.gm.markerPointer.enable({invisibleMarker:!0,lngLat:e.lngLat.toArray()}),this.fireMarkerPointerUpdateEvent();else{const r=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getFeatureGeoJson(r)]}),this.flags.featureCreateAllowed&&(this.featureData=this.createFeature(r),this.gm.markerPointer.disable(),this.fireMarkerPointerFinishEvent())}return{next:!1}}createFeature(e){const r=this.gm.mapAdapter.project(e);return this.createTextarea(r),this.gm.features.createFeature({shapeGeoJson:this.getFeatureGeoJson(e),sourceName:Q.temporary})}endShape(){const e=this.textarea?.value||"";this.removeTextarea(),e.trim()?(this.updateFeatureSource(e),this.saveFeature()):this.removeTmpFeature()}createTextarea(e){this.textarea=document.createElement("textarea"),this.textarea.style.position="absolute",this.textarea.style.left=`${e[0]}px`,this.textarea.style.top=`${e[1]}px`,this.textarea.style.opacity="0.7",this.gm.mapAdapter.getContainer().appendChild(this.textarea),this.textarea.focus()}removeTextarea(){this.textarea?.remove(),this.textarea=null}getFeatureGeoJson(e){return{type:"Feature",properties:{shape:this.shape,text:""},geometry:{type:"Point",coordinates:e}}}updateFeatureSource(e){this.featureData&&this.featureData._updateAllProperties({[`${it}shape`]:this.shape,[`${it}text`]:e})}}class bb extends ac{mode="ellipse";shape="ellipse";xSemiAxisPoint=null;xSemiAxisLngLat=null;throttledMethods=Fr({updateFeatureGeoJson:this.updateFeatureGeoJson},this,this.gm.options.settings.throttlingDelay);onMouseClick(e){if(!We(e))return{next:!0};const r=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();if(this.circleCenterLngLat&&this.xSemiAxisLngLat)this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getEllipseGeoJson(this.circleCenterLngLat,this.xSemiAxisLngLat,r)]}),this.flags.featureCreateAllowed&&(this.saveEllipseFeature(r),this.circleCenterLngLat=null,this.circleCenterPoint=null,this.xSemiAxisPoint=null,this.xSemiAxisLngLat=null,this.fireFinishEvent());else if(this.circleCenterLngLat)this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getEllipseGeoJson(this.circleCenterLngLat,r)]}),this.flags.featureCreateAllowed&&(this.xSemiAxisLngLat=r,this.xSemiAxisPoint=this.gm.mapAdapter.project(this.circleCenterLngLat));else if(this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getFeatureGeoJson(r)]}),this.flags.featureCreateAllowed){this.circleCenterLngLat=r,this.circleCenterPoint=this.gm.mapAdapter.project(this.circleCenterLngLat),this.featureData=this.createFeature();const s=this.getControlMarkerData();this.featureData&&s&&this.fireStartEvent(this.featureData,s)}return{next:!1}}onMouseMove(){if(this.circleCenterLngLat&&this.gm.markerPointer.marker){const e=this.gm.markerPointer.marker.getLngLat();this.fireBeforeFeatureCreate({geoJsonFeatures:[this.xSemiAxisLngLat?this.getEllipseGeoJson(this.circleCenterLngLat,this.xSemiAxisLngLat,e):this.getEllipseGeoJson(this.circleCenterLngLat,e)]}),this.flags.featureCreateAllowed&&this.throttledMethods.updateFeatureGeoJson(e)}return this.circleCenterLngLat||this.fireMarkerPointerUpdateEvent(),{next:!1}}updateFeatureGeoJson(e){if(!this.featureData||!this.circleCenterLngLat)return;const r=this.xSemiAxisLngLat?this.getEllipseGeoJson(this.circleCenterLngLat,this.xSemiAxisLngLat,e):this.getEllipseGeoJson(this.circleCenterLngLat,e);this.featureData.updateGeoJsonGeometry(r.geometry),this.featureData._updateAllProperties({shape:r.properties.shape});const s=this.getControlMarkerData();s&&this.fireUpdateEvent(this.featureData,s)}saveEllipseFeature(e){if(!(!this.circleCenterLngLat||!this.xSemiAxisLngLat)&&this.featureData){const r=this.gm.markerPointer.marker?.getLngLat()||e;this.updateFeatureGeoJson(r);const{xSemiAxis:s,ySemiAxis:u,angle:c}=tf({center:this.circleCenterLngLat,xSemiAxisLngLat:this.xSemiAxisLngLat,rimLngLat:r});this.featureData.setShapeProperty("center",this.circleCenterLngLat),this.featureData.setShapeProperty("xSemiAxis",s),this.featureData.setShapeProperty("ySemiAxis",u),this.featureData.setShapeProperty("angle",c),this.isFeatureGeoJsonValid()?this.saveFeature():this.removeTmpFeature()}}isFeatureGeoJsonValid(){return this.featureData?nc(this.featureData.getGeoJson()):!1}getEllipseGeoJson(e,r,s){const{xSemiAxis:u,ySemiAxis:c,angle:f}=tf({center:e,xSemiAxisLngLat:r,rimLngLat:s});return Ao({center:e,xSemiAxis:u,ySemiAxis:c,angle:f})}}const ro={marker:Hw,ellipse:bb,circle:Uw,circle_marker:Ow,text_marker:wb,line:Jw,rectangle:xb,polygon:Eb,freehand:null,custom_shape:null},Sb=(t,e)=>ro[e]?new ro[e](t):(te.error(`Draw "${e}" is not available`),null),hi=t=>Xn(t)&&t.actionType==="edit",Ib=t=>lw.includes(t),up=t=>Hl.includes(t),lp=t=>Xl.includes(t),cp=t=>Vl.includes(t),hp=t=>up(t)||lp(t)||cp(t);class Mb extends Io{eventHandlers={[`${ae}:draw`]:this.handleDrawEvent.bind(this)};constructor(e,r){super(e),r.attachEvents(this.eventHandlers)}handleDrawEvent(e){if(!Oo(e))return{next:!0};const r=`${e.actionType}__${e.mode}`;return e.action==="mode_start"?(this.trackExclusiveModes(e),this.start(r,e),this.trackRelatedModes(e)):e.action==="mode_end"&&(this.trackRelatedModes(e),this.end(r)),{next:!0}}start(e,r){const s=Sb(this.gm,r.mode);s&&(e in this.gm.actionInstances&&te.error(`Action instance "${e}" already exists`),this.gm.actionInstances[e]=s,s.startAction())}end(e){const r=this.gm.actionInstances[e];r instanceof Kn?(r.endAction(),delete this.gm.actionInstances[e]):console.error(`Wrong action instance for draw event "${e}":`,r)}}class is extends Po{actionType="edit";featureData=null;cursorExcludedLayerIds=["rectangle-line","polygon-line","circle-line"];layerEventHandlersData=[];startAction(){this.setEventsForLayers("mouseenter",this.setCursorToPointer.bind(this)),this.setEventsForLayers("mouseleave",this.setCursorToEmpty.bind(this)),super.startAction()}endAction(){this.clearEventsForLayers(),super.endAction()}setCursorToPointer(){this.flags.actionInProgress||this.gm.mapAdapter.setCursor("pointer")}setCursorToEmpty(){this.flags.actionInProgress||this.gm.mapAdapter.setCursor("")}getFeatureByMouseEvent({event:e,sourceNames:r}){const s=this.gm.features.getFeatureByMouseEvent({event:e,sourceNames:r});return!s||s.getShapeProperty("disableEdit")===!0?null:s}setEventsForLayers(e,r){this.gm.features.layers.map(s=>s.id).filter(s=>!this.cursorExcludedLayerIds.some(u=>s.includes(u))).forEach(s=>{this.gm.mapAdapter.on(e,s,r),this.layerEventHandlersData.push({eventName:e,layerId:s,callback:r})})}clearEventsForLayers(){this.layerEventHandlersData.forEach(({eventName:e,layerId:r,callback:s})=>{this.gm.mapAdapter.off(e,r,s)}),this.layerEventHandlersData=[]}updateFeatureGeoJson({featureData:e,featureGeoJson:r,forceMode:s=void 0}){return this.flags.featureUpdateAllowed?(e.updateGeoJsonGeometry(r.geometry),Qi(e.getGeoJson().properties,r.properties)||e._updateAllProperties(r.properties),this.fireFeatureUpdatedEvent({sourceFeatures:[e],targetFeatures:[e],forceMode:s}),!0):!1}fireBeforeFeatureUpdate({features:e,geoJsonFeatures:r,forceMode:s=void 0}){this.flags.featureUpdateAllowed=!0;const u={name:`${ae}:feature:before_update`,level:"system",actionType:"edit",mode:s||this.mode,action:"before_update",features:e,geoJsonFeatures:r};this.gm.events.fire(`${ae}:${this.actionType}`,u)}fireFeatureUpdatedEvent({sourceFeatures:e,targetFeatures:r,markerData:s=void 0,forceMode:u=void 0}){const c={name:`${ae}:edit:feature_updated`,level:"system",actionType:"edit",action:"feature_updated",mode:u||this.mode,sourceFeatures:e,targetFeatures:r,markerData:s||null};this.gm.events.fire(`${ae}:edit`,c)}fireFeatureEditStartEvent({feature:e,forceMode:r=void 0}){const s={name:`${ae}:edit:feature_edit_start`,level:"system",actionType:"edit",action:"feature_edit_start",mode:r||this.mode,feature:e};this.gm.events.fire(`${ae}:edit`,s)}fireFeatureEditEndEvent({feature:e,forceMode:r=void 0}){const s={name:`${ae}:edit:feature_edit_end`,level:"system",actionType:"edit",action:"feature_edit_end",mode:r||this.mode,feature:e};this.gm.events.fire(`${ae}:edit`,s)}fireMarkerPointerUpdateEvent(){if(!this.gm.markerPointer.marker)return;const e=this.gm.markerPointer.marker,r={name:`${ae}:draw:shape_with_data`,level:"system",variant:null,actionType:"draw",mode:this.getLineDrawerMode(),action:"update",markerData:{type:"dom",instance:e,position:{coordinate:e.getLngLat(),path:[-1]}},featureData:null};this.gm.events.fire(`${ae}:draw`,r)}forwardLineDrawerEvent(e){if(!sc(e)||!["cut","split"].includes(this.mode))return{next:!0};if(e.action==="start"||e.action==="update"){const r={name:`${ae}:draw:shape_with_data`,level:"system",actionType:"draw",mode:this.getLineDrawerMode(),variant:null,action:e.action,featureData:e.featureData,markerData:e.markerData};this.gm.events.fire(`${ae}:draw`,r)}else if(e.action==="finish"||e.action==="cancel"){const r={name:`${ae}:draw:shape`,level:"system",actionType:"draw",mode:this.getLineDrawerMode(),variant:null,action:e.action};this.gm.events.fire(`${ae}:draw`,r)}return{next:!0}}fireFeatureRemovedEvent(e){if(ur(e.shape,Yn)){const r={name:`${ae}:edit:feature_removed`,level:"system",actionType:"edit",mode:e.shape,action:"feature_removed",featureData:e};this.gm.events.fire(`${ae}:edit`,r)}}getLineDrawerMode(){return this.mode==="cut"?"polygon":(this.mode,"line")}}function Nb(t,e={}){const r=ar(t),s=(r[0]+r[2])/2,u=(r[1]+r[3])/2;return Sn([s,u],e.properties,e)}var sl={exports:{}},Lb=sl.exports,df;function Cb(){return df||(df=1,(function(t,e){(function(r,s){t.exports=s()})(Lb,(function(){function r(o,n){(n==null||n>o.length)&&(n=o.length);for(var i=0,a=Array(n);i<n;i++)a[i]=o[i];return a}function s(o,n,i){return n=y(n),(function(a,l){if(l&&(typeof l=="object"||typeof l=="function"))return l;if(l!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return(function(g){if(g===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g})(a)})(o,E()?Reflect.construct(n,i||[],y(o).constructor):n.apply(o,i))}function u(o,n){if(!(o instanceof n))throw new TypeError("Cannot call a class as a function")}function c(o,n,i){if(E())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,n);var l=new(o.bind.apply(o,a));return i&&S(l,i.prototype),l}function f(o,n){for(var i=0;i<n.length;i++){var a=n[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(o,O(a.key),a)}}function h(o,n,i){return n&&f(o.prototype,n),i&&f(o,i),Object.defineProperty(o,"prototype",{writable:!1}),o}function d(o,n){var i=typeof Symbol<"u"&&o[Symbol.iterator]||o["@@iterator"];if(!i){if(Array.isArray(o)||(i=D(o))||n){i&&(o=i);var a=0,l=function(){};return{s:l,n:function(){return a>=o.length?{done:!0}:{done:!1,value:o[a++]}},e:function(x){throw x},f:l}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
124
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var g,m=!0,_=!1;return{s:function(){i=i.call(o)},n:function(){var x=i.next();return m=x.done,x},e:function(x){_=!0,g=x},f:function(){try{m||i.return==null||i.return()}finally{if(_)throw g}}}}function p(){return p=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(o,n,i){var a=(function(g,m){for(;!{}.hasOwnProperty.call(g,m)&&(g=y(g))!==null;);return g})(o,n);if(a){var l=Object.getOwnPropertyDescriptor(a,n);return l.get?l.get.call(arguments.length<3?o:i):l.value}},p.apply(null,arguments)}function y(o){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},y(o)}function v(o,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");o.prototype=Object.create(n&&n.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),Object.defineProperty(o,"prototype",{writable:!1}),n&&S(o,n)}function E(){try{var o=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch{}return(E=function(){return!!o})()}function S(o,n){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,a){return i.__proto__=a,i},S(o,n)}function b(o,n,i,a){var l=p(y(1&a?o.prototype:o),n,i);return 2&a&&typeof l=="function"?function(g){return l.apply(i,g)}:l}function N(o){return(function(n){if(Array.isArray(n))return r(n)})(o)||(function(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)})(o)||D(o)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
125
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function O(o){var n=(function(i,a){if(typeof i!="object"||!i)return i;var l=i[Symbol.toPrimitive];if(l!==void 0){var g=l.call(i,a);if(typeof g!="object")return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)})(o,"string");return typeof n=="symbol"?n:n+""}function D(o,n){if(o){if(typeof o=="string")return r(o,n);var i={}.toString.call(o).slice(8,-1);return i==="Object"&&o.constructor&&(i=o.constructor.name),i==="Map"||i==="Set"?Array.from(o):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(o,n):void 0}}function L(o){var n=typeof Map=="function"?new Map:void 0;return L=function(i){if(i===null||!(function(l){try{return Function.toString.call(l).indexOf("[native code]")!==-1}catch{return typeof l=="function"}})(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(n!==void 0){if(n.has(i))return n.get(i);n.set(i,a)}function a(){return c(i,arguments,y(this).constructor)}return a.prototype=Object.create(i.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),S(a,i)},L(o)}var q=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=o.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=o.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==o.JOIN_ROUND&&(this._quadrantSegments=o.DEFAULT_QUADRANT_SEGMENTS)}},{key:"getJoinStyle",value:function(){return this._joinStyle}},{key:"setJoinStyle",value:function(n){this._joinStyle=n}},{key:"setSimplifyFactor",value:function(n){this._simplifyFactor=n<0?0:n}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(n){this._endCapStyle=n}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(n){this._mitreLimit=n}},{key:"setSingleSided",value:function(n){this._isSingleSided=n}}],[{key:"constructor_",value:function(){if(this._quadrantSegments=o.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=o.CAP_ROUND,this._joinStyle=o.JOIN_ROUND,this._mitreLimit=o.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=o.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setQuadrantSegments(n)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.setQuadrantSegments(i),this.setEndCapStyle(a)}else if(arguments.length===4){var l=arguments[0],g=arguments[1],m=arguments[2],_=arguments[3];this.setQuadrantSegments(l),this.setEndCapStyle(g),this.setJoinStyle(m),this.setMitreLimit(_)}}}},{key:"bufferDistanceError",value:function(n){var i=Math.PI/2/n;return 1-Math.cos(i/2)}}])})();q.CAP_ROUND=1,q.CAP_FLAT=2,q.CAP_SQUARE=3,q.JOIN_ROUND=1,q.JOIN_MITRE=2,q.JOIN_BEVEL=3,q.DEFAULT_QUADRANT_SEGMENTS=8,q.DEFAULT_MITRE_LIMIT=5,q.DEFAULT_SIMPLIFY_FACTOR=.01;var H=(function(o){function n(i){var a;return u(this,n),(a=s(this,n,[i])).name=Object.keys({Exception:n})[0],a}return v(n,o),h(n,[{key:"toString",value:function(){return this.message}}])})(L(Error)),J=(function(o){function n(i){var a;return u(this,n),(a=s(this,n,[i])).name=Object.keys({IllegalArgumentException:n})[0],a}return v(n,o),h(n)})(H),z=(function(){return h((function o(){u(this,o)}),[{key:"filter",value:function(o){}}])})();function $(){}function k(){}function w(){}var I,P,T,G,R,C,B,U,Y=(function(){return h((function o(){u(this,o)}),null,[{key:"equalsWithTolerance",value:function(o,n,i){return Math.abs(o-n)<=i}}])})(),W=(function(){return h((function o(n,i){u(this,o),this.low=i||0,this.high=n||0}),null,[{key:"toBinaryString",value:function(o){var n,i="";for(n=2147483648;n>0;n>>>=1)i+=(o.high&n)===n?"1":"0";for(n=2147483648;n>0;n>>>=1)i+=(o.low&n)===n?"1":"0";return i}}])})();function Z(){}function ne(){}Z.NaN=NaN,Z.isNaN=function(o){return Number.isNaN(o)},Z.isInfinite=function(o){return!Number.isFinite(o)},Z.MAX_VALUE=Number.MAX_VALUE,Z.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,Z.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,typeof Float64Array=="function"&&typeof Int32Array=="function"?(C=2146435072,B=new Float64Array(1),U=new Int32Array(B.buffer),Z.doubleToLongBits=function(o){B[0]=o;var n=0|U[0],i=0|U[1];return(i&C)===C&&1048575&i&&n!==0&&(n=0,i=2146959360),new W(i,n)},Z.longBitsToDouble=function(o){return U[0]=o.low,U[1]=o.high,B[0]}):(I=1023,P=Math.log2,T=Math.floor,G=Math.pow,R=(function(){for(var o=53;o>0;o--){var n=G(2,o)-1;if(T(P(n))+1===o)return n}return 0})(),Z.doubleToLongBits=function(o){var n,i,a,l,g,m,_,x,M;if(o<0||1/o===Number.NEGATIVE_INFINITY?(m=1<<31,o=-o):m=0,o===0)return new W(x=m,M=0);if(o===1/0)return new W(x=2146435072|m,M=0);if(o!=o)return new W(x=2146959360,M=0);if(l=0,M=0,(n=T(o))>1)if(n<=R)(l=T(P(n)))<=20?(M=0,x=n<<20-l&1048575):(M=n%(i=G(2,a=l-20))<<32-a,x=n/i&1048575);else for(a=n,M=0;(a=T(i=a/2))!==0;)l++,M>>>=1,M|=(1&x)<<31,x>>>=1,i!==a&&(x|=524288);if(_=l+I,g=n===0,n=o-n,l<52&&n!==0)for(a=0;;){if((i=2*n)>=1?(n=i-1,g?(_--,g=!1):(a<<=1,a|=1,l++)):(n=i,g?--_==0&&(l++,g=!1):(a<<=1,l++)),l===20)x|=a,a=0;else if(l===52){M|=a;break}if(i===1){l<20?x|=a<<20-l:l<52&&(M|=a<<52-l);break}}return x|=_<<20,new W(x|=m,M)},Z.longBitsToDouble=function(o){var n,i,a,l,g=o.high,m=o.low,_=g&1<<31?-1:1;for(a=((2146435072&g)>>20)-I,l=0,i=1<<19,n=1;n<=20;n++)g&i&&(l+=G(2,-n)),i>>>=1;for(i=1<<31,n=21;n<=52;n++)m&i&&(l+=G(2,-n)),i>>>=1;if(a===-1023){if(l===0)return 0*_;a=-1022}else{if(a===1024)return l===0?_/0:NaN;l+=1}return _*l*G(2,a)});var oe=(function(o){function n(i){var a;return u(this,n),(a=s(this,n,[i])).name=Object.keys({RuntimeException:n})[0],a}return v(n,o),h(n)})(H),le=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,null,[{key:"constructor_",value:function(){if(arguments.length===0)oe.constructor_.call(this);else if(arguments.length===1){var i=arguments[0];oe.constructor_.call(this,i)}}}])})(oe),ie=(function(){function o(){u(this,o)}return h(o,null,[{key:"shouldNeverReachHere",value:function(){if(arguments.length===0)o.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new le("Should never reach here"+(n!==null?": "+n:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var n=arguments[0];o.isTrue(n,null)}else if(arguments.length===2){var i=arguments[1];if(!arguments[0])throw i===null?new le:new le(i)}}},{key:"equals",value:function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];o.equals(n,i,null)}else if(arguments.length===3){var a=arguments[0],l=arguments[1],g=arguments[2];if(!l.equals(a))throw new le("Expected "+a+" but encountered "+l+(g!==null?": "+g:""))}}}])})(),ue=new ArrayBuffer(8),ke=new Float64Array(ue),Le=new Int32Array(ue),V=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getM",value:function(){return Z.NaN}},{key:"setOrdinate",value:function(n,i){switch(n){case o.X:this.x=i;break;case o.Y:this.y=i;break;case o.Z:this.setZ(i);break;default:throw new J("Invalid ordinate index: "+n)}}},{key:"equals2D",value:function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var i=arguments[0],a=arguments[1];return!!Y.equalsWithTolerance(this.x,i.x,a)&&!!Y.equalsWithTolerance(this.y,i.y,a)}}},{key:"setM",value:function(n){throw new J("Invalid ordinate index: "+o.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(n){switch(n){case o.X:return this.x;case o.Y:return this.y;case o.Z:return this.getZ()}throw new J("Invalid ordinate index: "+n)}},{key:"equals3D",value:function(n){return this.x===n.x&&this.y===n.y&&(this.getZ()===n.getZ()||Z.isNaN(this.getZ())&&Z.isNaN(n.getZ()))}},{key:"equals",value:function(n){return n instanceof o&&this.equals2D(n)}},{key:"equalInZ",value:function(n,i){return Y.equalsWithTolerance(this.getZ(),n.getZ(),i)}},{key:"setX",value:function(n){this.x=n}},{key:"compareTo",value:function(n){var i=n;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(n){this.z=n}},{key:"clone",value:function(){try{return null}catch(n){if(n instanceof CloneNotSupportedException)return ie.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw n}}},{key:"copy",value:function(){return new o(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(n){var i=this.x-n.x,a=this.y-n.y,l=this.getZ()-n.getZ();return Math.sqrt(i*i+a*a+l*l)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(n){this.y=n}},{key:"distance",value:function(n){var i=this.x-n.x,a=this.y-n.y;return Math.sqrt(i*i+a*a)}},{key:"hashCode",value:function(){var n=17;return n=37*(n=37*n+o.hashCode(this.x))+o.hashCode(this.y)}},{key:"setCoordinate",value:function(n){this.x=n.x,this.y=n.y,this.z=n.getZ()}},{key:"interfaces_",get:function(){return[$,k,w]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)o.constructor_.call(this,0,0);else if(arguments.length===1){var n=arguments[0];o.constructor_.call(this,n.x,n.y,n.getZ())}else if(arguments.length===2){var i=arguments[0],a=arguments[1];o.constructor_.call(this,i,a,o.NULL_ORDINATE)}else if(arguments.length===3){var l=arguments[0],g=arguments[1],m=arguments[2];this.x=l,this.y=g,this.z=m}}},{key:"hashCode",value:function(n){return ke[0]=n,Le[0]^Le[1]}}])})(),Cn=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"compare",value:function(n,i){var a=o.compare(n.x,i.x);if(a!==0)return a;var l=o.compare(n.y,i.y);return l!==0?l:this._dimensionsToTest<=2?0:o.compare(n.getZ(),i.getZ())}},{key:"interfaces_",get:function(){return[ne]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,arguments.length===0)o.constructor_.call(this,2);else if(arguments.length===1){var n=arguments[0];if(n!==2&&n!==3)throw new J("only 2 or 3 dimensions may be specified");this._dimensionsToTest=n}}},{key:"compare",value:function(n,i){return n<i?-1:n>i?1:Z.isNaN(n)?Z.isNaN(i)?0:-1:Z.isNaN(i)?1:0}}])})();V.DimensionalComparator=Cn,V.NULL_ORDINATE=Z.NaN,V.X=0,V.Y=1,V.Z=2,V.M=3;var Se=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(n){if(!(n instanceof o))return!1;var i=n;return this.isNull()?i.isNull():this._maxx===i.getMaxX()&&this._maxy===i.getMaxY()&&this._minx===i.getMinX()&&this._miny===i.getMinY()}},{key:"intersection",value:function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new o;var i=this._minx>n._minx?this._minx:n._minx,a=this._miny>n._miny?this._miny:n._miny;return new o(i,this._maxx<n._maxx?this._maxx:n._maxx,a,this._maxy<n._maxy?this._maxy:n._maxy)}},{key:"isNull",value:function(){return this._maxx<this._minx}},{key:"getMaxX",value:function(){return this._maxx}},{key:"covers",value:function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof o){var i=arguments[0];return!this.isNull()&&!i.isNull()&&i.getMinX()>=this._minx&&i.getMaxX()<=this._maxx&&i.getMinY()>=this._miny&&i.getMaxY()<=this._maxy}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];return!this.isNull()&&a>=this._minx&&a<=this._maxx&&l>=this._miny&&l<=this._maxy}}},{key:"intersects",value:function(){if(arguments.length===1){if(arguments[0]instanceof o){var n=arguments[0];return!this.isNull()&&!n.isNull()&&!(n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny)}if(arguments[0]instanceof V){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){if(arguments[0]instanceof V&&arguments[1]instanceof V){var a=arguments[0],l=arguments[1];return!this.isNull()&&!((a.x<l.x?a.x:l.x)>this._maxx)&&!((a.x>l.x?a.x:l.x)<this._minx)&&!((a.y<l.y?a.y:l.y)>this._maxy)&&!((a.y>l.y?a.y:l.y)<this._miny)}if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var g=arguments[0],m=arguments[1];return!this.isNull()&&!(g>this._maxx||g<this._minx||m>this._maxy||m<this._miny)}}}},{key:"getMinY",value:function(){return this._miny}},{key:"getDiameter",value:function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return Math.sqrt(n*n+i*i)}},{key:"getMinX",value:function(){return this._minx}},{key:"expandToInclude",value:function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof o){var i=arguments[0];if(i.isNull())return null;this.isNull()?(this._minx=i.getMinX(),this._maxx=i.getMaxX(),this._miny=i.getMinY(),this._maxy=i.getMaxY()):(i._minx<this._minx&&(this._minx=i._minx),i._maxx>this._maxx&&(this._maxx=i._maxx),i._miny<this._miny&&(this._miny=i._miny),i._maxy>this._maxy&&(this._maxy=i._maxy))}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.isNull()?(this._minx=a,this._maxx=a,this._miny=l,this._maxy=l):(a<this._minx&&(this._minx=a),a>this._maxx&&(this._maxx=a),l<this._miny&&(this._miny=l),l>this._maxy&&(this._maxy=l))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i}},{key:"getWidth",value:function(){return this.isNull()?0:this._maxx-this._minx}},{key:"compareTo",value:function(n){var i=n;return this.isNull()?i.isNull()?0:-1:i.isNull()?1:this._minx<i._minx?-1:this._minx>i._minx?1:this._miny<i._miny?-1:this._miny>i._miny?1:this._maxx<i._maxx?-1:this._maxx>i._maxx?1:this._maxy<i._maxy?-1:this._maxy>i._maxy?1:0}},{key:"translate",value:function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)}},{key:"copy",value:function(){return new o(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(n){return!(!this.isNull()&&!n.isNull())||n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny}},{key:"getHeight",value:function(){return this.isNull()?0:this._maxy-this._miny}},{key:"maxExtent",value:function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i}},{key:"expandBy",value:function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];if(this.isNull())return null;this._minx-=i,this._maxx+=i,this._miny-=a,this._maxy+=a,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}},{key:"contains",value:function(){if(arguments.length===1){if(arguments[0]instanceof o){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof V){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];return this.covers(a,l)}}},{key:"centre",value:function(){return this.isNull()?null:new V((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof o){var i=arguments[0];this._minx=i._minx,this._maxx=i._maxx,this._miny=i._miny,this._maxy=i._maxy}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.init(a.x,l.x,a.y,l.y)}else if(arguments.length===4){var g=arguments[0],m=arguments[1],_=arguments[2],x=arguments[3];g<m?(this._minx=g,this._maxx=m):(this._minx=m,this._maxx=g),_<x?(this._miny=_,this._maxy=x):(this._miny=x,this._maxy=_)}}},{key:"getMaxY",value:function(){return this._maxy}},{key:"distance",value:function(n){if(this.intersects(n))return 0;var i=0;this._maxx<n._minx?i=n._minx-this._maxx:this._minx>n._maxx&&(i=this._minx-n._maxx);var a=0;return this._maxy<n._miny?a=n._miny-this._maxy:this._miny>n._maxy&&(a=this._miny-n._maxy),i===0?a:a===0?i:Math.sqrt(i*i+a*a)}},{key:"hashCode",value:function(){var n=17;return n=37*(n=37*(n=37*(n=37*n+V.hashCode(this._minx))+V.hashCode(this._maxx))+V.hashCode(this._miny))+V.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[$,w]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof o){var i=arguments[0];this.init(i)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.init(a.x,l.x,a.y,l.y)}else if(arguments.length===4){var g=arguments[0],m=arguments[1],_=arguments[2],x=arguments[3];this.init(g,m,_,x)}}},{key:"intersects",value:function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],a=arguments[2];return a.x>=(n.x<i.x?n.x:i.x)&&a.x<=(n.x>i.x?n.x:i.x)&&a.y>=(n.y<i.y?n.y:i.y)&&a.y<=(n.y>i.y?n.y:i.y)}if(arguments.length===4){var l=arguments[0],g=arguments[1],m=arguments[2],_=arguments[3],x=Math.min(m.x,_.x),M=Math.max(m.x,_.x),j=Math.min(l.x,g.x),X=Math.max(l.x,g.x);return!(j>M)&&!(X<x)&&(x=Math.min(m.y,_.y),M=Math.max(m.y,_.y),j=Math.min(l.y,g.y),X=Math.max(l.y,g.y),!(j>M)&&!(X<x))}}}])})(),fe=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"isGeometryCollection",value:function(){return this.getTypeCode()===o.TYPECODE_GEOMETRYCOLLECTION}},{key:"getFactory",value:function(){return this._factory}},{key:"getGeometryN",value:function(n){return this}},{key:"getArea",value:function(){return 0}},{key:"isRectangle",value:function(){return!1}},{key:"equalsExact",value:function(n){return this===n||this.equalsExact(n,0)}},{key:"geometryChanged",value:function(){this.apply(o.geometryChangedFilter)}},{key:"geometryChangedAction",value:function(){this._envelope=null}},{key:"equalsNorm",value:function(n){return n!==null&&this.norm().equalsExact(n.norm())}},{key:"getLength",value:function(){return 0}},{key:"getNumGeometries",value:function(){return 1}},{key:"compareTo",value:function(){var n;if(arguments.length===1){var i=arguments[0];return n=i,this.getTypeCode()!==n.getTypeCode()?this.getTypeCode()-n.getTypeCode():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(i)}if(arguments.length===2){var a=arguments[0],l=arguments[1];return n=a,this.getTypeCode()!==n.getTypeCode()?this.getTypeCode()-n.getTypeCode():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(a,l)}}},{key:"getUserData",value:function(){return this._userData}},{key:"getSRID",value:function(){return this._SRID}},{key:"getEnvelope",value:function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())}},{key:"checkNotGeometryCollection",value:function(n){if(n.getTypeCode()===o.TYPECODE_GEOMETRYCOLLECTION)throw new J("This method does not support GeometryCollection arguments")}},{key:"equal",value:function(n,i,a){return a===0?n.equals(i):n.distance(i)<=a}},{key:"norm",value:function(){var n=this.copy();return n.normalize(),n}},{key:"reverse",value:function(){var n=this.reverseInternal();return this.envelope!=null&&(n.envelope=this.envelope.copy()),n.setSRID(this.getSRID()),n}},{key:"copy",value:function(){var n=this.copyInternal();return n.envelope=this._envelope==null?null:this._envelope.copy(),n._SRID=this._SRID,n._userData=this._userData,n}},{key:"getPrecisionModel",value:function(){return this._factory.getPrecisionModel()}},{key:"getEnvelopeInternal",value:function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Se(this._envelope)}},{key:"setSRID",value:function(n){this._SRID=n}},{key:"setUserData",value:function(n){this._userData=n}},{key:"compare",value:function(n,i){for(var a=n.iterator(),l=i.iterator();a.hasNext()&&l.hasNext();){var g=a.next(),m=l.next(),_=g.compareTo(m);if(_!==0)return _}return a.hasNext()?1:l.hasNext()?-1:0}},{key:"hashCode",value:function(){return this.getEnvelopeInternal().hashCode()}},{key:"isEquivalentClass",value:function(n){return this.getClass()===n.getClass()}},{key:"isGeometryCollectionOrDerived",value:function(){return this.getTypeCode()===o.TYPECODE_GEOMETRYCOLLECTION||this.getTypeCode()===o.TYPECODE_MULTIPOINT||this.getTypeCode()===o.TYPECODE_MULTILINESTRING||this.getTypeCode()===o.TYPECODE_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[k,$,w]}},{key:"getClass",value:function(){return o}}],[{key:"hasNonEmptyElements",value:function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1}},{key:"hasNullElements",value:function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1}}])})();fe.constructor_=function(o){o&&(this._envelope=null,this._userData=null,this._factory=o,this._SRID=o.getSRID())},fe.TYPECODE_POINT=0,fe.TYPECODE_MULTIPOINT=1,fe.TYPECODE_LINESTRING=2,fe.TYPECODE_LINEARRING=3,fe.TYPECODE_MULTILINESTRING=4,fe.TYPECODE_POLYGON=5,fe.TYPECODE_MULTIPOLYGON=6,fe.TYPECODE_GEOMETRYCOLLECTION=7,fe.TYPENAME_POINT="Point",fe.TYPENAME_MULTIPOINT="MultiPoint",fe.TYPENAME_LINESTRING="LineString",fe.TYPENAME_LINEARRING="LinearRing",fe.TYPENAME_MULTILINESTRING="MultiLineString",fe.TYPENAME_POLYGON="Polygon",fe.TYPENAME_MULTIPOLYGON="MultiPolygon",fe.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",fe.geometryChangedFilter={get interfaces_(){return[z]},filter:function(o){o.geometryChangedAction()}};var A=(function(){function o(){u(this,o)}return h(o,null,[{key:"toLocationSymbol",value:function(n){switch(n){case o.EXTERIOR:return"e";case o.BOUNDARY:return"b";case o.INTERIOR:return"i";case o.NONE:return"-"}throw new J("Unknown location value: "+n)}}])})();A.INTERIOR=0,A.BOUNDARY=1,A.EXTERIOR=2,A.NONE=-1;var Ce=(function(){return h((function o(){u(this,o)}),[{key:"add",value:function(){}},{key:"addAll",value:function(){}},{key:"isEmpty",value:function(){}},{key:"iterator",value:function(){}},{key:"size",value:function(){}},{key:"toArray",value:function(){}},{key:"remove",value:function(){}}])})(),qe=(function(o){function n(i){var a;return u(this,n),(a=s(this,n,[i])).name=Object.keys({NoSuchElementException:n})[0],a}return v(n,o),h(n)})(H),xe=(function(o){function n(i){var a;return u(this,n),(a=s(this,n,[i])).name=Object.keys({UnsupportedOperationException:n})[0],a}return v(n,o),h(n)})(H),fi=(function(o){function n(){return u(this,n),s(this,n,arguments)}return v(n,o),h(n,[{key:"contains",value:function(){}}])})(Ce),Br=(function(o){function n(i){var a;return u(this,n),(a=s(this,n)).map=new Map,i instanceof Ce&&a.addAll(i),a}return v(n,o),h(n,[{key:"contains",value:function(i){var a=i.hashCode?i.hashCode():i;return!!this.map.has(a)}},{key:"add",value:function(i){var a=i.hashCode?i.hashCode():i;return!this.map.has(a)&&!!this.map.set(a,i)}},{key:"addAll",value:function(i){var a,l=d(i);try{for(l.s();!(a=l.n()).done;){var g=a.value;this.add(g)}}catch(m){l.e(m)}finally{l.f()}return!0}},{key:"remove",value:function(){throw new xe}},{key:"size",value:function(){return this.map.size}},{key:"isEmpty",value:function(){return this.map.size===0}},{key:"toArray",value:function(){return Array.from(this.map.values())}},{key:"iterator",value:function(){return new vr(this.map)}},{key:Symbol.iterator,value:function(){return this.map}}])})(fi),vr=(function(){return h((function o(n){u(this,o),this.iterator=n.values();var i=this.iterator.next(),a=i.done,l=i.value;this.done=a,this.value=l}),[{key:"next",value:function(){if(this.done)throw new qe;var o=this.value,n=this.iterator.next(),i=n.done,a=n.value;return this.done=i,this.value=a,o}},{key:"hasNext",value:function(){return!this.done}},{key:"remove",value:function(){throw new xe}}])})(),re=(function(){function o(){u(this,o)}return h(o,null,[{key:"opposite",value:function(n){return n===o.LEFT?o.RIGHT:n===o.RIGHT?o.LEFT:n}}])})();re.ON=0,re.LEFT=1,re.RIGHT=2;var Ur=(function(o){function n(i){var a;return u(this,n),(a=s(this,n,[i])).name=Object.keys({EmptyStackException:n})[0],a}return v(n,o),h(n)})(H),as=(function(o){function n(i){var a;return u(this,n),(a=s(this,n,[i])).name=Object.keys({IndexOutOfBoundsException:n})[0],a}return v(n,o),h(n)})(H),An=(function(o){function n(){return u(this,n),s(this,n,arguments)}return v(n,o),h(n,[{key:"get",value:function(){}},{key:"set",value:function(){}},{key:"isEmpty",value:function(){}}])})(Ce),Go=(function(o){function n(){var i;return u(this,n),(i=s(this,n)).array=[],i}return v(n,o),h(n,[{key:"add",value:function(i){return this.array.push(i),!0}},{key:"get",value:function(i){if(i<0||i>=this.size())throw new as;return this.array[i]}},{key:"push",value:function(i){return this.array.push(i),i}},{key:"pop",value:function(){if(this.array.length===0)throw new Ur;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new Ur;return this.array[this.array.length-1]}},{key:"empty",value:function(){return this.array.length===0}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(i){return this.array.indexOf(i)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}])})(An);function _e(o,n){return o.interfaces_&&o.interfaces_.indexOf(n)>-1}var hn=(function(){return h((function o(n){u(this,o),this.str=n}),[{key:"append",value:function(o){this.str+=o}},{key:"setCharAt",value:function(o,n){this.str=this.str.substr(0,o)+n+this.str.substr(o+1)}},{key:"toString",value:function(){return this.str}}])})(),fn=(function(){function o(n){u(this,o),this.value=n}return h(o,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(n){return this.value<n?-1:this.value>n?1:0}}],[{key:"compare",value:function(n,i){return n<i?-1:n>i?1:0}},{key:"isNan",value:function(n){return Number.isNaN(n)}},{key:"valueOf",value:function(n){return new o(n)}}])})(),Tt=(function(){return h((function o(){u(this,o)}),null,[{key:"isWhitespace",value:function(o){return o<=32&&o>=0||o===127}},{key:"toUpperCase",value:function(o){return o.toUpperCase()}}])})(),me=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"le",value:function(n){return this._hi<n._hi||this._hi===n._hi&&this._lo<=n._lo}},{key:"extractSignificantDigits",value:function(n,i){var a=this.abs(),l=o.magnitude(a._hi),g=o.TEN.pow(l);(a=a.divide(g)).gt(o.TEN)?(a=a.divide(o.TEN),l+=1):a.lt(o.ONE)&&(a=a.multiply(o.TEN),l-=1);for(var m=l+1,_=new hn,x=o.MAX_PRINT_DIGITS-1,M=0;M<=x;M++){n&&M===m&&_.append(".");var j=Math.trunc(a._hi);if(j<0)break;var X=!1,K=0;j>9?(X=!0,K="9"):K="0"+j,_.append(K),a=a.subtract(o.valueOf(j)).multiply(o.TEN),X&&a.selfAdd(o.TEN);var ce=!0,ge=o.magnitude(a._hi);if(ge<0&&Math.abs(ge)>=x-M&&(ce=!1),!ce)break}return i[0]=l,_.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof o){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof o){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof o){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(n){return this.le(n)?this:n}},{key:"selfDivide",value:function(){if(arguments.length===1){if(arguments[0]instanceof o){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var a,l,g,m,_=arguments[0],x=arguments[1],M=null,j=null,X=null,K=null;return g=this._hi/_,K=(M=(X=o.SPLIT*g)-(M=X-g))*(j=(K=o.SPLIT*_)-(j=K-_))-(m=g*_)+M*(l=_-j)+(a=g-M)*j+a*l,K=g+(X=(this._hi-m-K+this._lo-g*x)/_),this._hi=K,this._lo=g-K+X,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof o){var n,i,a,l,g=arguments[0],m=null,_=null,x=null,M=null;return n=(a=this._hi/g._hi)-(m=(x=o.SPLIT*a)-(m=x-a)),M=m*(_=(M=o.SPLIT*g._hi)-(_=M-g._hi))-(l=a*g._hi)+m*(i=g._hi-_)+n*_+n*i,new o(M=a+(x=(this._hi-l-M+this._lo-a*g._lo)/g._hi),a-M+x)}if(typeof arguments[0]=="number"){var j=arguments[0];return Z.isNaN(j)?o.createNaN():o.copy(this).selfDivide(j,0)}}},{key:"ge",value:function(n){return this._hi>n._hi||this._hi===n._hi&&this._lo>=n._lo}},{key:"pow",value:function(n){if(n===0)return o.valueOf(1);var i=new o(this),a=o.valueOf(1),l=Math.abs(n);if(l>1)for(;l>0;)l%2==1&&a.selfMultiply(i),(l/=2)>0&&(i=i.sqr());else a=i;return n<0?a.reciprocal():a}},{key:"ceil",value:function(){if(this.isNaN())return o.NaN;var n=Math.ceil(this._hi),i=0;return n===this._hi&&(i=Math.ceil(this._lo)),new o(n,i)}},{key:"compareTo",value:function(n){var i=n;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof o){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}}},{key:"max",value:function(n){return this.ge(n)?this:n}},{key:"sqrt",value:function(){if(this.isZero())return o.valueOf(0);if(this.isNegative())return o.NaN;var n=1/Math.sqrt(this._hi),i=this._hi*n,a=o.valueOf(i),l=this.subtract(a.sqr())._hi*(.5*n);return a.add(l)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof o){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i,a,l,g,m,_=arguments[0],x=null;return x=(l=this._hi+_)-(g=l-this._hi),a=(m=(x=_-g+(this._hi-x))+this._lo)+(l-(i=l+m)),this._hi=i+a,this._lo=a+(i-this._hi),this}}else if(arguments.length===2){var M,j,X,K,ce=arguments[0],ge=arguments[1],pe=null,Me=null,Ie=null;X=this._hi+ce,j=this._lo+ge,Me=X-(Ie=X-this._hi),pe=j-(K=j-this._lo);var Fe=(M=X+(Ie=(Me=ce-Ie+(this._hi-Me))+j))+(Ie=(pe=ge-K+(this._lo-pe))+(Ie+(X-M))),ht=Ie+(M-Fe);return this._hi=Fe,this._lo=ht,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof o){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var a,l,g=arguments[0],m=arguments[1],_=null,x=null,M=null,j=null;_=(M=o.SPLIT*this._hi)-this._hi,j=o.SPLIT*g,_=M-_,a=this._hi-_,x=j-g;var X=(M=this._hi*g)+(j=_*(x=j-x)-M+_*(l=g-x)+a*x+a*l+(this._hi*m+this._lo*g)),K=j+(_=M-X);return this._hi=X,this._lo=K,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return o.NaN;var n=Math.floor(this._hi),i=0;return n===this._hi&&(i=Math.floor(this._lo)),new o(n,i)}},{key:"negate",value:function(){return this.isNaN()?this:new o(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(n){if(n instanceof CloneNotSupportedException)return null;throw n}}},{key:"multiply",value:function(){if(arguments[0]instanceof o){var n=arguments[0];return n.isNaN()?o.createNaN():o.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return Z.isNaN(i)?o.createNaN():o.copy(this).selfMultiply(i,0)}}},{key:"isNaN",value:function(){return Z.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var n=o.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),a=this.extractSignificantDigits(!0,i),l=i[0]+1,g=a;if(a.charAt(0)===".")g="0"+a;else if(l<0)g="0."+o.stringOfChar("0",-l)+a;else if(a.indexOf(".")===-1){var m=l-a.length;g=a+o.stringOfChar("0",m)+".0"}return this.isNegative()?"-"+g:g}},{key:"reciprocal",value:function(){var n,i,a,l,g=null,m=null,_=null,x=null;n=(a=1/this._hi)-(g=(_=o.SPLIT*a)-(g=_-a)),m=(x=o.SPLIT*this._hi)-this._hi;var M=a+(_=(1-(l=a*this._hi)-(x=g*(m=x-m)-l+g*(i=this._hi-m)+n*m+n*i)-a*this._lo)/this._hi);return new o(M,a-M+_)}},{key:"toSciNotation",value:function(){if(this.isZero())return o.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),a=this.extractSignificantDigits(!1,i),l=o.SCI_NOT_EXPONENT_CHAR+i[0];if(a.charAt(0)==="0")throw new IllegalStateException("Found leading zero: "+a);var g="";a.length>1&&(g=a.substring(1));var m=a.charAt(0)+"."+g;return this.isNegative()?"-"+m+l:m+l}},{key:"abs",value:function(){return this.isNaN()?o.NaN:this.isNegative()?this.negate():new o(this)}},{key:"isPositive",value:function(){return this._hi>0||this._hi===0&&this._lo>0}},{key:"lt",value:function(n){return this._hi<n._hi||this._hi===n._hi&&this._lo<n._lo}},{key:"add",value:function(){if(arguments[0]instanceof o){var n=arguments[0];return o.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return o.copy(this).selfAdd(i)}}},{key:"init",value:function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this._hi=n,this._lo=0}else if(arguments[0]instanceof o){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this._hi=a,this._lo=l}}},{key:"gt",value:function(n){return this._hi>n._hi||this._hi===n._hi&&this._lo>n._lo}},{key:"isNegative",value:function(){return this._hi<0||this._hi===0&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?o.NaN:this.isPositive()?this.floor():this.ceil()}},{key:"signum",value:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}},{key:"interfaces_",get:function(){return[w,$,k]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this.init(n)}else if(arguments[0]instanceof o){var i=arguments[0];this.init(i)}else if(typeof arguments[0]=="string"){var a=arguments[0];o.constructor_.call(this,o.parse(a))}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this.init(l,g)}}},{key:"determinant",value:function(){if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1],a=arguments[2],l=arguments[3];return o.determinant(o.valueOf(n),o.valueOf(i),o.valueOf(a),o.valueOf(l))}if(arguments[3]instanceof o&&arguments[2]instanceof o&&arguments[0]instanceof o&&arguments[1]instanceof o){var g=arguments[1],m=arguments[2],_=arguments[3];return arguments[0].multiply(_).selfSubtract(g.multiply(m))}}},{key:"sqr",value:function(n){return o.valueOf(n).selfMultiply(n)}},{key:"valueOf",value:function(){if(typeof arguments[0]=="string"){var n=arguments[0];return o.parse(n)}if(typeof arguments[0]=="number")return new o(arguments[0])}},{key:"sqrt",value:function(n){return o.valueOf(n).sqrt()}},{key:"parse",value:function(n){for(var i=0,a=n.length;Tt.isWhitespace(n.charAt(i));)i++;var l=!1;if(i<a){var g=n.charAt(i);g!=="-"&&g!=="+"||(i++,g==="-"&&(l=!0))}for(var m=new o,_=0,x=0,M=0,j=!1;!(i>=a);){var X=n.charAt(i);if(i++,Tt.isDigit(X)){var K=X-"0";m.selfMultiply(o.TEN),m.selfAdd(K),_++}else{if(X!=="."){if(X==="e"||X==="E"){var ce=n.substring(i);try{M=fn.parseInt(ce)}catch(Fe){throw Fe instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+ce+" in string "+n):Fe}break}throw new NumberFormatException("Unexpected character '"+X+"' at position "+i+" in string "+n)}x=_,j=!0}}var ge=m;j||(x=_);var pe=_-x-M;if(pe===0)ge=m;else if(pe>0){var Me=o.TEN.pow(pe);ge=m.divide(Me)}else if(pe<0){var Ie=o.TEN.pow(-pe);ge=m.multiply(Ie)}return l?ge.negate():ge}},{key:"createNaN",value:function(){return new o(Z.NaN,Z.NaN)}},{key:"copy",value:function(n){return new o(n)}},{key:"magnitude",value:function(n){var i=Math.abs(n),a=Math.log(i)/Math.log(10),l=Math.trunc(Math.floor(a));return 10*Math.pow(10,l)<=i&&(l+=1),l}},{key:"stringOfChar",value:function(n,i){for(var a=new hn,l=0;l<i;l++)a.append(n);return a.toString()}}])})();me.PI=new me(3.141592653589793,12246467991473532e-32),me.TWO_PI=new me(6.283185307179586,24492935982947064e-32),me.PI_2=new me(1.5707963267948966,6123233995736766e-32),me.E=new me(2.718281828459045,14456468917292502e-32),me.NaN=new me(Z.NaN,Z.NaN),me.EPS=123259516440783e-46,me.SPLIT=134217729,me.MAX_PRINT_DIGITS=32,me.TEN=me.valueOf(10),me.ONE=me.valueOf(1),me.SCI_NOT_EXPONENT_CHAR="E",me.SCI_NOT_ZERO="0.0E0";var gi=(function(){function o(){u(this,o)}return h(o,null,[{key:"orientationIndex",value:function(n,i,a){var l=o.orientationIndexFilter(n,i,a);if(l<=1)return l;var g=me.valueOf(i.x).selfAdd(-n.x),m=me.valueOf(i.y).selfAdd(-n.y),_=me.valueOf(a.x).selfAdd(-i.x),x=me.valueOf(a.y).selfAdd(-i.y);return g.selfMultiply(x).selfSubtract(m.selfMultiply(_)).signum()}},{key:"signOfDet2x2",value:function(){if(arguments[3]instanceof me&&arguments[2]instanceof me&&arguments[0]instanceof me&&arguments[1]instanceof me){var n=arguments[1],i=arguments[2],a=arguments[3];return arguments[0].multiply(a).selfSubtract(n.multiply(i)).signum()}if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var l=arguments[0],g=arguments[1],m=arguments[2],_=arguments[3],x=me.valueOf(l),M=me.valueOf(g),j=me.valueOf(m),X=me.valueOf(_);return x.multiply(X).selfSubtract(M.multiply(j)).signum()}}},{key:"intersection",value:function(n,i,a,l){var g=new me(n.y).selfSubtract(i.y),m=new me(i.x).selfSubtract(n.x),_=new me(n.x).selfMultiply(i.y).selfSubtract(new me(i.x).selfMultiply(n.y)),x=new me(a.y).selfSubtract(l.y),M=new me(l.x).selfSubtract(a.x),j=new me(a.x).selfMultiply(l.y).selfSubtract(new me(l.x).selfMultiply(a.y)),X=m.multiply(j).selfSubtract(M.multiply(_)),K=x.multiply(_).selfSubtract(g.multiply(j)),ce=g.multiply(M).selfSubtract(x.multiply(m)),ge=X.selfDivide(ce).doubleValue(),pe=K.selfDivide(ce).doubleValue();return Z.isNaN(ge)||Z.isInfinite(ge)||Z.isNaN(pe)||Z.isInfinite(pe)?null:new V(ge,pe)}},{key:"orientationIndexFilter",value:function(n,i,a){var l=null,g=(n.x-a.x)*(i.y-a.y),m=(n.y-a.y)*(i.x-a.x),_=g-m;if(g>0){if(m<=0)return o.signum(_);l=g+m}else{if(!(g<0)||m>=0)return o.signum(_);l=-g-m}var x=o.DP_SAFE_EPSILON*l;return _>=x||-_>=x?o.signum(_):2}},{key:"signum",value:function(n){return n>0?1:n<0?-1:0}}])})();gi.DP_SAFE_EPSILON=1e-15;var be=(function(){return h((function o(){u(this,o)}),[{key:"getM",value:function(o){if(this.hasM()){var n=this.getDimension()-this.getMeasures();return this.getOrdinate(o,n)}return Z.NaN}},{key:"setOrdinate",value:function(o,n,i){}},{key:"getZ",value:function(o){return this.hasZ()?this.getOrdinate(o,2):Z.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(o,n){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(o){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(o){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(o){}},{key:"copy",value:function(){}},{key:"getY",value:function(o){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[k]}}])})();be.X=0,be.Y=1,be.Z=2,be.M=3;var ve=(function(){function o(){u(this,o)}return h(o,null,[{key:"index",value:function(n,i,a){return gi.orientationIndex(n,i,a)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var n=arguments[0],i=n.length-1;if(i<3)throw new J("Ring has fewer than 4 points, so orientation cannot be determined");for(var a=n[0],l=0,g=1;g<=i;g++){var m=n[g];m.y>a.y&&(a=m,l=g)}var _=l;do(_-=1)<0&&(_=i);while(n[_].equals2D(a)&&_!==l);var x=l;do x=(x+1)%i;while(n[x].equals2D(a)&&x!==l);var M=n[_],j=n[x];if(M.equals2D(a)||j.equals2D(a)||M.equals2D(j))return!1;var X=o.index(M,a,j);return X===0?M.x>j.x:X>0}if(_e(arguments[0],be)){var K=arguments[0],ce=K.size()-1;if(ce<3)throw new J("Ring has fewer than 4 points, so orientation cannot be determined");for(var ge=K.getCoordinate(0),pe=0,Me=1;Me<=ce;Me++){var Ie=K.getCoordinate(Me);Ie.y>ge.y&&(ge=Ie,pe=Me)}var Fe=null,ht=pe;do(ht-=1)<0&&(ht=ce),Fe=K.getCoordinate(ht);while(Fe.equals2D(ge)&&ht!==pe);var dt=null,Hr=pe;do Hr=(Hr+1)%ce,dt=K.getCoordinate(Hr);while(dt.equals2D(ge)&&Hr!==pe);if(Fe.equals2D(ge)||dt.equals2D(ge)||Fe.equals2D(dt))return!1;var gs=o.index(Fe,ge,dt);return gs===0?Fe.x>dt.x:gs>0}}}])})();ve.CLOCKWISE=-1,ve.RIGHT=ve.CLOCKWISE,ve.COUNTERCLOCKWISE=1,ve.LEFT=ve.COUNTERCLOCKWISE,ve.COLLINEAR=0,ve.STRAIGHT=ve.COLLINEAR;var ua=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(o,n){var i=this.getRightmostSideOfSegment(o,n);return i<0&&(i=this.getRightmostSideOfSegment(o,n-1)),i<0&&(this._minCoord=null,this.checkForRightmostCoordinate(o)),i}},{key:"findRightmostEdgeAtVertex",value:function(){var o=this._minDe.getEdge().getCoordinates();ie.isTrue(this._minIndex>0&&this._minIndex<o.length,"rightmost point expected to be interior vertex of edge");var n=o[this._minIndex-1],i=o[this._minIndex+1],a=ve.index(this._minCoord,i,n),l=!1;(n.y<this._minCoord.y&&i.y<this._minCoord.y&&a===ve.COUNTERCLOCKWISE||n.y>this._minCoord.y&&i.y>this._minCoord.y&&a===ve.CLOCKWISE)&&(l=!0),l&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(o,n){var i=o.getEdge().getCoordinates();if(n<0||n+1>=i.length||i[n].y===i[n+1].y)return-1;var a=re.LEFT;return i[n].y<i[n+1].y&&(a=re.RIGHT),a}},{key:"getEdge",value:function(){return this._orientedDe}},{key:"checkForRightmostCoordinate",value:function(o){for(var n=o.getEdge().getCoordinates(),i=0;i<n.length-1;i++)(this._minCoord===null||n[i].x>this._minCoord.x)&&(this._minDe=o,this._minIndex=i,this._minCoord=n[i])}},{key:"findRightmostEdgeAtNode",value:function(){var o=this._minDe.getNode().getEdges();this._minDe=o.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(o){for(var n=o.iterator();n.hasNext();){var i=n.next();i.isForward()&&this.checkForRightmostCoordinate(i)}ie.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===re.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}])})(),Pt=(function(o){function n(i,a){var l;return u(this,n),(l=s(this,n,[a?i+" [ "+a+" ]":i])).pt=a?new V(a):void 0,l.name=Object.keys({TopologyException:n})[0],l}return v(n,o),h(n,[{key:"getCoordinate",value:function(){return this.pt}}])})(oe),di=(function(){return h((function o(){u(this,o),this.array=[]}),[{key:"addLast",value:function(o){this.array.push(o)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}])})(),de=(function(o){function n(i){var a;return u(this,n),(a=s(this,n)).array=[],i instanceof Ce&&a.addAll(i),a}return v(n,o),h(n,[{key:"interfaces_",get:function(){return[An,Ce]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(i){return arguments.length===1?this.array.push(i):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(i){var a,l=d(i);try{for(l.s();!(a=l.n()).done;){var g=a.value;this.array.push(g)}}catch(m){l.e(m)}finally{l.f()}}},{key:"set",value:function(i,a){var l=this.array[i];return this.array[i]=a,l}},{key:"iterator",value:function(){return new yr(this)}},{key:"get",value:function(i){if(i<0||i>=this.size())throw new as;return this.array[i]}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"sort",value:function(i){i?this.array.sort((function(a,l){return i.compare(a,l)})):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(i){for(var a=0,l=this.array.length;a<l;a++)if(this.array[a]===i)return!!this.array.splice(a,1);return!1}},{key:Symbol.iterator,value:function(){return this.array.values()}}])})(An),yr=(function(){return h((function o(n){u(this,o),this.arrayList=n,this.position=0}),[{key:"next",value:function(){if(this.position===this.arrayList.size())throw new qe;return this.arrayList.get(this.position++)}},{key:"hasNext",value:function(){return this.position<this.arrayList.size()}},{key:"set",value:function(o){return this.arrayList.set(this.position-1,o)}},{key:"remove",value:function(){this.arrayList.remove(this.arrayList.get(this.position))}}])})(),os=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"clearVisitedEdges",value:function(){for(var o=this._dirEdgeList.iterator();o.hasNext();)o.next().setVisited(!1)}},{key:"getRightmostCoordinate",value:function(){return this._rightMostCoord}},{key:"computeNodeDepth",value:function(o){for(var n=null,i=o.getEdges().iterator();i.hasNext();){var a=i.next();if(a.isVisited()||a.getSym().isVisited()){n=a;break}}if(n===null)throw new Pt("unable to find edge to compute depths at "+o.getCoordinate());o.getEdges().computeDepths(n);for(var l=o.getEdges().iterator();l.hasNext();){var g=l.next();g.setVisited(!0),this.copySymDepths(g)}}},{key:"computeDepth",value:function(o){this.clearVisitedEdges();var n=this._finder.getEdge();n.getNode(),n.getLabel(),n.setEdgeDepths(re.RIGHT,o),this.copySymDepths(n),this.computeDepths(n)}},{key:"create",value:function(o){this.addReachable(o),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}},{key:"findResultEdges",value:function(){for(var o=this._dirEdgeList.iterator();o.hasNext();){var n=o.next();n.getDepth(re.RIGHT)>=1&&n.getDepth(re.LEFT)<=0&&!n.isInteriorAreaEdge()&&n.setInResult(!0)}}},{key:"computeDepths",value:function(o){var n=new Br,i=new di,a=o.getNode();for(i.addLast(a),n.add(a),o.setVisited(!0);!i.isEmpty();){var l=i.removeFirst();n.add(l),this.computeNodeDepth(l);for(var g=l.getEdges().iterator();g.hasNext();){var m=g.next().getSym();if(!m.isVisited()){var _=m.getNode();n.contains(_)||(i.addLast(_),n.add(_))}}}}},{key:"compareTo",value:function(o){var n=o;return this._rightMostCoord.x<n._rightMostCoord.x?-1:this._rightMostCoord.x>n._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var o=new Se,n=this._dirEdgeList.iterator();n.hasNext();)for(var i=n.next().getEdge().getCoordinates(),a=0;a<i.length-1;a++)o.expandToInclude(i[a]);this._env=o}return this._env}},{key:"addReachable",value:function(o){var n=new Go;for(n.add(o);!n.empty();){var i=n.pop();this.add(i,n)}}},{key:"copySymDepths",value:function(o){var n=o.getSym();n.setDepth(re.LEFT,o.getDepth(re.RIGHT)),n.setDepth(re.RIGHT,o.getDepth(re.LEFT))}},{key:"add",value:function(o,n){o.setVisited(!0),this._nodes.add(o);for(var i=o.getEdges().iterator();i.hasNext();){var a=i.next();this._dirEdgeList.add(a);var l=a.getSym().getNode();l.isVisited()||n.push(l)}}},{key:"getNodes",value:function(){return this._nodes}},{key:"getDirectedEdges",value:function(){return this._dirEdgeList}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._finder=null,this._dirEdgeList=new de,this._nodes=new de,this._rightMostCoord=null,this._env=null,this._finder=new ua}}])})(),jr=(function(){return h((function o(){u(this,o)}),null,[{key:"intersection",value:function(o,n,i,a){var l=o.x<n.x?o.x:n.x,g=o.y<n.y?o.y:n.y,m=o.x>n.x?o.x:n.x,_=o.y>n.y?o.y:n.y,x=i.x<a.x?i.x:a.x,M=i.y<a.y?i.y:a.y,j=i.x>a.x?i.x:a.x,X=i.y>a.y?i.y:a.y,K=((l>x?l:x)+(m<j?m:j))/2,ce=((g>M?g:M)+(_<X?_:X))/2,ge=o.x-K,pe=o.y-ce,Me=n.x-K,Ie=n.y-ce,Fe=i.x-K,ht=i.y-ce,dt=a.x-K,Hr=a.y-ce,gs=pe-Ie,qc=Me-ge,Yc=ge*Ie-Me*pe,zc=ht-Hr,Jc=dt-Fe,Hc=Fe*Hr-dt*ht,Vc=gs*Jc-zc*qc,Wo=(qc*Hc-Jc*Yc)/Vc,Zo=(zc*Yc-gs*Hc)/Vc;return Z.isNaN(Wo)||Z.isInfinite(Wo)||Z.isNaN(Zo)||Z.isInfinite(Zo)?null:new V(Wo+K,Zo+ce)}}])})(),Ot=(function(){return h((function o(){u(this,o)}),null,[{key:"arraycopy",value:function(o,n,i,a,l){for(var g=0,m=n;m<n+l;m++)i[a+g]=o[m],g++}},{key:"getProperty",value:function(o){return{"line.separator":`
|
|
126
|
+
`}[o]}}])})(),Tn=(function(){function o(){u(this,o)}return h(o,null,[{key:"log10",value:function(n){var i=Math.log(n);return Z.isInfinite(i)||Z.isNaN(i)?i:i/o.LOG_10}},{key:"min",value:function(n,i,a,l){var g=n;return i<g&&(g=i),a<g&&(g=a),l<g&&(g=l),g}},{key:"clamp",value:function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1],a=arguments[2];return n<i?i:n>a?a:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var l=arguments[0],g=arguments[1],m=arguments[2];return l<g?g:l>m?m:l}}},{key:"wrap",value:function(n,i){return n<0?i- -n%i:n%i}},{key:"max",value:function(){if(arguments.length===3){var n=arguments[1],i=arguments[2],a=arguments[0];return n>a&&(a=n),i>a&&(a=i),a}if(arguments.length===4){var l=arguments[1],g=arguments[2],m=arguments[3],_=arguments[0];return l>_&&(_=l),g>_&&(_=g),m>_&&(_=m),_}}},{key:"average",value:function(n,i){return(n+i)/2}}])})();Tn.LOG_10=Math.log(10);var yt=(function(){function o(){u(this,o)}return h(o,null,[{key:"segmentToSegment",value:function(n,i,a,l){if(n.equals(i))return o.pointToSegment(n,a,l);if(a.equals(l))return o.pointToSegment(l,n,i);var g=!1;if(Se.intersects(n,i,a,l)){var m=(i.x-n.x)*(l.y-a.y)-(i.y-n.y)*(l.x-a.x);if(m===0)g=!0;else{var _=(n.y-a.y)*(l.x-a.x)-(n.x-a.x)*(l.y-a.y),x=((n.y-a.y)*(i.x-n.x)-(n.x-a.x)*(i.y-n.y))/m,M=_/m;(M<0||M>1||x<0||x>1)&&(g=!0)}}else g=!0;return g?Tn.min(o.pointToSegment(n,a,l),o.pointToSegment(i,a,l),o.pointToSegment(a,n,i),o.pointToSegment(l,n,i)):0}},{key:"pointToSegment",value:function(n,i,a){if(i.x===a.x&&i.y===a.y)return n.distance(i);var l=(a.x-i.x)*(a.x-i.x)+(a.y-i.y)*(a.y-i.y),g=((n.x-i.x)*(a.x-i.x)+(n.y-i.y)*(a.y-i.y))/l;if(g<=0)return n.distance(i);if(g>=1)return n.distance(a);var m=((i.y-n.y)*(a.x-i.x)-(i.x-n.x)*(a.y-i.y))/l;return Math.abs(m)*Math.sqrt(l)}},{key:"pointToLinePerpendicular",value:function(n,i,a){var l=(a.x-i.x)*(a.x-i.x)+(a.y-i.y)*(a.y-i.y),g=((i.y-n.y)*(a.x-i.x)-(i.x-n.x)*(a.y-i.y))/l;return Math.abs(g)*Math.sqrt(l)}},{key:"pointToSegmentString",value:function(n,i){if(i.length===0)throw new J("Line array must contain at least one vertex");for(var a=n.distance(i[0]),l=0;l<i.length-1;l++){var g=o.pointToSegment(n,i[l],i[l+1]);g<a&&(a=g)}return a}}])})(),la=(function(){return h((function o(){u(this,o)}),[{key:"create",value:function(){if(arguments.length===1)arguments[0]instanceof Array||_e(arguments[0],be);else if(arguments.length!==2&&arguments.length===3){var o=arguments[0],n=arguments[1];return this.create(o,n)}}}])})(),Pn=(function(){return h((function o(){u(this,o)}),[{key:"filter",value:function(o){}}])})(),Bo=(function(){return h((function o(){u(this,o)}),null,[{key:"ofLine",value:function(o){var n=o.size();if(n<=1)return 0;var i=0,a=new V;o.getCoordinate(0,a);for(var l=a.x,g=a.y,m=1;m<n;m++){o.getCoordinate(m,a);var _=a.x,x=a.y,M=_-l,j=x-g;i+=Math.sqrt(M*M+j*j),l=_,g=x}return i}}])})(),ca=h((function o(){u(this,o)})),De=(function(){function o(){u(this,o)}return h(o,null,[{key:"copyCoord",value:function(n,i,a,l){for(var g=Math.min(n.getDimension(),a.getDimension()),m=0;m<g;m++)a.setOrdinate(l,m,n.getOrdinate(i,m))}},{key:"isRing",value:function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,be.X)===n.getOrdinate(i-1,be.X)&&n.getOrdinate(0,be.Y)===n.getOrdinate(i-1,be.Y)}},{key:"scroll",value:function(){if(arguments.length===2){if(_e(arguments[0],be)&&Number.isInteger(arguments[1])){var n=arguments[0],i=arguments[1];o.scroll(n,i,o.isRing(n))}else if(_e(arguments[0],be)&&arguments[1]instanceof V){var a=arguments[0],l=arguments[1],g=o.indexOf(l,a);if(g<=0)return null;o.scroll(a,g)}}else if(arguments.length===3){var m=arguments[0],_=arguments[1],x=arguments[2];if(_<=0)return null;for(var M=m.copy(),j=x?m.size()-1:m.size(),X=0;X<j;X++)for(var K=0;K<m.getDimension();K++)m.setOrdinate(X,K,M.getOrdinate((_+X)%j,K));if(x)for(var ce=0;ce<m.getDimension();ce++)m.setOrdinate(j,ce,m.getOrdinate(0,ce))}}},{key:"isEqual",value:function(n,i){var a=n.size();if(a!==i.size())return!1;for(var l=Math.min(n.getDimension(),i.getDimension()),g=0;g<a;g++)for(var m=0;m<l;m++){var _=n.getOrdinate(g,m),x=i.getOrdinate(g,m);if(n.getOrdinate(g,m)!==i.getOrdinate(g,m)&&(!Z.isNaN(_)||!Z.isNaN(x)))return!1}return!0}},{key:"minCoordinateIndex",value:function(){if(arguments.length===1){var n=arguments[0];return o.minCoordinateIndex(n,0,n.size()-1)}if(arguments.length===3){for(var i=arguments[0],a=arguments[2],l=-1,g=null,m=arguments[1];m<=a;m++){var _=i.getCoordinate(m);(g===null||g.compareTo(_)>0)&&(g=_,l=m)}return l}}},{key:"extend",value:function(n,i,a){var l=n.create(a,i.getDimension()),g=i.size();if(o.copy(i,0,l,0,g),g>0)for(var m=g;m<a;m++)o.copy(i,g-1,l,m,1);return l}},{key:"reverse",value:function(n){for(var i=n.size()-1,a=Math.trunc(i/2),l=0;l<=a;l++)o.swap(n,l,i-l)}},{key:"swap",value:function(n,i,a){if(i===a)return null;for(var l=0;l<n.getDimension();l++){var g=n.getOrdinate(i,l);n.setOrdinate(i,l,n.getOrdinate(a,l)),n.setOrdinate(a,l,g)}}},{key:"copy",value:function(n,i,a,l,g){for(var m=0;m<g;m++)o.copyCoord(n,i+m,a,l+m)}},{key:"ensureValidRing",value:function(n,i){var a=i.size();return a===0?i:a<=3?o.createClosedRing(n,i,4):i.getOrdinate(0,be.X)===i.getOrdinate(a-1,be.X)&&i.getOrdinate(0,be.Y)===i.getOrdinate(a-1,be.Y)?i:o.createClosedRing(n,i,a+1)}},{key:"indexOf",value:function(n,i){for(var a=0;a<i.size();a++)if(n.x===i.getOrdinate(a,be.X)&&n.y===i.getOrdinate(a,be.Y))return a;return-1}},{key:"createClosedRing",value:function(n,i,a){var l=n.create(a,i.getDimension()),g=i.size();o.copy(i,0,l,0,g);for(var m=g;m<a;m++)o.copy(i,0,l,m,1);return l}},{key:"minCoordinate",value:function(n){for(var i=null,a=0;a<n.size();a++){var l=n.getCoordinate(a);(i===null||i.compareTo(l)>0)&&(i=l)}return i}}])})(),se=(function(){function o(){u(this,o)}return h(o,null,[{key:"toDimensionSymbol",value:function(n){switch(n){case o.FALSE:return o.SYM_FALSE;case o.TRUE:return o.SYM_TRUE;case o.DONTCARE:return o.SYM_DONTCARE;case o.P:return o.SYM_P;case o.L:return o.SYM_L;case o.A:return o.SYM_A}throw new J("Unknown dimension value: "+n)}},{key:"toDimensionValue",value:function(n){switch(Tt.toUpperCase(n)){case o.SYM_FALSE:return o.FALSE;case o.SYM_TRUE:return o.TRUE;case o.SYM_DONTCARE:return o.DONTCARE;case o.SYM_P:return o.P;case o.SYM_L:return o.L;case o.SYM_A:return o.A}throw new J("Unknown dimension symbol: "+n)}}])})();se.P=0,se.L=1,se.A=2,se.FALSE=-1,se.TRUE=-2,se.DONTCARE=-3,se.SYM_FALSE="F",se.SYM_TRUE="T",se.SYM_DONTCARE="*",se.SYM_P="0",se.SYM_L="1",se.SYM_A="2";var pi=(function(){return h((function o(){u(this,o)}),[{key:"filter",value:function(o){}}])})(),qr=(function(){return h((function o(){u(this,o)}),[{key:"filter",value:function(o,n){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}])})(),Qn=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new Se:this._points.expandEnvelope(new Se)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new n(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof fe){var i=arguments[0],a=arguments[1];if(!this.isEquivalentClass(i))return!1;var l=i;if(this._points.size()!==l._points.size())return!1;for(var g=0;g<this._points.size();g++)if(!this.equal(this._points.getCoordinate(g),l._points.getCoordinate(g),a))return!1;return!0}return b(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var i=0;i<Math.trunc(this._points.size()/2);i++){var a=this._points.size()-1-i;if(!this._points.getCoordinate(i).equals(this._points.getCoordinate(a))){if(this._points.getCoordinate(i).compareTo(this._points.getCoordinate(a))>0){var l=this._points.copy();De.reverse(l),this._points=l}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?se.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var i=this._points.copy();return De.reverse(i),this.getFactory().createLineString(i)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return fe.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return Bo.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var i=arguments[0],a=0,l=0;a<this._points.size()&&l<i._points.size();){var g=this._points.getCoordinate(a).compareTo(i._points.getCoordinate(l));if(g!==0)return g;a++,l++}return a<this._points.size()?1:l<i._points.size()?-1:0}if(arguments.length===2){var m=arguments[0];return arguments[1].compare(this._points,m._points)}}},{key:"apply",value:function(){if(_e(arguments[0],Pn))for(var i=arguments[0],a=0;a<this._points.size();a++)i.filter(this._points.getCoordinate(a));else if(_e(arguments[0],qr)){var l=arguments[0];if(this._points.size()===0)return null;for(var g=0;g<this._points.size()&&(l.filter(this._points,g),!l.isDone());g++);l.isGeometryChanged()&&this.geometryChanged()}else _e(arguments[0],pi)?arguments[0].filter(this):_e(arguments[0],z)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){throw new xe}},{key:"isEquivalentClass",value:function(i){return i instanceof n}},{key:"getCoordinateN",value:function(i){return this._points.getCoordinate(i)}},{key:"getGeometryType",value:function(){return fe.TYPENAME_LINESTRING}},{key:"getCoordinateSequence",value:function(){return this._points}},{key:"isEmpty",value:function(){return this._points.size()===0}},{key:"init",value:function(i){if(i===null&&(i=this.getFactory().getCoordinateSequenceFactory().create([])),i.size()===1)throw new J("Invalid number of points in LineString (found "+i.size()+" - must be 0 or >= 2)");this._points=i}},{key:"isCoordinate",value:function(i){for(var a=0;a<this._points.size();a++)if(this._points.getCoordinate(a).equals(i))return!0;return!1}},{key:"getStartPoint",value:function(){return this.isEmpty()?null:this.getPointN(0)}},{key:"getPointN",value:function(i){return this.getFactory().createPoint(this._points.getCoordinate(i))}},{key:"interfaces_",get:function(){return[ca]}}],[{key:"constructor_",value:function(){if(this._points=null,arguments.length!==0&&arguments.length===2){var i=arguments[0],a=arguments[1];fe.constructor_.call(this,a),this.init(i)}}}])})(fe),us=h((function o(){u(this,o)})),mi=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"computeEnvelopeInternal",value:function(){if(this.isEmpty())return new Se;var i=new Se;return i.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),i}},{key:"getCoordinates",value:function(){return this.isEmpty()?[]:[this.getCoordinate()]}},{key:"copyInternal",value:function(){return new n(this._coordinates.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof fe){var i=arguments[0],a=arguments[1];return!!this.isEquivalentClass(i)&&(!(!this.isEmpty()||!i.isEmpty())||this.isEmpty()===i.isEmpty()&&this.equal(i.getCoordinate(),this.getCoordinate(),a))}return b(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){}},{key:"getCoordinate",value:function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null}},{key:"getBoundaryDimension",value:function(){return se.FALSE}},{key:"reverseInternal",value:function(){return this.getFactory().createPoint(this._coordinates.copy())}},{key:"getTypeCode",value:function(){return fe.TYPECODE_POINT}},{key:"getDimension",value:function(){return 0}},{key:"getNumPoints",value:function(){return this.isEmpty()?0:1}},{key:"getX",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getX called on empty Point");return this.getCoordinate().x}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var i=arguments[0];return this.getCoordinate().compareTo(i.getCoordinate())}if(arguments.length===2){var a=arguments[0];return arguments[1].compare(this._coordinates,a._coordinates)}}},{key:"apply",value:function(){if(_e(arguments[0],Pn)){var i=arguments[0];if(this.isEmpty())return null;i.filter(this.getCoordinate())}else if(_e(arguments[0],qr)){var a=arguments[0];if(this.isEmpty())return null;a.filter(this._coordinates,0),a.isGeometryChanged()&&this.geometryChanged()}else _e(arguments[0],pi)?arguments[0].filter(this):_e(arguments[0],z)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return fe.TYPENAME_POINT}},{key:"getCoordinateSequence",value:function(){return this._coordinates}},{key:"getY",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getY called on empty Point");return this.getCoordinate().y}},{key:"isEmpty",value:function(){return this._coordinates.size()===0}},{key:"init",value:function(i){i===null&&(i=this.getFactory().getCoordinateSequenceFactory().create([])),ie.isTrue(i.size()<=1),this._coordinates=i}},{key:"isSimple",value:function(){return!0}},{key:"interfaces_",get:function(){return[us]}}],[{key:"constructor_",value:function(){this._coordinates=null;var i=arguments[0],a=arguments[1];fe.constructor_.call(this,a),this.init(i)}}])})(fe),ha=(function(){function o(){u(this,o)}return h(o,null,[{key:"ofRing",value:function(){if(arguments[0]instanceof Array){var n=arguments[0];return Math.abs(o.ofRingSigned(n))}if(_e(arguments[0],be)){var i=arguments[0];return Math.abs(o.ofRingSigned(i))}}},{key:"ofRingSigned",value:function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var i=0,a=n[0].x,l=1;l<n.length-1;l++){var g=n[l].x-a,m=n[l+1].y;i+=g*(n[l-1].y-m)}return i/2}if(_e(arguments[0],be)){var _=arguments[0],x=_.size();if(x<3)return 0;var M=new V,j=new V,X=new V;_.getCoordinate(0,j),_.getCoordinate(1,X);var K=j.x;X.x-=K;for(var ce=0,ge=1;ge<x-1;ge++)M.y=j.y,j.x=X.x,j.y=X.y,_.getCoordinate(ge+1,X),X.x-=K,ce+=j.x*(M.y-X.y);return ce/2}}}])})(),_t=(function(){return h((function o(){u(this,o)}),null,[{key:"sort",value:function(){var o=arguments,n=arguments[0];if(arguments.length===1)n.sort((function(K,ce){return K.compareTo(ce)}));else if(arguments.length===2)n.sort((function(K,ce){return o[1].compare(K,ce)}));else if(arguments.length===3){var i=n.slice(arguments[1],arguments[2]);i.sort();var a=n.slice(0,arguments[1]).concat(i,n.slice(arguments[2],n.length));n.splice(0,n.length);var l,g=d(a);try{for(g.s();!(l=g.n()).done;){var m=l.value;n.push(m)}}catch(K){g.e(K)}finally{g.f()}}else if(arguments.length===4){var _=n.slice(arguments[1],arguments[2]);_.sort((function(K,ce){return o[3].compare(K,ce)}));var x=n.slice(0,arguments[1]).concat(_,n.slice(arguments[2],n.length));n.splice(0,n.length);var M,j=d(x);try{for(j.s();!(M=j.n()).done;){var X=M.value;n.push(X)}}catch(K){j.e(K)}finally{j.f()}}}},{key:"asList",value:function(o){var n,i=new de,a=d(o);try{for(a.s();!(n=a.n()).done;){var l=n.value;i.add(l)}}catch(g){a.e(g)}finally{a.f()}return i}},{key:"copyOf",value:function(o,n){return o.slice(0,n)}}])})(),On=h((function o(){u(this,o)})),Yr=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"computeEnvelopeInternal",value:function(){return this._shell.getEnvelopeInternal()}},{key:"getCoordinates",value:function(){if(this.isEmpty())return[];for(var i=new Array(this.getNumPoints()).fill(null),a=-1,l=this._shell.getCoordinates(),g=0;g<l.length;g++)i[++a]=l[g];for(var m=0;m<this._holes.length;m++)for(var _=this._holes[m].getCoordinates(),x=0;x<_.length;x++)i[++a]=_[x];return i}},{key:"getArea",value:function(){var i=0;i+=ha.ofRing(this._shell.getCoordinateSequence());for(var a=0;a<this._holes.length;a++)i-=ha.ofRing(this._holes[a].getCoordinateSequence());return i}},{key:"copyInternal",value:function(){for(var i=this._shell.copy(),a=new Array(this._holes.length).fill(null),l=0;l<this._holes.length;l++)a[l]=this._holes[l].copy();return new n(i,a,this._factory)}},{key:"isRectangle",value:function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var i=this._shell.getCoordinateSequence(),a=this.getEnvelopeInternal(),l=0;l<5;l++){var g=i.getX(l);if(g!==a.getMinX()&&g!==a.getMaxX())return!1;var m=i.getY(l);if(m!==a.getMinY()&&m!==a.getMaxY())return!1}for(var _=i.getX(0),x=i.getY(0),M=1;M<=4;M++){var j=i.getX(M),X=i.getY(M);if(j!==_==(X!==x))return!1;_=j,x=X}return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof fe){var i=arguments[0],a=arguments[1];if(!this.isEquivalentClass(i))return!1;var l=i,g=this._shell,m=l._shell;if(!g.equalsExact(m,a)||this._holes.length!==l._holes.length)return!1;for(var _=0;_<this._holes.length;_++)if(!this._holes[_].equalsExact(l._holes[_],a))return!1;return!0}return b(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){if(arguments.length===0){this._shell=this.normalized(this._shell,!0);for(var i=0;i<this._holes.length;i++)this._holes[i]=this.normalized(this._holes[i],!1);_t.sort(this._holes)}else if(arguments.length===2){var a=arguments[0],l=arguments[1];if(a.isEmpty())return null;var g=a.getCoordinateSequence(),m=De.minCoordinateIndex(g,0,g.size()-2);De.scroll(g,m,!0),ve.isCCW(g)===l&&De.reverse(g)}}},{key:"getCoordinate",value:function(){return this._shell.getCoordinate()}},{key:"getNumInteriorRing",value:function(){return this._holes.length}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"reverseInternal",value:function(){for(var i=this.getExteriorRing().reverse(),a=new Array(this.getNumInteriorRing()).fill(null),l=0;l<a.length;l++)a[l]=this.getInteriorRingN(l).reverse();return this.getFactory().createPolygon(i,a)}},{key:"getTypeCode",value:function(){return fe.TYPECODE_POLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getLength",value:function(){var i=0;i+=this._shell.getLength();for(var a=0;a<this._holes.length;a++)i+=this._holes[a].getLength();return i}},{key:"getNumPoints",value:function(){for(var i=this._shell.getNumPoints(),a=0;a<this._holes.length;a++)i+=this._holes[a].getNumPoints();return i}},{key:"convexHull",value:function(){return this.getExteriorRing().convexHull()}},{key:"normalized",value:function(i,a){var l=i.copy();return this.normalize(l,a),l}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var i=arguments[0],a=this._shell,l=i._shell;return a.compareToSameClass(l)}if(arguments.length===2){var g=arguments[1],m=arguments[0],_=this._shell,x=m._shell,M=_.compareToSameClass(x,g);if(M!==0)return M;for(var j=this.getNumInteriorRing(),X=m.getNumInteriorRing(),K=0;K<j&&K<X;){var ce=this.getInteriorRingN(K),ge=m.getInteriorRingN(K),pe=ce.compareToSameClass(ge,g);if(pe!==0)return pe;K++}return K<j?1:K<X?-1:0}}},{key:"apply",value:function(){if(_e(arguments[0],Pn)){var i=arguments[0];this._shell.apply(i);for(var a=0;a<this._holes.length;a++)this._holes[a].apply(i)}else if(_e(arguments[0],qr)){var l=arguments[0];if(this._shell.apply(l),!l.isDone())for(var g=0;g<this._holes.length&&(this._holes[g].apply(l),!l.isDone());g++);l.isGeometryChanged()&&this.geometryChanged()}else if(_e(arguments[0],pi))arguments[0].filter(this);else if(_e(arguments[0],z)){var m=arguments[0];m.filter(this),this._shell.apply(m);for(var _=0;_<this._holes.length;_++)this._holes[_].apply(m)}}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var i=new Array(this._holes.length+1).fill(null);i[0]=this._shell;for(var a=0;a<this._holes.length;a++)i[a+1]=this._holes[a];return i.length<=1?this.getFactory().createLinearRing(i[0].getCoordinateSequence()):this.getFactory().createMultiLineString(i)}},{key:"getGeometryType",value:function(){return fe.TYPENAME_POLYGON}},{key:"getExteriorRing",value:function(){return this._shell}},{key:"isEmpty",value:function(){return this._shell.isEmpty()}},{key:"getInteriorRingN",value:function(i){return this._holes[i]}},{key:"interfaces_",get:function(){return[On]}}],[{key:"constructor_",value:function(){this._shell=null,this._holes=null;var i=arguments[0],a=arguments[1],l=arguments[2];if(fe.constructor_.call(this,l),i===null&&(i=this.getFactory().createLinearRing()),a===null&&(a=[]),fe.hasNullElements(a))throw new J("holes must not contain null elements");if(i.isEmpty()&&fe.hasNonEmptyElements(a))throw new J("shell is empty but holes are not");this._shell=i,this._holes=a}}])})(fe),fa=(function(o){function n(){return u(this,n),s(this,n,arguments)}return v(n,o),h(n)})(fi),vi=(function(o){function n(i){var a;return u(this,n),(a=s(this,n)).array=[],i instanceof Ce&&a.addAll(i),a}return v(n,o),h(n,[{key:"contains",value:function(i){var a,l=d(this.array);try{for(l.s();!(a=l.n()).done;)if(a.value.compareTo(i)===0)return!0}catch(g){l.e(g)}finally{l.f()}return!1}},{key:"add",value:function(i){if(this.contains(i))return!1;for(var a=0,l=this.array.length;a<l;a++)if(this.array[a].compareTo(i)===1)return!!this.array.splice(a,0,i);return this.array.push(i),!0}},{key:"addAll",value:function(i){var a,l=d(i);try{for(l.s();!(a=l.n()).done;){var g=a.value;this.add(g)}}catch(m){l.e(m)}finally{l.f()}return!0}},{key:"remove",value:function(){throw new xe}},{key:"size",value:function(){return this.array.length}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"toArray",value:function(){return this.array.slice()}},{key:"iterator",value:function(){return new ga(this.array)}}])})(fa),ga=(function(){return h((function o(n){u(this,o),this.array=n,this.position=0}),[{key:"next",value:function(){if(this.position===this.array.length)throw new qe;return this.array[this.position++]}},{key:"hasNext",value:function(){return this.position<this.array.length}},{key:"remove",value:function(){throw new xe}}])})(),Je=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"computeEnvelopeInternal",value:function(){for(var i=new Se,a=0;a<this._geometries.length;a++)i.expandToInclude(this._geometries[a].getEnvelopeInternal());return i}},{key:"getGeometryN",value:function(i){return this._geometries[i]}},{key:"getCoordinates",value:function(){for(var i=new Array(this.getNumPoints()).fill(null),a=-1,l=0;l<this._geometries.length;l++)for(var g=this._geometries[l].getCoordinates(),m=0;m<g.length;m++)i[++a]=g[m];return i}},{key:"getArea",value:function(){for(var i=0,a=0;a<this._geometries.length;a++)i+=this._geometries[a].getArea();return i}},{key:"copyInternal",value:function(){for(var i=new Array(this._geometries.length).fill(null),a=0;a<i.length;a++)i[a]=this._geometries[a].copy();return new n(i,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof fe){var i=arguments[0],a=arguments[1];if(!this.isEquivalentClass(i))return!1;var l=i;if(this._geometries.length!==l._geometries.length)return!1;for(var g=0;g<this._geometries.length;g++)if(!this._geometries[g].equalsExact(l._geometries[g],a))return!1;return!0}return b(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var i=0;i<this._geometries.length;i++)this._geometries[i].normalize();_t.sort(this._geometries)}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()}},{key:"getBoundaryDimension",value:function(){for(var i=se.FALSE,a=0;a<this._geometries.length;a++)i=Math.max(i,this._geometries[a].getBoundaryDimension());return i}},{key:"reverseInternal",value:function(){for(var i=this._geometries.length,a=new de(i),l=0;l<i;l++)a.add(this._geometries[l].reverse());return this.getFactory().buildGeometry(a)}},{key:"getTypeCode",value:function(){return fe.TYPECODE_GEOMETRYCOLLECTION}},{key:"getDimension",value:function(){for(var i=se.FALSE,a=0;a<this._geometries.length;a++)i=Math.max(i,this._geometries[a].getDimension());return i}},{key:"getLength",value:function(){for(var i=0,a=0;a<this._geometries.length;a++)i+=this._geometries[a].getLength();return i}},{key:"getNumPoints",value:function(){for(var i=0,a=0;a<this._geometries.length;a++)i+=this._geometries[a].getNumPoints();return i}},{key:"getNumGeometries",value:function(){return this._geometries.length}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var i=arguments[0],a=new vi(_t.asList(this._geometries)),l=new vi(_t.asList(i._geometries));return this.compare(a,l)}if(arguments.length===2){for(var g=arguments[1],m=arguments[0],_=this.getNumGeometries(),x=m.getNumGeometries(),M=0;M<_&&M<x;){var j=this.getGeometryN(M),X=m.getGeometryN(M),K=j.compareToSameClass(X,g);if(K!==0)return K;M++}return M<_?1:M<x?-1:0}}},{key:"apply",value:function(){if(_e(arguments[0],Pn))for(var i=arguments[0],a=0;a<this._geometries.length;a++)this._geometries[a].apply(i);else if(_e(arguments[0],qr)){var l=arguments[0];if(this._geometries.length===0)return null;for(var g=0;g<this._geometries.length&&(this._geometries[g].apply(l),!l.isDone());g++);l.isGeometryChanged()&&this.geometryChanged()}else if(_e(arguments[0],pi)){var m=arguments[0];m.filter(this);for(var _=0;_<this._geometries.length;_++)this._geometries[_].apply(m)}else if(_e(arguments[0],z)){var x=arguments[0];x.filter(this);for(var M=0;M<this._geometries.length;M++)this._geometries[M].apply(x)}}},{key:"getBoundary",value:function(){return fe.checkNotGeometryCollection(this),ie.shouldNeverReachHere(),null}},{key:"getGeometryType",value:function(){return fe.TYPENAME_GEOMETRYCOLLECTION}},{key:"isEmpty",value:function(){for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].isEmpty())return!1;return!0}}],[{key:"constructor_",value:function(){if(this._geometries=null,arguments.length!==0&&arguments.length===2){var i=arguments[0],a=arguments[1];if(fe.constructor_.call(this,a),i===null&&(i=[]),fe.hasNullElements(i))throw new J("geometries must not contain null elements");this._geometries=i}}}])})(fe),yi=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"copyInternal",value:function(){for(var i=new Array(this._geometries.length).fill(null),a=0;a<i.length;a++)i[a]=this._geometries[a].copy();return new n(i,this._factory)}},{key:"isValid",value:function(){return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof fe){var i=arguments[0],a=arguments[1];return!!this.isEquivalentClass(i)&&b(n,"equalsExact",this,1).call(this,i,a)}return b(n,"equalsExact",this,1).apply(this,arguments)}},{key:"getCoordinate",value:function(){if(arguments.length===1&&Number.isInteger(arguments[0])){var i=arguments[0];return this._geometries[i].getCoordinate()}return b(n,"getCoordinate",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return se.FALSE}},{key:"getTypeCode",value:function(){return fe.TYPECODE_MULTIPOINT}},{key:"getDimension",value:function(){return 0}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return fe.TYPENAME_MULTIPOINT}},{key:"interfaces_",get:function(){return[us]}}],[{key:"constructor_",value:function(){var i=arguments[0],a=arguments[1];Je.constructor_.call(this,i,a)}}])})(Je),_r=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"copyInternal",value:function(){return new n(this._points.copy(),this._factory)}},{key:"getBoundaryDimension",value:function(){return se.FALSE}},{key:"isClosed",value:function(){return!!this.isEmpty()||b(n,"isClosed",this,1).call(this)}},{key:"reverseInternal",value:function(){var i=this._points.copy();return De.reverse(i),this.getFactory().createLinearRing(i)}},{key:"getTypeCode",value:function(){return fe.TYPECODE_LINEARRING}},{key:"validateConstruction",value:function(){if(!this.isEmpty()&&!b(n,"isClosed",this,1).call(this))throw new J("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<n.MINIMUM_VALID_SIZE)throw new J("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")}},{key:"getGeometryType",value:function(){return fe.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var i=arguments[0],a=arguments[1];Qn.constructor_.call(this,i,a),this.validateConstruction()}}])})(Qn);_r.MINIMUM_VALID_SIZE=4;var Rn=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"setOrdinate",value:function(i,a){switch(i){case n.X:this.x=a;break;case n.Y:this.y=a;break;default:throw new J("Invalid ordinate index: "+i)}}},{key:"getZ",value:function(){return V.NULL_ORDINATE}},{key:"getOrdinate",value:function(i){switch(i){case n.X:return this.x;case n.Y:return this.y}throw new J("Invalid ordinate index: "+i)}},{key:"setZ",value:function(i){throw new J("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(i){this.x=i.x,this.y=i.y,this.z=i.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)V.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof n){var i=arguments[0];V.constructor_.call(this,i.x,i.y)}else if(arguments[0]instanceof V){var a=arguments[0];V.constructor_.call(this,a.x,a.y)}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];V.constructor_.call(this,l,g,V.NULL_ORDINATE)}}}])})(V);Rn.X=0,Rn.Y=1,Rn.Z=-1,Rn.M=-1;var Dn=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(i,a){switch(i){case n.X:this.x=a;break;case n.Y:this.y=a;break;case n.M:this._m=a;break;default:throw new J("Invalid ordinate index: "+i)}}},{key:"setM",value:function(i){this._m=i}},{key:"getZ",value:function(){return V.NULL_ORDINATE}},{key:"getOrdinate",value:function(i){switch(i){case n.X:return this.x;case n.Y:return this.y;case n.M:return this._m}throw new J("Invalid ordinate index: "+i)}},{key:"setZ",value:function(i){throw new J("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(i){this.x=i.x,this.y=i.y,this.z=i.getZ(),this._m=i.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)V.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof n){var i=arguments[0];V.constructor_.call(this,i.x,i.y),this._m=i._m}else if(arguments[0]instanceof V){var a=arguments[0];V.constructor_.call(this,a.x,a.y),this._m=this.getM()}}else if(arguments.length===3){var l=arguments[0],g=arguments[1],m=arguments[2];V.constructor_.call(this,l,g,V.NULL_ORDINATE),this._m=m}}}])})(V);Dn.X=0,Dn.Y=1,Dn.Z=-1,Dn.M=2;var ls=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(i,a){switch(i){case V.X:this.x=a;break;case V.Y:this.y=a;break;case V.Z:this.z=a;break;case V.M:this._m=a;break;default:throw new J("Invalid ordinate index: "+i)}}},{key:"setM",value:function(i){this._m=i}},{key:"getOrdinate",value:function(i){switch(i){case V.X:return this.x;case V.Y:return this.y;case V.Z:return this.getZ();case V.M:return this.getM()}throw new J("Invalid ordinate index: "+i)}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(i){this.x=i.x,this.y=i.y,this.z=i.getZ(),this._m=i.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)V.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof n){var i=arguments[0];V.constructor_.call(this,i),this._m=i._m}else if(arguments[0]instanceof V){var a=arguments[0];V.constructor_.call(this,a),this._m=this.getM()}}else if(arguments.length===4){var l=arguments[0],g=arguments[1],m=arguments[2],_=arguments[3];V.constructor_.call(this,l,g,m),this._m=_}}}])})(V),F=(function(){function o(){u(this,o)}return h(o,null,[{key:"measures",value:function(n){return n instanceof Rn?0:n instanceof Dn||n instanceof ls?1:0}},{key:"dimension",value:function(n){return n instanceof Rn?2:n instanceof Dn?3:n instanceof ls?4:3}},{key:"create",value:function(){if(arguments.length===1){var n=arguments[0];return o.create(n,0)}if(arguments.length===2){var i=arguments[0],a=arguments[1];return i===2?new Rn:i===3&&a===0?new V:i===3&&a===1?new Dn:i===4&&a===1?new ls:new V}}}])})(),he=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"getCoordinate",value:function(i){return this.get(i)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&_e(arguments[0],Ce)){for(var i=arguments[1],a=!1,l=arguments[0].iterator();l.hasNext();)this.add(l.next(),i),a=!0;return a}return b(n,"addAll",this,1).apply(this,arguments)}},{key:"clone",value:function(){for(var i=b(n,"clone",this,1).call(this),a=0;a<this.size();a++)i.add(a,this.get(a).clone());return i}},{key:"toCoordinateArray",value:function(){if(arguments.length===0)return this.toArray(n.coordArrayType);if(arguments.length===1){if(arguments[0])return this.toArray(n.coordArrayType);for(var i=this.size(),a=new Array(i).fill(null),l=0;l<i;l++)a[l]=this.get(i-l-1);return a}}},{key:"add",value:function(){if(arguments.length===1){var i=arguments[0];return b(n,"add",this,1).call(this,i)}if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var a=arguments[0],l=arguments[1];return this.add(a,l,!0),!0}if(arguments[0]instanceof V&&typeof arguments[1]=="boolean"){var g=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(g))return null;b(n,"add",this,1).call(this,g)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var m=arguments[0],_=arguments[1];return this.add(m,_),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var x=arguments[0],M=arguments[1];if(arguments[2])for(var j=0;j<x.length;j++)this.add(x[j],M);else for(var X=x.length-1;X>=0;X--)this.add(x[X],M);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof V){var K=arguments[0],ce=arguments[1];if(!arguments[2]){var ge=this.size();if(ge>0&&(K>0&&this.get(K-1).equals2D(ce)||K<ge&&this.get(K).equals2D(ce)))return null}b(n,"add",this,1).call(this,K,ce)}}else if(arguments.length===4){var pe=arguments[0],Me=arguments[1],Ie=arguments[2],Fe=arguments[3],ht=1;Ie>Fe&&(ht=-1);for(var dt=Ie;dt!==Fe;dt+=ht)this.add(pe[dt],Me);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var i=this.get(0).copy();this.add(i,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.ensureCapacity(i.length),this.add(i,!0)}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.ensureCapacity(a.length),this.add(a,l)}}}}])})(de);he.coordArrayType=new Array(0).fill(null);var ee=(function(){function o(){u(this,o)}return h(o,null,[{key:"isRing",value:function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])}},{key:"ptNotInList",value:function(n,i){for(var a=0;a<n.length;a++){var l=n[a];if(o.indexOf(l,i)<0)return l}return null}},{key:"scroll",value:function(n,i){var a=o.indexOf(i,n);if(a<0)return null;var l=new Array(n.length).fill(null);Ot.arraycopy(n,a,l,0,n.length-a),Ot.arraycopy(n,0,l,n.length-a,a),Ot.arraycopy(l,0,n,0,n.length)}},{key:"equals",value:function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(n===i)return!0;if(n===null||i===null||n.length!==i.length)return!1;for(var a=0;a<n.length;a++)if(!n[a].equals(i[a]))return!1;return!0}if(arguments.length===3){var l=arguments[0],g=arguments[1],m=arguments[2];if(l===g)return!0;if(l===null||g===null||l.length!==g.length)return!1;for(var _=0;_<l.length;_++)if(m.compare(l[_],g[_])!==0)return!1;return!0}}},{key:"intersection",value:function(n,i){for(var a=new he,l=0;l<n.length;l++)i.intersects(n[l])&&a.add(n[l],!0);return a.toCoordinateArray()}},{key:"measures",value:function(n){if(n===null||n.length===0)return 0;var i,a=0,l=d(n);try{for(l.s();!(i=l.n()).done;){var g=i.value;a=Math.max(a,F.measures(g))}}catch(m){l.e(m)}finally{l.f()}return a}},{key:"hasRepeatedPoints",value:function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1}},{key:"removeRepeatedPoints",value:function(n){return o.hasRepeatedPoints(n)?new he(n,!1).toCoordinateArray():n}},{key:"reverse",value:function(n){for(var i=n.length-1,a=Math.trunc(i/2),l=0;l<=a;l++){var g=n[l];n[l]=n[i-l],n[i-l]=g}}},{key:"removeNull",value:function(n){for(var i=0,a=0;a<n.length;a++)n[a]!==null&&i++;var l=new Array(i).fill(null);if(i===0)return l;for(var g=0,m=0;m<n.length;m++)n[m]!==null&&(l[g++]=n[m]);return l}},{key:"copyDeep",value:function(){if(arguments.length===1){for(var n=arguments[0],i=new Array(n.length).fill(null),a=0;a<n.length;a++)i[a]=n[a].copy();return i}if(arguments.length===5)for(var l=arguments[0],g=arguments[1],m=arguments[2],_=arguments[3],x=arguments[4],M=0;M<x;M++)m[_+M]=l[g+M].copy()}},{key:"isEqualReversed",value:function(n,i){for(var a=0;a<n.length;a++){var l=n[a],g=i[n.length-a-1];if(l.compareTo(g)!==0)return!1}return!0}},{key:"envelope",value:function(n){for(var i=new Se,a=0;a<n.length;a++)i.expandToInclude(n[a]);return i}},{key:"toCoordinateArray",value:function(n){return n.toArray(o.coordArrayType)}},{key:"dimension",value:function(n){if(n===null||n.length===0)return 3;var i,a=0,l=d(n);try{for(l.s();!(i=l.n()).done;){var g=i.value;a=Math.max(a,F.dimension(g))}}catch(m){l.e(m)}finally{l.f()}return a}},{key:"atLeastNCoordinatesOrNothing",value:function(n,i){return i.length>=n?i:[]}},{key:"indexOf",value:function(n,i){for(var a=0;a<i.length;a++)if(n.equals(i[a]))return a;return-1}},{key:"increasingDirection",value:function(n){for(var i=0;i<Math.trunc(n.length/2);i++){var a=n.length-1-i,l=n[i].compareTo(n[a]);if(l!==0)return l}return 1}},{key:"compare",value:function(n,i){for(var a=0;a<n.length&&a<i.length;){var l=n[a].compareTo(i[a]);if(l!==0)return l;a++}return a<i.length?-1:a<n.length?1:0}},{key:"minCoordinate",value:function(n){for(var i=null,a=0;a<n.length;a++)(i===null||i.compareTo(n[a])>0)&&(i=n[a]);return i}},{key:"extract",value:function(n,i,a){i=Tn.clamp(i,0,n.length);var l=(a=Tn.clamp(a,-1,n.length))-i+1;a<0&&(l=0),i>=n.length&&(l=0),a<i&&(l=0);var g=new Array(l).fill(null);if(l===0)return g;for(var m=0,_=i;_<=a;_++)g[m++]=n[_];return g}}])})(),Te=(function(){return h((function o(){u(this,o)}),[{key:"compare",value:function(o,n){var i=o,a=n;return ee.compare(i,a)}},{key:"interfaces_",get:function(){return[ne]}}])})(),et=(function(){return h((function o(){u(this,o)}),[{key:"compare",value:function(o,n){var i=o,a=n;if(i.length<a.length)return-1;if(i.length>a.length)return 1;if(i.length===0)return 0;var l=ee.compare(i,a);return ee.isEqualReversed(i,a)?0:l}},{key:"OLDcompare",value:function(o,n){var i=o,a=n;if(i.length<a.length)return-1;if(i.length>a.length)return 1;if(i.length===0)return 0;for(var l=ee.increasingDirection(i),g=ee.increasingDirection(a),m=l>0?0:i.length-1,_=g>0?0:i.length-1,x=0;x<i.length;x++){var M=i[m].compareTo(a[_]);if(M!==0)return M;m+=l,_+=g}return 0}},{key:"interfaces_",get:function(){return[ne]}}])})();ee.ForwardComparator=Te,ee.BidirectionalComparator=et,ee.coordArrayType=new Array(0).fill(null);var Re=(function(){return h((function o(n){u(this,o),this.str=n}),[{key:"append",value:function(o){this.str+=o}},{key:"setCharAt",value:function(o,n){this.str=this.str.substr(0,o)+n+this.str.substr(o+1)}},{key:"toString",value:function(){return this.str}}])})(),kt=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getM",value:function(n){return this.hasM()?this._coordinates[n].getM():Z.NaN}},{key:"setOrdinate",value:function(n,i,a){switch(i){case be.X:this._coordinates[n].x=a;break;case be.Y:this._coordinates[n].y=a;break;default:this._coordinates[n].setOrdinate(i,a)}}},{key:"getZ",value:function(n){return this.hasZ()?this._coordinates[n].getZ():Z.NaN}},{key:"size",value:function(){return this._coordinates.length}},{key:"getOrdinate",value:function(n,i){switch(i){case be.X:return this._coordinates[n].x;case be.Y:return this._coordinates[n].y;default:return this._coordinates[n].getOrdinate(i)}}},{key:"getCoordinate",value:function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var i=arguments[0];arguments[1].setCoordinate(this._coordinates[i])}}},{key:"getCoordinateCopy",value:function(n){var i=this.createCoordinate();return i.setCoordinate(this._coordinates[n]),i}},{key:"createCoordinate",value:function(){return F.create(this.getDimension(),this.getMeasures())}},{key:"getDimension",value:function(){return this._dimension}},{key:"getX",value:function(n){return this._coordinates[n].x}},{key:"getMeasures",value:function(){return this._measures}},{key:"expandEnvelope",value:function(n){for(var i=0;i<this._coordinates.length;i++)n.expandToInclude(this._coordinates[i]);return n}},{key:"copy",value:function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++){var a=this.createCoordinate();a.setCoordinate(this._coordinates[i]),n[i]=a}return new o(n,this._dimension,this._measures)}},{key:"toString",value:function(){if(this._coordinates.length>0){var n=new Re(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var i=1;i<this._coordinates.length;i++)n.append(", "),n.append(this._coordinates[i]);return n.append(")"),n.toString()}return"()"}},{key:"getY",value:function(n){return this._coordinates[n].y}},{key:"toCoordinateArray",value:function(){return this._coordinates}},{key:"interfaces_",get:function(){return[be,w]}}],[{key:"constructor_",value:function(){if(this._dimension=3,this._measures=0,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];o.constructor_.call(this,n,ee.dimension(n),ee.measures(n))}else if(Number.isInteger(arguments[0])){var i=arguments[0];this._coordinates=new Array(i).fill(null);for(var a=0;a<i;a++)this._coordinates[a]=new V}else if(_e(arguments[0],be)){var l=arguments[0];if(l===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=l.getDimension(),this._measures=l.getMeasures(),this._coordinates=new Array(l.size()).fill(null);for(var g=0;g<this._coordinates.length;g++)this._coordinates[g]=l.getCoordinateCopy(g)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var m=arguments[0],_=arguments[1];o.constructor_.call(this,m,_,ee.measures(m))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var x=arguments[0],M=arguments[1];this._coordinates=new Array(x).fill(null),this._dimension=M;for(var j=0;j<x;j++)this._coordinates[j]=F.create(M)}}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var X=arguments[0],K=arguments[1],ce=arguments[2];this._dimension=K,this._measures=ce,this._coordinates=X===null?new Array(0).fill(null):X}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var ge=arguments[0],pe=arguments[1],Me=arguments[2];this._coordinates=new Array(ge).fill(null),this._dimension=pe,this._measures=Me;for(var Ie=0;Ie<ge;Ie++)this._coordinates[Ie]=this.createCoordinate()}}}}])})(),Et=(function(){function o(){u(this,o)}return h(o,[{key:"readResolve",value:function(){return o.instance()}},{key:"create",value:function(){if(arguments.length===1){if(arguments[0]instanceof Array)return new kt(arguments[0]);if(_e(arguments[0],be))return new kt(arguments[0])}else{if(arguments.length===2){var n=arguments[1];return n>3&&(n=3),n<2&&(n=2),new kt(arguments[0],n)}if(arguments.length===3){var i=arguments[2],a=arguments[1]-i;return i>1&&(i=1),a>3&&(a=3),a<2&&(a=2),new kt(arguments[0],a+i,i)}}}},{key:"interfaces_",get:function(){return[la,w]}}],[{key:"instance",value:function(){return o.instanceObject}}])})();Et.instanceObject=new Et;var xt=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"copyInternal",value:function(){for(var i=new Array(this._geometries.length).fill(null),a=0;a<i.length;a++)i[a]=this._geometries[a].copy();return new n(i,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof fe){var i=arguments[0],a=arguments[1];return!!this.isEquivalentClass(i)&&b(n,"equalsExact",this,1).call(this,i,a)}return b(n,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"getTypeCode",value:function(){return fe.TYPECODE_MULTIPOLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var i=new de,a=0;a<this._geometries.length;a++)for(var l=this._geometries[a].getBoundary(),g=0;g<l.getNumGeometries();g++)i.add(l.getGeometryN(g));var m=new Array(i.size()).fill(null);return this.getFactory().createMultiLineString(i.toArray(m))}},{key:"getGeometryType",value:function(){return fe.TYPENAME_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[On]}}],[{key:"constructor_",value:function(){var i=arguments[0],a=arguments[1];Je.constructor_.call(this,i,a)}}])})(Je),_i=(function(){return h((function o(){u(this,o)}),[{key:"get",value:function(){}},{key:"put",value:function(){}},{key:"size",value:function(){}},{key:"values",value:function(){}},{key:"entrySet",value:function(){}}])})(),tt=(function(o){function n(){var i;return u(this,n),(i=s(this,n)).map=new Map,i}return v(n,o),h(n,[{key:"get",value:function(i){return this.map.get(i)||null}},{key:"put",value:function(i,a){return this.map.set(i,a),a}},{key:"values",value:function(){for(var i=new de,a=this.map.values(),l=a.next();!l.done;)i.add(l.value),l=a.next();return i}},{key:"entrySet",value:function(){var i=new Br;return this.map.entries().forEach((function(a){return i.add(a)})),i}},{key:"size",value:function(){return this.map.size()}}])})(_i),Rt=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"equals",value:function(n){if(!(n instanceof o))return!1;var i=n;return this._modelType===i._modelType&&this._scale===i._scale}},{key:"compareTo",value:function(n){var i=n,a=this.getMaximumSignificantDigits(),l=i.getMaximumSignificantDigits();return fn.compare(a,l)}},{key:"getScale",value:function(){return this._scale}},{key:"isFloating",value:function(){return this._modelType===o.FLOATING||this._modelType===o.FLOATING_SINGLE}},{key:"getType",value:function(){return this._modelType}},{key:"toString",value:function(){var n="UNKNOWN";return this._modelType===o.FLOATING?n="Floating":this._modelType===o.FLOATING_SINGLE?n="Floating-Single":this._modelType===o.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n}},{key:"makePrecise",value:function(){if(typeof arguments[0]=="number"){var n=arguments[0];return Z.isNaN(n)||this._modelType===o.FLOATING_SINGLE?n:this._modelType===o.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof V){var i=arguments[0];if(this._modelType===o.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}}},{key:"getMaximumSignificantDigits",value:function(){var n=16;return this._modelType===o.FLOATING?n=16:this._modelType===o.FLOATING_SINGLE?n=6:this._modelType===o.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n}},{key:"setScale",value:function(n){this._scale=Math.abs(n)}},{key:"interfaces_",get:function(){return[w,$]}}],[{key:"constructor_",value:function(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=o.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof kr){var n=arguments[0];this._modelType=n,n===o.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var i=arguments[0];this._modelType=o.FIXED,this.setScale(i)}else if(arguments[0]instanceof o){var a=arguments[0];this._modelType=a._modelType,this._scale=a._scale}}}},{key:"mostPrecise",value:function(n,i){return n.compareTo(i)>=0?n:i}}])})(),kr=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"readResolve",value:function(){return o.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[w]}}],[{key:"constructor_",value:function(){this._name=null;var n=arguments[0];this._name=n,o.nameToTypeMap.put(n,this)}}])})();kr.nameToTypeMap=new tt,Rt.Type=kr,Rt.FIXED=new kr("FIXED"),Rt.FLOATING=new kr("FLOATING"),Rt.FLOATING_SINGLE=new kr("FLOATING SINGLE"),Rt.maximumPreciseValue=9007199254740992;var Uo=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"copyInternal",value:function(){for(var i=new Array(this._geometries.length).fill(null),a=0;a<i.length;a++)i[a]=this._geometries[a].copy();return new n(i,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof fe){var i=arguments[0],a=arguments[1];return!!this.isEquivalentClass(i)&&b(n,"equalsExact",this,1).call(this,i,a)}return b(n,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?se.FALSE:0}},{key:"isClosed",value:function(){if(this.isEmpty())return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].isClosed())return!1;return!0}},{key:"getTypeCode",value:function(){return fe.TYPECODE_MULTILINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getBoundary",value:function(){throw new xe}},{key:"getGeometryType",value:function(){return fe.TYPENAME_MULTILINESTRING}},{key:"interfaces_",get:function(){return[ca]}}],[{key:"constructor_",value:function(){var i=arguments[0],a=arguments[1];Je.constructor_.call(this,i,a)}}])})(Je),ki=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"createEmpty",value:function(n){switch(n){case-1:return this.createGeometryCollection();case 0:return this.createPoint();case 1:return this.createLineString();case 2:return this.createPolygon();default:throw new J("Invalid dimension: "+n)}}},{key:"toGeometry",value:function(n){return n.isNull()?this.createPoint():n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new V(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new V(n.getMinX(),n.getMinY()),new V(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new V(n.getMinX(),n.getMinY()),new V(n.getMinX(),n.getMaxY()),new V(n.getMaxX(),n.getMaxY()),new V(n.getMaxX(),n.getMinY()),new V(n.getMinX(),n.getMinY())]),null)}},{key:"createLineString",value:function(){if(arguments.length===0)return this.createLineString(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLineString(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(_e(arguments[0],be))return new Qn(arguments[0],this)}}},{key:"createMultiLineString",value:function(){return arguments.length===0?new Uo(null,this):arguments.length===1?new Uo(arguments[0],this):void 0}},{key:"buildGeometry",value:function(n){for(var i=null,a=!1,l=!1,g=n.iterator();g.hasNext();){var m=g.next(),_=m.getTypeCode();i===null&&(i=_),_!==i&&(a=!0),m instanceof Je&&(l=!0)}if(i===null)return this.createGeometryCollection();if(a||l)return this.createGeometryCollection(o.toGeometryArray(n));var x=n.iterator().next();if(n.size()>1){if(x instanceof Yr)return this.createMultiPolygon(o.toPolygonArray(n));if(x instanceof Qn)return this.createMultiLineString(o.toLineStringArray(n));if(x instanceof mi)return this.createMultiPoint(o.toPointArray(n));ie.shouldNeverReachHere("Unhandled geometry type: "+x.getGeometryType())}return x}},{key:"createMultiPointFromCoords",value:function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(_e(arguments[0],be))return new mi(arguments[0],this)}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(_e(arguments[0],be)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var i=arguments[0];return this.createPolygon(this.createLinearRing(i))}if(arguments[0]instanceof _r){var a=arguments[0];return this.createPolygon(a,null)}}else if(arguments.length===2)return new Yr(arguments[0],arguments[1],this)}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){return arguments.length===0?new Je(null,this):arguments.length===1?new Je(arguments[0],this):void 0}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(_e(arguments[0],be))return new _r(arguments[0],this)}}},{key:"createMultiPolygon",value:function(){return arguments.length===0?new xt(null,this):arguments.length===1?new xt(arguments[0],this):void 0}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new yi(null,this);if(arguments.length===1){if(arguments[0]instanceof Array)return new yi(arguments[0],this);if(_e(arguments[0],be)){var n=arguments[0];if(n===null)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(n.size()).fill(null),a=0;a<n.size();a++){var l=this.getCoordinateSequenceFactory().create(1,n.getDimension(),n.getMeasures());De.copy(n,a,l,0,1),i[a]=this.createPoint(l)}return this.createMultiPoint(i)}}}},{key:"interfaces_",get:function(){return[w]}}],[{key:"constructor_",value:function(){if(this._precisionModel=null,this._coordinateSequenceFactory=null,this._SRID=null,arguments.length===0)o.constructor_.call(this,new Rt,0);else if(arguments.length===1){if(_e(arguments[0],la)){var n=arguments[0];o.constructor_.call(this,new Rt,0,n)}else if(arguments[0]instanceof Rt){var i=arguments[0];o.constructor_.call(this,i,0,o.getDefaultCoordinateSequenceFactory())}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];o.constructor_.call(this,a,l,o.getDefaultCoordinateSequenceFactory())}else if(arguments.length===3){var g=arguments[0],m=arguments[1],_=arguments[2];this._precisionModel=g,this._coordinateSequenceFactory=_,this._SRID=m}}},{key:"toMultiPolygonArray",value:function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)}},{key:"toGeometryArray",value:function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)}},{key:"getDefaultCoordinateSequenceFactory",value:function(){return Et.instance()}},{key:"toMultiLineStringArray",value:function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)}},{key:"toLineStringArray",value:function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)}},{key:"toMultiPointArray",value:function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)}},{key:"toLinearRingArray",value:function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)}},{key:"toPointArray",value:function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)}},{key:"toPolygonArray",value:function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)}},{key:"createPointFromInternalCoord",value:function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)}}])})(),jo="XY",Vp="XYZ",Xp="XYM",$p="XYZM",cc={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"},hc="EMPTY",da=1,er=2,Er=3,fc=4,Ei=5,Wp=6;for(var Zp in cc)cc[Zp].toUpperCase();var Kp=(function(){return h((function o(n){u(this,o),this.wkt=n,this.index_=-1}),[{key:"isAlpha_",value:function(o){return o>="a"&&o<="z"||o>="A"&&o<="Z"}},{key:"isNumeric_",value:function(o,n){return o>="0"&&o<="9"||o=="."&&!(n!==void 0&&n)}},{key:"isWhiteSpace_",value:function(o){return o==" "||o==" "||o=="\r"||o==`
|
|
127
|
+
`}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var o,n=this.nextChar_(),i=this.index_,a=n;if(n=="(")o=er;else if(n==",")o=Ei;else if(n==")")o=Er;else if(this.isNumeric_(n)||n=="-")o=fc,a=this.readNumber_();else if(this.isAlpha_(n))o=da,a=this.readText_();else{if(this.isWhiteSpace_(n))return this.nextToken();if(n!=="")throw new Error("Unexpected character: "+n);o=Wp}return{position:i,value:a,type:o}}},{key:"readNumber_",value:function(){var o,n=this.index_,i=!1,a=!1;do o=="."?i=!0:o!="e"&&o!="E"||(a=!0),o=this.nextChar_();while(this.isNumeric_(o,i)||!a&&(o=="e"||o=="E")||a&&(o=="-"||o=="+"));return parseFloat(this.wkt.substring(n,this.index_--))}},{key:"readText_",value:function(){var o,n=this.index_;do o=this.nextChar_();while(this.isAlpha_(o));return this.wkt.substring(n,this.index_--).toUpperCase()}}])})(),Qp=(function(){return h((function o(n,i){u(this,o),this.lexer_=n,this.token_,this.layout_=jo,this.factory=i}),[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(o){return this.token_.type==o}},{key:"match",value:function(o){var n=this.isTokenType(o);return n&&this.consume_(),n}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var o=jo,n=this.token_;if(this.isTokenType(da)){var i=n.value;i==="Z"?o=Vp:i==="M"?o=Xp:i==="ZM"&&(o=$p),o!==jo&&this.consume_()}return o}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(er)){var o=[];do o.push(this.parseGeometry_());while(this.match(Ei));if(this.match(Er))return o}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(er)){var o=this.parsePoint_();if(this.match(Er))return o}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(er)){var o=this.parsePointList_();if(this.match(Er))return o}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(er)){var o=this.parseLineStringTextList_();if(this.match(Er))return o}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var o;if(this.match(er)){if(o=this.token_.type==er?this.parsePointTextList_():this.parsePointList_(),this.match(Er))return o}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(er)){var o=this.parseLineStringTextList_();if(this.match(Er))return o}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(er)){var o=this.parsePolygonTextList_();if(this.match(Er))return o}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var o=[],n=this.layout_.length,i=0;i<n;++i){var a=this.token_;if(!this.match(fc))break;o.push(a.value)}if(o.length==n)return o;throw new Error(this.formatErrorMessage_())}},{key:"parsePointList_",value:function(){for(var o=[this.parsePoint_()];this.match(Ei);)o.push(this.parsePoint_());return o}},{key:"parsePointTextList_",value:function(){for(var o=[this.parsePointText_()];this.match(Ei);)o.push(this.parsePointText_());return o}},{key:"parseLineStringTextList_",value:function(){for(var o=[this.parseLineStringText_()];this.match(Ei);)o.push(this.parseLineStringText_());return o}},{key:"parsePolygonTextList_",value:function(){for(var o=[this.parsePolygonText_()];this.match(Ei);)o.push(this.parsePolygonText_());return o}},{key:"isEmptyGeometry_",value:function(){var o=this.isTokenType(da)&&this.token_.value==hc;return o&&this.consume_(),o}},{key:"formatErrorMessage_",value:function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}},{key:"parseGeometry_",value:function(){var o=this.factory,n=function(pe){return c(V,N(pe))},i=function(pe){var Me=pe.map((function(Ie){return o.createLinearRing(Ie.map(n))}));return Me.length>1?o.createPolygon(Me[0],Me.slice(1)):o.createPolygon(Me[0])},a=this.token_;if(this.match(da)){var l=a.value;if(this.layout_=this.parseGeometryLayout_(),l=="GEOMETRYCOLLECTION"){var g=this.parseGeometryCollectionText_();return o.createGeometryCollection(g)}switch(l){case"POINT":var m=this.parsePointText_();return m?o.createPoint(c(V,N(m))):o.createPoint();case"LINESTRING":var _=this.parseLineStringText_().map(n);return o.createLineString(_);case"LINEARRING":var x=this.parseLineStringText_().map(n);return o.createLinearRing(x);case"POLYGON":var M=this.parsePolygonText_();return M&&M.length!==0?i(M):o.createPolygon();case"MULTIPOINT":var j=this.parseMultiPointText_();if(!j||j.length===0)return o.createMultiPoint();var X=j.map(n).map((function(pe){return o.createPoint(pe)}));return o.createMultiPoint(X);case"MULTILINESTRING":var K=this.parseMultiLineStringText_().map((function(pe){return o.createLineString(pe.map(n))}));return o.createMultiLineString(K);case"MULTIPOLYGON":var ce=this.parseMultiPolygonText_();if(!ce||ce.length===0)return o.createMultiPolygon();var ge=ce.map(i);return o.createMultiPolygon(ge);default:throw new Error("Invalid geometry type: "+l)}}throw new Error(this.formatErrorMessage_())}}])})();function gc(o){if(o.isEmpty())return"";var n=o.getCoordinate(),i=[n.x,n.y];return n.z===void 0||Number.isNaN(n.z)||i.push(n.z),n.m===void 0||Number.isNaN(n.m)||i.push(n.m),i.join(" ")}function cs(o){for(var n=o.getCoordinates().map((function(g){var m=[g.x,g.y];return g.z===void 0||Number.isNaN(g.z)||m.push(g.z),g.m===void 0||Number.isNaN(g.m)||m.push(g.m),m})),i=[],a=0,l=n.length;a<l;++a)i.push(n[a].join(" "));return i.join(", ")}function dc(o){var n=[];n.push("("+cs(o.getExteriorRing())+")");for(var i=0,a=o.getNumInteriorRing();i<a;++i)n.push("("+cs(o.getInteriorRingN(i))+")");return n.join(", ")}var em={Point:gc,LineString:cs,LinearRing:cs,Polygon:dc,MultiPoint:function(o){for(var n=[],i=0,a=o.getNumGeometries();i<a;++i)n.push("("+gc(o.getGeometryN(i))+")");return n.join(", ")},MultiLineString:function(o){for(var n=[],i=0,a=o.getNumGeometries();i<a;++i)n.push("("+cs(o.getGeometryN(i))+")");return n.join(", ")},MultiPolygon:function(o){for(var n=[],i=0,a=o.getNumGeometries();i<a;++i)n.push("("+dc(o.getGeometryN(i))+")");return n.join(", ")},GeometryCollection:function(o){for(var n=[],i=0,a=o.getNumGeometries();i<a;++i)n.push(pc(o.getGeometryN(i)));return n.join(", ")}};function pc(o){var n=o.getGeometryType(),i=em[n];n=n.toUpperCase();var a=(function(l){var g="";if(l.isEmpty())return g;var m=l.getCoordinate();return m.z===void 0||Number.isNaN(m.z)||(g+="Z"),m.m===void 0||Number.isNaN(m.m)||(g+="M"),g})(o);return a.length>0&&(n+=" "+a),o.isEmpty()?n+" "+hc:n+" ("+i(o)+")"}var tm=(function(){return h((function o(n){u(this,o),this.geometryFactory=n||new ki,this.precisionModel=this.geometryFactory.getPrecisionModel()}),[{key:"read",value:function(o){var n=new Kp(o);return new Qp(n,this.geometryFactory).parse()}},{key:"write",value:function(o){return pc(o)}}])})(),qo=(function(){return h((function o(n){u(this,o),this.parser=new tm(n)}),[{key:"write",value:function(o){return this.parser.write(o)}}],[{key:"toLineString",value:function(o,n){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+o.x+" "+o.y+", "+n.x+" "+n.y+" )"}}])})(),ze=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getIndexAlongSegment",value:function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]}},{key:"getTopologySummary",value:function(){var n=new Re;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()}},{key:"computeIntersection",value:function(n,i,a,l){this._inputLines[0][0]=n,this._inputLines[0][1]=i,this._inputLines[1][0]=a,this._inputLines[1][1]=l,this._result=this.computeIntersect(n,i,a,l)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(n){this._precisionModel=n}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],i=0;i<this._result;i++)if(!this._intPt[i].equals2D(this._inputLines[n][0])&&!this._intPt[i].equals2D(this._inputLines[n][1]))return!0;return!1}}},{key:"getIntersection",value:function(n){return this._intPt[n]}},{key:"isEndPoint",value:function(){return this.hasIntersection()&&!this._isProper}},{key:"hasIntersection",value:function(){return this._result!==o.NO_INTERSECTION}},{key:"getEdgeDistance",value:function(n,i){return o.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])}},{key:"isCollinear",value:function(){return this._result===o.COLLINEAR_INTERSECTION}},{key:"toString",value:function(){return qo.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+qo.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()}},{key:"getEndpoint",value:function(n,i){return this._inputLines[n][i]}},{key:"isIntersection",value:function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1}},{key:"getIntersectionAlongSegment",value:function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]}}],[{key:"constructor_",value:function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return Array(2)})),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new V,this._intPt[1]=new V,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}},{key:"computeEdgeDistance",value:function(n,i,a){var l=Math.abs(a.x-i.x),g=Math.abs(a.y-i.y),m=-1;if(n.equals(i))m=0;else if(n.equals(a))m=l>g?l:g;else{var _=Math.abs(n.x-i.x),x=Math.abs(n.y-i.y);(m=l>g?_:x)!==0||n.equals(i)||(m=Math.max(_,x))}return ie.isTrue(!(m===0&&!n.equals(i)),"Bad distance calculation"),m}},{key:"nonRobustComputeEdgeDistance",value:function(n,i,a){var l=n.x-i.x,g=n.y-i.y,m=Math.sqrt(l*l+g*g);return ie.isTrue(!(m===0&&!n.equals(i)),"Invalid distance calculation"),m}}])})();ze.DONT_INTERSECT=0,ze.DO_INTERSECT=1,ze.COLLINEAR=2,ze.NO_INTERSECTION=0,ze.POINT_INTERSECTION=1,ze.COLLINEAR_INTERSECTION=2;var zr=(function(o){function n(){return u(this,n),s(this,n)}return v(n,o),h(n,[{key:"isInSegmentEnvelopes",value:function(i){var a=new Se(this._inputLines[0][0],this._inputLines[0][1]),l=new Se(this._inputLines[1][0],this._inputLines[1][1]);return a.contains(i)&&l.contains(i)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return b(n,"computeIntersection",this,1).apply(this,arguments);var i=arguments[0],a=arguments[1],l=arguments[2];if(this._isProper=!1,Se.intersects(a,l,i)&&ve.index(a,l,i)===0&&ve.index(l,a,i)===0)return this._isProper=!0,(i.equals(a)||i.equals(l))&&(this._isProper=!1),this._result=ze.POINT_INTERSECTION,null;this._result=ze.NO_INTERSECTION}},{key:"intersection",value:function(i,a,l,g){var m=this.intersectionSafe(i,a,l,g);return this.isInSegmentEnvelopes(m)||(m=new V(n.nearestEndpoint(i,a,l,g))),this._precisionModel!==null&&this._precisionModel.makePrecise(m),m}},{key:"checkDD",value:function(i,a,l,g,m){var _=gi.intersection(i,a,l,g),x=this.isInSegmentEnvelopes(_);Ot.out.println("DD in env = "+x+" --------------------- "+_),m.distance(_)>1e-4&&Ot.out.println("Distance = "+m.distance(_))}},{key:"intersectionSafe",value:function(i,a,l,g){var m=jr.intersection(i,a,l,g);return m===null&&(m=n.nearestEndpoint(i,a,l,g)),m}},{key:"computeCollinearIntersection",value:function(i,a,l,g){var m=Se.intersects(i,a,l),_=Se.intersects(i,a,g),x=Se.intersects(l,g,i),M=Se.intersects(l,g,a);return m&&_?(this._intPt[0]=l,this._intPt[1]=g,ze.COLLINEAR_INTERSECTION):x&&M?(this._intPt[0]=i,this._intPt[1]=a,ze.COLLINEAR_INTERSECTION):m&&x?(this._intPt[0]=l,this._intPt[1]=i,!l.equals(i)||_||M?ze.COLLINEAR_INTERSECTION:ze.POINT_INTERSECTION):m&&M?(this._intPt[0]=l,this._intPt[1]=a,!l.equals(a)||_||x?ze.COLLINEAR_INTERSECTION:ze.POINT_INTERSECTION):_&&x?(this._intPt[0]=g,this._intPt[1]=i,!g.equals(i)||m||M?ze.COLLINEAR_INTERSECTION:ze.POINT_INTERSECTION):_&&M?(this._intPt[0]=g,this._intPt[1]=a,!g.equals(a)||m||x?ze.COLLINEAR_INTERSECTION:ze.POINT_INTERSECTION):ze.NO_INTERSECTION}},{key:"computeIntersect",value:function(i,a,l,g){if(this._isProper=!1,!Se.intersects(i,a,l,g))return ze.NO_INTERSECTION;var m=ve.index(i,a,l),_=ve.index(i,a,g);if(m>0&&_>0||m<0&&_<0)return ze.NO_INTERSECTION;var x=ve.index(l,g,i),M=ve.index(l,g,a);return x>0&&M>0||x<0&&M<0?ze.NO_INTERSECTION:m===0&&_===0&&x===0&&M===0?this.computeCollinearIntersection(i,a,l,g):(m===0||_===0||x===0||M===0?(this._isProper=!1,i.equals2D(l)||i.equals2D(g)?this._intPt[0]=i:a.equals2D(l)||a.equals2D(g)?this._intPt[0]=a:m===0?this._intPt[0]=new V(l):_===0?this._intPt[0]=new V(g):x===0?this._intPt[0]=new V(i):M===0&&(this._intPt[0]=new V(a))):(this._isProper=!0,this._intPt[0]=this.intersection(i,a,l,g)),ze.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(i,a,l,g){var m=i,_=yt.pointToSegment(i,l,g),x=yt.pointToSegment(a,l,g);return x<_&&(_=x,m=a),(x=yt.pointToSegment(l,i,a))<_&&(_=x,m=l),(x=yt.pointToSegment(g,i,a))<_&&(_=x,m=g),m}}])})(ze),nm=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"countSegment",value:function(n,i){if(n.x<this._p.x&&i.x<this._p.x)return null;if(this._p.x===i.x&&this._p.y===i.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&i.y===this._p.y){var a=n.x,l=i.x;return a>l&&(a=i.x,l=n.x),this._p.x>=a&&this._p.x<=l&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&n.y<=this._p.y){var g=ve.index(n,i,this._p);if(g===ve.COLLINEAR)return this._isPointOnSegment=!0,null;i.y<n.y&&(g=-g),g===ve.LEFT&&this._crossingCount++}}},{key:"isPointInPolygon",value:function(){return this.getLocation()!==A.EXTERIOR}},{key:"getLocation",value:function(){return this._isPointOnSegment?A.BOUNDARY:this._crossingCount%2==1?A.INTERIOR:A.EXTERIOR}},{key:"isOnSegment",value:function(){return this._isPointOnSegment}}],[{key:"constructor_",value:function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n}},{key:"locatePointInRing",value:function(){if(arguments[0]instanceof V&&_e(arguments[1],be)){for(var n=arguments[1],i=new o(arguments[0]),a=new V,l=new V,g=1;g<n.size();g++)if(n.getCoordinate(g,a),n.getCoordinate(g-1,l),i.countSegment(a,l),i.isOnSegment())return i.getLocation();return i.getLocation()}if(arguments[0]instanceof V&&arguments[1]instanceof Array){for(var m=arguments[1],_=new o(arguments[0]),x=1;x<m.length;x++){var M=m[x],j=m[x-1];if(_.countSegment(M,j),_.isOnSegment())return _.getLocation()}return _.getLocation()}}}])})(),Yo=(function(){function o(){u(this,o)}return h(o,null,[{key:"isOnLine",value:function(){if(arguments[0]instanceof V&&_e(arguments[1],be)){for(var n=arguments[0],i=arguments[1],a=new zr,l=new V,g=new V,m=i.size(),_=1;_<m;_++)if(i.getCoordinate(_-1,l),i.getCoordinate(_,g),a.computeIntersection(n,l,g),a.hasIntersection())return!0;return!1}if(arguments[0]instanceof V&&arguments[1]instanceof Array){for(var x=arguments[0],M=arguments[1],j=new zr,X=1;X<M.length;X++){var K=M[X-1],ce=M[X];if(j.computeIntersection(x,K,ce),j.hasIntersection())return!0}return!1}}},{key:"locateInRing",value:function(n,i){return nm.locatePointInRing(n,i)}},{key:"isInRing",value:function(n,i){return o.locateInRing(n,i)!==A.EXTERIOR}}])})(),Vt=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"setAllLocations",value:function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n}},{key:"isNull",value:function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==A.NONE)return!1;return!0}},{key:"setAllLocationsIfNull",value:function(n){for(var i=0;i<this.location.length;i++)this.location[i]===A.NONE&&(this.location[i]=n)}},{key:"isLine",value:function(){return this.location.length===1}},{key:"merge",value:function(n){if(n.location.length>this.location.length){var i=new Array(3).fill(null);i[re.ON]=this.location[re.ON],i[re.LEFT]=A.NONE,i[re.RIGHT]=A.NONE,this.location=i}for(var a=0;a<this.location.length;a++)this.location[a]===A.NONE&&a<n.location.length&&(this.location[a]=n.location[a])}},{key:"getLocations",value:function(){return this.location}},{key:"flip",value:function(){if(this.location.length<=1)return null;var n=this.location[re.LEFT];this.location[re.LEFT]=this.location[re.RIGHT],this.location[re.RIGHT]=n}},{key:"toString",value:function(){var n=new hn;return this.location.length>1&&n.append(A.toLocationSymbol(this.location[re.LEFT])),n.append(A.toLocationSymbol(this.location[re.ON])),this.location.length>1&&n.append(A.toLocationSymbol(this.location[re.RIGHT])),n.toString()}},{key:"setLocations",value:function(n,i,a){this.location[re.ON]=n,this.location[re.LEFT]=i,this.location[re.RIGHT]=a}},{key:"get",value:function(n){return n<this.location.length?this.location[n]:A.NONE}},{key:"isArea",value:function(){return this.location.length>1}},{key:"isAnyNull",value:function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===A.NONE)return!0;return!1}},{key:"setLocation",value:function(){if(arguments.length===1){var n=arguments[0];this.setLocation(re.ON,n)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.location[i]=a}}},{key:"init",value:function(n){this.location=new Array(n).fill(null),this.setAllLocations(A.NONE)}},{key:"isEqualOnSide",value:function(n,i){return this.location[i]===n.location[i]}},{key:"allPositionsEqual",value:function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0}}],[{key:"constructor_",value:function(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];this.init(n.length)}else if(Number.isInteger(arguments[0])){var i=arguments[0];this.init(1),this.location[re.ON]=i}else if(arguments[0]instanceof o){var a=arguments[0];if(this.init(a.location.length),a!==null)for(var l=0;l<this.location.length;l++)this.location[l]=a.location[l]}}else if(arguments.length===3){var g=arguments[0],m=arguments[1],_=arguments[2];this.init(3),this.location[re.ON]=g,this.location[re.LEFT]=m,this.location[re.RIGHT]=_}}}])})(),Xt=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getGeometryCount",value:function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n}},{key:"setAllLocations",value:function(n,i){this.elt[n].setAllLocations(i)}},{key:"isNull",value:function(n){return this.elt[n].isNull()}},{key:"setAllLocationsIfNull",value:function(){if(arguments.length===1){var n=arguments[0];this.setAllLocationsIfNull(0,n),this.setAllLocationsIfNull(1,n)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.elt[i].setAllLocationsIfNull(a)}}},{key:"isLine",value:function(n){return this.elt[n].isLine()}},{key:"merge",value:function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new Vt(n.elt[i]):this.elt[i].merge(n.elt[i])}},{key:"flip",value:function(){this.elt[0].flip(),this.elt[1].flip()}},{key:"getLocation",value:function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(re.ON)}if(arguments.length===2){var i=arguments[0],a=arguments[1];return this.elt[i].get(a)}}},{key:"toString",value:function(){var n=new hn;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()}},{key:"isArea",value:function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var n=arguments[0];return this.elt[n].isArea()}}},{key:"isAnyNull",value:function(n){return this.elt[n].isAnyNull()}},{key:"setLocation",value:function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setLocation(re.ON,i)}else if(arguments.length===3){var a=arguments[0],l=arguments[1],g=arguments[2];this.elt[a].setLocation(l,g)}}},{key:"isEqualOnSide",value:function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)}},{key:"allPositionsEqual",value:function(n,i){return this.elt[n].allPositionsEqual(i)}},{key:"toLine",value:function(n){this.elt[n].isArea()&&(this.elt[n]=new Vt(this.elt[n].location[0]))}}],[{key:"constructor_",value:function(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var n=arguments[0];this.elt[0]=new Vt(n),this.elt[1]=new Vt(n)}else if(arguments[0]instanceof o){var i=arguments[0];this.elt[0]=new Vt(i.elt[0]),this.elt[1]=new Vt(i.elt[1])}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.elt[0]=new Vt(A.NONE),this.elt[1]=new Vt(A.NONE),this.elt[a].setLocation(l)}else if(arguments.length===3){var g=arguments[0],m=arguments[1],_=arguments[2];this.elt[0]=new Vt(g,m,_),this.elt[1]=new Vt(g,m,_)}else if(arguments.length===4){var x=arguments[0],M=arguments[1],j=arguments[2],X=arguments[3];this.elt[0]=new Vt(A.NONE,A.NONE,A.NONE),this.elt[1]=new Vt(A.NONE,A.NONE,A.NONE),this.elt[x].setLocations(M,j,X)}}},{key:"toLineLabel",value:function(n){for(var i=new o(A.NONE),a=0;a<2;a++)i.setLocation(a,n.getLocation(a));return i}}])})(),pa=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"computeRing",value:function(){if(this._ring!==null)return null;for(var o=new Array(this._pts.size()).fill(null),n=0;n<this._pts.size();n++)o[n]=this._pts.get(n);this._ring=this._geometryFactory.createLinearRing(o),this._isHole=ve.isCCW(this._ring.getCoordinates())}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"computePoints",value:function(o){this._startDe=o;var n=o,i=!0;do{if(n===null)throw new Pt("Found null DirectedEdge");if(n.getEdgeRing()===this)throw new Pt("Directed Edge visited twice during ring-building at "+n.getCoordinate());this._edges.add(n);var a=n.getLabel();ie.isTrue(a.isArea()),this.mergeLabel(a),this.addPoints(n.getEdge(),n.isForward(),i),i=!1,this.setEdgeRing(n,this),n=this.getNext(n)}while(n!==this._startDe)}},{key:"getLinearRing",value:function(){return this._ring}},{key:"getCoordinate",value:function(o){return this._pts.get(o)}},{key:"computeMaxNodeDegree",value:function(){this._maxNodeDegree=0;var o=this._startDe;do{var n=o.getNode().getEdges().getOutgoingDegree(this);n>this._maxNodeDegree&&(this._maxNodeDegree=n),o=this.getNext(o)}while(o!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(o,n,i){var a=o.getCoordinates();if(n){var l=1;i&&(l=0);for(var g=l;g<a.length;g++)this._pts.add(a[g])}else{var m=a.length-2;i&&(m=a.length-1);for(var _=m;_>=0;_--)this._pts.add(a[_])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var o=this._startDe;do o.getEdge().setInResult(!0),o=o.getNext();while(o!==this._startDe)}},{key:"containsPoint",value:function(o){var n=this.getLinearRing();if(!n.getEnvelopeInternal().contains(o)||!Yo.isInRing(o,n.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();)if(i.next().containsPoint(o))return!1;return!0}},{key:"addHole",value:function(o){this._holes.add(o)}},{key:"isShell",value:function(){return this._shell===null}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(arguments.length===1){var o=arguments[0];this.mergeLabel(o,0),this.mergeLabel(o,1)}else if(arguments.length===2){var n=arguments[1],i=arguments[0].getLocation(n,re.RIGHT);if(i===A.NONE)return null;if(this._label.getLocation(n)===A.NONE)return this._label.setLocation(n,i),null}}},{key:"setShell",value:function(o){this._shell=o,o!==null&&o.addHole(this)}},{key:"toPolygon",value:function(o){for(var n=new Array(this._holes.size()).fill(null),i=0;i<this._holes.size();i++)n[i]=this._holes.get(i).getLinearRing();return o.createPolygon(this.getLinearRing(),n)}}],[{key:"constructor_",value:function(){if(this._startDe=null,this._maxNodeDegree=-1,this._edges=new de,this._pts=new de,this._label=new Xt(A.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new de,this._geometryFactory=null,arguments.length!==0&&arguments.length===2){var o=arguments[0],n=arguments[1];this._geometryFactory=n,this.computePoints(o),this.computeRing()}}}])})(),rm=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"setEdgeRing",value:function(i,a){i.setMinEdgeRing(a)}},{key:"getNext",value:function(i){return i.getNextMin()}}],[{key:"constructor_",value:function(){var i=arguments[0],a=arguments[1];pa.constructor_.call(this,i,a)}}])})(pa),im=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"buildMinimalRings",value:function(){var i=new de,a=this._startDe;do{if(a.getMinEdgeRing()===null){var l=new rm(a,this._geometryFactory);i.add(l)}a=a.getNext()}while(a!==this._startDe);return i}},{key:"setEdgeRing",value:function(i,a){i.setEdgeRing(a)}},{key:"linkDirectedEdgesForMinimalEdgeRings",value:function(){var i=this._startDe;do i.getNode().getEdges().linkMinimalDirectedEdges(this),i=i.getNext();while(i!==this._startDe)}},{key:"getNext",value:function(i){return i.getNext()}}],[{key:"constructor_",value:function(){var i=arguments[0],a=arguments[1];pa.constructor_.call(this,i,a)}}])})(pa),mc=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"setVisited",value:function(o){this._isVisited=o}},{key:"setInResult",value:function(o){this._isInResult=o}},{key:"isCovered",value:function(){return this._isCovered}},{key:"isCoveredSet",value:function(){return this._isCoveredSet}},{key:"setLabel",value:function(o){this._label=o}},{key:"getLabel",value:function(){return this._label}},{key:"setCovered",value:function(o){this._isCovered=o,this._isCoveredSet=!0}},{key:"updateIM",value:function(o){ie.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(o)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0&&arguments.length===1){var o=arguments[0];this._label=o}}}])})(),ma=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"isIncidentEdgeInResult",value:function(){for(var i=this.getEdges().getEdges().iterator();i.hasNext();)if(i.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(i){i.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(i){}},{key:"computeMergedLocation",value:function(i,a){var l=A.NONE;if(l=this._label.getLocation(a),!i.isNull(a)){var g=i.getLocation(a);l!==A.BOUNDARY&&(l=g)}return l}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return b(n,"setLabel",this,1).apply(this,arguments);var i=arguments[0],a=arguments[1];this._label===null?this._label=new Xt(i,a):this._label.setLocation(i,a)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof n){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof Xt)for(var a=arguments[0],l=0;l<2;l++){var g=this.computeMergedLocation(a,l);this._label.getLocation(l)===A.NONE&&this._label.setLocation(l,g)}}},{key:"add",value:function(i){this._edges.insert(i),i.setNode(this)}},{key:"setLabelBoundary",value:function(i){if(this._label===null)return null;var a=A.NONE;this._label!==null&&(a=this._label.getLocation(i));var l=null;switch(a){case A.BOUNDARY:l=A.INTERIOR;break;case A.INTERIOR:default:l=A.BOUNDARY}this._label.setLocation(i,l)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var i=arguments[0],a=arguments[1];this._coord=i,this._edges=a,this._label=new Xt(0,A.NONE)}}])})(mc),sm=(function(o){function n(){return u(this,n),s(this,n,arguments)}return v(n,o),h(n)})(_i);function vc(o){return o==null?0:o.color}function Pe(o){return o==null?null:o.parent}function Fn(o,n){o!==null&&(o.color=n)}function zo(o){return o==null?null:o.left}function yc(o){return o==null?null:o.right}var hs=(function(o){function n(){var i;return u(this,n),(i=s(this,n)).root_=null,i.size_=0,i}return v(n,o),h(n,[{key:"get",value:function(i){for(var a=this.root_;a!==null;){var l=i.compareTo(a.key);if(l<0)a=a.left;else{if(!(l>0))return a.value;a=a.right}}return null}},{key:"put",value:function(i,a){if(this.root_===null)return this.root_={key:i,value:a,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var l,g,m=this.root_;do if(l=m,(g=i.compareTo(m.key))<0)m=m.left;else{if(!(g>0)){var _=m.value;return m.value=a,_}m=m.right}while(m!==null);var x={key:i,left:null,right:null,value:a,parent:l,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return g<0?l.left=x:l.right=x,this.fixAfterInsertion(x),this.size_++,null}},{key:"fixAfterInsertion",value:function(i){var a;for(i.color=1;i!=null&&i!==this.root_&&i.parent.color===1;)Pe(i)===zo(Pe(Pe(i)))?vc(a=yc(Pe(Pe(i))))===1?(Fn(Pe(i),0),Fn(a,0),Fn(Pe(Pe(i)),1),i=Pe(Pe(i))):(i===yc(Pe(i))&&(i=Pe(i),this.rotateLeft(i)),Fn(Pe(i),0),Fn(Pe(Pe(i)),1),this.rotateRight(Pe(Pe(i)))):vc(a=zo(Pe(Pe(i))))===1?(Fn(Pe(i),0),Fn(a,0),Fn(Pe(Pe(i)),1),i=Pe(Pe(i))):(i===zo(Pe(i))&&(i=Pe(i),this.rotateRight(i)),Fn(Pe(i),0),Fn(Pe(Pe(i)),1),this.rotateLeft(Pe(Pe(i))));this.root_.color=0}},{key:"values",value:function(){var i=new de,a=this.getFirstEntry();if(a!==null)for(i.add(a.value);(a=n.successor(a))!==null;)i.add(a.value);return i}},{key:"entrySet",value:function(){var i=new Br,a=this.getFirstEntry();if(a!==null)for(i.add(a);(a=n.successor(a))!==null;)i.add(a);return i}},{key:"rotateLeft",value:function(i){if(i!=null){var a=i.right;i.right=a.left,a.left!=null&&(a.left.parent=i),a.parent=i.parent,i.parent==null?this.root_=a:i.parent.left===i?i.parent.left=a:i.parent.right=a,a.left=i,i.parent=a}}},{key:"rotateRight",value:function(i){if(i!=null){var a=i.left;i.left=a.right,a.right!=null&&(a.right.parent=i),a.parent=i.parent,i.parent==null?this.root_=a:i.parent.right===i?i.parent.right=a:i.parent.left=a,a.right=i,i.parent=a}}},{key:"getFirstEntry",value:function(){var i=this.root_;if(i!=null)for(;i.left!=null;)i=i.left;return i}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(i){for(var a=this.root_;a!==null;){var l=i.compareTo(a.key);if(l<0)a=a.left;else{if(!(l>0))return!0;a=a.right}}return!1}}],[{key:"successor",value:function(i){var a;if(i===null)return null;if(i.right!==null){for(a=i.right;a.left!==null;)a=a.left;return a}a=i.parent;for(var l=i;a!==null&&l===a.right;)l=a,a=a.parent;return a}}])})(sm),_c=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"find",value:function(o){return this.nodeMap.get(o)}},{key:"addNode",value:function(){if(arguments[0]instanceof V){var o=arguments[0],n=this.nodeMap.get(o);return n===null&&(n=this.nodeFact.createNode(o),this.nodeMap.put(o,n)),n}if(arguments[0]instanceof ma){var i=arguments[0],a=this.nodeMap.get(i.getCoordinate());return a===null?(this.nodeMap.put(i.getCoordinate(),i),i):(a.mergeLabel(i),a)}}},{key:"print",value:function(o){for(var n=this.iterator();n.hasNext();)n.next().print(o)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(o){for(var n=new de,i=this.iterator();i.hasNext();){var a=i.next();a.getLabel().getLocation(o)===A.BOUNDARY&&n.add(a)}return n}},{key:"add",value:function(o){var n=o.getCoordinate();this.addNode(n).add(o)}}],[{key:"constructor_",value:function(){this.nodeMap=new hs,this.nodeFact=null;var o=arguments[0];this.nodeFact=o}}])})(),wt=(function(){function o(){u(this,o)}return h(o,null,[{key:"isNorthern",value:function(n){return n===o.NE||n===o.NW}},{key:"isOpposite",value:function(n,i){return n!==i&&(n-i+4)%4===2}},{key:"commonHalfPlane",value:function(n,i){if(n===i)return n;if((n-i+4)%4===2)return-1;var a=n<i?n:i;return a===0&&(n>i?n:i)===3?3:a}},{key:"isInHalfPlane",value:function(n,i){return i===o.SE?n===o.SE||n===o.SW:n===i||n===i+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new J("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?o.NE:o.SE:i>=0?o.NW:o.SW}if(arguments[0]instanceof V&&arguments[1]instanceof V){var a=arguments[0],l=arguments[1];if(l.x===a.x&&l.y===a.y)throw new J("Cannot compute the quadrant for two identical points "+a);return l.x>=a.x?l.y>=a.y?o.NE:o.SE:l.y>=a.y?o.NW:o.SW}}}])})();wt.NE=0,wt.NW=1,wt.SW=2,wt.SE=3;var kc=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"compareDirection",value:function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:ve.index(n._p0,n._p1,this._p1)}},{key:"getDy",value:function(){return this._dy}},{key:"getCoordinate",value:function(){return this._p0}},{key:"setNode",value:function(n){this._node=n}},{key:"print",value:function(n){var i=Math.atan2(this._dy,this._dx),a=this.getClass().getName(),l=a.lastIndexOf("."),g=a.substring(l+1);n.print(" "+g+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)}},{key:"compareTo",value:function(n){var i=n;return this.compareDirection(i)}},{key:"getDirectedCoordinate",value:function(){return this._p1}},{key:"getDx",value:function(){return this._dx}},{key:"getLabel",value:function(){return this._label}},{key:"getEdge",value:function(){return this._edge}},{key:"getQuadrant",value:function(){return this._quadrant}},{key:"getNode",value:function(){return this._node}},{key:"toString",value:function(){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),a=i.lastIndexOf(".");return" "+i.substring(a+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label}},{key:"computeLabel",value:function(n){}},{key:"init",value:function(n,i){this._p0=n,this._p1=i,this._dx=i.x-n.x,this._dy=i.y-n.y,this._quadrant=wt.quadrant(this._dx,this._dy),ie.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var i=arguments[0],a=arguments[1],l=arguments[2];o.constructor_.call(this,i,a,l,null)}else if(arguments.length===4){var g=arguments[0],m=arguments[1],_=arguments[2],x=arguments[3];o.constructor_.call(this,g),this.init(m,_),this._label=x}}}])})(),Jo=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"getNextMin",value:function(){return this._nextMin}},{key:"getDepth",value:function(i){return this._depth[i]}},{key:"setVisited",value:function(i){this._isVisited=i}},{key:"computeDirectedLabel",value:function(){this._label=new Xt(this._edge.getLabel()),this._isForward||this._label.flip()}},{key:"getNext",value:function(){return this._next}},{key:"setDepth",value:function(i,a){if(this._depth[i]!==-999&&this._depth[i]!==a)throw new Pt("assigned depths do not match",this.getCoordinate());this._depth[i]=a}},{key:"isInteriorAreaEdge",value:function(){for(var i=!0,a=0;a<2;a++)this._label.isArea(a)&&this._label.getLocation(a,re.LEFT)===A.INTERIOR&&this._label.getLocation(a,re.RIGHT)===A.INTERIOR||(i=!1);return i}},{key:"setNextMin",value:function(i){this._nextMin=i}},{key:"print",value:function(i){b(n,"print",this,1).call(this,i),i.print(" "+this._depth[re.LEFT]+"/"+this._depth[re.RIGHT]),i.print(" ("+this.getDepthDelta()+")"),this._isInResult&&i.print(" inResult")}},{key:"setMinEdgeRing",value:function(i){this._minEdgeRing=i}},{key:"isLineEdge",value:function(){var i=this._label.isLine(0)||this._label.isLine(1),a=!this._label.isArea(0)||this._label.allPositionsEqual(0,A.EXTERIOR),l=!this._label.isArea(1)||this._label.allPositionsEqual(1,A.EXTERIOR);return i&&a&&l}},{key:"setEdgeRing",value:function(i){this._edgeRing=i}},{key:"getMinEdgeRing",value:function(){return this._minEdgeRing}},{key:"getDepthDelta",value:function(){var i=this._edge.getDepthDelta();return this._isForward||(i=-i),i}},{key:"setInResult",value:function(i){this._isInResult=i}},{key:"getSym",value:function(){return this._sym}},{key:"isForward",value:function(){return this._isForward}},{key:"getEdge",value:function(){return this._edge}},{key:"printEdge",value:function(i){this.print(i),i.print(" "),this._isForward?this._edge.print(i):this._edge.printReverse(i)}},{key:"setSym",value:function(i){this._sym=i}},{key:"setVisitedEdge",value:function(i){this.setVisited(i),this._sym.setVisited(i)}},{key:"setEdgeDepths",value:function(i,a){var l=this.getEdge().getDepthDelta();this._isForward||(l=-l);var g=1;i===re.LEFT&&(g=-1);var m=re.opposite(i),_=a+l*g;this.setDepth(i,a),this.setDepth(m,_)}},{key:"getEdgeRing",value:function(){return this._edgeRing}},{key:"isInResult",value:function(){return this._isInResult}},{key:"setNext",value:function(i){this._next=i}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999];var i=arguments[0],a=arguments[1];if(kc.constructor_.call(this,i),this._isForward=a,a)this.init(i.getCoordinate(0),i.getCoordinate(1));else{var l=i.getNumPoints()-1;this.init(i.getCoordinate(l),i.getCoordinate(l-1))}this.computeDirectedLabel()}},{key:"depthFactor",value:function(i,a){return i===A.EXTERIOR&&a===A.INTERIOR?1:i===A.INTERIOR&&a===A.EXTERIOR?-1:0}}])})(kc),Ec=(function(){return h((function o(){u(this,o)}),[{key:"createNode",value:function(o){return new ma(o,null)}}])})(),xc=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"printEdges",value:function(o){o.println("Edges:");for(var n=0;n<this._edges.size();n++){o.println("edge "+n+":");var i=this._edges.get(n);i.print(o),i.eiList.print(o)}}},{key:"find",value:function(o){return this._nodes.find(o)}},{key:"addNode",value:function(){if(arguments[0]instanceof ma){var o=arguments[0];return this._nodes.addNode(o)}if(arguments[0]instanceof V){var n=arguments[0];return this._nodes.addNode(n)}}},{key:"getNodeIterator",value:function(){return this._nodes.iterator()}},{key:"linkResultDirectedEdges",value:function(){for(var o=this._nodes.iterator();o.hasNext();)o.next().getEdges().linkResultDirectedEdges()}},{key:"debugPrintln",value:function(o){Ot.out.println(o)}},{key:"isBoundaryNode",value:function(o,n){var i=this._nodes.find(n);if(i===null)return!1;var a=i.getLabel();return a!==null&&a.getLocation(o)===A.BOUNDARY}},{key:"linkAllDirectedEdges",value:function(){for(var o=this._nodes.iterator();o.hasNext();)o.next().getEdges().linkAllDirectedEdges()}},{key:"matchInSameDirection",value:function(o,n,i,a){return!!o.equals(i)&&ve.index(o,n,a)===ve.COLLINEAR&&wt.quadrant(o,n)===wt.quadrant(i,a)}},{key:"getEdgeEnds",value:function(){return this._edgeEndList}},{key:"debugPrint",value:function(o){Ot.out.print(o)}},{key:"getEdgeIterator",value:function(){return this._edges.iterator()}},{key:"findEdgeInSameDirection",value:function(o,n){for(var i=0;i<this._edges.size();i++){var a=this._edges.get(i),l=a.getCoordinates();if(this.matchInSameDirection(o,n,l[0],l[1])||this.matchInSameDirection(o,n,l[l.length-1],l[l.length-2]))return a}return null}},{key:"insertEdge",value:function(o){this._edges.add(o)}},{key:"findEdgeEnd",value:function(o){for(var n=this.getEdgeEnds().iterator();n.hasNext();){var i=n.next();if(i.getEdge()===o)return i}return null}},{key:"addEdges",value:function(o){for(var n=o.iterator();n.hasNext();){var i=n.next();this._edges.add(i);var a=new Jo(i,!0),l=new Jo(i,!1);a.setSym(l),l.setSym(a),this.add(a),this.add(l)}}},{key:"add",value:function(o){this._nodes.add(o),this._edgeEndList.add(o)}},{key:"getNodes",value:function(){return this._nodes.values()}},{key:"findEdge",value:function(o,n){for(var i=0;i<this._edges.size();i++){var a=this._edges.get(i),l=a.getCoordinates();if(o.equals(l[0])&&n.equals(l[1]))return a}return null}}],[{key:"constructor_",value:function(){if(this._edges=new de,this._nodes=null,this._edgeEndList=new de,arguments.length===0)this._nodes=new _c(new Ec);else if(arguments.length===1){var o=arguments[0];this._nodes=new _c(o)}}},{key:"linkResultDirectedEdges",value:function(o){for(var n=o.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()}}])})(),am=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"sortShellsAndHoles",value:function(n,i,a){for(var l=n.iterator();l.hasNext();){var g=l.next();g.isHole()?a.add(g):i.add(g)}}},{key:"computePolygons",value:function(n){for(var i=new de,a=n.iterator();a.hasNext();){var l=a.next().toPolygon(this._geometryFactory);i.add(l)}return i}},{key:"placeFreeHoles",value:function(n,i){for(var a=i.iterator();a.hasNext();){var l=a.next();if(l.getShell()===null){var g=o.findEdgeRingContaining(l,n);if(g===null)throw new Pt("unable to assign hole to a shell",l.getCoordinate(0));l.setShell(g)}}}},{key:"buildMinimalEdgeRings",value:function(n,i,a){for(var l=new de,g=n.iterator();g.hasNext();){var m=g.next();if(m.getMaxNodeDegree()>2){m.linkDirectedEdgesForMinimalEdgeRings();var _=m.buildMinimalRings(),x=this.findShell(_);x!==null?(this.placePolygonHoles(x,_),i.add(x)):a.addAll(_)}else l.add(m)}return l}},{key:"buildMaximalEdgeRings",value:function(n){for(var i=new de,a=n.iterator();a.hasNext();){var l=a.next();if(l.isInResult()&&l.getLabel().isArea()&&l.getEdgeRing()===null){var g=new im(l,this._geometryFactory);i.add(g),g.setInResult()}}return i}},{key:"placePolygonHoles",value:function(n,i){for(var a=i.iterator();a.hasNext();){var l=a.next();l.isHole()&&l.setShell(n)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(n){for(var i=0,a=null,l=n.iterator();l.hasNext();){var g=l.next();g.isHole()||(a=g,i++)}return ie.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),a}},{key:"add",value:function(){if(arguments.length===1){var n=arguments[0];this.add(n.getEdgeEnds(),n.getNodes())}else if(arguments.length===2){var i=arguments[0],a=arguments[1];xc.linkResultDirectedEdges(a);var l=this.buildMaximalEdgeRings(i),g=new de,m=this.buildMinimalEdgeRings(l,this._shellList,g);this.sortShellsAndHoles(m,this._shellList,g),this.placeFreeHoles(this._shellList,g)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new de;var n=arguments[0];this._geometryFactory=n}},{key:"findEdgeRingContaining",value:function(n,i){for(var a=n.getLinearRing(),l=a.getEnvelopeInternal(),g=a.getCoordinateN(0),m=null,_=null,x=i.iterator();x.hasNext();){var M=x.next(),j=M.getLinearRing(),X=j.getEnvelopeInternal();if(!X.equals(l)&&X.contains(l)){g=ee.ptNotInList(a.getCoordinates(),j.getCoordinates());var K=!1;Yo.isInRing(g,j.getCoordinates())&&(K=!0),K&&(m===null||_.contains(X))&&(_=(m=M).getLinearRing().getEnvelopeInternal())}}return m}}])})(),wc=(function(){return h((function o(){u(this,o)}),[{key:"getBounds",value:function(){}}])})(),tr=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[wc,w]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var o=arguments[0],n=arguments[1];this._bounds=o,this._item=n}}])})(),va=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"poll",value:function(){if(this.isEmpty())return null;var o=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),o}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(o){for(var n=null,i=this._items.get(o);2*o<=this._size&&((n=2*o)!==this._size&&this._items.get(n+1).compareTo(this._items.get(n))<0&&n++,this._items.get(n).compareTo(i)<0);o=n)this._items.set(o,this._items.get(n));this._items.set(o,i)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return this._size===0}},{key:"add",value:function(o){this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,o);o.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)this._items.set(n,this._items.get(Math.trunc(n/2)));this._items.set(n,o)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new de,this._items.add(null)}}])})(),om=(function(){return h((function o(){u(this,o)}),[{key:"insert",value:function(o,n){}},{key:"remove",value:function(o,n){}},{key:"query",value:function(){}}])})(),$t=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(o){ie.isTrue(this._bounds===null),this._childBoundables.add(o)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[wc,w]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new de,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var o=arguments[0];this._level=o}}}])})(),xi={reverseOrder:function(){return{compare:function(o,n){return n.compareTo(o)}}},min:function(o){return xi.sort(o),o.get(0)},sort:function(o,n){var i=o.toArray();n?_t.sort(i,n):_t.sort(i);for(var a=o.iterator(),l=0,g=i.length;l<g;l++)a.next(),a.set(i[l])},singletonList:function(o){var n=new de;return n.add(o),n}},um=(function(){function o(){u(this,o)}return h(o,null,[{key:"maxDistance",value:function(n,i,a,l,g,m,_,x){var M=o.distance(n,i,g,m);return M=Math.max(M,o.distance(n,i,_,x)),M=Math.max(M,o.distance(a,l,g,m)),M=Math.max(M,o.distance(a,l,_,x))}},{key:"distance",value:function(n,i,a,l){var g=a-n,m=l-i;return Math.sqrt(g*g+m*m)}},{key:"maximumDistance",value:function(n,i){var a=Math.min(n.getMinX(),i.getMinX()),l=Math.min(n.getMinY(),i.getMinY()),g=Math.max(n.getMaxX(),i.getMaxX()),m=Math.max(n.getMaxY(),i.getMaxY());return o.distance(a,l,g,m)}},{key:"minMaxDistance",value:function(n,i){var a=n.getMinX(),l=n.getMinY(),g=n.getMaxX(),m=n.getMaxY(),_=i.getMinX(),x=i.getMinY(),M=i.getMaxX(),j=i.getMaxY(),X=o.maxDistance(a,l,a,m,_,x,_,j);return X=Math.min(X,o.maxDistance(a,l,a,m,_,x,M,x)),X=Math.min(X,o.maxDistance(a,l,a,m,M,j,_,j)),X=Math.min(X,o.maxDistance(a,l,a,m,M,j,M,x)),X=Math.min(X,o.maxDistance(a,l,g,l,_,x,_,j)),X=Math.min(X,o.maxDistance(a,l,g,l,_,x,M,x)),X=Math.min(X,o.maxDistance(a,l,g,l,M,j,_,j)),X=Math.min(X,o.maxDistance(a,l,g,l,M,j,M,x)),X=Math.min(X,o.maxDistance(g,m,a,m,_,x,_,j)),X=Math.min(X,o.maxDistance(g,m,a,m,_,x,M,x)),X=Math.min(X,o.maxDistance(g,m,a,m,M,j,_,j)),X=Math.min(X,o.maxDistance(g,m,a,m,M,j,M,x)),X=Math.min(X,o.maxDistance(g,m,g,l,_,x,_,j)),X=Math.min(X,o.maxDistance(g,m,g,l,_,x,M,x)),X=Math.min(X,o.maxDistance(g,m,g,l,M,j,_,j)),X=Math.min(X,o.maxDistance(g,m,g,l,M,j,M,x))}}])})(),wi=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"maximumDistance",value:function(){return um.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}},{key:"expandToQueue",value:function(n,i){var a=o.isComposite(this._boundable1),l=o.isComposite(this._boundable2);if(a&&l)return o.area(this._boundable1)>o.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,n,i),null):(this.expand(this._boundable2,this._boundable1,!0,n,i),null);if(a)return this.expand(this._boundable1,this._boundable2,!1,n,i),null;if(l)return this.expand(this._boundable2,this._boundable1,!0,n,i),null;throw new J("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(o.isComposite(this._boundable1)||o.isComposite(this._boundable2))}},{key:"compareTo",value:function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0}},{key:"expand",value:function(n,i,a,l,g){for(var m=n.getChildBoundables().iterator();m.hasNext();){var _=m.next(),x=null;(x=a?new o(i,_,this._itemDistance):new o(_,i,this._itemDistance)).getDistance()<g&&l.add(x)}}},{key:"getBoundable",value:function(n){return n===0?this._boundable1:this._boundable2}},{key:"getDistance",value:function(){return this._distance}},{key:"distance",value:function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var n=arguments[0],i=arguments[1],a=arguments[2];this._boundable1=n,this._boundable2=i,this._itemDistance=a,this._distance=this.distance()}},{key:"area",value:function(n){return n.getBounds().getArea()}},{key:"isComposite",value:function(n){return n instanceof $t}}])})(),bc=(function(){return h((function o(){u(this,o)}),[{key:"visitItem",value:function(o){}}])})(),bi=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"queryInternal",value:function(){if(_e(arguments[2],bc)&&arguments[0]instanceof Object&&arguments[1]instanceof $t)for(var n=arguments[0],i=arguments[2],a=arguments[1].getChildBoundables(),l=0;l<a.size();l++){var g=a.get(l);this.getIntersectsOp().intersects(g.getBounds(),n)&&(g instanceof $t?this.queryInternal(n,g,i):g instanceof tr?i.visitItem(g.getItem()):ie.shouldNeverReachHere())}else if(_e(arguments[2],An)&&arguments[0]instanceof Object&&arguments[1]instanceof $t)for(var m=arguments[0],_=arguments[2],x=arguments[1].getChildBoundables(),M=0;M<x.size();M++){var j=x.get(M);this.getIntersectsOp().intersects(j.getBounds(),m)&&(j instanceof $t?this.queryInternal(m,j,_):j instanceof tr?_.add(j.getItem()):ie.shouldNeverReachHere())}}},{key:"getNodeCapacity",value:function(){return this._nodeCapacity}},{key:"lastNode",value:function(n){return n.get(n.size()-1)}},{key:"size",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var a=i.next();a instanceof $t?n+=this.size(a):a instanceof tr&&(n+=1)}return n}}},{key:"removeItem",value:function(n,i){for(var a=null,l=n.getChildBoundables().iterator();l.hasNext();){var g=l.next();g instanceof tr&&g.getItem()===i&&(a=g)}return a!==null&&(n.getChildBoundables().remove(a),!0)}},{key:"itemsTree",value:function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new de:n}if(arguments.length===1){for(var i=arguments[0],a=new de,l=i.getChildBoundables().iterator();l.hasNext();){var g=l.next();if(g instanceof $t){var m=this.itemsTree(g);m!==null&&a.add(m)}else g instanceof tr?a.add(g.getItem()):ie.shouldNeverReachHere()}return a.size()<=0?null:a}}},{key:"insert",value:function(n,i){ie.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new tr(n,i))}},{key:"boundablesAtLevel",value:function(){if(arguments.length===1){var n=arguments[0],i=new de;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var a=arguments[0],l=arguments[1],g=arguments[2];if(ie.isTrue(a>-2),l.getLevel()===a)return g.add(l),null;for(var m=l.getChildBoundables().iterator();m.hasNext();){var _=m.next();_ instanceof $t?this.boundablesAtLevel(a,_,g):(ie.isTrue(_ instanceof tr),a===-1&&g.add(_))}return null}}},{key:"query",value:function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new de;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.queryInternal(n,this._root,i),i}if(arguments.length===2){var a=arguments[0],l=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),a)&&this.queryInternal(a,this._root,l)}}},{key:"build",value:function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,i)}if(arguments.length===3){var a=arguments[0],l=arguments[1],g=arguments[2],m=this.removeItem(l,g);if(m)return!0;for(var _=null,x=l.getChildBoundables().iterator();x.hasNext();){var M=x.next();if(this.getIntersectsOp().intersects(M.getBounds(),a)&&M instanceof $t&&(m=this.remove(a,M,g))){_=M;break}}return _!==null&&_.getChildBoundables().isEmpty()&&l.getChildBoundables().remove(_),m}}},{key:"createHigherLevels",value:function(n,i){ie.isTrue(!n.isEmpty());var a=this.createParentBoundables(n,i+1);return a.size()===1?a.get(0):this.createHigherLevels(a,i+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var a=i.next();if(a instanceof $t){var l=this.depth(a);l>n&&(n=l)}}return n+1}}},{key:"createParentBoundables",value:function(n,i){ie.isTrue(!n.isEmpty());var a=new de;a.add(this.createNode(i));var l=new de(n);xi.sort(l,this.getComparator());for(var g=l.iterator();g.hasNext();){var m=g.next();this.lastNode(a).getChildBoundables().size()===this.getNodeCapacity()&&a.add(this.createNode(i)),this.lastNode(a).addChildBoundable(m)}return a}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[w]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new de,this._nodeCapacity=null,arguments.length===0)o.constructor_.call(this,o.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var n=arguments[0];ie.isTrue(n>1,"Node capacity must be greater than 1"),this._nodeCapacity=n}}},{key:"compareDoubles",value:function(n,i){return n>i?1:n<i?-1:0}}])})();bi.IntersectsOp=function(){},bi.DEFAULT_NODE_CAPACITY=10;var lm=(function(){return h((function o(){u(this,o)}),[{key:"distance",value:function(o,n){}}])})(),Gn=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"createParentBoundablesFromVerticalSlices",value:function(i,a){ie.isTrue(i.length>0);for(var l=new de,g=0;g<i.length;g++)l.addAll(this.createParentBoundablesFromVerticalSlice(i[g],a));return l}},{key:"nearestNeighbourK",value:function(){if(arguments.length===2){var i=arguments[0],a=arguments[1];return this.nearestNeighbourK(i,Z.POSITIVE_INFINITY,a)}if(arguments.length===3){var l=arguments[0],g=arguments[2],m=arguments[1],_=new va;_.add(l);for(var x=new va;!_.isEmpty()&&m>=0;){var M=_.poll(),j=M.getDistance();if(j>=m)break;M.isLeaves()?x.size()<g?x.add(M):(x.peek().getDistance()>j&&(x.poll(),x.add(M)),m=x.peek().getDistance()):M.expandToQueue(_,m)}return n.getItems(x)}}},{key:"createNode",value:function(i){return new Sc(i)}},{key:"size",value:function(){return arguments.length===0?b(n,"size",this,1).call(this):b(n,"size",this,1).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof Se))return b(n,"insert",this,1).apply(this,arguments);var i=arguments[0],a=arguments[1];if(i.isNull())return null;b(n,"insert",this,1).call(this,i,a)}},{key:"getIntersectsOp",value:function(){return n.intersectsOp}},{key:"verticalSlices",value:function(i,a){for(var l=Math.trunc(Math.ceil(i.size()/a)),g=new Array(a).fill(null),m=i.iterator(),_=0;_<a;_++){g[_]=new de;for(var x=0;m.hasNext()&&x<l;){var M=m.next();g[_].add(M),x++}}return g}},{key:"query",value:function(){if(arguments.length===1){var i=arguments[0];return b(n,"query",this,1).call(this,i)}if(arguments.length===2){var a=arguments[0],l=arguments[1];b(n,"query",this,1).call(this,a,l)}}},{key:"getComparator",value:function(){return n.yComparator}},{key:"createParentBoundablesFromVerticalSlice",value:function(i,a){return b(n,"createParentBoundables",this,1).call(this,i,a)}},{key:"remove",value:function(){if(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof Se){var i=arguments[0],a=arguments[1];return b(n,"remove",this,1).call(this,i,a)}return b(n,"remove",this,1).apply(this,arguments)}},{key:"depth",value:function(){return arguments.length===0?b(n,"depth",this,1).call(this):b(n,"depth",this,1).apply(this,arguments)}},{key:"createParentBoundables",value:function(i,a){ie.isTrue(!i.isEmpty());var l=Math.trunc(Math.ceil(i.size()/this.getNodeCapacity())),g=new de(i);xi.sort(g,n.xComparator);var m=this.verticalSlices(g,Math.trunc(Math.ceil(Math.sqrt(l))));return this.createParentBoundablesFromVerticalSlices(m,a)}},{key:"nearestNeighbour",value:function(){if(arguments.length===1){if(_e(arguments[0],lm)){var i=arguments[0];if(this.isEmpty())return null;var a=new wi(this.getRoot(),this.getRoot(),i);return this.nearestNeighbour(a)}if(arguments[0]instanceof wi){var l=arguments[0],g=Z.POSITIVE_INFINITY,m=null,_=new va;for(_.add(l);!_.isEmpty()&&g>0;){var x=_.poll(),M=x.getDistance();if(M>=g)break;x.isLeaves()?(g=M,m=x):x.expandToQueue(_,g)}return m===null?null:[m.getBoundable(0).getItem(),m.getBoundable(1).getItem()]}}else{if(arguments.length===2){var j=arguments[0],X=arguments[1];if(this.isEmpty()||j.isEmpty())return null;var K=new wi(this.getRoot(),j.getRoot(),X);return this.nearestNeighbour(K)}if(arguments.length===3){var ce=arguments[2],ge=new tr(arguments[0],arguments[1]),pe=new wi(this.getRoot(),ge,ce);return this.nearestNeighbour(pe)[0]}if(arguments.length===4){var Me=arguments[2],Ie=arguments[3],Fe=new tr(arguments[0],arguments[1]),ht=new wi(this.getRoot(),Fe,Me);return this.nearestNeighbourK(ht,Ie)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var i=arguments[0],a=arguments[1],l=Z.POSITIVE_INFINITY,g=new va;for(g.add(i);!g.isEmpty();){var m=g.poll(),_=m.getDistance();if(_>a)return!1;if(m.maximumDistance()<=a)return!0;if(m.isLeaves()){if((l=_)<=a)return!0}else m.expandToQueue(g,l)}return!1}if(arguments.length===3){var x=arguments[0],M=arguments[1],j=arguments[2],X=new wi(this.getRoot(),x.getRoot(),M);return this.isWithinDistance(X,j)}}},{key:"interfaces_",get:function(){return[om,w]}}],[{key:"constructor_",value:function(){if(arguments.length===0)n.constructor_.call(this,n.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var i=arguments[0];bi.constructor_.call(this,i)}}},{key:"centreX",value:function(i){return n.avg(i.getMinX(),i.getMaxX())}},{key:"avg",value:function(i,a){return(i+a)/2}},{key:"getItems",value:function(i){for(var a=new Array(i.size()).fill(null),l=0;!i.isEmpty();){var g=i.poll();a[l]=g.getBoundable(0).getItem(),l++}return a}},{key:"centreY",value:function(i){return n.avg(i.getMinY(),i.getMaxY())}}])})(bi),Sc=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"computeBounds",value:function(){for(var i=null,a=this.getChildBoundables().iterator();a.hasNext();){var l=a.next();i===null?i=new Se(l.getBounds()):i.expandToInclude(l.getBounds())}return i}}],[{key:"constructor_",value:function(){var i=arguments[0];$t.constructor_.call(this,i)}}])})($t);Gn.STRtreeNode=Sc,Gn.xComparator=new((function(){return h((function o(){u(this,o)}),[{key:"interfaces_",get:function(){return[ne]}},{key:"compare",value:function(o,n){return bi.compareDoubles(Gn.centreX(o.getBounds()),Gn.centreX(n.getBounds()))}}])})()),Gn.yComparator=new((function(){return h((function o(){u(this,o)}),[{key:"interfaces_",get:function(){return[ne]}},{key:"compare",value:function(o,n){return bi.compareDoubles(Gn.centreY(o.getBounds()),Gn.centreY(n.getBounds()))}}])})()),Gn.intersectsOp=new((function(){return h((function o(){u(this,o)}),[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(o,n){return o.intersects(n)}}])})()),Gn.DEFAULT_NODE_CAPACITY=10;var cm=(function(){function o(){u(this,o)}return h(o,null,[{key:"relativeSign",value:function(n,i){return n<i?-1:n>i?1:0}},{key:"compare",value:function(n,i,a){if(i.equals2D(a))return 0;var l=o.relativeSign(i.x,a.x),g=o.relativeSign(i.y,a.y);switch(n){case 0:return o.compareValue(l,g);case 1:return o.compareValue(g,l);case 2:return o.compareValue(g,-l);case 3:return o.compareValue(-l,g);case 4:return o.compareValue(-l,-g);case 5:return o.compareValue(-g,-l);case 6:return o.compareValue(-g,l);case 7:return o.compareValue(l,-g)}return ie.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(n,i){return n<0?-1:n>0?1:i<0?-1:i>0?1:0}}])})(),hm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(o){o.print(this.coord),o.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(o){var n=o;return this.segmentIndex<n.segmentIndex?-1:this.segmentIndex>n.segmentIndex?1:this.coord.equals2D(n.coord)?0:this._isInterior?n._isInterior?cm.compare(this._segmentOctant,this.coord,n.coord):1:-1}},{key:"isEndPoint",value:function(o){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===o}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var o=arguments[0],n=arguments[1],i=arguments[2],a=arguments[3];this._segString=o,this.coord=new V(n),this.segmentIndex=i,this._segmentOctant=a,this._isInterior=!n.equals2D(o.getCoordinate(i))}}])})(),fm=(function(){return h((function o(){u(this,o)}),[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}])})(),gm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getSplitCoordinates",value:function(){var o=new he;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var a=n.next();this.addEdgeCoordinates(i,a,o),i=a}return o.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var o=new de;this.findCollapsesFromInsertedNodes(o),this.findCollapsesFromExistingVertices(o);for(var n=o.iterator();n.hasNext();){var i=n.next().intValue();this.add(this._edge.getCoordinate(i),i)}}},{key:"createSplitEdgePts",value:function(o,n){var i=n.segmentIndex-o.segmentIndex+2;if(i===2)return[new V(o.coord),new V(n.coord)];var a=this._edge.getCoordinate(n.segmentIndex),l=n.isInterior()||!n.coord.equals2D(a);l||i--;var g=new Array(i).fill(null),m=0;g[m++]=new V(o.coord);for(var _=o.segmentIndex+1;_<=n.segmentIndex;_++)g[m++]=this._edge.getCoordinate(_);return l&&(g[m]=new V(n.coord)),g}},{key:"print",value:function(o){o.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(o)}},{key:"findCollapsesFromExistingVertices",value:function(o){for(var n=0;n<this._edge.size()-2;n++){var i=this._edge.getCoordinate(n);this._edge.getCoordinate(n+1);var a=this._edge.getCoordinate(n+2);i.equals2D(a)&&o.add(fn.valueOf(n+1))}}},{key:"addEdgeCoordinates",value:function(o,n,i){var a=this.createSplitEdgePts(o,n);i.add(a,!1)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(o){this.addEndpoints(),this.addCollapsedNodes();for(var n=this.iterator(),i=n.next();n.hasNext();){var a=n.next(),l=this.createSplitEdge(i,a);o.add(l),i=a}}},{key:"findCollapseIndex",value:function(o,n,i){if(!o.coord.equals2D(n.coord))return!1;var a=n.segmentIndex-o.segmentIndex;return n.isInterior()||a--,a===1&&(i[0]=o.segmentIndex+1,!0)}},{key:"findCollapsesFromInsertedNodes",value:function(o){for(var n=new Array(1).fill(null),i=this.iterator(),a=i.next();i.hasNext();){var l=i.next();this.findCollapseIndex(a,l,n)&&o.add(fn.valueOf(n[0])),a=l}}},{key:"getEdge",value:function(){return this._edge}},{key:"addEndpoints",value:function(){var o=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(o),o)}},{key:"createSplitEdge",value:function(o,n){var i=this.createSplitEdgePts(o,n);return new Jr(i,this._edge.getData())}},{key:"add",value:function(o,n){var i=new hm(this._edge,o,n,this._edge.getSegmentOctant(n)),a=this._nodeMap.get(i);return a!==null?(ie.isTrue(a.coord.equals2D(o),"Found equal nodes with different coordinates"),a):(this._nodeMap.put(i,i),i)}},{key:"checkSplitEdgesCorrectness",value:function(o){var n=this._edge.getCoordinates(),i=o.get(0).getCoordinate(0);if(!i.equals2D(n[0]))throw new oe("bad split edge start point at "+i);var a=o.get(o.size()-1).getCoordinates(),l=a[a.length-1];if(!l.equals2D(n[n.length-1]))throw new oe("bad split edge end point at "+l)}}],[{key:"constructor_",value:function(){this._nodeMap=new hs,this._edge=null;var o=arguments[0];this._edge=o}}])})(),dm=(function(){function o(){u(this,o)}return h(o,null,[{key:"octant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new J("Cannot compute the octant for point ( "+n+", "+i+" )");var a=Math.abs(n),l=Math.abs(i);return n>=0?i>=0?a>=l?0:1:a>=l?7:6:i>=0?a>=l?3:2:a>=l?4:5}if(arguments[0]instanceof V&&arguments[1]instanceof V){var g=arguments[0],m=arguments[1],_=m.x-g.x,x=m.y-g.y;if(_===0&&x===0)throw new J("Cannot compute the octant for two identical points "+g);return o.octant(_,x)}}}])})(),pm=(function(){return h((function o(){u(this,o)}),[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(o){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(o){}},{key:"getData",value:function(){}}])})(),mm=(function(){return h((function o(){u(this,o)}),[{key:"addIntersection",value:function(o,n){}},{key:"interfaces_",get:function(){return[pm]}}])})(),Jr=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(n){return this._pts[n]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))}},{key:"setData",value:function(n){this._data=n}},{key:"safeOctant",value:function(n,i){return n.equals2D(i)?0:dm.octant(n,i)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.addIntersectionNode(n,i)}else if(arguments.length===4){var a=arguments[1],l=arguments[3],g=new V(arguments[0].getIntersection(l));this.addIntersection(g,a)}}},{key:"toString",value:function(){return qo.toLineString(new kt(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(n,i){var a=i,l=a+1;if(l<this._pts.length){var g=this._pts[l];n.equals2D(g)&&(a=l)}return this._nodeList.add(n,a)}},{key:"addIntersections",value:function(n,i,a){for(var l=0;l<n.getIntersectionNum();l++)this.addIntersection(n,i,a,l)}},{key:"interfaces_",get:function(){return[mm]}}],[{key:"constructor_",value:function(){this._nodeList=new gm(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i}},{key:"getNodedSubstrings",value:function(){if(arguments.length===1){var n=arguments[0],i=new de;return o.getNodedSubstrings(n,i),i}if(arguments.length===2)for(var a=arguments[1],l=arguments[0].iterator();l.hasNext();)l.next().getNodeList().addSplitEdges(a)}}])})(),Ut=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"minX",value:function(){return Math.min(this.p0.x,this.p1.x)}},{key:"orientationIndex",value:function(){if(arguments[0]instanceof o){var n=arguments[0],i=ve.index(this.p0,this.p1,n.p0),a=ve.index(this.p0,this.p1,n.p1);return i>=0&&a>=0||i<=0&&a<=0?Math.max(i,a):0}if(arguments[0]instanceof V){var l=arguments[0];return ve.index(this.p0,this.p1,l)}}},{key:"toGeometry",value:function(n){return n.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(n){if(!(n instanceof o))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)}},{key:"intersection",value:function(n){var i=new zr;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof V){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new V(n);var i=this.projectionFactor(n),a=new V;return a.x=this.p0.x+i*(this.p1.x-this.p0.x),a.y=this.p0.y+i*(this.p1.y-this.p0.y),a}if(arguments[0]instanceof o){var l=arguments[0],g=this.projectionFactor(l.p0),m=this.projectionFactor(l.p1);if(g>=1&&m>=1||g<=0&&m<=0)return null;var _=this.project(l.p0);g<0&&(_=this.p0),g>1&&(_=this.p1);var x=this.project(l.p1);return m<0&&(x=this.p0),m>1&&(x=this.p1),new o(_,x)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(n){return n===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(n){return yt.pointToLinePerpendicular(n,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return o.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value:function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,a=this.p1.y-this.p0.y,l=i*i+a*a;return l<=0?Z.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*a)/l}},{key:"closestPoints",value:function(n){var i=this.intersection(n);if(i!==null)return[i,i];var a=new Array(2).fill(null),l=Z.MAX_VALUE,g=null,m=this.closestPoint(n.p0);l=m.distance(n.p0),a[0]=m,a[1]=n.p0;var _=this.closestPoint(n.p1);(g=_.distance(n.p1))<l&&(l=g,a[0]=_,a[1]=n.p1);var x=n.closestPoint(this.p0);(g=x.distance(this.p0))<l&&(l=g,a[0]=this.p0,a[1]=x);var M=n.closestPoint(this.p1);return(g=M.distance(this.p1))<l&&(l=g,a[0]=this.p1,a[1]=M),a}},{key:"closestPoint",value:function(n){var i=this.projectionFactor(n);return i>0&&i<1?this.project(n):this.p0.distance(n)<this.p1.distance(n)?this.p0:this.p1}},{key:"maxX",value:function(){return Math.max(this.p0.x,this.p1.x)}},{key:"getLength",value:function(){return this.p0.distance(this.p1)}},{key:"compareTo",value:function(n){var i=n,a=this.p0.compareTo(i.p0);return a!==0?a:this.p1.compareTo(i.p1)}},{key:"reverse",value:function(){var n=this.p0;this.p0=this.p1,this.p1=n}},{key:"equalsTopo",value:function(n){return this.p0.equals(n.p0)&&this.p1.equals(n.p1)||this.p0.equals(n.p1)&&this.p1.equals(n.p0)}},{key:"lineIntersection",value:function(n){return jr.intersection(this.p0,this.p1,n.p0,n.p1)}},{key:"maxY",value:function(){return Math.max(this.p0.y,this.p1.y)}},{key:"pointAlongOffset",value:function(n,i){var a=this.p0.x+n*(this.p1.x-this.p0.x),l=this.p0.y+n*(this.p1.y-this.p0.y),g=this.p1.x-this.p0.x,m=this.p1.y-this.p0.y,_=Math.sqrt(g*g+m*m),x=0,M=0;if(i!==0){if(_<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");x=i*g/_,M=i*m/_}return new V(a-M,l+x)}},{key:"setCoordinates",value:function(){if(arguments.length===1){var n=arguments[0];this.setCoordinates(n.p0,n.p1)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.p0.x=i.x,this.p0.y=i.y,this.p1.x=a.x,this.p1.y=a.y}}},{key:"segmentFraction",value:function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||Z.isNaN(i))&&(i=1),i}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(n){var i=this.p1.getY()-this.p0.getY(),a=this.p0.getX()-this.p1.getX(),l=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),g=i*i+a*a,m=i*i-a*a,_=n.getX(),x=n.getY();return new V((-m*_-2*i*a*x-2*i*l)/g,(m*x-2*i*a*_-2*a*l)/g)}},{key:"distance",value:function(){if(arguments[0]instanceof o){var n=arguments[0];return yt.segmentToSegment(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof V){var i=arguments[0];return yt.pointToSegment(i,this.p0,this.p1)}}},{key:"pointAlong",value:function(n){var i=new V;return i.x=this.p0.x+n*(this.p1.x-this.p0.x),i.y=this.p0.y+n*(this.p1.y-this.p0.y),i}},{key:"hashCode",value:function(){var n=Z.doubleToLongBits(this.p0.x);n^=31*Z.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),a=Z.doubleToLongBits(this.p1.x);return a^=31*Z.doubleToLongBits(this.p1.y),i^(Math.trunc(a)^Math.trunc(a>>32))}},{key:"interfaces_",get:function(){return[$,w]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)o.constructor_.call(this,new V,new V);else if(arguments.length===1){var n=arguments[0];o.constructor_.call(this,n.p0,n.p1)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.p0=i,this.p1=a}else if(arguments.length===4){var l=arguments[0],g=arguments[1],m=arguments[2],_=arguments[3];o.constructor_.call(this,new V(l,g),new V(m,_))}}},{key:"midPoint",value:function(n,i){return new V((n.x+i.x)/2,(n.y+i.y)/2)}}])})(),vm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"overlap",value:function(){if(arguments.length!==2&&arguments.length===4){var o=arguments[1],n=arguments[2],i=arguments[3];arguments[0].getLineSegment(o,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new Ut,this._overlapSeg2=new Ut}}])})(),Ic=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getLineSegment",value:function(o,n){n.p0=this._pts[o],n.p1=this._pts[o+1]}},{key:"computeSelect",value:function(o,n,i,a){var l=this._pts[n],g=this._pts[i];if(i-n==1)return a.select(this,n),null;if(!o.intersects(l,g))return null;var m=Math.trunc((n+i)/2);n<m&&this.computeSelect(o,n,m,a),m<i&&this.computeSelect(o,m,i,a)}},{key:"getCoordinates",value:function(){for(var o=new Array(this._end-this._start+1).fill(null),n=0,i=this._start;i<=this._end;i++)o[n++]=this._pts[i];return o}},{key:"computeOverlaps",value:function(){if(arguments.length===2){var o=arguments[0],n=arguments[1];this.computeOverlaps(this._start,this._end,o,o._start,o._end,n)}else if(arguments.length===6){var i=arguments[0],a=arguments[1],l=arguments[2],g=arguments[3],m=arguments[4],_=arguments[5];if(a-i==1&&m-g==1)return _.overlap(this,i,l,g),null;if(!this.overlaps(i,a,l,g,m))return null;var x=Math.trunc((i+a)/2),M=Math.trunc((g+m)/2);i<x&&(g<M&&this.computeOverlaps(i,x,l,g,M,_),M<m&&this.computeOverlaps(i,x,l,M,m,_)),x<a&&(g<M&&this.computeOverlaps(x,a,l,g,M,_),M<m&&this.computeOverlaps(x,a,l,M,m,_))}}},{key:"setId",value:function(o){this._id=o}},{key:"select",value:function(o,n){this.computeSelect(o,this._start,this._end,n)}},{key:"getEnvelope",value:function(){if(this._env===null){var o=this._pts[this._start],n=this._pts[this._end];this._env=new Se(o,n)}return this._env}},{key:"overlaps",value:function(o,n,i,a,l){return Se.intersects(this._pts[o],this._pts[n],i._pts[a],i._pts[l])}},{key:"getEndIndex",value:function(){return this._end}},{key:"getStartIndex",value:function(){return this._start}},{key:"getContext",value:function(){return this._context}},{key:"getId",value:function(){return this._id}}],[{key:"constructor_",value:function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var o=arguments[0],n=arguments[1],i=arguments[2],a=arguments[3];this._pts=o,this._start=n,this._end=i,this._context=a}}])})(),ym=(function(){function o(){u(this,o)}return h(o,null,[{key:"findChainEnd",value:function(n,i){for(var a=i;a<n.length-1&&n[a].equals2D(n[a+1]);)a++;if(a>=n.length-1)return n.length-1;for(var l=wt.quadrant(n[a],n[a+1]),g=i+1;g<n.length&&!(!n[g-1].equals2D(n[g])&&wt.quadrant(n[g-1],n[g])!==l);)g++;return g-1}},{key:"getChains",value:function(){if(arguments.length===1){var n=arguments[0];return o.getChains(n,null)}if(arguments.length===2){var i=arguments[0],a=arguments[1],l=new de,g=0;do{var m=o.findChainEnd(i,g),_=new Ic(i,g,m,a);l.add(_),g=m}while(g<i.length-1);return l}}}])})(),Ho=(function(){return h((function o(){u(this,o)}),[{key:"computeNodes",value:function(o){}},{key:"getNodedSubstrings",value:function(){}}])})(),Mc=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"setSegmentIntersector",value:function(o){this._segInt=o}},{key:"interfaces_",get:function(){return[Ho]}}],[{key:"constructor_",value:function(){if(this._segInt=null,arguments.length!==0&&arguments.length===1){var o=arguments[0];this.setSegmentIntersector(o)}}}])})(),Vo=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"getMonotoneChains",value:function(){return this._monoChains}},{key:"getNodedSubstrings",value:function(){return Jr.getNodedSubstrings(this._nodedSegStrings)}},{key:"getIndex",value:function(){return this._index}},{key:"add",value:function(i){for(var a=ym.getChains(i.getCoordinates(),i).iterator();a.hasNext();){var l=a.next();l.setId(this._idCounter++),this._index.insert(l.getEnvelope(),l),this._monoChains.add(l)}}},{key:"computeNodes",value:function(i){this._nodedSegStrings=i;for(var a=i.iterator();a.hasNext();)this.add(a.next());this.intersectChains()}},{key:"intersectChains",value:function(){for(var i=new Nc(this._segInt),a=this._monoChains.iterator();a.hasNext();)for(var l=a.next(),g=this._index.query(l.getEnvelope()).iterator();g.hasNext();){var m=g.next();if(m.getId()>l.getId()&&(l.computeOverlaps(m,i),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new de,this._index=new Gn,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0&&arguments.length===1){var i=arguments[0];Mc.constructor_.call(this,i)}}}])})(Mc),Nc=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"overlap",value:function(){if(arguments.length!==4)return b(n,"overlap",this,1).apply(this,arguments);var i=arguments[1],a=arguments[2],l=arguments[3],g=arguments[0].getContext(),m=a.getContext();this._si.processIntersections(g,i,m,l)}}],[{key:"constructor_",value:function(){this._si=null;var i=arguments[0];this._si=i}}])})(vm);Vo.SegmentOverlapAction=Nc;var gn=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"isDeletable",value:function(n,i,a,l){var g=this._inputLine[n],m=this._inputLine[i],_=this._inputLine[a];return!!this.isConcave(g,m,_)&&!!this.isShallow(g,m,_,l)&&this.isShallowSampled(g,m,n,a,l)}},{key:"deleteShallowConcavities",value:function(){for(var n=1,i=this.findNextNonDeletedIndex(n),a=this.findNextNonDeletedIndex(i),l=!1;a<this._inputLine.length;){var g=!1;this.isDeletable(n,i,a,this._distanceTol)&&(this._isDeleted[i]=o.DELETE,g=!0,l=!0),n=g?a:i,i=this.findNextNonDeletedIndex(n),a=this.findNextNonDeletedIndex(i)}return l}},{key:"isShallowConcavity",value:function(n,i,a,l){return ve.index(n,i,a)===this._angleOrientation&&yt.pointToSegment(i,n,a)<l}},{key:"isShallowSampled",value:function(n,i,a,l,g){var m=Math.trunc((l-a)/o.NUM_PTS_TO_CHECK);m<=0&&(m=1);for(var _=a;_<l;_+=m)if(!this.isShallow(n,i,this._inputLine[_],g))return!1;return!0}},{key:"isConcave",value:function(n,i,a){var l=ve.index(n,i,a)===this._angleOrientation;return l}},{key:"simplify",value:function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=ve.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()}},{key:"findNextNonDeletedIndex",value:function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===o.DELETE;)i++;return i}},{key:"isShallow",value:function(n,i,a,l){return yt.pointToSegment(i,n,a)<l}},{key:"collapseLine",value:function(){for(var n=new he,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==o.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()}}],[{key:"constructor_",value:function(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ve.COUNTERCLOCKWISE;var n=arguments[0];this._inputLine=n}},{key:"simplify",value:function(n,i){return new o(n).simplify(i)}}])})();gn.INIT=0,gn.DELETE=1,gn.KEEP=1,gn.NUM_PTS_TO_CHECK=10;var Lc=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getCoordinates",value:function(){return this._ptList.toArray(o.COORDINATE_ARRAY_TYPE)}},{key:"setPrecisionModel",value:function(n){this._precisionModel=n}},{key:"addPt",value:function(n){var i=new V(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)}},{key:"reverse",value:function(){}},{key:"addPts",value:function(n,i){if(i)for(var a=0;a<n.length;a++)this.addPt(n[a]);else for(var l=n.length-1;l>=0;l--)this.addPt(n[l])}},{key:"isRedundant",value:function(n){if(this._ptList.size()<1)return!1;var i=this._ptList.get(this._ptList.size()-1);return n.distance(i)<this._minimimVertexDistance}},{key:"toString",value:function(){return new ki().createLineString(this.getCoordinates()).toString()}},{key:"closeRing",value:function(){if(this._ptList.size()<1)return null;var n=new V(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)}},{key:"setMinimumVertexDistance",value:function(n){this._minimimVertexDistance=n}}],[{key:"constructor_",value:function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new de}}])})();Lc.COORDINATE_ARRAY_TYPE=new Array(0).fill(null);var jt=(function(){function o(){u(this,o)}return h(o,null,[{key:"toDegrees",value:function(n){return 180*n/Math.PI}},{key:"normalize",value:function(n){for(;n>Math.PI;)n-=o.PI_TIMES_2;for(;n<=-Math.PI;)n+=o.PI_TIMES_2;return n}},{key:"angle",value:function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var i=arguments[0],a=arguments[1],l=a.x-i.x,g=a.y-i.y;return Math.atan2(g,l)}}},{key:"isAcute",value:function(n,i,a){var l=n.x-i.x,g=n.y-i.y;return l*(a.x-i.x)+g*(a.y-i.y)>0}},{key:"isObtuse",value:function(n,i,a){var l=n.x-i.x,g=n.y-i.y;return l*(a.x-i.x)+g*(a.y-i.y)<0}},{key:"interiorAngle",value:function(n,i,a){var l=o.angle(i,n),g=o.angle(i,a);return Math.abs(g-l)}},{key:"normalizePositive",value:function(n){if(n<0){for(;n<0;)n+=o.PI_TIMES_2;n>=o.PI_TIMES_2&&(n=0)}else{for(;n>=o.PI_TIMES_2;)n-=o.PI_TIMES_2;n<0&&(n=0)}return n}},{key:"angleBetween",value:function(n,i,a){var l=o.angle(i,n),g=o.angle(i,a);return o.diff(l,g)}},{key:"diff",value:function(n,i){var a=null;return(a=n<i?i-n:n-i)>Math.PI&&(a=2*Math.PI-a),a}},{key:"toRadians",value:function(n){return n*Math.PI/180}},{key:"getTurn",value:function(n,i){var a=Math.sin(i-n);return a>0?o.COUNTERCLOCKWISE:a<0?o.CLOCKWISE:o.NONE}},{key:"angleBetweenOriented",value:function(n,i,a){var l=o.angle(i,n),g=o.angle(i,a)-l;return g<=-Math.PI?g+o.PI_TIMES_2:g>Math.PI?g-o.PI_TIMES_2:g}}])})();jt.PI_TIMES_2=2*Math.PI,jt.PI_OVER_2=Math.PI/2,jt.PI_OVER_4=Math.PI/4,jt.COUNTERCLOCKWISE=ve.COUNTERCLOCKWISE,jt.CLOCKWISE=ve.CLOCKWISE,jt.NONE=ve.COLLINEAR;var fs=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"addNextSegment",value:function(n,i){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var a=ve.index(this._s0,this._s1,this._s2),l=a===ve.CLOCKWISE&&this._side===re.LEFT||a===ve.COUNTERCLOCKWISE&&this._side===re.RIGHT;a===0?this.addCollinear(i):l?this.addOutsideTurn(a,i):this.addInsideTurn(a,i)}},{key:"addLineEndCap",value:function(n,i){var a=new Ut(n,i),l=new Ut;this.computeOffsetSegment(a,re.LEFT,this._distance,l);var g=new Ut;this.computeOffsetSegment(a,re.RIGHT,this._distance,g);var m=i.x-n.x,_=i.y-n.y,x=Math.atan2(_,m);switch(this._bufParams.getEndCapStyle()){case q.CAP_ROUND:this._segList.addPt(l.p1),this.addDirectedFillet(i,x+Math.PI/2,x-Math.PI/2,ve.CLOCKWISE,this._distance),this._segList.addPt(g.p1);break;case q.CAP_FLAT:this._segList.addPt(l.p1),this._segList.addPt(g.p1);break;case q.CAP_SQUARE:var M=new V;M.x=Math.abs(this._distance)*Math.cos(x),M.y=Math.abs(this._distance)*Math.sin(x);var j=new V(l.p1.x+M.x,l.p1.y+M.y),X=new V(g.p1.x+M.x,g.p1.y+M.y);this._segList.addPt(j),this._segList.addPt(X)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(n,i,a,l){var g=jr.intersection(i.p0,i.p1,a.p0,a.p1);if(g!==null&&(l<=0?1:g.distance(n)/Math.abs(l))<=this._bufParams.getMitreLimit())return this._segList.addPt(g),null;this.addLimitedMitreJoin(i,a,l,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*o.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===q.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===q.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(i&&this._segList.addPt(this._offset0.p1),this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))}},{key:"createSquare",value:function(n){this._segList.addPt(new V(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new V(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new V(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new V(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()}},{key:"addSegments",value:function(n,i){this._segList.addPts(n,i)}},{key:"addFirstSegment",value:function(){this._segList.addPt(this._offset1.p0)}},{key:"addCornerFillet",value:function(n,i,a,l,g){var m=i.x-n.x,_=i.y-n.y,x=Math.atan2(_,m),M=a.x-n.x,j=a.y-n.y,X=Math.atan2(j,M);l===ve.CLOCKWISE?x<=X&&(x+=2*Math.PI):x>=X&&(x-=2*Math.PI),this._segList.addPt(i),this.addDirectedFillet(n,x,X,l,g),this._segList.addPt(a)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(n,i,a){this._s1=n,this._s2=i,this._side=a,this._seg1.setCoordinates(n,i),this.computeOffsetSegment(this._seg1,a,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(n,i,a,l){var g=this._seg0.p1,m=jt.angle(g,this._seg0.p0),_=jt.angleBetweenOriented(this._seg0.p0,g,this._seg1.p1)/2,x=jt.normalize(m+_),M=jt.normalize(x+Math.PI),j=l*a,X=a-j*Math.abs(Math.sin(_)),K=g.x+j*Math.cos(M),ce=g.y+j*Math.sin(M),ge=new V(K,ce),pe=new Ut(g,ge),Me=pe.pointAlongOffset(1,X),Ie=pe.pointAlongOffset(1,-X);this._side===re.LEFT?(this._segList.addPt(Me),this._segList.addPt(Ie)):(this._segList.addPt(Ie),this._segList.addPt(Me))}},{key:"addDirectedFillet",value:function(n,i,a,l,g){var m=l===ve.CLOCKWISE?-1:1,_=Math.abs(i-a),x=Math.trunc(_/this._filletAngleQuantum+.5);if(x<1)return null;for(var M=_/x,j=new V,X=0;X<x;X++){var K=i+m*X*M;j.x=n.x+g*Math.cos(K),j.y=n.y+g*Math.sin(K),this._segList.addPt(j)}}},{key:"computeOffsetSegment",value:function(n,i,a,l){var g=i===re.LEFT?1:-1,m=n.p1.x-n.p0.x,_=n.p1.y-n.p0.y,x=Math.sqrt(m*m+_*_),M=g*a*m/x,j=g*a*_/x;l.p0.x=n.p0.x-j,l.p0.y=n.p0.y+M,l.p1.x=n.p1.x-j,l.p1.y=n.p1.y+M}},{key:"addInsideTurn",value:function(n,i){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*o.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var a=new V((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(a);var l=new V((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(l)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(n){var i=new V(n.x+this._distance,n.y);this._segList.addPt(i),this.addDirectedFillet(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)}},{key:"init",value:function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Lc,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*o.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===q.JOIN_BEVEL||this._bufParams.getJoinStyle()===q.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,ve.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Ut,this._seg1=new Ut,this._offset0=new Ut,this._offset1=new Ut,this._side=0,this._hasNarrowConcaveAngle=!1;var n=arguments[0],i=arguments[1],a=arguments[2];this._precisionModel=n,this._bufParams=i,this._li=new zr,this._filletAngleQuantum=Math.PI/2/i.getQuadrantSegments(),i.getQuadrantSegments()>=8&&i.getJoinStyle()===q.JOIN_ROUND&&(this._closingSegLengthFactor=o.MAX_CLOSING_SEG_LEN_FACTOR),this.init(a)}}])})();fs.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,fs.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,fs.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,fs.MAX_CLOSING_SEG_LEN_FACTOR=80;var _m=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getOffsetCurve",value:function(n,i){if(this._distance=i,i===0)return null;var a=i<0,l=Math.abs(i),g=this.getSegGen(l);n.length<=1?this.computePointCurve(n[0],g):this.computeOffsetCurve(n,a,g);var m=g.getCoordinates();return a&&ee.reverse(m),m}},{key:"computeSingleSidedBufferCurve",value:function(n,i,a){var l=this.simplifyTolerance(this._distance);if(i){a.addSegments(n,!0);var g=gn.simplify(n,-l),m=g.length-1;a.initSideSegments(g[m],g[m-1],re.LEFT),a.addFirstSegment();for(var _=m-2;_>=0;_--)a.addNextSegment(g[_],!0)}else{a.addSegments(n,!1);var x=gn.simplify(n,l),M=x.length-1;a.initSideSegments(x[0],x[1],re.LEFT),a.addFirstSegment();for(var j=2;j<=M;j++)a.addNextSegment(x[j],!0)}a.addLastSegment(),a.closeRing()}},{key:"computeRingBufferCurve",value:function(n,i,a){var l=this.simplifyTolerance(this._distance);i===re.RIGHT&&(l=-l);var g=gn.simplify(n,l),m=g.length-1;a.initSideSegments(g[m-1],g[0],i);for(var _=1;_<=m;_++){var x=_!==1;a.addNextSegment(g[_],x)}a.closeRing()}},{key:"computeLineBufferCurve",value:function(n,i){var a=this.simplifyTolerance(this._distance),l=gn.simplify(n,a),g=l.length-1;i.initSideSegments(l[0],l[1],re.LEFT);for(var m=2;m<=g;m++)i.addNextSegment(l[m],!0);i.addLastSegment(),i.addLineEndCap(l[g-1],l[g]);var _=gn.simplify(n,-a),x=_.length-1;i.initSideSegments(_[x],_[x-1],re.LEFT);for(var M=x-2;M>=0;M--)i.addNextSegment(_[M],!0);i.addLastSegment(),i.addLineEndCap(_[1],_[0]),i.closeRing()}},{key:"computePointCurve",value:function(n,i){switch(this._bufParams.getEndCapStyle()){case q.CAP_ROUND:i.createCircle(n);break;case q.CAP_SQUARE:i.createSquare(n)}}},{key:"getLineCurve",value:function(n,i){if(this._distance=i,this.isLineOffsetEmpty(i))return null;var a=Math.abs(i),l=this.getSegGen(a);if(n.length<=1)this.computePointCurve(n[0],l);else if(this._bufParams.isSingleSided()){var g=i<0;this.computeSingleSidedBufferCurve(n,g,l)}else this.computeLineBufferCurve(n,l);return l.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(n){return n*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(n,i,a){if(this._distance=a,n.length<=2)return this.getLineCurve(n,a);if(a===0)return o.copyCoordinates(n);var l=this.getSegGen(a);return this.computeRingBufferCurve(n,i,l),l.getCoordinates()}},{key:"computeOffsetCurve",value:function(n,i,a){var l=this.simplifyTolerance(this._distance);if(i){var g=gn.simplify(n,-l),m=g.length-1;a.initSideSegments(g[m],g[m-1],re.LEFT),a.addFirstSegment();for(var _=m-2;_>=0;_--)a.addNextSegment(g[_],!0)}else{var x=gn.simplify(n,l),M=x.length-1;a.initSideSegments(x[0],x[1],re.LEFT),a.addFirstSegment();for(var j=2;j<=M;j++)a.addNextSegment(x[j],!0)}a.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(n){return n===0||n<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(n){return new fs(this._precisionModel,this._bufParams,n)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i}},{key:"copyCoordinates",value:function(n){for(var i=new Array(n.length).fill(null),a=0;a<i.length;a++)i[a]=new V(n[a]);return i}}])})(),Cc=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"findStabbedSegments",value:function(){if(arguments.length===1){for(var o=arguments[0],n=new de,i=this._subgraphs.iterator();i.hasNext();){var a=i.next(),l=a.getEnvelope();o.y<l.getMinY()||o.y>l.getMaxY()||this.findStabbedSegments(o,a.getDirectedEdges(),n)}return n}if(arguments.length===3){if(_e(arguments[2],An)&&arguments[0]instanceof V&&arguments[1]instanceof Jo){for(var g=arguments[0],m=arguments[1],_=arguments[2],x=m.getEdge().getCoordinates(),M=0;M<x.length-1;M++)if(this._seg.p0=x[M],this._seg.p1=x[M+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<g.x||this._seg.isHorizontal()||g.y<this._seg.p0.y||g.y>this._seg.p1.y||ve.index(this._seg.p0,this._seg.p1,g)===ve.RIGHT)){var j=m.getDepth(re.LEFT);this._seg.p0.equals(x[M])||(j=m.getDepth(re.RIGHT));var X=new Ac(this._seg,j);_.add(X)}}else if(_e(arguments[2],An)&&arguments[0]instanceof V&&_e(arguments[1],An))for(var K=arguments[0],ce=arguments[2],ge=arguments[1].iterator();ge.hasNext();){var pe=ge.next();pe.isForward()&&this.findStabbedSegments(K,pe,ce)}}}},{key:"getDepth",value:function(o){var n=this.findStabbedSegments(o);return n.size()===0?0:xi.min(n)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new Ut;var o=arguments[0];this._subgraphs=o}}])})(),Ac=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"compareTo",value:function(o){var n=o;if(this._upwardSeg.minX()>=n._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=n._upwardSeg.minX())return-1;var i=this._upwardSeg.orientationIndex(n._upwardSeg);return i!==0||(i=-1*n._upwardSeg.orientationIndex(this._upwardSeg))!==0?i:this._upwardSeg.compareTo(n._upwardSeg)}},{key:"compareX",value:function(o,n){var i=o.p0.compareTo(n.p0);return i!==0?i:o.p1.compareTo(n.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var o=arguments[0],n=arguments[1];this._upwardSeg=new Ut(o),this._leftDepth=n}}])})();Cc.DepthSegment=Ac;var Tc=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,null,[{key:"constructor_",value:function(){H.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}])})(H),Xo=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getY",value:function(){var n=this.y/this.w;if(Z.isNaN(n)||Z.isInfinite(n))throw new Tc;return n}},{key:"getX",value:function(){var n=this.x/this.w;if(Z.isNaN(n)||Z.isInfinite(n))throw new Tc;return n}},{key:"getCoordinate",value:function(){var n=new V;return n.x=this.getX(),n.y=this.getY(),n}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var n=arguments[0];this.x=n.x,this.y=n.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1];this.x=i,this.y=a,this.w=1}else if(arguments[0]instanceof o&&arguments[1]instanceof o){var l=arguments[0],g=arguments[1];this.x=l.y*g.w-g.y*l.w,this.y=g.x*l.w-l.x*g.w,this.w=l.x*g.y-g.x*l.y}else if(arguments[0]instanceof V&&arguments[1]instanceof V){var m=arguments[0],_=arguments[1];this.x=m.y-_.y,this.y=_.x-m.x,this.w=m.x*_.y-_.x*m.y}}else if(arguments.length===3){var x=arguments[0],M=arguments[1],j=arguments[2];this.x=x,this.y=M,this.w=j}else if(arguments.length===4){var X=arguments[0],K=arguments[1],ce=arguments[2],ge=arguments[3],pe=X.y-K.y,Me=K.x-X.x,Ie=X.x*K.y-K.x*X.y,Fe=ce.y-ge.y,ht=ge.x-ce.x,dt=ce.x*ge.y-ge.x*ce.y;this.x=Me*dt-ht*Ie,this.y=Fe*Ie-pe*dt,this.w=pe*ht-Fe*Me}}}])})(),km=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"area",value:function(){return o.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return o.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(n){if(n===null)throw new J("Supplied point is null.");return o.interpolateZ(n,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return o.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return o.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return o.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return o.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return o.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return o.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var n=arguments[0],i=arguments[1],a=arguments[2];this.p0=n,this.p1=i,this.p2=a}},{key:"area",value:function(n,i,a){return Math.abs(((a.x-n.x)*(i.y-n.y)-(i.x-n.x)*(a.y-n.y))/2)}},{key:"signedArea",value:function(n,i,a){return((a.x-n.x)*(i.y-n.y)-(i.x-n.x)*(a.y-n.y))/2}},{key:"det",value:function(n,i,a,l){return n*l-i*a}},{key:"interpolateZ",value:function(n,i,a,l){var g=i.x,m=i.y,_=a.x-g,x=l.x-g,M=a.y-m,j=l.y-m,X=_*j-x*M,K=n.x-g,ce=n.y-m,ge=(j*K-x*ce)/X,pe=(-M*K+_*ce)/X;return i.getZ()+ge*(a.getZ()-i.getZ())+pe*(l.getZ()-i.getZ())}},{key:"longestSideLength",value:function(n,i,a){var l=n.distance(i),g=i.distance(a),m=a.distance(n),_=l;return g>_&&(_=g),m>_&&(_=m),_}},{key:"circumcentreDD",value:function(n,i,a){var l=me.valueOf(n.x).subtract(a.x),g=me.valueOf(n.y).subtract(a.y),m=me.valueOf(i.x).subtract(a.x),_=me.valueOf(i.y).subtract(a.y),x=me.determinant(l,g,m,_).multiply(2),M=l.sqr().add(g.sqr()),j=m.sqr().add(_.sqr()),X=me.determinant(g,M,_,j),K=me.determinant(l,M,m,j),ce=me.valueOf(a.x).subtract(X.divide(x)).doubleValue(),ge=me.valueOf(a.y).add(K.divide(x)).doubleValue();return new V(ce,ge)}},{key:"isAcute",value:function(n,i,a){return!!jt.isAcute(n,i,a)&&!!jt.isAcute(i,a,n)&&!!jt.isAcute(a,n,i)}},{key:"circumcentre",value:function(n,i,a){var l=a.x,g=a.y,m=n.x-l,_=n.y-g,x=i.x-l,M=i.y-g,j=2*o.det(m,_,x,M),X=o.det(_,m*m+_*_,M,x*x+M*M),K=o.det(m,m*m+_*_,x,x*x+M*M);return new V(l-X/j,g+K/j)}},{key:"perpendicularBisector",value:function(n,i){var a=i.x-n.x,l=i.y-n.y,g=new Xo(n.x+a/2,n.y+l/2,1),m=new Xo(n.x-l+a/2,n.y+a+l/2,1);return new Xo(g,m)}},{key:"angleBisector",value:function(n,i,a){var l=i.distance(n),g=l/(l+i.distance(a)),m=a.x-n.x,_=a.y-n.y;return new V(n.x+g*m,n.y+g*_)}},{key:"area3D",value:function(n,i,a){var l=i.x-n.x,g=i.y-n.y,m=i.getZ()-n.getZ(),_=a.x-n.x,x=a.y-n.y,M=a.getZ()-n.getZ(),j=g*M-m*x,X=m*_-l*M,K=l*x-g*_,ce=j*j+X*X+K*K,ge=Math.sqrt(ce)/2;return ge}},{key:"centroid",value:function(n,i,a){var l=(n.x+i.x+a.x)/3,g=(n.y+i.y+a.y)/3;return new V(l,g)}},{key:"inCentre",value:function(n,i,a){var l=i.distance(a),g=n.distance(a),m=n.distance(i),_=l+g+m,x=(l*n.x+g*i.x+m*a.x)/_,M=(l*n.y+g*i.y+m*a.y)/_;return new V(x,M)}}])})(),Em=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"addRingSide",value:function(o,n,i,a,l){if(n===0&&o.length<_r.MINIMUM_VALID_SIZE)return null;var g=a,m=l;o.length>=_r.MINIMUM_VALID_SIZE&&ve.isCCW(o)&&(g=l,m=a,i=re.opposite(i));var _=this._curveBuilder.getRingCurve(o,i,n);this.addCurve(_,g,m)}},{key:"addRingBothSides",value:function(o,n){this.addRingSide(o,n,re.LEFT,A.EXTERIOR,A.INTERIOR),this.addRingSide(o,n,re.RIGHT,A.INTERIOR,A.EXTERIOR)}},{key:"addPoint",value:function(o){if(this._distance<=0)return null;var n=o.getCoordinates(),i=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(i,A.EXTERIOR,A.INTERIOR)}},{key:"addPolygon",value:function(o){var n=this._distance,i=re.LEFT;this._distance<0&&(n=-this._distance,i=re.RIGHT);var a=o.getExteriorRing(),l=ee.removeRepeatedPoints(a.getCoordinates());if(this._distance<0&&this.isErodedCompletely(a,this._distance)||this._distance<=0&&l.length<3)return null;this.addRingSide(l,n,i,A.EXTERIOR,A.INTERIOR);for(var g=0;g<o.getNumInteriorRing();g++){var m=o.getInteriorRingN(g),_=ee.removeRepeatedPoints(m.getCoordinates());this._distance>0&&this.isErodedCompletely(m,-this._distance)||this.addRingSide(_,n,re.opposite(i),A.INTERIOR,A.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(o,n){var i=new km(o[0],o[1],o[2]),a=i.inCentre();return yt.pointToSegment(a,i.p0,i.p1)<Math.abs(n)}},{key:"addLineString",value:function(o){if(this._curveBuilder.isLineOffsetEmpty(this._distance))return null;var n=ee.removeRepeatedPoints(o.getCoordinates());if(ee.isRing(n)&&!this._curveBuilder.getBufferParameters().isSingleSided())this.addRingBothSides(n,this._distance);else{var i=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(i,A.EXTERIOR,A.INTERIOR)}}},{key:"addCurve",value:function(o,n,i){if(o===null||o.length<2)return null;var a=new Jr(o,new Xt(0,A.BOUNDARY,n,i));this._curveList.add(a)}},{key:"getCurves",value:function(){return this.add(this._inputGeom),this._curveList}},{key:"add",value:function(o){if(o.isEmpty())return null;if(o instanceof Yr)this.addPolygon(o);else if(o instanceof Qn)this.addLineString(o);else if(o instanceof mi)this.addPoint(o);else if(o instanceof yi)this.addCollection(o);else if(o instanceof Uo)this.addCollection(o);else if(o instanceof xt)this.addCollection(o);else{if(!(o instanceof Je))throw new xe(o.getGeometryType());this.addCollection(o)}}},{key:"isErodedCompletely",value:function(o,n){var i=o.getCoordinates();if(i.length<4)return n<0;if(i.length===4)return this.isTriangleErodedCompletely(i,n);var a=o.getEnvelopeInternal(),l=Math.min(a.getHeight(),a.getWidth());return n<0&&2*Math.abs(n)>l}},{key:"addCollection",value:function(o){for(var n=0;n<o.getNumGeometries();n++){var i=o.getGeometryN(n);this.add(i)}}}],[{key:"constructor_",value:function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new de;var o=arguments[0],n=arguments[1],i=arguments[2];this._inputGeom=o,this._distance=n,this._curveBuilder=i}}])})(),xm=(function(){return h((function o(){u(this,o)}),[{key:"locate",value:function(o){}}])})(),wm=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"next",value:function(){if(this._atStart)return this._atStart=!1,o.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new qe;var n=this._parent.getGeometryN(this._index++);return n instanceof Je?(this._subcollectionIterator=new o(n),this._subcollectionIterator.next()):n}},{key:"remove",value:function(){throw new xe(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[fm]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()}},{key:"isAtomic",value:function(n){return!(n instanceof Je)}}])})(),bm=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"locate",value:function(n){return o.locate(n,this._geom)}},{key:"interfaces_",get:function(){return[xm]}}],[{key:"constructor_",value:function(){this._geom=null;var n=arguments[0];this._geom=n}},{key:"locatePointInPolygon",value:function(n,i){if(i.isEmpty())return A.EXTERIOR;var a=i.getExteriorRing(),l=o.locatePointInRing(n,a);if(l!==A.INTERIOR)return l;for(var g=0;g<i.getNumInteriorRing();g++){var m=i.getInteriorRingN(g),_=o.locatePointInRing(n,m);if(_===A.BOUNDARY)return A.BOUNDARY;if(_===A.INTERIOR)return A.EXTERIOR}return A.INTERIOR}},{key:"locatePointInRing",value:function(n,i){return i.getEnvelopeInternal().intersects(n)?Yo.locateInRing(n,i.getCoordinates()):A.EXTERIOR}},{key:"containsPointInPolygon",value:function(n,i){return A.EXTERIOR!==o.locatePointInPolygon(n,i)}},{key:"locateInGeometry",value:function(n,i){if(i instanceof Yr)return o.locatePointInPolygon(n,i);if(i instanceof Je)for(var a=new wm(i);a.hasNext();){var l=a.next();if(l!==i){var g=o.locateInGeometry(n,l);if(g!==A.EXTERIOR)return g}}return A.EXTERIOR}},{key:"isContained",value:function(n,i){return A.EXTERIOR!==o.locate(n,i)}},{key:"locate",value:function(n,i){return i.isEmpty()?A.EXTERIOR:i.getEnvelopeInternal().intersects(n)?o.locateInGeometry(n,i):A.EXTERIOR}}])})(),Sm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getNextCW",value:function(o){this.getEdges();var n=this._edgeList.indexOf(o),i=n-1;return n===0&&(i=this._edgeList.size()-1),this._edgeList.get(i)}},{key:"propagateSideLabels",value:function(o){for(var n=A.NONE,i=this.iterator();i.hasNext();){var a=i.next().getLabel();a.isArea(o)&&a.getLocation(o,re.LEFT)!==A.NONE&&(n=a.getLocation(o,re.LEFT))}if(n===A.NONE)return null;for(var l=n,g=this.iterator();g.hasNext();){var m=g.next(),_=m.getLabel();if(_.getLocation(o,re.ON)===A.NONE&&_.setLocation(o,re.ON,l),_.isArea(o)){var x=_.getLocation(o,re.LEFT),M=_.getLocation(o,re.RIGHT);if(M!==A.NONE){if(M!==l)throw new Pt("side location conflict",m.getCoordinate());x===A.NONE&&ie.shouldNeverReachHere("found single null side (at "+m.getCoordinate()+")"),l=x}else ie.isTrue(_.getLocation(o,re.LEFT)===A.NONE,"found single null side"),_.setLocation(o,re.RIGHT,l),_.setLocation(o,re.LEFT,l)}}}},{key:"getCoordinate",value:function(){var o=this.iterator();return o.hasNext()?o.next().getCoordinate():null}},{key:"print",value:function(o){Ot.out.println("EdgeEndStar: "+this.getCoordinate());for(var n=this.iterator();n.hasNext();)n.next().print(o)}},{key:"isAreaLabelsConsistent",value:function(o){return this.computeEdgeEndLabels(o.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)}},{key:"checkAreaLabelsConsistent",value:function(o){var n=this.getEdges();if(n.size()<=0)return!0;var i=n.size()-1,a=n.get(i).getLabel().getLocation(o,re.LEFT);ie.isTrue(a!==A.NONE,"Found unlabelled area edge");for(var l=a,g=this.iterator();g.hasNext();){var m=g.next().getLabel();ie.isTrue(m.isArea(o),"Found non-area edge");var _=m.getLocation(o,re.LEFT),x=m.getLocation(o,re.RIGHT);if(_===x||x!==l)return!1;l=_}return!0}},{key:"findIndex",value:function(o){this.iterator();for(var n=0;n<this._edgeList.size();n++)if(this._edgeList.get(n)===o)return n;return-1}},{key:"iterator",value:function(){return this.getEdges().iterator()}},{key:"getEdges",value:function(){return this._edgeList===null&&(this._edgeList=new de(this._edgeMap.values())),this._edgeList}},{key:"getLocation",value:function(o,n,i){return this._ptInAreaLocation[o]===A.NONE&&(this._ptInAreaLocation[o]=bm.locate(n,i[o].getGeometry())),this._ptInAreaLocation[o]}},{key:"toString",value:function(){var o=new hn;o.append("EdgeEndStar: "+this.getCoordinate()),o.append(`
|
|
128
|
+
`);for(var n=this.iterator();n.hasNext();){var i=n.next();o.append(i),o.append(`
|
|
129
|
+
`)}return o.toString()}},{key:"computeEdgeEndLabels",value:function(o){for(var n=this.iterator();n.hasNext();)n.next().computeLabel(o)}},{key:"computeLabelling",value:function(o){this.computeEdgeEndLabels(o[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],i=this.iterator();i.hasNext();)for(var a=i.next().getLabel(),l=0;l<2;l++)a.isLine(l)&&a.getLocation(l)===A.BOUNDARY&&(n[l]=!0);for(var g=this.iterator();g.hasNext();)for(var m=g.next(),_=m.getLabel(),x=0;x<2;x++)if(_.isAnyNull(x)){var M=A.NONE;if(n[x])M=A.EXTERIOR;else{var j=m.getCoordinate();M=this.getLocation(x,j,o)}_.setAllLocationsIfNull(x,M)}}},{key:"getDegree",value:function(){return this._edgeMap.size()}},{key:"insertEdgeEnd",value:function(o,n){this._edgeMap.put(o,n),this._edgeList=null}}],[{key:"constructor_",value:function(){this._edgeMap=new hs,this._edgeList=null,this._ptInAreaLocation=[A.NONE,A.NONE]}}])})(),Im=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"linkResultDirectedEdges",value:function(){this.getResultAreaEdges();for(var i=null,a=null,l=this._SCANNING_FOR_INCOMING,g=0;g<this._resultAreaEdgeList.size();g++){var m=this._resultAreaEdgeList.get(g),_=m.getSym();if(m.getLabel().isArea())switch(i===null&&m.isInResult()&&(i=m),l){case this._SCANNING_FOR_INCOMING:if(!_.isInResult())continue;a=_,l=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!m.isInResult())continue;a.setNext(m),l=this._SCANNING_FOR_INCOMING}}if(l===this._LINKING_TO_OUTGOING){if(i===null)throw new Pt("no outgoing dirEdge found",this.getCoordinate());ie.isTrue(i.isInResult(),"unable to link last incoming dirEdge"),a.setNext(i)}}},{key:"insert",value:function(i){var a=i;this.insertEdgeEnd(a,a)}},{key:"getRightmostEdge",value:function(){var i=this.getEdges(),a=i.size();if(a<1)return null;var l=i.get(0);if(a===1)return l;var g=i.get(a-1),m=l.getQuadrant(),_=g.getQuadrant();return wt.isNorthern(m)&&wt.isNorthern(_)?l:wt.isNorthern(m)||wt.isNorthern(_)?l.getDy()!==0?l:g.getDy()!==0?g:(ie.shouldNeverReachHere("found two horizontal edges incident on node"),null):g}},{key:"print",value:function(i){Ot.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var a=this.iterator();a.hasNext();){var l=a.next();i.print("out "),l.print(i),i.println(),i.print("in "),l.getSym().print(i),i.println()}}},{key:"getResultAreaEdges",value:function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new de;for(var i=this.iterator();i.hasNext();){var a=i.next();(a.isInResult()||a.getSym().isInResult())&&this._resultAreaEdgeList.add(a)}return this._resultAreaEdgeList}},{key:"updateLabelling",value:function(i){for(var a=this.iterator();a.hasNext();){var l=a.next().getLabel();l.setAllLocationsIfNull(0,i.getLocation(0)),l.setAllLocationsIfNull(1,i.getLocation(1))}}},{key:"linkAllDirectedEdges",value:function(){this.getEdges();for(var i=null,a=null,l=this._edgeList.size()-1;l>=0;l--){var g=this._edgeList.get(l),m=g.getSym();a===null&&(a=m),i!==null&&m.setNext(i),i=g}a.setNext(i)}},{key:"computeDepths",value:function(){if(arguments.length===1){var i=arguments[0],a=this.findIndex(i),l=i.getDepth(re.LEFT),g=i.getDepth(re.RIGHT),m=this.computeDepths(a+1,this._edgeList.size(),l);if(this.computeDepths(0,a,m)!==g)throw new Pt("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var _=arguments[1],x=arguments[2],M=arguments[0];M<_;M++){var j=this._edgeList.get(M);j.setEdgeDepths(re.RIGHT,x),x=j.getDepth(re.LEFT)}return x}}},{key:"mergeSymLabels",value:function(){for(var i=this.iterator();i.hasNext();){var a=i.next();a.getLabel().merge(a.getSym().getLabel())}}},{key:"linkMinimalDirectedEdges",value:function(i){for(var a=null,l=null,g=this._SCANNING_FOR_INCOMING,m=this._resultAreaEdgeList.size()-1;m>=0;m--){var _=this._resultAreaEdgeList.get(m),x=_.getSym();switch(a===null&&_.getEdgeRing()===i&&(a=_),g){case this._SCANNING_FOR_INCOMING:if(x.getEdgeRing()!==i)continue;l=x,g=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(_.getEdgeRing()!==i)continue;l.setNextMin(_),g=this._SCANNING_FOR_INCOMING}}g===this._LINKING_TO_OUTGOING&&(ie.isTrue(a!==null,"found null for first outgoing dirEdge"),ie.isTrue(a.getEdgeRing()===i,"unable to link last incoming dirEdge"),l.setNextMin(a))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var i=0,a=this.iterator();a.hasNext();)a.next().isInResult()&&i++;return i}if(arguments.length===1){for(var l=arguments[0],g=0,m=this.iterator();m.hasNext();)m.next().getEdgeRing()===l&&g++;return g}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var i=A.NONE,a=this.iterator();a.hasNext();){var l=a.next(),g=l.getSym();if(!l.isLineEdge()){if(l.isInResult()){i=A.INTERIOR;break}if(g.isInResult()){i=A.EXTERIOR;break}}}if(i===A.NONE)return null;for(var m=i,_=this.iterator();_.hasNext();){var x=_.next(),M=x.getSym();x.isLineEdge()?x.getEdge().setCovered(m===A.INTERIOR):(x.isInResult()&&(m=A.EXTERIOR),M.isInResult()&&(m=A.INTERIOR))}}},{key:"computeLabelling",value:function(i){b(n,"computeLabelling",this,1).call(this,i),this._label=new Xt(A.NONE);for(var a=this.iterator();a.hasNext();)for(var l=a.next().getEdge().getLabel(),g=0;g<2;g++){var m=l.getLocation(g);m!==A.INTERIOR&&m!==A.BOUNDARY||this._label.setLocation(g,A.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}])})(Sm),Mm=(function(o){function n(){return u(this,n),s(this,n)}return v(n,o),h(n,[{key:"createNode",value:function(i){return new ma(i,new Im)}}])})(Ec),Pc=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"compareTo",value:function(n){var i=n;return o.compareOriented(this._pts,this._orientation,i._pts,i._orientation)}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var n=arguments[0];this._pts=n,this._orientation=o.orientation(n)}},{key:"orientation",value:function(n){return ee.increasingDirection(n)===1}},{key:"compareOriented",value:function(n,i,a,l){for(var g=i?1:-1,m=l?1:-1,_=i?n.length:-1,x=l?a.length:-1,M=i?0:n.length-1,j=l?0:a.length-1;;){var X=n[M].compareTo(a[j]);if(X!==0)return X;var K=(M+=g)===_,ce=(j+=m)===x;if(K&&!ce)return-1;if(!K&&ce)return 1;if(K&&ce)return 0}}}])})(),Nm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"print",value:function(o){o.print("MULTILINESTRING ( ");for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n);n>0&&o.print(","),o.print("(");for(var a=i.getCoordinates(),l=0;l<a.length;l++)l>0&&o.print(","),o.print(a[l].x+" "+a[l].y);o.println(")")}o.print(") ")}},{key:"addAll",value:function(o){for(var n=o.iterator();n.hasNext();)this.add(n.next())}},{key:"findEdgeIndex",value:function(o){for(var n=0;n<this._edges.size();n++)if(this._edges.get(n).equals(o))return n;return-1}},{key:"iterator",value:function(){return this._edges.iterator()}},{key:"getEdges",value:function(){return this._edges}},{key:"get",value:function(o){return this._edges.get(o)}},{key:"findEqualEdge",value:function(o){var n=new Pc(o.getCoordinates());return this._ocaMap.get(n)}},{key:"add",value:function(o){this._edges.add(o);var n=new Pc(o.getCoordinates());this._ocaMap.put(n,o)}}],[{key:"constructor_",value:function(){this._edges=new de,this._ocaMap=new hs}}])})(),Oc=(function(){return h((function o(){u(this,o)}),[{key:"processIntersections",value:function(o,n,i,a){}},{key:"isDone",value:function(){}}])})(),Lm=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"isTrivialIntersection",value:function(n,i,a,l){if(n===a&&this._li.getIntersectionNum()===1){if(o.isAdjacentSegments(i,l))return!0;if(n.isClosed()){var g=n.size()-1;if(i===0&&l===g||l===0&&i===g)return!0}}return!1}},{key:"getProperIntersectionPoint",value:function(){return this._properIntersectionPoint}},{key:"hasProperInteriorIntersection",value:function(){return this._hasProperInterior}},{key:"getLineIntersector",value:function(){return this._li}},{key:"hasProperIntersection",value:function(){return this._hasProper}},{key:"processIntersections",value:function(n,i,a,l){if(n===a&&i===l)return null;this.numTests++;var g=n.getCoordinates()[i],m=n.getCoordinates()[i+1],_=a.getCoordinates()[l],x=a.getCoordinates()[l+1];this._li.computeIntersection(g,m,_,x),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(n,i,a,l)||(this._hasIntersection=!0,n.addIntersections(this._li,i,0),a.addIntersections(this._li,l,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))}},{key:"hasIntersection",value:function(){return this._hasIntersection}},{key:"isDone",value:function(){return!1}},{key:"hasInteriorIntersection",value:function(){return this._hasInterior}},{key:"interfaces_",get:function(){return[Oc]}}],[{key:"constructor_",value:function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var n=arguments[0];this._li=n}},{key:"isAdjacentSegments",value:function(n,i){return Math.abs(n-i)===1}}])})(),Cm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getSegmentIndex",value:function(){return this.segmentIndex}},{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(o){o.print(this.coord),o.print(" seg # = "+this.segmentIndex),o.println(" dist = "+this.dist)}},{key:"compareTo",value:function(o){var n=o;return this.compare(n.segmentIndex,n.dist)}},{key:"isEndPoint",value:function(o){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===o}},{key:"toString",value:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist}},{key:"getDistance",value:function(){return this.dist}},{key:"compare",value:function(o,n){return this.segmentIndex<o?-1:this.segmentIndex>o?1:this.dist<n?-1:this.dist>n?1:0}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var o=arguments[0],n=arguments[1],i=arguments[2];this.coord=new V(o),this.segmentIndex=n,this.dist=i}}])})(),Am=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"print",value:function(o){o.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(o)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(o){this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var a=n.next(),l=this.createSplitEdge(i,a);o.add(l),i=a}}},{key:"addEndpoints",value:function(){var o=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[o],o,0)}},{key:"createSplitEdge",value:function(o,n){var i=n.segmentIndex-o.segmentIndex+2,a=this.edge.pts[n.segmentIndex],l=n.dist>0||!n.coord.equals2D(a);l||i--;var g=new Array(i).fill(null),m=0;g[m++]=new V(o.coord);for(var _=o.segmentIndex+1;_<=n.segmentIndex;_++)g[m++]=this.edge.pts[_];return l&&(g[m]=n.coord),new Dc(g,new Xt(this.edge._label))}},{key:"add",value:function(o,n,i){var a=new Cm(o,n,i),l=this._nodeMap.get(a);return l!==null?l:(this._nodeMap.put(a,a),a)}},{key:"isIntersection",value:function(o){for(var n=this.iterator();n.hasNext();)if(n.next().coord.equals(o))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new hs,this.edge=null;var o=arguments[0];this.edge=o}}])})(),Tm=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(o.isTrue(this._matrix[A.INTERIOR][A.INTERIOR])||o.isTrue(this._matrix[A.INTERIOR][A.BOUNDARY])||o.isTrue(this._matrix[A.BOUNDARY][A.INTERIOR])||o.isTrue(this._matrix[A.BOUNDARY][A.BOUNDARY]))&&this._matrix[A.EXTERIOR][A.INTERIOR]===se.FALSE&&this._matrix[A.EXTERIOR][A.BOUNDARY]===se.FALSE}},{key:"isCoveredBy",value:function(){return(o.isTrue(this._matrix[A.INTERIOR][A.INTERIOR])||o.isTrue(this._matrix[A.INTERIOR][A.BOUNDARY])||o.isTrue(this._matrix[A.BOUNDARY][A.INTERIOR])||o.isTrue(this._matrix[A.BOUNDARY][A.BOUNDARY]))&&this._matrix[A.INTERIOR][A.EXTERIOR]===se.FALSE&&this._matrix[A.BOUNDARY][A.EXTERIOR]===se.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var n=arguments[0],i=0;i<n.length;i++){var a=Math.trunc(i/3),l=i%3;this._matrix[a][l]=se.toDimensionValue(n.charAt(i))}else if(arguments.length===3){var g=arguments[0],m=arguments[1],_=arguments[2];this._matrix[g][m]=_}}},{key:"isContains",value:function(){return o.isTrue(this._matrix[A.INTERIOR][A.INTERIOR])&&this._matrix[A.EXTERIOR][A.INTERIOR]===se.FALSE&&this._matrix[A.EXTERIOR][A.BOUNDARY]===se.FALSE}},{key:"setAtLeast",value:function(){if(arguments.length===1)for(var n=arguments[0],i=0;i<n.length;i++){var a=Math.trunc(i/3),l=i%3;this.setAtLeast(a,l,se.toDimensionValue(n.charAt(i)))}else if(arguments.length===3){var g=arguments[0],m=arguments[1],_=arguments[2];this._matrix[g][m]<_&&(this._matrix[g][m]=_)}}},{key:"setAtLeastIfValid",value:function(n,i,a){n>=0&&i>=0&&this.setAtLeast(n,i,a)}},{key:"isWithin",value:function(){return o.isTrue(this._matrix[A.INTERIOR][A.INTERIOR])&&this._matrix[A.INTERIOR][A.EXTERIOR]===se.FALSE&&this._matrix[A.BOUNDARY][A.EXTERIOR]===se.FALSE}},{key:"isTouches",value:function(n,i){return n>i?this.isTouches(i,n):(n===se.A&&i===se.A||n===se.L&&i===se.L||n===se.L&&i===se.A||n===se.P&&i===se.A||n===se.P&&i===se.L)&&this._matrix[A.INTERIOR][A.INTERIOR]===se.FALSE&&(o.isTrue(this._matrix[A.INTERIOR][A.BOUNDARY])||o.isTrue(this._matrix[A.BOUNDARY][A.INTERIOR])||o.isTrue(this._matrix[A.BOUNDARY][A.BOUNDARY]))}},{key:"isOverlaps",value:function(n,i){return n===se.P&&i===se.P||n===se.A&&i===se.A?o.isTrue(this._matrix[A.INTERIOR][A.INTERIOR])&&o.isTrue(this._matrix[A.INTERIOR][A.EXTERIOR])&&o.isTrue(this._matrix[A.EXTERIOR][A.INTERIOR]):n===se.L&&i===se.L&&this._matrix[A.INTERIOR][A.INTERIOR]===1&&o.isTrue(this._matrix[A.INTERIOR][A.EXTERIOR])&&o.isTrue(this._matrix[A.EXTERIOR][A.INTERIOR])}},{key:"isEquals",value:function(n,i){return n===i&&o.isTrue(this._matrix[A.INTERIOR][A.INTERIOR])&&this._matrix[A.INTERIOR][A.EXTERIOR]===se.FALSE&&this._matrix[A.BOUNDARY][A.EXTERIOR]===se.FALSE&&this._matrix[A.EXTERIOR][A.INTERIOR]===se.FALSE&&this._matrix[A.EXTERIOR][A.BOUNDARY]===se.FALSE}},{key:"toString",value:function(){for(var n=new Re("123456789"),i=0;i<3;i++)for(var a=0;a<3;a++)n.setCharAt(3*i+a,se.toDimensionSymbol(this._matrix[i][a]));return n.toString()}},{key:"setAll",value:function(n){for(var i=0;i<3;i++)for(var a=0;a<3;a++)this._matrix[i][a]=n}},{key:"get",value:function(n,i){return this._matrix[n][i]}},{key:"transpose",value:function(){var n=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=n,n=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=n,n=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=n,this}},{key:"matches",value:function(n){if(n.length!==9)throw new J("Should be length 9: "+n);for(var i=0;i<3;i++)for(var a=0;a<3;a++)if(!o.matches(this._matrix[i][a],n.charAt(3*i+a)))return!1;return!0}},{key:"add",value:function(n){for(var i=0;i<3;i++)for(var a=0;a<3;a++)this.setAtLeast(i,a,n.get(i,a))}},{key:"isDisjoint",value:function(){return this._matrix[A.INTERIOR][A.INTERIOR]===se.FALSE&&this._matrix[A.INTERIOR][A.BOUNDARY]===se.FALSE&&this._matrix[A.BOUNDARY][A.INTERIOR]===se.FALSE&&this._matrix[A.BOUNDARY][A.BOUNDARY]===se.FALSE}},{key:"isCrosses",value:function(n,i){return n===se.P&&i===se.L||n===se.P&&i===se.A||n===se.L&&i===se.A?o.isTrue(this._matrix[A.INTERIOR][A.INTERIOR])&&o.isTrue(this._matrix[A.INTERIOR][A.EXTERIOR]):n===se.L&&i===se.P||n===se.A&&i===se.P||n===se.A&&i===se.L?o.isTrue(this._matrix[A.INTERIOR][A.INTERIOR])&&o.isTrue(this._matrix[A.EXTERIOR][A.INTERIOR]):n===se.L&&i===se.L&&this._matrix[A.INTERIOR][A.INTERIOR]===0}},{key:"interfaces_",get:function(){return[k]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map((function(){return Array(3)})),this.setAll(se.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var n=arguments[0];o.constructor_.call(this),this.set(n)}else if(arguments[0]instanceof o){var i=arguments[0];o.constructor_.call(this),this._matrix[A.INTERIOR][A.INTERIOR]=i._matrix[A.INTERIOR][A.INTERIOR],this._matrix[A.INTERIOR][A.BOUNDARY]=i._matrix[A.INTERIOR][A.BOUNDARY],this._matrix[A.INTERIOR][A.EXTERIOR]=i._matrix[A.INTERIOR][A.EXTERIOR],this._matrix[A.BOUNDARY][A.INTERIOR]=i._matrix[A.BOUNDARY][A.INTERIOR],this._matrix[A.BOUNDARY][A.BOUNDARY]=i._matrix[A.BOUNDARY][A.BOUNDARY],this._matrix[A.BOUNDARY][A.EXTERIOR]=i._matrix[A.BOUNDARY][A.EXTERIOR],this._matrix[A.EXTERIOR][A.INTERIOR]=i._matrix[A.EXTERIOR][A.INTERIOR],this._matrix[A.EXTERIOR][A.BOUNDARY]=i._matrix[A.EXTERIOR][A.BOUNDARY],this._matrix[A.EXTERIOR][A.EXTERIOR]=i._matrix[A.EXTERIOR][A.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var n=arguments[0],i=arguments[1];return i===se.SYM_DONTCARE||i===se.SYM_TRUE&&(n>=0||n===se.TRUE)||i===se.SYM_FALSE&&n===se.FALSE||i===se.SYM_P&&n===se.P||i===se.SYM_L&&n===se.L||i===se.SYM_A&&n===se.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var a=arguments[1];return new o(arguments[0]).matches(a)}}},{key:"isTrue",value:function(n){return n>=0||n===se.TRUE}}])})(),Pm=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(n){return n===null||n.length===0?null:(this.ensureCapacity(this._size+n.length),Ot.arraycopy(n,0,this._data,this._size,n.length),void(this._size+=n.length))}},{key:"ensureCapacity",value:function(n){if(n<=this._data.length)return null;var i=Math.max(n,2*this._data.length);this._data=_t.copyOf(this._data,i)}},{key:"toArray",value:function(){var n=new Array(this._size).fill(null);return Ot.arraycopy(this._data,0,n,0,this._size),n}},{key:"add",value:function(n){this.ensureCapacity(this._size+1),this._data[this._size]=n,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,arguments.length===0)o.constructor_.call(this,10);else if(arguments.length===1){var n=arguments[0];this._data=new Array(n).fill(null)}}}])})(),Om=(function(){function o(){u(this,o)}return h(o,[{key:"getChainStartIndices",value:function(n){var i=0,a=new Pm(Math.trunc(n.length/2));a.add(i);do{var l=this.findChainEnd(n,i);a.add(l),i=l}while(i<n.length-1);return a.toArray()}},{key:"findChainEnd",value:function(n,i){for(var a=wt.quadrant(n[i],n[i+1]),l=i+1;l<n.length&&wt.quadrant(n[l-1],n[l])===a;)l++;return l-1}},{key:"OLDgetChainStartIndices",value:function(n){var i=0,a=new de;a.add(i);do{var l=this.findChainEnd(n,i);a.add(l),i=l}while(i<n.length-1);return o.toIntArray(a)}}],[{key:"toIntArray",value:function(n){for(var i=new Array(n.size()).fill(null),a=0;a<i.length;a++)i[a]=n.get(a).intValue();return i}}])})(),Rm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getCoordinates",value:function(){return this.pts}},{key:"getMaxX",value:function(o){var n=this.pts[this.startIndex[o]].x,i=this.pts[this.startIndex[o+1]].x;return n>i?n:i}},{key:"getMinX",value:function(o){var n=this.pts[this.startIndex[o]].x,i=this.pts[this.startIndex[o+1]].x;return n<i?n:i}},{key:"computeIntersectsForChain",value:function(){if(arguments.length===4){var o=arguments[0],n=arguments[1],i=arguments[2],a=arguments[3];this.computeIntersectsForChain(this.startIndex[o],this.startIndex[o+1],n,n.startIndex[i],n.startIndex[i+1],a)}else if(arguments.length===6){var l=arguments[0],g=arguments[1],m=arguments[2],_=arguments[3],x=arguments[4],M=arguments[5];if(g-l==1&&x-_==1)return M.addIntersections(this.e,l,m.e,_),null;if(!this.overlaps(l,g,m,_,x))return null;var j=Math.trunc((l+g)/2),X=Math.trunc((_+x)/2);l<j&&(_<X&&this.computeIntersectsForChain(l,j,m,_,X,M),X<x&&this.computeIntersectsForChain(l,j,m,X,x,M)),j<g&&(_<X&&this.computeIntersectsForChain(j,g,m,_,X,M),X<x&&this.computeIntersectsForChain(j,g,m,X,x,M))}}},{key:"overlaps",value:function(o,n,i,a,l){return Se.intersects(this.pts[o],this.pts[n],i.pts[a],i.pts[l])}},{key:"getStartIndexes",value:function(){return this.startIndex}},{key:"computeIntersects",value:function(o,n){for(var i=0;i<this.startIndex.length-1;i++)for(var a=0;a<o.startIndex.length-1;a++)this.computeIntersectsForChain(i,o,a,n)}}],[{key:"constructor_",value:function(){this.e=null,this.pts=null,this.startIndex=null;var o=arguments[0];this.e=o,this.pts=o.getCoordinates();var n=new Om;this.startIndex=n.getChainStartIndices(this.pts)}}])})(),Rc=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getDepth",value:function(n,i){return this._depth[n][i]}},{key:"setDepth",value:function(n,i,a){this._depth[n][i]=a}},{key:"isNull",value:function(){if(arguments.length===0){for(var n=0;n<2;n++)for(var i=0;i<3;i++)if(this._depth[n][i]!==o.NULL_VALUE)return!1;return!0}if(arguments.length===1){var a=arguments[0];return this._depth[a][1]===o.NULL_VALUE}if(arguments.length===2){var l=arguments[0],g=arguments[1];return this._depth[l][g]===o.NULL_VALUE}}},{key:"normalize",value:function(){for(var n=0;n<2;n++)if(!this.isNull(n)){var i=this._depth[n][1];this._depth[n][2]<i&&(i=this._depth[n][2]),i<0&&(i=0);for(var a=1;a<3;a++){var l=0;this._depth[n][a]>i&&(l=1),this._depth[n][a]=l}}}},{key:"getDelta",value:function(n){return this._depth[n][re.RIGHT]-this._depth[n][re.LEFT]}},{key:"getLocation",value:function(n,i){return this._depth[n][i]<=0?A.EXTERIOR:A.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(arguments.length===1)for(var n=arguments[0],i=0;i<2;i++)for(var a=1;a<3;a++){var l=n.getLocation(i,a);l!==A.EXTERIOR&&l!==A.INTERIOR||(this.isNull(i,a)?this._depth[i][a]=o.depthAtLocation(l):this._depth[i][a]+=o.depthAtLocation(l))}else if(arguments.length===3){var g=arguments[0],m=arguments[1];arguments[2]===A.INTERIOR&&this._depth[g][m]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var n=0;n<2;n++)for(var i=0;i<3;i++)this._depth[n][i]=o.NULL_VALUE}},{key:"depthAtLocation",value:function(n){return n===A.EXTERIOR?0:n===A.INTERIOR?1:o.NULL_VALUE}}])})();Rc.NULL_VALUE=-1;var Dc=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var i=new Array(2).fill(null);return i[0]=this.pts[0],i[1]=this.pts[1],new n(i,Xt.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(i){this._isIsolated=i}},{key:"setName",value:function(i){this._name=i}},{key:"equals",value:function(i){if(!(i instanceof n))return!1;var a=i;if(this.pts.length!==a.pts.length)return!1;for(var l=!0,g=!0,m=this.pts.length,_=0;_<this.pts.length;_++)if(this.pts[_].equals2D(a.pts[_])||(l=!1),this.pts[_].equals2D(a.pts[--m])||(g=!1),!l&&!g)return!1;return!0}},{key:"getCoordinate",value:function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var i=arguments[0];return this.pts[i]}}},{key:"print",value:function(i){i.print("edge "+this._name+": "),i.print("LINESTRING (");for(var a=0;a<this.pts.length;a++)a>0&&i.print(","),i.print(this.pts[a].x+" "+this.pts[a].y);i.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(i){n.updateIM(this._label,i)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(i){i.print("edge "+this._name+": ");for(var a=this.pts.length-1;a>=0;a--)i.print(this.pts[a]+" ");i.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new Rm(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new Se;for(var i=0;i<this.pts.length;i++)this._env.expandToInclude(this.pts[i])}return this._env}},{key:"addIntersection",value:function(i,a,l,g){var m=new V(i.getIntersection(g)),_=a,x=i.getEdgeDistance(l,g),M=_+1;if(M<this.pts.length){var j=this.pts[M];m.equals2D(j)&&(_=M,x=0)}this.eiList.add(m,_,x)}},{key:"toString",value:function(){var i=new Re;i.append("edge "+this._name+": "),i.append("LINESTRING (");for(var a=0;a<this.pts.length;a++)a>0&&i.append(","),i.append(this.pts[a].x+" "+this.pts[a].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()}},{key:"isPointwiseEqual",value:function(i){if(this.pts.length!==i.pts.length)return!1;for(var a=0;a<this.pts.length;a++)if(!this.pts[a].equals2D(i.pts[a]))return!1;return!0}},{key:"setDepthDelta",value:function(i){this._depthDelta=i}},{key:"getEdgeIntersectionList",value:function(){return this.eiList}},{key:"addIntersections",value:function(i,a,l){for(var g=0;g<i.getIntersectionNum();g++)this.addIntersection(i,a,l,g)}}],[{key:"constructor_",value:function(){if(this.pts=null,this._env=null,this.eiList=new Am(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Rc,this._depthDelta=0,arguments.length===1){var i=arguments[0];n.constructor_.call(this,i,null)}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.pts=a,this._label=l}}},{key:"updateIM",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Tm&&arguments[0]instanceof Xt))return b(n,"updateIM",this).apply(this,arguments);var i=arguments[0],a=arguments[1];a.setAtLeastIfValid(i.getLocation(0,re.ON),i.getLocation(1,re.ON),1),i.isArea()&&(a.setAtLeastIfValid(i.getLocation(0,re.LEFT),i.getLocation(1,re.LEFT),2),a.setAtLeastIfValid(i.getLocation(0,re.RIGHT),i.getLocation(1,re.RIGHT),2))}}])})(mc),Fc=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"setWorkingPrecisionModel",value:function(n){this._workingPrecisionModel=n}},{key:"insertUniqueEdge",value:function(n){var i=this._edgeList.findEqualEdge(n);if(i!==null){var a=i.getLabel(),l=n.getLabel();i.isPointwiseEqual(n)||(l=new Xt(n.getLabel())).flip(),a.merge(l);var g=o.depthDelta(l),m=i.getDepthDelta()+g;i.setDepthDelta(m)}else this._edgeList.add(n),n.setDepthDelta(o.depthDelta(n.getLabel()))}},{key:"buildSubgraphs",value:function(n,i){for(var a=new de,l=n.iterator();l.hasNext();){var g=l.next(),m=g.getRightmostCoordinate(),_=new Cc(a).getDepth(m);g.computeDepth(_),g.findResultEdges(),a.add(g),i.add(g.getDirectedEdges(),g.getNodes())}}},{key:"createSubgraphs",value:function(n){for(var i=new de,a=n.getNodes().iterator();a.hasNext();){var l=a.next();if(!l.isVisited()){var g=new os;g.create(l),i.add(g)}}return xi.sort(i,xi.reverseOrder()),i}},{key:"createEmptyResultGeometry",value:function(){return this._geomFact.createPolygon()}},{key:"getNoder",value:function(n){if(this._workingNoder!==null)return this._workingNoder;var i=new Vo,a=new zr;return a.setPrecisionModel(n),i.setSegmentIntersector(new Lm(a)),i}},{key:"buffer",value:function(n,i){var a=this._workingPrecisionModel;a===null&&(a=n.getPrecisionModel()),this._geomFact=n.getFactory();var l=new _m(a,this._bufParams),g=new Em(n,i,l).getCurves();if(g.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(g,a),this._graph=new xc(new Mm),this._graph.addEdges(this._edgeList.getEdges());var m=this.createSubgraphs(this._graph),_=new am(this._geomFact);this.buildSubgraphs(m,_);var x=_.getPolygons();return x.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(x)}},{key:"computeNodedEdges",value:function(n,i){var a=this.getNoder(i);a.computeNodes(n);for(var l=a.getNodedSubstrings().iterator();l.hasNext();){var g=l.next(),m=g.getCoordinates();if(m.length!==2||!m[0].equals2D(m[1])){var _=g.getData(),x=new Dc(g.getCoordinates(),new Xt(_));this.insertUniqueEdge(x)}}}},{key:"setNoder",value:function(n){this._workingNoder=n}}],[{key:"constructor_",value:function(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Nm;var n=arguments[0];this._bufParams=n}},{key:"depthDelta",value:function(n){var i=n.getLocation(0,re.LEFT),a=n.getLocation(0,re.RIGHT);return i===A.INTERIOR&&a===A.EXTERIOR?1:i===A.EXTERIOR&&a===A.INTERIOR?-1:0}},{key:"convertSegStrings",value:function(n){for(var i=new ki,a=new de;n.hasNext();){var l=n.next(),g=i.createLineString(l.getCoordinates());a.add(g)}return i.buildGeometry(a)}}])})(),Dm=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"rescale",value:function(){if(_e(arguments[0],Ce))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.rescale(i.getCoordinates())}else if(arguments[0]instanceof Array){for(var a=arguments[0],l=0;l<a.length;l++)a[l].x=a[l].x/this._scaleFactor+this._offsetX,a[l].y=a[l].y/this._scaleFactor+this._offsetY;a.length===2&&a[0].equals2D(a[1])&&Ot.out.println(a)}}},{key:"scale",value:function(){if(_e(arguments[0],Ce)){for(var n=arguments[0],i=new de(n.size()),a=n.iterator();a.hasNext();){var l=a.next();i.add(new Jr(this.scale(l.getCoordinates()),l.getData()))}return i}if(arguments[0]instanceof Array){for(var g=arguments[0],m=new Array(g.length).fill(null),_=0;_<g.length;_++)m[_]=new V(Math.round((g[_].x-this._offsetX)*this._scaleFactor),Math.round((g[_].y-this._offsetY)*this._scaleFactor),g[_].getZ());return ee.removeRepeatedPoints(m)}}},{key:"isIntegerPrecision",value:function(){return this._scaleFactor===1}},{key:"getNodedSubstrings",value:function(){var n=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(n),n}},{key:"computeNodes",value:function(n){var i=n;this._isScaled&&(i=this.scale(n)),this._noder.computeNodes(i)}},{key:"interfaces_",get:function(){return[Ho]}}],[{key:"constructor_",value:function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var n=arguments[0],i=arguments[1];o.constructor_.call(this,n,i,0,0)}else if(arguments.length===4){var a=arguments[0],l=arguments[1];this._noder=a,this._scaleFactor=l,this._isScaled=!this.isIntegerPrecision()}}}])})(),Gc=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"checkEndPtVertexIntersections",value:function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var i=n.next().getCoordinates();this.checkEndPtVertexIntersections(i[0],this._segStrings),this.checkEndPtVertexIntersections(i[i.length-1],this._segStrings)}else if(arguments.length===2){for(var a=arguments[0],l=arguments[1].iterator();l.hasNext();)for(var g=l.next().getCoordinates(),m=1;m<g.length-1;m++)if(g[m].equals(a))throw new oe("found endpt/interior pt intersection at index "+m+" :pt "+a)}}},{key:"checkInteriorIntersections",value:function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();)for(var i=n.next(),a=this._segStrings.iterator();a.hasNext();){var l=a.next();this.checkInteriorIntersections(i,l)}else if(arguments.length===2)for(var g=arguments[0],m=arguments[1],_=g.getCoordinates(),x=m.getCoordinates(),M=0;M<_.length-1;M++)for(var j=0;j<x.length-1;j++)this.checkInteriorIntersections(g,M,m,j);else if(arguments.length===4){var X=arguments[0],K=arguments[1],ce=arguments[2],ge=arguments[3];if(X===ce&&K===ge)return null;var pe=X.getCoordinates()[K],Me=X.getCoordinates()[K+1],Ie=ce.getCoordinates()[ge],Fe=ce.getCoordinates()[ge+1];if(this._li.computeIntersection(pe,Me,Ie,Fe),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,pe,Me)||this.hasInteriorIntersection(this._li,Ie,Fe)))throw new oe("found non-noded intersection at "+pe+"-"+Me+" and "+Ie+"-"+Fe)}}},{key:"checkValid",value:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()}},{key:"checkCollapses",value:function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var i=n.next();this.checkCollapses(i)}else if(arguments.length===1)for(var a=arguments[0].getCoordinates(),l=0;l<a.length-2;l++)this.checkCollapse(a[l],a[l+1],a[l+2])}},{key:"hasInteriorIntersection",value:function(n,i,a){for(var l=0;l<n.getIntersectionNum();l++){var g=n.getIntersection(l);if(!g.equals(i)&&!g.equals(a))return!0}return!1}},{key:"checkCollapse",value:function(n,i,a){if(n.equals(a))throw new oe("found non-noded collapse at "+o.fact.createLineString([n,i,a]))}}],[{key:"constructor_",value:function(){this._li=new zr,this._segStrings=null;var n=arguments[0];this._segStrings=n}}])})();Gc.fact=new ki;var $o=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"intersectsScaled",value:function(n,i){var a=Math.min(n.x,i.x),l=Math.max(n.x,i.x),g=Math.min(n.y,i.y),m=Math.max(n.y,i.y),_=this._maxx<a||this._minx>l||this._maxy<g||this._miny>m;if(_)return!1;var x=this.intersectsToleranceSquare(n,i);return ie.isTrue(!(_&&x),"Found bad envelope test"),x}},{key:"initCorners",value:function(n){var i=.5;this._minx=n.x-i,this._maxx=n.x+i,this._miny=n.y-i,this._maxy=n.y+i,this._corner[0]=new V(this._maxx,this._maxy),this._corner[1]=new V(this._minx,this._maxy),this._corner[2]=new V(this._minx,this._miny),this._corner[3]=new V(this._maxx,this._miny)}},{key:"intersects",value:function(n,i){return this._scaleFactor===1?this.intersectsScaled(n,i):(this.copyScaled(n,this._p0Scaled),this.copyScaled(i,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(n){return Math.round(n*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(n,i){i.x=this.scale(n.x),i.y=this.scale(n.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var n=o.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Se(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(n,i){return this._li.computeIntersection(n,i,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(n,i){var a=!1,l=!1;return this._li.computeIntersection(n,i,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(n,i,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(a=!0),this._li.computeIntersection(n,i,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(l=!0),this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!a||!l)||!!n.equals(this._pt)||!!i.equals(this._pt))))}},{key:"addSnappedNode",value:function(n,i){var a=n.getCoordinate(i),l=n.getCoordinate(i+1);return!!this.intersects(a,l)&&(n.addIntersection(this.getCoordinate(),i),!0)}}],[{key:"constructor_",value:function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var n=arguments[0],i=arguments[1],a=arguments[2];if(this._originalPt=n,this._pt=n,this._scaleFactor=i,this._li=a,i<=0)throw new J("Scale factor must be non-zero");i!==1&&(this._pt=new V(this.scale(n.x),this.scale(n.y)),this._p0Scaled=new V,this._p1Scaled=new V),this.initCorners(this._pt)}}])})();$o.SAFE_ENV_EXPANSION_FACTOR=.75;var Fm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"select",value:function(){if(arguments.length!==1&&arguments.length===2){var o=arguments[1];arguments[0].getLineSegment(o,this.selectedSegment),this.select(this.selectedSegment)}}}],[{key:"constructor_",value:function(){this.selectedSegment=new Ut}}])})(),Bc=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"snap",value:function(){if(arguments.length===1){var o=arguments[0];return this.snap(o,null,-1)}if(arguments.length===3){var n=arguments[0],i=arguments[1],a=arguments[2],l=n.getSafeEnvelope(),g=new Uc(n,i,a);return this._index.query(l,new((function(){return h((function m(){u(this,m)}),[{key:"interfaces_",get:function(){return[bc]}},{key:"visitItem",value:function(m){m.select(l,g)}}])})())),g.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var o=arguments[0];this._index=o}}])})(),Uc=(function(o){function n(){var i;return u(this,n),i=s(this,n),n.constructor_.apply(i,arguments),i}return v(n,o),h(n,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof Ic))return b(n,"select",this,1).apply(this,arguments);var i=arguments[1],a=arguments[0].getContext();if(this._parentEdge===a&&(i===this._hotPixelVertexIndex||i+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(a,i)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var i=arguments[0],a=arguments[1],l=arguments[2];this._hotPixel=i,this._parentEdge=a,this._hotPixelVertexIndex=l}}])})(Fm);Bc.HotPixelSnapAction=Uc;var Gm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"processIntersections",value:function(o,n,i,a){if(o===i&&n===a)return null;var l=o.getCoordinates()[n],g=o.getCoordinates()[n+1],m=i.getCoordinates()[a],_=i.getCoordinates()[a+1];if(this._li.computeIntersection(l,g,m,_),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var x=0;x<this._li.getIntersectionNum();x++)this._interiorIntersections.add(this._li.getIntersection(x));o.addIntersections(this._li,n,0),i.addIntersections(this._li,a,1)}}},{key:"isDone",value:function(){return!1}},{key:"getInteriorIntersections",value:function(){return this._interiorIntersections}},{key:"interfaces_",get:function(){return[Oc]}}],[{key:"constructor_",value:function(){this._li=null,this._interiorIntersections=null;var o=arguments[0];this._li=o,this._interiorIntersections=new de}}])})(),Bm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"checkCorrectness",value:function(o){var n=Jr.getNodedSubstrings(o),i=new Gc(n);try{i.checkValid()}catch(a){if(!(a instanceof H))throw a;a.printStackTrace()}}},{key:"getNodedSubstrings",value:function(){return Jr.getNodedSubstrings(this._nodedSegStrings)}},{key:"snapRound",value:function(o,n){var i=this.findInteriorIntersections(o,n);this.computeIntersectionSnaps(i),this.computeVertexSnaps(o)}},{key:"findInteriorIntersections",value:function(o,n){var i=new Gm(n);return this._noder.setSegmentIntersector(i),this._noder.computeNodes(o),i.getInteriorIntersections()}},{key:"computeVertexSnaps",value:function(){if(_e(arguments[0],Ce))for(var o=arguments[0].iterator();o.hasNext();){var n=o.next();this.computeVertexSnaps(n)}else if(arguments[0]instanceof Jr)for(var i=arguments[0],a=i.getCoordinates(),l=0;l<a.length;l++){var g=new $o(a[l],this._scaleFactor,this._li);this._pointSnapper.snap(g,i,l)&&i.addIntersection(a[l],l)}}},{key:"computeNodes",value:function(o){this._nodedSegStrings=o,this._noder=new Vo,this._pointSnapper=new Bc(this._noder.getIndex()),this.snapRound(o,this._li)}},{key:"computeIntersectionSnaps",value:function(o){for(var n=o.iterator();n.hasNext();){var i=n.next(),a=new $o(i,this._scaleFactor,this._li);this._pointSnapper.snap(a)}}},{key:"interfaces_",get:function(){return[Ho]}}],[{key:"constructor_",value:function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var o=arguments[0];this._pm=o,this._li=new zr,this._li.setPrecisionModel(o),this._scaleFactor=o.getScale()}}])})(),Si=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"bufferFixedPrecision",value:function(n){var i=new Dm(new Bm(new Rt(1)),n.getScale()),a=new Fc(this._bufParams);a.setWorkingPrecisionModel(n),a.setNoder(i),this._resultGeometry=a.buffer(this._argGeom,this._distance)}},{key:"bufferReducedPrecision",value:function(){if(arguments.length===0){for(var n=o.MAX_PRECISION_DIGITS;n>=0;n--){try{this.bufferReducedPrecision(n)}catch(g){if(!(g instanceof Pt))throw g;this._saveException=g}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var i=arguments[0],a=o.precisionScaleFactor(this._argGeom,this._distance,i),l=new Rt(a);this.bufferFixedPrecision(l)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var n=this._argGeom.getFactory().getPrecisionModel();n.getType()===Rt.FIXED?this.bufferFixedPrecision(n):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(n){this._bufParams.setQuadrantSegments(n)}},{key:"bufferOriginalPrecision",value:function(){try{var n=new Fc(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(i){if(!(i instanceof oe))throw i;this._saveException=i}}},{key:"getResultGeometry",value:function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(n){this._bufParams.setEndCapStyle(n)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new q,this._resultGeometry=null,this._saveException=null,arguments.length===1){var n=arguments[0];this._argGeom=n}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this._argGeom=i,this._bufParams=a}}},{key:"bufferOp",value:function(){if(arguments.length===2){var n=arguments[1];return new o(arguments[0]).getResultGeometry(n)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof fe&&typeof arguments[1]=="number"){var i=arguments[1],a=arguments[2],l=new o(arguments[0]);return l.setQuadrantSegments(a),l.getResultGeometry(i)}if(arguments[2]instanceof q&&arguments[0]instanceof fe&&typeof arguments[1]=="number"){var g=arguments[1];return new o(arguments[0],arguments[2]).getResultGeometry(g)}}else if(arguments.length===4){var m=arguments[1],_=arguments[2],x=arguments[3],M=new o(arguments[0]);return M.setQuadrantSegments(_),M.setEndCapStyle(x),M.getResultGeometry(m)}}},{key:"precisionScaleFactor",value:function(n,i,a){var l=n.getEnvelopeInternal(),g=Tn.max(Math.abs(l.getMaxX()),Math.abs(l.getMaxY()),Math.abs(l.getMinX()),Math.abs(l.getMinY()))+2*(i>0?i:0),m=a-Math.trunc(Math.log(g)/Math.log(10)+1);return Math.pow(10,m)}}])})();Si.CAP_ROUND=q.CAP_ROUND,Si.CAP_BUTT=q.CAP_FLAT,Si.CAP_FLAT=q.CAP_FLAT,Si.CAP_SQUARE=q.CAP_SQUARE,Si.MAX_PRECISION_DIGITS=12;var Um=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],jc=(function(){return h((function o(n){u(this,o),this.geometryFactory=n||new ki}),[{key:"read",value:function(o){var n,i=(n=typeof o=="string"?JSON.parse(o):o).type;if(!Wt[i])throw new Error("Unknown GeoJSON type: "+n.type);return Um.indexOf(i)!==-1?Wt[i].call(this,n.coordinates):i==="GeometryCollection"?Wt[i].call(this,n.geometries):Wt[i].call(this,n)}},{key:"write",value:function(o){var n=o.getGeometryType();if(!Bn[n])throw new Error("Geometry is not supported");return Bn[n].call(this,o)}}])})(),Wt={Feature:function(o){var n={};for(var i in o)n[i]=o[i];if(o.geometry){var a=o.geometry.type;if(!Wt[a])throw new Error("Unknown GeoJSON type: "+o.type);n.geometry=this.read(o.geometry)}return o.bbox&&(n.bbox=Wt.bbox.call(this,o.bbox)),n},FeatureCollection:function(o){var n={};if(o.features){n.features=[];for(var i=0;i<o.features.length;++i)n.features.push(this.read(o.features[i]))}return o.bbox&&(n.bbox=this.parse.bbox.call(this,o.bbox)),n},coordinates:function(o){for(var n=[],i=0;i<o.length;++i){var a=o[i];n.push(c(V,N(a)))}return n},bbox:function(o){return this.geometryFactory.createLinearRing([new V(o[0],o[1]),new V(o[2],o[1]),new V(o[2],o[3]),new V(o[0],o[3]),new V(o[0],o[1])])},Point:function(o){var n=c(V,N(o));return this.geometryFactory.createPoint(n)},MultiPoint:function(o){for(var n=[],i=0;i<o.length;++i)n.push(Wt.Point.call(this,o[i]));return this.geometryFactory.createMultiPoint(n)},LineString:function(o){var n=Wt.coordinates.call(this,o);return this.geometryFactory.createLineString(n)},MultiLineString:function(o){for(var n=[],i=0;i<o.length;++i)n.push(Wt.LineString.call(this,o[i]));return this.geometryFactory.createMultiLineString(n)},Polygon:function(o){for(var n=Wt.coordinates.call(this,o[0]),i=this.geometryFactory.createLinearRing(n),a=[],l=1;l<o.length;++l){var g=o[l],m=Wt.coordinates.call(this,g),_=this.geometryFactory.createLinearRing(m);a.push(_)}return this.geometryFactory.createPolygon(i,a)},MultiPolygon:function(o){for(var n=[],i=0;i<o.length;++i){var a=o[i];n.push(Wt.Polygon.call(this,a))}return this.geometryFactory.createMultiPolygon(n)},GeometryCollection:function(o){for(var n=[],i=0;i<o.length;++i){var a=o[i];n.push(this.read(a))}return this.geometryFactory.createGeometryCollection(n)}},Bn={coordinate:function(o){var n=[o.x,o.y];return o.z&&n.push(o.z),o.m&&n.push(o.m),n},Point:function(o){return{type:"Point",coordinates:Bn.coordinate.call(this,o.getCoordinate())}},MultiPoint:function(o){for(var n=[],i=0;i<o._geometries.length;++i){var a=o._geometries[i],l=Bn.Point.call(this,a);n.push(l.coordinates)}return{type:"MultiPoint",coordinates:n}},LineString:function(o){for(var n=[],i=o.getCoordinates(),a=0;a<i.length;++a){var l=i[a];n.push(Bn.coordinate.call(this,l))}return{type:"LineString",coordinates:n}},MultiLineString:function(o){for(var n=[],i=0;i<o._geometries.length;++i){var a=o._geometries[i],l=Bn.LineString.call(this,a);n.push(l.coordinates)}return{type:"MultiLineString",coordinates:n}},Polygon:function(o){var n=[],i=Bn.LineString.call(this,o._shell);n.push(i.coordinates);for(var a=0;a<o._holes.length;++a){var l=o._holes[a],g=Bn.LineString.call(this,l);n.push(g.coordinates)}return{type:"Polygon",coordinates:n}},MultiPolygon:function(o){for(var n=[],i=0;i<o._geometries.length;++i){var a=o._geometries[i],l=Bn.Polygon.call(this,a);n.push(l.coordinates)}return{type:"MultiPolygon",coordinates:n}},GeometryCollection:function(o){for(var n=[],i=0;i<o._geometries.length;++i){var a=o._geometries[i],l=a.getGeometryType();n.push(Bn[l].call(this,a))}return{type:"GeometryCollection",geometries:n}}};return{BufferOp:Si,GeoJSONReader:(function(){return h((function o(n){u(this,o),this.parser=new jc(n||new ki)}),[{key:"read",value:function(o){return this.parser.read(o)}}])})(),GeoJSONWriter:(function(){return h((function o(){u(this,o),this.parser=new jc(this.geometryFactory)}),[{key:"write",value:function(o){return this.parser.write(o)}}])})()}}))})(sl)),sl.exports}var Ab=Cb();const Tb=Ag(Ab);function Gr(){return new io}function io(){this.reset()}io.prototype={constructor:io,reset:function(){this.s=this.t=0},add:function(t){pf(Sa,t,this.t),pf(this,Sa.s,this.s),this.s?this.t+=Sa.t:this.s=Sa.t},valueOf:function(){return this.s}};var Sa=new io;function pf(t,e,r){var s=t.s=e+r,u=s-e,c=s-u;t.t=e-c+(r-u)}var je=1e-6,Ae=Math.PI,zn=Ae/2,mf=Ae/4,Wn=Ae*2,wr=180/Ae,nn=Ae/180,lt=Math.abs,Pb=Math.atan,$i=Math.atan2,Xe=Math.cos,$e=Math.sin,ss=Math.sqrt;function fp(t){return t>1?0:t<-1?Ae:Math.acos(t)}function si(t){return t>1?zn:t<-1?-zn:Math.asin(t)}function As(){}function so(t,e){t&&yf.hasOwnProperty(t.type)&&yf[t.type](t,e)}var vf={Feature:function(t,e){so(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,s=-1,u=r.length;++s<u;)so(r[s].geometry,e)}},yf={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,s=-1,u=r.length;++s<u;)t=r[s],e.point(t[0],t[1],t[2])},LineString:function(t,e){al(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,s=-1,u=r.length;++s<u;)al(r[s],e,0)},Polygon:function(t,e){_f(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,s=-1,u=r.length;++s<u;)_f(r[s],e)},GeometryCollection:function(t,e){for(var r=t.geometries,s=-1,u=r.length;++s<u;)so(r[s],e)}};function al(t,e,r){var s=-1,u=t.length-r,c;for(e.lineStart();++s<u;)c=t[s],e.point(c[0],c[1],c[2]);e.lineEnd()}function _f(t,e){var r=-1,s=t.length;for(e.polygonStart();++r<s;)al(t[r],e,1);e.polygonEnd()}function Ob(t,e){t&&vf.hasOwnProperty(t.type)?vf[t.type](t,e):so(t,e)}Gr();Gr();function ol(t){return[$i(t[1],t[0]),si(t[2])]}function Wi(t){var e=t[0],r=t[1],s=Xe(r);return[s*Xe(e),s*$e(e),$e(r)]}function Ia(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ao(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function _u(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Ma(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function ul(t){var e=ss(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}Gr();function gp(t,e){function r(s,u){return s=t(s,u),e(s[0],s[1])}return t.invert&&e.invert&&(r.invert=function(s,u){return s=e.invert(s,u),s&&t.invert(s[0],s[1])}),r}function ll(t,e){return[t>Ae?t-Wn:t<-Ae?t+Wn:t,e]}ll.invert=ll;function Rb(t,e,r){return(t%=Wn)?e||r?gp(Ef(t),xf(e,r)):Ef(t):e||r?xf(e,r):ll}function kf(t){return function(e,r){return e+=t,[e>Ae?e-Wn:e<-Ae?e+Wn:e,r]}}function Ef(t){var e=kf(t);return e.invert=kf(-t),e}function xf(t,e){var r=Xe(t),s=$e(t),u=Xe(e),c=$e(e);function f(h,d){var p=Xe(d),y=Xe(h)*p,v=$e(h)*p,E=$e(d),S=E*r+y*s;return[$i(v*u-S*c,y*r-E*s),si(S*u+v*c)]}return f.invert=function(h,d){var p=Xe(d),y=Xe(h)*p,v=$e(h)*p,E=$e(d),S=E*u-v*c;return[$i(v*u+E*c,y*r+S*s),si(S*r-y*s)]},f}function Db(t,e,r,s,u,c){if(r){var f=Xe(e),h=$e(e),d=s*r;u==null?(u=e+s*Wn,c=e-d/2):(u=wf(f,u),c=wf(f,c),(s>0?u<c:u>c)&&(u+=s*Wn));for(var p,y=u;s>0?y>c:y<c;y-=d)p=ol([f,-h*Xe(y),-h*$e(y)]),t.point(p[0],p[1])}}function wf(t,e){e=Wi(e),e[0]-=t,ul(e);var r=fp(-e[1]);return((-e[2]<0?-r:r)+Wn-je)%Wn}function dp(){var t=[],e;return{point:function(r,s){e.push([r,s])},lineStart:function(){t.push(e=[])},lineEnd:As,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var r=t;return t=[],e=null,r}}}function Fb(t,e,r,s,u,c){var f=t[0],h=t[1],d=e[0],p=e[1],y=0,v=1,E=d-f,S=p-h,b;if(b=r-f,!(!E&&b>0)){if(b/=E,E<0){if(b<y)return;b<v&&(v=b)}else if(E>0){if(b>v)return;b>y&&(y=b)}if(b=u-f,!(!E&&b<0)){if(b/=E,E<0){if(b>v)return;b>y&&(y=b)}else if(E>0){if(b<y)return;b<v&&(v=b)}if(b=s-h,!(!S&&b>0)){if(b/=S,S<0){if(b<y)return;b<v&&(v=b)}else if(S>0){if(b>v)return;b>y&&(y=b)}if(b=c-h,!(!S&&b<0)){if(b/=S,S<0){if(b>v)return;b>y&&(y=b)}else if(S>0){if(b<y)return;b<v&&(v=b)}return y>0&&(t[0]=f+y*E,t[1]=h+y*S),v<1&&(e[0]=f+v*E,e[1]=h+v*S),!0}}}}}function ja(t,e){return lt(t[0]-e[0])<je&<(t[1]-e[1])<je}function Na(t,e,r,s){this.x=t,this.z=e,this.o=r,this.e=s,this.v=!1,this.n=this.p=null}function pp(t,e,r,s,u){var c=[],f=[],h,d;if(t.forEach(function(b){if(!((N=b.length-1)<=0)){var N,O=b[0],D=b[N],L;if(ja(O,D)){for(u.lineStart(),h=0;h<N;++h)u.point((O=b[h])[0],O[1]);u.lineEnd();return}c.push(L=new Na(O,b,null,!0)),f.push(L.o=new Na(O,null,L,!1)),c.push(L=new Na(D,b,null,!1)),f.push(L.o=new Na(D,null,L,!0))}}),!!c.length){for(f.sort(e),bf(c),bf(f),h=0,d=f.length;h<d;++h)f[h].e=r=!r;for(var p=c[0],y,v;;){for(var E=p,S=!0;E.v;)if((E=E.n)===p)return;y=E.z,u.lineStart();do{if(E.v=E.o.v=!0,E.e){if(S)for(h=0,d=y.length;h<d;++h)u.point((v=y[h])[0],v[1]);else s(E.x,E.n.x,1,u);E=E.n}else{if(S)for(y=E.p.z,h=y.length-1;h>=0;--h)u.point((v=y[h])[0],v[1]);else s(E.x,E.p.x,-1,u);E=E.p}E=E.o,y=E.z,S=!S}while(!E.v);u.lineEnd()}}}function bf(t){if(e=t.length){for(var e,r=0,s=t[0],u;++r<e;)s.n=u=t[r],u.p=s,s=u;s.n=u=t[0],u.p=s}}function mp(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Gb(t){return t.length===1&&(t=Bb(t)),{left:function(e,r,s,u){for(s==null&&(s=0),u==null&&(u=e.length);s<u;){var c=s+u>>>1;t(e[c],r)<0?s=c+1:u=c}return s},right:function(e,r,s,u){for(s==null&&(s=0),u==null&&(u=e.length);s<u;){var c=s+u>>>1;t(e[c],r)>0?u=c:s=c+1}return s}}}function Bb(t){return function(e,r){return mp(t(e),r)}}Gb(mp);function vp(t){for(var e=t.length,r,s=-1,u=0,c,f;++s<e;)u+=t[s].length;for(c=new Array(u);--e>=0;)for(f=t[e],r=f.length;--r>=0;)c[--u]=f[r];return c}var Ts=1e9,La=-Ts;function Ub(t,e,r,s){function u(p,y){return t<=p&&p<=r&&e<=y&&y<=s}function c(p,y,v,E){var S=0,b=0;if(p==null||(S=f(p,v))!==(b=f(y,v))||d(p,y)<0^v>0)do E.point(S===0||S===3?t:r,S>1?s:e);while((S=(S+v+4)%4)!==b);else E.point(y[0],y[1])}function f(p,y){return lt(p[0]-t)<je?y>0?0:3:lt(p[0]-r)<je?y>0?2:1:lt(p[1]-e)<je?y>0?1:0:y>0?3:2}function h(p,y){return d(p.x,y.x)}function d(p,y){var v=f(p,1),E=f(y,1);return v!==E?v-E:v===0?y[1]-p[1]:v===1?p[0]-y[0]:v===2?p[1]-y[1]:y[0]-p[0]}return function(p){var y=p,v=dp(),E,S,b,N,O,D,L,q,H,J,z,$={point:k,lineStart:T,lineEnd:G,polygonStart:I,polygonEnd:P};function k(C,B){u(C,B)&&y.point(C,B)}function w(){for(var C=0,B=0,U=S.length;B<U;++B)for(var Y=S[B],W=1,Z=Y.length,ne=Y[0],oe,le,ie=ne[0],ue=ne[1];W<Z;++W)oe=ie,le=ue,ne=Y[W],ie=ne[0],ue=ne[1],le<=s?ue>s&&(ie-oe)*(s-le)>(ue-le)*(t-oe)&&++C:ue<=s&&(ie-oe)*(s-le)<(ue-le)*(t-oe)&&--C;return C}function I(){y=v,E=[],S=[],z=!0}function P(){var C=w(),B=z&&C,U=(E=vp(E)).length;(B||U)&&(p.polygonStart(),B&&(p.lineStart(),c(null,null,1,p),p.lineEnd()),U&&pp(E,h,C,c,p),p.polygonEnd()),y=p,E=S=b=null}function T(){$.point=R,S&&S.push(b=[]),J=!0,H=!1,L=q=NaN}function G(){E&&(R(N,O),D&&H&&v.rejoin(),E.push(v.result())),$.point=k,H&&y.lineEnd()}function R(C,B){var U=u(C,B);if(S&&b.push([C,B]),J)N=C,O=B,D=U,J=!1,U&&(y.lineStart(),y.point(C,B));else if(U&&H)y.point(C,B);else{var Y=[L=Math.max(La,Math.min(Ts,L)),q=Math.max(La,Math.min(Ts,q))],W=[C=Math.max(La,Math.min(Ts,C)),B=Math.max(La,Math.min(Ts,B))];Fb(Y,W,t,e,r,s)?(H||(y.lineStart(),y.point(Y[0],Y[1])),y.point(W[0],W[1]),U||y.lineEnd(),z=!1):U&&(y.lineStart(),y.point(C,B),z=!1)}L=C,q=B,H=U}return $}}var ku=Gr();function jb(t,e){var r=e[0],s=e[1],u=[$e(r),-Xe(r),0],c=0,f=0;ku.reset();for(var h=0,d=t.length;h<d;++h)if(y=(p=t[h]).length)for(var p,y,v=p[y-1],E=v[0],S=v[1]/2+mf,b=$e(S),N=Xe(S),O=0;O<y;++O,E=L,b=H,N=J,v=D){var D=p[O],L=D[0],q=D[1]/2+mf,H=$e(q),J=Xe(q),z=L-E,$=z>=0?1:-1,k=$*z,w=k>Ae,I=b*H;if(ku.add($i(I*$*$e(k),N*J+I*Xe(k))),c+=w?z+$*Wn:z,w^E>=r^L>=r){var P=ao(Wi(v),Wi(D));ul(P);var T=ao(u,P);ul(T);var G=(w^z>=0?-1:1)*si(T[2]);(s>G||s===G&&(P[0]||P[1]))&&(f+=w^z>=0?1:-1)}}return(c<-je||c<je&&ku<-je)^f&1}Gr();function Sf(t){return t}Gr();Gr();var Zi=1/0,oo=Zi,Zs=-Zi,uo=Zs,If={point:qb,lineStart:As,lineEnd:As,polygonStart:As,polygonEnd:As,result:function(){var t=[[Zi,oo],[Zs,uo]];return Zs=uo=-(oo=Zi=1/0),t}};function qb(t,e){t<Zi&&(Zi=t),t>Zs&&(Zs=t),e<oo&&(oo=e),e>uo&&(uo=e)}Gr();function yp(t,e,r,s){return function(u,c){var f=e(c),h=u.invert(s[0],s[1]),d=dp(),p=e(d),y=!1,v,E,S,b={point:N,lineStart:D,lineEnd:L,polygonStart:function(){b.point=q,b.lineStart=H,b.lineEnd=J,E=[],v=[]},polygonEnd:function(){b.point=N,b.lineStart=D,b.lineEnd=L,E=vp(E);var z=jb(v,h);E.length?(y||(c.polygonStart(),y=!0),pp(E,zb,z,r,c)):z&&(y||(c.polygonStart(),y=!0),c.lineStart(),r(null,null,1,c),c.lineEnd()),y&&(c.polygonEnd(),y=!1),E=v=null},sphere:function(){c.polygonStart(),c.lineStart(),r(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function N(z,$){var k=u(z,$);t(z=k[0],$=k[1])&&c.point(z,$)}function O(z,$){var k=u(z,$);f.point(k[0],k[1])}function D(){b.point=O,f.lineStart()}function L(){b.point=N,f.lineEnd()}function q(z,$){S.push([z,$]);var k=u(z,$);p.point(k[0],k[1])}function H(){p.lineStart(),S=[]}function J(){q(S[0][0],S[0][1]),p.lineEnd();var z=p.clean(),$=d.result(),k,w=$.length,I,P,T;if(S.pop(),v.push(S),S=null,!!w){if(z&1){if(P=$[0],(I=P.length-1)>0){for(y||(c.polygonStart(),y=!0),c.lineStart(),k=0;k<I;++k)c.point((T=P[k])[0],T[1]);c.lineEnd()}return}w>1&&z&2&&$.push($.pop().concat($.shift())),E.push($.filter(Yb))}}return b}}function Yb(t){return t.length>1}function zb(t,e){return((t=t.x)[0]<0?t[1]-zn-je:zn-t[1])-((e=e.x)[0]<0?e[1]-zn-je:zn-e[1])}const Mf=yp(function(){return!0},Jb,Vb,[-Ae,-zn]);function Jb(t){var e=NaN,r=NaN,s=NaN,u;return{lineStart:function(){t.lineStart(),u=1},point:function(c,f){var h=c>0?Ae:-Ae,d=lt(c-e);lt(d-Ae)<je?(t.point(e,r=(r+f)/2>0?zn:-zn),t.point(s,r),t.lineEnd(),t.lineStart(),t.point(h,r),t.point(c,r),u=0):s!==h&&d>=Ae&&(lt(e-s)<je&&(e-=s*je),lt(c-h)<je&&(c-=h*je),r=Hb(e,r,c,f),t.point(s,r),t.lineEnd(),t.lineStart(),t.point(h,r),u=0),t.point(e=c,r=f),s=h},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-u}}}function Hb(t,e,r,s){var u,c,f=$e(t-r);return lt(f)>je?Pb(($e(e)*(c=Xe(s))*$e(r)-$e(s)*(u=Xe(e))*$e(t))/(u*c*f)):(e+s)/2}function Vb(t,e,r,s){var u;if(t==null)u=r*zn,s.point(-Ae,u),s.point(0,u),s.point(Ae,u),s.point(Ae,0),s.point(Ae,-u),s.point(0,-u),s.point(-Ae,-u),s.point(-Ae,0),s.point(-Ae,u);else if(lt(t[0]-e[0])>je){var c=t[0]<e[0]?Ae:-Ae;u=r*c/2,s.point(-c,u),s.point(0,u),s.point(c,u)}else s.point(e[0],e[1])}function Xb(t,e){var r=Xe(t),s=r>0,u=lt(r)>je;function c(y,v,E,S){Db(S,t,e,E,y,v)}function f(y,v){return Xe(y)*Xe(v)>r}function h(y){var v,E,S,b,N;return{lineStart:function(){b=S=!1,N=1},point:function(O,D){var L=[O,D],q,H=f(O,D),J=s?H?0:p(O,D):H?p(O+(O<0?Ae:-Ae),D):0;if(!v&&(b=S=H)&&y.lineStart(),H!==S&&(q=d(v,L),(!q||ja(v,q)||ja(L,q))&&(L[0]+=je,L[1]+=je,H=f(L[0],L[1]))),H!==S)N=0,H?(y.lineStart(),q=d(L,v),y.point(q[0],q[1])):(q=d(v,L),y.point(q[0],q[1]),y.lineEnd()),v=q;else if(u&&v&&s^H){var z;!(J&E)&&(z=d(L,v,!0))&&(N=0,s?(y.lineStart(),y.point(z[0][0],z[0][1]),y.point(z[1][0],z[1][1]),y.lineEnd()):(y.point(z[1][0],z[1][1]),y.lineEnd(),y.lineStart(),y.point(z[0][0],z[0][1])))}H&&(!v||!ja(v,L))&&y.point(L[0],L[1]),v=L,S=H,E=J},lineEnd:function(){S&&y.lineEnd(),v=null},clean:function(){return N|(b&&S)<<1}}}function d(y,v,E){var S=Wi(y),b=Wi(v),N=[1,0,0],O=ao(S,b),D=Ia(O,O),L=O[0],q=D-L*L;if(!q)return!E&&y;var H=r*D/q,J=-r*L/q,z=ao(N,O),$=Ma(N,H),k=Ma(O,J);_u($,k);var w=z,I=Ia($,w),P=Ia(w,w),T=I*I-P*(Ia($,$)-1);if(!(T<0)){var G=ss(T),R=Ma(w,(-I-G)/P);if(_u(R,$),R=ol(R),!E)return R;var C=y[0],B=v[0],U=y[1],Y=v[1],W;B<C&&(W=C,C=B,B=W);var Z=B-C,ne=lt(Z-Ae)<je,oe=ne||Z<je;if(!ne&&Y<U&&(W=U,U=Y,Y=W),oe?ne?U+Y>0^R[1]<(lt(R[0]-C)<je?U:Y):U<=R[1]&&R[1]<=Y:Z>Ae^(C<=R[0]&&R[0]<=B)){var le=Ma(w,(-I+G)/P);return _u(le,$),[R,ol(le)]}}}function p(y,v){var E=s?t:Ae-t,S=0;return y<-E?S|=1:y>E&&(S|=2),v<-E?S|=4:v>E&&(S|=8),S}return yp(f,h,c,s?[0,-t]:[-Ae,t-Ae])}function _p(t){return function(e){var r=new cl;for(var s in t)r[s]=t[s];return r.stream=e,r}}function cl(){}cl.prototype={constructor:cl,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function kp(t,e,r){var s=e[1][0]-e[0][0],u=e[1][1]-e[0][1],c=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),c!=null&&t.clipExtent(null),Ob(r,t.stream(If));var f=If.result(),h=Math.min(s/(f[1][0]-f[0][0]),u/(f[1][1]-f[0][1])),d=+e[0][0]+(s-h*(f[1][0]+f[0][0]))/2,p=+e[0][1]+(u-h*(f[1][1]+f[0][1]))/2;return c!=null&&t.clipExtent(c),t.scale(h*150).translate([d,p])}function $b(t,e,r){return kp(t,[[0,0],e],r)}var Nf=16,Wb=Xe(30*nn);function Lf(t,e){return+e?Kb(t,e):Zb(t)}function Zb(t){return _p({point:function(e,r){e=t(e,r),this.stream.point(e[0],e[1])}})}function Kb(t,e){function r(s,u,c,f,h,d,p,y,v,E,S,b,N,O){var D=p-s,L=y-u,q=D*D+L*L;if(q>4*e&&N--){var H=f+E,J=h+S,z=d+b,$=ss(H*H+J*J+z*z),k=si(z/=$),w=lt(lt(z)-1)<je||lt(c-v)<je?(c+v)/2:$i(J,H),I=t(w,k),P=I[0],T=I[1],G=P-s,R=T-u,C=L*G-D*R;(C*C/q>e||lt((D*G+L*R)/q-.5)>.3||f*E+h*S+d*b<Wb)&&(r(s,u,c,f,h,d,P,T,w,H/=$,J/=$,z,N,O),O.point(P,T),r(P,T,w,H,J,z,p,y,v,E,S,b,N,O))}}return function(s){var u,c,f,h,d,p,y,v,E,S,b,N,O={point:D,lineStart:L,lineEnd:H,polygonStart:function(){s.polygonStart(),O.lineStart=J},polygonEnd:function(){s.polygonEnd(),O.lineStart=L}};function D(k,w){k=t(k,w),s.point(k[0],k[1])}function L(){v=NaN,O.point=q,s.lineStart()}function q(k,w){var I=Wi([k,w]),P=t(k,w);r(v,E,y,S,b,N,v=P[0],E=P[1],y=k,S=I[0],b=I[1],N=I[2],Nf,s),s.point(v,E)}function H(){O.point=D,s.lineEnd()}function J(){L(),O.point=z,O.lineEnd=$}function z(k,w){q(u=k,w),c=v,f=E,h=S,d=b,p=N,O.point=q}function $(){r(v,E,y,S,b,N,c,f,u,h,d,p,Nf,s),O.lineEnd=H,H()}return O}}var Qb=_p({point:function(t,e){this.stream.point(t*nn,e*nn)}});function eS(t){return tS(function(){return t})()}function tS(t){var e,r=150,s=480,u=250,c,f,h=0,d=0,p=0,y=0,v=0,E,S,b=null,N=Mf,O=null,D,L,q,H=Sf,J=.5,z=Lf(P,J),$,k;function w(R){return R=S(R[0]*nn,R[1]*nn),[R[0]*r+c,f-R[1]*r]}function I(R){return R=S.invert((R[0]-c)/r,(f-R[1])/r),R&&[R[0]*wr,R[1]*wr]}function P(R,C){return R=e(R,C),[R[0]*r+c,f-R[1]*r]}w.stream=function(R){return $&&k===R?$:$=Qb(N(E,z(H(k=R))))},w.clipAngle=function(R){return arguments.length?(N=+R?Xb(b=R*nn,6*nn):(b=null,Mf),G()):b*wr},w.clipExtent=function(R){return arguments.length?(H=R==null?(O=D=L=q=null,Sf):Ub(O=+R[0][0],D=+R[0][1],L=+R[1][0],q=+R[1][1]),G()):O==null?null:[[O,D],[L,q]]},w.scale=function(R){return arguments.length?(r=+R,T()):r},w.translate=function(R){return arguments.length?(s=+R[0],u=+R[1],T()):[s,u]},w.center=function(R){return arguments.length?(h=R[0]%360*nn,d=R[1]%360*nn,T()):[h*wr,d*wr]},w.rotate=function(R){return arguments.length?(p=R[0]%360*nn,y=R[1]%360*nn,v=R.length>2?R[2]%360*nn:0,T()):[p*wr,y*wr,v*wr]},w.precision=function(R){return arguments.length?(z=Lf(P,J=R*R),G()):ss(J)},w.fitExtent=function(R,C){return kp(w,R,C)},w.fitSize=function(R,C){return $b(w,R,C)};function T(){S=gp(E=Rb(p,y,v),e);var R=e(h,d);return c=s-R[0]*r,f=u+R[1]*r,G()}function G(){return $=k=null,w}return function(){return e=t.apply(this,arguments),w.invert=e.invert&&I,T()}}function Ep(t){return function(e,r){var s=Xe(e),u=Xe(r),c=t(s*u);return[c*u*$e(e),c*$e(r)]}}function xp(t){return function(e,r){var s=ss(e*e+r*r),u=t(s),c=$e(u),f=Xe(u);return[$i(e*c,s*f),si(s&&r*c/s)]}}var nS=Ep(function(t){return ss(2/(1+t))});nS.invert=xp(function(t){return 2*si(t/2)});var wp=Ep(function(t){return(t=fp(t))&&t/$e(t)});wp.invert=xp(function(t){return t});function rS(){return eS(wp).scale(79.4188).clipAngle(180-.001)}function Cf(t,e){return[t,e]}Cf.invert=Cf;var{BufferOp:iS,GeoJSONReader:sS,GeoJSONWriter:aS}=Tb;function oS(t,e,r){r=r||{};var s=r.units||"kilometers",u=r.steps||8;if(!t)throw new Error("geojson is required");if(typeof r!="object")throw new Error("options must be an object");if(typeof u!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(u<=0)throw new Error("steps must be greater than 0");var c=[];switch(t.type){case"GeometryCollection":return ci(t,function(f){var h=qa(f,e,s,u);h&&c.push(h)}),Qe(c);case"FeatureCollection":return $n(t,function(f){var h=qa(f,e,s,u);h&&$n(h,function(d){d&&c.push(d)})}),Qe(c)}return qa(t,e,s,u)}function qa(t,e,r,s){var u=t.properties||{},c=t.type==="Feature"?t.geometry:t;if(c.type==="GeometryCollection"){var f=[];return ci(t,function(N){var O=qa(N,e,r,s);O&&f.push(O)}),Qe(f)}var h=uS(c),d={type:c.type,coordinates:Sp(c.coordinates,h)},p=new sS,y=p.read(d),v=$l(Wl(e,r),"meters"),E=iS.bufferOp(y,v,s),S=new aS;if(E=S.write(E),!bp(E.coordinates)){var b={type:E.type,coordinates:Ip(E.coordinates,h)};return ln(b,u)}}function bp(t){return Array.isArray(t[0])?bp(t[0]):isNaN(t[0])}function Sp(t,e){return typeof t[0]!="object"?e(t):t.map(function(r){return Sp(r,e)})}function Ip(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(r){return Ip(r,e)})}function uS(t){var e=Nb(t).geometry.coordinates,r=[-e[0],-e[1]];return rS().rotate(r).scale(ot)}var lS=oS;class Mp{constructor(e=[],r=cS){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:s}=this,u=r[e];for(;e>0;){const c=e-1>>1,f=r[c];if(s(u,f)>=0)break;r[e]=f,e=c}r[e]=u}_down(e){const{data:r,compare:s}=this,u=this.length>>1,c=r[e];for(;e<u;){let f=(e<<1)+1,h=r[f];const d=f+1;if(d<this.length&&s(r[d],h)<0&&(f=d,h=r[d]),s(h,c)>=0)break;r[e]=h,e=f}r[e]=c}}function cS(t,e){return t<e?-1:t>e?1:0}function Np(t,e){return t.p.x>e.p.x?1:t.p.x<e.p.x?-1:t.p.y!==e.p.y?t.p.y>e.p.y?1:-1:1}function hS(t,e){return t.rightSweepEvent.p.x>e.rightSweepEvent.p.x?1:t.rightSweepEvent.p.x<e.rightSweepEvent.p.x?-1:t.rightSweepEvent.p.y!==e.rightSweepEvent.p.y?t.rightSweepEvent.p.y<e.rightSweepEvent.p.y?1:-1:1}class Af{constructor(e,r,s,u){this.p={x:e[0],y:e[1]},this.featureId=r,this.ringId=s,this.eventId=u,this.otherEvent=null,this.isLeftEndpoint=null}isSamePoint(e){return this.p.x===e.p.x&&this.p.y===e.p.y}}function fS(t,e){if(t.type==="FeatureCollection"){const r=t.features;for(let s=0;s<r.length;s++)Tf(r[s],e)}else Tf(t,e)}let Ca=0,Aa=0,Ta=0;function Tf(t,e){const r=t.type==="Feature"?t.geometry:t;let s=r.coordinates;(r.type==="Polygon"||r.type==="MultiLineString")&&(s=[s]),r.type==="LineString"&&(s=[[s]]);for(let u=0;u<s.length;u++)for(let c=0;c<s[u].length;c++){let f=s[u][c][0],h=null;Aa=Aa+1;for(let d=0;d<s[u][c].length-1;d++){h=s[u][c][d+1];const p=new Af(f,Ca,Aa,Ta),y=new Af(h,Ca,Aa,Ta+1);p.otherEvent=y,y.otherEvent=p,Np(p,y)>0?(y.isLeftEndpoint=!0,p.isLeftEndpoint=!1):(p.isLeftEndpoint=!0,y.isLeftEndpoint=!1),e.push(p),e.push(y),f=h,Ta=Ta+1}}Ca=Ca+1}let gS=class{constructor(t){this.leftSweepEvent=t,this.rightSweepEvent=t.otherEvent}};function dS(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;const r=t.leftSweepEvent.p.x,s=t.leftSweepEvent.p.y,u=t.rightSweepEvent.p.x,c=t.rightSweepEvent.p.y,f=e.leftSweepEvent.p.x,h=e.leftSweepEvent.p.y,d=e.rightSweepEvent.p.x,p=e.rightSweepEvent.p.y,y=(p-h)*(u-r)-(d-f)*(c-s),v=(d-f)*(s-h)-(p-h)*(r-f),E=(u-r)*(s-h)-(c-s)*(r-f);if(y===0)return!1;const S=v/y,b=E/y;if(S>=0&&S<=1&&b>=0&&b<=1){const N=r+S*(u-r),O=s+S*(c-s);return[N,O]}return!1}function pS(t,e){e=e||!1;const r=[],s=new Mp([],hS);for(;t.length;){const u=t.pop();if(u.isLeftEndpoint){const c=new gS(u);for(let f=0;f<s.data.length;f++){const h=s.data[f];if(e&&h.leftSweepEvent.featureId===u.featureId)continue;const d=dS(c,h);d!==!1&&r.push(d)}s.push(c)}else u.isLeftEndpoint===!1&&s.pop()}return r}function mS(t,e){const r=new Mp([],Np);return fS(t,r),pS(r,e)}var vS=mS;function oa(t,e,r={}){const{removeDuplicates:s=!0,ignoreSelfIntersections:u=!0}=r;let c=[];t.type==="FeatureCollection"?c=c.concat(t.features):t.type==="Feature"?c.push(t):(t.type==="LineString"||t.type==="Polygon"||t.type==="MultiLineString"||t.type==="MultiPolygon")&&c.push(ln(t)),e.type==="FeatureCollection"?c=c.concat(e.features):e.type==="Feature"?c.push(e):(e.type==="LineString"||e.type==="Polygon"||e.type==="MultiLineString"||e.type==="MultiPolygon")&&c.push(ln(e));const f=vS(Qe(c),u);let h=[];if(s){const d={};f.forEach(p=>{const y=p.join(",");d[y]||(d[y]=!0,h.push(p))})}else h=f;return Qe(h.map(d=>Sn(d)))}var yS=oa;function hl(t){const e=zt(t);let r=0,s=1,u,c;for(;s<e.length;)u=c||e[0],c=e[s],r+=(c[0]-u[0])*(c[1]+u[1]),s++;return r>0}function _S(t,e={}){var r,s;if(e=e||{},!No(e))throw new Error("options is invalid");const u=(r=e.mutate)!=null?r:!1,c=(s=e.reverse)!=null?s:!1;if(!t)throw new Error("<geojson> is required");if(typeof c!="boolean")throw new Error("<reverse> must be a boolean");if(typeof u!="boolean")throw new Error("<mutate> must be a boolean");!u&&t.type!=="Point"&&t.type!=="MultiPoint"&&(t=Lo(t));const f=[];switch(t.type){case"GeometryCollection":return ci(t,function(h){Ya(h,c)}),t;case"FeatureCollection":return $n(t,function(h){const d=Ya(h,c);$n(d,function(p){f.push(p)})}),Qe(f)}return Ya(t,c)}function Ya(t,e){switch(t.type==="Feature"?t.geometry.type:t.type){case"GeometryCollection":return ci(t,function(r){Ya(r,e)}),t;case"LineString":return Pf(zt(t),e),t;case"Polygon":return Of(zt(t),e),t;case"MultiLineString":return zt(t).forEach(function(r){Pf(r,e)}),t;case"MultiPolygon":return zt(t).forEach(function(r){Of(r,e)}),t;case"Point":case"MultiPoint":return t}}function Pf(t,e){hl(t)===e&&t.reverse()}function Of(t,e){hl(t[0])!==e&&t[0].reverse();for(let r=1;r<t.length;r++)hl(t[r])===e&&t[r].reverse()}var kS=_S;const ES=["Point","MultiPoint"],xS=["LineString","MultiLineString","Polygon","MultiPolygon"],Lp=t=>ES.includes(t.geometry.type),fl=t=>xS.includes(t.geometry.type),Cp=(t,e)=>(rs(t,r=>{const s=r.coordinate;s[0]+=e.lng,s[1]+=e.lat}),t),wS=(t,e)=>{const r=t.getBounds(),s=Zd(r[0],r[1],{units:"meters"});return lS(e,s*1e-4,{units:"meters"})||null},bS=(t,e)=>{const r=Ht(t.getGeoJson());return Cp(r,e),r},SS=(t,e)=>{try{rs(t,r=>{if(!ii(r.coordinate,e))throw new Error("stop")})}catch{return!1}return!0},Ps=(t,e)=>{const r=SS(t,e);return Lp(t)?r:r&&fl(t)?!yS(t,e,{ignoreSelfIntersections:!0}).features.length:!1},lc=t=>{const e=t.getGeoJson();return typeof e!="object"?null:rc(e)},IS=t=>{if(fl(t)){const e=kS(t,{mutate:!1});if(e.type==="Feature"&&fl(e))return{...e,properties:t.properties||{}}}return Lp(t)?t:null},MS=(t,e)=>{const r=t.properties?.[e];return typeof r=="string"||typeof r=="number"?r:null};class Do extends is{mode="drag";previousLngLat=null;pointBasedShapes=["marker","circle_marker","text_marker"];throttledMethods=Fr({onMouseMove:this.onMouseMove},this,this.gm.options.settings.throttlingDelay);eventHandlers={[`${ae}:edit`]:this.handleGmEdit.bind(this),mousedown:this.onMouseDown.bind(this),touchstart:this.onMouseDown.bind(this),mousemove:this.throttledMethods.onMouseMove.bind(this),touchmove:this.throttledMethods.onMouseMove.bind(this),mouseup:this.onMouseUp.bind(this),touchend:this.onMouseUp.bind(this)};getUpdatedGeoJsonHandlers={marker:this.moveSource.bind(this),ellipse:this.moveEllipse.bind(this),circle:this.moveCircle.bind(this),circle_marker:this.moveSource.bind(this),text_marker:this.moveSource.bind(this),line:this.moveSource.bind(this),rectangle:this.moveSource.bind(this),polygon:this.moveSource.bind(this)};onMouseDown(e){if(!We(e))return{next:!0};const r=this.getFeatureByMouseEvent({event:e,sourceNames:[Q.main]});return r&&this.getUpdatedGeoJsonHandlers[r.shape]?(this.featureData=r,this.featureData.changeSource({sourceName:Q.temporary,atomic:!0}),this.gm.mapAdapter.setDragPan(!1),this.snappingHelper?.addExcludedFeature(this.featureData),this.fireFeatureEditStartEvent({feature:this.featureData,forceMode:"drag"}),this.flags.actionInProgress=!0,this.isPointBasedShape()&&this.alignShapeCenterWithControlMarker(this.featureData,e),{next:!1}):{next:!0}}onMouseUp(e){return!this.featureData||!We(e,{warning:!0})?{next:!0}:(this.snappingHelper?.clearExcludedFeatures(),this.featureData.changeSource({sourceName:Q.main,atomic:!0}),this.previousLngLat=null,this.gm.mapAdapter.setDragPan(!0),this.fireFeatureEditEndEvent({feature:this.featureData,forceMode:"drag"}),this.flags.actionInProgress=!1,this.featureData=null,{next:!0})}onMouseMove(e){if(!this.flags.actionInProgress||!We(e,{warning:!0}))return{next:!0};if(this.featureData){const r=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();this.moveFeature(this.featureData,r)}return{next:!1}}isPointBasedShape(){return!!this.featureData&&this.pointBasedShapes.includes(this.featureData.shape)}alignShapeCenterWithControlMarker(e,r){const s=lc(e);s&&(this.gm.markerPointer.marker?.setLngLat(s),this.onMouseMove(r))}moveFeature(e,r){if(!this.flags.actionInProgress)return;if(!this.previousLngLat){this.previousLngLat=r;return}const s=this.getUpdatedGeoJsonHandlers[e.shape];if(s){const u=s(e,this.previousLngLat,r);if(!u){te.error("BaseDrag.moveFeature: invalid updatedGeoJson",e);return}this.fireBeforeFeatureUpdate({features:[e],geoJsonFeatures:[u],forceMode:"drag"});const c=this.updateFeatureGeoJson({featureData:e,featureGeoJson:u,forceMode:"drag"});Qi(e.getGeoJson().properties,u.properties)||e._updateAllProperties(u.properties),c&&(this.previousLngLat=r)}}moveSource(e,r,s){const u=Ga(r,s);return bS(e,u)}moveEllipse(e,r,s){if(e.shape!=="ellipse")return te.error("BaseDrag.moveCircle: invalid shape type",e),null;const u=e.getShapeProperty("center"),c=e.getShapeProperty("xSemiAxis"),f=e.getShapeProperty("ySemiAxis"),h=e.getShapeProperty("angle");if(!Array.isArray(u)||typeof c!="number"||typeof f!="number"||typeof h!="number")return te.error("BaseDrag.moveEllipse: missing center, xSemiAxis, ySemiAxis or angle in the featureData",e),null;const d=Ga(r,s),p=[u[0]+d.lng,u[1]+d.lat];return Ao({center:p,xSemiAxis:c,ySemiAxis:f,angle:h})}moveCircle(e,r,s){if(e.shape!=="circle")return te.error("BaseDrag.moveCircle: invalid shape type",e),null;const u=e.getShapeProperty("center");if(!Array.isArray(u))return te.error("BaseDrag.moveCircle: missing center in the featureData",e),null;const c=e.getGeoJson(),f=Ga(r,s),h=rc(c);if(!h)return te.error("BaseDrag.moveCircle: missing center circleRimLngLat"),null;const d=[u[0]+f.lng,u[1]+f.lat];e.setShapeProperty("center",d);const p=ic({center:d,radius:this.gm.mapAdapter.getDistance(u,h)});return{type:"Feature",properties:{shape:"circle"},geometry:p.geometry}}}const Ap=(t,e)=>(t%e+e)%e;class NS extends Do{mode="change";cutVertexShapeTypes=["line","polygon","rectangle"];markerData=null;shapeUpdateHandlers={marker:this.updateSingleVertex.bind(this),circle:this.updateCircle.bind(this),circle_marker:this.updateSingleVertex.bind(this),ellipse:this.updateEllipse.bind(this),text_marker:this.updateSingleVertex.bind(this),line:this.updateSingleVertex.bind(this),rectangle:this.updateRectangle.bind(this),polygon:this.updateSingleVertex.bind(this)};get snapGuidesInstance(){const e=this.gm.actionInstances.helper__snap_guides;return ap(e)?e:null}onStartAction(){}onEndAction(){this.snapGuidesInstance?.removeSnapGuides()}handleGmEdit(e){if(!hi(e))return{next:!0};if(e.action==="marker_move"&&e.lngLatStart&&e.markerData){if(e.markerData.type==="vertex")return this.moveVertex(e),{next:!1};if(e.lngLatEnd)return this.moveSource(e.featureData,e.lngLatStart,e.lngLatEnd),{next:!1}}return e.action==="marker_right_click"?(this.cutVertex(e),this.fireFeatureEditEndEvent({feature:e.featureData})):e.action==="edge_marker_click"?this.insertVertex(e):e.action==="marker_captured"?(this.setCursorToPointer(),e.featureData.changeSource({sourceName:Q.temporary,atomic:!0}),this.flags.actionInProgress=!0,this.fireFeatureEditStartEvent({feature:e.featureData})):e.action==="marker_released"&&(this.markerData=null,this.snapGuidesInstance?.removeSnapGuides(),e.featureData.changeSource({sourceName:Q.main,atomic:!0}),this.fireFeatureEditEndEvent({feature:e.featureData}),this.flags.actionInProgress=!1),{next:!0}}moveVertex(e){this.markerData||(this.markerData=e.markerData||null,this.snapGuidesInstance?.updateSnapGuides(e.featureData.getGeoJson(),e.lngLatStart));const r=e.featureData,s=r.shape,u=this.shapeUpdateHandlers[s]?.(e)||null;u?(this.fireBeforeFeatureUpdate({features:[r],geoJsonFeatures:[u]}),this.updateFeatureGeoJson({featureData:r,featureGeoJson:u})):te.error("EditChange.moveVertex: invalid geojson",u,e)}cutVertex(e){const r=e.featureData;if(e.markerData.type!=="vertex"||!this.cutVertexShapeTypes.includes(r.shape))return;let s=!1;const u=r.getGeoJson(),c=e.markerData.instance;if(Qd(u)){if(Ba(u)<=2){this.gm.features.delete(r);return}}else if(Ql(u)){if(Ba(u)<=3){this.gm.features.delete(r);return}}else if(Kl(u)&&Ba(u)<=3){this.gm.features.delete(r);return}const f=lc(c);f&&(s=Aw(u,f)),s?(r.convertToPolygon(),r.updateGeoJsonGeometry(u.geometry),this.fireFeatureUpdatedEvent({sourceFeatures:[r],targetFeatures:[r],markerData:e.markerData})):te.error("EditChange.cutVertex: feature not updated",e)}insertVertex(e){if(e.markerData.type!=="edge")return;const r=e.featureData.getGeoJson(),s=e.markerData.segment.end.path,u=s.pop(),c=Yi(r,s);typeof u=="number"&&(c.splice(u,0,[...e.markerData.position.coordinate]),e.featureData.updateGeoJsonGeometry(r.geometry),e.featureData.convertToPolygon(),this.fireFeatureUpdatedEvent({sourceFeatures:[e.featureData],targetFeatures:[e.featureData],markerData:e.markerData}))}updateSingleVertex({featureData:e,lngLatEnd:r,markerData:s}){const u=Ht(e.getGeoJson()),c=Ht(s.position.path),f=c.pop(),h=Yi(u,c);return Array.isArray(h)&&typeof f=="number"?(h[f]=[...r],f===0&&e.shape==="polygon"&&(h[h.length-1]=[...r])):te.error("BaseDrag.moveSingleVertex: invalid coordinates",u,c),u}updateCircle({featureData:e,lngLatEnd:r}){const s=e.getShapeProperty("center");if(e.shape!=="circle"||!s)return te.error("BaseDrag.moveCircle: invalid shape type / missing center",e),null;const u=ic({center:s,radius:this.gm.mapAdapter.getDistance(s,r)});return{type:"Feature",properties:{shape:"circle"},geometry:u.geometry}}updateEllipse(e){const{featureData:r,lngLatEnd:s,markerData:u}=e;if(r.shape!=="ellipse")return te.error("EditChange.updateEllipse: invalid shape type",r),null;const c=r.getShapeProperty("center");let f=r.getShapeProperty("xSemiAxis"),h=r.getShapeProperty("ySemiAxis");const d=r.getShapeProperty("angle");if(!Array.isArray(c)||typeof f!="number"||typeof h!="number"||typeof d!="number")return te.error("updateEllipse: missing center, xSemiAxis, ySemiAxis or angle in the featureData",r),null;const p=this.gm.mapAdapter.getDistance(c,s),y=u.position.path[3],v=Math.floor(y/rp*4);return(v===0||v===2?"x":"y")=="x"?f=p:h=p,Ao({center:c,xSemiAxis:f,ySemiAxis:h,angle:d})}updateRectangle({featureData:e,lngLatStart:r,lngLatEnd:s}){const u=e.getGeoJson(),c=u.geometry.coordinates[0],{absCoordIndex:f}=Co(u,r);if(f===-1)return te.error("EditChange.updateRectangle: start vertex not found",e),null;const h=Ap(f-2,4),d=c[h];return il(s,d)}}function LS(t,e,{ignoreSelfIntersections:r=!0}={ignoreSelfIntersections:!0}){let s=!0;return Rr(t,u=>{Rr(e,c=>{if(s===!1)return!1;s=CS(u.geometry,c.geometry,r)})}),s}function CS(t,e,r){switch(t.type){case"Point":switch(e.type){case"Point":return!OS(t.coordinates,e.coordinates);case"LineString":return!Rf(e,t);case"Polygon":return!ii(t,e)}break;case"LineString":switch(e.type){case"Point":return!Rf(t,e);case"LineString":return!AS(t,e,r);case"Polygon":return!Df(e,t,r)}break;case"Polygon":switch(e.type){case"Point":return!ii(e,t);case"LineString":return!Df(t,e,r);case"Polygon":return!TS(e,t,r)}}return!1}function Rf(t,e){for(let r=0;r<t.coordinates.length-1;r++)if(PS(t.coordinates[r],t.coordinates[r+1],e.coordinates))return!0;return!1}function AS(t,e,r){return oa(t,e,{ignoreSelfIntersections:r}).features.length>0}function Df(t,e,r){for(const s of e.coordinates)if(ii(s,t))return!0;return oa(e,nl(t),{ignoreSelfIntersections:r}).features.length>0}function TS(t,e,r){for(const s of t.coordinates[0])if(ii(s,e))return!0;for(const s of e.coordinates[0])if(ii(s,t))return!0;return oa(nl(t),nl(e),{ignoreSelfIntersections:r}).features.length>0}function PS(t,e,r){const s=r[0]-t[0],u=r[1]-t[1],c=e[0]-t[0],f=e[1]-t[1];return s*f-u*c!==0?!1:Math.abs(c)>=Math.abs(f)?c>0?t[0]<=r[0]&&r[0]<=e[0]:e[0]<=r[0]&&r[0]<=t[0]:f>0?t[1]<=r[1]&&r[1]<=e[1]:e[1]<=r[1]&&r[1]<=t[1]}function OS(t,e){return t[0]===e[0]&&t[1]===e[1]}function RS(t,e,{ignoreSelfIntersections:r=!0}={}){let s=!1;return Rr(t,u=>{Rr(e,c=>{if(s===!0)return!0;s=!LS(u.geometry,c.geometry,{ignoreSelfIntersections:r})})}),s}var DS=RS,FS=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Eu=Math.ceil,Qt=Math.floor,Dt="[BigNumber Error] ",Ff=Dt+"Number primitive has more than 15 significant digits: ",dn=1e14,Ee=14,xu=9007199254740991,wu=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],br=1e7,at=1e9;function Tp(t){var e,r,s,u=L.prototype={constructor:L,toString:null,valueOf:null},c=new L(1),f=20,h=4,d=-7,p=21,y=-1e7,v=1e7,E=!1,S=1,b=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},O="0123456789abcdefghijklmnopqrstuvwxyz",D=!0;function L(k,w){var I,P,T,G,R,C,B,U,Y=this;if(!(Y instanceof L))return new L(k,w);if(w==null){if(k&&k._isBigNumber===!0){Y.s=k.s,!k.c||k.e>v?Y.c=Y.e=null:k.e<y?Y.c=[Y.e=0]:(Y.e=k.e,Y.c=k.c.slice());return}if((C=typeof k=="number")&&k*0==0){if(Y.s=1/k<0?(k=-k,-1):1,k===~~k){for(G=0,R=k;R>=10;R/=10,G++);G>v?Y.c=Y.e=null:(Y.e=G,Y.c=[k]);return}U=String(k)}else{if(!FS.test(U=String(k)))return s(Y,U,C);Y.s=U.charCodeAt(0)==45?(U=U.slice(1),-1):1}(G=U.indexOf("."))>-1&&(U=U.replace(".","")),(R=U.search(/e/i))>0?(G<0&&(G=R),G+=+U.slice(R+1),U=U.substring(0,R)):G<0&&(G=U.length)}else{if(He(w,2,O.length,"Base"),w==10&&D)return Y=new L(k),z(Y,f+Y.e+1,h);if(U=String(k),C=typeof k=="number"){if(k*0!=0)return s(Y,U,C,w);if(Y.s=1/k<0?(U=U.slice(1),-1):1,L.DEBUG&&U.replace(/^0\.0*|\./,"").length>15)throw Error(Ff+k)}else Y.s=U.charCodeAt(0)===45?(U=U.slice(1),-1):1;for(I=O.slice(0,w),G=R=0,B=U.length;R<B;R++)if(I.indexOf(P=U.charAt(R))<0){if(P=="."){if(R>G){G=B;continue}}else if(!T&&(U==U.toUpperCase()&&(U=U.toLowerCase())||U==U.toLowerCase()&&(U=U.toUpperCase()))){T=!0,R=-1,G=0;continue}return s(Y,String(k),C,w)}C=!1,U=r(U,w,10,Y.s),(G=U.indexOf("."))>-1?U=U.replace(".",""):G=U.length}for(R=0;U.charCodeAt(R)===48;R++);for(B=U.length;U.charCodeAt(--B)===48;);if(U=U.slice(R,++B)){if(B-=R,C&&L.DEBUG&&B>15&&(k>xu||k!==Qt(k)))throw Error(Ff+Y.s*k);if((G=G-R-1)>v)Y.c=Y.e=null;else if(G<y)Y.c=[Y.e=0];else{if(Y.e=G,Y.c=[],R=(G+1)%Ee,G<0&&(R+=Ee),R<B){for(R&&Y.c.push(+U.slice(0,R)),B-=Ee;R<B;)Y.c.push(+U.slice(R,R+=Ee));R=Ee-(U=U.slice(R)).length}else R-=B;for(;R--;U+="0");Y.c.push(+U)}}else Y.c=[Y.e=0]}L.clone=Tp,L.ROUND_UP=0,L.ROUND_DOWN=1,L.ROUND_CEIL=2,L.ROUND_FLOOR=3,L.ROUND_HALF_UP=4,L.ROUND_HALF_DOWN=5,L.ROUND_HALF_EVEN=6,L.ROUND_HALF_CEIL=7,L.ROUND_HALF_FLOOR=8,L.EUCLID=9,L.config=L.set=function(k){var w,I;if(k!=null)if(typeof k=="object"){if(k.hasOwnProperty(w="DECIMAL_PLACES")&&(I=k[w],He(I,0,at,w),f=I),k.hasOwnProperty(w="ROUNDING_MODE")&&(I=k[w],He(I,0,8,w),h=I),k.hasOwnProperty(w="EXPONENTIAL_AT")&&(I=k[w],I&&I.pop?(He(I[0],-at,0,w),He(I[1],0,at,w),d=I[0],p=I[1]):(He(I,-at,at,w),d=-(p=I<0?-I:I))),k.hasOwnProperty(w="RANGE"))if(I=k[w],I&&I.pop)He(I[0],-at,-1,w),He(I[1],1,at,w),y=I[0],v=I[1];else if(He(I,-at,at,w),I)y=-(v=I<0?-I:I);else throw Error(Dt+w+" cannot be zero: "+I);if(k.hasOwnProperty(w="CRYPTO"))if(I=k[w],I===!!I)if(I)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))E=I;else throw E=!I,Error(Dt+"crypto unavailable");else E=I;else throw Error(Dt+w+" not true or false: "+I);if(k.hasOwnProperty(w="MODULO_MODE")&&(I=k[w],He(I,0,9,w),S=I),k.hasOwnProperty(w="POW_PRECISION")&&(I=k[w],He(I,0,at,w),b=I),k.hasOwnProperty(w="FORMAT"))if(I=k[w],typeof I=="object")N=I;else throw Error(Dt+w+" not an object: "+I);if(k.hasOwnProperty(w="ALPHABET"))if(I=k[w],typeof I=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(I))D=I.slice(0,10)=="0123456789",O=I;else throw Error(Dt+w+" invalid: "+I)}else throw Error(Dt+"Object expected: "+k);return{DECIMAL_PLACES:f,ROUNDING_MODE:h,EXPONENTIAL_AT:[d,p],RANGE:[y,v],CRYPTO:E,MODULO_MODE:S,POW_PRECISION:b,FORMAT:N,ALPHABET:O}},L.isBigNumber=function(k){if(!k||k._isBigNumber!==!0)return!1;if(!L.DEBUG)return!0;var w,I,P=k.c,T=k.e,G=k.s;e:if({}.toString.call(P)=="[object Array]"){if((G===1||G===-1)&&T>=-at&&T<=at&&T===Qt(T)){if(P[0]===0){if(T===0&&P.length===1)return!0;break e}if(w=(T+1)%Ee,w<1&&(w+=Ee),String(P[0]).length==w){for(w=0;w<P.length;w++)if(I=P[w],I<0||I>=dn||I!==Qt(I))break e;if(I!==0)return!0}}}else if(P===null&&T===null&&(G===null||G===1||G===-1))return!0;throw Error(Dt+"Invalid BigNumber: "+k)},L.maximum=L.max=function(){return H(arguments,-1)},L.minimum=L.min=function(){return H(arguments,1)},L.random=(function(){var k=9007199254740992,w=Math.random()*k&2097151?function(){return Qt(Math.random()*k)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(I){var P,T,G,R,C,B=0,U=[],Y=new L(c);if(I==null?I=f:He(I,0,at),R=Eu(I/Ee),E)if(crypto.getRandomValues){for(P=crypto.getRandomValues(new Uint32Array(R*=2));B<R;)C=P[B]*131072+(P[B+1]>>>11),C>=9e15?(T=crypto.getRandomValues(new Uint32Array(2)),P[B]=T[0],P[B+1]=T[1]):(U.push(C%1e14),B+=2);B=R/2}else if(crypto.randomBytes){for(P=crypto.randomBytes(R*=7);B<R;)C=(P[B]&31)*281474976710656+P[B+1]*1099511627776+P[B+2]*4294967296+P[B+3]*16777216+(P[B+4]<<16)+(P[B+5]<<8)+P[B+6],C>=9e15?crypto.randomBytes(7).copy(P,B):(U.push(C%1e14),B+=7);B=R/7}else throw E=!1,Error(Dt+"crypto unavailable");if(!E)for(;B<R;)C=w(),C<9e15&&(U[B++]=C%1e14);for(R=U[--B],I%=Ee,R&&I&&(C=wu[Ee-I],U[B]=Qt(R/C)*C);U[B]===0;U.pop(),B--);if(B<0)U=[G=0];else{for(G=-1;U[0]===0;U.splice(0,1),G-=Ee);for(B=1,C=U[0];C>=10;C/=10,B++);B<Ee&&(G-=Ee-B)}return Y.e=G,Y.c=U,Y}})(),L.sum=function(){for(var k=1,w=arguments,I=new L(w[0]);k<w.length;)I=I.plus(w[k++]);return I},r=(function(){var k="0123456789";function w(I,P,T,G){for(var R,C=[0],B,U=0,Y=I.length;U<Y;){for(B=C.length;B--;C[B]*=P);for(C[0]+=G.indexOf(I.charAt(U++)),R=0;R<C.length;R++)C[R]>T-1&&(C[R+1]==null&&(C[R+1]=0),C[R+1]+=C[R]/T|0,C[R]%=T)}return C.reverse()}return function(I,P,T,G,R){var C,B,U,Y,W,Z,ne,oe,le=I.indexOf("."),ie=f,ue=h;for(le>=0&&(Y=b,b=0,I=I.replace(".",""),oe=new L(P),Z=oe.pow(I.length-le),b=Y,oe.c=w(nr(Kt(Z.c),Z.e,"0"),10,T,k),oe.e=oe.c.length),ne=w(I,P,T,R?(C=O,k):(C=k,O)),U=Y=ne.length;ne[--Y]==0;ne.pop());if(!ne[0])return C.charAt(0);if(le<0?--U:(Z.c=ne,Z.e=U,Z.s=G,Z=e(Z,oe,ie,ue,T),ne=Z.c,W=Z.r,U=Z.e),B=U+ie+1,le=ne[B],Y=T/2,W=W||B<0||ne[B+1]!=null,W=ue<4?(le!=null||W)&&(ue==0||ue==(Z.s<0?3:2)):le>Y||le==Y&&(ue==4||W||ue==6&&ne[B-1]&1||ue==(Z.s<0?8:7)),B<1||!ne[0])I=W?nr(C.charAt(1),-ie,C.charAt(0)):C.charAt(0);else{if(ne.length=B,W)for(--T;++ne[--B]>T;)ne[B]=0,B||(++U,ne=[1].concat(ne));for(Y=ne.length;!ne[--Y];);for(le=0,I="";le<=Y;I+=C.charAt(ne[le++]));I=nr(I,U,C.charAt(0))}return I}})(),e=(function(){function k(P,T,G){var R,C,B,U,Y=0,W=P.length,Z=T%br,ne=T/br|0;for(P=P.slice();W--;)B=P[W]%br,U=P[W]/br|0,R=ne*B+U*Z,C=Z*B+R%br*br+Y,Y=(C/G|0)+(R/br|0)+ne*U,P[W]=C%G;return Y&&(P=[Y].concat(P)),P}function w(P,T,G,R){var C,B;if(G!=R)B=G>R?1:-1;else for(C=B=0;C<G;C++)if(P[C]!=T[C]){B=P[C]>T[C]?1:-1;break}return B}function I(P,T,G,R){for(var C=0;G--;)P[G]-=C,C=P[G]<T[G]?1:0,P[G]=C*R+P[G]-T[G];for(;!P[0]&&P.length>1;P.splice(0,1));}return function(P,T,G,R,C){var B,U,Y,W,Z,ne,oe,le,ie,ue,ke,Le,V,Cn,Se,fe,A,Ce=P.s==T.s?1:-1,qe=P.c,xe=T.c;if(!qe||!qe[0]||!xe||!xe[0])return new L(!P.s||!T.s||(qe?xe&&qe[0]==xe[0]:!xe)?NaN:qe&&qe[0]==0||!xe?Ce*0:Ce/0);for(le=new L(Ce),ie=le.c=[],U=P.e-T.e,Ce=G+U+1,C||(C=dn,U=en(P.e/Ee)-en(T.e/Ee),Ce=Ce/Ee|0),Y=0;xe[Y]==(qe[Y]||0);Y++);if(xe[Y]>(qe[Y]||0)&&U--,Ce<0)ie.push(1),W=!0;else{for(Cn=qe.length,fe=xe.length,Y=0,Ce+=2,Z=Qt(C/(xe[0]+1)),Z>1&&(xe=k(xe,Z,C),qe=k(qe,Z,C),fe=xe.length,Cn=qe.length),V=fe,ue=qe.slice(0,fe),ke=ue.length;ke<fe;ue[ke++]=0);A=xe.slice(),A=[0].concat(A),Se=xe[0],xe[1]>=C/2&&Se++;do{if(Z=0,B=w(xe,ue,fe,ke),B<0){if(Le=ue[0],fe!=ke&&(Le=Le*C+(ue[1]||0)),Z=Qt(Le/Se),Z>1)for(Z>=C&&(Z=C-1),ne=k(xe,Z,C),oe=ne.length,ke=ue.length;w(ne,ue,oe,ke)==1;)Z--,I(ne,fe<oe?A:xe,oe,C),oe=ne.length,B=1;else Z==0&&(B=Z=1),ne=xe.slice(),oe=ne.length;if(oe<ke&&(ne=[0].concat(ne)),I(ue,ne,ke,C),ke=ue.length,B==-1)for(;w(xe,ue,fe,ke)<1;)Z++,I(ue,fe<ke?A:xe,ke,C),ke=ue.length}else B===0&&(Z++,ue=[0]);ie[Y++]=Z,ue[0]?ue[ke++]=qe[V]||0:(ue=[qe[V]],ke=1)}while((V++<Cn||ue[0]!=null)&&Ce--);W=ue[0]!=null,ie[0]||ie.splice(0,1)}if(C==dn){for(Y=1,Ce=ie[0];Ce>=10;Ce/=10,Y++);z(le,G+(le.e=Y+U*Ee-1)+1,R,W)}else le.e=U,le.r=+W;return le}})();function q(k,w,I,P){var T,G,R,C,B;if(I==null?I=h:He(I,0,8),!k.c)return k.toString();if(T=k.c[0],R=k.e,w==null)B=Kt(k.c),B=P==1||P==2&&(R<=d||R>=p)?Oa(B,R):nr(B,R,"0");else if(k=z(new L(k),w,I),G=k.e,B=Kt(k.c),C=B.length,P==1||P==2&&(w<=G||G<=d)){for(;C<w;B+="0",C++);B=Oa(B,G)}else if(w-=R+(P===2&&G>R),B=nr(B,G,"0"),G+1>C){if(--w>0)for(B+=".";w--;B+="0");}else if(w+=G-C,w>0)for(G+1==C&&(B+=".");w--;B+="0");return k.s<0&&T?"-"+B:B}function H(k,w){for(var I,P,T=1,G=new L(k[0]);T<k.length;T++)P=new L(k[T]),(!P.s||(I=Vr(G,P))===w||I===0&&G.s===w)&&(G=P);return G}function J(k,w,I){for(var P=1,T=w.length;!w[--T];w.pop());for(T=w[0];T>=10;T/=10,P++);return(I=P+I*Ee-1)>v?k.c=k.e=null:I<y?k.c=[k.e=0]:(k.e=I,k.c=w),k}s=(function(){var k=/^(-?)0([xbo])(?=\w[\w.]*$)/i,w=/^([^.]+)\.$/,I=/^\.([^.]+)$/,P=/^-?(Infinity|NaN)$/,T=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(G,R,C,B){var U,Y=C?R:R.replace(T,"");if(P.test(Y))G.s=isNaN(Y)?null:Y<0?-1:1;else{if(!C&&(Y=Y.replace(k,function(W,Z,ne){return U=(ne=ne.toLowerCase())=="x"?16:ne=="b"?2:8,!B||B==U?Z:W}),B&&(U=B,Y=Y.replace(w,"$1").replace(I,"0.$1")),R!=Y))return new L(Y,U);if(L.DEBUG)throw Error(Dt+"Not a"+(B?" base "+B:"")+" number: "+R);G.s=null}G.c=G.e=null}})();function z(k,w,I,P){var T,G,R,C,B,U,Y,W=k.c,Z=wu;if(W){e:{for(T=1,C=W[0];C>=10;C/=10,T++);if(G=w-T,G<0)G+=Ee,R=w,B=W[U=0],Y=Qt(B/Z[T-R-1]%10);else if(U=Eu((G+1)/Ee),U>=W.length)if(P){for(;W.length<=U;W.push(0));B=Y=0,T=1,G%=Ee,R=G-Ee+1}else break e;else{for(B=C=W[U],T=1;C>=10;C/=10,T++);G%=Ee,R=G-Ee+T,Y=R<0?0:Qt(B/Z[T-R-1]%10)}if(P=P||w<0||W[U+1]!=null||(R<0?B:B%Z[T-R-1]),P=I<4?(Y||P)&&(I==0||I==(k.s<0?3:2)):Y>5||Y==5&&(I==4||P||I==6&&(G>0?R>0?B/Z[T-R]:0:W[U-1])%10&1||I==(k.s<0?8:7)),w<1||!W[0])return W.length=0,P?(w-=k.e+1,W[0]=Z[(Ee-w%Ee)%Ee],k.e=-w||0):W[0]=k.e=0,k;if(G==0?(W.length=U,C=1,U--):(W.length=U+1,C=Z[Ee-G],W[U]=R>0?Qt(B/Z[T-R]%Z[R])*C:0),P)for(;;)if(U==0){for(G=1,R=W[0];R>=10;R/=10,G++);for(R=W[0]+=C,C=1;R>=10;R/=10,C++);G!=C&&(k.e++,W[0]==dn&&(W[0]=1));break}else{if(W[U]+=C,W[U]!=dn)break;W[U--]=0,C=1}for(G=W.length;W[--G]===0;W.pop());}k.e>v?k.c=k.e=null:k.e<y&&(k.c=[k.e=0])}return k}function $(k){var w,I=k.e;return I===null?k.toString():(w=Kt(k.c),w=I<=d||I>=p?Oa(w,I):nr(w,I,"0"),k.s<0?"-"+w:w)}return u.absoluteValue=u.abs=function(){var k=new L(this);return k.s<0&&(k.s=1),k},u.comparedTo=function(k,w){return Vr(this,new L(k,w))},u.decimalPlaces=u.dp=function(k,w){var I,P,T,G=this;if(k!=null)return He(k,0,at),w==null?w=h:He(w,0,8),z(new L(G),k+G.e+1,w);if(!(I=G.c))return null;if(P=((T=I.length-1)-en(this.e/Ee))*Ee,T=I[T])for(;T%10==0;T/=10,P--);return P<0&&(P=0),P},u.dividedBy=u.div=function(k,w){return e(this,new L(k,w),f,h)},u.dividedToIntegerBy=u.idiv=function(k,w){return e(this,new L(k,w),0,1)},u.exponentiatedBy=u.pow=function(k,w){var I,P,T,G,R,C,B,U,Y,W=this;if(k=new L(k),k.c&&!k.isInteger())throw Error(Dt+"Exponent not an integer: "+$(k));if(w!=null&&(w=new L(w)),C=k.e>14,!W.c||!W.c[0]||W.c[0]==1&&!W.e&&W.c.length==1||!k.c||!k.c[0])return Y=new L(Math.pow(+$(W),C?k.s*(2-Pa(k)):+$(k))),w?Y.mod(w):Y;if(B=k.s<0,w){if(w.c?!w.c[0]:!w.s)return new L(NaN);P=!B&&W.isInteger()&&w.isInteger(),P&&(W=W.mod(w))}else{if(k.e>9&&(W.e>0||W.e<-1||(W.e==0?W.c[0]>1||C&&W.c[1]>=24e7:W.c[0]<8e13||C&&W.c[0]<=9999975e7)))return G=W.s<0&&Pa(k)?-0:0,W.e>-1&&(G=1/G),new L(B?1/G:G);b&&(G=Eu(b/Ee+2))}for(C?(I=new L(.5),B&&(k.s=1),U=Pa(k)):(T=Math.abs(+$(k)),U=T%2),Y=new L(c);;){if(U){if(Y=Y.times(W),!Y.c)break;G?Y.c.length>G&&(Y.c.length=G):P&&(Y=Y.mod(w))}if(T){if(T=Qt(T/2),T===0)break;U=T%2}else if(k=k.times(I),z(k,k.e+1,1),k.e>14)U=Pa(k);else{if(T=+$(k),T===0)break;U=T%2}W=W.times(W),G?W.c&&W.c.length>G&&(W.c.length=G):P&&(W=W.mod(w))}return P?Y:(B&&(Y=c.div(Y)),w?Y.mod(w):G?z(Y,b,h,R):Y)},u.integerValue=function(k){var w=new L(this);return k==null?k=h:He(k,0,8),z(w,w.e+1,k)},u.isEqualTo=u.eq=function(k,w){return Vr(this,new L(k,w))===0},u.isFinite=function(){return!!this.c},u.isGreaterThan=u.gt=function(k,w){return Vr(this,new L(k,w))>0},u.isGreaterThanOrEqualTo=u.gte=function(k,w){return(w=Vr(this,new L(k,w)))===1||w===0},u.isInteger=function(){return!!this.c&&en(this.e/Ee)>this.c.length-2},u.isLessThan=u.lt=function(k,w){return Vr(this,new L(k,w))<0},u.isLessThanOrEqualTo=u.lte=function(k,w){return(w=Vr(this,new L(k,w)))===-1||w===0},u.isNaN=function(){return!this.s},u.isNegative=function(){return this.s<0},u.isPositive=function(){return this.s>0},u.isZero=function(){return!!this.c&&this.c[0]==0},u.minus=function(k,w){var I,P,T,G,R=this,C=R.s;if(k=new L(k,w),w=k.s,!C||!w)return new L(NaN);if(C!=w)return k.s=-w,R.plus(k);var B=R.e/Ee,U=k.e/Ee,Y=R.c,W=k.c;if(!B||!U){if(!Y||!W)return Y?(k.s=-w,k):new L(W?R:NaN);if(!Y[0]||!W[0])return W[0]?(k.s=-w,k):new L(Y[0]?R:h==3?-0:0)}if(B=en(B),U=en(U),Y=Y.slice(),C=B-U){for((G=C<0)?(C=-C,T=Y):(U=B,T=W),T.reverse(),w=C;w--;T.push(0));T.reverse()}else for(P=(G=(C=Y.length)<(w=W.length))?C:w,C=w=0;w<P;w++)if(Y[w]!=W[w]){G=Y[w]<W[w];break}if(G&&(T=Y,Y=W,W=T,k.s=-k.s),w=(P=W.length)-(I=Y.length),w>0)for(;w--;Y[I++]=0);for(w=dn-1;P>C;){if(Y[--P]<W[P]){for(I=P;I&&!Y[--I];Y[I]=w);--Y[I],Y[P]+=dn}Y[P]-=W[P]}for(;Y[0]==0;Y.splice(0,1),--U);return Y[0]?J(k,Y,U):(k.s=h==3?-1:1,k.c=[k.e=0],k)},u.modulo=u.mod=function(k,w){var I,P,T=this;return k=new L(k,w),!T.c||!k.s||k.c&&!k.c[0]?new L(NaN):!k.c||T.c&&!T.c[0]?new L(T):(S==9?(P=k.s,k.s=1,I=e(T,k,0,3),k.s=P,I.s*=P):I=e(T,k,0,S),k=T.minus(I.times(k)),!k.c[0]&&S==1&&(k.s=T.s),k)},u.multipliedBy=u.times=function(k,w){var I,P,T,G,R,C,B,U,Y,W,Z,ne,oe,le,ie,ue=this,ke=ue.c,Le=(k=new L(k,w)).c;if(!ke||!Le||!ke[0]||!Le[0])return!ue.s||!k.s||ke&&!ke[0]&&!Le||Le&&!Le[0]&&!ke?k.c=k.e=k.s=null:(k.s*=ue.s,!ke||!Le?k.c=k.e=null:(k.c=[0],k.e=0)),k;for(P=en(ue.e/Ee)+en(k.e/Ee),k.s*=ue.s,B=ke.length,W=Le.length,B<W&&(oe=ke,ke=Le,Le=oe,T=B,B=W,W=T),T=B+W,oe=[];T--;oe.push(0));for(le=dn,ie=br,T=W;--T>=0;){for(I=0,Z=Le[T]%ie,ne=Le[T]/ie|0,R=B,G=T+R;G>T;)U=ke[--R]%ie,Y=ke[R]/ie|0,C=ne*U+Y*Z,U=Z*U+C%ie*ie+oe[G]+I,I=(U/le|0)+(C/ie|0)+ne*Y,oe[G--]=U%le;oe[G]=I}return I?++P:oe.splice(0,1),J(k,oe,P)},u.negated=function(){var k=new L(this);return k.s=-k.s||null,k},u.plus=function(k,w){var I,P=this,T=P.s;if(k=new L(k,w),w=k.s,!T||!w)return new L(NaN);if(T!=w)return k.s=-w,P.minus(k);var G=P.e/Ee,R=k.e/Ee,C=P.c,B=k.c;if(!G||!R){if(!C||!B)return new L(T/0);if(!C[0]||!B[0])return B[0]?k:new L(C[0]?P:T*0)}if(G=en(G),R=en(R),C=C.slice(),T=G-R){for(T>0?(R=G,I=B):(T=-T,I=C),I.reverse();T--;I.push(0));I.reverse()}for(T=C.length,w=B.length,T-w<0&&(I=B,B=C,C=I,w=T),T=0;w;)T=(C[--w]=C[w]+B[w]+T)/dn|0,C[w]=dn===C[w]?0:C[w]%dn;return T&&(C=[T].concat(C),++R),J(k,C,R)},u.precision=u.sd=function(k,w){var I,P,T,G=this;if(k!=null&&k!==!!k)return He(k,1,at),w==null?w=h:He(w,0,8),z(new L(G),k,w);if(!(I=G.c))return null;if(T=I.length-1,P=T*Ee+1,T=I[T]){for(;T%10==0;T/=10,P--);for(T=I[0];T>=10;T/=10,P++);}return k&&G.e+1>P&&(P=G.e+1),P},u.shiftedBy=function(k){return He(k,-xu,xu),this.times("1e"+k)},u.squareRoot=u.sqrt=function(){var k,w,I,P,T,G=this,R=G.c,C=G.s,B=G.e,U=f+4,Y=new L("0.5");if(C!==1||!R||!R[0])return new L(!C||C<0&&(!R||R[0])?NaN:R?G:1/0);if(C=Math.sqrt(+$(G)),C==0||C==1/0?(w=Kt(R),(w.length+B)%2==0&&(w+="0"),C=Math.sqrt(+w),B=en((B+1)/2)-(B<0||B%2),C==1/0?w="5e"+B:(w=C.toExponential(),w=w.slice(0,w.indexOf("e")+1)+B),I=new L(w)):I=new L(C+""),I.c[0]){for(B=I.e,C=B+U,C<3&&(C=0);;)if(T=I,I=Y.times(T.plus(e(G,T,U,1))),Kt(T.c).slice(0,C)===(w=Kt(I.c)).slice(0,C))if(I.e<B&&--C,w=w.slice(C-3,C+1),w=="9999"||!P&&w=="4999"){if(!P&&(z(T,T.e+f+2,0),T.times(T).eq(G))){I=T;break}U+=4,C+=4,P=1}else{(!+w||!+w.slice(1)&&w.charAt(0)=="5")&&(z(I,I.e+f+2,1),k=!I.times(I).eq(G));break}}return z(I,I.e+f+1,h,k)},u.toExponential=function(k,w){return k!=null&&(He(k,0,at),k++),q(this,k,w,1)},u.toFixed=function(k,w){return k!=null&&(He(k,0,at),k=k+this.e+1),q(this,k,w)},u.toFormat=function(k,w,I){var P,T=this;if(I==null)k!=null&&w&&typeof w=="object"?(I=w,w=null):k&&typeof k=="object"?(I=k,k=w=null):I=N;else if(typeof I!="object")throw Error(Dt+"Argument not an object: "+I);if(P=T.toFixed(k,w),T.c){var G,R=P.split("."),C=+I.groupSize,B=+I.secondaryGroupSize,U=I.groupSeparator||"",Y=R[0],W=R[1],Z=T.s<0,ne=Z?Y.slice(1):Y,oe=ne.length;if(B&&(G=C,C=B,B=G,oe-=G),C>0&&oe>0){for(G=oe%C||C,Y=ne.substr(0,G);G<oe;G+=C)Y+=U+ne.substr(G,C);B>0&&(Y+=U+ne.slice(G)),Z&&(Y="-"+Y)}P=W?Y+(I.decimalSeparator||"")+((B=+I.fractionGroupSize)?W.replace(new RegExp("\\d{"+B+"}\\B","g"),"$&"+(I.fractionGroupSeparator||"")):W):Y}return(I.prefix||"")+P+(I.suffix||"")},u.toFraction=function(k){var w,I,P,T,G,R,C,B,U,Y,W,Z,ne=this,oe=ne.c;if(k!=null&&(C=new L(k),!C.isInteger()&&(C.c||C.s!==1)||C.lt(c)))throw Error(Dt+"Argument "+(C.isInteger()?"out of range: ":"not an integer: ")+$(C));if(!oe)return new L(ne);for(w=new L(c),U=I=new L(c),P=B=new L(c),Z=Kt(oe),G=w.e=Z.length-ne.e-1,w.c[0]=wu[(R=G%Ee)<0?Ee+R:R],k=!k||C.comparedTo(w)>0?G>0?w:U:C,R=v,v=1/0,C=new L(Z),B.c[0]=0;Y=e(C,w,0,1),T=I.plus(Y.times(P)),T.comparedTo(k)!=1;)I=P,P=T,U=B.plus(Y.times(T=U)),B=T,w=C.minus(Y.times(T=w)),C=T;return T=e(k.minus(I),P,0,1),B=B.plus(T.times(U)),I=I.plus(T.times(P)),B.s=U.s=ne.s,G=G*2,W=e(U,P,G,h).minus(ne).abs().comparedTo(e(B,I,G,h).minus(ne).abs())<1?[U,P]:[B,I],v=R,W},u.toNumber=function(){return+$(this)},u.toPrecision=function(k,w){return k!=null&&He(k,1,at),q(this,k,w,2)},u.toString=function(k){var w,I=this,P=I.s,T=I.e;return T===null?P?(w="Infinity",P<0&&(w="-"+w)):w="NaN":(k==null?w=T<=d||T>=p?Oa(Kt(I.c),T):nr(Kt(I.c),T,"0"):k===10&&D?(I=z(new L(I),f+T+1,h),w=nr(Kt(I.c),I.e,"0")):(He(k,2,O.length,"Base"),w=r(nr(Kt(I.c),T,"0"),10,k,P,!0)),P<0&&I.c[0]&&(w="-"+w)),w},u.valueOf=u.toJSON=function(){return $(this)},u._isBigNumber=!0,u[Symbol.toStringTag]="BigNumber",u[Symbol.for("nodejs.util.inspect.custom")]=u.valueOf,t!=null&&L.set(t),L}function en(t){var e=t|0;return t>0||t===e?e:e-1}function Kt(t){for(var e,r,s=1,u=t.length,c=t[0]+"";s<u;){for(e=t[s++]+"",r=Ee-e.length;r--;e="0"+e);c+=e}for(u=c.length;c.charCodeAt(--u)===48;);return c.slice(0,u+1||1)}function Vr(t,e){var r,s,u=t.c,c=e.c,f=t.s,h=e.s,d=t.e,p=e.e;if(!f||!h)return null;if(r=u&&!u[0],s=c&&!c[0],r||s)return r?s?0:-h:f;if(f!=h)return f;if(r=f<0,s=d==p,!u||!c)return s?0:!u^r?1:-1;if(!s)return d>p^r?1:-1;for(h=(d=u.length)<(p=c.length)?d:p,f=0;f<h;f++)if(u[f]!=c[f])return u[f]>c[f]^r?1:-1;return d==p?0:d>p^r?1:-1}function He(t,e,r,s){if(t<e||t>r||t!==Qt(t))throw Error(Dt+(s||"Argument")+(typeof t=="number"?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function Pa(t){var e=t.c.length-1;return en(t.e/Ee)==e&&t.c[e]%2!=0}function Oa(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function nr(t,e,r){var s,u;if(e<0){for(u=r+".";++e;u+=r);t=u+t}else if(s=t.length,++e>s){for(u=r,e-=s;--e;u+=r);t+=u}else e<s&&(t=t.slice(0,e)+"."+t.slice(e));return t}var Jn=Tp(),GS=class{key;left=null;right=null;constructor(t){this.key=t}},xs=class extends GS{constructor(t){super(t)}},BS=class{size=0;modificationCount=0;splayCount=0;splay(t){const e=this.root;if(e==null)return this.compare(t,t),-1;let r=null,s=null,u=null,c=null,f=e;const h=this.compare;let d;for(;;)if(d=h(f.key,t),d>0){let p=f.left;if(p==null||(d=h(p.key,t),d>0&&(f.left=p.right,p.right=f,f=p,p=f.left,p==null)))break;r==null?s=f:r.left=f,r=f,f=p}else if(d<0){let p=f.right;if(p==null||(d=h(p.key,t),d<0&&(f.right=p.left,p.left=f,f=p,p=f.right,p==null)))break;u==null?c=f:u.right=f,u=f,f=p}else break;return u!=null&&(u.right=f.left,f.left=c),r!=null&&(r.left=f.right,f.right=s),this.root!==f&&(this.root=f,this.splayCount++),d}splayMin(t){let e=t,r=e.left;for(;r!=null;){const s=r;e.left=s.right,s.right=e,e=s,r=e.left}return e}splayMax(t){let e=t,r=e.right;for(;r!=null;){const s=r;e.right=s.left,s.left=e,e=s,r=e.right}return e}_delete(t){if(this.root==null||this.splay(t)!=0)return null;let e=this.root;const r=e,s=e.left;if(this.size--,s==null)this.root=e.right;else{const u=e.right;e=this.splayMax(s),e.right=u,this.root=e}return this.modificationCount++,r}addNewRoot(t,e){this.size++,this.modificationCount++;const r=this.root;if(r==null){this.root=t;return}e<0?(t.left=r,t.right=r.right,r.right=null):(t.right=r,t.left=r.left,r.left=null),this.root=t}_first(){const t=this.root;return t==null?null:(this.root=this.splayMin(t),this.root)}_last(){const 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)=>t<e?-1:t>e?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)}}},lo=class Os extends BS{root=null;compare;validKey;constructor(e,r){super(),this.compare=e??this.defaultCompare(),this.validKey=r??(s=>s!=null&&s!=null)}delete(e){return this.validKey(e)?this._delete(e)!=null:!1}deleteAll(e){for(const r of e)this.delete(r)}forEach(e){const r=this[Symbol.iterator]();let s;for(;s=r.next(),!s.done;)e(s.value,s.value,this)}add(e){const r=this.splay(e);return r!=0&&this.addNewRoot(new xs(e),r),this}addAndReturn(e){const r=this.splay(e);return r!=0&&this.addNewRoot(new xs(e),r),this.root.key}addAll(e){for(const r of e)this.add(r)}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 s=r.right;for(;s!=null;)r=s,s=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 s=r.left;for(;s!=null;)r=s,s=r.left;return r.key}retainAll(e){const r=new Os(this.compare,this.validKey),s=this.modificationCount;for(const u of e){if(s!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(u)&&this.splay(u)==0&&r.add(this.root.key)}r.size!=this.size&&(this.root=r.root,this.size=r.size,this.modificationCount++)}lookup(e){return!this.validKey(e)||this.splay(e)!=0?null:this.root.key}intersection(e){const r=new Os(this.compare,this.validKey);for(const s of this)e.has(s)&&r.add(s);return r}difference(e){const r=new Os(this.compare,this.validKey);for(const s of this)e.has(s)||r.add(s);return r}union(e){const r=this.clone();return r.addAll(e),r}clone(){const e=new Os(this.compare,this.validKey);return e.size=this.size,e.root=this.copyNode(this.root),e}copyNode(e){if(e==null)return null;function r(u,c){let f,h;do{if(f=u.left,h=u.right,f!=null){const d=new xs(f.key);c.left=d,r(f,d)}if(h!=null){const d=new xs(h.key);c.right=d,u=h,c=d}}while(h!=null)}const s=new xs(e.key);return r(e,s),s}toSet(){return this.clone()}entries(){return new jS(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new US(this.wrap())}[Symbol.toStringTag]="[object Set]"},Pp=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;const 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 r=this.tree.getRoot();for(;r!=null;)this.path.push(r),r=r.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let 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}},US=class extends Pp{getValue(t){return t.key}},jS=class extends Pp{getValue(t){return[t.key,t.key]}},Op=t=>()=>t,gl=t=>{const e=t?(r,s)=>s.minus(r).abs().isLessThanOrEqualTo(t):Op(!1);return(r,s)=>e(r,s)?0:r.comparedTo(s)};function qS(t){const e=t?(r,s,u,c,f)=>r.exponentiatedBy(2).isLessThanOrEqualTo(c.minus(s).exponentiatedBy(2).plus(f.minus(u).exponentiatedBy(2)).times(t)):Op(!1);return(r,s,u)=>{const c=r.x,f=r.y,h=u.x,d=u.y,p=f.minus(d).times(s.x.minus(h)).minus(c.minus(h).times(s.y.minus(d)));return e(p,c,f,h,d)?0:p.comparedTo(0)}}var YS=t=>t,zS=t=>{if(t){const e=new lo(gl(t)),r=new lo(gl(t)),s=(c,f)=>f.addAndReturn(c),u=c=>({x:s(c.x,e),y:s(c.y,r)});return u({x:new Jn(0),y:new Jn(0)}),u}return YS},dl=t=>({set:e=>{hr=dl(e)},reset:()=>dl(t),compare:gl(t),snap:zS(t),orient:qS(t)}),hr=dl(),ws=(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),pl=(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;const r=t.ll.x.isLessThan(e.ll.x)?e.ll.x:t.ll.x,s=t.ur.x.isLessThan(e.ur.x)?t.ur.x:e.ur.x,u=t.ll.y.isLessThan(e.ll.y)?e.ll.y:t.ll.y,c=t.ur.y.isLessThan(e.ur.y)?t.ur.y:e.ur.y;return{ll:{x:r,y:u},ur:{x:s,y:c}}},za=(t,e)=>t.x.times(e.y).minus(t.y.times(e.x)),Rp=(t,e)=>t.x.times(e.x).plus(t.y.times(e.y)),co=t=>Rp(t,t).sqrt(),JS=(t,e,r)=>{const s={x:e.x.minus(t.x),y:e.y.minus(t.y)},u={x:r.x.minus(t.x),y:r.y.minus(t.y)};return za(u,s).div(co(u)).div(co(s))},HS=(t,e,r)=>{const s={x:e.x.minus(t.x),y:e.y.minus(t.y)},u={x:r.x.minus(t.x),y:r.y.minus(t.y)};return Rp(u,s).div(co(u)).div(co(s))},Gf=(t,e,r)=>e.y.isZero()?null:{x:t.x.plus(e.x.div(e.y).times(r.minus(t.y))),y:r},Bf=(t,e,r)=>e.x.isZero()?null:{x:r,y:t.y.plus(e.y.div(e.x).times(r.minus(t.x)))},VS=(t,e,r,s)=>{if(e.x.isZero())return Bf(r,s,t.x);if(s.x.isZero())return Bf(t,e,r.x);if(e.y.isZero())return Gf(r,s,t.y);if(s.y.isZero())return Gf(t,e,r.y);const u=za(e,s);if(u.isZero())return null;const c={x:r.x.minus(t.x),y:r.y.minus(t.y)},f=za(c,e).div(u),h=za(c,s).div(u),d=t.x.plus(h.times(e.x)),p=r.x.plus(f.times(s.x)),y=t.y.plus(h.times(e.y)),v=r.y.plus(f.times(s.y)),E=d.plus(p).div(2),S=y.plus(v).div(2);return{x:E,y:S}},qn=class Dp{point;isLeft;segment;otherSE;consumedBy;static compare(e,r){const s=Dp.comparePoints(e.point,r.point);return s!==0?s:(e.point!==r.point&&e.link(r),e.isLeft!==r.isLeft?e.isLeft?1:-1:ho.compare(e.segment,r.segment))}static comparePoints(e,r){return e.x.isLessThan(r.x)?-1:e.x.isGreaterThan(r.x)?1:e.y.isLessThan(r.y)?-1:e.y.isGreaterThan(r.y)?1:0}constructor(e,r){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const r=e.point.events;for(let s=0,u=r.length;s<u;s++){const c=r[s];this.point.events.push(c),c.point=this.point}this.checkForConsuming()}checkForConsuming(){const e=this.point.events.length;for(let r=0;r<e;r++){const s=this.point.events[r];if(s.segment.consumedBy===void 0)for(let u=r+1;u<e;u++){const c=this.point.events[u];c.consumedBy===void 0&&s.otherSE.point.events===c.otherSE.point.events&&s.segment.consume(c.segment)}}}getAvailableLinkedEvents(){const e=[];for(let r=0,s=this.point.events.length;r<s;r++){const u=this.point.events[r];u!==this&&!u.segment.ringOut&&u.segment.isInResult()&&e.push(u)}return e}getLeftmostComparator(e){const r=new Map,s=u=>{const c=u.otherSE;r.set(u,{sine:JS(this.point,e.point,c.point),cosine:HS(this.point,e.point,c.point)})};return(u,c)=>{r.has(u)||s(u),r.has(c)||s(c);const{sine:f,cosine:h}=r.get(u),{sine:d,cosine:p}=r.get(c);return f.isGreaterThanOrEqualTo(0)&&d.isGreaterThanOrEqualTo(0)?h.isLessThan(p)?1:h.isGreaterThan(p)?-1:0:f.isLessThan(0)&&d.isLessThan(0)?h.isLessThan(p)?-1:h.isGreaterThan(p)?1:0:d.isLessThan(f)?-1:d.isGreaterThan(f)?1:0}}},XS=class ml{events;poly;_isExteriorRing;_enclosingRing;static factory(e){const r=[];for(let s=0,u=e.length;s<u;s++){const c=e[s];if(!c.isInResult()||c.ringOut)continue;let f=null,h=c.leftSE,d=c.rightSE;const p=[h],y=h.point,v=[];for(;f=h,h=d,p.push(h),h.point!==y;)for(;;){const E=h.getAvailableLinkedEvents();if(E.length===0){const N=p[0].point,O=p[p.length-1].point;throw new Error(`Unable to complete output ring starting at [${N.x}, ${N.y}]. Last matching segment found ends at [${O.x}, ${O.y}].`)}if(E.length===1){d=E[0].otherSE;break}let S=null;for(let N=0,O=v.length;N<O;N++)if(v[N].point===h.point){S=N;break}if(S!==null){const N=v.splice(S)[0],O=p.splice(N.index);O.unshift(O[0].otherSE),r.push(new ml(O.reverse()));continue}v.push({index:p.length,point:h.point});const b=h.getLeftmostComparator(f);d=E.sort(b)[0].otherSE;break}r.push(new ml(p))}return r}constructor(e){this.events=e;for(let r=0,s=e.length;r<s;r++)e[r].segment.ringOut=this;this.poly=null}getGeom(){let e=this.events[0].point;const r=[e];for(let p=1,y=this.events.length-1;p<y;p++){const v=this.events[p].point,E=this.events[p+1].point;hr.orient(v,e,E)!==0&&(r.push(v),e=v)}if(r.length===1)return null;const s=r[0],u=r[1];hr.orient(s,e,u)===0&&r.shift(),r.push(r[0]);const c=this.isExteriorRing()?1:-1,f=this.isExteriorRing()?0:r.length-1,h=this.isExteriorRing()?r.length:-1,d=[];for(let p=f;p!=h;p+=c)d.push([r[p].x.toNumber(),r[p].y.toNumber()]);return d}isExteriorRing(){if(this._isExteriorRing===void 0){const e=this.enclosingRing();this._isExteriorRing=e?!e.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let e=this.events[0];for(let u=1,c=this.events.length;u<c;u++){const f=this.events[u];qn.compare(e,f)>0&&(e=f)}let r=e.segment.prevInResult(),s=r?r.prevInResult():null;for(;;){if(!r)return null;if(!s)return r.ringOut;if(s.ringOut!==r.ringOut)return s.ringOut?.enclosingRing()!==r.ringOut?r.ringOut:r.ringOut?.enclosingRing();r=s.prevInResult(),s=r?r.prevInResult():null}}},Uf=class{exteriorRing;interiorRings;constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=this.exteriorRing.getGeom();if(t===null)return null;const e=[t];for(let r=0,s=this.interiorRings.length;r<s;r++){const u=this.interiorRings[r].getGeom();u!==null&&e.push(u)}return e}},$S=class{rings;polys;constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let e=0,r=this.polys.length;e<r;e++){const s=this.polys[e].getGeom();s!==null&&t.push(s)}return t}_composePolys(t){const e=[];for(let r=0,s=t.length;r<s;r++){const u=t[r];if(!u.poly)if(u.isExteriorRing())e.push(new Uf(u));else{const c=u.enclosingRing();c?.poly||e.push(new Uf(c)),c?.poly?.addInterior(u)}}return e}},WS=class{queue;tree;segments;constructor(t,e=ho.compare){this.queue=t,this.tree=new lo(e),this.segments=[]}process(t){const e=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.delete(t.otherSE):this.tree.delete(e),r;t.isLeft&&this.tree.add(e);let s=e,u=e;do s=this.tree.lastBefore(s);while(s!=null&&s.consumedBy!=null);do u=this.tree.firstAfter(u);while(u!=null&&u.consumedBy!=null);if(t.isLeft){let c=null;if(s){const h=s.getIntersection(e);if(h!==null&&(e.isAnEndpoint(h)||(c=h),!s.isAnEndpoint(h))){const d=this._splitSafely(s,h);for(let p=0,y=d.length;p<y;p++)r.push(d[p])}}let f=null;if(u){const h=u.getIntersection(e);if(h!==null&&(e.isAnEndpoint(h)||(f=h),!u.isAnEndpoint(h))){const d=this._splitSafely(u,h);for(let p=0,y=d.length;p<y;p++)r.push(d[p])}}if(c!==null||f!==null){let h=null;c===null?h=f:f===null?h=c:h=qn.comparePoints(c,f)<=0?c:f,this.queue.delete(e.rightSE),r.push(e.rightSE);const d=e.split(h);for(let p=0,y=d.length;p<y;p++)r.push(d[p])}r.length>0?(this.tree.delete(e),r.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&u){const c=s.getIntersection(u);if(c!==null){if(!s.isAnEndpoint(c)){const f=this._splitSafely(s,c);for(let h=0,d=f.length;h<d;h++)r.push(f[h])}if(!u.isAnEndpoint(c)){const f=this._splitSafely(u,c);for(let h=0,d=f.length;h<d;h++)r.push(f[h])}}}this.tree.delete(e)}return r}_splitSafely(t,e){this.tree.delete(t);const r=t.rightSE;this.queue.delete(r);const s=t.split(e);return s.push(r),t.consumedBy===void 0&&this.tree.add(t),s}},ZS=class{type;numMultiPolys;run(t,e,r){Rs.type=t;const s=[new qf(e,!0)];for(let d=0,p=r.length;d<p;d++)s.push(new qf(r[d],!1));if(Rs.numMultiPolys=s.length,Rs.type==="difference"){const d=s[0];let p=1;for(;p<s.length;)pl(s[p].bbox,d.bbox)!==null?p++:s.splice(p,1)}if(Rs.type==="intersection")for(let d=0,p=s.length;d<p;d++){const y=s[d];for(let v=d+1,E=s.length;v<E;v++)if(pl(y.bbox,s[v].bbox)===null)return[]}const u=new lo(qn.compare);for(let d=0,p=s.length;d<p;d++){const y=s[d].getSweepEvents();for(let v=0,E=y.length;v<E;v++)u.add(y[v])}const c=new WS(u);let f=null;for(u.size!=0&&(f=u.first(),u.delete(f));f;){const d=c.process(f);for(let p=0,y=d.length;p<y;p++){const v=d[p];v.consumedBy===void 0&&u.add(v)}u.size!=0?(f=u.first(),u.delete(f)):f=null}hr.reset();const h=XS.factory(c.segments);return new $S(h).getGeom()}},Rs=new ZS,vl=Rs,KS=0,ho=class Ja{id;leftSE;rightSE;rings;windings;ringOut;consumedBy;prev;_prevInResult;_beforeState;_afterState;_isInResult;static compare(e,r){const s=e.leftSE.point.x,u=r.leftSE.point.x,c=e.rightSE.point.x,f=r.rightSE.point.x;if(f.isLessThan(s))return 1;if(c.isLessThan(u))return-1;const h=e.leftSE.point.y,d=r.leftSE.point.y,p=e.rightSE.point.y,y=r.rightSE.point.y;if(s.isLessThan(u)){if(d.isLessThan(h)&&d.isLessThan(p))return 1;if(d.isGreaterThan(h)&&d.isGreaterThan(p))return-1;const v=e.comparePoint(r.leftSE.point);if(v<0)return 1;if(v>0)return-1;const E=r.comparePoint(e.rightSE.point);return E!==0?E:-1}if(s.isGreaterThan(u)){if(h.isLessThan(d)&&h.isLessThan(y))return-1;if(h.isGreaterThan(d)&&h.isGreaterThan(y))return 1;const v=r.comparePoint(e.leftSE.point);if(v!==0)return v;const E=e.comparePoint(r.rightSE.point);return E<0?1:E>0?-1:1}if(h.isLessThan(d))return-1;if(h.isGreaterThan(d))return 1;if(c.isLessThan(f)){const v=r.comparePoint(e.rightSE.point);if(v!==0)return v}if(c.isGreaterThan(f)){const v=e.comparePoint(r.rightSE.point);if(v<0)return 1;if(v>0)return-1}if(!c.eq(f)){const v=p.minus(h),E=c.minus(s),S=y.minus(d),b=f.minus(u);if(v.isGreaterThan(E)&&S.isLessThan(b))return 1;if(v.isLessThan(E)&&S.isGreaterThan(b))return-1}return c.isGreaterThan(f)?1:c.isLessThan(f)||p.isLessThan(y)?-1:p.isGreaterThan(y)?1:e.id<r.id?-1:e.id>r.id?1:0}constructor(e,r,s,u){this.id=++KS,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=s,this.windings=u}static fromRing(e,r,s){let u,c,f;const h=qn.comparePoints(e,r);if(h<0)u=e,c=r,f=1;else if(h>0)u=r,c=e,f=-1;else throw new Error(`Tried to create degenerate segment at [${e.x}, ${e.y}]`);const d=new qn(u,!0),p=new qn(c,!1);return new Ja(d,p,[s],[f])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const e=this.leftSE.point.y,r=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e.isLessThan(r)?e:r},ur:{x:this.rightSE.point.x,y:e.isGreaterThan(r)?e:r}}}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 hr.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){const r=this.bbox(),s=e.bbox(),u=pl(r,s);if(u===null)return null;const c=this.leftSE.point,f=this.rightSE.point,h=e.leftSE.point,d=e.rightSE.point,p=ws(r,h)&&this.comparePoint(h)===0,y=ws(s,c)&&e.comparePoint(c)===0,v=ws(r,d)&&this.comparePoint(d)===0,E=ws(s,f)&&e.comparePoint(f)===0;if(y&&p)return E&&!v?f:!E&&v?d:null;if(y)return v&&c.x.eq(d.x)&&c.y.eq(d.y)?null:c;if(p)return E&&f.x.eq(h.x)&&f.y.eq(h.y)?null:h;if(E&&v)return null;if(E)return f;if(v)return d;const S=VS(c,this.vector(),h,e.vector());return S===null||!ws(u,S)?null:hr.snap(S)}split(e){const r=[],s=e.events!==void 0,u=new qn(e,!0),c=new qn(e,!1),f=this.rightSE;this.replaceRightSE(c),r.push(c),r.push(u);const h=new Ja(u,f,this.rings.slice(),this.windings.slice());return qn.comparePoints(h.leftSE.point,h.rightSE.point)>0&&h.swapEvents(),qn.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),s&&(u.checkForConsuming(),c.checkForConsuming()),r}swapEvents(){const e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let r=0,s=this.windings.length;r<s;r++)this.windings[r]*=-1}consume(e){let r=this,s=e;for(;r.consumedBy;)r=r.consumedBy;for(;s.consumedBy;)s=s.consumedBy;const u=Ja.compare(r,s);if(u!==0){if(u>0){const c=r;r=s,s=c}if(r.prev===s){const c=r;r=s,s=c}for(let c=0,f=s.rings.length;c<f;c++){const h=s.rings[c],d=s.windings[c],p=r.rings.indexOf(h);p===-1?(r.rings.push(h),r.windings.push(d)):r.windings[p]+=d}s.rings=null,s.windings=null,s.consumedBy=r,s.leftSE.consumedBy=r.leftSE,s.rightSE.consumedBy=r.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const e=this.prev.consumedBy||this.prev;this._beforeState=e.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};const r=this._afterState.rings,s=this._afterState.windings,u=this._afterState.multiPolys;for(let h=0,d=this.rings.length;h<d;h++){const p=this.rings[h],y=this.windings[h],v=r.indexOf(p);v===-1?(r.push(p),s.push(y)):s[v]+=y}const c=[],f=[];for(let h=0,d=r.length;h<d;h++){if(s[h]===0)continue;const p=r[h],y=p.poly;if(f.indexOf(y)===-1)if(p.isExterior)c.push(y);else{f.indexOf(y)===-1&&f.push(y);const v=c.indexOf(p.poly);v!==-1&&c.splice(v,1)}}for(let h=0,d=c.length;h<d;h++){const p=c[h].multiPoly;u.indexOf(p)===-1&&u.push(p)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const e=this.beforeState().multiPolys,r=this.afterState().multiPolys;switch(vl.type){case"union":{const s=e.length===0,u=r.length===0;this._isInResult=s!==u;break}case"intersection":{let s,u;e.length<r.length?(s=e.length,u=r.length):(s=r.length,u=e.length),this._isInResult=u===vl.numMultiPolys&&s<u;break}case"xor":{const s=Math.abs(e.length-r.length);this._isInResult=s%2===1;break}case"difference":{const s=u=>u.length===1&&u[0].isSubject;this._isInResult=s(e)!==s(r);break}}return this._isInResult}},jf=class{poly;isExterior;segments;bbox;constructor(t,e,r){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=r,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const s=hr.snap({x:new Jn(t[0][0]),y:new Jn(t[0][1])});this.bbox={ll:{x:s.x,y:s.y},ur:{x:s.x,y:s.y}};let u=s;for(let c=1,f=t.length;c<f;c++){if(typeof t[c][0]!="number"||typeof t[c][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const h=hr.snap({x:new Jn(t[c][0]),y:new Jn(t[c][1])});h.x.eq(u.x)&&h.y.eq(u.y)||(this.segments.push(ho.fromRing(u,h,this)),h.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=h.x),h.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=h.y),h.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=h.x),h.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=h.y),u=h)}(!s.x.eq(u.x)||!s.y.eq(u.y))&&this.segments.push(ho.fromRing(u,s,this))}getSweepEvents(){const t=[];for(let e=0,r=this.segments.length;e<r;e++){const s=this.segments[e];t.push(s.leftSE),t.push(s.rightSE)}return t}},QS=class{multiPoly;exteriorRing;interiorRings;bbox;constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new jf(t[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let r=1,s=t.length;r<s;r++){const u=new jf(t[r],this,!1);u.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=u.bbox.ll.x),u.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=u.bbox.ll.y),u.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=u.bbox.ur.x),u.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=u.bbox.ur.y),this.interiorRings.push(u)}this.multiPoly=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,r=this.interiorRings.length;e<r;e++){const s=this.interiorRings[e].getSweepEvents();for(let u=0,c=s.length;u<c;u++)t.push(s[u])}return t}},qf=class{isSubject;polys;bbox;constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof t[0][0][0]=="number"&&(t=[t])}catch{}this.polys=[],this.bbox={ll:{x:new Jn(Number.POSITIVE_INFINITY),y:new Jn(Number.POSITIVE_INFINITY)},ur:{x:new Jn(Number.NEGATIVE_INFINITY),y:new Jn(Number.NEGATIVE_INFINITY)}};for(let r=0,s=t.length;r<s;r++){const u=new QS(t[r],this);u.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=u.bbox.ll.x),u.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=u.bbox.ll.y),u.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=u.bbox.ur.x),u.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=u.bbox.ur.y),this.polys.push(u)}this.isSubject=e}getSweepEvents(){const t=[];for(let e=0,r=this.polys.length;e<r;e++){const s=this.polys[e].getSweepEvents();for(let u=0,c=s.length;u<c;u++)t.push(s[u])}return t}},eI=(t,...e)=>vl.run("difference",t,e);hr.set;function tI(t){const e=[];if(ci(t,u=>{e.push(u.coordinates)}),e.length<2)throw new Error("Must have at least two features");const r=t.features[0].properties||{},s=eI(e[0],...e.slice(1));return s.length===0?null:s.length===1?Pr(s[0],r):jd(s,r)}var nI=tI;function bu(t){var e;if(t.bbox)e=t.bbox;else if(Array.isArray(t)&&t.length===4)e=t;else if(Array.isArray(t)&&t.length===6)e=[t[0],t[1],t[3],t[4]];else if(t.type==="Feature")e=ar(t);else if(t.type==="FeatureCollection")e=ar(t);else throw new Error("invalid geojson");return{minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}}var rI=class{constructor(t=9){this.tree=new uc(t),this.tree.toBBox=bu}insert(t){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:ar(t),this.tree.insert(t),this}load(t){var e=[];return Array.isArray(t)?t.forEach(function(r){if(r.type!=="Feature")throw new Error("invalid features");r.bbox=r.bbox?r.bbox:ar(r),e.push(r)}):$n(t,function(r){if(r.type!=="Feature")throw new Error("invalid features");r.bbox=r.bbox?r.bbox:ar(r),e.push(r)}),this.tree.load(e),this}remove(t,e){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:ar(t),this.tree.remove(t,e),this}clear(){return this.tree.clear(),this}search(t){var e=this.tree.search(bu(t));return Qe(e)}collides(t){return this.tree.collides(bu(t))}all(){const t=this.tree.all();return Qe(t)}toJSON(){return this.tree.toJSON()}fromJSON(t){return this.tree.fromJSON(t),this}};function Fp(t){return new rI(t)}function iI(t,e){if(e=e??{},!No(e))throw new Error("options is invalid");var r=e.precision,s=e.coordinates,u=e.mutate;if(r=r==null||isNaN(r)?6:r,s=s==null||isNaN(s)?3:s,!t)throw new Error("<geojson> is required");if(typeof r!="number")throw new Error("<precision> must be a number");if(typeof s!="number")throw new Error("<coordinates> must be a number");(u===!1||u===void 0)&&(t=JSON.parse(JSON.stringify(t)));var c=Math.pow(10,r);return Dr(t,function(f){sI(f,c,s)}),t}function sI(t,e,r){t.length>r&&t.splice(r,t.length);for(var s=0;s<t.length;s++)t[s]=Math.round(t[s]*e)/e;return t}function aI(t){if(!t)throw new Error("geojson is required");const e=[];return Rr(t,r=>{oI(r,e)}),Qe(e)}function oI(t,e){let r=[];const s=t.geometry;if(s!==null){switch(s.type){case"Polygon":r=zt(s);break;case"LineString":r=[zt(s)]}r.forEach(u=>{uI(u,t.properties).forEach(c=>{c.id=e.length,e.push(c)})})}}function uI(t,e){const r=[];return t.reduce((s,u)=>{const c=Or([s,u],e);return c.bbox=lI(s,u),r.push(c),u}),r}function lI(t,e){const r=t[0],s=t[1],u=e[0],c=e[1],f=r<u?r:u,h=s<c?s:c,d=r>u?r:u,p=s>c?s:c;return[f,h,d,p]}var cI=Object.defineProperty,hI=Object.defineProperties,fI=Object.getOwnPropertyDescriptors,Yf=Object.getOwnPropertySymbols,gI=Object.prototype.hasOwnProperty,dI=Object.prototype.propertyIsEnumerable,zf=(t,e,r)=>e in t?cI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pI=(t,e)=>{for(var r in e||(e={}))gI.call(e,r)&&zf(t,r,e[r]);if(Yf)for(var r of Yf(e))dI.call(e,r)&&zf(t,r,e[r]);return t},mI=(t,e)=>hI(t,fI(e));function vI(t,e,r={}){if(!t||!e)throw new Error("lines and inputPoint are required arguments");const s=Ke(e);let u=Sn([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}),c=0,f=0,h=-1;return Rr(t,function(d,p,y){h!==y&&(h=y,f=0);const v=zt(d),E=v.length-2;for(let S=0;S<v.length-1;S++){const b=Sn(v[S]),N=Ke(b),O=Sn(v[S+1]),D=Ke(O),L=Bi(b,O,r);let q,H;D[0]===s[0]&&D[1]===s[1]?[q,H]=[D,!0]:N[0]===s[0]&&N[1]===s[1]?[q,H]=[N,!1]:[q,H]=kI(N,D,s);const J=Bi(e,q,r);if(J<u.properties.pointDistance){const z=Bi(b,q,r);u=Sn(q,{lineStringIndex:y,segmentIndex:H&&S+1<=E?S+1:S,totalDistance:c+z,lineDistance:f+z,segmentDistance:z,pointDistance:J,multiFeatureIndex:-1,index:-1,location:-1,dist:1/0}),u.properties=mI(pI({},u.properties),{multiFeatureIndex:u.properties.lineStringIndex,index:u.properties.segmentIndex,location:u.properties.totalDistance,dist:u.properties.pointDistance})}c+=L,f+=L}}),u}function Xr(t,e){const[r,s,u]=t,[c,f,h]=e;return r*c+s*f+u*h}function bs(t,e){const[r,s,u]=t,[c,f,h]=e;return[s*h-u*f,u*c-r*h,r*f-s*c]}function yI(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2))}function Jf(t){const e=yI(t);return[t[0]/e,t[1]/e,t[2]/e]}function Su(t){const e=ut(t[1]),r=ut(t[0]);return[Math.cos(e)*Math.cos(r),Math.cos(e)*Math.sin(r),Math.sin(e)]}function _I(t){const[e,r,s]=t,u=Math.min(Math.max(s,-1),1),c=ri(Math.asin(u));return[ri(Math.atan2(r,e)),c]}function kI(t,e,r){const s=Su(t),u=Su(e),c=Su(r),f=bs(s,u);if(f[0]===0&&f[1]===0&&f[2]===0)return Xr(s,u)>0?[[...e],!0]:[[...r],!1];const h=bs(f,c);if(h[0]===0&&h[1]===0&&h[2]===0)return[[...e],!0];const d=bs(h,f),p=Jf(d),y=[-p[0],-p[1],-p[2]],v=Xr(c,p)>Xr(c,y)?p:y,E=Jf(f),S=Xr(bs(s,v),E),b=Xr(bs(v,u),E);return S>=0&&b>=0?[_I(v),!1]:Xr(s,c)>Xr(u,c)?[[...t],!1]:[[...e],!0]}function EI(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");const r=Kh(t),s=Kh(e);if(r!=="LineString")throw new Error("line must be LineString");if(s==="FeatureCollection")throw new Error("splitter cannot be a FeatureCollection");if(s==="GeometryCollection")throw new Error("splitter cannot be a GeometryCollection");var u=iI(e,{precision:7});switch(t.type!=="Feature"&&(t=ln(t)),s){case"Point":return yl(t,u);case"MultiPoint":return Hf(t,u);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return Hf(t,oa(t,u,{ignoreSelfIntersections:!0}))}}function Hf(t,e){var r=[],s=Fp();return Rr(e,function(u){if(r.forEach(function(h,d){h.id=d}),!r.length)r=yl(t,u).features,s.load(Qe(r));else{var c=s.search(u);if(c.features.length){var f=Gp(u,c);r=r.filter(function(h){return h.id!==f.id}),s.remove(f),$n(yl(f,u),function(h){r.push(h),s.insert(h)})}}}),Qe(r)}function yl(t,e){var r=[],s=zt(t)[0],u=zt(t)[t.geometry.coordinates.length-1];if(Iu(s,Ke(e))||Iu(u,Ke(e)))return Qe([t]);var c=Fp(),f=aI(t);c.load(f);var h=c.search(e);if(!h.features.length)return Qe([t]);var d=Gp(e,h),p=[s],y=fw(f,function(v,E,S){var b=zt(E)[1],N=Ke(e);return S===d.id?(v.push(N),r.push(Or(v)),Iu(N,b)?[N]:[N,b]):(v.push(b),v)},p);return y.length>1&&r.push(Or(y)),Qe(r)}function Gp(t,e){if(!e.features.length)throw new Error("lines must contain features");if(e.features.length===1)return e.features[0];var r,s=1/0;return $n(e,function(u){var c=vI(u,t),f=c.properties.dist;f<s&&(r=u,s=f)}),r}function Iu(t,e){return t[0]===e[0]&&t[1]===e[1]}var Vf=EI;class xI extends is{mode="cut";lineDrawer=new Ro(this.gm,{snappingMarkers:"first",targetShape:"polygon"});cutShapesAllowed=["circle","ellipse","line","rectangle","polygon"];eventHandlers={[`${ae}:draw`]:this.forwardLineDrawerEvent.bind(this),mousemove:this.onMouseMove.bind(this)};onStartAction(){this.lineDrawer.startAction(),this.lineDrawer.on("firstMarkerClick",this.cutPolygonFinished.bind(this))}onEndAction(){this.lineDrawer.endAction()}onMouseMove(e){return We(e)?(this.lineDrawer.featureData||this.fireMarkerPointerUpdateEvent(),{next:!0}):{next:!0}}cutPolygonFinished(e){this.lineDrawer.endShape();const r=oc(e.geoJson),s=this.getBBoxFeaturesByPolygon(r);this.cutFeaturesByPolygon(s,r)}getBBoxFeaturesByPolygon(e){const r=tc(e),s=this.gm.mapAdapter.coordBoundsToScreenBounds(r);return this.gm.mapAdapter.queryFeaturesByScreenCoordinates({queryCoordinates:s,sourceNames:[Q.main]})}cutFeaturesByPolygon(e,r){e.forEach(s=>{if(s.getShapeProperty("disableEdit")!==!0){if(Ps(s.getGeoJson(),r)){this.gm.features.delete(s),this.fireFeatureRemovedEvent(s);return}if(DS(s.getGeoJson(),r)&&this.cutShapesAllowed.includes(s.shape)){if(s.shape==="line"){this.cutLineFeatureByPolygon(s,r);return}this.cutPolygonFeatureByPolygon(s.id,r)}}})}cutLineFeatureByPolygon(e,r){const s=e.getGeoJson(),u=wS(this.gm.mapAdapter,r);let c=!1,f=[];if(u){if(s.geometry.type==="MultiLineString")s.geometry.coordinates.forEach(h=>{if(Ps(Or(h),r))return;const d=Vf(Or(h),r);if(d.features.length===0){f.push(h);return}d.features.filter(p=>!Ps(p,u)).forEach(p=>{c=!0,f.push(p.geometry.coordinates)})});else if(s.geometry.type==="LineString"){const h=Vf(s,r);f=h.features.filter(d=>!Ps(d,u)&&d.geometry.type==="LineString").map(d=>d.geometry.coordinates),h.features.length>0&&(c=!0)}c&&f.length&&(f.length===1?e.updateGeoJsonGeometry({type:"LineString",coordinates:f[0]}):e.updateGeoJsonGeometry({type:"MultiLineString",coordinates:f}),this.fireFeatureUpdatedEvent({sourceFeatures:[e],targetFeatures:[e]}))}}cutPolygonFeatureByPolygon(e,r){const s=this.gm.features.get(Q.main,e);if(!s){te.warn("cutPolygonFeatureByPolygon: featureData not found",e);return}s.convertToPolygon();const u=s.getGeoJson(),c=this.getGeoJsonDifference(u,r);c&&(s.updateGeoJsonGeometry(c.geometry),this.fireFeatureUpdatedEvent({sourceFeatures:[s],targetFeatures:[s]}))}getGeoJsonDifference(e,r){const s=Qe([e,r]),u=nI(s);return u?u.type==="Feature"?u:(u.type==="FeatureCollection"&&te.error("getGeoJsonDifference: FeatureCollection detected (not supported)",u),null):null}}class wI extends is{mode="delete";allowedShapes=[...Yn];eventHandlers={click:this.onMouseClick.bind(this)};onStartAction(){this.gm.markerPointer.enable({invisibleMarker:!0}),this.gm.markerPointer.pauseSnapping()}onEndAction(){this.gm.markerPointer.resumeSnapping(),this.gm.markerPointer.disable()}onMouseClick(e){if(!We(e,{warning:!0}))return{next:!1};const r=this.getFeatureByMouseEvent({event:e,sourceNames:[Q.main]});return r&&this.allowedShapes.includes(r.shape)&&(this.gm.features.delete(r),this.fireFeatureRemovedEvent(r)),{next:!1}}}class bI extends Do{mode="drag";onStartAction(){}onEndAction(){}handleGmEdit(e){return hi(e)?e.action==="marker_move"&&e.lngLatStart&&e.lngLatEnd?(this.previousLngLat||(this.previousLngLat=e.lngLatStart),this.moveFeature(e.featureData,e.lngLatEnd),{next:!1}):(e.action==="marker_captured"?(e.featureData.changeSource({sourceName:Q.temporary,atomic:!0}),this.flags.actionInProgress=!0,this.fireFeatureEditStartEvent({feature:e.featureData}),this.setCursorToPointer()):e.action==="marker_released"&&(this.previousLngLat=null,e.featureData.changeSource({sourceName:Q.main,atomic:!0}),this.fireFeatureEditEndEvent({feature:e.featureData}),this.flags.actionInProgress=!1),{next:!0}):(te.error("EditDrag.handleGmEdit: not an edit event",e),{next:!0})}}class SI extends Do{mode="rotate";allowedShapes=["line","rectangle","polygon","ellipse"];convertFeaturesTypes=["rectangle"];shapeRotateHandlers={marker:this.rotateFeature.bind(this),circle:this.rotateFeature.bind(this),circle_marker:this.rotateFeature.bind(this),text_marker:this.rotateFeature.bind(this),line:this.rotateFeature.bind(this),rectangle:this.rotateFeature.bind(this),polygon:this.rotateFeature.bind(this),ellipse:this.rotateEllipse.bind(this)};onStartAction(){}onEndAction(){}handleGmEdit(e){return hi(e)?this.isFeatureAllowed(e)?{next:!0}:e.action==="marker_move"&&e.lngLatStart&&e.lngLatEnd?(e.markerData?.type==="vertex"?this.moveVertex(e):this.moveSource(e.featureData,e.lngLatStart,e.lngLatEnd),{next:!1}):(e.action==="marker_captured"?(e.featureData.changeSource({sourceName:Q.temporary,atomic:!0}),this.setCursorToPointer(),this.flags.actionInProgress=!0,this.fireFeatureEditStartEvent({feature:e.featureData})):e.action==="marker_released"&&(e.featureData.changeSource({sourceName:Q.main,atomic:!0}),this.fireFeatureEditEndEvent({feature:e.featureData}),this.flags.actionInProgress=!1),{next:!0}):(te.error("EditChange.handleGmEdit: not an edit event",e),{next:!1})}isFeatureAllowed(e){return"featureData"in e&&!this.allowedShapes.includes(e.featureData.shape)}moveVertex(e){const r=e.featureData,s=this.shapeRotateHandlers[r.shape]?.(e)||null;s?(this.fireBeforeFeatureUpdate({features:[r],geoJsonFeatures:[s]}),this.updateFeatureGeoJson({featureData:r,featureGeoJson:s})&&this.convertFeaturesTypes.includes(r.shape)&&r.convertToPolygon()):te.error("EditRotate.moveVertex: invalid geojson",s,e)}rotateEllipse(e){const{featureData:r}=e;if(r.shape!=="ellipse")return te.error("EditRotate.rotateEllipse: invalid shape type",r),null;const s=r.getShapeProperty("center"),u=r.getShapeProperty("xSemiAxis"),c=r.getShapeProperty("ySemiAxis"),f=r.getShapeProperty("angle");if(!Array.isArray(s)||typeof u!="number"||typeof c!="number"||typeof f!="number")return te.error("rotateEllipse: missing center, xSemiAxis, ySemiAxis or angle in the featureData",r),null;const h=this.calculateRotationAngle(s,e.lngLatStart,e.lngLatEnd,!1);return Ao({center:s,xSemiAxis:u,ySemiAxis:c,angle:f+h})}rotateFeature(e){const r=e.featureData,s=Ht(r.getGeoJson()),u=no(tl(s)),c=this.calculateRotationAngle(u,e.lngLatStart,e.lngLatEnd);return s.geometry=ww(s,c,{pivot:u}).geometry,s}calculateRotationAngle(e,r,s,u=!0){const c=eo(e,r),f=eo(e,s)-c;return u?(f+360)%360:f}}const fo={drag:bI,change:NS,rotate:SI,scale:null,copy:null,cut:xI,split:null,union:null,difference:null,line_simplification:null,lasso:null,delete:wI},II=(t,e)=>fo[e]?new fo[e](t):(te.error(`Edit "${e}" is not available`),null);class MI extends Io{eventHandlers={[`${ae}:edit`]:this.handleEditEvent.bind(this)};constructor(e,r){super(e),r.attachEvents(this.eventHandlers)}handleEditEvent(e){if(!hi(e))return{next:!0};const r=`${e.actionType}__${e.mode}`;return e.action==="mode_start"?(this.trackExclusiveModes(e),this.start(r,e),this.trackRelatedModes(e)):e.action==="mode_end"&&(this.trackRelatedModes(e),this.end(r)),{next:!0}}start(e,r){if(r.action!=="mode_start")return;const s=II(this.gm,r.mode);s&&(e in this.gm.actionInstances&&te.error(`Action instance "${e}" already exists`),this.gm.actionInstances[e]=s,s.startAction())}end(e){const r=this.gm.actionInstances[e];r instanceof is?(r.endAction(),delete this.gm.actionInstances[e]):console.error(`Wrong action instance for edit event "${e}": `,r)}}class Bp extends mr{mode="shape_markers";pinEnabled=this.gm.options.controls.helper.pin?.active||!1;previousPosition=null;activeMarker=null;activeFeatureData=null;sharedMarkers=[];allowedShapes=["circle","line","rectangle","polygon","ellipse"];edgeMarkersAllowed=!1;edgeMarkerAllowedShapes=["line","rectangle","polygon"];shapeMarkerAllowedModes=["drag","change","cut","split"];eventHandlers={[`${ae}:draw`]:this.handleGmDraw.bind(this),[`${ae}:edit`]:this.handleGmEdit.bind(this),mousedown:this.onMouseDown.bind(this),touchstart:this.onMouseDown.bind(this),mouseup:this.onMouseUp.bind(this),touchend:this.onMouseUp.bind(this),mousemove:this.onMouseMove.bind(this),touchmove:this.onMouseMove.bind(this),contextmenu:this.onMouseRightButtonClick.bind(this)};throttledMethods=Fr({sendMarkerMoveEvent:this.sendMarkerMoveEvent,sendMarkerRightClickEvent:this.sendMarkerRightClickEvent},this,this.gm.options.settings.throttlingDelay);debouncedMethods=Dw({refreshMarkers:this.refreshMarkers},this,this.gm.options.settings.throttlingDelay*10);get pinHelperInstance(){return this.pinEnabled&&Object.values(this.gm.actionInstances).find(qw)||null}onStartAction(){this.isShapeMarkerAllowed()&&this.gm.markerPointer.enable({invisibleMarker:!0}),this.edgeMarkersAllowed=this.gm.getActiveEditModes().includes("change"),this.addMarkers()}onEndAction(){this.gm.markerPointer.disable(),this.removeMarkers()}setPin(e){this.pinEnabled=e}onMouseDown(e){const r=["mousedown","touchstart"];if(!We(e,{warning:!0})||!r.includes(e.type)||Gw(e))return{next:!0};if(e.type==="mousedown"&&e.originalEvent.button!==0)return{next:!0};const s=this.getFeatureMarkerByMouseEvent(e);return this.activeMarker=s||null,this.activeFeatureData=s?.instance.parent||null,this.activeMarker&&this.activeFeatureData?(this.previousPosition=lc(this.activeMarker.instance),this.gm.mapAdapter.setDragPan(!1),this.activeMarker.type==="edge"&&this.sendMarkerEvent("edge_marker_click",this.activeFeatureData,this.activeMarker),this.pinEnabled&&this.pinHelperInstance?(this.sharedMarkers=this.pinHelperInstance.getSharedMarkers(this.activeMarker.position.coordinate),this.sharedMarkers.forEach(u=>this.snappingHelper?.addExcludedFeature(u.featureData))):this.snappingHelper?.addExcludedFeature(this.activeFeatureData),this.sendMarkerEvent("marker_captured",this.activeFeatureData,this.activeMarker),{next:!1}):{next:!0}}onMouseUp(){if(!this.activeMarker)return{next:!0};const e={featureData:this.activeFeatureData,markerData:this.activeMarker};return this.activeMarker=null,this.activeFeatureData=null,this.sharedMarkers=[],this.snappingHelper?.clearExcludedFeatures(),this.previousPosition=null,this.gm.mapAdapter.setDragPan(!0),e.featureData&&e.markerData?(this.sendMarkerEvent("marker_released",e.featureData,e.markerData),{next:!1}):(te.debug("ShapeMarkersHelper.onMouseUp: no active marker or featureData",e),{next:!0})}onMouseMove(e){return!this.activeMarker||!We(e,{warning:!0})?{next:!0}:(this.throttledMethods.sendMarkerMoveEvent(e),{next:!1})}onMouseRightButtonClick(e){if(!We(e,{warning:!0}))return{next:!0};const r=this.getFeatureMarkerByMouseEvent(e);return r&&r.instance.parent?(this.throttledMethods.sendMarkerRightClickEvent(r.instance.parent,r),{next:!1}):{next:!0}}isShapeMarkerAllowed(){return vk(this.shapeMarkerAllowedModes,this.gm.getActiveEditModes()).length>0}convertToVertexMarker(e){if(e.type==="edge"&&e.instance.parent){const r=e.position,s=e.instance.parent;this.removeMarker(e);const u=this.createMarker({type:"vertex",positionData:r,parentFeature:s}),c=s.getGeoJson(),f=ep(c,r.coordinate);if(f){const h=f.path.join("."),d=s.markers.get(h);return d&&this.removeMarker(d),s.markers.set(h,u),u}}return te.error("ShapeMarkersHelper.convertToVertexMarker: invalid marker type",e),e}getFeatureMarkerByMouseEvent(e){const r=this.gm.features.getFeatureByMouseEvent({event:e,sourceNames:[Q.main]});if(r?.parent?.markers){const s=Ok(r.parent.markers,u=>u.instance===r);if(s?.type!=="dom")return s}return null}addMarkers(){this.gm.features.forEach(e=>{if(!e||!this.allowedShapes.includes(e.shape)||e.getShapeProperty("disableEdit")===!0)return;this.addCenterMarker(e);const r=this.getAllShapeSegments(e),s=this.getEndMarkerIndexes(e);r.forEach((u,c)=>{if(this.isMarkerIndexAllowed(e.shape,c,r.length)){const f=this.createOrUpdateVertexMarker(u.segment.start,e);if(e.markers.set(f.markerKey,f.markerData),s.has(c)){const h=this.createOrUpdateVertexMarker(u.segment.end,e);e.markers.set(h.markerKey,h.markerData)}}if(this.isEdgeMarkerAllowed(e)){const f=this.createOrUpdateEdgeMarker(u,e);e.markers.set(f.markerKey,f.markerData)}})})}addCenterMarker(e){const r=e.getShapeProperty("center");if(r){const s=this.createMarker({type:"center",positionData:{path:[],coordinate:r},parentFeature:e});e.markers.set("center",s)}}getAllShapeSegments(e){const r=e.getGeoJson(),s=[];return ec(r,(u,c)=>{s.push({segment:u,middle:this.getSegmentMiddlePosition(u),edgeMarkerKey:this.getEdgeMarkerKey(c)})}),s}isEdgeMarkerAllowed(e){return this.edgeMarkersAllowed&&this.edgeMarkerAllowedShapes.includes(e.shape)}isMarkerIndexAllowed(e,r,s){const u=Math.floor(s/4);return e==="circle"?(r+u/2)%u===0:e==="ellipse"?r%u===0:!0}getEdgeMarkerKey(e){return`edge.${e}`}getEndMarkerIndexes(e){const r=e.getGeoJson().geometry;return e.shape!=="line"||!["LineString","MultiLineString"].includes(r.type)?new Set:r.type==="MultiLineString"?r.coordinates.reduce((s,u)=>(s.indexes.add(s.sum+u.length-2),s.sum+=u.length-1,s),{sum:0,indexes:new Set}).indexes:new Set([r.coordinates.length-2])}getSegmentMiddlePosition(e){const r=this.gm.mapAdapter.project(e.start.coordinate),s=this.gm.mapAdapter.project(e.end.coordinate),u=[(r[0]+s[0])/2,(r[1]+s[1])/2],c=e.start.path.slice(0,e.start.path.length-1).concat([-1]);return{coordinate:this.gm.mapAdapter.unproject(u),path:c}}removeMarkers(){this.gm.features.forEach((e,r)=>{const s=this.gm.features.get(Q.main,r);s&&(s.markers.forEach(u=>{u.type!=="dom"?this.gm.features.delete(u.instance):te.error("Non a FeatureData marker",u)}),s.markers=new Map)})}removeMarker(e){if(e.type==="dom"){te.error("Wrong marker type",e);return}const r=e.instance.parent;if(!r){te.error("Missing parent feature data",e);return}try{r.markers.forEach((s,u)=>{if(s===e)throw this.gm.features.delete(s.instance),r.markers.delete(u),new Error("break")})}catch{}}handleGmDraw(e){return Oo(e)?(["feature_created","mode_start"].includes(e.action)&&this.debouncedMethods.refreshMarkers(),{next:!0}):(te.error("ShapeMarkersHelper.handleGmDraw: not a draw event",e),{next:!0})}refreshMarkers(){this.gm.options.isModeEnabled("helper","shape_markers")&&(this.removeMarkers(),this.addMarkers())}handleGmEdit(e){return hi(e)?(e.action==="feature_updated"&&this.handleShapeUpdate(e),{next:!0}):(te.error("ShapeMarkersHelper.handleGmEdit: not an edit event",e),{next:!0})}handleShapeUpdate(e){const r=e.targetFeatures[0];if(!r){te.error("ShapeMarkersHelper.handleShapeUpdate: no featureData",e);return}this.activeMarker?.type==="edge"&&(this.activeMarker=this.convertToVertexMarker(this.activeMarker));const s=this.getAllShapeSegments(r),u=new Set(r.markers.keys()),c=this.getEndMarkerIndexes(r);s.forEach((f,h)=>{if(this.isMarkerIndexAllowed(r.shape,h,s.length)){const d=this.createOrUpdateVertexMarker(f.segment.start,r);if(u.delete(d.markerKey),c.has(h)){const p=this.createOrUpdateVertexMarker(f.segment.end,r);u.delete(p.markerKey)}}if(this.isEdgeMarkerAllowed(r)){const d=this.createOrUpdateEdgeMarker(f,r);u.delete(d.markerKey)}}),this.updateCenterMarkerPosition(r),u.delete("center"),u.forEach(f=>{const h=r.markers.get(f);h&&h.type!=="dom"?this.gm.features.delete(h.instance):te.error("Non a FeatureData marker"),r.markers.delete(f)})}createOrUpdateVertexMarker(e,r){const s=e.path.join(".");let u=r.markers.get(s)||null;if(u&&u?.type!=="vertex")throw new Error(`Invalid marker type "${u?.type}" for edge marker`);return u?(rl(u.position.coordinate,e.coordinate)||this.gm.features.updateMarkerFeaturePosition(u.instance,e.coordinate),u.position=e):(u=this.createMarker({type:"vertex",positionData:e,parentFeature:r}),r.markers.set(s,u)),{markerKey:s,markerData:u}}createOrUpdateEdgeMarker(e,r){let s=r.markers.get(e.edgeMarkerKey)||null;if(s&&s?.type!=="edge")throw new Error(`Invalid marker type "${s?.type}" for edge marker`);return s?(rl(s.position.coordinate,e.middle.coordinate)||s.instance.updateGeoJsonGeometry({type:"Point",coordinates:e.middle.coordinate}),s.position=e.middle,s.segment=e.segment):(s=this.createMarker({type:"edge",positionData:e.middle,segment:e.segment,parentFeature:r}),r.markers.set(e.edgeMarkerKey,s)),{markerKey:e.edgeMarkerKey,markerData:s}}updateCenterMarkerPosition(e){const r=e.markers.get("center")||null,s=e.getShapeProperty("center");r&&r.type!=="dom"&&s&&(r.instance.updateGeoJsonGeometry({type:"Point",coordinates:s}),r.position.coordinate=s)}sendMarkerEvent(e,r,s){const u={name:`${ae}:edit:marker`,level:"system",actionType:"edit",mode:"change",action:e,featureData:r,markerData:s};this.gm.events.fire(`${ae}:edit`,u)}sendMarkerRightClickEvent(e,r){const s={name:`${ae}:edit:marker`,level:"system",actionType:"edit",mode:"change",action:"marker_right_click",featureData:e,markerData:r};this.gm.events.fire(`${ae}:edit`,s)}sendMarkerMoveEvent(e){const r=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();this.activeMarker&&this.activeFeatureData&&(this.pinEnabled?this.sharedMarkers:[{markerData:this.activeMarker,featureData:this.activeFeatureData}]).forEach(s=>{if(this.previousPosition){const u={name:`${ae}:edit:marker_move`,level:"system",actionType:"edit",mode:"drag",action:"marker_move",featureData:s.featureData,markerData:s.markerData,lngLatStart:this.previousPosition,lngLatEnd:r};this.gm.events.fire(`${ae}:edit`,u)}}),this.previousPosition=r}createMarker({type:e,segment:r,positionData:s,parentFeature:u}){const c=s.coordinate,f=this.gm.features.createMarkerFeature({sourceName:u.sourceName,parentFeature:u,type:e,coordinate:c});if(!f)throw new Error(`Missine feature data for the "${e}" marker`);if(e==="edge"&&r)return{type:e,instance:f,position:Ht(s),segment:r};if(e==="vertex"||e==="center")return{type:e,instance:f,position:Ht(s)};throw new Error(`Invalid marker type "${e}" with segment: ${r}`)}}class NI extends mr{mode="snapping";tolerance=18;lineSnappingShapes=["circle","line","rectangle","polygon","snap_guide"];eventHandlers={};shapeSnappingHandlers={marker:this.getPointsSnapping.bind(this),circle:this.getLineSnapping.bind(this),circle_marker:this.getPointsSnapping.bind(this),text_marker:this.getPointsSnapping.bind(this),line:this.getLineSnapping.bind(this),rectangle:this.getLineSnapping.bind(this),polygon:this.getLineSnapping.bind(this),snap_guide:this.getLineSnapping.bind(this)};excludedFeature=new Set;customSnappingLngLats=new Map;customSnappingFeatures=new Set;onStartAction(){this.gm.markerPointer.setSnapping(!0)}onEndAction(){this.gm.markerPointer.setSnapping(!1)}addExcludedFeature(e){this.excludedFeature.add(e)}clearExcludedFeatures(){this.excludedFeature.clear()}addCustomSnappingFeature(e){this.customSnappingFeatures.add(e)}removeCustomSnappingFeature(e){this.customSnappingFeatures.delete(e)}clearCustomSnappingFeature(){this.customSnappingFeatures.clear()}setCustomSnappingCoordinates(e,r){this.customSnappingLngLats.set(e,r)}clearCustomSnappingCoordinates(e){this.customSnappingLngLats.delete(e)}getSnappedLngLat(e,r){let s=this.getCustomLngLatsSnapping(r);if(s)return s;const u=this.getFeaturesInPointBounds(r).filter(c=>!this.excludedFeature.has(c));return s=this.getFeaturePointsSnapping(u,e,r),s||(s=this.getFeatureLinesSnapping(u,e,r),s)?s:e}getCustomLngLatsSnapping(e){const r={distance:1/0,lngLat:null};return this.customSnappingLngLats.forEach(s=>{s.forEach(u=>{const c=this.gm.mapAdapter.project(u),f=qs(e,c);f<this.tolerance&&f<r.distance&&(r.distance=f,r.lngLat=u)})}),r.lngLat}getFeaturePointsSnapping(e,r,s){let u=e.map(c=>({shape:c.shape,...this.getPointsSnapping(c,r,s)})).filter(c=>c.distance<this.tolerance);return u.length?(u=Sh(u,["distance"]),u[0].lngLat):null}getFeatureLinesSnapping(e,r,s){let u=e.filter(c=>this.lineSnappingShapes.includes(c.shape)).map(c=>{const f=this.shapeSnappingHandlers[c.shape];return f?{shape:c.shape,...f(c,r,s)}:null}).filter(c=>c!==null&&c.distance<this.tolerance);return u.length?(u=Sh(u,["distance"]),u[0].lngLat):null}getFeaturesInPointBounds(e){const r=[[e[0]-this.tolerance,e[1]-this.tolerance],[e[0]+this.tolerance,e[1]+this.tolerance]];return this.gm.features.getFeaturesByScreenBounds({bounds:r,sourceNames:[Q.main,Q.temporary]}).filter(s=>s.temporary?this.customSnappingFeatures.has(s):!0)||[]}getPointsSnapping(e,r,s){const u=e.getGeoJson(),c={distance:1/0,coord:null};return rs(u,f=>{const h=this.gm.mapAdapter.project(f.coordinate),d=qs(s,h);d<this.tolerance&&d<c.distance&&(c.distance=d,c.coord=f.coordinate)},!0),{lngLat:c.coord?c.coord:r,distance:c.distance}}getLineSnapping(e,r,s){const u=e.getGeoJson();return this.getNearestLinePointData(u,r,s)}getNearestLinePointData(e,r,s){const u={lngLat:r,distance:1/0},c=this.gm.mapAdapter.getEuclideanNearestLngLat(e,r),f=this.gm.mapAdapter.project(c);return u.distance=qs(f,s),u.distance<this.tolerance&&(u.lngLat=c),u}}class LI extends mr{mode="zoom_to_features";eventHandlers={};onStartAction(){this.fitMapToFeatures(),setTimeout(()=>{this.gm.options.disableMode("helper","zoom_to_features")})}onEndAction(){}fitMapToFeatures(){const e=this.gm.features.asGeoJsonFeatureCollection({sourceNames:[Q.main,...nt?[Q.standby]:[]]}),r=Yd(e),s=[[r[0],r[1]],[r[2],r[3]]];try{this.gm.mapAdapter.fitBounds(s,{padding:20})}catch{te.warn("Wrong bounds for zooming to features",s,e)}}}const go={shape_markers:Bp,pin:null,snapping:NI,snap_guides:null,measurements:null,auto_trace:null,geofencing:null,zoom_to_features:LI,click_to_edit:null},CI=(t,e)=>go[e]?new go[e](t):(te.error(`Helper "${e}" is not available`),null);class AI extends Io{eventHandlers={[`${ae}:helper`]:this.handleHelperEvent.bind(this)};constructor(e,r){super(e),r.attachEvents(this.eventHandlers)}handleHelperEvent(e){if(!To(e))return{next:!0};const r=`${e.actionType}__${e.mode}`;return e.action==="mode_start"?(this.trackExclusiveModes(e),this.start(r,e),this.trackRelatedModes(e)):e.action==="mode_end"&&(this.trackRelatedModes(e),this.end(r)),{next:!0}}start(e,r){const s=CI(this.gm,r.mode);s&&(e in this.gm.actionInstances&&te.error(`Action instance "${e}" already exists`),this.gm.actionInstances[e]=s,s.startAction())}end(e){const r=this.gm.actionInstances[e];r instanceof mr?(r.endAction(),delete this.gm.actionInstances[e]):console.error(`Wrong action instance for edit event "${e}":`,r)}}class TI{gm;bus;listeners={};constructor(e){this.gm=e,this.bus=new ow(this.gm),this.listeners={draw:new Mb(this.gm,this.bus),edit:new MI(this.gm,this.bus),helper:new AI(this.gm,this.bus),control:new uw(this.gm,this.bus)}}fire(e,r){this.listeners[r.actionType]||te.error(`Can't find event listener for "${r.actionType}" event type`),this.bus.fireEvent(e,r)}}const Xf=5e3;class PI{gm;updateStorage;autoUpdatesEnabled=!0;delayedSourceUpdateMethods;pendingUpdatePromises;constructor(e){this.gm=e,this.updateStorage=Object.fromEntries(el(Q).map(r=>[r,[]])),this.pendingUpdatePromises={},this.delayedSourceUpdateMethods=Object.fromEntries(el(Q).map(r=>[r,Cg(()=>this.updateSourceActual(r),this.gm.options.settings.throttlingDelay)]))}updatesPending(e){return!!this.updateStorage[e]?.length||!!(this.pendingUpdatePromises[e]?.length??0)}getFeatureId(e){const r=e.properties?.[Gt]??e.id;return r==null&&console.warn("Feature id is null or undefined",e),r}updateSource({sourceName:e,diff:r}){r&&this.updateStorage[e].push(r),this.delayedSourceUpdateMethods[e]()}updateSourceActual(e){const r=this.gm.features.sources[e];if(this.autoUpdatesEnabled&&r){if(!r.loaded){setTimeout(()=>{this.updateSourceActual(e)},this.gm.options.settings.throttlingDelay);return}const s=this.getCombinedDiff(e);if(s){const u=r.updateData(s);this.addPendingPromise(e,u)}this.updateStorage[e].length>0&&setTimeout(()=>this.updateSourceActual(e),this.gm.options.settings.throttlingDelay)}}addPendingPromise(e,r){this.pendingUpdatePromises[e]||(this.pendingUpdatePromises[e]=[]),this.pendingUpdatePromises[e].push(r),r.finally(()=>{const s=this.pendingUpdatePromises[e];if(s){const u=s.indexOf(r);u!==-1&&s.splice(u,1),s.length===0&&delete this.pendingUpdatePromises[e]}})}async waitForPendingUpdates(e){const r=this.gm.features.sources[e];if(r){for(;this.updateStorage[e]?.length||this.pendingUpdatePromises[e]?.length;){if(this.updateStorage[e]?.length){const u=this.getCombinedDiff(e);if(u){const c=r.updateData(u);this.addPendingPromise(e,c)}}const s=this.pendingUpdatePromises[e];s?.length&&await Promise.all(s),await new Promise(u=>setTimeout(u,0))}await new Promise(s=>requestAnimationFrame(s))}}withAtomicSourcesUpdate(e){try{return this.autoUpdatesEnabled=!1,e()}finally{Ze(this.gm.features.sources).forEach(r=>{this.updateSource({sourceName:r})}),this.autoUpdatesEnabled=!0}}getCombinedDiff(e){let r={remove:[],add:[],update:[]};for(let s=0;s<Xf&&this.updateStorage[e][s]!==void 0;s+=1)r=this.mergeGeoJsonDiff(r,this.updateStorage[e][s]);return this.updateStorage[e]=this.updateStorage[e].slice(Xf),Object.values(r).find(s=>s.length)?r:null}mergeGeoJsonDiff(e,r){const s=e??{add:[],update:[],remove:[]},u=r??{add:[],update:[],remove:[]},c=new Set(u.remove),f=s.add?.filter(p=>!c.has(this.getFeatureId(p)))||[],h=s.update?.filter(p=>!c.has(this.getFeatureId(p)))||[],d=[];return u.update?.forEach(p=>{const y=f.findIndex(E=>this.getFeatureId(E)===this.getFeatureId(p)),v=h.findIndex(E=>this.getFeatureId(E)===this.getFeatureId(p));if(y===-1&&v===-1){d.push(p);return}y!==-1&&(f[y]=p),v!==-1&&(h[v]=p)}),{add:[...f,...u.add||[]],update:[...h,...d],remove:[...s.remove||[],...u.remove||[]]}}}class Up{isInstanceAvailable(){return this.sourceInstance?!0:(te.error("Source instance is not available"),!1)}}class OI{gm;featureCounter=0;featureStore=new Map;featureStoreAllowedSources=[Q.main,Q.temporary];sources;defaultSourceName=Q.main;updateManager;layers;constructor(e){this.gm=e,this.updateManager=new PI(e),this.sources=Object.fromEntries(el(Q).map(r=>[r,null])),this.layers=[]}get forEach(){return this.filteredForEach(e=>!e.temporary)}get tmpForEach(){return this.filteredForEach(e=>e.temporary)}init(){if(Object.values(this.sources).some(e=>e!==null)){te.warn("features.init(): features are already initialized");return}Ze(this.sources).forEach(e=>{this.sources[e]=this.createSource(e)}),this.hydrateFromExistingSources(),this.gm.options.settings.useDefaultLayers&&(this.layers=this.createLayers())}hydrateFromExistingSources(){let e=0;Ze(this.sources).forEach(r=>{const s=this.sources[r];if(s)try{const u=s.getGeoJson();if(u&&"features"in u)for(const c of u.features){const f=c.properties?.[Gt];if(!f)continue;if(typeof f=="string"&&f.startsWith("feature-")){const p=parseInt(f.replace("feature-",""),10);!isNaN(p)&&p>e&&(e=p)}if(this.featureStore.has(f))continue;const h=c,d=new Ui({gm:this.gm,id:f,parent:null,source:s,geoJsonShapeFeature:Ht(h),skipSourceUpdate:!0});this.featureStore.set(f,d)}}catch{}}),e>this.featureCounter&&(this.featureCounter=e)}getNewFeatureId(e){if(this.featureCounter+=1,this.gm.options.settings.idGenerator)return this.gm.options.settings.idGenerator(e);let r=`feature-${this.featureCounter}`;for(;this.featureStore.has(r);)this.featureCounter+=1,r=`feature-${this.featureCounter}`;return r}filteredForEach(e){return r=>{this.featureStore.forEach((s,u,c)=>{e(s)&&r(s,u,c)})}}has(e,r){const s=this.featureStore.get(r);return!!s&&s?.source===this.sources[e]}get(e,r){const s=this.featureStore.get(r)||null;return s?.source===this.sources[e]?s:null}add(e){if(this.featureStore.has(e.id)){te.error(`features.add: feature with the id "${e.id}" already exists`);return}this.featureStoreAllowedSources.includes(e.source.id)&&this.featureStore.set(e.id,e)}setDefaultSourceName(e){this.defaultSourceName=e}createSource(e){const r=this.gm.mapAdapter.addSource(e,{type:"FeatureCollection",features:[]});if(r)return r;throw new Error(`Features: failed to create the source: "${e}"`)}delete(e){let r;e instanceof Ui?r=e:r=this.featureStore.get(e)||null,r?(this.featureStore.delete(r.id),r.delete()):te.error(`features.delete: feature "${e}" not found`)}deleteAll(){this.featureStore.forEach(e=>{e.delete()}),this.featureStore.clear()}getFeatureByMouseEvent({event:e,sourceNames:r}){if(!We(e,{warning:!0}))return null;const s=[e.point.x,e.point.y],u=this.gm.mapAdapter.queryFeaturesByScreenCoordinates({queryCoordinates:s,sourceNames:r});return u.length===0?null:u.find(c=>Fd.includes(c.shape))??u[0]}getFeaturesByGeoJsonBounds({geoJson:e,sourceNames:r}){const s=tc(e),u=this.gm.mapAdapter.coordBoundsToScreenBounds(s);return this.getFeaturesByScreenBounds({bounds:u,sourceNames:r})}getFeaturesByScreenBounds({bounds:e,sourceNames:r}){return this.gm.mapAdapter.queryFeaturesByScreenCoordinates({queryCoordinates:e,sourceNames:r})}createFeature({featureId:e,shapeGeoJson:r,parent:s,sourceName:u,imported:c}){const f=this.sources[u];if(!f)return te.error("Features.createFeature Missing source for feature creation"),null;const h=e??r.properties[Gt]??this.getNewFeatureId(r);if(this.featureStore.get(h))return te.error(`Features.createFeature: feature with the id "${h}" already exists`,this.featureStore.get(h)),null;const d=new Ui({gm:this.gm,id:h,parent:s||null,source:f,geoJsonShapeFeature:Ht(r)});return this.add(d),!d.temporary&&!c&&this.fireFeatureCreatedEvent(d),this.featureCounter+=1,d}importGeoJson(e,r){const s=r??{},u="features"in e?e.features:[e],c={stats:{total:0,success:0,failed:0,overwritten:0},addedFeatures:[]};return u.forEach(f=>{let h=null;c.stats.total+=1;const d=IS(f);if(d){if(s.idPropertyName){const p=MS(d,s.idPropertyName);p&&(d.id=p)}if(s.overwrite){const p=d.id??d.properties?.[Gt];p&&this.featureStore.has(p)&&(this.delete(p),c.stats.overwritten+=1)}h=this.importGeoJsonFeature(d)}h?(c.addedFeatures.push(h),c.stats.success+=1):c.stats.failed+=1}),c}importGeoJsonFeature(e){const r=this.defaultSourceName,s=this.getFeatureShapeByGeoJson(e);return s?this.createFeature({featureId:e.id,shapeGeoJson:e,sourceName:r,imported:!0}):(te.error("features.addGeoJsonFeature: unknown shape",s),null)}getAll(){return this.exportGeoJson()}exportGeoJson({allowedShapes:e,idPropertyName:r}={allowedShapes:void 0}){return this.asGeoJsonFeatureCollection({sourceNames:[Q.main,...nt?[Q.standby]:[]],shapeTypes:e||[...Yn],idPropertyName:r,useMapLibreSource:!1})}exportGeoJsonFromSource({allowedShapes:e,idPropertyName:r}={allowedShapes:void 0}){return this.asGeoJsonFeatureCollection({sourceNames:[Q.main,...nt?[Q.standby]:[]],shapeTypes:e||[...Yn],idPropertyName:r,useMapLibreSource:!0})}asGeoJsonFeatureCollection({shapeTypes:e,sourceNames:r,idPropertyName:s,useMapLibreSource:u=!1}){const c={type:"FeatureCollection",features:[]};return s??=Gt,r.forEach(f=>{const h=this.sources[f];h&&(u?h.getGeoJson():h.getGmGeoJson()).features.filter(d=>!!d).forEach(d=>{const p=this.get(f,d.id);if(!p)return;const y=d.properties[Gt];s!==Gt&&(d.properties[s]=y,delete d.properties[Gt]),(e===void 0||e.includes(p.shape))&&c.features.push({...d,id:y})})}),c}convertSourceToGm(e){const r=[],s=e.getGeoJson(),u="features"in s?s.features:[s];return this.gm.mapAdapter.getSource(e.id).remove(),u.forEach(c=>{const f=this.addGeoJsonFeature({shapeGeoJson:c,defaultSource:!0});f&&r.push(f)}),r}addGeoJsonFeature({shapeGeoJson:e,sourceName:r,defaultSource:s}){let u;if(s?(u=this.defaultSourceName,r&&te.warn("features.addGeoJsonFeature: default source is set, sourceName is ignored")):u=r||null,!u)return te.error("features.addGeoJsonFeature: missing sourceName"),null;const c=this.getFeatureShapeByGeoJson(e);return c?this.createFeature({featureId:e.id,shapeGeoJson:{...e,properties:{...e.properties,shape:c}},sourceName:u}):(te.error("features.addGeoJsonFeature: unknown shape",c),null)}createLayers(){const e=[];return Ze(this.sources).forEach(r=>{Ze(this.gm.options.layerStyles).forEach(s=>{this.gm.options.layerStyles[s][r].forEach(u=>{const c=this.createGenericLayer({sourceName:r,shapeNames:[s],partialStyle:u});c&&e.push(c)})})}),e}createGenericLayer({sourceName:e,shapeNames:r,partialStyle:s}){const u=this.getGenericLayerName({sourceName:e,shapeNames:r,partialStyle:s});if(!u)throw new Error(`Can't create a layer, for ${{sourceName:e,shapeNames:r,partialStyle:s}}`);const c={...s,id:u,source:e,filter:["in",["get",`${it}shape`],["literal",r]]};return this.gm.mapAdapter.addLayer(c)}getGenericLayerName({sourceName:e,shapeNames:r,partialStyle:s}){const u=r.length===1?r[0]:"mixed",c=h=>`${e}-${u}__${s.type}-layer-${h}`;let f=null;for(let h=0;h<100;h+=1){const d=c(h);if(!this.gm.mapAdapter.getLayer(d))return f=d,f}return null}getFeatureShapeByGeoJson(e){const r={Point:"marker",LineString:"line",MultiLineString:"line",Polygon:"polygon",MultiPolygon:"polygon"},s=e.properties;return s?.shape&&Yn.includes(s?.shape)?s?.shape:r[e.geometry.type]||null}createMarkerFeature({parentFeature:e,coordinate:r,type:s,sourceName:u}){return this.createFeature({sourceName:u,parent:e,shapeGeoJson:{type:"Feature",geometry:{type:"Point",coordinates:r},properties:{[`${it}shape`]:`${s}_marker`}}})}updateMarkerFeaturePosition(e,r){e.updateGeoJsonGeometry({type:"Point",coordinates:r})}fireFeatureCreatedEvent(e){if(ur(e.shape,Yn)){const r={name:`${ae}:draw:feature_created`,level:"system",actionType:"draw",mode:e.shape,action:"feature_created",featureData:e};this.gm.events.fire(`${ae}:draw`,r)}}}class jp{getEuclideanNearestLngLat(e,r){const s=this.project(r);let u=[0,0],c=1/0;return ec(e,f=>{const h=this.project(f.start.coordinate),d=this.project(f.end.coordinate),p=tp(h,d,s),y=qs(s,p);y<c&&(c=y,u=[p[0],p[1]])}),this.unproject(u)}getDistance(e,r){return Zd(e,r,{units:"meters"})}}class qp{isInstanceAvailable(){return this.layerInstance?!0:(te.error("layerInstance is not available"),!1)}}class Mu extends qp{gm;layerInstance=null;mapInstance;constructor({gm:e,layerId:r,options:s}){super(),this.gm=e,this.mapInstance=this.gm.mapAdapter.mapInstance,s?this.layerInstance=this.createLayer(s):this.layerInstance=this.mapInstance.getLayer(r)||null}get id(){if(!this.isInstanceAvailable())throw new Error("Layer instance is not available");return this.layerInstance.id}get source(){if(!this.isInstanceAvailable())throw new Error("Layer instance is not available");return this.layerInstance.source}createLayer(e){let r=this.mapInstance.getLayer(e.id);return r?te.warn(`Layer "${e.id}" already exists, skipping`):(this.mapInstance.addLayer(e),r=this.mapInstance.getLayer(e.id)),r??null}remove(){this.isInstanceAvailable()&&this.mapInstance.removeLayer(this.id),this.layerInstance=null}}class RI extends Mo{markerInstance;constructor({mapInstance:e,options:r,lngLat:s}){super(),this.markerInstance=new _l.Marker(r).setLngLat(s).addTo(e)}getElement(){return this.isMarkerInstanceAvailable()&&this.markerInstance?.getElement()||null}setLngLat(e){this.isMarkerInstanceAvailable()&&this.markerInstance?.setLngLat(e)}getLngLat(){return this.isMarkerInstanceAvailable()?this.markerInstance?.getLngLat().toArray()||[0,0]:[0,0]}remove(){this.markerInstance?.remove()}}class Yp{isInstanceAvailable(){return this.popupInstance?!0:(te.error("Popup instance is not available"),!1)}}class DI extends Yp{popupInstance;constructor({mapInstance:e,options:r,lngLat:s}){super(),this.popupInstance=new _l.Popup(r).addTo(e),s&&this.setLngLat(s)}getLngLat(){return this.isInstanceAvailable()?this.popupInstance.getLngLat().toArray()||[0,0]:[0,0]}setLngLat(e){this.isInstanceAvailable()&&this.popupInstance.setLngLat(e)}setHtml(e){this.isInstanceAvailable()&&this.popupInstance.setHTML(e)}remove(){this.isInstanceAvailable()&&this.popupInstance.remove()}}class $f extends Up{gm;mapInstance;sourceInstance;constructor({gm:e,geoJson:r,sourceId:s}){super(),this.gm=e,this.mapInstance=this.gm.mapAdapter.mapInstance,r?this.sourceInstance=this.createSource({geoJson:r,sourceId:s}):this.sourceInstance=this.mapInstance.getSource(s)||null}get id(){if(!this.isInstanceAvailable())throw new Error("Source instance is not available");return this.sourceInstance.id}get loaded(){return this.mapInstance.isSourceLoaded(this.id)}createSource({geoJson:e,sourceId:r}){let s=this.mapInstance.getSource(r);return s?te.warn(`Source "${s.id}" already exists, skipping`):(this.mapInstance.addSource(r,{type:"geojson",data:e,promoteId:Gt}),s=this.mapInstance.getSource(r)),s??null}getGeoJson(){if(!this.isInstanceAvailable())throw new Error("Source instance is not available");return this.sourceInstance.serialize().data}getGmGeoJson(){if(!this.isInstanceAvailable())throw new Error("Source instance is not available");const e={type:"FeatureCollection",features:[]};return this.gm.features.filteredForEach(r=>r.source.id===this.sourceInstance?.id)(r=>{Yn.includes(r.shape)&&e.features.push(r.getGeoJson())}),e}async setData(e){if(!this.isInstanceAvailable())throw new Error("Source instance is not available");await this.sourceInstance.setData(e,!0)}async updateData(e){if(!this.isInstanceAvailable())return;const r=this.convertUniversalDiffToMlDiff(e);await this.sourceInstance.updateData(r,!0)}convertUniversalDiffToMlDiff(e){return{add:e.add?.map(this.sanitizeFeatureForAdd.bind(this)),update:e.update?.map(this.convertFeatureToMlUpdateDiff.bind(this)),remove:e.remove}}sanitizeFeatureForAdd(e){if(!e.properties)return e;const r={};for(const[s,u]of Object.entries(e.properties))u!==void 0&&(r[s]=u);return{...e,properties:r}}convertFeatureToMlUpdateDiff(e){const r=[],s=[];return Object.entries(e.properties||{}).forEach(([u,c])=>{c===void 0?s.push(u):r.push({key:u,value:c})}),{id:e.properties?.[Gt],newGeometry:e.geometry,addOrUpdateProperties:r,removeProperties:s}}remove(){this.isInstanceAvailable()&&(this.gm.mapAdapter.eachLayer(e=>{e.source===this.sourceInstance.id&&this.gm.mapAdapter.removeLayer(e.id)}),this.mapInstance.removeSource(this.sourceInstance.id))}}const FI=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","touchstart","touchend","touchcancel"],Nu=t=>FI.includes(t);class GI extends jp{gm;mapType="maplibre";mapInstance;constructor(e,r){super(),this.gm=r,this.mapInstance=e}getMapInstance(){return this.mapInstance}isLoaded(){return this.mapInstance._loaded}getContainer(){return this.mapInstance.getContainer()}getCanvas(){return this.mapInstance.getCanvas()}addControl(e){this.mapInstance.addControl(e)}removeControl(e){this.mapInstance.removeControl(e)}async loadImage({id:e,image:r}){if(!this.mapInstance.hasImage(e)){const s=await this.mapInstance.loadImage(r);this.mapInstance.addImage(e,s.data)}}removeImage(e){try{this.mapInstance.hasImage(e)&&this.mapInstance.removeImage(e)}catch{}}getBounds(){return this.mapInstance.getBounds().toArray()}fitBounds(e,r){this.mapInstance.fitBounds(e,r)}setCursor(e){this.mapInstance.getCanvas().style.cursor=e}disableMapInteractions(e){e.forEach(r=>{this.mapInstance[r].disable()})}enableMapInteractions(e){e.forEach(r=>{this.mapInstance[r].enable()})}setDragPan(e){e?this.mapInstance.dragPan.enable():this.mapInstance.dragPan.disable()}queryFeaturesByScreenCoordinates({queryCoordinates:e=void 0,sourceNames:r}){return Ih(this.mapInstance.queryRenderedFeatures(e).map(s=>({featureId:s.properties[Gt],featureSourceName:s.source})),Qi).map(({featureId:s,featureSourceName:u})=>s===void 0||!r.includes(u)?null:this.gm.features.get(u,s)||null).filter(s=>!!s)}queryGeoJsonFeatures({queryCoordinates:e=void 0,sourceNames:r}){const s=(u,c)=>u?.id===c?.id;return Ih(this.mapInstance.queryRenderedFeatures(e).map(u=>{const c=this.convertToGeoJsonImportFeature(u);return c?{id:u.properties[Gt],sourceName:u.source,geoJson:c}:null}),s).filter(u=>!!u&&u.id!==void 0&&u.geoJson&&r.includes(u.sourceName))}convertToGeoJsonImportFeature(e){const r=e.properties[Gt];return r===void 0||e.geometry.type==="GeometryCollection"?null:{id:r,type:"Feature",properties:e.properties,geometry:e.geometry}}addSource(e,r){return new $f({gm:this.gm,sourceId:e,geoJson:r})}getSource(e){return new $f({gm:this.gm,sourceId:e})}addLayer(e){const r=e.id;return new Mu({gm:this.gm,layerId:r,options:e})}getLayer(e){return this.mapInstance.getLayer(e)?new Mu({gm:this.gm,layerId:e}):null}removeLayer(e){const r=this.getLayer(e);r&&r.remove()}eachLayer(e){this.mapInstance.getStyle().layers.forEach(r=>{e(new Mu({gm:this.gm,layerId:r.id}))})}createDomMarker(e,r){return new RI({mapInstance:this.mapInstance,options:e,lngLat:r})}createPopup(e,r){return new DI({mapInstance:this.mapInstance,options:e,lngLat:r})}project(e){const r=this.mapInstance.project(e);return[r.x,r.y]}unproject(e){const r=this.mapInstance.unproject(e);return[r.lng,r.lat]}coordBoundsToScreenBounds(e){const r=new _l.LngLatBounds(e),s=this.project(r.getSouthWest().toArray()),u=this.project(r.getNorthEast().toArray());return[s,u]}fire(e,r){this.mapInstance.fire(e,r)}on(e,r,s){if(typeof r=="string"&&s&&Nu(e))this.mapInstance.on(e,r,s);else if(typeof r=="function")this.mapInstance.on(e,r);else throw new Error("Invalid arguments passed to 'on' method")}once(e,r,s){if(typeof r=="string"&&s&&Nu(e))this.mapInstance.once(e,r,s);else if(typeof r=="function")this.mapInstance.once(e,r);else throw new Error("Invalid arguments passed to 'once' method.")}off(e,r,s){if(typeof r=="string"&&s&&Nu(e))this.mapInstance.off(e,r,s);else if(typeof r=="function")this.mapInstance.off(e,r);else throw new Error("Invalid arguments passed to 'off' method")}}const BI=(t,e)=>new GI(e,t),zp=(t,e)=>{if(!Array.isArray(t)||!Array.isArray(e))return;if(e.some(u=>!Bw(u))){te.warn("Wrong partial layer detected for layer styles");return}const r=yk(t,"type"),s=rk(e,"type");if(Object.values(s).some(u=>u>1))throw new Error('Multiple layers for the same shape are detected. Use "useDefaultLayers: false" and define layers manually.');return e.forEach(u=>{r[u.type]?_k(r[u.type],u):r[u.type]=Ht(u)}),gk(r)};class Jp{gm;settings;controls;layerStyles;constructor(e,r){this.gm=e;const s=this.getMergedOptions(r);this.settings=s.settings,this.controls=s.controls,this.layerStyles=s.layerStyles}getMergedOptions(e={}){const r=Bu();return typeof e.settings?.controlsUiEnabledByDefault=="boolean"&&(r.settings.controlsUiEnabledByDefault=e.settings.controlsUiEnabledByDefault),Rk(r),lk(r,e,zp)}enableMode(e,r){const s=this.isModeEnabled(e,r),u=this.isModeAvailable(e,r);if(u||te.warn(`Unable to enable mode, "${e}:${r}" is not available`),s||!u)return;const c=this.controls[e][r];c?(c.active=!0,this.fireModeEvent(e,r,"mode_start"),this.fireControlEvent(e,r,"on"),this.fireModeEvent(e,r,"mode_started")):te.error("Can't find control section for",e,r)}disableMode(e,r){const s=this.isModeEnabled(e,r),u=this.isModeAvailable(e,r);if(!s||!u)return;const c=this.controls[e][r];c?(c.active=!1,this.fireModeEvent(e,r,"mode_end"),this.fireControlEvent(e,r,"off"),this.fireModeEvent(e,r,"mode_ended")):te.error("Can't find control section for",e,r)}syncModeState(e,r){const s=this.controls[e][r],u=this.isModeAvailable(e,r);s&&(u?s.active?this.enableMode(e,r):this.disableMode(e,r):(console.log(`Not available mode: ${e}:${r}`),s.active=!1,s.uiEnabled=!1))}toggleMode(e,r){this.isModeEnabled(e,r)?this.disableMode(e,r):this.enableMode(e,r)}isModeEnabled(e,r){return!!Object.entries(this.gm.actionInstances).find(([s,u])=>s===`${e}__${r}`&&u)}isModeAvailable(e,r){return e==="draw"&&ur(r,Hl)?!!this.gm.drawClassMap[r]:e==="edit"&&ur(r,Xl)?!!this.gm.editClassMap[r]:e==="helper"&&ur(r,Vl)?!!this.gm.helperClassMap[r]:!1}getControlOptions({modeType:e,modeName:r}){return e&&r&&this.controls[e][r]||null}fireModeEvent(e,r,s){const u={name:`${ae}:${r}:mode`,level:"system",actionType:e,mode:r,action:s};Fo(u)&&(Oo(u)?this.gm.events.fire(`${ae}:${e}`,u):hi(u)?this.gm.events.fire(`${ae}:${e}`,u):To(u)?this.gm.events.fire(`${ae}:${e}`,u):te.warn("Unknown mode event: ",u))}fireControlEvent(e,r,s){const u={name:`${ae}:control:switch`,level:"system",actionType:"control",section:e,mode:r,action:s};this.gm.events.fire(`${ae}:control`,u)}}class Hp{gm;marker=null;tmpMarker=null;snapping=!1;oldSnapping=void 0;constructor(e){this.gm=e,this.initEventHandlers()}get snappingHelper(){return this.gm.actionInstances.helper__snapping||null}initEventHandlers(){this.throttledMethods=Fr({onMouseMove:this.onMouseMove},this,this.gm.options.settings.throttlingDelay),this.eventHandlers={mousemove:this.throttledMethods.onMouseMove.bind(this)}}setSnapping(e){if(e&&!this.snappingHelper){te.error("MarkerPointer: snapping is not available");return}this.snapping=e}pauseSnapping(){this.oldSnapping!==void 0&&te.error("MarkerPointer: snapping is already paused"),this.oldSnapping=this.snapping,this.setSnapping(!1)}resumeSnapping(){this.oldSnapping===void 0?(te.error("MarkerPointer: resumeSnapping is called before pauseSnapping"),this.setSnapping(!0)):(this.setSnapping(this.oldSnapping),this.oldSnapping=void 0)}enable({lngLat:e,customMarker:r,invisibleMarker:s}={lngLat:[0,0],customMarker:void 0,invisibleMarker:!1}){if(!Rw()){if(r&&s)throw new Error("MarkerPointer: customMarker and invisibleMarker can't be used together");if(this.marker)throw new Error("MarkerPointer: marker is already enabled");this.gm.events.bus.attachEvents(this.eventHandlers),s?this.marker=this.createInvisibleMarker(e||[0,0]):this.marker=r||this.createMarker(e||[0,0]),this.gm.getActiveDrawModes().length&&this.gm.mapAdapter.setCursor("crosshair")}}disable(){this.marker&&(this.gm.events.bus.detachEvents(this.eventHandlers),this.marker.remove(),this.marker=null),this.gm.mapAdapter.setCursor("")}createMarker(e=[0,0]){return this.gm.mapAdapter.createDomMarker({anchor:"center",element:this.gm.createSvgMarkerElement("control",{pointerEvents:"none"})},e)}createInvisibleMarker(e=[0,0]){const r=document.createElement("div");return r.style.width="0px",r.style.height="0px",this.gm.mapAdapter.createDomMarker({anchor:"center",element:r},e)}onMouseMove(e){if(We(e,{warning:!0})&&this.marker)if(this.snapping&&this.snappingHelper){const r=[e.point.x,e.point.y],s=this.snappingHelper.getSnappedLngLat(e.lngLat.toArray(),r);this.marker.setLngLat(s)}else this.marker.setLngLat(e.lngLat.toArray());return{next:!0}}syncTmpMarker(e){this.tmpMarker||(this.tmpMarker=this.createMarker(e)),this.tmpMarker.setLngLat(e)}}const UI=["mode_start","mode_started","mode_end","mode_ended"],Fo=t=>Xn(t)&&ur(t.action,UI);class jI{mapAdapterInstance=null;globalLngLatBounds=this.getGlobalLngLatBounds();features;loaded=!1;destroyed=!1;options;events;control;actionInstances={};markerPointer;constructor(e,r={}){this.options=this.initCoreOptions(r),this.events=this.initCoreEvents(),this.features=this.initCoreFeatures(),this.control=this.initCoreControls(),this.markerPointer=this.initMarkerPointer();const s=Object.assign(e,{gm:this});this.mapAdapterInstance=BI(this,s),this.waitForBaseMap().then(this.init.bind(this)).catch(u=>{te.error("Geoman initialization failed:",u),this.destroy()})}get drawClassMap(){return ro}get editClassMap(){return fo}get helperClassMap(){return go}get mapAdapter(){if(this.mapAdapterInstance)return this.mapAdapterInstance;throw te.trace("Map adapter is not initialized"),new Error("Map adapter is not initialized")}initCoreOptions(e={}){return new Jp(this,e)}initCoreEvents(){return new TI(this)}initCoreFeatures(){return new OI(this)}initCoreControls(){return new iw(this)}initMarkerPointer(){return new Hp(this)}addControls(e=void 0){return new Promise(r=>{(async()=>{e?this.control.createControls(e):this.mapAdapter.addControl(this.control),await this.onMapLoad(),r()})().then()})}async waitForBaseMap(){const e=this.mapAdapter.mapInstance;if(!sp(e)){te.error('Map instance does not have a "once" method',e);return}return this.mapAdapter.isLoaded()||await nf(new Promise(r=>{const s=()=>r(e);e.once("load",s),this.mapAdapter.isLoaded()&&(e.off("load",s),r(e))}),"waitForBaseMap failed"),e}async waitForGeomanLoaded(){if(this.loaded)return this;if(this.destroyed)return;const e=await this.waitForBaseMap();if(!e){te.error("Map instance is not available",e);return}const r=`${rt}:loaded`;return await nf(new Promise(s=>{const u=()=>s(this);e.once(r,u),this.loaded&&(e.off(r,u),s(this))}),"waitForGeomanLoaded failed"),this}async init(){this.destroyed||(this.features.init(),!this.destroyed&&await this.addControls())}async destroy({removeSources:e}={removeSources:!1}){if(this.destroyed=!0,this.mapAdapterInstance&&"gm"in this.mapAdapterInstance.mapInstance&&delete this.mapAdapterInstance.mapInstance.gm,this.loaded?(this.removeControls(),this.mapAdapter.removeImage("default-marker")):this.events.bus.detachAllEvents(),e)for(const r of Object.values(this.features.sources))r&&r.remove()}removeControls(){this.disableAllModes(),this.mapAdapter.removeControl(this.control)}async onMapLoad(){if(this.loaded||this.destroyed||(await this.mapAdapter.loadImage({id:"default-marker",image:jm}),this.destroyed))return;const e={name:`${ae}:control:load`,level:"system",actionType:"control",action:"loaded"};this.events.fire(`${ae}:control`,e),this.loaded=!0}disableAllModes(){Ze(this.actionInstances).forEach(e=>{const[r,s]=e.split("__");Ib(r)&&hp(s)&&this.options.disableMode(r,s)})}getActiveDrawModes(){return Ze(this.actionInstances).map(e=>{const r=this.actionInstances[e];return r instanceof Kn?r.mode:null}).filter(e=>e!==null)}getActiveEditModes(){return Ze(this.actionInstances).map(e=>{const r=this.actionInstances[e];return r instanceof is?r.mode:null}).filter(e=>e!==null)}getActiveHelperModes(){return Ze(this.actionInstances).map(e=>{const r=this.actionInstances[e];return r instanceof mr?r.mode:null}).filter(e=>e!==null)}getGlobalLngLatBounds(){const e=85.051129;return[[-179.99999,-e],[179.99999,e]]}setGlobalEventsListener(e=null){this.events.bus.forwarder.globalEventsListener=e}createSvgMarkerElement(e,r=void 0){const s=this.options.settings.markerIcons;s[e]||te.error(`createMarkerElement: marker type "${e}" not found`);const u=document.createElement("div");u.classList.add("marker-wrapper"),u.style.lineHeight="0",u.innerHTML=s[e]||"NO_ICON";const c=u.firstChild;if(typeof c!="object")throw te.error(`createMarkerElement: no icon "${e}" found`),new Error(`No icon "${e}" found`);return r&&Object.assign(c.style,r),u}enableMode(e,r){this.options.enableMode(e,r)}disableMode(e,r){this.options.disableMode(e,r)}toggleMode(e,r){this.options.toggleMode(e,r)}isModeEnabled(e,r){return this.options.isModeEnabled(e,r)}enableDraw(e){this.options.enableMode("draw",e)}disableDraw(){this.getActiveDrawModes().forEach(e=>this.options.disableMode("draw",e))}toggleDraw(e){this.options.toggleMode("draw",e)}drawEnabled(e){return this.options.isModeEnabled("draw",e)}enableGlobalDragMode(){this.options.enableMode("edit","drag")}disableGlobalDragMode(){this.options.disableMode("edit","drag")}toggleGlobalDragMode(){this.options.toggleMode("edit","drag")}globalDragModeEnabled(){return this.options.isModeEnabled("edit","drag")}enableGlobalEditMode(){this.options.enableMode("edit","change")}disableGlobalEditMode(){this.options.disableMode("edit","change")}toggleGlobalEditMode(){this.options.toggleMode("edit","change")}globalEditModeEnabled(){return this.options.isModeEnabled("edit","change")}enableGlobalRotateMode(){this.options.enableMode("edit","rotate")}disableGlobalRotateMode(){this.options.disableMode("edit","rotate")}toggleGlobalRotateMode(){this.options.toggleMode("edit","rotate")}globalRotateModeEnabled(){return this.options.isModeEnabled("edit","rotate")}enableGlobalCutMode(){this.options.enableMode("edit","cut")}disableGlobalCutMode(){this.options.disableMode("edit","cut")}toggleGlobalCutMode(){this.options.toggleMode("edit","cut")}globalCutModeEnabled(){return this.options.isModeEnabled("edit","cut")}enableGlobalRemovalMode(){this.options.enableMode("edit","delete")}disableGlobalRemovalMode(){this.options.disableMode("edit","delete")}toggleGlobalRemovalMode(){this.options.toggleMode("edit","delete")}globalRemovalModeEnabled(){return this.options.isModeEnabled("edit","delete")}}exports.BaseAction=Po;exports.BaseDomMarker=Mo;exports.BaseDrag=Do;exports.BaseDraw=Kn;exports.BaseEdit=is;exports.BaseHelper=mr;exports.BaseLayer=qp;exports.BaseMapAdapter=jp;exports.BasePopup=Yp;exports.BaseSource=Up;exports.DRAW_MODES=Hl;exports.EDIT_MODES=Xl;exports.EXTRA_DRAW_MODES=Bd;exports.FEATURE_ID_PROPERTY=Gt;exports.FEATURE_PROPERTY_PREFIX=it;exports.FeatureData=Ui;exports.GM_PREFIX=rt;exports.Geoman=jI;exports.GmOptions=Jp;exports.HELPER_MODES=Vl;exports.IS_PRO=nt;exports.LineDrawer=Ro;exports.MarkerPointer=Hp;exports.SHAPE_NAMES=Yn;exports.SOURCES=Q;exports.ShapeMarkersHelper=Bp;exports.controlIcons=mt;exports.convertToThrottled=Fr;exports.defaultLayerStyles=Kf;exports.drawClassMap=ro;exports.eachCoordinateWithPath=rs;exports.eachSegmentWithPath=ec;exports.editClassMap=fo;exports.findCoordinateWithPath=ep;exports.geoJsonPointToLngLat=no;exports.getEuclideanDistance=qs;exports.getEuclideanSegmentNearestPoint=tp;exports.getGeoJsonCoordinatesCount=Ba;exports.getGeoJsonFirstPoint=rc;exports.getLngLatDiff=Ga;exports.helperClassMap=go;exports.includesWithType=ur;exports.isDrawModeName=up;exports.isEditModeName=lp;exports.isEqualPosition=rl;exports.isGeoJsonFeatureInPolygon=Ps;exports.isGmControlEvent=Jl;exports.isGmDrawEvent=Oo;exports.isGmDrawLineDrawerEvent=sc;exports.isGmDrawShapeEvent=ip;exports.isGmEditEvent=hi;exports.isGmEvent=Xn;exports.isGmHelperEvent=To;exports.isGmModeEvent=Fo;exports.isHelperModeName=cp;exports.isMapPointerEvent=We;exports.isMapWithOnceMethod=sp;exports.isModeName=hp;exports.isMultiPolygonFeature=Ql;exports.isPolygonFeature=Kl;exports.lngLatToGeoJsonPoint=np;exports.mergeByTypeCustomizer=zp;exports.moveGeoJson=Cp;exports.toMod=Ap;exports.typedKeys=Ze;
|