From d2e6b3fbbce40e0952c1e23a624ae378f348b10b Mon Sep 17 00:00:00 2001 From: Carlo Espinal Date: Tue, 21 Apr 2020 10:28:54 -0600 Subject: [PATCH] First timer: Remove jQuery part 1 (#540) * refactored two ajax request to simple xhr * added verify to request success * changed requests to fetch api * Rebase * check out package.json * Revert package.json state to main * change request url mistype and fixed response transform * Rebase * Rebase package-lock * Update response 200 to response.ok Co-authored-by: sashadev-sky --- dist/leaflet.distortableimage.js | 2 +- src/edit/DistortableCollection.Edit.js | 34 +++++++++++++------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/dist/leaflet.distortableimage.js b/dist/leaflet.distortableimage.js index 0113a0e3b..c018f639b 100644 --- a/dist/leaflet.distortableimage.js +++ b/dist/leaflet.distortableimage.js @@ -1,2 +1,2 @@ -!function(t){var e={};function i(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(o,n,function(e){return t[e]}.bind(null,n));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/dist/",i(i.s=0)}([function(t,e,i){i(1),i(2),i(3),i(4),i(5),i(6),i(7),i(8),i(9),i(10),i(11),i(12),i(13),i(14),i(15),i(16),i(17),i(18),i(19),i(20),i(21),i(22),i(23),i(24),i(25),i(26),i(27),i(28),i(29),i(30),i(31),i(32),i(33),i(34),i(35),i(36),i(37),i(38),i(39),i(40),i(41),i(42),t.exports=i(43)},function(t,e){L.DomUtil=L.extend(L.DomUtil,{initTranslation:function(t){this.translation=t},getMatrixString:function(t){var e=L.Browser.webkit3d||L.Browser.gecko3d||L.Browser.ie3d,i=[t[0],t[3],0,t[6],t[1],t[4],0,t[7],0,0,1,0,t[2],t[5],0,t[8]],o=e?"matrix3d("+i.join(",")+")":"";return e||console.log("Your browser must support 3D CSS transformsin order to use DistortableImageOverlay."),o},toggleClass:function(t,e){var i=e;return this.hasClass(t,i)?this.removeClass(t,i):this.addClass(t,i)},confirmDelete:function(){return window.confirm(this.translation.confirmImageDelete)},confirmDeletes:function(t){if(1!==t){var e=this.translation.confirmImagesDeletes,i="";return i="function"==typeof e?e(t):t+" "+e,window.confirm(i)}this.confirmDelete()}})},function(t,e){L.IconUtil={create:function(t){return/^#/.test(t)&&(t=t.replace(/^#/,"")),''},addClassToSvg:function(t,e){var i=t.querySelector("svg");i&&L.DomUtil.addClass(i,e)},toggleXlink:function(t,e,i){/^#/.test(e)||(e="#"+e),/^#/.test(i)||(i="#"+i);var o=t.querySelector("use");if(o){var n=o.getAttribute("xlink:href")===e?i:e;return o.setAttribute("xlink:href",n),n}return!1},toggleTitle:function(t,e,i){var o=t.getAttribute("title")===e?i:e;return t.setAttribute("title",o),t.hasAttribute("aria-label")&&t.setAttribute("aria-label",o),o}}},function(t,e){L.ImageUtil={getCmPerPixel:function(t){var e=t._map;return 100*e.latLngToLayerPoint(t.getCorner(0)).distanceTo(e.latLngToLayerPoint(t.getCorner(1)))/t.getElement().width}}},function(t,e){L.MatrixUtil={adj:function(t){return[t[4]*t[8]-t[5]*t[7],t[2]*t[7]-t[1]*t[8],t[1]*t[5]-t[2]*t[4],t[5]*t[6]-t[3]*t[8],t[0]*t[8]-t[2]*t[6],t[2]*t[3]-t[0]*t[5],t[3]*t[7]-t[4]*t[6],t[1]*t[6]-t[0]*t[7],t[0]*t[4]-t[1]*t[3]]},multmm:function(t,e){var i,o=[];for(i=0;i<3;i++)for(var n=0;n<3;n++){for(var a=0,s=0;s<3;s++)a+=t[3*i+s]*e[3*s+n];o[3*i+n]=a}return o},multmv:function(t,e){return[t[0]*e[0]+t[1]*e[1]+t[2]*e[2],t[3]*e[0]+t[4]*e[1]+t[5]*e[2],t[6]*e[0]+t[7]*e[1]+t[8]*e[2]]},multsm:function(t,e){for(var i=[],o=0,n=e.length;o2&&void 0!==arguments[2]?arguments[2]:"deg";return"deg"===i?this.radiansToDegrees(Math.atan2(e,t)):Math.atan2(e,t)},radiansToDegrees:function(t){return 180*t/Math.PI},degreesToRadians:function(t){return t*Math.PI/180}}},function(t,e){L.Utils={initTranslation:function(){var t={deleteImage:"Delete Image",deleteImages:"Delete Images",distortImage:"Distort Image",dragImage:"Drag Image",exportImage:"Export Image",exportImages:"Export Images",removeBorder:"Remove Border",addBorder:"Add Border",freeRotateImage:"Free rotate Image",geolocateImage:"Geolocate Image",lockMode:"Lock Mode",lockImages:"Lock Images",makeImageOpaque:"Make Image Opaque",makeImageTransparent:"Make Image Transparent",restoreImage:"Restore Natural Image",rotateImage:"Rotate Image",scaleImage:"Scale Image",stackToFront:"Stack to Front",stackToBack:"Stack to Back",unlockImages:"Unlock Images",confirmImageDelete:"Are you sure? This image will be permanently deleted from the map.",confirmImagesDeletes:"Are you sure? These images will be permanently deleted from the map."};if(this.options.translation)for(var e in t)this.options.translation.hasOwnProperty(e)||(this.options.translation[e]=t[e]);else this.options.translation=t;L.DomUtil.initTranslation(this.options.translation)},getNestedVal:function(t,e,i){return[e,i].reduce((function(t,e){return t&&t[e]}),t)}}},function(t,e){L.DistortableImageOverlay=L.ImageOverlay.extend({options:{height:200,crossOrigin:!0,edgeMinWidth:50,editable:!0,mode:"distort",selected:!1},initialize:function(t,e){L.setOptions(this,e),L.Utils.initTranslation.call(this),this.edgeMinWidth=this.options.edgeMinWidth,this.editable=this.options.editable,this._selected=this.options.selected,this._url=t,this.rotation={}},onAdd:function(t){this._map=t,this.getElement()||this._initImage(),t.on("viewreset",this._reset,this),this.options.corners&&(this._corners=this.options.corners,t.options.zoomAnimation&&L.Browser.any3d&&t.on("zoomanim",this._animateZoom,this)),L.DomEvent.on(this.getElement(),"load",(function(){if(this.getPane().appendChild(this.getElement()),this._initImageDimensions(),this.options.rotation){var e=this.options.rotation.deg?"deg":"rad";this.setAngle(this.options.rotation[e],e)}else this.rotation={deg:0,rad:0},this._reset();this._corners||t.options.zoomAnimation&&L.Browser.any3d&&t.on("zoomanim",this._animateZoom,this);var i=this._eventParents;i?(this.eP=i[Object.keys(i)[0]],this.eP.editable&&this.editing.enable()):(this.editable&&this.editing.enable(),this.eP=null)}),this),L.DomEvent.on(this.getElement(),"click",this.select,this),L.DomEvent.on(t,{singleclickon:this._singleClickListeners,singleclickoff:this._resetClickListeners,singleclick:this._singleClick},this),t.doubleClickZoom.enabled()||t.doubleClickLabels.enabled()||L.DomEvent.on(t,"click",this.deselect,this),this.fire("add")},onRemove:function(t){L.DomEvent.off(this.getElement(),"click",this.select,this),L.DomEvent.off(t,{singleclickon:this._singleClickListeners,singleclickoff:this._resetClickListeners,singleclick:this._singleClick},this),L.DomEvent.off(t,"click",this.deselect,this),this.editing&&this.editing.disable(),this.fire("remove"),L.ImageOverlay.prototype.onRemove.call(this,t)},_initImageDimensions:function(){var t=this._map,e=L.DomUtil.getStyle(this.getElement(),"width"),i=L.DomUtil.getStyle(this.getElement(),"height"),o=parseInt(e)/parseInt(i),n=this.options.height,a=parseInt(o*n),s=t.project(t.getCenter()),r=L.point(a,n).divideBy(2);this.options.corners?this._corners=this.options.corners:this._corners=[t.unproject(s.subtract(r)),t.unproject(s.add(L.point(r.x,-r.y))),t.unproject(s.add(L.point(-r.x,r.y))),t.unproject(s.add(r))],this._initialDimensions={center:s,offset:r,zoom:t.getZoom()},this.setBounds(L.latLngBounds(this.getCorners()))},_singleClick:function(t){"singleclick"===t.type&&this.deselect()},_singleClickListeners:function(){var t=this._map;L.DomEvent.off(t,"click",this.deselect,this),L.DomEvent.on(t,"singleclick",this.deselect,this)},_resetClickListeners:function(){var t=this._map;L.DomEvent.on(t,"click",this.deselect,this),L.DomEvent.off(t,"singleclick",this.deselect,this)},isSelected:function(){return this._selected},deselect:function(){var t=this.editing;if(t.enabled())return t._removeToolbar(),t._hideMarkers(),this._selected=!1,this},select:function(t){var e=this.editing,i=this.eP;if(e.enabled()){if(t&&L.DomEvent.stopPropagation(t),this._programmaticGrouping(),this._selected=!0,e._addToolbar(),e._showMarkers(),!i||!i.anyCollected())return this;this.deselect()}},_programmaticGrouping:function(){this._map.eachLayer((function(t){t instanceof L.DistortableImageOverlay&&t.deselect()}))},setCorner:function(t,e){var i=this.editing;return this._corners[t]=e,this.setBounds(L.latLngBounds(this.getCorners())),this.fire("update"),i.toolbar&&i.toolbar instanceof L.DistortableImage.PopupBar&&i._updateToolbarPos(),this.edited=!0,this},_cornerExceedsMapLats:function(t,e,i){var o,n;return 0===t?(o=i.project(e).y<2,n=i.project(e).y>=255):(o=i.project(e).y/t<2,n=i.project(e).y/Math.pow(2,t)>=255),o||n},setCorners:function(t){var e=this._map,i=e.getZoom(),o=this.editing,n=0;for(var a in t)if(this._cornerExceedsMapLats(i,t[a],e))return this.setBounds(L.latLngBounds(this.getCorners())),void this.fire("update");for(a in t)this._corners[n]=t[a],n+=1;return this.setBounds(L.latLngBounds(this.getCorners())),this.fire("update"),o.toolbar&&o.toolbar instanceof L.DistortableImage.PopupBar&&o._updateToolbarPos(),this.edited=!0,this},setCornersFromPoints:function(t){var e=this._map,i=e.getZoom(),o=this.editing,n=0;for(var a in t){var s=e.layerPointToLatLng(t[a]);if(this._cornerExceedsMapLats(i,s,e))return this.setBounds(L.latLngBounds(this.getCorners())),void this.fire("update")}for(a in t)this._corners[n]=e.layerPointToLatLng(t[a]),n+=1;return this.setBounds(L.latLngBounds(this.getCorners())),this.fire("update"),o.toolbar&&o.toolbar instanceof L.DistortableImage.PopupBar&&o._updateToolbarPos(),this.edited=!0,this},scaleBy:function(t){var e,i,o=this._map,n=o.project(this.getCenter()),a={};if(0!==t){for(e=0;e<4;e++)i=o.project(this.getCorner(e)).subtract(n).multiplyBy(t).add(n),a[e]=o.unproject(i);return this.setCorners(a),this}},getAngle:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"deg",e=this.getElement().style[L.DomUtil.TRANSFORM].split("matrix3d")[1].slice(1,-1).split(","),i=e[0],o=e[1],n=e[4],a=e[5],s=i*a-o*n,r=L.TrigUtil.calcAngle(i,o,"rad");return s<0&&(r+=r<0?Math.PI:-Math.PI),r<0&&(r=2*Math.PI+r),"deg"===t?Math.round(L.TrigUtil.radiansToDegrees(r)):L.Util.formatNum(r,2)},setAngle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"deg",i=this.getAngle(e),o=t-i;return this.rotateBy(o,e),this},rotateBy:function(t){var e,i,o,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"deg",a=this._map,s=a.project(this.getCenter()),r={};for("deg"===n&&(t=L.TrigUtil.degreesToRadians(t)),e=0;e<4;e++)i=a.project(this.getCorner(e)).subtract(s),o=L.point(Math.cos(t)*i.x-Math.sin(t)*i.y,Math.sin(t)*i.x+Math.cos(t)*i.y),r[e]=a.unproject(o.add(s));return this.setCorners(r),this},dragBy:function(t,e){var i,o,n=this._map,a={},s=n.project(t).subtract(n.project(e));for(i=0;i<4;i++)o=n.project(this.getCorner(i)).subtract(s),a[i]=n.unproject(o);this.setCorners(a)},restore:function(){for(var t=this._map,e=this._initialDimensions.center,i=this._initialDimensions.offset,o=this._initialDimensions.zoom,n=[e.subtract(i),e.add(L.point(i.x,-i.y)),e.add(L.point(-i.x,i.y)),e.add(i)],a=0;a<4;a++)t.unproject(n[a],o).equals(this.getCorner(a))||this.setCorner(a,t.unproject(n[a],o));return this.edited=!1,this.fire("restore"),this},_getTranslateString:function(t){var e=L.Browser.webkit3d,i=(e?",0":"")+")";return"translate"+(e?"3d":"")+"("+t.x+"px,"+t.y+"px"+i},_reset:function(){var t=this._map,e=this.getElement(),i=L.bind(t.latLngToLayerPoint,t),o=this._calculateProjectiveTransform(i),n=i(this.getCorner(0)),a=L.DomUtil.getMatrixString(o),s=this._getTranslateString(n);e._leaflet_pos=n,e.style[L.DomUtil.TRANSFORM]=[s,a].join(" "),e.style[L.DomUtil.TRANSFORM+"-origin"]="0 0 0",this.rotation.deg=this.getAngle(),this.rotation.rad=this.getAngle("rad")},_animateZoom:function(t){var e=this._map,i=this.getElement(),o=function(i){return e._latLngToNewLayerPoint(i,t.zoom,t.center)},n=this._calculateProjectiveTransform(o),a=o(this.getCorner(0)),s=L.DomUtil.getMatrixString(n),r=this._getTranslateString(a);i._leaflet_pos=a,i.style[L.DomUtil.TRANSFORM]=[r,s].join(" ")},getCorners:function(){return this._corners},getCorner:function(t){return this._corners[t]},getCenter:function(){var t=this._map,e=this.getCorners().reduce((function(e,i){return e.add(t.project(i))}),L.point(0,0));return t.unproject(e.divideBy(4))},_calculateProjectiveTransform:function(t){var e,i=t(this.getCorner(0)),o=this.getElement().offsetWidth||500,n=this.getElement().offsetHeight||375,a=[];for(e=0;e<4;e++)a.push(t(this.getCorner(e))._subtract(i));return L.MatrixUtil.general2DProjection(0,0,a[0].x,a[0].y,o,0,a[1].x,a[1].y,0,n,a[2].x,a[2].y,o,n,a[3].x,a[3].y)}}),L.distortableImageOverlay=function(t,e){return new L.DistortableImageOverlay(t,e)},L.Map.addInitHook((function(){L.DomUtil.hasClass(this.getContainer(),"ldi")||L.DomUtil.addClass(this.getContainer(),"ldi")}))},function(t,e){L.DistortableCollection=L.FeatureGroup.extend({options:{editable:!0,exportOpts:{exportStartUrl:"//export.mapknitter.org/export",statusUrl:"//export.mapknitter.org",exportUrl:"http://export.mapknitter.org/"}},initialize:function(t){L.setOptions(this,t),L.FeatureGroup.prototype.initialize.call(this,t),L.Utils.initTranslation.call(this),this.editable=this.options.editable},onAdd:function(t){L.FeatureGroup.prototype.onAdd.call(this,t),this._map=t,this.editable&&this.editing.enable(),this.on("layeradd",this._addEvents,this),this.on("layerremove",this._removeEvents,this)},onRemove:function(){this.editing&&this.editing.disable(),this.off("layeradd",this._addEvents,this),this.off("layerremove",this._removeEvents,this)},_addEvents:function(t){var e=t.layer;L.DomEvent.on(e,{dragstart:this._dragStartMultiple,drag:this._dragMultiple},this),L.DomEvent.on(e.getElement(),{mousedown:this._deselectOthers,contextmenu:this._longPressMultiSelect},this)},_removeEvents:function(t){var e=t.layer;L.DomEvent.off(e,{dragstart:this._dragStartMultiple,drag:this._dragMultiple},this),L.DomEvent.off(e.getElement(),{mousedown:this._deselectOthers,contextmenu:this._longPressMultiSelect},this)},_longPressMultiSelect:function(t){this.editable&&(t.preventDefault(),this.eachLayer((function(e){var i=e.editing;e.getElement()===t.target&&i.enabled()&&(L.DomUtil.toggleClass(e.getElement(),"collected"),this.anyCollected()?(e.deselect(),this.editing._addToolbar()):this.editing._removeToolbar())}),this))},isCollected:function(t){return L.DomUtil.hasClass(t.getElement(),"collected")},anyCollected:function(){return this.getLayers().some(this.isCollected.bind(this))},_toggleCollected:function(t,e){t.shiftKey&&e.editing.enabled()&&L.DomUtil.toggleClass(t.target,"collected"),this.anyCollected()?e.deselect():this.editing._removeToolbar()},_deselectOthers:function(t){this.editable&&(this.eachLayer((function(e){e.getElement()!==t.target?e.deselect():this._toggleCollected(t,e)}),this),t&&L.DomEvent.stopPropagation(t))},_dragStartMultiple:function(t){var e,i=t.target,o=this._map;this.isCollected(i)&&this.eachLayer((function(t){for(t._dragStartPoints={},t.deselect(),e=0;e<4;e++){var i=t.getCorner(e);t._dragStartPoints[e]=o.latLngToLayerPoint(i)}}))},_dragMultiple:function(t){var e=t.target,i=this._map;if(this.isCollected(e)){var o=i.latLngToLayerPoint(e.getCorner(0)),n=e._dragStartPoints[0].subtract(o);this._updateCollectionFromPoints(n,e)}},_toRemove:function(){return this.getLayers().filter((function(t){var e=t.editing._mode;return this.isCollected(t)&&"lock"!==e}),this)},_toMove:function(t){return this.getLayers().filter((function(e){var i=e.editing._mode;return e!==t&&this.isCollected(e)&&"lock"!==i}),this)},_updateCollectionFromPoints:function(t,e){var i,o=this._toMove(e),n=new L.Transformation(1,-t.x,1,-t.y);o.forEach((function(t){var e={};for(i=0;i<4;i++)e[i]=n.transform(t._dragStartPoints[i]);t.setCornersFromPoints(e)}))},_getAvgCmPerPixel:function(t){return t.reduce((function(t,e){return t+e.cm_per_pixel}),0)/t.length},generateExportJson:function(){var t={images:[]};return this.eachLayer((function(e){if(this.isCollected(e)){var i=e._image.src.split("/"),o=i[i.length-1],n=e.getCorners(),a=[{lat:n[0].lat,lon:n[0].lng},{lat:n[1].lat,lon:n[1].lng},{lat:n[3].lat,lon:n[3].lng},{lat:n[2].lat,lon:n[2].lng}];t.images.push({id:this.getLayerId(e),src:e._image.src,width:e._image.width,height:e._image.height,image_file_name:o,nodes:a,cm_per_pixel:L.ImageUtil.getCmPerPixel(e)})}}),this),t.images=t.images.reverse(),t.avg_cm_per_pixel=this._getAvgCmPerPixel(t.images),t}}),L.distortableCollection=function(t,e){return new L.DistortableCollection(t,e)}},function(t,e){L.EXIF=function(t){if(0!==Object.keys(EXIF.getAllTags(t)).length){console.log(EXIF.getAllTags(t));var e=EXIF.getAllTags(t);if(void 0!==e.GPSLatitude&&void 0!==e.GPSLongitude){e.GPSLatitude[0],e.GPSLatitude[1],e.GPSLatitude[2],e.GPSLongitude[0],e.GPSLongitude[1],e.GPSLongitude[2];"N"!==e.GPSLatitudeRef&&-1,"W"===e.GPSLongitudeRef&&-1}"T"===e.GPSImgDirectionRef||"M"===e.GPSImgDirectionRef?Math.PI/180*(e.GPSImgDirection.numerator/e.GPSImgDirection.denominator-90):console.log("No compass data found"),console.log("Orientation:",e.Orientation),6===e.Orientation?Math.PI/180*-90:8===e.Orientation?Math.PI/180*90:3===e.Orientation&&Math.PI/180*180,void 0!==e.GPSAltitude&&void 0!==e.GPSAltitudeRef&&(void 0!==e.GPSAltitude&&void 0!==e.GPSAltitudeRef?e.GPSAltitude.numerator/e.GPSAltitude.denominator+e.GPSAltitudeRef:0)}else alert("EXIF initialized. Press again to view data in console.")}},function(t,e){L.EditHandle=L.Marker.extend({initialize:function(t,e,i){var o=t.getCorner(e);L.setOptions(this,i),this._handled=t,this._corner=e;var n={draggable:!0,zIndexOffset:10};i&&i.hasOwnProperty("draggable")&&(n.draggable=i.draggable),L.Marker.prototype.initialize.call(this,o,n)},onAdd:function(t){L.Marker.prototype.onAdd.call(this,t),this._bindListeners(),this.updateHandle()},onRemove:function(t){this._unbindListeners(),L.Marker.prototype.onRemove.call(this,t)},_onHandleDragStart:function(){this._handled.fire("editstart")},_onHandleDragEnd:function(){this._fireEdit()},_fireEdit:function(){this._handled.edited=!0,this._handled.fire("edit")},_bindListeners:function(){this.on({contextmenu:L.DomEvent.stop,dragstart:this._onHandleDragStart,drag:this._onHandleDrag,dragend:this._onHandleDragEnd},this),this._handled._map.on("zoomend",this.updateHandle,this),this._handled.on("update",this.updateHandle,this)},_unbindListeners:function(){this.off({contextmenu:L.DomEvent.stop,dragstart:this._onHandleDragStart,drag:this._onHandleDrag,dragend:this._onHandleDragEnd},this),this._handled._map.off("zoomend",this.updateHandle,this),this._handled.off("update",this.updateHandle,this)},_calculateScalingFactor:function(t,e){var i=this._handled,o=i._map,n=o.latLngToLayerPoint(i.getCenter()),a=o.latLngToLayerPoint(t),s=o.latLngToLayerPoint(e),r=this._d2(n,a),l=this._d2(n,s);return Math.sqrt(l/r)},_d2:function(t,e){var i=t.x-e.x,o=t.y-e.y;return Math.pow(i,2)+Math.pow(o,2)},calculateAngleDelta:function(t,e){var i=this._handled,o=i._map,n=o.latLngToLayerPoint(i.getCenter()),a=o.latLngToLayerPoint(t),s=o.latLngToLayerPoint(e),r=Math.atan2(n.y-a.y,n.x-a.x);return Math.atan2(n.y-s.y,n.x-s.x)-r}})},function(t,e){L.DistortHandle=L.EditHandle.extend({options:{TYPE:"distort",icon:L.icon({iconUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAklEQVR4AewaftIAAAChSURBVO3BIU4DURgGwNkvL2B6AkQTLBqP4QCoSm7DDXoBLBZHDbfgICAIZjEV3YTn9uVHdMZZtcnCfI13bIzxg0emg6Nm6QVbYz3jylEsXRrvwommb49X67jFkz80fR9Mb1YxTzqiWBSLYlEsikWxKBbFolgUi2JRLIpFsSgWxaJY03fHHOu40dH07bAzWCx9Ge/TiWbpHgdsjPGNB2f/yS+7xRCyiiZPJQAAAABJRU5ErkJggg==",iconSize:[32,32],iconAnchor:[16,16]})},_onHandleDrag:function(){this._handled.setCorner(this._corner,this.getLatLng())},updateHandle:function(){this.setLatLng(this._handled.getCorner(this._corner))}}),L.distortHandle=function(t,e,i){return new L.DistortHandle(t,e,i)}},function(t,e){L.DragHandle=L.EditHandle.extend({options:{TYPE:"drag",icon:L.icon({iconUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAsVJREFUeNrMVztLXEEUvnNVFAVBAhY2aRKbTZEHJNpYabuNjSgYg/GxdsmPSJkUAa/ZdVEX8mgWYVutbHxAHkVskjQBuUUgBISVhCQk3wnfwMlk1rusN1wHPubOzJlzvjlz5sxc01Ma/hUEwQnwDIjqc7uvgv9YYO86qgIwCXQbdNTlQ8kcCBHgBch8TcloF6oJGr6phk6EQAkfdz3zvgDr9Mr7Fg1fptEZoM8jsmrokpfsiIFO4IIjuE2v1EDmR4LRdlR5Gh51hj8D34ABtm8YTtqna0TgklIw5CgQguKxIojEjmFROg/MKQO27NkFAB+4wAPouGUJiIvWKHwbAxX2XyWRKWkqhT+pbJntJZJuUzISW0+5hW+obxrVBsfvoH/dqCCJuU97GBh2VteLSiYvArmErT8EVoAK9Bw7enbpVYmvAQlyowYforrH5jXL2rPHI/TKONDB7u9AlavdaTBPvPmazUeQuy8f7UomUgTEwIJPEQ3sQGE/6ll2l9H/KcEzBcfWn2IclluM3DpddJxSHujlFkscbUPvmB0LHVnLrId7nlaZVkEc6QGXQI1MAwZcWmVRHeNaQwJMMiU2cwy4s7p/RJ2ckpvIQs+cIs+5GzitloLKHUV3MPREuXbTOKO91dX387gGTONxIgEWm+E61FFrpcyqXLHsEwiDjEsjAksqw5XPoL9MHVrn6QR4q+XZrDaR4RoWzq2ymafuRA/Mq1stSsHLVkcbdf9VjOcx8ZH3+SFWcCWlVPyWuUBOwUWdC1wP5NVjYiXFWLO69PZ6CRTUY6KSIoEKdf6T3IzzgHxnsyHctNBEkmn6Oob8ExUDg/ahGybd177cDjzH5xHwgDiSvoS7I/LZyvxJZj0wod7tkX5G0XVC7rEyLhfLJjBGbKoLLEfZWObyKeZ6oY82g+yf5Zn/mJyHX7PMf04z/T3/LcAAu4E6iiyJqf0AAAAASUVORK5CYII=",iconSize:[32,32],iconAnchor:[16,16]})},_onHandleDrag:function(){var t=this._handled,e=t.getCorner(this._corner),i=this.getLatLng();t.dragBy(e,i)},updateHandle:function(){this.setLatLng(this._handled.getCorner(this._corner))}})},function(t,e){L.FreeRotateHandle=L.EditHandle.extend({options:{TYPE:"freeRotate",icon:L.icon({iconUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAklEQVR4AewaftIAAAHiSURBVMXBa3HbShgA0PMp/1sCCo8oCEpgTaCXgIXAJiDzyCJoAUTm4UVQAns1Y8+snWnTvJyeE16hkjDgDrfoNTMKcpC9UPiLSo8JyetkjEHxjPCMyoS199kFoz8Iv1HpMaN3qWDCHoegOKkkRwnJpRmroHgiPFEZ8IBekzEGxQtUEhKSS/fB7Ew4U+lxcGkVZG9QWWPSFAxBcdK59KApuA+yNwp2uEdx1GN25sZJZULSfAtm77SlbNjju6MvG75u+WHRWVR6rDVjMPsgwYyVZl3pLTpHkyYHOx8syMiayaJzlDTZ9YyaZNFVkiYH2ZUEBcVJJXVImuz6Js3Qofe59pq7DoOTILu+g+a288mCouk7/1iH4qTS+2QdDppbV1ZJmrnDXnPnc5UOs2Z0fUmTuyBr+krvSioJyUmQO0dZM7mepMkWnaNRkyrJB6uskTSjxY3Fll8bvmJwlDb83FJ8gMqAB80uyBY3Trb82PAfvjj6vuHnluIdKgMeNXOwctK5NKBoHitrb1RJeHRp5Ux4ojLg0aWMHGQvUOkxIWkKVsHsTPiNSo8HDC5lZIsgO6n0uMUdRvQuFQxB8UR4RmXC2vvsgtEfhL+o9JiQvE7GGBTPCK9QSUjoMWgKDthjDrIX+h/k0I7gth6N5gAAAABJRU5ErkJggg==",iconSize:[32,32],iconAnchor:[16,16]})},_onHandleDrag:function(){var t=this._handled,e=t._map,i=t.edgeMinWidth,o=t.getCorner(this._corner),n=this.getLatLng(),a=this.calculateAngleDelta(o,n),s=this._calculateScalingFactor(o,n);0!==a&&t.rotateBy(a,"rad"),i||(i=50);var r=e.latLngToContainerPoint(t.getCorner(0)),l=e.latLngToContainerPoint(t.getCorner(1)),c=Math.abs(r.x-l.x),d=Math.abs(r.y-l.y);Math.sqrt(c*c+d*d)>i||s>1?t.scaleBy(s):t.scaleBy(1)},updateHandle:function(){this.setLatLng(this._handled.getCorner(this._corner))}}),L.freeRotateHandle=function(t,e,i){return new L.FreeRotateHandle(t,e,i)}},function(t,e){L.LockHandle=L.EditHandle.extend({options:{TYPE:"lock",interactive:!1,icon:L.icon({iconUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAklEQVR4AewaftIAAAD8SURBVO3BPU7CYAAA0AdfjIcQlRCQBG7C3gk2uIPG2RC3Dk16Gz0FTO1WZs/gwGCMP/2+xsSl7+n1er1Iz9LtRQjaPeMeO+TinLDCJV78YqjdA04YodKuxhUaPGoRxMmxwRQZSt87Yo4KExGCeAUyLLFB4bMacxywEClIU2KDKXbInTUYo8JCgoFuGoxQO5uiwY1EA91VmDqrcKeDoX8WdNNgjApvmGGLXKIgXY0xGkxQYItrrFFIEKQ5Yo4KEx9yrDFDhlKkIF6NOQ5Y+KpAhiXWKEQI4pxwiwoLPyuxwQw75FoE7fZYocFEuwI7jHCBV39gL92TXq/Xi/AOcmczZmaIMScAAAAASUVORK5CYII=",iconSize:[32,32],iconAnchor:[16,16]})},onRemove:function(t){this.unbindTooltip(),L.EditHandle.prototype.onRemove.call(this,t)},_bindListeners:function(){var t=this.getElement();L.EditHandle.prototype._bindListeners.call(this),L.DomEvent.on(t,{mousedown:this._tooltipOn,mouseup:this._tooltipOff},this),L.DomEvent.on(document,"pointerleave",this._tooltipOff,this)},_unbindListeners:function(){var t=this.getElement();L.EditHandle.prototype._bindListeners.call(this),L.DomEvent.off(t,{mousedown:this._tooltipOn,mouseup:this._tooltipOff},this),L.DomEvent.off(document,"pointerleave",this._tooltipOff,this)},_onHandleDrag:function(){},updateHandle:function(){this.setLatLng(this._handled.getCorner(this._corner))},_tooltipOn:function(t){var e=this._handled.parentGroup,i=e?e.editing:this._handled.editing;if(!t.shiftKey&&(this._handled.isSelected()||!e||e.isCollected(this._handled))){var o=i._lockHandles;this._timer=setTimeout(L.bind((function(){this._timeout&&clearTimeout(this._timeout),this.getTooltip()?o.eachLayer((function(t){this!==t&&t.closeTooltip()})):this.bindTooltip("Locked!",{permanent:!0}),this.openTooltip()}),this),500)}},_tooltipOff:function(t){var e=this._handled.parentGroup,i=e?e.editing:this._handled.editing;if(!t.shiftKey&&(this._handled.isSelected()||!e||e.isCollected(this._handled))){var o=i._lockHandles;t.currentTarget===document&&o.eachLayer((function(t){t.closeTooltip()})),this._timer&&clearTimeout(this._timer),this._timeout=setTimeout(L.bind((function(){this.closeTooltip()}),this),400)}}}),L.lockHandle=function(t,e,i){return new L.LockHandle(t,e,i)}},function(t,e){L.RotateHandle=L.EditHandle.extend({options:{TYPE:"rotate",icon:L.icon({iconUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAklEQVR4AewaftIAAAHiSURBVMXBa3HbShgA0PMp/1sCCo8oCEpgTaCXgIXAJiDzyCJoAUTm4UVQAns1Y8+snWnTvJyeE16hkjDgDrfoNTMKcpC9UPiLSo8JyetkjEHxjPCMyoS199kFoz8Iv1HpMaN3qWDCHoegOKkkRwnJpRmroHgiPFEZ8IBekzEGxQtUEhKSS/fB7Ew4U+lxcGkVZG9QWWPSFAxBcdK59KApuA+yNwp2uEdx1GN25sZJZULSfAtm77SlbNjju6MvG75u+WHRWVR6rDVjMPsgwYyVZl3pLTpHkyYHOx8syMiayaJzlDTZ9YyaZNFVkiYH2ZUEBcVJJXVImuz6Js3Qofe59pq7DoOTILu+g+a288mCouk7/1iH4qTS+2QdDppbV1ZJmrnDXnPnc5UOs2Z0fUmTuyBr+krvSioJyUmQO0dZM7mepMkWnaNRkyrJB6uskTSjxY3Fll8bvmJwlDb83FJ8gMqAB80uyBY3Trb82PAfvjj6vuHnluIdKgMeNXOwctK5NKBoHitrb1RJeHRp5Ux4ojLg0aWMHGQvUOkxIWkKVsHsTPiNSo8HDC5lZIsgO6n0uMUdRvQuFQxB8UR4RmXC2vvsgtEfhL+o9JiQvE7GGBTPCK9QSUjoMWgKDthjDrIX+h/k0I7gth6N5gAAAABJRU5ErkJggg==",iconSize:[32,32],iconAnchor:[16,16]})},_onHandleDrag:function(){var t=this._handled,e=t.getCorner(this._corner),i=this.getLatLng(),o=this.calculateAngleDelta(e,i);t.rotateBy(o,"rad")},updateHandle:function(){this.setLatLng(this._handled.getCorner(this._corner))}}),L.rotateHandle=function(t,e,i){return new L.RotateHandle(t,e,i)}},function(t,e){L.ScaleHandle=L.EditHandle.extend({options:{TYPE:"scale",icon:L.icon({iconUrl:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHdpZHRoPSI0NTkiIGhlaWdodD0iNDY0IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA1MTIgNTEyIiB4bWw6c3BhY2U9InByZXNlcnZlIiBzdHlsZT0iIj48cmVjdCBpZD0iYmFja2dyb3VuZHJlY3QiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHg9IjAiIHk9IjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0ibm9uZSIgY2xhc3M9IiIgc3R5bGU9IiIvPjxnIGNsYXNzPSJjdXJyZW50TGF5ZXIiIHN0eWxlPSIiPjx0aXRsZT5MYXllciAxPC90aXRsZT48cGF0aCBkPSJNNDU5LjA0OTE1OTUzMDQ3MTM0LDg2LjkyNjIzNDUxMjU1MDAyIFYwIGgtODUuNzE0NTczMzU2MzEyMDkgdjI3LjA0MzcxNzQwMzkwNDQ1MiBIODUuNzE0NTczMzU2MzEyMDMgVjAgSDAgdjg2LjkyNjIzNDUxMjU1MDAyIGgyNS43MTQzNzIwMDY4OTM2MjYgdjI4OS43NTQxMTUwNDE4MzM0IEgwIHY4Ni45MjYyMzQ1MTI1NTAwMiBoODUuNzE0NTczMzU2MzEyMDkgdi0yNy4wNDM3MTc0MDM5MDQ0NTIgaDI4NS43MTUyNDQ1MjEwNDAzIHYyNy4wNDM3MTc0MDM5MDQ0NTIgaDg1LjcxNDU3MzM1NjMxMjA5IHYtODYuOTI2MjM0NTEyNTUwMDIgaC0yMy44MDk2MDM3MTAwODY2OSBWODYuOTI2MjM0NTEyNTUwMDIgSDQ1OS4wNDkxNTk1MzA0NzEzNCB6TTM4NC43NjMxOTU5NTUwMDA5LDEyLjU1NjAxMTY1MTgxMjc4MSBoNjEuOTA0OTY5NjQ2MjI1Mzk2IHY2Mi43ODAwNTgyNTkwNjM5MSBoLTYxLjkwNDk2OTY0NjIyNTM5NiBWMTIuNTU2MDExNjUxODEyNzgxIHpNMTIuMzgwOTkzOTI5MjQ1MDUsMTIuNTU2MDExNjUxODEyNzgxIGg2MS45MDQ5Njk2NDYyMjUzOTYgdjYyLjc4MDA1ODI1OTA2MzkxIEgxMi4zODA5OTM5MjkyNDUwNSBWMTIuNTU2MDExNjUxODEyNzgxIHpNNzQuMjg1OTYzNTc1NDcwNTMsNDUxLjA1MDU3MjQxNTEyMDY2IEgxMi4zODA5OTM5MjkyNDUwNSB2LTYyLjc4MDA1ODI1OTA2MzkxIGg2MS45MDQ5Njk2NDYyMjUzOTYgVjQ1MS4wNTA1NzI0MTUxMjA2NiB6TTQ0NS43MTU3ODE0NTI4MjI3NCw0NTEuMDUwNTcyNDE1MTIwNjYgaC02Mi44NTczNTM3OTQ2Mjg4NjQgdi02Mi43ODAwNTgyNTkwNjM5MSBoNjIuODU3MzUzNzk0NjI4ODY0IFY0NTEuMDUwNTcyNDE1MTIwNjYgek00MDcuNjIwNDE1NTE2Njg0MjYsMzc2LjY4MDM0OTU1NDM4MzQ0IGgtMzYuMTkwNTk3NjM5MzMxNzcgdjMyLjgzODc5OTcwNDc0MTEyIEg4NS43MTQ1NzMzNTYzMTIwMyB2LTMyLjgzODc5OTcwNDc0MTEyIEg0OS41MjM5NzU3MTY5ODAzMiBWODYuOTI2MjM0NTEyNTUwMDIgaDM2LjE5MDU5NzYzOTMzMTc3IFY1MC4yMjQwNDY2MDcyNTExMjUgaDI4Ny42MjAwMTI4MTc4NDcyIHYzNi43MDIxODc5MDUyOTg5IGgzNC4yODU4MjkzNDI1MjQ4MzUgVjM3Ni42ODAzNDk1NTQzODM0NCB6IiBpZD0ic3ZnXzIiIGNsYXNzPSIiIGZpbGw9IiMxYTFhZWIiIGZpbGwtb3BhY2l0eT0iMSIvPjwvZz48L3N2Zz4=",iconSize:[32,32],iconAnchor:[16,16]})},_onHandleDrag:function(){var t=this._handled,e=t._map,i=t.edgeMinWidth,o=t.getCorner(this._corner),n=this.getLatLng(),a=this._calculateScalingFactor(o,n);i||(i=50);var s=e.latLngToLayerPoint(t.getCorner(0)),r=e.latLngToLayerPoint(t.getCorner(1)),l=Math.abs(s.x-r.x),c=Math.abs(s.y-r.y);Math.sqrt(l*l+c*c)>i||a>1?t.scaleBy(a):t.scaleBy(1)},updateHandle:function(){this.setLatLng(this._handled.getCorner(this._corner))}}),L.scaleHandle=function(t,e,i){return new L.ScaleHandle(t,e,i)}},function(t,e){L.IconSet=L.Class.extend({_svg:'',_symbols:"",render:function(){return this.addSymbols(this._symbols),this._svg},addSymbols:function(t){this._svg+=t}})},function(t,e){L.KeymapperIconSet=L.IconSet.extend({_symbols:''})},function(t,e){L.ToolbarIconSet=L.IconSet.extend({_symbols:''})},function(t,e){L.DistortableImage=L.DistortableImage||{},L.distortableImage=L.DistortableImage,L.DistortableImage.action_map={},L.EditAction=L.Toolbar2.Action.extend({options:{toolbarIcon:{svg:!1,html:"",className:"",tooltip:""}},initialize:function(t,e,i){this._overlay=e,this._map=t,L.setOptions(this,i),L.Toolbar2.Action.prototype.initialize.call(this,i),this._injectIconSet()},_createIcon:function(t,e,i){var o=this,n=this.options.toolbarIcon,a=n.className,s=this._overlay.editing;this.toolbar=t,this._icon=L.DomUtil.create("li","",e),this._link=L.DomUtil.create("a","",this._icon),n.svg?this._link.innerHTML=L.IconUtil.create(n.html):this._link.innerHTML=n.html,this._link.setAttribute("href","#"),this._link.setAttribute("title",n.tooltip),this._link.setAttribute("role","button"),L.DomUtil.addClass(this._link,this.constructor.baseClass),a&&(L.DomUtil.addClass(this._link,a),"disabled"===a&&L.DomUtil.addClass(this._icon,a),a===s._mode?L.DomUtil.addClass(this._link,"selected-mode"):L.DomUtil.removeClass(this._link,"selected-mode")),L.DomEvent.on(this._link,"click",this.enable,this),L.DomEvent.on(this._overlay,"update",(function(){var t=o._link.innerHTML.match(/xlink:href="#restore"/);t&&1===t.length&&o._enableAction()})),this._addSubToolbar(t,this._icon,i)},_injectIconSet:function(){if(!document.querySelector("#iconset")){var t=document.createElement("div");t.id="iconset",t.setAttribute("hidden","hidden"),t.innerHTML=(new L.ToolbarIconSet).render(),document.querySelector(".leaflet-marker-pane").appendChild(t)}},_enableAction:function(){L.DomUtil.removeClass(this._link.parentElement,"disabled"),L.DomUtil.removeClass(this._link,"disabled")},_disableAction:function(){L.DomUtil.addClass(this._link.parentElement,"disabled"),L.DomUtil.addClass(this._link,"disabled")}}),L.editAction=function(t,e,i){return new L.EditAction(t,e,i)}},function(t,e){L.BorderAction=L.EditAction.extend({initialize:function(t,e,i){var o,n,a=e.editing,s=a._mode;a._outlined?(o="lock",n=e.options.translation.removeBorder):(o="lock",n=e.options.translation.addBorder),(i=i||{}).toolbarIcon={svg:!0,html:o,tooltip:n,className:"lock"===s?"disabled":""},L.DistortableImage.action_map.b="lock"===s?"":"_toggleBorder",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay.editing;L.IconUtil.toggleXlink(this._link,"border_clear","border_outer"),L.IconUtil.toggleTitle(this._link,"Remove Border","Add Border"),t._toggleBorder()}})},function(t,e){L.DeleteAction=L.EditAction.extend({initialize:function(t,e,i){var o,n=e.editing;n instanceof L.DistortableImage.Edit?(o=e.options.translation.deleteImage,L.DistortableImage.action_map.Backspace="lock"===n._mode?"":"_removeOverlay"):(o=e.options.translation.deleteImages,L.DistortableImage.group_action_map.Backspace="lock"===n._mode?"":"_removeGroup"),(i=i||{}).toolbarIcon={svg:!0,html:"delete_forever",tooltip:o,className:"lock"===n._mode?"disabled":""},L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay.editing;t instanceof L.DistortableImage.Edit?t._removeOverlay():t._removeGroup()}})},function(t,e){L.DistortAction=L.EditAction.extend({initialize:function(t,e,i){(i=i||{}).toolbarIcon={svg:!0,html:"distort",tooltip:e.options.translation.distortImage,className:"distort"},L.DistortableImage.action_map.d="_distortMode",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){this._overlay.editing._distortMode()}})},function(t,e){L.DragAction=L.EditAction.extend({initialize:function(t,e,i){(i=i||{}).toolbarIcon={svg:!0,html:"drag",tooltip:e.options.translation.dragImage,className:"drag"},L.DistortableImage.action_map.D="_dragMode",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){this._overlay.editing._dragMode()}})},function(t,e){L.ExportAction=L.EditAction.extend({initialize:function(t,e,i){var o,n=e.editing;this.isExporting=!1,this.mouseLeaveSkip=!0,this.isHooksExecuted=!1,n instanceof L.DistortableImage.Edit?(L.DistortableImage.action_map.e="_getExport",o=e.options.translation.exportImage):(L.DistortableImage.group_action_map.e="runExporter",o=e.options.translation.exportImages),(i=i||{}).toolbarIcon={svg:!0,html:"get_app",tooltip:o},L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay.editing;if(t instanceof L.DistortableImage.Edit)t._getExport();else if(!this.isHooksExecuted){this.isHooksExecuted=!0;var e=this._link.parentElement;this.mouseEnterHandler=this.handleMouseEnter.bind(this),this.mouseLeaveHandler=this.handleMouseLeave.bind(this),L.DomEvent.on(e,"click",(function(){if(this.isExporting){if(this.mouseLeaveSkip)return;this.resetState(),this.detachMouseEventListeners(e),t.cancelExport()}else this.isExporting=!0,this.renderExportIcon(),setTimeout(this.attachMouseEventListeners.bind(this,e),100),t.runExporter().then(function(){this.resetState(),this.detachMouseEventListeners(e)}.bind(this))}),this)}},resetState:function(){this.renderDownloadIcon(),this.isExporting=!1,this.mouseLeaveSkip=!0},attachMouseEventListeners:function(t){t.addEventListener("mouseenter",this.mouseEnterHandler),t.addEventListener("mouseleave",this.mouseLeaveHandler)},detachMouseEventListeners:function(t){t.removeEventListener("mouseenter",this.mouseEnterHandler),t.removeEventListener("mouseleave",this.mouseLeaveHandler)},handleMouseEnter:function(){this.renderCancelIcon()},handleMouseLeave:function(){this.mouseLeaveSkip?this.mouseLeaveSkip=!1:this.renderExportIcon()},renderDownloadIcon:function(){L.IconUtil.toggleXlink(this._link,"get_app","spinner"),L.IconUtil.toggleTitle(this._link,"Export Images","Loading..."),L.DomUtil.removeClass(this._link.firstChild,"loader")},renderExportIcon:function(){L.IconUtil.toggleXlink(this._link,"spinner"),L.IconUtil.toggleTitle(this._link,"Export Images","Loading..."),L.IconUtil.addClassToSvg(this._link,"loader")},renderCancelIcon:function(){L.IconUtil.toggleXlink(this._link,"cancel"),L.IconUtil.toggleTitle(this._link,"Cancel Export","Loading..."),L.DomUtil.removeClass(this._link.firstChild,"loader")}})},function(t,e){L.FreeRotateAction=L.EditAction.extend({initialize:function(t,e,i){(i=i||{}).toolbarIcon={svg:!0,html:"crop_rotate",tooltip:e.options.translation.freeRotateImage,className:"freeRotate"},L.DistortableImage.action_map.f="_freeRotateMode",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){this._overlay.editing._freeRotateMode()}})},function(t,e){L.GeolocateAction=L.EditAction.extend({initialize:function(t,e,i){var o=e.editing;(i=i||{}).toolbarIcon={svg:!0,html:"explore",tooltip:e.options.translation.geolocateImage,className:"lock"===o._mode?"disabled":""},L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay.getElement();EXIF.getData(t,L.EXIF(t))}})},function(t,e){L.LockAction=L.EditAction.extend({initialize:function(t,e,i){var o,n,a=e.editing;a instanceof L.DistortableImage.Edit?(L.DistortableImage.action_map.u="_unlock",L.DistortableImage.action_map.l="_lock",n=e.options.translation.lockMode,o=a.isMode("lock")?"lock":"unlock"):(L.DistortableImage.group_action_map.l="_lockGroup",n=e.options.translation.lockImages,o="lock"),(i=i||{}).toolbarIcon={svg:!0,html:o,tooltip:n,className:"lock"},L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay.editing;t instanceof L.DistortableImage.Edit?t._toggleLockMode():t._lockGroup()}})},function(t,e){L.OpacityAction=L.EditAction.extend({initialize:function(t,e,i){var o,n,a=e.editing,s=a._mode;a._transparent?(o="opacity_empty",n=e.options.translation.makeImageOpaque):(o="opacity",n=e.options.translation.makeImageTransparent),(i=i||{}).toolbarIcon={svg:!0,html:o,tooltip:n,className:"lock"===s?"disabled":""},L.DistortableImage.action_map.o="lock"===s?"":"_toggleOpacity",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay.editing,e=this._link;L.IconUtil.toggleXlink(e,"opacity","opacity_empty"),L.IconUtil.toggleTitle(e,"Make Image Transparent","Make Image Opaque"),t._toggleOpacity()}})},function(t,e){L.RestoreAction=L.EditAction.extend({initialize:function(t,e,i){var o=L.Utils.getNestedVal(e,"editing","_mode"),n=e.edited;(i=i||{}).toolbarIcon={svg:!0,html:"restore",tooltip:e.options.translation.restoreImage,className:n&&"lock"!==o?"":"disabled"},L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay;L.DomEvent.on(t,{edit:this._enableAction,restore:this._disableAction},this),t.restore()}})},function(t,e){L.RotateAction=L.EditAction.extend({initialize:function(t,e,i){(i=i||{}).toolbarIcon={svg:!0,html:"rotate",tooltip:e.options.translation.rotateImage,className:"rotate"},L.DistortableImage.action_map.r="_rotateMode",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){this._overlay.editing._rotateMode()}})},function(t,e){L.ScaleAction=L.EditAction.extend({initialize:function(t,e,i){(i=i||{}).toolbarIcon={svg:!0,html:"scale",tooltip:e.options.translation.scaleImage,className:"scale"},L.DistortableImage.action_map.s="_scaleMode",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){this._overlay.editing._scaleMode()}})},function(t,e){L.StackAction=L.EditAction.extend({initialize:function(t,e,i){var o,n,a=e.editing;a._toggledImage?(o="flip_to_back",n=e.options.translation.stackToFront):(o="flip_to_front",n=e.options.translation.stackToBack),(i=i||{}).toolbarIcon={svg:!0,html:o,tooltip:n,className:"lock"===a._mode?"disabled":""},L.DistortableImage.action_map.q="lock"===a._mode?"":"_stackUp",L.DistortableImage.action_map.a="lock"===a._mode?"":"_stackDown",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay.editing;L.IconUtil.toggleXlink(this._link,"flip_to_front","flip_to_back"),L.IconUtil.toggleTitle(this._link,"Stack to Front","Stack to Back"),t._toggleOrder()}})},function(t,e){L.UnlockAction=L.EditAction.extend({initialize:function(t,e,i){(i=i||{}).toolbarIcon={svg:!0,html:"unlock",tooltip:e.options.translation.unlockImages},L.DistortableImage.group_action_map.u="_unlockGroup",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){this._overlay.editing._unlockGroup()}})},function(t,e){L.DistortableImage=L.DistortableImage||{},L.distortableImage=L.DistortableImage,L.DistortableImage.action_map={},L.DistortableImage.PopupBar=L.Toolbar2.Popup.extend({options:{anchor:[0,-10]},initialize:function(t,e){L.setOptions(this,e),L.Toolbar2.Popup.prototype.initialize.call(this,t,e)},addHooks:function(t,e){this.map=t,this.ov=e},tools:function(){if(this._ul)return this._ul.children},clickTool:function(t){for(var e=this.tools(),i=0;i=1?this.nextMode():("lock"===t&&this._enableDragging(),this._mode="",this._updateHandle()))},_removeToolbar:function(){var t=this._overlay._map;this.toolbar&&(t.removeLayer(this.toolbar),this.toolbar=!1)},_enableDragging:function(){var t=this._overlay,e=t._map;this.dragging=new L.Draggable(t.getElement()),this.dragging.enable(),this.dragging.on("dragstart",(function(){t.fire("dragstart"),this._removeToolbar()}),this),this.dragging._updatePosition=function(){var i,o,n=t.getCorner(0),a=this._newPos.subtract(e.latLngToLayerPoint(n)),s={};for(this.fire("predrag"),o=0;o<4;o++)i=e.latLngToLayerPoint(t.getCorner(o)),s[o]=e.layerPointToLatLng(i.add(a));t.setCorners(s),t.fire("drag"),this.fire("drag")}},_disableDragging:function(){this.dragging&&(this.dragging.disable(),delete this.dragging)},_dragMode:function(){this.setMode("drag")},_scaleMode:function(){this.setMode("scale")},_distortMode:function(){this.setMode("distort")},_rotateMode:function(){this.setMode("rotate")},_freeRotateMode:function(){this.setMode("freeRotate")},_toggleLockMode:function(){this.hasTool(L.LockAction)&&(this.isMode("lock")?this._unlock():this._lock())},_toggleOpacity:function(){var t,e=this._overlay.getElement();this.hasTool(L.OpacityAction)&&(this._transparent=!this._transparent,t=this._transparent?this.options.opacity:1,L.DomUtil.setOpacity(e,t),e.setAttribute("opacity",t),this._refresh())},_toggleBorder:function(){var t,e=this._overlay.getElement();this.hasTool(L.BorderAction)&&(this._outlined=!this._outlined,t=this._outlined?this.options.outline:"none",e.style.outline=t,this._refresh())},_toggleOrder:function(){this.hasTool(L.StackAction)&&(this._toggledImage?this._stackUp():this._stackDown())},_removeOverlay:function(){var t=this._overlay,e=this.parentGroup;!this.isMode("lock")&&this.hasTool(L.DeleteAction)&&(L.DomUtil.confirmDelete()&&(this._removeToolbar(),e?e.removeLayer(t):t._map.removeLayer(t)))},_getExport:function(){var t=this._overlay,e=t._map,i=t.getElement();if(this.hasTool(L.ExportAction)){var o=new Image;o.id=o.id||"tempId12345",document.body.appendChild(o),o.onload=function(){var i=o.height,n=o.width,a=e.latLngToLayerPoint(t.getCorner(0)),s=e.latLngToLayerPoint(t.getCorner(1)),r=e.latLngToLayerPoint(t.getCorner(2)),l=e.latLngToLayerPoint(t.getCorner(3));o.onload=function(){L.DomUtil.remove(o)},window&&window.hasOwnProperty("warpWebGl")&&warpWebGl(o.id,[0,0,n,0,n,i,0,i],[a.x,a.y,s.x,s.y,l.x,l.y,r.x,r.y],!0)},o.src=t.options.fullResolutionSrc||i.src}},_stackUp:function(){this._toggledImage&&this.hasTool(L.StackAction)&&(this._toggledImage=!1,this._overlay.bringToFront(),this._refresh())},_stackDown:function(){!this._toggledImage&&this.hasTool(L.StackAction)&&(this._toggledImage=!0,this._overlay.bringToBack(),this._refresh())},_unlock:function(){var t=this._overlay,e=t._map,i=this.parentGroup,o=L.LockAction,n=L.UnlockAction;this.isMode("lock")&&(this.hasTool(o)||!i||i.editing.hasTool(n))&&(this.currentHandle&&e.removeLayer(this.currentHandle),"lock"!==t.options.mode&&this.hasMode(t.options.mode)?this._mode=t.options.mode:(this._mode="",this.currentHandle=""),this._updateHandle(),this._enableDragging(),this._refresh())},_lock:function(){var t=this._overlay._map,e=this.parentGroup,i=L.LockAction;this.isMode("lock")||(this.hasTool(i)||!e||e.editing.hasTool(i))&&(this.currentHandle&&t.removeLayer(this.currentHandle),this._mode="lock",this._updateHandle(),this._disableDragging(),this._refresh())},_deselect:function(){this._overlay.deselect()},_showMarkers:function(t){var e=this.parentGroup;this.currentHandle&&(!this.isMode("lock")&&e&&e.anyCollected()||this.currentHandle.eachLayer((function(t){t.setOpacity(1),t.dragging&&t.dragging.enable(),L.DomUtil.addClass(t.getElement(),"leaflet-interactive")})))},_hideMarkers:function(){var t=this._overlay,e=this.parentGroup;this._handles||this._initHandles(),this.currentHandle&&(this.isMode("lock")&&e&&e.isCollected(t)||this.currentHandle.eachLayer((function(t){t.setOpacity(0),t.dragging&&t.dragging.disable(),L.DomUtil.removeClass(t.getElement(),"leaflet-interactive")})))},_updateHandle:function(){var t=this._overlay._map,e=this.getMode();this.currentHandle&&t.removeLayer(this.currentHandle),this.currentHandle=""===e?"":this._handles[this.getMode()],""!==this.currentHandle&&t.addLayer(this.currentHandle)},_addToolbar:function(){var t=this._overlay,e=this.parentGroup,i=t._map,o=t.getCorners(),n=-1/0;if(e&&e.anyCollected())e.editing._addToolbar();else if(!t.options.suppressToolbar&&!this.toolbar){for(var a=0;an&&(n=o[a].lat);var s=t.getCenter();s.lat=n,this.toolbar=L.distortableImage.popupBar(s,{actions:this.editActions}).addTo(i,t),t.fire("toolbar:created")}},_refresh:function(){this.toolbar&&this._removeToolbar(),this._addToolbar()},_updateToolbarPos:function(){var t=this._overlay,e=t.getCorners(),i=this.toolbar,o=-1/0;if(i&&i instanceof L.DistortableImage.PopupBar){for(var n=0;no&&(o=e[n].lat);var a=t.getCenter();a.lat=o,t.options.suppressToolbar||this.toolbar.setLatLng(a)}},hasMode:function(t){return!!this._modes[t]},getMode:function(){if(this.enabled())return this._mode},getModes:function(){return this._modes},isMode:function(t){return!!this.enabled()&&this._mode===t},setMode:function(t){var e,i=this._overlay,o=this.parentGroup,n=this.getMode();if(o&&(e=L.DistortableCollection.Edit.MODES[t]),n!==t&&this.enabled()&&this.hasMode(t)&&(!o||o.editing.hasTool(e)))return this.toolbar&&this.toolbar.clickTool(t),this.isMode("lock")&&!this.dragging&&this._enableDragging(),this._mode=t,this.isMode("lock")&&this._disableDragging(),this._updateHandle(),this._refresh(),o&&o.isCollected(i)&&i.deselect(),this},nextMode:function(t){var e=this.getMode(),i=this.parentGroup,o=Object.keys(this.getModes()),n=o.indexOf(e),a=o[(n+1)%o.length];if(t){if(i&&i.anyCollected())return;L.DomEvent.stop(t)}return this.setMode(a)}}),L.distortableImage.edit=function(t,e){return new L.DistortableImage.Edit(t,e)}},function(t,e){L.DistortableImage=L.DistortableImage||{},L.DistortableCollection.Edit=L.Handler.extend({options:{keymap:L.distortableImage.group_action_map},initialize:function(t,e){this._group=t,this._exportOpts=t.options.exportOpts,L.setOptions(this,e),L.distortableImage.group_action_map.Escape="_decollectAll"},addHooks:function(){var t=this._group._map;this.editActions=this.options.actions,this.runExporter=L.bind(L.Utils.getNestedVal(this,"_exportOpts","exporter")||this.startExport,this),L.DomEvent.on(document,"keydown",this._onKeyDown,this),t.doubleClickZoom.enabled()||t.doubleClickLabels.enabled()||L.DomEvent.on(t,"click",this._decollectAll,this),L.DomEvent.on(t,{singleclickon:this._singleClickListeners,singleclickoff:this._resetClickListeners,singleclick:this._singleClick,boxcollectend:this._addCollections},this),this._group.editable=!0,this._group.eachLayer((function(t){t.editing.enable()}))},removeHooks:function(){var t=this._group._map;L.DomEvent.off(document,"keydown",this._onKeyDown,this),t.doubleClickZoom.enabled()||t.doubleClickLabels.enabled()||L.DomEvent.off(t,"click",this._decollectAll,this),L.DomEvent.off(t,{singleclickon:this._singleClickListeners,singleclickoff:this._resetClickListeners,singleclick:this._singleClick,boxcollectend:this._addCollections},this),this._decollectAll(),this._group.editable=!1,this._group.eachLayer((function(t){t.editing.disable()}))},enable:function(){return this._enabled=!0,this.addHooks(),this},disable:function(){return this._enabled=!1,this.removeHooks(),this},_onKeyDown:function(t){var e=this.options.keymap[t.key];this[e]&&this._group.anyCollected()&&this[e].call(this)},_singleClick:function(t){"singleclick"===t.type&&this._decollectAll(t)},_singleClickListeners:function(){var t=this._group._map;L.DomEvent.off(t,"click",this._decollectAll,this),L.DomEvent.on(t,"singleclick",this._decollectAll,this)},_resetClickListeners:function(){var t=this._group._map;L.DomEvent.on(t,"click",this._decollectAll,this),L.DomEvent.off(t,"singleclick",this._decollectAll,this)},_decollectAll:function(t){var e;t&&(e=t.originalEvent),e&&(e.shiftKey||e.target instanceof HTMLImageElement)||(this._group.eachLayer((function(t){L.DomUtil.removeClass(t.getElement(),"collected"),t.deselect()})),this._removeToolbar(),t&&L.DomEvent.stopPropagation(t))},_unlockGroup:function(){this._group.eachLayer((function(t){if(this._group.isCollected(t)){var e=t.editing;e.isMode("lock")&&(e._unlock(),t.deselect())}}),this)},_lockGroup:function(){this._group.eachLayer((function(t){if(this._group.isCollected(t)){var e=t.editing;e.isMode("lock")||(e._lock(),L.DomUtil.addClass(t.getElement(),"collected"))}}),this)},_addCollections:function(t){var e=t.boxCollectBounds,i=this._group._map;this._group.eachLayer((function(t){var o=t.editing;t.isSelected()&&t.deselect();var n=L.latLngBounds(t.getCorner(2),t.getCorner(1)),a=i.getZoom(),s=i.getCenter();n=i._latLngBoundsToNewLayerBounds(n,a,s),e.intersects(n)&&o.enabled()&&(this.toolbar||this._addToolbar(),L.DomUtil.addClass(t.getElement(),"collected"))}),this)},_removeGroup:function(t){var e=this._group._toRemove(),i=e.length;0!==i&&(L.DomUtil.confirmDeletes(i)&&(e.forEach((function(t){this._group.removeLayer(t)}),this),this._group.anyCollected()||this._removeToolbar()),t&&L.DomEvent.stopPropagation(t))},cancelExport:function(){this.customCollection||(this._exportOpts.collection=void 0),clearInterval(this.updateInterval)},_addToolbar:function(){var t=this._group,e=t._map;t.options.suppressToolbar||this.toolbar||(this.toolbar=L.distortableImage.controlBar({actions:this.editActions,position:"topleft"}).addTo(e,t))},_removeToolbar:function(){var t=this._group._map;if(!this.toolbar)return!1;t.removeLayer(this.toolbar),this.toolbar=!1},hasTool:function(t){return this.editActions.some((function(e){return e===t}))},addTool:function(t){return"leaflet-toolbar-icon"!==t.baseClass||this.hasTool(t)||(this._removeToolbar(),this.editActions.push(t),this._addToolbar()),this},removeTool:function(t){return this.editActions.some((function(e,i){return this.editActions[i]===t&&(this._removeToolbar(),this.editActions.splice(i,1),this._addToolbar(),!0)}),this),this},startExport:function(){return new Promise(function(t){var e,i=this._exportOpts;i.resolve=t;var o=this;this.updateInterval=null,i.collection?o.customCollection=!0:(o.customCollection=!1,i.collection=this._group.generateExportJson().images),i.frequency=i.frequency||3e3,i.scale=i.scale||100,i.updater=i.updater||function(n){(n=JSON.parse(n)).status_url&&(e!==n.status_url&&n.status_url.match(".json")&&(e=n.status_url),"complete"===n.status&&(clearInterval(o.updateInterval),o.customCollection||(o._exportOpts.collection=void 0),t(),null!==n.jpg&&alert("Export succeeded. "+i.exportUrl+n.jpg)),console.log(n))},i.handleStatusRes=i.handleStatusRes||function(t){e=i.statusUrl+t,o.updateInterval=setInterval((function(){$.ajax(e+"?"+Date.now(),{type:"GET",crossDomain:!0}).done((function(t){i.updater(t)}))}),i.frequency)},i.fetchStatusUrl=i.fetchStatusUrl||function(t){$.ajax({url:t.exportStartUrl,crossDomain:!0,type:"POST",data:{collection:JSON.stringify(t.collection),scale:t.scale,upload:!0},success:function(e){t.handleStatusRes(e)}})},i.fetchStatusUrl(i)}.bind(this))}}),L.distortableCollection.edit=function(t,e){return new L.DistortableCollection.Edit(t,e)}},function(t,e){L.DomUtil=L.DomUtil||{},L.DistortableImage=L.DistortableImage||{},L.distortableImage=L.DistortableImage,L.DistortableImage.Keymapper=L.Handler.extend({options:{position:"topright"},initialize:function(t,e){this._map=t,L.setOptions(this,e)},addHooks:function(){this._keymapper||(this._container=this._buildContainer(),this._scrollWrapper=this._wrap(),this._toggler=this._createButton(),this._setMapper(this._container,this._scrollWrapper,this._toggler),L.DomEvent.on(this._toggler,"click",this._toggleKeymapper,this),L.DomEvent.disableClickPropagation(this._container),L.DomEvent.disableScrollPropagation(this._container))},removeHooks:function(){this._keymapper&&(L.DomEvent.off(this._toggler,"click",this._toggleKeymapper,this),L.DomUtil.remove(this._toggler),L.DomUtil.remove(this._scrollWrapper),L.DomUtil.remove(this._container),this._keymapper=!1)},_buildContainer:function(){var t=L.DomUtil.create("div","ldi-keymapper-hide");t.setAttribute("id","ldi-keymapper");var e=L.DomUtil.create("br","divider");return t.appendChild(e),t},_createButton:function(){var t=L.DomUtil.create("a","");return t.innerHTML=L.IconUtil.create("keyboard_open"),t.setAttribute("id","toggle-keymapper"),t.setAttribute("href","#"),t.setAttribute("title","Show keymap"),t.setAttribute("role","button"),t.setAttribute("aria-label","Show keymap"),t},_wrap:function(){var t=L.DomUtil.create("div","");return t.setAttribute("id","keymapper-wrapper"),t.style.display="none",t},_setMapper:function(t,e,i){this._keymapper=L.control({position:this.options.position}),this._keymapper.onAdd=function(){return t.appendChild(e),e.insertAdjacentHTML("beforeend",'
Rotate Mode
R
RotateScale Mode
r
Scale Mode
s
Distort Mode
d
Drag Mode
D
Lock (Mode) / Unlock Image
l u
Stack up / down
q a
Add / Remove Image Border
b
Toggle Opacity
o
Deselect All
esc
Delete Image(s)
delete backspace
Export Image(s)
e
'),t.appendChild(i),t},this._keymapper.addTo(this._map)},_toggleKeymapper:function(t){t.preventDefault(),this._container.className="ldi-keymapper leaflet-control"===this._container.className?"ldi-keymapper-hide leaflet-control":"ldi-keymapper leaflet-control",this._scrollWrapper.style.display="none"===this._scrollWrapper.style.display?"block":"none",this._toggler.innerHTML="close"===this._toggler.innerHTML?L.IconUtil.create("keyboard_open"):"close",L.IconUtil.toggleTitle(this._toggler,"Show keymap","Hide keymap"),L.DomUtil.toggleClass(this._toggler,"close-icon")},_injectIconSet:function(){if(!document.querySelector("#keymapper-iconset")){var t=L.DomUtil.create("div","");t.id="keymapper-iconset",t.setAttribute("hidden","hidden"),this._iconset=(new L.KeymapperIconSet).render(),t.innerHTML=this._iconset,document.querySelector(".leaflet-control-container").appendChild(t)}}}),L.DistortableImage.Keymapper.addInitHook((function(){L.DistortableImage.Keymapper.prototype._n=L.DistortableImage.Keymapper.prototype._n?L.DistortableImage.Keymapper.prototype._n+1:1,1!==L.DistortableImage.Keymapper.prototype._n||L.Browser.mobile||(this.enable(),this._injectIconSet())})),L.distortableImage.keymapper=function(t,e){return new L.DistortableImage.Keymapper(t,e)}},function(t,e){L.Map.DoubleClickZoom.include({addHooks:function(){this._map.on({click:this._fireIfSingle,dblclick:this._onDoubleClick},this)},removeHooks:function(){this._map.off({click:this._fireIfSingle,dblclick:this._onDoubleClick},this)},enable:function(){return this._enabled||this._map.doubleClickLabels&&this._map.doubleClickLabels.enabled()||(this._map.fire("singleclickon"),this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._map.fire("singleclickoff"),this._enabled=!1,this.removeHooks(),this):this},_fireIfSingle:function(t){var e=this._map,i=t.originalEvent;i&&i.shiftKey||(e._clicked+=1,this._map._clickTimeout=setTimeout((function(){1===e._clicked?(e._clicked=0,e.fire("singleclick",{type:"singleclick"})):L.Browser.touch&&i&&i.sourceCapabilities.firesTouchEvents&&e._fireDOMEvent(i,"dblclick",[e])}),250))},_onDoubleClick:function(t){var e=this._map,i=t.originalEvent;if(setTimeout((function(){e._clicked=0,clearTimeout(e._clickTimeout)}),0),!i)return!1;var o=e.getZoom(),n=e.options.zoomDelta,a=i.shiftKey?o-n:o+n;"center"===e.options.doubleClickZoom?e.setZoom(a):e.setZoomAround(t.containerPoint,a)}})},function(t,e){L.Map.mergeOptions({boxCollector:!0,boxZoom:!1}),L.Map.BoxCollector=L.Map.BoxZoom.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){L.DomEvent.on(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){L.DomEvent.off(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){L.DomUtil.remove(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),L.DomUtil.disableTextSelection(),L.DomUtil.disableImageDrag(),this._startPoint=this._map.mouseEventToContainerPoint(t),L.DomEvent.on(document,{contextmenu:L.DomEvent.stop,mousemove:this._onMouseMove,mouseup:this._onMouseUp},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=L.DomUtil.create("div","leaflet-zoom-box",this._container),L.DomUtil.addClass(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t),this._bounds=L.bounds(this._startPoint,this._point);var e=this._bounds.getSize();L.DomUtil.setPosition(this._box,this._bounds.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(L.DomUtil.remove(this._box),L.DomUtil.removeClass(this._container,"leaflet-crosshair")),L.DomUtil.enableTextSelection(),L.DomUtil.enableImageDrag(),L.DomEvent.off(document,{contextmenu:L.DomEvent.stop,mousemove:this._onMouseMove,mouseup:this._onMouseUp},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(L.Util.bind(this._resetState,this),0);var e=L.latLngBounds(this._map.containerPointToLatLng(this._bounds.getBottomLeft()),this._map.containerPointToLatLng(this._bounds.getTopRight())),i=this._map.getZoom(),o=this._map.getCenter();e=this._map._latLngBoundsToNewLayerBounds(e,i,o),this._map.fire("boxcollectend",{boxCollectBounds:e})}}}),L.Map.addInitHook("addHandler","boxCollector",L.Map.BoxCollector)},function(t,e){L.Map.mergeOptions({doubleClickLabels:!0}),L.Map.DoubleClickLabels=L.Map.DoubleClickZoom.extend({enable:function(){var t=this._map;return this._enabled||(t.doubleClickZoom.enabled()&&t.doubleClickZoom.disable(),this._map.fire("singleclickon"),this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},_fireIfSingle:function(t){var e=this._map,i=t.originalEvent;i&&i.shiftKey||(e._clicked+=1,this._map._clickTimeout=setTimeout((function(){1===e._clicked?(e._clicked=0,e.fire("singleclick",{type:"singleclick"})):L.Browser.touch&&i&&i.sourceCapabilities.firesTouchEvents&&e.fire("dblclick")}),250))},_onDoubleClick:function(){var t=this._map,e=t._labels;setTimeout((function(){t._clicked=0,clearTimeout(t._clickTimeout)}),0),e&&(1===e.options.opacity?(e.options.opacity=0,e.setOpacity(0)):(e.options.opacity=1,e.setOpacity(1)))}}),L.Map.addInitHook("addHandler","doubleClickLabels",L.Map.DoubleClickLabels)},function(t,e){L.Map.include({_clicked:0,addGoogleMutant:function(t){return(t=this.mutantOptions=L.extend({mutantOpacity:.8,maxZoom:24,maxNativeZoom:20,minZoom:0,labels:!0,labelOpacity:1,doubleClickLabels:!0},t)).labels||(this.mutantOptions=L.extend(this.mutantOptions,{labelOpacity:t.labels?1:void 0,doubleClickLabels:!!t.labels||void 0})),this._googleMutant=L.tileLayer("http://mt0.google.com/vt/lyrs=s&x={x}&y={y}&z={z}",{maxZoom:t.maxZoom,maxNativeZoom:t.maxNativeZoom,minZoom:t.minZoom,opacity:t.mutantOpacity}).addTo(this),t.labels?this._addLabels(t):this.doubleClickLabels=void 0,this},_addLabels:function(t){return 0!==t.labelOpacity&&1!==t.labelOpacity&&(t.labelOpacity=1),this._labels=L.tileLayer("https://stamen-tiles-{s}.a.ssl.fastly.net/toner-labels/{z}/{x}/{y}{r}.{ext}",{attribution:'Map tiles by Stamen Design, CC BY 3.0 — Map data © OpenStreetMap contributors',subdomains:"abcd",interactive:!1,opacity:t.labelOpacity,maxZoom:t.maxZoom,maxNativeZoom:t.maxNativeZoom,minZoom:t.minZoom,ext:"png"}).addTo(this),this.mutantOptions.doubleClickLabels&&this.doubleClickLabels.enable(),this}}),L.Map.addInitHook((function(){this.doubleClickLabels.disable(),this.doubleClickZoom.enable()}))}]); +!function(t){var e={};function i(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(o,n,function(e){return t[e]}.bind(null,n));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/dist/",i(i.s=0)}([function(t,e,i){i(1),i(2),i(3),i(4),i(5),i(6),i(7),i(8),i(9),i(10),i(11),i(12),i(13),i(14),i(15),i(16),i(17),i(18),i(19),i(20),i(21),i(22),i(23),i(24),i(25),i(26),i(27),i(28),i(29),i(30),i(31),i(32),i(33),i(34),i(35),i(36),i(37),i(38),i(39),i(40),i(41),i(42),t.exports=i(43)},function(t,e){L.DomUtil=L.extend(L.DomUtil,{initTranslation:function(t){this.translation=t},getMatrixString:function(t){var e=L.Browser.webkit3d||L.Browser.gecko3d||L.Browser.ie3d,i=[t[0],t[3],0,t[6],t[1],t[4],0,t[7],0,0,1,0,t[2],t[5],0,t[8]],o=e?"matrix3d("+i.join(",")+")":"";return e||console.log("Your browser must support 3D CSS transformsin order to use DistortableImageOverlay."),o},toggleClass:function(t,e){var i=e;return this.hasClass(t,i)?this.removeClass(t,i):this.addClass(t,i)},confirmDelete:function(){return window.confirm(this.translation.confirmImageDelete)},confirmDeletes:function(t){if(1!==t){var e=this.translation.confirmImagesDeletes,i="";return i="function"==typeof e?e(t):t+" "+e,window.confirm(i)}this.confirmDelete()}})},function(t,e){L.IconUtil={create:function(t){return/^#/.test(t)&&(t=t.replace(/^#/,"")),''},addClassToSvg:function(t,e){var i=t.querySelector("svg");i&&L.DomUtil.addClass(i,e)},toggleXlink:function(t,e,i){/^#/.test(e)||(e="#"+e),/^#/.test(i)||(i="#"+i);var o=t.querySelector("use");if(o){var n=o.getAttribute("xlink:href")===e?i:e;return o.setAttribute("xlink:href",n),n}return!1},toggleTitle:function(t,e,i){var o=t.getAttribute("title")===e?i:e;return t.setAttribute("title",o),t.hasAttribute("aria-label")&&t.setAttribute("aria-label",o),o}}},function(t,e){L.ImageUtil={getCmPerPixel:function(t){var e=t._map;return 100*e.latLngToLayerPoint(t.getCorner(0)).distanceTo(e.latLngToLayerPoint(t.getCorner(1)))/t.getElement().width}}},function(t,e){L.MatrixUtil={adj:function(t){return[t[4]*t[8]-t[5]*t[7],t[2]*t[7]-t[1]*t[8],t[1]*t[5]-t[2]*t[4],t[5]*t[6]-t[3]*t[8],t[0]*t[8]-t[2]*t[6],t[2]*t[3]-t[0]*t[5],t[3]*t[7]-t[4]*t[6],t[1]*t[6]-t[0]*t[7],t[0]*t[4]-t[1]*t[3]]},multmm:function(t,e){var i,o=[];for(i=0;i<3;i++)for(var n=0;n<3;n++){for(var a=0,s=0;s<3;s++)a+=t[3*i+s]*e[3*s+n];o[3*i+n]=a}return o},multmv:function(t,e){return[t[0]*e[0]+t[1]*e[1]+t[2]*e[2],t[3]*e[0]+t[4]*e[1]+t[5]*e[2],t[6]*e[0]+t[7]*e[1]+t[8]*e[2]]},multsm:function(t,e){for(var i=[],o=0,n=e.length;o2&&void 0!==arguments[2]?arguments[2]:"deg";return"deg"===i?this.radiansToDegrees(Math.atan2(e,t)):Math.atan2(e,t)},radiansToDegrees:function(t){return 180*t/Math.PI},degreesToRadians:function(t){return t*Math.PI/180}}},function(t,e){L.Utils={initTranslation:function(){var t={deleteImage:"Delete Image",deleteImages:"Delete Images",distortImage:"Distort Image",dragImage:"Drag Image",exportImage:"Export Image",exportImages:"Export Images",removeBorder:"Remove Border",addBorder:"Add Border",freeRotateImage:"Free rotate Image",geolocateImage:"Geolocate Image",lockMode:"Lock Mode",lockImages:"Lock Images",makeImageOpaque:"Make Image Opaque",makeImageTransparent:"Make Image Transparent",restoreImage:"Restore Natural Image",rotateImage:"Rotate Image",scaleImage:"Scale Image",stackToFront:"Stack to Front",stackToBack:"Stack to Back",unlockImages:"Unlock Images",confirmImageDelete:"Are you sure? This image will be permanently deleted from the map.",confirmImagesDeletes:"Are you sure? These images will be permanently deleted from the map."};if(this.options.translation)for(var e in t)this.options.translation.hasOwnProperty(e)||(this.options.translation[e]=t[e]);else this.options.translation=t;L.DomUtil.initTranslation(this.options.translation)},getNestedVal:function(t,e,i){return[e,i].reduce((function(t,e){return t&&t[e]}),t)}}},function(t,e){L.DistortableImageOverlay=L.ImageOverlay.extend({options:{height:200,crossOrigin:!0,edgeMinWidth:50,editable:!0,mode:"distort",selected:!1},initialize:function(t,e){L.setOptions(this,e),L.Utils.initTranslation.call(this),this.edgeMinWidth=this.options.edgeMinWidth,this.editable=this.options.editable,this._selected=this.options.selected,this._url=t,this.rotation={}},onAdd:function(t){this._map=t,this.getElement()||this._initImage(),t.on("viewreset",this._reset,this),this.options.corners&&(this._corners=this.options.corners,t.options.zoomAnimation&&L.Browser.any3d&&t.on("zoomanim",this._animateZoom,this)),L.DomEvent.on(this.getElement(),"load",(function(){if(this.getPane().appendChild(this.getElement()),this._initImageDimensions(),this.options.rotation){var e=this.options.rotation.deg?"deg":"rad";this.setAngle(this.options.rotation[e],e)}else this.rotation={deg:0,rad:0},this._reset();this._corners||t.options.zoomAnimation&&L.Browser.any3d&&t.on("zoomanim",this._animateZoom,this);var i=this._eventParents;i?(this.eP=i[Object.keys(i)[0]],this.eP.editable&&this.editing.enable()):(this.editable&&this.editing.enable(),this.eP=null)}),this),L.DomEvent.on(this.getElement(),"click",this.select,this),L.DomEvent.on(t,{singleclickon:this._singleClickListeners,singleclickoff:this._resetClickListeners,singleclick:this._singleClick},this),t.doubleClickZoom.enabled()||t.doubleClickLabels.enabled()||L.DomEvent.on(t,"click",this.deselect,this),this.fire("add")},onRemove:function(t){L.DomEvent.off(this.getElement(),"click",this.select,this),L.DomEvent.off(t,{singleclickon:this._singleClickListeners,singleclickoff:this._resetClickListeners,singleclick:this._singleClick},this),L.DomEvent.off(t,"click",this.deselect,this),this.editing&&this.editing.disable(),this.fire("remove"),L.ImageOverlay.prototype.onRemove.call(this,t)},_initImageDimensions:function(){var t=this._map,e=L.DomUtil.getStyle(this.getElement(),"width"),i=L.DomUtil.getStyle(this.getElement(),"height"),o=parseInt(e)/parseInt(i),n=this.options.height,a=parseInt(o*n),s=t.project(t.getCenter()),r=L.point(a,n).divideBy(2);this.options.corners?this._corners=this.options.corners:this._corners=[t.unproject(s.subtract(r)),t.unproject(s.add(L.point(r.x,-r.y))),t.unproject(s.add(L.point(-r.x,r.y))),t.unproject(s.add(r))],this._initialDimensions={center:s,offset:r,zoom:t.getZoom()},this.setBounds(L.latLngBounds(this.getCorners()))},_singleClick:function(t){"singleclick"===t.type&&this.deselect()},_singleClickListeners:function(){var t=this._map;L.DomEvent.off(t,"click",this.deselect,this),L.DomEvent.on(t,"singleclick",this.deselect,this)},_resetClickListeners:function(){var t=this._map;L.DomEvent.on(t,"click",this.deselect,this),L.DomEvent.off(t,"singleclick",this.deselect,this)},isSelected:function(){return this._selected},deselect:function(){var t=this.editing;if(t.enabled())return t._removeToolbar(),t._hideMarkers(),this._selected=!1,this},select:function(t){var e=this.editing,i=this.eP;if(e.enabled()){if(t&&L.DomEvent.stopPropagation(t),this._programmaticGrouping(),this._selected=!0,e._addToolbar(),e._showMarkers(),!i||!i.anyCollected())return this;this.deselect()}},_programmaticGrouping:function(){this._map.eachLayer((function(t){t instanceof L.DistortableImageOverlay&&t.deselect()}))},setCorner:function(t,e){var i=this.editing;return this._corners[t]=e,this.setBounds(L.latLngBounds(this.getCorners())),this.fire("update"),i.toolbar&&i.toolbar instanceof L.DistortableImage.PopupBar&&i._updateToolbarPos(),this.edited=!0,this},_cornerExceedsMapLats:function(t,e,i){var o,n;return 0===t?(o=i.project(e).y<2,n=i.project(e).y>=255):(o=i.project(e).y/t<2,n=i.project(e).y/Math.pow(2,t)>=255),o||n},setCorners:function(t){var e=this._map,i=e.getZoom(),o=this.editing,n=0;for(var a in t)if(this._cornerExceedsMapLats(i,t[a],e))return this.setBounds(L.latLngBounds(this.getCorners())),void this.fire("update");for(a in t)this._corners[n]=t[a],n+=1;return this.setBounds(L.latLngBounds(this.getCorners())),this.fire("update"),o.toolbar&&o.toolbar instanceof L.DistortableImage.PopupBar&&o._updateToolbarPos(),this.edited=!0,this},setCornersFromPoints:function(t){var e=this._map,i=e.getZoom(),o=this.editing,n=0;for(var a in t){var s=e.layerPointToLatLng(t[a]);if(this._cornerExceedsMapLats(i,s,e))return this.setBounds(L.latLngBounds(this.getCorners())),void this.fire("update")}for(a in t)this._corners[n]=e.layerPointToLatLng(t[a]),n+=1;return this.setBounds(L.latLngBounds(this.getCorners())),this.fire("update"),o.toolbar&&o.toolbar instanceof L.DistortableImage.PopupBar&&o._updateToolbarPos(),this.edited=!0,this},scaleBy:function(t){var e,i,o=this._map,n=o.project(this.getCenter()),a={};if(0!==t){for(e=0;e<4;e++)i=o.project(this.getCorner(e)).subtract(n).multiplyBy(t).add(n),a[e]=o.unproject(i);return this.setCorners(a),this}},getAngle:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"deg",e=this.getElement().style[L.DomUtil.TRANSFORM].split("matrix3d")[1].slice(1,-1).split(","),i=e[0],o=e[1],n=e[4],a=e[5],s=i*a-o*n,r=L.TrigUtil.calcAngle(i,o,"rad");return s<0&&(r+=r<0?Math.PI:-Math.PI),r<0&&(r=2*Math.PI+r),"deg"===t?Math.round(L.TrigUtil.radiansToDegrees(r)):L.Util.formatNum(r,2)},setAngle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"deg",i=this.getAngle(e),o=t-i;return this.rotateBy(o,e),this},rotateBy:function(t){var e,i,o,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"deg",a=this._map,s=a.project(this.getCenter()),r={};for("deg"===n&&(t=L.TrigUtil.degreesToRadians(t)),e=0;e<4;e++)i=a.project(this.getCorner(e)).subtract(s),o=L.point(Math.cos(t)*i.x-Math.sin(t)*i.y,Math.sin(t)*i.x+Math.cos(t)*i.y),r[e]=a.unproject(o.add(s));return this.setCorners(r),this},dragBy:function(t,e){var i,o,n=this._map,a={},s=n.project(t).subtract(n.project(e));for(i=0;i<4;i++)o=n.project(this.getCorner(i)).subtract(s),a[i]=n.unproject(o);this.setCorners(a)},restore:function(){for(var t=this._map,e=this._initialDimensions.center,i=this._initialDimensions.offset,o=this._initialDimensions.zoom,n=[e.subtract(i),e.add(L.point(i.x,-i.y)),e.add(L.point(-i.x,i.y)),e.add(i)],a=0;a<4;a++)t.unproject(n[a],o).equals(this.getCorner(a))||this.setCorner(a,t.unproject(n[a],o));return this.edited=!1,this.fire("restore"),this},_getTranslateString:function(t){var e=L.Browser.webkit3d,i=(e?",0":"")+")";return"translate"+(e?"3d":"")+"("+t.x+"px,"+t.y+"px"+i},_reset:function(){var t=this._map,e=this.getElement(),i=L.bind(t.latLngToLayerPoint,t),o=this._calculateProjectiveTransform(i),n=i(this.getCorner(0)),a=L.DomUtil.getMatrixString(o),s=this._getTranslateString(n);e._leaflet_pos=n,e.style[L.DomUtil.TRANSFORM]=[s,a].join(" "),e.style[L.DomUtil.TRANSFORM+"-origin"]="0 0 0",this.rotation.deg=this.getAngle(),this.rotation.rad=this.getAngle("rad")},_animateZoom:function(t){var e=this._map,i=this.getElement(),o=function(i){return e._latLngToNewLayerPoint(i,t.zoom,t.center)},n=this._calculateProjectiveTransform(o),a=o(this.getCorner(0)),s=L.DomUtil.getMatrixString(n),r=this._getTranslateString(a);i._leaflet_pos=a,i.style[L.DomUtil.TRANSFORM]=[r,s].join(" ")},getCorners:function(){return this._corners},getCorner:function(t){return this._corners[t]},getCenter:function(){var t=this._map,e=this.getCorners().reduce((function(e,i){return e.add(t.project(i))}),L.point(0,0));return t.unproject(e.divideBy(4))},_calculateProjectiveTransform:function(t){var e,i=t(this.getCorner(0)),o=this.getElement().offsetWidth||500,n=this.getElement().offsetHeight||375,a=[];for(e=0;e<4;e++)a.push(t(this.getCorner(e))._subtract(i));return L.MatrixUtil.general2DProjection(0,0,a[0].x,a[0].y,o,0,a[1].x,a[1].y,0,n,a[2].x,a[2].y,o,n,a[3].x,a[3].y)}}),L.distortableImageOverlay=function(t,e){return new L.DistortableImageOverlay(t,e)},L.Map.addInitHook((function(){L.DomUtil.hasClass(this.getContainer(),"ldi")||L.DomUtil.addClass(this.getContainer(),"ldi")}))},function(t,e){L.DistortableCollection=L.FeatureGroup.extend({options:{editable:!0,exportOpts:{exportStartUrl:"//export.mapknitter.org/export",statusUrl:"//export.mapknitter.org",exportUrl:"http://export.mapknitter.org/"}},initialize:function(t){L.setOptions(this,t),L.FeatureGroup.prototype.initialize.call(this,t),L.Utils.initTranslation.call(this),this.editable=this.options.editable},onAdd:function(t){L.FeatureGroup.prototype.onAdd.call(this,t),this._map=t,this.editable&&this.editing.enable(),this.on("layeradd",this._addEvents,this),this.on("layerremove",this._removeEvents,this)},onRemove:function(){this.editing&&this.editing.disable(),this.off("layeradd",this._addEvents,this),this.off("layerremove",this._removeEvents,this)},_addEvents:function(t){var e=t.layer;L.DomEvent.on(e,{dragstart:this._dragStartMultiple,drag:this._dragMultiple},this),L.DomEvent.on(e.getElement(),{mousedown:this._deselectOthers,contextmenu:this._longPressMultiSelect},this)},_removeEvents:function(t){var e=t.layer;L.DomEvent.off(e,{dragstart:this._dragStartMultiple,drag:this._dragMultiple},this),L.DomEvent.off(e.getElement(),{mousedown:this._deselectOthers,contextmenu:this._longPressMultiSelect},this)},_longPressMultiSelect:function(t){this.editable&&(t.preventDefault(),this.eachLayer((function(e){var i=e.editing;e.getElement()===t.target&&i.enabled()&&(L.DomUtil.toggleClass(e.getElement(),"collected"),this.anyCollected()?(e.deselect(),this.editing._addToolbar()):this.editing._removeToolbar())}),this))},isCollected:function(t){return L.DomUtil.hasClass(t.getElement(),"collected")},anyCollected:function(){return this.getLayers().some(this.isCollected.bind(this))},_toggleCollected:function(t,e){t.shiftKey&&e.editing.enabled()&&L.DomUtil.toggleClass(t.target,"collected"),this.anyCollected()?e.deselect():this.editing._removeToolbar()},_deselectOthers:function(t){this.editable&&(this.eachLayer((function(e){e.getElement()!==t.target?e.deselect():this._toggleCollected(t,e)}),this),t&&L.DomEvent.stopPropagation(t))},_dragStartMultiple:function(t){var e,i=t.target,o=this._map;this.isCollected(i)&&this.eachLayer((function(t){for(t._dragStartPoints={},t.deselect(),e=0;e<4;e++){var i=t.getCorner(e);t._dragStartPoints[e]=o.latLngToLayerPoint(i)}}))},_dragMultiple:function(t){var e=t.target,i=this._map;if(this.isCollected(e)){var o=i.latLngToLayerPoint(e.getCorner(0)),n=e._dragStartPoints[0].subtract(o);this._updateCollectionFromPoints(n,e)}},_toRemove:function(){return this.getLayers().filter((function(t){var e=t.editing._mode;return this.isCollected(t)&&"lock"!==e}),this)},_toMove:function(t){return this.getLayers().filter((function(e){var i=e.editing._mode;return e!==t&&this.isCollected(e)&&"lock"!==i}),this)},_updateCollectionFromPoints:function(t,e){var i,o=this._toMove(e),n=new L.Transformation(1,-t.x,1,-t.y);o.forEach((function(t){var e={};for(i=0;i<4;i++)e[i]=n.transform(t._dragStartPoints[i]);t.setCornersFromPoints(e)}))},_getAvgCmPerPixel:function(t){return t.reduce((function(t,e){return t+e.cm_per_pixel}),0)/t.length},generateExportJson:function(){var t={images:[]};return this.eachLayer((function(e){if(this.isCollected(e)){var i=e._image.src.split("/"),o=i[i.length-1],n=e.getCorners(),a=[{lat:n[0].lat,lon:n[0].lng},{lat:n[1].lat,lon:n[1].lng},{lat:n[3].lat,lon:n[3].lng},{lat:n[2].lat,lon:n[2].lng}];t.images.push({id:this.getLayerId(e),src:e._image.src,width:e._image.width,height:e._image.height,image_file_name:o,nodes:a,cm_per_pixel:L.ImageUtil.getCmPerPixel(e)})}}),this),t.images=t.images.reverse(),t.avg_cm_per_pixel=this._getAvgCmPerPixel(t.images),t}}),L.distortableCollection=function(t,e){return new L.DistortableCollection(t,e)}},function(t,e){L.EXIF=function(t){if(0!==Object.keys(EXIF.getAllTags(t)).length){console.log(EXIF.getAllTags(t));var e=EXIF.getAllTags(t);if(void 0!==e.GPSLatitude&&void 0!==e.GPSLongitude){e.GPSLatitude[0],e.GPSLatitude[1],e.GPSLatitude[2],e.GPSLongitude[0],e.GPSLongitude[1],e.GPSLongitude[2];"N"!==e.GPSLatitudeRef&&-1,"W"===e.GPSLongitudeRef&&-1}"T"===e.GPSImgDirectionRef||"M"===e.GPSImgDirectionRef?Math.PI/180*(e.GPSImgDirection.numerator/e.GPSImgDirection.denominator-90):console.log("No compass data found"),console.log("Orientation:",e.Orientation),6===e.Orientation?Math.PI/180*-90:8===e.Orientation?Math.PI/180*90:3===e.Orientation&&Math.PI/180*180,void 0!==e.GPSAltitude&&void 0!==e.GPSAltitudeRef&&(void 0!==e.GPSAltitude&&void 0!==e.GPSAltitudeRef?e.GPSAltitude.numerator/e.GPSAltitude.denominator+e.GPSAltitudeRef:0)}else alert("EXIF initialized. Press again to view data in console.")}},function(t,e){L.EditHandle=L.Marker.extend({initialize:function(t,e,i){var o=t.getCorner(e);L.setOptions(this,i),this._handled=t,this._corner=e;var n={draggable:!0,zIndexOffset:10};i&&i.hasOwnProperty("draggable")&&(n.draggable=i.draggable),L.Marker.prototype.initialize.call(this,o,n)},onAdd:function(t){L.Marker.prototype.onAdd.call(this,t),this._bindListeners(),this.updateHandle()},onRemove:function(t){this._unbindListeners(),L.Marker.prototype.onRemove.call(this,t)},_onHandleDragStart:function(){this._handled.fire("editstart")},_onHandleDragEnd:function(){this._fireEdit()},_fireEdit:function(){this._handled.edited=!0,this._handled.fire("edit")},_bindListeners:function(){this.on({contextmenu:L.DomEvent.stop,dragstart:this._onHandleDragStart,drag:this._onHandleDrag,dragend:this._onHandleDragEnd},this),this._handled._map.on("zoomend",this.updateHandle,this),this._handled.on("update",this.updateHandle,this)},_unbindListeners:function(){this.off({contextmenu:L.DomEvent.stop,dragstart:this._onHandleDragStart,drag:this._onHandleDrag,dragend:this._onHandleDragEnd},this),this._handled._map.off("zoomend",this.updateHandle,this),this._handled.off("update",this.updateHandle,this)},_calculateScalingFactor:function(t,e){var i=this._handled,o=i._map,n=o.latLngToLayerPoint(i.getCenter()),a=o.latLngToLayerPoint(t),s=o.latLngToLayerPoint(e),r=this._d2(n,a),l=this._d2(n,s);return Math.sqrt(l/r)},_d2:function(t,e){var i=t.x-e.x,o=t.y-e.y;return Math.pow(i,2)+Math.pow(o,2)},calculateAngleDelta:function(t,e){var i=this._handled,o=i._map,n=o.latLngToLayerPoint(i.getCenter()),a=o.latLngToLayerPoint(t),s=o.latLngToLayerPoint(e),r=Math.atan2(n.y-a.y,n.x-a.x);return Math.atan2(n.y-s.y,n.x-s.x)-r}})},function(t,e){L.DistortHandle=L.EditHandle.extend({options:{TYPE:"distort",icon:L.icon({iconUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAklEQVR4AewaftIAAAChSURBVO3BIU4DURgGwNkvL2B6AkQTLBqP4QCoSm7DDXoBLBZHDbfgICAIZjEV3YTn9uVHdMZZtcnCfI13bIzxg0emg6Nm6QVbYz3jylEsXRrvwommb49X67jFkz80fR9Mb1YxTzqiWBSLYlEsikWxKBbFolgUi2JRLIpFsSgWxaJY03fHHOu40dH07bAzWCx9Ge/TiWbpHgdsjPGNB2f/yS+7xRCyiiZPJQAAAABJRU5ErkJggg==",iconSize:[32,32],iconAnchor:[16,16]})},_onHandleDrag:function(){this._handled.setCorner(this._corner,this.getLatLng())},updateHandle:function(){this.setLatLng(this._handled.getCorner(this._corner))}}),L.distortHandle=function(t,e,i){return new L.DistortHandle(t,e,i)}},function(t,e){L.DragHandle=L.EditHandle.extend({options:{TYPE:"drag",icon:L.icon({iconUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAsVJREFUeNrMVztLXEEUvnNVFAVBAhY2aRKbTZEHJNpYabuNjSgYg/GxdsmPSJkUAa/ZdVEX8mgWYVutbHxAHkVskjQBuUUgBISVhCQk3wnfwMlk1rusN1wHPubOzJlzvjlz5sxc01Ma/hUEwQnwDIjqc7uvgv9YYO86qgIwCXQbdNTlQ8kcCBHgBch8TcloF6oJGr6phk6EQAkfdz3zvgDr9Mr7Fg1fptEZoM8jsmrokpfsiIFO4IIjuE2v1EDmR4LRdlR5Gh51hj8D34ABtm8YTtqna0TgklIw5CgQguKxIojEjmFROg/MKQO27NkFAB+4wAPouGUJiIvWKHwbAxX2XyWRKWkqhT+pbJntJZJuUzISW0+5hW+obxrVBsfvoH/dqCCJuU97GBh2VteLSiYvArmErT8EVoAK9Bw7enbpVYmvAQlyowYforrH5jXL2rPHI/TKONDB7u9AlavdaTBPvPmazUeQuy8f7UomUgTEwIJPEQ3sQGE/6ll2l9H/KcEzBcfWn2IclluM3DpddJxSHujlFkscbUPvmB0LHVnLrId7nlaZVkEc6QGXQI1MAwZcWmVRHeNaQwJMMiU2cwy4s7p/RJ2ckpvIQs+cIs+5GzitloLKHUV3MPREuXbTOKO91dX387gGTONxIgEWm+E61FFrpcyqXLHsEwiDjEsjAksqw5XPoL9MHVrn6QR4q+XZrDaR4RoWzq2ymafuRA/Mq1stSsHLVkcbdf9VjOcx8ZH3+SFWcCWlVPyWuUBOwUWdC1wP5NVjYiXFWLO69PZ6CRTUY6KSIoEKdf6T3IzzgHxnsyHctNBEkmn6Oob8ExUDg/ahGybd177cDjzH5xHwgDiSvoS7I/LZyvxJZj0wod7tkX5G0XVC7rEyLhfLJjBGbKoLLEfZWObyKeZ6oY82g+yf5Zn/mJyHX7PMf04z/T3/LcAAu4E6iiyJqf0AAAAASUVORK5CYII=",iconSize:[32,32],iconAnchor:[16,16]})},_onHandleDrag:function(){var t=this._handled,e=t.getCorner(this._corner),i=this.getLatLng();t.dragBy(e,i)},updateHandle:function(){this.setLatLng(this._handled.getCorner(this._corner))}})},function(t,e){L.FreeRotateHandle=L.EditHandle.extend({options:{TYPE:"freeRotate",icon:L.icon({iconUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAklEQVR4AewaftIAAAHiSURBVMXBa3HbShgA0PMp/1sCCo8oCEpgTaCXgIXAJiDzyCJoAUTm4UVQAns1Y8+snWnTvJyeE16hkjDgDrfoNTMKcpC9UPiLSo8JyetkjEHxjPCMyoS199kFoz8Iv1HpMaN3qWDCHoegOKkkRwnJpRmroHgiPFEZ8IBekzEGxQtUEhKSS/fB7Ew4U+lxcGkVZG9QWWPSFAxBcdK59KApuA+yNwp2uEdx1GN25sZJZULSfAtm77SlbNjju6MvG75u+WHRWVR6rDVjMPsgwYyVZl3pLTpHkyYHOx8syMiayaJzlDTZ9YyaZNFVkiYH2ZUEBcVJJXVImuz6Js3Qofe59pq7DoOTILu+g+a288mCouk7/1iH4qTS+2QdDppbV1ZJmrnDXnPnc5UOs2Z0fUmTuyBr+krvSioJyUmQO0dZM7mepMkWnaNRkyrJB6uskTSjxY3Fll8bvmJwlDb83FJ8gMqAB80uyBY3Trb82PAfvjj6vuHnluIdKgMeNXOwctK5NKBoHitrb1RJeHRp5Ux4ojLg0aWMHGQvUOkxIWkKVsHsTPiNSo8HDC5lZIsgO6n0uMUdRvQuFQxB8UR4RmXC2vvsgtEfhL+o9JiQvE7GGBTPCK9QSUjoMWgKDthjDrIX+h/k0I7gth6N5gAAAABJRU5ErkJggg==",iconSize:[32,32],iconAnchor:[16,16]})},_onHandleDrag:function(){var t=this._handled,e=t._map,i=t.edgeMinWidth,o=t.getCorner(this._corner),n=this.getLatLng(),a=this.calculateAngleDelta(o,n),s=this._calculateScalingFactor(o,n);0!==a&&t.rotateBy(a,"rad"),i||(i=50);var r=e.latLngToContainerPoint(t.getCorner(0)),l=e.latLngToContainerPoint(t.getCorner(1)),c=Math.abs(r.x-l.x),d=Math.abs(r.y-l.y);Math.sqrt(c*c+d*d)>i||s>1?t.scaleBy(s):t.scaleBy(1)},updateHandle:function(){this.setLatLng(this._handled.getCorner(this._corner))}}),L.freeRotateHandle=function(t,e,i){return new L.FreeRotateHandle(t,e,i)}},function(t,e){L.LockHandle=L.EditHandle.extend({options:{TYPE:"lock",interactive:!1,icon:L.icon({iconUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAklEQVR4AewaftIAAAD8SURBVO3BPU7CYAAA0AdfjIcQlRCQBG7C3gk2uIPG2RC3Dk16Gz0FTO1WZs/gwGCMP/2+xsSl7+n1er1Iz9LtRQjaPeMeO+TinLDCJV78YqjdA04YodKuxhUaPGoRxMmxwRQZSt87Yo4KExGCeAUyLLFB4bMacxywEClIU2KDKXbInTUYo8JCgoFuGoxQO5uiwY1EA91VmDqrcKeDoX8WdNNgjApvmGGLXKIgXY0xGkxQYItrrFFIEKQ5Yo4KEx9yrDFDhlKkIF6NOQ5Y+KpAhiXWKEQI4pxwiwoLPyuxwQw75FoE7fZYocFEuwI7jHCBV39gL92TXq/Xi/AOcmczZmaIMScAAAAASUVORK5CYII=",iconSize:[32,32],iconAnchor:[16,16]})},onRemove:function(t){this.unbindTooltip(),L.EditHandle.prototype.onRemove.call(this,t)},_bindListeners:function(){var t=this.getElement();L.EditHandle.prototype._bindListeners.call(this),L.DomEvent.on(t,{mousedown:this._tooltipOn,mouseup:this._tooltipOff},this),L.DomEvent.on(document,"pointerleave",this._tooltipOff,this)},_unbindListeners:function(){var t=this.getElement();L.EditHandle.prototype._bindListeners.call(this),L.DomEvent.off(t,{mousedown:this._tooltipOn,mouseup:this._tooltipOff},this),L.DomEvent.off(document,"pointerleave",this._tooltipOff,this)},_onHandleDrag:function(){},updateHandle:function(){this.setLatLng(this._handled.getCorner(this._corner))},_tooltipOn:function(t){var e=this._handled.parentGroup,i=e?e.editing:this._handled.editing;if(!t.shiftKey&&(this._handled.isSelected()||!e||e.isCollected(this._handled))){var o=i._lockHandles;this._timer=setTimeout(L.bind((function(){this._timeout&&clearTimeout(this._timeout),this.getTooltip()?o.eachLayer((function(t){this!==t&&t.closeTooltip()})):this.bindTooltip("Locked!",{permanent:!0}),this.openTooltip()}),this),500)}},_tooltipOff:function(t){var e=this._handled.parentGroup,i=e?e.editing:this._handled.editing;if(!t.shiftKey&&(this._handled.isSelected()||!e||e.isCollected(this._handled))){var o=i._lockHandles;t.currentTarget===document&&o.eachLayer((function(t){t.closeTooltip()})),this._timer&&clearTimeout(this._timer),this._timeout=setTimeout(L.bind((function(){this.closeTooltip()}),this),400)}}}),L.lockHandle=function(t,e,i){return new L.LockHandle(t,e,i)}},function(t,e){L.RotateHandle=L.EditHandle.extend({options:{TYPE:"rotate",icon:L.icon({iconUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAklEQVR4AewaftIAAAHiSURBVMXBa3HbShgA0PMp/1sCCo8oCEpgTaCXgIXAJiDzyCJoAUTm4UVQAns1Y8+snWnTvJyeE16hkjDgDrfoNTMKcpC9UPiLSo8JyetkjEHxjPCMyoS199kFoz8Iv1HpMaN3qWDCHoegOKkkRwnJpRmroHgiPFEZ8IBekzEGxQtUEhKSS/fB7Ew4U+lxcGkVZG9QWWPSFAxBcdK59KApuA+yNwp2uEdx1GN25sZJZULSfAtm77SlbNjju6MvG75u+WHRWVR6rDVjMPsgwYyVZl3pLTpHkyYHOx8syMiayaJzlDTZ9YyaZNFVkiYH2ZUEBcVJJXVImuz6Js3Qofe59pq7DoOTILu+g+a288mCouk7/1iH4qTS+2QdDppbV1ZJmrnDXnPnc5UOs2Z0fUmTuyBr+krvSioJyUmQO0dZM7mepMkWnaNRkyrJB6uskTSjxY3Fll8bvmJwlDb83FJ8gMqAB80uyBY3Trb82PAfvjj6vuHnluIdKgMeNXOwctK5NKBoHitrb1RJeHRp5Ux4ojLg0aWMHGQvUOkxIWkKVsHsTPiNSo8HDC5lZIsgO6n0uMUdRvQuFQxB8UR4RmXC2vvsgtEfhL+o9JiQvE7GGBTPCK9QSUjoMWgKDthjDrIX+h/k0I7gth6N5gAAAABJRU5ErkJggg==",iconSize:[32,32],iconAnchor:[16,16]})},_onHandleDrag:function(){var t=this._handled,e=t.getCorner(this._corner),i=this.getLatLng(),o=this.calculateAngleDelta(e,i);t.rotateBy(o,"rad")},updateHandle:function(){this.setLatLng(this._handled.getCorner(this._corner))}}),L.rotateHandle=function(t,e,i){return new L.RotateHandle(t,e,i)}},function(t,e){L.ScaleHandle=L.EditHandle.extend({options:{TYPE:"scale",icon:L.icon({iconUrl:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHdpZHRoPSI0NTkiIGhlaWdodD0iNDY0IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA1MTIgNTEyIiB4bWw6c3BhY2U9InByZXNlcnZlIiBzdHlsZT0iIj48cmVjdCBpZD0iYmFja2dyb3VuZHJlY3QiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHg9IjAiIHk9IjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0ibm9uZSIgY2xhc3M9IiIgc3R5bGU9IiIvPjxnIGNsYXNzPSJjdXJyZW50TGF5ZXIiIHN0eWxlPSIiPjx0aXRsZT5MYXllciAxPC90aXRsZT48cGF0aCBkPSJNNDU5LjA0OTE1OTUzMDQ3MTM0LDg2LjkyNjIzNDUxMjU1MDAyIFYwIGgtODUuNzE0NTczMzU2MzEyMDkgdjI3LjA0MzcxNzQwMzkwNDQ1MiBIODUuNzE0NTczMzU2MzEyMDMgVjAgSDAgdjg2LjkyNjIzNDUxMjU1MDAyIGgyNS43MTQzNzIwMDY4OTM2MjYgdjI4OS43NTQxMTUwNDE4MzM0IEgwIHY4Ni45MjYyMzQ1MTI1NTAwMiBoODUuNzE0NTczMzU2MzEyMDkgdi0yNy4wNDM3MTc0MDM5MDQ0NTIgaDI4NS43MTUyNDQ1MjEwNDAzIHYyNy4wNDM3MTc0MDM5MDQ0NTIgaDg1LjcxNDU3MzM1NjMxMjA5IHYtODYuOTI2MjM0NTEyNTUwMDIgaC0yMy44MDk2MDM3MTAwODY2OSBWODYuOTI2MjM0NTEyNTUwMDIgSDQ1OS4wNDkxNTk1MzA0NzEzNCB6TTM4NC43NjMxOTU5NTUwMDA5LDEyLjU1NjAxMTY1MTgxMjc4MSBoNjEuOTA0OTY5NjQ2MjI1Mzk2IHY2Mi43ODAwNTgyNTkwNjM5MSBoLTYxLjkwNDk2OTY0NjIyNTM5NiBWMTIuNTU2MDExNjUxODEyNzgxIHpNMTIuMzgwOTkzOTI5MjQ1MDUsMTIuNTU2MDExNjUxODEyNzgxIGg2MS45MDQ5Njk2NDYyMjUzOTYgdjYyLjc4MDA1ODI1OTA2MzkxIEgxMi4zODA5OTM5MjkyNDUwNSBWMTIuNTU2MDExNjUxODEyNzgxIHpNNzQuMjg1OTYzNTc1NDcwNTMsNDUxLjA1MDU3MjQxNTEyMDY2IEgxMi4zODA5OTM5MjkyNDUwNSB2LTYyLjc4MDA1ODI1OTA2MzkxIGg2MS45MDQ5Njk2NDYyMjUzOTYgVjQ1MS4wNTA1NzI0MTUxMjA2NiB6TTQ0NS43MTU3ODE0NTI4MjI3NCw0NTEuMDUwNTcyNDE1MTIwNjYgaC02Mi44NTczNTM3OTQ2Mjg4NjQgdi02Mi43ODAwNTgyNTkwNjM5MSBoNjIuODU3MzUzNzk0NjI4ODY0IFY0NTEuMDUwNTcyNDE1MTIwNjYgek00MDcuNjIwNDE1NTE2Njg0MjYsMzc2LjY4MDM0OTU1NDM4MzQ0IGgtMzYuMTkwNTk3NjM5MzMxNzcgdjMyLjgzODc5OTcwNDc0MTEyIEg4NS43MTQ1NzMzNTYzMTIwMyB2LTMyLjgzODc5OTcwNDc0MTEyIEg0OS41MjM5NzU3MTY5ODAzMiBWODYuOTI2MjM0NTEyNTUwMDIgaDM2LjE5MDU5NzYzOTMzMTc3IFY1MC4yMjQwNDY2MDcyNTExMjUgaDI4Ny42MjAwMTI4MTc4NDcyIHYzNi43MDIxODc5MDUyOTg5IGgzNC4yODU4MjkzNDI1MjQ4MzUgVjM3Ni42ODAzNDk1NTQzODM0NCB6IiBpZD0ic3ZnXzIiIGNsYXNzPSIiIGZpbGw9IiMxYTFhZWIiIGZpbGwtb3BhY2l0eT0iMSIvPjwvZz48L3N2Zz4=",iconSize:[32,32],iconAnchor:[16,16]})},_onHandleDrag:function(){var t=this._handled,e=t._map,i=t.edgeMinWidth,o=t.getCorner(this._corner),n=this.getLatLng(),a=this._calculateScalingFactor(o,n);i||(i=50);var s=e.latLngToLayerPoint(t.getCorner(0)),r=e.latLngToLayerPoint(t.getCorner(1)),l=Math.abs(s.x-r.x),c=Math.abs(s.y-r.y);Math.sqrt(l*l+c*c)>i||a>1?t.scaleBy(a):t.scaleBy(1)},updateHandle:function(){this.setLatLng(this._handled.getCorner(this._corner))}}),L.scaleHandle=function(t,e,i){return new L.ScaleHandle(t,e,i)}},function(t,e){L.IconSet=L.Class.extend({_svg:'',_symbols:"",render:function(){return this.addSymbols(this._symbols),this._svg},addSymbols:function(t){this._svg+=t}})},function(t,e){L.KeymapperIconSet=L.IconSet.extend({_symbols:''})},function(t,e){L.ToolbarIconSet=L.IconSet.extend({_symbols:''})},function(t,e){L.DistortableImage=L.DistortableImage||{},L.distortableImage=L.DistortableImage,L.DistortableImage.action_map={},L.EditAction=L.Toolbar2.Action.extend({options:{toolbarIcon:{svg:!1,html:"",className:"",tooltip:""}},initialize:function(t,e,i){this._overlay=e,this._map=t,L.setOptions(this,i),L.Toolbar2.Action.prototype.initialize.call(this,i),this._injectIconSet()},_createIcon:function(t,e,i){var o=this,n=this.options.toolbarIcon,a=n.className,s=this._overlay.editing;this.toolbar=t,this._icon=L.DomUtil.create("li","",e),this._link=L.DomUtil.create("a","",this._icon),n.svg?this._link.innerHTML=L.IconUtil.create(n.html):this._link.innerHTML=n.html,this._link.setAttribute("href","#"),this._link.setAttribute("title",n.tooltip),this._link.setAttribute("role","button"),L.DomUtil.addClass(this._link,this.constructor.baseClass),a&&(L.DomUtil.addClass(this._link,a),"disabled"===a&&L.DomUtil.addClass(this._icon,a),a===s._mode?L.DomUtil.addClass(this._link,"selected-mode"):L.DomUtil.removeClass(this._link,"selected-mode")),L.DomEvent.on(this._link,"click",this.enable,this),L.DomEvent.on(this._overlay,"update",(function(){var t=o._link.innerHTML.match(/xlink:href="#restore"/);t&&1===t.length&&o._enableAction()})),this._addSubToolbar(t,this._icon,i)},_injectIconSet:function(){if(!document.querySelector("#iconset")){var t=document.createElement("div");t.id="iconset",t.setAttribute("hidden","hidden"),t.innerHTML=(new L.ToolbarIconSet).render(),document.querySelector(".leaflet-marker-pane").appendChild(t)}},_enableAction:function(){L.DomUtil.removeClass(this._link.parentElement,"disabled"),L.DomUtil.removeClass(this._link,"disabled")},_disableAction:function(){L.DomUtil.addClass(this._link.parentElement,"disabled"),L.DomUtil.addClass(this._link,"disabled")}}),L.editAction=function(t,e,i){return new L.EditAction(t,e,i)}},function(t,e){L.BorderAction=L.EditAction.extend({initialize:function(t,e,i){var o,n,a=e.editing,s=a._mode;a._outlined?(o="border_outer",n=e.options.translation.removeBorder):(o="border_clear",n=e.options.translation.addBorder),(i=i||{}).toolbarIcon={svg:!0,html:o,tooltip:n,className:"lock"===s?"disabled":""},L.DistortableImage.action_map.b="lock"===s?"":"_toggleBorder",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay.editing;L.IconUtil.toggleXlink(this._link,"border_clear","border_outer"),L.IconUtil.toggleTitle(this._link,"Remove Border","Add Border"),t._toggleBorder()}})},function(t,e){L.DeleteAction=L.EditAction.extend({initialize:function(t,e,i){var o,n=e.editing;n instanceof L.DistortableImage.Edit?(o=e.options.translation.deleteImage,L.DistortableImage.action_map.Backspace="lock"===n._mode?"":"_removeOverlay"):(o=e.options.translation.deleteImages,L.DistortableImage.group_action_map.Backspace="lock"===n._mode?"":"_removeGroup"),(i=i||{}).toolbarIcon={svg:!0,html:"delete_forever",tooltip:o,className:"lock"===n._mode?"disabled":""},L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay.editing;t instanceof L.DistortableImage.Edit?t._removeOverlay():t._removeGroup()}})},function(t,e){L.DistortAction=L.EditAction.extend({initialize:function(t,e,i){(i=i||{}).toolbarIcon={svg:!0,html:"distort",tooltip:e.options.translation.distortImage,className:"distort"},L.DistortableImage.action_map.d="_distortMode",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){this._overlay.editing._distortMode()}})},function(t,e){L.DragAction=L.EditAction.extend({initialize:function(t,e,i){(i=i||{}).toolbarIcon={svg:!0,html:"drag",tooltip:e.options.translation.dragImage,className:"drag"},L.DistortableImage.action_map.D="_dragMode",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){this._overlay.editing._dragMode()}})},function(t,e){L.ExportAction=L.EditAction.extend({initialize:function(t,e,i){var o,n=e.editing;this.isExporting=!1,this.mouseLeaveSkip=!0,this.isHooksExecuted=!1,n instanceof L.DistortableImage.Edit?(L.DistortableImage.action_map.e="_getExport",o=e.options.translation.exportImage):(L.DistortableImage.group_action_map.e="runExporter",o=e.options.translation.exportImages),(i=i||{}).toolbarIcon={svg:!0,html:"get_app",tooltip:o},L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay.editing;if(t instanceof L.DistortableImage.Edit)t._getExport();else if(!this.isHooksExecuted){this.isHooksExecuted=!0;var e=this._link.parentElement;this.mouseEnterHandler=this.handleMouseEnter.bind(this),this.mouseLeaveHandler=this.handleMouseLeave.bind(this),L.DomEvent.on(e,"click",(function(){if(this.isExporting){if(this.mouseLeaveSkip)return;this.resetState(),this.detachMouseEventListeners(e),t.cancelExport()}else this.isExporting=!0,this.renderExportIcon(),setTimeout(this.attachMouseEventListeners.bind(this,e),100),t.runExporter().then(function(){this.resetState(),this.detachMouseEventListeners(e)}.bind(this))}),this)}},resetState:function(){this.renderDownloadIcon(),this.isExporting=!1,this.mouseLeaveSkip=!0},attachMouseEventListeners:function(t){t.addEventListener("mouseenter",this.mouseEnterHandler),t.addEventListener("mouseleave",this.mouseLeaveHandler)},detachMouseEventListeners:function(t){t.removeEventListener("mouseenter",this.mouseEnterHandler),t.removeEventListener("mouseleave",this.mouseLeaveHandler)},handleMouseEnter:function(){this.renderCancelIcon()},handleMouseLeave:function(){this.mouseLeaveSkip?this.mouseLeaveSkip=!1:this.renderExportIcon()},renderDownloadIcon:function(){L.IconUtil.toggleXlink(this._link,"get_app","spinner"),L.IconUtil.toggleTitle(this._link,"Export Images","Loading..."),L.DomUtil.removeClass(this._link.firstChild,"loader")},renderExportIcon:function(){L.IconUtil.toggleXlink(this._link,"spinner"),L.IconUtil.toggleTitle(this._link,"Export Images","Loading..."),L.IconUtil.addClassToSvg(this._link,"loader")},renderCancelIcon:function(){L.IconUtil.toggleXlink(this._link,"cancel"),L.IconUtil.toggleTitle(this._link,"Cancel Export","Loading..."),L.DomUtil.removeClass(this._link.firstChild,"loader")}})},function(t,e){L.FreeRotateAction=L.EditAction.extend({initialize:function(t,e,i){(i=i||{}).toolbarIcon={svg:!0,html:"crop_rotate",tooltip:e.options.translation.freeRotateImage,className:"freeRotate"},L.DistortableImage.action_map.f="_freeRotateMode",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){this._overlay.editing._freeRotateMode()}})},function(t,e){L.GeolocateAction=L.EditAction.extend({initialize:function(t,e,i){var o=e.editing;(i=i||{}).toolbarIcon={svg:!0,html:"explore",tooltip:e.options.translation.geolocateImage,className:"lock"===o._mode?"disabled":""},L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay.getElement();EXIF.getData(t,L.EXIF(t))}})},function(t,e){L.LockAction=L.EditAction.extend({initialize:function(t,e,i){var o,n,a=e.editing;a instanceof L.DistortableImage.Edit?(L.DistortableImage.action_map.u="_unlock",L.DistortableImage.action_map.l="_lock",n=e.options.translation.lockMode,o=a.isMode("lock")?"lock":"unlock"):(L.DistortableImage.group_action_map.l="_lockGroup",n=e.options.translation.lockImages,o="lock"),(i=i||{}).toolbarIcon={svg:!0,html:o,tooltip:n,className:"lock"},L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay.editing;t instanceof L.DistortableImage.Edit?t._toggleLockMode():t._lockGroup()}})},function(t,e){L.OpacityAction=L.EditAction.extend({initialize:function(t,e,i){var o,n,a=e.editing,s=a._mode;a._transparent?(o="opacity_empty",n=e.options.translation.makeImageOpaque):(o="opacity",n=e.options.translation.makeImageTransparent),(i=i||{}).toolbarIcon={svg:!0,html:o,tooltip:n,className:"lock"===s?"disabled":""},L.DistortableImage.action_map.o="lock"===s?"":"_toggleOpacity",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay.editing,e=this._link;L.IconUtil.toggleXlink(e,"opacity","opacity_empty"),L.IconUtil.toggleTitle(e,"Make Image Transparent","Make Image Opaque"),t._toggleOpacity()}})},function(t,e){L.RestoreAction=L.EditAction.extend({initialize:function(t,e,i){var o=L.Utils.getNestedVal(e,"editing","_mode"),n=e.edited;(i=i||{}).toolbarIcon={svg:!0,html:"restore",tooltip:e.options.translation.restoreImage,className:n&&"lock"!==o?"":"disabled"},L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay;L.DomEvent.on(t,{edit:this._enableAction,restore:this._disableAction},this),t.restore()}})},function(t,e){L.RotateAction=L.EditAction.extend({initialize:function(t,e,i){(i=i||{}).toolbarIcon={svg:!0,html:"rotate",tooltip:e.options.translation.rotateImage,className:"rotate"},L.DistortableImage.action_map.r="_rotateMode",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){this._overlay.editing._rotateMode()}})},function(t,e){L.ScaleAction=L.EditAction.extend({initialize:function(t,e,i){(i=i||{}).toolbarIcon={svg:!0,html:"scale",tooltip:e.options.translation.scaleImage,className:"scale"},L.DistortableImage.action_map.s="_scaleMode",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){this._overlay.editing._scaleMode()}})},function(t,e){L.StackAction=L.EditAction.extend({initialize:function(t,e,i){var o,n,a=e.editing;a._toggledImage?(o="flip_to_back",n=e.options.translation.stackToFront):(o="flip_to_front",n=e.options.translation.stackToBack),(i=i||{}).toolbarIcon={svg:!0,html:o,tooltip:n,className:"lock"===a._mode?"disabled":""},L.DistortableImage.action_map.q="lock"===a._mode?"":"_stackUp",L.DistortableImage.action_map.a="lock"===a._mode?"":"_stackDown",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){var t=this._overlay.editing;L.IconUtil.toggleXlink(this._link,"flip_to_front","flip_to_back"),L.IconUtil.toggleTitle(this._link,"Stack to Front","Stack to Back"),t._toggleOrder()}})},function(t,e){L.UnlockAction=L.EditAction.extend({initialize:function(t,e,i){(i=i||{}).toolbarIcon={svg:!0,html:"unlock",tooltip:e.options.translation.unlockImages},L.DistortableImage.group_action_map.u="_unlockGroup",L.EditAction.prototype.initialize.call(this,t,e,i)},addHooks:function(){this._overlay.editing._unlockGroup()}})},function(t,e){L.DistortableImage=L.DistortableImage||{},L.distortableImage=L.DistortableImage,L.DistortableImage.action_map={},L.DistortableImage.PopupBar=L.Toolbar2.Popup.extend({options:{anchor:[0,-10]},initialize:function(t,e){L.setOptions(this,e),L.Toolbar2.Popup.prototype.initialize.call(this,t,e)},addHooks:function(t,e){this.map=t,this.ov=e},tools:function(){if(this._ul)return this._ul.children},clickTool:function(t){for(var e=this.tools(),i=0;i=1?this.nextMode():("lock"===t&&this._enableDragging(),this._mode="",this._updateHandle()))},_removeToolbar:function(){var t=this._overlay._map;this.toolbar&&(t.removeLayer(this.toolbar),this.toolbar=!1)},_enableDragging:function(){var t=this._overlay,e=t._map;this.dragging=new L.Draggable(t.getElement()),this.dragging.enable(),this.dragging.on("dragstart",(function(){t.fire("dragstart"),this._removeToolbar()}),this),this.dragging._updatePosition=function(){var i,o,n=t.getCorner(0),a=this._newPos.subtract(e.latLngToLayerPoint(n)),s={};for(this.fire("predrag"),o=0;o<4;o++)i=e.latLngToLayerPoint(t.getCorner(o)),s[o]=e.layerPointToLatLng(i.add(a));t.setCorners(s),t.fire("drag"),this.fire("drag")}},_disableDragging:function(){this.dragging&&(this.dragging.disable(),delete this.dragging)},_dragMode:function(){this.setMode("drag")},_scaleMode:function(){this.setMode("scale")},_distortMode:function(){this.setMode("distort")},_rotateMode:function(){this.setMode("rotate")},_freeRotateMode:function(){this.setMode("freeRotate")},_toggleLockMode:function(){this.hasTool(L.LockAction)&&(this.isMode("lock")?this._unlock():this._lock())},_toggleOpacity:function(){var t,e=this._overlay.getElement();this.hasTool(L.OpacityAction)&&(this._transparent=!this._transparent,t=this._transparent?this.options.opacity:1,L.DomUtil.setOpacity(e,t),e.setAttribute("opacity",t),this._refresh())},_toggleBorder:function(){var t,e=this._overlay.getElement();this.hasTool(L.BorderAction)&&(this._outlined=!this._outlined,t=this._outlined?this.options.outline:"none",e.style.outline=t,this._refresh())},_toggleOrder:function(){this.hasTool(L.StackAction)&&(this._toggledImage?this._stackUp():this._stackDown())},_removeOverlay:function(){var t=this._overlay,e=this.parentGroup;!this.isMode("lock")&&this.hasTool(L.DeleteAction)&&(L.DomUtil.confirmDelete()&&(this._removeToolbar(),e?e.removeLayer(t):t._map.removeLayer(t)))},_getExport:function(){var t=this._overlay,e=t._map,i=t.getElement();if(this.hasTool(L.ExportAction)){var o=new Image;o.id=o.id||"tempId12345",document.body.appendChild(o),o.onload=function(){var i=o.height,n=o.width,a=e.latLngToLayerPoint(t.getCorner(0)),s=e.latLngToLayerPoint(t.getCorner(1)),r=e.latLngToLayerPoint(t.getCorner(2)),l=e.latLngToLayerPoint(t.getCorner(3));o.onload=function(){L.DomUtil.remove(o)},window&&window.hasOwnProperty("warpWebGl")&&warpWebGl(o.id,[0,0,n,0,n,i,0,i],[a.x,a.y,s.x,s.y,l.x,l.y,r.x,r.y],!0)},o.src=t.options.fullResolutionSrc||i.src}},_stackUp:function(){this._toggledImage&&this.hasTool(L.StackAction)&&(this._toggledImage=!1,this._overlay.bringToFront(),this._refresh())},_stackDown:function(){!this._toggledImage&&this.hasTool(L.StackAction)&&(this._toggledImage=!0,this._overlay.bringToBack(),this._refresh())},_unlock:function(){var t=this._overlay,e=t._map,i=this.parentGroup,o=L.LockAction,n=L.UnlockAction;this.isMode("lock")&&(this.hasTool(o)||!i||i.editing.hasTool(n))&&(this.currentHandle&&e.removeLayer(this.currentHandle),"lock"!==t.options.mode&&this.hasMode(t.options.mode)?this._mode=t.options.mode:(this._mode="",this.currentHandle=""),this._updateHandle(),this._enableDragging(),this._refresh())},_lock:function(){var t=this._overlay._map,e=this.parentGroup,i=L.LockAction;this.isMode("lock")||(this.hasTool(i)||!e||e.editing.hasTool(i))&&(this.currentHandle&&t.removeLayer(this.currentHandle),this._mode="lock",this._updateHandle(),this._disableDragging(),this._refresh())},_deselect:function(){this._overlay.deselect()},_showMarkers:function(t){var e=this.parentGroup;this.currentHandle&&(!this.isMode("lock")&&e&&e.anyCollected()||this.currentHandle.eachLayer((function(t){t.setOpacity(1),t.dragging&&t.dragging.enable(),L.DomUtil.addClass(t.getElement(),"leaflet-interactive")})))},_hideMarkers:function(){var t=this._overlay,e=this.parentGroup;this._handles||this._initHandles(),this.currentHandle&&(this.isMode("lock")&&e&&e.isCollected(t)||this.currentHandle.eachLayer((function(t){t.setOpacity(0),t.dragging&&t.dragging.disable(),L.DomUtil.removeClass(t.getElement(),"leaflet-interactive")})))},_updateHandle:function(){var t=this._overlay._map,e=this.getMode();this.currentHandle&&t.removeLayer(this.currentHandle),this.currentHandle=""===e?"":this._handles[this.getMode()],""!==this.currentHandle&&t.addLayer(this.currentHandle)},_addToolbar:function(){var t=this._overlay,e=this.parentGroup,i=t._map,o=t.getCorners(),n=-1/0;if(e&&e.anyCollected())e.editing._addToolbar();else if(!t.options.suppressToolbar&&!this.toolbar){for(var a=0;an&&(n=o[a].lat);var s=t.getCenter();s.lat=n,this.toolbar=L.distortableImage.popupBar(s,{actions:this.editActions}).addTo(i,t),t.fire("toolbar:created")}},_refresh:function(){this.toolbar&&this._removeToolbar(),this._addToolbar()},_updateToolbarPos:function(){var t=this._overlay,e=t.getCorners(),i=this.toolbar,o=-1/0;if(i&&i instanceof L.DistortableImage.PopupBar){for(var n=0;no&&(o=e[n].lat);var a=t.getCenter();a.lat=o,t.options.suppressToolbar||this.toolbar.setLatLng(a)}},hasMode:function(t){return!!this._modes[t]},getMode:function(){if(this.enabled())return this._mode},getModes:function(){return this._modes},isMode:function(t){return!!this.enabled()&&this._mode===t},setMode:function(t){var e,i=this._overlay,o=this.parentGroup,n=this.getMode();if(o&&(e=L.DistortableCollection.Edit.MODES[t]),n!==t&&this.enabled()&&this.hasMode(t)&&(!o||o.editing.hasTool(e)))return this.toolbar&&this.toolbar.clickTool(t),this.isMode("lock")&&!this.dragging&&this._enableDragging(),this._mode=t,this.isMode("lock")&&this._disableDragging(),this._updateHandle(),this._refresh(),o&&o.isCollected(i)&&i.deselect(),this},nextMode:function(t){var e=this.getMode(),i=this.parentGroup,o=Object.keys(this.getModes()),n=o.indexOf(e),a=o[(n+1)%o.length];if(t){if(i&&i.anyCollected())return;L.DomEvent.stop(t)}return this.setMode(a)}}),L.distortableImage.edit=function(t,e){return new L.DistortableImage.Edit(t,e)}},function(t,e){L.DistortableImage=L.DistortableImage||{},L.DistortableCollection.Edit=L.Handler.extend({options:{keymap:L.distortableImage.group_action_map},initialize:function(t,e){this._group=t,this._exportOpts=t.options.exportOpts,L.setOptions(this,e),L.distortableImage.group_action_map.Escape="_decollectAll"},addHooks:function(){var t=this._group._map;this.editActions=this.options.actions,this.runExporter=L.bind(L.Utils.getNestedVal(this,"_exportOpts","exporter")||this.startExport,this),L.DomEvent.on(document,"keydown",this._onKeyDown,this),t.doubleClickZoom.enabled()||t.doubleClickLabels.enabled()||L.DomEvent.on(t,"click",this._decollectAll,this),L.DomEvent.on(t,{singleclickon:this._singleClickListeners,singleclickoff:this._resetClickListeners,singleclick:this._singleClick,boxcollectend:this._addCollections},this),this._group.editable=!0,this._group.eachLayer((function(t){t.editing.enable()}))},removeHooks:function(){var t=this._group._map;L.DomEvent.off(document,"keydown",this._onKeyDown,this),t.doubleClickZoom.enabled()||t.doubleClickLabels.enabled()||L.DomEvent.off(t,"click",this._decollectAll,this),L.DomEvent.off(t,{singleclickon:this._singleClickListeners,singleclickoff:this._resetClickListeners,singleclick:this._singleClick,boxcollectend:this._addCollections},this),this._decollectAll(),this._group.editable=!1,this._group.eachLayer((function(t){t.editing.disable()}))},enable:function(){return this._enabled=!0,this.addHooks(),this},disable:function(){return this._enabled=!1,this.removeHooks(),this},_onKeyDown:function(t){var e=this.options.keymap[t.key];this[e]&&this._group.anyCollected()&&this[e].call(this)},_singleClick:function(t){"singleclick"===t.type&&this._decollectAll(t)},_singleClickListeners:function(){var t=this._group._map;L.DomEvent.off(t,"click",this._decollectAll,this),L.DomEvent.on(t,"singleclick",this._decollectAll,this)},_resetClickListeners:function(){var t=this._group._map;L.DomEvent.on(t,"click",this._decollectAll,this),L.DomEvent.off(t,"singleclick",this._decollectAll,this)},_decollectAll:function(t){var e;t&&(e=t.originalEvent),e&&(e.shiftKey||e.target instanceof HTMLImageElement)||(this._group.eachLayer((function(t){L.DomUtil.removeClass(t.getElement(),"collected"),t.deselect()})),this._removeToolbar(),t&&L.DomEvent.stopPropagation(t))},_unlockGroup:function(){this._group.eachLayer((function(t){if(this._group.isCollected(t)){var e=t.editing;e.isMode("lock")&&(e._unlock(),t.deselect())}}),this)},_lockGroup:function(){this._group.eachLayer((function(t){if(this._group.isCollected(t)){var e=t.editing;e.isMode("lock")||(e._lock(),L.DomUtil.addClass(t.getElement(),"collected"))}}),this)},_addCollections:function(t){var e=t.boxCollectBounds,i=this._group._map;this._group.eachLayer((function(t){var o=t.editing;t.isSelected()&&t.deselect();var n=L.latLngBounds(t.getCorner(2),t.getCorner(1)),a=i.getZoom(),s=i.getCenter();n=i._latLngBoundsToNewLayerBounds(n,a,s),e.intersects(n)&&o.enabled()&&(this.toolbar||this._addToolbar(),L.DomUtil.addClass(t.getElement(),"collected"))}),this)},_removeGroup:function(t){var e=this._group._toRemove(),i=e.length;0!==i&&(L.DomUtil.confirmDeletes(i)&&(e.forEach((function(t){this._group.removeLayer(t)}),this),this._group.anyCollected()||this._removeToolbar()),t&&L.DomEvent.stopPropagation(t))},cancelExport:function(){this.customCollection||(this._exportOpts.collection=void 0),clearInterval(this.updateInterval)},_addToolbar:function(){var t=this._group,e=t._map;t.options.suppressToolbar||this.toolbar||(this.toolbar=L.distortableImage.controlBar({actions:this.editActions,position:"topleft"}).addTo(e,t))},_removeToolbar:function(){var t=this._group._map;if(!this.toolbar)return!1;t.removeLayer(this.toolbar),this.toolbar=!1},hasTool:function(t){return this.editActions.some((function(e){return e===t}))},addTool:function(t){return"leaflet-toolbar-icon"!==t.baseClass||this.hasTool(t)||(this._removeToolbar(),this.editActions.push(t),this._addToolbar()),this},removeTool:function(t){return this.editActions.some((function(e,i){return this.editActions[i]===t&&(this._removeToolbar(),this.editActions.splice(i,1),this._addToolbar(),!0)}),this),this},startExport:function(){return new Promise(function(t){var e,i=this._exportOpts;i.resolve=t;var o=this;this.updateInterval=null,i.collection?o.customCollection=!0:(o.customCollection=!1,i.collection=this._group.generateExportJson().images),i.frequency=i.frequency||3e3,i.scale=i.scale||100,i.updater=i.updater||function(n){(n=JSON.parse(n)).status_url&&(e!==n.status_url&&n.status_url.match(".json")&&(e=n.status_url),"complete"===n.status&&(clearInterval(o.updateInterval),o.customCollection||(o._exportOpts.collection=void 0),t(),null!==n.jpg&&alert("Export succeeded. "+i.exportUrl+n.jpg)),console.log(n))},i.handleStatusRes=i.handleStatusRes||function(t){e=i.statusUrl+t,o.updateInterval=setInterval((function(){var t=new Request(e+"?"+Date.now(),{method:"GET"});fetch(t).then((function(t){if(t.ok)return t.text()})).then(i.updater)}),i.frequency)},i.fetchStatusUrl=i.fetchStatusUrl||function(t){var e=new FormData;e.append("collection",JSON.stringify(t.collection)),e.append("scale",t.scale),e.append("upload",!0);var i={method:"POST",body:e},o=new Request(t.exportStartUrl,i);fetch(o).then((function(t){if(t.ok)return t.text()})).then(t.handleStatusRes)},i.fetchStatusUrl(i)}.bind(this))}}),L.distortableCollection.edit=function(t,e){return new L.DistortableCollection.Edit(t,e)}},function(t,e){L.DomUtil=L.DomUtil||{},L.DistortableImage=L.DistortableImage||{},L.distortableImage=L.DistortableImage,L.DistortableImage.Keymapper=L.Handler.extend({options:{position:"topright"},initialize:function(t,e){this._map=t,L.setOptions(this,e)},addHooks:function(){this._keymapper||(this._container=this._buildContainer(),this._scrollWrapper=this._wrap(),this._toggler=this._createButton(),this._setMapper(this._container,this._scrollWrapper,this._toggler),L.DomEvent.on(this._toggler,"click",this._toggleKeymapper,this),L.DomEvent.disableClickPropagation(this._container),L.DomEvent.disableScrollPropagation(this._container))},removeHooks:function(){this._keymapper&&(L.DomEvent.off(this._toggler,"click",this._toggleKeymapper,this),L.DomUtil.remove(this._toggler),L.DomUtil.remove(this._scrollWrapper),L.DomUtil.remove(this._container),this._keymapper=!1)},_buildContainer:function(){var t=L.DomUtil.create("div","ldi-keymapper-hide");t.setAttribute("id","ldi-keymapper");var e=L.DomUtil.create("br","divider");return t.appendChild(e),t},_createButton:function(){var t=L.DomUtil.create("a","");return t.innerHTML=L.IconUtil.create("keyboard_open"),t.setAttribute("id","toggle-keymapper"),t.setAttribute("href","#"),t.setAttribute("title","Show keymap"),t.setAttribute("role","button"),t.setAttribute("aria-label","Show keymap"),t},_wrap:function(){var t=L.DomUtil.create("div","");return t.setAttribute("id","keymapper-wrapper"),t.style.display="none",t},_setMapper:function(t,e,i){this._keymapper=L.control({position:this.options.position}),this._keymapper.onAdd=function(){return t.appendChild(e),e.insertAdjacentHTML("beforeend",'
Rotate Mode
R
RotateScale Mode
r
Scale Mode
s
Distort Mode
d
Drag Mode
D
Lock (Mode) / Unlock Image
l u
Stack up / down
q a
Add / Remove Image Border
b
Toggle Opacity
o
Deselect All
esc
Delete Image(s)
delete backspace
Export Image(s)
e
'),t.appendChild(i),t},this._keymapper.addTo(this._map)},_toggleKeymapper:function(t){t.preventDefault(),this._container.className="ldi-keymapper leaflet-control"===this._container.className?"ldi-keymapper-hide leaflet-control":"ldi-keymapper leaflet-control",this._scrollWrapper.style.display="none"===this._scrollWrapper.style.display?"block":"none",this._toggler.innerHTML="close"===this._toggler.innerHTML?L.IconUtil.create("keyboard_open"):"close",L.IconUtil.toggleTitle(this._toggler,"Show keymap","Hide keymap"),L.DomUtil.toggleClass(this._toggler,"close-icon")},_injectIconSet:function(){if(!document.querySelector("#keymapper-iconset")){var t=L.DomUtil.create("div","");t.id="keymapper-iconset",t.setAttribute("hidden","hidden"),this._iconset=(new L.KeymapperIconSet).render(),t.innerHTML=this._iconset,document.querySelector(".leaflet-control-container").appendChild(t)}}}),L.DistortableImage.Keymapper.addInitHook((function(){L.DistortableImage.Keymapper.prototype._n=L.DistortableImage.Keymapper.prototype._n?L.DistortableImage.Keymapper.prototype._n+1:1,1!==L.DistortableImage.Keymapper.prototype._n||L.Browser.mobile||(this.enable(),this._injectIconSet())})),L.distortableImage.keymapper=function(t,e){return new L.DistortableImage.Keymapper(t,e)}},function(t,e){L.Map.DoubleClickZoom.include({addHooks:function(){this._map.on({click:this._fireIfSingle,dblclick:this._onDoubleClick},this)},removeHooks:function(){this._map.off({click:this._fireIfSingle,dblclick:this._onDoubleClick},this)},enable:function(){return this._enabled||this._map.doubleClickLabels&&this._map.doubleClickLabels.enabled()||(this._map.fire("singleclickon"),this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._map.fire("singleclickoff"),this._enabled=!1,this.removeHooks(),this):this},_fireIfSingle:function(t){var e=this._map,i=t.originalEvent;i&&i.shiftKey||(e._clicked+=1,this._map._clickTimeout=setTimeout((function(){1===e._clicked?(e._clicked=0,e.fire("singleclick",{type:"singleclick"})):L.Browser.touch&&i&&i.sourceCapabilities.firesTouchEvents&&e._fireDOMEvent(i,"dblclick",[e])}),250))},_onDoubleClick:function(t){var e=this._map,i=t.originalEvent;if(setTimeout((function(){e._clicked=0,clearTimeout(e._clickTimeout)}),0),!i)return!1;var o=e.getZoom(),n=e.options.zoomDelta,a=i.shiftKey?o-n:o+n;"center"===e.options.doubleClickZoom?e.setZoom(a):e.setZoomAround(t.containerPoint,a)}})},function(t,e){L.Map.mergeOptions({boxCollector:!0,boxZoom:!1}),L.Map.BoxCollector=L.Map.BoxZoom.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){L.DomEvent.on(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){L.DomEvent.off(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){L.DomUtil.remove(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),L.DomUtil.disableTextSelection(),L.DomUtil.disableImageDrag(),this._startPoint=this._map.mouseEventToContainerPoint(t),L.DomEvent.on(document,{contextmenu:L.DomEvent.stop,mousemove:this._onMouseMove,mouseup:this._onMouseUp},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=L.DomUtil.create("div","leaflet-zoom-box",this._container),L.DomUtil.addClass(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t),this._bounds=L.bounds(this._startPoint,this._point);var e=this._bounds.getSize();L.DomUtil.setPosition(this._box,this._bounds.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(L.DomUtil.remove(this._box),L.DomUtil.removeClass(this._container,"leaflet-crosshair")),L.DomUtil.enableTextSelection(),L.DomUtil.enableImageDrag(),L.DomEvent.off(document,{contextmenu:L.DomEvent.stop,mousemove:this._onMouseMove,mouseup:this._onMouseUp},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(L.Util.bind(this._resetState,this),0);var e=L.latLngBounds(this._map.containerPointToLatLng(this._bounds.getBottomLeft()),this._map.containerPointToLatLng(this._bounds.getTopRight())),i=this._map.getZoom(),o=this._map.getCenter();e=this._map._latLngBoundsToNewLayerBounds(e,i,o),this._map.fire("boxcollectend",{boxCollectBounds:e})}}}),L.Map.addInitHook("addHandler","boxCollector",L.Map.BoxCollector)},function(t,e){L.Map.mergeOptions({doubleClickLabels:!0}),L.Map.DoubleClickLabels=L.Map.DoubleClickZoom.extend({enable:function(){var t=this._map;return this._enabled||(t.doubleClickZoom.enabled()&&t.doubleClickZoom.disable(),this._map.fire("singleclickon"),this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},_fireIfSingle:function(t){var e=this._map,i=t.originalEvent;i&&i.shiftKey||(e._clicked+=1,this._map._clickTimeout=setTimeout((function(){1===e._clicked?(e._clicked=0,e.fire("singleclick",{type:"singleclick"})):L.Browser.touch&&i&&i.sourceCapabilities.firesTouchEvents&&e.fire("dblclick")}),250))},_onDoubleClick:function(){var t=this._map,e=t._labels;setTimeout((function(){t._clicked=0,clearTimeout(t._clickTimeout)}),0),e&&(1===e.options.opacity?(e.options.opacity=0,e.setOpacity(0)):(e.options.opacity=1,e.setOpacity(1)))}}),L.Map.addInitHook("addHandler","doubleClickLabels",L.Map.DoubleClickLabels)},function(t,e){L.Map.include({_clicked:0,addGoogleMutant:function(t){return(t=this.mutantOptions=L.extend({mutantOpacity:.8,maxZoom:24,maxNativeZoom:20,minZoom:0,labels:!0,labelOpacity:1,doubleClickLabels:!0},t)).labels||(this.mutantOptions=L.extend(this.mutantOptions,{labelOpacity:t.labels?1:void 0,doubleClickLabels:!!t.labels||void 0})),this._googleMutant=L.tileLayer("http://mt0.google.com/vt/lyrs=s&x={x}&y={y}&z={z}",{maxZoom:t.maxZoom,maxNativeZoom:t.maxNativeZoom,minZoom:t.minZoom,opacity:t.mutantOpacity}).addTo(this),t.labels?this._addLabels(t):this.doubleClickLabels=void 0,this},_addLabels:function(t){return 0!==t.labelOpacity&&1!==t.labelOpacity&&(t.labelOpacity=1),this._labels=L.tileLayer("https://stamen-tiles-{s}.a.ssl.fastly.net/toner-labels/{z}/{x}/{y}{r}.{ext}",{attribution:'Map tiles by Stamen Design, CC BY 3.0 — Map data © OpenStreetMap contributors',subdomains:"abcd",interactive:!1,opacity:t.labelOpacity,maxZoom:t.maxZoom,maxNativeZoom:t.maxNativeZoom,minZoom:t.minZoom,ext:"png"}).addTo(this),this.mutantOptions.doubleClickLabels&&this.doubleClickLabels.enable(),this}}),L.Map.addInitHook((function(){this.doubleClickLabels.disable(),this.doubleClickZoom.enable()}))}]); //# sourceMappingURL=leaflet.distortableimage.js.map \ No newline at end of file diff --git a/src/edit/DistortableCollection.Edit.js b/src/edit/DistortableCollection.Edit.js index b252fe65e..6e33a51d5 100644 --- a/src/edit/DistortableCollection.Edit.js +++ b/src/edit/DistortableCollection.Edit.js @@ -303,28 +303,28 @@ L.DistortableCollection.Edit = L.Handler.extend({ statusUrl = opts.statusUrl + data; // repeatedly fetch the status.json self.updateInterval = setInterval(function intervalUpdater() { - $.ajax(statusUrl + '?' + Date.now(), {// bust cache with timestamp - type: 'GET', - crossDomain: true, - }).done(function(data) { - opts.updater(data); - }); + var request = new Request(statusUrl+'?'+Date.now(), {method: 'GET'}); + fetch(request).then(function(response) { + if (response.ok) { + return response.text(); + } + }).then(opts.updater); }, opts.frequency); } // initiate the export function _defaultFetchStatusUrl(opts) { - $.ajax({ - url: opts.exportStartUrl, - crossDomain: true, - type: 'POST', - data: { - collection: JSON.stringify(opts.collection), - scale: opts.scale, - upload: true, - }, - success: function(data) { opts.handleStatusRes(data); }, // this handles the initial response - }); + var form = new FormData(); + form.append('collection', JSON.stringify(opts.collection)); + form.append('scale', opts.scale); + form.append('upload', true); + var requestOptions = {method: 'POST', body: form}; + var request = new Request(opts.exportStartUrl, requestOptions); + fetch(request).then(function(response) { + if (response.ok) { + return response.text(); + } + }).then(opts.handleStatusRes); } // If the user has passed collection property