Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@evergis/react

Package Overview
Dependencies
Maintainers
6
Versions
357
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evergis/react - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

dist/components/Symbol/index.d.ts

1

dist/components/index.d.ts

@@ -5,2 +5,3 @@ export * from './Measurer/Measurer';

export * from './Measurer/MeasureTool';
export * from './Symbol';
export { EvergisDynamicLayer } from './Layers/EvergisDynamicLayer';

@@ -7,0 +8,0 @@ export { EvergisTileLayer, AVAILABLE_BASE_MAPS, } from './Layers/EvergisTileLayer';

export { formatArea } from './measurer/formatArea';
export { formatLength } from './measurer/formatLength';
export { getScale } from './scaling';
export * from './symbol';

2

dist/react.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),n=e(t),o=require("@evergis/api"),r=require("@evergis/sgis/es/Map"),s=require("@evergis/sgis/es/painters/DomPainter/DomPainter"),i=require("@evergis/sgis/es/layers/FeatureLayer"),a=require("@evergis/sgis/es/features/Polyline"),u=require("@evergis/sgis/es/features/Polygon"),l=e(require("react-dom")),c=require("@evergis/sgis/es/symbols/Symbol"),p=require("@evergis/sgis/es/renders/Arc"),f=require("@evergis/sgis/es/symbols/point/Point"),d=require("@evergis/sgis/es/features/PointFeature"),m=require("@evergis/sgis/es/symbols/PolylineSymbol"),h=require("@evergis/sgis/es/features/Poly"),y=require("@evergis/sgis/es/renders/Poly"),v=require("@evergis/sgis/es/controls/PolylineControl"),b=require("@evergis/sgis/es/features/Label"),g=require("@evergis/sgis/es/geotools"),x=require("@evergis/sgis/es/Crs"),L=require("@evergis/sgis/es/controls/Control"),C=require("@evergis/sgis/es/utils/math"),w=require("@evergis/sgis/es/controls/PolyEditor"),k=require("styled-components"),M=e(k),P=require("@evergis/icons"),S=require("@evergis/sgis/es/commonEvents"),E=require("@evergis/sgis/es/Bbox"),R=require("@evergis/sgis/es/utils/domEvent"),F=require("@evergis/sgis/es/layers/TileLayer");const _=new o.Api({url:"/"}),z=t.createContext(_),O=()=>t.useContext(z),T=new r.Map,A=new s.DomPainter(T),D=t.createContext({map:T,painter:A}),q=()=>t.useContext(D),I=new i.FeatureLayer,j=new i.FeatureLayer,B=t.createContext({layer:I,popupLayer:j}),W=()=>t.useContext(B);function U(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function N(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function V(e,t,n){return t&&N(e.prototype,t),n&&N(e,n),e}function Z(){return(Z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function X(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Y(e){return(Y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function G(e,t){if(null==e)return{};var n,o,r={},s=Object.keys(e);for(o=0;o<s.length;o++)t.indexOf(n=s[o])>=0||(r[n]=e[n]);return r}function H(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function J(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=Y(e);if(t){var r=Y(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return H(this,n)}}function K(e,t,n){return(K="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Y(e)););return e}(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function Q(e,t){return t||(t=e.slice(0)),e.raw=t,e}let $=function(e){X(o,c.DynamicPointSymbol);var t=J(o);function o(e){var n;let{component:r,offset:s}=void 0===e?{}:e;return U(this,o),(n=t.call(this,{offset:s})).component=r,n}return V(o,[{key:"_getFeatureNode",value:function(e){const t=document.createElement("div");return this.renderDom(e.content,t),t}},{key:"_updateFeatureNode",value:function(e){this.renderDom(e.content,this.getNode(e))}},{key:"renderDom",value:function(e,t){if(!t)return;const o=this.component;o?l.render(n.createElement(o,{content:e}),t):t.innerText=e}}]),o}();const ee=[8,-16],te=e=>{const{offset:t=ee,renderLabel:o=(e=>{let{content:t}=e;return n.createElement("div",null,t)}),onClose:r}=e||{};return new $({offset:t,component:e=>{let{content:t}=e;return o({content:t,onClose:r})}})};function ne(e,t){let{strokeWidth:n=2,shadowColor:o,shadowSize:r,size:s=6}=t;return new p.Arc(e,{fillColor:"transparent",strokeColor:o,strokeWidth:r,radius:(s+n+r)/2})}function oe(e,t){let{strokeColor:n,strokeWidth:o,shadowColor:r,fillColor:s,shadowSize:i,size:a=0}=t;const u=a/2;return[ne(e,{strokeWidth:o,strokeColor:n,shadowSize:i,shadowColor:r,size:a}),new p.Arc(e,{fillColor:s,strokeColor:n,strokeWidth:o,radius:u})]}let re=function(e){X(n,f.PointSymbol);var t=J(n);function n(e){return U(this,n),t.call(this,e)}return V(n,[{key:"renderFunction",value:function(e,t,n){if(!(e instanceof d.PointFeature))return[];const{position:o}=e.projectTo(n),r=[o[0]/t+(this.offset[0]||0),-o[1]/t+(this.offset[1]||0)],s=this.getShadow(r),i=this.getPoint(r);return s?[s,i]:[i]}},{key:"getShadow",value:function(e){return n.getShadowArc(e,this)}},{key:"getPoint",value:function(e){return n.getPointArc(e,this)}}],[{key:"getShadowArc",value:function(e,t){let{strokeWidth:n=2,shadowColor:o,shadowSize:r,size:s=6}=t;return new p.Arc(e,{fillColor:"transparent",strokeColor:o,strokeWidth:r,radius:(s+n+r)/2})}},{key:"getPointArc",value:function(e,t){let{strokeWidth:n,fillColor:o,strokeColor:r,size:s=6}=t;return new p.Arc(e,{fillColor:o,strokeColor:r,strokeWidth:n,radius:s/2})}},{key:"getArcs",value:function(e,t){const o=n.getShadowArc(e,t),r=n.getPointArc(e,t);return o?[o,r]:[r]}}]),n}(),se=function(e){X(n,m.PolylineSymbol);var t=J(n);function n(e){return U(this,n),t.call(this,e)}return V(n,[{key:"renderFunction",value:function(e,t,n){if(!(e instanceof h.Poly))return[];const o=m.PolylineSymbol.getRenderedCoordinates(e,t,n),r=this.getPolyRender(o),s=this.getShadow(o),i=this.getVertexRenders(o);let a=[r];return s&&(a=[s,r]),i&&(a=a.concat(i)),a}},{key:"getShadow",value:function(e){return new y.PolyRender(e,{fillStyle:y.FillStyle.None,enclosed:this.enclose,strokeColor:this.shadowColor,strokeWidth:this.shadowSize,lineDash:this.lineDash})}},{key:"getPolyRender",value:function(e){return new y.PolyRender(e,{fillStyle:this.enclose?y.FillStyle.Color:y.FillStyle.None,enclosed:this.enclose,fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,lineDash:this.lineDash})}},{key:"getVertexRenders",value:function(e){if(this.showVertex)return e.reduce((e,t)=>e.concat(t),[]).map(e=>oe(e,{size:6,strokeWidth:2,shadowColor:this.shadowColor,strokeColor:this.strokeColor,shadowSize:void 0!==this.vertexShadowSize?this.vertexShadowSize:2,fillColor:"#ffffff"})).reduce((e,t)=>e.concat(t),[])}}]),n}();const ie={strokeWidth:2,strokeColor:"#e33600",shadowSize:8,shadowColor:"rgba(227, 54, 0, 0.3)"},ae={strokeColor:"#ff6933",shadowSize:0,vertexShadowSize:0},ue=new se(Z({},ie,ae,{enclose:!1,showVertex:!0})),le=new se(Z({},ie,ae,{fillColor:"rgba(255, 105, 51, 0.25)",enclose:!0,showVertex:!0})),ce=new re(Z({},{size:10,strokeWidth:2,strokeColor:"#e33600",fillColor:"#ffffff",shadowColor:"rgba(227, 54, 0, 0.3)",shadowSize:3},{strokeColor:"#ff6933",shadowSize:0}));function pe(e,t){if(e[0].length<=3)return!1;const n=e[0],o=n[0],r=n[n.length-1],s=2*t;return C.softEquals(o[0],r[0],s)&&C.softEquals(o[1],r[1],s)}function fe(e,t,n){void 0===t&&(t=2),void 0===n&&(n=",");const[o,r]=e.toFixed(t).split(".");return[o.replace(/\B(?=(\d{3})+(?!\d))/g," "),r].join(n)}function de(e){let t=e,n="м²";return e>=1e7?(t=e/1e6,n="км²"):e>=1e4&&(t=e/1e4,n="га"),fe(t)+" "+n}function me(e){let t=e,n="м";return e>1e4&&(t=e/1e3,n="км"),fe(t)+" "+n}function he(e,t){return"S : "+de(e)+" P : "+me(t)}const ye=[Infinity,Infinity];let ve=function(e){X(n,v.PolylineControl);var t=J(n);function n(e,o,r){var s;return U(this,n),(s=t.call(this,e,r)).cancel=()=>{s.fire("cancel")},s.painter=o,s.renderLabelSymbol=r.renderLabelSymbol,s.on("pointAdd",s.handlePointAdd),s.on("change",s.updateDistance),s}return V(n,[{key:"_handleMousemove",value:function(e){K(Y(n.prototype),"_handleMousemove",this).call(this,e),this.drawPointOnMouseMove(e)}},{key:"_activate",value:function(){K(Y(n.prototype),"_activate",this).call(this),this.addTempLabel(),this.setCursor("pointer")}},{key:"_deactivate",value:function(){K(Y(n.prototype),"_deactivate",this).call(this),this.removeCoordLabel(),this.removeTempLabel(),this.removeMeasureLabel(),this.removeTempPolygon(),this.setCursor("default")}},{key:"handlePointAdd",value:function(){const e=this.activeFeature;if(!e)return;const{rings:t,crs:n}=e;if(pe(t,this.map.resolution))return this.finishDrawing(),void this.fire(new L.DrawingFinishEvent(e,new MouseEvent("mouseup")));if(2===t[0].length){const e=n.projectionTo(x.geo),o=t[0][0];if(!e)return;const[r,s]=e(o);this.removeTempLabel(),this.addMeasureResultLabel(),this.addCoordLabel(r.toFixed(6)+", "+s.toFixed(6),o)}else this.removeCoordLabel()}},{key:"polygonPreview",value:function(){this.tempPolygon&&this._tempLayer&&this._tempLayer.remove(this.tempPolygon);const e=this.activeFeature;if(!e)return;const{rings:t,crs:n}=e,o=[...t[0]];o.shift(),this.tempPolygon=new u.Polygon(o,{crs:n}),this.tempPolygon.symbol=le,this.activeFeature&&this.activeFeature.hide(),this._tempLayer&&this._tempLayer.add(this.tempPolygon)}},{key:"removeTempPolygon",value:function(){this.tempPolygon&&(this._tempLayer&&this._tempLayer.remove(this.tempPolygon),delete this.tempPolygon)}},{key:"updateDistance",value:function(e){const t=this.activeFeature,{ringIndex:n,pointIndex:o}=e;if(!t||null===n||null===o)return;const{rings:r,crs:s}=t,i=r[n][o],a=g.length(r,s);let u=me(a);pe(r,this.map.resolution)?(this.polygonPreview(),u=he(g.area(r,s),a)):this.tempPolygon&&(t.show(),this.removeTempPolygon()),this.measureResultLabel&&(this.measureResultLabel.position=i,this.measureResultLabel.content=u)}},{key:"addTempLabel",value:function(){this.tempLabel=new b.LabelFeature(ye,{content:"Нажмите на карту, чтобы начать измерение",crs:this.map.crs,symbol:te({renderLabel:this.renderLabelSymbol})}),this._tempLayer&&this._tempLayer.add(this.tempLabel)}},{key:"addCoordLabel",value:function(e,t){this.coordLabel=new b.LabelFeature(t,{content:e,crs:this.map.crs,symbol:te({renderLabel:this.renderLabelSymbol,onClose:this.cancel})}),this._tempLayer&&this.coordLabel&&this._tempLayer.add(this.coordLabel)}},{key:"addMeasureResultLabel",value:function(){this.measureResultLabel=new b.LabelFeature(ye,{crs:this.map.crs,symbol:te({renderLabel:this.renderLabelSymbol})}),this._tempLayer&&this.measureResultLabel&&this._tempLayer.add(this.measureResultLabel)}},{key:"removeTempLabel",value:function(){this.tempLabel&&(this._tempLayer&&this._tempLayer.remove(this.tempLabel),delete this.tempLabel)}},{key:"removeCoordLabel",value:function(){this.coordLabel&&(this._tempLayer&&this._tempLayer.remove(this.coordLabel),delete this.coordLabel)}},{key:"removeMeasureLabel",value:function(){this.measureResultLabel&&(this._tempLayer&&this._tempLayer.remove(this.measureResultLabel),delete this.measureResultLabel)}},{key:"drawPointOnMouseMove",value:function(e){this.tempLabel&&(this.tempLabel.position=e.point.position)}},{key:"setCursor",value:function(e){const{wrapper:t}=this.painter;t&&"string"!=typeof t&&(t.style.cursor=e)}}]),n}(),be=function(e){X(n,w.PolyEditor);var t=J(n);function n(e,o,r){var s;return U(this,n),(s=t.call(this,e,r)).measureResult=()=>{const e=s.activeFeature;if(!e)return null;const{rings:t,isEnclosed:n,crs:o}=e,r=t[0][t[0].length-1],i=g.area(t,o),a=g.length(t,o,n);return{content:n?he(i,a):me(a),position:r}},s.removeFeature=()=>{s.fire("remove")},s.painter=o,s.renderLabelSymbol=r.renderLabelSymbol,s.on("change",s.updateMeasureResult),s.on("edit",s.updateMeasureResult),s}return V(n,[{key:"_activate",value:function(){K(Y(n.prototype),"_activate",this).call(this),this.addMeasureResultLabel()}},{key:"addMeasureResultLabel",value:function(){const e=this.measureResult();if(null===e)return;const{content:t,position:n}=e;this.measureResultLabel=new b.LabelFeature(n,{content:t,crs:this.map.crs,symbol:te({onClose:this.removeFeature,renderLabel:this.renderLabelSymbol})}),this._tempLayer&&this._tempLayer.add(this.measureResultLabel)}},{key:"updateMeasureResult",value:function(){if(this.measureResultLabel){const e=this.measureResult();if(null===e)return;const{content:t,position:n}=e;this.measureResultLabel.content=t,this.measureResultLabel.position=n}}}]),n}(),ge=function(e){X(o,n.Component);var t=J(o);function o(){var e;return U(this,o),(e=t.apply(this,arguments)).createFeature=t=>{const n=e.getFeature([...t.feature.rings]);e.layer&&e.layer.add(n),e.editorControl&&(e.editorControl.activeFeature=n),e.switchMode(!1,!0)},e.removeFeature=()=>{e.editorControl&&e.editorControl.activeFeature&&e.layer&&e.layer.remove(e.editorControl.activeFeature),e.switchMode(!0,!1)},e.cancelFeatureCreation=()=>{setTimeout(()=>{e.switchMode(!1,!1),e.switchMode(!0,!1)},10)},e}return V(o,[{key:"componentDidMount",value:function(){const{map:e,painter:t,renderLabelSymbol:n}=this.props;this.layer=new i.FeatureLayer,this.initCreateMode(e,t,n),this.initEditMode(e,t,n),this.props.map.addLayer(this.layer),this.switchMode(!0,!1)}},{key:"componentWillUnmount",value:function(){this.layer&&this.props.map.removeLayer(this.layer),this.switchMode(!1,!1),this.offEvents(),this.clearProperties()}},{key:"initCreateMode",value:function(e,t,n){this.createControl=new ve(e,t,{isActive:!1,useTempLayer:!0,symbol:ue,dblClickMinTime:300,renderLabelSymbol:n}),this.createControl.on("drawingFinish",this.createFeature),this.createControl.on("cancel",this.cancelFeatureCreation)}},{key:"initEditMode",value:function(e,t,n){this.editorControl=new be(e,t,{isActive:!1,activeLayer:this.layer,snappingSymbol:ce,symbol:ue,renderLabelSymbol:n}),this.editorControl.featureDragAllowed=!1,this.editorControl.on("remove",this.removeFeature)}},{key:"offEvents",value:function(){this.createControl&&this.createControl.off("drawingFinish",this.createFeature),this.editorControl&&this.editorControl.off("remove",this.removeFeature),this.createControl&&this.createControl.off("cancel",this.cancelFeatureCreation)}},{key:"clearProperties",value:function(){delete this.createControl,delete this.editorControl,delete this.layer}},{key:"switchMode",value:function(e,t){this.createControl&&(this.createControl.isActive=e),this.editorControl&&(this.editorControl.isActive=t)}},{key:"getFeature",value:function(e){let t;return pe(e,this.props.map.resolution)?(e[0].shift(),t=new u.Polygon(e,{crs:this.props.map.crs}),t.symbol=le):(t=new a.Polyline(e,{crs:this.props.map.crs}),t.symbol=ue),t}},{key:"render",value:function(){return n.createElement("div",{style:{display:"none"}})}}]),o}();function xe(){const e=Q(["\n ","\n ","\n ","\n ","\n"]);return xe=function(){return e},e}function Le(){const e=Q(["\n bottom: ",";\n right: ",";\n"]);return Le=function(){return e},e}function Ce(){const e=Q(["\n bottom: ",";\n left: ",";\n"]);return Ce=function(){return e},e}function we(){const e=Q(["\n top: ",";\n right: ",";\n"]);return we=function(){return e},e}function ke(){const e=Q(["\n top: ",";\n left: ",";\n"]);return ke=function(){return e},e}const Me=function(e,t){return void 0===e&&(e="bottom-left"),void 0===t&&(t="1rem"),k.css(xe(),"top-left"===e&&(e=>k.css(ke(),e,e))(t),"top-right"===e&&(e=>k.css(we(),e,e))(t),"bottom-left"===e&&(e=>k.css(Ce(),e,e))(t),"bottom-right"===e&&(e=>k.css(Le(),e,e))(t))};function Pe(){const e=Q(["\n position: absolute;\n display: flex;\n flex-direction: ",";\n\n ","\n\n "," {\n margin-bottom: ",";\n margin-right: ",";\n flex-direction: ",";\n }\n"]);return Pe=function(){return e},e}function Se(){const e=Q(["\n border-radius: 0.15rem;\n background: rgba(28, 33, 48, 0.8);\n display: flex;\n align-items: center;\n justify-content: center;\n color: #fff;\n font-size: 1.5rem;\n cursor: pointer;\n height: auto;\n width: auto;\n padding: 0.25rem;\n"]);return Se=function(){return e},e}function Ee(){const e=Q(["\n ","\n"]);return Ee=function(){return e},e}function Re(){const e=Q(["\n ","\n"]);return Re=function(){return e},e}function Fe(){const e=Q(["\n ","\n"]);return Fe=function(){return e},e}function _e(){const e=Q(["\n ","\n"]);return _e=function(){return e},e}function ze(){const e=Q(["\n ","\n"]);return ze=function(){return e},e}function Oe(){const e=Q(["\n width: 2rem;\n height: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n"]);return Oe=function(){return e},e}const Te=k.css(Oe()),Ae=M(P.EverCloudPlusIcon)(ze(),Te),De=M(P.EverCloudMinusIcon)(_e(),Te),qe=M(P.EverCloudSearchIcon)(Fe(),Te),Ie=M(P.EverCloudMaximizeIcon)(Re(),Te),je=M(P.EverCloudMeasureLenghtIcon)(Ee(),Te),Be=M.div(Se()),We=M.div(Pe(),e=>{let{vertical:t}=e;return t?"column":"row"},e=>{let{placement:t}=e;return Me(t)},Be,e=>{let{vertical:t}=e;return t?"0.5rem":"0"},e=>{let{vertical:t}=e;return t?"0":"0.5rem"},e=>{let{vertical:t}=e;return t?"column":"row"});function Ue(){const e=Q(["\n height: 2rem;\n display: flex;\n justify-content: center;\n align-items: ",";\n width: ",";\n color: #fff;\n font-size: 1rem;\n cursor: default;\n padding: 0 0.5rem;\n"]);return Ue=function(){return e},e}function Ne(){const e=Q(["\n display: flex;\n align-items: flex-end;\n justify-content: center;\n width: ",";\n height: 0.25rem;\n border: 0.0625rem solid white;\n border-top: 0;\n"]);return Ne=function(){return e},e}function Ve(){const e=Q(["\n height: 2rem;\n cursor: default;\n display: flex;\n align-items: flex-end;\n padding: 0 0.5rem 0.5rem;\n box-sizing: border-box;\n"]);return Ve=function(){return e},e}const Ze=M.div(Ve()),Xe=M.div(Ne(),e=>{let{width:t}=e;return t+"px"}),Ye=M.div(Ue(),e=>{let{alignEnd:t}=e;return t?"flex-end":"center"},e=>{let{width:t}=e;return t||"auto"});function Ge(e){const t=[1,2,5];for(let n=0;n<21;n++)for(let o=0;o<t.length;o++){const r=Math.pow(10,n)*t[o];if(r>e)return r}return 1}function He(e){let{onMount:n,onUnmount:o}=e;t.useEffect(()=>(n&&n(),o),[])}function Je(e,n){let{factory:o,destructor:r,update:s}=e;void 0===n&&(n=[]);const i=t.useRef();return He({onUnmount(){i.current&&r&&r(i.current)}}),t.useMemo(()=>{if(i.current)if(s){const e=s(i.current,n,{factory:o,destructor:r});e&&(i.current=e)}else r&&r(i.current);else s&&i.current||(i.current=o(n));return i.current},n)}function Ke(e){let{onUpdate:n,shouldUpdate:o,deps:r}=e;t.useEffect(()=>{o&&!o()||n()},r)}function Qe(e,t){const{map:n}=q();Ke({onUpdate:()=>n.insertLayer(e,t),deps:[t,e]})}function $e(e,t){void 0===t&&(t=!0),Ke({shouldUpdate:()=>e.isDisplayed!==t,onUpdate:()=>e.isDisplayed=t,deps:[t,e]})}function et(e){let{name:t,zIndex:n,style:r,condition:s,isDisplayed:i}=e;const a=O(),{map:u}=q(),l=Je({factory:()=>new o.EvergisDynamicLayer({name:t,condition:s,style:r},a),destructor:e=>-1!==u.indexOf(e)&&u.removeLayer(e),update:(e,t)=>{let[n,o,r]=t;e.name=n,e.style=o,e.condition=r}},[t,r,s]);return Qe(l,n),$e(l,i),l}function tt(e){let{name:t,subDomains:n,zIndex:r,isDisplayed:s}=e;const i=O(),{map:a}=q(),u=Je({factory:()=>new o.EvergisTileLayer({name:t,subDomains:n},i),update:(e,t)=>{let[n,o]=t;e.name=n,e.subDomains=o,"function"==typeof e.clearCache&&e.clearCache(),"function"==typeof e.redraw&&e.redraw()},destructor:e=>-1!==a.indexOf(e)&&a.removeLayer(e)},[t,n]);return Qe(u,r),$e(u,s),u}function nt(e){let{zIndex:t,isDisplayed:n=!0,features:o}=e;const{map:r}=q(),s=Je({factory:()=>new i.FeatureLayer({features:o}),destructor:e=>-1!==r.indexOf(e)&&r.removeLayer(e),update:(e,t)=>{let[n]=t;e.features=n}},[o]);return Qe(s,t),$e(s,n),s}function ot(e,n){const{map:o}=q(),s=n?r.BboxChangeEvent:r.BboxChangeEndEvent,i=t.useCallback(()=>{e&&e(rt(o))},[e,o,s]);t.useEffect(()=>(o.on(s.type,i),()=>{o.off(s.type,i)}),[i,s])}function rt(e){return{position:e.position.slice(0),resolution:e.resolution}}function st(e){return e._currentRender&&e._currentRender.bbox&&e._currentRender.bbox.coordinates}function it(e){let t={};for(const n of e)o.isEvergisDynamicLayer(n)&&(t[n.name]=st(n));return t}function at(e){const{map:n}=q(),[,o]=t.useReducer(ut,void 0,()=>rt(n));return ot(t.useCallback(o,[]),e),rt(n)}function ut(e,t){return t}function lt(){const{map:e,painter:n}=q(),{position:o,resolution:r}=at(),s=t.useMemo(()=>{const t=e.tileScheme.getLevel(r);if(void 0!==t||null!==t)return e.tileScheme.levels[t].zIndex},[r]),i=t.useMemo(()=>n.bbox,[o,r]);return{position:o,resolution:r,level:s,bbox:i}}function ct(){const{map:e}=q(),{resolution:n}=at(!0);return t.useMemo(()=>{const t=e.tileScheme.getLevel(n);if(void 0!==t||null!==t)return e.tileScheme.levels[t].zIndex},[n])}const pt=()=>{const{painter:e}=q();return t.useCallback(t=>{if("point"in t)return t.point;const n="browserEvent"in t?t.browserEvent:t,o=e.wrapper,{x:r,y:s}=R.getMouseOffset(o,"touches"in n?{pageX:n.touches[0].pageX,pageY:n.touches[0].pageY}:n);return e.getPointFromPxPosition(r,s)},[e])};function ft(){const{map:e,painter:n}=q(),o=pt(),r=t.useCallback(t=>{e.zoom(t,e.position)},[e]),s=t.useCallback(()=>r(1),[r]),i=t.useCallback(()=>r(-1),[r]),a=t.useCallback(t=>{let{position:o,resolution:r,extent:s}=t;if(o||r){const t=o?o.slice(0):e.position;e.animateTo(t,r||e.resolution)}if(s){const{xMax:t,xMin:o,yMax:r,yMin:i}=s,a=new E.Bbox([o,r],[t,i],e.crs);n&&n.show(a,!0)}},[e,n]),u=t.useCallback(t=>{e.zoom(1,o(t))},[o,e]);return{zoomTo:r,zoomIn:s,zoomOut:i,zoomAround:u,animateTo:a}}function dt(){const{painter:e}=q(),n=t.useRef(null);return He({onMount:()=>e.wrapper=n.current,onUnmount:()=>e.wrapper=null}),n}const mt=e=>t=>{let{zIndex:n}=t;return n===e},ht=(e,n,o,r)=>{const{map:s}=q();t.useEffect(()=>{const t=s.tileScheme.levels;if(void 0!==n){const{resolution:e}=t.find(mt(n))||{resolution:-1};s.minResolution=e}if(void 0!==e){const{resolution:n}=t.find(mt(e))||{resolution:-1};s.maxResolution=n}void 0===e&&void 0===n||yt(s,o,r)},[s,e,n])},yt=(e,t,n)=>{if(t&&n){const o=Math.min(Math.max(n,e.minResolution||0),e.maxResolution||Number.MAX_VALUE);e.animateTo(t,o)}};function vt(e){const t=Math.pow(10,(Math.floor(e)+"").length-1),n=e/t;return t*(n>=10?10:n>=5?5:n>=3?3:n>=2?2:1)}function bt(e,n){let{position:o,resolution:r}=e;const{map:s}=q(),{animateTo:i}=ft();t.useEffect(()=>{gt(s,{position:o,resolution:r})&&i({position:o,resolution:r})},[o,r,n])}function gt(e,t){let{position:n,resolution:o}=t;return function(e,t){return t&&(!C.softEquals(e.position[0],t[0])||!C.softEquals(e.position[1],t[1]))}(e,n)||function(e,t){return t&&!C.softEquals(e.resolution,t)}(e,o)}const xt=function(e){void 0===e&&(e=1);const{layer:n,popupLayer:o}=W(),{map:s}=q(),i=pt(),a=t.useRef([]),u=t.useRef(null),l=t.useRef([]),c=t.useCallback(()=>o.remove(o.features),[o]),p=t.useCallback(()=>{a.current.forEach((e,t)=>{const n=l.current[t];if(n){const{onMouseOver:t,onMouseMove:o,onMouseOut:r,onClick:s}=n;e.hasListener("mouseover",t)&&e.off("mouseover",t),e.hasListener("mousemove",o)&&e.off("mousemove",o),e.hasListener("mouseout",r)&&e.off("mouseout",r),e.hasListener("click",s)&&e.off("click",s)}}),s.off("click",c),a.current=[],u.current=null,n.remove(n.features),l.current=[],-1!==s.indexOf(o)&&s.removeLayer(o)},[c,o,n,s]);t.useEffect(()=>(-1===s.indexOf(n)&&s.insertLayer(n,e),p),[p,s,n,e]);const f=t.useCallback(t=>{let{point:r,position:i,component:a,clickMode:l}=t;const c=new b.LabelFeature(i||r.position,{symbol:new $({component:a}),crs:s.crs});l?(-1===s.indexOf(o)&&s.insertLayer(o,e),o.remove(o.features),o.add(c)):(u.current=c,n.add(c))},[o,n,s,e]),d=t.useCallback(e=>{e.node&&(e.node.doNotBubbleToMap=!0),e.stopPropagation(),u.current&&n.has(u.current)&&n.remove(u.current),u.current=null,n.remove(n.features)},[n]);return t.useCallback(e=>{const{feature:t,position:o,component:p,clickMode:m}=e,h=t||s;a.current.push(h);const y=h instanceof r.Map,v={onMouseOver:e=>{e.stopPropagation(),d(e),f({point:i(e),position:o,component:p})},onMouseMove:e=>{y||e.stopPropagation(),e.node&&(e.node.doNotBubbleToMap=!0);const t=i(e);u.current?(y&&!n.has(u.current)&&n.add(u.current),u.current.position=o||t.position):f({point:t,position:o,component:p})}};m&&(v.onClick=e=>{e.stopPropagation(),f({point:i(e),position:o,component:p,clickMode:m})}),v.onMouseOut=d,l.current.push(v);const{onMouseOver:b,onMouseMove:g,onMouseOut:x,onClick:L}=v;m&&!y?(h.on("mouseover",x),h.on("mousemove",x),h.on("click",L),s.hasListener("click",c)||s.on("click",c)):(y||h.on("mouseover",b),h.on("mousemove",g),h.on("mouseout",x))},[d,c,s,f,i,n])};function Lt(){const e=Q(["\n position: absolute;\n z-index: 999;\n display: flex;\n font-size: 0.625rem;\n color: #fff;\n background-color: rgba(28, 33, 48, 0.8);\n padding: 0.4em 0.6em;\n border-radius: 2px;\n user-select: none;\n box-sizing: border-box;\n white-space: pre;\n ","\n ","\n"]);return Lt=function(){return e},e}function Ct(){const e=Q(["\n &:before {\n content: '';\n width: 0;\n height: 0;\n position: absolute;\n }\n"]);return Ct=function(){return e},e}function wt(){const e=Q(["\n ","\n ","\n ","\n ","\n"]);return wt=function(){return e},e}function kt(){const e=Q(["\n transform: translate(-50%, 0);\n left: -50%;\n top: ",";\n ","\n"]);return kt=function(){return e},e}function Mt(){const e=Q(["\n transform: translate(0, -50%);\n top: -50%;\n right: ",";\n ","\n"]);return Mt=function(){return e},e}function Pt(){const e=Q(["\n transform: translate(0, -50%);\n top: -50%;\n left: ",";\n ","\n"]);return Pt=function(){return e},e}function St(){const e=Q(["\n transform: translate(-50%, 0);\n left: -50%;\n bottom: ",";\n ","\n"]);return St=function(){return e},e}function Et(){const e=Q(["\n &:before {\n transform: translate(-50%, -100%);\n left: 50%;\n top: 0;\n border-left: "," solid transparent;\n border-right: "," solid transparent;\n border-bottom: "," solid rgba(28, 33, 48, 0.8);\n }\n"]);return Et=function(){return e},e}function Rt(){const e=Q(["\n &:before {\n transform: translate(100%, -50%);\n right: 0;\n top: 50%;\n border-top: "," solid transparent;\n border-left: "," solid rgba(28, 33, 48, 0.8);\n border-bottom: "," solid transparent;\n }\n"]);return Rt=function(){return e},e}function Ft(){const e=Q(["\n &:before {\n transform: translate(-100%, -50%);\n left: 0;\n top: 50%;\n border-top: "," solid transparent;\n border-right: "," solid rgba(28, 33, 48, 0.8);\n border-bottom: "," solid transparent;\n }\n"]);return Ft=function(){return e},e}function _t(){const e=Q(["\n &:before {\n left: 50%;\n transform: translate(-50%, 100%);\n bottom: 0;\n border-left: "," solid transparent;\n border-right: "," solid transparent;\n border-top: "," solid rgba(28, 33, 48, 0.8);\n }\n"]);return _t=function(){return e},e}const zt=k.css(Ct()),Ot=M.div(Lt(),e=>{let{placement:t,distance:n="0.5rem",withArrow:o,cornerSize:r="0.25rem"}=e;return function(e,t,n){return void 0===e&&(e="top"),k.css(wt(),"top"===e&&((e,t)=>k.css(St(),e,t&&(e=>k.css(_t(),e,e,e))(t)))(t,n),"right"===e&&((e,t)=>k.css(Pt(),e,t&&(e=>k.css(Ft(),e,e,e))(t)))(t,n),"left"===e&&((e,t)=>k.css(Mt(),e,t&&(e=>k.css(Rt(),e,e,e))(t)))(t,n),"bottom"===e&&((e,t)=>k.css(kt(),e,t&&(e=>k.css(Et(),e,e,e))(t)))(t,n))}(t,n,o?r:null)},e=>{let{withArrow:t}=e;return t&&zt}),{Provider:Tt,Consumer:At}=t.createContext([]);exports.AVAILABLE_BASE_MAPS=["2gis","osm_mono","carto_dm","sputnik","stamen_terrain","stamen_toner","stamen_watercolor"],exports.BaseMeasureToolCreator=ve,exports.BaseMeasureToolEditor=be,exports.CONTROL_PLACEMENTS=["top-left","top-right","bottom-left","bottom-right"],exports.EvergisDynamicLayer=e=>(et(e),null),exports.EvergisProvider=e=>{let{api:o,children:r}=e;const s=t.useMemo(()=>o||_,[o]);return n.createElement(z.Provider,{value:s},r)},exports.EvergisTileLayer=e=>(tt(e),null),exports.FeatureLayer=e=>(nt(e),null),exports.Fullscreen=()=>n.createElement(Be,null,n.createElement(Ie,{onClick:()=>{}})),exports.FullscreenBtn=Ie,exports.LabelSymbol=$,exports.Map=e=>{let{className:o,position:r,resolution:s,minScale:i,maxScale:a,children:u,onBboxChange:l,style:c}=e;const p=dt(),{map:f}=q(),d=t.useCallback(e=>{l&&gt(f,{position:r,resolution:s})&&l(e)},[f,l,r,s]);return bt({position:r,resolution:s}),ht(i,a,r,s),ot(d),n.createElement("div",{className:o,ref:p,style:c},u)},exports.MapControl=Be,exports.MapControls=We,exports.MapProvider=e=>{let{map:o,painter:r,children:i}=e;const a=t.useMemo(()=>({map:o||T,painter:r||(o?new s.DomPainter(o):A)}),[o,r]);return n.createElement(D.Provider,{value:a},i)},exports.Measure=()=>n.createElement(Be,null,n.createElement(je,{onClick:()=>{}})),exports.MeasureBtn=je,exports.MeasureTool=ge,exports.Measurer=e=>{let{isActive:t,renderLabelSymbol:o}=e;const{map:r,painter:s}=q();return t?n.createElement(ge,{map:r,painter:s,renderLabelSymbol:o}):null},exports.ScaleRuler=()=>{const{resolution:e}=lt(),o=function(e){const{painter:n}=q(),{height:o,width:r}=n;return t.useMemo(()=>{if(0===r)return e;const t=r/10,s=n.getPointFromPxPosition(0,o/2),i=n.getPointFromPxPosition(t,o/2);return g.distance(s,i)/t},[o,r,e,n])}(e||0),r=50*o,s=Ge(r),i=Ge(r)/o;return n.createElement(Ze,null,n.createElement(Xe,{width:i},n.createElement(Ye,{alignEnd:!0,margin:"0"},s>=1e3?s/1e3+"km":s+"m")))},exports.ScaleRulerBlock=Xe,exports.ScaleRulerContainer=Ze,exports.Search=()=>n.createElement(Be,null,n.createElement(qe,{onClick:()=>{}})),exports.SearchBtn=qe,exports.ShadowedPointSymbol=re,exports.ShadowedPolySymbol=se,exports.TextContainer=Ye,exports.TileLayer=e=>(function(e){let{maskUrl:t,zIndex:n,isDisplayed:o}=e,r=G(e,["maskUrl","zIndex","isDisplayed"]);const{map:s}=q(),i=Je({factory:()=>new F.TileLayer(t,r),destructor:e=>-1!==s.indexOf(e)&&s.removeLayer(e)},[t]);Qe(i,n),$e(i,o)}(e),null),exports.Tooltip=e=>{let{features:o=[],map:s,center:i,component:a,zIndex:u,children:l,content:c,onEachFeature:p,clickMode:f}=e,d=G(e,["features","map","center","component","zIndex","children","content","onEachFeature","clickMode"]);const m=xt(u);return t.useEffect(()=>{(s?[s]:o).forEach(e=>{m({feature:e,component:"function"==typeof p?()=>p(e):()=>n.createElement(Ot,Object.assign({},d),c),position:!i||e instanceof r.Map||!e.bbox.center?void 0:e.bbox.center,clickMode:f})})},[c,f,p,m,s,i,o,a,d]),n.createElement(Tt,{value:o},s?l:l?n.createElement(At,null,l):null)},exports.TooltipComponent=Ot,exports.TooltipProvider=e=>{let{layer:o,popupLayer:r,children:s}=e;const i=t.useMemo(()=>({layer:o||I,popupLayer:r||j}),[o,r]);return n.createElement(B.Provider,{value:i},s)},exports.Zoom=e=>{let{children:t}=e;const{zoomIn:o,zoomOut:r}=ft();return n.createElement(Be,null,n.createElement(Ae,{onClick:o}),n.createElement(De,{onClick:r}),t)},exports.ZoomInBtn=Ae,exports.ZoomLevel=()=>{const e=ct();return n.createElement(Ye,{buttonText:!0,width:"2rem"},e||0)},exports.ZoomOutBtn=De,exports.createLabelSymbol=te,exports.createShadowRender=ne,exports.defaultOffset=ee,exports.formatArea=de,exports.formatLength=me,exports.getEditorPointRenderer=oe,exports.getMapState=rt,exports.getScale=Ge,exports.measureAreaSymbol=le,exports.measureLengthSymbol=ue,exports.measurePolygonSnapSymbol=ce,exports.placementMixin=Me,exports.shouldUpdateMapState=gt,exports.useEventPoint=pt,exports.useEvergisContext=O,exports.useEvergisDynamicLayer=et,exports.useEvergisTileLayer=tt,exports.useFeatureLayer=nt,exports.useLayerOrder=Qe,exports.useLayerVisibility=$e,exports.useMapBboxChange=ot,exports.useMapContext=q,exports.useMapLevel=ct,exports.useMapPick=()=>{const{map:e,painter:n}=q(),[o,r]=t.useState(),s=t.useMemo(()=>e.layers,[e.layers]),i=t.useCallback(e=>{if(!(e instanceof S.sGisClickEvent))return;const t=[0,0,n.width,n.height],[o,i]=n.getPxPosition(e.point.position);r({clickPoint:[Math.round(o),Math.round(i)],envelopes:it(s),imageRectangle:t})},[e]);return He({onMount:()=>e.on("click",i),onUnmount:()=>e.off("click",i)}),o},exports.useMapState=at,exports.useMapView=lt,exports.useMapViewActions=ft,exports.useMapWrapper=dt,exports.useMaxMinScale=ht,exports.useMount=He,exports.useProperty=Je,exports.useScale=function(e){let{resolution:n,minLength:o=50}=e;const r=function(e){const{painter:n}=q(),{height:o,width:r,bbox:{xMin:s,xMax:i,yMin:a,yMax:u,crs:l}}=n;return t.useMemo(()=>{if(0===r)return e;const t=r/10,s=n.getPointFromPxPosition(0,o/2),i=n.getPointFromPxPosition(t,o/2);return g.distance(s,i)/t},[o,r,s,i,a,u,l.wkid,e,n])}(n);return t.useMemo(()=>{const e=o*r;return{currentScale:vt(e),width:vt(e)/r}},[r,o])},exports.useTooltip=xt,exports.useTooltipContext=W,exports.useUpdate=Ke,exports.useUpdateMapView=bt;
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),n=e(t),o=require("@evergis/api"),r=require("@evergis/sgis/es/Map"),s=require("@evergis/sgis/es/painters/DomPainter/DomPainter"),i=require("@evergis/sgis/es/layers/FeatureLayer"),a=require("@evergis/sgis/es/features/Polyline"),l=require("@evergis/sgis/es/features/Polygon"),u=e(require("react-dom")),c=require("@evergis/sgis/es/symbols/Symbol"),f=require("@evergis/sgis/es/renders/Arc"),p=require("@evergis/sgis/es/symbols/point/Point"),d=require("@evergis/sgis/es/features/PointFeature"),m=require("@evergis/sgis/es/symbols/PolylineSymbol"),h=require("@evergis/sgis/es/features/Poly"),y=require("@evergis/sgis/es/renders/Poly"),v=require("@evergis/sgis/es/controls/PolylineControl"),b=require("@evergis/sgis/es/features/Label"),g=require("@evergis/sgis/es/geotools"),x=require("@evergis/sgis/es/Crs"),L=require("@evergis/sgis/es/controls/Control"),w=require("@evergis/sgis/es/utils/math"),C=require("@evergis/sgis/es/controls/PolyEditor"),k=require("styled-components"),M=e(k),P=require("@evergis/icons"),S=require("@evergis/sgis/es/commonEvents"),E=require("@evergis/sgis/es/Bbox"),F=require("@evergis/sgis/es/utils/domEvent"),R=require("@evergis/sgis/es/painters/DomPainter/Canvas"),_=require("@evergis/sgis/es/symbols/polygon/BrushFill"),z=require("@evergis/sgis/es/symbols/polygon/ImageFill"),O=require("@evergis/sgis/es/symbols/point/StaticImageSymbol"),q=require("@evergis/sgis/es/symbols/point/Square"),T=require("@evergis/sgis/es/symbols/polygon/Simple"),A=require("@evergis/sgis/es/symbols/point/MaskedImage"),D=require("@evergis/sgis/es/layers/TileLayer");const I=new o.Api({url:"/"}),j=t.createContext(I),B=()=>t.useContext(j),W=new r.Map,U=new s.DomPainter(W),N=t.createContext({map:W,painter:U}),V=()=>t.useContext(N),Z=new i.FeatureLayer,X=new i.FeatureLayer,Y=t.createContext({layer:Z,popupLayer:X}),G=()=>t.useContext(Y);function H(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function J(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function K(e,t,n){return t&&J(e.prototype,t),n&&J(e,n),e}function Q(){return(Q=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function $(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ee(e){return(ee=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function te(e,t){if(null==e)return{};var n,o,r={},s=Object.keys(e);for(o=0;o<s.length;o++)t.indexOf(n=s[o])>=0||(r[n]=e[n]);return r}function ne(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function oe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=ee(e);if(t){var r=ee(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return ne(this,n)}}function re(e,t,n){return(re="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=ee(e)););return e}(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function se(e,t){return t||(t=e.slice(0)),e.raw=t,e}let ie=function(e){$(o,c.DynamicPointSymbol);var t=oe(o);function o(e){var n;let{component:r,offset:s}=void 0===e?{}:e;return H(this,o),(n=t.call(this,{offset:s})).component=r,n}return K(o,[{key:"_getFeatureNode",value:function(e){const t=document.createElement("div");return this.renderDom(e.content,t),t}},{key:"_updateFeatureNode",value:function(e){this.renderDom(e.content,this.getNode(e))}},{key:"renderDom",value:function(e,t){if(!t)return;const o=this.component;o?u.render(n.createElement(o,{content:e}),t):t.innerText=e}}]),o}();const ae=[8,-16],le=e=>{const{offset:t=ae,renderLabel:o=(e=>{let{content:t}=e;return n.createElement("div",null,t)}),onClose:r}=e||{};return new ie({offset:t,component:e=>{let{content:t}=e;return o({content:t,onClose:r})}})};function ue(e,t){let{strokeWidth:n=2,shadowColor:o,shadowSize:r,size:s=6}=t;return new f.Arc(e,{fillColor:"transparent",strokeColor:o,strokeWidth:r,radius:(s+n+r)/2})}function ce(e,t){let{strokeColor:n,strokeWidth:o,shadowColor:r,fillColor:s,shadowSize:i,size:a=0}=t;const l=a/2;return[ue(e,{strokeWidth:o,strokeColor:n,shadowSize:i,shadowColor:r,size:a}),new f.Arc(e,{fillColor:s,strokeColor:n,strokeWidth:o,radius:l})]}let fe=function(e){$(n,p.PointSymbol);var t=oe(n);function n(e){return H(this,n),t.call(this,e)}return K(n,[{key:"renderFunction",value:function(e,t,n){if(!(e instanceof d.PointFeature))return[];const{position:o}=e.projectTo(n),r=[o[0]/t+(this.offset[0]||0),-o[1]/t+(this.offset[1]||0)],s=this.getShadow(r),i=this.getPoint(r);return s?[s,i]:[i]}},{key:"getShadow",value:function(e){return n.getShadowArc(e,this)}},{key:"getPoint",value:function(e){return n.getPointArc(e,this)}}],[{key:"getShadowArc",value:function(e,t){let{strokeWidth:n=2,shadowColor:o,shadowSize:r,size:s=6}=t;return new f.Arc(e,{fillColor:"transparent",strokeColor:o,strokeWidth:r,radius:(s+n+r)/2})}},{key:"getPointArc",value:function(e,t){let{strokeWidth:n,fillColor:o,strokeColor:r,size:s=6}=t;return new f.Arc(e,{fillColor:o,strokeColor:r,strokeWidth:n,radius:s/2})}},{key:"getArcs",value:function(e,t){const o=n.getShadowArc(e,t),r=n.getPointArc(e,t);return o?[o,r]:[r]}}]),n}(),pe=function(e){$(n,m.PolylineSymbol);var t=oe(n);function n(e){return H(this,n),t.call(this,e)}return K(n,[{key:"renderFunction",value:function(e,t,n){if(!(e instanceof h.Poly))return[];const o=m.PolylineSymbol.getRenderedCoordinates(e,t,n),r=this.getPolyRender(o),s=this.getShadow(o),i=this.getVertexRenders(o);let a=[r];return s&&(a=[s,r]),i&&(a=a.concat(i)),a}},{key:"getShadow",value:function(e){return new y.PolyRender(e,{fillStyle:y.FillStyle.None,enclosed:this.enclose,strokeColor:this.shadowColor,strokeWidth:this.shadowSize,lineDash:this.lineDash})}},{key:"getPolyRender",value:function(e){return new y.PolyRender(e,{fillStyle:this.enclose?y.FillStyle.Color:y.FillStyle.None,enclosed:this.enclose,fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,lineDash:this.lineDash})}},{key:"getVertexRenders",value:function(e){if(this.showVertex)return e.reduce((e,t)=>e.concat(t),[]).map(e=>ce(e,{size:6,strokeWidth:2,shadowColor:this.shadowColor,strokeColor:this.strokeColor,shadowSize:void 0!==this.vertexShadowSize?this.vertexShadowSize:2,fillColor:"#ffffff"})).reduce((e,t)=>e.concat(t),[])}}]),n}();const de={strokeWidth:2,strokeColor:"#e33600",shadowSize:8,shadowColor:"rgba(227, 54, 0, 0.3)"},me={strokeColor:"#ff6933",shadowSize:0,vertexShadowSize:0},he=new pe(Q({},de,me,{enclose:!1,showVertex:!0})),ye=new pe(Q({},de,me,{fillColor:"rgba(255, 105, 51, 0.25)",enclose:!0,showVertex:!0})),ve=new fe(Q({},{size:10,strokeWidth:2,strokeColor:"#e33600",fillColor:"#ffffff",shadowColor:"rgba(227, 54, 0, 0.3)",shadowSize:3},{strokeColor:"#ff6933",shadowSize:0}));function be(e,t){if(e[0].length<=3)return!1;const n=e[0],o=n[0],r=n[n.length-1],s=2*t;return w.softEquals(o[0],r[0],s)&&w.softEquals(o[1],r[1],s)}function ge(e,t,n){void 0===t&&(t=2),void 0===n&&(n=",");const[o,r]=e.toFixed(t).split(".");return[o.replace(/\B(?=(\d{3})+(?!\d))/g," "),r].join(n)}function xe(e){let t=e,n="м²";return e>=1e7?(t=e/1e6,n="км²"):e>=1e4&&(t=e/1e4,n="га"),ge(t)+" "+n}function Le(e){let t=e,n="м";return e>1e4&&(t=e/1e3,n="км"),ge(t)+" "+n}function we(e,t){return"S : "+xe(e)+" P : "+Le(t)}const Ce=[Infinity,Infinity];let ke=function(e){$(n,v.PolylineControl);var t=oe(n);function n(e,o,r){var s;return H(this,n),(s=t.call(this,e,r)).cancel=()=>{s.fire("cancel")},s.painter=o,s.renderLabelSymbol=r.renderLabelSymbol,s.on("pointAdd",s.handlePointAdd),s.on("change",s.updateDistance),s}return K(n,[{key:"_handleMousemove",value:function(e){re(ee(n.prototype),"_handleMousemove",this).call(this,e),this.drawPointOnMouseMove(e)}},{key:"_activate",value:function(){re(ee(n.prototype),"_activate",this).call(this),this.addTempLabel(),this.setCursor("pointer")}},{key:"_deactivate",value:function(){re(ee(n.prototype),"_deactivate",this).call(this),this.removeCoordLabel(),this.removeTempLabel(),this.removeMeasureLabel(),this.removeTempPolygon(),this.setCursor("default")}},{key:"handlePointAdd",value:function(){const e=this.activeFeature;if(!e)return;const{rings:t,crs:n}=e;if(be(t,this.map.resolution))return this.finishDrawing(),void this.fire(new L.DrawingFinishEvent(e,new MouseEvent("mouseup")));if(2===t[0].length){const e=n.projectionTo(x.geo),o=t[0][0];if(!e)return;const[r,s]=e(o);this.removeTempLabel(),this.addMeasureResultLabel(),this.addCoordLabel(r.toFixed(6)+", "+s.toFixed(6),o)}else this.removeCoordLabel()}},{key:"polygonPreview",value:function(){this.tempPolygon&&this._tempLayer&&this._tempLayer.remove(this.tempPolygon);const e=this.activeFeature;if(!e)return;const{rings:t,crs:n}=e,o=[...t[0]];o.shift(),this.tempPolygon=new l.Polygon(o,{crs:n}),this.tempPolygon.symbol=ye,this.activeFeature&&this.activeFeature.hide(),this._tempLayer&&this._tempLayer.add(this.tempPolygon)}},{key:"removeTempPolygon",value:function(){this.tempPolygon&&(this._tempLayer&&this._tempLayer.remove(this.tempPolygon),delete this.tempPolygon)}},{key:"updateDistance",value:function(e){const t=this.activeFeature,{ringIndex:n,pointIndex:o}=e;if(!t||null===n||null===o)return;const{rings:r,crs:s}=t,i=r[n][o],a=g.length(r,s);let l=Le(a);be(r,this.map.resolution)?(this.polygonPreview(),l=we(g.area(r,s),a)):this.tempPolygon&&(t.show(),this.removeTempPolygon()),this.measureResultLabel&&(this.measureResultLabel.position=i,this.measureResultLabel.content=l)}},{key:"addTempLabel",value:function(){this.tempLabel=new b.LabelFeature(Ce,{content:"Нажмите на карту, чтобы начать измерение",crs:this.map.crs,symbol:le({renderLabel:this.renderLabelSymbol})}),this._tempLayer&&this._tempLayer.add(this.tempLabel)}},{key:"addCoordLabel",value:function(e,t){this.coordLabel=new b.LabelFeature(t,{content:e,crs:this.map.crs,symbol:le({renderLabel:this.renderLabelSymbol,onClose:this.cancel})}),this._tempLayer&&this.coordLabel&&this._tempLayer.add(this.coordLabel)}},{key:"addMeasureResultLabel",value:function(){this.measureResultLabel=new b.LabelFeature(Ce,{crs:this.map.crs,symbol:le({renderLabel:this.renderLabelSymbol})}),this._tempLayer&&this.measureResultLabel&&this._tempLayer.add(this.measureResultLabel)}},{key:"removeTempLabel",value:function(){this.tempLabel&&(this._tempLayer&&this._tempLayer.remove(this.tempLabel),delete this.tempLabel)}},{key:"removeCoordLabel",value:function(){this.coordLabel&&(this._tempLayer&&this._tempLayer.remove(this.coordLabel),delete this.coordLabel)}},{key:"removeMeasureLabel",value:function(){this.measureResultLabel&&(this._tempLayer&&this._tempLayer.remove(this.measureResultLabel),delete this.measureResultLabel)}},{key:"drawPointOnMouseMove",value:function(e){this.tempLabel&&(this.tempLabel.position=e.point.position)}},{key:"setCursor",value:function(e){const{wrapper:t}=this.painter;t&&"string"!=typeof t&&(t.style.cursor=e)}}]),n}(),Me=function(e){$(n,C.PolyEditor);var t=oe(n);function n(e,o,r){var s;return H(this,n),(s=t.call(this,e,r)).measureResult=()=>{const e=s.activeFeature;if(!e)return null;const{rings:t,isEnclosed:n,crs:o}=e,r=t[0][t[0].length-1],i=g.area(t,o),a=g.length(t,o,n);return{content:n?we(i,a):Le(a),position:r}},s.removeFeature=()=>{s.fire("remove")},s.painter=o,s.renderLabelSymbol=r.renderLabelSymbol,s.on("change",s.updateMeasureResult),s.on("edit",s.updateMeasureResult),s}return K(n,[{key:"_activate",value:function(){re(ee(n.prototype),"_activate",this).call(this),this.addMeasureResultLabel()}},{key:"addMeasureResultLabel",value:function(){const e=this.measureResult();if(null===e)return;const{content:t,position:n}=e;this.measureResultLabel=new b.LabelFeature(n,{content:t,crs:this.map.crs,symbol:le({onClose:this.removeFeature,renderLabel:this.renderLabelSymbol})}),this._tempLayer&&this._tempLayer.add(this.measureResultLabel)}},{key:"updateMeasureResult",value:function(){if(this.measureResultLabel){const e=this.measureResult();if(null===e)return;const{content:t,position:n}=e;this.measureResultLabel.content=t,this.measureResultLabel.position=n}}}]),n}(),Pe=function(e){$(o,n.Component);var t=oe(o);function o(){var e;return H(this,o),(e=t.apply(this,arguments)).createFeature=t=>{const n=e.getFeature([...t.feature.rings]);e.layer&&e.layer.add(n),e.editorControl&&(e.editorControl.activeFeature=n),e.switchMode(!1,!0)},e.removeFeature=()=>{e.editorControl&&e.editorControl.activeFeature&&e.layer&&e.layer.remove(e.editorControl.activeFeature),e.switchMode(!0,!1)},e.cancelFeatureCreation=()=>{setTimeout(()=>{e.switchMode(!1,!1),e.switchMode(!0,!1)},10)},e}return K(o,[{key:"componentDidMount",value:function(){const{map:e,painter:t,renderLabelSymbol:n}=this.props;this.layer=new i.FeatureLayer,this.initCreateMode(e,t,n),this.initEditMode(e,t,n),this.props.map.addLayer(this.layer),this.switchMode(!0,!1)}},{key:"componentWillUnmount",value:function(){this.layer&&this.props.map.removeLayer(this.layer),this.switchMode(!1,!1),this.offEvents(),this.clearProperties()}},{key:"initCreateMode",value:function(e,t,n){this.createControl=new ke(e,t,{isActive:!1,useTempLayer:!0,symbol:he,dblClickMinTime:300,renderLabelSymbol:n}),this.createControl.on("drawingFinish",this.createFeature),this.createControl.on("cancel",this.cancelFeatureCreation)}},{key:"initEditMode",value:function(e,t,n){this.editorControl=new Me(e,t,{isActive:!1,activeLayer:this.layer,snappingSymbol:ve,symbol:he,renderLabelSymbol:n}),this.editorControl.featureDragAllowed=!1,this.editorControl.on("remove",this.removeFeature)}},{key:"offEvents",value:function(){this.createControl&&this.createControl.off("drawingFinish",this.createFeature),this.editorControl&&this.editorControl.off("remove",this.removeFeature),this.createControl&&this.createControl.off("cancel",this.cancelFeatureCreation)}},{key:"clearProperties",value:function(){delete this.createControl,delete this.editorControl,delete this.layer}},{key:"switchMode",value:function(e,t){this.createControl&&(this.createControl.isActive=e),this.editorControl&&(this.editorControl.isActive=t)}},{key:"getFeature",value:function(e){let t;return be(e,this.props.map.resolution)?(e[0].shift(),t=new l.Polygon(e,{crs:this.props.map.crs}),t.symbol=ye):(t=new a.Polyline(e,{crs:this.props.map.crs}),t.symbol=he),t}},{key:"render",value:function(){return n.createElement("div",{style:{display:"none"}})}}]),o}();function Se(){const e=se(["\n ","\n ","\n ","\n ","\n"]);return Se=function(){return e},e}function Ee(){const e=se(["\n bottom: ",";\n right: ",";\n"]);return Ee=function(){return e},e}function Fe(){const e=se(["\n bottom: ",";\n left: ",";\n"]);return Fe=function(){return e},e}function Re(){const e=se(["\n top: ",";\n right: ",";\n"]);return Re=function(){return e},e}function _e(){const e=se(["\n top: ",";\n left: ",";\n"]);return _e=function(){return e},e}const ze=function(e,t){return void 0===e&&(e="bottom-left"),void 0===t&&(t="1rem"),k.css(Se(),"top-left"===e&&(e=>k.css(_e(),e,e))(t),"top-right"===e&&(e=>k.css(Re(),e,e))(t),"bottom-left"===e&&(e=>k.css(Fe(),e,e))(t),"bottom-right"===e&&(e=>k.css(Ee(),e,e))(t))};function Oe(){const e=se(["\n position: absolute;\n display: flex;\n flex-direction: ",";\n\n ","\n\n "," {\n margin-bottom: ",";\n margin-right: ",";\n flex-direction: ",";\n }\n"]);return Oe=function(){return e},e}function qe(){const e=se(["\n border-radius: 0.15rem;\n background: rgba(28, 33, 48, 0.8);\n display: flex;\n align-items: center;\n justify-content: center;\n color: #fff;\n font-size: 1.5rem;\n cursor: pointer;\n height: auto;\n width: auto;\n padding: 0.25rem;\n"]);return qe=function(){return e},e}function Te(){const e=se(["\n ","\n"]);return Te=function(){return e},e}function Ae(){const e=se(["\n ","\n"]);return Ae=function(){return e},e}function De(){const e=se(["\n ","\n"]);return De=function(){return e},e}function Ie(){const e=se(["\n ","\n"]);return Ie=function(){return e},e}function je(){const e=se(["\n ","\n"]);return je=function(){return e},e}function Be(){const e=se(["\n width: 2rem;\n height: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n"]);return Be=function(){return e},e}const We=k.css(Be()),Ue=M(P.EverCloudPlusIcon)(je(),We),Ne=M(P.EverCloudMinusIcon)(Ie(),We),Ve=M(P.EverCloudSearchIcon)(De(),We),Ze=M(P.EverCloudMaximizeIcon)(Ae(),We),Xe=M(P.EverCloudMeasureLenghtIcon)(Te(),We),Ye=M.div(qe()),Ge=M.div(Oe(),e=>{let{vertical:t}=e;return t?"column":"row"},e=>{let{placement:t}=e;return ze(t)},Ye,e=>{let{vertical:t}=e;return t?"0.5rem":"0"},e=>{let{vertical:t}=e;return t?"0":"0.5rem"},e=>{let{vertical:t}=e;return t?"column":"row"});function He(){const e=se(["\n height: 2rem;\n display: flex;\n justify-content: center;\n align-items: ",";\n width: ",";\n color: #fff;\n font-size: 1rem;\n cursor: default;\n padding: 0 0.5rem;\n"]);return He=function(){return e},e}function Je(){const e=se(["\n display: flex;\n align-items: flex-end;\n justify-content: center;\n width: ",";\n height: 0.25rem;\n border: 0.0625rem solid white;\n border-top: 0;\n"]);return Je=function(){return e},e}function Ke(){const e=se(["\n height: 2rem;\n cursor: default;\n display: flex;\n align-items: flex-end;\n padding: 0 0.5rem 0.5rem;\n box-sizing: border-box;\n"]);return Ke=function(){return e},e}const Qe=M.div(Ke()),$e=M.div(Je(),e=>{let{width:t}=e;return t+"px"}),et=M.div(He(),e=>{let{alignEnd:t}=e;return t?"flex-end":"center"},e=>{let{width:t}=e;return t||"auto"});function tt(e){const t=[1,2,5];for(let n=0;n<21;n++)for(let o=0;o<t.length;o++){const r=Math.pow(10,n)*t[o];if(r>e)return r}return 1}function nt(e){let{onMount:n,onUnmount:o}=e;t.useEffect(()=>(n&&n(),o),[])}function ot(e,n){let{factory:o,destructor:r,update:s}=e;void 0===n&&(n=[]);const i=t.useRef();return nt({onUnmount(){i.current&&r&&r(i.current)}}),t.useMemo(()=>{if(i.current)if(s){const e=s(i.current,n,{factory:o,destructor:r});e&&(i.current=e)}else r&&r(i.current);else s&&i.current||(i.current=o(n));return i.current},n)}function rt(e){let{onUpdate:n,shouldUpdate:o,deps:r}=e;t.useEffect(()=>{o&&!o()||n()},r)}function st(e,t){const{map:n}=V();rt({onUpdate:()=>n.insertLayer(e,t),deps:[t,e]})}function it(e,t){void 0===t&&(t=!0),rt({shouldUpdate:()=>e.isDisplayed!==t,onUpdate:()=>e.isDisplayed=t,deps:[t,e]})}function at(e){let{name:t,zIndex:n,style:r,condition:s,isDisplayed:i}=e;const a=B(),{map:l}=V(),u=ot({factory:()=>new o.EvergisDynamicLayer({name:t,condition:s,style:r},a),destructor:e=>-1!==l.indexOf(e)&&l.removeLayer(e),update:(e,t)=>{let[n,o,r]=t;e.name=n,e.style=o,e.condition=r}},[t,r,s]);return st(u,n),it(u,i),u}function lt(e){let{name:t,subDomains:n,zIndex:r,isDisplayed:s}=e;const i=B(),{map:a}=V(),l=ot({factory:()=>new o.EvergisTileLayer({name:t,subDomains:n},i),update:(e,t)=>{let[n,o]=t;e.name=n,e.subDomains=o,"function"==typeof e.clearCache&&e.clearCache(),"function"==typeof e.redraw&&e.redraw()},destructor:e=>-1!==a.indexOf(e)&&a.removeLayer(e)},[t,n]);return st(l,r),it(l,s),l}function ut(e){let{zIndex:t,isDisplayed:n=!0,features:o}=e;const{map:r}=V(),s=ot({factory:()=>new i.FeatureLayer({features:o}),destructor:e=>-1!==r.indexOf(e)&&r.removeLayer(e),update:(e,t)=>{let[n]=t;e.features=n}},[o]);return st(s,t),it(s,n),s}function ct(e,n){const{map:o}=V(),s=n?r.BboxChangeEvent:r.BboxChangeEndEvent,i=t.useCallback(()=>{e&&e(ft(o))},[e,o,s]);t.useEffect(()=>(o.on(s.type,i),()=>{o.off(s.type,i)}),[i,s])}function ft(e){return{position:e.position.slice(0),resolution:e.resolution}}function pt(e){return e._currentRender&&e._currentRender.bbox&&e._currentRender.bbox.coordinates}function dt(e){let t={};for(const n of e)o.isEvergisDynamicLayer(n)&&(t[n.name]=pt(n));return t}function mt(e){const{map:n}=V(),[,o]=t.useReducer(ht,void 0,()=>ft(n));return ct(t.useCallback(o,[]),e),ft(n)}function ht(e,t){return t}function yt(){const{map:e,painter:n}=V(),{position:o,resolution:r}=mt(),s=t.useMemo(()=>{const t=e.tileScheme.getLevel(r);if(void 0!==t||null!==t)return e.tileScheme.levels[t].zIndex},[r]),i=t.useMemo(()=>n.bbox,[o,r]);return{position:o,resolution:r,level:s,bbox:i}}function vt(){const{map:e}=V(),{resolution:n}=mt(!0);return t.useMemo(()=>{const t=e.tileScheme.getLevel(n);if(void 0!==t||null!==t)return e.tileScheme.levels[t].zIndex},[n])}const bt=()=>{const{painter:e}=V();return t.useCallback(t=>{if("point"in t)return t.point;const n="browserEvent"in t?t.browserEvent:t,o=e.wrapper,{x:r,y:s}=F.getMouseOffset(o,"touches"in n?{pageX:n.touches[0].pageX,pageY:n.touches[0].pageY}:n);return e.getPointFromPxPosition(r,s)},[e])};function gt(){const{map:e,painter:n}=V(),o=bt(),r=t.useCallback(t=>{e.zoom(t,e.position)},[e]),s=t.useCallback(()=>r(1),[r]),i=t.useCallback(()=>r(-1),[r]),a=t.useCallback(t=>{let{position:o,resolution:r,extent:s}=t;if(o||r){const t=o?o.slice(0):e.position;e.animateTo(t,r||e.resolution)}if(s){const{xMax:t,xMin:o,yMax:r,yMin:i}=s,a=new E.Bbox([o,r],[t,i],e.crs);n&&n.show(a,!0)}},[e,n]),l=t.useCallback(t=>{e.zoom(1,o(t))},[o,e]);return{zoomTo:r,zoomIn:s,zoomOut:i,zoomAround:l,animateTo:a}}function xt(){const{painter:e}=V(),n=t.useRef(null);return nt({onMount:()=>e.wrapper=n.current,onUnmount:()=>e.wrapper=null}),n}const Lt=e=>t=>{let{zIndex:n}=t;return n===e},wt=(e,n,o,r)=>{const{map:s}=V();t.useEffect(()=>{const t=s.tileScheme.levels;if(void 0!==n){const{resolution:e}=t.find(Lt(n))||{resolution:-1};s.minResolution=e}if(void 0!==e){const{resolution:n}=t.find(Lt(e))||{resolution:-1};s.maxResolution=n}void 0===e&&void 0===n||Ct(s,o,r)},[s,e,n])},Ct=(e,t,n)=>{if(t&&n){const o=Math.min(Math.max(n,e.minResolution||0),e.maxResolution||Number.MAX_VALUE);e.animateTo(t,o)}};function kt(e){const t=Math.pow(10,(Math.floor(e)+"").length-1),n=e/t;return t*(n>=10?10:n>=5?5:n>=3?3:n>=2?2:1)}function Mt(e,n){let{position:o,resolution:r}=e;const{map:s}=V(),{animateTo:i}=gt();t.useEffect(()=>{Pt(s,{position:o,resolution:r})&&i({position:o,resolution:r})},[o,r,n])}function Pt(e,t){let{position:n,resolution:o}=t;return function(e,t){return t&&(!w.softEquals(e.position[0],t[0])||!w.softEquals(e.position[1],t[1]))}(e,n)||function(e,t){return t&&!w.softEquals(e.resolution,t)}(e,o)}const St=function(e){void 0===e&&(e=1);const{layer:n,popupLayer:o}=G(),{map:s}=V(),i=bt(),a=t.useRef([]),l=t.useRef(null),u=t.useRef([]),c=t.useCallback(()=>o.remove(o.features),[o]),f=t.useCallback(()=>{a.current.forEach((e,t)=>{const n=u.current[t];if(n){const{onMouseOver:t,onMouseMove:o,onMouseOut:r,onClick:s}=n;e.hasListener("mouseover",t)&&e.off("mouseover",t),e.hasListener("mousemove",o)&&e.off("mousemove",o),e.hasListener("mouseout",r)&&e.off("mouseout",r),e.hasListener("click",s)&&e.off("click",s)}}),s.off("click",c),a.current=[],l.current=null,n.remove(n.features),u.current=[],-1!==s.indexOf(o)&&s.removeLayer(o)},[c,o,n,s]);t.useEffect(()=>(-1===s.indexOf(n)&&s.insertLayer(n,e),f),[f,s,n,e]);const p=t.useCallback(t=>{let{point:r,position:i,component:a,clickMode:u}=t;const c=new b.LabelFeature(i||r.position,{symbol:new ie({component:a}),crs:s.crs});u?(-1===s.indexOf(o)&&s.insertLayer(o,e),o.remove(o.features),o.add(c)):(l.current=c,n.add(c))},[o,n,s,e]),d=t.useCallback(e=>{e.node&&(e.node.doNotBubbleToMap=!0),e.stopPropagation(),l.current&&n.has(l.current)&&n.remove(l.current),l.current=null,n.remove(n.features)},[n]);return t.useCallback(e=>{const{feature:t,position:o,component:f,clickMode:m}=e,h=t||s;a.current.push(h);const y=h instanceof r.Map,v={onMouseOver:e=>{e.stopPropagation(),d(e),p({point:i(e),position:o,component:f})},onMouseMove:e=>{y||e.stopPropagation(),e.node&&(e.node.doNotBubbleToMap=!0);const t=i(e);l.current?(y&&!n.has(l.current)&&n.add(l.current),l.current.position=o||t.position):p({point:t,position:o,component:f})}};m&&(v.onClick=e=>{e.stopPropagation(),p({point:i(e),position:o,component:f,clickMode:m})}),v.onMouseOut=d,u.current.push(v);const{onMouseOver:b,onMouseMove:g,onMouseOut:x,onClick:L}=v;m&&!y?(h.on("mouseover",x),h.on("mousemove",x),h.on("click",L),s.hasListener("click",c)||s.on("click",c)):(y||h.on("mouseover",b),h.on("mousemove",g),h.on("mouseout",x))},[d,c,s,p,i,n])};function Et(e){return e instanceof T.PolygonSymbol||e instanceof _.BrushFill||e instanceof z.ImageFill}function Ft(e){return e instanceof m.PolylineSymbol}const Rt=new d.PointFeature([50,-50],{crs:x.plain}),_t=new a.Polyline([[0,-57],[26,-57],[40,-35],[60,-65],[74,-43],[100,-43]],{crs:x.plain}),zt=new l.Polygon([[50,-15],[80,-33],[80,-67],[50,-85],[20,-67],[20,-33],[50,-15]],{crs:x.plain}),Ot=new a.Polyline([[0,-50],[100,-50]],{crs:x.plain}),qt=new l.Polygon([[0,0],[100,0],[100,-100],[0,-100]],{crs:x.plain});function Tt(e,t,n){void 0===t&&(t=100);const o=100/t;return Et(e)?e.renderFunctionAsync(n?qt:zt,o,x.plain):Ft(e)?e.renderFunctionAsync(n?Ot:_t,o,x.plain):e.renderFunctionAsync(Rt,o,x.plain)}function At(e,t){e.forEach(e=>{t.draw(e)})}const Dt=16;function It(){const e=se(["\n position: absolute;\n z-index: 999;\n display: flex;\n font-size: 0.625rem;\n color: #fff;\n background-color: rgba(28, 33, 48, 0.8);\n padding: 0.4em 0.6em;\n border-radius: 2px;\n user-select: none;\n box-sizing: border-box;\n white-space: pre;\n ","\n ","\n"]);return It=function(){return e},e}function jt(){const e=se(["\n &:before {\n content: '';\n width: 0;\n height: 0;\n position: absolute;\n }\n"]);return jt=function(){return e},e}function Bt(){const e=se(["\n ","\n ","\n ","\n ","\n"]);return Bt=function(){return e},e}function Wt(){const e=se(["\n transform: translate(-50%, 0);\n left: -50%;\n top: ",";\n ","\n"]);return Wt=function(){return e},e}function Ut(){const e=se(["\n transform: translate(0, -50%);\n top: -50%;\n right: ",";\n ","\n"]);return Ut=function(){return e},e}function Nt(){const e=se(["\n transform: translate(0, -50%);\n top: -50%;\n left: ",";\n ","\n"]);return Nt=function(){return e},e}function Vt(){const e=se(["\n transform: translate(-50%, 0);\n left: -50%;\n bottom: ",";\n ","\n"]);return Vt=function(){return e},e}function Zt(){const e=se(["\n &:before {\n transform: translate(-50%, -100%);\n left: 50%;\n top: 0;\n border-left: "," solid transparent;\n border-right: "," solid transparent;\n border-bottom: "," solid rgba(28, 33, 48, 0.8);\n }\n"]);return Zt=function(){return e},e}function Xt(){const e=se(["\n &:before {\n transform: translate(100%, -50%);\n right: 0;\n top: 50%;\n border-top: "," solid transparent;\n border-left: "," solid rgba(28, 33, 48, 0.8);\n border-bottom: "," solid transparent;\n }\n"]);return Xt=function(){return e},e}function Yt(){const e=se(["\n &:before {\n transform: translate(-100%, -50%);\n left: 0;\n top: 50%;\n border-top: "," solid transparent;\n border-right: "," solid rgba(28, 33, 48, 0.8);\n border-bottom: "," solid transparent;\n }\n"]);return Yt=function(){return e},e}function Gt(){const e=se(["\n &:before {\n left: 50%;\n transform: translate(-50%, 100%);\n bottom: 0;\n border-left: "," solid transparent;\n border-right: "," solid transparent;\n border-top: "," solid rgba(28, 33, 48, 0.8);\n }\n"]);return Gt=function(){return e},e}const Ht=k.css(jt()),Jt=M.div(It(),e=>{let{placement:t,distance:n="0.5rem",withArrow:o,cornerSize:r="0.25rem"}=e;return function(e,t,n){return void 0===e&&(e="top"),k.css(Bt(),"top"===e&&((e,t)=>k.css(Vt(),e,t&&(e=>k.css(Gt(),e,e,e))(t)))(t,n),"right"===e&&((e,t)=>k.css(Nt(),e,t&&(e=>k.css(Yt(),e,e,e))(t)))(t,n),"left"===e&&((e,t)=>k.css(Ut(),e,t&&(e=>k.css(Xt(),e,e,e))(t)))(t,n),"bottom"===e&&((e,t)=>k.css(Wt(),e,t&&(e=>k.css(Zt(),e,e,e))(t)))(t,n))}(t,n,o?r:null)},e=>{let{withArrow:t}=e;return t&&Ht}),{Provider:Kt,Consumer:Qt}=t.createContext([]);exports.AVAILABLE_BASE_MAPS=["2gis","osm_mono","carto_dm","sputnik","stamen_terrain","stamen_toner","stamen_watercolor"],exports.BaseMeasureToolCreator=ke,exports.BaseMeasureToolEditor=Me,exports.CONTROL_PLACEMENTS=["top-left","top-right","bottom-left","bottom-right"],exports.EvergisDynamicLayer=e=>(at(e),null),exports.EvergisProvider=e=>{let{api:o,children:r}=e;const s=t.useMemo(()=>o||I,[o]);return n.createElement(j.Provider,{value:s},r)},exports.EvergisTileLayer=e=>(lt(e),null),exports.FeatureLayer=e=>(ut(e),null),exports.Fullscreen=()=>n.createElement(Ye,null,n.createElement(Ze,{onClick:()=>{}})),exports.FullscreenBtn=Ze,exports.LabelSymbol=ie,exports.Map=e=>{let{className:o,position:r,resolution:s,minScale:i,maxScale:a,children:l,onBboxChange:u,style:c}=e;const f=xt(),{map:p}=V(),d=t.useCallback(e=>{u&&Pt(p,{position:r,resolution:s})&&u(e)},[p,u,r,s]);return Mt({position:r,resolution:s}),wt(i,a,r,s),ct(d),n.createElement("div",{className:o,ref:f,style:c},l)},exports.MapControl=Ye,exports.MapControls=Ge,exports.MapProvider=e=>{let{map:o,painter:r,children:i}=e;const a=t.useMemo(()=>({map:o||W,painter:r||(o?new s.DomPainter(o):U)}),[o,r]);return n.createElement(N.Provider,{value:a},i)},exports.Measure=()=>n.createElement(Ye,null,n.createElement(Xe,{onClick:()=>{}})),exports.MeasureBtn=Xe,exports.MeasureTool=Pe,exports.Measurer=e=>{let{isActive:t,renderLabelSymbol:o}=e;const{map:r,painter:s}=V();return t?n.createElement(Pe,{map:r,painter:s,renderLabelSymbol:o}):null},exports.ScaleRuler=()=>{const{resolution:e}=yt(),o=function(e){const{painter:n}=V(),{height:o,width:r}=n;return t.useMemo(()=>{if(0===r)return e;const t=r/10,s=n.getPointFromPxPosition(0,o/2),i=n.getPointFromPxPosition(t,o/2);return g.distance(s,i)/t},[o,r,e,n])}(e||0),r=50*o,s=tt(r),i=tt(r)/o;return n.createElement(Qe,null,n.createElement($e,{width:i},n.createElement(et,{alignEnd:!0,margin:"0"},s>=1e3?s/1e3+"km":s+"m")))},exports.ScaleRulerBlock=$e,exports.ScaleRulerContainer=Qe,exports.Search=()=>n.createElement(Ye,null,n.createElement(Ve,{onClick:()=>{}})),exports.SearchBtn=Ve,exports.ShadowedPointSymbol=fe,exports.ShadowedPolySymbol=pe,exports.Symbol=e=>{let{symbol:o,size:r,isLegend:s}=e;const{canvas:i,ref:a}=function(){const e=t.useRef(null),n=t.useCallback(t=>{e.current=null!==t?new R.Canvas(t):null},[]);return{canvas:e,ref:n}}();return function(e,n){let{symbol:o,size:r=Dt,isLegend:s,maxWidth:i}=e;t.useEffect(()=>{if(null!==n.current){const e=n.current;!function(e,t,n){e.node.height=t,e.node.width=n?Math.min(t,n):t}(e,r,i),Tt(o,r,s).then(t=>{At(t,e)})}},[o,r,s,i])}({symbol:o,size:r,isLegend:s},i),n.createElement("canvas",{ref:a})},exports.TextContainer=et,exports.TileLayer=e=>(function(e){let{maskUrl:t,zIndex:n,isDisplayed:o}=e,r=te(e,["maskUrl","zIndex","isDisplayed"]);const{map:s}=V(),i=ot({factory:()=>new D.TileLayer(t,r),destructor:e=>-1!==s.indexOf(e)&&s.removeLayer(e)},[t]);st(i,n),it(i,o)}(e),null),exports.Tooltip=e=>{let{features:o=[],map:s,center:i,component:a,zIndex:l,children:u,content:c,onEachFeature:f,clickMode:p}=e,d=te(e,["features","map","center","component","zIndex","children","content","onEachFeature","clickMode"]);const m=St(l);return t.useEffect(()=>{(s?[s]:o).forEach(e=>{m({feature:e,component:"function"==typeof f?()=>f(e):()=>n.createElement(Jt,Object.assign({},d),c),position:!i||e instanceof r.Map||!e.bbox.center?void 0:e.bbox.center,clickMode:p})})},[c,p,f,m,s,i,o,a,d]),n.createElement(Kt,{value:o},s?u:u?n.createElement(Qt,null,u):null)},exports.TooltipComponent=Jt,exports.TooltipProvider=e=>{let{layer:o,popupLayer:r,children:s}=e;const i=t.useMemo(()=>({layer:o||Z,popupLayer:r||X}),[o,r]);return n.createElement(Y.Provider,{value:i},s)},exports.Zoom=e=>{let{children:t}=e;const{zoomIn:o,zoomOut:r}=gt();return n.createElement(Ye,null,n.createElement(Ue,{onClick:o}),n.createElement(Ne,{onClick:r}),t)},exports.ZoomInBtn=Ue,exports.ZoomLevel=()=>{const e=vt();return n.createElement(et,{buttonText:!0,width:"2rem"},e||0)},exports.ZoomOutBtn=Ne,exports.createLabelSymbol=le,exports.createShadowRender=ue,exports.defaultOffset=ae,exports.formatArea=xe,exports.formatLength=Le,exports.getEditorPointRenderer=ce,exports.getMapState=ft,exports.getScale=tt,exports.getSymbolRenders=Tt,exports.isImageSymbol=function(e){return e instanceof O.StaticImageSymbol||e instanceof A.MaskedImage},exports.isPointSymbol=function(e){return e instanceof p.PointSymbol||e instanceof O.StaticImageSymbol||e instanceof q.SquareSymbol||e instanceof A.MaskedImage},exports.isPolygonSymbol=Et,exports.isPolylineSymbol=Ft,exports.measureAreaSymbol=ye,exports.measureLengthSymbol=he,exports.measurePolygonSnapSymbol=ve,exports.placementMixin=ze,exports.renderSymbolToCanvas=At,exports.shouldUpdateMapState=Pt,exports.useEventPoint=bt,exports.useEvergisContext=B,exports.useEvergisDynamicLayer=at,exports.useEvergisTileLayer=lt,exports.useFeatureLayer=ut,exports.useLayerOrder=st,exports.useLayerVisibility=it,exports.useMapBboxChange=ct,exports.useMapContext=V,exports.useMapLevel=vt,exports.useMapPick=()=>{const{map:e,painter:n}=V(),[o,r]=t.useState(),s=t.useMemo(()=>e.layers,[e.layers]),i=t.useCallback(e=>{if(!(e instanceof S.sGisClickEvent))return;const t=[0,0,n.width,n.height],[o,i]=n.getPxPosition(e.point.position);r({clickPoint:[Math.round(o),Math.round(i)],envelopes:dt(s),imageRectangle:t})},[e]);return nt({onMount:()=>e.on("click",i),onUnmount:()=>e.off("click",i)}),o},exports.useMapState=mt,exports.useMapView=yt,exports.useMapViewActions=gt,exports.useMapWrapper=xt,exports.useMaxMinScale=wt,exports.useMount=nt,exports.useProperty=ot,exports.useScale=function(e){let{resolution:n,minLength:o=50}=e;const r=function(e){const{painter:n}=V(),{height:o,width:r,bbox:{xMin:s,xMax:i,yMin:a,yMax:l,crs:u}}=n;return t.useMemo(()=>{if(0===r)return e;const t=r/10,s=n.getPointFromPxPosition(0,o/2),i=n.getPointFromPxPosition(t,o/2);return g.distance(s,i)/t},[o,r,s,i,a,l,u.wkid,e,n])}(n);return t.useMemo(()=>{const e=o*r;return{currentScale:kt(e),width:kt(e)/r}},[r,o])},exports.useTooltip=St,exports.useTooltipContext=G,exports.useUpdate=rt,exports.useUpdateMapView=Mt;
//# sourceMappingURL=react.cjs.production.min.js.map
{
"version": "1.2.0",
"version": "1.2.1",
"license": "MIT",

@@ -73,3 +73,3 @@ "main": "dist/index.js",

},
"gitHead": "cbed26062c3022be5bb453faa04af2a69a0502b6"
"gitHead": "9586f450185090ee21ea78d38be883ec3f86580d"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc