leaflet-plot
Version:
A Leaflet Plugin For Plot in Leaflet 1.0
1 lines • 20 kB
JavaScript
(()=>{var t={628:(t,e,i)=>{"use strict";i(107),i=L.Class.extend({initialize:function(t){this.map=t,this.Draw=new L.SL.Draw(t),this.Create=L.SL.Create},enableDraw:function(t,e){this.Draw.enable(t,e)},disableDraw:function(){this.Draw.drawOff(),this.Draw.clearTemps(),this.map.fire("sl:disable")}});const n={TWO_PI:2*Math.PI,HALF_PI:Math.PI/2,FITTING_COUNT:100,ZERO_TOLERANCE:1e-4};var r={distance:function(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2))},wholeDistance:function(t){for(var e=0,i=0;i<t.length-1;i++)e+=r.distance(t[i],t[i+1]);return e},getBaseLength:function(t){return Math.pow(r.wholeDistance(t),.99)},mid:function(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]},getCircleCenterOfThreePoints:function(t,e,i){var n=[(t[0]+e[0])/2,(t[1]+e[1])/2],o=[n[0]-t[1]+e[1],n[1]+t[0]-e[0]];return i=[(e=[(t[0]+i[0])/2,(t[1]+i[1])/2])[0]-t[1]+i[1],e[1]+t[0]-i[0]],r.getIntersectPoint(n,o,e,i)},getIntersectPoint:function(t,e,i,n){if(t[1]==e[1]){var r=(n[0]-i[0])/(n[1]-i[1]),o=r*(t[1]-i[1])+i[0],a=t[1];return[o,a]}if(i[1]!=n[1])return s=(e[0]-t[0])/(e[1]-t[1]),r=(n[0]-i[0])/(n[1]-i[1]),[o=s*(a=(s*t[1]-t[0]-r*i[1]+i[0])/(s-r))-s*t[1]+t[0],a];var s=(e[0]-t[0])/(e[1]-t[1]);return[o=s*(i[1]-t[1])+t[0],a=i[1]]},getAzimuth:function(t,e){var i,o=Math.asin(Math.abs(e[1]-t[1])/r.distance(t,e));return e[1]>=t[1]&&e[0]>=t[0]?i=o+Math.PI:e[1]>=t[1]&&e[0]<t[0]?i=n.TWO_PI-o:e[1]<t[1]&&e[0]<t[0]?i=o:e[1]<t[1]&&e[0]>=t[0]&&(i=Math.PI-o),i},getAngleOfThreePoints:function(t,e,i){return(i=r.getAzimuth(e,t)-r.getAzimuth(e,i))<0?i+n.TWO_PI:i},isClockWise:function(t,e,i){return(i[1]-t[1])*(e[0]-t[0])>(e[1]-t[1])*(i[0]-t[0])},getPointOnLine:function(t,e,i){return[e[0]+t*(i[0]-e[0]),e[1]+t*(i[1]-e[1])]},getCubicValue:function(t,e,i,n,r){var o=1-(t=Math.max(Math.min(t,1),0)),a=t*t,s=a*t,h=o*o,l=h*o;return[l*e[0]+3*h*t*i[0]+3*o*a*n[0]+s*r[0],l*e[1]+3*h*t*i[1]+3*o*a*n[1]+s*r[1]]},getThirdPoint:function(t,e,i,n,o){return t=r.getAzimuth(t,e),t=o?t+i:t-i,i=n*Math.cos(t),t=n*Math.sin(t),[e[0]+i,e[1]+t]},getArcPoints:function(t,e,i,r){for(var o=[],a=(a=r-i)<0?a+n.TWO_PI:a,s=0;s<=n.FITTING_COUNT;s++){var h=i+a*s/n.FITTING_COUNT,l=t[0]+e*Math.cos(h);h=t[1]+e*Math.sin(h),o.push([l,h])}return o},getBisectorNormals:function(t,e,i,o){var a,s,h=r.getNormal(e,i,o),l=Math.sqrt(h[0]*h[0]+h[1]*h[1]),p=h[0]/l,c=h[1]/l,d=r.distance(e,i);return h=r.distance(i,o),i=l>n.ZERO_TOLERANCE?r.isClockWise(e,i,o)?(a=[i[0]-(s=t*d)*c,i[1]+s*p],[i[0]+(s=t*h)*c,i[1]-s*p]):(a=[i[0]+(s=t*d)*c,i[1]-s*p],[i[0]-(s=t*h)*c,i[1]+s*p]):(a=[i[0]+t*(e[0]-i[0]),i[1]+t*(e[1]-i[1])],[i[0]+t*(o[0]-i[0]),i[1]+t*(o[1]-i[1])]),[a,i]},getNormal:function(t,e,i){var n=t[0]-e[0],r=t[1]-e[1];return n/=t=Math.sqrt(n*n+r*r),r/=t,t=i[0]-e[0],i=i[1]-e[1],[n+(t/=e=Math.sqrt(t*t+i*i)),r+(i/=e)]},getBezierPoints:function(t){if(t.length<=2)return t;for(var e=[],i=t.length-1,n=0;n<=1;n+=.01){for(var o=0,a=0,s=0;s<=i;s++){var h=r.getBinomialFactor(i,s),l=Math.pow(n,s),p=Math.pow(1-n,i-s);o+=h*l*p*t[s][0],a+=h*l*p*t[s][1]}e.push([o,a])}return e.push(t[i]),e},getBinomialFactor:function(t,e){return r.getFactorial(t)/(r.getFactorial(e)*r.getFactorial(t-e))},getFactorial:function(t){if(t<=1)return 1;if(2==t)return 2;if(3==t)return 6;if(4==t)return 24;if(5==t)return 120;for(var e=1,i=1;i<=t;i++)e*=i;return e},getQBSplinePoints:function(t){if(t.length<=2)return t;var e=[],i=t.length-2-1;e.push(t[0]);for(var n=0;n<=i;n++)for(var o=0;o<=1;o+=.05){for(var a=0,s=0,h=0;h<=2;h++){var l=r.getQuadricBSplineFactor(h,o);a+=l*t[n+h][0],s+=l*t[n+h][1]}e.push([a,s])}return e.push(t[t.length-1]),e},getQuadricBSplineFactor:function(t,e){return 0==t?Math.pow(e-1,2)/2:1==t?(-2*Math.pow(e,2)+2*e+1)/2:2==t?Math.pow(e,2)/2:0}};const o=r;function a(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return s(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(i="Object"===i&&t.constructor?t.constructor.name:i)||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?s(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function h(t,e,i,r){var a=o.mid(t,e),s=o.distance(a,i),h=o.getThirdPoint(i,a,0,.3*s,!0),l=o.getThirdPoint(i,a,0,.5*s,!0),p=[a,h=o.getThirdPoint(a,h,n.HALF_PI,s/5,r),l=o.getThirdPoint(a,l,n.HALF_PI,s/4,r),i];return h=p,a={headHeightFactor:.25,headWidthFactor:.3,neckHeightFactor:.85,neckWidthFactor:.15},s=o.getBaseLength(h)*a.headHeightFactor,r=h[h.length-1],l=s*a.headWidthFactor,i=s*a.neckWidthFactor,a=s*a.neckHeightFactor,s=o.getThirdPoint(h[h.length-2],r,0,s,!0),h=o.getThirdPoint(h[h.length-2],r,0,a,!0),a=o.getThirdPoint(r,s,n.HALF_PI,l,!1),s=o.getThirdPoint(r,s,n.HALF_PI,l,!0),l=[l=o.getThirdPoint(r,h,n.HALF_PI,i,!1),a,r,s,i=o.getThirdPoint(r,h,n.HALF_PI,i,!0)],i=(s=function(t,e,i,n){for(var r=o.wholeDistance(t),a=o.getBaseLength(t)*n,s=(a-(i=o.distance(e,i)))/2,h=0,l=[],p=[],c=1;c<t.length-1;c++){var d=o.getAngleOfThreePoints(t[c-1],t[c],t[c+1])/2,u=(a/2-(h+=o.distance(t[c-1],t[c]))/r*s)/Math.sin(d),m=o.getThirdPoint(t[c-1],t[c],Math.PI-d,u,!0);u=o.getThirdPoint(t[c-1],t[c],d,u,!1),l.push(m),p.push(u)}return l.concat(p)}(p,a=l[0],r=l[4],o.distance(t,e)/o.getBaseLength(p)/2)).length,p=s.slice(0,i/2),i=s.slice(i/2,i),p.push(a),i.push(r),(p=p.reverse()).push(e),(i=i.reverse()).push(t),p.reverse().concat(l,i)}const l=function(t,e){var i={connPoint:null,tempPoint4:null,fixPointCount:4},r=t[0],s=t[1],l=t[2],p=t.length;i.tempPoint4=3==p?function(t,e,i){var r,a,s,h=o.mid(t,e);return e=o.distance(h,i),(i=o.getAngleOfThreePoints(t,h,i))<n.HALF_PI?(r=e*Math.sin(i),a=e*Math.cos(i),s=o.getThirdPoint(t,h,n.HALF_PI,r,!1),o.getThirdPoint(h,s,n.HALF_PI,a,!0)):i>=n.HALF_PI&&i<Math.PI?(r=e*Math.sin(Math.PI-i),a=e*Math.cos(Math.PI-i),s=o.getThirdPoint(t,h,n.HALF_PI,r,!1),o.getThirdPoint(h,s,n.HALF_PI,a,!1)):i>=Math.PI&&i<1.5*Math.PI?(r=e*Math.sin(i-Math.PI),a=e*Math.cos(i-Math.PI),s=o.getThirdPoint(t,h,n.HALF_PI,r,!0),o.getThirdPoint(h,s,n.HALF_PI,a,!0)):(r=e*Math.sin(2*Math.PI-i),a=e*Math.cos(2*Math.PI-i),s=o.getThirdPoint(t,h,n.HALF_PI,r,!0),o.getThirdPoint(h,s,n.HALF_PI,a,!1))}(r,s,l):t[3],i.connPoint=3==p||4==p?o.mid(r,s):t[4];var c=o.isClockWise(r,s,l)?(u=h(r,i.connPoint,i.tempPoint4,!1),h(i.connPoint,s,l,!0)):(u=h(s,i.connPoint,l,!1),h(i.connPoint,r,i.tempPoint4,!0)),d=((m=u.length)-5)/2,u=(p=u.slice(0,d),s=u.slice(d,5+d),l=u.slice(5+d,m),r=c.slice(0,d),c.slice(d,5+d)),m=c.slice(5+d,m);return r=o.getBezierPoints(r),p=o.getBezierPoints(m.concat(p.slice(1))),l=o.getBezierPoints(l),(l=r.concat(u,p,s,l)).some((function(t){return isNaN(t[0])||isNaN(t[1])}))?null:((e=L.polygon(l,e))._plotNodes=a(t),e._plotNodes[3]=i.tempPoint4,e._plotNodes[4]=i.connPoint,e._shape="DoubleArrow",e)},p=function(t,e){var i={tailWidthDactor:.2,neckWidthFactor:.25,headWidthFactor:.3,headAngle:Math.PI/4,neckAngle:.17741*Math.PI},r=t[0],a=t[1],s=(c=o.getBaseLength(t))*i.tailWidthDactor,h=c*i.neckWidthFactor,l=c*i.headWidthFactor,p=o.getThirdPoint(a,r,n.HALF_PI,s,!0),c=o.getThirdPoint(a,r,n.HALF_PI,s,!1);return s=o.getThirdPoint(r,a,i.headAngle,l,!1),l=o.getThirdPoint(r,a,i.headAngle,l,!0),(c=[p,o.getThirdPoint(r,a,i.neckAngle,h,!1),s,a,l,o.getThirdPoint(r,a,i.neckAngle,h,!0),c]).some((function(t){return isNaN(t[0])||isNaN(t[1])}))?null:((e=L.polygon(c,e))._plotNodes=t,e._shape="RightAngleArrow",e)},c=function(t,e){var i=t[0],n=t[1],r=o.distance(i,n)/5;return(r=[i,n,o.getThirdPoint(i,n,Math.PI/6,r,!1),n,o.getThirdPoint(i,n,Math.PI/6,r,!0)]).some((function(t){return isNaN(t[0])||isNaN(t[1])}))?null:((e=L.polyline(r,e))._plotNodes=t,e._shape="StraightArrow",e)},d=function(t,e){var i={headHeightFactor:.18,headWidthFactor:.3,neckHeightFactor:.85,neckWidthFactor:.15,tailWidthFactor:.1,headTailFactor:.8,swallowTailFactor:1,swallowTailPnt:null},r=t[0],a=t[1];o.isClockWise(t[0],t[1],t[2])&&(r=t[1],a=t[0]);var s=[o.mid(r,a)].concat(t.slice(2)),h=function(t,e,i,r){var a,s=o.getBaseLength(t)*r.headHeightFactor,h=t[t.length-1];return a=o.distance(h,t[t.length-2]),s>(e=o.distance(e,i))*r.headTailFactor&&(s=e*r.headTailFactor),i=s*r.headWidthFactor,e=s*r.neckWidthFactor,r=(s=a<s?a:s)*r.neckHeightFactor,s=o.getThirdPoint(t[t.length-2],h,0,s,!0),t=o.getThirdPoint(t[t.length-2],h,0,r,!0),r=o.getThirdPoint(h,s,n.HALF_PI,i,!1),s=o.getThirdPoint(h,s,n.HALF_PI,i,!0),[i=o.getThirdPoint(h,t,n.HALF_PI,e,!1),r,h,s,e=o.getThirdPoint(h,t,n.HALF_PI,e,!0)]}(s,r,a,i),l=h[0],p=h[4],c=o.distance(r,a),d=o.getBaseLength(s),u=d*i.tailWidthFactor*i.swallowTailFactor;return i.swallowTailPnt=o.getThirdPoint(s[1],s[0],0,u,!0),c=function(t,e,i,n){for(var r=o.wholeDistance(t),a=o.getBaseLength(t)*n,s=(a-(i=o.distance(e,i)))/2,h=0,l=[],p=[],c=1;c<t.length-1;c++){var d=o.getAngleOfThreePoints(t[c-1],t[c],t[c+1])/2,u=(a/2-(h+=o.distance(t[c-1],t[c]))/r*s)/Math.sin(d),m=o.getThirdPoint(t[c-1],t[c],Math.PI-d,u,!0);u=o.getThirdPoint(t[c-1],t[c],d,u,!1),l.push(m),p.push(u)}return l.concat(p)}(s,l,p,c/d),d=c.length,(r=[r].concat(c.slice(0,d/2))).push(l),(d=[a].concat(c.slice(d/2,d))).push(p),r=o.getQBSplinePoints(r),d=o.getQBSplinePoints(d),(r=[r.concat(h,d.reverse(),[i.swallowTailPnt,r[0]])])[0].some((function(t){return isNaN(t[0])||isNaN(t[1])}))?null:((e=L.polygon(r,e))._plotNodes=t,e._shape="TailedArrow",e)},u={DoubleArrow:l,RightAngleArrow:p,StraightArrow:c,TailedArrow:d},m=L.Class.extend({tempGp:{layerNode:[],layerNodeLen:0,tempNode:[],tempLayer:null},initialize:function(t){var e=this;this._map=t,this.shapes=["StraightArrow","DoubleArrow","RightAngleArrow","TailedArrow"],this.shapes.forEach((function(t){e[t]=new L.SL.Draw[t](e._map)}))},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[t].enable(e)},addNode:function(t){return(t=L.marker(t,{icon:L.divIcon({className:"marker-icon"})})).addTo(this._map),t},clearTemps:function(){this.tempGp.tempLayer&&this.tempGp.tempLayer.remove(),this.tempGp.tempNode.map((function(t){return t.remove()})),this.tempGp.layerNode=[],this.tempGp.layerNodeLen=0,this.tempGp.tempNode=[],this.tempGp.tempLayer=null},drawOn:function(){this.clearTemps(),this._map.doubleClickZoom.disable(),this._map._container.style.cursor="crosshair",this.unable()},drawOff:function(){var t=this;this._shape?this.unable():this.shapes.forEach((function(e){t[e].unable()})),this._map.doubleClickZoom.enable(),this._map._container.style.cursor=""}});m.StraightArrow=m.extend({initialize:function(t){this._map=t,this._shape="StraightArrow",this._options={}},enable:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.drawOn(),this._options=t,this._map.on("click",this.onClick,this),this._map.on("mousemove",this.onMousemove,this)},onClick:function(t){var e=this.tempGp.tempNode[this.tempGp.tempNode.length-1];e&&t.latlng.lat===e._latlng.lat&&t.latlng.lng==e._latlng.lng||(this.tempGp.layerNode.push([t.latlng.lat,t.latlng.lng]),this.tempGp.layerNodeLen=this.tempGp.layerNode.length,this.tempGp.tempNode.push(this.addNode(t.latlng)),3<=this.tempGp.layerNodeLen&&(this.tempGp.layerNode.pop(),t=c(this.tempGp.layerNode,this._options).addTo(this._map),this.clearTemps(),this.drawOff(),this._map.fire("sl:create",{shape:this._shape,layer:t})))},onMousemove:function(t){1===this.tempGp.layerNodeLen&&(this.tempGp.tempLayer&&this.tempGp.tempLayer.remove(),this.tempGp.layerNode[this.tempGp.layerNodeLen]=[t.latlng.lat,t.latlng.lng],(t=c(this.tempGp.layerNode,this._options))&&(this.tempGp.tempLayer=t.addTo(this._map)))},unable:function(){this._map.off("click",this.onClick,this),this._map.off("mousemove",this.onMousemove,this)}}),m.DoubleArrow=m.extend({initialize:function(t){this._map=t,this._shape="DoubleArrow",this._options={}},enable:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.drawOn(),this._options=t,this._map.on("click",this.onClick,this),this._map.on("mousemove",this.onMousemove,this),this._map.on("dblclick",this.onDblclick,this)},onClick:function(t){var e=this.tempGp.tempNode[this.tempGp.tempNode.length-1];e&&t.latlng.lat===e._latlng.lat&&t.latlng.lng==e._latlng.lng||(this.tempGp.layerNode.push([t.latlng.lat,t.latlng.lng]),this.tempGp.layerNodeLen=this.tempGp.layerNode.length,this.tempGp.tempNode.push(this.addNode(t.latlng)),7===this.tempGp.layerNodeLen&&(this.tempGp.layerNode.splice(this.tempGp.layerNodeLen-2),t=l(this.tempGp.layerNode,this._options).addTo(this._map),this.clearTemps(),this.drawOff(),this._map.fire("sl:create",{shape:this._shape,layer:t})))},onMousemove:function(t){var e;2<=this.tempGp.layerNodeLen&&(this.tempGp.tempLayer&&this.tempGp.tempLayer.remove(),e=2===this.tempGp.layerNodeLen?2:this.tempGp.layerNodeLen-1,this.tempGp.layerNode[e]=[t.latlng.lat,t.latlng.lng],(t=l(this.tempGp.layerNode,this._options))&&(this.tempGp.tempLayer=t.addTo(this._map)))},onDblclick:function(){var t;this.tempGp.layerNodeLen<4||(this.tempGp.layerNode.splice(this.tempGp.layerNodeLen-1),t=l(this.tempGp.layerNode,this._options).addTo(this._map),this.clearTemps(),this.drawOff(),this._map.fire("sl:create",{shape:this._shape,layer:t}))},unable:function(){this._map.off("click",this.onClick,this),this._map.off("mousemove",this.onMousemove,this),this._map.off("dblclick",this.onDblclick,this)}}),m.RightAngleArrow=m.extend({initialize:function(t){this._map=t,this._shape="RightAngleArrow",this._options={}},enable:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.drawOn(),this._options=t,this._map.on("click",this.onClick,this),this._map.on("mousemove",this.onMousemove,this)},onClick:function(t){var e=this.tempGp.tempNode[this.tempGp.tempNode.length-1];e&&t.latlng.lat===e._latlng.lat&&t.latlng.lng==e._latlng.lng||(this.tempGp.layerNode.push([t.latlng.lat,t.latlng.lng]),this.tempGp.layerNodeLen=this.tempGp.layerNode.length,this.tempGp.tempNode.push(this.addNode(t.latlng)),3===this.tempGp.layerNodeLen&&(this.tempGp.layerNode.pop(),t=p(this.tempGp.layerNode,this._options).addTo(this._map),this.clearTemps(),this.drawOff(),this._map.fire("sl:create",{shape:this._shape,layer:t})))},onMousemove:function(t){1<=this.tempGp.layerNodeLen&&(this.tempGp.tempLayer&&this.tempGp.tempLayer.remove(),this.tempGp.layerNode[this.tempGp.layerNodeLen]=[t.latlng.lat,t.latlng.lng],(t=p(this.tempGp.layerNode,this._options))&&(this.tempGp.tempLayer=t.addTo(this._map)))},unable:function(){this._map.off("click",this.onClick,this),this._map.off("mousemove",this.onMousemove,this)}}),m.TailedArrow=m.extend({initialize:function(t){this._map=t,this._shape="TailedArrow",this._options={}},enable:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.drawOn(),this._options=t,this._map.on("click",this.onClick,this),this._map.on("mousemove",this.onMousemove,this),this._map.on("dblclick",this.onDblclick,this)},onClick:function(t){var e=this.tempGp.tempNode[this.tempGp.tempNode.length-1];e&&t.latlng.lat===e._latlng.lat&&t.latlng.lng==e._latlng.lng||(this.tempGp.layerNode.push([t.latlng.lat,t.latlng.lng]),this.tempGp.layerNodeLen=this.tempGp.layerNode.length,this.tempGp.tempNode.push(this.addNode(t.latlng)))},onMousemove:function(t){var e;2<=this.tempGp.layerNodeLen&&(this.tempGp.tempLayer&&this.tempGp.tempLayer.remove(),e=2===this.tempGp.layerNodeLen?2:this.tempGp.layerNodeLen-1,this.tempGp.layerNode[e]=[t.latlng.lat,t.latlng.lng],(t=d(this.tempGp.layerNode,this._options))&&(this.tempGp.tempLayer=t.addTo(this._map)))},onDblclick:function(){var t;this.tempGp.layerNodeLen<4||(this.tempGp.layerNode.splice(this.tempGp.layerNodeLen-1),t=d(this.tempGp.layerNode,this._options).addTo(this._map),this.clearTemps(),this.drawOff(),this._map.fire("sl:create",{shape:this._shape,layer:t}))},unable:function(){this._map.off("click",this.onClick,this),this._map.off("mousemove",this.onMousemove,this),this._map.off("dblclick",this.onDblclick,this)}});const g=L.Class.extend({isArrow:function(){var t;return(null===(t=this._layer._shape)||void 0===t?void 0:t.includes("Arrow"))||!1}});g.Arrow=g.extend({initialize:function(t){this._layer=t},enable:function(){if(this._map=this._layer._map,this._map){if(!this.isArrow)throw new Error("Error: Please Edit Arrow");this._initMarkers(),this._layer.on("remove",this._onLayerRemove,this),this._map.on("sl:disable",this._onLayerRemove,this)}},disable:function(){this._markerGroup.clearLayers(),this._layer.off("remove",this._onLayerRemove,this),this._map.off("sl:disable",this._onLayerRemove,this)},_onLayerRemove:function(t){this.disable(t.target)},_initMarkers:function(){var t=this,e=this._map,i=this._layer._plotNodes;this._markerGroup&&this._markerGroup.clearLayers(),this._markerGroup=new L.LayerGroup,this._markers=i.map((function(e){return t._createMarker(e)})),e.addLayer(this._markerGroup)},_createMarker:function(t){return(t=new L.Marker(t,{draggable:!0,icon:L.divIcon({className:"marker-icon"})})).on("move",this._onMarkerDrag,this),t.on("dragend",this._onMarkerDragEnd,this),this._markerGroup.addLayer(t),t},findDeepMarkerIndex:function(t,e){var i;return t.some(function t(n){return function(r,o){return o=n.concat(o),r._leaflet_id===e._leaflet_id?(i=o,!0):Array.isArray(r)&&r.some(t(o))}}([])),t={},i?{indexPath:i,index:i[i.length-1],parentPath:i.slice(0,i.length-1)}:t},updateArrowCoordsFromMarkerDrag:function(t){var e=this._layer._plotNodes,i=[(i=t.getLatLng()).lat,i.lng];t=this.findDeepMarkerIndex(this._markers,t).index,e.splice(t,1,i),e=u[this._layer._shape](e,this._layer.options).getLatLngs(),this._layer.setLatLngs(e)},_onMarkerDrag:function(t){t=t.target,this.updateArrowCoordsFromMarkerDrag(t)},_onMarkerDragEnd:function(){this._layer.fire("sl:edit")}}),L.SL=L.SL||{version:"1.0.5",Map:i,Draw:m,Edit:g,Create:u,initialize:function(){this.addInitHooks()},addInitHooks:function(){function t(){this.sl=void 0,this.sl=new L.SL.Edit.Arrow(this)}L.Map.addInitHook((function(){this.sl=void 0,this.sl=new L.SL.Map(this)})),L.Polygon.addInitHook(t),L.Polyline.addInitHook(t)}},L.SL.initialize()},107:()=>{Array.prototype.findIndex=Array.prototype.findIndex||function(t){if(null===this)throw new TypeError("Array.prototype.findIndex called on null or undefined");if("function"!=typeof t)throw new TypeError("callback must be a function");for(var e=Object(this),i=e.length>>>0,n=arguments[1],r=0;r<i;r++)if(t.call(n,e[r],r,e))return r;return-1},Array.prototype.find=Array.prototype.find||function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("callback must be a function");for(var e=Object(this),i=e.length>>>0,n=arguments[1],r=0;r<i;r++){var o=e[r];if(t.call(n,o,r,e))return o}},"function"!=typeof Object.assign&&(Object.assign=function(t){"use strict";if(null==t)throw new TypeError("Cannot convert undefined or null to object");t=Object(t);for(var e=1;e<arguments.length;e++){var i=arguments[e];if(null!=i)for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t}),[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach((function(t){t.hasOwnProperty("remove")||Object.defineProperty(t,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){this.parentNode.removeChild(this)}})})),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var i=Object(this),n=i.length>>>0;if(0==n)return!1;e|=0;for(var r,o,a=Math.max(0<=e?e:n-Math.abs(e),0);a<n;){if((r=i[a])===(o=t)||"number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o))return!0;a++}return!1}})}},e={};!function i(n){var r=e[n];return void 0!==r||(r=e[n]={exports:{}},t[n](r,r.exports,i)),r.exports}(628)})();