@defra/interactive-map 0.0.57-alpha → 0.0.59-alpha
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/dist/esm/im-core.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/docs/assets/css/docusaurus.scss +7 -1
- package/docs/plugins/draw.md +317 -186
- package/package.json +1 -1
- package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/esm/index.js +1 -1
- package/plugins/draw/dist/esm/liveDrawChecks.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/umd/index.js +1 -1
- package/plugins/draw/src/adapterEvents.js +15 -9
- package/plugins/draw/src/adapters/adapterContract.test.js +1 -0
- package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.js +15 -3
- package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.test.js +27 -0
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/pointerHandlers.js +8 -19
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/pointerHandlers.test.js +20 -0
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/pointerHandlers.js +6 -17
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/pointerHandlers.test.js +19 -0
- package/plugins/draw/src/adapters/maplibre/utils/editModeEvents.js +29 -1
- package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.js +13 -3
- package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.test.js +28 -0
- package/plugins/draw/src/api/addFeature.js +9 -6
- package/plugins/draw/src/api/addFeature.test.js +37 -10
- package/plugins/draw/src/api/createNewShape.js +2 -2
- package/plugins/draw/src/api/editFeature.js +1 -1
- package/plugins/draw/src/api/newPoint.js +2 -2
- package/plugins/draw/src/api/newPoint.test.js +8 -0
- package/plugins/draw/src/api/newPolygon.test.js +8 -0
- package/plugins/draw/src/api/recheckGeometry.js +1 -1
- package/plugins/draw/src/api/recheckGeometry.test.js +2 -2
- package/plugins/draw/src/api/setProperties.js +39 -0
- package/plugins/draw/src/api/setProperties.test.js +74 -0
- package/plugins/draw/src/api/setStyle.js +16 -19
- package/plugins/draw/src/api/setStyle.test.js +17 -2
- package/plugins/draw/src/api/split.js +10 -4
- package/plugins/draw/src/api/split.test.js +30 -2
- package/plugins/draw/src/events.js +110 -64
- package/plugins/draw/src/events.test.js +494 -4
- package/plugins/draw/src/manifest.js +6 -4
- package/plugins/draw/src/manifest.test.js +20 -26
- package/plugins/draw/src/reducer.js +7 -0
- package/plugins/draw/src/reducer.test.js +11 -0
- package/plugins/draw/src/utils/flattenStyleProperties.js +54 -2
- package/plugins/draw/src/utils/flattenStyleProperties.test.js +74 -1
- package/plugins/draw/src/utils/isPlainObject.js +14 -0
- package/plugins/draw/src/utils/isPlainObject.test.js +24 -0
- package/plugins/draw/src/utils/mergeFeatureProperties.js +45 -0
- package/plugins/draw/src/utils/mergeFeatureProperties.test.js +48 -0
- package/plugins/draw/src/utils/stripInternalProperties.js +3 -2
- package/plugins/draw/src/validation/commitChecks.js +32 -12
- package/plugins/draw/src/validation/commitChecks.test.js +73 -13
- package/plugins/draw/src/validation/validateGeometry.js +12 -5
- package/plugins/draw/src/validation/validateGeometry.test.js +18 -0
- package/src/App/store/MapProvider.jsx +1 -0
- package/src/App/store/MapProvider.test.jsx +25 -0
- package/src/App/store/mapActionsMap.js +6 -0
- package/src/App/store/mapActionsMap.test.js +7 -0
- package/src/App/store/mapReducer.js +2 -0
- package/src/App/store/mapReducer.test.js +2 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see im-draw-plugin.js.LICENSE.txt */
|
|
2
|
-
"use strict";(Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap=Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap||[]).push([[568],{278:function(e,t,n){n.d(t,{Et:function(){return d},Gf:function(){return c},Lr:function(){return l},n1:function(){return u},nv:function(){return f},tR:function(){return p},wi:function(){return s},zX:function(){return r},zx:function(){return a}});var r=6371008.8,i={centimeters:100*r,centimetres:100*r,degrees:360/(2*Math.PI),feet:3.28084*r,inches:39.37*r,kilometers:r/1e3,kilometres:r/1e3,meters:r,metres:r,miles:r/1609.344,millimeters:1e3*r,millimetres:1e3*r,nauticalmiles:r/1852,radians:1,yards:1.0936*r};function o(e,t,n={}){const r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}function a(e,t,n={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!d(e[0])||!d(e[1]))throw new Error("coordinates must contain numbers");return o({type:"Point",coordinates:e},t,n)}function u(e,t,n={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return o({type:"Polygon",coordinates:e},t,n)}function s(e,t,n={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return o({type:"LineString",coordinates:e},t,n)}function l(e,t={}){const n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function c(e,t="kilometers"){const n=i[t];if(!n)throw new Error(t+" units is invalid");return e/n}function f(e){return e%(2*Math.PI)*180/Math.PI}function p(e){return e%360*Math.PI/180}function d(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}},850:function(e,t,n){function r(e,t,n){if(null!==e)for(var i,o,a,u,s,l,c,f,p=0,d=0,h=e.type,y="FeatureCollection"===h,g="Feature"===h,v=y?e.features.length:1,m=0;m<v;m++){s=(f=!!(c=y?e.features[m].geometry:g?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var b=0;b<s;b++){var S=0,w=0;if(null!==(u=f?c.geometries[b]:c)){l=u.coordinates;var E=u.type;switch(p=!n||"Polygon"!==E&&"MultiPolygon"!==E?0:1,E){case null:break;case"Point":if(!1===t(l,d,m,S,w))return!1;d++,S++;break;case"LineString":case"MultiPoint":for(i=0;i<l.length;i++){if(!1===t(l[i],d,m,S,w))return!1;d++,"MultiPoint"===E&&S++}"LineString"===E&&S++;break;case"Polygon":case"MultiLineString":for(i=0;i<l.length;i++){for(o=0;o<l[i].length-p;o++){if(!1===t(l[i][o],d,m,S,w))return!1;d++}"MultiLineString"===E&&S++,"Polygon"===E&&w++}"Polygon"===E&&S++;break;case"MultiPolygon":for(i=0;i<l.length;i++){for(w=0,o=0;o<l[i].length;o++){for(a=0;a<l[i][o].length-p;a++){if(!1===t(l[i][o][a],d,m,S,w))return!1;d++}w++}S++}break;case"GeometryCollection":for(i=0;i<u.geometries.length;i++)if(!1===r(u.geometries[i],t,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function i(e,t,n){var r=n;return function(e,t){var n,r,i,o,a,u,s,l,c,f,p=0,d="FeatureCollection"===e.type,h="Feature"===e.type,y=d?e.features.length:1;for(n=0;n<y;n++){for(u=d?e.features[n].geometry:h?e.geometry:e,l=d?e.features[n].properties:h?e.properties:{},c=d?e.features[n].bbox:h?e.bbox:void 0,f=d?e.features[n].id:h?e.id:void 0,a=(s=!!u&&"GeometryCollection"===u.type)?u.geometries.length:1,i=0;i<a;i++)if(null!==(o=s?u.geometries[i]:u))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,p,l,c,f))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===t(o.geometries[r],p,l,c,f))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,p,l,c,f))return!1;p++}}(e,function(e,i,o,a,u){r=0===i&&void 0===n?e:t(r,e,i,o,a,u)}),r}n.d(t,{Fh:function(){return r},jE:function(){return i}})},360:function(e,t,n){n.d(t,{P:function(){return r},k:function(){return i}});var r="change",i={CREATE:"create",EDIT_FINISH:"editfinish",CANCEL:"cancel",VERTEX_SELECTION:"vertexselection",VERTEX_CHANGE:"vertexchange",UNDO_CHANGE:"undochange",UPDATE:"update",GEOMETRY_CHANGE:"geometrychange",INTERFACE_TYPE_CHANGE:"interfacetypechange",PLACEMENT_BLOCKED:"placementblocked",VALIDITY_CHANGE:"validitychange",CAN_PLACE_CHANGE:"canplacechange"}},682:function(e,t,n){n.d(t,{F0:function(){return s},V3:function(){return f},WQ:function(){return c},lm:function(){return u},vf:function(){return l}});var r="rgba(29,112,184,1)",i="#ffffff",o="rgba(11,12,12,1)",a="rgba(212,53,28,0.5)",u={editStroke:{light:r,dark:i},editFill:{light:"rgba(29,112,184,0.1)",dark:"rgba(255,255,255,0.1)"},editVertex:{light:r,dark:i},editMidpoint:{light:r,dark:i},editHalo:{light:i,dark:o},editActive:{light:o,dark:i},splitInvalid:{light:r,dark:i},splitValid:{light:r,dark:i},invalidStroke:{light:r,dark:i},shapeStroke:"rgba(212,53,28,1)",shapeFill:a,snapVertex:a,snapMidpoint:"rgba(40,161,151,1)",snapEdge:"rgba(29,112,184,0.5)"},s={strokeWidth:2,vertexRadius:6,midpointRadius:4,vertexHaloRadius:8,midpointHaloRadius:6,touchTargetSize:48,touchIndicatorRadius:30},l={snapRadius:12},c={nudgeAmount:1,stepAmount:5},f="draw"},362:function(e,t,n){n.r(t),n.d(t,{manifest:function(){return ht}});var r=new Set(["draw_polygon","draw_line"]),i=new Set(["draw_polygon","draw_line","draw_point"]),o=new Set(["edit_vertex","edit_point"]),a=new Set(["draw_polygon","draw_line","edit_vertex","edit_point"]),u=new Set(["draw_polygon","draw_line","draw_point","edit_vertex","edit_point"]),s=function(e){return r.has(e)},l=function(e){return i.has(e)},c=function(e){return o.has(e)},f=function(e){return a.has(e)};function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(e,t,n){return(t=function(e){var t=function(e){if("object"!=p(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==p(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g={SET_MODE:function(e,t){return h(h({},e),{},{mode:t,numVertices:s(t)?0:e.numVertices,validationStatus:"idle",checkSlow:!1,holding:!1,previewValid:!0,canAddPoint:!0})},SET_ACTION:function(e,t){return h(h({},e),{},{action:t.name,actionValid:t.isValid})},SET_FEATURE:function(e,t){return h(h({},e),{},{feature:void 0===t.feature?e.feature:t.feature,tempFeature:void 0===t.tempFeature?e.tempFeature:t.tempFeature})},SET_SELECTED_VERTEX_INDEX:function(e,t){return h(h({},e),{},{selectedVertexIndex:t.index,numVertices:t.numVertices})},TOGGLE_SNAP:function(e){return h(h({},e),{},{snap:!e.snap})},SET_HAS_SNAP_LAYERS:function(e,t){return h(h({},e),{},{hasSnapLayers:!!t})},SET_UNDO_STACK_LENGTH:function(e,t){return h(h({},e),{},{undoStackLength:t})},SET_VALIDATION_STATUS:function(e,t){return h(h({},e),{},{validationStatus:t,checkSlow:!1})},SET_CHECK_SLOW:function(e){return h(h({},e),{},{checkSlow:!0})},SET_HOLDING:function(e,t){return h(h({},e),{},{holding:!!t})},SET_PREVIEW_VALID:function(e,t){return h(h({},e),{},{previewValid:!!t})},SET_CAN_ADD_POINT:function(e,t){return h(h({},e),{},{canAddPoint:!!t})}},v=n(738),m={APP_ADD_MARKER:"app:addmarker",APP_UPDATE_MARKER:"app:updatemarker",APP_REMOVE_MARKER:"app:removemarker",APP_ADD_BUTTON:"app:addbutton",APP_TOGGLE_BUTTON_STATE:"app:togglebuttonstate",APP_ADD_PANEL:"app:addpanel",APP_REMOVE_PANEL:"app:removepanel",APP_SHOW_PANEL:"app:showpanel",APP_HIDE_PANEL:"app:hidepanel",APP_ADD_CONTROL:"app:addcontrol",APP_SET_APPLICATION_MODE:"app:setapplicationmode",APP_CLEAR_APPLICATION_MODE:"app:clearapplicationmode",APP_SHOW_HINT:"app:showhint",APP_DISMISS_HINT:"app:dismisshint",APP_READY:"app:ready",APP_OPENED:"app:opened",APP_CLOSED:"app:closed",APP_FULLSCREEN_CHANGE:"app:fullscreenchange",APP_PANEL_OPENED:"app:panelopened",APP_PANEL_CLOSED:"app:panelclosed",MAP_SET_STYLE:"map:setstyle",MAP_SET_SIZE:"map:setsize",MAP_SET_SPATIAL_LIST:"map:setspatiallist",MAP_SET_SPATIAL_LIST_SUPPRESSED:"map:setspatiallistsuppressed",MAP_SET_ACTIVE_ITEM:"map:setactiveitem",MAP_SELECT_ITEM:"map:selectitem",MAP_SET_PIXEL_RATIO:"map:setpixelratio",MAP_FIT_TO_BOUNDS:"map:fittobounds",MAP_SET_VIEW:"map:setview",MAP_INIT_MAP_STYLES:"map:initmapstyles",MAP_STYLE_CHANGE:"map:stylechange",MAP_LOADED:"map:loaded",MAP_READY:"map:ready",MAP_SIZE_CHANGE:"map:sizechange",MAP_FIRST_IDLE:"map:firstidle",MAP_MOVE_START:"map:movestart",MAP_MOVE:"map:move",MAP_MOVE_END:"map:moveend",MAP_STATE_UPDATED:"map:stateupdated",MAP_DATA_CHANGE:"map:datachange",MAP_RENDER:"map:render",MAP_CLICK:"map:click",MAP_DESTROY:"map:destroy"};function b(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var s=r&&r.prototype instanceof u?r:u,l=Object.create(s.prototype);return S(l,"_invoke",function(n,r,i){var o,u,s,l=0,c=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,u=0,s=e,p.n=n,a}};function d(n,r){for(u=n,s=r,t=0;!f&&l&&!i&&t<c.length;t++){var i,o=c[t],d=p.p,h=o[2];n>3?(i=h===r)&&(s=o[(u=o[4])?5:(u=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=n<2&&d<o[1])?(u=0,p.v=r,p.n=o[1]):d<h&&(i=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,p.n=h,u=0))}if(i||n>1)return a;throw f=!0,r}return function(i,c,h){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&d(c,h),u=c,s=h;(t=u<2?e:s)||!f;){o||(u?u<3?(u>1&&(p.n=-1),d(u,s)):p.n=s:p.v=s);try{if(l=2,o){if(u||(i="next"),t=o[i]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,u<2&&(u=0)}else 1===u&&(t=o.return)&&t.call(o),u<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),u=1);o=e}else if((t=(f=p.n<0)?s:n.call(r,p))!==a)break}catch(t){o=e,u=1,s=t}finally{l=1}}return{value:t,done:f}}}(n,i,o),!0),l}var a={};function u(){}function s(){}function l(){}t=Object.getPrototypeOf;var c=[][r]?t(t([][r]())):(S(t={},r,function(){return this}),t),f=l.prototype=u.prototype=Object.create(c);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,S(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return s.prototype=l,S(f,"constructor",l),S(l,"constructor",s),s.displayName="GeneratorFunction",S(l,i,"GeneratorFunction"),S(f),S(f,i,"Generator"),S(f,r,function(){return this}),S(f,"toString",function(){return"[object Generator]"}),(b=function(){return{w:o,m:p}})()}function S(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}S=function(e,t,n,r){function o(t,n){S(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},S(e,t,n,r)}function w(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}var E=function(){var e,t=(e=b().m(function e(t,r){var i,o,a,u,s;return b().w(function(e){for(;;)switch(e.n){case 0:s=t.name,e.n="MapLibreProvider"===s?1:"OpenLayersProvider"===s?3:5;break;case 1:return e.n=2,n.e(356).then(n.bind(n,960));case 2:return i=e.v,o=i.MaplibreDrawAdapter,e.a(2,new o(t,r));case 3:return e.n=4,n.e(722).then(n.bind(n,356));case 4:return a=e.v,u=a.OLDrawAdapter,e.a(2,new u(t,r));case 5:throw new Error('No draw adapter available for map provider "'.concat(t.name,'"'));case 6:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){w(o,r,i,a,u,"next",e)}function u(e){w(o,r,i,a,u,"throw",e)}a(void 0)})});return function(e,n){return t.apply(this,arguments)}}(),P=n(360),O=n(520),x=n(9),_=n(619),T=new Set(["symbol","symbolSvgContent","symbolViewBox","symbolAnchor","symbolSize","symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"]);function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach(function(t){j(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function j(e,t,n){return(t=function(e){var t=function(e){if("object"!=A(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=A(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==A(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return M(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var L=function(e){if(null==e||!e.properties)return e;for(var t={},n=0,r=Object.entries(e.properties);n<r.length;n++){var i=I(r[n],2),o=i[0],a=i[1];"sortKey"===o||o.startsWith("symbol")&&!T.has(o)||(t[o]=a)}return k(k({},e),{},{properties:t})};function R(e){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R(e)}function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach(function(t){G(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function G(e,t,n){return(t=function(e){var t=function(e){if("object"!=R(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=R(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==R(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var V={revision:0,status:"idle",result:null,feature:null,context:null,slow:!1,afterPending:!1},F=function(e){return e.valid?"valid":"invalid"},B=new WeakMap,U=function(e){var t,n,r,i,o,a,u,s,l,c=B.get(e);return c||(t=0,n=null,r=null,i=null,o=V,a=null,u=null,s=function(){var e;null===(e=i)||void 0===e||e.abort(),i=null,clearTimeout(r)},l=function(e,u){var s;if(e===t){"pending"!==u.status&&(i=null,clearTimeout(r));var l=!!u.slow,c="pending"!==u.status&&n===e;n=l?e:null,o=D(D({},u),{},{revision:e,slow:l,afterPending:c}),null===(s=a)||void 0===s||s(o)}},c={get state(){return o},setOnSettle:function(e){a=e},get heldId(){var e;return(null===(e=u)||void 0===e?void 0:e.revision)===t?u.id:void 0},hold:function(e){u={id:e,revision:t}},release:function(){u=null},run:function(e){var n=e.feature,o=e.context,a=e.onGeometryChange,u=e.rules,c=void 0===u?x.k7:u;s();var f=++t,p={feature:n,context:o},d=(0,O.$U)(n,o,{rules:c});if(d.valid&&"function"==typeof a){i=new AbortController;var h,y=function(e){f===t&&(_.v.warn("[draw] onGeometryChange failed",e),l(f,D(D({},p),{},{status:"error",result:{valid:!1,reason:null,source:"callback"},error:e})))};try{h=a(D({feature:n},o),{signal:i.signal,revision:f})}catch(e){return void y(e)}var g,v=function(e){var t=(0,O.g5)((0,O.Av)(e),"callback");l(f,D(D({},p),{},{status:F(t),result:t}))};"function"==typeof(null==(g=h)?void 0:g.then)?(l(f,D(D({},p),{},{status:"pending",result:null})),r=setTimeout(function(){return l(f,D(D({},p),{},{status:"pending",result:null,slow:!0}))},300),h.then(v,y)):v(h)}else l(f,D(D({},p),{},{status:F(d),result:d}))},reset:function(){var e,n=(null===(e=u)||void 0===e?void 0:e.revision)===t?u.id:void 0;return s(),t++,o=V,u=null,n}},B.set(e,c)),c},H=function(e){var t=e[0],n=e[e.length-1];return e.length>1&&t[0]===n[0]&&t[1]===n[1]?e.slice(0,-1):e},q=function(e){return"Polygon"===e.type?e.coordinates.map(H):e.coordinates},z=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;e._previewValidator=null!==(t=r.onGeometryPreview)&&void 0!==t?t:i.onGeometryPreview,e._commitValidator=null!==(n=r.onGeometryChange)&&void 0!==n?n:i.onGeometryChange;var a=U(e).reset();if(void 0!==a){var u=e.get(a);e.delete(a),null==o||o.emit("draw:cancelled",L(u))}};function W(e){return W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},W(e)}var Y=["announcement"];function $(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function X(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach(function(t){K(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function K(e,t,n){return(t=function(e){var t=function(e){if("object"!=W(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=W(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==W(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Z="draw:created",J=new WeakMap,Q=new WeakMap,ee=new Set(["create","edit-finish"]),te=function(e){var t=e.result,n=e.context;return!(null==t||!t.recheckOnFinish||ee.has(null==n?void 0:n.phase))},ne={pending:"Checking shape",valid:"Shape check passed",invalid:"Shape check failed",error:"Shape could not be checked"};function re(e){var t=e.appState,n=e.appConfig,r=e.mapState,i=e.draw,o=e.dispatch,a=e.eventBus,u=e.resetState,s=U(i),l=function(e){u(),setTimeout(function(){return i.changeMode("disabled")},0),a.emit(Z,L(e))},c=function(e,u){J.set(i,e),setTimeout(function(){return function(e,t,n){var r,i,o,a,u=e.draw,s=e.appState,l=e.appConfig,c=e.mapState,f=e.dispatch,p=e.eventBus,d="Point"===n?"edit_point":"edit_vertex";u.changeMode(d,{container:null==s||null===(r=s.layoutRefs)||void 0===r||null===(r=r.viewportRef)||void 0===r?void 0:r.current,deleteVertexButtonId:"".concat(null==l?void 0:l.id,"-draw-delete-point"),undoButtonId:"".concat(null==l?void 0:l.id,"-draw-undo"),isPanEnabled:"keyboard"!==(null==s?void 0:s.interfaceType),interfaceType:null==s?void 0:s.interfaceType,scale:null==c?void 0:c.mapSizeScale,featureId:t,getSnapEnabled:function(){return u.isSnapEnabled()}});var h=u.get(t),y=U(u).state,g=y.status,v=y.result;f({type:"SET_FEATURE",payload:{feature:h,tempFeature:h}}),f({type:"SET_MODE",payload:d}),f({type:"SET_VALIDATION_STATUS",payload:g}),null===(i=u.setCanFinish)||void 0===i||i.call(u,"valid"===g||"pending"===g),null===(o=u.setInvalid)||void 0===o||o.call(u,"invalid"===g),p.emit("draw:reopened",{feature:L(h),status:g,reason:null!==(a=null==v?void 0:v.reason)&&void 0!==a?a:null})}({draw:i,appState:t,appConfig:n,mapState:r,dispatch:o,eventBus:a},e,u)},0)},f=function(e){var t,n=function(e){var t,n,r,o,a=s.state,u=a.status,l=a.feature;return!("valid"!==u&&"pending"!==u||(t=l,n=e,r=null==t?void 0:t.geometry,o=null==n?void 0:n.geometry,!r||!o||r.type!==o.type||JSON.stringify(q(r))!==JSON.stringify(q(o)))||te(s.state))||s.run({feature:e,context:{phase:"create",mode:i.getMode()},onGeometryChange:i._commitValidator}),s.state}(e);if("valid"===n.status)l(e);else if("pending"===n.status)t=e.id,s.hold(t),o({type:"SET_HOLDING",payload:!0}),setTimeout(function(){return i.changeMode("disabled")},0);else{var r;c(e.id,null===(r=e.geometry)||void 0===r?void 0:r.type)}};return{onCreate:f,onCheckSettled:function(e){var t=s.heldId;if(void 0!==t&&"pending"!==e.status){s.release();var n=i.get(t);if(te(e))f(n);else if("valid"===e.status)l(n);else{var r;c(t,null==n||null===(r=n.geometry)||void 0===r?void 0:r.type)}}},onEditFinish:function(e){u(),setTimeout(function(){return i.changeMode("disabled")},0),J.get(i)===e.id?(J.delete(i),a.emit(Z,L(e))):a.emit("draw:edited",L(e))}}}function ie(e){var t=e.appState,n=e.appConfig,r=e.mapState,i=e.pluginState,o=e.mapProvider,a=e.buttonConfig,u=e.eventBus,s=e.hints,l=e.announce,p=o.draw,d=function(e,t){return function(n){var r,i=n.announcement,o=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(n,Y);e.emit("draw:geometryinvalid",o),i||!o.reason||(r=o.reason,Object.values(x.PH).includes(r))||t.show(o.reason)}}(u,s),h=function(e){var t=e.appState,n=e.appConfig,r=e.mapState,i=e.pluginState,o=e.mapProvider,a=e.eventBus,u=e.emitGeometryInvalid,s=e.announce,l=e.resetState,p=o.draw,d=i.feature,h=i.tempFeature,y=i.dispatch,g=U(p);return X(X(X(X({},function(e){var t=e.draw,n=e.dispatch,r=U(t),i=function(e){Q.set(t,e),n({type:"SET_HOLDING",payload:!0})},o=function(e){if("pending"!==e.status)if(te(e)){r.run({feature:e.feature,context:{phase:"edit-finish",mode:t.getMode()},onGeometryChange:t._commitValidator});var o=r.state;"pending"===o.status?i(o.revision):"valid"===o.status?t.done():n({type:"SET_HOLDING",payload:!1})}else t.done();else i(e.revision)};return{handleDone:function(){c(t.getMode())?o(r.state):t.done()},onEditCheckSettled:function(e){if(Q.has(t)){var r=Q.get(t)===e.revision;r&&"pending"===e.status||(Q.delete(t),r&&"valid"===e.status?o(e):n({type:"SET_HOLDING",payload:!1}))}}}}({draw:p,dispatch:y})),{},{handleCancel:function(){var e,t=p.getMode(),n=c(t)&&!(null==h||!h.id),r=n&&J.get(p)===h.id,i=null!==(e=g.heldId)&&void 0!==e?e:r?h.id:void 0;n&&!r&&p.add(d),J.delete(p),g.release(),p.cancel(),void 0!==i&&p.delete(i),l(),a.emit("draw:cancelled",L(d))},handleUndo:function(){return p.undo()},handleDeleteVertex:function(){return p.deleteVertex()},handleSnap:function(){i.dispatch({type:"TOGGLE_SNAP"}),p.setSnapEnabled(!i.snap)},onCancel:function(){g.reset()}},re({appState:t,appConfig:n,mapState:r,draw:p,dispatch:y,eventBus:a,resetState:l})),function(e){var t=e.draw,n=e.pluginState,r=e.mapProvider,i=e.eventBus;return{onVertexSelection:function(e){n.dispatch({type:"SET_SELECTED_VERTEX_INDEX",payload:e}),r.activeMoveTarget=e.index>=0?function(e){return{move:function(t,n,r){return e.nudgeSelectedVertex(t,n,r)},label:"vertex"}}(t):null,i.emit("draw:vertexselection",e)},onVertexChange:function(e){n.dispatch({type:"SET_SELECTED_VERTEX_INDEX",payload:{index:-1,numVertices:e.numVertices}}),r.activeMoveTarget=null}}}({draw:p,pluginState:i,mapProvider:o,eventBus:a})),{},{onUndoChange:function(e){i.dispatch({type:"SET_UNDO_STACK_LENGTH",payload:e})},onUpdate:function(e){a.emit("draw:updated",L(e))},onGeometryChange:function(e){if(null!=e&&e.phase){var t=p.getMode();f(t)&&g.run({feature:e.feature,context:{phase:e.phase,vertexIndex:e.vertexIndex,mode:t},onGeometryChange:p._commitValidator})}},onPlacementBlocked:function(e){e.announcement&&(null==s||s(e.announcement,"action")),u(X(X({},e),{},{feature:L(e.feature)}))},onValidityChange:function(e){i.dispatch({type:"SET_PREVIEW_VALID",payload:e.valid})},onCanPlaceChange:function(e){i.dispatch({type:"SET_CAN_ADD_POINT",payload:e.canPlace})},onInterfaceTypeChange:function(e){a.emit("draw:interfacetypechange",{interfaceType:e.interfaceType})}})}({appState:t,appConfig:n,mapState:r,pluginState:i,mapProvider:o,eventBus:u,emitGeometryInvalid:d,announce:l,resetState:function(){i.dispatch({type:"SET_MODE",payload:null}),i.dispatch({type:"SET_FEATURE",payload:{feature:null,tempFeature:null}}),o.activeMoveTarget=null,U(p).reset(),Q.delete(p)}}),y=U(p),g=function(e){var t=e.draw,n=e.dispatch,r=e.emitGeometryInvalid,i=e.announce;return function(e){var o,a,u=e.status,s=e.result,l=e.context,f=e.feature,p="valid"===u;if(n(e.slow?{type:"SET_CHECK_SLOW"}:{type:"SET_VALIDATION_STATUS",payload:u}),function(e,t){var n=t.status,r=t.result,i=t.slow,o=t.afterPending;null!=r&&r.announcement?null==e||e(r.announcement,"action"):"pending"===n?i&&(null==e||e(ne.pending,"action")):o&&(null==e||e("invalid"===n&&r.reason||ne[n],"action"))}(i,e),null===(o=t.setCanFinish)||void 0===o||o.call(t,p||"pending"===u),"pending"!==u&&"error"!==u&&(c(t.getMode())&&(null===(a=t.setInvalid)||void 0===a||a.call(t,!p)),!p&&"edit-start"!==(null==l?void 0:l.phase))){var d=s.reason,h=s.source,y=s.announcement;r(X(X({reason:d,source:h,announcement:y},l),{},{feature:L(f)}))}}}({draw:p,dispatch:i.dispatch,emitGeometryInvalid:d,announce:l});return y.setOnSettle(function(e){g(e),h.onCheckSettled(e),h.onEditCheckSettled(e)}),function(e,t){var n=e.drawDone,r=e.drawCancel,i=e.drawUndo,o=e.drawDeletePoint,a=e.drawSnap;n.onClick=t.handleDone,r.onClick=t.handleCancel,i.onClick=t.handleUndo,o&&(o.onClick=t.handleDeleteVertex),a&&(a.onClick=t.handleSnap)}(a,h),function(e,t){e.on(P.k.CREATE,t.onCreate),e.on(P.k.EDIT_FINISH,t.onEditFinish),e.on(P.k.CANCEL,t.onCancel),e.on(P.k.VERTEX_SELECTION,t.onVertexSelection),e.on(P.k.VERTEX_CHANGE,t.onVertexChange),e.on(P.k.UNDO_CHANGE,t.onUndoChange),e.on(P.k.UPDATE,t.onUpdate),e.on(P.k.GEOMETRY_CHANGE,t.onGeometryChange),e.on(P.k.PLACEMENT_BLOCKED,t.onPlacementBlocked),e.on(P.k.VALIDITY_CHANGE,t.onValidityChange),e.on(P.k.CAN_PLACE_CHANGE,t.onCanPlaceChange),e.on(P.k.INTERFACE_TYPE_CHANGE,t.onInterfaceTypeChange)}(p,h),function(){y.setOnSettle(null),function(e){var t=e.drawDone,n=e.drawCancel,r=e.drawUndo,i=e.drawDeletePoint,o=e.drawSnap;t.onClick=null,n.onClick=null,r.onClick=null,i&&(i.onClick=null),o&&(o.onClick=null)}(a),function(e,t){e.off(P.k.CREATE,t.onCreate),e.off(P.k.EDIT_FINISH,t.onEditFinish),e.off(P.k.CANCEL,t.onCancel),e.off(P.k.VERTEX_SELECTION,t.onVertexSelection),e.off(P.k.VERTEX_CHANGE,t.onVertexChange),e.off(P.k.UNDO_CHANGE,t.onUndoChange),e.off(P.k.UPDATE,t.onUpdate),e.off(P.k.GEOMETRY_CHANGE,t.onGeometryChange),e.off(P.k.PLACEMENT_BLOCKED,t.onPlacementBlocked),e.off(P.k.VALIDITY_CHANGE,t.onValidityChange),e.off(P.k.CAN_PLACE_CHANGE,t.onCanPlaceChange),e.off(P.k.INTERFACE_TYPE_CHANGE,t.onInterfaceTypeChange)}(p,h)}}function oe(e){return oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oe(e)}function ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ae(Object(n),!0).forEach(function(t){se(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ae(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function se(e,t,n){return(t=function(e){var t=function(e){if("object"!=oe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==oe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le="edit_vertex",ce="draw",fe=function(e,t,n){var r=e.mapToScreen(n);return{x:r.x*t,y:r.y*t}};function pe(e){var t=e.mapState,n=e.pluginState,r=e.services,i=e.mapProvider,o=e.spatialListRegistry,a=e.viewportRef,u=t.mapSizeScale,s=r.eventBus,l=r.announce,c=(0,v.useRef)([]),f=(0,v.useRef)(null);!function(e){var t=e.pluginState,n=e.mapProvider,r=e.mapSizeScale,i=e.spatialListRegistry,o=e.itemsRef,a=e.eventBus;(0,v.useEffect)(function(){var e=function(){o.current=t.mode===le?function(e,t){var n,r,i,o=null!==(n=null===(r=e.draw)||void 0===r||null===(i=r.getVertexItems)||void 0===i?void 0:i.call(r))&&void 0!==n?n:{vertices:[],midpoints:[]},a=o.vertices,u=o.midpoints,s=[];return a.forEach(function(n,r){s.push(function(n,r){return ue({id:String(r),label:"Point ".concat(r+1),isMidpoint:!1},fe(e,t,n))}(n,r)),r<u.length&&s.push(function(n,r){return ue({id:String(a.length+r),label:"Insert ".concat(r+1,"-").concat((r+1)%a.length+1),isMidpoint:!0},fe(e,t,n))}(u[r],r))}),s}(n,r):[],i.notifyItemsChanged(ce)};e(),a.on(m.MAP_MOVE_END,e);var u=n.draw;return u?(u.on(P.k.UPDATE,e),function(){a.off(m.MAP_MOVE_END,e),u.off(P.k.UPDATE,e)}):function(){return a.off(m.MAP_MOVE_END,e)}},[t.mode,n,r,i,o,a]),(0,v.useEffect)(function(){return i.registerItemProvider(ce,{getItems:function(){return{items:o.current,multiselectable:!1,label:"Shape points",focusable:!1}},exclusive:!0}),function(){i.unregisterItemProvider(ce)}},[i,o]),(0,v.useEffect)(function(){if(t.mode===le)return i.claimExclusive(ce),function(){return i.releaseExclusive(ce)}},[t.mode,i])}({pluginState:n,mapProvider:i,mapSizeScale:u,spatialListRegistry:o,itemsRef:c,eventBus:s}),function(e){var t=e.eventBus,n=e.mapProvider,r=e.pluginState,i=e.activeIdRef;(0,v.useEffect)(function(){var e=function(e){var t,o,a=e.id;i.current=a,null!==a&&r.mode===le&&(null===(t=n.draw)||void 0===t||null===(o=t.selectVertex)||void 0===o||o.call(t,Number(a)))};return t.on(m.MAP_SET_ACTIVE_ITEM,e),function(){t.off(m.MAP_SET_ACTIVE_ITEM,e)}},[t,n,r.mode,i])}({eventBus:s,mapProvider:i,pluginState:n,activeIdRef:f}),function(e){var t=e.eventBus,n=e.mapProvider,r=e.pluginState,i=e.activeIdRef,o=e.itemsRef,a=e.viewportRef,u=e.announce;(0,v.useEffect)(function(){var e=function(){var e;if(r.mode===le&&null!==i.current){var t,s,l=o.current.find(function(e){return e.id===i.current});l&&(l.isMidpoint?(null===(t=n.draw)||void 0===t||null===(s=t.insertVertexAtMidpoint)||void 0===s||s.call(t,Number(i.current)),u("New point inserted","action")):u("".concat(l.label," selected"),"action"),null===(e=a.current)||void 0===e||e.focus())}};return t.on(m.MAP_SELECT_ITEM,e),function(){t.off(m.MAP_SELECT_ITEM,e)}},[t,n,r.mode,i,o,a,u])}({eventBus:s,mapProvider:i,pluginState:n,activeIdRef:f,itemsRef:c,viewportRef:a,announce:l})}var de=n(682),he=function(e){var t,n=e.appState,r=e.pluginState;return l(r.mode)&&("touch"===n.interfaceType||!(null===(t=n.expandedButtons)||void 0===t||!t.has("mapControls")))};function ye(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var s=r&&r.prototype instanceof u?r:u,l=Object.create(s.prototype);return ge(l,"_invoke",function(n,r,i){var o,u,s,l=0,c=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,u=0,s=e,p.n=n,a}};function d(n,r){for(u=n,s=r,t=0;!f&&l&&!i&&t<c.length;t++){var i,o=c[t],d=p.p,h=o[2];n>3?(i=h===r)&&(s=o[(u=o[4])?5:(u=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=n<2&&d<o[1])?(u=0,p.v=r,p.n=o[1]):d<h&&(i=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,p.n=h,u=0))}if(i||n>1)return a;throw f=!0,r}return function(i,c,h){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&d(c,h),u=c,s=h;(t=u<2?e:s)||!f;){o||(u?u<3?(u>1&&(p.n=-1),d(u,s)):p.n=s:p.v=s);try{if(l=2,o){if(u||(i="next"),t=o[i]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,u<2&&(u=0)}else 1===u&&(t=o.return)&&t.call(o),u<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),u=1);o=e}else if((t=(f=p.n<0)?s:n.call(r,p))!==a)break}catch(t){o=e,u=1,s=t}finally{l=1}}return{value:t,done:f}}}(n,i,o),!0),l}var a={};function u(){}function s(){}function l(){}t=Object.getPrototypeOf;var c=[][r]?t(t([][r]())):(ge(t={},r,function(){return this}),t),f=l.prototype=u.prototype=Object.create(c);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,ge(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return s.prototype=l,ge(f,"constructor",l),ge(l,"constructor",s),s.displayName="GeneratorFunction",ge(l,i,"GeneratorFunction"),ge(f),ge(f,i,"Generator"),ge(f,r,function(){return this}),ge(f,"toString",function(){return"[object Generator]"}),(ye=function(){return{w:o,m:p}})()}function ge(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}ge=function(e,t,n,r){function o(t,n){ge(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},ge(e,t,n,r)}function ve(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}var me=function(){return new Promise(function(e){return setTimeout(e,0)})};function be(e){return be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},be(e)}function Se(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return we(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?we(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function we(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ee=new Set(["stroke","fill","strokeWidth"]),Pe=function(e){if(!e)return{};for(var t={},n=0,r=Object.entries(e);n<r.length;n++){var i=Se(r[n],2),o=i[0],a=i[1];if(Ee.has(o)&&"object"===be(a)&&null!==a){var u=Object.entries(a);u.length>0&&(t[o]=u[0][1]);for(var s=0,l=u;s<l.length;s++){var c=Se(l[s],2),f=c[0],p=c[1];t["".concat(o).concat(f.charAt(0).toUpperCase()+f.slice(1))]=p}}else t[o]=a}return t};function Oe(e){return Oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oe(e)}var xe=["stroke","fill","strokeWidth","properties","onGeometryChange","onGeometryPreview"];function _e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(n),!0).forEach(function(t){Ae(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_e(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ae(e,t,n){return(t=function(e){var t=function(e){if("object"!=Oe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Oe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ce=function(e){return function(t,n){var r,i=t.appState,o=t.appConfig,a=t.pluginConfig,u=t.pluginState,s=t.mapState,l=t.mapProvider,c=t.services,f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},p=u.dispatch,d=l.draw,h=c.eventBus;if(d){var y=f.stroke,g=f.fill,v=f.strokeWidth,m=f.properties,b=f.onGeometryChange,S=f.onGeometryPreview,w=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(f,xe);z(d,{onGeometryChange:b,onGeometryPreview:S},a,h),h.emit("draw:started",{mode:e,featureId:n});var E=void 0===f.snapLayers?null!==(r=a.snapLayers)&&void 0!==r?r:null:f.snapLayers;d.setSnapLayers(E),p({type:"SET_HAS_SNAP_LAYERS",payload:(null==E?void 0:E.length)>0});var P=Te(Te({},m),Pe({stroke:y,fill:g,strokeWidth:v}));d.changeMode(e,Te(Te({container:i.layoutRefs.viewportRef.current,addVertexButtonId:"".concat(o.id,"-draw-add-point"),interfaceType:i.interfaceType,crossHair:s.crossHair,getSnapEnabled:function(){return d.isSnapEnabled()},featureId:n},w),{},{properties:P})),p({type:"SET_MODE",payload:e})}}},ke=Ce("draw_polygon"),je=Ce("draw_line");function Ie(e){return Ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ie(e)}var Me=["properties","onGeometryChange","onGeometryPreview"];function Le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Le(Object(n),!0).forEach(function(t){Ne(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Le(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ne(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ie(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ie(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function De(e){return De="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},De(e)}var Ge=["stroke","fill","strokeWidth","properties"];function Ve(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ve(Object(n),!0).forEach(function(t){Be(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ve(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Be(e,t,n){return(t=function(e){var t=function(e){if("object"!=De(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=De(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==De(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ue=new Set(["Point","LineString","Polygon"]);function He(e){return He="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},He(e)}function qe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ze(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qe(Object(n),!0).forEach(function(t){We(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function We(e,t,n){return(t=function(e){var t=function(e){if("object"!=He(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=He(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==He(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ye(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $e(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$e(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Xe=new Set(["stroke","fill","strokeWidth"]),Ke=n(704);function Ze(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Je="_splitter",Qe=function(e){var t,n,r,i,o=e.draw,a=(t=e.polygonFeature,n=e.feature,!(!(i=null===(r=n.geometry)||void 0===r?void 0:r.coordinates)||i.length<2||!(0,Ke.ns)(t,{id:Je,geometry:n.geometry})));return o.setDrawingPreviewProperty("splitter",a?"valid":"invalid"),a},et=function(e){return e?{valid:!0}:{valid:!1,reason:"Line does not split the shape into two parts"}};function tt(e){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tt(e)}function nt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function rt(e,t,n){return(t=function(e){var t=function(e){if("object"!=tt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=tt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==tt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var it=function(){var e;return"undefined"!=typeof navigator&&/mac/i.test((null===(e=navigator.userAgentData)||void 0===e?void 0:e.platform)||navigator.platform||"")};function ot(e){return ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ot(e)}function at(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ut(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?at(Object(n),!0).forEach(function(t){st(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):at(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function st(e,t,n){return(t=function(e){var t=function(e){if("object"!=ot(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ot(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ot(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var lt=it()?"<kbd>Command</kbd> + <kbd>Z</kbd>":"<kbd>Ctrl</kbd> + <kbd>Z</kbd>",ct=it()?"<kbd>Option</kbd>":"<kbd>Alt</kbd>",ft="top-middle",pt=function(e){var t=e.checkSlow,n=e.holding;return!(!t||!n)},dt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"actions";return{mobile:{slot:t,showLabel:e},tablet:{slot:t,showLabel:e},desktop:{slot:t,showLabel:e}}},ht={reducer:{initialState:{mode:null,action:null,actionValid:!1,feature:null,tempFeature:null,selectedVertexIndex:-1,numVertices:null,validationStatus:"idle",checkSlow:!1,holding:!1,previewValid:!0,canAddPoint:!0,snap:!1,hasSnapLayers:!1,undoStackLength:0},actions:g},InitComponent:function(e){var t=e.appState,n=e.appConfig,r=e.mapState,i=e.pluginConfig,o=e.pluginState,a=e.services,s=e.mapProvider,c=e.buttonConfig,f=e.setApplicationMode,p=e.clearApplicationMode,d=a.eventBus,h=a.hints,y=a.symbolRegistry,g=r.crossHair;pe({mapState:r,pluginState:o,services:a,mapProvider:s,spatialListRegistry:t.spatialListRegistry,viewportRef:t.layoutRefs.viewportRef});var b=(0,v.useRef)(!1);b.current=!o.holding&&(he({appState:t,pluginState:o})||l(o.mode)&&"keyboard"===t.interfaceType),function(e){var t=e.mapState,n=e.pluginConfig,r=e.pluginState,i=e.mapProvider,o=e.eventBus,a=e.symbolRegistry,u=(0,v.useRef)(!0),s=(0,v.useRef)(!1);(0,v.useEffect)(function(){if(t.isMapReady&&!s.current){s.current=!0;var e=function(){var e,s=(e=ye().m(function e(){var s,l;return ye().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,me();case 1:if(u.current){e.n=2;break}return e.a(2);case 2:return e.n=3,E(i,{mapStyle:t.mapStyle,snapLayers:n.snapLayers,pluginConfig:n,events:m,eventBus:o,symbolRegistry:a});case 3:if(l=e.v,u.current){e.n=4;break}return l.remove(),e.a(2);case 4:i.draw=l,r.dispatch({type:"SET_HAS_SNAP_LAYERS",payload:(null===(s=n.snapLayers)||void 0===s?void 0:s.length)>0}),o.emit("draw:ready");case 5:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){ve(o,r,i,a,u,"next",e)}function u(e){ve(o,r,i,a,u,"throw",e)}a(void 0)})});return function(){return s.apply(this,arguments)}}();e().catch(function(e){return _.v.error("[draw] failed to load the draw adapter",e)})}},[t.isMapReady]),(0,v.useEffect)(function(){return function(){var e;u.current=!1,null===(e=i.draw)||void 0===e||e.remove(),i.draw=null,i.activeMoveTarget=null}},[])}({mapState:r,pluginConfig:i,pluginState:o,mapProvider:s,eventBus:d,symbolRegistry:y}),(0,v.useLayoutEffect)(function(){if(o.mode)return f(de.V3),function(){return p(de.V3)};p(de.V3)},[o.mode]),(0,v.useEffect)(function(){var e=null!==o.mode&&"edit_vertex"!==o.mode;return d.emit(m.MAP_SET_SPATIAL_LIST_SUPPRESSED,{suppressed:e}),function(){d.emit(m.MAP_SET_SPATIAL_LIST_SUPPRESSED,{suppressed:!1})}},[o.mode,d]),(0,v.useEffect)(function(){if(b.current){var e=g.isVisible;return g.fixAtCenter(),function(){e||b.current||g.hide()}}},[o.mode,o.holding,t.interfaceType,t.expandedButtons]),(0,v.useEffect)(function(){var e;e=o.mode,u.has(e)&&s.draw&&s.draw.setInterfaceType(t.interfaceType)},[t.interfaceType,o.mode]),(0,v.useEffect)(function(){if(s.draw)return ie({appState:t,appConfig:n,mapState:r,mapProvider:s,buttonConfig:c,pluginState:o,events:m,eventBus:d,hints:h,announce:a.announce})},[s,t,o])},applicationModes:st({},de.V3,{include:["mapStyles","mapControls","scaleBar"]}),buttons:[ut({id:"drawCancel",label:"Cancel",variant:"tertiary",exclusiveSlot:!0,hiddenWhen:function(e){return!e.pluginState.mode}},dt(!0)),ut({id:"drawAddPoint",label:"Add point",variant:"primary",exclusiveSlot:!0,hiddenWhen:function(e){var t=e.appState,n=e.pluginState;return!he({appState:t,pluginState:n})},enableWhen:function(e){var t=e.pluginState;return t.canAddPoint&&!t.holding}},dt(!0)),ut({id:"drawDone",label:function(e){var t=e.pluginState;return pt(t)?"Checking…":"Done"},busyWhen:function(e){var t=e.pluginState;return pt(t)},variant:"primary",exclusiveSlot:!0,hiddenWhen:function(e){var t=e.pluginState;return!f(t.mode)&&!t.holding},enableWhen:function(e){var t=e.pluginState,n=t.mode,r=t.validationStatus,i=t.previewValid,o=t.holding,a="valid"===r||"pending"===r;return f(n)&&a&&i&&!o}},dt(!0)),ut({id:"drawUndo",label:"Undo",iconId:"undo",hiddenWhen:function(e){var t=e.pluginState;return!f(t.mode)},enableWhen:function(e){var t=e.pluginState;return!t.holding&&(s(t.mode)?t.numVertices>0:t.undoStackLength>0)}},dt(!1,ft)),ut({id:"drawSnap",label:"Snap",iconId:"magnet",hiddenWhen:function(e){var t=e.pluginState;return!t.mode||!t.hasSnapLayers},enableWhen:function(e){return!e.pluginState.holding},pressedWhen:function(e){return!!e.pluginState.snap}},dt(!0,ft)),ut({id:"drawDeletePoint",label:"Delete point",iconId:"trash",enableWhen:function(e){var t,n=e.pluginState;return!(n.holding||n.selectedVertexIndex<0)&&("Polygon"===(null===(t=n.feature)||void 0===t||null===(t=t.geometry)||void 0===t?void 0:t.type)?n.numVertices>3:n.numVertices>2)},hiddenWhen:function(e){return"edit_vertex"!==e.pluginState.mode}},dt(!1,ft))],keyboardShortcuts:[{id:"drawAddPoint",group:"Drawing",title:"Add point (draw)",command:"<kbd>Enter</kbd>"},{id:"drawSelectPoint",group:"Drawing",title:"Select nearest point (edit)",command:"<kbd>Spacebar</kbd>"},{id:"drawSelectAdjacentPoint",group:"Drawing",title:"Select adjacent point (edit)",command:"".concat(ct," + <kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> or <kbd>→</kbd>")},{id:"drawMovePoint",group:"Drawing",title:"Move point (edit)",command:"<kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> or <kbd>→</kbd>"},{id:"drawNudgePoint",group:"Drawing",title:"Nudge point (edit)",command:"<kbd>Shift</kbd> + <kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> or <kbd>→</kbd>"},{id:"drawDeletePoint",group:"Drawing",title:"Delete point (edit)",command:"<kbd>Delete</kbd>"},{id:"drawUndo",group:"Drawing",title:"Undo",command:lt}],icons:[{id:"undo",svgContent:'<path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11"/>'},{id:"magnet",svgContent:'<path d="m12 15 4 4"/><path d="M2.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.029-6.029a1 1 0 1 1 3 3l-6.029 6.029a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.365-6.367A1 1 0 0 0 8.716 4.282z"/><path d="m5 8 4 4"/>'},{id:"trash",svgContent:'<path d="M10 11v6"/><path d="M14 11v6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>'}],api:{newPolygon:ke,newLine:je,newPoint:function(e,t){var n,r=e.appState,i=e.appConfig,o=e.pluginConfig,a=e.pluginState,u=e.mapState,s=e.mapProvider,l=e.services,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},f=a.dispatch,p=s.draw,d=l.eventBus;if(p){var h=c.properties,y=c.onGeometryChange,g=c.onGeometryPreview,v=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(c,Me);z(p,{onGeometryChange:y,onGeometryPreview:g},o,d),d.emit("draw:started",{mode:"draw_point",featureId:t});var m=void 0===c.snapLayers?null!==(n=o.snapLayers)&&void 0!==n?n:null:c.snapLayers;p.setSnapLayers(m),f({type:"SET_HAS_SNAP_LAYERS",payload:(null==m?void 0:m.length)>0});var b={};T.forEach(function(e){void 0!==v[e]&&(b[e]=v[e],delete v[e])}),p.changeMode("draw_point",Re(Re({container:r.layoutRefs.viewportRef.current,addVertexButtonId:"".concat(i.id,"-draw-add-point"),interfaceType:r.interfaceType,crossHair:u.crossHair,getSnapEnabled:function(){return p.isSnapEnabled()},featureId:t},v),{},{properties:Re(Re({},h),b)})),f({type:"SET_MODE",payload:"draw_point"})}},editFeature:function(e,t){var n,r=e.appState,i=e.appConfig,o=e.mapState,a=e.pluginConfig,u=e.pluginState,s=e.mapProvider,l=e.services,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},f=u.dispatch,p=s.draw,d=l.eventBus;if(!p)return!1;var h=p.get(t);if(!h)return!1;z(p,c,a,d);var y="Point"===h.geometry.type?"edit_point":"edit_vertex";d.emit("draw:editstart",{mode:{LineString:"edit_line",Polygon:"edit_polygon",Point:"edit_point"}[h.geometry.type],featureId:t});var g=void 0===c.snapLayers?null!==(n=a.snapLayers)&&void 0!==n?n:null:c.snapLayers;p.setSnapLayers(g),f({type:"SET_HAS_SNAP_LAYERS",payload:(null==g?void 0:g.length)>0}),p.changeMode(y,{container:r.layoutRefs.viewportRef.current,deleteVertexButtonId:"".concat(i.id,"-draw-delete-point"),undoButtonId:"".concat(i.id,"-draw-undo"),isPanEnabled:"keyboard"!==r.interfaceType,interfaceType:r.interfaceType,scale:o.mapSizeScale,featureId:t,getSnapEnabled:function(){return p.isSnapEnabled()}});var v=p.get(t);return f({type:"SET_FEATURE",payload:{feature:v,tempFeature:v}}),f({type:"SET_MODE",payload:y}),U(p).run({feature:v,context:{phase:"edit-start",mode:y},onGeometryChange:p._commitValidator}),!0},addFeature:function(e,t){var n=e.mapProvider,r=e.services,i=n.draw,o=r.eventBus;if(i){var a=t.stroke,u=t.fill,s=t.strokeWidth,l=t.properties,c=Fe(Fe({type:"Feature"},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,Ge)),{},{properties:Fe(Fe({},l),Pe({stroke:a,fill:u,strokeWidth:s}))});!function(e){var t,n;return Ue.has(null===(t=e.geometry)||void 0===t?void 0:t.type)&&void 0!==(null===(n=e.geometry)||void 0===n?void 0:n.coordinates)}(c)?_.v.warn("addFeature: ignoring invalid GeoJSON feature",c):(i.add(c),o.emit("draw:add",L(c)))}},setStyle:function(e,t){var n=e.mapProvider,r=e.services,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.draw,a=r.eventBus;if(!o)return!1;if(!o.get(t))return _.v.warn("setStyle: no feature found for id",t),!1;for(var u={},s={},l=0,c=Object.entries(i);l<c.length;l++){var f=Ye(c[l],2),p=f[0],d=f[1];(Xe.has(p)?u:s)[p]=d}var h=function(e){for(var t={},n=0,r=Object.entries(e);n<r.length;n++){var i=Ye(r[n],2),o=i[0],a=i[1];void 0!==a&&(t[o]=a)}return t}(ze(ze({},Pe(u)),s));return o.setStyle(t,h),a.emit("draw:stylechange",{featureId:t,properties:h}),!0},deleteFeature:function(e,t){var n=e.mapProvider,r=e.services,i=n.draw,o=r.eventBus;i&&(i.delete(t),o.emit("draw:delete",{featureId:t}))},split:function(e,t){var n,r=e.appState,i=e.appConfig,o=e.pluginState,a=e.mapState,u=e.mapProvider,s=e.services,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=o.dispatch,f=u.draw,p=s.eventBus;if(f){var d=f.get(t),h=f._previewValidator,y=f._commitValidator;f._previewValidator=function(e){var t=e.draw,n=e.polygonFeature;return function(e){var r=e.feature;return"preview"===e.phase?et(Qe({draw:t,polygonFeature:n,feature:r})):{valid:!0}}}({draw:f,polygonFeature:d}),f._commitValidator=function(e){var t=e.draw,n=e.dispatch,r=e.polygonFeature;return function(e){var i=e.feature;return e.phase===P.P?et(function(e){var t=e.dispatch,n=Qe({draw:e.draw,polygonFeature:e.polygonFeature,feature:e.feature});return t({type:"SET_ACTION",payload:{name:"split",isValid:n}}),n}({draw:t,dispatch:n,polygonFeature:r,feature:i})):{valid:!0}}}({draw:f,dispatch:c,polygonFeature:d}),U(f).reset();var g=["stroke-inactive.cold"].concat(function(e){if(Array.isArray(e))return Ze(e)}(n=l.snapLayers||[])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||function(e,t){if(e){if("string"==typeof e)return Ze(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ze(e,t):void 0}}(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());f.setSnapLayers(g),c({type:"SET_HAS_SNAP_LAYERS",payload:!0}),f.changeMode("draw_line",{container:r.layoutRefs.viewportRef.current,addVertexButtonId:"".concat(i.id,"-draw-add-point"),interfaceType:r.interfaceType,crossHair:null==a?void 0:a.crossHair,getSnapEnabled:function(){return f.isSnapEnabled()},featureId:Je,properties:{splitter:"invalid"}});var v=function(){f._previewValidator=h,f._commitValidator=y,f.off(P.k.CREATE,m),f.off(P.k.CANCEL,b)},m=function(e){v(),f.delete(Je);var n=(0,Ke.ns)(d,e);c({type:"SET_ACTION",payload:{name:"split",isValid:!!n}}),n&&p.emit("draw:split",{originalFeatureId:t,featureCollection:n})},b=function(){v()};f.on(P.k.CREATE,m),f.on(P.k.CANCEL,b),c({type:"SET_MODE",payload:"draw_line"}),c({type:"SET_ACTION",payload:{name:"split"}})}},merge:function(e,t){var n=e.mapProvider,r=e.services,i=n.draw,o=r.eventBus;if(!i)return null;var a=t.map(function(e){return i.get(e)}),u=(0,Ke.OI)(a);return u&&o.emit("draw:merge",{originalFeatureIds:t,feature:u}),u},setGeometry:function(e,t){var n,r,i=e.mapProvider,o=e.pluginState,a=i.draw;if(!a||!c(a.getMode()))return!1;var u,s=a.get(null===(n=o.feature)||void 0===n?void 0:n.id);return!(!s||(null===(r=s.geometry)||void 0===r?void 0:r.type)!==(null==t?void 0:t.type)||(a.setGeometry({type:t.type,coordinates:(u=t.coordinates,JSON.parse(JSON.stringify(u)))}),0))},recheckGeometry:function(e,t){var n=e.mapProvider.draw;if(!n)return!1;var r=n.getMode(),i=U(n),o=i.state.feature;if(!f(r)||!o)return!1;var a=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nt(Object(n),!0).forEach(function(t){rt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({phase:"recheck",mode:r},void 0!==t&&{detail:t});return i.run({feature:o,context:a,onGeometryChange:n._commitValidator}),!0}}}},704:function(e,t,n){function r(e){var t={type:"Feature"};return Object.keys(e).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:t[n]=e[n]}}),t.properties=i(e.properties),t.geometry=o(e.geometry),t}function i(e){var t={};return e?(Object.keys(e).forEach(function(n){var r=e[n];"object"==typeof r?null===r?t[n]=null:Array.isArray(r)?t[n]=r.map(function(e){return e}):t[n]=i(r):t[n]=r}),t):t}function o(e){var t={type:e.type};return e.bbox&&(t.bbox=e.bbox),"GeometryCollection"===e.type?(t.geometries=e.geometries.map(function(e){return o(e)}),t):(t.coordinates=a(e.coordinates),t)}function a(e){var t=e;return"object"!=typeof t[0]?t.slice():t.map(function(e){return a(e)})}n.d(t,{jK:function(){return ht},DF:function(){return dt},OI:function(){return ft},ns:function(){return ct}});function u(e){for(var t,n,r=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}(e),i=0,o=1;o<r.length;)t=n||r[0],i+=((n=r[o])[0]-t[0])*(n[1]+t[1]),o++;return i>0}function s(e,t){if("Feature"===e.type)t(e,0);else if("FeatureCollection"===e.type)for(var n=0;n<e.features.length&&!1!==t(e.features[n],n);n++);}function l(e,t){var n,r,i,o,a,u,s,l,c,f,p=0,d="FeatureCollection"===e.type,h="Feature"===e.type,y=d?e.features.length:1;for(n=0;n<y;n++){for(u=d?e.features[n].geometry:h?e.geometry:e,l=d?e.features[n].properties:h?e.properties:{},c=d?e.features[n].bbox:h?e.bbox:void 0,f=d?e.features[n].id:h?e.id:void 0,a=(s=!!u&&"GeometryCollection"===u.type)?u.geometries.length:1,i=0;i<a;i++)if(null!==(o=s?u.geometries[i]:u))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,p,l,c,f))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===t(o.geometries[r],p,l,c,f))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,p,l,c,f))return!1;p++}}function c(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function f(e,t){switch("Feature"===e.type?e.geometry.type:e.type){case"GeometryCollection":return l(e,function(e){f(e,t)}),e;case"LineString":return p(c(e),t),e;case"Polygon":return d(c(e),t),e;case"MultiLineString":return c(e).forEach(function(e){p(e,t)}),e;case"MultiPolygon":return c(e).forEach(function(e){d(e,t)}),e;case"Point":case"MultiPoint":return e}}function p(e,t){u(e)===t&&e.reverse()}function d(e,t){u(e[0])!==t&&e[0].reverse();for(var n=1;n<e.length;n++)u(e[n])===t&&e[n].reverse()}var h=function(e,t){if(!(n=t=t||{})||n.constructor!==Object)throw new Error("options is invalid");var n,i=t.reverse||!1,a=t.mutate||!1;if(!e)throw new Error("<geojson> is required");if("boolean"!=typeof i)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof a)throw new Error("<mutate> must be a boolean");!1===a&&(e=function(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return r(e);case"FeatureCollection":return function(e){var t={type:"FeatureCollection"};return Object.keys(e).forEach(function(n){switch(n){case"type":case"features":return;default:t[n]=e[n]}}),t.features=e.features.map(function(e){return r(e)}),t}(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return o(e);default:throw new Error("unknown GeoJSON type")}}(e));var u=[];switch(e.type){case"GeometryCollection":return l(e,function(e){f(e,i)}),e;case"FeatureCollection":return s(e,function(e){s(f(e,i),function(e){u.push(e)})}),function(e,t){void 0===t&&(t={});var n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}(u)}return f(e,i)};const y=11102230246251565e-32,g=134217729,v=(3+8*y)*y;function m(e,t,n,r,i){let o,a,u,s,l=t[0],c=r[0],f=0,p=0;c>l==c>-l?(o=l,l=t[++f]):(o=c,c=r[++p]);let d=0;if(f<e&&p<n)for(c>l==c>-l?(a=l+o,u=o-(a-l),l=t[++f]):(a=c+o,u=o-(a-c),c=r[++p]),o=a,0!==u&&(i[d++]=u);f<e&&p<n;)c>l==c>-l?(a=o+l,s=a-o,u=o-(a-s)+(l-s),l=t[++f]):(a=o+c,s=a-o,u=o-(a-s)+(c-s),c=r[++p]),o=a,0!==u&&(i[d++]=u);for(;f<e;)a=o+l,s=a-o,u=o-(a-s)+(l-s),l=t[++f],o=a,0!==u&&(i[d++]=u);for(;p<n;)a=o+c,s=a-o,u=o-(a-s)+(c-s),c=r[++p],o=a,0!==u&&(i[d++]=u);return 0===o&&0!==d||(i[d++]=o),d}function b(e){return new Float64Array(e)}const S=b(4),w=b(8),E=b(12),P=b(16),O=b(4);function x(e,t,n,r,i,o){const a=(t-o)*(n-i),u=(e-i)*(r-o),s=a-u,l=Math.abs(a+u);return Math.abs(s)>=33306690738754716e-32*l?s:-function(e,t,n,r,i,o,a){let u,s,l,c,f,p,d,h,y,b,x,_,T,A,C,k,j,I;const M=e-i,L=n-i,R=t-o,N=r-o;A=M*N,p=g*M,d=p-(p-M),h=M-d,p=g*N,y=p-(p-N),b=N-y,C=h*b-(A-d*y-h*y-d*b),k=R*L,p=g*R,d=p-(p-R),h=R-d,p=g*L,y=p-(p-L),b=L-y,j=h*b-(k-d*y-h*y-d*b),x=C-j,f=C-x,S[0]=C-(x+f)+(f-j),_=A+x,f=_-A,T=A-(_-f)+(x-f),x=T-k,f=T-x,S[1]=T-(x+f)+(f-k),I=_+x,f=I-_,S[2]=_-(I-f)+(x-f),S[3]=I;let D=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,S),G=22204460492503146e-32*a;if(D>=G||-D>=G)return D;if(f=e-M,u=e-(M+f)+(f-i),f=n-L,l=n-(L+f)+(f-i),f=t-R,s=t-(R+f)+(f-o),f=r-N,c=r-(N+f)+(f-o),0===u&&0===s&&0===l&&0===c)return D;if(G=11093356479670487e-47*a+v*Math.abs(D),D+=M*c+N*u-(R*l+L*s),D>=G||-D>=G)return D;A=u*N,p=g*u,d=p-(p-u),h=u-d,p=g*N,y=p-(p-N),b=N-y,C=h*b-(A-d*y-h*y-d*b),k=s*L,p=g*s,d=p-(p-s),h=s-d,p=g*L,y=p-(p-L),b=L-y,j=h*b-(k-d*y-h*y-d*b),x=C-j,f=C-x,O[0]=C-(x+f)+(f-j),_=A+x,f=_-A,T=A-(_-f)+(x-f),x=T-k,f=T-x,O[1]=T-(x+f)+(f-k),I=_+x,f=I-_,O[2]=_-(I-f)+(x-f),O[3]=I;const V=m(4,S,4,O,w);A=M*c,p=g*M,d=p-(p-M),h=M-d,p=g*c,y=p-(p-c),b=c-y,C=h*b-(A-d*y-h*y-d*b),k=R*l,p=g*R,d=p-(p-R),h=R-d,p=g*l,y=p-(p-l),b=l-y,j=h*b-(k-d*y-h*y-d*b),x=C-j,f=C-x,O[0]=C-(x+f)+(f-j),_=A+x,f=_-A,T=A-(_-f)+(x-f),x=T-k,f=T-x,O[1]=T-(x+f)+(f-k),I=_+x,f=I-_,O[2]=_-(I-f)+(x-f),O[3]=I;const F=m(V,w,4,O,E);A=u*c,p=g*u,d=p-(p-u),h=u-d,p=g*c,y=p-(p-c),b=c-y,C=h*b-(A-d*y-h*y-d*b),k=s*l,p=g*s,d=p-(p-s),h=s-d,p=g*l,y=p-(p-l),b=l-y,j=h*b-(k-d*y-h*y-d*b),x=C-j,f=C-x,O[0]=C-(x+f)+(f-j),_=A+x,f=_-A,T=A-(_-f)+(x-f),x=T-k,f=T-x,O[1]=T-(x+f)+(f-k),I=_+x,f=I-_,O[2]=_-(I-f)+(x-f),O[3]=I;const B=m(F,E,4,O,P);return P[B-1]}(e,t,n,r,i,o,l)}function _(e,t){var n,r,i,o,a,u,s,l,c,f=0,p=e[0],d=e[1],h=t.length;for(n=0;n<h;n++){r=0;var y=t[n],g=y.length-1;if((l=y[0])[0]!==y[g][0]&&l[1]!==y[g][1])throw new Error("First and last coordinates in a ring must be the same");for(o=l[0]-p,a=l[1]-d;r<g;r++){if(u=(c=y[r+1])[0]-p,s=c[1]-d,0===a&&0===s){if(u<=0&&o>=0||o<=0&&u>=0)return 0}else if(s>=0&&a<=0||s<=0&&a>=0){if(0===(i=x(o,u,a,s,0,0)))return 0;(i>0&&s>0&&a<=0||i<0&&s<=0&&a>0)&&f++}l=c,a=s,o=u}}return f%2!=0}b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(8),b(8),b(8),b(4),b(8),b(8),b(8),b(12),b(192),b(192),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(8),b(8),b(8),b(8),b(8),b(8),b(8),b(8),b(8),b(4),b(4),b(4),b(8),b(16),b(16),b(16),b(32),b(32),b(48),b(64),b(1152),b(1152),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(1152),b(1152),b(1152),b(1152),b(1152),b(2304),b(2304),b(3456),b(5760),b(8),b(8),b(8),b(16),b(24),b(48),b(48),b(96),b(192),b(384),b(384),b(384),b(768),b(96),b(96),b(96),b(1152);const T=134217729;function A(e,t,n,r,i){let o,a,u,s,l=t[0],c=r[0],f=0,p=0;c>l==c>-l?(o=l,l=t[++f]):(o=c,c=r[++p]);let d=0;if(f<e&&p<n)for(c>l==c>-l?(a=l+o,u=o-(a-l),l=t[++f]):(a=c+o,u=o-(a-c),c=r[++p]),o=a,0!==u&&(i[d++]=u);f<e&&p<n;)c>l==c>-l?(a=o+l,s=a-o,u=o-(a-s)+(l-s),l=t[++f]):(a=o+c,s=a-o,u=o-(a-s)+(c-s),c=r[++p]),o=a,0!==u&&(i[d++]=u);for(;f<e;)a=o+l,s=a-o,u=o-(a-s)+(l-s),l=t[++f],o=a,0!==u&&(i[d++]=u);for(;p<n;)a=o+c,s=a-o,u=o-(a-s)+(c-s),c=r[++p],o=a,0!==u&&(i[d++]=u);return 0===o&&0!==d||(i[d++]=o),d}function C(e){return new Float64Array(e)}const k=C(4),j=C(8),I=C(12),M=C(16),L=C(4);function R(e,t,n,r,i,o){const a=(t-o)*(n-i),u=(e-i)*(r-o),s=a-u;if(0===a||0===u||a>0!=u>0)return s;const l=Math.abs(a+u);return Math.abs(s)>=33306690738754716e-32*l?s:-function(e,t,n,r,i,o,a){let u,s,l,c,f,p,d,h,y,g,v,m,b,S,w,E,P,O;const x=e-i,_=n-i,C=t-o,R=r-o;S=x*R,p=T*x,d=p-(p-x),h=x-d,p=T*R,y=p-(p-R),g=R-y,w=h*g-(S-d*y-h*y-d*g),E=C*_,p=T*C,d=p-(p-C),h=C-d,p=T*_,y=p-(p-_),g=_-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,k[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,k[1]=b-(v+f)+(f-E),O=m+v,f=O-m,k[2]=m-(O-f)+(v-f),k[3]=O;let N=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,k),D=22204460492503146e-32*a;if(N>=D||-N>=D)return N;if(f=e-x,u=e-(x+f)+(f-i),f=n-_,l=n-(_+f)+(f-i),f=t-C,s=t-(C+f)+(f-o),f=r-R,c=r-(R+f)+(f-o),0===u&&0===s&&0===l&&0===c)return N;if(D=11093356479670487e-47*a+33306690738754706e-32*Math.abs(N),N+=x*c+R*u-(C*l+_*s),N>=D||-N>=D)return N;S=u*R,p=T*u,d=p-(p-u),h=u-d,p=T*R,y=p-(p-R),g=R-y,w=h*g-(S-d*y-h*y-d*g),E=s*_,p=T*s,d=p-(p-s),h=s-d,p=T*_,y=p-(p-_),g=_-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,L[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,L[1]=b-(v+f)+(f-E),O=m+v,f=O-m,L[2]=m-(O-f)+(v-f),L[3]=O;const G=A(4,k,4,L,j);S=x*c,p=T*x,d=p-(p-x),h=x-d,p=T*c,y=p-(p-c),g=c-y,w=h*g-(S-d*y-h*y-d*g),E=C*l,p=T*C,d=p-(p-C),h=C-d,p=T*l,y=p-(p-l),g=l-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,L[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,L[1]=b-(v+f)+(f-E),O=m+v,f=O-m,L[2]=m-(O-f)+(v-f),L[3]=O;const V=A(G,j,4,L,I);S=u*c,p=T*u,d=p-(p-u),h=u-d,p=T*c,y=p-(p-c),g=c-y,w=h*g-(S-d*y-h*y-d*g),E=s*l,p=T*s,d=p-(p-s),h=s-d,p=T*l,y=p-(p-l),g=l-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,L[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,L[1]=b-(v+f)+(f-E),O=m+v,f=O-m,L[2]=m-(O-f)+(v-f),L[3]=O;const F=A(V,I,4,L,M);return M[F-1]}(e,t,n,r,i,o,l)}C(4),C(4),C(4),C(4),C(4),C(4),C(4),C(4),C(4),C(8),C(8),C(8),C(4),C(8),C(8),C(8),C(12),C(192),C(192),C(4),C(4),C(4),C(4),C(4),C(4),C(4),C(4),C(8),C(8),C(8),C(8),C(8),C(8),C(8),C(8),C(8),C(4),C(4),C(4),C(8),C(16),C(16),C(16),C(32),C(32),C(48),C(64),C(1152),C(1152),C(4),C(4),C(4),C(4),C(4),C(4),C(4),C(4),C(4),C(4),C(24),C(24),C(24),C(24),C(24),C(24),C(24),C(24),C(24),C(24),C(1152),C(1152),C(1152),C(1152),C(1152),C(2304),C(2304),C(3456),C(5760),C(8),C(8),C(8),C(16),C(24),C(48),C(48),C(96),C(192),C(384),C(384),C(384),C(768),C(96),C(96),C(96),C(1152);var N=function(e,t,n,r,i){this.p1=e,this.p2=t,this.edgeType=n,this.originalIndex=r,this.polygonContourId=i,this.interiorRing=!1,this.minX=Math.min(e.p[0],t.p[0]),this.minY=Math.min(e.p[1],t.p[1]),this.maxX=Math.max(e.p[0],t.p[0]),this.maxY=Math.max(e.p[1],t.p[1]),this.intersectionPoints=[],this.nextEdge=null},D=function(e){this.p=e},G=function(e,t){this.id=e,this.rawCoords=t};function V(e,t){return!(e.maxX<t[0]||e.minX>t[2]||e.maxY<t[1]||e.minY>t[3])}var F=function(e,t,n,r){this.p=e,this.polylineEdge=t,this.polygonEdge=n,this.isHeadingIn=r,this.distanceFromPolylineEdgeStart=B(this.polylineEdge.p1.p,this.p),this.distanceFromPolygonEdgeStart=B(this.polygonEdge.p1.p,this.p),this.polygonEdge.intersectionPoints.push(this),this.polylineEdge.intersectionPoints.push(this),this.visitCount=0};function B(e,t){var n=t[0]-e[0],r=t[1]-e[1];return n*=n,r*=r,Math.sqrt(n+r)}F.prototype.incrementVisitCount=function(){this.visitCount=this.visitCount+1};function U(e,t){return e[0]*t[1]-e[1]*t[0]}function H(e,t){return e[0]*t[0]+e[1]*t[1]}function q(e,t,n){return[e[0]+t*n[0],e[1]+t*n[1]]}function z(e,t,n){var r=[e.p2.p[0]-e.p1.p[0],e.p2.p[1]-e.p1.p[1]],i=[t.p2.p[0]-t.p1.p[0],t.p2.p[1]-t.p1.p[1]],o=[t.p1.p[0]-e.p1.p[0],t.p1.p[1]-e.p1.p[1]],a=U(r,i),u=a*a,s=H(r,r);if(u>0){var l=U(o,i)/a;if(l<0||l>1)return null;var c=U(o,r)/a;return c<0||c>1?null:0===l||1===l?n?null:[q(e.p1.p,l,r)]:0===c||1===c?n?null:[q(t.p1.p,c,i)]:[q(e.p1.p,l,r)]}var f=H(o,o);if((u=(a=U(o,r))*a)>1e-9*s*f)return null;var p=H(r,o)/s,d=p+H(r,i)/s,h=Math.min(p,d),y=Math.max(p,d);return h<=1&&y>=0?1===h?n?null:[q(e.p1.p,h>0?h:0,r)]:0===y?n?null:[q(e.p1.p,y<1?y:1,r)]:n&&0===h&&1===y?null:[q(e.p1.p,h>0?h:0,r),q(e.p1.p,y<1?y:1,r)]:null}function W(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.polygonContourId===t)return r}}function Y(e,t){return t.find(function(t){return t.id===e.polygonContourId}).rawCoords}function $(e,t){for(var n=0;n<t.length;n++){var r=t[n];if(_(e[0],[r[0]]))return void r.push(e)}t.push([e])}function X(e,t){var n=e.polygonEdge;if(n.intersectionPoints.length>1&&n.intersectionPoints[n.intersectionPoints.length-1]!==e){var r=K(e,n.intersectionPoints),i=n.intersectionPoints[r+1];return t.push(i.p),i.incrementVisitCount(),i}for(var o=!0;o;){if(t.push(n.p2.p),null===(n=n.nextEdge))return e;n.intersectionPoints.length>0&&(o=!1)}return n.intersectionPoints[0].incrementVisitCount(),t.push(n.intersectionPoints[0].p),n.intersectionPoints[0]}function K(e,t){for(var n=0;n<t.length;n++)if(t[n]===e)return n;return null}function Z(e,t){var n=e.polylineEdge;if(2===n.intersectionPoints.length){var r=n.intersectionPoints[n.intersectionPoints.length-1];if(r===e){var i=n.intersectionPoints[0];return t.push(i.p),i.incrementVisitCount(),i}return t.push(r.p),r.incrementVisitCount(),r}if(n.intersectionPoints.length>2&&n.intersectionPoints[0]!==e){var o=K(e,n.intersectionPoints),a=n.intersectionPoints[o-1];return t.push(a.p),a.incrementVisitCount(),a}for(var u=!0;u;){if(t.push(n.p1.p),void 0===(n=n.prevEdge).originalIndex)return e;n.intersectionPoints.length>0&&(u=!1)}if(void 0===n.originalIndex)return e;var s=n.intersectionPoints[n.intersectionPoints.length-1];return s.incrementVisitCount(),t.push(s.p),s}function J(e,t){var n=e.polylineEdge;if(n.intersectionPoints.length>1&&n.intersectionPoints[n.intersectionPoints.length-1]!==e){var r=K(e,n.intersectionPoints),i=n.intersectionPoints[r+1];return t.push(i.p),i.incrementVisitCount(),i}for(var o=!0;o;){if(t.push(n.p2.p),null===(n=n.nextEdge))return e;n.intersectionPoints.length>0&&(o=!1)}if(void 0===n)return e;var a=n.intersectionPoints[0];return a.incrementVisitCount(),t.push(a.p),a}var Q=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ee=Math.ceil,te=Math.floor,ne="[BigNumber Error] ",re=ne+"Number primitive has more than 15 significant digits: ",ie=1e14,oe=14,ae=9007199254740991,ue=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],se=1e7,le=1e9;function ce(e){var t=0|e;return e>0||e===t?t:t-1}function fe(e){for(var t,n,r=1,i=e.length,o=e[0]+"";r<i;){for(t=e[r++]+"",n=oe-t.length;n--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function pe(e,t){var n,r,i=e.c,o=t.c,a=e.s,u=t.s,s=e.e,l=t.e;if(!a||!u)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-u:a;if(a!=u)return a;if(n=a<0,r=s==l,!i||!o)return r?0:!i^n?1:-1;if(!r)return s>l^n?1:-1;for(u=(s=i.length)<(l=o.length)?s:l,a=0;a<u;a++)if(i[a]!=o[a])return i[a]>o[a]^n?1:-1;return s==l?0:s>l^n?1:-1}function de(e,t,n,r){if(e<t||e>n||e!==te(e))throw Error(ne+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function he(e){var t=e.c.length-1;return ce(e.e/oe)==t&&e.c[t]%2!=0}function ye(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ge(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(++t>(r=e.length)){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var ve=function e(t){var n,r,i,o,a,u,s,l,c,f,p=_.prototype={constructor:_,toString:null,valueOf:null},d=new _(1),h=20,y=4,g=-7,v=21,m=-1e7,b=1e7,S=!1,w=1,E=0,P={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},O="0123456789abcdefghijklmnopqrstuvwxyz",x=!0;function _(e,t){var n,o,a,u,s,l,c,f,p=this;if(!(p instanceof _))return new _(e,t);if(null==t){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>b?p.c=p.e=null:e.e<m?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((l="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,s=e;s>=10;s/=10,u++);return void(u>b?p.c=p.e=null:(p.e=u,p.c=[e]))}f=String(e)}else{if(!Q.test(f=String(e)))return i(p,f,l);p.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(u=f.indexOf("."))>-1&&(f=f.replace(".","")),(s=f.search(/e/i))>0?(u<0&&(u=s),u+=+f.slice(s+1),f=f.substring(0,s)):u<0&&(u=f.length)}else{if(de(t,2,O.length,"Base"),10==t&&x)return k(p=new _(e),h+p.e+1,y);if(f=String(e),l="number"==typeof e){if(0*e!=0)return i(p,f,l,t);if(p.s=1/e<0?(f=f.slice(1),-1):1,_.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(re+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(n=O.slice(0,t),u=s=0,c=f.length;s<c;s++)if(n.indexOf(o=f.charAt(s))<0){if("."==o){if(s>u){u=c;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,s=-1,u=0;continue}return i(p,String(e),l,t)}l=!1,(u=(f=r(f,t,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):u=f.length}for(s=0;48===f.charCodeAt(s);s++);for(c=f.length;48===f.charCodeAt(--c););if(f=f.slice(s,++c)){if(c-=s,l&&_.DEBUG&&c>15&&(e>ae||e!==te(e)))throw Error(re+p.s*e);if((u=u-s-1)>b)p.c=p.e=null;else if(u<m)p.c=[p.e=0];else{if(p.e=u,p.c=[],s=(u+1)%oe,u<0&&(s+=oe),s<c){for(s&&p.c.push(+f.slice(0,s)),c-=oe;s<c;)p.c.push(+f.slice(s,s+=oe));s=oe-(f=f.slice(s)).length}else s-=c;for(;s--;f+="0");p.c.push(+f)}}else p.c=[p.e=0]}function T(e,t,n,r){var i,o,a,u,s;if(null==n?n=y:de(n,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==t)s=fe(e.c),s=1==r||2==r&&(a<=g||a>=v)?ye(s,a):ge(s,a,"0");else if(o=(e=k(new _(e),t,n)).e,u=(s=fe(e.c)).length,1==r||2==r&&(t<=o||o<=g)){for(;u<t;s+="0",u++);s=ye(s,o)}else if(t-=a+(2===r&&o>a),s=ge(s,o,"0"),o+1>u){if(--t>0)for(s+=".";t--;s+="0");}else if((t+=o-u)>0)for(o+1==u&&(s+=".");t--;s+="0");return e.s<0&&i?"-"+s:s}function A(e,t){for(var n,r,i=1,o=new _(e[0]);i<e.length;i++)(!(r=new _(e[i])).s||(n=pe(o,r))===t||0===n&&o.s===t)&&(o=r);return o}function C(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*oe-1)>b?e.c=e.e=null:n<m?e.c=[e.e=0]:(e.e=n,e.c=t),e}function k(e,t,n,r){var i,o,a,u,s,l,c,f=e.c,p=ue;if(f){e:{for(i=1,u=f[0];u>=10;u/=10,i++);if((o=t-i)<0)o+=oe,a=t,s=f[l=0],c=te(s/p[i-a-1]%10);else if((l=ee((o+1)/oe))>=f.length){if(!r)break e;for(;f.length<=l;f.push(0));s=c=0,i=1,a=(o%=oe)-oe+1}else{for(s=u=f[l],i=1;u>=10;u/=10,i++);c=(a=(o%=oe)-oe+i)<0?0:te(s/p[i-a-1]%10)}if(r=r||t<0||null!=f[l+1]||(a<0?s:s%p[i-a-1]),r=n<4?(c||r)&&(0==n||n==(e.s<0?3:2)):c>5||5==c&&(4==n||r||6==n&&(o>0?a>0?s/p[i-a]:0:f[l-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,r?(t-=e.e+1,f[0]=p[(oe-t%oe)%oe],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=l,u=1,l--):(f.length=l+1,u=p[oe-o],f[l]=a>0?te(s/p[i-a]%p[a])*u:0),r)for(;;){if(0==l){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=u,u=1;a>=10;a/=10,u++);o!=u&&(e.e++,f[0]==ie&&(f[0]=1));break}if(f[l]+=u,f[l]!=ie)break;f[l--]=0,u=1}for(o=f.length;0===f[--o];f.pop());}e.e>b?e.c=e.e=null:e.e<m&&(e.c=[e.e=0])}return e}function j(e){var t,n=e.e;return null===n?e.toString():(t=fe(e.c),t=n<=g||n>=v?ye(t,n):ge(t,n,"0"),e.s<0?"-"+t:t)}return _.clone=e,_.ROUND_UP=0,_.ROUND_DOWN=1,_.ROUND_CEIL=2,_.ROUND_FLOOR=3,_.ROUND_HALF_UP=4,_.ROUND_HALF_DOWN=5,_.ROUND_HALF_EVEN=6,_.ROUND_HALF_CEIL=7,_.ROUND_HALF_FLOOR=8,_.EUCLID=9,_.config=_.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(ne+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(de(n=e[t],0,le,t),h=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(de(n=e[t],0,8,t),y=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(de(n[0],-le,0,t),de(n[1],0,le,t),g=n[0],v=n[1]):(de(n,-le,le,t),g=-(v=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)de(n[0],-le,-1,t),de(n[1],1,le,t),m=n[0],b=n[1];else{if(de(n,-le,le,t),!n)throw Error(ne+t+" cannot be zero: "+n);m=-(b=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(ne+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw S=!n,Error(ne+"crypto unavailable");S=n}else S=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(de(n=e[t],0,9,t),w=n),e.hasOwnProperty(t="POW_PRECISION")&&(de(n=e[t],0,le,t),E=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(ne+t+" not an object: "+n);P=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(ne+t+" invalid: "+n);x="0123456789"==n.slice(0,10),O=n}}return{DECIMAL_PLACES:h,ROUNDING_MODE:y,EXPONENTIAL_AT:[g,v],RANGE:[m,b],CRYPTO:S,MODULO_MODE:w,POW_PRECISION:E,FORMAT:P,ALPHABET:O}},_.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!_.DEBUG)return!0;var t,n,r=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-le&&i<=le&&i===te(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if((t=(i+1)%oe)<1&&(t+=oe),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=ie||n!==te(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(ne+"Invalid BigNumber: "+e)},_.maximum=_.max=function(){return A(arguments,-1)},_.minimum=_.min=function(){return A(arguments,1)},_.random=(o=9007199254740992,a=Math.random()*o&2097151?function(){return te(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,i,o,u=0,s=[],l=new _(d);if(null==e?e=h:de(e,0,le),i=ee(e/oe),S)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)(o=131072*t[u]+(t[u+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[u]=n[0],t[u+1]=n[1]):(s.push(o%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw S=!1,Error(ne+"crypto unavailable");for(t=crypto.randomBytes(i*=7);u<i;)(o=281474976710656*(31&t[u])+1099511627776*t[u+1]+4294967296*t[u+2]+16777216*t[u+3]+(t[u+4]<<16)+(t[u+5]<<8)+t[u+6])>=9e15?crypto.randomBytes(7).copy(t,u):(s.push(o%1e14),u+=7);u=i/7}if(!S)for(;u<i;)(o=a())<9e15&&(s[u++]=o%1e14);for(i=s[--u],e%=oe,i&&e&&(o=ue[oe-e],s[u]=te(i/o)*o);0===s[u];s.pop(),u--);if(u<0)s=[r=0];else{for(r=-1;0===s[0];s.splice(0,1),r-=oe);for(u=1,o=s[0];o>=10;o/=10,u++);u<oe&&(r-=oe-u)}return l.e=r,l.c=s,l}),_.sum=function(){for(var e=1,t=arguments,n=new _(t[0]);e<t.length;)n=n.plus(t[e++]);return n},r=function(){var e="0123456789";function t(e,t,n,r){for(var i,o,a=[0],u=0,s=e.length;u<s;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(u++)),i=0;i<a.length;i++)a[i]>n-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,o,a,u){var s,l,c,f,p,d,g,v,m=r.indexOf("."),b=h,S=y;for(m>=0&&(f=E,E=0,r=r.replace(".",""),d=(v=new _(i)).pow(r.length-m),E=f,v.c=t(ge(fe(d.c),d.e,"0"),10,o,e),v.e=v.c.length),c=f=(g=t(r,i,o,u?(s=O,e):(s=e,O))).length;0==g[--f];g.pop());if(!g[0])return s.charAt(0);if(m<0?--c:(d.c=g,d.e=c,d.s=a,g=(d=n(d,v,b,S,o)).c,p=d.r,c=d.e),m=g[l=c+b+1],f=o/2,p=p||l<0||null!=g[l+1],p=S<4?(null!=m||p)&&(0==S||S==(d.s<0?3:2)):m>f||m==f&&(4==S||p||6==S&&1&g[l-1]||S==(d.s<0?8:7)),l<1||!g[0])r=p?ge(s.charAt(1),-b,s.charAt(0)):s.charAt(0);else{if(g.length=l,p)for(--o;++g[--l]>o;)g[l]=0,l||(++c,g=[1].concat(g));for(f=g.length;!g[--f];);for(m=0,r="";m<=f;r+=s.charAt(g[m++]));r=ge(r,c,s.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,i,o,a,u=0,s=e.length,l=t%se,c=t/se|0;for(e=e.slice();s--;)u=((i=l*(o=e[s]%se)+(r=c*o+(a=e[s]/se|0)*l)%se*se+u)/n|0)+(r/se|0)+c*a,e[s]=i%n;return u&&(e=[u].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,o,a,u){var s,l,c,f,p,d,h,y,g,v,m,b,S,w,E,P,O,x=r.s==i.s?1:-1,T=r.c,A=i.c;if(!(T&&T[0]&&A&&A[0]))return new _(r.s&&i.s&&(T?!A||T[0]!=A[0]:A)?T&&0==T[0]||!A?0*x:x/0:NaN);for(g=(y=new _(x)).c=[],x=o+(l=r.e-i.e)+1,u||(u=ie,l=ce(r.e/oe)-ce(i.e/oe),x=x/oe|0),c=0;A[c]==(T[c]||0);c++);if(A[c]>(T[c]||0)&&l--,x<0)g.push(1),f=!0;else{for(w=T.length,P=A.length,c=0,x+=2,(p=te(u/(A[0]+1)))>1&&(A=e(A,p,u),T=e(T,p,u),P=A.length,w=T.length),S=P,m=(v=T.slice(0,P)).length;m<P;v[m++]=0);O=A.slice(),O=[0].concat(O),E=A[0],A[1]>=u/2&&E++;do{if(p=0,(s=t(A,v,P,m))<0){if(b=v[0],P!=m&&(b=b*u+(v[1]||0)),(p=te(b/E))>1)for(p>=u&&(p=u-1),h=(d=e(A,p,u)).length,m=v.length;1==t(d,v,h,m);)p--,n(d,P<h?O:A,h,u),h=d.length,s=1;else 0==p&&(s=p=1),h=(d=A.slice()).length;if(h<m&&(d=[0].concat(d)),n(v,d,m,u),m=v.length,-1==s)for(;t(A,v,P,m)<1;)p++,n(v,P<m?O:A,m,u),m=v.length}else 0===s&&(p++,v=[0]);g[c++]=p,v[0]?v[m++]=T[S]||0:(v=[T[S]],m=1)}while((S++<w||null!=v[0])&&x--);f=null!=v[0],g[0]||g.splice(0,1)}if(u==ie){for(c=1,x=g[0];x>=10;x/=10,c++);k(y,o+(y.e=c+l*oe-1)+1,a,f)}else y.e=l,y.r=+f;return y}}(),u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,s=/^([^.]+)\.$/,l=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,f=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,n,r){var i,o=n?t:t.replace(f,"");if(c.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(u,function(e,t,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?e:t}),r&&(i=r,o=o.replace(s,"$1").replace(l,"0.$1")),t!=o))return new _(o,i);if(_.DEBUG)throw Error(ne+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},p.absoluteValue=p.abs=function(){var e=new _(this);return e.s<0&&(e.s=1),e},p.comparedTo=function(e,t){return pe(this,new _(e,t))},p.decimalPlaces=p.dp=function(e,t){var n,r,i,o=this;if(null!=e)return de(e,0,le),null==t?t=y:de(t,0,8),k(new _(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-ce(this.e/oe))*oe,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},p.dividedBy=p.div=function(e,t){return n(this,new _(e,t),h,y)},p.dividedToIntegerBy=p.idiv=function(e,t){return n(this,new _(e,t),0,1)},p.exponentiatedBy=p.pow=function(e,t){var n,r,i,o,a,u,s,l,c=this;if((e=new _(e)).c&&!e.isInteger())throw Error(ne+"Exponent not an integer: "+j(e));if(null!=t&&(t=new _(t)),a=e.e>14,!c.c||!c.c[0]||1==c.c[0]&&!c.e&&1==c.c.length||!e.c||!e.c[0])return l=new _(Math.pow(+j(c),a?e.s*(2-he(e)):+j(e))),t?l.mod(t):l;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new _(NaN);(r=!u&&c.isInteger()&&t.isInteger())&&(c=c.mod(t))}else{if(e.e>9&&(c.e>0||c.e<-1||(0==c.e?c.c[0]>1||a&&c.c[1]>=24e7:c.c[0]<8e13||a&&c.c[0]<=9999975e7)))return o=c.s<0&&he(e)?-0:0,c.e>-1&&(o=1/o),new _(u?1/o:o);E&&(o=ee(E/oe+2))}for(a?(n=new _(.5),u&&(e.s=1),s=he(e)):s=(i=Math.abs(+j(e)))%2,l=new _(d);;){if(s){if(!(l=l.times(c)).c)break;o?l.c.length>o&&(l.c.length=o):r&&(l=l.mod(t))}if(i){if(0===(i=te(i/2)))break;s=i%2}else if(k(e=e.times(n),e.e+1,1),e.e>14)s=he(e);else{if(0===(i=+j(e)))break;s=i%2}c=c.times(c),o?c.c&&c.c.length>o&&(c.c.length=o):r&&(c=c.mod(t))}return r?l:(u&&(l=d.div(l)),t?l.mod(t):o?k(l,E,y,void 0):l)},p.integerValue=function(e){var t=new _(this);return null==e?e=y:de(e,0,8),k(t,t.e+1,e)},p.isEqualTo=p.eq=function(e,t){return 0===pe(this,new _(e,t))},p.isFinite=function(){return!!this.c},p.isGreaterThan=p.gt=function(e,t){return pe(this,new _(e,t))>0},p.isGreaterThanOrEqualTo=p.gte=function(e,t){return 1===(t=pe(this,new _(e,t)))||0===t},p.isInteger=function(){return!!this.c&&ce(this.e/oe)>this.c.length-2},p.isLessThan=p.lt=function(e,t){return pe(this,new _(e,t))<0},p.isLessThanOrEqualTo=p.lte=function(e,t){return-1===(t=pe(this,new _(e,t)))||0===t},p.isNaN=function(){return!this.s},p.isNegative=function(){return this.s<0},p.isPositive=function(){return this.s>0},p.isZero=function(){return!!this.c&&0==this.c[0]},p.minus=function(e,t){var n,r,i,o,a=this,u=a.s;if(t=(e=new _(e,t)).s,!u||!t)return new _(NaN);if(u!=t)return e.s=-t,a.plus(e);var s=a.e/oe,l=e.e/oe,c=a.c,f=e.c;if(!s||!l){if(!c||!f)return c?(e.s=-t,e):new _(f?a:NaN);if(!c[0]||!f[0])return f[0]?(e.s=-t,e):new _(c[0]?a:3==y?-0:0)}if(s=ce(s),l=ce(l),c=c.slice(),u=s-l){for((o=u<0)?(u=-u,i=c):(l=s,i=f),i.reverse(),t=u;t--;i.push(0));i.reverse()}else for(r=(o=(u=c.length)<(t=f.length))?u:t,u=t=0;t<r;t++)if(c[t]!=f[t]){o=c[t]<f[t];break}if(o&&(i=c,c=f,f=i,e.s=-e.s),(t=(r=f.length)-(n=c.length))>0)for(;t--;c[n++]=0);for(t=ie-1;r>u;){if(c[--r]<f[r]){for(n=r;n&&!c[--n];c[n]=t);--c[n],c[r]+=ie}c[r]-=f[r]}for(;0==c[0];c.splice(0,1),--l);return c[0]?C(e,c,l):(e.s=3==y?-1:1,e.c=[e.e=0],e)},p.modulo=p.mod=function(e,t){var r,i,o=this;return e=new _(e,t),!o.c||!e.s||e.c&&!e.c[0]?new _(NaN):!e.c||o.c&&!o.c[0]?new _(o):(9==w?(i=e.s,e.s=1,r=n(o,e,0,3),e.s=i,r.s*=i):r=n(o,e,0,w),(e=o.minus(r.times(e))).c[0]||1!=w||(e.s=o.s),e)},p.multipliedBy=p.times=function(e,t){var n,r,i,o,a,u,s,l,c,f,p,d,h,y,g,v=this,m=v.c,b=(e=new _(e,t)).c;if(!(m&&b&&m[0]&&b[0]))return!v.s||!e.s||m&&!m[0]&&!b||b&&!b[0]&&!m?e.c=e.e=e.s=null:(e.s*=v.s,m&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=ce(v.e/oe)+ce(e.e/oe),e.s*=v.s,(s=m.length)<(f=b.length)&&(h=m,m=b,b=h,i=s,s=f,f=i),i=s+f,h=[];i--;h.push(0));for(y=ie,g=se,i=f;--i>=0;){for(n=0,p=b[i]%g,d=b[i]/g|0,o=i+(a=s);o>i;)n=((l=p*(l=m[--a]%g)+(u=d*l+(c=m[a]/g|0)*p)%g*g+h[o]+n)/y|0)+(u/g|0)+d*c,h[o--]=l%y;h[o]=n}return n?++r:h.splice(0,1),C(e,h,r)},p.negated=function(){var e=new _(this);return e.s=-e.s||null,e},p.plus=function(e,t){var n,r=this,i=r.s;if(t=(e=new _(e,t)).s,!i||!t)return new _(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/oe,a=e.e/oe,u=r.c,s=e.c;if(!o||!a){if(!u||!s)return new _(i/0);if(!u[0]||!s[0])return s[0]?e:new _(u[0]?r:0*i)}if(o=ce(o),a=ce(a),u=u.slice(),i=o-a){for(i>0?(a=o,n=s):(i=-i,n=u),n.reverse();i--;n.push(0));n.reverse()}for((i=u.length)-(t=s.length)<0&&(n=s,s=u,u=n,t=i),i=0;t;)i=(u[--t]=u[t]+s[t]+i)/ie|0,u[t]=ie===u[t]?0:u[t]%ie;return i&&(u=[i].concat(u),++a),C(e,u,a)},p.precision=p.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return de(e,1,le),null==t?t=y:de(t,0,8),k(new _(o),e,t);if(!(n=o.c))return null;if(r=(i=n.length-1)*oe+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},p.shiftedBy=function(e){return de(e,-9007199254740991,ae),this.times("1e"+e)},p.squareRoot=p.sqrt=function(){var e,t,r,i,o,a=this,u=a.c,s=a.s,l=a.e,c=h+4,f=new _("0.5");if(1!==s||!u||!u[0])return new _(!s||s<0&&(!u||u[0])?NaN:u?a:1/0);if(0==(s=Math.sqrt(+j(a)))||s==1/0?(((t=fe(u)).length+l)%2==0&&(t+="0"),s=Math.sqrt(+t),l=ce((l+1)/2)-(l<0||l%2),r=new _(t=s==1/0?"5e"+l:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+l)):r=new _(s+""),r.c[0])for((s=(l=r.e)+c)<3&&(s=0);;)if(o=r,r=f.times(o.plus(n(a,o,c,1))),fe(o.c).slice(0,s)===(t=fe(r.c)).slice(0,s)){if(r.e<l&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(k(r,r.e+h+2,1),e=!r.times(r).eq(a));break}if(!i&&(k(o,o.e+h+2,0),o.times(o).eq(a))){r=o;break}c+=4,s+=4,i=1}return k(r,r.e+h+1,y,e)},p.toExponential=function(e,t){return null!=e&&(de(e,0,le),e++),T(this,e,t,1)},p.toFixed=function(e,t){return null!=e&&(de(e,0,le),e=e+this.e+1),T(this,e,t)},p.toFormat=function(e,t,n){var r,i=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=P;else if("object"!=typeof n)throw Error(ne+"Argument not an object: "+n);if(r=i.toFixed(e,t),i.c){var o,a=r.split("."),u=+n.groupSize,s=+n.secondaryGroupSize,l=n.groupSeparator||"",c=a[0],f=a[1],p=i.s<0,d=p?c.slice(1):c,h=d.length;if(s&&(o=u,u=s,s=o,h-=o),u>0&&h>0){for(o=h%u||u,c=d.substr(0,o);o<h;o+=u)c+=l+d.substr(o,u);s>0&&(c+=l+d.slice(o)),p&&(c="-"+c)}r=f?c+(n.decimalSeparator||"")+((s=+n.fractionGroupSize)?f.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):f):c}return(n.prefix||"")+r+(n.suffix||"")},p.toFraction=function(e){var t,r,i,o,a,u,s,l,c,f,p,h,g=this,v=g.c;if(null!=e&&(!(s=new _(e)).isInteger()&&(s.c||1!==s.s)||s.lt(d)))throw Error(ne+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+j(s));if(!v)return new _(g);for(t=new _(d),c=r=new _(d),i=l=new _(d),h=fe(v),a=t.e=h.length-g.e-1,t.c[0]=ue[(u=a%oe)<0?oe+u:u],e=!e||s.comparedTo(t)>0?a>0?t:c:s,u=b,b=1/0,s=new _(h),l.c[0]=0;f=n(s,t,0,1),1!=(o=r.plus(f.times(i))).comparedTo(e);)r=i,i=o,c=l.plus(f.times(o=c)),l=o,t=s.minus(f.times(o=t)),s=o;return o=n(e.minus(r),i,0,1),l=l.plus(o.times(c)),r=r.plus(o.times(i)),l.s=c.s=g.s,p=n(c,i,a*=2,y).minus(g).abs().comparedTo(n(l,r,a,y).minus(g).abs())<1?[c,i]:[l,r],b=u,p},p.toNumber=function(){return+j(this)},p.toPrecision=function(e,t){return null!=e&&de(e,1,le),T(this,e,t,2)},p.toString=function(e){var t,n=this,i=n.s,o=n.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=g||o>=v?ye(fe(n.c),o):ge(fe(n.c),o,"0"):10===e&&x?t=ge(fe((n=k(new _(n),h+o+1,y)).c),n.e,"0"):(de(e,2,O.length,"Base"),t=r(ge(fe(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},p.valueOf=p.toJSON=function(){return j(this)},p._isBigNumber=!0,p[Symbol.toStringTag]="BigNumber",p[Symbol.for("nodejs.util.inspect.custom")]=p.valueOf,null!=t&&_.set(t),_}(),me=ve,be=class{key;left=null;right=null;constructor(e){this.key=e}},Se=class extends be{constructor(e){super(e)}},we=class{size=0;modificationCount=0;splayCount=0;splay(e){const t=this.root;if(null==t)return this.compare(e,e),-1;let n=null,r=null,i=null,o=null,a=t;const u=this.compare;let s;for(;;)if(s=u(a.key,e),s>0){let t=a.left;if(null==t)break;if(s=u(t.key,e),s>0&&(a.left=t.right,t.right=a,a=t,t=a.left,null==t))break;null==n?r=a:n.left=a,n=a,a=t}else{if(!(s<0))break;{let t=a.right;if(null==t)break;if(s=u(t.key,e),s<0&&(a.right=t.left,t.left=a,a=t,t=a.right,null==t))break;null==i?o=a:i.right=a,i=a,a=t}}return null!=i&&(i.right=a.left,a.left=o),null!=n&&(n.left=a.right,a.right=r),this.root!==a&&(this.root=a,this.splayCount++),s}splayMin(e){let t=e,n=t.left;for(;null!=n;){const e=n;t.left=e.right,e.right=t,t=e,n=t.left}return t}splayMax(e){let t=e,n=t.right;for(;null!=n;){const e=n;t.right=e.left,e.left=t,t=e,n=t.right}return t}_delete(e){if(null==this.root)return null;if(0!=this.splay(e))return null;let t=this.root;const n=t,r=t.left;if(this.size--,null==r)this.root=t.right;else{const e=t.right;t=this.splayMax(r),t.right=e,this.root=t}return this.modificationCount++,n}addNewRoot(e,t){this.size++,this.modificationCount++;const n=this.root;null!=n?(t<0?(e.left=n,e.right=n.right,n.right=null):(e.right=n,e.left=n.left,n.left=null),this.root=e):this.root=e}_first(){const e=this.root;return null==e?null:(this.root=this.splayMin(e),this.root)}_last(){const e=this.root;return null==e?null:(this.root=this.splayMax(e),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(e){return this.validKey(e)&&0==this.splay(e)}defaultCompare(){return(e,t)=>e<t?-1:e>t?1:0}wrap(){return{getRoot:()=>this.root,setRoot:e=>{this.root=e},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:e=>{this.splayCount=e},splay:e=>this.splay(e),has:e=>this.has(e)}}},Ee=(Symbol.iterator,Symbol.toStringTag,class e extends we{root=null;compare;validKey;constructor(e,t){super(),this.compare=e??this.defaultCompare(),this.validKey=t??(e=>null!=e&&null!=e)}delete(e){return!!this.validKey(e)&&null!=this._delete(e)}deleteAll(e){for(const t of e)this.delete(t)}forEach(e){const t=this[Symbol.iterator]();let n;for(;n=t.next(),!n.done;)e(n.value,n.value,this)}add(e){const t=this.splay(e);return 0!=t&&this.addNewRoot(new Se(e),t),this}addAndReturn(e){const t=this.splay(e);return 0!=t&&this.addNewRoot(new Se(e),t),this.root.key}addAll(e){for(const t of e)this.add(t)}isEmpty(){return null==this.root}isNotEmpty(){return null!=this.root}single(){if(0==this.size)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(0==this.size)throw"Bad state: No element";return this._first().key}last(){if(0==this.size)throw"Bad state: No element";return this._last().key}lastBefore(e){if(null==e)throw"Invalid arguments(s)";if(null==this.root)return null;if(this.splay(e)<0)return this.root.key;let t=this.root.left;if(null==t)return null;let n=t.right;for(;null!=n;)t=n,n=t.right;return t.key}firstAfter(e){if(null==e)throw"Invalid arguments(s)";if(null==this.root)return null;if(this.splay(e)>0)return this.root.key;let t=this.root.right;if(null==t)return null;let n=t.left;for(;null!=n;)t=n,n=t.left;return t.key}retainAll(t){const n=new e(this.compare,this.validKey),r=this.modificationCount;for(const e of t){if(r!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(e)&&0==this.splay(e)&&n.add(this.root.key)}n.size!=this.size&&(this.root=n.root,this.size=n.size,this.modificationCount++)}lookup(e){return this.validKey(e)?0!=this.splay(e)?null:this.root.key:null}intersection(t){const n=new e(this.compare,this.validKey);for(const e of this)t.has(e)&&n.add(e);return n}difference(t){const n=new e(this.compare,this.validKey);for(const e of this)t.has(e)||n.add(e);return n}union(e){const t=this.clone();return t.addAll(e),t}clone(){const t=new e(this.compare,this.validKey);return t.size=this.size,t.root=this.copyNode(this.root),t}copyNode(e){if(null==e)return null;const t=new Se(e.key);return function e(t,n){let r,i;do{if(r=t.left,i=t.right,null!=r){const t=new Se(r.key);n.left=t,e(r,t)}if(null!=i){const e=new Se(i.key);n.right=e,t=i,n=e}}while(null!=i)}(e,t),t}toSet(){return this.clone()}entries(){return new xe(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Oe(this.wrap())}[Symbol.toStringTag]="[object Set]"}),Pe=class{tree;path=new Array;modificationCount=null;splayCount;constructor(e){this.tree=e,this.splayCount=e.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;const e=this.path[this.path.length-1];return this.getValue(e)}rebuildPath(e){this.path.splice(0,this.path.length),this.tree.splay(e),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(e){for(;null!=e;)this.path.push(e),e=e.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(null==this.modificationCount){this.modificationCount=this.tree.getModificationCount();let e=this.tree.getRoot();for(;null!=e;)this.path.push(e),e=e.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let e=this.path[this.path.length-1],t=e.right;if(null!=t){for(;null!=t;)this.path.push(t),t=t.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===e;)e=this.path.pop();return this.path.length>0}},Oe=class extends Pe{getValue(e){return e.key}},xe=class extends Pe{getValue(e){return[e.key,e.key]}},_e=e=>()=>e,Te=e=>{const t=e?(t,n)=>n.minus(t).abs().isLessThanOrEqualTo(e):_e(!1);return(e,n)=>t(e,n)?0:e.comparedTo(n)};function Ae(e){const t=e?(t,n,r,i,o)=>t.exponentiatedBy(2).isLessThanOrEqualTo(i.minus(n).exponentiatedBy(2).plus(o.minus(r).exponentiatedBy(2)).times(e)):_e(!1);return(e,n,r)=>{const i=e.x,o=e.y,a=r.x,u=r.y,s=o.minus(u).times(n.x.minus(a)).minus(i.minus(a).times(n.y.minus(u)));return t(s,i,o,a,u)?0:s.comparedTo(0)}}var Ce=e=>e,ke=e=>{if(e){const t=new Ee(Te(e)),n=new Ee(Te(e)),r=(e,t)=>t.addAndReturn(e),i=e=>({x:r(e.x,t),y:r(e.y,n)});return i({x:new me(0),y:new me(0)}),i}return Ce},je=e=>({set:e=>{Ie=je(e)},reset:()=>je(e),compare:Te(e),snap:ke(e),orient:Ae(e)}),Ie=je(),Me=(e,t)=>e.ll.x.isLessThanOrEqualTo(t.x)&&t.x.isLessThanOrEqualTo(e.ur.x)&&e.ll.y.isLessThanOrEqualTo(t.y)&&t.y.isLessThanOrEqualTo(e.ur.y),Le=(e,t)=>{if(t.ur.x.isLessThan(e.ll.x)||e.ur.x.isLessThan(t.ll.x)||t.ur.y.isLessThan(e.ll.y)||e.ur.y.isLessThan(t.ll.y))return null;const n=e.ll.x.isLessThan(t.ll.x)?t.ll.x:e.ll.x,r=e.ur.x.isLessThan(t.ur.x)?e.ur.x:t.ur.x;return{ll:{x:n,y:e.ll.y.isLessThan(t.ll.y)?t.ll.y:e.ll.y},ur:{x:r,y:e.ur.y.isLessThan(t.ur.y)?e.ur.y:t.ur.y}}},Re=(e,t)=>e.x.times(t.y).minus(e.y.times(t.x)),Ne=(e,t)=>e.x.times(t.x).plus(e.y.times(t.y)),De=e=>Ne(e,e).sqrt(),Ge=(e,t,n)=>{const r={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:n.x.minus(e.x),y:n.y.minus(e.y)};return Re(i,r).div(De(i)).div(De(r))},Ve=(e,t,n)=>{const r={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:n.x.minus(e.x),y:n.y.minus(e.y)};return Ne(i,r).div(De(i)).div(De(r))},Fe=(e,t,n)=>t.y.isZero()?null:{x:e.x.plus(t.x.div(t.y).times(n.minus(e.y))),y:n},Be=(e,t,n)=>t.x.isZero()?null:{x:n,y:e.y.plus(t.y.div(t.x).times(n.minus(e.x)))},Ue=class e{point;isLeft;segment;otherSE;consumedBy;static compare(t,n){const r=e.comparePoints(t.point,n.point);return 0!==r?r:(t.point!==n.point&&t.link(n),t.isLeft!==n.isLeft?t.isLeft?1:-1:Ke.compare(t.segment,n.segment))}static comparePoints(e,t){return e.x.isLessThan(t.x)?-1:e.x.isGreaterThan(t.x)?1:e.y.isLessThan(t.y)?-1:e.y.isGreaterThan(t.y)?1:0}constructor(e,t){void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const t=e.point.events;for(let e=0,n=t.length;e<n;e++){const n=t[e];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){const e=this.point.events.length;for(let t=0;t<e;t++){const n=this.point.events[t];if(void 0===n.segment.consumedBy)for(let r=t+1;r<e;r++){const e=this.point.events[r];void 0===e.consumedBy&&n.otherSE.point.events===e.otherSE.point.events&&n.segment.consume(e.segment)}}}getAvailableLinkedEvents(){const e=[];for(let t=0,n=this.point.events.length;t<n;t++){const n=this.point.events[t];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&e.push(n)}return e}getLeftmostComparator(e){const t=new Map,n=n=>{const r=n.otherSE;t.set(n,{sine:Ge(this.point,e.point,r.point),cosine:Ve(this.point,e.point,r.point)})};return(e,r)=>{t.has(e)||n(e),t.has(r)||n(r);const{sine:i,cosine:o}=t.get(e),{sine:a,cosine:u}=t.get(r);return i.isGreaterThanOrEqualTo(0)&&a.isGreaterThanOrEqualTo(0)?o.isLessThan(u)?1:o.isGreaterThan(u)?-1:0:i.isLessThan(0)&&a.isLessThan(0)?o.isLessThan(u)?-1:o.isGreaterThan(u)?1:0:a.isLessThan(i)?-1:a.isGreaterThan(i)?1:0}}},He=class e{events;poly;_isExteriorRing;_enclosingRing;static factory(t){const n=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];if(!i.isInResult()||i.ringOut)continue;let o=null,a=i.leftSE,u=i.rightSE;const s=[a],l=a.point,c=[];for(;o=a,a=u,s.push(a),a.point!==l;)for(;;){const t=a.getAvailableLinkedEvents();if(0===t.length){const e=s[0].point,t=s[s.length-1].point;throw new Error(`Unable to complete output ring starting at [${e.x}, ${e.y}]. Last matching segment found ends at [${t.x}, ${t.y}].`)}if(1===t.length){u=t[0].otherSE;break}let r=null;for(let e=0,t=c.length;e<t;e++)if(c[e].point===a.point){r=e;break}if(null!==r){const t=c.splice(r)[0],i=s.splice(t.index);i.unshift(i[0].otherSE),n.push(new e(i.reverse()));continue}c.push({index:s.length,point:a.point});const i=a.getLeftmostComparator(o);u=t.sort(i)[0].otherSE;break}n.push(new e(s))}return n}constructor(e){this.events=e;for(let t=0,n=e.length;t<n;t++)e[t].segment.ringOut=this;this.poly=null}getGeom(){let e=this.events[0].point;const t=[e];for(let n=1,r=this.events.length-1;n<r;n++){const r=this.events[n].point,i=this.events[n+1].point;0!==Ie.orient(r,e,i)&&(t.push(r),e=r)}if(1===t.length)return null;const n=t[0],r=t[1];0===Ie.orient(n,e,r)&&t.shift(),t.push(t[0]);const i=this.isExteriorRing()?1:-1,o=this.isExteriorRing()?0:t.length-1,a=this.isExteriorRing()?t.length:-1,u=[];for(let e=o;e!=a;e+=i)u.push([t[e].x.toNumber(),t[e].y.toNumber()]);return u}isExteriorRing(){if(void 0===this._isExteriorRing){const e=this.enclosingRing();this._isExteriorRing=!e||!e.isExteriorRing()}return this._isExteriorRing}enclosingRing(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let e=this.events[0];for(let t=1,n=this.events.length;t<n;t++){const n=this.events[t];Ue.compare(e,n)>0&&(e=n)}let t=e.segment.prevInResult(),n=t?t.prevInResult():null;for(;;){if(!t)return null;if(!n)return t.ringOut;if(n.ringOut!==t.ringOut)return n.ringOut?.enclosingRing()!==t.ringOut?t.ringOut:t.ringOut?.enclosingRing();t=n.prevInResult(),n=t?t.prevInResult():null}}},qe=class{exteriorRing;interiorRings;constructor(e){this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){const e=this.exteriorRing.getGeom();if(null===e)return null;const t=[e];for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}},ze=class{rings;polys;constructor(e){this.rings=e,this.polys=this._composePolys(e)}getGeom(){const e=[];for(let t=0,n=this.polys.length;t<n;t++){const n=this.polys[t].getGeom();null!==n&&e.push(n)}return e}_composePolys(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];if(!r.poly)if(r.isExteriorRing())t.push(new qe(r));else{const e=r.enclosingRing();e?.poly||t.push(new qe(e)),e?.poly?.addInterior(r)}}return t}},We=class{queue;tree;segments;constructor(e,t=Ke.compare){this.queue=e,this.tree=new Ee(t),this.segments=[]}process(e){const t=e.segment,n=[];if(e.consumedBy)return e.isLeft?this.queue.delete(e.otherSE):this.tree.delete(t),n;e.isLeft&&this.tree.add(t);let r=t,i=t;do{r=this.tree.lastBefore(r)}while(null!=r&&null!=r.consumedBy);do{i=this.tree.firstAfter(i)}while(null!=i&&null!=i.consumedBy);if(e.isLeft){let o=null;if(r){const e=r.getIntersection(t);if(null!==e&&(t.isAnEndpoint(e)||(o=e),!r.isAnEndpoint(e))){const t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}let a=null;if(i){const e=i.getIntersection(t);if(null!==e&&(t.isAnEndpoint(e)||(a=e),!i.isAnEndpoint(e))){const t=this._splitSafely(i,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}if(null!==o||null!==a){let e=null;e=null===o?a:null===a||Ue.comparePoints(o,a)<=0?o:a,this.queue.delete(t.rightSE),n.push(t.rightSE);const r=t.split(e);for(let e=0,t=r.length;e<t;e++)n.push(r[e])}n.length>0?(this.tree.delete(t),n.push(e)):(this.segments.push(t),t.prev=r)}else{if(r&&i){const e=r.getIntersection(i);if(null!==e){if(!r.isAnEndpoint(e)){const t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}if(!i.isAnEndpoint(e)){const t=this._splitSafely(i,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}}this.tree.delete(t)}return n}_splitSafely(e,t){this.tree.delete(e);const n=e.rightSE;this.queue.delete(n);const r=e.split(t);return r.push(n),void 0===e.consumedBy&&this.tree.add(e),r}},Ye=new class{type;numMultiPolys;run(e,t,n){Ye.type=e;const r=[new Qe(t,!0)];for(let e=0,t=n.length;e<t;e++)r.push(new Qe(n[e],!1));if(Ye.numMultiPolys=r.length,"difference"===Ye.type){const e=r[0];let t=1;for(;t<r.length;)null!==Le(r[t].bbox,e.bbox)?t++:r.splice(t,1)}if("intersection"===Ye.type)for(let e=0,t=r.length;e<t;e++){const t=r[e];for(let n=e+1,i=r.length;n<i;n++)if(null===Le(t.bbox,r[n].bbox))return[]}const i=new Ee(Ue.compare);for(let e=0,t=r.length;e<t;e++){const t=r[e].getSweepEvents();for(let e=0,n=t.length;e<n;e++)i.add(t[e])}const o=new We(i);let a=null;for(0!=i.size&&(a=i.first(),i.delete(a));a;){const e=o.process(a);for(let t=0,n=e.length;t<n;t++){const n=e[t];void 0===n.consumedBy&&i.add(n)}0!=i.size?(a=i.first(),i.delete(a)):a=null}Ie.reset();const u=He.factory(o.segments);return new ze(u).getGeom()}},$e=Ye,Xe=0,Ke=class e{id;leftSE;rightSE;rings;windings;ringOut;consumedBy;prev;_prevInResult;_beforeState;_afterState;_isInResult;static compare(e,t){const n=e.leftSE.point.x,r=t.leftSE.point.x,i=e.rightSE.point.x,o=t.rightSE.point.x;if(o.isLessThan(n))return 1;if(i.isLessThan(r))return-1;const a=e.leftSE.point.y,u=t.leftSE.point.y,s=e.rightSE.point.y,l=t.rightSE.point.y;if(n.isLessThan(r)){if(u.isLessThan(a)&&u.isLessThan(s))return 1;if(u.isGreaterThan(a)&&u.isGreaterThan(s))return-1;const n=e.comparePoint(t.leftSE.point);if(n<0)return 1;if(n>0)return-1;const r=t.comparePoint(e.rightSE.point);return 0!==r?r:-1}if(n.isGreaterThan(r)){if(a.isLessThan(u)&&a.isLessThan(l))return-1;if(a.isGreaterThan(u)&&a.isGreaterThan(l))return 1;const n=t.comparePoint(e.leftSE.point);if(0!==n)return n;const r=e.comparePoint(t.rightSE.point);return r<0?1:r>0?-1:1}if(a.isLessThan(u))return-1;if(a.isGreaterThan(u))return 1;if(i.isLessThan(o)){const n=t.comparePoint(e.rightSE.point);if(0!==n)return n}if(i.isGreaterThan(o)){const n=e.comparePoint(t.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(!i.eq(o)){const e=s.minus(a),t=i.minus(n),c=l.minus(u),f=o.minus(r);if(e.isGreaterThan(t)&&c.isLessThan(f))return 1;if(e.isLessThan(t)&&c.isGreaterThan(f))return-1}return i.isGreaterThan(o)?1:i.isLessThan(o)||s.isLessThan(l)?-1:s.isGreaterThan(l)?1:e.id<t.id?-1:e.id>t.id?1:0}constructor(e,t,n,r){this.id=++Xe,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=n,this.windings=r}static fromRing(t,n,r){let i,o,a;const u=Ue.comparePoints(t,n);if(u<0)i=t,o=n,a=1;else{if(!(u>0))throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);i=n,o=t,a=-1}const s=new Ue(i,!0),l=new Ue(o,!1);return new e(s,l,[r],[a])}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,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e.isLessThan(t)?e:t},ur:{x:this.rightSE.point.x,y:e.isGreaterThan(t)?e:t}}}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 Ie.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){const t=this.bbox(),n=e.bbox(),r=Le(t,n);if(null===r)return null;const i=this.leftSE.point,o=this.rightSE.point,a=e.leftSE.point,u=e.rightSE.point,s=Me(t,a)&&0===this.comparePoint(a),l=Me(n,i)&&0===e.comparePoint(i),c=Me(t,u)&&0===this.comparePoint(u),f=Me(n,o)&&0===e.comparePoint(o);if(l&&s)return f&&!c?o:!f&&c?u:null;if(l)return c&&i.x.eq(u.x)&&i.y.eq(u.y)?null:i;if(s)return f&&o.x.eq(a.x)&&o.y.eq(a.y)?null:a;if(f&&c)return null;if(f)return o;if(c)return u;const p=((e,t,n,r)=>{if(t.x.isZero())return Be(n,r,e.x);if(r.x.isZero())return Be(e,t,n.x);if(t.y.isZero())return Fe(n,r,e.y);if(r.y.isZero())return Fe(e,t,n.y);const i=Re(t,r);if(i.isZero())return null;const o={x:n.x.minus(e.x),y:n.y.minus(e.y)},a=Re(o,t).div(i),u=Re(o,r).div(i),s=e.x.plus(u.times(t.x)),l=n.x.plus(a.times(r.x)),c=e.y.plus(u.times(t.y)),f=n.y.plus(a.times(r.y));return{x:s.plus(l).div(2),y:c.plus(f).div(2)}})(i,this.vector(),a,e.vector());return null===p?null:Me(r,p)?Ie.snap(p):null}split(t){const n=[],r=void 0!==t.events,i=new Ue(t,!0),o=new Ue(t,!1),a=this.rightSE;this.replaceRightSE(o),n.push(o),n.push(i);const u=new e(i,a,this.rings.slice(),this.windings.slice());return Ue.comparePoints(u.leftSE.point,u.rightSE.point)>0&&u.swapEvents(),Ue.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}swapEvents(){const e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,t=this.windings.length;e<t;e++)this.windings[e]*=-1}consume(t){let n=this,r=t;for(;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;const i=e.compare(n,r);if(0!==i){if(i>0){const e=n;n=r,r=e}if(n.prev===r){const e=n;n=r,r=e}for(let e=0,t=r.rings.length;e<t;e++){const t=r.rings[e],i=r.windings[e],o=n.rings.indexOf(t);-1===o?(n.rings.push(t),n.windings.push(i)):n.windings[o]+=i}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}prevInResult(){return 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(void 0!==this._beforeState)return this._beforeState;if(this.prev){const e=this.prev.consumedBy||this.prev;this._beforeState=e.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}afterState(){if(void 0!==this._afterState)return this._afterState;const e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};const t=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let e=0,r=this.rings.length;e<r;e++){const r=this.rings[e],i=this.windings[e],o=t.indexOf(r);-1===o?(t.push(r),n.push(i)):n[o]+=i}const i=[],o=[];for(let e=0,r=t.length;e<r;e++){if(0===n[e])continue;const r=t[e],a=r.poly;if(-1===o.indexOf(a))if(r.isExterior)i.push(a);else{-1===o.indexOf(a)&&o.push(a);const e=i.indexOf(r.poly);-1!==e&&i.splice(e,1)}}for(let e=0,t=i.length;e<t;e++){const t=i[e].multiPoly;-1===r.indexOf(t)&&r.push(t)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;const e=this.beforeState().multiPolys,t=this.afterState().multiPolys;switch($e.type){case"union":{const n=0===e.length,r=0===t.length;this._isInResult=n!==r;break}case"intersection":{let n,r;e.length<t.length?(n=e.length,r=t.length):(n=t.length,r=e.length),this._isInResult=r===$e.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(e.length-t.length);this._isInResult=n%2==1;break}case"difference":{const n=e=>1===e.length&&e[0].isSubject;this._isInResult=n(e)!==n(t);break}}return this._isInResult}},Ze=class{poly;isExterior;segments;bbox;constructor(e,t,n){if(!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=t,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const r=Ie.snap({x:new me(e[0][0]),y:new me(e[0][1])});this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let t=1,n=e.length;t<n;t++){if("number"!=typeof e[t][0]||"number"!=typeof e[t][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const n=Ie.snap({x:new me(e[t][0]),y:new me(e[t][1])});n.x.eq(i.x)&&n.y.eq(i.y)||(this.segments.push(Ke.fromRing(i,n,this)),n.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.x),n.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.y),n.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.x),n.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.y),i=n)}r.x.eq(i.x)&&r.y.eq(i.y)||this.segments.push(Ke.fromRing(i,r,this))}getSweepEvents(){const e=[];for(let t=0,n=this.segments.length;t<n;t++){const n=this.segments[t];e.push(n.leftSE),e.push(n.rightSE)}return e}},Je=class{multiPoly;exteriorRing;interiorRings;bbox;constructor(e,t){if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Ze(e[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 t=1,n=e.length;t<n;t++){const n=new Ze(e[t],this,!1);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=t}getSweepEvents(){const e=this.exteriorRing.getSweepEvents();for(let t=0,n=this.interiorRings.length;t<n;t++){const n=this.interiorRings[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}},Qe=class{isSubject;polys;bbox;constructor(e,t){if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}catch(e){}this.polys=[],this.bbox={ll:{x:new me(Number.POSITIVE_INFINITY),y:new me(Number.POSITIVE_INFINITY)},ur:{x:new me(Number.NEGATIVE_INFINITY),y:new me(Number.NEGATIVE_INFINITY)}};for(let t=0,n=e.length;t<n;t++){const n=new Je(e[t],this);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=t}getSweepEvents(){const e=[];for(let t=0,n=this.polys.length;t<n;t++){const n=this.polys[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}};Ie.set;function et(e,t,n={}){const r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}Math.PI;var tt=function(e,t={}){const n=[];if(function(e,t){var n,r,i,o,a,u,s,l,c,f,p=0,d="FeatureCollection"===e.type,h="Feature"===e.type,y=d?e.features.length:1;for(n=0;n<y;n++){for(u=d?e.features[n].geometry:h?e.geometry:e,l=d?e.features[n].properties:h?e.properties:{},c=d?e.features[n].bbox:h?e.bbox:void 0,f=d?e.features[n].id:h?e.id:void 0,a=(s=!!u&&"GeometryCollection"===u.type)?u.geometries.length:1,i=0;i<a;i++)if(null!==(o=s?u.geometries[i]:u))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,p,l,c,f))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===t(o.geometries[r],p,l,c,f))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,p,l,c,f))return!1;p++}}(e,e=>{n.push(e.coordinates)}),n.length<2)throw new Error("Must have at least 2 geometries");const r=((e,...t)=>$e.run("union",e,t))(n[0],...n.slice(1));return 0===r.length?null:1===r.length?function(e,t,n={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return et({type:"Polygon",coordinates:e},t,n)}(r[0],t.properties):function(e,t,n={}){return et({type:"MultiPolygon",coordinates:e},t,n)}(r,t.properties)},nt=n(278);function rt(e){return rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rt(e)}function it(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return u}}(e,t)||st(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function at(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ot(Object(n),!0).forEach(function(t){ut(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ot(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ut(e,t,n){return(t=function(e){var t=function(e){if("object"!=rt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=rt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==rt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function st(e,t){if(e){if("string"==typeof e)return lt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lt(e,t):void 0}}function lt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ct=function(e,t){var n,r,i,o,a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01,n=e.geometry.coordinates.map(function(e){return function(e){if(Array.isArray(e))return lt(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||st(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();var t}),r=n.length-1,i=function(e,n){return[e[0]+(e[0]-n[0])*t,e[1]+(e[1]-n[1])*t]},o=i(n[0],n[1]),a=i(n[r],n[r-1]);return n[0]=o,n[r]=a,(0,nt.wi)(n)}(t);try{o=function(e,t){var n=[],r=[],i=[],o=function(e,t,n,r,i){for(var o=0,a=[],u="Feature"===t.type?t.geometry:t,s="LineString"===u.type?[u.coordinates]:u.coordinates,l=0,c=0;c<s.length;c++){for(var f=s[c].length-1,p=new D(s[c][0]),d=null,h={nextEdge:null},y=0;y<f;y++){d=new D(s[c][y+1]),p.nextPoint=d,d.prevPoint=p;var g=new N(p,d,"polyline",l,null);r.push(g),h.nextEdge=g,g.prevEdge=h,i[0]=Math.min(i[0],p.p[0]),i[1]=Math.min(i[1],p.p[1]),i[2]=Math.max(i[2],p.p[0]),i[3]=Math.max(i[3],p.p[1]),p=d,l+=1,h=g}i[0]=Math.min(i[0],s[c][f][0]),i[1]=Math.min(i[1],s[c][f][1]),i[2]=Math.max(i[2],s[c][f][0]),i[3]=Math.max(i[3],s[c][f][1])}for(var v="Feature"===e.type?e.geometry:e,m="Polygon"===v.type?[v.coordinates]:v.coordinates,b=m.length,S=0;S<b;S++)for(var w=m[S].length,E=0;E<w;E++){o+=1;var P=m[S][E],O=P.length;a.push(new G(o,P));for(var x=new D(P[0]),_=x,T=void 0,A=null,C={nextEdge:null,prevEdge:null},k=null,j=1;j<O;j++)T=new D(P[j]),_.nextPoint=T,T.prevPoint=_,A=new N(_,T,"polygon",l,o),C.nextEdge=A,A.prevEdge=C,1===j&&(k=A),E>0&&(A.interiorRing=!0),A.intersectPolylineBbox=V(A,i),n.push(A),_=T,l+=1,C=A;A.nextEdge=k,k.prevEdge=A,T.nextPoint=x.nextPoint,x.prevPoint=T.prevPoint}return a}(h(e),t,r,i,[1/0,1/0,1/0,1/0]);if(function(e,t,n){var r,i,o,a=t.length,u=e.length;for(r=0;r<a;r++){var s=t[r];for(i=0;i<u;i++){var l=e[i];if(l.intersectPolylineBbox&&!(l.maxX<s.minX||l.minX>s.maxX||l.maxY<s.minY||l.minY>s.maxY)){var c=z(s,l);if(null!==c)for(o=0;o<c.length;o++){var f=R(l.p1.p[0],l.p1.p[1],l.p2.p[0],l.p2.p[1],s.p1.p[0],s.p1.p[1]),p=new F(c[o],s,l,f>0);n.push(p)}}}}t.forEach(function(e){e.intersectionPoints.sort(function(e,t){return e.distanceFromPolylineEdgeStart-t.distanceFromPolylineEdgeStart})}),e.forEach(function(e){e.intersectionPoints.sort(function(e,t){return e.distanceFromPolygonEdgeStart-t.distanceFromPolygonEdgeStart})})}(r,i,n),0===n.length)return e;var a={};o.forEach(function(e){return a[e.id]=0}),n.forEach(function(e){var t=e.polygonEdge.polygonContourId;a[t]=a[t]+1});for(var u=0,s=[],l=null,c=0;c<i.length;c++){var f=i[c];if(f.intersectionPoints.length>0){l=f.intersectionPoints[0];break}}for(var p=l,d={visitCount:1};l!==d&&!(u>2*n.length);){if(u=u++,d.visitCount>=2){for(var y=!1,g=0;g<n.length;g++){var v=n[g];if(v.visitCount<2){p=v,y=!0;break}}if(!y)break}p.visitCount=p.visitCount+1;var m=[];s.push(m),m.push(p.p),p.visitCount=p.visitCount+1;var b=X(p,m),S=!1;if(b===(d=b)&&2===n.length)for(var w=0;w<n.length;w++)n[w].visitCount<2&&(S=!0);for(;b!==p||S;)(b=(b.isHeadingIn?J:Z)(b,m))!==p&&(b=X(b,m)),S=!1;if(d.visitCount>=2){for(var E=!1,P=0;P<n.length;P++){var O=n[P];if(O.visitCount<2){p=O,E=!0;break}}E&&(d=p)}p=d}for(var x=s.map(function(e){return[e]}),_=Object.keys(a),T=0;T<_.length;T++){var A=_[T];0===a[A]&&$(Y(W(r,parseInt(A)),o),x)}return{type:"Feature",properties:{},geometry:{type:"MultiPolygon",coordinates:x}}}(e,a)}catch(e){return null}var u=[];if("MultiPolygon"!==o.geometry.type)return null;if(2!==o.geometry.coordinates.length)return null;u=o.geometry.coordinates.map(function(t){return(0,nt.n1)(t,e.properties)});var s=null!==(n=null!==(r=e.id)&&void 0!==r?r:null===(i=e.properties)||void 0===i?void 0:i.id)&&void 0!==n?n:"poly",l=u.map(function(t,n){return(0,nt.n1)(t.geometry.coordinates,at(at({},e.properties),{},{id:s}),{id:"".concat(s,"-").concat(n+1)})});return(0,nt.Lr)(l)},ft=function(e){var t,n,r,i,o;try{o=tt((0,nt.Lr)(e))}catch(e){return null}if("Polygon"!==(null===(t=o)||void 0===t||null===(t=t.geometry)||void 0===t?void 0:t.type))return null;var a=null!==(n=null!==(r=e[0].id)&&void 0!==r?r:null===(i=e[0].properties)||void 0===i?void 0:i.id)&&void 0!==n?n:"poly";return(0,nt.n1)(o.geometry.coordinates,at(at({},e[0].properties),{},{id:a}),{id:a})},pt=function(e,t){var n=it(e,2),r=n[0],i=n[1],o=it(t,2),a=o[0],u=o[1],s=function(e){return e*Math.PI/180},l=s(u-i),c=s(a-r),f=Math.pow(Math.sin(l/2),2)+Math.cos(s(i))*Math.cos(s(u))*Math.pow(Math.sin(c/2),2);return 12742e3*Math.atan2(Math.sqrt(f),Math.sqrt(1-f))},dt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01;if(e.length<=1)return!0;var n=e[e.length-1],r=e[e.length-2];return pt(n,r)>=t},ht=function(e){return e[0].length<=1||function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01,n=e[0];return n.length<=1||!(n.length<=3&&function(e,t){for(var n=0;n<e.length;n++)for(var r=n+1;r<e.length;r++)if(pt(e[n],e[r])<t)return!0;return!1}(n,t))}(e)}},9:function(e,t,n){n.d(t,{k7:function(){return P},n8:function(){return c},PH:function(){return E},Uv:function(){return x},J$:function(){return O}});var r=n(278),i=n(850);function o(e){let t=0;if(e&&e.length>0){t+=Math.abs(s(e[0]));for(let n=1;n<e.length;n++)t-=Math.abs(s(e[n]))}return t}var a=r.zX*r.zX/2,u=Math.PI/180;function s(e){const t=e.length-1;if(t<=2)return 0;let n=0,r=0;for(;r<t;){const i=e[r],o=e[r+1===t?0:r+1],a=e[r+2>=t?(r+2)%t:r+2],s=i[0]*u,l=o[1]*u;n+=(a[0]*u-s)*Math.sin(l),r++}return n*a}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var c={Polygon:3,LineString:2},f=function(e){var t;return null!==(t=null==e?void 0:e.geometry)&&void 0!==t?t:e},p=function(e){var t=f(e);return"Polygon"===(null==t?void 0:t.type)?t:null},d=function(e){for(var t,n,r=null!==(t=null===(n=e.coordinates)||void 0===n?void 0:n[0])&&void 0!==t?t:[],i=r.filter(function(e,t){return 0===t||e[0]!==r[t-1][0]||e[1]!==r[t-1][1]});i.length>1&&i[0][0]===i[i.length-1][0]&&i[0][1]===i[i.length-1][1];)i.pop();return i},h=function(e){return[].concat(function(e){if(Array.isArray(e))return l(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[e[0]]);var t},y=function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])},g=function(e,t){return e>0&&t<0||e<0&&t>0},v=function(e,t,n,r){return 0===e&&function(e,t,n){return Math.min(e[0],n[0])<=t[0]&&t[0]<=Math.max(e[0],n[0])&&Math.min(e[1],n[1])<=t[1]&&t[1]<=Math.max(e[1],n[1])}(t,n,r)},m=function(e,t,n,r){var i=y(n,r,e),o=y(n,r,t),a=y(e,t,n),u=y(e,t,r);return!(!g(i,o)||!g(a,u))||v(i,n,e,r)||v(o,n,t,r)||v(a,e,n,t)||v(u,e,r,t)},b=function(e,t){for(var n=e.length,r=t?n:n-1,i=0;i<r;i++)for(var o=i+1;o<r;o++)if(!(o===i+1||t&&0===i&&o===r-1)&&m(e[i],e[(i+1)%n],e[o],e[(o+1)%n]))return!0;return!1},S=function(e){var t=p(e);if(!t)return{valid:!0};var n=d(t);return n.length<4?{valid:!0}:b(n,!0)?{valid:!1,reason:"Shape must not intersect itself"}:{valid:!0}},w=function(e){var t=p(e);if(!t)return{valid:!0};var n=d(t);if(n.length<c.Polygon)return{valid:!0};var r,a=0;try{r={type:"Feature",geometry:{type:"Polygon",coordinates:[h(n)]},properties:{}},a=(0,i.jE)(r,(e,t)=>e+function(e){let t,n=0;switch(e.type){case"Polygon":return o(e.coordinates);case"MultiPolygon":for(t=0;t<e.coordinates.length;t++)n+=o(e.coordinates[t]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(t),0)}catch(e){return{valid:!0}}return a>0?{valid:!0}:{valid:!1,reason:"Shape must enclose an area"}},E={Polygon:"Shape needs at least 3 points",LineString:"Line needs at least 2 points"},P=[S,w,function(e){var t,n,r=f(e);return"Polygon"===(null==r?void 0:r.type)?d(r).length>=c.Polygon?{valid:!0}:{valid:!1,reason:E.Polygon}:"LineString"===(null==r?void 0:r.type)?(null!==(t=null===(n=r.coordinates)||void 0===n?void 0:n.length)&&void 0!==t?t:0)>=c.LineString?{valid:!0}:{valid:!1,reason:E.LineString}:{valid:!0}}],O=[S,w],x=[function(e){return function(e){var t=p(e);if(!t)return!1;var n=d(t);return!(n.length<4)&&b(n,!1)}(e)?{valid:!1,reason:"Shape must not intersect itself"}:{valid:!0}}]},520:function(e,t,n){n.d(t,{$U:function(){return p},$b:function(){return g},Av:function(){return c},RQ:function(){return y},Uk:function(){return v},dV:function(){return h},g5:function(){return f},oK:function(){return d}});var r=n(9);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=function(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=function(e){if(void 0===e||!0===e)return{valid:!0};if(!1===e)return{valid:!1,reason:null};var t=e.valid,n=e.reason,r=e.announcement,i=e.recheckOnFinish;return s(s({valid:!1!==t,reason:n},r&&{announcement:r}),i&&{recheckOnFinish:!0})},f=function(e,t){return e.valid?e:s(s({},e),{},{source:t})},p=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=i.rules,u=void 0===a?r.k7:a,l=i.onGeometryPreview,p=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=o(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw i}}}}(u);try{for(p.s();!(t=p.n()).done;){var d=t.value,h=c(d(e,n));if(!h.valid)return f(h,"rules")}}catch(e){p.e(e)}finally{p.f()}return"function"==typeof l?f(c(l(s({feature:e},n))),"callback"):{valid:!0}},d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.rules,o=void 0===i?r.Uv:i,a=n.onGeometryPreview;return p(e,s(s({},t),{},{phase:"place"}),{rules:o,onGeometryPreview:a})},h={Polygon:"draw_polygon",LineString:"draw_line"},y=function(e,t,n){var r=t.reason,i=t.source,o=t.announcement,a=n.mode,u=n.vertexIndex;return s(s({feature:e,reason:null!=r?r:null,source:i},o&&{announcement:o}),{},{phase:"place",mode:a,vertexIndex:u})},g=function(e){var t,n=e.placed,r=e.point,i=e.geometryType,u=e.onGeometryPreview,s=[].concat(function(e){if(Array.isArray(e))return a(e)}(t=n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[r]),l={type:"Feature",geometry:"Polygon"===i?{type:"Polygon",coordinates:[s]}:{type:"LineString",coordinates:s},properties:{}},c=h[i],f=n.length,p=d(l,{mode:c,vertexIndex:f},{onGeometryPreview:u});return p.valid?{valid:!0}:{valid:!1,blocked:y(l,p,{mode:c,vertexIndex:f})}},v=function(e){var t,n,i,o,a,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=l.rules,f=void 0===c?r.J$:c,d=l.onGeometryPreview,h=null!==(t=null==e||null===(n=e.geometry)||void 0===n?void 0:n.type)&&void 0!==t?t:null==e?void 0:e.type,y=null!==(i=r.n8[h])&&void 0!==i?i:0,g=(null!==(o=u.numVertices)&&void 0!==o?o:0)<y?[]:f;return p(e,s(s({},u),{},{phase:null!==(a=u.phase)&&void 0!==a?a:"preview"}),{rules:g,onGeometryPreview:d})}},619:function(e,t,n){n.d(t,{v:function(){return i}});var r="[interactive-map]",i={warn:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=console).warn.apply(e,[r].concat(n))},error:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=console).error.apply(e,[r].concat(n))}}}}]);
|
|
2
|
+
"use strict";(Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap=Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap||[]).push([[568],{278:function(e,t,n){n.d(t,{Et:function(){return d},Gf:function(){return c},Lr:function(){return s},n1:function(){return u},nv:function(){return f},tR:function(){return p},wi:function(){return l},zX:function(){return r},zx:function(){return a}});var r=6371008.8,i={centimeters:100*r,centimetres:100*r,degrees:360/(2*Math.PI),feet:3.28084*r,inches:39.37*r,kilometers:r/1e3,kilometres:r/1e3,meters:r,metres:r,miles:r/1609.344,millimeters:1e3*r,millimetres:1e3*r,nauticalmiles:r/1852,radians:1,yards:1.0936*r};function o(e,t,n={}){const r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}function a(e,t,n={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!d(e[0])||!d(e[1]))throw new Error("coordinates must contain numbers");return o({type:"Point",coordinates:e},t,n)}function u(e,t,n={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return o({type:"Polygon",coordinates:e},t,n)}function l(e,t,n={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return o({type:"LineString",coordinates:e},t,n)}function s(e,t={}){const n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function c(e,t="kilometers"){const n=i[t];if(!n)throw new Error(t+" units is invalid");return e/n}function f(e){return e%(2*Math.PI)*180/Math.PI}function p(e){return e%360*Math.PI/180}function d(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}},850:function(e,t,n){function r(e,t,n){if(null!==e)for(var i,o,a,u,l,s,c,f,p=0,d=0,h=e.type,y="FeatureCollection"===h,g="Feature"===h,v=y?e.features.length:1,m=0;m<v;m++){l=(f=!!(c=y?e.features[m].geometry:g?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var b=0;b<l;b++){var S=0,w=0;if(null!==(u=f?c.geometries[b]:c)){s=u.coordinates;var E=u.type;switch(p=!n||"Polygon"!==E&&"MultiPolygon"!==E?0:1,E){case null:break;case"Point":if(!1===t(s,d,m,S,w))return!1;d++,S++;break;case"LineString":case"MultiPoint":for(i=0;i<s.length;i++){if(!1===t(s[i],d,m,S,w))return!1;d++,"MultiPoint"===E&&S++}"LineString"===E&&S++;break;case"Polygon":case"MultiLineString":for(i=0;i<s.length;i++){for(o=0;o<s[i].length-p;o++){if(!1===t(s[i][o],d,m,S,w))return!1;d++}"MultiLineString"===E&&S++,"Polygon"===E&&w++}"Polygon"===E&&S++;break;case"MultiPolygon":for(i=0;i<s.length;i++){for(w=0,o=0;o<s[i].length;o++){for(a=0;a<s[i][o].length-p;a++){if(!1===t(s[i][o][a],d,m,S,w))return!1;d++}w++}S++}break;case"GeometryCollection":for(i=0;i<u.geometries.length;i++)if(!1===r(u.geometries[i],t,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function i(e,t,n){var r=n;return function(e,t){var n,r,i,o,a,u,l,s,c,f,p=0,d="FeatureCollection"===e.type,h="Feature"===e.type,y=d?e.features.length:1;for(n=0;n<y;n++){for(u=d?e.features[n].geometry:h?e.geometry:e,s=d?e.features[n].properties:h?e.properties:{},c=d?e.features[n].bbox:h?e.bbox:void 0,f=d?e.features[n].id:h?e.id:void 0,a=(l=!!u&&"GeometryCollection"===u.type)?u.geometries.length:1,i=0;i<a;i++)if(null!==(o=l?u.geometries[i]:u))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,p,s,c,f))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===t(o.geometries[r],p,s,c,f))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,p,s,c,f))return!1;p++}}(e,function(e,i,o,a,u){r=0===i&&void 0===n?e:t(r,e,i,o,a,u)}),r}n.d(t,{Fh:function(){return r},jE:function(){return i}})},360:function(e,t,n){n.d(t,{P:function(){return r},k:function(){return i}});var r="change",i={CREATE:"create",EDIT_FINISH:"editfinish",CANCEL:"cancel",VERTEX_SELECTION:"vertexselection",VERTEX_CHANGE:"vertexchange",UNDO_CHANGE:"undochange",UPDATE:"update",GEOMETRY_CHANGE:"geometrychange",INTERFACE_TYPE_CHANGE:"interfacetypechange",PLACEMENT_BLOCKED:"placementblocked",VALIDITY_CHANGE:"validitychange",CAN_PLACE_CHANGE:"canplacechange"}},682:function(e,t,n){n.d(t,{F0:function(){return l},V3:function(){return f},WQ:function(){return c},lm:function(){return u},vf:function(){return s}});var r="rgba(29,112,184,1)",i="#ffffff",o="rgba(11,12,12,1)",a="rgba(212,53,28,0.5)",u={editStroke:{light:r,dark:i},editFill:{light:"rgba(29,112,184,0.1)",dark:"rgba(255,255,255,0.1)"},editVertex:{light:r,dark:i},editMidpoint:{light:r,dark:i},editHalo:{light:i,dark:o},editActive:{light:o,dark:i},splitInvalid:{light:r,dark:i},splitValid:{light:r,dark:i},invalidStroke:{light:r,dark:i},shapeStroke:"rgba(212,53,28,1)",shapeFill:a,snapVertex:a,snapMidpoint:"rgba(40,161,151,1)",snapEdge:"rgba(29,112,184,0.5)"},l={strokeWidth:2,vertexRadius:6,midpointRadius:4,vertexHaloRadius:8,midpointHaloRadius:6,touchTargetSize:48,touchIndicatorRadius:30},s={snapRadius:12},c={nudgeAmount:1,stepAmount:5},f="draw"},806:function(e,t,n){n.r(t),n.d(t,{manifest:function(){return xt}});var r=new Set(["draw_polygon","draw_line"]),i=new Set(["draw_polygon","draw_line","draw_point"]),o=new Set(["edit_vertex","edit_point"]),a=new Set(["draw_polygon","draw_line","edit_vertex","edit_point"]),u=new Set(["draw_polygon","draw_line","draw_point","edit_vertex","edit_point"]),l=function(e){return r.has(e)},s=function(e){return i.has(e)},c=function(e){return o.has(e)},f=function(e){return a.has(e)};function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(e,t,n){return(t=function(e){var t=function(e){if("object"!=p(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==p(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g={SET_MODE:function(e,t){return h(h({},e),{},{mode:t,numVertices:l(t)?0:e.numVertices,validationStatus:"idle",canFinish:!1,checkSlow:!1,holding:!1,previewValid:!0,canAddPoint:!0})},SET_ACTION:function(e,t){return h(h({},e),{},{action:t.name,actionValid:t.isValid})},SET_FEATURE:function(e,t){return h(h({},e),{},{feature:void 0===t.feature?e.feature:t.feature,tempFeature:void 0===t.tempFeature?e.tempFeature:t.tempFeature})},SET_SELECTED_VERTEX_INDEX:function(e,t){return h(h({},e),{},{selectedVertexIndex:t.index,numVertices:t.numVertices})},TOGGLE_SNAP:function(e){return h(h({},e),{},{snap:!e.snap})},SET_HAS_SNAP_LAYERS:function(e,t){return h(h({},e),{},{hasSnapLayers:!!t})},SET_UNDO_STACK_LENGTH:function(e,t){return h(h({},e),{},{undoStackLength:t})},SET_VALIDATION_STATUS:function(e,t){return h(h({},e),{},{validationStatus:t,checkSlow:!1})},SET_CAN_FINISH:function(e,t){return h(h({},e),{},{canFinish:!!t})},SET_CHECK_SLOW:function(e){return h(h({},e),{},{checkSlow:!0})},SET_HOLDING:function(e,t){return h(h({},e),{},{holding:!!t})},SET_PREVIEW_VALID:function(e,t){return h(h({},e),{},{previewValid:!!t})},SET_CAN_ADD_POINT:function(e,t){return h(h({},e),{},{canAddPoint:!!t})}},v=n(738),m={APP_ADD_MARKER:"app:addmarker",APP_UPDATE_MARKER:"app:updatemarker",APP_REMOVE_MARKER:"app:removemarker",APP_ADD_BUTTON:"app:addbutton",APP_TOGGLE_BUTTON_STATE:"app:togglebuttonstate",APP_ADD_PANEL:"app:addpanel",APP_REMOVE_PANEL:"app:removepanel",APP_SHOW_PANEL:"app:showpanel",APP_HIDE_PANEL:"app:hidepanel",APP_ADD_CONTROL:"app:addcontrol",APP_SET_APPLICATION_MODE:"app:setapplicationmode",APP_CLEAR_APPLICATION_MODE:"app:clearapplicationmode",APP_SHOW_HINT:"app:showhint",APP_DISMISS_HINT:"app:dismisshint",APP_READY:"app:ready",APP_OPENED:"app:opened",APP_CLOSED:"app:closed",APP_FULLSCREEN_CHANGE:"app:fullscreenchange",APP_PANEL_OPENED:"app:panelopened",APP_PANEL_CLOSED:"app:panelclosed",MAP_SET_STYLE:"map:setstyle",MAP_SET_SIZE:"map:setsize",MAP_SET_SPATIAL_LIST:"map:setspatiallist",MAP_SET_SPATIAL_LIST_SUPPRESSED:"map:setspatiallistsuppressed",MAP_SET_ACTIVE_ITEM:"map:setactiveitem",MAP_SELECT_ITEM:"map:selectitem",MAP_SET_PIXEL_RATIO:"map:setpixelratio",MAP_FIT_TO_BOUNDS:"map:fittobounds",MAP_SET_VIEW:"map:setview",MAP_INIT_MAP_STYLES:"map:initmapstyles",MAP_STYLE_CHANGE:"map:stylechange",MAP_LOADED:"map:loaded",MAP_READY:"map:ready",MAP_SIZE_CHANGE:"map:sizechange",MAP_FIRST_IDLE:"map:firstidle",MAP_MOVE_START:"map:movestart",MAP_MOVE:"map:move",MAP_MOVE_END:"map:moveend",MAP_STATE_UPDATED:"map:stateupdated",MAP_DATA_CHANGE:"map:datachange",MAP_RENDER:"map:render",MAP_CLICK:"map:click",MAP_DESTROY:"map:destroy"};function b(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof u?r:u,s=Object.create(l.prototype);return S(s,"_invoke",function(n,r,i){var o,u,l,s=0,c=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,u=0,l=e,p.n=n,a}};function d(n,r){for(u=n,l=r,t=0;!f&&s&&!i&&t<c.length;t++){var i,o=c[t],d=p.p,h=o[2];n>3?(i=h===r)&&(l=o[(u=o[4])?5:(u=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=n<2&&d<o[1])?(u=0,p.v=r,p.n=o[1]):d<h&&(i=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,p.n=h,u=0))}if(i||n>1)return a;throw f=!0,r}return function(i,c,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===c&&d(c,h),u=c,l=h;(t=u<2?e:l)||!f;){o||(u?u<3?(u>1&&(p.n=-1),d(u,l)):p.n=l:p.v=l);try{if(s=2,o){if(u||(i="next"),t=o[i]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,u<2&&(u=0)}else 1===u&&(t=o.return)&&t.call(o),u<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),u=1);o=e}else if((t=(f=p.n<0)?l:n.call(r,p))!==a)break}catch(t){o=e,u=1,l=t}finally{s=1}}return{value:t,done:f}}}(n,i,o),!0),s}var a={};function u(){}function l(){}function s(){}t=Object.getPrototypeOf;var c=[][r]?t(t([][r]())):(S(t={},r,function(){return this}),t),f=s.prototype=u.prototype=Object.create(c);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,S(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return l.prototype=s,S(f,"constructor",s),S(s,"constructor",l),l.displayName="GeneratorFunction",S(s,i,"GeneratorFunction"),S(f),S(f,i,"Generator"),S(f,r,function(){return this}),S(f,"toString",function(){return"[object Generator]"}),(b=function(){return{w:o,m:p}})()}function S(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}S=function(e,t,n,r){function o(t,n){S(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},S(e,t,n,r)}function w(e,t,n,r,i,o,a){try{var u=e[o](a),l=u.value}catch(e){return void n(e)}u.done?t(l):Promise.resolve(l).then(r,i)}var E=function(){var e,t=(e=b().m(function e(t,r){var i,o,a,u,l;return b().w(function(e){for(;;)switch(e.n){case 0:l=t.name,e.n="MapLibreProvider"===l?1:"OpenLayersProvider"===l?3:5;break;case 1:return e.n=2,n.e(356).then(n.bind(n,960));case 2:return i=e.v,o=i.MaplibreDrawAdapter,e.a(2,new o(t,r));case 3:return e.n=4,n.e(722).then(n.bind(n,356));case 4:return a=e.v,u=a.OLDrawAdapter,e.a(2,new u(t,r));case 5:throw new Error('No draw adapter available for map provider "'.concat(t.name,'"'));case 6:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){w(o,r,i,a,u,"next",e)}function u(e){w(o,r,i,a,u,"throw",e)}a(void 0)})});return function(e,n){return t.apply(this,arguments)}}(),P=n(360),O=n(520),x=n(9),_=n(619),A=n(59);function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach(function(t){k(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function k(e,t,n){return(t=function(e){var t=function(e){if("object"!=T(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=T(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==T(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return M(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var L=function(e){return"sortKey"===e||e.startsWith("symbol")&&!A.I.has(e)},R=function(e){if(null==e||!e.properties)return e;for(var t={},n=0,r=Object.entries(e.properties);n<r.length;n++){var i=I(r[n],2),o=i[0],a=i[1];L(o)||(t[o]=a)}return C(C({},e),{},{properties:t})};function N(e){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},N(e)}function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(Object(n),!0).forEach(function(t){F(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function F(e,t,n){return(t=function(e){var t=function(e){if("object"!=N(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=N(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==N(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var V={revision:0,status:"idle",result:null,feature:null,context:null,slow:!1,afterPending:!1,lastResultStatus:null},B=function(e){return e.valid?"valid":"invalid"},U=new Set(["invalid","error"]),H=new WeakMap,q=function(e){var t,n,r,i,o,a,u,l,s,c=H.get(e);return c||(t=0,n=null,r=null,i=null,o=V,a=null,u=null,l=function(){var e;null===(e=i)||void 0===e||e.abort(),i=null,clearTimeout(r)},s=function(e,u){var l,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).fromCallback;if(e===t){var c=void 0!==s&&s?u.status:o.lastResultStatus;"pending"!==u.status&&(i=null,clearTimeout(r));var f=!!u.slow,p="pending"!==u.status&&n===e;n=f?e:null,o=G(G({},u),{},{revision:e,slow:f,afterPending:p,lastResultStatus:c}),null===(l=a)||void 0===l||l(o)}},c={get state(){return o},setOnSettle:function(e){a=e},get heldId(){var e;return(null===(e=u)||void 0===e?void 0:e.revision)===t?u.id:void 0},hold:function(e){u={id:e,revision:t}},release:function(){u=null},run:function(e){var n=e.feature,o=e.context,a=e.consumerCheck,u=e.rules,c=void 0===u?x.k7:u;l();var f=++t,p={feature:n,context:o},d=(0,O.$U)(n,o,{rules:c});if(d.valid&&"function"==typeof a){i=new AbortController;var h,y=function(e){f===t&&(_.v.warn("[draw] geometry check failed (".concat(null==o?void 0:o.phase,")"),e),s(f,G(G({},p),{},{status:"error",result:{valid:!1,reason:null,source:"callback"},error:e}),{fromCallback:!0}))};try{h=a(G({feature:n},o),{signal:i.signal,revision:f})}catch(e){return void y(e)}var g,v=function(e){var t=(0,O.g5)((0,O.Av)(e),"callback");s(f,G(G({},p),{},{status:B(t),result:t}),{fromCallback:!0})};"function"==typeof(null==(g=h)?void 0:g.then)?(s(f,G(G({},p),{},{status:"pending",result:null})),r=setTimeout(function(){return s(f,G(G({},p),{},{status:"pending",result:null,slow:!0}))},300),h.then(v,y)):v(h)}else s(f,G(G({},p),{},{status:B(d),result:d}))},reset:function(){var e,n=(null===(e=u)||void 0===e?void 0:e.revision)===t?u.id:void 0;return l(),t++,o=V,u=null,n}},H.set(e,c)),c},z=function(e){var t=e[0],n=e[e.length-1];return e.length>1&&t[0]===n[0]&&t[1]===n[1]?e.slice(0,-1):e},W=function(e){return"Polygon"===e.type?e.coordinates.map(z):e.coordinates},Y=function(e,t){var n=null==e?void 0:e.geometry,r=null==t?void 0:t.geometry;return!(!n||!r||n.type!==r.type)&&JSON.stringify(W(n))===JSON.stringify(W(r))},$=function(e){var t,n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;e._previewValidator=null!==(t=i.onGeometryPreview)&&void 0!==t?t:o.onGeometryPreview,e._commitValidator=null!==(n=i.onGeometryChange)&&void 0!==n?n:o.onGeometryChange,e._finishValidator=null!==(r=i.onGeometryFinish)&&void 0!==r?r:o.onGeometryFinish;var u=q(e).reset();if(void 0!==u){var l=e.get(u);e.delete(u),null==a||a.emit("draw:cancelled",R(l))}},X=n(652),K=n(491);function Z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return J(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?J(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function J(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Q=function(e,t,n,r){var i=r.caller,o=r.styleIds,a=void 0===o?[]:o;if(null==n)return{};if(!(0,K.Q)(n))return _.v.warn("".concat(i,": ignoring properties that aren't a plain object"),n),{};for(var u={},l=[],s=0,c=Object.entries((0,X.Uv)(n));s<c.length;s++){var f=Z(c[s],2),p=f[0],d=f[1];L(p)||(0,X.TI)(p,a)?l.push(p):u[p]=d}return l.length&&_.v.warn("".concat(i,": ignoring internal and style properties — use setStyle for style"),l),Object.keys(u).length&&e.setProperties(t,u),u};function ee(e){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(e)}var te=["announcement"];function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach(function(t){ie(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ie(e,t,n){return(t=function(e){var t=function(e){if("object"!=ee(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ee(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var oe="draw:created",ae=new WeakMap,ue=new WeakMap,le=new Set(["create","edit-finish"]),se=function(e,t){var n=t.result,r=t.context;return!(le.has(null==r?void 0:r.phase)||"function"!=typeof e._finishValidator&&(null==n||!n.recheckOnFinish))},ce=function(e){var t;return null!==(t=e._finishValidator)&&void 0!==t?t:e._commitValidator},fe=function(e,t,n){var r=t.status,i=t.result,o=t.context,a=t.feature;return"function"==typeof e._finishValidator&&le.has(null==o?void 0:o.phase)&&"valid"===r&&Y(a,n)?i:null},pe=function(e,t,n){var r,i=null===(r=fe(e,q(e).state,t))||void 0===r?void 0:r.properties;return i?(Q(e,t.id,i,{caller:"onGeometryFinish",styleIds:(0,X._8)(n)}),e.get(t.id)):t},de=function(e,t,n){var r,i,o,a,u,l=(o=(i=n).status,a=i.lastResultStatus,u=i.context,"valid"===o||"pending"===o&&"edit-start"!==(null==u?void 0:u.phase)&&!U.has(a));null===(r=e.setCanFinish)||void 0===r||r.call(e,l),t({type:"SET_CAN_FINISH",payload:l})},he={pending:"Checking shape",valid:"Shape check passed",invalid:"Shape check failed",error:"Shape could not be checked"};function ye(e){var t=e.appState,n=e.appConfig,r=e.mapState,i=e.pluginState,o=e.mapProvider,a=e.eventBus,u=e.emitGeometryInvalid,l=e.announce,s=e.resetState,p=o.draw,d=i.feature,h=i.tempFeature,y=i.dispatch,g=q(p);return re(re(re(re({},function(e){var t=e.draw,n=e.dispatch,r=q(t),i=function(e){ue.set(t,e),n({type:"SET_HOLDING",payload:!0})},o=function(e){if("pending"!==e.status||t._finishValidator)if(se(t,e)){r.run({feature:e.feature,context:{phase:"edit-finish",mode:t.getMode()},consumerCheck:ce(t)});var o=r.state;"pending"===o.status?i(o.revision):"valid"===o.status?t.done():n({type:"SET_HOLDING",payload:!1})}else t.done();else i(e.revision)};return{handleDone:function(){c(t.getMode())?o(r.state):t.done()},onEditCheckSettled:function(e){if(ue.has(t)){var r=ue.get(t)===e.revision;r&&"pending"===e.status||(ue.delete(t),r&&"valid"===e.status?o(e):n({type:"SET_HOLDING",payload:!1}))}}}}({draw:p,dispatch:y})),{},{handleCancel:function(){var e,t=p.getMode(),n=c(t)&&!(null==h||!h.id),r=n&&ae.get(p)===h.id,i=null!==(e=g.heldId)&&void 0!==e?e:r?h.id:void 0;n&&!r&&p.add(d),ae.delete(p),g.release(),p.cancel(),void 0!==i&&p.delete(i),s(),a.emit("draw:cancelled",R(d))},handleUndo:function(){return p.undo()},handleDeleteVertex:function(){return p.deleteVertex()},handleSnap:function(){i.dispatch({type:"TOGGLE_SNAP"}),p.setSnapEnabled(!i.snap)},onCancel:function(){g.reset()}},function(e){var t=e.appState,n=e.appConfig,r=e.mapState,i=e.draw,o=e.dispatch,a=e.eventBus,u=e.resetState,l=q(i),s=function(e,u){ae.set(i,e),setTimeout(function(){return function(e,t,n){var r,i,o,a=e.draw,u=e.appState,l=e.appConfig,s=e.mapState,c=e.dispatch,f=e.eventBus,p="Point"===n?"edit_point":"edit_vertex";a.changeMode(p,{container:null==u||null===(r=u.layoutRefs)||void 0===r||null===(r=r.viewportRef)||void 0===r?void 0:r.current,deleteVertexButtonId:"".concat(null==l?void 0:l.id,"-draw-delete-point"),undoButtonId:"".concat(null==l?void 0:l.id,"-draw-undo"),isPanEnabled:"keyboard"!==(null==u?void 0:u.interfaceType),interfaceType:null==u?void 0:u.interfaceType,scale:null==s?void 0:s.mapSizeScale,featureId:t,getSnapEnabled:function(){return a.isSnapEnabled()}});var d=a.get(t),h=q(a).state,y=h.status,g=h.result;c({type:"SET_FEATURE",payload:{feature:d,tempFeature:d}}),c({type:"SET_MODE",payload:p}),c({type:"SET_VALIDATION_STATUS",payload:y}),de(a,c,h),null===(i=a.setInvalid)||void 0===i||i.call(a,"invalid"===y),f.emit("draw:reopened",{feature:R(d),status:y,reason:null!==(o=null==g?void 0:g.reason)&&void 0!==o?o:null})}({draw:i,appState:t,appConfig:n,mapState:r,dispatch:o,eventBus:a},e,u)},0)},c=function(e,t){var n,o,l;"create"===(null===(n=t.context)||void 0===n?void 0:n.phase)&&null!==(o=fe(i,t,e))&&void 0!==o&&o.reopen?s(e.id,null===(l=e.geometry)||void 0===l?void 0:l.type):function(e){var t=pe(i,e,r);u(),setTimeout(function(){return i.changeMode("disabled")},0),a.emit(oe,R(t))}(e)},f=function(e){var t,n=function(e){var t=l.state,n=t.status,r=t.feature;return("valid"===n||"pending"===n)&&Y(r,e)&&!se(i,l.state)||l.run({feature:e,context:{phase:"create",mode:i.getMode()},consumerCheck:ce(i)}),l.state}(e);if("valid"===n.status)c(e,n);else if("pending"===n.status)t=e.id,l.hold(t),o({type:"SET_HOLDING",payload:!0}),setTimeout(function(){return i.changeMode("disabled")},0);else{var r;s(e.id,null===(r=e.geometry)||void 0===r?void 0:r.type)}};return{onCreate:f,onCheckSettled:function(e){var t=l.heldId;if(void 0!==t&&"pending"!==e.status){l.release();var n=i.get(t);if(se(i,e))f(n);else if("valid"===e.status)c(n,e);else{var r;s(t,null==n||null===(r=n.geometry)||void 0===r?void 0:r.type)}}},onEditFinish:function(e){var t=pe(i,e,r);u(),setTimeout(function(){return i.changeMode("disabled")},0),ae.get(i)===e.id?(ae.delete(i),a.emit(oe,R(t))):a.emit("draw:edited",R(t))}}}({appState:t,appConfig:n,mapState:r,draw:p,dispatch:y,eventBus:a,resetState:s})),function(e){var t=e.draw,n=e.pluginState,r=e.mapProvider,i=e.eventBus;return{onVertexSelection:function(e){n.dispatch({type:"SET_SELECTED_VERTEX_INDEX",payload:e}),r.activeMoveTarget=e.index>=0?function(e){return{move:function(t,n,r){return e.nudgeSelectedVertex(t,n,r)},label:"vertex"}}(t):null,i.emit("draw:vertexselection",e)},onVertexChange:function(e){n.dispatch({type:"SET_SELECTED_VERTEX_INDEX",payload:{index:-1,numVertices:e.numVertices}}),r.activeMoveTarget=null}}}({draw:p,pluginState:i,mapProvider:o,eventBus:a})),{},{onUndoChange:function(e){i.dispatch({type:"SET_UNDO_STACK_LENGTH",payload:e})},onUpdate:function(e){a.emit("draw:updated",R(e))},onGeometryChange:function(e){if(null!=e&&e.phase){var t=p.getMode();f(t)&&g.run({feature:e.feature,context:{phase:e.phase,vertexIndex:e.vertexIndex,mode:t},consumerCheck:p._commitValidator})}},onPlacementBlocked:function(e){e.announcement&&(null==l||l(e.announcement,"action")),u(re(re({},e),{},{feature:R(e.feature)}))},onValidityChange:function(e){i.dispatch({type:"SET_PREVIEW_VALID",payload:e.valid})},onCanPlaceChange:function(e){i.dispatch({type:"SET_CAN_ADD_POINT",payload:e.canPlace})},onInterfaceTypeChange:function(e){a.emit("draw:interfacetypechange",{interfaceType:e.interfaceType})}})}function ge(e){var t=e.appState,n=e.appConfig,r=e.mapState,i=e.pluginState,o=e.mapProvider,a=e.buttonConfig,u=e.eventBus,l=e.hints,s=e.announce,f=o.draw,p=function(e,t){return function(n){var r,i=n.announcement,o=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(n,te);e.emit("draw:geometryinvalid",o),i||!o.reason||(r=o.reason,Object.values(x.PH).includes(r))||t.show(o.reason)}}(u,l),d=ye({appState:t,appConfig:n,mapState:r,pluginState:i,mapProvider:o,eventBus:u,emitGeometryInvalid:p,announce:s,resetState:function(){i.dispatch({type:"SET_MODE",payload:null}),i.dispatch({type:"SET_FEATURE",payload:{feature:null,tempFeature:null}}),o.activeMoveTarget=null,q(f).reset(),ue.delete(f)}}),h=q(f),y=function(e){var t=e.draw,n=e.dispatch,r=e.emitGeometryInvalid,i=e.announce;return function(e){var o,a=e.status,u=e.result,l=e.context,s=e.feature,f="valid"===a;if(n(e.slow?{type:"SET_CHECK_SLOW"}:{type:"SET_VALIDATION_STATUS",payload:a}),function(e,t){var n=t.status,r=t.result,i=t.slow,o=t.afterPending;null!=r&&r.announcement?null==e||e(r.announcement,"action"):"pending"===n?i&&(null==e||e(he.pending,"action")):o&&(null==e||e("invalid"===n&&r.reason||he[n],"action"))}(i,e),de(t,n,e),"pending"!==a&&"error"!==a&&(c(t.getMode())&&(null===(o=t.setInvalid)||void 0===o||o.call(t,!f)),!f&&"edit-start"!==(null==l?void 0:l.phase))){var p=u.reason,d=u.source,h=u.announcement;r(re(re({reason:p,source:d,announcement:h},l),{},{feature:R(s)}))}}}({draw:f,dispatch:i.dispatch,emitGeometryInvalid:p,announce:s});return h.setOnSettle(function(e){y(e),d.onCheckSettled(e),d.onEditCheckSettled(e)}),function(e,t){var n=e.drawDone,r=e.drawCancel,i=e.drawUndo,o=e.drawDeletePoint,a=e.drawSnap;n.onClick=t.handleDone,r.onClick=t.handleCancel,i.onClick=t.handleUndo,o&&(o.onClick=t.handleDeleteVertex),a&&(a.onClick=t.handleSnap)}(a,d),function(e,t){e.on(P.k.CREATE,t.onCreate),e.on(P.k.EDIT_FINISH,t.onEditFinish),e.on(P.k.CANCEL,t.onCancel),e.on(P.k.VERTEX_SELECTION,t.onVertexSelection),e.on(P.k.VERTEX_CHANGE,t.onVertexChange),e.on(P.k.UNDO_CHANGE,t.onUndoChange),e.on(P.k.UPDATE,t.onUpdate),e.on(P.k.GEOMETRY_CHANGE,t.onGeometryChange),e.on(P.k.PLACEMENT_BLOCKED,t.onPlacementBlocked),e.on(P.k.VALIDITY_CHANGE,t.onValidityChange),e.on(P.k.CAN_PLACE_CHANGE,t.onCanPlaceChange),e.on(P.k.INTERFACE_TYPE_CHANGE,t.onInterfaceTypeChange)}(f,d),function(){h.setOnSettle(null),function(e){var t=e.drawDone,n=e.drawCancel,r=e.drawUndo,i=e.drawDeletePoint,o=e.drawSnap;t.onClick=null,n.onClick=null,r.onClick=null,i&&(i.onClick=null),o&&(o.onClick=null)}(a),function(e,t){e.off(P.k.CREATE,t.onCreate),e.off(P.k.EDIT_FINISH,t.onEditFinish),e.off(P.k.CANCEL,t.onCancel),e.off(P.k.VERTEX_SELECTION,t.onVertexSelection),e.off(P.k.VERTEX_CHANGE,t.onVertexChange),e.off(P.k.UNDO_CHANGE,t.onUndoChange),e.off(P.k.UPDATE,t.onUpdate),e.off(P.k.GEOMETRY_CHANGE,t.onGeometryChange),e.off(P.k.PLACEMENT_BLOCKED,t.onPlacementBlocked),e.off(P.k.VALIDITY_CHANGE,t.onValidityChange),e.off(P.k.CAN_PLACE_CHANGE,t.onCanPlaceChange),e.off(P.k.INTERFACE_TYPE_CHANGE,t.onInterfaceTypeChange)}(f,d)}}function ve(e){return ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ve(e)}function me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?me(Object(n),!0).forEach(function(t){Se(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):me(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Se(e,t,n){return(t=function(e){var t=function(e){if("object"!=ve(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ve(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ve(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var we="edit_vertex",Ee="draw",Pe=function(e,t,n){var r=e.mapToScreen(n);return{x:r.x*t,y:r.y*t}};function Oe(e){var t=e.mapState,n=e.pluginState,r=e.services,i=e.mapProvider,o=e.spatialListRegistry,a=e.viewportRef,u=t.mapSizeScale,l=r.eventBus,s=r.announce,c=(0,v.useRef)([]),f=(0,v.useRef)(null);!function(e){var t=e.pluginState,n=e.mapProvider,r=e.mapSizeScale,i=e.spatialListRegistry,o=e.itemsRef,a=e.eventBus;(0,v.useEffect)(function(){var e=function(){o.current=t.mode===we?function(e,t){var n,r,i,o=null!==(n=null===(r=e.draw)||void 0===r||null===(i=r.getVertexItems)||void 0===i?void 0:i.call(r))&&void 0!==n?n:{vertices:[],midpoints:[]},a=o.vertices,u=o.midpoints,l=[];return a.forEach(function(n,r){l.push(function(n,r){return be({id:String(r),label:"Point ".concat(r+1),isMidpoint:!1},Pe(e,t,n))}(n,r)),r<u.length&&l.push(function(n,r){return be({id:String(a.length+r),label:"Insert ".concat(r+1,"-").concat((r+1)%a.length+1),isMidpoint:!0},Pe(e,t,n))}(u[r],r))}),l}(n,r):[],i.notifyItemsChanged(Ee)};e(),a.on(m.MAP_MOVE_END,e);var u=n.draw;return u?(u.on(P.k.UPDATE,e),function(){a.off(m.MAP_MOVE_END,e),u.off(P.k.UPDATE,e)}):function(){return a.off(m.MAP_MOVE_END,e)}},[t.mode,n,r,i,o,a]),(0,v.useEffect)(function(){return i.registerItemProvider(Ee,{getItems:function(){return{items:o.current,multiselectable:!1,label:"Shape points",focusable:!1}},exclusive:!0}),function(){i.unregisterItemProvider(Ee)}},[i,o]),(0,v.useEffect)(function(){if(t.mode===we)return i.claimExclusive(Ee),function(){return i.releaseExclusive(Ee)}},[t.mode,i])}({pluginState:n,mapProvider:i,mapSizeScale:u,spatialListRegistry:o,itemsRef:c,eventBus:l}),function(e){var t=e.eventBus,n=e.mapProvider,r=e.pluginState,i=e.activeIdRef;(0,v.useEffect)(function(){var e=function(e){var t,o,a=e.id;i.current=a,null!==a&&r.mode===we&&(null===(t=n.draw)||void 0===t||null===(o=t.selectVertex)||void 0===o||o.call(t,Number(a)))};return t.on(m.MAP_SET_ACTIVE_ITEM,e),function(){t.off(m.MAP_SET_ACTIVE_ITEM,e)}},[t,n,r.mode,i])}({eventBus:l,mapProvider:i,pluginState:n,activeIdRef:f}),function(e){var t=e.eventBus,n=e.mapProvider,r=e.pluginState,i=e.activeIdRef,o=e.itemsRef,a=e.viewportRef,u=e.announce;(0,v.useEffect)(function(){var e=function(){var e;if(r.mode===we&&null!==i.current){var t,l,s=o.current.find(function(e){return e.id===i.current});s&&(s.isMidpoint?(null===(t=n.draw)||void 0===t||null===(l=t.insertVertexAtMidpoint)||void 0===l||l.call(t,Number(i.current)),u("New point inserted","action")):u("".concat(s.label," selected"),"action"),null===(e=a.current)||void 0===e||e.focus())}};return t.on(m.MAP_SELECT_ITEM,e),function(){t.off(m.MAP_SELECT_ITEM,e)}},[t,n,r.mode,i,o,a,u])}({eventBus:l,mapProvider:i,pluginState:n,activeIdRef:f,itemsRef:c,viewportRef:a,announce:s})}var xe=n(682),_e=function(e){var t,n=e.appState,r=e.pluginState;return s(r.mode)&&("touch"===n.interfaceType||!(null===(t=n.expandedButtons)||void 0===t||!t.has("mapControls")))};function Ae(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof u?r:u,s=Object.create(l.prototype);return Te(s,"_invoke",function(n,r,i){var o,u,l,s=0,c=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,u=0,l=e,p.n=n,a}};function d(n,r){for(u=n,l=r,t=0;!f&&s&&!i&&t<c.length;t++){var i,o=c[t],d=p.p,h=o[2];n>3?(i=h===r)&&(l=o[(u=o[4])?5:(u=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=n<2&&d<o[1])?(u=0,p.v=r,p.n=o[1]):d<h&&(i=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,p.n=h,u=0))}if(i||n>1)return a;throw f=!0,r}return function(i,c,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===c&&d(c,h),u=c,l=h;(t=u<2?e:l)||!f;){o||(u?u<3?(u>1&&(p.n=-1),d(u,l)):p.n=l:p.v=l);try{if(s=2,o){if(u||(i="next"),t=o[i]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,u<2&&(u=0)}else 1===u&&(t=o.return)&&t.call(o),u<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),u=1);o=e}else if((t=(f=p.n<0)?l:n.call(r,p))!==a)break}catch(t){o=e,u=1,l=t}finally{s=1}}return{value:t,done:f}}}(n,i,o),!0),s}var a={};function u(){}function l(){}function s(){}t=Object.getPrototypeOf;var c=[][r]?t(t([][r]())):(Te(t={},r,function(){return this}),t),f=s.prototype=u.prototype=Object.create(c);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Te(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return l.prototype=s,Te(f,"constructor",s),Te(s,"constructor",l),l.displayName="GeneratorFunction",Te(s,i,"GeneratorFunction"),Te(f),Te(f,i,"Generator"),Te(f,r,function(){return this}),Te(f,"toString",function(){return"[object Generator]"}),(Ae=function(){return{w:o,m:p}})()}function Te(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}Te=function(e,t,n,r){function o(t,n){Te(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Te(e,t,n,r)}function je(e,t,n,r,i,o,a){try{var u=e[o](a),l=u.value}catch(e){return void n(e)}u.done?t(l):Promise.resolve(l).then(r,i)}var Ce=function(){return new Promise(function(e){return setTimeout(e,0)})};function ke(e){return ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ke(e)}var Ie=["stroke","fill","strokeWidth","properties","onGeometryChange","onGeometryPreview","onGeometryFinish"];function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(n),!0).forEach(function(t){Re(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Re(e,t,n){return(t=function(e){var t=function(e){if("object"!=ke(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ke(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ke(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ne=function(e){return function(t,n){var r,i=t.appState,o=t.appConfig,a=t.pluginConfig,u=t.pluginState,l=t.mapState,s=t.mapProvider,c=t.services,f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},p=u.dispatch,d=s.draw,h=c.eventBus;if(d){var y=f.stroke,g=f.fill,v=f.strokeWidth,m=f.properties,b=f.onGeometryChange,S=f.onGeometryPreview,w=f.onGeometryFinish,E=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(f,Ie);$(d,{onGeometryChange:b,onGeometryPreview:S,onGeometryFinish:w},a,h),h.emit("draw:started",{mode:e,featureId:n});var P=void 0===f.snapLayers?null!==(r=a.snapLayers)&&void 0!==r?r:null:f.snapLayers;d.setSnapLayers(P),p({type:"SET_HAS_SNAP_LAYERS",payload:(null==P?void 0:P.length)>0});var O=Le(Le({},m),(0,X.h1)({stroke:y,fill:g,strokeWidth:v}));d.changeMode(e,Le(Le({container:i.layoutRefs.viewportRef.current,addVertexButtonId:"".concat(o.id,"-draw-add-point"),interfaceType:i.interfaceType,crossHair:l.crossHair,getSnapEnabled:function(){return d.isSnapEnabled()},featureId:n},E),{},{properties:O})),p({type:"SET_MODE",payload:e})}}},De=Ne("draw_polygon"),Ge=Ne("draw_line");function Fe(e){return Fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fe(e)}var Ve=["properties","onGeometryChange","onGeometryPreview","onGeometryFinish"];function Be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Be(Object(n),!0).forEach(function(t){He(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Be(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function He(e,t,n){return(t=function(e){var t=function(e){if("object"!=Fe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Fe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Fe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qe(e){return qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qe(e)}var ze=["stroke","fill","strokeWidth","properties"];function We(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ye(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?We(Object(n),!0).forEach(function(t){$e(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):We(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $e(e,t,n){return(t=function(e){var t=function(e){if("object"!=qe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=qe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==qe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xe=new Set(["Point","LineString","Polygon"]);function Ke(e){return Ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ke(e)}function Ze(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Je(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(n),!0).forEach(function(t){Qe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ze(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Qe(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ke(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ke(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ke(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function et(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return tt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var nt=new Set(["stroke","fill","strokeWidth"]),rt=function(e){return Object.fromEntries(Object.entries(e).map(function(e){var t=et(e,2),n=t[0],r=t[1];return[n,void 0===r?null:r]}))};function it(e){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},it(e)}function ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function at(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ot(Object(n),!0).forEach(function(t){ut(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ot(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ut(e,t,n){return(t=function(e){var t=function(e){if("object"!=it(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=it(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==it(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var lt=n(704);function st(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ct="_splitter",ft=function(e){var t,n,r,i,o=e.draw,a=(t=e.polygonFeature,n=e.feature,!(!(i=null===(r=n.geometry)||void 0===r?void 0:r.coordinates)||i.length<2||!(0,lt.ns)(t,{id:ct,geometry:n.geometry})));return o.setDrawingPreviewProperty("splitter",a?"valid":"invalid"),a};function pt(e){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pt(e)}function dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ht(e,t,n){return(t=function(e){var t=function(e){if("object"!=pt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=pt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var yt=function(){var e;return"undefined"!=typeof navigator&&/mac/i.test((null===(e=navigator.userAgentData)||void 0===e?void 0:e.platform)||navigator.platform||"")};function gt(e){return gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gt(e)}function vt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vt(Object(n),!0).forEach(function(t){bt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function bt(e,t,n){return(t=function(e){var t=function(e){if("object"!=gt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==gt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var St=yt()?"<kbd>Command</kbd> + <kbd>Z</kbd>":"<kbd>Ctrl</kbd> + <kbd>Z</kbd>",wt=yt()?"<kbd>Option</kbd>":"<kbd>Alt</kbd>",Et="top-middle",Pt=function(e){var t=e.checkSlow,n=e.holding;return!(!t||!n)},Ot=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"actions";return{mobile:{slot:t,showLabel:e},tablet:{slot:t,showLabel:e},desktop:{slot:t,showLabel:e}}},xt={reducer:{initialState:{mode:null,action:null,actionValid:!1,feature:null,tempFeature:null,selectedVertexIndex:-1,numVertices:null,validationStatus:"idle",canFinish:!1,checkSlow:!1,holding:!1,previewValid:!0,canAddPoint:!0,snap:!1,hasSnapLayers:!1,undoStackLength:0},actions:g},InitComponent:function(e){var t=e.appState,n=e.appConfig,r=e.mapState,i=e.pluginConfig,o=e.pluginState,a=e.services,l=e.mapProvider,c=e.buttonConfig,f=e.setApplicationMode,p=e.clearApplicationMode,d=a.eventBus,h=a.hints,y=a.symbolRegistry,g=r.crossHair;Oe({mapState:r,pluginState:o,services:a,mapProvider:l,spatialListRegistry:t.spatialListRegistry,viewportRef:t.layoutRefs.viewportRef});var b=(0,v.useRef)(!1);b.current=!o.holding&&(_e({appState:t,pluginState:o})||s(o.mode)&&"keyboard"===t.interfaceType),function(e){var t=e.mapState,n=e.pluginConfig,r=e.pluginState,i=e.mapProvider,o=e.eventBus,a=e.symbolRegistry,u=(0,v.useRef)(!0),l=(0,v.useRef)(!1);(0,v.useEffect)(function(){if(t.isMapReady&&!l.current){l.current=!0;var e=function(){var e,l=(e=Ae().m(function e(){var l,s;return Ae().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Ce();case 1:if(u.current){e.n=2;break}return e.a(2);case 2:return e.n=3,E(i,{mapStyle:t.mapStyle,snapLayers:n.snapLayers,pluginConfig:n,events:m,eventBus:o,symbolRegistry:a});case 3:if(s=e.v,u.current){e.n=4;break}return s.remove(),e.a(2);case 4:i.draw=s,r.dispatch({type:"SET_HAS_SNAP_LAYERS",payload:(null===(l=n.snapLayers)||void 0===l?void 0:l.length)>0}),o.emit("draw:ready");case 5:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){je(o,r,i,a,u,"next",e)}function u(e){je(o,r,i,a,u,"throw",e)}a(void 0)})});return function(){return l.apply(this,arguments)}}();e().catch(function(e){return _.v.error("[draw] failed to load the draw adapter",e)})}},[t.isMapReady]),(0,v.useEffect)(function(){return function(){var e;u.current=!1,null===(e=i.draw)||void 0===e||e.remove(),i.draw=null,i.activeMoveTarget=null}},[])}({mapState:r,pluginConfig:i,pluginState:o,mapProvider:l,eventBus:d,symbolRegistry:y}),(0,v.useLayoutEffect)(function(){if(o.mode)return f(xe.V3),function(){return p(xe.V3)};p(xe.V3)},[o.mode]),(0,v.useEffect)(function(){var e=null!==o.mode&&"edit_vertex"!==o.mode;return d.emit(m.MAP_SET_SPATIAL_LIST_SUPPRESSED,{suppressed:e}),function(){d.emit(m.MAP_SET_SPATIAL_LIST_SUPPRESSED,{suppressed:!1})}},[o.mode,d]),(0,v.useEffect)(function(){if(b.current){var e=g.isVisible;return g.fixAtCenter(),function(){e||b.current||g.hide()}}},[o.mode,o.holding,t.interfaceType,t.expandedButtons]),(0,v.useEffect)(function(){var e;e=o.mode,u.has(e)&&l.draw&&l.draw.setInterfaceType(t.interfaceType)},[t.interfaceType,o.mode]),(0,v.useEffect)(function(){if(l.draw)return ge({appState:t,appConfig:n,mapState:r,mapProvider:l,buttonConfig:c,pluginState:o,events:m,eventBus:d,hints:h,announce:a.announce})},[l,t,o])},applicationModes:bt({},xe.V3,{include:["mapStyles","mapControls","scaleBar"]}),buttons:[mt({id:"drawCancel",label:"Cancel",variant:"tertiary",exclusiveSlot:!0,hiddenWhen:function(e){return!e.pluginState.mode}},Ot(!0)),mt({id:"drawAddPoint",label:"Add point",variant:"primary",exclusiveSlot:!0,hiddenWhen:function(e){var t=e.appState,n=e.pluginState;return!_e({appState:t,pluginState:n})},enableWhen:function(e){var t=e.pluginState;return t.canAddPoint&&!t.holding}},Ot(!0)),mt({id:"drawDone",label:function(e){var t=e.pluginState;return Pt(t)?"Checking…":"Done"},busyWhen:function(e){var t=e.pluginState;return Pt(t)},variant:"primary",exclusiveSlot:!0,hiddenWhen:function(e){var t=e.pluginState;return!f(t.mode)&&!t.holding},enableWhen:function(e){var t=e.pluginState,n=t.mode,r=t.canFinish,i=t.previewValid,o=t.holding;return f(n)&&r&&i&&!o}},Ot(!0)),mt({id:"drawUndo",label:"Undo",iconId:"undo",hiddenWhen:function(e){var t=e.pluginState;return!f(t.mode)},enableWhen:function(e){var t=e.pluginState;return!t.holding&&(l(t.mode)?t.numVertices>0:t.undoStackLength>0)}},Ot(!1,Et)),mt({id:"drawSnap",label:"Snap",iconId:"magnet",hiddenWhen:function(e){var t=e.pluginState;return!t.mode||!t.hasSnapLayers},enableWhen:function(e){return!e.pluginState.holding},pressedWhen:function(e){return!!e.pluginState.snap}},Ot(!0,Et)),mt({id:"drawDeletePoint",label:"Delete point",iconId:"trash",enableWhen:function(e){var t,n=e.pluginState;return!(n.holding||n.selectedVertexIndex<0)&&("Polygon"===(null===(t=n.feature)||void 0===t||null===(t=t.geometry)||void 0===t?void 0:t.type)?n.numVertices>3:n.numVertices>2)},hiddenWhen:function(e){return"edit_vertex"!==e.pluginState.mode}},Ot(!1,Et))],keyboardShortcuts:[{id:"drawAddPoint",group:"Drawing",title:"Add point (draw)",command:"<kbd>Enter</kbd>"},{id:"drawSelectPoint",group:"Drawing",title:"Select nearest point (edit)",command:"<kbd>Spacebar</kbd>"},{id:"drawSelectAdjacentPoint",group:"Drawing",title:"Select adjacent point (edit)",command:"".concat(wt," + <kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> or <kbd>→</kbd>")},{id:"drawMovePoint",group:"Drawing",title:"Move point (edit)",command:"<kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> or <kbd>→</kbd>"},{id:"drawNudgePoint",group:"Drawing",title:"Nudge point (edit)",command:"<kbd>Shift</kbd> + <kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> or <kbd>→</kbd>"},{id:"drawDeletePoint",group:"Drawing",title:"Delete point (edit)",command:"<kbd>Delete</kbd>"},{id:"drawUndo",group:"Drawing",title:"Undo",command:St}],icons:[{id:"undo",svgContent:'<path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11"/>'},{id:"magnet",svgContent:'<path d="m12 15 4 4"/><path d="M2.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.029-6.029a1 1 0 1 1 3 3l-6.029 6.029a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.365-6.367A1 1 0 0 0 8.716 4.282z"/><path d="m5 8 4 4"/>'},{id:"trash",svgContent:'<path d="M10 11v6"/><path d="M14 11v6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>'}],api:{newPolygon:De,newLine:Ge,newPoint:function(e,t){var n,r=e.appState,i=e.appConfig,o=e.pluginConfig,a=e.pluginState,u=e.mapState,l=e.mapProvider,s=e.services,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},f=a.dispatch,p=l.draw,d=s.eventBus;if(p){var h=c.properties,y=c.onGeometryChange,g=c.onGeometryPreview,v=c.onGeometryFinish,m=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(c,Ve);$(p,{onGeometryChange:y,onGeometryPreview:g,onGeometryFinish:v},o,d),d.emit("draw:started",{mode:"draw_point",featureId:t});var b=void 0===c.snapLayers?null!==(n=o.snapLayers)&&void 0!==n?n:null:c.snapLayers;p.setSnapLayers(b),f({type:"SET_HAS_SNAP_LAYERS",payload:(null==b?void 0:b.length)>0});var S={};A.I.forEach(function(e){void 0!==m[e]&&(S[e]=m[e],delete m[e])}),p.changeMode("draw_point",Ue(Ue({container:r.layoutRefs.viewportRef.current,addVertexButtonId:"".concat(i.id,"-draw-add-point"),interfaceType:r.interfaceType,crossHair:u.crossHair,getSnapEnabled:function(){return p.isSnapEnabled()},featureId:t},m),{},{properties:Ue(Ue({},h),S)})),f({type:"SET_MODE",payload:"draw_point"})}},editFeature:function(e,t){var n,r=e.appState,i=e.appConfig,o=e.mapState,a=e.pluginConfig,u=e.pluginState,l=e.mapProvider,s=e.services,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},f=u.dispatch,p=l.draw,d=s.eventBus;if(!p)return!1;var h=p.get(t);if(!h)return!1;$(p,c,a,d);var y="Point"===h.geometry.type?"edit_point":"edit_vertex";d.emit("draw:editstart",{mode:{LineString:"edit_line",Polygon:"edit_polygon",Point:"edit_point"}[h.geometry.type],featureId:t});var g=void 0===c.snapLayers?null!==(n=a.snapLayers)&&void 0!==n?n:null:c.snapLayers;p.setSnapLayers(g),f({type:"SET_HAS_SNAP_LAYERS",payload:(null==g?void 0:g.length)>0}),p.changeMode(y,{container:r.layoutRefs.viewportRef.current,deleteVertexButtonId:"".concat(i.id,"-draw-delete-point"),undoButtonId:"".concat(i.id,"-draw-undo"),isPanEnabled:"keyboard"!==r.interfaceType,interfaceType:r.interfaceType,scale:o.mapSizeScale,featureId:t,getSnapEnabled:function(){return p.isSnapEnabled()}});var v=p.get(t);return f({type:"SET_FEATURE",payload:{feature:v,tempFeature:v}}),f({type:"SET_MODE",payload:y}),q(p).run({feature:v,context:{phase:"edit-start",mode:y},consumerCheck:p._commitValidator}),!0},addFeature:function(e,t){var n=e.mapState,r=e.mapProvider,i=e.services,o=r.draw,a=i.eventBus;if(o){var u=t.stroke,l=t.fill,s=t.strokeWidth,c=t.properties,f=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,ze),p=(0,X.h1)(c),d=Ye(Ye({type:"Feature"},f),{},{properties:(0,X.Uv)(Ye(Ye({},p),(0,X.A)(p,{stroke:u,fill:l,strokeWidth:s},(0,X._8)(n))))});!function(e){var t,n;return Xe.has(null===(t=e.geometry)||void 0===t?void 0:t.type)&&void 0!==(null===(n=e.geometry)||void 0===n?void 0:n.coordinates)}(d)?_.v.warn("addFeature: ignoring invalid GeoJSON feature",d):(o.add(d),a.emit("draw:add",R(d)))}},setStyle:function(e,t){var n=e.mapState,r=e.mapProvider,i=e.services,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r.draw,u=i.eventBus;if(!a)return!1;var l=a.get(t);if(!l)return _.v.warn("setStyle: no feature found for id",t),!1;for(var s={},c={},f=0,p=Object.entries(o);f<p.length;f++){var d=et(p[f],2),h=d[0],y=d[1];(nt.has(h)?s:c)[h]=y}var g=Je(Je({},(0,X.A)(l.properties,s,(0,X._8)(n))),(0,X.Uv)(c));return a.setStyle(t,g),u.emit("draw:stylechange",{featureId:t,properties:rt(g)}),!0},setProperties:function(e,t){var n=e.pluginState,r=e.mapState,i=e.mapProvider,o=e.services,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=i.draw,l=o.eventBus;if(!u)return!1;if(!u.get(t))return _.v.warn("setProperties: no feature found for id",t),!1;var s=Q(u,t,a,{caller:"setProperties",styleIds:(0,X._8)(r)}),f=n.feature,p=n.dispatch;return c(u.getMode())&&(null==f?void 0:f.id)===t&&p({type:"SET_FEATURE",payload:{feature:at(at({},f),{},{properties:at(at({},f.properties),s)})}}),l.emit("draw:propertieschange",{featureId:t,properties:s}),!0},deleteFeature:function(e,t){var n=e.mapProvider,r=e.services,i=n.draw,o=r.eventBus;i&&(i.delete(t),o.emit("draw:delete",{featureId:t}))},split:function(e,t){var n,r=e.appState,i=e.appConfig,o=e.pluginState,a=e.mapState,u=e.mapProvider,l=e.services,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=o.dispatch,f=u.draw,p=l.eventBus;if(f){var d=f.get(t),h=f._previewValidator,y=f._commitValidator,g=f._finishValidator;f._previewValidator=function(e){var t=e.draw,n=e.polygonFeature;return function(e){var r=e.feature;return"preview"===e.phase&&ft({draw:t,polygonFeature:n,feature:r}),{valid:!0}}}({draw:f,polygonFeature:d}),f._commitValidator=function(e){var t=e.draw,n=e.dispatch,r=e.polygonFeature;return function(e){var i,o=e.feature;return e.phase===P.P?(i=function(e){var t=e.dispatch,n=ft({draw:e.draw,polygonFeature:e.polygonFeature,feature:e.feature});return t({type:"SET_ACTION",payload:{name:"split",isValid:n}}),n}({draw:t,dispatch:n,polygonFeature:r,feature:o}),i?{valid:!0}:{valid:!1,reason:"Line does not split the shape into two parts"}):{valid:!0}}}({draw:f,dispatch:c,polygonFeature:d}),f._finishValidator=null,q(f).reset();var v=["stroke-inactive.cold"].concat(function(e){if(Array.isArray(e))return st(e)}(n=s.snapLayers||[])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||function(e,t){if(e){if("string"==typeof e)return st(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?st(e,t):void 0}}(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());f.setSnapLayers(v),c({type:"SET_HAS_SNAP_LAYERS",payload:!0}),f.changeMode("draw_line",{container:r.layoutRefs.viewportRef.current,addVertexButtonId:"".concat(i.id,"-draw-add-point"),interfaceType:r.interfaceType,crossHair:null==a?void 0:a.crossHair,getSnapEnabled:function(){return f.isSnapEnabled()},featureId:ct,properties:{splitter:"invalid"}});var m=function(){f._previewValidator=h,f._commitValidator=y,f._finishValidator=g,f.off(P.k.CREATE,b),f.off(P.k.CANCEL,S)},b=function(e){m(),f.delete(ct);var n=(0,lt.ns)(d,e);c({type:"SET_ACTION",payload:{name:"split",isValid:!!n}}),n&&p.emit("draw:split",{originalFeatureId:t,featureCollection:n})},S=function(){m()};f.on(P.k.CREATE,b),f.on(P.k.CANCEL,S),c({type:"SET_MODE",payload:"draw_line"}),c({type:"SET_ACTION",payload:{name:"split"}})}},merge:function(e,t){var n=e.mapProvider,r=e.services,i=n.draw,o=r.eventBus;if(!i)return null;var a=t.map(function(e){return i.get(e)}),u=(0,lt.OI)(a);return u&&o.emit("draw:merge",{originalFeatureIds:t,feature:u}),u},setGeometry:function(e,t){var n,r,i=e.mapProvider,o=e.pluginState,a=i.draw;if(!a||!c(a.getMode()))return!1;var u,l=a.get(null===(n=o.feature)||void 0===n?void 0:n.id);return!(!l||(null===(r=l.geometry)||void 0===r?void 0:r.type)!==(null==t?void 0:t.type)||(a.setGeometry({type:t.type,coordinates:(u=t.coordinates,JSON.parse(JSON.stringify(u)))}),0))},recheckGeometry:function(e,t){var n=e.mapProvider.draw;if(!n)return!1;var r=n.getMode(),i=q(n),o=i.state.feature;if(!f(r)||!o)return!1;var a=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dt(Object(n),!0).forEach(function(t){ht(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({phase:"recheck",mode:r},void 0!==t&&{detail:t});return i.run({feature:o,context:a,consumerCheck:n._commitValidator}),!0}}}},652:function(e,t,n){n.d(t,{A:function(){return b},TI:function(){return m},Uv:function(){return g},_8:function(){return v},h1:function(){return y}});var r=n(59),i=n(491);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=function(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return u}}(e,t)||f(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){if(e){if("string"==typeof e)return p(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var d=new Set(["stroke","fill","strokeWidth"]),h=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},y=function(e){if(!e)return{};for(var t={},n=0,r=Object.entries(e);n<r.length;n++){var o=c(r[n],2),a=o[0],u=o[1];if(d.has(a)&&(0,i.Q)(u)){var l=Object.entries(u);l.length>0&&(t[a]=l[0][1]);for(var s=0,f=l;s<f.length;s++){var p=c(f[s],2),y=p[0],g=p[1];t["".concat(a).concat(h(y))]=g}}else t[a]=u}return t},g=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={},n=0,r=Object.entries(e);n<r.length;n++){var i=c(r[n],2),o=i[0],a=i[1];void 0!==a&&(t[o]=a)}return t},v=function(e){var t,n;return null!==(t=null==e||null===(n=e.mapStyles)||void 0===n?void 0:n.map(function(e){return e.id}))&&void 0!==t?t:[]},m=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return d.has(e)||r.I.has(e)||(t=d,function(e){if(Array.isArray(e))return p(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||f(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).some(function(t){return n.some(function(n){return e==="".concat(t).concat(h(n))})})},b=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=g(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),r={},i=0,o=Object.keys(n);i<o.length;i++){var a=o[i];if(d.has(a)){var l,c=s(t);try{for(c.s();!(l=c.n()).done;){var f=l.value,p="".concat(a).concat(h(f));p in e&&(r[p]=void 0)}}catch(e){c.e(e)}finally{c.f()}}}return u(u({},r),y(n))}},491:function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}n.d(t,{Q:function(){return i}});var i=function(e){if(null===e||"object"!==r(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},704:function(e,t,n){function r(e){var t={type:"Feature"};return Object.keys(e).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:t[n]=e[n]}}),t.properties=i(e.properties),t.geometry=o(e.geometry),t}function i(e){var t={};return e?(Object.keys(e).forEach(function(n){var r=e[n];"object"==typeof r?null===r?t[n]=null:Array.isArray(r)?t[n]=r.map(function(e){return e}):t[n]=i(r):t[n]=r}),t):t}function o(e){var t={type:e.type};return e.bbox&&(t.bbox=e.bbox),"GeometryCollection"===e.type?(t.geometries=e.geometries.map(function(e){return o(e)}),t):(t.coordinates=a(e.coordinates),t)}function a(e){var t=e;return"object"!=typeof t[0]?t.slice():t.map(function(e){return a(e)})}n.d(t,{jK:function(){return ht},DF:function(){return dt},OI:function(){return ft},ns:function(){return ct}});function u(e){for(var t,n,r=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}(e),i=0,o=1;o<r.length;)t=n||r[0],i+=((n=r[o])[0]-t[0])*(n[1]+t[1]),o++;return i>0}function l(e,t){if("Feature"===e.type)t(e,0);else if("FeatureCollection"===e.type)for(var n=0;n<e.features.length&&!1!==t(e.features[n],n);n++);}function s(e,t){var n,r,i,o,a,u,l,s,c,f,p=0,d="FeatureCollection"===e.type,h="Feature"===e.type,y=d?e.features.length:1;for(n=0;n<y;n++){for(u=d?e.features[n].geometry:h?e.geometry:e,s=d?e.features[n].properties:h?e.properties:{},c=d?e.features[n].bbox:h?e.bbox:void 0,f=d?e.features[n].id:h?e.id:void 0,a=(l=!!u&&"GeometryCollection"===u.type)?u.geometries.length:1,i=0;i<a;i++)if(null!==(o=l?u.geometries[i]:u))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,p,s,c,f))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===t(o.geometries[r],p,s,c,f))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,p,s,c,f))return!1;p++}}function c(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function f(e,t){switch("Feature"===e.type?e.geometry.type:e.type){case"GeometryCollection":return s(e,function(e){f(e,t)}),e;case"LineString":return p(c(e),t),e;case"Polygon":return d(c(e),t),e;case"MultiLineString":return c(e).forEach(function(e){p(e,t)}),e;case"MultiPolygon":return c(e).forEach(function(e){d(e,t)}),e;case"Point":case"MultiPoint":return e}}function p(e,t){u(e)===t&&e.reverse()}function d(e,t){u(e[0])!==t&&e[0].reverse();for(var n=1;n<e.length;n++)u(e[n])===t&&e[n].reverse()}var h=function(e,t){if(!(n=t=t||{})||n.constructor!==Object)throw new Error("options is invalid");var n,i=t.reverse||!1,a=t.mutate||!1;if(!e)throw new Error("<geojson> is required");if("boolean"!=typeof i)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof a)throw new Error("<mutate> must be a boolean");!1===a&&(e=function(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return r(e);case"FeatureCollection":return function(e){var t={type:"FeatureCollection"};return Object.keys(e).forEach(function(n){switch(n){case"type":case"features":return;default:t[n]=e[n]}}),t.features=e.features.map(function(e){return r(e)}),t}(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return o(e);default:throw new Error("unknown GeoJSON type")}}(e));var u=[];switch(e.type){case"GeometryCollection":return s(e,function(e){f(e,i)}),e;case"FeatureCollection":return l(e,function(e){l(f(e,i),function(e){u.push(e)})}),function(e,t){void 0===t&&(t={});var n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}(u)}return f(e,i)};const y=11102230246251565e-32,g=134217729,v=(3+8*y)*y;function m(e,t,n,r,i){let o,a,u,l,s=t[0],c=r[0],f=0,p=0;c>s==c>-s?(o=s,s=t[++f]):(o=c,c=r[++p]);let d=0;if(f<e&&p<n)for(c>s==c>-s?(a=s+o,u=o-(a-s),s=t[++f]):(a=c+o,u=o-(a-c),c=r[++p]),o=a,0!==u&&(i[d++]=u);f<e&&p<n;)c>s==c>-s?(a=o+s,l=a-o,u=o-(a-l)+(s-l),s=t[++f]):(a=o+c,l=a-o,u=o-(a-l)+(c-l),c=r[++p]),o=a,0!==u&&(i[d++]=u);for(;f<e;)a=o+s,l=a-o,u=o-(a-l)+(s-l),s=t[++f],o=a,0!==u&&(i[d++]=u);for(;p<n;)a=o+c,l=a-o,u=o-(a-l)+(c-l),c=r[++p],o=a,0!==u&&(i[d++]=u);return 0===o&&0!==d||(i[d++]=o),d}function b(e){return new Float64Array(e)}const S=b(4),w=b(8),E=b(12),P=b(16),O=b(4);function x(e,t,n,r,i,o){const a=(t-o)*(n-i),u=(e-i)*(r-o),l=a-u,s=Math.abs(a+u);return Math.abs(l)>=33306690738754716e-32*s?l:-function(e,t,n,r,i,o,a){let u,l,s,c,f,p,d,h,y,b,x,_,A,T,j,C,k,I;const M=e-i,L=n-i,R=t-o,N=r-o;T=M*N,p=g*M,d=p-(p-M),h=M-d,p=g*N,y=p-(p-N),b=N-y,j=h*b-(T-d*y-h*y-d*b),C=R*L,p=g*R,d=p-(p-R),h=R-d,p=g*L,y=p-(p-L),b=L-y,k=h*b-(C-d*y-h*y-d*b),x=j-k,f=j-x,S[0]=j-(x+f)+(f-k),_=T+x,f=_-T,A=T-(_-f)+(x-f),x=A-C,f=A-x,S[1]=A-(x+f)+(f-C),I=_+x,f=I-_,S[2]=_-(I-f)+(x-f),S[3]=I;let D=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,S),G=22204460492503146e-32*a;if(D>=G||-D>=G)return D;if(f=e-M,u=e-(M+f)+(f-i),f=n-L,s=n-(L+f)+(f-i),f=t-R,l=t-(R+f)+(f-o),f=r-N,c=r-(N+f)+(f-o),0===u&&0===l&&0===s&&0===c)return D;if(G=11093356479670487e-47*a+v*Math.abs(D),D+=M*c+N*u-(R*s+L*l),D>=G||-D>=G)return D;T=u*N,p=g*u,d=p-(p-u),h=u-d,p=g*N,y=p-(p-N),b=N-y,j=h*b-(T-d*y-h*y-d*b),C=l*L,p=g*l,d=p-(p-l),h=l-d,p=g*L,y=p-(p-L),b=L-y,k=h*b-(C-d*y-h*y-d*b),x=j-k,f=j-x,O[0]=j-(x+f)+(f-k),_=T+x,f=_-T,A=T-(_-f)+(x-f),x=A-C,f=A-x,O[1]=A-(x+f)+(f-C),I=_+x,f=I-_,O[2]=_-(I-f)+(x-f),O[3]=I;const F=m(4,S,4,O,w);T=M*c,p=g*M,d=p-(p-M),h=M-d,p=g*c,y=p-(p-c),b=c-y,j=h*b-(T-d*y-h*y-d*b),C=R*s,p=g*R,d=p-(p-R),h=R-d,p=g*s,y=p-(p-s),b=s-y,k=h*b-(C-d*y-h*y-d*b),x=j-k,f=j-x,O[0]=j-(x+f)+(f-k),_=T+x,f=_-T,A=T-(_-f)+(x-f),x=A-C,f=A-x,O[1]=A-(x+f)+(f-C),I=_+x,f=I-_,O[2]=_-(I-f)+(x-f),O[3]=I;const V=m(F,w,4,O,E);T=u*c,p=g*u,d=p-(p-u),h=u-d,p=g*c,y=p-(p-c),b=c-y,j=h*b-(T-d*y-h*y-d*b),C=l*s,p=g*l,d=p-(p-l),h=l-d,p=g*s,y=p-(p-s),b=s-y,k=h*b-(C-d*y-h*y-d*b),x=j-k,f=j-x,O[0]=j-(x+f)+(f-k),_=T+x,f=_-T,A=T-(_-f)+(x-f),x=A-C,f=A-x,O[1]=A-(x+f)+(f-C),I=_+x,f=I-_,O[2]=_-(I-f)+(x-f),O[3]=I;const B=m(V,E,4,O,P);return P[B-1]}(e,t,n,r,i,o,s)}function _(e,t){var n,r,i,o,a,u,l,s,c,f=0,p=e[0],d=e[1],h=t.length;for(n=0;n<h;n++){r=0;var y=t[n],g=y.length-1;if((s=y[0])[0]!==y[g][0]&&s[1]!==y[g][1])throw new Error("First and last coordinates in a ring must be the same");for(o=s[0]-p,a=s[1]-d;r<g;r++){if(u=(c=y[r+1])[0]-p,l=c[1]-d,0===a&&0===l){if(u<=0&&o>=0||o<=0&&u>=0)return 0}else if(l>=0&&a<=0||l<=0&&a>=0){if(0===(i=x(o,u,a,l,0,0)))return 0;(i>0&&l>0&&a<=0||i<0&&l<=0&&a>0)&&f++}s=c,a=l,o=u}}return f%2!=0}b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(8),b(8),b(8),b(4),b(8),b(8),b(8),b(12),b(192),b(192),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(8),b(8),b(8),b(8),b(8),b(8),b(8),b(8),b(8),b(4),b(4),b(4),b(8),b(16),b(16),b(16),b(32),b(32),b(48),b(64),b(1152),b(1152),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(1152),b(1152),b(1152),b(1152),b(1152),b(2304),b(2304),b(3456),b(5760),b(8),b(8),b(8),b(16),b(24),b(48),b(48),b(96),b(192),b(384),b(384),b(384),b(768),b(96),b(96),b(96),b(1152);const A=134217729;function T(e,t,n,r,i){let o,a,u,l,s=t[0],c=r[0],f=0,p=0;c>s==c>-s?(o=s,s=t[++f]):(o=c,c=r[++p]);let d=0;if(f<e&&p<n)for(c>s==c>-s?(a=s+o,u=o-(a-s),s=t[++f]):(a=c+o,u=o-(a-c),c=r[++p]),o=a,0!==u&&(i[d++]=u);f<e&&p<n;)c>s==c>-s?(a=o+s,l=a-o,u=o-(a-l)+(s-l),s=t[++f]):(a=o+c,l=a-o,u=o-(a-l)+(c-l),c=r[++p]),o=a,0!==u&&(i[d++]=u);for(;f<e;)a=o+s,l=a-o,u=o-(a-l)+(s-l),s=t[++f],o=a,0!==u&&(i[d++]=u);for(;p<n;)a=o+c,l=a-o,u=o-(a-l)+(c-l),c=r[++p],o=a,0!==u&&(i[d++]=u);return 0===o&&0!==d||(i[d++]=o),d}function j(e){return new Float64Array(e)}const C=j(4),k=j(8),I=j(12),M=j(16),L=j(4);function R(e,t,n,r,i,o){const a=(t-o)*(n-i),u=(e-i)*(r-o),l=a-u;if(0===a||0===u||a>0!=u>0)return l;const s=Math.abs(a+u);return Math.abs(l)>=33306690738754716e-32*s?l:-function(e,t,n,r,i,o,a){let u,l,s,c,f,p,d,h,y,g,v,m,b,S,w,E,P,O;const x=e-i,_=n-i,j=t-o,R=r-o;S=x*R,p=A*x,d=p-(p-x),h=x-d,p=A*R,y=p-(p-R),g=R-y,w=h*g-(S-d*y-h*y-d*g),E=j*_,p=A*j,d=p-(p-j),h=j-d,p=A*_,y=p-(p-_),g=_-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,C[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,C[1]=b-(v+f)+(f-E),O=m+v,f=O-m,C[2]=m-(O-f)+(v-f),C[3]=O;let N=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,C),D=22204460492503146e-32*a;if(N>=D||-N>=D)return N;if(f=e-x,u=e-(x+f)+(f-i),f=n-_,s=n-(_+f)+(f-i),f=t-j,l=t-(j+f)+(f-o),f=r-R,c=r-(R+f)+(f-o),0===u&&0===l&&0===s&&0===c)return N;if(D=11093356479670487e-47*a+33306690738754706e-32*Math.abs(N),N+=x*c+R*u-(j*s+_*l),N>=D||-N>=D)return N;S=u*R,p=A*u,d=p-(p-u),h=u-d,p=A*R,y=p-(p-R),g=R-y,w=h*g-(S-d*y-h*y-d*g),E=l*_,p=A*l,d=p-(p-l),h=l-d,p=A*_,y=p-(p-_),g=_-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,L[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,L[1]=b-(v+f)+(f-E),O=m+v,f=O-m,L[2]=m-(O-f)+(v-f),L[3]=O;const G=T(4,C,4,L,k);S=x*c,p=A*x,d=p-(p-x),h=x-d,p=A*c,y=p-(p-c),g=c-y,w=h*g-(S-d*y-h*y-d*g),E=j*s,p=A*j,d=p-(p-j),h=j-d,p=A*s,y=p-(p-s),g=s-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,L[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,L[1]=b-(v+f)+(f-E),O=m+v,f=O-m,L[2]=m-(O-f)+(v-f),L[3]=O;const F=T(G,k,4,L,I);S=u*c,p=A*u,d=p-(p-u),h=u-d,p=A*c,y=p-(p-c),g=c-y,w=h*g-(S-d*y-h*y-d*g),E=l*s,p=A*l,d=p-(p-l),h=l-d,p=A*s,y=p-(p-s),g=s-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,L[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,L[1]=b-(v+f)+(f-E),O=m+v,f=O-m,L[2]=m-(O-f)+(v-f),L[3]=O;const V=T(F,I,4,L,M);return M[V-1]}(e,t,n,r,i,o,s)}j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(8),j(8),j(8),j(4),j(8),j(8),j(8),j(12),j(192),j(192),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(8),j(8),j(8),j(8),j(8),j(8),j(8),j(8),j(8),j(4),j(4),j(4),j(8),j(16),j(16),j(16),j(32),j(32),j(48),j(64),j(1152),j(1152),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(24),j(24),j(24),j(24),j(24),j(24),j(24),j(24),j(24),j(24),j(1152),j(1152),j(1152),j(1152),j(1152),j(2304),j(2304),j(3456),j(5760),j(8),j(8),j(8),j(16),j(24),j(48),j(48),j(96),j(192),j(384),j(384),j(384),j(768),j(96),j(96),j(96),j(1152);var N=function(e,t,n,r,i){this.p1=e,this.p2=t,this.edgeType=n,this.originalIndex=r,this.polygonContourId=i,this.interiorRing=!1,this.minX=Math.min(e.p[0],t.p[0]),this.minY=Math.min(e.p[1],t.p[1]),this.maxX=Math.max(e.p[0],t.p[0]),this.maxY=Math.max(e.p[1],t.p[1]),this.intersectionPoints=[],this.nextEdge=null},D=function(e){this.p=e},G=function(e,t){this.id=e,this.rawCoords=t};function F(e,t){return!(e.maxX<t[0]||e.minX>t[2]||e.maxY<t[1]||e.minY>t[3])}var V=function(e,t,n,r){this.p=e,this.polylineEdge=t,this.polygonEdge=n,this.isHeadingIn=r,this.distanceFromPolylineEdgeStart=B(this.polylineEdge.p1.p,this.p),this.distanceFromPolygonEdgeStart=B(this.polygonEdge.p1.p,this.p),this.polygonEdge.intersectionPoints.push(this),this.polylineEdge.intersectionPoints.push(this),this.visitCount=0};function B(e,t){var n=t[0]-e[0],r=t[1]-e[1];return n*=n,r*=r,Math.sqrt(n+r)}V.prototype.incrementVisitCount=function(){this.visitCount=this.visitCount+1};function U(e,t){return e[0]*t[1]-e[1]*t[0]}function H(e,t){return e[0]*t[0]+e[1]*t[1]}function q(e,t,n){return[e[0]+t*n[0],e[1]+t*n[1]]}function z(e,t,n){var r=[e.p2.p[0]-e.p1.p[0],e.p2.p[1]-e.p1.p[1]],i=[t.p2.p[0]-t.p1.p[0],t.p2.p[1]-t.p1.p[1]],o=[t.p1.p[0]-e.p1.p[0],t.p1.p[1]-e.p1.p[1]],a=U(r,i),u=a*a,l=H(r,r);if(u>0){var s=U(o,i)/a;if(s<0||s>1)return null;var c=U(o,r)/a;return c<0||c>1?null:0===s||1===s?n?null:[q(e.p1.p,s,r)]:0===c||1===c?n?null:[q(t.p1.p,c,i)]:[q(e.p1.p,s,r)]}var f=H(o,o);if((u=(a=U(o,r))*a)>1e-9*l*f)return null;var p=H(r,o)/l,d=p+H(r,i)/l,h=Math.min(p,d),y=Math.max(p,d);return h<=1&&y>=0?1===h?n?null:[q(e.p1.p,h>0?h:0,r)]:0===y?n?null:[q(e.p1.p,y<1?y:1,r)]:n&&0===h&&1===y?null:[q(e.p1.p,h>0?h:0,r),q(e.p1.p,y<1?y:1,r)]:null}function W(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.polygonContourId===t)return r}}function Y(e,t){return t.find(function(t){return t.id===e.polygonContourId}).rawCoords}function $(e,t){for(var n=0;n<t.length;n++){var r=t[n];if(_(e[0],[r[0]]))return void r.push(e)}t.push([e])}function X(e,t){var n=e.polygonEdge;if(n.intersectionPoints.length>1&&n.intersectionPoints[n.intersectionPoints.length-1]!==e){var r=K(e,n.intersectionPoints),i=n.intersectionPoints[r+1];return t.push(i.p),i.incrementVisitCount(),i}for(var o=!0;o;){if(t.push(n.p2.p),null===(n=n.nextEdge))return e;n.intersectionPoints.length>0&&(o=!1)}return n.intersectionPoints[0].incrementVisitCount(),t.push(n.intersectionPoints[0].p),n.intersectionPoints[0]}function K(e,t){for(var n=0;n<t.length;n++)if(t[n]===e)return n;return null}function Z(e,t){var n=e.polylineEdge;if(2===n.intersectionPoints.length){var r=n.intersectionPoints[n.intersectionPoints.length-1];if(r===e){var i=n.intersectionPoints[0];return t.push(i.p),i.incrementVisitCount(),i}return t.push(r.p),r.incrementVisitCount(),r}if(n.intersectionPoints.length>2&&n.intersectionPoints[0]!==e){var o=K(e,n.intersectionPoints),a=n.intersectionPoints[o-1];return t.push(a.p),a.incrementVisitCount(),a}for(var u=!0;u;){if(t.push(n.p1.p),void 0===(n=n.prevEdge).originalIndex)return e;n.intersectionPoints.length>0&&(u=!1)}if(void 0===n.originalIndex)return e;var l=n.intersectionPoints[n.intersectionPoints.length-1];return l.incrementVisitCount(),t.push(l.p),l}function J(e,t){var n=e.polylineEdge;if(n.intersectionPoints.length>1&&n.intersectionPoints[n.intersectionPoints.length-1]!==e){var r=K(e,n.intersectionPoints),i=n.intersectionPoints[r+1];return t.push(i.p),i.incrementVisitCount(),i}for(var o=!0;o;){if(t.push(n.p2.p),null===(n=n.nextEdge))return e;n.intersectionPoints.length>0&&(o=!1)}if(void 0===n)return e;var a=n.intersectionPoints[0];return a.incrementVisitCount(),t.push(a.p),a}var Q=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ee=Math.ceil,te=Math.floor,ne="[BigNumber Error] ",re=ne+"Number primitive has more than 15 significant digits: ",ie=1e14,oe=14,ae=9007199254740991,ue=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],le=1e7,se=1e9;function ce(e){var t=0|e;return e>0||e===t?t:t-1}function fe(e){for(var t,n,r=1,i=e.length,o=e[0]+"";r<i;){for(t=e[r++]+"",n=oe-t.length;n--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function pe(e,t){var n,r,i=e.c,o=t.c,a=e.s,u=t.s,l=e.e,s=t.e;if(!a||!u)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-u:a;if(a!=u)return a;if(n=a<0,r=l==s,!i||!o)return r?0:!i^n?1:-1;if(!r)return l>s^n?1:-1;for(u=(l=i.length)<(s=o.length)?l:s,a=0;a<u;a++)if(i[a]!=o[a])return i[a]>o[a]^n?1:-1;return l==s?0:l>s^n?1:-1}function de(e,t,n,r){if(e<t||e>n||e!==te(e))throw Error(ne+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function he(e){var t=e.c.length-1;return ce(e.e/oe)==t&&e.c[t]%2!=0}function ye(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ge(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(++t>(r=e.length)){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var ve=function e(t){var n,r,i,o,a,u,l,s,c,f,p=_.prototype={constructor:_,toString:null,valueOf:null},d=new _(1),h=20,y=4,g=-7,v=21,m=-1e7,b=1e7,S=!1,w=1,E=0,P={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},O="0123456789abcdefghijklmnopqrstuvwxyz",x=!0;function _(e,t){var n,o,a,u,l,s,c,f,p=this;if(!(p instanceof _))return new _(e,t);if(null==t){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>b?p.c=p.e=null:e.e<m?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((s="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,l=e;l>=10;l/=10,u++);return void(u>b?p.c=p.e=null:(p.e=u,p.c=[e]))}f=String(e)}else{if(!Q.test(f=String(e)))return i(p,f,s);p.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(u=f.indexOf("."))>-1&&(f=f.replace(".","")),(l=f.search(/e/i))>0?(u<0&&(u=l),u+=+f.slice(l+1),f=f.substring(0,l)):u<0&&(u=f.length)}else{if(de(t,2,O.length,"Base"),10==t&&x)return C(p=new _(e),h+p.e+1,y);if(f=String(e),s="number"==typeof e){if(0*e!=0)return i(p,f,s,t);if(p.s=1/e<0?(f=f.slice(1),-1):1,_.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(re+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(n=O.slice(0,t),u=l=0,c=f.length;l<c;l++)if(n.indexOf(o=f.charAt(l))<0){if("."==o){if(l>u){u=c;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,l=-1,u=0;continue}return i(p,String(e),s,t)}s=!1,(u=(f=r(f,t,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):u=f.length}for(l=0;48===f.charCodeAt(l);l++);for(c=f.length;48===f.charCodeAt(--c););if(f=f.slice(l,++c)){if(c-=l,s&&_.DEBUG&&c>15&&(e>ae||e!==te(e)))throw Error(re+p.s*e);if((u=u-l-1)>b)p.c=p.e=null;else if(u<m)p.c=[p.e=0];else{if(p.e=u,p.c=[],l=(u+1)%oe,u<0&&(l+=oe),l<c){for(l&&p.c.push(+f.slice(0,l)),c-=oe;l<c;)p.c.push(+f.slice(l,l+=oe));l=oe-(f=f.slice(l)).length}else l-=c;for(;l--;f+="0");p.c.push(+f)}}else p.c=[p.e=0]}function A(e,t,n,r){var i,o,a,u,l;if(null==n?n=y:de(n,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==t)l=fe(e.c),l=1==r||2==r&&(a<=g||a>=v)?ye(l,a):ge(l,a,"0");else if(o=(e=C(new _(e),t,n)).e,u=(l=fe(e.c)).length,1==r||2==r&&(t<=o||o<=g)){for(;u<t;l+="0",u++);l=ye(l,o)}else if(t-=a+(2===r&&o>a),l=ge(l,o,"0"),o+1>u){if(--t>0)for(l+=".";t--;l+="0");}else if((t+=o-u)>0)for(o+1==u&&(l+=".");t--;l+="0");return e.s<0&&i?"-"+l:l}function T(e,t){for(var n,r,i=1,o=new _(e[0]);i<e.length;i++)(!(r=new _(e[i])).s||(n=pe(o,r))===t||0===n&&o.s===t)&&(o=r);return o}function j(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*oe-1)>b?e.c=e.e=null:n<m?e.c=[e.e=0]:(e.e=n,e.c=t),e}function C(e,t,n,r){var i,o,a,u,l,s,c,f=e.c,p=ue;if(f){e:{for(i=1,u=f[0];u>=10;u/=10,i++);if((o=t-i)<0)o+=oe,a=t,l=f[s=0],c=te(l/p[i-a-1]%10);else if((s=ee((o+1)/oe))>=f.length){if(!r)break e;for(;f.length<=s;f.push(0));l=c=0,i=1,a=(o%=oe)-oe+1}else{for(l=u=f[s],i=1;u>=10;u/=10,i++);c=(a=(o%=oe)-oe+i)<0?0:te(l/p[i-a-1]%10)}if(r=r||t<0||null!=f[s+1]||(a<0?l:l%p[i-a-1]),r=n<4?(c||r)&&(0==n||n==(e.s<0?3:2)):c>5||5==c&&(4==n||r||6==n&&(o>0?a>0?l/p[i-a]:0:f[s-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,r?(t-=e.e+1,f[0]=p[(oe-t%oe)%oe],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=s,u=1,s--):(f.length=s+1,u=p[oe-o],f[s]=a>0?te(l/p[i-a]%p[a])*u:0),r)for(;;){if(0==s){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=u,u=1;a>=10;a/=10,u++);o!=u&&(e.e++,f[0]==ie&&(f[0]=1));break}if(f[s]+=u,f[s]!=ie)break;f[s--]=0,u=1}for(o=f.length;0===f[--o];f.pop());}e.e>b?e.c=e.e=null:e.e<m&&(e.c=[e.e=0])}return e}function k(e){var t,n=e.e;return null===n?e.toString():(t=fe(e.c),t=n<=g||n>=v?ye(t,n):ge(t,n,"0"),e.s<0?"-"+t:t)}return _.clone=e,_.ROUND_UP=0,_.ROUND_DOWN=1,_.ROUND_CEIL=2,_.ROUND_FLOOR=3,_.ROUND_HALF_UP=4,_.ROUND_HALF_DOWN=5,_.ROUND_HALF_EVEN=6,_.ROUND_HALF_CEIL=7,_.ROUND_HALF_FLOOR=8,_.EUCLID=9,_.config=_.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(ne+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(de(n=e[t],0,se,t),h=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(de(n=e[t],0,8,t),y=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(de(n[0],-se,0,t),de(n[1],0,se,t),g=n[0],v=n[1]):(de(n,-se,se,t),g=-(v=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)de(n[0],-se,-1,t),de(n[1],1,se,t),m=n[0],b=n[1];else{if(de(n,-se,se,t),!n)throw Error(ne+t+" cannot be zero: "+n);m=-(b=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(ne+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw S=!n,Error(ne+"crypto unavailable");S=n}else S=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(de(n=e[t],0,9,t),w=n),e.hasOwnProperty(t="POW_PRECISION")&&(de(n=e[t],0,se,t),E=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(ne+t+" not an object: "+n);P=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(ne+t+" invalid: "+n);x="0123456789"==n.slice(0,10),O=n}}return{DECIMAL_PLACES:h,ROUNDING_MODE:y,EXPONENTIAL_AT:[g,v],RANGE:[m,b],CRYPTO:S,MODULO_MODE:w,POW_PRECISION:E,FORMAT:P,ALPHABET:O}},_.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!_.DEBUG)return!0;var t,n,r=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-se&&i<=se&&i===te(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if((t=(i+1)%oe)<1&&(t+=oe),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=ie||n!==te(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(ne+"Invalid BigNumber: "+e)},_.maximum=_.max=function(){return T(arguments,-1)},_.minimum=_.min=function(){return T(arguments,1)},_.random=(o=9007199254740992,a=Math.random()*o&2097151?function(){return te(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,i,o,u=0,l=[],s=new _(d);if(null==e?e=h:de(e,0,se),i=ee(e/oe),S)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)(o=131072*t[u]+(t[u+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[u]=n[0],t[u+1]=n[1]):(l.push(o%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw S=!1,Error(ne+"crypto unavailable");for(t=crypto.randomBytes(i*=7);u<i;)(o=281474976710656*(31&t[u])+1099511627776*t[u+1]+4294967296*t[u+2]+16777216*t[u+3]+(t[u+4]<<16)+(t[u+5]<<8)+t[u+6])>=9e15?crypto.randomBytes(7).copy(t,u):(l.push(o%1e14),u+=7);u=i/7}if(!S)for(;u<i;)(o=a())<9e15&&(l[u++]=o%1e14);for(i=l[--u],e%=oe,i&&e&&(o=ue[oe-e],l[u]=te(i/o)*o);0===l[u];l.pop(),u--);if(u<0)l=[r=0];else{for(r=-1;0===l[0];l.splice(0,1),r-=oe);for(u=1,o=l[0];o>=10;o/=10,u++);u<oe&&(r-=oe-u)}return s.e=r,s.c=l,s}),_.sum=function(){for(var e=1,t=arguments,n=new _(t[0]);e<t.length;)n=n.plus(t[e++]);return n},r=function(){var e="0123456789";function t(e,t,n,r){for(var i,o,a=[0],u=0,l=e.length;u<l;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(u++)),i=0;i<a.length;i++)a[i]>n-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,o,a,u){var l,s,c,f,p,d,g,v,m=r.indexOf("."),b=h,S=y;for(m>=0&&(f=E,E=0,r=r.replace(".",""),d=(v=new _(i)).pow(r.length-m),E=f,v.c=t(ge(fe(d.c),d.e,"0"),10,o,e),v.e=v.c.length),c=f=(g=t(r,i,o,u?(l=O,e):(l=e,O))).length;0==g[--f];g.pop());if(!g[0])return l.charAt(0);if(m<0?--c:(d.c=g,d.e=c,d.s=a,g=(d=n(d,v,b,S,o)).c,p=d.r,c=d.e),m=g[s=c+b+1],f=o/2,p=p||s<0||null!=g[s+1],p=S<4?(null!=m||p)&&(0==S||S==(d.s<0?3:2)):m>f||m==f&&(4==S||p||6==S&&1&g[s-1]||S==(d.s<0?8:7)),s<1||!g[0])r=p?ge(l.charAt(1),-b,l.charAt(0)):l.charAt(0);else{if(g.length=s,p)for(--o;++g[--s]>o;)g[s]=0,s||(++c,g=[1].concat(g));for(f=g.length;!g[--f];);for(m=0,r="";m<=f;r+=l.charAt(g[m++]));r=ge(r,c,l.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,i,o,a,u=0,l=e.length,s=t%le,c=t/le|0;for(e=e.slice();l--;)u=((i=s*(o=e[l]%le)+(r=c*o+(a=e[l]/le|0)*s)%le*le+u)/n|0)+(r/le|0)+c*a,e[l]=i%n;return u&&(e=[u].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,o,a,u){var l,s,c,f,p,d,h,y,g,v,m,b,S,w,E,P,O,x=r.s==i.s?1:-1,A=r.c,T=i.c;if(!(A&&A[0]&&T&&T[0]))return new _(r.s&&i.s&&(A?!T||A[0]!=T[0]:T)?A&&0==A[0]||!T?0*x:x/0:NaN);for(g=(y=new _(x)).c=[],x=o+(s=r.e-i.e)+1,u||(u=ie,s=ce(r.e/oe)-ce(i.e/oe),x=x/oe|0),c=0;T[c]==(A[c]||0);c++);if(T[c]>(A[c]||0)&&s--,x<0)g.push(1),f=!0;else{for(w=A.length,P=T.length,c=0,x+=2,(p=te(u/(T[0]+1)))>1&&(T=e(T,p,u),A=e(A,p,u),P=T.length,w=A.length),S=P,m=(v=A.slice(0,P)).length;m<P;v[m++]=0);O=T.slice(),O=[0].concat(O),E=T[0],T[1]>=u/2&&E++;do{if(p=0,(l=t(T,v,P,m))<0){if(b=v[0],P!=m&&(b=b*u+(v[1]||0)),(p=te(b/E))>1)for(p>=u&&(p=u-1),h=(d=e(T,p,u)).length,m=v.length;1==t(d,v,h,m);)p--,n(d,P<h?O:T,h,u),h=d.length,l=1;else 0==p&&(l=p=1),h=(d=T.slice()).length;if(h<m&&(d=[0].concat(d)),n(v,d,m,u),m=v.length,-1==l)for(;t(T,v,P,m)<1;)p++,n(v,P<m?O:T,m,u),m=v.length}else 0===l&&(p++,v=[0]);g[c++]=p,v[0]?v[m++]=A[S]||0:(v=[A[S]],m=1)}while((S++<w||null!=v[0])&&x--);f=null!=v[0],g[0]||g.splice(0,1)}if(u==ie){for(c=1,x=g[0];x>=10;x/=10,c++);C(y,o+(y.e=c+s*oe-1)+1,a,f)}else y.e=s,y.r=+f;return y}}(),u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,s=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,f=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,n,r){var i,o=n?t:t.replace(f,"");if(c.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(u,function(e,t,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?e:t}),r&&(i=r,o=o.replace(l,"$1").replace(s,"0.$1")),t!=o))return new _(o,i);if(_.DEBUG)throw Error(ne+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},p.absoluteValue=p.abs=function(){var e=new _(this);return e.s<0&&(e.s=1),e},p.comparedTo=function(e,t){return pe(this,new _(e,t))},p.decimalPlaces=p.dp=function(e,t){var n,r,i,o=this;if(null!=e)return de(e,0,se),null==t?t=y:de(t,0,8),C(new _(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-ce(this.e/oe))*oe,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},p.dividedBy=p.div=function(e,t){return n(this,new _(e,t),h,y)},p.dividedToIntegerBy=p.idiv=function(e,t){return n(this,new _(e,t),0,1)},p.exponentiatedBy=p.pow=function(e,t){var n,r,i,o,a,u,l,s,c=this;if((e=new _(e)).c&&!e.isInteger())throw Error(ne+"Exponent not an integer: "+k(e));if(null!=t&&(t=new _(t)),a=e.e>14,!c.c||!c.c[0]||1==c.c[0]&&!c.e&&1==c.c.length||!e.c||!e.c[0])return s=new _(Math.pow(+k(c),a?e.s*(2-he(e)):+k(e))),t?s.mod(t):s;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new _(NaN);(r=!u&&c.isInteger()&&t.isInteger())&&(c=c.mod(t))}else{if(e.e>9&&(c.e>0||c.e<-1||(0==c.e?c.c[0]>1||a&&c.c[1]>=24e7:c.c[0]<8e13||a&&c.c[0]<=9999975e7)))return o=c.s<0&&he(e)?-0:0,c.e>-1&&(o=1/o),new _(u?1/o:o);E&&(o=ee(E/oe+2))}for(a?(n=new _(.5),u&&(e.s=1),l=he(e)):l=(i=Math.abs(+k(e)))%2,s=new _(d);;){if(l){if(!(s=s.times(c)).c)break;o?s.c.length>o&&(s.c.length=o):r&&(s=s.mod(t))}if(i){if(0===(i=te(i/2)))break;l=i%2}else if(C(e=e.times(n),e.e+1,1),e.e>14)l=he(e);else{if(0===(i=+k(e)))break;l=i%2}c=c.times(c),o?c.c&&c.c.length>o&&(c.c.length=o):r&&(c=c.mod(t))}return r?s:(u&&(s=d.div(s)),t?s.mod(t):o?C(s,E,y,void 0):s)},p.integerValue=function(e){var t=new _(this);return null==e?e=y:de(e,0,8),C(t,t.e+1,e)},p.isEqualTo=p.eq=function(e,t){return 0===pe(this,new _(e,t))},p.isFinite=function(){return!!this.c},p.isGreaterThan=p.gt=function(e,t){return pe(this,new _(e,t))>0},p.isGreaterThanOrEqualTo=p.gte=function(e,t){return 1===(t=pe(this,new _(e,t)))||0===t},p.isInteger=function(){return!!this.c&&ce(this.e/oe)>this.c.length-2},p.isLessThan=p.lt=function(e,t){return pe(this,new _(e,t))<0},p.isLessThanOrEqualTo=p.lte=function(e,t){return-1===(t=pe(this,new _(e,t)))||0===t},p.isNaN=function(){return!this.s},p.isNegative=function(){return this.s<0},p.isPositive=function(){return this.s>0},p.isZero=function(){return!!this.c&&0==this.c[0]},p.minus=function(e,t){var n,r,i,o,a=this,u=a.s;if(t=(e=new _(e,t)).s,!u||!t)return new _(NaN);if(u!=t)return e.s=-t,a.plus(e);var l=a.e/oe,s=e.e/oe,c=a.c,f=e.c;if(!l||!s){if(!c||!f)return c?(e.s=-t,e):new _(f?a:NaN);if(!c[0]||!f[0])return f[0]?(e.s=-t,e):new _(c[0]?a:3==y?-0:0)}if(l=ce(l),s=ce(s),c=c.slice(),u=l-s){for((o=u<0)?(u=-u,i=c):(s=l,i=f),i.reverse(),t=u;t--;i.push(0));i.reverse()}else for(r=(o=(u=c.length)<(t=f.length))?u:t,u=t=0;t<r;t++)if(c[t]!=f[t]){o=c[t]<f[t];break}if(o&&(i=c,c=f,f=i,e.s=-e.s),(t=(r=f.length)-(n=c.length))>0)for(;t--;c[n++]=0);for(t=ie-1;r>u;){if(c[--r]<f[r]){for(n=r;n&&!c[--n];c[n]=t);--c[n],c[r]+=ie}c[r]-=f[r]}for(;0==c[0];c.splice(0,1),--s);return c[0]?j(e,c,s):(e.s=3==y?-1:1,e.c=[e.e=0],e)},p.modulo=p.mod=function(e,t){var r,i,o=this;return e=new _(e,t),!o.c||!e.s||e.c&&!e.c[0]?new _(NaN):!e.c||o.c&&!o.c[0]?new _(o):(9==w?(i=e.s,e.s=1,r=n(o,e,0,3),e.s=i,r.s*=i):r=n(o,e,0,w),(e=o.minus(r.times(e))).c[0]||1!=w||(e.s=o.s),e)},p.multipliedBy=p.times=function(e,t){var n,r,i,o,a,u,l,s,c,f,p,d,h,y,g,v=this,m=v.c,b=(e=new _(e,t)).c;if(!(m&&b&&m[0]&&b[0]))return!v.s||!e.s||m&&!m[0]&&!b||b&&!b[0]&&!m?e.c=e.e=e.s=null:(e.s*=v.s,m&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=ce(v.e/oe)+ce(e.e/oe),e.s*=v.s,(l=m.length)<(f=b.length)&&(h=m,m=b,b=h,i=l,l=f,f=i),i=l+f,h=[];i--;h.push(0));for(y=ie,g=le,i=f;--i>=0;){for(n=0,p=b[i]%g,d=b[i]/g|0,o=i+(a=l);o>i;)n=((s=p*(s=m[--a]%g)+(u=d*s+(c=m[a]/g|0)*p)%g*g+h[o]+n)/y|0)+(u/g|0)+d*c,h[o--]=s%y;h[o]=n}return n?++r:h.splice(0,1),j(e,h,r)},p.negated=function(){var e=new _(this);return e.s=-e.s||null,e},p.plus=function(e,t){var n,r=this,i=r.s;if(t=(e=new _(e,t)).s,!i||!t)return new _(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/oe,a=e.e/oe,u=r.c,l=e.c;if(!o||!a){if(!u||!l)return new _(i/0);if(!u[0]||!l[0])return l[0]?e:new _(u[0]?r:0*i)}if(o=ce(o),a=ce(a),u=u.slice(),i=o-a){for(i>0?(a=o,n=l):(i=-i,n=u),n.reverse();i--;n.push(0));n.reverse()}for((i=u.length)-(t=l.length)<0&&(n=l,l=u,u=n,t=i),i=0;t;)i=(u[--t]=u[t]+l[t]+i)/ie|0,u[t]=ie===u[t]?0:u[t]%ie;return i&&(u=[i].concat(u),++a),j(e,u,a)},p.precision=p.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return de(e,1,se),null==t?t=y:de(t,0,8),C(new _(o),e,t);if(!(n=o.c))return null;if(r=(i=n.length-1)*oe+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},p.shiftedBy=function(e){return de(e,-9007199254740991,ae),this.times("1e"+e)},p.squareRoot=p.sqrt=function(){var e,t,r,i,o,a=this,u=a.c,l=a.s,s=a.e,c=h+4,f=new _("0.5");if(1!==l||!u||!u[0])return new _(!l||l<0&&(!u||u[0])?NaN:u?a:1/0);if(0==(l=Math.sqrt(+k(a)))||l==1/0?(((t=fe(u)).length+s)%2==0&&(t+="0"),l=Math.sqrt(+t),s=ce((s+1)/2)-(s<0||s%2),r=new _(t=l==1/0?"5e"+s:(t=l.toExponential()).slice(0,t.indexOf("e")+1)+s)):r=new _(l+""),r.c[0])for((l=(s=r.e)+c)<3&&(l=0);;)if(o=r,r=f.times(o.plus(n(a,o,c,1))),fe(o.c).slice(0,l)===(t=fe(r.c)).slice(0,l)){if(r.e<s&&--l,"9999"!=(t=t.slice(l-3,l+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(C(r,r.e+h+2,1),e=!r.times(r).eq(a));break}if(!i&&(C(o,o.e+h+2,0),o.times(o).eq(a))){r=o;break}c+=4,l+=4,i=1}return C(r,r.e+h+1,y,e)},p.toExponential=function(e,t){return null!=e&&(de(e,0,se),e++),A(this,e,t,1)},p.toFixed=function(e,t){return null!=e&&(de(e,0,se),e=e+this.e+1),A(this,e,t)},p.toFormat=function(e,t,n){var r,i=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=P;else if("object"!=typeof n)throw Error(ne+"Argument not an object: "+n);if(r=i.toFixed(e,t),i.c){var o,a=r.split("."),u=+n.groupSize,l=+n.secondaryGroupSize,s=n.groupSeparator||"",c=a[0],f=a[1],p=i.s<0,d=p?c.slice(1):c,h=d.length;if(l&&(o=u,u=l,l=o,h-=o),u>0&&h>0){for(o=h%u||u,c=d.substr(0,o);o<h;o+=u)c+=s+d.substr(o,u);l>0&&(c+=s+d.slice(o)),p&&(c="-"+c)}r=f?c+(n.decimalSeparator||"")+((l=+n.fractionGroupSize)?f.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):f):c}return(n.prefix||"")+r+(n.suffix||"")},p.toFraction=function(e){var t,r,i,o,a,u,l,s,c,f,p,h,g=this,v=g.c;if(null!=e&&(!(l=new _(e)).isInteger()&&(l.c||1!==l.s)||l.lt(d)))throw Error(ne+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+k(l));if(!v)return new _(g);for(t=new _(d),c=r=new _(d),i=s=new _(d),h=fe(v),a=t.e=h.length-g.e-1,t.c[0]=ue[(u=a%oe)<0?oe+u:u],e=!e||l.comparedTo(t)>0?a>0?t:c:l,u=b,b=1/0,l=new _(h),s.c[0]=0;f=n(l,t,0,1),1!=(o=r.plus(f.times(i))).comparedTo(e);)r=i,i=o,c=s.plus(f.times(o=c)),s=o,t=l.minus(f.times(o=t)),l=o;return o=n(e.minus(r),i,0,1),s=s.plus(o.times(c)),r=r.plus(o.times(i)),s.s=c.s=g.s,p=n(c,i,a*=2,y).minus(g).abs().comparedTo(n(s,r,a,y).minus(g).abs())<1?[c,i]:[s,r],b=u,p},p.toNumber=function(){return+k(this)},p.toPrecision=function(e,t){return null!=e&&de(e,1,se),A(this,e,t,2)},p.toString=function(e){var t,n=this,i=n.s,o=n.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=g||o>=v?ye(fe(n.c),o):ge(fe(n.c),o,"0"):10===e&&x?t=ge(fe((n=C(new _(n),h+o+1,y)).c),n.e,"0"):(de(e,2,O.length,"Base"),t=r(ge(fe(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},p.valueOf=p.toJSON=function(){return k(this)},p._isBigNumber=!0,p[Symbol.toStringTag]="BigNumber",p[Symbol.for("nodejs.util.inspect.custom")]=p.valueOf,null!=t&&_.set(t),_}(),me=ve,be=class{key;left=null;right=null;constructor(e){this.key=e}},Se=class extends be{constructor(e){super(e)}},we=class{size=0;modificationCount=0;splayCount=0;splay(e){const t=this.root;if(null==t)return this.compare(e,e),-1;let n=null,r=null,i=null,o=null,a=t;const u=this.compare;let l;for(;;)if(l=u(a.key,e),l>0){let t=a.left;if(null==t)break;if(l=u(t.key,e),l>0&&(a.left=t.right,t.right=a,a=t,t=a.left,null==t))break;null==n?r=a:n.left=a,n=a,a=t}else{if(!(l<0))break;{let t=a.right;if(null==t)break;if(l=u(t.key,e),l<0&&(a.right=t.left,t.left=a,a=t,t=a.right,null==t))break;null==i?o=a:i.right=a,i=a,a=t}}return null!=i&&(i.right=a.left,a.left=o),null!=n&&(n.left=a.right,a.right=r),this.root!==a&&(this.root=a,this.splayCount++),l}splayMin(e){let t=e,n=t.left;for(;null!=n;){const e=n;t.left=e.right,e.right=t,t=e,n=t.left}return t}splayMax(e){let t=e,n=t.right;for(;null!=n;){const e=n;t.right=e.left,e.left=t,t=e,n=t.right}return t}_delete(e){if(null==this.root)return null;if(0!=this.splay(e))return null;let t=this.root;const n=t,r=t.left;if(this.size--,null==r)this.root=t.right;else{const e=t.right;t=this.splayMax(r),t.right=e,this.root=t}return this.modificationCount++,n}addNewRoot(e,t){this.size++,this.modificationCount++;const n=this.root;null!=n?(t<0?(e.left=n,e.right=n.right,n.right=null):(e.right=n,e.left=n.left,n.left=null),this.root=e):this.root=e}_first(){const e=this.root;return null==e?null:(this.root=this.splayMin(e),this.root)}_last(){const e=this.root;return null==e?null:(this.root=this.splayMax(e),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(e){return this.validKey(e)&&0==this.splay(e)}defaultCompare(){return(e,t)=>e<t?-1:e>t?1:0}wrap(){return{getRoot:()=>this.root,setRoot:e=>{this.root=e},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:e=>{this.splayCount=e},splay:e=>this.splay(e),has:e=>this.has(e)}}},Ee=(Symbol.iterator,Symbol.toStringTag,class e extends we{root=null;compare;validKey;constructor(e,t){super(),this.compare=e??this.defaultCompare(),this.validKey=t??(e=>null!=e&&null!=e)}delete(e){return!!this.validKey(e)&&null!=this._delete(e)}deleteAll(e){for(const t of e)this.delete(t)}forEach(e){const t=this[Symbol.iterator]();let n;for(;n=t.next(),!n.done;)e(n.value,n.value,this)}add(e){const t=this.splay(e);return 0!=t&&this.addNewRoot(new Se(e),t),this}addAndReturn(e){const t=this.splay(e);return 0!=t&&this.addNewRoot(new Se(e),t),this.root.key}addAll(e){for(const t of e)this.add(t)}isEmpty(){return null==this.root}isNotEmpty(){return null!=this.root}single(){if(0==this.size)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(0==this.size)throw"Bad state: No element";return this._first().key}last(){if(0==this.size)throw"Bad state: No element";return this._last().key}lastBefore(e){if(null==e)throw"Invalid arguments(s)";if(null==this.root)return null;if(this.splay(e)<0)return this.root.key;let t=this.root.left;if(null==t)return null;let n=t.right;for(;null!=n;)t=n,n=t.right;return t.key}firstAfter(e){if(null==e)throw"Invalid arguments(s)";if(null==this.root)return null;if(this.splay(e)>0)return this.root.key;let t=this.root.right;if(null==t)return null;let n=t.left;for(;null!=n;)t=n,n=t.left;return t.key}retainAll(t){const n=new e(this.compare,this.validKey),r=this.modificationCount;for(const e of t){if(r!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(e)&&0==this.splay(e)&&n.add(this.root.key)}n.size!=this.size&&(this.root=n.root,this.size=n.size,this.modificationCount++)}lookup(e){return this.validKey(e)?0!=this.splay(e)?null:this.root.key:null}intersection(t){const n=new e(this.compare,this.validKey);for(const e of this)t.has(e)&&n.add(e);return n}difference(t){const n=new e(this.compare,this.validKey);for(const e of this)t.has(e)||n.add(e);return n}union(e){const t=this.clone();return t.addAll(e),t}clone(){const t=new e(this.compare,this.validKey);return t.size=this.size,t.root=this.copyNode(this.root),t}copyNode(e){if(null==e)return null;const t=new Se(e.key);return function e(t,n){let r,i;do{if(r=t.left,i=t.right,null!=r){const t=new Se(r.key);n.left=t,e(r,t)}if(null!=i){const e=new Se(i.key);n.right=e,t=i,n=e}}while(null!=i)}(e,t),t}toSet(){return this.clone()}entries(){return new xe(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Oe(this.wrap())}[Symbol.toStringTag]="[object Set]"}),Pe=class{tree;path=new Array;modificationCount=null;splayCount;constructor(e){this.tree=e,this.splayCount=e.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;const e=this.path[this.path.length-1];return this.getValue(e)}rebuildPath(e){this.path.splice(0,this.path.length),this.tree.splay(e),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(e){for(;null!=e;)this.path.push(e),e=e.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(null==this.modificationCount){this.modificationCount=this.tree.getModificationCount();let e=this.tree.getRoot();for(;null!=e;)this.path.push(e),e=e.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let e=this.path[this.path.length-1],t=e.right;if(null!=t){for(;null!=t;)this.path.push(t),t=t.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===e;)e=this.path.pop();return this.path.length>0}},Oe=class extends Pe{getValue(e){return e.key}},xe=class extends Pe{getValue(e){return[e.key,e.key]}},_e=e=>()=>e,Ae=e=>{const t=e?(t,n)=>n.minus(t).abs().isLessThanOrEqualTo(e):_e(!1);return(e,n)=>t(e,n)?0:e.comparedTo(n)};function Te(e){const t=e?(t,n,r,i,o)=>t.exponentiatedBy(2).isLessThanOrEqualTo(i.minus(n).exponentiatedBy(2).plus(o.minus(r).exponentiatedBy(2)).times(e)):_e(!1);return(e,n,r)=>{const i=e.x,o=e.y,a=r.x,u=r.y,l=o.minus(u).times(n.x.minus(a)).minus(i.minus(a).times(n.y.minus(u)));return t(l,i,o,a,u)?0:l.comparedTo(0)}}var je=e=>e,Ce=e=>{if(e){const t=new Ee(Ae(e)),n=new Ee(Ae(e)),r=(e,t)=>t.addAndReturn(e),i=e=>({x:r(e.x,t),y:r(e.y,n)});return i({x:new me(0),y:new me(0)}),i}return je},ke=e=>({set:e=>{Ie=ke(e)},reset:()=>ke(e),compare:Ae(e),snap:Ce(e),orient:Te(e)}),Ie=ke(),Me=(e,t)=>e.ll.x.isLessThanOrEqualTo(t.x)&&t.x.isLessThanOrEqualTo(e.ur.x)&&e.ll.y.isLessThanOrEqualTo(t.y)&&t.y.isLessThanOrEqualTo(e.ur.y),Le=(e,t)=>{if(t.ur.x.isLessThan(e.ll.x)||e.ur.x.isLessThan(t.ll.x)||t.ur.y.isLessThan(e.ll.y)||e.ur.y.isLessThan(t.ll.y))return null;const n=e.ll.x.isLessThan(t.ll.x)?t.ll.x:e.ll.x,r=e.ur.x.isLessThan(t.ur.x)?e.ur.x:t.ur.x;return{ll:{x:n,y:e.ll.y.isLessThan(t.ll.y)?t.ll.y:e.ll.y},ur:{x:r,y:e.ur.y.isLessThan(t.ur.y)?e.ur.y:t.ur.y}}},Re=(e,t)=>e.x.times(t.y).minus(e.y.times(t.x)),Ne=(e,t)=>e.x.times(t.x).plus(e.y.times(t.y)),De=e=>Ne(e,e).sqrt(),Ge=(e,t,n)=>{const r={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:n.x.minus(e.x),y:n.y.minus(e.y)};return Re(i,r).div(De(i)).div(De(r))},Fe=(e,t,n)=>{const r={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:n.x.minus(e.x),y:n.y.minus(e.y)};return Ne(i,r).div(De(i)).div(De(r))},Ve=(e,t,n)=>t.y.isZero()?null:{x:e.x.plus(t.x.div(t.y).times(n.minus(e.y))),y:n},Be=(e,t,n)=>t.x.isZero()?null:{x:n,y:e.y.plus(t.y.div(t.x).times(n.minus(e.x)))},Ue=class e{point;isLeft;segment;otherSE;consumedBy;static compare(t,n){const r=e.comparePoints(t.point,n.point);return 0!==r?r:(t.point!==n.point&&t.link(n),t.isLeft!==n.isLeft?t.isLeft?1:-1:Ke.compare(t.segment,n.segment))}static comparePoints(e,t){return e.x.isLessThan(t.x)?-1:e.x.isGreaterThan(t.x)?1:e.y.isLessThan(t.y)?-1:e.y.isGreaterThan(t.y)?1:0}constructor(e,t){void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const t=e.point.events;for(let e=0,n=t.length;e<n;e++){const n=t[e];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){const e=this.point.events.length;for(let t=0;t<e;t++){const n=this.point.events[t];if(void 0===n.segment.consumedBy)for(let r=t+1;r<e;r++){const e=this.point.events[r];void 0===e.consumedBy&&n.otherSE.point.events===e.otherSE.point.events&&n.segment.consume(e.segment)}}}getAvailableLinkedEvents(){const e=[];for(let t=0,n=this.point.events.length;t<n;t++){const n=this.point.events[t];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&e.push(n)}return e}getLeftmostComparator(e){const t=new Map,n=n=>{const r=n.otherSE;t.set(n,{sine:Ge(this.point,e.point,r.point),cosine:Fe(this.point,e.point,r.point)})};return(e,r)=>{t.has(e)||n(e),t.has(r)||n(r);const{sine:i,cosine:o}=t.get(e),{sine:a,cosine:u}=t.get(r);return i.isGreaterThanOrEqualTo(0)&&a.isGreaterThanOrEqualTo(0)?o.isLessThan(u)?1:o.isGreaterThan(u)?-1:0:i.isLessThan(0)&&a.isLessThan(0)?o.isLessThan(u)?-1:o.isGreaterThan(u)?1:0:a.isLessThan(i)?-1:a.isGreaterThan(i)?1:0}}},He=class e{events;poly;_isExteriorRing;_enclosingRing;static factory(t){const n=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];if(!i.isInResult()||i.ringOut)continue;let o=null,a=i.leftSE,u=i.rightSE;const l=[a],s=a.point,c=[];for(;o=a,a=u,l.push(a),a.point!==s;)for(;;){const t=a.getAvailableLinkedEvents();if(0===t.length){const e=l[0].point,t=l[l.length-1].point;throw new Error(`Unable to complete output ring starting at [${e.x}, ${e.y}]. Last matching segment found ends at [${t.x}, ${t.y}].`)}if(1===t.length){u=t[0].otherSE;break}let r=null;for(let e=0,t=c.length;e<t;e++)if(c[e].point===a.point){r=e;break}if(null!==r){const t=c.splice(r)[0],i=l.splice(t.index);i.unshift(i[0].otherSE),n.push(new e(i.reverse()));continue}c.push({index:l.length,point:a.point});const i=a.getLeftmostComparator(o);u=t.sort(i)[0].otherSE;break}n.push(new e(l))}return n}constructor(e){this.events=e;for(let t=0,n=e.length;t<n;t++)e[t].segment.ringOut=this;this.poly=null}getGeom(){let e=this.events[0].point;const t=[e];for(let n=1,r=this.events.length-1;n<r;n++){const r=this.events[n].point,i=this.events[n+1].point;0!==Ie.orient(r,e,i)&&(t.push(r),e=r)}if(1===t.length)return null;const n=t[0],r=t[1];0===Ie.orient(n,e,r)&&t.shift(),t.push(t[0]);const i=this.isExteriorRing()?1:-1,o=this.isExteriorRing()?0:t.length-1,a=this.isExteriorRing()?t.length:-1,u=[];for(let e=o;e!=a;e+=i)u.push([t[e].x.toNumber(),t[e].y.toNumber()]);return u}isExteriorRing(){if(void 0===this._isExteriorRing){const e=this.enclosingRing();this._isExteriorRing=!e||!e.isExteriorRing()}return this._isExteriorRing}enclosingRing(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let e=this.events[0];for(let t=1,n=this.events.length;t<n;t++){const n=this.events[t];Ue.compare(e,n)>0&&(e=n)}let t=e.segment.prevInResult(),n=t?t.prevInResult():null;for(;;){if(!t)return null;if(!n)return t.ringOut;if(n.ringOut!==t.ringOut)return n.ringOut?.enclosingRing()!==t.ringOut?t.ringOut:t.ringOut?.enclosingRing();t=n.prevInResult(),n=t?t.prevInResult():null}}},qe=class{exteriorRing;interiorRings;constructor(e){this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){const e=this.exteriorRing.getGeom();if(null===e)return null;const t=[e];for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}},ze=class{rings;polys;constructor(e){this.rings=e,this.polys=this._composePolys(e)}getGeom(){const e=[];for(let t=0,n=this.polys.length;t<n;t++){const n=this.polys[t].getGeom();null!==n&&e.push(n)}return e}_composePolys(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];if(!r.poly)if(r.isExteriorRing())t.push(new qe(r));else{const e=r.enclosingRing();e?.poly||t.push(new qe(e)),e?.poly?.addInterior(r)}}return t}},We=class{queue;tree;segments;constructor(e,t=Ke.compare){this.queue=e,this.tree=new Ee(t),this.segments=[]}process(e){const t=e.segment,n=[];if(e.consumedBy)return e.isLeft?this.queue.delete(e.otherSE):this.tree.delete(t),n;e.isLeft&&this.tree.add(t);let r=t,i=t;do{r=this.tree.lastBefore(r)}while(null!=r&&null!=r.consumedBy);do{i=this.tree.firstAfter(i)}while(null!=i&&null!=i.consumedBy);if(e.isLeft){let o=null;if(r){const e=r.getIntersection(t);if(null!==e&&(t.isAnEndpoint(e)||(o=e),!r.isAnEndpoint(e))){const t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}let a=null;if(i){const e=i.getIntersection(t);if(null!==e&&(t.isAnEndpoint(e)||(a=e),!i.isAnEndpoint(e))){const t=this._splitSafely(i,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}if(null!==o||null!==a){let e=null;e=null===o?a:null===a||Ue.comparePoints(o,a)<=0?o:a,this.queue.delete(t.rightSE),n.push(t.rightSE);const r=t.split(e);for(let e=0,t=r.length;e<t;e++)n.push(r[e])}n.length>0?(this.tree.delete(t),n.push(e)):(this.segments.push(t),t.prev=r)}else{if(r&&i){const e=r.getIntersection(i);if(null!==e){if(!r.isAnEndpoint(e)){const t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}if(!i.isAnEndpoint(e)){const t=this._splitSafely(i,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}}this.tree.delete(t)}return n}_splitSafely(e,t){this.tree.delete(e);const n=e.rightSE;this.queue.delete(n);const r=e.split(t);return r.push(n),void 0===e.consumedBy&&this.tree.add(e),r}},Ye=new class{type;numMultiPolys;run(e,t,n){Ye.type=e;const r=[new Qe(t,!0)];for(let e=0,t=n.length;e<t;e++)r.push(new Qe(n[e],!1));if(Ye.numMultiPolys=r.length,"difference"===Ye.type){const e=r[0];let t=1;for(;t<r.length;)null!==Le(r[t].bbox,e.bbox)?t++:r.splice(t,1)}if("intersection"===Ye.type)for(let e=0,t=r.length;e<t;e++){const t=r[e];for(let n=e+1,i=r.length;n<i;n++)if(null===Le(t.bbox,r[n].bbox))return[]}const i=new Ee(Ue.compare);for(let e=0,t=r.length;e<t;e++){const t=r[e].getSweepEvents();for(let e=0,n=t.length;e<n;e++)i.add(t[e])}const o=new We(i);let a=null;for(0!=i.size&&(a=i.first(),i.delete(a));a;){const e=o.process(a);for(let t=0,n=e.length;t<n;t++){const n=e[t];void 0===n.consumedBy&&i.add(n)}0!=i.size?(a=i.first(),i.delete(a)):a=null}Ie.reset();const u=He.factory(o.segments);return new ze(u).getGeom()}},$e=Ye,Xe=0,Ke=class e{id;leftSE;rightSE;rings;windings;ringOut;consumedBy;prev;_prevInResult;_beforeState;_afterState;_isInResult;static compare(e,t){const n=e.leftSE.point.x,r=t.leftSE.point.x,i=e.rightSE.point.x,o=t.rightSE.point.x;if(o.isLessThan(n))return 1;if(i.isLessThan(r))return-1;const a=e.leftSE.point.y,u=t.leftSE.point.y,l=e.rightSE.point.y,s=t.rightSE.point.y;if(n.isLessThan(r)){if(u.isLessThan(a)&&u.isLessThan(l))return 1;if(u.isGreaterThan(a)&&u.isGreaterThan(l))return-1;const n=e.comparePoint(t.leftSE.point);if(n<0)return 1;if(n>0)return-1;const r=t.comparePoint(e.rightSE.point);return 0!==r?r:-1}if(n.isGreaterThan(r)){if(a.isLessThan(u)&&a.isLessThan(s))return-1;if(a.isGreaterThan(u)&&a.isGreaterThan(s))return 1;const n=t.comparePoint(e.leftSE.point);if(0!==n)return n;const r=e.comparePoint(t.rightSE.point);return r<0?1:r>0?-1:1}if(a.isLessThan(u))return-1;if(a.isGreaterThan(u))return 1;if(i.isLessThan(o)){const n=t.comparePoint(e.rightSE.point);if(0!==n)return n}if(i.isGreaterThan(o)){const n=e.comparePoint(t.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(!i.eq(o)){const e=l.minus(a),t=i.minus(n),c=s.minus(u),f=o.minus(r);if(e.isGreaterThan(t)&&c.isLessThan(f))return 1;if(e.isLessThan(t)&&c.isGreaterThan(f))return-1}return i.isGreaterThan(o)?1:i.isLessThan(o)||l.isLessThan(s)?-1:l.isGreaterThan(s)?1:e.id<t.id?-1:e.id>t.id?1:0}constructor(e,t,n,r){this.id=++Xe,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=n,this.windings=r}static fromRing(t,n,r){let i,o,a;const u=Ue.comparePoints(t,n);if(u<0)i=t,o=n,a=1;else{if(!(u>0))throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);i=n,o=t,a=-1}const l=new Ue(i,!0),s=new Ue(o,!1);return new e(l,s,[r],[a])}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,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e.isLessThan(t)?e:t},ur:{x:this.rightSE.point.x,y:e.isGreaterThan(t)?e:t}}}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 Ie.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){const t=this.bbox(),n=e.bbox(),r=Le(t,n);if(null===r)return null;const i=this.leftSE.point,o=this.rightSE.point,a=e.leftSE.point,u=e.rightSE.point,l=Me(t,a)&&0===this.comparePoint(a),s=Me(n,i)&&0===e.comparePoint(i),c=Me(t,u)&&0===this.comparePoint(u),f=Me(n,o)&&0===e.comparePoint(o);if(s&&l)return f&&!c?o:!f&&c?u:null;if(s)return c&&i.x.eq(u.x)&&i.y.eq(u.y)?null:i;if(l)return f&&o.x.eq(a.x)&&o.y.eq(a.y)?null:a;if(f&&c)return null;if(f)return o;if(c)return u;const p=((e,t,n,r)=>{if(t.x.isZero())return Be(n,r,e.x);if(r.x.isZero())return Be(e,t,n.x);if(t.y.isZero())return Ve(n,r,e.y);if(r.y.isZero())return Ve(e,t,n.y);const i=Re(t,r);if(i.isZero())return null;const o={x:n.x.minus(e.x),y:n.y.minus(e.y)},a=Re(o,t).div(i),u=Re(o,r).div(i),l=e.x.plus(u.times(t.x)),s=n.x.plus(a.times(r.x)),c=e.y.plus(u.times(t.y)),f=n.y.plus(a.times(r.y));return{x:l.plus(s).div(2),y:c.plus(f).div(2)}})(i,this.vector(),a,e.vector());return null===p?null:Me(r,p)?Ie.snap(p):null}split(t){const n=[],r=void 0!==t.events,i=new Ue(t,!0),o=new Ue(t,!1),a=this.rightSE;this.replaceRightSE(o),n.push(o),n.push(i);const u=new e(i,a,this.rings.slice(),this.windings.slice());return Ue.comparePoints(u.leftSE.point,u.rightSE.point)>0&&u.swapEvents(),Ue.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}swapEvents(){const e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,t=this.windings.length;e<t;e++)this.windings[e]*=-1}consume(t){let n=this,r=t;for(;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;const i=e.compare(n,r);if(0!==i){if(i>0){const e=n;n=r,r=e}if(n.prev===r){const e=n;n=r,r=e}for(let e=0,t=r.rings.length;e<t;e++){const t=r.rings[e],i=r.windings[e],o=n.rings.indexOf(t);-1===o?(n.rings.push(t),n.windings.push(i)):n.windings[o]+=i}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}prevInResult(){return 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(void 0!==this._beforeState)return this._beforeState;if(this.prev){const e=this.prev.consumedBy||this.prev;this._beforeState=e.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}afterState(){if(void 0!==this._afterState)return this._afterState;const e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};const t=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let e=0,r=this.rings.length;e<r;e++){const r=this.rings[e],i=this.windings[e],o=t.indexOf(r);-1===o?(t.push(r),n.push(i)):n[o]+=i}const i=[],o=[];for(let e=0,r=t.length;e<r;e++){if(0===n[e])continue;const r=t[e],a=r.poly;if(-1===o.indexOf(a))if(r.isExterior)i.push(a);else{-1===o.indexOf(a)&&o.push(a);const e=i.indexOf(r.poly);-1!==e&&i.splice(e,1)}}for(let e=0,t=i.length;e<t;e++){const t=i[e].multiPoly;-1===r.indexOf(t)&&r.push(t)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;const e=this.beforeState().multiPolys,t=this.afterState().multiPolys;switch($e.type){case"union":{const n=0===e.length,r=0===t.length;this._isInResult=n!==r;break}case"intersection":{let n,r;e.length<t.length?(n=e.length,r=t.length):(n=t.length,r=e.length),this._isInResult=r===$e.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(e.length-t.length);this._isInResult=n%2==1;break}case"difference":{const n=e=>1===e.length&&e[0].isSubject;this._isInResult=n(e)!==n(t);break}}return this._isInResult}},Ze=class{poly;isExterior;segments;bbox;constructor(e,t,n){if(!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=t,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const r=Ie.snap({x:new me(e[0][0]),y:new me(e[0][1])});this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let t=1,n=e.length;t<n;t++){if("number"!=typeof e[t][0]||"number"!=typeof e[t][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const n=Ie.snap({x:new me(e[t][0]),y:new me(e[t][1])});n.x.eq(i.x)&&n.y.eq(i.y)||(this.segments.push(Ke.fromRing(i,n,this)),n.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.x),n.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.y),n.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.x),n.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.y),i=n)}r.x.eq(i.x)&&r.y.eq(i.y)||this.segments.push(Ke.fromRing(i,r,this))}getSweepEvents(){const e=[];for(let t=0,n=this.segments.length;t<n;t++){const n=this.segments[t];e.push(n.leftSE),e.push(n.rightSE)}return e}},Je=class{multiPoly;exteriorRing;interiorRings;bbox;constructor(e,t){if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Ze(e[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 t=1,n=e.length;t<n;t++){const n=new Ze(e[t],this,!1);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=t}getSweepEvents(){const e=this.exteriorRing.getSweepEvents();for(let t=0,n=this.interiorRings.length;t<n;t++){const n=this.interiorRings[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}},Qe=class{isSubject;polys;bbox;constructor(e,t){if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}catch(e){}this.polys=[],this.bbox={ll:{x:new me(Number.POSITIVE_INFINITY),y:new me(Number.POSITIVE_INFINITY)},ur:{x:new me(Number.NEGATIVE_INFINITY),y:new me(Number.NEGATIVE_INFINITY)}};for(let t=0,n=e.length;t<n;t++){const n=new Je(e[t],this);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=t}getSweepEvents(){const e=[];for(let t=0,n=this.polys.length;t<n;t++){const n=this.polys[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}};Ie.set;function et(e,t,n={}){const r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}Math.PI;var tt=function(e,t={}){const n=[];if(function(e,t){var n,r,i,o,a,u,l,s,c,f,p=0,d="FeatureCollection"===e.type,h="Feature"===e.type,y=d?e.features.length:1;for(n=0;n<y;n++){for(u=d?e.features[n].geometry:h?e.geometry:e,s=d?e.features[n].properties:h?e.properties:{},c=d?e.features[n].bbox:h?e.bbox:void 0,f=d?e.features[n].id:h?e.id:void 0,a=(l=!!u&&"GeometryCollection"===u.type)?u.geometries.length:1,i=0;i<a;i++)if(null!==(o=l?u.geometries[i]:u))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,p,s,c,f))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===t(o.geometries[r],p,s,c,f))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,p,s,c,f))return!1;p++}}(e,e=>{n.push(e.coordinates)}),n.length<2)throw new Error("Must have at least 2 geometries");const r=((e,...t)=>$e.run("union",e,t))(n[0],...n.slice(1));return 0===r.length?null:1===r.length?function(e,t,n={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return et({type:"Polygon",coordinates:e},t,n)}(r[0],t.properties):function(e,t,n={}){return et({type:"MultiPolygon",coordinates:e},t,n)}(r,t.properties)},nt=n(278);function rt(e){return rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rt(e)}function it(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return u}}(e,t)||lt(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function at(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ot(Object(n),!0).forEach(function(t){ut(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ot(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ut(e,t,n){return(t=function(e){var t=function(e){if("object"!=rt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=rt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==rt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lt(e,t){if(e){if("string"==typeof e)return st(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?st(e,t):void 0}}function st(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ct=function(e,t){var n,r,i,o,a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01,n=e.geometry.coordinates.map(function(e){return function(e){if(Array.isArray(e))return st(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||lt(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();var t}),r=n.length-1,i=function(e,n){return[e[0]+(e[0]-n[0])*t,e[1]+(e[1]-n[1])*t]},o=i(n[0],n[1]),a=i(n[r],n[r-1]);return n[0]=o,n[r]=a,(0,nt.wi)(n)}(t);try{o=function(e,t){var n=[],r=[],i=[],o=function(e,t,n,r,i){for(var o=0,a=[],u="Feature"===t.type?t.geometry:t,l="LineString"===u.type?[u.coordinates]:u.coordinates,s=0,c=0;c<l.length;c++){for(var f=l[c].length-1,p=new D(l[c][0]),d=null,h={nextEdge:null},y=0;y<f;y++){d=new D(l[c][y+1]),p.nextPoint=d,d.prevPoint=p;var g=new N(p,d,"polyline",s,null);r.push(g),h.nextEdge=g,g.prevEdge=h,i[0]=Math.min(i[0],p.p[0]),i[1]=Math.min(i[1],p.p[1]),i[2]=Math.max(i[2],p.p[0]),i[3]=Math.max(i[3],p.p[1]),p=d,s+=1,h=g}i[0]=Math.min(i[0],l[c][f][0]),i[1]=Math.min(i[1],l[c][f][1]),i[2]=Math.max(i[2],l[c][f][0]),i[3]=Math.max(i[3],l[c][f][1])}for(var v="Feature"===e.type?e.geometry:e,m="Polygon"===v.type?[v.coordinates]:v.coordinates,b=m.length,S=0;S<b;S++)for(var w=m[S].length,E=0;E<w;E++){o+=1;var P=m[S][E],O=P.length;a.push(new G(o,P));for(var x=new D(P[0]),_=x,A=void 0,T=null,j={nextEdge:null,prevEdge:null},C=null,k=1;k<O;k++)A=new D(P[k]),_.nextPoint=A,A.prevPoint=_,T=new N(_,A,"polygon",s,o),j.nextEdge=T,T.prevEdge=j,1===k&&(C=T),E>0&&(T.interiorRing=!0),T.intersectPolylineBbox=F(T,i),n.push(T),_=A,s+=1,j=T;T.nextEdge=C,C.prevEdge=T,A.nextPoint=x.nextPoint,x.prevPoint=A.prevPoint}return a}(h(e),t,r,i,[1/0,1/0,1/0,1/0]);if(function(e,t,n){var r,i,o,a=t.length,u=e.length;for(r=0;r<a;r++){var l=t[r];for(i=0;i<u;i++){var s=e[i];if(s.intersectPolylineBbox&&!(s.maxX<l.minX||s.minX>l.maxX||s.maxY<l.minY||s.minY>l.maxY)){var c=z(l,s);if(null!==c)for(o=0;o<c.length;o++){var f=R(s.p1.p[0],s.p1.p[1],s.p2.p[0],s.p2.p[1],l.p1.p[0],l.p1.p[1]),p=new V(c[o],l,s,f>0);n.push(p)}}}}t.forEach(function(e){e.intersectionPoints.sort(function(e,t){return e.distanceFromPolylineEdgeStart-t.distanceFromPolylineEdgeStart})}),e.forEach(function(e){e.intersectionPoints.sort(function(e,t){return e.distanceFromPolygonEdgeStart-t.distanceFromPolygonEdgeStart})})}(r,i,n),0===n.length)return e;var a={};o.forEach(function(e){return a[e.id]=0}),n.forEach(function(e){var t=e.polygonEdge.polygonContourId;a[t]=a[t]+1});for(var u=0,l=[],s=null,c=0;c<i.length;c++){var f=i[c];if(f.intersectionPoints.length>0){s=f.intersectionPoints[0];break}}for(var p=s,d={visitCount:1};s!==d&&!(u>2*n.length);){if(u=u++,d.visitCount>=2){for(var y=!1,g=0;g<n.length;g++){var v=n[g];if(v.visitCount<2){p=v,y=!0;break}}if(!y)break}p.visitCount=p.visitCount+1;var m=[];l.push(m),m.push(p.p),p.visitCount=p.visitCount+1;var b=X(p,m),S=!1;if(b===(d=b)&&2===n.length)for(var w=0;w<n.length;w++)n[w].visitCount<2&&(S=!0);for(;b!==p||S;)(b=(b.isHeadingIn?J:Z)(b,m))!==p&&(b=X(b,m)),S=!1;if(d.visitCount>=2){for(var E=!1,P=0;P<n.length;P++){var O=n[P];if(O.visitCount<2){p=O,E=!0;break}}E&&(d=p)}p=d}for(var x=l.map(function(e){return[e]}),_=Object.keys(a),A=0;A<_.length;A++){var T=_[A];0===a[T]&&$(Y(W(r,parseInt(T)),o),x)}return{type:"Feature",properties:{},geometry:{type:"MultiPolygon",coordinates:x}}}(e,a)}catch(e){return null}var u=[];if("MultiPolygon"!==o.geometry.type)return null;if(2!==o.geometry.coordinates.length)return null;u=o.geometry.coordinates.map(function(t){return(0,nt.n1)(t,e.properties)});var l=null!==(n=null!==(r=e.id)&&void 0!==r?r:null===(i=e.properties)||void 0===i?void 0:i.id)&&void 0!==n?n:"poly",s=u.map(function(t,n){return(0,nt.n1)(t.geometry.coordinates,at(at({},e.properties),{},{id:l}),{id:"".concat(l,"-").concat(n+1)})});return(0,nt.Lr)(s)},ft=function(e){var t,n,r,i,o;try{o=tt((0,nt.Lr)(e))}catch(e){return null}if("Polygon"!==(null===(t=o)||void 0===t||null===(t=t.geometry)||void 0===t?void 0:t.type))return null;var a=null!==(n=null!==(r=e[0].id)&&void 0!==r?r:null===(i=e[0].properties)||void 0===i?void 0:i.id)&&void 0!==n?n:"poly";return(0,nt.n1)(o.geometry.coordinates,at(at({},e[0].properties),{},{id:a}),{id:a})},pt=function(e,t){var n=it(e,2),r=n[0],i=n[1],o=it(t,2),a=o[0],u=o[1],l=function(e){return e*Math.PI/180},s=l(u-i),c=l(a-r),f=Math.pow(Math.sin(s/2),2)+Math.cos(l(i))*Math.cos(l(u))*Math.pow(Math.sin(c/2),2);return 12742e3*Math.atan2(Math.sqrt(f),Math.sqrt(1-f))},dt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01;if(e.length<=1)return!0;var n=e[e.length-1],r=e[e.length-2];return pt(n,r)>=t},ht=function(e){return e[0].length<=1||function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01,n=e[0];return n.length<=1||!(n.length<=3&&function(e,t){for(var n=0;n<e.length;n++)for(var r=n+1;r<e.length;r++)if(pt(e[n],e[r])<t)return!0;return!1}(n,t))}(e)}},59:function(e,t,n){n.d(t,{I:function(){return r}});var r=new Set(["symbol","symbolSvgContent","symbolViewBox","symbolAnchor","symbolSize","symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"])},9:function(e,t,n){n.d(t,{k7:function(){return P},n8:function(){return c},PH:function(){return E},Uv:function(){return x},J$:function(){return O}});var r=n(278),i=n(850);function o(e){let t=0;if(e&&e.length>0){t+=Math.abs(l(e[0]));for(let n=1;n<e.length;n++)t-=Math.abs(l(e[n]))}return t}var a=r.zX*r.zX/2,u=Math.PI/180;function l(e){const t=e.length-1;if(t<=2)return 0;let n=0,r=0;for(;r<t;){const i=e[r],o=e[r+1===t?0:r+1],a=e[r+2>=t?(r+2)%t:r+2],l=i[0]*u,s=o[1]*u;n+=(a[0]*u-l)*Math.sin(s),r++}return n*a}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var c={Polygon:3,LineString:2},f=function(e){var t;return null!==(t=null==e?void 0:e.geometry)&&void 0!==t?t:e},p=function(e){var t=f(e);return"Polygon"===(null==t?void 0:t.type)?t:null},d=function(e){for(var t,n,r=null!==(t=null===(n=e.coordinates)||void 0===n?void 0:n[0])&&void 0!==t?t:[],i=r.filter(function(e,t){return 0===t||e[0]!==r[t-1][0]||e[1]!==r[t-1][1]});i.length>1&&i[0][0]===i[i.length-1][0]&&i[0][1]===i[i.length-1][1];)i.pop();return i},h=function(e){return[].concat(function(e){if(Array.isArray(e))return s(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[e[0]]);var t},y=function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])},g=function(e,t){return e>0&&t<0||e<0&&t>0},v=function(e,t,n,r){return 0===e&&function(e,t,n){return Math.min(e[0],n[0])<=t[0]&&t[0]<=Math.max(e[0],n[0])&&Math.min(e[1],n[1])<=t[1]&&t[1]<=Math.max(e[1],n[1])}(t,n,r)},m=function(e,t,n,r){var i=y(n,r,e),o=y(n,r,t),a=y(e,t,n),u=y(e,t,r);return!(!g(i,o)||!g(a,u))||v(i,n,e,r)||v(o,n,t,r)||v(a,e,n,t)||v(u,e,r,t)},b=function(e,t){for(var n=e.length,r=t?n:n-1,i=0;i<r;i++)for(var o=i+1;o<r;o++)if(!(o===i+1||t&&0===i&&o===r-1)&&m(e[i],e[(i+1)%n],e[o],e[(o+1)%n]))return!0;return!1},S=function(e){var t=p(e);if(!t)return{valid:!0};var n=d(t);return n.length<4?{valid:!0}:b(n,!0)?{valid:!1,reason:"Shape must not intersect itself"}:{valid:!0}},w=function(e){var t=p(e);if(!t)return{valid:!0};var n=d(t);if(n.length<c.Polygon)return{valid:!0};var r,a=0;try{r={type:"Feature",geometry:{type:"Polygon",coordinates:[h(n)]},properties:{}},a=(0,i.jE)(r,(e,t)=>e+function(e){let t,n=0;switch(e.type){case"Polygon":return o(e.coordinates);case"MultiPolygon":for(t=0;t<e.coordinates.length;t++)n+=o(e.coordinates[t]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(t),0)}catch(e){return{valid:!0}}return a>0?{valid:!0}:{valid:!1,reason:"Shape must enclose an area"}},E={Polygon:"Shape needs at least 3 points",LineString:"Line needs at least 2 points"},P=[S,w,function(e){var t,n,r=f(e);return"Polygon"===(null==r?void 0:r.type)?d(r).length>=c.Polygon?{valid:!0}:{valid:!1,reason:E.Polygon}:"LineString"===(null==r?void 0:r.type)?(null!==(t=null===(n=r.coordinates)||void 0===n?void 0:n.length)&&void 0!==t?t:0)>=c.LineString?{valid:!0}:{valid:!1,reason:E.LineString}:{valid:!0}}],O=[S,w],x=[function(e){return function(e){var t=p(e);if(!t)return!1;var n=d(t);return!(n.length<4)&&b(n,!1)}(e)?{valid:!1,reason:"Shape must not intersect itself"}:{valid:!0}}]},520:function(e,t,n){n.d(t,{$U:function(){return p},$b:function(){return g},Av:function(){return c},RQ:function(){return y},Uk:function(){return v},dV:function(){return h},g5:function(){return f},oK:function(){return d}});var r=n(9);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s(e,t,n){return(t=function(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=function(e){if(void 0===e||!0===e)return{valid:!0};if(!1===e)return{valid:!1,reason:null};var t=e.valid,n=e.reason,r=e.announcement,i=e.recheckOnFinish,o=e.reopen,a=e.properties,u=!1!==t;return l(l(l(l({valid:u,reason:n},r&&{announcement:r}),i&&{recheckOnFinish:!0}),u&&o&&{reopen:!0}),u&&null!=a&&{properties:a})},f=function(e,t){return e.valid?e:l(l({},e),{},{source:t})},p=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=i.rules,u=void 0===a?r.k7:a,s=i.onGeometryPreview,p=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=o(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw i}}}}(u);try{for(p.s();!(t=p.n()).done;){var d=t.value,h=c(d(e,n));if(!h.valid)return f(h,"rules")}}catch(e){p.e(e)}finally{p.f()}return"function"==typeof s?f(c(s(l({feature:e},n))),"callback"):{valid:!0}},d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.rules,o=void 0===i?r.Uv:i,a=n.onGeometryPreview;return p(e,l(l({},t),{},{phase:"place"}),{rules:o,onGeometryPreview:a})},h={Polygon:"draw_polygon",LineString:"draw_line"},y=function(e,t,n){var r=t.reason,i=t.source,o=t.announcement,a=n.mode,u=n.vertexIndex;return l(l({feature:e,reason:null!=r?r:null,source:i},o&&{announcement:o}),{},{phase:"place",mode:a,vertexIndex:u})},g=function(e){var t,n=e.placed,r=e.point,i=e.geometryType,u=e.onGeometryPreview,l=[].concat(function(e){if(Array.isArray(e))return a(e)}(t=n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[r]),s={type:"Feature",geometry:"Polygon"===i?{type:"Polygon",coordinates:[l]}:{type:"LineString",coordinates:l},properties:{}},c=h[i],f=n.length,p=d(s,{mode:c,vertexIndex:f},{onGeometryPreview:u});return p.valid?{valid:!0}:{valid:!1,blocked:y(s,p,{mode:c,vertexIndex:f})}},v=function(e){var t,n,i,o,a,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=s.rules,f=void 0===c?r.J$:c,d=s.onGeometryPreview,h=null!==(t=null==e||null===(n=e.geometry)||void 0===n?void 0:n.type)&&void 0!==t?t:null==e?void 0:e.type,y=null!==(i=r.n8[h])&&void 0!==i?i:0,g=(null!==(o=u.numVertices)&&void 0!==o?o:0)<y?[]:f;return p(e,l(l({},u),{},{phase:null!==(a=u.phase)&&void 0!==a?a:"preview"}),{rules:g,onGeometryPreview:d})}},619:function(e,t,n){n.d(t,{v:function(){return i}});var r="[interactive-map]",i={warn:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=console).warn.apply(e,[r].concat(n))},error:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=console).error.apply(e,[r].concat(n))}}}}]);
|