diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 00000000..bab55386
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,8 @@
+module.exports = {
+ parserOptions: {
+ parser: "@babel/eslint-parser",
+ requireConfigFile: false,
+ ecmaVersion: "latest",
+ },
+ extends: ["plugin:prettier/recommended"],
+};
diff --git a/.github/code-review/require-person/cynhu92/PR-50 b/.github/code-review/require-person/cynhu92/PR-50
new file mode 100644
index 00000000..e69de29b
diff --git a/.github/code-review/require-person/gnarza/PR-50 b/.github/code-review/require-person/gnarza/PR-50
new file mode 100644
index 00000000..e69de29b
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 00000000..29eb6537
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,100 @@
+name: Draw Attention CI workflow
+
+on:
+ pull_request:
+
+concurrency:
+ group: da-ci-${{ github.head_ref || github.ref_name }}
+ cancel-in-progress: true
+
+env:
+ EVENT: ${{ toJSON(github.event) }}
+
+jobs:
+ # =====================================================================================#
+ # Run code through PHPCodeSniffer to conform to standards =============================#
+ # =====================================================================================#
+ # The installed coding standards are Zend, PEAR, PSR2, Squiz, PSR12, MySource, PSR1, PHPCompatibility, PHPCompatibilityParagonieRandomCompat, PHPCompatibilityParagonieSodiumCompat, PHPCompatibilityWP, WordPress, WordPress-Extra, WordPress-Core and WordPress-Docs
+ static-code-analysis:
+ name: Static Code Analysis
+ if: ${{ github.event_name == 'pull_request' }}
+ runs-on: ubuntu-latest
+ env:
+ phpcs_config_flags: --standard=WordPress --ignore=vendor,node_modules,*min.* --extensions=php --runtime-set testVersion 7.2
+ steps:
+ - name: Install PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: 7.2
+ coverage: none
+
+ - uses: actions/checkout@v3
+ with:
+ ref: ${{ github.event.pull_request.head.ref }}
+
+ - name: Set git user information
+ run: |
+ git config --global user.email "otto@nsquared.io"
+ git config --global user.name "otto-bot-git"
+
+ - name: Prepare environment
+ run: |
+ composer init --name nsquared-team/draw-attention --no-interaction
+ composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
+ composer require --with-all-dependencies --dev dealerdirect/phpcodesniffer-composer-installer:"*" phpcompatibility/phpcompatibility-wp:"*"
+ composer require --with-all-dependencies --dev wp-coding-standards/wpcs
+ vendor/bin/phpcs --version
+ vendor/bin/phpcs -i
+ vendor/bin/phpcs --config-set colors 1
+
+ - name: Install dependencies
+ run: |
+ npm install
+ npm install -g prettier
+ npm install -g eslint
+
+ # =================================================================================================#
+ # Run code through PHPCodeSniffer to conform to standards ========================================#
+ # =================================================================================================#
+
+ - name: Fix code with PHP Code Sniffer
+ if: always()
+ continue-on-error: true
+ run: |
+ vendor/bin/phpcbf -p "." ${{ env.phpcs_config_flags }}
+
+ - name: Check any remaining errors with PHP Code Sniffer
+ if: always()
+ continue-on-error: true
+ run: |
+ vendor/bin/phpcs -p "." ${{ env.phpcs_config_flags }}
+
+ # =================================================================================================#
+ # Run code through Prettier and ESLint to conform to standards ====================================#
+ # =================================================================================================#
+
+ - name: Format JS files
+ run: prettier --write "**/*.js"
+
+ # No Vue files in this project at the moment
+ # - name: Format Vue files
+ # run: prettier --write "**/*.vue"
+
+ - name: Lint JS files
+ run: eslint --fix "**/*.js" --ignore-pattern "**/vendor/**/*" --ignore-pattern "**/node_modules/**/*" --ignore-pattern "**/*min.*"
+
+ # No Vue files in this project at the moment
+ # - name: Lint Vue files
+ # run: eslint --fix "**/*.vue" --ignore-pattern "**/vendor/**/*" --ignore-pattern "**/node_modules/**/*"
+
+ - name: Revert unwanted composer changes
+ run: |
+ git checkout composer.json
+ git checkout composer.lock
+
+ # The push below will not trigger a new workflow because it uses the default GITHUB_TOKEN
+ - name: Commit and push changes
+ run: |
+ # just a guard, we also should keep on excluding the minified files
+ git restore "*min.*"
+ `git add -A && git commit -m "Automated code formatting on branch done." > /dev/null && git push` || true
diff --git a/.gitignore b/.gitignore
index a81060c5..06568d81 100644
--- a/.gitignore
+++ b/.gitignore
@@ -146,6 +146,7 @@ wp-config.php
wp-content/plugins/akismet/.htaccess
public/assets/config.codekit3
+vendor/
# Needed for WP release
node_modules/
release/
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 00000000..ba648ddd
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,2 @@
+*min.*
+public/assets/js/leaflet.js
\ No newline at end of file
diff --git a/Gruntfile.js b/Gruntfile.js
index d918398c..b67aa6db 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,198 +1,214 @@
-module.exports = function( grunt ) {
-
- require('load-grunt-tasks')(grunt);
-
- var pkg = grunt.file.readJSON( 'package.json' );
-
- var bannerTemplate = '/**\n' +
- ' * <%= pkg.title %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
- ' * <%= pkg.author.url %>\n' +
- ' *\n' +
- ' * Copyright (c) <%= grunt.template.today("yyyy") %>;\n' +
- ' * Licensed GPLv2+\n' +
- ' */\n';
-
- var compactBannerTemplate = '/** ' +
- '<%= pkg.title %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> | <%= pkg.author.url %> | Copyright (c) <%= grunt.template.today("yyyy") %>; | Licensed GPLv2+' +
- ' **/\n';
-
- // Project configuration
- grunt.initConfig( {
-
- pkg: pkg,
- watch: {
- styles: {
- files: ['assets/**/*.css','assets/**/*.scss'],
- tasks: ['styles'],
- options: {
- spawn: false,
- livereload: true,
- debounceDelay: 500
- }
- },
- scripts: {
- files: ['assets/**/*.js'],
- tasks: ['scripts'],
- options: {
- spawn: false,
- livereload: true,
- debounceDelay: 500
- }
- },
- php: {
- files: ['**/*.php', '!vendor/**.*.php'],
- tasks: ['php'],
- options: {
- spawn: false,
- debounceDelay: 500
- }
- }
- },
-
- makepot: {
- dist: {
- options: {
- domainPath: '/languages/',
- potFilename: pkg.name + '.pot',
- type: 'wp-plugin'
- }
- }
- },
-
- addtextdomain: {
- dist: {
- options: {
- textdomain: pkg.name
- },
- target: {
- files: {
- src: ['**/*.php']
- }
- }
- }
- },
-
- replace: {
- version_php: {
- src: [
- '**/*.php',
- '!public/includes/lib/**',
- ],
- overwrite: true,
- replacements: [ {
- from: /Version:(\s*?)[a-zA-Z0-9\.\-\+]+$/m,
- to: 'Version:$1' + pkg.version
- }, {
- from: /@version(\s*?)[a-zA-Z0-9\.\-\+]+$/m,
- to: '@version$1' + pkg.version
- }, {
- from: /@since(.*?)NEXT/mg,
- to: '@since$1' + pkg.version
- }, {
- from: /VERSION(\s*?)=(\s*?['"])[a-zA-Z0-9\.\-\+]+/mg,
- to: 'VERSION$1=$2' + pkg.version
- } ]
- },
- version_readme: {
- src: 'readme.txt',
- overwrite: true,
- replacements: [ {
- from: /^Stable tag:(\s*?)[a-zA-Z0-9.-]+(\s*?)$/mi,
- to: 'Stable tag:$1<%= pkg.version %>$2'
- } ]
- },
- readme_txt: {
- src: 'readme.txt',
- dest: 'release/' + pkg.version + '/readme.txt',
- replacements: [ {
- from: /^# (.*?)( #+)?$/mg,
- to: '=== $1 ==='
- }, {
- from: /^## (.*?)( ##+)?$/mg,
- to: '== $1 =='
- }, {
- from: /^### (.*?)( ###+)?$/mg,
- to: '= $1 ='
- }, {
- from: /^\*\*(.*?):\*\*/mg,
- to: '$1:'
- } ]
- }
- },
-
- copy: {
- release: {
- src: [
- '**',
- '!.git',
- '!.github',
- '!external',
- '!.gitignore',
- '!CHANGELOG.md',
- '!CODEOWNERS',
- '!Gruntfile.js',
- '!package.json',
- '!package-lock.json',
-
- '!assets/repo/**',
-
- '!**/*.scss',
- '!**/node_modules/**',
- '!release/**'
-
- ],
- dest: 'release/' + pkg.version + '/'
- },
- svn: {
- cwd: 'release/<%= pkg.version %>/',
- expand: true,
- src: '**',
- dest: 'release/svn/'
- }
- },
-
- compress: {
- dist: {
- options: {
- mode: 'zip',
- archive: './release/<%= pkg.name %>.<%= pkg.version %>.zip'
- },
- expand: true,
- cwd: 'release/<%= pkg.version %>',
- src: ['**/*'],
- dest: '<%= pkg.name %>'
- }
+module.exports = function (grunt) {
+ require("load-grunt-tasks")(grunt);
+
+ var pkg = grunt.file.readJSON("package.json");
+
+ var bannerTemplate =
+ "/**\n" +
+ ' * <%= pkg.title %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ " * <%= pkg.author.url %>\n" +
+ " *\n" +
+ ' * Copyright (c) <%= grunt.template.today("yyyy") %>;\n' +
+ " * Licensed GPLv2+\n" +
+ " */\n";
+
+ var compactBannerTemplate =
+ "/** " +
+ '<%= pkg.title %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> | <%= pkg.author.url %> | Copyright (c) <%= grunt.template.today("yyyy") %>; | Licensed GPLv2+' +
+ " **/\n";
+
+ // Project configuration
+ grunt.initConfig({
+ pkg: pkg,
+ watch: {
+ styles: {
+ files: ["assets/**/*.css", "assets/**/*.scss"],
+ tasks: ["styles"],
+ options: {
+ spawn: false,
+ livereload: true,
+ debounceDelay: 500,
},
-
- wp_deploy: {
- dist: {
- options: {
- plugin_slug: '<%= pkg.name %>',
- svn_user: "croixhaug",
- build_dir: 'release/svn/',
- assets_dir: 'assets/repo/'
- }
- }
+ },
+ scripts: {
+ files: ["assets/**/*.js"],
+ tasks: ["scripts"],
+ options: {
+ spawn: false,
+ livereload: true,
+ debounceDelay: 500,
},
+ },
+ php: {
+ files: ["**/*.php", "!vendor/**.*.php"],
+ tasks: ["php"],
+ options: {
+ spawn: false,
+ debounceDelay: 500,
+ },
+ },
+ },
+
+ makepot: {
+ dist: {
+ options: {
+ domainPath: "/languages/",
+ potFilename: pkg.name + ".pot",
+ type: "wp-plugin",
+ },
+ },
+ },
- clean: {
- release: [
- 'release/<%= pkg.version %>/',
- 'release/svn/'
- ]
- }
-
- } );
-
- grunt.registerTask( 'scripts', [] );
- grunt.registerTask( 'styles', [] );
- grunt.registerTask( 'php', [ 'addtextdomain', 'makepot' ] );
- grunt.registerTask( 'default', ['styles', 'scripts', 'php'] );
-
- grunt.registerTask( 'version', [ 'default', 'replace:version_php', 'replace:version_readme' ] );
- grunt.registerTask( 'release', [ 'clean:release', 'replace:readme_txt', 'copy', 'compress' ] );
- grunt.registerTask( 'wporg', [ 'clean:release', 'replace:readme_txt', 'copy' ] );
- grunt.registerTask( 'increment-version', [ 'replace:version_php', 'replace:version_readme' ] );
-
- grunt.util.linefeed = '\n';
+ addtextdomain: {
+ dist: {
+ options: {
+ textdomain: pkg.name,
+ },
+ target: {
+ files: {
+ src: ["**/*.php"],
+ },
+ },
+ },
+ },
+
+ replace: {
+ version_php: {
+ src: ["**/*.php", "!public/includes/lib/**"],
+ overwrite: true,
+ replacements: [
+ {
+ from: /Version:(\s*?)[a-zA-Z0-9\.\-\+]+$/m,
+ to: "Version:$1" + pkg.version,
+ },
+ {
+ from: /@version(\s*?)[a-zA-Z0-9\.\-\+]+$/m,
+ to: "@version$1" + pkg.version,
+ },
+ {
+ from: /@since(.*?)NEXT/gm,
+ to: "@since$1" + pkg.version,
+ },
+ {
+ from: /VERSION(\s*?)=(\s*?['"])[a-zA-Z0-9\.\-\+]+/gm,
+ to: "VERSION$1=$2" + pkg.version,
+ },
+ ],
+ },
+ version_readme: {
+ src: "readme.txt",
+ overwrite: true,
+ replacements: [
+ {
+ from: /^Stable tag:(\s*?)[a-zA-Z0-9.-]+(\s*?)$/im,
+ to: "Stable tag:$1<%= pkg.version %>$2",
+ },
+ ],
+ },
+ readme_txt: {
+ src: "readme.txt",
+ dest: "release/" + pkg.version + "/readme.txt",
+ replacements: [
+ {
+ from: /^# (.*?)( #+)?$/gm,
+ to: "=== $1 ===",
+ },
+ {
+ from: /^## (.*?)( ##+)?$/gm,
+ to: "== $1 ==",
+ },
+ {
+ from: /^### (.*?)( ###+)?$/gm,
+ to: "= $1 =",
+ },
+ {
+ from: /^\*\*(.*?):\*\*/gm,
+ to: "$1:",
+ },
+ ],
+ },
+ },
+
+ copy: {
+ release: {
+ src: [
+ "**",
+ "!.git",
+ "!.github",
+ "!external",
+ "!.gitignore",
+ "!CHANGELOG.md",
+ "!CODEOWNERS",
+ "!Gruntfile.js",
+ "!package.json",
+ "!package-lock.json",
+
+ "!assets/repo/**",
+
+ "!**/*.scss",
+ "!**/node_modules/**",
+ "!release/**",
+ ],
+ dest: "release/" + pkg.version + "/",
+ },
+ svn: {
+ cwd: "release/<%= pkg.version %>/",
+ expand: true,
+ src: "**",
+ dest: "release/svn/",
+ },
+ },
+
+ compress: {
+ dist: {
+ options: {
+ mode: "zip",
+ archive: "./release/<%= pkg.name %>.<%= pkg.version %>.zip",
+ },
+ expand: true,
+ cwd: "release/<%= pkg.version %>",
+ src: ["**/*"],
+ dest: "<%= pkg.name %>",
+ },
+ },
+
+ wp_deploy: {
+ dist: {
+ options: {
+ plugin_slug: "<%= pkg.name %>",
+ svn_user: "croixhaug",
+ build_dir: "release/svn/",
+ assets_dir: "assets/repo/",
+ },
+ },
+ },
+
+ clean: {
+ release: ["release/<%= pkg.version %>/", "release/svn/"],
+ },
+ });
+
+ grunt.registerTask("scripts", []);
+ grunt.registerTask("styles", []);
+ grunt.registerTask("php", ["addtextdomain", "makepot"]);
+ grunt.registerTask("default", ["styles", "scripts", "php"]);
+
+ grunt.registerTask("version", [
+ "default",
+ "replace:version_php",
+ "replace:version_readme",
+ ]);
+ grunt.registerTask("release", [
+ "clean:release",
+ "replace:readme_txt",
+ "copy",
+ "compress",
+ ]);
+ grunt.registerTask("wporg", ["clean:release", "replace:readme_txt", "copy"]);
+ grunt.registerTask("increment-version", [
+ "replace:version_php",
+ "replace:version_readme",
+ ]);
+
+ grunt.util.linefeed = "\n";
};
diff --git a/admin/assets/js/draw-attention-block.js b/admin/assets/js/draw-attention-block.js
index cd580f6e..15a375c0 100644
--- a/admin/assets/js/draw-attention-block.js
+++ b/admin/assets/js/draw-attention-block.js
@@ -1,31 +1,30 @@
-(function(blocks, element, serverSideRender, blockEditor )
- {
- var el = element.createElement,
- registerBlockType = blocks.registerBlockType,
- ServerSideRender = serverSideRender,
- useBlockProps = blockEditor.useBlockProps;
+(function (blocks, element, serverSideRender, blockEditor) {
+ var el = element.createElement,
+ registerBlockType = blocks.registerBlockType,
+ ServerSideRender = serverSideRender,
+ useBlockProps = blockEditor.useBlockProps;
- registerBlockType( 'draw-attention/image', {
- apiVersion: 2,
- title: 'Draw Attention Image',
- icon: 'images-alt2',
- category: 'widgets',
+ registerBlockType("draw-attention/image", {
+ apiVersion: 2,
+ title: "Draw Attention Image",
+ icon: "images-alt2",
+ category: "widgets",
- edit: function(props) {
- var blockProps = useBlockProps();
- return el(
- 'div',
- blockProps,
- el(ServerSideRender, {
- block: 'draw-attention/image',
- attributes: props.attributes,
- })
- );
- },
- } );
+ edit: function (props) {
+ var blockProps = useBlockProps();
+ return el(
+ "div",
+ blockProps,
+ el(ServerSideRender, {
+ block: "draw-attention/image",
+ attributes: props.attributes,
+ }),
+ );
+ },
+ });
})(
- window.wp.blocks,
- window.wp.element,
- window.wp.serverSideRender,
- window.wp.blockEditor
-);
\ No newline at end of file
+ window.wp.blocks,
+ window.wp.element,
+ window.wp.serverSideRender,
+ window.wp.blockEditor,
+);
diff --git a/admin/assets/js/leaflet.draw.js b/admin/assets/js/leaflet.draw.js
index 2fe040b0..e56a5b2c 100644
--- a/admin/assets/js/leaflet.draw.js
+++ b/admin/assets/js/leaflet.draw.js
@@ -5,6 +5,2941 @@
https://github.com/Leaflet/Leaflet.draw
http://leafletjs.com
*/
-!function(t,e,i){function o(t,e){for(;(t=t.parentElement)&&!t.classList.contains(e););return t}L.drawVersion="0.4.14",L.Draw={},L.drawLocal={draw:{toolbar:{actions:{title:"Cancel drawing",text:"Cancel"},finish:{title:"Finish drawing",text:"Finish"},undo:{title:"Delete last point drawn",text:"Delete last point"},buttons:{polyline:"Draw a polyline",polygon:"Draw a polygon",rectangle:"Draw a rectangle",circle:"Draw a circle",marker:"Draw a marker",circlemarker:"Draw a circlemarker"}},handlers:{circle:{tooltip:{start:"Click and drag to draw circle."},radius:"Radius"},circlemarker:{tooltip:{start:"Click map to place circle marker."}},marker:{tooltip:{start:"Click map to place marker."}},polygon:{tooltip:{start:"Click to start drawing shape.",cont:"Click to continue drawing shape.",end:"Click first point to close this shape."}},polyline:{error:"Error: shape edges cannot cross!",tooltip:{start:"Click to start drawing line.",cont:"Click to continue drawing line.",end:"Click last point to finish line."}},rectangle:{tooltip:{start:"Click and drag to draw rectangle."}},simpleshape:{tooltip:{end:"Release mouse to finish drawing."}}}},edit:{toolbar:{actions:{save:{title:"Save changes",text:"Save"},cancel:{title:"Cancel editing, discards all changes",text:"Cancel"},clearAll:{title:"Clear all layers",text:"Clear All"}},buttons:{edit:"Edit layers",editDisabled:"No layers to edit",remove:"Delete layers",removeDisabled:"No layers to delete"}},handlers:{edit:{tooltip:{text:"Drag handles or markers to edit features.",subtext:"Click cancel to undo changes."}},remove:{tooltip:{text:"Click on a feature to remove."}}}}},L.Draw.Event={},L.Draw.Event.CREATED="draw:created",L.Draw.Event.EDITED="draw:edited",L.Draw.Event.DELETED="draw:deleted",L.Draw.Event.DRAWSTART="draw:drawstart",L.Draw.Event.DRAWSTOP="draw:drawstop",L.Draw.Event.DRAWVERTEX="draw:drawvertex",L.Draw.Event.EDITSTART="draw:editstart",L.Draw.Event.EDITMOVE="draw:editmove",L.Draw.Event.EDITRESIZE="draw:editresize",L.Draw.Event.EDITVERTEX="draw:editvertex",L.Draw.Event.EDITSTOP="draw:editstop",L.Draw.Event.DELETESTART="draw:deletestart",L.Draw.Event.DELETESTOP="draw:deletestop",L.Draw.Event.TOOLBAROPENED="draw:toolbaropened",L.Draw.Event.TOOLBARCLOSED="draw:toolbarclosed",L.Draw.Event.MARKERCONTEXT="draw:markercontext",L.Draw=L.Draw||{},L.Draw.Feature=L.Handler.extend({initialize:function(t,e){this._map=t,this._container=t._container,this._overlayPane=t._panes.overlayPane,this._popupPane=t._panes.popupPane,e&&e.shapeOptions&&(e.shapeOptions=L.Util.extend({},this.options.shapeOptions,e.shapeOptions)),L.setOptions(this,e);var i=L.version.split(".");1===parseInt(i[0],10)&&parseInt(i[1],10)>=2?L.Draw.Feature.include(L.Evented.prototype):L.Draw.Feature.include(L.Mixin.Events)},enable:function(){this._enabled||(L.Handler.prototype.enable.call(this),this.fire("enabled",{handler:this.type}),this._map.fire(L.Draw.Event.DRAWSTART,{layerType:this.type}))},disable:function(){this._enabled&&(L.Handler.prototype.disable.call(this),this._map.fire(L.Draw.Event.DRAWSTOP,{layerType:this.type}),this.fire("disabled",{handler:this.type}))},addHooks:function(){var t=this._map;t&&(L.DomUtil.disableTextSelection(),t.getContainer().focus(),this._tooltip=new L.Draw.Tooltip(this._map),L.DomEvent.on(this._container,"keyup",this._cancelDrawing,this))},removeHooks:function(){this._map&&(L.DomUtil.enableTextSelection(),this._tooltip.dispose(),this._tooltip=null,L.DomEvent.off(this._container,"keyup",this._cancelDrawing,this))},setOptions:function(t){L.setOptions(this,t)},_fireCreatedEvent:function(t){this._map.fire(L.Draw.Event.CREATED,{layer:t,layerType:this.type})},_cancelDrawing:function(t){27===t.keyCode&&(this._map.fire("draw:canceled",{layerType:this.type}),this.disable())}}),L.Draw.Polyline=L.Draw.Feature.extend({statics:{TYPE:"polyline"},Poly:L.Polyline,options:{allowIntersection:!0,repeatMode:!1,drawError:{color:"#b00b00",timeout:2500},icon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon"}),touchIcon:new L.DivIcon({iconSize:new L.Point(20,20),className:"leaflet-div-icon leaflet-editing-icon leaflet-touch-icon"}),guidelineDistance:20,maxGuideLineLength:4e3,shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!1,clickable:!0},metric:!0,feet:!0,nautic:!1,showLength:!0,zIndexOffset:2e3,factor:1,maxPoints:0},initialize:function(t,e){L.Browser.touch&&(this.options.icon=this.options.touchIcon),this.options.drawError.message=L.drawLocal.draw.handlers.polyline.error,e&&e.drawError&&(e.drawError=L.Util.extend({},this.options.drawError,e.drawError)),this.type=L.Draw.Polyline.TYPE,L.Draw.Feature.prototype.initialize.call(this,t,e)},addHooks:function(){L.Draw.Feature.prototype.addHooks.call(this),this._map&&(this._markers=[],this._markerGroup=new L.LayerGroup,this._map.addLayer(this._markerGroup),this._poly=new L.Polyline([],this.options.shapeOptions),this._tooltip.updateContent(this._getTooltipText()),this._mouseMarker||(this._mouseMarker=L.marker(this._map.getCenter(),{icon:L.divIcon({className:"leaflet-mouse-marker",iconAnchor:[20,20],iconSize:[40,40]}),opacity:0,zIndexOffset:this.options.zIndexOffset})),this._mouseMarker.on("mouseout",this._onMouseOut,this).on("mousemove",this._onMouseMove,this).on("mousedown",this._onMouseDown,this).on("mouseup",this._onMouseUp,this).addTo(this._map),this._map.on("mouseup",this._onMouseUp,this).on("mousemove",this._onMouseMove,this).on("zoomlevelschange",this._onZoomEnd,this).on("touchstart",this._onTouch,this).on("zoomend",this._onZoomEnd,this))},removeHooks:function(){L.Draw.Feature.prototype.removeHooks.call(this),this._clearHideErrorTimeout(),this._cleanUpShape(),this._map.removeLayer(this._markerGroup),delete this._markerGroup,delete this._markers,this._map.removeLayer(this._poly),delete this._poly,this._mouseMarker.off("mousedown",this._onMouseDown,this).off("mouseout",this._onMouseOut,this).off("mouseup",this._onMouseUp,this).off("mousemove",this._onMouseMove,this),this._map.removeLayer(this._mouseMarker),delete this._mouseMarker,this._clearGuides(),this._map.off("mouseup",this._onMouseUp,this).off("mousemove",this._onMouseMove,this).off("zoomlevelschange",this._onZoomEnd,this).off("zoomend",this._onZoomEnd,this).off("touchstart",this._onTouch,this).off("click",this._onTouch,this)},deleteLastVertex:function(){if(!(this._markers.length<=1)){var t=this._markers.pop(),e=this._poly,i=e.getLatLngs(),o=i.splice(-1,1)[0];this._poly.setLatLngs(i),this._markerGroup.removeLayer(t),e.getLatLngs().length<2&&this._map.removeLayer(e),this._vertexChanged(o,!1)}},addVertex:function(t){if(this._markers.length>=2&&!this.options.allowIntersection&&this._poly.newLatLngIntersects(t))return void this._showErrorTooltip();this._errorShown&&this._hideErrorTooltip(),this._markers.push(this._createMarker(t)),this._poly.addLatLng(t),2===this._poly.getLatLngs().length&&this._map.addLayer(this._poly),this._vertexChanged(t,!0)},completeShape:function(){this._markers.length<=1||(this._fireCreatedEvent(),this.disable(),this.options.repeatMode&&this.enable())},_finishShape:function(){var t=this._poly._defaultShape?this._poly._defaultShape():this._poly.getLatLngs(),e=this._poly.newLatLngIntersects(t[t.length-1]);if(!this.options.allowIntersection&&e||!this._shapeIsValid())return void this._showErrorTooltip();this._fireCreatedEvent(),this.disable(),this.options.repeatMode&&this.enable()},_shapeIsValid:function(){return!0},_onZoomEnd:function(){null!==this._markers&&this._updateGuide()},_onMouseMove:function(t){var e=this._map.mouseEventToLayerPoint(t.originalEvent),i=this._map.layerPointToLatLng(e);this._currentLatLng=i,this._updateTooltip(i),this._updateGuide(e),this._mouseMarker.setLatLng(i),L.DomEvent.preventDefault(t.originalEvent)},_vertexChanged:function(t,e){this._map.fire(L.Draw.Event.DRAWVERTEX,{layers:this._markerGroup}),this._updateFinishHandler(),this._updateRunningMeasure(t,e),this._clearGuides(),this._updateTooltip()},_onMouseDown:function(t){if(!this._clickHandled&&!this._touchHandled&&!this._disableMarkers){this._onMouseMove(t),this._clickHandled=!0,this._disableNewMarkers();var e=t.originalEvent,i=e.clientX,o=e.clientY;this._startPoint.call(this,i,o)}},_startPoint:function(t,e){this._mouseDownOrigin=L.point(t,e)},_onMouseUp:function(t){var e=t.originalEvent,i=e.clientX,o=e.clientY;this._endPoint.call(this,i,o,t),this._clickHandled=null},_endPoint:function(e,i,o){if(this._mouseDownOrigin){var n=L.point(e,i).distanceTo(this._mouseDownOrigin),a=this._calculateFinishDistance(o.latlng);this.options.maxPoints>1&&this.options.maxPoints==this._markers.length+1?(this.addVertex(o.latlng),this._finishShape()):a<10&&L.Browser.touch?this._finishShape():Math.abs(n)<9*(t.devicePixelRatio||1)&&this.addVertex(o.latlng),this._enableNewMarkers()}this._mouseDownOrigin=null},_onTouch:function(t){var e,i,o=t.originalEvent;!o.touches||!o.touches[0]||this._clickHandled||this._touchHandled||this._disableMarkers||(e=o.touches[0].clientX,i=o.touches[0].clientY,this._disableNewMarkers(),this._touchHandled=!0,this._startPoint.call(this,e,i),this._endPoint.call(this,e,i,t),this._touchHandled=null),this._clickHandled=null},_onMouseOut:function(){this._tooltip&&this._tooltip._onMouseOut.call(this._tooltip)},_calculateFinishDistance:function(t){var e;if(this._markers.length>0){var i;if(this.type===L.Draw.Polyline.TYPE)i=this._markers[this._markers.length-1];else{if(this.type!==L.Draw.Polygon.TYPE)return 1/0;i=this._markers[0]}var o=this._map.latLngToContainerPoint(i.getLatLng()),n=new L.Marker(t,{icon:this.options.icon,zIndexOffset:2*this.options.zIndexOffset}),a=this._map.latLngToContainerPoint(n.getLatLng());e=o.distanceTo(a)}else e=1/0;return e},_updateFinishHandler:function(){var t=this._markers.length;t>1&&this._markers[t-1].on("click",this._finishShape,this),t>2&&this._markers[t-2].off("click",this._finishShape,this)},_createMarker:function(t){var e=new L.Marker(t,{icon:this.options.icon,zIndexOffset:2*this.options.zIndexOffset});return this._markerGroup.addLayer(e),e},_updateGuide:function(t){var e=this._markers?this._markers.length:0;e>0&&(t=t||this._map.latLngToLayerPoint(this._currentLatLng),this._clearGuides(),this._drawGuide(this._map.latLngToLayerPoint(this._markers[e-1].getLatLng()),t))},_updateTooltip:function(t){var e=this._getTooltipText();t&&this._tooltip.updatePosition(t),this._errorShown||this._tooltip.updateContent(e)},_drawGuide:function(t,e){var i,o,n,a=Math.floor(Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))),s=this.options.guidelineDistance,r=this.options.maxGuideLineLength,l=a>r?a-r:s;for(this._guidesContainer||(this._guidesContainer=L.DomUtil.create("div","leaflet-draw-guides",this._overlayPane));l1&&this._markers[this._markers.length-1].off("click",this._finishShape,this)},_fireCreatedEvent:function(){var t=new this.Poly(this._poly.getLatLngs(),this.options.shapeOptions);L.Draw.Feature.prototype._fireCreatedEvent.call(this,t)}}),L.Draw.Polygon=L.Draw.Polyline.extend({statics:{TYPE:"polygon"},Poly:L.Polygon,options:{showArea:!1,showLength:!1,shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0},metric:!0,feet:!0,nautic:!1,precision:{}},initialize:function(t,e){L.Draw.Polyline.prototype.initialize.call(this,t,e),this.type=L.Draw.Polygon.TYPE},_updateFinishHandler:function(){var t=this._markers.length;1===t&&this._markers[0].on("click",this._finishShape,this),t>2&&(this._markers[t-1].on("dblclick",this._finishShape,this),t>3&&this._markers[t-2].off("dblclick",this._finishShape,this))},_getTooltipText:function(){var t,e;return 0===this._markers.length?t=L.drawLocal.draw.handlers.polygon.tooltip.start:this._markers.length<3?(t=L.drawLocal.draw.handlers.polygon.tooltip.cont,e=this._getMeasurementString()):(t=L.drawLocal.draw.handlers.polygon.tooltip.end,e=this._getMeasurementString()),{text:t,subtext:e}},_getMeasurementString:function(){var t=this._area,e="";return t||this.options.showLength?(this.options.showLength&&(e=L.Draw.Polyline.prototype._getMeasurementString.call(this)),t&&(e+=" ' + shapeAddress + ' " + shapeAddress + "
"+L.GeometryUtil.readableArea(t,this.options.metric,this.options.precision)),e):null},_shapeIsValid:function(){return this._markers.length>=3},_vertexChanged:function(t,e){var i;!this.options.allowIntersection&&this.options.showArea&&(i=this._poly.getLatLngs(),this._area=L.GeometryUtil.geodesicArea(i)),L.Draw.Polyline.prototype._vertexChanged.call(this,t,e)},_cleanUpShape:function(){var t=this._markers.length;t>0&&(this._markers[0].off("click",this._finishShape,this),t>2&&this._markers[t-1].off("dblclick",this._finishShape,this))}}),L.SimpleShape={},L.Draw.SimpleShape=L.Draw.Feature.extend({options:{repeatMode:!1},initialize:function(t,e){this._endLabelText=L.drawLocal.draw.handlers.simpleshape.tooltip.end,L.Draw.Feature.prototype.initialize.call(this,t,e)},addHooks:function(){L.Draw.Feature.prototype.addHooks.call(this),this._map&&(this._mapDraggable=this._map.dragging.enabled(),this._mapDraggable&&this._map.dragging.disable(),this._container.style.cursor="crosshair",this._tooltip.updateContent({text:this._initialLabelText}),this._map.on("mousedown",this._onMouseDown,this).on("mousemove",this._onMouseMove,this).on("touchstart",this._onMouseDown,this).on("touchmove",this._onMouseMove,this),e.addEventListener("touchstart",L.DomEvent.preventDefault,{passive:!1}))},removeHooks:function(){L.Draw.Feature.prototype.removeHooks.call(this),this._map&&(this._mapDraggable&&this._map.dragging.enable(),this._container.style.cursor="",this._map.off("mousedown",this._onMouseDown,this).off("mousemove",this._onMouseMove,this).off("touchstart",this._onMouseDown,this).off("touchmove",this._onMouseMove,this),L.DomEvent.off(e,"mouseup",this._onMouseUp,this),L.DomEvent.off(e,"touchend",this._onMouseUp,this),e.removeEventListener("touchstart",L.DomEvent.preventDefault),this._shape&&(this._map.removeLayer(this._shape),delete this._shape)),this._isDrawing=!1},_getTooltipText:function(){return{text:this._endLabelText}},_onMouseDown:function(t){this._isDrawing=!0,this._startLatLng=t.latlng,L.DomEvent.on(e,"mouseup",this._onMouseUp,this).on(e,"touchend",this._onMouseUp,this).preventDefault(t.originalEvent)},_onMouseMove:function(t){var e=t.latlng;this._tooltip.updatePosition(e),this._isDrawing&&(this._tooltip.updateContent(this._getTooltipText()),this._drawShape(e))},_onMouseUp:function(){this._shape&&this._fireCreatedEvent(),this.disable(),this.options.repeatMode&&this.enable()}}),L.Draw.Rectangle=L.Draw.SimpleShape.extend({statics:{TYPE:"rectangle"},options:{shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,showArea:!0,clickable:!0},metric:!0},initialize:function(t,e){this.type=L.Draw.Rectangle.TYPE,this._initialLabelText=L.drawLocal.draw.handlers.rectangle.tooltip.start,L.Draw.SimpleShape.prototype.initialize.call(this,t,e)},disable:function(){this._enabled&&(this._isCurrentlyTwoClickDrawing=!1,L.Draw.SimpleShape.prototype.disable.call(this))},_onMouseUp:function(t){if(!this._shape&&!this._isCurrentlyTwoClickDrawing)return void(this._isCurrentlyTwoClickDrawing=!0);this._isCurrentlyTwoClickDrawing&&!o(t.target,"leaflet-pane")||L.Draw.SimpleShape.prototype._onMouseUp.call(this)},_drawShape:function(t){this._shape?this._shape.setBounds(new L.LatLngBounds(this._startLatLng,t)):(this._shape=new L.Rectangle(new L.LatLngBounds(this._startLatLng,t),this.options.shapeOptions),this._map.addLayer(this._shape))},_fireCreatedEvent:function(){var t=new L.Rectangle(this._shape.getBounds(),this.options.shapeOptions);L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this,t)},_getTooltipText:function(){var t,e,i,o=L.Draw.SimpleShape.prototype._getTooltipText.call(this),n=this._shape,a=this.options.showArea;return n&&(t=this._shape._defaultShape?this._shape._defaultShape():this._shape.getLatLngs(),e=L.GeometryUtil.geodesicArea(t),i=a?L.GeometryUtil.readableArea(e,this.options.metric):""),{text:o.text,subtext:i}}}),L.Draw.Marker=L.Draw.Feature.extend({statics:{TYPE:"marker"},options:{icon:new L.Icon.Default,repeatMode:!1,zIndexOffset:2e3},initialize:function(t,e){this.type=L.Draw.Marker.TYPE,this._initialLabelText=L.drawLocal.draw.handlers.marker.tooltip.start,L.Draw.Feature.prototype.initialize.call(this,t,e)},addHooks:function(){L.Draw.Feature.prototype.addHooks.call(this),this._map&&(this._tooltip.updateContent({text:this._initialLabelText}),this._mouseMarker||(this._mouseMarker=L.marker(this._map.getCenter(),{icon:L.divIcon({className:"leaflet-mouse-marker",iconAnchor:[20,20],iconSize:[40,40]}),opacity:0,zIndexOffset:this.options.zIndexOffset})),this._mouseMarker.on("click",this._onClick,this).addTo(this._map),this._map.on("mousemove",this._onMouseMove,this),this._map.on("click",this._onTouch,this))},removeHooks:function(){L.Draw.Feature.prototype.removeHooks.call(this),this._map&&(this._map.off("click",this._onClick,this).off("click",this._onTouch,this),this._marker&&(this._marker.off("click",this._onClick,this),this._map.removeLayer(this._marker),delete this._marker),this._mouseMarker.off("click",this._onClick,this),this._map.removeLayer(this._mouseMarker),delete this._mouseMarker,this._map.off("mousemove",this._onMouseMove,this))},_onMouseMove:function(t){var e=t.latlng;this._tooltip.updatePosition(e),this._mouseMarker.setLatLng(e),this._marker?(e=this._mouseMarker.getLatLng(),this._marker.setLatLng(e)):(this._marker=this._createMarker(e),this._marker.on("click",this._onClick,this),this._map.on("click",this._onClick,this).addLayer(this._marker))},_createMarker:function(t){return new L.Marker(t,{icon:this.options.icon,zIndexOffset:this.options.zIndexOffset})},_onClick:function(){this._fireCreatedEvent(),this.disable(),this.options.repeatMode&&this.enable()},_onTouch:function(t){this._onMouseMove(t),this._onClick()},_fireCreatedEvent:function(){var t=new L.Marker.Touch(this._marker.getLatLng(),{icon:this.options.icon});L.Draw.Feature.prototype._fireCreatedEvent.call(this,t)}}),L.Draw.CircleMarker=L.Draw.Marker.extend({statics:{TYPE:"circlemarker"},options:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0,zIndexOffset:2e3},initialize:function(t,e){this.type=L.Draw.CircleMarker.TYPE,this._initialLabelText=L.drawLocal.draw.handlers.circlemarker.tooltip.start,L.Draw.Feature.prototype.initialize.call(this,t,e)},_fireCreatedEvent:function(){var t=new L.CircleMarker(this._marker.getLatLng(),this.options);L.Draw.Feature.prototype._fireCreatedEvent.call(this,t)},_createMarker:function(t){return new L.CircleMarker(t,this.options)}}),L.Draw.Circle=L.Draw.SimpleShape.extend({statics:{TYPE:"circle"},options:{shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0},showRadius:!0,metric:!0,feet:!0,nautic:!1},initialize:function(t,e){this.type=L.Draw.Circle.TYPE,this._initialLabelText=L.drawLocal.draw.handlers.circle.tooltip.start,L.Draw.SimpleShape.prototype.initialize.call(this,t,e)},_drawShape:function(t){if(L.GeometryUtil.isVersion07x())var e=this._startLatLng.distanceTo(t);else var e=this._map.distance(this._startLatLng,t);this._shape?this._shape.setRadius(e):(this._shape=new L.Circle(this._startLatLng,e,this.options.shapeOptions),this._map.addLayer(this._shape))},_fireCreatedEvent:function(){var t=new L.Circle(this._startLatLng,this._shape.getRadius(),this.options.shapeOptions);L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this,t)},_onMouseMove:function(t){var e,i=t.latlng,o=this.options.showRadius,n=this.options.metric;if(this._tooltip.updatePosition(i),this._isDrawing){this._drawShape(i),e=this._shape.getRadius().toFixed(1);var a="";o&&(a=L.drawLocal.draw.handlers.circle.radius+": "+L.GeometryUtil.readableDistance(e,n,this.options.feet,this.options.nautic)),this._tooltip.updateContent({text:this._endLabelText,subtext:a})}}}),L.Edit=L.Edit||{},L.Edit.Marker=L.Handler.extend({initialize:function(t,e){this._marker=t,L.setOptions(this,e)},addHooks:function(){var t=this._marker;t.dragging.enable(),t.on("dragend",this._onDragEnd,t),this._toggleMarkerHighlight()},removeHooks:function(){var t=this._marker;t.dragging.disable(),t.off("dragend",this._onDragEnd,t),this._toggleMarkerHighlight()},_onDragEnd:function(t){var e=t.target;e.edited=!0,this._map.fire(L.Draw.Event.EDITMOVE,{layer:e})},_toggleMarkerHighlight:function(){var t=this._marker._icon;t&&(t.style.display="none",L.DomUtil.hasClass(t,"leaflet-edit-marker-selected")?(L.DomUtil.removeClass(t,"leaflet-edit-marker-selected"),this._offsetMarker(t,-4)):(L.DomUtil.addClass(t,"leaflet-edit-marker-selected"),this._offsetMarker(t,4)),t.style.display="")},_offsetMarker:function(t,e){var i=parseInt(t.style.marginTop,10)-e,o=parseInt(t.style.marginLeft,10)-e;t.style.marginTop=i+"px",t.style.marginLeft=o+"px"}}),L.Marker.addInitHook(function(){L.Edit.Marker&&(this.editing=new L.Edit.Marker(this),this.options.editable&&this.editing.enable())}),L.Edit=L.Edit||{},L.Edit.Poly=L.Handler.extend({initialize:function(t){this.latlngs=[t._latlngs],t._holes&&(this.latlngs=this.latlngs.concat(t._holes)),this._poly=t,this._poly.on("revert-edited",this._updateLatLngs,this)},_defaultShape:function(){return L.Polyline._flat?L.Polyline._flat(this._poly._latlngs)?this._poly._latlngs:this._poly._latlngs[0]:this._poly._latlngs},_eachVertexHandler:function(t){for(var e=0;e
":"")+""+t.text+"",t.text||t.subtext?(this._visible=!0,this._container.style.visibility="inherit"):(this._visible=!1,this._container.style.visibility="hidden"),this):this},updatePosition:function(t){var e=this._map.latLngToLayerPoint(t),i=this._container;return this._container&&(this._visible&&(i.style.visibility="inherit"),L.DomUtil.setPosition(i,e)),this},showAsError:function(){return this._container&&L.DomUtil.addClass(this._container,"leaflet-error-draw-tooltip"),this},removeError:function(){return this._container&&L.DomUtil.removeClass(this._container,"leaflet-error-draw-tooltip"),this},_onMouseOut:function(){this._container&&(this._container.style.visibility="hidden")}}),L.DrawToolbar=L.Toolbar.extend({statics:{TYPE:"draw"},options:{polyline:{},polygon:{},rectangle:{},circle:{},marker:{},circlemarker:{}},initialize:function(t){for(var e in this.options)this.options.hasOwnProperty(e)&&t[e]&&(t[e]=L.extend({},this.options[e],t[e]));this._toolbarClass="leaflet-draw-draw",L.Toolbar.prototype.initialize.call(this,t)},getModeHandlers:function(t){return[{enabled:this.options.polyline,handler:new L.Draw.Polyline(t,this.options.polyline),title:L.drawLocal.draw.toolbar.buttons.polyline},{enabled:this.options.polygon,handler:new L.Draw.Polygon(t,this.options.polygon),title:L.drawLocal.draw.toolbar.buttons.polygon},{enabled:this.options.rectangle,handler:new L.Draw.Rectangle(t,this.options.rectangle),title:L.drawLocal.draw.toolbar.buttons.rectangle},{enabled:this.options.circle,handler:new L.Draw.Circle(t,this.options.circle),title:L.drawLocal.draw.toolbar.buttons.circle},{enabled:this.options.marker,handler:new L.Draw.Marker(t,this.options.marker),title:L.drawLocal.draw.toolbar.buttons.marker},{enabled:this.options.circlemarker,handler:new L.Draw.CircleMarker(t,this.options.circlemarker),title:L.drawLocal.draw.toolbar.buttons.circlemarker}]},getActions:function(t){return[{enabled:t.completeShape,title:L.drawLocal.draw.toolbar.finish.title,text:L.drawLocal.draw.toolbar.finish.text,callback:t.completeShape,context:t},{enabled:t.deleteLastVertex,title:L.drawLocal.draw.toolbar.undo.title,text:L.drawLocal.draw.toolbar.undo.text,callback:t.deleteLastVertex,context:t},{title:L.drawLocal.draw.toolbar.actions.title,text:L.drawLocal.draw.toolbar.actions.text,callback:this.disable,context:this}]},setOptions:function(t){L.setOptions(this,t);for(var e in this._modes)this._modes.hasOwnProperty(e)&&t.hasOwnProperty(e)&&this._modes[e].handler.setOptions(t[e])}}),L.EditToolbar=L.Toolbar.extend({statics:{TYPE:"edit"},options:{edit:{selectedPathOptions:{dashArray:"10, 10",fill:!0,fillColor:"#fe57a1",fillOpacity:.1,maintainColor:!1}},remove:{},poly:null,featureGroup:null},initialize:function(t){t.edit&&(void 0===t.edit.selectedPathOptions&&(t.edit.selectedPathOptions=this.options.edit.selectedPathOptions),t.edit.selectedPathOptions=L.extend({},this.options.edit.selectedPathOptions,t.edit.selectedPathOptions)),t.remove&&(t.remove=L.extend({},this.options.remove,t.remove)),t.poly&&(t.poly=L.extend({},this.options.poly,t.poly)),this._toolbarClass="leaflet-draw-edit",L.Toolbar.prototype.initialize.call(this,t),this._selectedFeatureCount=0},getModeHandlers:function(t){var e=this.options.featureGroup;return[{enabled:this.options.edit,handler:new L.EditToolbar.Edit(t,{featureGroup:e,selectedPathOptions:this.options.edit.selectedPathOptions,poly:this.options.poly}),title:L.drawLocal.edit.toolbar.buttons.edit},{enabled:this.options.remove,handler:new L.EditToolbar.Delete(t,{featureGroup:e}),title:L.drawLocal.edit.toolbar.buttons.remove}]},getActions:function(t){var e=[{title:L.drawLocal.edit.toolbar.actions.save.title,text:L.drawLocal.edit.toolbar.actions.save.text,callback:this._save,context:this},{title:L.drawLocal.edit.toolbar.actions.cancel.title,text:L.drawLocal.edit.toolbar.actions.cancel.text,callback:this.disable,context:this}];return t.removeAllLayers&&e.push({title:L.drawLocal.edit.toolbar.actions.clearAll.title,text:L.drawLocal.edit.toolbar.actions.clearAll.text,callback:this._clearAllLayers,context:this}),e},addToolbar:function(t){var e=L.Toolbar.prototype.addToolbar.call(this,t);return this._checkDisabled(),this.options.featureGroup.on("layeradd layerremove",this._checkDisabled,this),e},removeToolbar:function(){this.options.featureGroup.off("layeradd layerremove",this._checkDisabled,this),L.Toolbar.prototype.removeToolbar.call(this)},disable:function(){this.enabled()&&(this._activeMode.handler.revertLayers(),L.Toolbar.prototype.disable.call(this))},_save:function(){this._activeMode.handler.save(),this._activeMode&&this._activeMode.handler.disable()},_clearAllLayers:function(){this._activeMode.handler.removeAllLayers(),this._activeMode&&this._activeMode.handler.disable()},_checkDisabled:function(){var t,e=this.options.featureGroup,i=0!==e.getLayers().length;this.options.edit&&(t=this._modes[L.EditToolbar.Edit.TYPE].button,i?L.DomUtil.removeClass(t,"leaflet-disabled"):L.DomUtil.addClass(t,"leaflet-disabled"),t.setAttribute("title",i?L.drawLocal.edit.toolbar.buttons.edit:L.drawLocal.edit.toolbar.buttons.editDisabled)),this.options.remove&&(t=this._modes[L.EditToolbar.Delete.TYPE].button,i?L.DomUtil.removeClass(t,"leaflet-disabled"):L.DomUtil.addClass(t,"leaflet-disabled"),t.setAttribute("title",i?L.drawLocal.edit.toolbar.buttons.remove:L.drawLocal.edit.toolbar.buttons.removeDisabled))}}),L.EditToolbar.Edit=L.Handler.extend({statics:{TYPE:"edit"},initialize:function(t,e){if(L.Handler.prototype.initialize.call(this,t),L.setOptions(this,e),this._featureGroup=e.featureGroup,!(this._featureGroup instanceof L.FeatureGroup))throw new Error("options.featureGroup must be a L.FeatureGroup");this._uneditedLayerProps={},this.type=L.EditToolbar.Edit.TYPE;var i=L.version.split(".");1===parseInt(i[0],10)&&parseInt(i[1],10)>=2?L.EditToolbar.Edit.include(L.Evented.prototype):L.EditToolbar.Edit.include(L.Mixin.Events)},enable:function(){!this._enabled&&this._hasAvailableLayers()&&(this.fire("enabled",{handler:this.type}),this._map.fire(L.Draw.Event.EDITSTART,{handler:this.type}),L.Handler.prototype.enable.call(this),this._featureGroup.on("layeradd",this._enableLayerEdit,this).on("layerremove",this._disableLayerEdit,this))},disable:function(){this._enabled&&(this._featureGroup.off("layeradd",this._enableLayerEdit,this).off("layerremove",this._disableLayerEdit,this),L.Handler.prototype.disable.call(this),this._map.fire(L.Draw.Event.EDITSTOP,{handler:this.type}),this.fire("disabled",{handler:this.type}))},addHooks:function(){var t=this._map;t&&(t.getContainer().focus(),this._featureGroup.eachLayer(this._enableLayerEdit,this),this._tooltip=new L.Draw.Tooltip(this._map),this._tooltip.updateContent({text:L.drawLocal.edit.handlers.edit.tooltip.text,subtext:L.drawLocal.edit.handlers.edit.tooltip.subtext}),t._editTooltip=this._tooltip,this._updateTooltip(),this._map.on("mousemove",this._onMouseMove,this).on("touchmove",this._onMouseMove,this).on("MSPointerMove",this._onMouseMove,this).on(L.Draw.Event.EDITVERTEX,this._updateTooltip,this))},removeHooks:function(){this._map&&(this._featureGroup.eachLayer(this._disableLayerEdit,this),this._uneditedLayerProps={},this._tooltip.dispose(),this._tooltip=null,this._map.off("mousemove",this._onMouseMove,this).off("touchmove",this._onMouseMove,this).off("MSPointerMove",this._onMouseMove,this).off(L.Draw.Event.EDITVERTEX,this._updateTooltip,this))},revertLayers:function(){this._featureGroup.eachLayer(function(t){this._revertLayer(t)},this)},save:function(){var t=new L.LayerGroup;this._featureGroup.eachLayer(function(e){e.edited&&(t.addLayer(e),e.edited=!1)}),this._map.fire(L.Draw.Event.EDITED,{layers:t})},_backupLayer:function(t){var e=L.Util.stamp(t);this._uneditedLayerProps[e]||(t instanceof L.Polyline||t instanceof L.Polygon||t instanceof L.Rectangle?this._uneditedLayerProps[e]={latlngs:L.LatLngUtil.cloneLatLngs(t.getLatLngs())}:t instanceof L.Circle?this._uneditedLayerProps[e]={latlng:L.LatLngUtil.cloneLatLng(t.getLatLng()),radius:t.getRadius()}:(t instanceof L.Marker||t instanceof L.CircleMarker)&&(this._uneditedLayerProps[e]={latlng:L.LatLngUtil.cloneLatLng(t.getLatLng())}))},_getTooltipText:function(){return{text:L.drawLocal.edit.handlers.edit.tooltip.text,subtext:L.drawLocal.edit.handlers.edit.tooltip.subtext}},_updateTooltip:function(){this._tooltip.updateContent(this._getTooltipText())},_revertLayer:function(t){var e=L.Util.stamp(t);t.edited=!1,this._uneditedLayerProps.hasOwnProperty(e)&&(t instanceof L.Polyline||t instanceof L.Polygon||t instanceof L.Rectangle?t.setLatLngs(this._uneditedLayerProps[e].latlngs):t instanceof L.Circle?(t.setLatLng(this._uneditedLayerProps[e].latlng),t.setRadius(this._uneditedLayerProps[e].radius)):(t instanceof L.Marker||t instanceof L.CircleMarker)&&t.setLatLng(this._uneditedLayerProps[e].latlng),t.fire("revert-edited",{layer:t}))},_enableLayerEdit:function(t){var e,i,o=t.layer||t.target||t;this._backupLayer(o),this.options.poly&&(i=L.Util.extend({},this.options.poly),o.options.poly=i),this.options.selectedPathOptions&&(e=L.Util.extend({},this.options.selectedPathOptions),e.maintainColor&&(e.color=o.options.color,e.fillColor=o.options.fillColor),o.options.original=L.extend({},o.options),o.options.editing=e),o instanceof L.Marker?(o.editing&&o.editing.enable(),o.dragging.enable(),o.on("dragend",this._onMarkerDragEnd).on("touchmove",this._onTouchMove,this).on("MSPointerMove",this._onTouchMove,this).on("touchend",this._onMarkerDragEnd,this).on("MSPointerUp",this._onMarkerDragEnd,this)):o.editing.enable()},_disableLayerEdit:function(t){var e=t.layer||t.target||t;e.edited=!1,e.editing&&e.editing.disable(),delete e.options.editing,delete e.options.original,
-this._selectedPathOptions&&(e instanceof L.Marker?this._toggleMarkerHighlight(e):(e.setStyle(e.options.previousOptions),delete e.options.previousOptions)),e instanceof L.Marker?(e.dragging.disable(),e.off("dragend",this._onMarkerDragEnd,this).off("touchmove",this._onTouchMove,this).off("MSPointerMove",this._onTouchMove,this).off("touchend",this._onMarkerDragEnd,this).off("MSPointerUp",this._onMarkerDragEnd,this)):e.editing.disable()},_onMouseMove:function(t){this._tooltip.updatePosition(t.latlng)},_onMarkerDragEnd:function(t){var e=t.target;e.edited=!0,this._map.fire(L.Draw.Event.EDITMOVE,{layer:e})},_onTouchMove:function(t){var e=t.originalEvent.changedTouches[0],i=this._map.mouseEventToLayerPoint(e),o=this._map.layerPointToLatLng(i);t.target.setLatLng(o)},_hasAvailableLayers:function(){return 0!==this._featureGroup.getLayers().length}}),L.EditToolbar.Delete=L.Handler.extend({statics:{TYPE:"remove"},initialize:function(t,e){if(L.Handler.prototype.initialize.call(this,t),L.Util.setOptions(this,e),this._deletableLayers=this.options.featureGroup,!(this._deletableLayers instanceof L.FeatureGroup))throw new Error("options.featureGroup must be a L.FeatureGroup");this.type=L.EditToolbar.Delete.TYPE;var i=L.version.split(".");1===parseInt(i[0],10)&&parseInt(i[1],10)>=2?L.EditToolbar.Delete.include(L.Evented.prototype):L.EditToolbar.Delete.include(L.Mixin.Events)},enable:function(){!this._enabled&&this._hasAvailableLayers()&&(this.fire("enabled",{handler:this.type}),this._map.fire(L.Draw.Event.DELETESTART,{handler:this.type}),L.Handler.prototype.enable.call(this),this._deletableLayers.on("layeradd",this._enableLayerDelete,this).on("layerremove",this._disableLayerDelete,this))},disable:function(){this._enabled&&(this._deletableLayers.off("layeradd",this._enableLayerDelete,this).off("layerremove",this._disableLayerDelete,this),L.Handler.prototype.disable.call(this),this._map.fire(L.Draw.Event.DELETESTOP,{handler:this.type}),this.fire("disabled",{handler:this.type}))},addHooks:function(){var t=this._map;t&&(t.getContainer().focus(),this._deletableLayers.eachLayer(this._enableLayerDelete,this),this._deletedLayers=new L.LayerGroup,this._tooltip=new L.Draw.Tooltip(this._map),this._tooltip.updateContent({text:L.drawLocal.edit.handlers.remove.tooltip.text}),this._map.on("mousemove",this._onMouseMove,this))},removeHooks:function(){this._map&&(this._deletableLayers.eachLayer(this._disableLayerDelete,this),this._deletedLayers=null,this._tooltip.dispose(),this._tooltip=null,this._map.off("mousemove",this._onMouseMove,this))},revertLayers:function(){this._deletedLayers.eachLayer(function(t){this._deletableLayers.addLayer(t),t.fire("revert-deleted",{layer:t})},this)},save:function(){this._map.fire(L.Draw.Event.DELETED,{layers:this._deletedLayers})},removeAllLayers:function(){this._deletableLayers.eachLayer(function(t){this._removeLayer({layer:t})},this),this.save()},_enableLayerDelete:function(t){(t.layer||t.target||t).on("click",this._removeLayer,this)},_disableLayerDelete:function(t){var e=t.layer||t.target||t;e.off("click",this._removeLayer,this),this._deletedLayers.removeLayer(e)},_removeLayer:function(t){var e=t.layer||t.target||t;this._deletableLayers.removeLayer(e),this._deletedLayers.addLayer(e),e.fire("deleted")},_onMouseMove:function(t){this._tooltip.updatePosition(t.latlng)},_hasAvailableLayers:function(){return 0!==this._deletableLayers.getLayers().length}})}(window,document);
\ No newline at end of file
+!(function (t, e, i) {
+ function o(t, e) {
+ for (; (t = t.parentElement) && !t.classList.contains(e); );
+ return t;
+ }
+ (L.drawVersion = "0.4.14"),
+ (L.Draw = {}),
+ (L.drawLocal = {
+ draw: {
+ toolbar: {
+ actions: { title: "Cancel drawing", text: "Cancel" },
+ finish: { title: "Finish drawing", text: "Finish" },
+ undo: { title: "Delete last point drawn", text: "Delete last point" },
+ buttons: {
+ polyline: "Draw a polyline",
+ polygon: "Draw a polygon",
+ rectangle: "Draw a rectangle",
+ circle: "Draw a circle",
+ marker: "Draw a marker",
+ circlemarker: "Draw a circlemarker",
+ },
+ },
+ handlers: {
+ circle: {
+ tooltip: { start: "Click and drag to draw circle." },
+ radius: "Radius",
+ },
+ circlemarker: {
+ tooltip: { start: "Click map to place circle marker." },
+ },
+ marker: { tooltip: { start: "Click map to place marker." } },
+ polygon: {
+ tooltip: {
+ start: "Click to start drawing shape.",
+ cont: "Click to continue drawing shape.",
+ end: "Click first point to close this shape.",
+ },
+ },
+ polyline: {
+ error: "Error: shape edges cannot cross!",
+ tooltip: {
+ start: "Click to start drawing line.",
+ cont: "Click to continue drawing line.",
+ end: "Click last point to finish line.",
+ },
+ },
+ rectangle: {
+ tooltip: { start: "Click and drag to draw rectangle." },
+ },
+ simpleshape: { tooltip: { end: "Release mouse to finish drawing." } },
+ },
+ },
+ edit: {
+ toolbar: {
+ actions: {
+ save: { title: "Save changes", text: "Save" },
+ cancel: {
+ title: "Cancel editing, discards all changes",
+ text: "Cancel",
+ },
+ clearAll: { title: "Clear all layers", text: "Clear All" },
+ },
+ buttons: {
+ edit: "Edit layers",
+ editDisabled: "No layers to edit",
+ remove: "Delete layers",
+ removeDisabled: "No layers to delete",
+ },
+ },
+ handlers: {
+ edit: {
+ tooltip: {
+ text: "Drag handles or markers to edit features.",
+ subtext: "Click cancel to undo changes.",
+ },
+ },
+ remove: { tooltip: { text: "Click on a feature to remove." } },
+ },
+ },
+ }),
+ (L.Draw.Event = {}),
+ (L.Draw.Event.CREATED = "draw:created"),
+ (L.Draw.Event.EDITED = "draw:edited"),
+ (L.Draw.Event.DELETED = "draw:deleted"),
+ (L.Draw.Event.DRAWSTART = "draw:drawstart"),
+ (L.Draw.Event.DRAWSTOP = "draw:drawstop"),
+ (L.Draw.Event.DRAWVERTEX = "draw:drawvertex"),
+ (L.Draw.Event.EDITSTART = "draw:editstart"),
+ (L.Draw.Event.EDITMOVE = "draw:editmove"),
+ (L.Draw.Event.EDITRESIZE = "draw:editresize"),
+ (L.Draw.Event.EDITVERTEX = "draw:editvertex"),
+ (L.Draw.Event.EDITSTOP = "draw:editstop"),
+ (L.Draw.Event.DELETESTART = "draw:deletestart"),
+ (L.Draw.Event.DELETESTOP = "draw:deletestop"),
+ (L.Draw.Event.TOOLBAROPENED = "draw:toolbaropened"),
+ (L.Draw.Event.TOOLBARCLOSED = "draw:toolbarclosed"),
+ (L.Draw.Event.MARKERCONTEXT = "draw:markercontext"),
+ (L.Draw = L.Draw || {}),
+ (L.Draw.Feature = L.Handler.extend({
+ initialize: function (t, e) {
+ (this._map = t),
+ (this._container = t._container),
+ (this._overlayPane = t._panes.overlayPane),
+ (this._popupPane = t._panes.popupPane),
+ e &&
+ e.shapeOptions &&
+ (e.shapeOptions = L.Util.extend(
+ {},
+ this.options.shapeOptions,
+ e.shapeOptions,
+ )),
+ L.setOptions(this, e);
+ var i = L.version.split(".");
+ 1 === parseInt(i[0], 10) && parseInt(i[1], 10) >= 2
+ ? L.Draw.Feature.include(L.Evented.prototype)
+ : L.Draw.Feature.include(L.Mixin.Events);
+ },
+ enable: function () {
+ this._enabled ||
+ (L.Handler.prototype.enable.call(this),
+ this.fire("enabled", { handler: this.type }),
+ this._map.fire(L.Draw.Event.DRAWSTART, { layerType: this.type }));
+ },
+ disable: function () {
+ this._enabled &&
+ (L.Handler.prototype.disable.call(this),
+ this._map.fire(L.Draw.Event.DRAWSTOP, { layerType: this.type }),
+ this.fire("disabled", { handler: this.type }));
+ },
+ addHooks: function () {
+ var t = this._map;
+ t &&
+ (L.DomUtil.disableTextSelection(),
+ t.getContainer().focus(),
+ (this._tooltip = new L.Draw.Tooltip(this._map)),
+ L.DomEvent.on(this._container, "keyup", this._cancelDrawing, this));
+ },
+ removeHooks: function () {
+ this._map &&
+ (L.DomUtil.enableTextSelection(),
+ this._tooltip.dispose(),
+ (this._tooltip = null),
+ L.DomEvent.off(this._container, "keyup", this._cancelDrawing, this));
+ },
+ setOptions: function (t) {
+ L.setOptions(this, t);
+ },
+ _fireCreatedEvent: function (t) {
+ this._map.fire(L.Draw.Event.CREATED, {
+ layer: t,
+ layerType: this.type,
+ });
+ },
+ _cancelDrawing: function (t) {
+ 27 === t.keyCode &&
+ (this._map.fire("draw:canceled", { layerType: this.type }),
+ this.disable());
+ },
+ })),
+ (L.Draw.Polyline = L.Draw.Feature.extend({
+ statics: { TYPE: "polyline" },
+ Poly: L.Polyline,
+ options: {
+ allowIntersection: !0,
+ repeatMode: !1,
+ drawError: { color: "#b00b00", timeout: 2500 },
+ icon: new L.DivIcon({
+ iconSize: new L.Point(8, 8),
+ className: "leaflet-div-icon leaflet-editing-icon",
+ }),
+ touchIcon: new L.DivIcon({
+ iconSize: new L.Point(20, 20),
+ className: "leaflet-div-icon leaflet-editing-icon leaflet-touch-icon",
+ }),
+ guidelineDistance: 20,
+ maxGuideLineLength: 4e3,
+ shapeOptions: {
+ stroke: !0,
+ color: "#3388ff",
+ weight: 4,
+ opacity: 0.5,
+ fill: !1,
+ clickable: !0,
+ },
+ metric: !0,
+ feet: !0,
+ nautic: !1,
+ showLength: !0,
+ zIndexOffset: 2e3,
+ factor: 1,
+ maxPoints: 0,
+ },
+ initialize: function (t, e) {
+ L.Browser.touch && (this.options.icon = this.options.touchIcon),
+ (this.options.drawError.message =
+ L.drawLocal.draw.handlers.polyline.error),
+ e &&
+ e.drawError &&
+ (e.drawError = L.Util.extend(
+ {},
+ this.options.drawError,
+ e.drawError,
+ )),
+ (this.type = L.Draw.Polyline.TYPE),
+ L.Draw.Feature.prototype.initialize.call(this, t, e);
+ },
+ addHooks: function () {
+ L.Draw.Feature.prototype.addHooks.call(this),
+ this._map &&
+ ((this._markers = []),
+ (this._markerGroup = new L.LayerGroup()),
+ this._map.addLayer(this._markerGroup),
+ (this._poly = new L.Polyline([], this.options.shapeOptions)),
+ this._tooltip.updateContent(this._getTooltipText()),
+ this._mouseMarker ||
+ (this._mouseMarker = L.marker(this._map.getCenter(), {
+ icon: L.divIcon({
+ className: "leaflet-mouse-marker",
+ iconAnchor: [20, 20],
+ iconSize: [40, 40],
+ }),
+ opacity: 0,
+ zIndexOffset: this.options.zIndexOffset,
+ })),
+ this._mouseMarker
+ .on("mouseout", this._onMouseOut, this)
+ .on("mousemove", this._onMouseMove, this)
+ .on("mousedown", this._onMouseDown, this)
+ .on("mouseup", this._onMouseUp, this)
+ .addTo(this._map),
+ this._map
+ .on("mouseup", this._onMouseUp, this)
+ .on("mousemove", this._onMouseMove, this)
+ .on("zoomlevelschange", this._onZoomEnd, this)
+ .on("touchstart", this._onTouch, this)
+ .on("zoomend", this._onZoomEnd, this));
+ },
+ removeHooks: function () {
+ L.Draw.Feature.prototype.removeHooks.call(this),
+ this._clearHideErrorTimeout(),
+ this._cleanUpShape(),
+ this._map.removeLayer(this._markerGroup),
+ delete this._markerGroup,
+ delete this._markers,
+ this._map.removeLayer(this._poly),
+ delete this._poly,
+ this._mouseMarker
+ .off("mousedown", this._onMouseDown, this)
+ .off("mouseout", this._onMouseOut, this)
+ .off("mouseup", this._onMouseUp, this)
+ .off("mousemove", this._onMouseMove, this),
+ this._map.removeLayer(this._mouseMarker),
+ delete this._mouseMarker,
+ this._clearGuides(),
+ this._map
+ .off("mouseup", this._onMouseUp, this)
+ .off("mousemove", this._onMouseMove, this)
+ .off("zoomlevelschange", this._onZoomEnd, this)
+ .off("zoomend", this._onZoomEnd, this)
+ .off("touchstart", this._onTouch, this)
+ .off("click", this._onTouch, this);
+ },
+ deleteLastVertex: function () {
+ if (!(this._markers.length <= 1)) {
+ var t = this._markers.pop(),
+ e = this._poly,
+ i = e.getLatLngs(),
+ o = i.splice(-1, 1)[0];
+ this._poly.setLatLngs(i),
+ this._markerGroup.removeLayer(t),
+ e.getLatLngs().length < 2 && this._map.removeLayer(e),
+ this._vertexChanged(o, !1);
+ }
+ },
+ addVertex: function (t) {
+ if (
+ this._markers.length >= 2 &&
+ !this.options.allowIntersection &&
+ this._poly.newLatLngIntersects(t)
+ )
+ return void this._showErrorTooltip();
+ this._errorShown && this._hideErrorTooltip(),
+ this._markers.push(this._createMarker(t)),
+ this._poly.addLatLng(t),
+ 2 === this._poly.getLatLngs().length &&
+ this._map.addLayer(this._poly),
+ this._vertexChanged(t, !0);
+ },
+ completeShape: function () {
+ this._markers.length <= 1 ||
+ (this._fireCreatedEvent(),
+ this.disable(),
+ this.options.repeatMode && this.enable());
+ },
+ _finishShape: function () {
+ var t = this._poly._defaultShape
+ ? this._poly._defaultShape()
+ : this._poly.getLatLngs(),
+ e = this._poly.newLatLngIntersects(t[t.length - 1]);
+ if ((!this.options.allowIntersection && e) || !this._shapeIsValid())
+ return void this._showErrorTooltip();
+ this._fireCreatedEvent(),
+ this.disable(),
+ this.options.repeatMode && this.enable();
+ },
+ _shapeIsValid: function () {
+ return !0;
+ },
+ _onZoomEnd: function () {
+ null !== this._markers && this._updateGuide();
+ },
+ _onMouseMove: function (t) {
+ var e = this._map.mouseEventToLayerPoint(t.originalEvent),
+ i = this._map.layerPointToLatLng(e);
+ (this._currentLatLng = i),
+ this._updateTooltip(i),
+ this._updateGuide(e),
+ this._mouseMarker.setLatLng(i),
+ L.DomEvent.preventDefault(t.originalEvent);
+ },
+ _vertexChanged: function (t, e) {
+ this._map.fire(L.Draw.Event.DRAWVERTEX, { layers: this._markerGroup }),
+ this._updateFinishHandler(),
+ this._updateRunningMeasure(t, e),
+ this._clearGuides(),
+ this._updateTooltip();
+ },
+ _onMouseDown: function (t) {
+ if (
+ !this._clickHandled &&
+ !this._touchHandled &&
+ !this._disableMarkers
+ ) {
+ this._onMouseMove(t),
+ (this._clickHandled = !0),
+ this._disableNewMarkers();
+ var e = t.originalEvent,
+ i = e.clientX,
+ o = e.clientY;
+ this._startPoint.call(this, i, o);
+ }
+ },
+ _startPoint: function (t, e) {
+ this._mouseDownOrigin = L.point(t, e);
+ },
+ _onMouseUp: function (t) {
+ var e = t.originalEvent,
+ i = e.clientX,
+ o = e.clientY;
+ this._endPoint.call(this, i, o, t), (this._clickHandled = null);
+ },
+ _endPoint: function (e, i, o) {
+ if (this._mouseDownOrigin) {
+ var n = L.point(e, i).distanceTo(this._mouseDownOrigin),
+ a = this._calculateFinishDistance(o.latlng);
+ this.options.maxPoints > 1 &&
+ this.options.maxPoints == this._markers.length + 1
+ ? (this.addVertex(o.latlng), this._finishShape())
+ : a < 10 && L.Browser.touch
+ ? this._finishShape()
+ : Math.abs(n) < 9 * (t.devicePixelRatio || 1) &&
+ this.addVertex(o.latlng),
+ this._enableNewMarkers();
+ }
+ this._mouseDownOrigin = null;
+ },
+ _onTouch: function (t) {
+ var e,
+ i,
+ o = t.originalEvent;
+ !o.touches ||
+ !o.touches[0] ||
+ this._clickHandled ||
+ this._touchHandled ||
+ this._disableMarkers ||
+ ((e = o.touches[0].clientX),
+ (i = o.touches[0].clientY),
+ this._disableNewMarkers(),
+ (this._touchHandled = !0),
+ this._startPoint.call(this, e, i),
+ this._endPoint.call(this, e, i, t),
+ (this._touchHandled = null)),
+ (this._clickHandled = null);
+ },
+ _onMouseOut: function () {
+ this._tooltip && this._tooltip._onMouseOut.call(this._tooltip);
+ },
+ _calculateFinishDistance: function (t) {
+ var e;
+ if (this._markers.length > 0) {
+ var i;
+ if (this.type === L.Draw.Polyline.TYPE)
+ i = this._markers[this._markers.length - 1];
+ else {
+ if (this.type !== L.Draw.Polygon.TYPE) return 1 / 0;
+ i = this._markers[0];
+ }
+ var o = this._map.latLngToContainerPoint(i.getLatLng()),
+ n = new L.Marker(t, {
+ icon: this.options.icon,
+ zIndexOffset: 2 * this.options.zIndexOffset,
+ }),
+ a = this._map.latLngToContainerPoint(n.getLatLng());
+ e = o.distanceTo(a);
+ } else e = 1 / 0;
+ return e;
+ },
+ _updateFinishHandler: function () {
+ var t = this._markers.length;
+ t > 1 && this._markers[t - 1].on("click", this._finishShape, this),
+ t > 2 && this._markers[t - 2].off("click", this._finishShape, this);
+ },
+ _createMarker: function (t) {
+ var e = new L.Marker(t, {
+ icon: this.options.icon,
+ zIndexOffset: 2 * this.options.zIndexOffset,
+ });
+ return this._markerGroup.addLayer(e), e;
+ },
+ _updateGuide: function (t) {
+ var e = this._markers ? this._markers.length : 0;
+ e > 0 &&
+ ((t = t || this._map.latLngToLayerPoint(this._currentLatLng)),
+ this._clearGuides(),
+ this._drawGuide(
+ this._map.latLngToLayerPoint(this._markers[e - 1].getLatLng()),
+ t,
+ ));
+ },
+ _updateTooltip: function (t) {
+ var e = this._getTooltipText();
+ t && this._tooltip.updatePosition(t),
+ this._errorShown || this._tooltip.updateContent(e);
+ },
+ _drawGuide: function (t, e) {
+ var i,
+ o,
+ n,
+ a = Math.floor(
+ Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2)),
+ ),
+ s = this.options.guidelineDistance,
+ r = this.options.maxGuideLineLength,
+ l = a > r ? a - r : s;
+ for (
+ this._guidesContainer ||
+ (this._guidesContainer = L.DomUtil.create(
+ "div",
+ "leaflet-draw-guides",
+ this._overlayPane,
+ ));
+ l < a;
+ l += this.options.guidelineDistance
+ )
+ (i = l / a),
+ (o = {
+ x: Math.floor(t.x * (1 - i) + i * e.x),
+ y: Math.floor(t.y * (1 - i) + i * e.y),
+ }),
+ (n = L.DomUtil.create(
+ "div",
+ "leaflet-draw-guide-dash",
+ this._guidesContainer,
+ )),
+ (n.style.backgroundColor = this._errorShown
+ ? this.options.drawError.color
+ : this.options.shapeOptions.color),
+ L.DomUtil.setPosition(n, o);
+ },
+ _updateGuideColor: function (t) {
+ if (this._guidesContainer)
+ for (
+ var e = 0, i = this._guidesContainer.childNodes.length;
+ e < i;
+ e++
+ )
+ this._guidesContainer.childNodes[e].style.backgroundColor = t;
+ },
+ _clearGuides: function () {
+ if (this._guidesContainer)
+ for (; this._guidesContainer.firstChild; )
+ this._guidesContainer.removeChild(this._guidesContainer.firstChild);
+ },
+ _getTooltipText: function () {
+ var t,
+ e,
+ i = this.options.showLength;
+ return (
+ 0 === this._markers.length
+ ? (t = { text: L.drawLocal.draw.handlers.polyline.tooltip.start })
+ : ((e = i ? this._getMeasurementString() : ""),
+ (t =
+ 1 === this._markers.length
+ ? {
+ text: L.drawLocal.draw.handlers.polyline.tooltip.cont,
+ subtext: e,
+ }
+ : {
+ text: L.drawLocal.draw.handlers.polyline.tooltip.end,
+ subtext: e,
+ })),
+ t
+ );
+ },
+ _updateRunningMeasure: function (t, e) {
+ var i,
+ o,
+ n = this._markers.length;
+ 1 === this._markers.length
+ ? (this._measurementRunningTotal = 0)
+ : ((i = n - (e ? 2 : 1)),
+ (o = L.GeometryUtil.isVersion07x()
+ ? t.distanceTo(this._markers[i].getLatLng()) *
+ (this.options.factor || 1)
+ : this._map.distance(t, this._markers[i].getLatLng()) *
+ (this.options.factor || 1)),
+ (this._measurementRunningTotal += o * (e ? 1 : -1)));
+ },
+ _getMeasurementString: function () {
+ var t,
+ e = this._currentLatLng,
+ i = this._markers[this._markers.length - 1].getLatLng();
+ return (
+ (t = L.GeometryUtil.isVersion07x()
+ ? i && e && e.distanceTo
+ ? this._measurementRunningTotal +
+ e.distanceTo(i) * (this.options.factor || 1)
+ : this._measurementRunningTotal || 0
+ : i && e
+ ? this._measurementRunningTotal +
+ this._map.distance(e, i) * (this.options.factor || 1)
+ : this._measurementRunningTotal || 0),
+ L.GeometryUtil.readableDistance(
+ t,
+ this.options.metric,
+ this.options.feet,
+ this.options.nautic,
+ this.options.precision,
+ )
+ );
+ },
+ _showErrorTooltip: function () {
+ (this._errorShown = !0),
+ this._tooltip
+ .showAsError()
+ .updateContent({ text: this.options.drawError.message }),
+ this._updateGuideColor(this.options.drawError.color),
+ this._poly.setStyle({ color: this.options.drawError.color }),
+ this._clearHideErrorTimeout(),
+ (this._hideErrorTimeout = setTimeout(
+ L.Util.bind(this._hideErrorTooltip, this),
+ this.options.drawError.timeout,
+ ));
+ },
+ _hideErrorTooltip: function () {
+ (this._errorShown = !1),
+ this._clearHideErrorTimeout(),
+ this._tooltip.removeError().updateContent(this._getTooltipText()),
+ this._updateGuideColor(this.options.shapeOptions.color),
+ this._poly.setStyle({ color: this.options.shapeOptions.color });
+ },
+ _clearHideErrorTimeout: function () {
+ this._hideErrorTimeout &&
+ (clearTimeout(this._hideErrorTimeout),
+ (this._hideErrorTimeout = null));
+ },
+ _disableNewMarkers: function () {
+ this._disableMarkers = !0;
+ },
+ _enableNewMarkers: function () {
+ setTimeout(
+ function () {
+ this._disableMarkers = !1;
+ }.bind(this),
+ 50,
+ );
+ },
+ _cleanUpShape: function () {
+ this._markers.length > 1 &&
+ this._markers[this._markers.length - 1].off(
+ "click",
+ this._finishShape,
+ this,
+ );
+ },
+ _fireCreatedEvent: function () {
+ var t = new this.Poly(
+ this._poly.getLatLngs(),
+ this.options.shapeOptions,
+ );
+ L.Draw.Feature.prototype._fireCreatedEvent.call(this, t);
+ },
+ })),
+ (L.Draw.Polygon = L.Draw.Polyline.extend({
+ statics: { TYPE: "polygon" },
+ Poly: L.Polygon,
+ options: {
+ showArea: !1,
+ showLength: !1,
+ shapeOptions: {
+ stroke: !0,
+ color: "#3388ff",
+ weight: 4,
+ opacity: 0.5,
+ fill: !0,
+ fillColor: null,
+ fillOpacity: 0.2,
+ clickable: !0,
+ },
+ metric: !0,
+ feet: !0,
+ nautic: !1,
+ precision: {},
+ },
+ initialize: function (t, e) {
+ L.Draw.Polyline.prototype.initialize.call(this, t, e),
+ (this.type = L.Draw.Polygon.TYPE);
+ },
+ _updateFinishHandler: function () {
+ var t = this._markers.length;
+ 1 === t && this._markers[0].on("click", this._finishShape, this),
+ t > 2 &&
+ (this._markers[t - 1].on("dblclick", this._finishShape, this),
+ t > 3 &&
+ this._markers[t - 2].off("dblclick", this._finishShape, this));
+ },
+ _getTooltipText: function () {
+ var t, e;
+ return (
+ 0 === this._markers.length
+ ? (t = L.drawLocal.draw.handlers.polygon.tooltip.start)
+ : this._markers.length < 3
+ ? ((t = L.drawLocal.draw.handlers.polygon.tooltip.cont),
+ (e = this._getMeasurementString()))
+ : ((t = L.drawLocal.draw.handlers.polygon.tooltip.end),
+ (e = this._getMeasurementString())),
+ { text: t, subtext: e }
+ );
+ },
+ _getMeasurementString: function () {
+ var t = this._area,
+ e = "";
+ return t || this.options.showLength
+ ? (this.options.showLength &&
+ (e = L.Draw.Polyline.prototype._getMeasurementString.call(this)),
+ t &&
+ (e +=
+ "
" +
+ L.GeometryUtil.readableArea(
+ t,
+ this.options.metric,
+ this.options.precision,
+ )),
+ e)
+ : null;
+ },
+ _shapeIsValid: function () {
+ return this._markers.length >= 3;
+ },
+ _vertexChanged: function (t, e) {
+ var i;
+ !this.options.allowIntersection &&
+ this.options.showArea &&
+ ((i = this._poly.getLatLngs()),
+ (this._area = L.GeometryUtil.geodesicArea(i))),
+ L.Draw.Polyline.prototype._vertexChanged.call(this, t, e);
+ },
+ _cleanUpShape: function () {
+ var t = this._markers.length;
+ t > 0 &&
+ (this._markers[0].off("click", this._finishShape, this),
+ t > 2 &&
+ this._markers[t - 1].off("dblclick", this._finishShape, this));
+ },
+ })),
+ (L.SimpleShape = {}),
+ (L.Draw.SimpleShape = L.Draw.Feature.extend({
+ options: { repeatMode: !1 },
+ initialize: function (t, e) {
+ (this._endLabelText =
+ L.drawLocal.draw.handlers.simpleshape.tooltip.end),
+ L.Draw.Feature.prototype.initialize.call(this, t, e);
+ },
+ addHooks: function () {
+ L.Draw.Feature.prototype.addHooks.call(this),
+ this._map &&
+ ((this._mapDraggable = this._map.dragging.enabled()),
+ this._mapDraggable && this._map.dragging.disable(),
+ (this._container.style.cursor = "crosshair"),
+ this._tooltip.updateContent({ text: this._initialLabelText }),
+ this._map
+ .on("mousedown", this._onMouseDown, this)
+ .on("mousemove", this._onMouseMove, this)
+ .on("touchstart", this._onMouseDown, this)
+ .on("touchmove", this._onMouseMove, this),
+ e.addEventListener("touchstart", L.DomEvent.preventDefault, {
+ passive: !1,
+ }));
+ },
+ removeHooks: function () {
+ L.Draw.Feature.prototype.removeHooks.call(this),
+ this._map &&
+ (this._mapDraggable && this._map.dragging.enable(),
+ (this._container.style.cursor = ""),
+ this._map
+ .off("mousedown", this._onMouseDown, this)
+ .off("mousemove", this._onMouseMove, this)
+ .off("touchstart", this._onMouseDown, this)
+ .off("touchmove", this._onMouseMove, this),
+ L.DomEvent.off(e, "mouseup", this._onMouseUp, this),
+ L.DomEvent.off(e, "touchend", this._onMouseUp, this),
+ e.removeEventListener("touchstart", L.DomEvent.preventDefault),
+ this._shape &&
+ (this._map.removeLayer(this._shape), delete this._shape)),
+ (this._isDrawing = !1);
+ },
+ _getTooltipText: function () {
+ return { text: this._endLabelText };
+ },
+ _onMouseDown: function (t) {
+ (this._isDrawing = !0),
+ (this._startLatLng = t.latlng),
+ L.DomEvent.on(e, "mouseup", this._onMouseUp, this)
+ .on(e, "touchend", this._onMouseUp, this)
+ .preventDefault(t.originalEvent);
+ },
+ _onMouseMove: function (t) {
+ var e = t.latlng;
+ this._tooltip.updatePosition(e),
+ this._isDrawing &&
+ (this._tooltip.updateContent(this._getTooltipText()),
+ this._drawShape(e));
+ },
+ _onMouseUp: function () {
+ this._shape && this._fireCreatedEvent(),
+ this.disable(),
+ this.options.repeatMode && this.enable();
+ },
+ })),
+ (L.Draw.Rectangle = L.Draw.SimpleShape.extend({
+ statics: { TYPE: "rectangle" },
+ options: {
+ shapeOptions: {
+ stroke: !0,
+ color: "#3388ff",
+ weight: 4,
+ opacity: 0.5,
+ fill: !0,
+ fillColor: null,
+ fillOpacity: 0.2,
+ showArea: !0,
+ clickable: !0,
+ },
+ metric: !0,
+ },
+ initialize: function (t, e) {
+ (this.type = L.Draw.Rectangle.TYPE),
+ (this._initialLabelText =
+ L.drawLocal.draw.handlers.rectangle.tooltip.start),
+ L.Draw.SimpleShape.prototype.initialize.call(this, t, e);
+ },
+ disable: function () {
+ this._enabled &&
+ ((this._isCurrentlyTwoClickDrawing = !1),
+ L.Draw.SimpleShape.prototype.disable.call(this));
+ },
+ _onMouseUp: function (t) {
+ if (!this._shape && !this._isCurrentlyTwoClickDrawing)
+ return void (this._isCurrentlyTwoClickDrawing = !0);
+ (this._isCurrentlyTwoClickDrawing && !o(t.target, "leaflet-pane")) ||
+ L.Draw.SimpleShape.prototype._onMouseUp.call(this);
+ },
+ _drawShape: function (t) {
+ this._shape
+ ? this._shape.setBounds(new L.LatLngBounds(this._startLatLng, t))
+ : ((this._shape = new L.Rectangle(
+ new L.LatLngBounds(this._startLatLng, t),
+ this.options.shapeOptions,
+ )),
+ this._map.addLayer(this._shape));
+ },
+ _fireCreatedEvent: function () {
+ var t = new L.Rectangle(
+ this._shape.getBounds(),
+ this.options.shapeOptions,
+ );
+ L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this, t);
+ },
+ _getTooltipText: function () {
+ var t,
+ e,
+ i,
+ o = L.Draw.SimpleShape.prototype._getTooltipText.call(this),
+ n = this._shape,
+ a = this.options.showArea;
+ return (
+ n &&
+ ((t = this._shape._defaultShape
+ ? this._shape._defaultShape()
+ : this._shape.getLatLngs()),
+ (e = L.GeometryUtil.geodesicArea(t)),
+ (i = a ? L.GeometryUtil.readableArea(e, this.options.metric) : "")),
+ { text: o.text, subtext: i }
+ );
+ },
+ })),
+ (L.Draw.Marker = L.Draw.Feature.extend({
+ statics: { TYPE: "marker" },
+ options: {
+ icon: new L.Icon.Default(),
+ repeatMode: !1,
+ zIndexOffset: 2e3,
+ },
+ initialize: function (t, e) {
+ (this.type = L.Draw.Marker.TYPE),
+ (this._initialLabelText =
+ L.drawLocal.draw.handlers.marker.tooltip.start),
+ L.Draw.Feature.prototype.initialize.call(this, t, e);
+ },
+ addHooks: function () {
+ L.Draw.Feature.prototype.addHooks.call(this),
+ this._map &&
+ (this._tooltip.updateContent({ text: this._initialLabelText }),
+ this._mouseMarker ||
+ (this._mouseMarker = L.marker(this._map.getCenter(), {
+ icon: L.divIcon({
+ className: "leaflet-mouse-marker",
+ iconAnchor: [20, 20],
+ iconSize: [40, 40],
+ }),
+ opacity: 0,
+ zIndexOffset: this.options.zIndexOffset,
+ })),
+ this._mouseMarker.on("click", this._onClick, this).addTo(this._map),
+ this._map.on("mousemove", this._onMouseMove, this),
+ this._map.on("click", this._onTouch, this));
+ },
+ removeHooks: function () {
+ L.Draw.Feature.prototype.removeHooks.call(this),
+ this._map &&
+ (this._map
+ .off("click", this._onClick, this)
+ .off("click", this._onTouch, this),
+ this._marker &&
+ (this._marker.off("click", this._onClick, this),
+ this._map.removeLayer(this._marker),
+ delete this._marker),
+ this._mouseMarker.off("click", this._onClick, this),
+ this._map.removeLayer(this._mouseMarker),
+ delete this._mouseMarker,
+ this._map.off("mousemove", this._onMouseMove, this));
+ },
+ _onMouseMove: function (t) {
+ var e = t.latlng;
+ this._tooltip.updatePosition(e),
+ this._mouseMarker.setLatLng(e),
+ this._marker
+ ? ((e = this._mouseMarker.getLatLng()), this._marker.setLatLng(e))
+ : ((this._marker = this._createMarker(e)),
+ this._marker.on("click", this._onClick, this),
+ this._map
+ .on("click", this._onClick, this)
+ .addLayer(this._marker));
+ },
+ _createMarker: function (t) {
+ return new L.Marker(t, {
+ icon: this.options.icon,
+ zIndexOffset: this.options.zIndexOffset,
+ });
+ },
+ _onClick: function () {
+ this._fireCreatedEvent(),
+ this.disable(),
+ this.options.repeatMode && this.enable();
+ },
+ _onTouch: function (t) {
+ this._onMouseMove(t), this._onClick();
+ },
+ _fireCreatedEvent: function () {
+ var t = new L.Marker.Touch(this._marker.getLatLng(), {
+ icon: this.options.icon,
+ });
+ L.Draw.Feature.prototype._fireCreatedEvent.call(this, t);
+ },
+ })),
+ (L.Draw.CircleMarker = L.Draw.Marker.extend({
+ statics: { TYPE: "circlemarker" },
+ options: {
+ stroke: !0,
+ color: "#3388ff",
+ weight: 4,
+ opacity: 0.5,
+ fill: !0,
+ fillColor: null,
+ fillOpacity: 0.2,
+ clickable: !0,
+ zIndexOffset: 2e3,
+ },
+ initialize: function (t, e) {
+ (this.type = L.Draw.CircleMarker.TYPE),
+ (this._initialLabelText =
+ L.drawLocal.draw.handlers.circlemarker.tooltip.start),
+ L.Draw.Feature.prototype.initialize.call(this, t, e);
+ },
+ _fireCreatedEvent: function () {
+ var t = new L.CircleMarker(this._marker.getLatLng(), this.options);
+ L.Draw.Feature.prototype._fireCreatedEvent.call(this, t);
+ },
+ _createMarker: function (t) {
+ return new L.CircleMarker(t, this.options);
+ },
+ })),
+ (L.Draw.Circle = L.Draw.SimpleShape.extend({
+ statics: { TYPE: "circle" },
+ options: {
+ shapeOptions: {
+ stroke: !0,
+ color: "#3388ff",
+ weight: 4,
+ opacity: 0.5,
+ fill: !0,
+ fillColor: null,
+ fillOpacity: 0.2,
+ clickable: !0,
+ },
+ showRadius: !0,
+ metric: !0,
+ feet: !0,
+ nautic: !1,
+ },
+ initialize: function (t, e) {
+ (this.type = L.Draw.Circle.TYPE),
+ (this._initialLabelText =
+ L.drawLocal.draw.handlers.circle.tooltip.start),
+ L.Draw.SimpleShape.prototype.initialize.call(this, t, e);
+ },
+ _drawShape: function (t) {
+ if (L.GeometryUtil.isVersion07x())
+ var e = this._startLatLng.distanceTo(t);
+ else var e = this._map.distance(this._startLatLng, t);
+ this._shape
+ ? this._shape.setRadius(e)
+ : ((this._shape = new L.Circle(
+ this._startLatLng,
+ e,
+ this.options.shapeOptions,
+ )),
+ this._map.addLayer(this._shape));
+ },
+ _fireCreatedEvent: function () {
+ var t = new L.Circle(
+ this._startLatLng,
+ this._shape.getRadius(),
+ this.options.shapeOptions,
+ );
+ L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this, t);
+ },
+ _onMouseMove: function (t) {
+ var e,
+ i = t.latlng,
+ o = this.options.showRadius,
+ n = this.options.metric;
+ if ((this._tooltip.updatePosition(i), this._isDrawing)) {
+ this._drawShape(i), (e = this._shape.getRadius().toFixed(1));
+ var a = "";
+ o &&
+ (a =
+ L.drawLocal.draw.handlers.circle.radius +
+ ": " +
+ L.GeometryUtil.readableDistance(
+ e,
+ n,
+ this.options.feet,
+ this.options.nautic,
+ )),
+ this._tooltip.updateContent({
+ text: this._endLabelText,
+ subtext: a,
+ });
+ }
+ },
+ })),
+ (L.Edit = L.Edit || {}),
+ (L.Edit.Marker = L.Handler.extend({
+ initialize: function (t, e) {
+ (this._marker = t), L.setOptions(this, e);
+ },
+ addHooks: function () {
+ var t = this._marker;
+ t.dragging.enable(),
+ t.on("dragend", this._onDragEnd, t),
+ this._toggleMarkerHighlight();
+ },
+ removeHooks: function () {
+ var t = this._marker;
+ t.dragging.disable(),
+ t.off("dragend", this._onDragEnd, t),
+ this._toggleMarkerHighlight();
+ },
+ _onDragEnd: function (t) {
+ var e = t.target;
+ (e.edited = !0), this._map.fire(L.Draw.Event.EDITMOVE, { layer: e });
+ },
+ _toggleMarkerHighlight: function () {
+ var t = this._marker._icon;
+ t &&
+ ((t.style.display = "none"),
+ L.DomUtil.hasClass(t, "leaflet-edit-marker-selected")
+ ? (L.DomUtil.removeClass(t, "leaflet-edit-marker-selected"),
+ this._offsetMarker(t, -4))
+ : (L.DomUtil.addClass(t, "leaflet-edit-marker-selected"),
+ this._offsetMarker(t, 4)),
+ (t.style.display = ""));
+ },
+ _offsetMarker: function (t, e) {
+ var i = parseInt(t.style.marginTop, 10) - e,
+ o = parseInt(t.style.marginLeft, 10) - e;
+ (t.style.marginTop = i + "px"), (t.style.marginLeft = o + "px");
+ },
+ })),
+ L.Marker.addInitHook(function () {
+ L.Edit.Marker &&
+ ((this.editing = new L.Edit.Marker(this)),
+ this.options.editable && this.editing.enable());
+ }),
+ (L.Edit = L.Edit || {}),
+ (L.Edit.Poly = L.Handler.extend({
+ initialize: function (t) {
+ (this.latlngs = [t._latlngs]),
+ t._holes && (this.latlngs = this.latlngs.concat(t._holes)),
+ (this._poly = t),
+ this._poly.on("revert-edited", this._updateLatLngs, this);
+ },
+ _defaultShape: function () {
+ return L.Polyline._flat
+ ? L.Polyline._flat(this._poly._latlngs)
+ ? this._poly._latlngs
+ : this._poly._latlngs[0]
+ : this._poly._latlngs;
+ },
+ _eachVertexHandler: function (t) {
+ for (var e = 0; e < this._verticesHandlers.length; e++)
+ t(this._verticesHandlers[e]);
+ },
+ addHooks: function () {
+ this._initHandlers(),
+ this._eachVertexHandler(function (t) {
+ t.addHooks();
+ });
+ },
+ removeHooks: function () {
+ this._eachVertexHandler(function (t) {
+ t.removeHooks();
+ });
+ },
+ updateMarkers: function () {
+ this._eachVertexHandler(function (t) {
+ t.updateMarkers();
+ });
+ },
+ _initHandlers: function () {
+ this._verticesHandlers = [];
+ for (var t = 0; t < this.latlngs.length; t++)
+ this._verticesHandlers.push(
+ new L.Edit.PolyVerticesEdit(
+ this._poly,
+ this.latlngs[t],
+ this._poly.options.poly,
+ ),
+ );
+ },
+ _updateLatLngs: function (t) {
+ (this.latlngs = [t.layer._latlngs]),
+ t.layer._holes &&
+ (this.latlngs = this.latlngs.concat(t.layer._holes));
+ },
+ })),
+ (L.Edit.PolyVerticesEdit = L.Handler.extend({
+ options: {
+ icon: new L.DivIcon({
+ iconSize: new L.Point(8, 8),
+ className: "leaflet-div-icon leaflet-editing-icon",
+ }),
+ touchIcon: new L.DivIcon({
+ iconSize: new L.Point(20, 20),
+ className: "leaflet-div-icon leaflet-editing-icon leaflet-touch-icon",
+ }),
+ drawError: { color: "#b00b00", timeout: 1e3 },
+ },
+ initialize: function (t, e, i) {
+ L.Browser.touch && (this.options.icon = this.options.touchIcon),
+ (this._poly = t),
+ i &&
+ i.drawError &&
+ (i.drawError = L.Util.extend(
+ {},
+ this.options.drawError,
+ i.drawError,
+ )),
+ (this._latlngs = e),
+ L.setOptions(this, i);
+ },
+ _defaultShape: function () {
+ return L.Polyline._flat
+ ? L.Polyline._flat(this._latlngs)
+ ? this._latlngs
+ : this._latlngs[0]
+ : this._latlngs;
+ },
+ addHooks: function () {
+ var t = this._poly,
+ e = t._path;
+ t instanceof L.Polygon ||
+ ((t.options.fill = !1),
+ t.options.editing && (t.options.editing.fill = !1)),
+ e &&
+ t.options.editing.className &&
+ (t.options.original.className &&
+ t.options.original.className.split(" ").forEach(function (t) {
+ L.DomUtil.removeClass(e, t);
+ }),
+ t.options.editing.className.split(" ").forEach(function (t) {
+ L.DomUtil.addClass(e, t);
+ })),
+ t.setStyle(t.options.editing),
+ this._poly._map &&
+ ((this._map = this._poly._map),
+ this._markerGroup || this._initMarkers(),
+ this._poly._map.addLayer(this._markerGroup));
+ },
+ removeHooks: function () {
+ var t = this._poly,
+ e = t._path;
+ e &&
+ t.options.editing.className &&
+ (t.options.editing.className.split(" ").forEach(function (t) {
+ L.DomUtil.removeClass(e, t);
+ }),
+ t.options.original.className &&
+ t.options.original.className.split(" ").forEach(function (t) {
+ L.DomUtil.addClass(e, t);
+ })),
+ t.setStyle(t.options.original),
+ t._map &&
+ (t._map.removeLayer(this._markerGroup),
+ delete this._markerGroup,
+ delete this._markers);
+ },
+ updateMarkers: function () {
+ this._markerGroup.clearLayers(), this._initMarkers();
+ },
+ _initMarkers: function () {
+ this._markerGroup || (this._markerGroup = new L.LayerGroup()),
+ (this._markers = []);
+ var t,
+ e,
+ i,
+ o,
+ n = this._defaultShape();
+ for (t = 0, i = n.length; t < i; t++)
+ (o = this._createMarker(n[t], t)),
+ o.on("click", this._onMarkerClick, this),
+ o.on("contextmenu", this._onContextMenu, this),
+ this._markers.push(o);
+ var a, s;
+ for (t = 0, e = i - 1; t < i; e = t++)
+ (0 !== t || (L.Polygon && this._poly instanceof L.Polygon)) &&
+ ((a = this._markers[e]),
+ (s = this._markers[t]),
+ this._createMiddleMarker(a, s),
+ this._updatePrevNext(a, s));
+ },
+ _createMarker: function (t, e) {
+ var i = new L.Marker.Touch(t, {
+ draggable: !0,
+ icon: this.options.icon,
+ });
+ return (
+ (i._origLatLng = t),
+ (i._index = e),
+ i
+ .on("dragstart", this._onMarkerDragStart, this)
+ .on("drag", this._onMarkerDrag, this)
+ .on("dragend", this._fireEdit, this)
+ .on("touchmove", this._onTouchMove, this)
+ .on("touchend", this._fireEdit, this)
+ .on("MSPointerMove", this._onTouchMove, this)
+ .on("MSPointerUp", this._fireEdit, this),
+ this._markerGroup.addLayer(i),
+ i
+ );
+ },
+ _onMarkerDragStart: function () {
+ this._poly.fire("editstart");
+ },
+ _spliceLatLngs: function () {
+ var t = this._defaultShape(),
+ e = [].splice.apply(t, arguments);
+ return this._poly._convertLatLngs(t, !0), this._poly.redraw(), e;
+ },
+ _removeMarker: function (t) {
+ var e = t._index;
+ this._markerGroup.removeLayer(t),
+ this._markers.splice(e, 1),
+ this._spliceLatLngs(e, 1),
+ this._updateIndexes(e, -1),
+ t
+ .off("dragstart", this._onMarkerDragStart, this)
+ .off("drag", this._onMarkerDrag, this)
+ .off("dragend", this._fireEdit, this)
+ .off("touchmove", this._onMarkerDrag, this)
+ .off("touchend", this._fireEdit, this)
+ .off("click", this._onMarkerClick, this)
+ .off("MSPointerMove", this._onTouchMove, this)
+ .off("MSPointerUp", this._fireEdit, this);
+ },
+ _fireEdit: function () {
+ (this._poly.edited = !0),
+ this._poly.fire("edit"),
+ this._poly._map.fire(L.Draw.Event.EDITVERTEX, {
+ layers: this._markerGroup,
+ poly: this._poly,
+ });
+ },
+ _onMarkerDrag: function (t) {
+ var e = t.target,
+ i = this._poly;
+ if (
+ (L.extend(e._origLatLng, e._latlng),
+ e._middleLeft &&
+ e._middleLeft.setLatLng(this._getMiddleLatLng(e._prev, e)),
+ e._middleRight &&
+ e._middleRight.setLatLng(this._getMiddleLatLng(e, e._next)),
+ i.options.poly)
+ ) {
+ var o = i._map._editTooltip;
+ if (!i.options.poly.allowIntersection && i.intersects()) {
+ var n = i.options.color;
+ i.setStyle({ color: this.options.drawError.color }),
+ 0 !== L.version.indexOf("0.7") && e.dragging._draggable._onUp(t),
+ this._onMarkerClick(t),
+ o &&
+ o.updateContent({
+ text: L.drawLocal.draw.handlers.polyline.error,
+ }),
+ setTimeout(function () {
+ i.setStyle({ color: n }),
+ o &&
+ o.updateContent({
+ text: L.drawLocal.edit.handlers.edit.tooltip.text,
+ subtext: L.drawLocal.edit.handlers.edit.tooltip.subtext,
+ });
+ }, 1e3);
+ }
+ }
+ (this._poly._bounds._southWest = L.latLng(1 / 0, 1 / 0)),
+ (this._poly._bounds._northEast = L.latLng(-1 / 0, -1 / 0));
+ var a = this._poly.getLatLngs();
+ this._poly._convertLatLngs(a, !0),
+ this._poly.redraw(),
+ this._poly.fire("editdrag");
+ },
+ _onMarkerClick: function (t) {
+ var e = L.Polygon && this._poly instanceof L.Polygon ? 4 : 3,
+ i = t.target;
+ this._defaultShape().length < e ||
+ (this._removeMarker(i),
+ this._updatePrevNext(i._prev, i._next),
+ i._middleLeft && this._markerGroup.removeLayer(i._middleLeft),
+ i._middleRight && this._markerGroup.removeLayer(i._middleRight),
+ i._prev && i._next
+ ? this._createMiddleMarker(i._prev, i._next)
+ : i._prev
+ ? i._next || (i._prev._middleRight = null)
+ : (i._next._middleLeft = null),
+ this._fireEdit());
+ },
+ _onContextMenu: function (t) {
+ var e = t.target;
+ this._poly;
+ this._poly._map.fire(L.Draw.Event.MARKERCONTEXT, {
+ marker: e,
+ layers: this._markerGroup,
+ poly: this._poly,
+ }),
+ L.DomEvent.stopPropagation;
+ },
+ _onTouchMove: function (t) {
+ var e = this._map.mouseEventToLayerPoint(t.originalEvent.touches[0]),
+ i = this._map.layerPointToLatLng(e),
+ o = t.target;
+ L.extend(o._origLatLng, i),
+ o._middleLeft &&
+ o._middleLeft.setLatLng(this._getMiddleLatLng(o._prev, o)),
+ o._middleRight &&
+ o._middleRight.setLatLng(this._getMiddleLatLng(o, o._next)),
+ this._poly.redraw(),
+ this.updateMarkers();
+ },
+ _updateIndexes: function (t, e) {
+ this._markerGroup.eachLayer(function (i) {
+ i._index > t && (i._index += e);
+ });
+ },
+ _createMiddleMarker: function (t, e) {
+ var i,
+ o,
+ n,
+ a = this._getMiddleLatLng(t, e),
+ s = this._createMarker(a);
+ s.setOpacity(0.8),
+ (t._middleRight = e._middleLeft = s),
+ (o = function () {
+ s.off("touchmove", o, this);
+ var n = e._index;
+ (s._index = n),
+ s.off("click", i, this).on("click", this._onMarkerClick, this),
+ (a.lat = s.getLatLng().lat),
+ (a.lng = s.getLatLng().lng),
+ this._spliceLatLngs(n, 0, a),
+ this._markers.splice(n, 0, s),
+ s.setOpacity(1),
+ s._icon.classList.remove("leaflet-middle-icon"),
+ this._updateIndexes(n, 1),
+ e._index++,
+ this._updatePrevNext(t, s),
+ this._updatePrevNext(s, e),
+ this._poly.fire("editstart");
+ }),
+ (n = function () {
+ s.off("dragstart", o, this),
+ s.off("dragend", n, this),
+ s.off("touchmove", o, this),
+ this._createMiddleMarker(t, s),
+ this._createMiddleMarker(s, e);
+ }),
+ (i = function () {
+ o.call(this), n.call(this), this._fireEdit();
+ }),
+ s
+ .on("click", i, this)
+ .on("dragstart", o, this)
+ .on("dragend", n, this)
+ .on("touchmove", o, this),
+ this._markerGroup.addLayer(s);
+ setTimeout(() => {
+ s._icon.classList.add("leaflet-middle-icon");
+ }, 100);
+ },
+ _updatePrevNext: function (t, e) {
+ t && (t._next = e), e && (e._prev = t);
+ },
+ _getMiddleLatLng: function (t, e) {
+ var i = this._poly._map,
+ o = i.project(t.getLatLng()),
+ n = i.project(e.getLatLng());
+ return i.unproject(o._add(n)._divideBy(2));
+ },
+ })),
+ L.Polyline.addInitHook(function () {
+ this.editing ||
+ (L.Edit.Poly &&
+ ((this.editing = new L.Edit.Poly(this)),
+ this.options.editable && this.editing.enable()),
+ this.on("add", function () {
+ this.editing && this.editing.enabled() && this.editing.addHooks();
+ }),
+ this.on("remove", function () {
+ this.editing && this.editing.enabled() && this.editing.removeHooks();
+ }));
+ }),
+ (L.Edit = L.Edit || {}),
+ (L.Edit.SimpleShape = L.Handler.extend({
+ options: {
+ moveIcon: new L.DivIcon({
+ iconSize: new L.Point(8, 8),
+ className: "leaflet-div-icon leaflet-editing-icon leaflet-edit-move",
+ }),
+ resizeIcon: new L.DivIcon({
+ iconSize: new L.Point(8, 8),
+ className:
+ "leaflet-div-icon leaflet-editing-icon leaflet-edit-resize",
+ }),
+ touchMoveIcon: new L.DivIcon({
+ iconSize: new L.Point(20, 20),
+ className:
+ "leaflet-div-icon leaflet-editing-icon leaflet-edit-move leaflet-touch-icon",
+ }),
+ touchResizeIcon: new L.DivIcon({
+ iconSize: new L.Point(20, 20),
+ className:
+ "leaflet-div-icon leaflet-editing-icon leaflet-edit-resize leaflet-touch-icon",
+ }),
+ },
+ initialize: function (t, e) {
+ L.Browser.touch &&
+ ((this.options.moveIcon = this.options.touchMoveIcon),
+ (this.options.resizeIcon = this.options.touchResizeIcon)),
+ (this._shape = t),
+ L.Util.setOptions(this, e);
+ },
+ addHooks: function () {
+ var t = this._shape;
+ this._shape._map &&
+ ((this._map = this._shape._map),
+ t.setStyle(t.options.editing),
+ t._map &&
+ ((this._map = t._map),
+ this._markerGroup || this._initMarkers(),
+ this._map.addLayer(this._markerGroup)));
+ },
+ removeHooks: function () {
+ var t = this._shape;
+ if ((t.setStyle(t.options.original), t._map)) {
+ this._unbindMarker(this._moveMarker);
+ for (var e = 0, i = this._resizeMarkers.length; e < i; e++)
+ this._unbindMarker(this._resizeMarkers[e]);
+ (this._resizeMarkers = null),
+ this._map.removeLayer(this._markerGroup),
+ delete this._markerGroup;
+ }
+ this._map = null;
+ },
+ updateMarkers: function () {
+ this._markerGroup.clearLayers(), this._initMarkers();
+ },
+ _initMarkers: function () {
+ this._markerGroup || (this._markerGroup = new L.LayerGroup()),
+ this._createMoveMarker(),
+ this._createResizeMarker();
+ },
+ _createMoveMarker: function () {},
+ _createResizeMarker: function () {},
+ _createMarker: function (t, e) {
+ var i = new L.Marker.Touch(t, {
+ draggable: !0,
+ icon: e,
+ zIndexOffset: 10,
+ });
+ return this._bindMarker(i), this._markerGroup.addLayer(i), i;
+ },
+ _bindMarker: function (t) {
+ t.on("dragstart", this._onMarkerDragStart, this)
+ .on("drag", this._onMarkerDrag, this)
+ .on("dragend", this._onMarkerDragEnd, this)
+ .on("touchstart", this._onTouchStart, this)
+ .on("touchmove", this._onTouchMove, this)
+ .on("MSPointerMove", this._onTouchMove, this)
+ .on("touchend", this._onTouchEnd, this)
+ .on("MSPointerUp", this._onTouchEnd, this);
+ },
+ _unbindMarker: function (t) {
+ t.off("dragstart", this._onMarkerDragStart, this)
+ .off("drag", this._onMarkerDrag, this)
+ .off("dragend", this._onMarkerDragEnd, this)
+ .off("touchstart", this._onTouchStart, this)
+ .off("touchmove", this._onTouchMove, this)
+ .off("MSPointerMove", this._onTouchMove, this)
+ .off("touchend", this._onTouchEnd, this)
+ .off("MSPointerUp", this._onTouchEnd, this);
+ },
+ _onMarkerDragStart: function (t) {
+ t.target.setOpacity(0), this._shape.fire("editstart");
+ },
+ _fireEdit: function () {
+ (this._shape.edited = !0), this._shape.fire("edit");
+ },
+ _onMarkerDrag: function (t) {
+ var e = t.target,
+ i = e.getLatLng();
+ e === this._moveMarker ? this._move(i) : this._resize(i),
+ this._shape.redraw(),
+ this._shape.fire("editdrag");
+ },
+ _onMarkerDragEnd: function (t) {
+ t.target.setOpacity(1), this._fireEdit();
+ },
+ _onTouchStart: function (t) {
+ if (
+ (L.Edit.SimpleShape.prototype._onMarkerDragStart.call(this, t),
+ "function" == typeof this._getCorners)
+ ) {
+ var e = this._getCorners(),
+ i = t.target,
+ o = i._cornerIndex;
+ i.setOpacity(0),
+ (this._oppositeCorner = e[(o + 2) % 4]),
+ this._toggleCornerMarkers(0, o);
+ }
+ this._shape.fire("editstart");
+ },
+ _onTouchMove: function (t) {
+ var e = this._map.mouseEventToLayerPoint(t.originalEvent.touches[0]),
+ i = this._map.layerPointToLatLng(e);
+ return (
+ t.target === this._moveMarker ? this._move(i) : this._resize(i),
+ this._shape.redraw(),
+ !1
+ );
+ },
+ _onTouchEnd: function (t) {
+ t.target.setOpacity(1), this.updateMarkers(), this._fireEdit();
+ },
+ _move: function () {},
+ _resize: function () {},
+ })),
+ (L.Edit = L.Edit || {}),
+ (L.Edit.Rectangle = L.Edit.SimpleShape.extend({
+ _createMoveMarker: function () {
+ var t = this._shape.getBounds(),
+ e = t.getCenter();
+ this._moveMarker = this._createMarker(e, this.options.moveIcon);
+ },
+ _createResizeMarker: function () {
+ var t = this._getCorners();
+ this._resizeMarkers = [];
+ for (var e = 0, i = t.length; e < i; e++)
+ this._resizeMarkers.push(
+ this._createMarker(t[e], this.options.resizeIcon),
+ ),
+ (this._resizeMarkers[e]._cornerIndex = e);
+ },
+ _onMarkerDragStart: function (t) {
+ L.Edit.SimpleShape.prototype._onMarkerDragStart.call(this, t);
+ var e = this._getCorners(),
+ i = t.target,
+ o = i._cornerIndex;
+ (this._oppositeCorner = e[(o + 2) % 4]),
+ this._toggleCornerMarkers(0, o);
+ },
+ _onMarkerDragEnd: function (t) {
+ var e,
+ i,
+ o = t.target;
+ o === this._moveMarker &&
+ ((e = this._shape.getBounds()), (i = e.getCenter()), o.setLatLng(i)),
+ this._toggleCornerMarkers(1),
+ this._repositionCornerMarkers(),
+ L.Edit.SimpleShape.prototype._onMarkerDragEnd.call(this, t);
+ },
+ _move: function (t) {
+ for (
+ var e,
+ i = this._shape._defaultShape
+ ? this._shape._defaultShape()
+ : this._shape.getLatLngs(),
+ o = this._shape.getBounds(),
+ n = o.getCenter(),
+ a = [],
+ s = 0,
+ r = i.length;
+ s < r;
+ s++
+ )
+ (e = [i[s].lat - n.lat, i[s].lng - n.lng]),
+ a.push([t.lat + e[0], t.lng + e[1]]);
+ this._shape.setLatLngs(a),
+ this._repositionCornerMarkers(),
+ this._map.fire(L.Draw.Event.EDITMOVE, { layer: this._shape });
+ },
+ _resize: function (t) {
+ var e;
+ this._shape.setBounds(L.latLngBounds(t, this._oppositeCorner)),
+ (e = this._shape.getBounds()),
+ this._moveMarker.setLatLng(e.getCenter()),
+ this._map.fire(L.Draw.Event.EDITRESIZE, { layer: this._shape });
+ },
+ _getCorners: function () {
+ var t = this._shape.getBounds();
+ return [
+ t.getNorthWest(),
+ t.getNorthEast(),
+ t.getSouthEast(),
+ t.getSouthWest(),
+ ];
+ },
+ _toggleCornerMarkers: function (t) {
+ for (var e = 0, i = this._resizeMarkers.length; e < i; e++)
+ this._resizeMarkers[e].setOpacity(t);
+ },
+ _repositionCornerMarkers: function () {
+ for (
+ var t = this._getCorners(), e = 0, i = this._resizeMarkers.length;
+ e < i;
+ e++
+ )
+ this._resizeMarkers[e].setLatLng(t[e]);
+ },
+ })),
+ L.Rectangle.addInitHook(function () {
+ L.Edit.Rectangle &&
+ ((this.editing = new L.Edit.Rectangle(this)),
+ this.options.editable && this.editing.enable());
+ }),
+ (L.Edit = L.Edit || {}),
+ (L.Edit.CircleMarker = L.Edit.SimpleShape.extend({
+ _createMoveMarker: function () {
+ var t = this._shape.getLatLng();
+ this._moveMarker = this._createMarker(t, this.options.moveIcon);
+ },
+ _createResizeMarker: function () {
+ this._resizeMarkers = [];
+ },
+ _move: function (t) {
+ if (this._resizeMarkers.length) {
+ var e = this._getResizeMarkerPoint(t);
+ this._resizeMarkers[0].setLatLng(e);
+ }
+ this._shape.setLatLng(t),
+ this._map.fire(L.Draw.Event.EDITMOVE, { layer: this._shape });
+ },
+ })),
+ L.CircleMarker.addInitHook(function () {
+ L.Edit.CircleMarker &&
+ ((this.editing = new L.Edit.CircleMarker(this)),
+ this.options.editable && this.editing.enable()),
+ this.on("add", function () {
+ this.editing && this.editing.enabled() && this.editing.addHooks();
+ }),
+ this.on("remove", function () {
+ this.editing && this.editing.enabled() && this.editing.removeHooks();
+ });
+ }),
+ (L.Edit = L.Edit || {}),
+ (L.Edit.Circle = L.Edit.CircleMarker.extend({
+ _createResizeMarker: function () {
+ var t = this._shape.getLatLng(),
+ e = this._getResizeMarkerPoint(t);
+ (this._resizeMarkers = []),
+ this._resizeMarkers.push(
+ this._createMarker(e, this.options.resizeIcon),
+ );
+ },
+ _getResizeMarkerPoint: function (t) {
+ var e = this._shape._radius * Math.cos(Math.PI / 4),
+ i = this._map.project(t);
+ return this._map.unproject([i.x + e, i.y - e]);
+ },
+ _resize: function (t) {
+ var e = this._moveMarker.getLatLng();
+ L.GeometryUtil.isVersion07x()
+ ? (radius = e.distanceTo(t))
+ : (radius = this._map.distance(e, t)),
+ this._shape.setRadius(radius),
+ this._map._editTooltip.updateContent({
+ text:
+ L.drawLocal.edit.handlers.edit.tooltip.subtext +
+ "
" +
+ L.drawLocal.edit.handlers.edit.tooltip.text,
+ subtext:
+ L.drawLocal.draw.handlers.circle.radius +
+ ": " +
+ L.GeometryUtil.readableDistance(
+ radius,
+ !0,
+ this.options.feet,
+ this.options.nautic,
+ ),
+ }),
+ this._shape.setRadius(radius),
+ this._map.fire(L.Draw.Event.EDITRESIZE, { layer: this._shape });
+ },
+ })),
+ L.Circle.addInitHook(function () {
+ L.Edit.Circle &&
+ ((this.editing = new L.Edit.Circle(this)),
+ this.options.editable && this.editing.enable()),
+ this.on("add", function () {
+ this.editing && this.editing.enabled() && this.editing.addHooks();
+ }),
+ this.on("remove", function () {
+ this.editing && this.editing.enabled() && this.editing.removeHooks();
+ });
+ }),
+ L.Map.mergeOptions({ touchExtend: !0 }),
+ (L.Map.TouchExtend = L.Handler.extend({
+ initialize: function (t) {
+ (this._map = t),
+ (this._container = t._container),
+ (this._pane = t._panes.overlayPane);
+ },
+ addHooks: function () {
+ L.DomEvent.on(this._container, "touchstart", this._onTouchStart, this),
+ L.DomEvent.on(this._container, "touchend", this._onTouchEnd, this),
+ L.DomEvent.on(this._container, "touchmove", this._onTouchMove, this),
+ this._detectIE()
+ ? (L.DomEvent.on(
+ this._container,
+ "MSPointerDown",
+ this._onTouchStart,
+ this,
+ ),
+ L.DomEvent.on(
+ this._container,
+ "MSPointerUp",
+ this._onTouchEnd,
+ this,
+ ),
+ L.DomEvent.on(
+ this._container,
+ "MSPointerMove",
+ this._onTouchMove,
+ this,
+ ),
+ L.DomEvent.on(
+ this._container,
+ "MSPointerCancel",
+ this._onTouchCancel,
+ this,
+ ))
+ : (L.DomEvent.on(
+ this._container,
+ "touchcancel",
+ this._onTouchCancel,
+ this,
+ ),
+ L.DomEvent.on(
+ this._container,
+ "touchleave",
+ this._onTouchLeave,
+ this,
+ ));
+ },
+ removeHooks: function () {
+ L.DomEvent.off(this._container, "touchstart", this._onTouchStart),
+ L.DomEvent.off(this._container, "touchend", this._onTouchEnd),
+ L.DomEvent.off(this._container, "touchmove", this._onTouchMove),
+ this._detectIE()
+ ? (L.DomEvent.off(
+ this._container,
+ "MSPointerDowm",
+ this._onTouchStart,
+ ),
+ L.DomEvent.off(this._container, "MSPointerUp", this._onTouchEnd),
+ L.DomEvent.off(
+ this._container,
+ "MSPointerMove",
+ this._onTouchMove,
+ ),
+ L.DomEvent.off(
+ this._container,
+ "MSPointerCancel",
+ this._onTouchCancel,
+ ))
+ : (L.DomEvent.off(
+ this._container,
+ "touchcancel",
+ this._onTouchCancel,
+ ),
+ L.DomEvent.off(
+ this._container,
+ "touchleave",
+ this._onTouchLeave,
+ ));
+ },
+ _touchEvent: function (t, e) {
+ var i = {};
+ if (void 0 !== t.touches) {
+ if (!t.touches.length) return;
+ i = t.touches[0];
+ } else {
+ if ("touch" !== t.pointerType) return;
+ if (((i = t), !this._filterClick(t))) return;
+ }
+ var o = this._map.mouseEventToContainerPoint(i),
+ n = this._map.mouseEventToLayerPoint(i),
+ a = this._map.layerPointToLatLng(n);
+ this._map.fire(e, {
+ latlng: a,
+ layerPoint: n,
+ containerPoint: o,
+ pageX: i.pageX,
+ pageY: i.pageY,
+ originalEvent: t,
+ });
+ },
+ _filterClick: function (t) {
+ var e = t.timeStamp || t.originalEvent.timeStamp,
+ i = L.DomEvent._lastClick && e - L.DomEvent._lastClick;
+ return (i && i > 100 && i < 500) ||
+ (t.target._simulatedClick && !t._simulated)
+ ? (L.DomEvent.stop(t), !1)
+ : ((L.DomEvent._lastClick = e), !0);
+ },
+ _onTouchStart: function (t) {
+ if (this._map._loaded) {
+ this._touchEvent(t, "touchstart");
+ }
+ },
+ _onTouchEnd: function (t) {
+ if (this._map._loaded) {
+ this._touchEvent(t, "touchend");
+ }
+ },
+ _onTouchCancel: function (t) {
+ if (this._map._loaded) {
+ var e = "touchcancel";
+ this._detectIE() && (e = "pointercancel"), this._touchEvent(t, e);
+ }
+ },
+ _onTouchLeave: function (t) {
+ if (this._map._loaded) {
+ this._touchEvent(t, "touchleave");
+ }
+ },
+ _onTouchMove: function (t) {
+ if (this._map._loaded) {
+ this._touchEvent(t, "touchmove");
+ }
+ },
+ _detectIE: function () {
+ var e = t.navigator.userAgent,
+ i = e.indexOf("MSIE ");
+ if (i > 0) return parseInt(e.substring(i + 5, e.indexOf(".", i)), 10);
+ if (e.indexOf("Trident/") > 0) {
+ var o = e.indexOf("rv:");
+ return parseInt(e.substring(o + 3, e.indexOf(".", o)), 10);
+ }
+ var n = e.indexOf("Edge/");
+ return n > 0 && parseInt(e.substring(n + 5, e.indexOf(".", n)), 10);
+ },
+ })),
+ L.Map.addInitHook("addHandler", "touchExtend", L.Map.TouchExtend),
+ (L.Marker.Touch = L.Marker.extend({
+ _initInteraction: function () {
+ return this.addInteractiveTarget
+ ? L.Marker.prototype._initInteraction.apply(this)
+ : this._initInteractionLegacy();
+ },
+ _initInteractionLegacy: function () {
+ if (this.options.clickable) {
+ var t = this._icon,
+ e = [
+ "dblclick",
+ "mousedown",
+ "mouseover",
+ "mouseout",
+ "contextmenu",
+ "touchstart",
+ "touchend",
+ "touchmove",
+ ];
+ this._detectIE
+ ? e.concat([
+ "MSPointerDown",
+ "MSPointerUp",
+ "MSPointerMove",
+ "MSPointerCancel",
+ ])
+ : e.concat(["touchcancel"]),
+ L.DomUtil.addClass(t, "leaflet-clickable"),
+ L.DomEvent.on(t, "click", this._onMouseClick, this),
+ L.DomEvent.on(t, "keypress", this._onKeyPress, this);
+ for (var i = 0; i < e.length; i++)
+ L.DomEvent.on(t, e[i], this._fireMouseEvent, this);
+ L.Handler.MarkerDrag &&
+ ((this.dragging = new L.Handler.MarkerDrag(this)),
+ this.options.draggable && this.dragging.enable());
+ }
+ },
+ _detectIE: function () {
+ var e = t.navigator.userAgent,
+ i = e.indexOf("MSIE ");
+ if (i > 0) return parseInt(e.substring(i + 5, e.indexOf(".", i)), 10);
+ if (e.indexOf("Trident/") > 0) {
+ var o = e.indexOf("rv:");
+ return parseInt(e.substring(o + 3, e.indexOf(".", o)), 10);
+ }
+ var n = e.indexOf("Edge/");
+ return n > 0 && parseInt(e.substring(n + 5, e.indexOf(".", n)), 10);
+ },
+ })),
+ (L.LatLngUtil = {
+ cloneLatLngs: function (t) {
+ for (var e = [], i = 0, o = t.length; i < o; i++)
+ Array.isArray(t[i])
+ ? e.push(L.LatLngUtil.cloneLatLngs(t[i]))
+ : e.push(this.cloneLatLng(t[i]));
+ return e;
+ },
+ cloneLatLng: function (t) {
+ return L.latLng(t.lat, t.lng);
+ },
+ }),
+ (function () {
+ var t = { km: 2, ha: 2, m: 0, mi: 2, ac: 2, yd: 0, ft: 0, nm: 2 };
+ L.GeometryUtil = L.extend(L.GeometryUtil || {}, {
+ geodesicArea: function (t) {
+ var e,
+ i,
+ o = t.length,
+ n = 0,
+ a = Math.PI / 180;
+ if (o > 2) {
+ for (var s = 0; s < o; s++)
+ (e = t[s]),
+ (i = t[(s + 1) % o]),
+ (n +=
+ (i.lng - e.lng) *
+ a *
+ (2 + Math.sin(e.lat * a) + Math.sin(i.lat * a)));
+ n = (6378137 * n * 6378137) / 2;
+ }
+ return Math.abs(n);
+ },
+ formattedNumber: function (t, e) {
+ var i = parseFloat(t).toFixed(e),
+ o = L.drawLocal.format && L.drawLocal.format.numeric,
+ n = o && o.delimiters,
+ a = n && n.thousands,
+ s = n && n.decimal;
+ if (a || s) {
+ var r = i.split(".");
+ (i = a ? r[0].replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1" + a) : r[0]),
+ (s = s || "."),
+ r.length > 1 && (i = i + s + r[1]);
+ }
+ return i;
+ },
+ readableArea: function (e, i, o) {
+ var n,
+ a,
+ o = L.Util.extend({}, t, o);
+ return (
+ i
+ ? ((a = ["ha", "m"]),
+ (type = typeof i),
+ "string" === type ? (a = [i]) : "boolean" !== type && (a = i),
+ (n =
+ e >= 1e6 && -1 !== a.indexOf("km")
+ ? L.GeometryUtil.formattedNumber(1e-6 * e, o.km) + " km²"
+ : e >= 1e4 && -1 !== a.indexOf("ha")
+ ? L.GeometryUtil.formattedNumber(1e-4 * e, o.ha) + " ha"
+ : L.GeometryUtil.formattedNumber(e, o.m) + " m²"))
+ : ((e /= 0.836127),
+ (n =
+ e >= 3097600
+ ? L.GeometryUtil.formattedNumber(e / 3097600, o.mi) + " mi²"
+ : e >= 4840
+ ? L.GeometryUtil.formattedNumber(e / 4840, o.ac) +
+ " acres"
+ : L.GeometryUtil.formattedNumber(e, o.yd) + " yd²")),
+ n
+ );
+ },
+ readableDistance: function (e, i, o, n, a) {
+ var s,
+ a = L.Util.extend({}, t, a);
+ switch (
+ i
+ ? "string" == typeof i
+ ? i
+ : "metric"
+ : o
+ ? "feet"
+ : n
+ ? "nauticalMile"
+ : "yards"
+ ) {
+ case "metric":
+ s =
+ e > 1e3
+ ? L.GeometryUtil.formattedNumber(e / 1e3, a.km) + " km"
+ : L.GeometryUtil.formattedNumber(e, a.m) + " m";
+ break;
+ case "feet":
+ (e *= 3.28083),
+ (s = L.GeometryUtil.formattedNumber(e, a.ft) + " ft");
+ break;
+ case "nauticalMile":
+ (e *= 0.53996),
+ (s = L.GeometryUtil.formattedNumber(e / 1e3, a.nm) + " nm");
+ break;
+ case "yards":
+ default:
+ (e *= 1.09361),
+ (s =
+ e > 1760
+ ? L.GeometryUtil.formattedNumber(e / 1760, a.mi) + " miles"
+ : L.GeometryUtil.formattedNumber(e, a.yd) + " yd");
+ }
+ return s;
+ },
+ isVersion07x: function () {
+ var t = L.version.split(".");
+ return 0 === parseInt(t[0], 10) && 7 === parseInt(t[1], 10);
+ },
+ });
+ })(),
+ L.Util.extend(L.LineUtil, {
+ segmentsIntersect: function (t, e, i, o) {
+ return (
+ this._checkCounterclockwise(t, i, o) !==
+ this._checkCounterclockwise(e, i, o) &&
+ this._checkCounterclockwise(t, e, i) !==
+ this._checkCounterclockwise(t, e, o)
+ );
+ },
+ _checkCounterclockwise: function (t, e, i) {
+ return (i.y - t.y) * (e.x - t.x) > (e.y - t.y) * (i.x - t.x);
+ },
+ }),
+ L.Polyline.include({
+ intersects: function () {
+ var t,
+ e,
+ i,
+ o = this._getProjectedPoints(),
+ n = o ? o.length : 0;
+ if (this._tooFewPointsForIntersection()) return !1;
+ for (t = n - 1; t >= 3; t--)
+ if (
+ ((e = o[t - 1]),
+ (i = o[t]),
+ this._lineSegmentsIntersectsRange(e, i, t - 2))
+ )
+ return !0;
+ return !1;
+ },
+ newLatLngIntersects: function (t, e) {
+ return (
+ !!this._map &&
+ this.newPointIntersects(this._map.latLngToLayerPoint(t), e)
+ );
+ },
+ newPointIntersects: function (t, e) {
+ var i = this._getProjectedPoints(),
+ o = i ? i.length : 0,
+ n = i ? i[o - 1] : null,
+ a = o - 2;
+ return (
+ !this._tooFewPointsForIntersection(1) &&
+ this._lineSegmentsIntersectsRange(n, t, a, e ? 1 : 0)
+ );
+ },
+ _tooFewPointsForIntersection: function (t) {
+ var e = this._getProjectedPoints(),
+ i = e ? e.length : 0;
+ return (i += t || 0), !e || i <= 3;
+ },
+ _lineSegmentsIntersectsRange: function (t, e, i, o) {
+ var n,
+ a,
+ s = this._getProjectedPoints();
+ o = o || 0;
+ for (var r = i; r > o; r--)
+ if (
+ ((n = s[r - 1]),
+ (a = s[r]),
+ L.LineUtil.segmentsIntersect(t, e, n, a))
+ )
+ return !0;
+ return !1;
+ },
+ _getProjectedPoints: function () {
+ if (!this._defaultShape) return this._originalPoints;
+ for (var t = [], e = this._defaultShape(), i = 0; i < e.length; i++)
+ t.push(this._map.latLngToLayerPoint(e[i]));
+ return t;
+ },
+ }),
+ L.Polygon.include({
+ intersects: function () {
+ var t,
+ e,
+ i,
+ o,
+ n = this._getProjectedPoints();
+ return (
+ !this._tooFewPointsForIntersection() &&
+ (!!L.Polyline.prototype.intersects.call(this) ||
+ ((t = n.length),
+ (e = n[0]),
+ (i = n[t - 1]),
+ (o = t - 2),
+ this._lineSegmentsIntersectsRange(i, e, o, 1)))
+ );
+ },
+ }),
+ (L.Control.Draw = L.Control.extend({
+ options: { position: "topleft", draw: {}, edit: !1 },
+ initialize: function (t) {
+ if (L.version < "0.7")
+ throw new Error(
+ "Leaflet.draw 0.2.3+ requires Leaflet 0.7.0+. Download latest from https://github.com/Leaflet/Leaflet/",
+ );
+ L.Control.prototype.initialize.call(this, t);
+ var e;
+ (this._toolbars = {}),
+ L.DrawToolbar &&
+ this.options.draw &&
+ ((e = new L.DrawToolbar(this.options.draw)),
+ (this._toolbars[L.DrawToolbar.TYPE] = e),
+ this._toolbars[L.DrawToolbar.TYPE].on(
+ "enable",
+ this._toolbarEnabled,
+ this,
+ )),
+ L.EditToolbar &&
+ this.options.edit &&
+ ((e = new L.EditToolbar(this.options.edit)),
+ (this._toolbars[L.EditToolbar.TYPE] = e),
+ this._toolbars[L.EditToolbar.TYPE].on(
+ "enable",
+ this._toolbarEnabled,
+ this,
+ )),
+ (L.toolbar = this);
+ },
+ onAdd: function (t) {
+ var e,
+ i = L.DomUtil.create("div", "leaflet-draw"),
+ o = !1;
+ for (var n in this._toolbars)
+ this._toolbars.hasOwnProperty(n) &&
+ (e = this._toolbars[n].addToolbar(t)) &&
+ (o ||
+ (L.DomUtil.hasClass(e, "leaflet-draw-toolbar-top") ||
+ L.DomUtil.addClass(e.childNodes[0], "leaflet-draw-toolbar-top"),
+ (o = !0)),
+ i.appendChild(e));
+ return i;
+ },
+ onRemove: function () {
+ for (var t in this._toolbars)
+ this._toolbars.hasOwnProperty(t) && this._toolbars[t].removeToolbar();
+ },
+ setDrawingOptions: function (t) {
+ for (var e in this._toolbars)
+ this._toolbars[e] instanceof L.DrawToolbar &&
+ this._toolbars[e].setOptions(t);
+ },
+ _toolbarEnabled: function (t) {
+ var e = t.target;
+ for (var i in this._toolbars)
+ this._toolbars[i] !== e && this._toolbars[i].disable();
+ },
+ })),
+ L.Map.mergeOptions({ drawControlTooltips: !0, drawControl: !1 }),
+ L.Map.addInitHook(function () {
+ this.options.drawControl &&
+ ((this.drawControl = new L.Control.Draw()),
+ this.addControl(this.drawControl));
+ }),
+ (L.Toolbar = L.Class.extend({
+ initialize: function (t) {
+ L.setOptions(this, t),
+ (this._modes = {}),
+ (this._actionButtons = []),
+ (this._activeMode = null);
+ var e = L.version.split(".");
+ 1 === parseInt(e[0], 10) && parseInt(e[1], 10) >= 2
+ ? L.Toolbar.include(L.Evented.prototype)
+ : L.Toolbar.include(L.Mixin.Events);
+ },
+ enabled: function () {
+ return null !== this._activeMode;
+ },
+ disable: function () {
+ this.enabled() && this._activeMode.handler.disable();
+ },
+ addToolbar: function (t) {
+ var e,
+ i = L.DomUtil.create("div", "leaflet-draw-section"),
+ o = 0,
+ n = this._toolbarClass || "",
+ a = this.getModeHandlers(t);
+ for (
+ this._toolbarContainer = L.DomUtil.create(
+ "div",
+ "leaflet-draw-toolbar leaflet-bar",
+ ),
+ this._map = t,
+ e = 0;
+ e < a.length;
+ e++
+ )
+ a[e].enabled &&
+ this._initModeHandler(
+ a[e].handler,
+ this._toolbarContainer,
+ o++,
+ n,
+ a[e].title,
+ );
+ if (o)
+ return (
+ (this._lastButtonIndex = --o),
+ (this._actionsContainer = L.DomUtil.create(
+ "ul",
+ "leaflet-draw-actions",
+ )),
+ i.appendChild(this._toolbarContainer),
+ i.appendChild(this._actionsContainer),
+ i
+ );
+ },
+ removeToolbar: function () {
+ for (var t in this._modes)
+ this._modes.hasOwnProperty(t) &&
+ (this._disposeButton(
+ this._modes[t].button,
+ this._modes[t].handler.enable,
+ this._modes[t].handler,
+ ),
+ this._modes[t].handler.disable(),
+ this._modes[t].handler
+ .off("enabled", this._handlerActivated, this)
+ .off("disabled", this._handlerDeactivated, this));
+ this._modes = {};
+ for (var e = 0, i = this._actionButtons.length; e < i; e++)
+ this._disposeButton(
+ this._actionButtons[e].button,
+ this._actionButtons[e].callback,
+ this,
+ );
+ (this._actionButtons = []), (this._actionsContainer = null);
+ },
+ _initModeHandler: function (t, e, i, o, n) {
+ var a = t.type;
+ (this._modes[a] = {}),
+ (this._modes[a].handler = t),
+ (this._modes[a].button = this._createButton({
+ type: a,
+ title: n,
+ className: o + "-" + a,
+ container: e,
+ callback: this._modes[a].handler.enable,
+ context: this._modes[a].handler,
+ })),
+ (this._modes[a].buttonIndex = i),
+ this._modes[a].handler
+ .on("enabled", this._handlerActivated, this)
+ .on("disabled", this._handlerDeactivated, this);
+ },
+ _detectIOS: function () {
+ return /iPad|iPhone|iPod/.test(navigator.userAgent) && !t.MSStream;
+ },
+ _createButton: function (t) {
+ var e = L.DomUtil.create("a", t.className || "", t.container),
+ i = L.DomUtil.create("span", "sr-only", t.container);
+ (e.href = "#"),
+ e.appendChild(i),
+ t.title && ((e.title = t.title), (i.innerHTML = t.title)),
+ t.text && ((e.innerHTML = t.text), (i.innerHTML = t.text));
+ var o = this._detectIOS() ? "touchstart" : "click";
+ return (
+ L.DomEvent.on(e, "click", L.DomEvent.stopPropagation)
+ .on(e, "mousedown", L.DomEvent.stopPropagation)
+ .on(e, "dblclick", L.DomEvent.stopPropagation)
+ .on(e, "touchstart", L.DomEvent.stopPropagation)
+ .on(e, "click", L.DomEvent.preventDefault)
+ .on(e, o, t.callback, t.context),
+ e
+ );
+ },
+ _disposeButton: function (t, e) {
+ var i = this._detectIOS() ? "touchstart" : "click";
+ L.DomEvent.off(t, "click", L.DomEvent.stopPropagation)
+ .off(t, "mousedown", L.DomEvent.stopPropagation)
+ .off(t, "dblclick", L.DomEvent.stopPropagation)
+ .off(t, "touchstart", L.DomEvent.stopPropagation)
+ .off(t, "click", L.DomEvent.preventDefault)
+ .off(t, i, e);
+ },
+ _handlerActivated: function (t) {
+ this.disable(),
+ (this._activeMode = this._modes[t.handler]),
+ L.DomUtil.addClass(
+ this._activeMode.button,
+ "leaflet-draw-toolbar-button-enabled",
+ ),
+ this._showActionsToolbar(),
+ this.fire("enable");
+ },
+ _handlerDeactivated: function () {
+ this._hideActionsToolbar(),
+ L.DomUtil.removeClass(
+ this._activeMode.button,
+ "leaflet-draw-toolbar-button-enabled",
+ ),
+ (this._activeMode = null),
+ this.fire("disable");
+ },
+ _createActions: function (t) {
+ var e,
+ i,
+ o,
+ n,
+ a = this._actionsContainer,
+ s = this.getActions(t),
+ r = s.length;
+ for (i = 0, o = this._actionButtons.length; i < o; i++)
+ this._disposeButton(
+ this._actionButtons[i].button,
+ this._actionButtons[i].callback,
+ );
+ for (this._actionButtons = []; a.firstChild; )
+ a.removeChild(a.firstChild);
+ for (var l = 0; l < r; l++)
+ ("enabled" in s[l] && !s[l].enabled) ||
+ ((e = L.DomUtil.create("li", "", a)),
+ (n = this._createButton({
+ title: s[l].title,
+ text: s[l].text,
+ container: e,
+ callback: s[l].callback,
+ context: s[l].context,
+ })),
+ this._actionButtons.push({ button: n, callback: s[l].callback }));
+ },
+ _showActionsToolbar: function () {
+ var t = this._activeMode.buttonIndex,
+ e = this._lastButtonIndex,
+ i = this._activeMode.button.offsetTop - 1;
+ this._createActions(this._activeMode.handler),
+ (this._actionsContainer.style.top = i + "px"),
+ 0 === t &&
+ (L.DomUtil.addClass(
+ this._toolbarContainer,
+ "leaflet-draw-toolbar-notop",
+ ),
+ L.DomUtil.addClass(
+ this._actionsContainer,
+ "leaflet-draw-actions-top",
+ )),
+ t === e &&
+ (L.DomUtil.addClass(
+ this._toolbarContainer,
+ "leaflet-draw-toolbar-nobottom",
+ ),
+ L.DomUtil.addClass(
+ this._actionsContainer,
+ "leaflet-draw-actions-bottom",
+ )),
+ (this._actionsContainer.style.display = "block"),
+ this._map.fire(L.Draw.Event.TOOLBAROPENED);
+ },
+ _hideActionsToolbar: function () {
+ (this._actionsContainer.style.display = "none"),
+ L.DomUtil.removeClass(
+ this._toolbarContainer,
+ "leaflet-draw-toolbar-notop",
+ ),
+ L.DomUtil.removeClass(
+ this._toolbarContainer,
+ "leaflet-draw-toolbar-nobottom",
+ ),
+ L.DomUtil.removeClass(
+ this._actionsContainer,
+ "leaflet-draw-actions-top",
+ ),
+ L.DomUtil.removeClass(
+ this._actionsContainer,
+ "leaflet-draw-actions-bottom",
+ ),
+ this._map.fire(L.Draw.Event.TOOLBARCLOSED);
+ },
+ })),
+ (L.Draw = L.Draw || {}),
+ (L.Draw.Tooltip = L.Class.extend({
+ initialize: function (t) {
+ (this._map = t),
+ (this._popupPane = t._panes.popupPane),
+ (this._visible = !1),
+ (this._container = t.options.drawControlTooltips
+ ? L.DomUtil.create("div", "leaflet-draw-tooltip", this._popupPane)
+ : null),
+ (this._singleLineLabel = !1),
+ this._map.on("mouseout", this._onMouseOut, this);
+ },
+ dispose: function () {
+ this._map.off("mouseout", this._onMouseOut, this),
+ this._container &&
+ (this._popupPane.removeChild(this._container),
+ (this._container = null));
+ },
+ updateContent: function (t) {
+ return this._container
+ ? ((t.subtext = t.subtext || ""),
+ 0 !== t.subtext.length || this._singleLineLabel
+ ? t.subtext.length > 0 &&
+ this._singleLineLabel &&
+ (L.DomUtil.removeClass(
+ this._container,
+ "leaflet-draw-tooltip-single",
+ ),
+ (this._singleLineLabel = !1))
+ : (L.DomUtil.addClass(
+ this._container,
+ "leaflet-draw-tooltip-single",
+ ),
+ (this._singleLineLabel = !0)),
+ (this._container.innerHTML =
+ (t.subtext.length > 0
+ ? '' +
+ t.subtext +
+ "
"
+ : "") +
+ "" +
+ t.text +
+ ""),
+ t.text || t.subtext
+ ? ((this._visible = !0),
+ (this._container.style.visibility = "inherit"))
+ : ((this._visible = !1),
+ (this._container.style.visibility = "hidden")),
+ this)
+ : this;
+ },
+ updatePosition: function (t) {
+ var e = this._map.latLngToLayerPoint(t),
+ i = this._container;
+ return (
+ this._container &&
+ (this._visible && (i.style.visibility = "inherit"),
+ L.DomUtil.setPosition(i, e)),
+ this
+ );
+ },
+ showAsError: function () {
+ return (
+ this._container &&
+ L.DomUtil.addClass(this._container, "leaflet-error-draw-tooltip"),
+ this
+ );
+ },
+ removeError: function () {
+ return (
+ this._container &&
+ L.DomUtil.removeClass(
+ this._container,
+ "leaflet-error-draw-tooltip",
+ ),
+ this
+ );
+ },
+ _onMouseOut: function () {
+ this._container && (this._container.style.visibility = "hidden");
+ },
+ })),
+ (L.DrawToolbar = L.Toolbar.extend({
+ statics: { TYPE: "draw" },
+ options: {
+ polyline: {},
+ polygon: {},
+ rectangle: {},
+ circle: {},
+ marker: {},
+ circlemarker: {},
+ },
+ initialize: function (t) {
+ for (var e in this.options)
+ this.options.hasOwnProperty(e) &&
+ t[e] &&
+ (t[e] = L.extend({}, this.options[e], t[e]));
+ (this._toolbarClass = "leaflet-draw-draw"),
+ L.Toolbar.prototype.initialize.call(this, t);
+ },
+ getModeHandlers: function (t) {
+ return [
+ {
+ enabled: this.options.polyline,
+ handler: new L.Draw.Polyline(t, this.options.polyline),
+ title: L.drawLocal.draw.toolbar.buttons.polyline,
+ },
+ {
+ enabled: this.options.polygon,
+ handler: new L.Draw.Polygon(t, this.options.polygon),
+ title: L.drawLocal.draw.toolbar.buttons.polygon,
+ },
+ {
+ enabled: this.options.rectangle,
+ handler: new L.Draw.Rectangle(t, this.options.rectangle),
+ title: L.drawLocal.draw.toolbar.buttons.rectangle,
+ },
+ {
+ enabled: this.options.circle,
+ handler: new L.Draw.Circle(t, this.options.circle),
+ title: L.drawLocal.draw.toolbar.buttons.circle,
+ },
+ {
+ enabled: this.options.marker,
+ handler: new L.Draw.Marker(t, this.options.marker),
+ title: L.drawLocal.draw.toolbar.buttons.marker,
+ },
+ {
+ enabled: this.options.circlemarker,
+ handler: new L.Draw.CircleMarker(t, this.options.circlemarker),
+ title: L.drawLocal.draw.toolbar.buttons.circlemarker,
+ },
+ ];
+ },
+ getActions: function (t) {
+ return [
+ {
+ enabled: t.completeShape,
+ title: L.drawLocal.draw.toolbar.finish.title,
+ text: L.drawLocal.draw.toolbar.finish.text,
+ callback: t.completeShape,
+ context: t,
+ },
+ {
+ enabled: t.deleteLastVertex,
+ title: L.drawLocal.draw.toolbar.undo.title,
+ text: L.drawLocal.draw.toolbar.undo.text,
+ callback: t.deleteLastVertex,
+ context: t,
+ },
+ {
+ title: L.drawLocal.draw.toolbar.actions.title,
+ text: L.drawLocal.draw.toolbar.actions.text,
+ callback: this.disable,
+ context: this,
+ },
+ ];
+ },
+ setOptions: function (t) {
+ L.setOptions(this, t);
+ for (var e in this._modes)
+ this._modes.hasOwnProperty(e) &&
+ t.hasOwnProperty(e) &&
+ this._modes[e].handler.setOptions(t[e]);
+ },
+ })),
+ (L.EditToolbar = L.Toolbar.extend({
+ statics: { TYPE: "edit" },
+ options: {
+ edit: {
+ selectedPathOptions: {
+ dashArray: "10, 10",
+ fill: !0,
+ fillColor: "#fe57a1",
+ fillOpacity: 0.1,
+ maintainColor: !1,
+ },
+ },
+ remove: {},
+ poly: null,
+ featureGroup: null,
+ },
+ initialize: function (t) {
+ t.edit &&
+ (void 0 === t.edit.selectedPathOptions &&
+ (t.edit.selectedPathOptions =
+ this.options.edit.selectedPathOptions),
+ (t.edit.selectedPathOptions = L.extend(
+ {},
+ this.options.edit.selectedPathOptions,
+ t.edit.selectedPathOptions,
+ ))),
+ t.remove && (t.remove = L.extend({}, this.options.remove, t.remove)),
+ t.poly && (t.poly = L.extend({}, this.options.poly, t.poly)),
+ (this._toolbarClass = "leaflet-draw-edit"),
+ L.Toolbar.prototype.initialize.call(this, t),
+ (this._selectedFeatureCount = 0);
+ },
+ getModeHandlers: function (t) {
+ var e = this.options.featureGroup;
+ return [
+ {
+ enabled: this.options.edit,
+ handler: new L.EditToolbar.Edit(t, {
+ featureGroup: e,
+ selectedPathOptions: this.options.edit.selectedPathOptions,
+ poly: this.options.poly,
+ }),
+ title: L.drawLocal.edit.toolbar.buttons.edit,
+ },
+ {
+ enabled: this.options.remove,
+ handler: new L.EditToolbar.Delete(t, { featureGroup: e }),
+ title: L.drawLocal.edit.toolbar.buttons.remove,
+ },
+ ];
+ },
+ getActions: function (t) {
+ var e = [
+ {
+ title: L.drawLocal.edit.toolbar.actions.save.title,
+ text: L.drawLocal.edit.toolbar.actions.save.text,
+ callback: this._save,
+ context: this,
+ },
+ {
+ title: L.drawLocal.edit.toolbar.actions.cancel.title,
+ text: L.drawLocal.edit.toolbar.actions.cancel.text,
+ callback: this.disable,
+ context: this,
+ },
+ ];
+ return (
+ t.removeAllLayers &&
+ e.push({
+ title: L.drawLocal.edit.toolbar.actions.clearAll.title,
+ text: L.drawLocal.edit.toolbar.actions.clearAll.text,
+ callback: this._clearAllLayers,
+ context: this,
+ }),
+ e
+ );
+ },
+ addToolbar: function (t) {
+ var e = L.Toolbar.prototype.addToolbar.call(this, t);
+ return (
+ this._checkDisabled(),
+ this.options.featureGroup.on(
+ "layeradd layerremove",
+ this._checkDisabled,
+ this,
+ ),
+ e
+ );
+ },
+ removeToolbar: function () {
+ this.options.featureGroup.off(
+ "layeradd layerremove",
+ this._checkDisabled,
+ this,
+ ),
+ L.Toolbar.prototype.removeToolbar.call(this);
+ },
+ disable: function () {
+ this.enabled() &&
+ (this._activeMode.handler.revertLayers(),
+ L.Toolbar.prototype.disable.call(this));
+ },
+ _save: function () {
+ this._activeMode.handler.save(),
+ this._activeMode && this._activeMode.handler.disable();
+ },
+ _clearAllLayers: function () {
+ this._activeMode.handler.removeAllLayers(),
+ this._activeMode && this._activeMode.handler.disable();
+ },
+ _checkDisabled: function () {
+ var t,
+ e = this.options.featureGroup,
+ i = 0 !== e.getLayers().length;
+ this.options.edit &&
+ ((t = this._modes[L.EditToolbar.Edit.TYPE].button),
+ i
+ ? L.DomUtil.removeClass(t, "leaflet-disabled")
+ : L.DomUtil.addClass(t, "leaflet-disabled"),
+ t.setAttribute(
+ "title",
+ i
+ ? L.drawLocal.edit.toolbar.buttons.edit
+ : L.drawLocal.edit.toolbar.buttons.editDisabled,
+ )),
+ this.options.remove &&
+ ((t = this._modes[L.EditToolbar.Delete.TYPE].button),
+ i
+ ? L.DomUtil.removeClass(t, "leaflet-disabled")
+ : L.DomUtil.addClass(t, "leaflet-disabled"),
+ t.setAttribute(
+ "title",
+ i
+ ? L.drawLocal.edit.toolbar.buttons.remove
+ : L.drawLocal.edit.toolbar.buttons.removeDisabled,
+ ));
+ },
+ })),
+ (L.EditToolbar.Edit = L.Handler.extend({
+ statics: { TYPE: "edit" },
+ initialize: function (t, e) {
+ if (
+ (L.Handler.prototype.initialize.call(this, t),
+ L.setOptions(this, e),
+ (this._featureGroup = e.featureGroup),
+ !(this._featureGroup instanceof L.FeatureGroup))
+ )
+ throw new Error("options.featureGroup must be a L.FeatureGroup");
+ (this._uneditedLayerProps = {}), (this.type = L.EditToolbar.Edit.TYPE);
+ var i = L.version.split(".");
+ 1 === parseInt(i[0], 10) && parseInt(i[1], 10) >= 2
+ ? L.EditToolbar.Edit.include(L.Evented.prototype)
+ : L.EditToolbar.Edit.include(L.Mixin.Events);
+ },
+ enable: function () {
+ !this._enabled &&
+ this._hasAvailableLayers() &&
+ (this.fire("enabled", { handler: this.type }),
+ this._map.fire(L.Draw.Event.EDITSTART, { handler: this.type }),
+ L.Handler.prototype.enable.call(this),
+ this._featureGroup
+ .on("layeradd", this._enableLayerEdit, this)
+ .on("layerremove", this._disableLayerEdit, this));
+ },
+ disable: function () {
+ this._enabled &&
+ (this._featureGroup
+ .off("layeradd", this._enableLayerEdit, this)
+ .off("layerremove", this._disableLayerEdit, this),
+ L.Handler.prototype.disable.call(this),
+ this._map.fire(L.Draw.Event.EDITSTOP, { handler: this.type }),
+ this.fire("disabled", { handler: this.type }));
+ },
+ addHooks: function () {
+ var t = this._map;
+ t &&
+ (t.getContainer().focus(),
+ this._featureGroup.eachLayer(this._enableLayerEdit, this),
+ (this._tooltip = new L.Draw.Tooltip(this._map)),
+ this._tooltip.updateContent({
+ text: L.drawLocal.edit.handlers.edit.tooltip.text,
+ subtext: L.drawLocal.edit.handlers.edit.tooltip.subtext,
+ }),
+ (t._editTooltip = this._tooltip),
+ this._updateTooltip(),
+ this._map
+ .on("mousemove", this._onMouseMove, this)
+ .on("touchmove", this._onMouseMove, this)
+ .on("MSPointerMove", this._onMouseMove, this)
+ .on(L.Draw.Event.EDITVERTEX, this._updateTooltip, this));
+ },
+ removeHooks: function () {
+ this._map &&
+ (this._featureGroup.eachLayer(this._disableLayerEdit, this),
+ (this._uneditedLayerProps = {}),
+ this._tooltip.dispose(),
+ (this._tooltip = null),
+ this._map
+ .off("mousemove", this._onMouseMove, this)
+ .off("touchmove", this._onMouseMove, this)
+ .off("MSPointerMove", this._onMouseMove, this)
+ .off(L.Draw.Event.EDITVERTEX, this._updateTooltip, this));
+ },
+ revertLayers: function () {
+ this._featureGroup.eachLayer(function (t) {
+ this._revertLayer(t);
+ }, this);
+ },
+ save: function () {
+ var t = new L.LayerGroup();
+ this._featureGroup.eachLayer(function (e) {
+ e.edited && (t.addLayer(e), (e.edited = !1));
+ }),
+ this._map.fire(L.Draw.Event.EDITED, { layers: t });
+ },
+ _backupLayer: function (t) {
+ var e = L.Util.stamp(t);
+ this._uneditedLayerProps[e] ||
+ (t instanceof L.Polyline ||
+ t instanceof L.Polygon ||
+ t instanceof L.Rectangle
+ ? (this._uneditedLayerProps[e] = {
+ latlngs: L.LatLngUtil.cloneLatLngs(t.getLatLngs()),
+ })
+ : t instanceof L.Circle
+ ? (this._uneditedLayerProps[e] = {
+ latlng: L.LatLngUtil.cloneLatLng(t.getLatLng()),
+ radius: t.getRadius(),
+ })
+ : (t instanceof L.Marker || t instanceof L.CircleMarker) &&
+ (this._uneditedLayerProps[e] = {
+ latlng: L.LatLngUtil.cloneLatLng(t.getLatLng()),
+ }));
+ },
+ _getTooltipText: function () {
+ return {
+ text: L.drawLocal.edit.handlers.edit.tooltip.text,
+ subtext: L.drawLocal.edit.handlers.edit.tooltip.subtext,
+ };
+ },
+ _updateTooltip: function () {
+ this._tooltip.updateContent(this._getTooltipText());
+ },
+ _revertLayer: function (t) {
+ var e = L.Util.stamp(t);
+ (t.edited = !1),
+ this._uneditedLayerProps.hasOwnProperty(e) &&
+ (t instanceof L.Polyline ||
+ t instanceof L.Polygon ||
+ t instanceof L.Rectangle
+ ? t.setLatLngs(this._uneditedLayerProps[e].latlngs)
+ : t instanceof L.Circle
+ ? (t.setLatLng(this._uneditedLayerProps[e].latlng),
+ t.setRadius(this._uneditedLayerProps[e].radius))
+ : (t instanceof L.Marker || t instanceof L.CircleMarker) &&
+ t.setLatLng(this._uneditedLayerProps[e].latlng),
+ t.fire("revert-edited", { layer: t }));
+ },
+ _enableLayerEdit: function (t) {
+ var e,
+ i,
+ o = t.layer || t.target || t;
+ this._backupLayer(o),
+ this.options.poly &&
+ ((i = L.Util.extend({}, this.options.poly)), (o.options.poly = i)),
+ this.options.selectedPathOptions &&
+ ((e = L.Util.extend({}, this.options.selectedPathOptions)),
+ e.maintainColor &&
+ ((e.color = o.options.color),
+ (e.fillColor = o.options.fillColor)),
+ (o.options.original = L.extend({}, o.options)),
+ (o.options.editing = e)),
+ o instanceof L.Marker
+ ? (o.editing && o.editing.enable(),
+ o.dragging.enable(),
+ o
+ .on("dragend", this._onMarkerDragEnd)
+ .on("touchmove", this._onTouchMove, this)
+ .on("MSPointerMove", this._onTouchMove, this)
+ .on("touchend", this._onMarkerDragEnd, this)
+ .on("MSPointerUp", this._onMarkerDragEnd, this))
+ : o.editing.enable();
+ },
+ _disableLayerEdit: function (t) {
+ var e = t.layer || t.target || t;
+ (e.edited = !1),
+ e.editing && e.editing.disable(),
+ delete e.options.editing,
+ delete e.options.original,
+ this._selectedPathOptions &&
+ (e instanceof L.Marker
+ ? this._toggleMarkerHighlight(e)
+ : (e.setStyle(e.options.previousOptions),
+ delete e.options.previousOptions)),
+ e instanceof L.Marker
+ ? (e.dragging.disable(),
+ e
+ .off("dragend", this._onMarkerDragEnd, this)
+ .off("touchmove", this._onTouchMove, this)
+ .off("MSPointerMove", this._onTouchMove, this)
+ .off("touchend", this._onMarkerDragEnd, this)
+ .off("MSPointerUp", this._onMarkerDragEnd, this))
+ : e.editing.disable();
+ },
+ _onMouseMove: function (t) {
+ this._tooltip.updatePosition(t.latlng);
+ },
+ _onMarkerDragEnd: function (t) {
+ var e = t.target;
+ (e.edited = !0), this._map.fire(L.Draw.Event.EDITMOVE, { layer: e });
+ },
+ _onTouchMove: function (t) {
+ var e = t.originalEvent.changedTouches[0],
+ i = this._map.mouseEventToLayerPoint(e),
+ o = this._map.layerPointToLatLng(i);
+ t.target.setLatLng(o);
+ },
+ _hasAvailableLayers: function () {
+ return 0 !== this._featureGroup.getLayers().length;
+ },
+ })),
+ (L.EditToolbar.Delete = L.Handler.extend({
+ statics: { TYPE: "remove" },
+ initialize: function (t, e) {
+ if (
+ (L.Handler.prototype.initialize.call(this, t),
+ L.Util.setOptions(this, e),
+ (this._deletableLayers = this.options.featureGroup),
+ !(this._deletableLayers instanceof L.FeatureGroup))
+ )
+ throw new Error("options.featureGroup must be a L.FeatureGroup");
+ this.type = L.EditToolbar.Delete.TYPE;
+ var i = L.version.split(".");
+ 1 === parseInt(i[0], 10) && parseInt(i[1], 10) >= 2
+ ? L.EditToolbar.Delete.include(L.Evented.prototype)
+ : L.EditToolbar.Delete.include(L.Mixin.Events);
+ },
+ enable: function () {
+ !this._enabled &&
+ this._hasAvailableLayers() &&
+ (this.fire("enabled", { handler: this.type }),
+ this._map.fire(L.Draw.Event.DELETESTART, { handler: this.type }),
+ L.Handler.prototype.enable.call(this),
+ this._deletableLayers
+ .on("layeradd", this._enableLayerDelete, this)
+ .on("layerremove", this._disableLayerDelete, this));
+ },
+ disable: function () {
+ this._enabled &&
+ (this._deletableLayers
+ .off("layeradd", this._enableLayerDelete, this)
+ .off("layerremove", this._disableLayerDelete, this),
+ L.Handler.prototype.disable.call(this),
+ this._map.fire(L.Draw.Event.DELETESTOP, { handler: this.type }),
+ this.fire("disabled", { handler: this.type }));
+ },
+ addHooks: function () {
+ var t = this._map;
+ t &&
+ (t.getContainer().focus(),
+ this._deletableLayers.eachLayer(this._enableLayerDelete, this),
+ (this._deletedLayers = new L.LayerGroup()),
+ (this._tooltip = new L.Draw.Tooltip(this._map)),
+ this._tooltip.updateContent({
+ text: L.drawLocal.edit.handlers.remove.tooltip.text,
+ }),
+ this._map.on("mousemove", this._onMouseMove, this));
+ },
+ removeHooks: function () {
+ this._map &&
+ (this._deletableLayers.eachLayer(this._disableLayerDelete, this),
+ (this._deletedLayers = null),
+ this._tooltip.dispose(),
+ (this._tooltip = null),
+ this._map.off("mousemove", this._onMouseMove, this));
+ },
+ revertLayers: function () {
+ this._deletedLayers.eachLayer(function (t) {
+ this._deletableLayers.addLayer(t),
+ t.fire("revert-deleted", { layer: t });
+ }, this);
+ },
+ save: function () {
+ this._map.fire(L.Draw.Event.DELETED, { layers: this._deletedLayers });
+ },
+ removeAllLayers: function () {
+ this._deletableLayers.eachLayer(function (t) {
+ this._removeLayer({ layer: t });
+ }, this),
+ this.save();
+ },
+ _enableLayerDelete: function (t) {
+ (t.layer || t.target || t).on("click", this._removeLayer, this);
+ },
+ _disableLayerDelete: function (t) {
+ var e = t.layer || t.target || t;
+ e.off("click", this._removeLayer, this),
+ this._deletedLayers.removeLayer(e);
+ },
+ _removeLayer: function (t) {
+ var e = t.layer || t.target || t;
+ this._deletableLayers.removeLayer(e),
+ this._deletedLayers.addLayer(e),
+ e.fire("deleted");
+ },
+ _onMouseMove: function (t) {
+ this._tooltip.updatePosition(t.latlng);
+ },
+ _hasAvailableLayers: function () {
+ return 0 !== this._deletableLayers.getLayers().length;
+ },
+ }));
+})(window, document);
diff --git a/composer.json b/composer.json
new file mode 100644
index 00000000..cbec3397
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,13 @@
+{
+ "name": "nsquared-team/draw-attention",
+ "config": {
+ "allow-plugins": {
+ "dealerdirect/phpcodesniffer-composer-installer": true
+ }
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "*",
+ "phpcompatibility/phpcompatibility-wp": "*",
+ "wp-coding-standards/wpcs": "^3.0"
+ }
+}
diff --git a/composer.lock b/composer.lock
new file mode 100644
index 00000000..0468ac84
--- /dev/null
+++ b/composer.lock
@@ -0,0 +1,583 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "5d5de8a92f9262f412f4846d91031d5e",
+ "packages": [],
+ "packages-dev": [
+ {
+ "name": "dealerdirect/phpcodesniffer-composer-installer",
+ "version": "v1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCSStandards/composer-installer.git",
+ "reference": "4be43904336affa5c2f70744a348312336afd0da"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da",
+ "reference": "4be43904336affa5c2f70744a348312336afd0da",
+ "shasum": ""
+ },
+ "require": {
+ "composer-plugin-api": "^1.0 || ^2.0",
+ "php": ">=5.4",
+ "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0"
+ },
+ "require-dev": {
+ "composer/composer": "*",
+ "ext-json": "*",
+ "ext-zip": "*",
+ "php-parallel-lint/php-parallel-lint": "^1.3.1",
+ "phpcompatibility/php-compatibility": "^9.0",
+ "yoast/phpunit-polyfills": "^1.0"
+ },
+ "type": "composer-plugin",
+ "extra": {
+ "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
+ },
+ "autoload": {
+ "psr-4": {
+ "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Franck Nijhof",
+ "email": "franck.nijhof@dealerdirect.com",
+ "homepage": "http://www.frenck.nl",
+ "role": "Developer / IT Manager"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors"
+ }
+ ],
+ "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
+ "homepage": "http://www.dealerdirect.com",
+ "keywords": [
+ "PHPCodeSniffer",
+ "PHP_CodeSniffer",
+ "code quality",
+ "codesniffer",
+ "composer",
+ "installer",
+ "phpcbf",
+ "phpcs",
+ "plugin",
+ "qa",
+ "quality",
+ "standard",
+ "standards",
+ "style guide",
+ "stylecheck",
+ "tests"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCSStandards/composer-installer/issues",
+ "source": "https://github.com/PHPCSStandards/composer-installer"
+ },
+ "time": "2023-01-05T11:28:13+00:00"
+ },
+ {
+ "name": "phpcompatibility/php-compatibility",
+ "version": "9.3.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
+ "reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
+ "reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3",
+ "squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
+ },
+ "conflict": {
+ "squizlabs/php_codesniffer": "2.6.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
+ },
+ "suggest": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
+ },
+ "type": "phpcodesniffer-standard",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Wim Godden",
+ "homepage": "https://github.com/wimg",
+ "role": "lead"
+ },
+ {
+ "name": "Juliette Reinders Folmer",
+ "homepage": "https://github.com/jrfnl",
+ "role": "lead"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
+ }
+ ],
+ "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
+ "homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
+ "keywords": [
+ "compatibility",
+ "phpcs",
+ "standards"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
+ "source": "https://github.com/PHPCompatibility/PHPCompatibility"
+ },
+ "time": "2019-12-27T09:44:58+00:00"
+ },
+ {
+ "name": "phpcompatibility/phpcompatibility-paragonie",
+ "version": "1.3.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
+ "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/bba5a9dfec7fcfbd679cfaf611d86b4d3759da26",
+ "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26",
+ "shasum": ""
+ },
+ "require": {
+ "phpcompatibility/php-compatibility": "^9.0"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7",
+ "paragonie/random_compat": "dev-master",
+ "paragonie/sodium_compat": "dev-master"
+ },
+ "suggest": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
+ },
+ "type": "phpcodesniffer-standard",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Wim Godden",
+ "role": "lead"
+ },
+ {
+ "name": "Juliette Reinders Folmer",
+ "role": "lead"
+ }
+ ],
+ "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
+ "homepage": "http://phpcompatibility.com/",
+ "keywords": [
+ "compatibility",
+ "paragonie",
+ "phpcs",
+ "polyfill",
+ "standards",
+ "static analysis"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues",
+ "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie"
+ },
+ "time": "2022-10-25T01:46:02+00:00"
+ },
+ {
+ "name": "phpcompatibility/phpcompatibility-wp",
+ "version": "2.1.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
+ "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5",
+ "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5",
+ "shasum": ""
+ },
+ "require": {
+ "phpcompatibility/php-compatibility": "^9.0",
+ "phpcompatibility/phpcompatibility-paragonie": "^1.0"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7"
+ },
+ "suggest": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
+ },
+ "type": "phpcodesniffer-standard",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Wim Godden",
+ "role": "lead"
+ },
+ {
+ "name": "Juliette Reinders Folmer",
+ "role": "lead"
+ }
+ ],
+ "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
+ "homepage": "http://phpcompatibility.com/",
+ "keywords": [
+ "compatibility",
+ "phpcs",
+ "standards",
+ "static analysis",
+ "wordpress"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues",
+ "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP"
+ },
+ "time": "2022-10-24T09:00:36+00:00"
+ },
+ {
+ "name": "phpcsstandards/phpcsextra",
+ "version": "1.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCSStandards/PHPCSExtra.git",
+ "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/11d387c6642b6e4acaf0bd9bf5203b8cca1ec489",
+ "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4",
+ "phpcsstandards/phpcsutils": "^1.0.9",
+ "squizlabs/php_codesniffer": "^3.8.0"
+ },
+ "require-dev": {
+ "php-parallel-lint/php-console-highlighter": "^1.0",
+ "php-parallel-lint/php-parallel-lint": "^1.3.2",
+ "phpcsstandards/phpcsdevcs": "^1.1.6",
+ "phpcsstandards/phpcsdevtools": "^1.2.1",
+ "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
+ },
+ "type": "phpcodesniffer-standard",
+ "extra": {
+ "branch-alias": {
+ "dev-stable": "1.x-dev",
+ "dev-develop": "1.x-dev"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Juliette Reinders Folmer",
+ "homepage": "https://github.com/jrfnl",
+ "role": "lead"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors"
+ }
+ ],
+ "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.",
+ "keywords": [
+ "PHP_CodeSniffer",
+ "phpcbf",
+ "phpcodesniffer-standard",
+ "phpcs",
+ "standards",
+ "static analysis"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues",
+ "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy",
+ "source": "https://github.com/PHPCSStandards/PHPCSExtra"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/PHPCSStandards",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/jrfnl",
+ "type": "github"
+ },
+ {
+ "url": "https://opencollective.com/php_codesniffer",
+ "type": "open_collective"
+ }
+ ],
+ "time": "2023-12-08T16:49:07+00:00"
+ },
+ {
+ "name": "phpcsstandards/phpcsutils",
+ "version": "1.0.9",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCSStandards/PHPCSUtils.git",
+ "reference": "908247bc65010c7b7541a9551e002db12e9dae70"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/908247bc65010c7b7541a9551e002db12e9dae70",
+ "reference": "908247bc65010c7b7541a9551e002db12e9dae70",
+ "shasum": ""
+ },
+ "require": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0",
+ "php": ">=5.4",
+ "squizlabs/php_codesniffer": "^3.8.0 || 4.0.x-dev@dev"
+ },
+ "require-dev": {
+ "ext-filter": "*",
+ "php-parallel-lint/php-console-highlighter": "^1.0",
+ "php-parallel-lint/php-parallel-lint": "^1.3.2",
+ "phpcsstandards/phpcsdevcs": "^1.1.6",
+ "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0"
+ },
+ "type": "phpcodesniffer-standard",
+ "extra": {
+ "branch-alias": {
+ "dev-stable": "1.x-dev",
+ "dev-develop": "1.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "PHPCSUtils/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Juliette Reinders Folmer",
+ "homepage": "https://github.com/jrfnl",
+ "role": "lead"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors"
+ }
+ ],
+ "description": "A suite of utility functions for use with PHP_CodeSniffer",
+ "homepage": "https://phpcsutils.com/",
+ "keywords": [
+ "PHP_CodeSniffer",
+ "phpcbf",
+ "phpcodesniffer-standard",
+ "phpcs",
+ "phpcs3",
+ "standards",
+ "static analysis",
+ "tokens",
+ "utility"
+ ],
+ "support": {
+ "docs": "https://phpcsutils.com/",
+ "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues",
+ "security": "https://github.com/PHPCSStandards/PHPCSUtils/security/policy",
+ "source": "https://github.com/PHPCSStandards/PHPCSUtils"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/PHPCSStandards",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/jrfnl",
+ "type": "github"
+ },
+ {
+ "url": "https://opencollective.com/php_codesniffer",
+ "type": "open_collective"
+ }
+ ],
+ "time": "2023-12-08T14:50:00+00:00"
+ },
+ {
+ "name": "squizlabs/php_codesniffer",
+ "version": "3.8.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
+ "reference": "14f5fff1e64118595db5408e946f3a22c75807f7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7",
+ "reference": "14f5fff1e64118595db5408e946f3a22c75807f7",
+ "shasum": ""
+ },
+ "require": {
+ "ext-simplexml": "*",
+ "ext-tokenizer": "*",
+ "ext-xmlwriter": "*",
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4"
+ },
+ "bin": [
+ "bin/phpcbf",
+ "bin/phpcs"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.x-dev"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Greg Sherwood",
+ "role": "Former lead"
+ },
+ {
+ "name": "Juliette Reinders Folmer",
+ "role": "Current lead"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors"
+ }
+ ],
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
+ "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer",
+ "keywords": [
+ "phpcs",
+ "standards",
+ "static analysis"
+ ],
+ "support": {
+ "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues",
+ "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy",
+ "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer",
+ "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/PHPCSStandards",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/jrfnl",
+ "type": "github"
+ },
+ {
+ "url": "https://opencollective.com/php_codesniffer",
+ "type": "open_collective"
+ }
+ ],
+ "time": "2024-01-11T20:47:48+00:00"
+ },
+ {
+ "name": "wp-coding-standards/wpcs",
+ "version": "3.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/WordPress/WordPress-Coding-Standards.git",
+ "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b4caf9689f1a0e4a4c632679a44e638c1c67aff1",
+ "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1",
+ "shasum": ""
+ },
+ "require": {
+ "ext-filter": "*",
+ "ext-libxml": "*",
+ "ext-tokenizer": "*",
+ "ext-xmlreader": "*",
+ "php": ">=5.4",
+ "phpcsstandards/phpcsextra": "^1.1.0",
+ "phpcsstandards/phpcsutils": "^1.0.8",
+ "squizlabs/php_codesniffer": "^3.7.2"
+ },
+ "require-dev": {
+ "php-parallel-lint/php-console-highlighter": "^1.0.0",
+ "php-parallel-lint/php-parallel-lint": "^1.3.2",
+ "phpcompatibility/php-compatibility": "^9.0",
+ "phpcsstandards/phpcsdevtools": "^1.2.0",
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
+ },
+ "suggest": {
+ "ext-iconv": "For improved results",
+ "ext-mbstring": "For improved results"
+ },
+ "type": "phpcodesniffer-standard",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors"
+ }
+ ],
+ "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
+ "keywords": [
+ "phpcs",
+ "standards",
+ "static analysis",
+ "wordpress"
+ ],
+ "support": {
+ "issues": "https://github.com/WordPress/WordPress-Coding-Standards/issues",
+ "source": "https://github.com/WordPress/WordPress-Coding-Standards",
+ "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki"
+ },
+ "funding": [
+ {
+ "url": "https://opencollective.com/thewpcc/contribute/wp-php-63406",
+ "type": "custom"
+ }
+ ],
+ "time": "2023-09-14T07:06:09+00:00"
+ }
+ ],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": [],
+ "plugin-api-version": "2.3.0"
+}
diff --git a/draw-attention.php b/draw-attention.php
index 4b1f60f7..244ec974 100644
--- a/draw-attention.php
+++ b/draw-attention.php
@@ -24,7 +24,8 @@
die;
}
-/*----------------------------------------------------------------------------*
+/*
+----------------------------------------------------------------------------*
* Public-Facing Functionality
*----------------------------------------------------------------------------*/
@@ -34,7 +35,7 @@
* - replace `class-drawattention.php` with the name of the plugin's class file
*
*/
-require_once( plugin_dir_path( __FILE__ ) . 'public/class-drawattention.php' );
+require_once plugin_dir_path( __FILE__ ) . 'public/class-drawattention.php';
/*
* Register hooks that are fired when the plugin is activated or deactivated.
@@ -56,7 +57,8 @@
*/
add_action( 'plugins_loaded', array( 'DrawAttention', 'get_instance' ) );
-/*----------------------------------------------------------------------------*
+/*
+----------------------------------------------------------------------------*
* Dashboard and Administrative Functionality
*----------------------------------------------------------------------------*/
@@ -78,7 +80,7 @@
*/
if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
- require_once( plugin_dir_path( __FILE__ ) . 'admin/class-drawattention-admin.php' );
+ require_once plugin_dir_path( __FILE__ ) . 'admin/class-drawattention-admin.php';
add_action( 'plugins_loaded', array( 'DrawAttention_Admin', 'get_instance' ) );
}
@@ -90,13 +92,12 @@
* Please check your list of active plugins to see if you have the Responsive Image Maps plugin installed and activated. If so, we regretfully recommend deactivating this plugin.
* It has been abandoned and has not been updated since 2015.
* Here is a link to our public ticket asking the plugin author to update their plugin: https://wordpress.org/support/topic/conflict-with-draw-attention-plugin-2/
- *
+ *
* Our final solution is to dequeue the Responsive Image Maps plugin’s script if it is active.
* And tell WordPress to not load RIM plugin
- *
*/
-function da_dequeue_conflicting_rim_scripts(){
-
+function da_dequeue_conflicting_rim_scripts() {
+
if ( ! function_exists( 'pn_rim_enqueue_scripts' ) ) {
return;
}
@@ -104,14 +105,14 @@ function da_dequeue_conflicting_rim_scripts(){
wp_dequeue_script( 'jQuery.rwd_image_maps' );
}
-function da_disable_rim_plugin(){
-
+function da_disable_rim_plugin() {
+
if ( ! function_exists( 'pn_rim_enqueue_scripts' ) ) {
return;
}
-
+
remove_action( 'wp_head', 'pn_rim_header_scripts' );
}
-add_action('init', 'da_disable_rim_plugin');
-add_action('wp_enqueue_scripts', 'da_dequeue_conflicting_rim_scripts', 999 );
\ No newline at end of file
+add_action( 'init', 'da_disable_rim_plugin' );
+add_action( 'wp_enqueue_scripts', 'da_dequeue_conflicting_rim_scripts', 999 );
diff --git a/external/actions-scripts/format-changelog.php b/external/actions-scripts/format-changelog.php
index f44a2606..3577b861 100644
--- a/external/actions-scripts/format-changelog.php
+++ b/external/actions-scripts/format-changelog.php
@@ -3,97 +3,97 @@
// Note: this script is expected to return a stringified JSON representation of the slack message
// avoid any echo or print commands other than the final one
-define('CHANGELOG_JSON', getenv('CHANGELOG_JSON'));
-define('CHANGELOG_STRING', getenv('CHANGELOG_STRING'));
-define('PROJECT', getenv('PROJECT'));
+define( 'CHANGELOG_JSON', getenv( 'CHANGELOG_JSON' ) );
+define( 'CHANGELOG_STRING', getenv( 'CHANGELOG_STRING' ) );
+define( 'PROJECT', getenv( 'PROJECT' ) );
$values = getopt(
'',
array(
'version:',
'repo:',
- 'out:'
+ 'out:',
)
);
-if (!isset($values["version"])) {
- echo "version is empty!";
- exit(1);
+if ( ! isset( $values['version'] ) ) {
+ echo 'version is empty!';
+ exit( 1 );
}
-if (!isset($values["repo"])) {
- echo "repo is empty!";
- exit(1);
+if ( ! isset( $values['repo'] ) ) {
+ echo 'repo is empty!';
+ exit( 1 );
}
-if (!isset($values["out"])) {
- echo "out is empty! please specify output filename";
- exit(1);
+if ( ! isset( $values['out'] ) ) {
+ echo 'out is empty! please specify output filename';
+ exit( 1 );
}
-$slack_payload_blocks = [
- [
- "type" => "divider"
- ],
- [
- "type" => "header",
- "text" => [
- "type" => "plain_text",
- "text" => PROJECT." GitHub Release.\n"
- ]
- ],
- [
- "type" => "section",
- "text" => [
- "type" => "mrkdwn",
- "text" => "You can
Error: ' + errorMsg + '
Line ' + lineNumber + ': ' + url);
- }
- return false;
-}
+window.onerror = function (errorMsg, url, lineNumber) {
+ // This should be a fun little experiement!
+ var errorBox = jQuery(".da-error").show();
+ if (errorBox.length) {
+ var contents = errorBox.html();
+ errorBox.html(
+ contents +
+ "
Error: " +
+ errorMsg +
+ "
Line " +
+ lineNumber +
+ ": " +
+ url,
+ );
+ }
+ return false;
+};
/* Fix for Elementor bug - duplicating DA images when popup opens */
-jQuery(document).on('elementor/popup/show', () => {
- setTimeout(function(){
- var imageContainers = jQuery('.hotspots-image-container');
- imageContainers.each(function(){
- var extraMapContainers = jQuery(this).find('.hotspots-map-container:not(:first)').remove(); // find all but the first one and remove them
- });
- }, 250);
-} );
+jQuery(document).on("elementor/popup/show", () => {
+ setTimeout(function () {
+ var imageContainers = jQuery(".hotspots-image-container");
+ imageContainers.each(function () {
+ var extraMapContainers = jQuery(this)
+ .find(".hotspots-map-container:not(:first)")
+ .remove(); // find all but the first one and remove them
+ });
+ }, 250);
+});
diff --git a/public/class-drawattention.php b/public/class-drawattention.php
index b563977c..b2d5cebf 100644
--- a/public/class-drawattention.php
+++ b/public/class-drawattention.php
@@ -21,7 +21,7 @@
* @package DrawAttention
* @author Nathan Tyler Your server is out of date
Draw Attention (and many other WP plugins) requires PHP version 5.3 or higher. PHP 5.2 was released back in 2006 and support was officially terminated in 2011.
@@ -365,9 +364,9 @@ function php_52_notice() {
$message
$message
$message
$message
It looks like there is a JavaScript error in a plugin or theme that is causing a conflict with Draw Attention. For more information on troubleshooting this issue, please see our help page.