You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
5.8 KiB

!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("leaflet-draw"),require("react"),require("leaflet")):"function"==typeof define&&define.amd?define(["leaflet-draw","react","leaflet"],r):"object"==typeof exports?exports.ReactLeaflet=r(require("leaflet-draw"),require("react"),require("leaflet")):e.ReactLeaflet=r(e.L,e.React,e.L)}(self,((e,r,t)=>(()=>{var o={704:e=>{"use strict";e.exports=function e(r,t){if(r===t)return!0;if(r&&t&&"object"==typeof r&&"object"==typeof t){if(r.constructor!==t.constructor)return!1;var o,n,p;if(Array.isArray(r)){if((o=r.length)!=t.length)return!1;for(n=o;0!=n--;)if(!e(r[n],t[n]))return!1;return!0}if(r.constructor===RegExp)return r.source===t.source&&r.flags===t.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===t.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===t.toString();if((o=(p=Object.keys(r)).length)!==Object.keys(t).length)return!1;for(n=o;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,p[n]))return!1;for(n=o;0!=n--;){var a=p[n];if(!e(r[a],t[a]))return!1}return!0}return r!=r&&t!=t}},433:(e,r,t)=>{"use strict";var o=t(642);function n(){}function p(){}p.resetWarningCache=n,e.exports=function(){function e(e,r,t,n,p,a){if(a!==o){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function r(){return e}e.isRequired=e;var t={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:r,element:e,elementType:e,instanceOf:r,node:e,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:p,resetWarningCache:n};return t.PropTypes=t,t}},74:(e,r,t)=>{e.exports=t(433)()},642:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},708:e=>{"use strict";e.exports=t},654:r=>{"use strict";r.exports=e},329:e=>{"use strict";e.exports=r}},n={};function p(e){var r=n[e];if(void 0!==r)return r.exports;var t=n[e]={exports:{}};return o[e](t,t.exports,p),t.exports}p.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return p.d(r,{a:r}),r},p.d=(e,r)=>{for(var t in r)p.o(r,t)&&!p.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},p.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),p.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{"use strict";p.r(a),p.d(a,{EditControl:()=>T});var e=p(74),r=(p(654),p(704)),t=p.n(r),o=p(329),n=p.n(o);const i=(0,o.createContext)(null);i.Provider;var s=p(708),c=p.n(s);function u(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function f(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?u(Object(t),!0).forEach((function(r){y(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function y(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var l={onEdited:"draw:edited",onDrawStart:"draw:drawstart",onDrawStop:"draw:drawstop",onDrawVertex:"draw:drawvertex",onEditStart:"draw:editstart",onEditMove:"draw:editmove",onEditResize:"draw:editresize",onEditVertex:"draw:editvertex",onEditStop:"draw:editstop",onDeleted:"draw:deleted",onDeleteStart:"draw:deletestart",onDeleteStop:"draw:deletestop"};function d(e){var r=function(){const e=(0,o.useContext)(i);if(null==e)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return e}(),p=(0,o.useRef)(),a=(0,o.useRef)(e),s=function(t){var o=e.onCreated;(r.layerContainer||r.map).addLayer(t.layer),o&&o(t)};return n().useEffect((function(){var t=r.map,o=e.onMounted;for(var n in l)t.on(l[n],(function(r){var t=Object.keys(l).filter((function(e){return l[e]===r.type}));if(1===t.length){var o=t[0];e[o]&&e[o](r)}}));return t.on(c().Draw.Event.CREATED,s),p.current=b(e,r),t.addControl(p.current),o&&o(p.current),function(){for(var r in t.off(c().Draw.Event.CREATED,s),l)e[r]&&t.off(l[r],e[r])}}),[]),n().useEffect((function(){if(!t()(e.draw,a.current.draw)||!t()(e.edit,a.current.edit)||e.position!==a.current.position){var o=r.map;p.current.remove(o),p.current=b(e,r),p.current.addTo(o);var n=e.onMounted;n&&n(p.current)}}),[e.draw,e.edit,e.position]),null}function b(e,r){var t=r.layerContainer,o=e.draw,n=e.edit,p=e.position,a={edit:f(f({},n),{},{featureGroup:t})};return o&&(a.draw=f({},o)),p&&(a.position=p),new s.Control.Draw(a)}d.propTypes=f(f({},Object.keys(l).reduce((function(r,t){return r[t]=e.PropTypes.func,r}),{})),{},{onCreated:e.PropTypes.func,onMounted:e.PropTypes.func,draw:e.PropTypes.shape({polyline:e.PropTypes.oneOfType([e.PropTypes.object,e.PropTypes.bool]),polygon:e.PropTypes.oneOfType([e.PropTypes.object,e.PropTypes.bool]),rectangle:e.PropTypes.oneOfType([e.PropTypes.object,e.PropTypes.bool]),circle:e.PropTypes.oneOfType([e.PropTypes.object,e.PropTypes.bool]),marker:e.PropTypes.oneOfType([e.PropTypes.object,e.PropTypes.bool])}),edit:e.PropTypes.shape({edit:e.PropTypes.oneOfType([e.PropTypes.object,e.PropTypes.bool]),remove:e.PropTypes.oneOfType([e.PropTypes.object,e.PropTypes.bool]),poly:e.PropTypes.oneOfType([e.PropTypes.object,e.PropTypes.bool]),allowIntersection:e.PropTypes.bool}),position:e.PropTypes.oneOf(["topright","topleft","bottomright","bottomleft"]),leaflet:e.PropTypes.shape({map:e.PropTypes.instanceOf(s.Map),layerContainer:e.PropTypes.shape({addLayer:e.PropTypes.func.isRequired,removeLayer:e.PropTypes.func.isRequired})})});const T=d})(),a})()));