L.DistanceMarker=L.CircleMarker.extend({_updatePath(){let t=this._renderer._ctx,i=this._point;if(this.options.rotation=this.options.rotation||0,this.options.radius&&this._renderer._updateCircle&&this._renderer._updateCircle(this),this.options.icon&&this.options.icon.url)if(this.options.icon.element){const e=this.options.icon;let s=i.x+e.offset.x,h=i.y+e.offset.y;t.save(),e.rotate&&(t.translate(i.x,i.y),t.rotate(e.rotate),s=0,h=0),t.drawImage(e.element,s-e.size[0]/2,h-e.size[1]/2,e.size[0],e.size[1]),t.restore()}else{const e=document.createElement("img");this.options.icon=Object.assign({rotate:0,size:[40,40],offset:{x:0,y:0}},this.options.icon),this.options.icon.rotate+=this.options.rotation,this.options.icon.element=e,e.src=this.options.icon.url,e.onload=()=>this.redraw(),e.onerror=()=>this.options.icon=null}if(this.options.label){let e=i.x,s=i.y;t.save(),t.font=this.options.font||'normal 7pt "Helvetica Neue", Arial, Helvetica, sans-serif',t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.options.fillStyle||"black",this.options.rotation&&(t.translate(i.x,i.y),t.rotate(this.options.rotation),e=0,s=0),this._map.getZoom()>17&&(t.fillStyle=this.options.strokeStyle||"black"),t.fillText(this.options.label,e,s),this.options.strokeStyle&&this._map.getZoom()<=17&&(t.strokeStyle=this.options.strokeStyle,t.strokeText(this.options.label,e,s)),t.restore()}}}),L.DistanceMarkers=L.LayerGroup.extend({options:{cssClass:"dist-marker",iconSize:[12,12],arrowSize:[10,10],arrowUrl:"data:image/svg+xml,%3Csvg transform='rotate(90)' xmlns='http://www.w3.org/2000/svg' width='560px' height='560px' viewBox='0 0 560 560'%3E%3Cpath stroke-width='35' fill='%23000' stroke='%23FFF' d='M280,40L522,525L280,420L38,525z'/%3E%3C/svg%3E",offset:1e3,showAll:12,textFunction:(t,i,e)=>i,distance:!0,direction:!0},initialize(t,i,e){this._layers={},this._zoomLayers={},e=L.Util.setOptions(this,e);let s=i.options.preferCanvas,h=Math.min(i.getMaxZoom(),e.showAll);!s&&!i.options.rotate&&console.warn('Missing dependency: "leaflet-rotate"');let c=typeof t.getLatLngs=="function"?t.getLatLngs():t;c=L.LineUtil.isFlat(c)?[c]:c,c.forEach(r=>{let n=0,o=r.map((a,d)=>(d&&(n+=r[d-1].distanceTo(a)),n)),S=o.length>0?o[o.length-1]:0;for(let a=1,d=Math.floor(S/e.offset),l=0;a<=d;++a){let y=e.offset*a;for(;l{let r=this._lastZoomLevel||0,n=i.getZoom();if(n>r)for(let o=r+1;o<=n;++o)this._zoomLayers[o]!==void 0&&this.addLayer(this._zoomLayers[o]);else if(nn;--o)this._zoomLayers[o]!==void 0&&this.removeLayer(this._zoomLayers[o]);this._lastZoomLevel=n};i.on("zoomend",u),u()},_minimumZoomLevelForItem(t,i){for(;t>0&&t%2===0;)--i,t=Math.floor(t/2);return i}}),L.Polyline.include({_originalOnAdd:L.Polyline.prototype.onAdd,_originalOnRemove:L.Polyline.prototype.onRemove,addDistanceMarkers(){this._map&&this._distanceMarkers&&this._map.addLayer(this._distanceMarkers)},removeDistanceMarkers(){this._map&&this._distanceMarkers&&this._map.removeLayer(this._distanceMarkers)},onAdd(t){this._originalOnAdd(t);let i=this.options.distanceMarkers||{};this.options.distanceMarkers&&(this._distanceMarkers=this._distanceMarkers||new L.DistanceMarkers(this,t,i)),(i.lazy===void 0||i.lazy===!1)&&this.addDistanceMarkers()},onRemove(t){this.removeDistanceMarkers(),this._originalOnRemove(t)}});