/*! * Copyright (c) 2017 Sumit Kumar * leaflet.pm.(https://github.com/codeofsumit/leaflet.pm) * license: MIT * version: v0.25.0 */ !function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=18)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=void 0;var n=function(t){return t&&t.__esModule?t:{"default":t}}(r(10)),i=L.Class.extend({includes:[n["default"]],options:{snappable:!0,snapDistance:20,cursorMarker:!0,finishOnDoubleClick:!1,finishOn:null,allowSelfIntersection:!0,templineStyle:{},hintlineStyle:{dashArray:"5,5"},markerStyle:{draggable:!0}},initialize:function(t){var e=this;this._map=t,this.shapes=["Marker","Line","Poly","Rectangle","Circle","Cut"],this.shapes.forEach(function(t){e[t]=new L.PM.Draw[t](e._map)})},setPathOptions:function(t){this.options.pathOptions=t},getShapes:function(){return this.shapes},enable:function(t,e){if(!t)throw new Error("Error: Please pass a shape as a parameter. Possible shapes are: ".concat(this.getShapes().join(",")));this.disable(),this[t].enable(e)},disable:function(){var t=this;this.shapes.forEach(function(e){t[e].disable()})},addControls:function(){var t=this;this.shapes.forEach(function(e){t[e].addButton()})}});e["default"]=i},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=void 0;var i=n(r(10)),o=n(r(36)),a=L.Class.extend({includes:[o["default"],i["default"]],options:{snappable:!0,snapDistance:20,allowSelfIntersection:!0,draggable:!0},isPolygon:function(){return this._layer instanceof L.Polygon}});e["default"]=a},function(t,e,r){"use strict";function n(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function i(t,e,r){void 0===r&&(r={});return n({type:"Point",coordinates:t},e,r)}function o(t,e,r){void 0===r&&(r={});for(var i=0,o=t;i=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r},e.radiansToLength=c,e.lengthToRadians=f,e.lengthToDegrees=function(t,e){return p(f(t,e))},e.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},e.radiansToDegrees=p,e.degreesToRadians=function(t){return t%360*Math.PI/180},e.convertLength=function(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return c(f(t,e),r)},e.convertArea=function(t,r,n){if(void 0===r&&(r="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=e.areaFactors[r];if(!i)throw new Error("invalid original units");var o=e.areaFactors[n];if(!o)throw new Error("invalid final units");return t/i*o},e.isNumber=d,e.isObject=function(t){return!!t&&t.constructor===Object},e.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(function(t){if(!d(t))throw new Error("bbox must only contain numbers")})},e.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")},e.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},e.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},e.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},e.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},e.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},e.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},e.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}},function(t,e,r){var n=r(16)(Object,"create");t.exports=n},function(t,e,r){var n=r(69);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},function(t,e,r){var n=r(75);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},function(t,e){var r=Array.isArray;t.exports=r},function(t,e,r){var n=r(15),i=r(48),o="[object Symbol]";t.exports=function(t){return"symbol"==typeof t||i(t)&&n(t)==o}},function(t,e,r){var n=r(9).Symbol;t.exports=n},function(t,e,r){var n=r(44),i="object"==typeof self&&self&&self.Object===Object&&self,o=n||i||Function("return this")();t.exports=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=void 0;var n={_initSnappableMarkers:function(){this.options.snapDistance=this.options.snapDistance||30,this._assignEvents(this._markers),this._layer.off("pm:dragstart",this._unsnap,this),this._layer.on("pm:dragstart",this._unsnap,this)},_assignEvents:function(t){var e=this;t.forEach(function(t){Array.isArray(t)?e._assignEvents(t):(t.off("drag",e._handleSnapping,e),t.on("drag",e._handleSnapping,e),t.off("dragend",e._cleanupSnapping,e),t.on("dragend",e._cleanupSnapping,e))})},_unsnap:function(){delete this._snapLatLng},_cleanupSnapping:function(){delete this._snapList,this._map.off("pm:remove",this._handleSnapLayerRemoval,this),this.debugIndicatorLines&&this.debugIndicatorLines.forEach(function(t){t.remove()})},_handleSnapLayerRemoval:function(t){var e=t.layer,r=this._snapList.findIndex(function(t){return t._leaflet_id===e._leaflet_id});this._snapList.splice(r,1)},_handleSnapping:function(t){var e=this;if(t.originalEvent.altKey)return!1;if(this._snapList===undefined&&this._createSnapList(t),this._snapList.length<=0)return!1;var r,n=t.target,i=this._calcClosestLayer(n.getLatLng(),this._snapList),o=i.layer instanceof L.Marker||i.layer instanceof L.CircleMarker;r=o?i.latlng:this._checkPrioritiySnapping(i);var a=this.options.snapDistance,s={marker:n,snapLatLng:r,segment:i.segment,layer:this._layer,layerInteractedWith:i.layer};if(i.distance0})).filter(function(t){return!t._pmTempLayer}),this._otherSnapLayers?this._snapList=e.concat(this._otherSnapLayers):this._snapList=e,this.debugIndicatorLines=r},_calcClosestLayer:function(t,e){var r=this,n={};return e.forEach(function(e,i){var o=r._calcLayerDistances(t,e);r.debugIndicatorLines[i].setLatLngs([t,o.latlng]),(n.distance===undefined||o.distance=0&&u<=1&&(p.onLine1=!0),h>=0&&h<=1&&(p.onLine2=!0),!(!p.onLine1||!p.onLine2)&&[p.x,p.y])}(t[r][0],t[r][1],t[r+1][0],t[r+1][1],e[o][0],e[o][1],e[o+1][0],e[o+1][1]);a&&i.features.push(n.point([a[0],a[1]]))}})}),i}},function(t,e,r){"use strict";function n(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function i(t,e,r){void 0===r&&(r={});return n({type:"Point",coordinates:t},e,r)}function o(t,e,r){void 0===r&&(r={});for(var i=0,o=t;i=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r},e.radiansToLength=c,e.lengthToRadians=f,e.lengthToDegrees=function(t,e){return p(f(t,e))},e.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},e.radiansToDegrees=p,e.degreesToRadians=function(t){return t%360*Math.PI/180},e.convertLength=function(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return c(f(t,e),r)},e.convertArea=function(t,r,n){if(void 0===r&&(r="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=e.areaFactors[r];if(!i)throw new Error("invalid original units");var o=e.areaFactors[n];if(!o)throw new Error("invalid final units");return t/i*o},e.isNumber=d,e.isObject=function(t){return!!t&&t.constructor===Object},e.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(function(t){if(!d(t))throw new Error("bbox must only contain numbers")})},e.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")},e.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},e.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},e.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},e.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},e.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},e.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},e.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}},function(t,e,r){var n;!function(e){t.exports=e()}(function(){return function t(e,r,i){function o(s,l){if(!r[s]){if(!e[s]){if(!l&&("function"==typeof n&&n))return n(s,!0);if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var h=r[s]={exports:{}};e[s][0].call(h.exports,function(t){var r=e[s][1][t];return o(r||t)},h,h.exports,t,e,r,i)}return r[s].exports}for(var a="function"==typeof n&&n,s=0;s0&&(e.balanceFactor+=t.balanceFactor),e}function i(t){var e=t.left;return t.left=e.right,t.left&&(t.left.parent=t),e.parent=t.parent,e.parent&&(e.parent.left===t?e.parent.left=e:e.parent.right=e),t.parent=e,e.right=t,t.balanceFactor-=1,e.balanceFactor>0&&(t.balanceFactor-=e.balanceFactor),e.balanceFactor-=1,t.balanceFactor<0&&(e.balanceFactor+=t.balanceFactor),e}var o=function(t,e){void 0===e&&(e=!1),this._comparator=t||function(t,e){return t>e?1:t0?(t(e=r.pop(),i++),e=e.right):n=!0;return this},o.prototype.keys=function(){for(var t=this._root,e=[],r=[],n=!1;!n;)t?(e.push(t),t=t.left):e.length>0?(t=e.pop(),r.push(t.key),t=t.right):n=!0;return r},o.prototype.values=function(){for(var t=this._root,e=[],r=[],n=!1;!n;)t?(e.push(t),t=t.left):e.length>0?(t=e.pop(),r.push(t.data),t=t.right):n=!0;return r},o.prototype.at=function(t){for(var e=this._root,r=[],n=!1,i=0;!n;)if(e)r.push(e),e=e.left;else if(r.length>0){if(e=r.pop(),i===t)return e;i++,e=e.right}else n=!0;return null},o.prototype.minNode=function(){var t=this._root;if(!t)return null;for(;t.left;)t=t.left;return t},o.prototype.maxNode=function(){var t=this._root;if(!t)return null;for(;t.right;)t=t.right;return t},o.prototype.min=function(){var t=this._root;if(!t)return null;for(;t.left;)t=t.left;return t.key},o.prototype.max=function(){var t=this._root;if(!t)return null;for(;t.right;)t=t.right;return t.key},o.prototype.isEmpty=function(){return!this._root},o.prototype.pop=function(){var t=this._root,e=null;if(t){for(;t.left;)t=t.left;e={key:t.key,data:t.data},this.remove(t.key)}return e},o.prototype.find=function(t){for(var e,r=this._root,n=this._comparator;r;){if(0===(e=n(t,r.key)))return r;r=e<0?r.left:r.right}return null},o.prototype.insert=function(t,e){var r=this;if(!this._root)return this._root={parent:null,left:null,right:null,balanceFactor:0,key:t,data:e},this._size++,this._root;var o=this._comparator,a=this._root,s=null,l=0;if(this._noDuplicates)for(;a;){if(l=o(t,a.key),s=a,0===l)return null;a=l<0?a.left:a.right}else for(;a;)s=a,a=(l=o(t,a.key))<=0?a.left:a.right;var u,h={left:null,right:null,balanceFactor:0,parent:s,key:t,data:e};for(l<=0?s.left=h:s.right=h;s&&((l=o(s.key,t))<0?s.balanceFactor-=1:s.balanceFactor+=1,0!==s.balanceFactor);){if(s.balanceFactor<-1){1===s.right.balanceFactor&&i(s.right),u=n(s),s===r._root&&(r._root=u);break}if(s.balanceFactor>1){-1===s.left.balanceFactor&&n(s.left),u=i(s),s===r._root&&(r._root=u);break}s=s.parent}return this._size++,h},o.prototype.remove=function(t){var e=this;if(!this._root)return null;for(var r=this._root,o=this._comparator,a=0;r&&0!==(a=o(t,r.key));)r=a<0?r.left:r.right;if(!r)return null;var s,l,u=r.key;if(r.left){for(s=r.left;s.left||s.right;){for(;s.right;)s=s.right;r.key=s.key,r.data=s.data,s.left&&(r=s,s=s.left)}r.key=s.key,r.data=s.data,r=s}if(r.right){for(l=r.right;l.left||l.right;){for(;l.left;)l=l.left;r.key=l.key,r.data=l.data,l.right&&(r=l,l=l.right)}r.key=l.key,r.data=l.data,r=l}for(var h,c=r.parent,f=r;c&&(c.left===f?c.balanceFactor-=1:c.balanceFactor+=1,c.balanceFactor<-1?(1===c.right.balanceFactor&&i(c.right),h=n(c),c===e._root&&(e._root=h),c=h):c.balanceFactor>1&&(-1===c.left.balanceFactor&&n(c.left),h=i(c),c===e._root&&(e._root=h),c=h),-1!==c.balanceFactor&&1!==c.balanceFactor);)f=c,c=c.parent;return r.parent&&(r.parent.left===r?r.parent.left=null:r.parent.right=null),r===this._root&&(this._root=null),this._size--,u},o.prototype.load=function(t,e){var r=this;if(void 0===t&&(t=[]),void 0===e&&(e=[]),Array.isArray(t))for(var n=0,i=t.length;ne?1:0},this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)}e.exports=n,e.exports["default"]=n,n.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0===this.length)return undefined;var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,o=e[i];if(r(n,o)>=0)break;e[t]=o,t=i}e[t]=n},_down:function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t=0)break;e[t]=s,t=o}e[t]=i}}},{}],4:[function(t,e,r){"use strict";var n=t("./signed_area");e.exports=function(t,e){var r=t.point,i=e.point;return r[0]>i[0]?1:r[0]i[1]?1:-1:function(t,e,r,i){return t.left!==e.left?t.left?1:-1:0!==n(r,t.otherEvent.point,e.otherEvent.point)?t.isBelow(e.otherEvent.point)?-1:1:!t.isSubject&&e.isSubject?1:-1}(t,e,r)}},{"./signed_area":16}],5:[function(t,e,r){"use strict";var n=t("./signed_area"),i=t("./compare_events"),o=t("./equals");e.exports=function(t,e){if(t===e)return 0;if(0!==n(t.point,t.otherEvent.point,e.point)||0!==n(t.point,t.otherEvent.point,e.otherEvent.point))return o(t.point,e.point)?t.isBelow(e.otherEvent.point)?-1:1:t.point[0]===e.point[0]?t.point[1]e.contourId?1:-1):1===i(t,e)?1:-1}},{"./compare_events":4,"./equals":10,"./signed_area":16}],6:[function(t,e,r){"use strict";function n(t,e){switch(t.type){case i.NORMAL:switch(e){case a:return!t.otherInOut;case s:return t.otherInOut;case l:return t.isSubject&&t.otherInOut||!t.isSubject&&!t.otherInOut;case u:return!0}break;case i.SAME_TRANSITION:return e===a||e===s;case i.DIFFERENT_TRANSITION:return e===l;case i.NON_CONTRIBUTING:return!1}return!1}var i=t("./edge_type"),o=t("./operation"),a=o.INTERSECTION,s=o.UNION,l=o.DIFFERENCE,u=o.XOR;e.exports=function(t,e,r){null===e?(t.inOut=!1,t.otherInOut=!0):(t.isSubject===e.isSubject?(t.inOut=!e.inOut,t.otherInOut=e.otherInOut):(t.inOut=!e.otherInOut,t.otherInOut=e.isVertical()?!e.inOut:e.inOut),e&&(t.prevInResult=!n(e,r)||e.isVertical()?e.prevInResult:e)),t.inResult=n(t,r)}},{"./edge_type":9,"./operation":13}],7:[function(t,e,r){"use strict";function n(t,e,r,n){var i=t+1,o=e.length;if(i>o-1)return t-1;for(var a=e[t].point,s=e[i].point;i=n;)i--;return i}var i=t("./compare_events"),o=t("./operation");e.exports=function(t,e){var r,a,s,l=function(t){var e,r,n,o,a=[];for(r=0,n=t.length;r1?h[h.length-1].push(c[0]):h.push(c):e!==o.DIFFERENCE||l[r].isSubject||0!==h.length?0===h.length?h.push([[c]]):h[h.length-1].push(c[0]):h.push(c);var f=h.length-1,p=r,d=l[r].point;for(c[0].push(d);p>=r;)s=l[p],u[p]=!0,s.left?(s.resultInOut=!1,s.contourId=f):(s.otherEvent.resultInOut=!0,s.otherEvent.contourId=f),u[p=s.pos]=!0,c[0].push(l[p].point),p=n(p,l,u,r);s=l[p=-1===p?r:p],u[p]=u[s.pos]=!0,s.otherEvent.resultInOut=!0,s.otherEvent.contourId=f}return h}},{"./compare_events":4,"./operation":13}],8:[function(t,e,r){"use strict";var n=t("./sweep_event"),i=t("./equals"),o=t("./compare_events");e.exports=function(t,e,r){var a=new n(e,!1,t,t.isSubject),s=new n(e,!0,t.otherEvent,t.isSubject);return i(t.point,t.otherEvent.point)&&console.warn("what is that, a collapsed segment?",t),a.contourId=s.contourId=t.contourId,o(s,t.otherEvent)>0&&(t.otherEvent.left=!0,s.left=!1),t.otherEvent.otherEvent=s,t.otherEvent=a,r.push(s),r.push(a),r}},{"./compare_events":4,"./equals":10,"./sweep_event":18}],9:[function(t,e,r){"use strict";e.exports={NORMAL:0,NON_CONTRIBUTING:1,SAME_TRANSITION:2,DIFFERENT_TRANSITION:3}},{}],10:[function(t,e,r){"use strict";e.exports=function(t,e){return t[0]===e[0]&&t[1]===e[1]}},{}],11:[function(t,e,r){"use strict";function n(t,e,r,n,i,s){var h,c,f,p,d,g;for(h=0,c=t.length-1;h0?g.left=!0:d.left=!0;var _=f[0],m=f[1];i[0]=u(i[0],_),i[1]=u(i[1],m),i[2]=l(i[2],_),i[3]=l(i[3],m),n.push(d),n.push(g)}}var i=t("tinyqueue"),o=t("./sweep_event"),a=t("./compare_events"),s=t("./operation"),l=Math.max,u=Math.min,h=0;e.exports=function(t,e,r,o,l){var u,c,f,p,d,g,_=new i(null,a);for(f=0,p=t.length;fn[2]||n[0]>r[2]||r[1]>n[3]||n[1]>r[3])&&(i===s.INTERSECTION?o=l:i===s.DIFFERENCE?o=t:i!==s.UNION&&i!==s.XOR||(o=t.concat(e))),o}(t,e,u,h,r))return n===l?null:n;var f=i(c,t,e,u,h,r);return o(f,r)}var i=t("./subdivide_segments"),o=t("./connect_edges"),a=t("./fill_queue"),s=t("./operation"),l=[];n.union=function(t,e){return n(t,e,s.UNION)},n.diff=function(t,e){return n(t,e,s.DIFFERENCE)},n.xor=function(t,e){return n(t,e,s.XOR)},n.intersection=function(t,e){return n(t,e,s.INTERSECTION)},n.operations=s,e.exports=n,e.exports["default"]=n},{"./connect_edges":7,"./fill_queue":11,"./operation":13,"./subdivide_segments":17}],13:[function(t,e,r){"use strict";e.exports={INTERSECTION:0,UNION:1,DIFFERENCE:2,XOR:3}},{}],14:[function(t,e,r){"use strict";var n=t("./divide_segment"),i=t("./segment_intersection"),o=t("./equals"),a=t("./compare_events"),s=t("./edge_type");e.exports=function(t,e,r){var l=i(t.point,t.otherEvent.point,e.point,e.otherEvent.point),u=l?l.length:0;if(0===u)return 0;if(1===u&&(o(t.point,e.point)||o(t.otherEvent.point,e.otherEvent.point)))return 0;if(2===u&&t.isSubject===e.isSubject)return 0;if(1===u)return o(t.point,l[0])||o(t.otherEvent.point,l[0])||n(t,l[0],r),o(e.point,l[0])||o(e.otherEvent.point,l[0])||n(e,l[0],r),1;var h=[],c=!1,f=!1;return o(t.point,e.point)?c=!0:1===a(t,e)?h.push(e,t):h.push(t,e),o(t.otherEvent.point,e.otherEvent.point)?f=!0:1===a(t.otherEvent,e.otherEvent)?h.push(e.otherEvent,t.otherEvent):h.push(t.otherEvent,e.otherEvent),c&&f||c?(e.type=s.NON_CONTRIBUTING,t.type=e.inOut===t.inOut?s.SAME_TRANSITION:s.DIFFERENT_TRANSITION,c&&!f&&n(h[1].otherEvent,h[0].point,r),2):f?(n(h[0],h[1].point,r),3):h[0]!==h[3].otherEvent?(n(h[0],h[1].point,r),n(h[1],h[2].point,r),3):(n(h[0],h[1].point,r),n(h[3].otherEvent,h[2].point,r),3)}},{"./compare_events":4,"./divide_segment":8,"./edge_type":9,"./equals":10,"./segment_intersection":15}],15:[function(t,e,r){"use strict";function n(t,e){return t[0]*e[1]-t[1]*e[0]}function i(t,e){return t[0]*e[0]+t[1]*e[1]}e.exports=function(t,e,r,o,a){function s(t,e,r){return[t[0]+e*r[0],t[1]+e*r[1]]}var l=[e[0]-t[0],e[1]-t[1]],u=[o[0]-r[0],o[1]-r[1]],h=[r[0]-t[0],r[1]-t[1]],c=n(l,u),f=c*c,p=i(l,l);if(f>1e-9*p*i(u,u)){var d=n(h,u)/c;if(d<0||d>1)return null;var g=n(h,l)/c;return g<0||g>1?null:a?null:[s(t,d,l)]}var _=i(h,h);if(c=n(h,l),(f=c*c)>1e-9*p*_)return null;var m=i(l,h)/p,y=m+i(l,u)/p,v=Math.min(m,y),b=Math.max(m,y);return v<=1&&b>=0?1===v?a?null:[s(t,v>0?v:0,l)]:0===b?a?null:[s(t,b<1?b:1,l)]:a&&0===v&&1===b?null:[s(t,v>0?v:0,l),s(t,b<1?b:1,l)]:null}},{}],16:[function(t,e,r){"use strict";e.exports=function(t,e,r){return(t[0]-r[0])*(e[1]-r[1])-(e[0]-r[0])*(t[1]-r[1])}},{}],17:[function(t,e,r){"use strict";var n=t("avl"),i=t("./compute_fields"),o=t("./possible_intersection"),a=t("./compare_segments"),s=t("./operation");e.exports=function(t,e,r,l,u,h){for(var c,f,p,d=new n(a),g=[],_=Math.min(l[2],u[2]),m=s.INTERSECTION,y=s.DIFFERENCE;t.length;){var v=t.pop();if(g.push(v),h===m&&v.point[0]>_||h===y&&v.point[0]>l[2])break;if(v.left){f=c=d.insert(v),c=c!==(p=d.minNode())?d.prev(c):null,f=d.next(f);var b,L=c?c.key:null;if(i(v,L,h),f&&2===o(v,f.key,t)&&(i(v,L,h),i(v,f.key,h)),c&&2===o(c.key,v,t)){var k=c;b=(k=k!==p?d.prev(k):null)?k.key:null,i(L,b,h),i(v,L,h)}}else v=v.otherEvent,f=c=d.find(v),c&&f&&(c=c!==p?d.prev(c):null,f=d.next(f),d.remove(v),f&&c&&o(c.key,f.key,t))}return g}},{"./compare_segments":5,"./compute_fields":6,"./operation":13,"./possible_intersection":14,avl:2}],18:[function(t,e,r){"use strict";function n(t,e,r,n,o){this.left=e,this.point=t,this.otherEvent=r,this.isSubject=n,this.type=o||i.NORMAL,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.inResult=!1,this.resultInOut=!1,this.isExteriorRing=!0}var i=t("./edge_type");n.prototype={isBelow:function(t){var e=this.point,r=this.otherEvent.point;return this.left?(e[0]-t[0])*(r[1]-t[1])-(r[0]-t[0])*(e[1]-t[1])>0:(r[0]-t[0])*(e[1]-t[1])-(e[0]-t[0])*(r[1]-t[1])>0},isAbove:function(t){return!this.isBelow(t)},isVertical:function(){return this.point[0]===this.otherEvent.point[0]},clone:function(){var t=new n(this.point,this.left,this.otherEvent,this.isSubject,this.type);return t.inResult=this.inResult,t.prevInResult=this.prevInResult,t.isExteriorRing=this.isExteriorRing,t.inOut=this.inOut,t.otherInOut=this.otherInOut,t}},e.exports=n},{"./edge_type":9}]},{},[1])(1)})},function(t,e,r){"use strict";function n(t,e,r){if(null!==t)for(var i,o,a,s,l,u,h,c,f=0,p=0,d=t.type,g="FeatureCollection"===d,_="Feature"===d,m=g?t.features.length:1,y=0;yl||p>u||d>c)return s=n,l=r,u=p,c=d,void(o=0);var g=h.lineString([s,n],t.properties);if(!1===e(g,r,i,d,o))return!1;o++,s=n})&&void 0}}})}function u(t,e){if(!t)throw new Error("geojson is required");s(t,function(t,r,n){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,r,n,0,0))return!1;break;case"Polygon":for(var a=0;a>>0,n=arguments[1],i=0;i>>0,n=arguments[1],i=0;i0&&arguments[0]!==undefined?arguments[0]:"Poly",e=arguments.length>1?arguments[1]:undefined;this.Draw.enable(t,e)},disableDraw:function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"Poly";this.Draw.disable(t)},setPathOptions:function(t){this.Draw.setPathOptions(t)},removeLayer:function(t){var e=t.target;e._layers||e.pm&&e.pm.dragging()||t.target.remove()},toggleGlobalRemovalMode:function(){var t=this;this.globalRemovalEnabled()?(this._globalRemovalMode=!1,this.map.eachLayer(function(e){e.off("click",t.removeLayer)})):(this._globalRemovalMode=!0,this.map.eachLayer(function(e){!e.pm||e.pm.options&&e.pm.options.preventMarkerRemoval||e.on("click",t.removeLayer)})),this.Toolbar.toggleButton("deleteLayer",this._globalRemovalMode)},globalRemovalEnabled:function(){return this._globalRemovalMode},globalEditEnabled:function(){return this._globalEditMode},enableGlobalEditMode:function(t){var e=[];this.map.eachLayer(function(t){(t instanceof L.Polyline||t instanceof L.Marker||t instanceof L.Circle)&&e.push(t)}),e=(e=e.filter(function(t){return!!t.pm})).filter(function(t){return!t._pmTempLayer}),this._globalEditMode=!0,e.forEach(function(e){e.pm.enable(t)}),this.Toolbar.toggleButton("editPolygon",this._globalEditMode),this._fireEditModeEvent(!0)},disableGlobalEditMode:function(){var t=[];this.map.eachLayer(function(e){(e instanceof L.Polyline||e instanceof L.Marker||e instanceof L.Circle)&&t.push(e)}),t=(t=t.filter(function(t){return!!t.pm})).filter(function(t){return!t._pmTempLayer}),this._globalEditMode=!1,t.forEach(function(t){t.pm.disable()}),this.Toolbar.toggleButton("editPolygon",this._globalEditMode),this._fireEditModeEvent(!1)},_fireEditModeEvent:function(t){this.map.fire("pm:globaleditmodetoggled",{enabled:t,map:this.map})},toggleGlobalEditMode:function(t){console.log("toggle global edit mode",t),this.globalEditEnabled()?this.disableGlobalEditMode():this.enableGlobalEditMode(t)}});e["default"]=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=void 0;var n=function(t){return t&&t.__esModule?t:{"default":t}}(r(24));L.Control.PMButton=n["default"];var i=L.Class.extend({options:{drawMarker:!0,drawPolygon:!0,drawPolyline:!0,drawCircle:!0,drawRectangle:!0,editMode:!0,cutPolygon:!0,dragPolygon:!1,removalMode:!0,position:"topleft"},initialize:function(t){this.map=t,this.buttons={},this.isVisible=!1,this.container=L.DomUtil.create("div","leaflet-pm-toolbar leaflet-bar leaflet-control"),this._defineButtons()},getButtons:function(){return this.buttons},addControls:function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.options;"undefined"!=typeof t.editPolygon&&(t.editMode=t.editPolygon),"undefined"!=typeof t.deleteLayer&&(t.removalMode=t.deleteLayer),L.Util.setOptions(this,t),this._showHideButtons(),this.isVisible=!0},removeControls:function(){var t=this.getButtons();for(var e in t)t[e].remove();this.isVisible=!1},toggleControls:function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.options;this.isVisible?this.removeControls():this.addControls(t)},_addButton:function(t,e){return this.buttons[t]=e,this.options[t]=this.options[t]||!1,this.buttons[t]},triggerClickOnToggledButtons:function(t){for(var e in this.buttons)this.buttons[e]!==t&&this.buttons[e].toggled()&&this.buttons[e]._triggerClick()},toggleButton:function(t,e){return"editPolygon"===t&&(t="editMode"),"deleteLayer"===t&&(t="removalMode"),this.triggerClickOnToggledButtons(this.buttons[t]),this.buttons[t].toggle(e)},_defineButtons:function(){var t=this,e={className:" leaflet-pm-icon-delete",onClick:function(){},afterClick:function(){t.map.pm.toggleGlobalRemovalMode()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},r={className:"leaflet-pm-icon-polygon",onClick:function(){},afterClick:function(){t.map.pm.Draw.Poly.toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},n={className:"leaflet-pm-icon-cut",onClick:function(){},afterClick:function(){t.map.pm.Draw.Cut.toggle({snappable:!0,cursorMarker:!0,allowSelfIntersection:!1})},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},i={className:"leaflet-pm-icon-marker",onClick:function(){},afterClick:function(){t.map.pm.Draw.Marker.toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},o={className:"leaflet-pm-icon-polyline",onClick:function(){},afterClick:function(){t.map.pm.Draw.Line.toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},a={className:"leaflet-pm-icon-circle",onClick:function(){},afterClick:function(){t.map.pm.Draw.Circle.toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},s={className:"leaflet-pm-icon-rectangle",onClick:function(){},afterClick:function(){t.map.pm.Draw.Rectangle.toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},l={className:"leaflet-pm-icon-edit",onClick:function(){},afterClick:function(){t.map.pm.toggleGlobalEditMode()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},u={className:"leaflet-pm-icon-drag",onClick:function(){},afterClick:function(){},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position};this._addButton("drawMarker",new L.Control.PMButton(i)),this._addButton("drawPolyline",new L.Control.PMButton(o)),this._addButton("drawRectangle",new L.Control.PMButton(s)),this._addButton("drawPolygon",new L.Control.PMButton(r)),this._addButton("drawCircle",new L.Control.PMButton(a)),this._addButton("cutPolygon",new L.Control.PMButton(n)),this._addButton("editMode",new L.Control.PMButton(l)),this._addButton("dragPolygon",new L.Control.PMButton(u)),this._addButton("removalMode",new L.Control.PMButton(e))},_showHideButtons:function(){this.removeControls();var t=this.getButtons();for(var e in t)this.options[e]&&(t[e].setPosition(this.options.position),t[e].addTo(this.map))}});e["default"]=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=void 0;var n=L.Control.extend({options:{position:"topleft"},initialize:function(t){this._button=L.Util.setOptions(this,t)},onAdd:function(t){return this._map=t,this._container=this._map.pm.Toolbar.container,this.buttonsDomNode=this._makeButton(this._button),this._container.appendChild(this.buttonsDomNode),this._container},onRemove:function(){return this.buttonsDomNode.remove(),this._container},getText:function(){return this._button.text},getIconUrl:function(){return this._button.iconUrl},destroy:function(){this._button={},this._update()},toggle:function(t){return this._button.toggleStatus="boolean"==typeof t?t:!this._button.toggleStatus,this._applyStyleClasses(),this._button.toggleStatus},toggled:function(){return this._button.toggleStatus},onCreate:function(){this.toggle(!1)},_triggerClick:function(t){this._button.onClick(t),this._clicked(t),this._button.afterClick(t)},_makeButton:function(t){var e=this,r=L.DomUtil.create("a","leaflet-buttons-control-button",this._container);t.toggleStatus&&L.DomUtil.addClass(r,"active");var n=L.DomUtil.create("div","control-icon",r);return t.iconUrl&&n.setAttribute("src",t.iconUrl),t.className&&L.DomUtil.addClass(n,t.className),L.DomEvent.addListener(r,"click",function(){e._button.disableOtherButtons&&e._map.pm.Toolbar.triggerClickOnToggledButtons(e)}),L.DomEvent.addListener(r,"click",this._triggerClick,this),L.DomEvent.disableClickPropagation(r),r},_applyStyleClasses:function(){this._container&&(this._button.toggleStatus?L.DomUtil.addClass(this.buttonsDomNode,"active"):L.DomUtil.removeClass(this.buttonsDomNode,"active"))},_clicked:function(){this._button.doToggle&&this.toggle()}});e["default"]=n},function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{"default":t}}(r(0));n["default"].Marker=n["default"].extend({initialize:function(t){this._map=t,this._shape="Marker",this.toolbarButtonName="drawMarker"},enable:function(t){L.Util.setOptions(this,t),this._enabled=!0,this._map.on("click",this._createMarker,this),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!0),this._hintMarker=L.marker([0,0],this.options.markerStyle),this._hintMarker._pmTempLayer=!0,this._hintMarker.addTo(this._map),this._layer=this._hintMarker,this._map.on("mousemove",this._syncHintMarker,this),this._map.fire("pm:drawstart",{shape:this._shape,workingLayer:this._layer}),this._map.eachLayer(function(t){t instanceof L.Marker&&t.pm&&t.pm.enable()})},disable:function(){this._enabled&&(this._map.off("click",this._createMarker,this),this._hintMarker.remove(),this._map.off("mousemove",this._syncHintMarker,this),this._map.eachLayer(function(t){t instanceof L.Marker&&t.pm&&!t._pmTempLayer&&t.pm.disable()}),this._map.fire("pm:drawend",{shape:this._shape}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this._enabled=!1)},enabled:function(){return this._enabled},toggle:function(t){this.enabled()?this.disable():this.enable(t)},_createMarker:function(t){if(t.latlng){this._hintMarker._snapped||this._hintMarker.setLatLng(t.latlng);var e=this._hintMarker.getLatLng(),r=new L.Marker(e,this.options.markerStyle);r.addTo(this._map),r.pm.enable(),this._map.fire("pm:create",{shape:this._shape,marker:r,layer:r}),this._cleanupSnapping()}},_syncHintMarker:function(t){if(this._hintMarker.setLatLng(t.latlng),this.options.snappable){var e=t;e.target=this._hintMarker,this._handleSnapping(e)}}})},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}var i=n(r(11)),o=n(r(0));o["default"].Line=o["default"].extend({initialize:function(t){this._map=t,this._shape="Line",this.toolbarButtonName="drawPolyline",this._doesSelfIntersect=!1},enable:function(t){L.Util.setOptions(this,t),this.options.finishOnDoubleClick&&!this.options.finishOn&&(this.options.finishOn="dblclick"),this._enabled=!0,this._layerGroup=new L.LayerGroup,this._layerGroup._pmTempLayer=!0,this._layerGroup.addTo(this._map),this._layer=L.polyline([],this.options.templineStyle),this._layer._pmTempLayer=!0,this._layerGroup.addLayer(this._layer),this._hintline=L.polyline([],this.options.hintlineStyle),this._hintline._pmTempLayer=!0,this._layerGroup.addLayer(this._hintline),this._hintMarker=L.marker(this._map.getCenter(),{icon:L.divIcon({className:"marker-icon cursor-marker"})}),this._hintMarker._pmTempLayer=!0,this._layerGroup.addLayer(this._hintMarker),this.options.cursorMarker&&L.DomUtil.addClass(this._hintMarker._icon,"visible"),this._map._container.style.cursor="crosshair",this._map.on("click",this._createVertex,this),this.options.finishOn&&this._map.on(this.options.finishOn,this._finishShape,this),"dblclick"===this.options.finishOn&&(this.tempMapDoubleClickZoomState=this._map.doubleClickZoom._enabled,this.tempMapDoubleClickZoomState&&this._map.doubleClickZoom.disable()),this._map.on("mousemove",this._syncHintMarker,this),this._hintMarker.on("move",this._syncHintLine,this),this._map.fire("pm:drawstart",{shape:this._shape,workingLayer:this._layer}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!0),this._otherSnapLayers=[]},disable:function(){this._enabled&&(this._enabled=!1,this._map._container.style.cursor="",this._map.off("click",this._createVertex,this),this._map.off("mousemove",this._syncHintMarker,this),this.options.finishOn&&this._map.off(this.options.finishOn,this._finishShape,this),this.tempMapDoubleClickZoomState&&this._map.doubleClickZoom.enable(),this._map.removeLayer(this._layerGroup),this._map.fire("pm:drawend",{shape:this._shape}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this.options.snappable&&this._cleanupSnapping())},enabled:function(){return this._enabled},toggle:function(t){this.enabled()?this.disable():this.enable(t)},hasSelfIntersection:function(){return(0,i["default"])(this._layer.toGeoJSON()).features.length>0},_syncHintLine:function(){var t=this._layer.getLatLngs();if(t.length>0){var e=t[t.length-1];this._hintline.setLatLngs([e,this._hintMarker.getLatLng()])}},_syncHintMarker:function(t){if(this._hintMarker.setLatLng(t.latlng),this.options.snappable){var e=t;e.target=this._hintMarker,this._handleSnapping(e)}this.options.allowSelfIntersection||this._handleSelfIntersection()},_handleSelfIntersection:function(){var t=L.polyline(this._layer.getLatLngs());t.addLatLng(this._hintMarker.getLatLng());var e=(0,i["default"])(t.toGeoJSON());this._doesSelfIntersect=e.features.length>0,this._doesSelfIntersect?this._hintline.setStyle({color:"red"}):this._hintline.setStyle(this.options.hintlineStyle)},_createVertex:function(t){if(this.options.allowSelfIntersection||!this._doesSelfIntersect){this._hintMarker._snapped||this._hintMarker.setLatLng(t.latlng);var e=this._hintMarker.getLatLng();if(e.equals(this._layer.getLatLngs()[0]))this._finishShape(t);else{var r=0===this._layer.getLatLngs().length;this._layer.addLatLng(e);var n=this._createMarker(e,r);this._hintline.setLatLngs([e,e]),this._layer.fire("pm:vertexadded",{shape:this._shape,workingLayer:this._layer,marker:n,latlng:e})}}},_finishShape:function(){if(this.options.allowSelfIntersection||!this._doesSelfIntersect){var t=this._layer.getLatLngs(),e=L.polyline(t,this.options.pathOptions).addTo(this._map);this.disable(),this._map.fire("pm:create",{shape:this._shape,layer:e}),this.options.snappable&&this._cleanupSnapping()}},_createMarker:function(t){var e=new L.Marker(t,{draggable:!1,icon:L.divIcon({className:"marker-icon"})});return e._pmTempLayer=!0,this._layerGroup.addLayer(e),e.on("click",this._finishShape,this),e}})},function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{"default":t}}(r(0));n["default"].Poly=n["default"].Line.extend({initialize:function(t){this._map=t,this._shape="Poly",this.toolbarButtonName="drawPolygon"},_finishShape:function(t){if(this.options.allowSelfIntersection||!this._doesSelfIntersect){var e=this._layer.getLatLngs();t&&"dblclick"===t.type&&e.splice(e.length-1,1);var r=L.polygon(e,this.options.pathOptions).addTo(this._map);this.disable(),this._map.fire("pm:create",{shape:this._shape,layer:r}),this._cleanupSnapping(),this._otherSnapLayers.splice(this._tempSnapLayerIndex,1),delete this._tempSnapLayerIndex}},_createMarker:function(t,e){var r=new L.Marker(t,{draggable:!1,icon:L.divIcon({className:"marker-icon"})});return r._pmTempLayer=!0,this._layerGroup.addLayer(r),e&&(r.on("click",this._finishShape,this),this._tempSnapLayerIndex=this._otherSnapLayers.push(r)-1,this.options.snappable&&this._cleanupSnapping()),r}})},function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{"default":t}}(r(0));n["default"].Rectangle=n["default"].extend({initialize:function(t){this._map=t,this._shape="Rectangle",this.toolbarButtonName="drawRectangle"},enable:function(t){if(L.Util.setOptions(this,t),this._enabled=!0,this._layerGroup=new L.LayerGroup,this._layerGroup._pmTempLayer=!0,this._layerGroup.addTo(this._map),this._layer=L.rectangle([[0,0],[0,0]],this.options.pathOptions),this._layer._pmTempLayer=!0,this._startMarker=L.marker([0,0],{icon:L.divIcon({className:"marker-icon rect-start-marker"}),draggable:!0,zIndexOffset:100,opacity:this.options.cursorMarker?1:0}),this._startMarker._pmTempLayer=!0,this._layerGroup.addLayer(this._startMarker),this._hintMarker=L.marker([0,0],{icon:L.divIcon({className:"marker-icon cursor-marker"})}),this._hintMarker._pmTempLayer=!0,this._layerGroup.addLayer(this._hintMarker),this.options.cursorMarker){L.DomUtil.addClass(this._hintMarker._icon,"visible"),this._styleMarkers=[];for(var e=0;e<2;e+=1){var r=L.marker([0,0],{icon:L.divIcon({className:"marker-icon rect-style-marker"}),draggable:!0,zIndexOffset:100});r._pmTempLayer=!0,this._layerGroup.addLayer(r),this._styleMarkers.push(r)}}this._map._container.style.cursor="crosshair",this._map.on("click",this._placeStartingMarkers,this),this._map.on("mousemove",this._syncHintMarker,this),this._map.fire("pm:drawstart",{shape:this._shape,workingLayer:this._layer}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!0),this._otherSnapLayers=[]},disable:function(){this._enabled&&(this._enabled=!1,this._map._container.style.cursor="",this._map.off("click",this._finishShape,this),this._map.off("click",this._placeStartingMarkers,this),this._map.off("mousemove",this._syncHintMarker,this),this._map.removeLayer(this._layerGroup),this._map.fire("pm:drawend",{shape:this._shape}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this.options.snappable&&this._cleanupSnapping())},enabled:function(){return this._enabled},toggle:function(t){this.enabled()?this.disable():this.enable(t)},_placeStartingMarkers:function(t){this._hintMarker._snapped||this._hintMarker.setLatLng(t.latlng);var e=this._hintMarker.getLatLng();L.DomUtil.addClass(this._startMarker._icon,"visible"),this._startMarker.setLatLng(e),this.options.cursorMarker&&this._styleMarkers&&this._styleMarkers.forEach(function(t){L.DomUtil.addClass(t._icon,"visible"),t.setLatLng(e)}),this._map.off("click",this._placeStartingMarkers,this),this._map.on("click",this._finishShape,this),this._setRectangleOrigin()},_setRectangleOrigin:function(){var t=this._startMarker.getLatLng();t&&(this._layerGroup.addLayer(this._layer),this._layer.setLatLngs([t,t]),this._hintMarker.on("move",this._syncRectangleSize,this))},_syncHintMarker:function(t){if(this._hintMarker.setLatLng(t.latlng),this.options.snappable){var e=t;e.target=this._hintMarker,this._handleSnapping(e)}},_syncRectangleSize:function(){var t=this,e=this._startMarker.getLatLng(),r=this._hintMarker.getLatLng();if(this._layer.setBounds([e,r]),this.options.cursorMarker&&this._styleMarkers){var n=[];this._findCorners().forEach(function(e){e.equals(t._startMarker.getLatLng())||e.equals(t._hintMarker.getLatLng())||n.push(e)}),n.forEach(function(e,r){t._styleMarkers[r].setLatLng(e)})}},_finishShape:function(){var t=this._startMarker.getLatLng(),e=this._hintMarker.getLatLng(),r=L.rectangle([t,e],this.options.pathOptions).addTo(this._map);this.disable(),this._map.fire("pm:create",{shape:this._shape,layer:r})},_findCorners:function(){var t=this._layer.getBounds();return[t.getNorthWest(),t.getNorthEast(),t.getSouthEast(),t.getSouthWest()]}})},function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{"default":t}}(r(0));n["default"].Circle=n["default"].extend({initialize:function(t){this._map=t,this._shape="Circle",this.toolbarButtonName="drawCircle"},enable:function(t){L.Util.setOptions(this,t),this.options.radius=0,this._enabled=!0,this._layerGroup=new L.LayerGroup,this._layerGroup._pmTempLayer=!0,this._layerGroup.addTo(this._map),this._layer=L.circle([0,0],this.options.templineStyle),this._layer._pmTempLayer=!0,this._layerGroup.addLayer(this._layer),this._centerMarker=L.marker([0,0],{icon:L.divIcon({className:"marker-icon"}),draggable:!1,zIndexOffset:100}),this._centerMarker._pmTempLayer=!0,this._layerGroup.addLayer(this._centerMarker),this._hintMarker=L.marker([0,0],{icon:L.divIcon({className:"marker-icon cursor-marker"})}),this._hintMarker._pmTempLayer=!0,this._layerGroup.addLayer(this._hintMarker),this.options.cursorMarker&&L.DomUtil.addClass(this._hintMarker._icon,"visible"),this._hintline=L.polyline([],this.options.hintlineStyle),this._hintline._pmTempLayer=!0,this._layerGroup.addLayer(this._hintline),this._map._container.style.cursor="crosshair",this._map.on("click",this._placeCenterMarker,this),this._map.on("mousemove",this._syncHintMarker,this),this._map.fire("pm:drawstart",{shape:this._shape,workingLayer:this._layer}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!0),this._otherSnapLayers=[]},disable:function(){this._enabled&&(this._enabled=!1,this._map._container.style.cursor="",this._map.off("click",this._finishShape,this),this._map.off("click",this._placeCenterMarker,this),this._map.off("mousemove",this._syncHintMarker,this),this._map.removeLayer(this._layerGroup),this._map.fire("pm:drawend",{shape:this._shape}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this.options.snappable&&this._cleanupSnapping())},enabled:function(){return this._enabled},toggle:function(t){this.enabled()?this.disable():this.enable(t)},_syncHintLine:function(){var t=this._centerMarker.getLatLng();this._hintline.setLatLngs([t,this._hintMarker.getLatLng()])},_syncCircleRadius:function(){var t=this._centerMarker.getLatLng(),e=this._hintMarker.getLatLng(),r=t.distanceTo(e);this._layer.setRadius(r)},_syncHintMarker:function(t){if(this._hintMarker.setLatLng(t.latlng),this.options.snappable){var e=t;e.target=this._hintMarker,this._handleSnapping(e)}},_placeCenterMarker:function(t){this._hintMarker._snapped||this._hintMarker.setLatLng(t.latlng);var e=this._hintMarker.getLatLng();this._centerMarker.setLatLng(e),this._map.off("click",this._placeCenterMarker,this),this._map.on("click",this._finishShape,this),this._placeCircleCenter()},_placeCircleCenter:function(){var t=this._centerMarker.getLatLng();t&&(this._layer.setLatLng(t),this._hintMarker.on("move",this._syncHintLine,this),this._hintMarker.on("move",this._syncCircleRadius,this),this._layer.fire("pm:centerplaced",{shape:this._shape,workingLayer:this._layer,latlng:t}))},_finishShape:function(){var t=this._centerMarker.getLatLng(),e=this._hintMarker.getLatLng(),r=t.distanceTo(e),n=L.circle(t,{radius:r}).addTo(this._map);this.disable(),this._map.fire("pm:create",{shape:this._shape,layer:n})},_createMarker:function(t){var e=new L.Marker(t,{draggable:!1,icon:L.divIcon({className:"marker-icon"})});return e._pmTempLayer=!0,this._layerGroup.addLayer(e),e}})},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}var i=n(r(31)),o=n(r(33)),a=n(r(0));a["default"].Cut=a["default"].Poly.extend({initialize:function(t){this._map=t,this._shape="Cut",this.toolbarButtonName="cutPolygon"},_cut:function(t){var e=this,r=this._map._layers;Object.keys(r).map(function(t){return r[t]}).filter(function(t){return t.pm}).filter(function(t){return t instanceof L.Polygon}).filter(function(e){return e!==t}).filter(function(e){try{return!!(0,i["default"])(t.toGeoJSON(),e.toGeoJSON())}catch(r){return console.error("You cant cut polygons with self-intersections"),!1}}).forEach(function(r){var n=[],i=(0,o["default"])(r.toGeoJSON(),t.toGeoJSON()),a=L.geoJSON(i,r.options).addTo(e._map);n.push(a),a.addTo(e._map),a.pm.enable(e.options),a.pm.disable(),r.fire("pm:cut",{shape:e._shape,layer:r,resultingLayers:n}),e._map.fire("pm:cut",{shape:e._shape,cuttedLayer:r,resultingLayers:n}),r._pmTempLayer=!0,t._pmTempLayer=!0,r.remove(),t.remove()})},_finishShape:function(){var t=this._layer.getLatLngs(),e=L.polygon(t,this.options.pathOptions);this._cut(e),this.disable(),this._cleanupSnapping(),this._otherSnapLayers.splice(this._tempSnapLayerIndex,1),delete this._tempSnapLayerIndex}})},function(t,e,r){"use strict";function n(t,e,r){void 0===r&&(r={});var i=a.getGeom(t),l=a.getGeom(e);if("Polygon"===i.type&&"Polygon"===l.type){var u=s.intersection(i.coordinates,l.coordinates);if(null===u||0===u.length)return null;if(1===u.length){var h=u[0][0][0],c=u[0][0][u[0][0].length-1];return h[0]===c[0]&&h[1]===c[1]?o.polygon(u[0],r.properties):null}return o.multiPolygon(u,r.properties)}if("MultiPolygon"===i.type){for(var f=[],p=0,d=i.coordinates;p1&&Object(i.isNumber)(t[0])&&Object(i.isNumber)(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return n(t[0]);throw new Error("coordinates must only contain numbers")}Object.defineProperty(e,"__esModule",{value:!0}),e.getCoord=function(t){if(!t)throw new Error("coord is required");if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates;if(Array.isArray(t)&&t.length>=2&&t[0].length===undefined&&t[1].length===undefined)return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")},e.getCoords=function(t){if(!t)throw new Error("coords is required");if("Feature"===t.type&&null!==t.geometry)return t.geometry.coordinates;if(t.coordinates)return t.coordinates;if(Array.isArray(t))return t;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")},e.containsNumber=n,e.geojsonType=function(t,e,r){if(!e||!r)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.type)},e.featureOf=function(t,e,r){if(!t)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.geometry.type)},e.collectionOf=function(t,e,r){if(!t)throw new Error("No featureCollection passed");if(!r)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+r+", FeatureCollection required");for(var n=0;n1?t:null;case"MultiPolygon":var e=[];if(u.flattenEach(t,function(t){a(t)>1&&e.push(t.geometry.coordinates)}),e.length)return{type:"MultiPolygon",coordinates:e}}}var o=n(r(13)),a=n(r(34)),s=r(2),l=r(35),u=r(14);t.exports=function(t,e){var r=l.getGeom(t),n=l.getGeom(e),a=t.properties||{};if(r=i(r),n=i(n),!r)return null;if(!n)return s.feature(r,a);var u=o.diff(r.coordinates,n.coordinates);return 0===u.length?null:1===u.length?s.polygon(u[0],a):s.multiPolygon(u,a)}},function(t,e,r){"use strict";function n(t){var e=0;if(t&&t.length>0){e+=Math.abs(i(t[0]));for(var r=1;r2){for(l=0;l1&&i.isNumber(t[0])&&i.isNumber(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return n(t[0]);throw new Error("coordinates must only contain numbers")}Object.defineProperty(e,"__esModule",{value:!0});var i=r(2);e.getCoord=function(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")},e.getCoords=function(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")},e.containsNumber=n,e.geojsonType=function(t,e,r){if(!e||!r)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.type)},e.featureOf=function(t,e,r){if(!t)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.geometry.type)},e.collectionOf=function(t,e,r){if(!t)throw new Error("No featureCollection passed");if(!r)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+r+", FeatureCollection required");for(var n=0,i=t.features;n0||(this._safeToCacheDragState&&(this._originalMapDragState=this._layer._map.dragging._enabled,this._safeToCacheDragState=!1),this._tempDragCoord=t.latlng,this._layer.on("mouseup",this._dragMixinOnMouseUp,this),this._layer._map.on("mousemove",this._dragMixinOnMouseMove,this))},dragging:function(){return this._dragging},_onLayerDrag:function(t){var e=t.latlng,r={lat:e.lat-this._tempDragCoord.lat,lng:e.lng-this._tempDragCoord.lng},n=function i(t){return t.map(function(t){return Array.isArray(t)?i(t):{lat:t.lat+r.lat,lng:t.lng+r.lng}})}(this._layer._latlngs);this._layer.setLatLngs(n).redraw(),this._tempDragCoord=e,this._layer.fire("pm:drag")}};e["default"]=n},function(t,e,r){"use strict";(function(t){return t&&t.__esModule?t:{"default":t}})(r(1))["default"].LayerGroup=L.Class.extend({initialize:function(t){var e=this;this._layerGroup=t,this._layers=this.findLayers(),this._layers.forEach(function(t){return e._initLayer(t)}),this._layerGroup.on("layeradd",function(t){t.target._pmTempLayer||(e._layers=e.findLayers(),t.layer.pm&&e._initLayer(t.layer),t.target.pm.enabled()&&e.enable(e.getOptions()))})},findLayers:function(){var t=this._layerGroup.getLayers();return t=t.filter(function(t){return!(t instanceof L.LayerGroup)}),t=t.filter(function(t){return!!t.pm}),t=t.filter(function(t){return!t._pmTempLayer})},_initLayer:function(t){var e=this;["pm:edit","pm:update","pm:remove","pm:dragstart","pm:drag","pm:dragend","pm:snap","pm:unsnap","pm:cut","pm:intersect","pm:raiseMarkers","pm:markerdragend","pm:markerdragstart","pm:vertexadded","pm:vertexremoved","pm:centerplaced"].forEach(function(r){t.on(r,e._fireEvent,e)}),t.pm._layerGroup=this._layerGroup},_fireEvent:function(t){this._layerGroup.fireEvent(t.type,t)},toggleEdit:function(t){this._options=t,this._layers.forEach(function(e){e.pm.toggleEdit(t)})},enable:function(t){this._options=t,this._layers.forEach(function(e){e.pm.enable(t)})},disable:function(){this._layers.forEach(function(t){t.pm.disable()})},enabled:function(){var t=this._layers.find(function(t){return t.pm.enabled()});return!!t},dragging:function(){var t=this._layers.find(function(t){return t.pm.dragging()});return!!t},getOptions:function(){return this._options}})},function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{"default":t}}(r(1));n["default"].Marker=n["default"].extend({initialize:function(t){this._layer=t,this._enabled=!1,this._layer.on("dragend",this._onDragEnd,this)},toggleEdit:function(t){this.enabled()?this.disable():this.enable(t)},enable:function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{draggable:!0,snappable:!0};L.Util.setOptions(this,t),this._map=this._layer._map,this.enabled()||(this._enabled=!0,this.options.preventMarkerRemoval||this._layer.on("contextmenu",this._removeMarker,this),this.options.draggable&&this._layer.dragging.enable(),this.options.snappable&&this._initSnappableMarkers())},enabled:function(){return this._enabled},disable:function(){this._enabled=!1,this._layer.dragging.disable(),this._layer.off("contextmenu",this._removeMarker,this),this._layerEdited&&this._layer.fire("pm:update",{}),this._layerEdited=!1},_removeMarker:function(t){var e=t.target;e.remove(),e.fire("pm:remove")},_onDragEnd:function(t){t.target.fire("pm:edit"),this._layerEdited=!0},_initSnappableMarkers:function(){var t=this._layer;this.options.snapDistance=this.options.snapDistance||30,t.off("drag",this._handleSnapping,this),t.on("drag",this._handleSnapping,this),t.off("dragend",this._cleanupSnapping,this),t.on("dragend",this._cleanupSnapping,this),t.off("pm:dragstart",this._unsnap,this),t.on("pm:dragstart",this._unsnap,this)}})},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}var i=n(r(11)),o=n(r(40)),a=n(r(1));a["default"].Line=a["default"].extend({initialize:function(t){this._layer=t,this._enabled=!1},toggleEdit:function(t){this.enabled()?this.disable():this.enable(t)},enable:function(t){L.Util.setOptions(this,t),this._map=this._layer._map,this._map&&(this.enabled()||this.disable(),this._enabled=!0,this._initMarkers(),this._layer.on("remove",this._onLayerRemove,this),this.options.allowSelfIntersection||this._layer.on("pm:vertexremoved",this._handleSelfIntersectionOnVertexRemoval,this),this.options.draggable&&this._initDraggableLayer(),this.options.allowSelfIntersection||this._handleLayerStyle())},_onLayerRemove:function(t){this.disable(t.target)},enabled:function(){return this._enabled},disable:function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._layer;if(!this.enabled())return!1;if(t.pm._dragging)return!1;t.pm._enabled=!1,t.pm._markerGroup.clearLayers(),t.off("mousedown"),t.off("mouseup"),this._layer.off("remove",this._onLayerRemove),this.options.allowSelfIntersection||this._layer.off("pm:vertexremoved",this._handleSelfIntersectionOnVertexRemoval);var e=t._path?t._path:this._layer._renderer._container;return L.DomUtil.removeClass(e,"leaflet-pm-draggable"),this.hasSelfIntersection()&&L.DomUtil.removeClass(e,"leaflet-pm-invalid"),this._layerEdited&&this._layer.fire("pm:update",{}),this._layerEdited=!1,!0},hasSelfIntersection:function(){return(0,i["default"])(this._layer.toGeoJSON()).features.length>0},_handleSelfIntersectionOnVertexRemoval:function(){this._handleLayerStyle(!0),this.hasSelfIntersection()&&(this._layer.setLatLngs(this._coordsBeforeEdit),this._coordsBeforeEdit=null,this._initMarkers())},_handleLayerStyle:function(t){var e=this._layer._path?this._layer._path:this._layer._renderer._container;if(this.hasSelfIntersection()){if(L.DomUtil.hasClass(e,"leaflet-pm-invalid"))return;t?(L.DomUtil.addClass(e,"leaflet-pm-invalid"),window.setTimeout(function(){L.DomUtil.removeClass(e,"leaflet-pm-invalid")},200)):L.DomUtil.addClass(e,"leaflet-pm-invalid"),this._layer.fire("pm:intersect",{intersection:(0,i["default"])(this._layer.toGeoJSON())})}else L.DomUtil.removeClass(e,"leaflet-pm-invalid")},_initMarkers:function(){var t=this,e=this._map,r=this._layer.getLatLngs();this._markerGroup&&this._markerGroup.clearLayers(),this._markerGroup=new L.LayerGroup,this._markerGroup._pmTempLayer=!0,e.addLayer(this._markerGroup);this._markers=function n(e){if(Array.isArray(e[0]))return e.map(n,t);var r=e.map(t._createMarker,t);return e.map(function(n,i){var o=t.isPolygon()?(i+1)%e.length:i+1;return t._createMiddleMarker(r[i],r[o])}),r}(r),this.options.snappable&&this._initSnappableMarkers()},_createMarker:function(t){var e=new L.Marker(t,{draggable:!this.options.preventVertexEdit,icon:L.divIcon({className:"marker-icon"})});return e._pmTempLayer=!0,e.on("dragstart",this._onMarkerDragStart,this),e.on("move",this._onMarkerDrag,this),e.on("dragend",this._onMarkerDragEnd,this),this.options.preventMarkerRemoval||e.on("contextmenu",this._removeMarker,this),this._markerGroup.addLayer(e),e},_createMiddleMarker:function(t,e){var r=this;if(!t||!e)return!1;var n=this._calcMiddleLatLng(t.getLatLng(),e.getLatLng()),i=this._createMarker(n),o=L.divIcon({className:"marker-icon marker-icon-middle"});return i.setIcon(o),t._middleMarkerNext=i,e._middleMarkerPrev=i,i.on("click",function(){var n=L.divIcon({className:"marker-icon"});i.setIcon(n),r._addMarker(i,t,e)}),i.on("movestart",function(){i.on("moveend",function(){var t=L.divIcon({className:"marker-icon"});i.setIcon(t),i.off("moveend")}),r._addMarker(i,t,e)}),i},_addMarker:function(t,e,r){t.off("movestart"),t.off("click");var n=t.getLatLng(),i=this._layer._latlngs,a=this.findDeepMarkerIndex(this._markers,r),s=a.indexPath,l=a.index,u=a.parentPath,h=s.length>1?(0,o["default"])(i,u):i,c=s.length>1?(0,o["default"])(this._markers,u):this._markers;h.splice(l,0,n),c.splice(l,0,t),this._layer.setLatLngs(i),this._createMiddleMarker(e,t),this._createMiddleMarker(t,r),this._fireEdit(),this._layer.fire("pm:vertexadded",{layer:this._layer,marker:t,indexPath:s}),this.options.snappable&&this._initSnappableMarkers()},_removeMarker:function(t){if(!this.options.allowSelfIntersection){var e=this._layer.getLatLngs();this._coordsBeforeEdit=JSON.parse(JSON.stringify(e))}var r=t.target,n=this._layer.getLatLngs(),i=this.findDeepMarkerIndex(this._markers,r),a=i.indexPath,s=i.index,l=i.parentPath;if(a){var u=a.length>1?(0,o["default"])(n,l):n,h=a.length>1?(0,o["default"])(this._markers,l):this._markers;u.splice(s,1),this._layer.setLatLngs(n),u.length<=1&&(u.splice(0,u.length),this._layer.setLatLngs(n),this.disable(),this.enable(this.options)),this.isEmptyDeep(n)&&this._layer.remove(),r._middleMarkerPrev&&this._markerGroup.removeLayer(r._middleMarkerPrev),r._middleMarkerNext&&this._markerGroup.removeLayer(r._middleMarkerNext),this._markerGroup.removeLayer(r);var c,f;if(this.isPolygon()?(c=(s+1)%h.length,f=(s+(h.length-1))%h.length):(f=s-1<0?undefined:s-1,c=s+1>=h.length?undefined:s+1),c!==f){var p=h[f],d=h[c];this._createMiddleMarker(p,d)}h.splice(s,1),this._fireEdit(),this._layer.fire("pm:vertexremoved",{layer:this._layer,marker:r,indexPath:a})}},isEmptyDeep:function(t){return!function e(t){return t.filter(function(t){return![null,"",undefined].includes(t)}).reduce(function(t,r){return t.concat(Array.isArray(r)?e(r):r)},[])}(t).length},findDeepMarkerIndex:function(t,e){var r;t.some(function i(t){return function(n,o){var a=t.concat(o);return n._leaflet_id===e._leaflet_id?(r=a,!0):Array.isArray(n)&&n.some(i(a))}}([]));var n={};return r&&(n={indexPath:r,index:r[r.length-1],parentPath:r.slice(0,r.length-1)}),n},updatePolygonCoordsFromMarkerDrag:function(t){var e=this._layer.getLatLngs(),r=t.getLatLng(),n=this.findDeepMarkerIndex(this._markers,t),i=n.indexPath,a=n.index,s=n.parentPath;(i.length>1?(0,o["default"])(e,s):e).splice(a,1,r),this._layer.setLatLngs(e).redraw()},_onMarkerDrag:function(t){var e=t.target,r=this.findDeepMarkerIndex(this._markers,e),n=r.indexPath,i=r.index,a=r.parentPath;if(n){this.updatePolygonCoordsFromMarkerDrag(e);var s=n.length>1?(0,o["default"])(this._markers,a):this._markers,l=(i+1)%s.length,u=(i+(s.length-1))%s.length,h=e.getLatLng(),c=s[u].getLatLng(),f=s[l].getLatLng();if(e._middleMarkerNext){var p=this._calcMiddleLatLng(h,f);e._middleMarkerNext.setLatLng(p)}if(e._middleMarkerPrev){var d=this._calcMiddleLatLng(h,c);e._middleMarkerPrev.setLatLng(d)}this.options.allowSelfIntersection||this._handleLayerStyle()}},_onMarkerDragEnd:function(t){var e=t.target,r=this.findDeepMarkerIndex(this._markers,e).indexPath;if(!this.options.allowSelfIntersection&&this.hasSelfIntersection())return this._layer.setLatLngs(this._coordsBeforeEdit),this._coordsBeforeEdit=null,this._initMarkers(),void this._handleLayerStyle();this._layer.fire("pm:markerdragend",{markerEvent:t,indexPath:r}),this._fireEdit()},_onMarkerDragStart:function(t){var e=t.target,r=this.findDeepMarkerIndex(this._markers,e).indexPath;this._layer.fire("pm:markerdragstart",{markerEvent:t,indexPath:r}),this.options.allowSelfIntersection||(this._coordsBeforeEdit=this._layer.getLatLngs())},_fireEdit:function(){this._layerEdited=!0,this._layer.fire("pm:edit")},_calcMiddleLatLng:function(t,e){var r=this._map,n=r.project(t),i=r.project(e);return r.unproject(n._add(i)._divideBy(2))}})},function(t,e,r){var n=r(41);t.exports=function(t,e,r){var i=null==t?undefined:n(t,e);return i===undefined?r:i}},function(t,e,r){var n=r(42),i=r(82);t.exports=function(t,e){for(var r=0,o=(e=n(e,t)).length;null!=t&&r-1}},function(t,e,r){var n=r(4);t.exports=function(t,e){var r=this.__data__,i=n(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}},function(t,e,r){var n=r(16)(r(9),"Map");t.exports=n},function(t,e,r){var n=r(5);t.exports=function(t){var e=n(this,t)["delete"](t);return this.size-=e?1:0,e}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,r){var n=r(5);t.exports=function(t){return n(this,t).get(t)}},function(t,e,r){var n=r(5);t.exports=function(t){return n(this,t).has(t)}},function(t,e,r){var n=r(5);t.exports=function(t,e){var r=n(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}},function(t,e,r){var n=r(80);t.exports=function(t){return null==t?"":n(t)}},function(t,e,r){function n(t){if("string"==typeof t)return t;if(a(t))return o(t,n)+"";if(s(t))return h?h.call(t):"";var e=t+"";return"0"==e&&1/t==-l?"-0":e}var i=r(8),o=r(81),a=r(6),s=r(7),l=1/0,u=i?i.prototype:undefined,h=u?u.toString:undefined;t.exports=n},function(t,e){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r0&&arguments[0]!==undefined?arguments[0]:this._layer;if(!this.enabled())return!1;if(t.pm._dragging)return!1;t.pm._enabled=!1,t.pm._layerGroup.clearLayers(),t.off("mousedown"),t.off("mouseup");var e=t._path?t._path:this._layer._renderer._container;return L.DomUtil.removeClass(e,"leaflet-pm-draggable"),this._layerEdited&&this._layer.fire("pm:update",{}),this._layerEdited=!1,!0},_initMarkers:function(){var t=this._map;this._layerGroup&&this._layerGroup.clearLayers(),this._layerGroup=new L.LayerGroup,t.addLayer(this._layerGroup);var e=this._layer.getLatLng(),r=this._layer._radius,n=this._getLatLngOnCircle(e,r);this._centerMarker=this._createCenterMarker(e),this._outerMarker=this._createOuterMarker(n),this._markers=[this._centerMarker,this._outerMarker],this._createHintLine(this._centerMarker,this._outerMarker),this.options.snappable&&this._initSnappableMarkers()},_getLatLngOnCircle:function(t,e){var r=this._map.project(t),n=L.point(r.x+e,r.y);return this._map.unproject(n)},_resizeCircle:function(){this._syncHintLine(),this._syncCircleRadius()},_moveCircle:function(t){var e=t.latlng;this._layer.setLatLng(e);var r=this._layer._radius,n=this._getLatLngOnCircle(e,r);this._outerMarker.setLatLng(n),this._syncHintLine(),this._layer.fire("pm:centerplaced",{layer:this._layer,latlng:e})},_onMarkerDragStart:function(t){this._layer.fire("pm:markerdragstart",{markerEvent:t})},_onMarkerDragEnd:function(t){this._fireEdit(),this._layer.fire("pm:markerdragend",{markerEvent:t})},_syncCircleRadius:function(){var t=this._centerMarker.getLatLng(),e=this._outerMarker.getLatLng(),r=t.distanceTo(e);this._layer.setRadius(r)},_syncHintLine:function(){var t=this._centerMarker.getLatLng(),e=this._outerMarker.getLatLng();this._hintline.setLatLngs([t,e])},_createHintLine:function(t,e){var r=t.getLatLng(),n=e.getLatLng();this._hintline=L.polyline([r,n],this.options.hintlineStyle),this._hintline._pmTempLayer=!0,this._layerGroup.addLayer(this._hintline)},_createCenterMarker:function(t){var e=this._createMarker(t);return e.on("move",this._moveCircle,this),e},_createOuterMarker:function(t){var e=this._createMarker(t);return this.options.preventVertexEdit&&e.dragging.disable(),e.on("move",this._resizeCircle,this),e},_createMarker:function(t){var e=new L.Marker(t,{draggable:!0,icon:L.divIcon({className:"marker-icon"})});return e._origLatLng=t,e._pmTempLayer=!0,e.on("dragstart",this._onMarkerDragStart,this),e.on("dragend",this._onMarkerDragEnd,this),this._layerGroup.addLayer(e),e},_fireEdit:function(){this._layer.fire("pm:edit"),this._layerEdited=!0}})},function(t,e){},function(t,e){}]);