From fb65fea6e483a4bb43f404d7134b38f2205303b8 Mon Sep 17 00:00:00 2001
From: hsein-bitar
Date: Tue, 13 Feb 2024 16:44:59 +0200
Subject: [PATCH 01/12] initial workflow to format the code in the CI pipline
---
.github/workflows/ci.yml | 96 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 96 insertions(+)
create mode 100644 .github/workflows/ci.yml
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..b0da9ba
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,96 @@
+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
+ runs-on: ubuntu-latest
+ env:
+ phpcs_config_flags: --standard=WordPress --ignore=vendor,node_modules --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
+ cd admin-app && npm install && cd ..
+
+ # =================================================================================================#
+ # 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"
+
+ - name: Format Vue files
+ run: prettier --write "**/*.vue"
+
+ - name: Lint JS files
+ run: eslint --fix "**/*.js" --ignore-pattern "**/vendor/**/*" --ignore-pattern "**/node_modules/**/*"
+
+ - 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: |
+ `git add -A && git commit -m "Automated code formatting on branch done." > /dev/null && git push` || true
From d41a137043dd639d0c2572cfce2bf9564c1f1e94 Mon Sep 17 00:00:00 2001
From: hsein-bitar
Date: Tue, 13 Feb 2024 16:57:44 +0200
Subject: [PATCH 02/12] attempt to ignore minified files
---
.github/workflows/ci.yml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b0da9ba..ef4ce4b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -19,7 +19,7 @@ jobs:
name: Static Code Analysis
runs-on: ubuntu-latest
env:
- phpcs_config_flags: --standard=WordPress --ignore=vendor,node_modules --extensions=php --runtime-set testVersion 7.2
+ 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
@@ -51,7 +51,6 @@ jobs:
npm install
npm install -g prettier
npm install -g eslint
- cd admin-app && npm install && cd ..
# =================================================================================================#
# Run code through PHPCodeSniffer to conform to standards ========================================#
From 59f2856652dd1734f5f92fc438040d306ba82ca4 Mon Sep 17 00:00:00 2001
From: hsein-bitar
Date: Tue, 13 Feb 2024 17:14:43 +0200
Subject: [PATCH 03/12] working solution
---
.github/workflows/ci.yml | 13 +-
.gitignore | 1 +
Gruntfile.js | 404 +-
admin/assets/js/draw-attention-block.js | 55 +-
admin/assets/js/leaflet.draw.js | 2941 ++++++-
composer.json | 13 +
composer.lock | 583 ++
public/assets/js/leaflet.js | 7107 ++++++++++++++++-
public/assets/js/leaflet.responsive.popup.js | 630 +-
public/assets/js/public.js | 1661 ++--
.../includes/lib/CMB2/js/cmb2-char-counter.js | 409 +-
public/includes/lib/CMB2/js/cmb2-wysiwyg.js | 696 +-
public/includes/lib/CMB2/js/cmb2.js | 2830 +++----
.../lib/CMB2/js/wp-color-picker-alpha.js | 999 +--
.../assets/scripts/drag-drop-uploader.js | 247 +-
.../assets/scripts/drag-to-feature.js | 27 +-
16 files changed, 14827 insertions(+), 3789 deletions(-)
create mode 100644 composer.json
create mode 100644 composer.lock
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ef4ce4b..34f010a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -17,6 +17,7 @@ jobs:
# 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
@@ -75,14 +76,16 @@ jobs:
- name: Format JS files
run: prettier --write "**/*.js"
- - name: Format Vue files
- run: prettier --write "**/*.vue"
+ # 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/**/*"
- - name: Lint Vue files
- run: eslint --fix "**/*.vue" --ignore-pattern "**/vendor/**/*" --ignore-pattern "**/node_modules/**/*"
+ # 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: |
@@ -92,4 +95,6 @@ jobs:
# 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 a81060c..06568d8 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/Gruntfile.js b/Gruntfile.js
index d918398..b67aa6d 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 cd580f6..15a375c 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 2fe040b..e56a5b2 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+=" "+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;et&&(i._index+=e)})},_createMiddleMarker:function(t,e){var i,o,n,a=this._getMiddleLatLng(t,e),s=this._createMarker(a);s.setOpacity(.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 "+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;i0)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;i2){for(var s=0;s1&&(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/=.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*=.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=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;e0&&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:.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 0000000..cbec339
--- /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 0000000..0468ac8
--- /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/public/assets/js/leaflet.js b/public/assets/js/leaflet.js
index f914d94..175efa5 100644
--- a/public/assets/js/leaflet.js
+++ b/public/assets/js/leaflet.js
@@ -2,4 +2,7109 @@
* Leaflet 1.5.1, a JS library for interactive maps. http://leafletjs.com
* (c) 2010-2018 Vladimir Agafonkin, (c) 2010-2011 CloudMade
*/
-!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i(t.L={})}(this,function(t){"use strict";var i=Object.freeze;function h(t){var i,e,n,o;for(e=1,n=arguments.length;e=this.min.x&&e.x<=this.max.x&&i.y>=this.min.y&&e.y<=this.max.y},intersects:function(t){t=R(t);var i=this.min,e=this.max,n=t.min,o=t.max,s=o.x>=i.x&&n.x<=e.x,r=o.y>=i.y&&n.y<=e.y;return s&&r},overlaps:function(t){t=R(t);var i=this.min,e=this.max,n=t.min,o=t.max,s=o.x>i.x&&n.xi.y&&n.y=n.lat&&e.lat<=o.lat&&i.lng>=n.lng&&e.lng<=o.lng},intersects:function(t){t=D(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=i.lat&&n.lat<=e.lat,r=o.lng>=i.lng&&n.lng<=e.lng;return s&&r},overlaps:function(t){t=D(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>i.lat&&n.lati.lng&&n.lng ';var i=t.firstChild;return i.style.behavior="url(#default#VML)",i&&"object"==typeof i.adj}catch(t){return!1}}();function kt(t){return 0<=navigator.userAgent.toLowerCase().indexOf(t)}var Bt=(Object.freeze||Object)({ie:it,ielt9:et,edge:nt,webkit:ot,android:st,android23:rt,androidStock:ht,opera:ut,chrome:lt,gecko:ct,safari:_t,phantom:dt,opera12:pt,win:mt,ie3d:ft,webkit3d:gt,gecko3d:vt,any3d:yt,mobile:xt,mobileWebkit:wt,mobileWebkit3d:Pt,msPointer:Lt,pointer:bt,touch:Tt,mobileOpera:zt,mobileGecko:Mt,retina:Ct,canvas:St,svg:Zt,vml:Et}),At=Lt?"MSPointerDown":"pointerdown",It=Lt?"MSPointerMove":"pointermove",Ot=Lt?"MSPointerUp":"pointerup",Rt=Lt?"MSPointerCancel":"pointercancel",Nt=["INPUT","SELECT","OPTION"],Dt={},jt=!1,Wt=0;function Ht(t,i,e,n){return"touchstart"===i?function(t,i,e){var n=a(function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(Nt.indexOf(t.target.tagName)<0))return;Di(t)}qt(t,i)});t["_leaflet_touchstart"+e]=n,t.addEventListener(At,n,!1),jt||(document.documentElement.addEventListener(At,Ft,!0),document.documentElement.addEventListener(It,Ut,!0),document.documentElement.addEventListener(Ot,Vt,!0),document.documentElement.addEventListener(Rt,Vt,!0),jt=!0)}(t,e,n):"touchmove"===i?function(t,i,e){var n=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&qt(t,i)};t["_leaflet_touchmove"+e]=n,t.addEventListener(It,n,!1)}(t,e,n):"touchend"===i&&function(t,i,e){var n=function(t){qt(t,i)};t["_leaflet_touchend"+e]=n,t.addEventListener(Ot,n,!1),t.addEventListener(Rt,n,!1)}(t,e,n),this}function Ft(t){Dt[t.pointerId]=t,Wt++}function Ut(t){Dt[t.pointerId]&&(Dt[t.pointerId]=t)}function Vt(t){delete Dt[t.pointerId],Wt--}function qt(t,i){for(var e in t.touches=[],Dt)t.touches.push(Dt[e]);t.changedTouches=[t],i(t)}var Gt=Lt?"MSPointerDown":bt?"pointerdown":"touchstart",Kt=Lt?"MSPointerUp":bt?"pointerup":"touchend",Yt="_leaflet_";function Xt(t,o,i){var s,r,a=!1;function e(t){var i;if(bt){if(!nt||"mouse"===t.pointerType)return;i=Wt}else i=t.touches.length;if(!(1this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,i){this._enforcingBounds=!0;var e=this.getCenter(),n=this._limitCenter(e,this._zoom,D(t));return e.equals(n)||this.panTo(n,i),this._enforcingBounds=!1,this},panInside:function(t,i){var e=I((i=i||{}).paddingTopLeft||i.padding||[0,0]),n=I(i.paddingBottomRight||i.padding||[0,0]),o=this.getCenter(),s=this.project(o),r=this.project(t),a=this.getPixelBounds(),h=a.getSize().divideBy(2),u=R([a.min.add(e),a.max.subtract(n)]);if(!u.contains(r)){this._enforcingBounds=!0;var l=s.subtract(r),c=I(r.x+l.x,r.y+l.y);(r.xu.max.x)&&(c.x=s.x-l.x,0u.max.y)&&(c.y=s.y-l.y,0=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,i){for(var e,n=[],o="mouseout"===i||"mouseover"===i,s=t.target||t.srcElement,r=!1;s;){if((e=this._targets[u(s)])&&("click"===i||"preclick"===i)&&!t._simulated&&this._draggableMoved(e)){r=!0;break}if(e&&e.listens(i,!0)){if(o&&!Ki(s,t))break;if(n.push(e),o)break}if(s===this._container)break;s=s.parentNode}return n.length||r||o||!Ki(s,t)||(n=[this]),n},_handleDOMEvent:function(t){if(this._loaded&&!Gi(t)){var i=t.type;"mousedown"!==i&&"keypress"!==i&&"keyup"!==i&&"keydown"!==i||zi(t.target||t.srcElement),this._fireDOMEvent(t,i)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,i,e){if("click"===t.type){var n=h({},t);n.type="preclick",this._fireDOMEvent(n,n.type,e)}if(!t._stopped&&(e=(e||[]).concat(this._findEventTargets(t,i))).length){var o=e[0];"contextmenu"===i&&o.listens(i,!0)&&Di(t);var s={originalEvent:t};if("keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type){var r=o.getLatLng&&(!o._radius||o._radius<=10);s.containerPoint=r?this.latLngToContainerPoint(o.getLatLng()):this.mouseEventToContainerPoint(t),s.layerPoint=this.containerPointToLayerPoint(s.containerPoint),s.latlng=r?o.getLatLng():this.layerPointToLatLng(s.layerPoint)}for(var a=0;athis.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(i),o=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==e.animate&&!this.getSize().contains(o))&&(M(function(){this._moveStart(!0,!1)._animateZoom(t,i,!0)},this),!0)},_animateZoom:function(t,i,e,n){this._mapPane&&(e&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=i,pi(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:i,noUpdate:n}),setTimeout(a(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&mi(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),M(function(){this._moveEnd(!0)},this))}});function $i(t){return new Qi(t)}var Qi=Z.extend({options:{position:"topright"},initialize:function(t){p(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var i=this._map;return i&&i.removeControl(this),this.options.position=t,i&&i.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var i=this._container=this.onAdd(t),e=this.getPosition(),n=t._controlCorners[e];return pi(i,"leaflet-control"),-1!==e.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(ui(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0 ",n=document.createElement("div");return n.innerHTML=e,n.firstChild},_addItem:function(t){var i,e=document.createElement("label"),n=this._map.hasLayer(t.layer);t.overlay?((i=document.createElement("input")).type="checkbox",i.className="leaflet-control-layers-selector",i.defaultChecked=n):i=this._createRadioElement("leaflet-base-layers_"+u(this),n),this._layerControlInputs.push(i),i.layerId=u(t.layer),Ei(i,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+t.name;var s=document.createElement("div");return e.appendChild(s),s.appendChild(i),s.appendChild(o),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){var t,i,e=this._layerControlInputs,n=[],o=[];this._handlingClick=!0;for(var s=e.length-1;0<=s;s--)t=e[s],i=this._getLayer(t.layerId).layer,t.checked?n.push(i):t.checked||o.push(i);for(s=0;si.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),ie=Qi.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"−",zoomOutTitle:"Zoom out"},onAdd:function(t){var i="leaflet-control-zoom",e=hi("div",i+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,i+"-in",e,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,i+"-out",e,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),e},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,i,e,n,o){var s=hi("a",e,n);return s.innerHTML=t,s.href="#",s.title=i,s.setAttribute("role","button"),s.setAttribute("aria-label",i),Ni(s),Ei(s,"click",ji),Ei(s,"click",o,this),Ei(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,i="leaflet-disabled";mi(this._zoomInButton,i),mi(this._zoomOutButton,i),!this._disabled&&t._zoom!==t.getMinZoom()||pi(this._zoomOutButton,i),!this._disabled&&t._zoom!==t.getMaxZoom()||pi(this._zoomInButton,i)}});Ji.mergeOptions({zoomControl:!0}),Ji.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new ie,this.addControl(this.zoomControl))});var ee=Qi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var i="leaflet-control-scale",e=hi("div",i),n=this.options;return this._addScales(n,i+"-line",e),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),e},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,i,e){t.metric&&(this._mScale=hi("div",i,e)),t.imperial&&(this._iScale=hi("div",i,e))},_update:function(){var t=this._map,i=t.getSize().y/2,e=t.distance(t.containerPointToLatLng([0,i]),t.containerPointToLatLng([this.options.maxWidth,i]));this._updateScales(e)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var i=this._getRoundNum(t),e=i<1e3?i+" m":i/1e3+" km";this._updateScale(this._mScale,e,i/t)},_updateImperial:function(t){var i,e,n,o=3.2808399*t;5280Leaflet '},initialize:function(t){p(this,t),this._attributions={}},onAdd:function(t){for(var i in(t.attributionControl=this)._container=hi("div","leaflet-control-attribution"),Ni(this._container),t._layers)t._layers[i].getAttribution&&this.addAttribution(t._layers[i].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var t=[];for(var i in this._attributions)this._attributions[i]&&t.push(i);var e=[];this.options.prefix&&e.push(this.options.prefix),t.length&&e.push(t.join(", ")),this._container.innerHTML=e.join(" | ")}}});Ji.mergeOptions({attributionControl:!0}),Ji.addInitHook(function(){this.options.attributionControl&&(new ne).addTo(this)});Qi.Layers=te,Qi.Zoom=ie,Qi.Scale=ee,Qi.Attribution=ne,$i.layers=function(t,i,e){return new te(t,i,e)},$i.zoom=function(t){return new ie(t)},$i.scale=function(t){return new ee(t)},$i.attribution=function(t){return new ne(t)};var oe=Z.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}});oe.addTo=function(t,i){return t.addHandler(i,this),this};var se,re={Events:E},ae=Tt?"touchstart mousedown":"mousedown",he={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},ue={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},le=k.extend({options:{clickTolerance:3},initialize:function(t,i,e,n){p(this,n),this._element=t,this._dragStartTarget=i||t,this._preventOutline=e},enable:function(){this._enabled||(Ei(this._dragStartTarget,ae,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(le._dragging===this&&this.finishDrag(),Bi(this._dragStartTarget,ae,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!di(this._element,"leaflet-zoom-anim")&&!(le._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||((le._dragging=this)._preventOutline&&zi(this._element),bi(),$t(),this._moving)))){this.fire("down");var i=t.touches?t.touches[0]:t,e=Ci(this._element);this._startPoint=new B(i.clientX,i.clientY),this._parentScale=Si(e),Ei(document,ue[t.type],this._onMove,this),Ei(document,he[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&1i.max.x&&(e|=2),t.yi.max.y&&(e|=8),e}function fe(t,i,e,n){var o,s=i.x,r=i.y,a=e.x-s,h=e.y-r,u=a*a+h*h;return 0this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()t.y!=n.y>t.y&&t.x<(n.x-e.x)*(t.y-e.y)/(n.y-e.y)+e.x&&(u=!u);return u||De.prototype._containsPoint.call(this,t,!0)}});var We=Ee.extend({initialize:function(t,i){p(this,i),this._layers={},t&&this.addData(t)},addData:function(t){var i,e,n,o=v(t)?t:t.features;if(o){for(i=0,e=o.length;iu.x&&(l=s.x+n-u.x+h.x),s.x-l-a.x<0&&(l=s.x-a.x),s.y+e+h.y>u.y&&(c=s.y+e-u.y+h.y),s.y-c-a.y<0&&(c=s.y-a.y),(l||c)&&t.fire("autopanstart").panBy([l,c])}},_onCloseButtonClick:function(t){this._close(),ji(t)},_getAnchor:function(){return I(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}});Ji.mergeOptions({closePopupOnClick:!0}),Ji.include({openPopup:function(t,i,e){return t instanceof nn||(t=new nn(e).setContent(t)),i&&t.setLatLng(i),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Se.include({bindPopup:function(t,i){return t instanceof nn?(p(t,i),(this._popup=t)._source=this):(this._popup&&!i||(this._popup=new nn(i,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,i){return this._popup&&this._map&&(i=this._popup._prepareOpen(this,t,i),this._map.openPopup(this._popup,i)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var i=t.layer||t.target;this._popup&&this._map&&(ji(t),i instanceof Oe?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===i?this.closePopup():this.openPopup(i,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var on=en.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){en.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){en.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=en.prototype.getEvents.call(this);return Tt&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=hi("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var i=this._map,e=this._container,n=i.latLngToContainerPoint(i.getCenter()),o=i.layerPointToContainerPoint(t),s=this.options.direction,r=e.offsetWidth,a=e.offsetHeight,h=I(this.options.offset),u=this._getAnchor();t="top"===s?t.add(I(-r/2+h.x,-a+h.y+u.y,!0)):"bottom"===s?t.subtract(I(r/2-h.x,-h.y,!0)):"center"===s?t.subtract(I(r/2+h.x,a/2-u.y+h.y,!0)):"right"===s||"auto"===s&&o.xthis.options.maxZoom||ethis.options.maxZoom||void 0!==this.options.minZoom&&oe.max.x)||!i.wrapLat&&(t.ye.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return D(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var i=this._map,e=this.getTileSize(),n=t.scaleBy(e),o=n.add(e);return[i.unproject(n,t.z),i.unproject(o,t.z)]},_tileCoordsToBounds:function(t){var i=this._tileCoordsToNwSe(t),e=new N(i[0],i[1]);return this.options.noWrap||(e=this._map.wrapLatLngBounds(e)),e},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var i=t.split(":"),e=new B(+i[0],+i[1]);return e.z=+i[2],e},_removeTile:function(t){var i=this._tiles[t];i&&(ui(i.el),delete this._tiles[t],this.fire("tileunload",{tile:i.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){pi(t,"leaflet-tile");var i=this.getTileSize();t.style.width=i.x+"px",t.style.height=i.y+"px",t.onselectstart=l,t.onmousemove=l,et&&this.options.opacity<1&&vi(t,this.options.opacity),st&&!rt&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,i){var e=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),a(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&M(a(this._tileReady,this,t,null,o)),wi(o,e),this._tiles[n]={el:o,coords:t,current:!0},i.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,i,e){i&&this.fire("tileerror",{error:i,tile:e,coords:t});var n=this._tileCoordsToKey(t);(e=this._tiles[n])&&(e.loaded=+new Date,this._map._fadeAnimated?(vi(e.el,0),C(this._fadeFrame),this._fadeFrame=M(this._updateOpacity,this)):(e.active=!0,this._pruneTiles()),i||(pi(e.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:e.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),et||!this._map._fadeAnimated?M(this._pruneTiles,this):setTimeout(a(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var i=new B(this._wrapX?r(t.x,this._wrapX):t.x,this._wrapY?r(t.y,this._wrapY):t.y);return i.z=t.z,i},_pxBoundsToTileRange:function(t){var i=this.getTileSize();return new O(t.min.unscaleBy(i).floor(),t.max.unscaleBy(i).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});var an=rn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,i){this._url=t,(i=p(this,i)).detectRetina&&Ct&&0')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),pn={_initContainer:function(){this._container=hi("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(ln.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var i=t._container=dn("shape");pi(i,"leaflet-vml-shape "+(this.options.className||"")),i.coordsize="1 1",t._path=dn("path"),i.appendChild(t._path),this._updateStyle(t),this._layers[u(t)]=t},_addPath:function(t){var i=t._container;this._container.appendChild(i),t.options.interactive&&t.addInteractiveTarget(i)},_removePath:function(t){var i=t._container;ui(i),t.removeInteractiveTarget(i),delete this._layers[u(t)]},_updateStyle:function(t){var i=t._stroke,e=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(i||(i=t._stroke=dn("stroke")),o.appendChild(i),i.weight=n.weight+"px",i.color=n.color,i.opacity=n.opacity,n.dashArray?i.dashStyle=v(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):i.dashStyle="",i.endcap=n.lineCap.replace("butt","flat"),i.joinstyle=n.lineJoin):i&&(o.removeChild(i),t._stroke=null),n.fill?(e||(e=t._fill=dn("fill")),o.appendChild(e),e.color=n.fillColor||n.color,e.opacity=n.fillOpacity):e&&(o.removeChild(e),t._fill=null)},_updateCircle:function(t){var i=t._point.round(),e=Math.round(t._radius),n=Math.round(t._radiusY||e);this._setPath(t,t._empty()?"M0 0":"AL "+i.x+","+i.y+" "+e+","+n+" 0,23592600")},_setPath:function(t,i){t._path.v=i},_bringToFront:function(t){ci(t._container)},_bringToBack:function(t){_i(t._container)}},mn=Et?dn:$,fn=ln.extend({getEvents:function(){var t=ln.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=mn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=mn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ui(this._container),Bi(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){ln.prototype._update.call(this);var t=this._bounds,i=t.getSize(),e=this._container;this._svgSize&&this._svgSize.equals(i)||(this._svgSize=i,e.setAttribute("width",i.x),e.setAttribute("height",i.y)),wi(e,t.min),e.setAttribute("viewBox",[t.min.x,t.min.y,i.x,i.y].join(" ")),this.fire("update")}},_initPath:function(t){var i=t._path=mn("path");t.options.className&&pi(i,t.options.className),t.options.interactive&&pi(i,"leaflet-interactive"),this._updateStyle(t),this._layers[u(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ui(t._path),t.removeInteractiveTarget(t._path),delete this._layers[u(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var i=t._path,e=t.options;i&&(e.stroke?(i.setAttribute("stroke",e.color),i.setAttribute("stroke-opacity",e.opacity),i.setAttribute("stroke-width",e.weight),i.setAttribute("stroke-linecap",e.lineCap),i.setAttribute("stroke-linejoin",e.lineJoin),e.dashArray?i.setAttribute("stroke-dasharray",e.dashArray):i.removeAttribute("stroke-dasharray"),e.dashOffset?i.setAttribute("stroke-dashoffset",e.dashOffset):i.removeAttribute("stroke-dashoffset")):i.setAttribute("stroke","none"),e.fill?(i.setAttribute("fill",e.fillColor||e.color),i.setAttribute("fill-opacity",e.fillOpacity),i.setAttribute("fill-rule",e.fillRule||"evenodd")):i.setAttribute("fill","none"))},_updatePoly:function(t,i){this._setPath(t,Q(t._parts,i))},_updateCircle:function(t){var i=t._point,e=Math.max(Math.round(t._radius),1),n="a"+e+","+(Math.max(Math.round(t._radiusY),1)||e)+" 0 1,0 ",o=t._empty()?"M0 0":"M"+(i.x-e)+","+i.y+n+2*e+",0 "+n+2*-e+",0 ";this._setPath(t,o)},_setPath:function(t,i){t._path.setAttribute("d",i)},_bringToFront:function(t){ci(t._path)},_bringToBack:function(t){_i(t._path)}});function gn(t){return Zt||Et?new fn(t):null}Et&&fn.include(pn),Ji.include({getRenderer:function(t){var i=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return i||(i=this._renderer=this._createRenderer()),this.hasLayer(i)||this.addLayer(i),i},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var i=this._paneRenderers[t];return void 0===i&&(i=this._createRenderer({pane:t}),this._paneRenderers[t]=i),i},_createRenderer:function(t){return this.options.preferCanvas&&_n(t)||gn(t)}});var vn=je.extend({initialize:function(t,i){je.prototype.initialize.call(this,this._boundsToLatLngs(t),i)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=D(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});fn.create=mn,fn.pointsToPath=Q,We.geometryToLayer=He,We.coordsToLatLng=Fe,We.coordsToLatLngs=Ue,We.latLngToCoords=Ve,We.latLngsToCoords=qe,We.getFeature=Ge,We.asFeature=Ke,Ji.mergeOptions({boxZoom:!0});var yn=oe.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){Ei(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Bi(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ui(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),$t(),bi(),this._startPoint=this._map.mouseEventToContainerPoint(t),Ei(document,{contextmenu:ji,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=hi("div","leaflet-zoom-box",this._container),pi(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var i=new O(this._point,this._startPoint),e=i.getSize();wi(this._box,i.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(ui(this._box),mi(this._container,"leaflet-crosshair")),Qt(),Ti(),Bi(document,{contextmenu:ji,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(a(this._resetState,this),0);var i=new N(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(i).fire("boxzoomend",{boxZoomBounds:i})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});Ji.addInitHook("addHandler","boxZoom",yn),Ji.mergeOptions({doubleClickZoom:!0});var xn=oe.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var i=this._map,e=i.getZoom(),n=i.options.zoomDelta,o=t.originalEvent.shiftKey?e-n:e+n;"center"===i.options.doubleClickZoom?i.setZoom(o):i.setZoomAround(t.containerPoint,o)}});Ji.addInitHook("addHandler","doubleClickZoom",xn),Ji.mergeOptions({dragging:!0,inertia:!rt,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var wn=oe.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new le(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}pi(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){mi(this._map._container,"leaflet-grab"),mi(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var i=D(this._map.options.maxBounds);this._offsetLimit=R(this._map.latLngToContainerPoint(i.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(i.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var i=this._lastTime=+new Date,e=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(e),this._times.push(i),this._prunePositions(i)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;1i.max.x&&(t.x=this._viscousLimit(t.x,i.max.x)),t.y>i.max.y&&(t.y=this._viscousLimit(t.y,i.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,i=Math.round(t/2),e=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-i+e)%t+i-e,s=(n+i+e)%t-i-e,r=Math.abs(o+e)i.getMaxZoom()&&1= this.min.x &&
+ e.x <= this.max.x &&
+ i.y >= this.min.y &&
+ e.y <= this.max.y
+ );
+ },
+ intersects: function (t) {
+ t = R(t);
+ var i = this.min,
+ e = this.max,
+ n = t.min,
+ o = t.max,
+ s = o.x >= i.x && n.x <= e.x,
+ r = o.y >= i.y && n.y <= e.y;
+ return s && r;
+ },
+ overlaps: function (t) {
+ t = R(t);
+ var i = this.min,
+ e = this.max,
+ n = t.min,
+ o = t.max,
+ s = o.x > i.x && n.x < e.x,
+ r = o.y > i.y && n.y < e.y;
+ return s && r;
+ },
+ isValid: function () {
+ return !(!this.min || !this.max);
+ },
+ }),
+ (N.prototype = {
+ extend: function (t) {
+ var i,
+ e,
+ n = this._southWest,
+ o = this._northEast;
+ if (t instanceof j) e = i = t;
+ else {
+ if (!(t instanceof N)) return t ? this.extend(W(t) || D(t)) : this;
+ if (((i = t._southWest), (e = t._northEast), !i || !e)) return this;
+ }
+ return (
+ n || o
+ ? ((n.lat = Math.min(i.lat, n.lat)),
+ (n.lng = Math.min(i.lng, n.lng)),
+ (o.lat = Math.max(e.lat, o.lat)),
+ (o.lng = Math.max(e.lng, o.lng)))
+ : ((this._southWest = new j(i.lat, i.lng)),
+ (this._northEast = new j(e.lat, e.lng))),
+ this
+ );
+ },
+ pad: function (t) {
+ var i = this._southWest,
+ e = this._northEast,
+ n = Math.abs(i.lat - e.lat) * t,
+ o = Math.abs(i.lng - e.lng) * t;
+ return new N(new j(i.lat - n, i.lng - o), new j(e.lat + n, e.lng + o));
+ },
+ getCenter: function () {
+ return new j(
+ (this._southWest.lat + this._northEast.lat) / 2,
+ (this._southWest.lng + this._northEast.lng) / 2,
+ );
+ },
+ getSouthWest: function () {
+ return this._southWest;
+ },
+ getNorthEast: function () {
+ return this._northEast;
+ },
+ getNorthWest: function () {
+ return new j(this.getNorth(), this.getWest());
+ },
+ getSouthEast: function () {
+ return new j(this.getSouth(), this.getEast());
+ },
+ getWest: function () {
+ return this._southWest.lng;
+ },
+ getSouth: function () {
+ return this._southWest.lat;
+ },
+ getEast: function () {
+ return this._northEast.lng;
+ },
+ getNorth: function () {
+ return this._northEast.lat;
+ },
+ contains: function (t) {
+ t =
+ "number" == typeof t[0] || t instanceof j || "lat" in t ? W(t) : D(t);
+ var i,
+ e,
+ n = this._southWest,
+ o = this._northEast;
+ return (
+ t instanceof N
+ ? ((i = t.getSouthWest()), (e = t.getNorthEast()))
+ : (i = e = t),
+ i.lat >= n.lat && e.lat <= o.lat && i.lng >= n.lng && e.lng <= o.lng
+ );
+ },
+ intersects: function (t) {
+ t = D(t);
+ var i = this._southWest,
+ e = this._northEast,
+ n = t.getSouthWest(),
+ o = t.getNorthEast(),
+ s = o.lat >= i.lat && n.lat <= e.lat,
+ r = o.lng >= i.lng && n.lng <= e.lng;
+ return s && r;
+ },
+ overlaps: function (t) {
+ t = D(t);
+ var i = this._southWest,
+ e = this._northEast,
+ n = t.getSouthWest(),
+ o = t.getNorthEast(),
+ s = o.lat > i.lat && n.lat < e.lat,
+ r = o.lng > i.lng && n.lng < e.lng;
+ return s && r;
+ },
+ toBBoxString: function () {
+ return [
+ this.getWest(),
+ this.getSouth(),
+ this.getEast(),
+ this.getNorth(),
+ ].join(",");
+ },
+ equals: function (t, i) {
+ return (
+ !!t &&
+ ((t = D(t)),
+ this._southWest.equals(t.getSouthWest(), i) &&
+ this._northEast.equals(t.getNorthEast(), i))
+ );
+ },
+ isValid: function () {
+ return !(!this._southWest || !this._northEast);
+ },
+ });
+ var H,
+ F = {
+ latLngToPoint: function (t, i) {
+ var e = this.projection.project(t),
+ n = this.scale(i);
+ return this.transformation._transform(e, n);
+ },
+ pointToLatLng: function (t, i) {
+ var e = this.scale(i),
+ n = this.transformation.untransform(t, e);
+ return this.projection.unproject(n);
+ },
+ project: function (t) {
+ return this.projection.project(t);
+ },
+ unproject: function (t) {
+ return this.projection.unproject(t);
+ },
+ scale: function (t) {
+ return 256 * Math.pow(2, t);
+ },
+ zoom: function (t) {
+ return Math.log(t / 256) / Math.LN2;
+ },
+ getProjectedBounds: function (t) {
+ if (this.infinite) return null;
+ var i = this.projection.bounds,
+ e = this.scale(t);
+ return new O(
+ this.transformation.transform(i.min, e),
+ this.transformation.transform(i.max, e),
+ );
+ },
+ infinite: !(j.prototype = {
+ equals: function (t, i) {
+ return (
+ !!t &&
+ ((t = W(t)),
+ Math.max(Math.abs(this.lat - t.lat), Math.abs(this.lng - t.lng)) <=
+ (void 0 === i ? 1e-9 : i))
+ );
+ },
+ toString: function (t) {
+ return "LatLng(" + c(this.lat, t) + ", " + c(this.lng, t) + ")";
+ },
+ distanceTo: function (t) {
+ return U.distance(this, W(t));
+ },
+ wrap: function () {
+ return U.wrapLatLng(this);
+ },
+ toBounds: function (t) {
+ var i = (180 * t) / 40075017,
+ e = i / Math.cos((Math.PI / 180) * this.lat);
+ return D([this.lat - i, this.lng - e], [this.lat + i, this.lng + e]);
+ },
+ clone: function () {
+ return new j(this.lat, this.lng, this.alt);
+ },
+ }),
+ wrapLatLng: function (t) {
+ var i = this.wrapLng ? r(t.lng, this.wrapLng, !0) : t.lng;
+ return new j(
+ this.wrapLat ? r(t.lat, this.wrapLat, !0) : t.lat,
+ i,
+ t.alt,
+ );
+ },
+ wrapLatLngBounds: function (t) {
+ var i = t.getCenter(),
+ e = this.wrapLatLng(i),
+ n = i.lat - e.lat,
+ o = i.lng - e.lng;
+ if (0 == n && 0 == o) return t;
+ var s = t.getSouthWest(),
+ r = t.getNorthEast();
+ return new N(new j(s.lat - n, s.lng - o), new j(r.lat - n, r.lng - o));
+ },
+ },
+ U = h({}, F, {
+ wrapLng: [-180, 180],
+ R: 6371e3,
+ distance: function (t, i) {
+ var e = Math.PI / 180,
+ n = t.lat * e,
+ o = i.lat * e,
+ s = Math.sin(((i.lat - t.lat) * e) / 2),
+ r = Math.sin(((i.lng - t.lng) * e) / 2),
+ a = s * s + Math.cos(n) * Math.cos(o) * r * r,
+ h = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
+ return this.R * h;
+ },
+ }),
+ V = 6378137,
+ q = {
+ R: V,
+ MAX_LATITUDE: 85.0511287798,
+ project: function (t) {
+ var i = Math.PI / 180,
+ e = this.MAX_LATITUDE,
+ n = Math.max(Math.min(e, t.lat), -e),
+ o = Math.sin(n * i);
+ return new B(
+ this.R * t.lng * i,
+ (this.R * Math.log((1 + o) / (1 - o))) / 2,
+ );
+ },
+ unproject: function (t) {
+ var i = 180 / Math.PI;
+ return new j(
+ (2 * Math.atan(Math.exp(t.y / this.R)) - Math.PI / 2) * i,
+ (t.x * i) / this.R,
+ );
+ },
+ bounds: ((H = V * Math.PI), new O([-H, -H], [H, H])),
+ };
+ function G(t, i, e, n) {
+ if (v(t))
+ return (
+ (this._a = t[0]),
+ (this._b = t[1]),
+ (this._c = t[2]),
+ void (this._d = t[3])
+ );
+ (this._a = t), (this._b = i), (this._c = e), (this._d = n);
+ }
+ function K(t, i, e, n) {
+ return new G(t, i, e, n);
+ }
+ G.prototype = {
+ transform: function (t, i) {
+ return this._transform(t.clone(), i);
+ },
+ _transform: function (t, i) {
+ return (
+ (i = i || 1),
+ (t.x = i * (this._a * t.x + this._b)),
+ (t.y = i * (this._c * t.y + this._d)),
+ t
+ );
+ },
+ untransform: function (t, i) {
+ return (
+ (i = i || 1),
+ new B((t.x / i - this._b) / this._a, (t.y / i - this._d) / this._c)
+ );
+ },
+ };
+ var Y,
+ X = h({}, U, {
+ code: "EPSG:3857",
+ projection: q,
+ transformation: ((Y = 0.5 / (Math.PI * q.R)), K(Y, 0.5, -Y, 0.5)),
+ }),
+ J = h({}, X, { code: "EPSG:900913" });
+ function $(t) {
+ return document.createElementNS("http://www.w3.org/2000/svg", t);
+ }
+ function Q(t, i) {
+ var e,
+ n,
+ o,
+ s,
+ r,
+ a,
+ h = "";
+ for (e = 0, o = t.length; e < o; e++) {
+ for (n = 0, s = (r = t[e]).length; n < s; n++)
+ h += (n ? "L" : "M") + (a = r[n]).x + " " + a.y;
+ h += i ? (Zt ? "z" : "x") : "";
+ }
+ return h || "M0 0";
+ }
+ var tt = document.documentElement.style,
+ it = "ActiveXObject" in window,
+ et = it && !document.addEventListener,
+ nt = "msLaunchUri" in navigator && !("documentMode" in document),
+ ot = kt("webkit"),
+ st = kt("android"),
+ rt = kt("android 2") || kt("android 3"),
+ at = parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10),
+ ht = st && kt("Google") && at < 537 && !("AudioNode" in window),
+ ut = !!window.opera,
+ lt = kt("chrome"),
+ ct = kt("gecko") && !ot && !ut && !it,
+ _t = !lt && kt("safari"),
+ dt = kt("phantom"),
+ pt = "OTransition" in tt,
+ mt = 0 === navigator.platform.indexOf("Win"),
+ ft = it && "transition" in tt,
+ gt =
+ "WebKitCSSMatrix" in window &&
+ "m11" in new window.WebKitCSSMatrix() &&
+ !rt,
+ vt = "MozPerspective" in tt,
+ yt = !window.L_DISABLE_3D && (ft || gt || vt) && !pt && !dt,
+ xt = "undefined" != typeof orientation || kt("mobile"),
+ wt = xt && ot,
+ Pt = xt && gt,
+ Lt = !window.PointerEvent && window.MSPointerEvent,
+ bt = !(!window.PointerEvent && !Lt),
+ Tt =
+ !window.L_NO_TOUCH &&
+ (bt ||
+ "ontouchstart" in window ||
+ (window.DocumentTouch && document instanceof window.DocumentTouch)),
+ zt = xt && ut,
+ Mt = xt && ct,
+ Ct =
+ 1 <
+ (window.devicePixelRatio ||
+ window.screen.deviceXDPI / window.screen.logicalXDPI),
+ St = !!document.createElement("canvas").getContext,
+ Zt = !(!document.createElementNS || !$("svg").createSVGRect),
+ Et =
+ !Zt &&
+ (function () {
+ try {
+ var t = document.createElement("div");
+ t.innerHTML = ' ';
+ var i = t.firstChild;
+ return (
+ (i.style.behavior = "url(#default#VML)"),
+ i && "object" == typeof i.adj
+ );
+ } catch (t) {
+ return !1;
+ }
+ })();
+ function kt(t) {
+ return 0 <= navigator.userAgent.toLowerCase().indexOf(t);
+ }
+ var Bt = (Object.freeze || Object)({
+ ie: it,
+ ielt9: et,
+ edge: nt,
+ webkit: ot,
+ android: st,
+ android23: rt,
+ androidStock: ht,
+ opera: ut,
+ chrome: lt,
+ gecko: ct,
+ safari: _t,
+ phantom: dt,
+ opera12: pt,
+ win: mt,
+ ie3d: ft,
+ webkit3d: gt,
+ gecko3d: vt,
+ any3d: yt,
+ mobile: xt,
+ mobileWebkit: wt,
+ mobileWebkit3d: Pt,
+ msPointer: Lt,
+ pointer: bt,
+ touch: Tt,
+ mobileOpera: zt,
+ mobileGecko: Mt,
+ retina: Ct,
+ canvas: St,
+ svg: Zt,
+ vml: Et,
+ }),
+ At = Lt ? "MSPointerDown" : "pointerdown",
+ It = Lt ? "MSPointerMove" : "pointermove",
+ Ot = Lt ? "MSPointerUp" : "pointerup",
+ Rt = Lt ? "MSPointerCancel" : "pointercancel",
+ Nt = ["INPUT", "SELECT", "OPTION"],
+ Dt = {},
+ jt = !1,
+ Wt = 0;
+ function Ht(t, i, e, n) {
+ return (
+ "touchstart" === i
+ ? (function (t, i, e) {
+ var n = a(function (t) {
+ if (
+ "mouse" !== t.pointerType &&
+ t.MSPOINTER_TYPE_MOUSE &&
+ t.pointerType !== t.MSPOINTER_TYPE_MOUSE
+ ) {
+ if (!(Nt.indexOf(t.target.tagName) < 0)) return;
+ Di(t);
+ }
+ qt(t, i);
+ });
+ (t["_leaflet_touchstart" + e] = n),
+ t.addEventListener(At, n, !1),
+ jt ||
+ (document.documentElement.addEventListener(At, Ft, !0),
+ document.documentElement.addEventListener(It, Ut, !0),
+ document.documentElement.addEventListener(Ot, Vt, !0),
+ document.documentElement.addEventListener(Rt, Vt, !0),
+ (jt = !0));
+ })(t, e, n)
+ : "touchmove" === i
+ ? (function (t, i, e) {
+ var n = function (t) {
+ ((t.pointerType !== t.MSPOINTER_TYPE_MOUSE &&
+ "mouse" !== t.pointerType) ||
+ 0 !== t.buttons) &&
+ qt(t, i);
+ };
+ (t["_leaflet_touchmove" + e] = n), t.addEventListener(It, n, !1);
+ })(t, e, n)
+ : "touchend" === i &&
+ (function (t, i, e) {
+ var n = function (t) {
+ qt(t, i);
+ };
+ (t["_leaflet_touchend" + e] = n),
+ t.addEventListener(Ot, n, !1),
+ t.addEventListener(Rt, n, !1);
+ })(t, e, n),
+ this
+ );
+ }
+ function Ft(t) {
+ (Dt[t.pointerId] = t), Wt++;
+ }
+ function Ut(t) {
+ Dt[t.pointerId] && (Dt[t.pointerId] = t);
+ }
+ function Vt(t) {
+ delete Dt[t.pointerId], Wt--;
+ }
+ function qt(t, i) {
+ for (var e in ((t.touches = []), Dt)) t.touches.push(Dt[e]);
+ (t.changedTouches = [t]), i(t);
+ }
+ var Gt = Lt ? "MSPointerDown" : bt ? "pointerdown" : "touchstart",
+ Kt = Lt ? "MSPointerUp" : bt ? "pointerup" : "touchend",
+ Yt = "_leaflet_";
+ function Xt(t, o, i) {
+ var s,
+ r,
+ a = !1;
+ function e(t) {
+ var i;
+ if (bt) {
+ if (!nt || "mouse" === t.pointerType) return;
+ i = Wt;
+ } else i = t.touches.length;
+ if (!(1 < i)) {
+ var e = Date.now(),
+ n = e - (s || e);
+ (r = t.touches ? t.touches[0] : t), (a = 0 < n && n <= 250), (s = e);
+ }
+ }
+ function n(t) {
+ if (a && !r.cancelBubble) {
+ if (bt) {
+ if (!nt || "mouse" === t.pointerType) return;
+ var i,
+ e,
+ n = {};
+ for (e in r) (i = r[e]), (n[e] = i && i.bind ? i.bind(r) : i);
+ r = n;
+ }
+ (r.type = "dblclick"), (r.button = 0), o(r), (s = null);
+ }
+ }
+ return (
+ (t[Yt + Gt + i] = e),
+ (t[Yt + Kt + i] = n),
+ (t[Yt + "dblclick" + i] = o),
+ t.addEventListener(Gt, e, !1),
+ t.addEventListener(Kt, n, !1),
+ t.addEventListener("dblclick", o, !1),
+ this
+ );
+ }
+ function Jt(t, i) {
+ var e = t[Yt + Gt + i],
+ n = t[Yt + Kt + i],
+ o = t[Yt + "dblclick" + i];
+ return (
+ t.removeEventListener(Gt, e, !1),
+ t.removeEventListener(Kt, n, !1),
+ nt || t.removeEventListener("dblclick", o, !1),
+ this
+ );
+ }
+ var $t,
+ Qt,
+ ti,
+ ii,
+ ei,
+ ni = yi([
+ "transform",
+ "webkitTransform",
+ "OTransform",
+ "MozTransform",
+ "msTransform",
+ ]),
+ oi = yi([
+ "webkitTransition",
+ "transition",
+ "OTransition",
+ "MozTransition",
+ "msTransition",
+ ]),
+ si =
+ "webkitTransition" === oi || "OTransition" === oi
+ ? oi + "End"
+ : "transitionend";
+ function ri(t) {
+ return "string" == typeof t ? document.getElementById(t) : t;
+ }
+ function ai(t, i) {
+ var e = t.style[i] || (t.currentStyle && t.currentStyle[i]);
+ if ((!e || "auto" === e) && document.defaultView) {
+ var n = document.defaultView.getComputedStyle(t, null);
+ e = n ? n[i] : null;
+ }
+ return "auto" === e ? null : e;
+ }
+ function hi(t, i, e) {
+ var n = document.createElement(t);
+ return (n.className = i || ""), e && e.appendChild(n), n;
+ }
+ function ui(t) {
+ var i = t.parentNode;
+ i && i.removeChild(t);
+ }
+ function li(t) {
+ for (; t.firstChild; ) t.removeChild(t.firstChild);
+ }
+ function ci(t) {
+ var i = t.parentNode;
+ i && i.lastChild !== t && i.appendChild(t);
+ }
+ function _i(t) {
+ var i = t.parentNode;
+ i && i.firstChild !== t && i.insertBefore(t, i.firstChild);
+ }
+ function di(t, i) {
+ if (void 0 !== t.classList) return t.classList.contains(i);
+ var e = gi(t);
+ return 0 < e.length && new RegExp("(^|\\s)" + i + "(\\s|$)").test(e);
+ }
+ function pi(t, i) {
+ if (void 0 !== t.classList)
+ for (var e = d(i), n = 0, o = e.length; n < o; n++) t.classList.add(e[n]);
+ else if (!di(t, i)) {
+ var s = gi(t);
+ fi(t, (s ? s + " " : "") + i);
+ }
+ }
+ function mi(t, i) {
+ void 0 !== t.classList
+ ? t.classList.remove(i)
+ : fi(t, _((" " + gi(t) + " ").replace(" " + i + " ", " ")));
+ }
+ function fi(t, i) {
+ void 0 === t.className.baseVal
+ ? (t.className = i)
+ : (t.className.baseVal = i);
+ }
+ function gi(t) {
+ return (
+ t.correspondingElement && (t = t.correspondingElement),
+ void 0 === t.className.baseVal ? t.className : t.className.baseVal
+ );
+ }
+ function vi(t, i) {
+ "opacity" in t.style
+ ? (t.style.opacity = i)
+ : "filter" in t.style &&
+ (function (t, i) {
+ var e = !1,
+ n = "DXImageTransform.Microsoft.Alpha";
+ try {
+ e = t.filters.item(n);
+ } catch (t) {
+ if (1 === i) return;
+ }
+ (i = Math.round(100 * i)),
+ e
+ ? ((e.Enabled = 100 !== i), (e.Opacity = i))
+ : (t.style.filter += " progid:" + n + "(opacity=" + i + ")");
+ })(t, i);
+ }
+ function yi(t) {
+ for (var i = document.documentElement.style, e = 0; e < t.length; e++)
+ if (t[e] in i) return t[e];
+ return !1;
+ }
+ function xi(t, i, e) {
+ var n = i || new B(0, 0);
+ t.style[ni] =
+ (ft
+ ? "translate(" + n.x + "px," + n.y + "px)"
+ : "translate3d(" + n.x + "px," + n.y + "px,0)") +
+ (e ? " scale(" + e + ")" : "");
+ }
+ function wi(t, i) {
+ (t._leaflet_pos = i),
+ yt ? xi(t, i) : ((t.style.left = i.x + "px"), (t.style.top = i.y + "px"));
+ }
+ function Pi(t) {
+ return t._leaflet_pos || new B(0, 0);
+ }
+ if ("onselectstart" in document)
+ ($t = function () {
+ Ei(window, "selectstart", Di);
+ }),
+ (Qt = function () {
+ Bi(window, "selectstart", Di);
+ });
+ else {
+ var Li = yi([
+ "userSelect",
+ "WebkitUserSelect",
+ "OUserSelect",
+ "MozUserSelect",
+ "msUserSelect",
+ ]);
+ ($t = function () {
+ if (Li) {
+ var t = document.documentElement.style;
+ (ti = t[Li]), (t[Li] = "none");
+ }
+ }),
+ (Qt = function () {
+ Li && ((document.documentElement.style[Li] = ti), (ti = void 0));
+ });
+ }
+ function bi() {
+ Ei(window, "dragstart", Di);
+ }
+ function Ti() {
+ Bi(window, "dragstart", Di);
+ }
+ function zi(t) {
+ for (; -1 === t.tabIndex; ) t = t.parentNode;
+ t.style &&
+ (Mi(),
+ (ei = (ii = t).style.outline),
+ (t.style.outline = "none"),
+ Ei(window, "keydown", Mi));
+ }
+ function Mi() {
+ ii &&
+ ((ii.style.outline = ei), (ei = ii = void 0), Bi(window, "keydown", Mi));
+ }
+ function Ci(t) {
+ for (
+ ;
+ !(
+ ((t = t.parentNode).offsetWidth && t.offsetHeight) ||
+ t === document.body
+ );
+
+ );
+ return t;
+ }
+ function Si(t) {
+ var i = t.getBoundingClientRect();
+ return {
+ x: i.width / t.offsetWidth || 1,
+ y: i.height / t.offsetHeight || 1,
+ boundingClientRect: i,
+ };
+ }
+ var Zi = (Object.freeze || Object)({
+ TRANSFORM: ni,
+ TRANSITION: oi,
+ TRANSITION_END: si,
+ get: ri,
+ getStyle: ai,
+ create: hi,
+ remove: ui,
+ empty: li,
+ toFront: ci,
+ toBack: _i,
+ hasClass: di,
+ addClass: pi,
+ removeClass: mi,
+ setClass: fi,
+ getClass: gi,
+ setOpacity: vi,
+ testProp: yi,
+ setTransform: xi,
+ setPosition: wi,
+ getPosition: Pi,
+ disableTextSelection: $t,
+ enableTextSelection: Qt,
+ disableImageDrag: bi,
+ enableImageDrag: Ti,
+ preventOutline: zi,
+ restoreOutline: Mi,
+ getSizedParentNode: Ci,
+ getScale: Si,
+ });
+ function Ei(t, i, e, n) {
+ if ("object" == typeof i) for (var o in i) Ai(t, o, i[o], e);
+ else for (var s = 0, r = (i = d(i)).length; s < r; s++) Ai(t, i[s], e, n);
+ return this;
+ }
+ var ki = "_leaflet_events";
+ function Bi(t, i, e, n) {
+ if ("object" == typeof i) for (var o in i) Ii(t, o, i[o], e);
+ else if (i)
+ for (var s = 0, r = (i = d(i)).length; s < r; s++) Ii(t, i[s], e, n);
+ else {
+ for (var a in t[ki]) Ii(t, a, t[ki][a]);
+ delete t[ki];
+ }
+ return this;
+ }
+ function Ai(i, t, e, n) {
+ var o = t + u(e) + (n ? "_" + u(n) : "");
+ if (i[ki] && i[ki][o]) return this;
+ var s = function (t) {
+ return e.call(n || i, t || window.event);
+ },
+ r = s;
+ bt && 0 === t.indexOf("touch")
+ ? Ht(i, t, s, o)
+ : !Tt || "dblclick" !== t || (bt && lt)
+ ? "addEventListener" in i
+ ? "mousewheel" === t
+ ? i.addEventListener("onwheel" in i ? "wheel" : "mousewheel", s, !1)
+ : "mouseenter" === t || "mouseleave" === t
+ ? ((s = function (t) {
+ (t = t || window.event), Ki(i, t) && r(t);
+ }),
+ i.addEventListener(
+ "mouseenter" === t ? "mouseover" : "mouseout",
+ s,
+ !1,
+ ))
+ : ("click" === t &&
+ st &&
+ (s = function (t) {
+ !(function (t, i) {
+ var e =
+ t.timeStamp ||
+ (t.originalEvent && t.originalEvent.timeStamp),
+ n = Ui && e - Ui;
+ if (
+ (n && 100 < n && n < 500) ||
+ (t.target._simulatedClick && !t._simulated)
+ )
+ return ji(t);
+ (Ui = e), i(t);
+ })(t, r);
+ }),
+ i.addEventListener(t, s, !1))
+ : "attachEvent" in i && i.attachEvent("on" + t, s)
+ : Xt(i, s, o),
+ (i[ki] = i[ki] || {}),
+ (i[ki][o] = s);
+ }
+ function Ii(t, i, e, n) {
+ var o = i + u(e) + (n ? "_" + u(n) : ""),
+ s = t[ki] && t[ki][o];
+ if (!s) return this;
+ bt && 0 === i.indexOf("touch")
+ ? (function (t, i, e) {
+ var n = t["_leaflet_" + i + e];
+ "touchstart" === i
+ ? t.removeEventListener(At, n, !1)
+ : "touchmove" === i
+ ? t.removeEventListener(It, n, !1)
+ : "touchend" === i &&
+ (t.removeEventListener(Ot, n, !1),
+ t.removeEventListener(Rt, n, !1));
+ })(t, i, o)
+ : !Tt || "dblclick" !== i || (bt && lt)
+ ? "removeEventListener" in t
+ ? "mousewheel" === i
+ ? t.removeEventListener(
+ "onwheel" in t ? "wheel" : "mousewheel",
+ s,
+ !1,
+ )
+ : t.removeEventListener(
+ "mouseenter" === i
+ ? "mouseover"
+ : "mouseleave" === i
+ ? "mouseout"
+ : i,
+ s,
+ !1,
+ )
+ : "detachEvent" in t && t.detachEvent("on" + i, s)
+ : Jt(t, o),
+ (t[ki][o] = null);
+ }
+ function Oi(t) {
+ return (
+ t.stopPropagation
+ ? t.stopPropagation()
+ : t.originalEvent
+ ? (t.originalEvent._stopped = !0)
+ : (t.cancelBubble = !0),
+ Gi(t),
+ this
+ );
+ }
+ function Ri(t) {
+ return Ai(t, "mousewheel", Oi), this;
+ }
+ function Ni(t) {
+ return Ei(t, "mousedown touchstart dblclick", Oi), Ai(t, "click", qi), this;
+ }
+ function Di(t) {
+ return t.preventDefault ? t.preventDefault() : (t.returnValue = !1), this;
+ }
+ function ji(t) {
+ return Di(t), Oi(t), this;
+ }
+ function Wi(t, i) {
+ if (!i) return new B(t.clientX, t.clientY);
+ var e = Si(i),
+ n = e.boundingClientRect;
+ return new B(
+ (t.clientX - n.left) / e.x - i.clientLeft,
+ (t.clientY - n.top) / e.y - i.clientTop,
+ );
+ }
+ var Hi =
+ mt && lt ? 2 * window.devicePixelRatio : ct ? window.devicePixelRatio : 1;
+ function Fi(t) {
+ return nt
+ ? t.wheelDeltaY / 2
+ : t.deltaY && 0 === t.deltaMode
+ ? -t.deltaY / Hi
+ : t.deltaY && 1 === t.deltaMode
+ ? 20 * -t.deltaY
+ : t.deltaY && 2 === t.deltaMode
+ ? 60 * -t.deltaY
+ : t.deltaX || t.deltaZ
+ ? 0
+ : t.wheelDelta
+ ? (t.wheelDeltaY || t.wheelDelta) / 2
+ : t.detail && Math.abs(t.detail) < 32765
+ ? 20 * -t.detail
+ : t.detail
+ ? (t.detail / -32765) * 60
+ : 0;
+ }
+ var Ui,
+ Vi = {};
+ function qi(t) {
+ Vi[t.type] = !0;
+ }
+ function Gi(t) {
+ var i = Vi[t.type];
+ return (Vi[t.type] = !1), i;
+ }
+ function Ki(t, i) {
+ var e = i.relatedTarget;
+ if (!e) return !0;
+ try {
+ for (; e && e !== t; ) e = e.parentNode;
+ } catch (t) {
+ return !1;
+ }
+ return e !== t;
+ }
+ var Yi = (Object.freeze || Object)({
+ on: Ei,
+ off: Bi,
+ stopPropagation: Oi,
+ disableScrollPropagation: Ri,
+ disableClickPropagation: Ni,
+ preventDefault: Di,
+ stop: ji,
+ getMousePosition: Wi,
+ getWheelDelta: Fi,
+ fakeStop: qi,
+ skipped: Gi,
+ isExternalTarget: Ki,
+ addListener: Ei,
+ removeListener: Bi,
+ }),
+ Xi = k.extend({
+ run: function (t, i, e, n) {
+ this.stop(),
+ (this._el = t),
+ (this._inProgress = !0),
+ (this._duration = e || 0.25),
+ (this._easeOutPower = 1 / Math.max(n || 0.5, 0.2)),
+ (this._startPos = Pi(t)),
+ (this._offset = i.subtract(this._startPos)),
+ (this._startTime = +new Date()),
+ this.fire("start"),
+ this._animate();
+ },
+ stop: function () {
+ this._inProgress && (this._step(!0), this._complete());
+ },
+ _animate: function () {
+ (this._animId = M(this._animate, this)), this._step();
+ },
+ _step: function (t) {
+ var i = +new Date() - this._startTime,
+ e = 1e3 * this._duration;
+ i < e
+ ? this._runFrame(this._easeOut(i / e), t)
+ : (this._runFrame(1), this._complete());
+ },
+ _runFrame: function (t, i) {
+ var e = this._startPos.add(this._offset.multiplyBy(t));
+ i && e._round(), wi(this._el, e), this.fire("step");
+ },
+ _complete: function () {
+ C(this._animId), (this._inProgress = !1), this.fire("end");
+ },
+ _easeOut: function (t) {
+ return 1 - Math.pow(1 - t, this._easeOutPower);
+ },
+ }),
+ Ji = k.extend({
+ options: {
+ crs: X,
+ center: void 0,
+ zoom: void 0,
+ minZoom: void 0,
+ maxZoom: void 0,
+ layers: [],
+ maxBounds: void 0,
+ renderer: void 0,
+ zoomAnimation: !0,
+ zoomAnimationThreshold: 4,
+ fadeAnimation: !0,
+ markerZoomAnimation: !0,
+ transform3DLimit: 8388608,
+ zoomSnap: 1,
+ zoomDelta: 1,
+ trackResize: !0,
+ },
+ initialize: function (t, i) {
+ (i = p(this, i)),
+ (this._handlers = []),
+ (this._layers = {}),
+ (this._zoomBoundLayers = {}),
+ (this._sizeChanged = !0),
+ this._initContainer(t),
+ this._initLayout(),
+ (this._onResize = a(this._onResize, this)),
+ this._initEvents(),
+ i.maxBounds && this.setMaxBounds(i.maxBounds),
+ void 0 !== i.zoom && (this._zoom = this._limitZoom(i.zoom)),
+ i.center &&
+ void 0 !== i.zoom &&
+ this.setView(W(i.center), i.zoom, { reset: !0 }),
+ this.callInitHooks(),
+ (this._zoomAnimated = oi && yt && !zt && this.options.zoomAnimation),
+ this._zoomAnimated &&
+ (this._createAnimProxy(),
+ Ei(this._proxy, si, this._catchTransitionEnd, this)),
+ this._addLayers(this.options.layers);
+ },
+ setView: function (t, i, e) {
+ if (
+ ((i = void 0 === i ? this._zoom : this._limitZoom(i)),
+ (t = this._limitCenter(W(t), i, this.options.maxBounds)),
+ (e = e || {}),
+ this._stop(),
+ this._loaded && !e.reset && !0 !== e) &&
+ (void 0 !== e.animate &&
+ ((e.zoom = h({ animate: e.animate }, e.zoom)),
+ (e.pan = h({ animate: e.animate, duration: e.duration }, e.pan))),
+ this._zoom !== i
+ ? this._tryAnimatedZoom && this._tryAnimatedZoom(t, i, e.zoom)
+ : this._tryAnimatedPan(t, e.pan))
+ )
+ return clearTimeout(this._sizeTimer), this;
+ return this._resetView(t, i), this;
+ },
+ setZoom: function (t, i) {
+ return this._loaded
+ ? this.setView(this.getCenter(), t, { zoom: i })
+ : ((this._zoom = t), this);
+ },
+ zoomIn: function (t, i) {
+ return (
+ (t = t || (yt ? this.options.zoomDelta : 1)),
+ this.setZoom(this._zoom + t, i)
+ );
+ },
+ zoomOut: function (t, i) {
+ return (
+ (t = t || (yt ? this.options.zoomDelta : 1)),
+ this.setZoom(this._zoom - t, i)
+ );
+ },
+ setZoomAround: function (t, i, e) {
+ var n = this.getZoomScale(i),
+ o = this.getSize().divideBy(2),
+ s = (t instanceof B ? t : this.latLngToContainerPoint(t))
+ .subtract(o)
+ .multiplyBy(1 - 1 / n),
+ r = this.containerPointToLatLng(o.add(s));
+ return this.setView(r, i, { zoom: e });
+ },
+ _getBoundsCenterZoom: function (t, i) {
+ (i = i || {}), (t = t.getBounds ? t.getBounds() : D(t));
+ var e = I(i.paddingTopLeft || i.padding || [0, 0]),
+ n = I(i.paddingBottomRight || i.padding || [0, 0]),
+ o = this.getBoundsZoom(t, !1, e.add(n));
+ if (
+ (o = "number" == typeof i.maxZoom ? Math.min(i.maxZoom, o) : o) ===
+ 1 / 0
+ )
+ return { center: t.getCenter(), zoom: o };
+ var s = n.subtract(e).divideBy(2),
+ r = this.project(t.getSouthWest(), o),
+ a = this.project(t.getNorthEast(), o);
+ return {
+ center: this.unproject(r.add(a).divideBy(2).add(s), o),
+ zoom: o,
+ };
+ },
+ fitBounds: function (t, i) {
+ if (!(t = D(t)).isValid()) throw new Error("Bounds are not valid.");
+ var e = this._getBoundsCenterZoom(t, i);
+ return this.setView(e.center, e.zoom, i);
+ },
+ fitWorld: function (t) {
+ return this.fitBounds(
+ [
+ [-90, -180],
+ [90, 180],
+ ],
+ t,
+ );
+ },
+ panTo: function (t, i) {
+ return this.setView(t, this._zoom, { pan: i });
+ },
+ panBy: function (t, i) {
+ if (((i = i || {}), !(t = I(t).round()).x && !t.y))
+ return this.fire("moveend");
+ if (!0 !== i.animate && !this.getSize().contains(t))
+ return (
+ this._resetView(
+ this.unproject(this.project(this.getCenter()).add(t)),
+ this.getZoom(),
+ ),
+ this
+ );
+ if (
+ (this._panAnim ||
+ ((this._panAnim = new Xi()),
+ this._panAnim.on(
+ {
+ step: this._onPanTransitionStep,
+ end: this._onPanTransitionEnd,
+ },
+ this,
+ )),
+ i.noMoveStart || this.fire("movestart"),
+ !1 !== i.animate)
+ ) {
+ pi(this._mapPane, "leaflet-pan-anim");
+ var e = this._getMapPanePos().subtract(t).round();
+ this._panAnim.run(
+ this._mapPane,
+ e,
+ i.duration || 0.25,
+ i.easeLinearity,
+ );
+ } else this._rawPanBy(t), this.fire("move").fire("moveend");
+ return this;
+ },
+ flyTo: function (n, o, t) {
+ if (!1 === (t = t || {}).animate || !yt) return this.setView(n, o, t);
+ this._stop();
+ var s = this.project(this.getCenter()),
+ r = this.project(n),
+ i = this.getSize(),
+ a = this._zoom;
+ (n = W(n)), (o = void 0 === o ? a : o);
+ var h = Math.max(i.x, i.y),
+ u = h * this.getZoomScale(a, o),
+ l = r.distanceTo(s) || 1,
+ c = 1.42,
+ _ = c * c;
+ function e(t) {
+ var i =
+ (u * u - h * h + (t ? -1 : 1) * _ * _ * l * l) /
+ (2 * (t ? u : h) * _ * l),
+ e = Math.sqrt(i * i + 1) - i;
+ return e < 1e-9 ? -18 : Math.log(e);
+ }
+ function d(t) {
+ return (Math.exp(t) - Math.exp(-t)) / 2;
+ }
+ function p(t) {
+ return (Math.exp(t) + Math.exp(-t)) / 2;
+ }
+ var m = e(0);
+ function f(t) {
+ return (
+ (h *
+ (p(m) *
+ (function (t) {
+ return d(t) / p(t);
+ })(m + c * t) -
+ d(m))) /
+ _
+ );
+ }
+ var g = Date.now(),
+ v = (e(1) - m) / c,
+ y = t.duration ? 1e3 * t.duration : 1e3 * v * 0.8;
+ return (
+ this._moveStart(!0, t.noMoveStart),
+ function t() {
+ var i = (Date.now() - g) / y,
+ e =
+ (function (t) {
+ return 1 - Math.pow(1 - t, 1.5);
+ })(i) * v;
+ i <= 1
+ ? ((this._flyToFrame = M(t, this)),
+ this._move(
+ this.unproject(s.add(r.subtract(s).multiplyBy(f(e) / l)), a),
+ this.getScaleZoom(
+ h /
+ (function (t) {
+ return h * (p(m) / p(m + c * t));
+ })(e),
+ a,
+ ),
+ { flyTo: !0 },
+ ))
+ : this._move(n, o)._moveEnd(!0);
+ }.call(this),
+ this
+ );
+ },
+ flyToBounds: function (t, i) {
+ var e = this._getBoundsCenterZoom(t, i);
+ return this.flyTo(e.center, e.zoom, i);
+ },
+ setMaxBounds: function (t) {
+ return (t = D(t)).isValid()
+ ? (this.options.maxBounds &&
+ this.off("moveend", this._panInsideMaxBounds),
+ (this.options.maxBounds = t),
+ this._loaded && this._panInsideMaxBounds(),
+ this.on("moveend", this._panInsideMaxBounds))
+ : ((this.options.maxBounds = null),
+ this.off("moveend", this._panInsideMaxBounds));
+ },
+ setMinZoom: function (t) {
+ var i = this.options.minZoom;
+ return (
+ (this.options.minZoom = t),
+ this._loaded &&
+ i !== t &&
+ (this.fire("zoomlevelschange"), this.getZoom() < this.options.minZoom)
+ ? this.setZoom(t)
+ : this
+ );
+ },
+ setMaxZoom: function (t) {
+ var i = this.options.maxZoom;
+ return (
+ (this.options.maxZoom = t),
+ this._loaded &&
+ i !== t &&
+ (this.fire("zoomlevelschange"), this.getZoom() > this.options.maxZoom)
+ ? this.setZoom(t)
+ : this
+ );
+ },
+ panInsideBounds: function (t, i) {
+ this._enforcingBounds = !0;
+ var e = this.getCenter(),
+ n = this._limitCenter(e, this._zoom, D(t));
+ return (
+ e.equals(n) || this.panTo(n, i), (this._enforcingBounds = !1), this
+ );
+ },
+ panInside: function (t, i) {
+ var e = I((i = i || {}).paddingTopLeft || i.padding || [0, 0]),
+ n = I(i.paddingBottomRight || i.padding || [0, 0]),
+ o = this.getCenter(),
+ s = this.project(o),
+ r = this.project(t),
+ a = this.getPixelBounds(),
+ h = a.getSize().divideBy(2),
+ u = R([a.min.add(e), a.max.subtract(n)]);
+ if (!u.contains(r)) {
+ this._enforcingBounds = !0;
+ var l = s.subtract(r),
+ c = I(r.x + l.x, r.y + l.y);
+ (r.x < u.min.x || r.x > u.max.x) &&
+ ((c.x = s.x - l.x),
+ 0 < l.x ? (c.x += h.x - e.x) : (c.x -= h.x - n.x)),
+ (r.y < u.min.y || r.y > u.max.y) &&
+ ((c.y = s.y - l.y),
+ 0 < l.y ? (c.y += h.y - e.y) : (c.y -= h.y - n.y)),
+ this.panTo(this.unproject(c), i),
+ (this._enforcingBounds = !1);
+ }
+ return this;
+ },
+ invalidateSize: function (t) {
+ if (!this._loaded) return this;
+ t = h({ animate: !1, pan: !0 }, !0 === t ? { animate: !0 } : t);
+ var i = this.getSize();
+ (this._sizeChanged = !0), (this._lastCenter = null);
+ var e = this.getSize(),
+ n = i.divideBy(2).round(),
+ o = e.divideBy(2).round(),
+ s = n.subtract(o);
+ return s.x || s.y
+ ? (t.animate && t.pan
+ ? this.panBy(s)
+ : (t.pan && this._rawPanBy(s),
+ this.fire("move"),
+ t.debounceMoveend
+ ? (clearTimeout(this._sizeTimer),
+ (this._sizeTimer = setTimeout(
+ a(this.fire, this, "moveend"),
+ 200,
+ )))
+ : this.fire("moveend")),
+ this.fire("resize", { oldSize: i, newSize: e }))
+ : this;
+ },
+ stop: function () {
+ return (
+ this.setZoom(this._limitZoom(this._zoom)),
+ this.options.zoomSnap || this.fire("viewreset"),
+ this._stop()
+ );
+ },
+ locate: function (t) {
+ if (
+ ((t = this._locateOptions = h({ timeout: 1e4, watch: !1 }, t)),
+ !("geolocation" in navigator))
+ )
+ return (
+ this._handleGeolocationError({
+ code: 0,
+ message: "Geolocation not supported.",
+ }),
+ this
+ );
+ var i = a(this._handleGeolocationResponse, this),
+ e = a(this._handleGeolocationError, this);
+ return (
+ t.watch
+ ? (this._locationWatchId = navigator.geolocation.watchPosition(
+ i,
+ e,
+ t,
+ ))
+ : navigator.geolocation.getCurrentPosition(i, e, t),
+ this
+ );
+ },
+ stopLocate: function () {
+ return (
+ navigator.geolocation &&
+ navigator.geolocation.clearWatch &&
+ navigator.geolocation.clearWatch(this._locationWatchId),
+ this._locateOptions && (this._locateOptions.setView = !1),
+ this
+ );
+ },
+ _handleGeolocationError: function (t) {
+ var i = t.code,
+ e =
+ t.message ||
+ (1 === i
+ ? "permission denied"
+ : 2 === i
+ ? "position unavailable"
+ : "timeout");
+ this._locateOptions.setView && !this._loaded && this.fitWorld(),
+ this.fire("locationerror", {
+ code: i,
+ message: "Geolocation error: " + e + ".",
+ });
+ },
+ _handleGeolocationResponse: function (t) {
+ var i = new j(t.coords.latitude, t.coords.longitude),
+ e = i.toBounds(2 * t.coords.accuracy),
+ n = this._locateOptions;
+ if (n.setView) {
+ var o = this.getBoundsZoom(e);
+ this.setView(i, n.maxZoom ? Math.min(o, n.maxZoom) : o);
+ }
+ var s = { latlng: i, bounds: e, timestamp: t.timestamp };
+ for (var r in t.coords)
+ "number" == typeof t.coords[r] && (s[r] = t.coords[r]);
+ this.fire("locationfound", s);
+ },
+ addHandler: function (t, i) {
+ if (!i) return this;
+ var e = (this[t] = new i(this));
+ return this._handlers.push(e), this.options[t] && e.enable(), this;
+ },
+ remove: function () {
+ if (
+ (this._initEvents(!0),
+ this._containerId !== this._container._leaflet_id)
+ )
+ throw new Error("Map container is being reused by another instance");
+ try {
+ delete this._container._leaflet_id, delete this._containerId;
+ } catch (t) {
+ (this._container._leaflet_id = void 0), (this._containerId = void 0);
+ }
+ var t;
+ for (t in (void 0 !== this._locationWatchId && this.stopLocate(),
+ this._stop(),
+ ui(this._mapPane),
+ this._clearControlPos && this._clearControlPos(),
+ this._resizeRequest &&
+ (C(this._resizeRequest), (this._resizeRequest = null)),
+ this._clearHandlers(),
+ this._loaded && this.fire("unload"),
+ this._layers))
+ this._layers[t].remove();
+ for (t in this._panes) ui(this._panes[t]);
+ return (
+ (this._layers = []),
+ (this._panes = []),
+ delete this._mapPane,
+ delete this._renderer,
+ this
+ );
+ },
+ createPane: function (t, i) {
+ var e = hi(
+ "div",
+ "leaflet-pane" +
+ (t ? " leaflet-" + t.replace("Pane", "") + "-pane" : ""),
+ i || this._mapPane,
+ );
+ return t && (this._panes[t] = e), e;
+ },
+ getCenter: function () {
+ return (
+ this._checkIfLoaded(),
+ this._lastCenter && !this._moved()
+ ? this._lastCenter
+ : this.layerPointToLatLng(this._getCenterLayerPoint())
+ );
+ },
+ getZoom: function () {
+ return this._zoom;
+ },
+ getBounds: function () {
+ var t = this.getPixelBounds();
+ return new N(
+ this.unproject(t.getBottomLeft()),
+ this.unproject(t.getTopRight()),
+ );
+ },
+ getMinZoom: function () {
+ return void 0 === this.options.minZoom
+ ? this._layersMinZoom || 0
+ : this.options.minZoom;
+ },
+ getMaxZoom: function () {
+ return void 0 === this.options.maxZoom
+ ? void 0 === this._layersMaxZoom
+ ? 1 / 0
+ : this._layersMaxZoom
+ : this.options.maxZoom;
+ },
+ getBoundsZoom: function (t, i, e) {
+ (t = D(t)), (e = I(e || [0, 0]));
+ var n = this.getZoom() || 0,
+ o = this.getMinZoom(),
+ s = this.getMaxZoom(),
+ r = t.getNorthWest(),
+ a = t.getSouthEast(),
+ h = this.getSize().subtract(e),
+ u = R(this.project(a, n), this.project(r, n)).getSize(),
+ l = yt ? this.options.zoomSnap : 1,
+ c = h.x / u.x,
+ _ = h.y / u.y,
+ d = i ? Math.max(c, _) : Math.min(c, _);
+ return (
+ (n = this.getScaleZoom(d, n)),
+ l &&
+ ((n = Math.round(n / (l / 100)) * (l / 100)),
+ (n = i ? Math.ceil(n / l) * l : Math.floor(n / l) * l)),
+ Math.max(o, Math.min(s, n))
+ );
+ },
+ getSize: function () {
+ return (
+ (this._size && !this._sizeChanged) ||
+ ((this._size = new B(
+ this._container.clientWidth || 0,
+ this._container.clientHeight || 0,
+ )),
+ (this._sizeChanged = !1)),
+ this._size.clone()
+ );
+ },
+ getPixelBounds: function (t, i) {
+ var e = this._getTopLeftPoint(t, i);
+ return new O(e, e.add(this.getSize()));
+ },
+ getPixelOrigin: function () {
+ return this._checkIfLoaded(), this._pixelOrigin;
+ },
+ getPixelWorldBounds: function (t) {
+ return this.options.crs.getProjectedBounds(
+ void 0 === t ? this.getZoom() : t,
+ );
+ },
+ getPane: function (t) {
+ return "string" == typeof t ? this._panes[t] : t;
+ },
+ getPanes: function () {
+ return this._panes;
+ },
+ getContainer: function () {
+ return this._container;
+ },
+ getZoomScale: function (t, i) {
+ var e = this.options.crs;
+ return (i = void 0 === i ? this._zoom : i), e.scale(t) / e.scale(i);
+ },
+ getScaleZoom: function (t, i) {
+ var e = this.options.crs;
+ i = void 0 === i ? this._zoom : i;
+ var n = e.zoom(t * e.scale(i));
+ return isNaN(n) ? 1 / 0 : n;
+ },
+ project: function (t, i) {
+ return (
+ (i = void 0 === i ? this._zoom : i),
+ this.options.crs.latLngToPoint(W(t), i)
+ );
+ },
+ unproject: function (t, i) {
+ return (
+ (i = void 0 === i ? this._zoom : i),
+ this.options.crs.pointToLatLng(I(t), i)
+ );
+ },
+ layerPointToLatLng: function (t) {
+ var i = I(t).add(this.getPixelOrigin());
+ return this.unproject(i);
+ },
+ latLngToLayerPoint: function (t) {
+ return this.project(W(t))._round()._subtract(this.getPixelOrigin());
+ },
+ wrapLatLng: function (t) {
+ return this.options.crs.wrapLatLng(W(t));
+ },
+ wrapLatLngBounds: function (t) {
+ return this.options.crs.wrapLatLngBounds(D(t));
+ },
+ distance: function (t, i) {
+ return this.options.crs.distance(W(t), W(i));
+ },
+ containerPointToLayerPoint: function (t) {
+ return I(t).subtract(this._getMapPanePos());
+ },
+ layerPointToContainerPoint: function (t) {
+ return I(t).add(this._getMapPanePos());
+ },
+ containerPointToLatLng: function (t) {
+ var i = this.containerPointToLayerPoint(I(t));
+ return this.layerPointToLatLng(i);
+ },
+ latLngToContainerPoint: function (t) {
+ return this.layerPointToContainerPoint(this.latLngToLayerPoint(W(t)));
+ },
+ mouseEventToContainerPoint: function (t) {
+ return Wi(t, this._container);
+ },
+ mouseEventToLayerPoint: function (t) {
+ return this.containerPointToLayerPoint(
+ this.mouseEventToContainerPoint(t),
+ );
+ },
+ mouseEventToLatLng: function (t) {
+ return this.layerPointToLatLng(this.mouseEventToLayerPoint(t));
+ },
+ _initContainer: function (t) {
+ var i = (this._container = ri(t));
+ if (!i) throw new Error("Map container not found.");
+ if (i._leaflet_id)
+ throw new Error("Map container is already initialized.");
+ Ei(i, "scroll", this._onScroll, this), (this._containerId = u(i));
+ },
+ _initLayout: function () {
+ var t = this._container;
+ (this._fadeAnimated = this.options.fadeAnimation && yt),
+ pi(
+ t,
+ "leaflet-container" +
+ (Tt ? " leaflet-touch" : "") +
+ (Ct ? " leaflet-retina" : "") +
+ (et ? " leaflet-oldie" : "") +
+ (_t ? " leaflet-safari" : "") +
+ (this._fadeAnimated ? " leaflet-fade-anim" : ""),
+ );
+ var i = ai(t, "position");
+ "absolute" !== i &&
+ "relative" !== i &&
+ "fixed" !== i &&
+ (t.style.position = "relative"),
+ this._initPanes(),
+ this._initControlPos && this._initControlPos();
+ },
+ _initPanes: function () {
+ var t = (this._panes = {});
+ (this._paneRenderers = {}),
+ (this._mapPane = this.createPane("mapPane", this._container)),
+ wi(this._mapPane, new B(0, 0)),
+ this.createPane("tilePane"),
+ this.createPane("shadowPane"),
+ this.createPane("overlayPane"),
+ this.createPane("markerPane"),
+ this.createPane("tooltipPane"),
+ this.createPane("popupPane"),
+ this.options.markerZoomAnimation ||
+ (pi(t.markerPane, "leaflet-zoom-hide"),
+ pi(t.shadowPane, "leaflet-zoom-hide"));
+ },
+ _resetView: function (t, i) {
+ wi(this._mapPane, new B(0, 0));
+ var e = !this._loaded;
+ (this._loaded = !0),
+ (i = this._limitZoom(i)),
+ this.fire("viewprereset");
+ var n = this._zoom !== i;
+ this._moveStart(n, !1)._move(t, i)._moveEnd(n),
+ this.fire("viewreset"),
+ e && this.fire("load");
+ },
+ _moveStart: function (t, i) {
+ return t && this.fire("zoomstart"), i || this.fire("movestart"), this;
+ },
+ _move: function (t, i, e) {
+ void 0 === i && (i = this._zoom);
+ var n = this._zoom !== i;
+ return (
+ (this._zoom = i),
+ (this._lastCenter = t),
+ (this._pixelOrigin = this._getNewPixelOrigin(t)),
+ (n || (e && e.pinch)) && this.fire("zoom", e),
+ this.fire("move", e)
+ );
+ },
+ _moveEnd: function (t) {
+ return t && this.fire("zoomend"), this.fire("moveend");
+ },
+ _stop: function () {
+ return C(this._flyToFrame), this._panAnim && this._panAnim.stop(), this;
+ },
+ _rawPanBy: function (t) {
+ wi(this._mapPane, this._getMapPanePos().subtract(t));
+ },
+ _getZoomSpan: function () {
+ return this.getMaxZoom() - this.getMinZoom();
+ },
+ _panInsideMaxBounds: function () {
+ this._enforcingBounds || this.panInsideBounds(this.options.maxBounds);
+ },
+ _checkIfLoaded: function () {
+ if (!this._loaded) throw new Error("Set map center and zoom first.");
+ },
+ _initEvents: function (t) {
+ this._targets = {};
+ var i = t ? Bi : Ei;
+ i(
+ (this._targets[u(this._container)] = this)._container,
+ "click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",
+ this._handleDOMEvent,
+ this,
+ ),
+ this.options.trackResize && i(window, "resize", this._onResize, this),
+ yt &&
+ this.options.transform3DLimit &&
+ (t ? this.off : this.on).call(this, "moveend", this._onMoveEnd);
+ },
+ _onResize: function () {
+ C(this._resizeRequest),
+ (this._resizeRequest = M(function () {
+ this.invalidateSize({ debounceMoveend: !0 });
+ }, this));
+ },
+ _onScroll: function () {
+ (this._container.scrollTop = 0), (this._container.scrollLeft = 0);
+ },
+ _onMoveEnd: function () {
+ var t = this._getMapPanePos();
+ Math.max(Math.abs(t.x), Math.abs(t.y)) >=
+ this.options.transform3DLimit &&
+ this._resetView(this.getCenter(), this.getZoom());
+ },
+ _findEventTargets: function (t, i) {
+ for (
+ var e,
+ n = [],
+ o = "mouseout" === i || "mouseover" === i,
+ s = t.target || t.srcElement,
+ r = !1;
+ s;
+
+ ) {
+ if (
+ (e = this._targets[u(s)]) &&
+ ("click" === i || "preclick" === i) &&
+ !t._simulated &&
+ this._draggableMoved(e)
+ ) {
+ r = !0;
+ break;
+ }
+ if (e && e.listens(i, !0)) {
+ if (o && !Ki(s, t)) break;
+ if ((n.push(e), o)) break;
+ }
+ if (s === this._container) break;
+ s = s.parentNode;
+ }
+ return n.length || r || o || !Ki(s, t) || (n = [this]), n;
+ },
+ _handleDOMEvent: function (t) {
+ if (this._loaded && !Gi(t)) {
+ var i = t.type;
+ ("mousedown" !== i &&
+ "keypress" !== i &&
+ "keyup" !== i &&
+ "keydown" !== i) ||
+ zi(t.target || t.srcElement),
+ this._fireDOMEvent(t, i);
+ }
+ },
+ _mouseEvents: [
+ "click",
+ "dblclick",
+ "mouseover",
+ "mouseout",
+ "contextmenu",
+ ],
+ _fireDOMEvent: function (t, i, e) {
+ if ("click" === t.type) {
+ var n = h({}, t);
+ (n.type = "preclick"), this._fireDOMEvent(n, n.type, e);
+ }
+ if (
+ !t._stopped &&
+ (e = (e || []).concat(this._findEventTargets(t, i))).length
+ ) {
+ var o = e[0];
+ "contextmenu" === i && o.listens(i, !0) && Di(t);
+ var s = { originalEvent: t };
+ if (
+ "keypress" !== t.type &&
+ "keydown" !== t.type &&
+ "keyup" !== t.type
+ ) {
+ var r = o.getLatLng && (!o._radius || o._radius <= 10);
+ (s.containerPoint = r
+ ? this.latLngToContainerPoint(o.getLatLng())
+ : this.mouseEventToContainerPoint(t)),
+ (s.layerPoint = this.containerPointToLayerPoint(
+ s.containerPoint,
+ )),
+ (s.latlng = r
+ ? o.getLatLng()
+ : this.layerPointToLatLng(s.layerPoint));
+ }
+ for (var a = 0; a < e.length; a++)
+ if (
+ (e[a].fire(i, s, !0),
+ s.originalEvent._stopped ||
+ (!1 === e[a].options.bubblingMouseEvents &&
+ -1 !== y(this._mouseEvents, i)))
+ )
+ return;
+ }
+ },
+ _draggableMoved: function (t) {
+ return (
+ ((t = t.dragging && t.dragging.enabled() ? t : this).dragging &&
+ t.dragging.moved()) ||
+ (this.boxZoom && this.boxZoom.moved())
+ );
+ },
+ _clearHandlers: function () {
+ for (var t = 0, i = this._handlers.length; t < i; t++)
+ this._handlers[t].disable();
+ },
+ whenReady: function (t, i) {
+ return (
+ this._loaded
+ ? t.call(i || this, { target: this })
+ : this.on("load", t, i),
+ this
+ );
+ },
+ _getMapPanePos: function () {
+ return Pi(this._mapPane) || new B(0, 0);
+ },
+ _moved: function () {
+ var t = this._getMapPanePos();
+ return t && !t.equals([0, 0]);
+ },
+ _getTopLeftPoint: function (t, i) {
+ return (
+ t && void 0 !== i
+ ? this._getNewPixelOrigin(t, i)
+ : this.getPixelOrigin()
+ ).subtract(this._getMapPanePos());
+ },
+ _getNewPixelOrigin: function (t, i) {
+ var e = this.getSize()._divideBy(2);
+ return this.project(t, i)
+ ._subtract(e)
+ ._add(this._getMapPanePos())
+ ._round();
+ },
+ _latLngToNewLayerPoint: function (t, i, e) {
+ var n = this._getNewPixelOrigin(e, i);
+ return this.project(t, i)._subtract(n);
+ },
+ _latLngBoundsToNewLayerBounds: function (t, i, e) {
+ var n = this._getNewPixelOrigin(e, i);
+ return R([
+ this.project(t.getSouthWest(), i)._subtract(n),
+ this.project(t.getNorthWest(), i)._subtract(n),
+ this.project(t.getSouthEast(), i)._subtract(n),
+ this.project(t.getNorthEast(), i)._subtract(n),
+ ]);
+ },
+ _getCenterLayerPoint: function () {
+ return this.containerPointToLayerPoint(this.getSize()._divideBy(2));
+ },
+ _getCenterOffset: function (t) {
+ return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint());
+ },
+ _limitCenter: function (t, i, e) {
+ if (!e) return t;
+ var n = this.project(t, i),
+ o = this.getSize().divideBy(2),
+ s = new O(n.subtract(o), n.add(o)),
+ r = this._getBoundsOffset(s, e, i);
+ return r.round().equals([0, 0]) ? t : this.unproject(n.add(r), i);
+ },
+ _limitOffset: function (t, i) {
+ if (!i) return t;
+ var e = this.getPixelBounds(),
+ n = new O(e.min.add(t), e.max.add(t));
+ return t.add(this._getBoundsOffset(n, i));
+ },
+ _getBoundsOffset: function (t, i, e) {
+ var n = R(
+ this.project(i.getNorthEast(), e),
+ this.project(i.getSouthWest(), e),
+ ),
+ o = n.min.subtract(t.min),
+ s = n.max.subtract(t.max);
+ return new B(this._rebound(o.x, -s.x), this._rebound(o.y, -s.y));
+ },
+ _rebound: function (t, i) {
+ return 0 < t + i
+ ? Math.round(t - i) / 2
+ : Math.max(0, Math.ceil(t)) - Math.max(0, Math.floor(i));
+ },
+ _limitZoom: function (t) {
+ var i = this.getMinZoom(),
+ e = this.getMaxZoom(),
+ n = yt ? this.options.zoomSnap : 1;
+ return n && (t = Math.round(t / n) * n), Math.max(i, Math.min(e, t));
+ },
+ _onPanTransitionStep: function () {
+ this.fire("move");
+ },
+ _onPanTransitionEnd: function () {
+ mi(this._mapPane, "leaflet-pan-anim"), this.fire("moveend");
+ },
+ _tryAnimatedPan: function (t, i) {
+ var e = this._getCenterOffset(t)._trunc();
+ return (
+ !(!0 !== (i && i.animate) && !this.getSize().contains(e)) &&
+ (this.panBy(e, i), !0)
+ );
+ },
+ _createAnimProxy: function () {
+ var t = (this._proxy = hi(
+ "div",
+ "leaflet-proxy leaflet-zoom-animated",
+ ));
+ this._panes.mapPane.appendChild(t),
+ this.on(
+ "zoomanim",
+ function (t) {
+ var i = ni,
+ e = this._proxy.style[i];
+ xi(
+ this._proxy,
+ this.project(t.center, t.zoom),
+ this.getZoomScale(t.zoom, 1),
+ ),
+ e === this._proxy.style[i] &&
+ this._animatingZoom &&
+ this._onZoomTransitionEnd();
+ },
+ this,
+ ),
+ this.on(
+ "load moveend",
+ function () {
+ var t = this.getCenter(),
+ i = this.getZoom();
+ xi(this._proxy, this.project(t, i), this.getZoomScale(i, 1));
+ },
+ this,
+ ),
+ this._on("unload", this._destroyAnimProxy, this);
+ },
+ _destroyAnimProxy: function () {
+ ui(this._proxy), delete this._proxy;
+ },
+ _catchTransitionEnd: function (t) {
+ this._animatingZoom &&
+ 0 <= t.propertyName.indexOf("transform") &&
+ this._onZoomTransitionEnd();
+ },
+ _nothingToAnimate: function () {
+ return !this._container.getElementsByClassName("leaflet-zoom-animated")
+ .length;
+ },
+ _tryAnimatedZoom: function (t, i, e) {
+ if (this._animatingZoom) return !0;
+ if (
+ ((e = e || {}),
+ !this._zoomAnimated ||
+ !1 === e.animate ||
+ this._nothingToAnimate() ||
+ Math.abs(i - this._zoom) > this.options.zoomAnimationThreshold)
+ )
+ return !1;
+ var n = this.getZoomScale(i),
+ o = this._getCenterOffset(t)._divideBy(1 - 1 / n);
+ return (
+ !(!0 !== e.animate && !this.getSize().contains(o)) &&
+ (M(function () {
+ this._moveStart(!0, !1)._animateZoom(t, i, !0);
+ }, this),
+ !0)
+ );
+ },
+ _animateZoom: function (t, i, e, n) {
+ this._mapPane &&
+ (e &&
+ ((this._animatingZoom = !0),
+ (this._animateToCenter = t),
+ (this._animateToZoom = i),
+ pi(this._mapPane, "leaflet-zoom-anim")),
+ this.fire("zoomanim", { center: t, zoom: i, noUpdate: n }),
+ setTimeout(a(this._onZoomTransitionEnd, this), 250));
+ },
+ _onZoomTransitionEnd: function () {
+ this._animatingZoom &&
+ (this._mapPane && mi(this._mapPane, "leaflet-zoom-anim"),
+ (this._animatingZoom = !1),
+ this._move(this._animateToCenter, this._animateToZoom),
+ M(function () {
+ this._moveEnd(!0);
+ }, this));
+ },
+ });
+ function $i(t) {
+ return new Qi(t);
+ }
+ var Qi = Z.extend({
+ options: { position: "topright" },
+ initialize: function (t) {
+ p(this, t);
+ },
+ getPosition: function () {
+ return this.options.position;
+ },
+ setPosition: function (t) {
+ var i = this._map;
+ return (
+ i && i.removeControl(this),
+ (this.options.position = t),
+ i && i.addControl(this),
+ this
+ );
+ },
+ getContainer: function () {
+ return this._container;
+ },
+ addTo: function (t) {
+ this.remove(), (this._map = t);
+ var i = (this._container = this.onAdd(t)),
+ e = this.getPosition(),
+ n = t._controlCorners[e];
+ return (
+ pi(i, "leaflet-control"),
+ -1 !== e.indexOf("bottom")
+ ? n.insertBefore(i, n.firstChild)
+ : n.appendChild(i),
+ this._map.on("unload", this.remove, this),
+ this
+ );
+ },
+ remove: function () {
+ return (
+ this._map &&
+ (ui(this._container),
+ this.onRemove && this.onRemove(this._map),
+ this._map.off("unload", this.remove, this),
+ (this._map = null)),
+ this
+ );
+ },
+ _refocusOnMap: function (t) {
+ this._map &&
+ t &&
+ 0 < t.screenX &&
+ 0 < t.screenY &&
+ this._map.getContainer().focus();
+ },
+ });
+ Ji.include({
+ addControl: function (t) {
+ return t.addTo(this), this;
+ },
+ removeControl: function (t) {
+ return t.remove(), this;
+ },
+ _initControlPos: function () {
+ var n = (this._controlCorners = {}),
+ o = "leaflet-",
+ s = (this._controlContainer = hi(
+ "div",
+ o + "control-container",
+ this._container,
+ ));
+ function t(t, i) {
+ var e = o + t + " " + o + i;
+ n[t + i] = hi("div", e, s);
+ }
+ t("top", "left"),
+ t("top", "right"),
+ t("bottom", "left"),
+ t("bottom", "right");
+ },
+ _clearControlPos: function () {
+ for (var t in this._controlCorners) ui(this._controlCorners[t]);
+ ui(this._controlContainer),
+ delete this._controlCorners,
+ delete this._controlContainer;
+ },
+ });
+ var te = Qi.extend({
+ options: {
+ collapsed: !0,
+ position: "topright",
+ autoZIndex: !0,
+ hideSingleBase: !1,
+ sortLayers: !1,
+ sortFunction: function (t, i, e, n) {
+ return e < n ? -1 : n < e ? 1 : 0;
+ },
+ },
+ initialize: function (t, i, e) {
+ for (var n in (p(this, e),
+ (this._layerControlInputs = []),
+ (this._layers = []),
+ (this._lastZIndex = 0),
+ (this._handlingClick = !1),
+ t))
+ this._addLayer(t[n], n);
+ for (n in i) this._addLayer(i[n], n, !0);
+ },
+ onAdd: function (t) {
+ this._initLayout(),
+ this._update(),
+ (this._map = t).on("zoomend", this._checkDisabledLayers, this);
+ for (var i = 0; i < this._layers.length; i++)
+ this._layers[i].layer.on("add remove", this._onLayerChange, this);
+ return this._container;
+ },
+ addTo: function (t) {
+ return Qi.prototype.addTo.call(this, t), this._expandIfNotCollapsed();
+ },
+ onRemove: function () {
+ this._map.off("zoomend", this._checkDisabledLayers, this);
+ for (var t = 0; t < this._layers.length; t++)
+ this._layers[t].layer.off("add remove", this._onLayerChange, this);
+ },
+ addBaseLayer: function (t, i) {
+ return this._addLayer(t, i), this._map ? this._update() : this;
+ },
+ addOverlay: function (t, i) {
+ return this._addLayer(t, i, !0), this._map ? this._update() : this;
+ },
+ removeLayer: function (t) {
+ t.off("add remove", this._onLayerChange, this);
+ var i = this._getLayer(u(t));
+ return (
+ i && this._layers.splice(this._layers.indexOf(i), 1),
+ this._map ? this._update() : this
+ );
+ },
+ expand: function () {
+ pi(this._container, "leaflet-control-layers-expanded"),
+ (this._section.style.height = null);
+ var t = this._map.getSize().y - (this._container.offsetTop + 50);
+ return (
+ t < this._section.clientHeight
+ ? (pi(this._section, "leaflet-control-layers-scrollbar"),
+ (this._section.style.height = t + "px"))
+ : mi(this._section, "leaflet-control-layers-scrollbar"),
+ this._checkDisabledLayers(),
+ this
+ );
+ },
+ collapse: function () {
+ return mi(this._container, "leaflet-control-layers-expanded"), this;
+ },
+ _initLayout: function () {
+ var t = "leaflet-control-layers",
+ i = (this._container = hi("div", t)),
+ e = this.options.collapsed;
+ i.setAttribute("aria-haspopup", !0), Ni(i), Ri(i);
+ var n = (this._section = hi("section", t + "-list"));
+ e &&
+ (this._map.on("click", this.collapse, this),
+ st ||
+ Ei(
+ i,
+ { mouseenter: this.expand, mouseleave: this.collapse },
+ this,
+ ));
+ var o = (this._layersLink = hi("a", t + "-toggle", i));
+ (o.href = "#"),
+ (o.title = "Layers"),
+ Tt
+ ? (Ei(o, "click", ji), Ei(o, "click", this.expand, this))
+ : Ei(o, "focus", this.expand, this),
+ e || this.expand(),
+ (this._baseLayersList = hi("div", t + "-base", n)),
+ (this._separator = hi("div", t + "-separator", n)),
+ (this._overlaysList = hi("div", t + "-overlays", n)),
+ i.appendChild(n);
+ },
+ _getLayer: function (t) {
+ for (var i = 0; i < this._layers.length; i++)
+ if (this._layers[i] && u(this._layers[i].layer) === t)
+ return this._layers[i];
+ },
+ _addLayer: function (t, i, e) {
+ this._map && t.on("add remove", this._onLayerChange, this),
+ this._layers.push({ layer: t, name: i, overlay: e }),
+ this.options.sortLayers &&
+ this._layers.sort(
+ a(function (t, i) {
+ return this.options.sortFunction(
+ t.layer,
+ i.layer,
+ t.name,
+ i.name,
+ );
+ }, this),
+ ),
+ this.options.autoZIndex &&
+ t.setZIndex &&
+ (this._lastZIndex++, t.setZIndex(this._lastZIndex)),
+ this._expandIfNotCollapsed();
+ },
+ _update: function () {
+ if (!this._container) return this;
+ li(this._baseLayersList),
+ li(this._overlaysList),
+ (this._layerControlInputs = []);
+ var t,
+ i,
+ e,
+ n,
+ o = 0;
+ for (e = 0; e < this._layers.length; e++)
+ (n = this._layers[e]),
+ this._addItem(n),
+ (i = i || n.overlay),
+ (t = t || !n.overlay),
+ (o += n.overlay ? 0 : 1);
+ return (
+ this.options.hideSingleBase &&
+ ((t = t && 1 < o),
+ (this._baseLayersList.style.display = t ? "" : "none")),
+ (this._separator.style.display = i && t ? "" : "none"),
+ this
+ );
+ },
+ _onLayerChange: function (t) {
+ this._handlingClick || this._update();
+ var i = this._getLayer(u(t.target)),
+ e = i.overlay
+ ? "add" === t.type
+ ? "overlayadd"
+ : "overlayremove"
+ : "add" === t.type
+ ? "baselayerchange"
+ : null;
+ e && this._map.fire(e, i);
+ },
+ _createRadioElement: function (t, i) {
+ var e =
+ ' ",
+ n = document.createElement("div");
+ return (n.innerHTML = e), n.firstChild;
+ },
+ _addItem: function (t) {
+ var i,
+ e = document.createElement("label"),
+ n = this._map.hasLayer(t.layer);
+ t.overlay
+ ? (((i = document.createElement("input")).type = "checkbox"),
+ (i.className = "leaflet-control-layers-selector"),
+ (i.defaultChecked = n))
+ : (i = this._createRadioElement("leaflet-base-layers_" + u(this), n)),
+ this._layerControlInputs.push(i),
+ (i.layerId = u(t.layer)),
+ Ei(i, "click", this._onInputClick, this);
+ var o = document.createElement("span");
+ o.innerHTML = " " + t.name;
+ var s = document.createElement("div");
+ return (
+ e.appendChild(s),
+ s.appendChild(i),
+ s.appendChild(o),
+ (t.overlay ? this._overlaysList : this._baseLayersList).appendChild(
+ e,
+ ),
+ this._checkDisabledLayers(),
+ e
+ );
+ },
+ _onInputClick: function () {
+ var t,
+ i,
+ e = this._layerControlInputs,
+ n = [],
+ o = [];
+ this._handlingClick = !0;
+ for (var s = e.length - 1; 0 <= s; s--)
+ (t = e[s]),
+ (i = this._getLayer(t.layerId).layer),
+ t.checked ? n.push(i) : t.checked || o.push(i);
+ for (s = 0; s < o.length; s++)
+ this._map.hasLayer(o[s]) && this._map.removeLayer(o[s]);
+ for (s = 0; s < n.length; s++)
+ this._map.hasLayer(n[s]) || this._map.addLayer(n[s]);
+ (this._handlingClick = !1), this._refocusOnMap();
+ },
+ _checkDisabledLayers: function () {
+ for (
+ var t,
+ i,
+ e = this._layerControlInputs,
+ n = this._map.getZoom(),
+ o = e.length - 1;
+ 0 <= o;
+ o--
+ )
+ (t = e[o]),
+ (i = this._getLayer(t.layerId).layer),
+ (t.disabled =
+ (void 0 !== i.options.minZoom && n < i.options.minZoom) ||
+ (void 0 !== i.options.maxZoom && n > i.options.maxZoom));
+ },
+ _expandIfNotCollapsed: function () {
+ return this._map && !this.options.collapsed && this.expand(), this;
+ },
+ _expand: function () {
+ return this.expand();
+ },
+ _collapse: function () {
+ return this.collapse();
+ },
+ }),
+ ie = Qi.extend({
+ options: {
+ position: "topleft",
+ zoomInText: "+",
+ zoomInTitle: "Zoom in",
+ zoomOutText: "−",
+ zoomOutTitle: "Zoom out",
+ },
+ onAdd: function (t) {
+ var i = "leaflet-control-zoom",
+ e = hi("div", i + " leaflet-bar"),
+ n = this.options;
+ return (
+ (this._zoomInButton = this._createButton(
+ n.zoomInText,
+ n.zoomInTitle,
+ i + "-in",
+ e,
+ this._zoomIn,
+ )),
+ (this._zoomOutButton = this._createButton(
+ n.zoomOutText,
+ n.zoomOutTitle,
+ i + "-out",
+ e,
+ this._zoomOut,
+ )),
+ this._updateDisabled(),
+ t.on("zoomend zoomlevelschange", this._updateDisabled, this),
+ e
+ );
+ },
+ onRemove: function (t) {
+ t.off("zoomend zoomlevelschange", this._updateDisabled, this);
+ },
+ disable: function () {
+ return (this._disabled = !0), this._updateDisabled(), this;
+ },
+ enable: function () {
+ return (this._disabled = !1), this._updateDisabled(), this;
+ },
+ _zoomIn: function (t) {
+ !this._disabled &&
+ this._map._zoom < this._map.getMaxZoom() &&
+ this._map.zoomIn(this._map.options.zoomDelta * (t.shiftKey ? 3 : 1));
+ },
+ _zoomOut: function (t) {
+ !this._disabled &&
+ this._map._zoom > this._map.getMinZoom() &&
+ this._map.zoomOut(this._map.options.zoomDelta * (t.shiftKey ? 3 : 1));
+ },
+ _createButton: function (t, i, e, n, o) {
+ var s = hi("a", e, n);
+ return (
+ (s.innerHTML = t),
+ (s.href = "#"),
+ (s.title = i),
+ s.setAttribute("role", "button"),
+ s.setAttribute("aria-label", i),
+ Ni(s),
+ Ei(s, "click", ji),
+ Ei(s, "click", o, this),
+ Ei(s, "click", this._refocusOnMap, this),
+ s
+ );
+ },
+ _updateDisabled: function () {
+ var t = this._map,
+ i = "leaflet-disabled";
+ mi(this._zoomInButton, i),
+ mi(this._zoomOutButton, i),
+ (!this._disabled && t._zoom !== t.getMinZoom()) ||
+ pi(this._zoomOutButton, i),
+ (!this._disabled && t._zoom !== t.getMaxZoom()) ||
+ pi(this._zoomInButton, i);
+ },
+ });
+ Ji.mergeOptions({ zoomControl: !0 }),
+ Ji.addInitHook(function () {
+ this.options.zoomControl &&
+ ((this.zoomControl = new ie()), this.addControl(this.zoomControl));
+ });
+ var ee = Qi.extend({
+ options: {
+ position: "bottomleft",
+ maxWidth: 100,
+ metric: !0,
+ imperial: !0,
+ },
+ onAdd: function (t) {
+ var i = "leaflet-control-scale",
+ e = hi("div", i),
+ n = this.options;
+ return (
+ this._addScales(n, i + "-line", e),
+ t.on(n.updateWhenIdle ? "moveend" : "move", this._update, this),
+ t.whenReady(this._update, this),
+ e
+ );
+ },
+ onRemove: function (t) {
+ t.off(
+ this.options.updateWhenIdle ? "moveend" : "move",
+ this._update,
+ this,
+ );
+ },
+ _addScales: function (t, i, e) {
+ t.metric && (this._mScale = hi("div", i, e)),
+ t.imperial && (this._iScale = hi("div", i, e));
+ },
+ _update: function () {
+ var t = this._map,
+ i = t.getSize().y / 2,
+ e = t.distance(
+ t.containerPointToLatLng([0, i]),
+ t.containerPointToLatLng([this.options.maxWidth, i]),
+ );
+ this._updateScales(e);
+ },
+ _updateScales: function (t) {
+ this.options.metric && t && this._updateMetric(t),
+ this.options.imperial && t && this._updateImperial(t);
+ },
+ _updateMetric: function (t) {
+ var i = this._getRoundNum(t),
+ e = i < 1e3 ? i + " m" : i / 1e3 + " km";
+ this._updateScale(this._mScale, e, i / t);
+ },
+ _updateImperial: function (t) {
+ var i,
+ e,
+ n,
+ o = 3.2808399 * t;
+ 5280 < o
+ ? ((i = o / 5280),
+ (e = this._getRoundNum(i)),
+ this._updateScale(this._iScale, e + " mi", e / i))
+ : ((n = this._getRoundNum(o)),
+ this._updateScale(this._iScale, n + " ft", n / o));
+ },
+ _updateScale: function (t, i, e) {
+ (t.style.width = Math.round(this.options.maxWidth * e) + "px"),
+ (t.innerHTML = i);
+ },
+ _getRoundNum: function (t) {
+ var i = Math.pow(10, (Math.floor(t) + "").length - 1),
+ e = t / i;
+ return (
+ i * (e = 10 <= e ? 10 : 5 <= e ? 5 : 3 <= e ? 3 : 2 <= e ? 2 : 1)
+ );
+ },
+ }),
+ ne = Qi.extend({
+ options: {
+ position: "bottomright",
+ prefix:
+ 'Leaflet ',
+ },
+ initialize: function (t) {
+ p(this, t), (this._attributions = {});
+ },
+ onAdd: function (t) {
+ for (var i in (((t.attributionControl = this)._container = hi(
+ "div",
+ "leaflet-control-attribution",
+ )),
+ Ni(this._container),
+ t._layers))
+ t._layers[i].getAttribution &&
+ this.addAttribution(t._layers[i].getAttribution());
+ return this._update(), this._container;
+ },
+ setPrefix: function (t) {
+ return (this.options.prefix = t), this._update(), this;
+ },
+ addAttribution: function (t) {
+ return (
+ t &&
+ (this._attributions[t] || (this._attributions[t] = 0),
+ this._attributions[t]++,
+ this._update()),
+ this
+ );
+ },
+ removeAttribution: function (t) {
+ return (
+ t &&
+ this._attributions[t] &&
+ (this._attributions[t]--, this._update()),
+ this
+ );
+ },
+ _update: function () {
+ if (this._map) {
+ var t = [];
+ for (var i in this._attributions) this._attributions[i] && t.push(i);
+ var e = [];
+ this.options.prefix && e.push(this.options.prefix),
+ t.length && e.push(t.join(", ")),
+ (this._container.innerHTML = e.join(" | "));
+ }
+ },
+ });
+ Ji.mergeOptions({ attributionControl: !0 }),
+ Ji.addInitHook(function () {
+ this.options.attributionControl && new ne().addTo(this);
+ });
+ (Qi.Layers = te),
+ (Qi.Zoom = ie),
+ (Qi.Scale = ee),
+ (Qi.Attribution = ne),
+ ($i.layers = function (t, i, e) {
+ return new te(t, i, e);
+ }),
+ ($i.zoom = function (t) {
+ return new ie(t);
+ }),
+ ($i.scale = function (t) {
+ return new ee(t);
+ }),
+ ($i.attribution = function (t) {
+ return new ne(t);
+ });
+ var oe = Z.extend({
+ initialize: function (t) {
+ this._map = t;
+ },
+ enable: function () {
+ return this._enabled || ((this._enabled = !0), this.addHooks()), this;
+ },
+ disable: function () {
+ return this._enabled && ((this._enabled = !1), this.removeHooks()), this;
+ },
+ enabled: function () {
+ return !!this._enabled;
+ },
+ });
+ oe.addTo = function (t, i) {
+ return t.addHandler(i, this), this;
+ };
+ var se,
+ re = { Events: E },
+ ae = Tt ? "touchstart mousedown" : "mousedown",
+ he = {
+ mousedown: "mouseup",
+ touchstart: "touchend",
+ pointerdown: "touchend",
+ MSPointerDown: "touchend",
+ },
+ ue = {
+ mousedown: "mousemove",
+ touchstart: "touchmove",
+ pointerdown: "touchmove",
+ MSPointerDown: "touchmove",
+ },
+ le = k.extend({
+ options: { clickTolerance: 3 },
+ initialize: function (t, i, e, n) {
+ p(this, n),
+ (this._element = t),
+ (this._dragStartTarget = i || t),
+ (this._preventOutline = e);
+ },
+ enable: function () {
+ this._enabled ||
+ (Ei(this._dragStartTarget, ae, this._onDown, this),
+ (this._enabled = !0));
+ },
+ disable: function () {
+ this._enabled &&
+ (le._dragging === this && this.finishDrag(),
+ Bi(this._dragStartTarget, ae, this._onDown, this),
+ (this._enabled = !1),
+ (this._moved = !1));
+ },
+ _onDown: function (t) {
+ if (
+ !t._simulated &&
+ this._enabled &&
+ ((this._moved = !1),
+ !di(this._element, "leaflet-zoom-anim") &&
+ !(
+ le._dragging ||
+ t.shiftKey ||
+ (1 !== t.which && 1 !== t.button && !t.touches) ||
+ ((le._dragging = this)._preventOutline && zi(this._element),
+ bi(),
+ $t(),
+ this._moving)
+ ))
+ ) {
+ this.fire("down");
+ var i = t.touches ? t.touches[0] : t,
+ e = Ci(this._element);
+ (this._startPoint = new B(i.clientX, i.clientY)),
+ (this._parentScale = Si(e)),
+ Ei(document, ue[t.type], this._onMove, this),
+ Ei(document, he[t.type], this._onUp, this);
+ }
+ },
+ _onMove: function (t) {
+ if (!t._simulated && this._enabled)
+ if (t.touches && 1 < t.touches.length) this._moved = !0;
+ else {
+ var i = t.touches && 1 === t.touches.length ? t.touches[0] : t,
+ e = new B(i.clientX, i.clientY)._subtract(this._startPoint);
+ (e.x || e.y) &&
+ (Math.abs(e.x) + Math.abs(e.y) < this.options.clickTolerance ||
+ ((e.x /= this._parentScale.x),
+ (e.y /= this._parentScale.y),
+ Di(t),
+ this._moved ||
+ (this.fire("dragstart"),
+ (this._moved = !0),
+ (this._startPos = Pi(this._element).subtract(e)),
+ pi(document.body, "leaflet-dragging"),
+ (this._lastTarget = t.target || t.srcElement),
+ window.SVGElementInstance &&
+ this._lastTarget instanceof SVGElementInstance &&
+ (this._lastTarget =
+ this._lastTarget.correspondingUseElement),
+ pi(this._lastTarget, "leaflet-drag-target")),
+ (this._newPos = this._startPos.add(e)),
+ (this._moving = !0),
+ C(this._animRequest),
+ (this._lastEvent = t),
+ (this._animRequest = M(this._updatePosition, this, !0))));
+ }
+ },
+ _updatePosition: function () {
+ var t = { originalEvent: this._lastEvent };
+ this.fire("predrag", t),
+ wi(this._element, this._newPos),
+ this.fire("drag", t);
+ },
+ _onUp: function (t) {
+ !t._simulated && this._enabled && this.finishDrag();
+ },
+ finishDrag: function () {
+ for (var t in (mi(document.body, "leaflet-dragging"),
+ this._lastTarget &&
+ (mi(this._lastTarget, "leaflet-drag-target"),
+ (this._lastTarget = null)),
+ ue))
+ Bi(document, ue[t], this._onMove, this),
+ Bi(document, he[t], this._onUp, this);
+ Ti(),
+ Qt(),
+ this._moved &&
+ this._moving &&
+ (C(this._animRequest),
+ this.fire("dragend", {
+ distance: this._newPos.distanceTo(this._startPos),
+ })),
+ (this._moving = !1),
+ (le._dragging = !1);
+ },
+ });
+ function ce(t, i) {
+ if (!i || !t.length) return t.slice();
+ var e = i * i;
+ return (t = (function (t, i) {
+ var e = t.length,
+ n = new (typeof Uint8Array != void 0 + "" ? Uint8Array : Array)(e);
+ (n[0] = n[e - 1] = 1),
+ (function t(i, e, n, o, s) {
+ var r,
+ a,
+ h,
+ u = 0;
+ for (a = o + 1; a <= s - 1; a++)
+ (h = fe(i[a], i[o], i[s], !0)), u < h && ((r = a), (u = h));
+ n < u && ((e[r] = 1), t(i, e, n, o, r), t(i, e, n, r, s));
+ })(t, n, i, 0, e - 1);
+ var o,
+ s = [];
+ for (o = 0; o < e; o++) n[o] && s.push(t[o]);
+ return s;
+ })(
+ (t = (function (t, i) {
+ for (var e = [t[0]], n = 1, o = 0, s = t.length; n < s; n++)
+ (r = t[n]),
+ (a = t[o]),
+ void 0,
+ (h = a.x - r.x),
+ (u = a.y - r.y),
+ i < h * h + u * u && (e.push(t[n]), (o = n));
+ var r, a, h, u;
+ o < s - 1 && e.push(t[s - 1]);
+ return e;
+ })(t, e)),
+ e,
+ ));
+ }
+ function _e(t, i, e) {
+ return Math.sqrt(fe(t, i, e, !0));
+ }
+ function de(t, i, e, n, o) {
+ var s,
+ r,
+ a,
+ h = n ? se : me(t, e),
+ u = me(i, e);
+ for (se = u; ; ) {
+ if (!(h | u)) return [t, i];
+ if (h & u) return !1;
+ (a = me((r = pe(t, i, (s = h || u), e, o)), e)),
+ s === h ? ((t = r), (h = a)) : ((i = r), (u = a));
+ }
+ }
+ function pe(t, i, e, n, o) {
+ var s,
+ r,
+ a = i.x - t.x,
+ h = i.y - t.y,
+ u = n.min,
+ l = n.max;
+ return (
+ 8 & e
+ ? ((s = t.x + (a * (l.y - t.y)) / h), (r = l.y))
+ : 4 & e
+ ? ((s = t.x + (a * (u.y - t.y)) / h), (r = u.y))
+ : 2 & e
+ ? ((s = l.x), (r = t.y + (h * (l.x - t.x)) / a))
+ : 1 & e && ((s = u.x), (r = t.y + (h * (u.x - t.x)) / a)),
+ new B(s, r, o)
+ );
+ }
+ function me(t, i) {
+ var e = 0;
+ return (
+ t.x < i.min.x ? (e |= 1) : t.x > i.max.x && (e |= 2),
+ t.y < i.min.y ? (e |= 4) : t.y > i.max.y && (e |= 8),
+ e
+ );
+ }
+ function fe(t, i, e, n) {
+ var o,
+ s = i.x,
+ r = i.y,
+ a = e.x - s,
+ h = e.y - r,
+ u = a * a + h * h;
+ return (
+ 0 < u &&
+ (1 < (o = ((t.x - s) * a + (t.y - r) * h) / u)
+ ? ((s = e.x), (r = e.y))
+ : 0 < o && ((s += a * o), (r += h * o))),
+ (a = t.x - s),
+ (h = t.y - r),
+ n ? a * a + h * h : new B(s, r)
+ );
+ }
+ function ge(t) {
+ return !v(t[0]) || ("object" != typeof t[0][0] && void 0 !== t[0][0]);
+ }
+ function ve(t) {
+ return (
+ console.warn(
+ "Deprecated use of _flat, please use L.LineUtil.isFlat instead.",
+ ),
+ ge(t)
+ );
+ }
+ var ye = (Object.freeze || Object)({
+ simplify: ce,
+ pointToSegmentDistance: _e,
+ closestPointOnSegment: function (t, i, e) {
+ return fe(t, i, e);
+ },
+ clipSegment: de,
+ _getEdgeIntersection: pe,
+ _getBitCode: me,
+ _sqClosestPointOnSegment: fe,
+ isFlat: ge,
+ _flat: ve,
+ });
+ function xe(t, i, e) {
+ var n,
+ o,
+ s,
+ r,
+ a,
+ h,
+ u,
+ l,
+ c,
+ _ = [1, 4, 2, 8];
+ for (o = 0, u = t.length; o < u; o++) t[o]._code = me(t[o], i);
+ for (r = 0; r < 4; r++) {
+ for (l = _[r], n = [], o = 0, s = (u = t.length) - 1; o < u; s = o++)
+ (a = t[o]),
+ (h = t[s]),
+ a._code & l
+ ? h._code & l ||
+ (((c = pe(h, a, l, i, e))._code = me(c, i)), n.push(c))
+ : (h._code & l &&
+ (((c = pe(h, a, l, i, e))._code = me(c, i)), n.push(c)),
+ n.push(a));
+ t = n;
+ }
+ return t;
+ }
+ var we,
+ Pe = (Object.freeze || Object)({ clipPolygon: xe }),
+ Le = {
+ project: function (t) {
+ return new B(t.lng, t.lat);
+ },
+ unproject: function (t) {
+ return new j(t.y, t.x);
+ },
+ bounds: new O([-180, -90], [180, 90]),
+ },
+ be = {
+ R: 6378137,
+ R_MINOR: 6356752.314245179,
+ bounds: new O(
+ [-20037508.34279, -15496570.73972],
+ [20037508.34279, 18764656.23138],
+ ),
+ project: function (t) {
+ var i = Math.PI / 180,
+ e = this.R,
+ n = t.lat * i,
+ o = this.R_MINOR / e,
+ s = Math.sqrt(1 - o * o),
+ r = s * Math.sin(n),
+ a =
+ Math.tan(Math.PI / 4 - n / 2) / Math.pow((1 - r) / (1 + r), s / 2);
+ return (n = -e * Math.log(Math.max(a, 1e-10))), new B(t.lng * i * e, n);
+ },
+ unproject: function (t) {
+ for (
+ var i,
+ e = 180 / Math.PI,
+ n = this.R,
+ o = this.R_MINOR / n,
+ s = Math.sqrt(1 - o * o),
+ r = Math.exp(-t.y / n),
+ a = Math.PI / 2 - 2 * Math.atan(r),
+ h = 0,
+ u = 0.1;
+ h < 15 && 1e-7 < Math.abs(u);
+ h++
+ )
+ (i = s * Math.sin(a)),
+ (i = Math.pow((1 - i) / (1 + i), s / 2)),
+ (a += u = Math.PI / 2 - 2 * Math.atan(r * i) - a);
+ return new j(a * e, (t.x * e) / n);
+ },
+ },
+ Te = (Object.freeze || Object)({
+ LonLat: Le,
+ Mercator: be,
+ SphericalMercator: q,
+ }),
+ ze = h({}, U, {
+ code: "EPSG:3395",
+ projection: be,
+ transformation: ((we = 0.5 / (Math.PI * be.R)), K(we, 0.5, -we, 0.5)),
+ }),
+ Me = h({}, U, {
+ code: "EPSG:4326",
+ projection: Le,
+ transformation: K(1 / 180, 1, -1 / 180, 0.5),
+ }),
+ Ce = h({}, F, {
+ projection: Le,
+ transformation: K(1, 0, -1, 0),
+ scale: function (t) {
+ return Math.pow(2, t);
+ },
+ zoom: function (t) {
+ return Math.log(t) / Math.LN2;
+ },
+ distance: function (t, i) {
+ var e = i.lng - t.lng,
+ n = i.lat - t.lat;
+ return Math.sqrt(e * e + n * n);
+ },
+ infinite: !0,
+ });
+ (F.Earth = U),
+ (F.EPSG3395 = ze),
+ (F.EPSG3857 = X),
+ (F.EPSG900913 = J),
+ (F.EPSG4326 = Me),
+ (F.Simple = Ce);
+ var Se = k.extend({
+ options: {
+ pane: "overlayPane",
+ attribution: null,
+ bubblingMouseEvents: !0,
+ },
+ addTo: function (t) {
+ return t.addLayer(this), this;
+ },
+ remove: function () {
+ return this.removeFrom(this._map || this._mapToAdd);
+ },
+ removeFrom: function (t) {
+ return t && t.removeLayer(this), this;
+ },
+ getPane: function (t) {
+ return this._map.getPane(t ? this.options[t] || t : this.options.pane);
+ },
+ addInteractiveTarget: function (t) {
+ return (this._map._targets[u(t)] = this);
+ },
+ removeInteractiveTarget: function (t) {
+ return delete this._map._targets[u(t)], this;
+ },
+ getAttribution: function () {
+ return this.options.attribution;
+ },
+ _layerAdd: function (t) {
+ var i = t.target;
+ if (i.hasLayer(this)) {
+ if (
+ ((this._map = i),
+ (this._zoomAnimated = i._zoomAnimated),
+ this.getEvents)
+ ) {
+ var e = this.getEvents();
+ i.on(e, this),
+ this.once(
+ "remove",
+ function () {
+ i.off(e, this);
+ },
+ this,
+ );
+ }
+ this.onAdd(i),
+ this.getAttribution &&
+ i.attributionControl &&
+ i.attributionControl.addAttribution(this.getAttribution()),
+ this.fire("add"),
+ i.fire("layeradd", { layer: this });
+ }
+ },
+ });
+ Ji.include({
+ addLayer: function (t) {
+ if (!t._layerAdd) throw new Error("The provided object is not a Layer.");
+ var i = u(t);
+ return (
+ this._layers[i] ||
+ (((this._layers[i] = t)._mapToAdd = this),
+ t.beforeAdd && t.beforeAdd(this),
+ this.whenReady(t._layerAdd, t)),
+ this
+ );
+ },
+ removeLayer: function (t) {
+ var i = u(t);
+ return (
+ this._layers[i] &&
+ (this._loaded && t.onRemove(this),
+ t.getAttribution &&
+ this.attributionControl &&
+ this.attributionControl.removeAttribution(t.getAttribution()),
+ delete this._layers[i],
+ this._loaded &&
+ (this.fire("layerremove", { layer: t }), t.fire("remove")),
+ (t._map = t._mapToAdd = null)),
+ this
+ );
+ },
+ hasLayer: function (t) {
+ return !!t && u(t) in this._layers;
+ },
+ eachLayer: function (t, i) {
+ for (var e in this._layers) t.call(i, this._layers[e]);
+ return this;
+ },
+ _addLayers: function (t) {
+ for (var i = 0, e = (t = t ? (v(t) ? t : [t]) : []).length; i < e; i++)
+ this.addLayer(t[i]);
+ },
+ _addZoomLimit: function (t) {
+ (!isNaN(t.options.maxZoom) && isNaN(t.options.minZoom)) ||
+ ((this._zoomBoundLayers[u(t)] = t), this._updateZoomLevels());
+ },
+ _removeZoomLimit: function (t) {
+ var i = u(t);
+ this._zoomBoundLayers[i] &&
+ (delete this._zoomBoundLayers[i], this._updateZoomLevels());
+ },
+ _updateZoomLevels: function () {
+ var t = 1 / 0,
+ i = -1 / 0,
+ e = this._getZoomSpan();
+ for (var n in this._zoomBoundLayers) {
+ var o = this._zoomBoundLayers[n].options;
+ (t = void 0 === o.minZoom ? t : Math.min(t, o.minZoom)),
+ (i = void 0 === o.maxZoom ? i : Math.max(i, o.maxZoom));
+ }
+ (this._layersMaxZoom = i === -1 / 0 ? void 0 : i),
+ (this._layersMinZoom = t === 1 / 0 ? void 0 : t),
+ e !== this._getZoomSpan() && this.fire("zoomlevelschange"),
+ void 0 === this.options.maxZoom &&
+ this._layersMaxZoom &&
+ this.getZoom() > this._layersMaxZoom &&
+ this.setZoom(this._layersMaxZoom),
+ void 0 === this.options.minZoom &&
+ this._layersMinZoom &&
+ this.getZoom() < this._layersMinZoom &&
+ this.setZoom(this._layersMinZoom);
+ },
+ });
+ var Ze = Se.extend({
+ initialize: function (t, i) {
+ var e, n;
+ if ((p(this, i), (this._layers = {}), t))
+ for (e = 0, n = t.length; e < n; e++) this.addLayer(t[e]);
+ },
+ addLayer: function (t) {
+ var i = this.getLayerId(t);
+ return (this._layers[i] = t), this._map && this._map.addLayer(t), this;
+ },
+ removeLayer: function (t) {
+ var i = t in this._layers ? t : this.getLayerId(t);
+ return (
+ this._map &&
+ this._layers[i] &&
+ this._map.removeLayer(this._layers[i]),
+ delete this._layers[i],
+ this
+ );
+ },
+ hasLayer: function (t) {
+ return !!t && (t in this._layers || this.getLayerId(t) in this._layers);
+ },
+ clearLayers: function () {
+ return this.eachLayer(this.removeLayer, this);
+ },
+ invoke: function (t) {
+ var i,
+ e,
+ n = Array.prototype.slice.call(arguments, 1);
+ for (i in this._layers) (e = this._layers[i])[t] && e[t].apply(e, n);
+ return this;
+ },
+ onAdd: function (t) {
+ this.eachLayer(t.addLayer, t);
+ },
+ onRemove: function (t) {
+ this.eachLayer(t.removeLayer, t);
+ },
+ eachLayer: function (t, i) {
+ for (var e in this._layers) t.call(i, this._layers[e]);
+ return this;
+ },
+ getLayer: function (t) {
+ return this._layers[t];
+ },
+ getLayers: function () {
+ var t = [];
+ return this.eachLayer(t.push, t), t;
+ },
+ setZIndex: function (t) {
+ return this.invoke("setZIndex", t);
+ },
+ getLayerId: function (t) {
+ return u(t);
+ },
+ }),
+ Ee = Ze.extend({
+ addLayer: function (t) {
+ return this.hasLayer(t)
+ ? this
+ : (t.addEventParent(this),
+ Ze.prototype.addLayer.call(this, t),
+ this.fire("layeradd", { layer: t }));
+ },
+ removeLayer: function (t) {
+ return this.hasLayer(t)
+ ? (t in this._layers && (t = this._layers[t]),
+ t.removeEventParent(this),
+ Ze.prototype.removeLayer.call(this, t),
+ this.fire("layerremove", { layer: t }))
+ : this;
+ },
+ setStyle: function (t) {
+ return this.invoke("setStyle", t);
+ },
+ bringToFront: function () {
+ return this.invoke("bringToFront");
+ },
+ bringToBack: function () {
+ return this.invoke("bringToBack");
+ },
+ getBounds: function () {
+ var t = new N();
+ for (var i in this._layers) {
+ var e = this._layers[i];
+ t.extend(e.getBounds ? e.getBounds() : e.getLatLng());
+ }
+ return t;
+ },
+ }),
+ ke = Z.extend({
+ options: { popupAnchor: [0, 0], tooltipAnchor: [0, 0] },
+ initialize: function (t) {
+ p(this, t);
+ },
+ createIcon: function (t) {
+ return this._createIcon("icon", t);
+ },
+ createShadow: function (t) {
+ return this._createIcon("shadow", t);
+ },
+ _createIcon: function (t, i) {
+ var e = this._getIconUrl(t);
+ if (!e) {
+ if ("icon" === t)
+ throw new Error("iconUrl not set in Icon options (see the docs).");
+ return null;
+ }
+ var n = this._createImg(e, i && "IMG" === i.tagName ? i : null);
+ return this._setIconStyles(n, t), n;
+ },
+ _setIconStyles: function (t, i) {
+ var e = this.options,
+ n = e[i + "Size"];
+ "number" == typeof n && (n = [n, n]);
+ var o = I(n),
+ s = I(
+ ("shadow" === i && e.shadowAnchor) ||
+ e.iconAnchor ||
+ (o && o.divideBy(2, !0)),
+ );
+ (t.className = "leaflet-marker-" + i + " " + (e.className || "")),
+ s &&
+ ((t.style.marginLeft = -s.x + "px"),
+ (t.style.marginTop = -s.y + "px")),
+ o && ((t.style.width = o.x + "px"), (t.style.height = o.y + "px"));
+ },
+ _createImg: function (t, i) {
+ return ((i = i || document.createElement("img")).src = t), i;
+ },
+ _getIconUrl: function (t) {
+ return (Ct && this.options[t + "RetinaUrl"]) || this.options[t + "Url"];
+ },
+ });
+ var Be = ke.extend({
+ options: {
+ iconUrl: "marker-icon.png",
+ iconRetinaUrl: "marker-icon-2x.png",
+ shadowUrl: "marker-shadow.png",
+ iconSize: [25, 41],
+ iconAnchor: [12, 41],
+ popupAnchor: [1, -34],
+ tooltipAnchor: [16, -28],
+ shadowSize: [41, 41],
+ },
+ _getIconUrl: function (t) {
+ return (
+ Be.imagePath || (Be.imagePath = this._detectIconPath()),
+ (this.options.imagePath || Be.imagePath) +
+ ke.prototype._getIconUrl.call(this, t)
+ );
+ },
+ _detectIconPath: function () {
+ var t = hi("div", "leaflet-default-icon-path", document.body),
+ i = ai(t, "background-image") || ai(t, "backgroundImage");
+ return (
+ document.body.removeChild(t),
+ (i =
+ null === i || 0 !== i.indexOf("url")
+ ? ""
+ : i
+ .replace(/^url\(["']?/, "")
+ .replace(/marker-icon\.png["']?\)$/, ""))
+ );
+ },
+ }),
+ Ae = oe.extend({
+ initialize: function (t) {
+ this._marker = t;
+ },
+ addHooks: function () {
+ var t = this._marker._icon;
+ this._draggable || (this._draggable = new le(t, t, !0)),
+ this._draggable
+ .on(
+ {
+ dragstart: this._onDragStart,
+ predrag: this._onPreDrag,
+ drag: this._onDrag,
+ dragend: this._onDragEnd,
+ },
+ this,
+ )
+ .enable(),
+ pi(t, "leaflet-marker-draggable");
+ },
+ removeHooks: function () {
+ this._draggable
+ .off(
+ {
+ dragstart: this._onDragStart,
+ predrag: this._onPreDrag,
+ drag: this._onDrag,
+ dragend: this._onDragEnd,
+ },
+ this,
+ )
+ .disable(),
+ this._marker._icon &&
+ mi(this._marker._icon, "leaflet-marker-draggable");
+ },
+ moved: function () {
+ return this._draggable && this._draggable._moved;
+ },
+ _adjustPan: function (t) {
+ var i = this._marker,
+ e = i._map,
+ n = this._marker.options.autoPanSpeed,
+ o = this._marker.options.autoPanPadding,
+ s = Pi(i._icon),
+ r = e.getPixelBounds(),
+ a = e.getPixelOrigin(),
+ h = R(r.min._subtract(a).add(o), r.max._subtract(a).subtract(o));
+ if (!h.contains(s)) {
+ var u = I(
+ (Math.max(h.max.x, s.x) - h.max.x) / (r.max.x - h.max.x) -
+ (Math.min(h.min.x, s.x) - h.min.x) / (r.min.x - h.min.x),
+ (Math.max(h.max.y, s.y) - h.max.y) / (r.max.y - h.max.y) -
+ (Math.min(h.min.y, s.y) - h.min.y) / (r.min.y - h.min.y),
+ ).multiplyBy(n);
+ e.panBy(u, { animate: !1 }),
+ this._draggable._newPos._add(u),
+ this._draggable._startPos._add(u),
+ wi(i._icon, this._draggable._newPos),
+ this._onDrag(t),
+ (this._panRequest = M(this._adjustPan.bind(this, t)));
+ }
+ },
+ _onDragStart: function () {
+ (this._oldLatLng = this._marker.getLatLng()),
+ this._marker.closePopup().fire("movestart").fire("dragstart");
+ },
+ _onPreDrag: function (t) {
+ this._marker.options.autoPan &&
+ (C(this._panRequest),
+ (this._panRequest = M(this._adjustPan.bind(this, t))));
+ },
+ _onDrag: function (t) {
+ var i = this._marker,
+ e = i._shadow,
+ n = Pi(i._icon),
+ o = i._map.layerPointToLatLng(n);
+ e && wi(e, n),
+ (i._latlng = o),
+ (t.latlng = o),
+ (t.oldLatLng = this._oldLatLng),
+ i.fire("move", t).fire("drag", t);
+ },
+ _onDragEnd: function (t) {
+ C(this._panRequest),
+ delete this._oldLatLng,
+ this._marker.fire("moveend").fire("dragend", t);
+ },
+ }),
+ Ie = Se.extend({
+ options: {
+ icon: new Be(),
+ interactive: !0,
+ keyboard: !0,
+ title: "",
+ alt: "",
+ zIndexOffset: 0,
+ opacity: 1,
+ riseOnHover: !1,
+ riseOffset: 250,
+ pane: "markerPane",
+ shadowPane: "shadowPane",
+ bubblingMouseEvents: !1,
+ draggable: !1,
+ autoPan: !1,
+ autoPanPadding: [50, 50],
+ autoPanSpeed: 10,
+ },
+ initialize: function (t, i) {
+ p(this, i), (this._latlng = W(t));
+ },
+ onAdd: function (t) {
+ (this._zoomAnimated =
+ this._zoomAnimated && t.options.markerZoomAnimation),
+ this._zoomAnimated && t.on("zoomanim", this._animateZoom, this),
+ this._initIcon(),
+ this.update();
+ },
+ onRemove: function (t) {
+ this.dragging &&
+ this.dragging.enabled() &&
+ ((this.options.draggable = !0), this.dragging.removeHooks()),
+ delete this.dragging,
+ this._zoomAnimated && t.off("zoomanim", this._animateZoom, this),
+ this._removeIcon(),
+ this._removeShadow();
+ },
+ getEvents: function () {
+ return { zoom: this.update, viewreset: this.update };
+ },
+ getLatLng: function () {
+ return this._latlng;
+ },
+ setLatLng: function (t) {
+ var i = this._latlng;
+ return (
+ (this._latlng = W(t)),
+ this.update(),
+ this.fire("move", { oldLatLng: i, latlng: this._latlng })
+ );
+ },
+ setZIndexOffset: function (t) {
+ return (this.options.zIndexOffset = t), this.update();
+ },
+ getIcon: function () {
+ return this.options.icon;
+ },
+ setIcon: function (t) {
+ return (
+ (this.options.icon = t),
+ this._map && (this._initIcon(), this.update()),
+ this._popup && this.bindPopup(this._popup, this._popup.options),
+ this
+ );
+ },
+ getElement: function () {
+ return this._icon;
+ },
+ update: function () {
+ if (this._icon && this._map) {
+ var t = this._map.latLngToLayerPoint(this._latlng).round();
+ this._setPos(t);
+ }
+ return this;
+ },
+ _initIcon: function () {
+ var t = this.options,
+ i = "leaflet-zoom-" + (this._zoomAnimated ? "animated" : "hide"),
+ e = t.icon.createIcon(this._icon),
+ n = !1;
+ e !== this._icon &&
+ (this._icon && this._removeIcon(),
+ (n = !0),
+ t.title && (e.title = t.title),
+ "IMG" === e.tagName && (e.alt = t.alt || "")),
+ pi(e, i),
+ t.keyboard && (e.tabIndex = "0"),
+ (this._icon = e),
+ t.riseOnHover &&
+ this.on({
+ mouseover: this._bringToFront,
+ mouseout: this._resetZIndex,
+ });
+ var o = t.icon.createShadow(this._shadow),
+ s = !1;
+ o !== this._shadow && (this._removeShadow(), (s = !0)),
+ o && (pi(o, i), (o.alt = "")),
+ (this._shadow = o),
+ t.opacity < 1 && this._updateOpacity(),
+ n && this.getPane().appendChild(this._icon),
+ this._initInteraction(),
+ o && s && this.getPane(t.shadowPane).appendChild(this._shadow);
+ },
+ _removeIcon: function () {
+ this.options.riseOnHover &&
+ this.off({
+ mouseover: this._bringToFront,
+ mouseout: this._resetZIndex,
+ }),
+ ui(this._icon),
+ this.removeInteractiveTarget(this._icon),
+ (this._icon = null);
+ },
+ _removeShadow: function () {
+ this._shadow && ui(this._shadow), (this._shadow = null);
+ },
+ _setPos: function (t) {
+ wi(this._icon, t),
+ this._shadow && wi(this._shadow, t),
+ (this._zIndex = t.y + this.options.zIndexOffset),
+ this._resetZIndex();
+ },
+ _updateZIndex: function (t) {
+ this._icon.style.zIndex = this._zIndex + t;
+ },
+ _animateZoom: function (t) {
+ var i = this._map
+ ._latLngToNewLayerPoint(this._latlng, t.zoom, t.center)
+ .round();
+ this._setPos(i);
+ },
+ _initInteraction: function () {
+ if (
+ this.options.interactive &&
+ (pi(this._icon, "leaflet-interactive"),
+ this.addInteractiveTarget(this._icon),
+ Ae)
+ ) {
+ var t = this.options.draggable;
+ this.dragging &&
+ ((t = this.dragging.enabled()), this.dragging.disable()),
+ (this.dragging = new Ae(this)),
+ t && this.dragging.enable();
+ }
+ },
+ setOpacity: function (t) {
+ return (
+ (this.options.opacity = t), this._map && this._updateOpacity(), this
+ );
+ },
+ _updateOpacity: function () {
+ var t = this.options.opacity;
+ this._icon && vi(this._icon, t), this._shadow && vi(this._shadow, t);
+ },
+ _bringToFront: function () {
+ this._updateZIndex(this.options.riseOffset);
+ },
+ _resetZIndex: function () {
+ this._updateZIndex(0);
+ },
+ _getPopupAnchor: function () {
+ return this.options.icon.options.popupAnchor;
+ },
+ _getTooltipAnchor: function () {
+ return this.options.icon.options.tooltipAnchor;
+ },
+ });
+ var Oe = Se.extend({
+ options: {
+ stroke: !0,
+ color: "#3388ff",
+ weight: 3,
+ opacity: 1,
+ lineCap: "round",
+ lineJoin: "round",
+ dashArray: null,
+ dashOffset: null,
+ fill: !1,
+ fillColor: null,
+ fillOpacity: 0.2,
+ fillRule: "evenodd",
+ interactive: !0,
+ bubblingMouseEvents: !0,
+ },
+ beforeAdd: function (t) {
+ this._renderer = t.getRenderer(this);
+ },
+ onAdd: function () {
+ this._renderer._initPath(this),
+ this._reset(),
+ this._renderer._addPath(this);
+ },
+ onRemove: function () {
+ this._renderer._removePath(this);
+ },
+ redraw: function () {
+ return this._map && this._renderer._updatePath(this), this;
+ },
+ setStyle: function (t) {
+ return (
+ p(this, t),
+ this._renderer &&
+ (this._renderer._updateStyle(this),
+ this.options.stroke &&
+ t.hasOwnProperty("weight") &&
+ this._updateBounds()),
+ this
+ );
+ },
+ bringToFront: function () {
+ return this._renderer && this._renderer._bringToFront(this), this;
+ },
+ bringToBack: function () {
+ return this._renderer && this._renderer._bringToBack(this), this;
+ },
+ getElement: function () {
+ return this._path;
+ },
+ _reset: function () {
+ this._project(), this._update();
+ },
+ _clickTolerance: function () {
+ return (
+ (this.options.stroke ? this.options.weight / 2 : 0) +
+ this._renderer.options.tolerance
+ );
+ },
+ }),
+ Re = Oe.extend({
+ options: { fill: !0, radius: 10 },
+ initialize: function (t, i) {
+ p(this, i), (this._latlng = W(t)), (this._radius = this.options.radius);
+ },
+ setLatLng: function (t) {
+ return (
+ (this._latlng = W(t)),
+ this.redraw(),
+ this.fire("move", { latlng: this._latlng })
+ );
+ },
+ getLatLng: function () {
+ return this._latlng;
+ },
+ setRadius: function (t) {
+ return (this.options.radius = this._radius = t), this.redraw();
+ },
+ getRadius: function () {
+ return this._radius;
+ },
+ setStyle: function (t) {
+ var i = (t && t.radius) || this._radius;
+ return Oe.prototype.setStyle.call(this, t), this.setRadius(i), this;
+ },
+ _project: function () {
+ (this._point = this._map.latLngToLayerPoint(this._latlng)),
+ this._updateBounds();
+ },
+ _updateBounds: function () {
+ var t = this._radius,
+ i = this._radiusY || t,
+ e = this._clickTolerance(),
+ n = [t + e, i + e];
+ this._pxBounds = new O(this._point.subtract(n), this._point.add(n));
+ },
+ _update: function () {
+ this._map && this._updatePath();
+ },
+ _updatePath: function () {
+ this._renderer._updateCircle(this);
+ },
+ _empty: function () {
+ return (
+ this._radius && !this._renderer._bounds.intersects(this._pxBounds)
+ );
+ },
+ _containsPoint: function (t) {
+ return (
+ t.distanceTo(this._point) <= this._radius + this._clickTolerance()
+ );
+ },
+ });
+ var Ne = Re.extend({
+ initialize: function (t, i, e) {
+ if (
+ ("number" == typeof i && (i = h({}, e, { radius: i })),
+ p(this, i),
+ (this._latlng = W(t)),
+ isNaN(this.options.radius))
+ )
+ throw new Error("Circle radius cannot be NaN");
+ this._mRadius = this.options.radius;
+ },
+ setRadius: function (t) {
+ return (this._mRadius = t), this.redraw();
+ },
+ getRadius: function () {
+ return this._mRadius;
+ },
+ getBounds: function () {
+ var t = [this._radius, this._radiusY || this._radius];
+ return new N(
+ this._map.layerPointToLatLng(this._point.subtract(t)),
+ this._map.layerPointToLatLng(this._point.add(t)),
+ );
+ },
+ setStyle: Oe.prototype.setStyle,
+ _project: function () {
+ var t = this._latlng.lng,
+ i = this._latlng.lat,
+ e = this._map,
+ n = e.options.crs;
+ if (n.distance === U.distance) {
+ var o = Math.PI / 180,
+ s = this._mRadius / U.R / o,
+ r = e.project([i + s, t]),
+ a = e.project([i - s, t]),
+ h = r.add(a).divideBy(2),
+ u = e.unproject(h).lat,
+ l =
+ Math.acos(
+ (Math.cos(s * o) - Math.sin(i * o) * Math.sin(u * o)) /
+ (Math.cos(i * o) * Math.cos(u * o)),
+ ) / o;
+ (!isNaN(l) && 0 !== l) || (l = s / Math.cos((Math.PI / 180) * i)),
+ (this._point = h.subtract(e.getPixelOrigin())),
+ (this._radius = isNaN(l) ? 0 : h.x - e.project([u, t - l]).x),
+ (this._radiusY = h.y - r.y);
+ } else {
+ var c = n.unproject(
+ n.project(this._latlng).subtract([this._mRadius, 0]),
+ );
+ (this._point = e.latLngToLayerPoint(this._latlng)),
+ (this._radius = this._point.x - e.latLngToLayerPoint(c).x);
+ }
+ this._updateBounds();
+ },
+ });
+ var De = Oe.extend({
+ options: { smoothFactor: 1, noClip: !1 },
+ initialize: function (t, i) {
+ p(this, i), this._setLatLngs(t);
+ },
+ getLatLngs: function () {
+ return this._latlngs;
+ },
+ setLatLngs: function (t) {
+ return this._setLatLngs(t), this.redraw();
+ },
+ isEmpty: function () {
+ return !this._latlngs.length;
+ },
+ closestLayerPoint: function (t) {
+ for (
+ var i, e, n = 1 / 0, o = null, s = fe, r = 0, a = this._parts.length;
+ r < a;
+ r++
+ )
+ for (var h = this._parts[r], u = 1, l = h.length; u < l; u++) {
+ var c = s(t, (i = h[u - 1]), (e = h[u]), !0);
+ c < n && ((n = c), (o = s(t, i, e)));
+ }
+ return o && (o.distance = Math.sqrt(n)), o;
+ },
+ getCenter: function () {
+ if (!this._map)
+ throw new Error("Must add layer to map before using getCenter()");
+ var t,
+ i,
+ e,
+ n,
+ o,
+ s,
+ r,
+ a = this._rings[0],
+ h = a.length;
+ if (!h) return null;
+ for (i = t = 0; t < h - 1; t++) i += a[t].distanceTo(a[t + 1]) / 2;
+ if (0 === i) return this._map.layerPointToLatLng(a[0]);
+ for (n = t = 0; t < h - 1; t++)
+ if (((o = a[t]), (s = a[t + 1]), i < (n += e = o.distanceTo(s))))
+ return (
+ (r = (n - i) / e),
+ this._map.layerPointToLatLng([
+ s.x - r * (s.x - o.x),
+ s.y - r * (s.y - o.y),
+ ])
+ );
+ },
+ getBounds: function () {
+ return this._bounds;
+ },
+ addLatLng: function (t, i) {
+ return (
+ (i = i || this._defaultShape()),
+ (t = W(t)),
+ i.push(t),
+ this._bounds.extend(t),
+ this.redraw()
+ );
+ },
+ _setLatLngs: function (t) {
+ (this._bounds = new N()), (this._latlngs = this._convertLatLngs(t));
+ },
+ _defaultShape: function () {
+ return ge(this._latlngs) ? this._latlngs : this._latlngs[0];
+ },
+ _convertLatLngs: function (t) {
+ for (var i = [], e = ge(t), n = 0, o = t.length; n < o; n++)
+ e
+ ? ((i[n] = W(t[n])), this._bounds.extend(i[n]))
+ : (i[n] = this._convertLatLngs(t[n]));
+ return i;
+ },
+ _project: function () {
+ var t = new O();
+ (this._rings = []),
+ this._projectLatlngs(this._latlngs, this._rings, t),
+ this._bounds.isValid() &&
+ t.isValid() &&
+ ((this._rawPxBounds = t), this._updateBounds());
+ },
+ _updateBounds: function () {
+ var t = this._clickTolerance(),
+ i = new B(t, t);
+ this._pxBounds = new O([
+ this._rawPxBounds.min.subtract(i),
+ this._rawPxBounds.max.add(i),
+ ]);
+ },
+ _projectLatlngs: function (t, i, e) {
+ var n,
+ o,
+ s = t[0] instanceof j,
+ r = t.length;
+ if (s) {
+ for (o = [], n = 0; n < r; n++)
+ (o[n] = this._map.latLngToLayerPoint(t[n])), e.extend(o[n]);
+ i.push(o);
+ } else for (n = 0; n < r; n++) this._projectLatlngs(t[n], i, e);
+ },
+ _clipPoints: function () {
+ var t = this._renderer._bounds;
+ if (((this._parts = []), this._pxBounds && this._pxBounds.intersects(t)))
+ if (this.options.noClip) this._parts = this._rings;
+ else {
+ var i,
+ e,
+ n,
+ o,
+ s,
+ r,
+ a,
+ h = this._parts;
+ for (n = i = 0, o = this._rings.length; i < o; i++)
+ for (e = 0, s = (a = this._rings[i]).length; e < s - 1; e++)
+ (r = de(a[e], a[e + 1], t, e, !0)) &&
+ ((h[n] = h[n] || []),
+ h[n].push(r[0]),
+ (r[1] === a[e + 1] && e !== s - 2) || (h[n].push(r[1]), n++));
+ }
+ },
+ _simplifyPoints: function () {
+ for (
+ var t = this._parts, i = this.options.smoothFactor, e = 0, n = t.length;
+ e < n;
+ e++
+ )
+ t[e] = ce(t[e], i);
+ },
+ _update: function () {
+ this._map &&
+ (this._clipPoints(), this._simplifyPoints(), this._updatePath());
+ },
+ _updatePath: function () {
+ this._renderer._updatePoly(this);
+ },
+ _containsPoint: function (t, i) {
+ var e,
+ n,
+ o,
+ s,
+ r,
+ a,
+ h = this._clickTolerance();
+ if (!this._pxBounds || !this._pxBounds.contains(t)) return !1;
+ for (e = 0, s = this._parts.length; e < s; e++)
+ for (n = 0, o = (r = (a = this._parts[e]).length) - 1; n < r; o = n++)
+ if ((i || 0 !== n) && _e(t, a[o], a[n]) <= h) return !0;
+ return !1;
+ },
+ });
+ De._flat = ve;
+ var je = De.extend({
+ options: { fill: !0 },
+ isEmpty: function () {
+ return !this._latlngs.length || !this._latlngs[0].length;
+ },
+ getCenter: function () {
+ if (!this._map)
+ throw new Error("Must add layer to map before using getCenter()");
+ var t,
+ i,
+ e,
+ n,
+ o,
+ s,
+ r,
+ a,
+ h,
+ u = this._rings[0],
+ l = u.length;
+ if (!l) return null;
+ for (s = r = a = 0, t = 0, i = l - 1; t < l; i = t++)
+ (e = u[t]),
+ (n = u[i]),
+ (o = e.y * n.x - n.y * e.x),
+ (r += (e.x + n.x) * o),
+ (a += (e.y + n.y) * o),
+ (s += 3 * o);
+ return (
+ (h = 0 === s ? u[0] : [r / s, a / s]), this._map.layerPointToLatLng(h)
+ );
+ },
+ _convertLatLngs: function (t) {
+ var i = De.prototype._convertLatLngs.call(this, t),
+ e = i.length;
+ return 2 <= e && i[0] instanceof j && i[0].equals(i[e - 1]) && i.pop(), i;
+ },
+ _setLatLngs: function (t) {
+ De.prototype._setLatLngs.call(this, t),
+ ge(this._latlngs) && (this._latlngs = [this._latlngs]);
+ },
+ _defaultShape: function () {
+ return ge(this._latlngs[0]) ? this._latlngs[0] : this._latlngs[0][0];
+ },
+ _clipPoints: function () {
+ var t = this._renderer._bounds,
+ i = this.options.weight,
+ e = new B(i, i);
+ if (
+ ((t = new O(t.min.subtract(e), t.max.add(e))),
+ (this._parts = []),
+ this._pxBounds && this._pxBounds.intersects(t))
+ )
+ if (this.options.noClip) this._parts = this._rings;
+ else
+ for (var n, o = 0, s = this._rings.length; o < s; o++)
+ (n = xe(this._rings[o], t, !0)).length && this._parts.push(n);
+ },
+ _updatePath: function () {
+ this._renderer._updatePoly(this, !0);
+ },
+ _containsPoint: function (t) {
+ var i,
+ e,
+ n,
+ o,
+ s,
+ r,
+ a,
+ h,
+ u = !1;
+ if (!this._pxBounds || !this._pxBounds.contains(t)) return !1;
+ for (o = 0, a = this._parts.length; o < a; o++)
+ for (s = 0, r = (h = (i = this._parts[o]).length) - 1; s < h; r = s++)
+ (e = i[s]),
+ (n = i[r]),
+ e.y > t.y != n.y > t.y &&
+ t.x < ((n.x - e.x) * (t.y - e.y)) / (n.y - e.y) + e.x &&
+ (u = !u);
+ return u || De.prototype._containsPoint.call(this, t, !0);
+ },
+ });
+ var We = Ee.extend({
+ initialize: function (t, i) {
+ p(this, i), (this._layers = {}), t && this.addData(t);
+ },
+ addData: function (t) {
+ var i,
+ e,
+ n,
+ o = v(t) ? t : t.features;
+ if (o) {
+ for (i = 0, e = o.length; i < e; i++)
+ ((n = o[i]).geometries ||
+ n.geometry ||
+ n.features ||
+ n.coordinates) &&
+ this.addData(n);
+ return this;
+ }
+ var s = this.options;
+ if (s.filter && !s.filter(t)) return this;
+ var r = He(t, s);
+ return r
+ ? ((r.feature = Ke(t)),
+ (r.defaultOptions = r.options),
+ this.resetStyle(r),
+ s.onEachFeature && s.onEachFeature(t, r),
+ this.addLayer(r))
+ : this;
+ },
+ resetStyle: function (t) {
+ return (
+ (t.options = h({}, t.defaultOptions)),
+ this._setLayerStyle(t, this.options.style),
+ this
+ );
+ },
+ setStyle: function (i) {
+ return this.eachLayer(function (t) {
+ this._setLayerStyle(t, i);
+ }, this);
+ },
+ _setLayerStyle: function (t, i) {
+ t.setStyle &&
+ ("function" == typeof i && (i = i(t.feature)), t.setStyle(i));
+ },
+ });
+ function He(t, i) {
+ var e,
+ n,
+ o,
+ s,
+ r = "Feature" === t.type ? t.geometry : t,
+ a = r ? r.coordinates : null,
+ h = [],
+ u = i && i.pointToLayer,
+ l = (i && i.coordsToLatLng) || Fe;
+ if (!a && !r) return null;
+ switch (r.type) {
+ case "Point":
+ return (e = l(a)), u ? u(t, e) : new Ie(e);
+ case "MultiPoint":
+ for (o = 0, s = a.length; o < s; o++)
+ (e = l(a[o])), h.push(u ? u(t, e) : new Ie(e));
+ return new Ee(h);
+ case "LineString":
+ case "MultiLineString":
+ return (n = Ue(a, "LineString" === r.type ? 0 : 1, l)), new De(n, i);
+ case "Polygon":
+ case "MultiPolygon":
+ return (n = Ue(a, "Polygon" === r.type ? 1 : 2, l)), new je(n, i);
+ case "GeometryCollection":
+ for (o = 0, s = r.geometries.length; o < s; o++) {
+ var c = He(
+ {
+ geometry: r.geometries[o],
+ type: "Feature",
+ properties: t.properties,
+ },
+ i,
+ );
+ c && h.push(c);
+ }
+ return new Ee(h);
+ default:
+ throw new Error("Invalid GeoJSON object.");
+ }
+ }
+ function Fe(t) {
+ return new j(t[1], t[0], t[2]);
+ }
+ function Ue(t, i, e) {
+ for (var n, o = [], s = 0, r = t.length; s < r; s++)
+ (n = i ? Ue(t[s], i - 1, e) : (e || Fe)(t[s])), o.push(n);
+ return o;
+ }
+ function Ve(t, i) {
+ return (
+ (i = "number" == typeof i ? i : 6),
+ void 0 !== t.alt
+ ? [c(t.lng, i), c(t.lat, i), c(t.alt, i)]
+ : [c(t.lng, i), c(t.lat, i)]
+ );
+ }
+ function qe(t, i, e, n) {
+ for (var o = [], s = 0, r = t.length; s < r; s++)
+ o.push(i ? qe(t[s], i - 1, e, n) : Ve(t[s], n));
+ return !i && e && o.push(o[0]), o;
+ }
+ function Ge(t, i) {
+ return t.feature ? h({}, t.feature, { geometry: i }) : Ke(i);
+ }
+ function Ke(t) {
+ return "Feature" === t.type || "FeatureCollection" === t.type
+ ? t
+ : { type: "Feature", properties: {}, geometry: t };
+ }
+ var Ye = {
+ toGeoJSON: function (t) {
+ return Ge(this, { type: "Point", coordinates: Ve(this.getLatLng(), t) });
+ },
+ };
+ function Xe(t, i) {
+ return new We(t, i);
+ }
+ Ie.include(Ye),
+ Ne.include(Ye),
+ Re.include(Ye),
+ De.include({
+ toGeoJSON: function (t) {
+ var i = !ge(this._latlngs);
+ return Ge(this, {
+ type: (i ? "Multi" : "") + "LineString",
+ coordinates: qe(this._latlngs, i ? 1 : 0, !1, t),
+ });
+ },
+ }),
+ je.include({
+ toGeoJSON: function (t) {
+ var i = !ge(this._latlngs),
+ e = i && !ge(this._latlngs[0]),
+ n = qe(this._latlngs, e ? 2 : i ? 1 : 0, !0, t);
+ return (
+ i || (n = [n]),
+ Ge(this, { type: (e ? "Multi" : "") + "Polygon", coordinates: n })
+ );
+ },
+ }),
+ Ze.include({
+ toMultiPoint: function (i) {
+ var e = [];
+ return (
+ this.eachLayer(function (t) {
+ e.push(t.toGeoJSON(i).geometry.coordinates);
+ }),
+ Ge(this, { type: "MultiPoint", coordinates: e })
+ );
+ },
+ toGeoJSON: function (n) {
+ var t =
+ this.feature && this.feature.geometry && this.feature.geometry.type;
+ if ("MultiPoint" === t) return this.toMultiPoint(n);
+ var o = "GeometryCollection" === t,
+ s = [];
+ return (
+ this.eachLayer(function (t) {
+ if (t.toGeoJSON) {
+ var i = t.toGeoJSON(n);
+ if (o) s.push(i.geometry);
+ else {
+ var e = Ke(i);
+ "FeatureCollection" === e.type
+ ? s.push.apply(s, e.features)
+ : s.push(e);
+ }
+ }
+ }),
+ o
+ ? Ge(this, { geometries: s, type: "GeometryCollection" })
+ : { type: "FeatureCollection", features: s }
+ );
+ },
+ });
+ var Je = Xe,
+ $e = Se.extend({
+ options: {
+ opacity: 1,
+ alt: "",
+ interactive: !1,
+ crossOrigin: !1,
+ errorOverlayUrl: "",
+ zIndex: 1,
+ className: "",
+ },
+ initialize: function (t, i, e) {
+ (this._url = t), (this._bounds = D(i)), p(this, e);
+ },
+ onAdd: function () {
+ this._image ||
+ (this._initImage(),
+ this.options.opacity < 1 && this._updateOpacity()),
+ this.options.interactive &&
+ (pi(this._image, "leaflet-interactive"),
+ this.addInteractiveTarget(this._image)),
+ this.getPane().appendChild(this._image),
+ this._reset();
+ },
+ onRemove: function () {
+ ui(this._image),
+ this.options.interactive && this.removeInteractiveTarget(this._image);
+ },
+ setOpacity: function (t) {
+ return (
+ (this.options.opacity = t), this._image && this._updateOpacity(), this
+ );
+ },
+ setStyle: function (t) {
+ return t.opacity && this.setOpacity(t.opacity), this;
+ },
+ bringToFront: function () {
+ return this._map && ci(this._image), this;
+ },
+ bringToBack: function () {
+ return this._map && _i(this._image), this;
+ },
+ setUrl: function (t) {
+ return (this._url = t), this._image && (this._image.src = t), this;
+ },
+ setBounds: function (t) {
+ return (this._bounds = D(t)), this._map && this._reset(), this;
+ },
+ getEvents: function () {
+ var t = { zoom: this._reset, viewreset: this._reset };
+ return this._zoomAnimated && (t.zoomanim = this._animateZoom), t;
+ },
+ setZIndex: function (t) {
+ return (this.options.zIndex = t), this._updateZIndex(), this;
+ },
+ getBounds: function () {
+ return this._bounds;
+ },
+ getElement: function () {
+ return this._image;
+ },
+ _initImage: function () {
+ var t = "IMG" === this._url.tagName,
+ i = (this._image = t ? this._url : hi("img"));
+ pi(i, "leaflet-image-layer"),
+ this._zoomAnimated && pi(i, "leaflet-zoom-animated"),
+ this.options.className && pi(i, this.options.className),
+ (i.onselectstart = l),
+ (i.onmousemove = l),
+ (i.onload = a(this.fire, this, "load")),
+ (i.onerror = a(this._overlayOnError, this, "error")),
+ (!this.options.crossOrigin && "" !== this.options.crossOrigin) ||
+ (i.crossOrigin =
+ !0 === this.options.crossOrigin ? "" : this.options.crossOrigin),
+ this.options.zIndex && this._updateZIndex(),
+ t
+ ? (this._url = i.src)
+ : ((i.src = this._url), (i.alt = this.options.alt));
+ },
+ _animateZoom: function (t) {
+ var i = this._map.getZoomScale(t.zoom),
+ e = this._map._latLngBoundsToNewLayerBounds(
+ this._bounds,
+ t.zoom,
+ t.center,
+ ).min;
+ xi(this._image, e, i);
+ },
+ _reset: function () {
+ var t = this._image,
+ i = new O(
+ this._map.latLngToLayerPoint(this._bounds.getNorthWest()),
+ this._map.latLngToLayerPoint(this._bounds.getSouthEast()),
+ ),
+ e = i.getSize();
+ wi(t, i.min),
+ (t.style.width = e.x + "px"),
+ (t.style.height = e.y + "px");
+ },
+ _updateOpacity: function () {
+ vi(this._image, this.options.opacity);
+ },
+ _updateZIndex: function () {
+ this._image &&
+ void 0 !== this.options.zIndex &&
+ null !== this.options.zIndex &&
+ (this._image.style.zIndex = this.options.zIndex);
+ },
+ _overlayOnError: function () {
+ this.fire("error");
+ var t = this.options.errorOverlayUrl;
+ t && this._url !== t && ((this._url = t), (this._image.src = t));
+ },
+ }),
+ Qe = $e.extend({
+ options: { autoplay: !0, loop: !0, keepAspectRatio: !0 },
+ _initImage: function () {
+ var t = "VIDEO" === this._url.tagName,
+ i = (this._image = t ? this._url : hi("video"));
+ if (
+ (pi(i, "leaflet-image-layer"),
+ this._zoomAnimated && pi(i, "leaflet-zoom-animated"),
+ (i.onselectstart = l),
+ (i.onmousemove = l),
+ (i.onloadeddata = a(this.fire, this, "load")),
+ t)
+ ) {
+ for (
+ var e = i.getElementsByTagName("source"), n = [], o = 0;
+ o < e.length;
+ o++
+ )
+ n.push(e[o].src);
+ this._url = 0 < e.length ? n : [i.src];
+ } else {
+ v(this._url) || (this._url = [this._url]),
+ !this.options.keepAspectRatio &&
+ i.style.hasOwnProperty("objectFit") &&
+ (i.style.objectFit = "fill"),
+ (i.autoplay = !!this.options.autoplay),
+ (i.loop = !!this.options.loop);
+ for (var s = 0; s < this._url.length; s++) {
+ var r = hi("source");
+ (r.src = this._url[s]), i.appendChild(r);
+ }
+ }
+ },
+ });
+ var tn = $e.extend({
+ _initImage: function () {
+ var t = (this._image = this._url);
+ pi(t, "leaflet-image-layer"),
+ this._zoomAnimated && pi(t, "leaflet-zoom-animated"),
+ (t.onselectstart = l),
+ (t.onmousemove = l);
+ },
+ });
+ var en = Se.extend({
+ options: { offset: [0, 7], className: "", pane: "popupPane" },
+ initialize: function (t, i) {
+ p(this, t), (this._source = i);
+ },
+ onAdd: function (t) {
+ (this._zoomAnimated = t._zoomAnimated),
+ this._container || this._initLayout(),
+ t._fadeAnimated && vi(this._container, 0),
+ clearTimeout(this._removeTimeout),
+ this.getPane().appendChild(this._container),
+ this.update(),
+ t._fadeAnimated && vi(this._container, 1),
+ this.bringToFront();
+ },
+ onRemove: function (t) {
+ t._fadeAnimated
+ ? (vi(this._container, 0),
+ (this._removeTimeout = setTimeout(
+ a(ui, void 0, this._container),
+ 200,
+ )))
+ : ui(this._container);
+ },
+ getLatLng: function () {
+ return this._latlng;
+ },
+ setLatLng: function (t) {
+ return (
+ (this._latlng = W(t)),
+ this._map && (this._updatePosition(), this._adjustPan()),
+ this
+ );
+ },
+ getContent: function () {
+ return this._content;
+ },
+ setContent: function (t) {
+ return (this._content = t), this.update(), this;
+ },
+ getElement: function () {
+ return this._container;
+ },
+ update: function () {
+ this._map &&
+ ((this._container.style.visibility = "hidden"),
+ this._updateContent(),
+ this._updateLayout(),
+ this._updatePosition(),
+ (this._container.style.visibility = ""),
+ this._adjustPan());
+ },
+ getEvents: function () {
+ var t = { zoom: this._updatePosition, viewreset: this._updatePosition };
+ return this._zoomAnimated && (t.zoomanim = this._animateZoom), t;
+ },
+ isOpen: function () {
+ return !!this._map && this._map.hasLayer(this);
+ },
+ bringToFront: function () {
+ return this._map && ci(this._container), this;
+ },
+ bringToBack: function () {
+ return this._map && _i(this._container), this;
+ },
+ _prepareOpen: function (t, i, e) {
+ if ((i instanceof Se || ((e = i), (i = t)), i instanceof Ee))
+ for (var n in t._layers) {
+ i = t._layers[n];
+ break;
+ }
+ if (!e)
+ if (i.getCenter) e = i.getCenter();
+ else {
+ if (!i.getLatLng)
+ throw new Error("Unable to get source layer LatLng.");
+ e = i.getLatLng();
+ }
+ return (this._source = i), this.update(), e;
+ },
+ _updateContent: function () {
+ if (this._content) {
+ var t = this._contentNode,
+ i =
+ "function" == typeof this._content
+ ? this._content(this._source || this)
+ : this._content;
+ if ("string" == typeof i) t.innerHTML = i;
+ else {
+ for (; t.hasChildNodes(); ) t.removeChild(t.firstChild);
+ t.appendChild(i);
+ }
+ this.fire("contentupdate");
+ }
+ },
+ _updatePosition: function () {
+ if (this._map) {
+ var t = this._map.latLngToLayerPoint(this._latlng),
+ i = I(this.options.offset),
+ e = this._getAnchor();
+ this._zoomAnimated
+ ? wi(this._container, t.add(e))
+ : (i = i.add(t).add(e));
+ var n = (this._containerBottom = -i.y),
+ o = (this._containerLeft =
+ -Math.round(this._containerWidth / 2) + i.x);
+ (this._container.style.bottom = n + "px"),
+ (this._container.style.left = o + "px");
+ }
+ },
+ _getAnchor: function () {
+ return [0, 0];
+ },
+ }),
+ nn = en.extend({
+ options: {
+ maxWidth: 300,
+ minWidth: 50,
+ maxHeight: null,
+ autoPan: !0,
+ autoPanPaddingTopLeft: null,
+ autoPanPaddingBottomRight: null,
+ autoPanPadding: [5, 5],
+ keepInView: !1,
+ closeButton: !0,
+ autoClose: !0,
+ closeOnEscapeKey: !0,
+ className: "",
+ },
+ openOn: function (t) {
+ return t.openPopup(this), this;
+ },
+ onAdd: function (t) {
+ en.prototype.onAdd.call(this, t),
+ t.fire("popupopen", { popup: this }),
+ this._source &&
+ (this._source.fire("popupopen", { popup: this }, !0),
+ this._source instanceof Oe || this._source.on("preclick", Oi));
+ },
+ onRemove: function (t) {
+ en.prototype.onRemove.call(this, t),
+ t.fire("popupclose", { popup: this }),
+ this._source &&
+ (this._source.fire("popupclose", { popup: this }, !0),
+ this._source instanceof Oe || this._source.off("preclick", Oi));
+ },
+ getEvents: function () {
+ var t = en.prototype.getEvents.call(this);
+ return (
+ (void 0 !== this.options.closeOnClick
+ ? this.options.closeOnClick
+ : this._map.options.closePopupOnClick) &&
+ (t.preclick = this._close),
+ this.options.keepInView && (t.moveend = this._adjustPan),
+ t
+ );
+ },
+ _close: function () {
+ this._map && this._map.closePopup(this);
+ },
+ _initLayout: function () {
+ var t = "leaflet-popup",
+ i = (this._container = hi(
+ "div",
+ t + " " + (this.options.className || "") + " leaflet-zoom-animated",
+ )),
+ e = (this._wrapper = hi("div", t + "-content-wrapper", i));
+ if (
+ ((this._contentNode = hi("div", t + "-content", e)),
+ Ni(e),
+ Ri(this._contentNode),
+ Ei(e, "contextmenu", Oi),
+ (this._tipContainer = hi("div", t + "-tip-container", i)),
+ (this._tip = hi("div", t + "-tip", this._tipContainer)),
+ this.options.closeButton)
+ ) {
+ var n = (this._closeButton = hi("a", t + "-close-button", i));
+ (n.href = "#close"),
+ (n.innerHTML = "×"),
+ Ei(n, "click", this._onCloseButtonClick, this);
+ }
+ },
+ _updateLayout: function () {
+ var t = this._contentNode,
+ i = t.style;
+ (i.width = ""), (i.whiteSpace = "nowrap");
+ var e = t.offsetWidth;
+ (e = Math.min(e, this.options.maxWidth)),
+ (e = Math.max(e, this.options.minWidth)),
+ (i.width = e + 1 + "px"),
+ (i.whiteSpace = ""),
+ (i.height = "");
+ var n = t.offsetHeight,
+ o = this.options.maxHeight,
+ s = "leaflet-popup-scrolled";
+ o && o < n ? ((i.height = o + "px"), pi(t, s)) : mi(t, s),
+ (this._containerWidth = this._container.offsetWidth);
+ },
+ _animateZoom: function (t) {
+ var i = this._map._latLngToNewLayerPoint(
+ this._latlng,
+ t.zoom,
+ t.center,
+ ),
+ e = this._getAnchor();
+ wi(this._container, i.add(e));
+ },
+ _adjustPan: function () {
+ if (this.options.autoPan) {
+ this._map._panAnim && this._map._panAnim.stop();
+ var t = this._map,
+ i = parseInt(ai(this._container, "marginBottom"), 10) || 0,
+ e = this._container.offsetHeight + i,
+ n = this._containerWidth,
+ o = new B(this._containerLeft, -e - this._containerBottom);
+ o._add(Pi(this._container));
+ var s = t.layerPointToContainerPoint(o),
+ r = I(this.options.autoPanPadding),
+ a = I(this.options.autoPanPaddingTopLeft || r),
+ h = I(this.options.autoPanPaddingBottomRight || r),
+ u = t.getSize(),
+ l = 0,
+ c = 0;
+ s.x + n + h.x > u.x && (l = s.x + n - u.x + h.x),
+ s.x - l - a.x < 0 && (l = s.x - a.x),
+ s.y + e + h.y > u.y && (c = s.y + e - u.y + h.y),
+ s.y - c - a.y < 0 && (c = s.y - a.y),
+ (l || c) && t.fire("autopanstart").panBy([l, c]);
+ }
+ },
+ _onCloseButtonClick: function (t) {
+ this._close(), ji(t);
+ },
+ _getAnchor: function () {
+ return I(
+ this._source && this._source._getPopupAnchor
+ ? this._source._getPopupAnchor()
+ : [0, 0],
+ );
+ },
+ });
+ Ji.mergeOptions({ closePopupOnClick: !0 }),
+ Ji.include({
+ openPopup: function (t, i, e) {
+ return (
+ t instanceof nn || (t = new nn(e).setContent(t)),
+ i && t.setLatLng(i),
+ this.hasLayer(t)
+ ? this
+ : (this._popup &&
+ this._popup.options.autoClose &&
+ this.closePopup(),
+ (this._popup = t),
+ this.addLayer(t))
+ );
+ },
+ closePopup: function (t) {
+ return (
+ (t && t !== this._popup) || ((t = this._popup), (this._popup = null)),
+ t && this.removeLayer(t),
+ this
+ );
+ },
+ }),
+ Se.include({
+ bindPopup: function (t, i) {
+ return (
+ t instanceof nn
+ ? (p(t, i), ((this._popup = t)._source = this))
+ : ((this._popup && !i) || (this._popup = new nn(i, this)),
+ this._popup.setContent(t)),
+ this._popupHandlersAdded ||
+ (this.on({
+ click: this._openPopup,
+ keypress: this._onKeyPress,
+ remove: this.closePopup,
+ move: this._movePopup,
+ }),
+ (this._popupHandlersAdded = !0)),
+ this
+ );
+ },
+ unbindPopup: function () {
+ return (
+ this._popup &&
+ (this.off({
+ click: this._openPopup,
+ keypress: this._onKeyPress,
+ remove: this.closePopup,
+ move: this._movePopup,
+ }),
+ (this._popupHandlersAdded = !1),
+ (this._popup = null)),
+ this
+ );
+ },
+ openPopup: function (t, i) {
+ return (
+ this._popup &&
+ this._map &&
+ ((i = this._popup._prepareOpen(this, t, i)),
+ this._map.openPopup(this._popup, i)),
+ this
+ );
+ },
+ closePopup: function () {
+ return this._popup && this._popup._close(), this;
+ },
+ togglePopup: function (t) {
+ return (
+ this._popup &&
+ (this._popup._map ? this.closePopup() : this.openPopup(t)),
+ this
+ );
+ },
+ isPopupOpen: function () {
+ return !!this._popup && this._popup.isOpen();
+ },
+ setPopupContent: function (t) {
+ return this._popup && this._popup.setContent(t), this;
+ },
+ getPopup: function () {
+ return this._popup;
+ },
+ _openPopup: function (t) {
+ var i = t.layer || t.target;
+ this._popup &&
+ this._map &&
+ (ji(t),
+ i instanceof Oe
+ ? this.openPopup(t.layer || t.target, t.latlng)
+ : this._map.hasLayer(this._popup) && this._popup._source === i
+ ? this.closePopup()
+ : this.openPopup(i, t.latlng));
+ },
+ _movePopup: function (t) {
+ this._popup.setLatLng(t.latlng);
+ },
+ _onKeyPress: function (t) {
+ 13 === t.originalEvent.keyCode && this._openPopup(t);
+ },
+ });
+ var on = en.extend({
+ options: {
+ pane: "tooltipPane",
+ offset: [0, 0],
+ direction: "auto",
+ permanent: !1,
+ sticky: !1,
+ interactive: !1,
+ opacity: 0.9,
+ },
+ onAdd: function (t) {
+ en.prototype.onAdd.call(this, t),
+ this.setOpacity(this.options.opacity),
+ t.fire("tooltipopen", { tooltip: this }),
+ this._source && this._source.fire("tooltipopen", { tooltip: this }, !0);
+ },
+ onRemove: function (t) {
+ en.prototype.onRemove.call(this, t),
+ t.fire("tooltipclose", { tooltip: this }),
+ this._source &&
+ this._source.fire("tooltipclose", { tooltip: this }, !0);
+ },
+ getEvents: function () {
+ var t = en.prototype.getEvents.call(this);
+ return Tt && !this.options.permanent && (t.preclick = this._close), t;
+ },
+ _close: function () {
+ this._map && this._map.closeTooltip(this);
+ },
+ _initLayout: function () {
+ var t =
+ "leaflet-tooltip " +
+ (this.options.className || "") +
+ " leaflet-zoom-" +
+ (this._zoomAnimated ? "animated" : "hide");
+ this._contentNode = this._container = hi("div", t);
+ },
+ _updateLayout: function () {},
+ _adjustPan: function () {},
+ _setPosition: function (t) {
+ var i = this._map,
+ e = this._container,
+ n = i.latLngToContainerPoint(i.getCenter()),
+ o = i.layerPointToContainerPoint(t),
+ s = this.options.direction,
+ r = e.offsetWidth,
+ a = e.offsetHeight,
+ h = I(this.options.offset),
+ u = this._getAnchor();
+ (t =
+ "top" === s
+ ? t.add(I(-r / 2 + h.x, -a + h.y + u.y, !0))
+ : "bottom" === s
+ ? t.subtract(I(r / 2 - h.x, -h.y, !0))
+ : "center" === s
+ ? t.subtract(I(r / 2 + h.x, a / 2 - u.y + h.y, !0))
+ : "right" === s || ("auto" === s && o.x < n.x)
+ ? ((s = "right"), t.add(I(h.x + u.x, u.y - a / 2 + h.y, !0)))
+ : ((s = "left"),
+ t.subtract(I(r + u.x - h.x, a / 2 - u.y - h.y, !0)))),
+ mi(e, "leaflet-tooltip-right"),
+ mi(e, "leaflet-tooltip-left"),
+ mi(e, "leaflet-tooltip-top"),
+ mi(e, "leaflet-tooltip-bottom"),
+ pi(e, "leaflet-tooltip-" + s),
+ wi(e, t);
+ },
+ _updatePosition: function () {
+ var t = this._map.latLngToLayerPoint(this._latlng);
+ this._setPosition(t);
+ },
+ setOpacity: function (t) {
+ (this.options.opacity = t), this._container && vi(this._container, t);
+ },
+ _animateZoom: function (t) {
+ var i = this._map._latLngToNewLayerPoint(this._latlng, t.zoom, t.center);
+ this._setPosition(i);
+ },
+ _getAnchor: function () {
+ return I(
+ this._source && this._source._getTooltipAnchor && !this.options.sticky
+ ? this._source._getTooltipAnchor()
+ : [0, 0],
+ );
+ },
+ });
+ Ji.include({
+ openTooltip: function (t, i, e) {
+ return (
+ t instanceof on || (t = new on(e).setContent(t)),
+ i && t.setLatLng(i),
+ this.hasLayer(t) ? this : this.addLayer(t)
+ );
+ },
+ closeTooltip: function (t) {
+ return t && this.removeLayer(t), this;
+ },
+ }),
+ Se.include({
+ bindTooltip: function (t, i) {
+ return (
+ t instanceof on
+ ? (p(t, i), ((this._tooltip = t)._source = this))
+ : ((this._tooltip && !i) || (this._tooltip = new on(i, this)),
+ this._tooltip.setContent(t)),
+ this._initTooltipInteractions(),
+ this._tooltip.options.permanent &&
+ this._map &&
+ this._map.hasLayer(this) &&
+ this.openTooltip(),
+ this
+ );
+ },
+ unbindTooltip: function () {
+ return (
+ this._tooltip &&
+ (this._initTooltipInteractions(!0),
+ this.closeTooltip(),
+ (this._tooltip = null)),
+ this
+ );
+ },
+ _initTooltipInteractions: function (t) {
+ if (t || !this._tooltipHandlersAdded) {
+ var i = t ? "off" : "on",
+ e = { remove: this.closeTooltip, move: this._moveTooltip };
+ this._tooltip.options.permanent
+ ? (e.add = this._openTooltip)
+ : ((e.mouseover = this._openTooltip),
+ (e.mouseout = this.closeTooltip),
+ this._tooltip.options.sticky && (e.mousemove = this._moveTooltip),
+ Tt && (e.click = this._openTooltip)),
+ this[i](e),
+ (this._tooltipHandlersAdded = !t);
+ }
+ },
+ openTooltip: function (t, i) {
+ return (
+ this._tooltip &&
+ this._map &&
+ ((i = this._tooltip._prepareOpen(this, t, i)),
+ this._map.openTooltip(this._tooltip, i),
+ this._tooltip.options.interactive &&
+ this._tooltip._container &&
+ (pi(this._tooltip._container, "leaflet-clickable"),
+ this.addInteractiveTarget(this._tooltip._container))),
+ this
+ );
+ },
+ closeTooltip: function () {
+ return (
+ this._tooltip &&
+ (this._tooltip._close(),
+ this._tooltip.options.interactive &&
+ this._tooltip._container &&
+ (mi(this._tooltip._container, "leaflet-clickable"),
+ this.removeInteractiveTarget(this._tooltip._container))),
+ this
+ );
+ },
+ toggleTooltip: function (t) {
+ return (
+ this._tooltip &&
+ (this._tooltip._map ? this.closeTooltip() : this.openTooltip(t)),
+ this
+ );
+ },
+ isTooltipOpen: function () {
+ return this._tooltip.isOpen();
+ },
+ setTooltipContent: function (t) {
+ return this._tooltip && this._tooltip.setContent(t), this;
+ },
+ getTooltip: function () {
+ return this._tooltip;
+ },
+ _openTooltip: function (t) {
+ var i = t.layer || t.target;
+ this._tooltip &&
+ this._map &&
+ this.openTooltip(i, this._tooltip.options.sticky ? t.latlng : void 0);
+ },
+ _moveTooltip: function (t) {
+ var i,
+ e,
+ n = t.latlng;
+ this._tooltip.options.sticky &&
+ t.originalEvent &&
+ ((i = this._map.mouseEventToContainerPoint(t.originalEvent)),
+ (e = this._map.containerPointToLayerPoint(i)),
+ (n = this._map.layerPointToLatLng(e))),
+ this._tooltip.setLatLng(n);
+ },
+ });
+ var sn = ke.extend({
+ options: {
+ iconSize: [12, 12],
+ html: !1,
+ bgPos: null,
+ className: "leaflet-div-icon",
+ },
+ createIcon: function (t) {
+ var i = t && "DIV" === t.tagName ? t : document.createElement("div"),
+ e = this.options;
+ if (
+ (e.html instanceof Element
+ ? (li(i), i.appendChild(e.html))
+ : (i.innerHTML = !1 !== e.html ? e.html : ""),
+ e.bgPos)
+ ) {
+ var n = I(e.bgPos);
+ i.style.backgroundPosition = -n.x + "px " + -n.y + "px";
+ }
+ return this._setIconStyles(i, "icon"), i;
+ },
+ createShadow: function () {
+ return null;
+ },
+ });
+ ke.Default = Be;
+ var rn = Se.extend({
+ options: {
+ tileSize: 256,
+ opacity: 1,
+ updateWhenIdle: xt,
+ updateWhenZooming: !0,
+ updateInterval: 200,
+ zIndex: 1,
+ bounds: null,
+ minZoom: 0,
+ maxZoom: void 0,
+ maxNativeZoom: void 0,
+ minNativeZoom: void 0,
+ noWrap: !1,
+ pane: "tilePane",
+ className: "",
+ keepBuffer: 2,
+ },
+ initialize: function (t) {
+ p(this, t);
+ },
+ onAdd: function () {
+ this._initContainer(),
+ (this._levels = {}),
+ (this._tiles = {}),
+ this._resetView(),
+ this._update();
+ },
+ beforeAdd: function (t) {
+ t._addZoomLimit(this);
+ },
+ onRemove: function (t) {
+ this._removeAllTiles(),
+ ui(this._container),
+ t._removeZoomLimit(this),
+ (this._container = null),
+ (this._tileZoom = void 0);
+ },
+ bringToFront: function () {
+ return (
+ this._map && (ci(this._container), this._setAutoZIndex(Math.max)), this
+ );
+ },
+ bringToBack: function () {
+ return (
+ this._map && (_i(this._container), this._setAutoZIndex(Math.min)), this
+ );
+ },
+ getContainer: function () {
+ return this._container;
+ },
+ setOpacity: function (t) {
+ return (this.options.opacity = t), this._updateOpacity(), this;
+ },
+ setZIndex: function (t) {
+ return (this.options.zIndex = t), this._updateZIndex(), this;
+ },
+ isLoading: function () {
+ return this._loading;
+ },
+ redraw: function () {
+ return this._map && (this._removeAllTiles(), this._update()), this;
+ },
+ getEvents: function () {
+ var t = {
+ viewprereset: this._invalidateAll,
+ viewreset: this._resetView,
+ zoom: this._resetView,
+ moveend: this._onMoveEnd,
+ };
+ return (
+ this.options.updateWhenIdle ||
+ (this._onMove ||
+ (this._onMove = o(
+ this._onMoveEnd,
+ this.options.updateInterval,
+ this,
+ )),
+ (t.move = this._onMove)),
+ this._zoomAnimated && (t.zoomanim = this._animateZoom),
+ t
+ );
+ },
+ createTile: function () {
+ return document.createElement("div");
+ },
+ getTileSize: function () {
+ var t = this.options.tileSize;
+ return t instanceof B ? t : new B(t, t);
+ },
+ _updateZIndex: function () {
+ this._container &&
+ void 0 !== this.options.zIndex &&
+ null !== this.options.zIndex &&
+ (this._container.style.zIndex = this.options.zIndex);
+ },
+ _setAutoZIndex: function (t) {
+ for (
+ var i,
+ e = this.getPane().children,
+ n = -t(-1 / 0, 1 / 0),
+ o = 0,
+ s = e.length;
+ o < s;
+ o++
+ )
+ (i = e[o].style.zIndex),
+ e[o] !== this._container && i && (n = t(n, +i));
+ isFinite(n) &&
+ ((this.options.zIndex = n + t(-1, 1)), this._updateZIndex());
+ },
+ _updateOpacity: function () {
+ if (this._map && !et) {
+ vi(this._container, this.options.opacity);
+ var t = +new Date(),
+ i = !1,
+ e = !1;
+ for (var n in this._tiles) {
+ var o = this._tiles[n];
+ if (o.current && o.loaded) {
+ var s = Math.min(1, (t - o.loaded) / 200);
+ vi(o.el, s),
+ s < 1
+ ? (i = !0)
+ : (o.active ? (e = !0) : this._onOpaqueTile(o),
+ (o.active = !0));
+ }
+ }
+ e && !this._noPrune && this._pruneTiles(),
+ i &&
+ (C(this._fadeFrame),
+ (this._fadeFrame = M(this._updateOpacity, this)));
+ }
+ },
+ _onOpaqueTile: l,
+ _initContainer: function () {
+ this._container ||
+ ((this._container = hi(
+ "div",
+ "leaflet-layer " + (this.options.className || ""),
+ )),
+ this._updateZIndex(),
+ this.options.opacity < 1 && this._updateOpacity(),
+ this.getPane().appendChild(this._container));
+ },
+ _updateLevels: function () {
+ var t = this._tileZoom,
+ i = this.options.maxZoom;
+ if (void 0 !== t) {
+ for (var e in this._levels)
+ this._levels[e].el.children.length || e === t
+ ? ((this._levels[e].el.style.zIndex = i - Math.abs(t - e)),
+ this._onUpdateLevel(e))
+ : (ui(this._levels[e].el),
+ this._removeTilesAtZoom(e),
+ this._onRemoveLevel(e),
+ delete this._levels[e]);
+ var n = this._levels[t],
+ o = this._map;
+ return (
+ n ||
+ (((n = this._levels[t] = {}).el = hi(
+ "div",
+ "leaflet-tile-container leaflet-zoom-animated",
+ this._container,
+ )),
+ (n.el.style.zIndex = i),
+ (n.origin = o.project(o.unproject(o.getPixelOrigin()), t).round()),
+ (n.zoom = t),
+ this._setZoomTransform(n, o.getCenter(), o.getZoom()),
+ n.el.offsetWidth,
+ this._onCreateLevel(n)),
+ (this._level = n)
+ );
+ }
+ },
+ _onUpdateLevel: l,
+ _onRemoveLevel: l,
+ _onCreateLevel: l,
+ _pruneTiles: function () {
+ if (this._map) {
+ var t,
+ i,
+ e = this._map.getZoom();
+ if (e > this.options.maxZoom || e < this.options.minZoom)
+ this._removeAllTiles();
+ else {
+ for (t in this._tiles) (i = this._tiles[t]).retain = i.current;
+ for (t in this._tiles)
+ if ((i = this._tiles[t]).current && !i.active) {
+ var n = i.coords;
+ this._retainParent(n.x, n.y, n.z, n.z - 5) ||
+ this._retainChildren(n.x, n.y, n.z, n.z + 2);
+ }
+ for (t in this._tiles) this._tiles[t].retain || this._removeTile(t);
+ }
+ }
+ },
+ _removeTilesAtZoom: function (t) {
+ for (var i in this._tiles)
+ this._tiles[i].coords.z === t && this._removeTile(i);
+ },
+ _removeAllTiles: function () {
+ for (var t in this._tiles) this._removeTile(t);
+ },
+ _invalidateAll: function () {
+ for (var t in this._levels)
+ ui(this._levels[t].el), this._onRemoveLevel(t), delete this._levels[t];
+ this._removeAllTiles(), (this._tileZoom = void 0);
+ },
+ _retainParent: function (t, i, e, n) {
+ var o = Math.floor(t / 2),
+ s = Math.floor(i / 2),
+ r = e - 1,
+ a = new B(+o, +s);
+ a.z = +r;
+ var h = this._tileCoordsToKey(a),
+ u = this._tiles[h];
+ return u && u.active
+ ? (u.retain = !0)
+ : (u && u.loaded && (u.retain = !0),
+ n < r && this._retainParent(o, s, r, n));
+ },
+ _retainChildren: function (t, i, e, n) {
+ for (var o = 2 * t; o < 2 * t + 2; o++)
+ for (var s = 2 * i; s < 2 * i + 2; s++) {
+ var r = new B(o, s);
+ r.z = e + 1;
+ var a = this._tileCoordsToKey(r),
+ h = this._tiles[a];
+ h && h.active
+ ? (h.retain = !0)
+ : (h && h.loaded && (h.retain = !0),
+ e + 1 < n && this._retainChildren(o, s, e + 1, n));
+ }
+ },
+ _resetView: function (t) {
+ var i = t && (t.pinch || t.flyTo);
+ this._setView(this._map.getCenter(), this._map.getZoom(), i, i);
+ },
+ _animateZoom: function (t) {
+ this._setView(t.center, t.zoom, !0, t.noUpdate);
+ },
+ _clampZoom: function (t) {
+ var i = this.options;
+ return void 0 !== i.minNativeZoom && t < i.minNativeZoom
+ ? i.minNativeZoom
+ : void 0 !== i.maxNativeZoom && i.maxNativeZoom < t
+ ? i.maxNativeZoom
+ : t;
+ },
+ _setView: function (t, i, e, n) {
+ var o = this._clampZoom(Math.round(i));
+ ((void 0 !== this.options.maxZoom && o > this.options.maxZoom) ||
+ (void 0 !== this.options.minZoom && o < this.options.minZoom)) &&
+ (o = void 0);
+ var s = this.options.updateWhenZooming && o !== this._tileZoom;
+ (n && !s) ||
+ ((this._tileZoom = o),
+ this._abortLoading && this._abortLoading(),
+ this._updateLevels(),
+ this._resetGrid(),
+ void 0 !== o && this._update(t),
+ e || this._pruneTiles(),
+ (this._noPrune = !!e)),
+ this._setZoomTransforms(t, i);
+ },
+ _setZoomTransforms: function (t, i) {
+ for (var e in this._levels) this._setZoomTransform(this._levels[e], t, i);
+ },
+ _setZoomTransform: function (t, i, e) {
+ var n = this._map.getZoomScale(e, t.zoom),
+ o = t.origin
+ .multiplyBy(n)
+ .subtract(this._map._getNewPixelOrigin(i, e))
+ .round();
+ yt ? xi(t.el, o, n) : wi(t.el, o);
+ },
+ _resetGrid: function () {
+ var t = this._map,
+ i = t.options.crs,
+ e = (this._tileSize = this.getTileSize()),
+ n = this._tileZoom,
+ o = this._map.getPixelWorldBounds(this._tileZoom);
+ o && (this._globalTileRange = this._pxBoundsToTileRange(o)),
+ (this._wrapX = i.wrapLng &&
+ !this.options.noWrap && [
+ Math.floor(t.project([0, i.wrapLng[0]], n).x / e.x),
+ Math.ceil(t.project([0, i.wrapLng[1]], n).x / e.y),
+ ]),
+ (this._wrapY = i.wrapLat &&
+ !this.options.noWrap && [
+ Math.floor(t.project([i.wrapLat[0], 0], n).y / e.x),
+ Math.ceil(t.project([i.wrapLat[1], 0], n).y / e.y),
+ ]);
+ },
+ _onMoveEnd: function () {
+ this._map && !this._map._animatingZoom && this._update();
+ },
+ _getTiledPixelBounds: function (t) {
+ var i = this._map,
+ e = i._animatingZoom
+ ? Math.max(i._animateToZoom, i.getZoom())
+ : i.getZoom(),
+ n = i.getZoomScale(e, this._tileZoom),
+ o = i.project(t, this._tileZoom).floor(),
+ s = i.getSize().divideBy(2 * n);
+ return new O(o.subtract(s), o.add(s));
+ },
+ _update: function (t) {
+ var i = this._map;
+ if (i) {
+ var e = this._clampZoom(i.getZoom());
+ if ((void 0 === t && (t = i.getCenter()), void 0 !== this._tileZoom)) {
+ var n = this._getTiledPixelBounds(t),
+ o = this._pxBoundsToTileRange(n),
+ s = o.getCenter(),
+ r = [],
+ a = this.options.keepBuffer,
+ h = new O(
+ o.getBottomLeft().subtract([a, -a]),
+ o.getTopRight().add([a, -a]),
+ );
+ if (
+ !(
+ isFinite(o.min.x) &&
+ isFinite(o.min.y) &&
+ isFinite(o.max.x) &&
+ isFinite(o.max.y)
+ )
+ )
+ throw new Error("Attempted to load an infinite number of tiles");
+ for (var u in this._tiles) {
+ var l = this._tiles[u].coords;
+ (l.z === this._tileZoom && h.contains(new B(l.x, l.y))) ||
+ (this._tiles[u].current = !1);
+ }
+ if (1 < Math.abs(e - this._tileZoom)) this._setView(t, e);
+ else {
+ for (var c = o.min.y; c <= o.max.y; c++)
+ for (var _ = o.min.x; _ <= o.max.x; _++) {
+ var d = new B(_, c);
+ if (((d.z = this._tileZoom), this._isValidTile(d))) {
+ var p = this._tiles[this._tileCoordsToKey(d)];
+ p ? (p.current = !0) : r.push(d);
+ }
+ }
+ if (
+ (r.sort(function (t, i) {
+ return t.distanceTo(s) - i.distanceTo(s);
+ }),
+ 0 !== r.length)
+ ) {
+ this._loading || ((this._loading = !0), this.fire("loading"));
+ var m = document.createDocumentFragment();
+ for (_ = 0; _ < r.length; _++) this._addTile(r[_], m);
+ this._level.el.appendChild(m);
+ }
+ }
+ }
+ }
+ },
+ _isValidTile: function (t) {
+ var i = this._map.options.crs;
+ if (!i.infinite) {
+ var e = this._globalTileRange;
+ if (
+ (!i.wrapLng && (t.x < e.min.x || t.x > e.max.x)) ||
+ (!i.wrapLat && (t.y < e.min.y || t.y > e.max.y))
+ )
+ return !1;
+ }
+ if (!this.options.bounds) return !0;
+ var n = this._tileCoordsToBounds(t);
+ return D(this.options.bounds).overlaps(n);
+ },
+ _keyToBounds: function (t) {
+ return this._tileCoordsToBounds(this._keyToTileCoords(t));
+ },
+ _tileCoordsToNwSe: function (t) {
+ var i = this._map,
+ e = this.getTileSize(),
+ n = t.scaleBy(e),
+ o = n.add(e);
+ return [i.unproject(n, t.z), i.unproject(o, t.z)];
+ },
+ _tileCoordsToBounds: function (t) {
+ var i = this._tileCoordsToNwSe(t),
+ e = new N(i[0], i[1]);
+ return this.options.noWrap || (e = this._map.wrapLatLngBounds(e)), e;
+ },
+ _tileCoordsToKey: function (t) {
+ return t.x + ":" + t.y + ":" + t.z;
+ },
+ _keyToTileCoords: function (t) {
+ var i = t.split(":"),
+ e = new B(+i[0], +i[1]);
+ return (e.z = +i[2]), e;
+ },
+ _removeTile: function (t) {
+ var i = this._tiles[t];
+ i &&
+ (ui(i.el),
+ delete this._tiles[t],
+ this.fire("tileunload", {
+ tile: i.el,
+ coords: this._keyToTileCoords(t),
+ }));
+ },
+ _initTile: function (t) {
+ pi(t, "leaflet-tile");
+ var i = this.getTileSize();
+ (t.style.width = i.x + "px"),
+ (t.style.height = i.y + "px"),
+ (t.onselectstart = l),
+ (t.onmousemove = l),
+ et && this.options.opacity < 1 && vi(t, this.options.opacity),
+ st && !rt && (t.style.WebkitBackfaceVisibility = "hidden");
+ },
+ _addTile: function (t, i) {
+ var e = this._getTilePos(t),
+ n = this._tileCoordsToKey(t),
+ o = this.createTile(this._wrapCoords(t), a(this._tileReady, this, t));
+ this._initTile(o),
+ this.createTile.length < 2 && M(a(this._tileReady, this, t, null, o)),
+ wi(o, e),
+ (this._tiles[n] = { el: o, coords: t, current: !0 }),
+ i.appendChild(o),
+ this.fire("tileloadstart", { tile: o, coords: t });
+ },
+ _tileReady: function (t, i, e) {
+ i && this.fire("tileerror", { error: i, tile: e, coords: t });
+ var n = this._tileCoordsToKey(t);
+ (e = this._tiles[n]) &&
+ ((e.loaded = +new Date()),
+ this._map._fadeAnimated
+ ? (vi(e.el, 0),
+ C(this._fadeFrame),
+ (this._fadeFrame = M(this._updateOpacity, this)))
+ : ((e.active = !0), this._pruneTiles()),
+ i ||
+ (pi(e.el, "leaflet-tile-loaded"),
+ this.fire("tileload", { tile: e.el, coords: t })),
+ this._noTilesToLoad() &&
+ ((this._loading = !1),
+ this.fire("load"),
+ et || !this._map._fadeAnimated
+ ? M(this._pruneTiles, this)
+ : setTimeout(a(this._pruneTiles, this), 250)));
+ },
+ _getTilePos: function (t) {
+ return t.scaleBy(this.getTileSize()).subtract(this._level.origin);
+ },
+ _wrapCoords: function (t) {
+ var i = new B(
+ this._wrapX ? r(t.x, this._wrapX) : t.x,
+ this._wrapY ? r(t.y, this._wrapY) : t.y,
+ );
+ return (i.z = t.z), i;
+ },
+ _pxBoundsToTileRange: function (t) {
+ var i = this.getTileSize();
+ return new O(
+ t.min.unscaleBy(i).floor(),
+ t.max.unscaleBy(i).ceil().subtract([1, 1]),
+ );
+ },
+ _noTilesToLoad: function () {
+ for (var t in this._tiles) if (!this._tiles[t].loaded) return !1;
+ return !0;
+ },
+ });
+ var an = rn.extend({
+ options: {
+ minZoom: 0,
+ maxZoom: 18,
+ subdomains: "abc",
+ errorTileUrl: "",
+ zoomOffset: 0,
+ tms: !1,
+ zoomReverse: !1,
+ detectRetina: !1,
+ crossOrigin: !1,
+ },
+ initialize: function (t, i) {
+ (this._url = t),
+ (i = p(this, i)).detectRetina &&
+ Ct &&
+ 0 < i.maxZoom &&
+ ((i.tileSize = Math.floor(i.tileSize / 2)),
+ i.zoomReverse
+ ? (i.zoomOffset--, i.minZoom++)
+ : (i.zoomOffset++, i.maxZoom--),
+ (i.minZoom = Math.max(0, i.minZoom))),
+ "string" == typeof i.subdomains &&
+ (i.subdomains = i.subdomains.split("")),
+ st || this.on("tileunload", this._onTileRemove);
+ },
+ setUrl: function (t, i) {
+ return (
+ this._url === t && void 0 === i && (i = !0),
+ (this._url = t),
+ i || this.redraw(),
+ this
+ );
+ },
+ createTile: function (t, i) {
+ var e = document.createElement("img");
+ return (
+ Ei(e, "load", a(this._tileOnLoad, this, i, e)),
+ Ei(e, "error", a(this._tileOnError, this, i, e)),
+ (!this.options.crossOrigin && "" !== this.options.crossOrigin) ||
+ (e.crossOrigin =
+ !0 === this.options.crossOrigin ? "" : this.options.crossOrigin),
+ (e.alt = ""),
+ e.setAttribute("role", "presentation"),
+ (e.src = this.getTileUrl(t)),
+ e
+ );
+ },
+ getTileUrl: function (t) {
+ var i = {
+ r: Ct ? "@2x" : "",
+ s: this._getSubdomain(t),
+ x: t.x,
+ y: t.y,
+ z: this._getZoomForUrl(),
+ };
+ if (this._map && !this._map.options.crs.infinite) {
+ var e = this._globalTileRange.max.y - t.y;
+ this.options.tms && (i.y = e), (i["-y"] = e);
+ }
+ return g(this._url, h(i, this.options));
+ },
+ _tileOnLoad: function (t, i) {
+ et ? setTimeout(a(t, this, null, i), 0) : t(null, i);
+ },
+ _tileOnError: function (t, i, e) {
+ var n = this.options.errorTileUrl;
+ n && i.getAttribute("src") !== n && (i.src = n), t(e, i);
+ },
+ _onTileRemove: function (t) {
+ t.tile.onload = null;
+ },
+ _getZoomForUrl: function () {
+ var t = this._tileZoom,
+ i = this.options.maxZoom;
+ return (
+ this.options.zoomReverse && (t = i - t), t + this.options.zoomOffset
+ );
+ },
+ _getSubdomain: function (t) {
+ var i = Math.abs(t.x + t.y) % this.options.subdomains.length;
+ return this.options.subdomains[i];
+ },
+ _abortLoading: function () {
+ var t, i;
+ for (t in this._tiles)
+ this._tiles[t].coords.z !== this._tileZoom &&
+ (((i = this._tiles[t].el).onload = l),
+ (i.onerror = l),
+ i.complete || ((i.src = x), ui(i), delete this._tiles[t]));
+ },
+ _removeTile: function (t) {
+ var i = this._tiles[t];
+ if (i)
+ return (
+ ht || i.el.setAttribute("src", x),
+ rn.prototype._removeTile.call(this, t)
+ );
+ },
+ _tileReady: function (t, i, e) {
+ if (this._map && (!e || e.getAttribute("src") !== x))
+ return rn.prototype._tileReady.call(this, t, i, e);
+ },
+ });
+ function hn(t, i) {
+ return new an(t, i);
+ }
+ var un = an.extend({
+ defaultWmsParams: {
+ service: "WMS",
+ request: "GetMap",
+ layers: "",
+ styles: "",
+ format: "image/jpeg",
+ transparent: !1,
+ version: "1.1.1",
+ },
+ options: { crs: null, uppercase: !1 },
+ initialize: function (t, i) {
+ this._url = t;
+ var e = h({}, this.defaultWmsParams);
+ for (var n in i) n in this.options || (e[n] = i[n]);
+ var o = (i = p(this, i)).detectRetina && Ct ? 2 : 1,
+ s = this.getTileSize();
+ (e.width = s.x * o), (e.height = s.y * o), (this.wmsParams = e);
+ },
+ onAdd: function (t) {
+ (this._crs = this.options.crs || t.options.crs),
+ (this._wmsVersion = parseFloat(this.wmsParams.version));
+ var i = 1.3 <= this._wmsVersion ? "crs" : "srs";
+ (this.wmsParams[i] = this._crs.code), an.prototype.onAdd.call(this, t);
+ },
+ getTileUrl: function (t) {
+ var i = this._tileCoordsToNwSe(t),
+ e = this._crs,
+ n = R(e.project(i[0]), e.project(i[1])),
+ o = n.min,
+ s = n.max,
+ r = (
+ 1.3 <= this._wmsVersion && this._crs === Me
+ ? [o.y, o.x, s.y, s.x]
+ : [o.x, o.y, s.x, s.y]
+ ).join(","),
+ a = an.prototype.getTileUrl.call(this, t);
+ return (
+ a +
+ m(this.wmsParams, a, this.options.uppercase) +
+ (this.options.uppercase ? "&BBOX=" : "&bbox=") +
+ r
+ );
+ },
+ setParams: function (t, i) {
+ return h(this.wmsParams, t), i || this.redraw(), this;
+ },
+ });
+ (an.WMS = un),
+ (hn.wms = function (t, i) {
+ return new un(t, i);
+ });
+ var ln = Se.extend({
+ options: { padding: 0.1, tolerance: 0 },
+ initialize: function (t) {
+ p(this, t), u(this), (this._layers = this._layers || {});
+ },
+ onAdd: function () {
+ this._container ||
+ (this._initContainer(),
+ this._zoomAnimated && pi(this._container, "leaflet-zoom-animated")),
+ this.getPane().appendChild(this._container),
+ this._update(),
+ this.on("update", this._updatePaths, this);
+ },
+ onRemove: function () {
+ this.off("update", this._updatePaths, this), this._destroyContainer();
+ },
+ getEvents: function () {
+ var t = {
+ viewreset: this._reset,
+ zoom: this._onZoom,
+ moveend: this._update,
+ zoomend: this._onZoomEnd,
+ };
+ return this._zoomAnimated && (t.zoomanim = this._onAnimZoom), t;
+ },
+ _onAnimZoom: function (t) {
+ this._updateTransform(t.center, t.zoom);
+ },
+ _onZoom: function () {
+ this._updateTransform(this._map.getCenter(), this._map.getZoom());
+ },
+ _updateTransform: function (t, i) {
+ var e = this._map.getZoomScale(i, this._zoom),
+ n = Pi(this._container),
+ o = this._map.getSize().multiplyBy(0.5 + this.options.padding),
+ s = this._map.project(this._center, i),
+ r = this._map.project(t, i).subtract(s),
+ a = o.multiplyBy(-e).add(n).add(o).subtract(r);
+ yt ? xi(this._container, a, e) : wi(this._container, a);
+ },
+ _reset: function () {
+ for (var t in (this._update(),
+ this._updateTransform(this._center, this._zoom),
+ this._layers))
+ this._layers[t]._reset();
+ },
+ _onZoomEnd: function () {
+ for (var t in this._layers) this._layers[t]._project();
+ },
+ _updatePaths: function () {
+ for (var t in this._layers) this._layers[t]._update();
+ },
+ _update: function () {
+ var t = this.options.padding,
+ i = this._map.getSize(),
+ e = this._map.containerPointToLayerPoint(i.multiplyBy(-t)).round();
+ (this._bounds = new O(e, e.add(i.multiplyBy(1 + 2 * t)).round())),
+ (this._center = this._map.getCenter()),
+ (this._zoom = this._map.getZoom());
+ },
+ }),
+ cn = ln.extend({
+ getEvents: function () {
+ var t = ln.prototype.getEvents.call(this);
+ return (t.viewprereset = this._onViewPreReset), t;
+ },
+ _onViewPreReset: function () {
+ this._postponeUpdatePaths = !0;
+ },
+ onAdd: function () {
+ ln.prototype.onAdd.call(this), this._draw();
+ },
+ _initContainer: function () {
+ var t = (this._container = document.createElement("canvas"));
+ Ei(t, "mousemove", o(this._onMouseMove, 32, this), this),
+ Ei(
+ t,
+ "click dblclick mousedown mouseup contextmenu",
+ this._onClick,
+ this,
+ ),
+ Ei(t, "mouseout", this._handleMouseOut, this),
+ (this._ctx = t.getContext("2d"));
+ },
+ _destroyContainer: function () {
+ C(this._redrawRequest),
+ delete this._ctx,
+ ui(this._container),
+ Bi(this._container),
+ delete this._container;
+ },
+ _updatePaths: function () {
+ if (!this._postponeUpdatePaths) {
+ for (var t in ((this._redrawBounds = null), this._layers))
+ this._layers[t]._update();
+ this._redraw();
+ }
+ },
+ _update: function () {
+ if (!this._map._animatingZoom || !this._bounds) {
+ ln.prototype._update.call(this);
+ var t = this._bounds,
+ i = this._container,
+ e = t.getSize(),
+ n = Ct ? 2 : 1;
+ wi(i, t.min),
+ (i.width = n * e.x),
+ (i.height = n * e.y),
+ (i.style.width = e.x + "px"),
+ (i.style.height = e.y + "px"),
+ Ct && this._ctx.scale(2, 2),
+ this._ctx.translate(-t.min.x, -t.min.y),
+ this.fire("update");
+ }
+ },
+ _reset: function () {
+ ln.prototype._reset.call(this),
+ this._postponeUpdatePaths &&
+ ((this._postponeUpdatePaths = !1), this._updatePaths());
+ },
+ _initPath: function (t) {
+ this._updateDashArray(t);
+ var i = ((this._layers[u(t)] = t)._order = {
+ layer: t,
+ prev: this._drawLast,
+ next: null,
+ });
+ this._drawLast && (this._drawLast.next = i),
+ (this._drawLast = i),
+ (this._drawFirst = this._drawFirst || this._drawLast);
+ },
+ _addPath: function (t) {
+ this._requestRedraw(t);
+ },
+ _removePath: function (t) {
+ var i = t._order,
+ e = i.next,
+ n = i.prev;
+ e ? (e.prev = n) : (this._drawLast = n),
+ n ? (n.next = e) : (this._drawFirst = e),
+ delete t._order,
+ delete this._layers[u(t)],
+ this._requestRedraw(t);
+ },
+ _updatePath: function (t) {
+ this._extendRedrawBounds(t),
+ t._project(),
+ t._update(),
+ this._requestRedraw(t);
+ },
+ _updateStyle: function (t) {
+ this._updateDashArray(t), this._requestRedraw(t);
+ },
+ _updateDashArray: function (t) {
+ if ("string" == typeof t.options.dashArray) {
+ var i,
+ e,
+ n = t.options.dashArray.split(/[, ]+/),
+ o = [];
+ for (e = 0; e < n.length; e++) {
+ if (((i = Number(n[e])), isNaN(i))) return;
+ o.push(i);
+ }
+ t.options._dashArray = o;
+ } else t.options._dashArray = t.options.dashArray;
+ },
+ _requestRedraw: function (t) {
+ this._map &&
+ (this._extendRedrawBounds(t),
+ (this._redrawRequest = this._redrawRequest || M(this._redraw, this)));
+ },
+ _extendRedrawBounds: function (t) {
+ if (t._pxBounds) {
+ var i = (t.options.weight || 0) + 1;
+ (this._redrawBounds = this._redrawBounds || new O()),
+ this._redrawBounds.extend(t._pxBounds.min.subtract([i, i])),
+ this._redrawBounds.extend(t._pxBounds.max.add([i, i]));
+ }
+ },
+ _redraw: function () {
+ (this._redrawRequest = null),
+ this._redrawBounds &&
+ (this._redrawBounds.min._floor(), this._redrawBounds.max._ceil()),
+ this._clear(),
+ this._draw(),
+ (this._redrawBounds = null);
+ },
+ _clear: function () {
+ var t = this._redrawBounds;
+ if (t) {
+ var i = t.getSize();
+ this._ctx.clearRect(t.min.x, t.min.y, i.x, i.y);
+ } else
+ this._ctx.clearRect(
+ 0,
+ 0,
+ this._container.width,
+ this._container.height,
+ );
+ },
+ _draw: function () {
+ var t,
+ i = this._redrawBounds;
+ if ((this._ctx.save(), i)) {
+ var e = i.getSize();
+ this._ctx.beginPath(),
+ this._ctx.rect(i.min.x, i.min.y, e.x, e.y),
+ this._ctx.clip();
+ }
+ this._drawing = !0;
+ for (var n = this._drawFirst; n; n = n.next)
+ (t = n.layer),
+ (!i || (t._pxBounds && t._pxBounds.intersects(i))) &&
+ t._updatePath();
+ (this._drawing = !1), this._ctx.restore();
+ },
+ _updatePoly: function (t, i) {
+ if (this._drawing) {
+ var e,
+ n,
+ o,
+ s,
+ r = t._parts,
+ a = r.length,
+ h = this._ctx;
+ if (a) {
+ for (h.beginPath(), e = 0; e < a; e++) {
+ for (n = 0, o = r[e].length; n < o; n++)
+ (s = r[e][n]), h[n ? "lineTo" : "moveTo"](s.x, s.y);
+ i && h.closePath();
+ }
+ this._fillStroke(h, t);
+ }
+ }
+ },
+ _updateCircle: function (t) {
+ if (this._drawing && !t._empty()) {
+ var i = t._point,
+ e = this._ctx,
+ n = Math.max(Math.round(t._radius), 1),
+ o = (Math.max(Math.round(t._radiusY), 1) || n) / n;
+ 1 != o && (e.save(), e.scale(1, o)),
+ e.beginPath(),
+ e.arc(i.x, i.y / o, n, 0, 2 * Math.PI, !1),
+ 1 != o && e.restore(),
+ this._fillStroke(e, t);
+ }
+ },
+ _fillStroke: function (t, i) {
+ var e = i.options;
+ e.fill &&
+ ((t.globalAlpha = e.fillOpacity),
+ (t.fillStyle = e.fillColor || e.color),
+ t.fill(e.fillRule || "evenodd")),
+ e.stroke &&
+ 0 !== e.weight &&
+ (t.setLineDash &&
+ t.setLineDash((i.options && i.options._dashArray) || []),
+ (t.globalAlpha = e.opacity),
+ (t.lineWidth = e.weight),
+ (t.strokeStyle = e.color),
+ (t.lineCap = e.lineCap),
+ (t.lineJoin = e.lineJoin),
+ t.stroke());
+ },
+ _onClick: function (t) {
+ for (
+ var i,
+ e,
+ n = this._map.mouseEventToLayerPoint(t),
+ o = this._drawFirst;
+ o;
+ o = o.next
+ )
+ (i = o.layer).options.interactive &&
+ i._containsPoint(n) &&
+ !this._map._draggableMoved(i) &&
+ (e = i);
+ e && (qi(t), this._fireEvent([e], t));
+ },
+ _onMouseMove: function (t) {
+ if (
+ this._map &&
+ !this._map.dragging.moving() &&
+ !this._map._animatingZoom
+ ) {
+ var i = this._map.mouseEventToLayerPoint(t);
+ this._handleMouseHover(t, i);
+ }
+ },
+ _handleMouseOut: function (t) {
+ var i = this._hoveredLayer;
+ i &&
+ (mi(this._container, "leaflet-interactive"),
+ this._fireEvent([i], t, "mouseout"),
+ (this._hoveredLayer = null));
+ },
+ _handleMouseHover: function (t, i) {
+ for (var e, n, o = this._drawFirst; o; o = o.next)
+ (e = o.layer).options.interactive && e._containsPoint(i) && (n = e);
+ n !== this._hoveredLayer &&
+ (this._handleMouseOut(t),
+ n &&
+ (pi(this._container, "leaflet-interactive"),
+ this._fireEvent([n], t, "mouseover"),
+ (this._hoveredLayer = n))),
+ this._hoveredLayer && this._fireEvent([this._hoveredLayer], t);
+ },
+ _fireEvent: function (t, i, e) {
+ this._map._fireDOMEvent(i, e || i.type, t);
+ },
+ _bringToFront: function (t) {
+ var i = t._order;
+ if (i) {
+ var e = i.next,
+ n = i.prev;
+ e &&
+ ((e.prev = n) ? (n.next = e) : e && (this._drawFirst = e),
+ (i.prev = this._drawLast),
+ ((this._drawLast.next = i).next = null),
+ (this._drawLast = i),
+ this._requestRedraw(t));
+ }
+ },
+ _bringToBack: function (t) {
+ var i = t._order;
+ if (i) {
+ var e = i.next,
+ n = i.prev;
+ n &&
+ ((n.next = e) ? (e.prev = n) : n && (this._drawLast = n),
+ (i.prev = null),
+ (i.next = this._drawFirst),
+ (this._drawFirst.prev = i),
+ (this._drawFirst = i),
+ this._requestRedraw(t));
+ }
+ },
+ });
+ function _n(t) {
+ return St ? new cn(t) : null;
+ }
+ var dn = (function () {
+ try {
+ return (
+ document.namespaces.add("lvml", "urn:schemas-microsoft-com:vml"),
+ function (t) {
+ return document.createElement("');
+ }
+ );
+ } catch (t) {
+ return function (t) {
+ return document.createElement(
+ "<" + t + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">',
+ );
+ };
+ }
+ })(),
+ pn = {
+ _initContainer: function () {
+ this._container = hi("div", "leaflet-vml-container");
+ },
+ _update: function () {
+ this._map._animatingZoom ||
+ (ln.prototype._update.call(this), this.fire("update"));
+ },
+ _initPath: function (t) {
+ var i = (t._container = dn("shape"));
+ pi(i, "leaflet-vml-shape " + (this.options.className || "")),
+ (i.coordsize = "1 1"),
+ (t._path = dn("path")),
+ i.appendChild(t._path),
+ this._updateStyle(t),
+ (this._layers[u(t)] = t);
+ },
+ _addPath: function (t) {
+ var i = t._container;
+ this._container.appendChild(i),
+ t.options.interactive && t.addInteractiveTarget(i);
+ },
+ _removePath: function (t) {
+ var i = t._container;
+ ui(i), t.removeInteractiveTarget(i), delete this._layers[u(t)];
+ },
+ _updateStyle: function (t) {
+ var i = t._stroke,
+ e = t._fill,
+ n = t.options,
+ o = t._container;
+ (o.stroked = !!n.stroke),
+ (o.filled = !!n.fill),
+ n.stroke
+ ? (i || (i = t._stroke = dn("stroke")),
+ o.appendChild(i),
+ (i.weight = n.weight + "px"),
+ (i.color = n.color),
+ (i.opacity = n.opacity),
+ n.dashArray
+ ? (i.dashStyle = v(n.dashArray)
+ ? n.dashArray.join(" ")
+ : n.dashArray.replace(/( *, *)/g, " "))
+ : (i.dashStyle = ""),
+ (i.endcap = n.lineCap.replace("butt", "flat")),
+ (i.joinstyle = n.lineJoin))
+ : i && (o.removeChild(i), (t._stroke = null)),
+ n.fill
+ ? (e || (e = t._fill = dn("fill")),
+ o.appendChild(e),
+ (e.color = n.fillColor || n.color),
+ (e.opacity = n.fillOpacity))
+ : e && (o.removeChild(e), (t._fill = null));
+ },
+ _updateCircle: function (t) {
+ var i = t._point.round(),
+ e = Math.round(t._radius),
+ n = Math.round(t._radiusY || e);
+ this._setPath(
+ t,
+ t._empty()
+ ? "M0 0"
+ : "AL " + i.x + "," + i.y + " " + e + "," + n + " 0,23592600",
+ );
+ },
+ _setPath: function (t, i) {
+ t._path.v = i;
+ },
+ _bringToFront: function (t) {
+ ci(t._container);
+ },
+ _bringToBack: function (t) {
+ _i(t._container);
+ },
+ },
+ mn = Et ? dn : $,
+ fn = ln.extend({
+ getEvents: function () {
+ var t = ln.prototype.getEvents.call(this);
+ return (t.zoomstart = this._onZoomStart), t;
+ },
+ _initContainer: function () {
+ (this._container = mn("svg")),
+ this._container.setAttribute("pointer-events", "none"),
+ (this._rootGroup = mn("g")),
+ this._container.appendChild(this._rootGroup);
+ },
+ _destroyContainer: function () {
+ ui(this._container),
+ Bi(this._container),
+ delete this._container,
+ delete this._rootGroup,
+ delete this._svgSize;
+ },
+ _onZoomStart: function () {
+ this._update();
+ },
+ _update: function () {
+ if (!this._map._animatingZoom || !this._bounds) {
+ ln.prototype._update.call(this);
+ var t = this._bounds,
+ i = t.getSize(),
+ e = this._container;
+ (this._svgSize && this._svgSize.equals(i)) ||
+ ((this._svgSize = i),
+ e.setAttribute("width", i.x),
+ e.setAttribute("height", i.y)),
+ wi(e, t.min),
+ e.setAttribute("viewBox", [t.min.x, t.min.y, i.x, i.y].join(" ")),
+ this.fire("update");
+ }
+ },
+ _initPath: function (t) {
+ var i = (t._path = mn("path"));
+ t.options.className && pi(i, t.options.className),
+ t.options.interactive && pi(i, "leaflet-interactive"),
+ this._updateStyle(t),
+ (this._layers[u(t)] = t);
+ },
+ _addPath: function (t) {
+ this._rootGroup || this._initContainer(),
+ this._rootGroup.appendChild(t._path),
+ t.addInteractiveTarget(t._path);
+ },
+ _removePath: function (t) {
+ ui(t._path),
+ t.removeInteractiveTarget(t._path),
+ delete this._layers[u(t)];
+ },
+ _updatePath: function (t) {
+ t._project(), t._update();
+ },
+ _updateStyle: function (t) {
+ var i = t._path,
+ e = t.options;
+ i &&
+ (e.stroke
+ ? (i.setAttribute("stroke", e.color),
+ i.setAttribute("stroke-opacity", e.opacity),
+ i.setAttribute("stroke-width", e.weight),
+ i.setAttribute("stroke-linecap", e.lineCap),
+ i.setAttribute("stroke-linejoin", e.lineJoin),
+ e.dashArray
+ ? i.setAttribute("stroke-dasharray", e.dashArray)
+ : i.removeAttribute("stroke-dasharray"),
+ e.dashOffset
+ ? i.setAttribute("stroke-dashoffset", e.dashOffset)
+ : i.removeAttribute("stroke-dashoffset"))
+ : i.setAttribute("stroke", "none"),
+ e.fill
+ ? (i.setAttribute("fill", e.fillColor || e.color),
+ i.setAttribute("fill-opacity", e.fillOpacity),
+ i.setAttribute("fill-rule", e.fillRule || "evenodd"))
+ : i.setAttribute("fill", "none"));
+ },
+ _updatePoly: function (t, i) {
+ this._setPath(t, Q(t._parts, i));
+ },
+ _updateCircle: function (t) {
+ var i = t._point,
+ e = Math.max(Math.round(t._radius), 1),
+ n =
+ "a" +
+ e +
+ "," +
+ (Math.max(Math.round(t._radiusY), 1) || e) +
+ " 0 1,0 ",
+ o = t._empty()
+ ? "M0 0"
+ : "M" +
+ (i.x - e) +
+ "," +
+ i.y +
+ n +
+ 2 * e +
+ ",0 " +
+ n +
+ 2 * -e +
+ ",0 ";
+ this._setPath(t, o);
+ },
+ _setPath: function (t, i) {
+ t._path.setAttribute("d", i);
+ },
+ _bringToFront: function (t) {
+ ci(t._path);
+ },
+ _bringToBack: function (t) {
+ _i(t._path);
+ },
+ });
+ function gn(t) {
+ return Zt || Et ? new fn(t) : null;
+ }
+ Et && fn.include(pn),
+ Ji.include({
+ getRenderer: function (t) {
+ var i =
+ t.options.renderer ||
+ this._getPaneRenderer(t.options.pane) ||
+ this.options.renderer ||
+ this._renderer;
+ return (
+ i || (i = this._renderer = this._createRenderer()),
+ this.hasLayer(i) || this.addLayer(i),
+ i
+ );
+ },
+ _getPaneRenderer: function (t) {
+ if ("overlayPane" === t || void 0 === t) return !1;
+ var i = this._paneRenderers[t];
+ return (
+ void 0 === i &&
+ ((i = this._createRenderer({ pane: t })),
+ (this._paneRenderers[t] = i)),
+ i
+ );
+ },
+ _createRenderer: function (t) {
+ return (this.options.preferCanvas && _n(t)) || gn(t);
+ },
+ });
+ var vn = je.extend({
+ initialize: function (t, i) {
+ je.prototype.initialize.call(this, this._boundsToLatLngs(t), i);
+ },
+ setBounds: function (t) {
+ return this.setLatLngs(this._boundsToLatLngs(t));
+ },
+ _boundsToLatLngs: function (t) {
+ return [
+ (t = D(t)).getSouthWest(),
+ t.getNorthWest(),
+ t.getNorthEast(),
+ t.getSouthEast(),
+ ];
+ },
+ });
+ (fn.create = mn),
+ (fn.pointsToPath = Q),
+ (We.geometryToLayer = He),
+ (We.coordsToLatLng = Fe),
+ (We.coordsToLatLngs = Ue),
+ (We.latLngToCoords = Ve),
+ (We.latLngsToCoords = qe),
+ (We.getFeature = Ge),
+ (We.asFeature = Ke),
+ Ji.mergeOptions({ boxZoom: !0 });
+ var yn = oe.extend({
+ initialize: function (t) {
+ (this._map = t),
+ (this._container = t._container),
+ (this._pane = t._panes.overlayPane),
+ (this._resetStateTimeout = 0),
+ t.on("unload", this._destroy, this);
+ },
+ addHooks: function () {
+ Ei(this._container, "mousedown", this._onMouseDown, this);
+ },
+ removeHooks: function () {
+ Bi(this._container, "mousedown", this._onMouseDown, this);
+ },
+ moved: function () {
+ return this._moved;
+ },
+ _destroy: function () {
+ ui(this._pane), delete this._pane;
+ },
+ _resetState: function () {
+ (this._resetStateTimeout = 0), (this._moved = !1);
+ },
+ _clearDeferredResetState: function () {
+ 0 !== this._resetStateTimeout &&
+ (clearTimeout(this._resetStateTimeout), (this._resetStateTimeout = 0));
+ },
+ _onMouseDown: function (t) {
+ if (!t.shiftKey || (1 !== t.which && 1 !== t.button)) return !1;
+ this._clearDeferredResetState(),
+ this._resetState(),
+ $t(),
+ bi(),
+ (this._startPoint = this._map.mouseEventToContainerPoint(t)),
+ Ei(
+ document,
+ {
+ contextmenu: ji,
+ mousemove: this._onMouseMove,
+ mouseup: this._onMouseUp,
+ keydown: this._onKeyDown,
+ },
+ this,
+ );
+ },
+ _onMouseMove: function (t) {
+ this._moved ||
+ ((this._moved = !0),
+ (this._box = hi("div", "leaflet-zoom-box", this._container)),
+ pi(this._container, "leaflet-crosshair"),
+ this._map.fire("boxzoomstart")),
+ (this._point = this._map.mouseEventToContainerPoint(t));
+ var i = new O(this._point, this._startPoint),
+ e = i.getSize();
+ wi(this._box, i.min),
+ (this._box.style.width = e.x + "px"),
+ (this._box.style.height = e.y + "px");
+ },
+ _finish: function () {
+ this._moved && (ui(this._box), mi(this._container, "leaflet-crosshair")),
+ Qt(),
+ Ti(),
+ Bi(
+ document,
+ {
+ contextmenu: ji,
+ mousemove: this._onMouseMove,
+ mouseup: this._onMouseUp,
+ keydown: this._onKeyDown,
+ },
+ this,
+ );
+ },
+ _onMouseUp: function (t) {
+ if ((1 === t.which || 1 === t.button) && (this._finish(), this._moved)) {
+ this._clearDeferredResetState(),
+ (this._resetStateTimeout = setTimeout(a(this._resetState, this), 0));
+ var i = new N(
+ this._map.containerPointToLatLng(this._startPoint),
+ this._map.containerPointToLatLng(this._point),
+ );
+ this._map.fitBounds(i).fire("boxzoomend", { boxZoomBounds: i });
+ }
+ },
+ _onKeyDown: function (t) {
+ 27 === t.keyCode && this._finish();
+ },
+ });
+ Ji.addInitHook("addHandler", "boxZoom", yn),
+ Ji.mergeOptions({ doubleClickZoom: !0 });
+ var xn = oe.extend({
+ addHooks: function () {
+ this._map.on("dblclick", this._onDoubleClick, this);
+ },
+ removeHooks: function () {
+ this._map.off("dblclick", this._onDoubleClick, this);
+ },
+ _onDoubleClick: function (t) {
+ var i = this._map,
+ e = i.getZoom(),
+ n = i.options.zoomDelta,
+ o = t.originalEvent.shiftKey ? e - n : e + n;
+ "center" === i.options.doubleClickZoom
+ ? i.setZoom(o)
+ : i.setZoomAround(t.containerPoint, o);
+ },
+ });
+ Ji.addInitHook("addHandler", "doubleClickZoom", xn),
+ Ji.mergeOptions({
+ dragging: !0,
+ inertia: !rt,
+ inertiaDeceleration: 3400,
+ inertiaMaxSpeed: 1 / 0,
+ easeLinearity: 0.2,
+ worldCopyJump: !1,
+ maxBoundsViscosity: 0,
+ });
+ var wn = oe.extend({
+ addHooks: function () {
+ if (!this._draggable) {
+ var t = this._map;
+ (this._draggable = new le(t._mapPane, t._container)),
+ this._draggable.on(
+ {
+ dragstart: this._onDragStart,
+ drag: this._onDrag,
+ dragend: this._onDragEnd,
+ },
+ this,
+ ),
+ this._draggable.on("predrag", this._onPreDragLimit, this),
+ t.options.worldCopyJump &&
+ (this._draggable.on("predrag", this._onPreDragWrap, this),
+ t.on("zoomend", this._onZoomEnd, this),
+ t.whenReady(this._onZoomEnd, this));
+ }
+ pi(this._map._container, "leaflet-grab leaflet-touch-drag"),
+ this._draggable.enable(),
+ (this._positions = []),
+ (this._times = []);
+ },
+ removeHooks: function () {
+ mi(this._map._container, "leaflet-grab"),
+ mi(this._map._container, "leaflet-touch-drag"),
+ this._draggable.disable();
+ },
+ moved: function () {
+ return this._draggable && this._draggable._moved;
+ },
+ moving: function () {
+ return this._draggable && this._draggable._moving;
+ },
+ _onDragStart: function () {
+ var t = this._map;
+ if (
+ (t._stop(),
+ this._map.options.maxBounds && this._map.options.maxBoundsViscosity)
+ ) {
+ var i = D(this._map.options.maxBounds);
+ (this._offsetLimit = R(
+ this._map.latLngToContainerPoint(i.getNorthWest()).multiplyBy(-1),
+ this._map
+ .latLngToContainerPoint(i.getSouthEast())
+ .multiplyBy(-1)
+ .add(this._map.getSize()),
+ )),
+ (this._viscosity = Math.min(
+ 1,
+ Math.max(0, this._map.options.maxBoundsViscosity),
+ ));
+ } else this._offsetLimit = null;
+ t.fire("movestart").fire("dragstart"),
+ t.options.inertia && ((this._positions = []), (this._times = []));
+ },
+ _onDrag: function (t) {
+ if (this._map.options.inertia) {
+ var i = (this._lastTime = +new Date()),
+ e = (this._lastPos =
+ this._draggable._absPos || this._draggable._newPos);
+ this._positions.push(e), this._times.push(i), this._prunePositions(i);
+ }
+ this._map.fire("move", t).fire("drag", t);
+ },
+ _prunePositions: function (t) {
+ for (; 1 < this._positions.length && 50 < t - this._times[0]; )
+ this._positions.shift(), this._times.shift();
+ },
+ _onZoomEnd: function () {
+ var t = this._map.getSize().divideBy(2),
+ i = this._map.latLngToLayerPoint([0, 0]);
+ (this._initialWorldOffset = i.subtract(t).x),
+ (this._worldWidth = this._map.getPixelWorldBounds().getSize().x);
+ },
+ _viscousLimit: function (t, i) {
+ return t - (t - i) * this._viscosity;
+ },
+ _onPreDragLimit: function () {
+ if (this._viscosity && this._offsetLimit) {
+ var t = this._draggable._newPos.subtract(this._draggable._startPos),
+ i = this._offsetLimit;
+ t.x < i.min.x && (t.x = this._viscousLimit(t.x, i.min.x)),
+ t.y < i.min.y && (t.y = this._viscousLimit(t.y, i.min.y)),
+ t.x > i.max.x && (t.x = this._viscousLimit(t.x, i.max.x)),
+ t.y > i.max.y && (t.y = this._viscousLimit(t.y, i.max.y)),
+ (this._draggable._newPos = this._draggable._startPos.add(t));
+ }
+ },
+ _onPreDragWrap: function () {
+ var t = this._worldWidth,
+ i = Math.round(t / 2),
+ e = this._initialWorldOffset,
+ n = this._draggable._newPos.x,
+ o = ((n - i + e) % t) + i - e,
+ s = ((n + i + e) % t) - i - e,
+ r = Math.abs(o + e) < Math.abs(s + e) ? o : s;
+ (this._draggable._absPos = this._draggable._newPos.clone()),
+ (this._draggable._newPos.x = r);
+ },
+ _onDragEnd: function (t) {
+ var i = this._map,
+ e = i.options,
+ n = !e.inertia || this._times.length < 2;
+ if ((i.fire("dragend", t), n)) i.fire("moveend");
+ else {
+ this._prunePositions(+new Date());
+ var o = this._lastPos.subtract(this._positions[0]),
+ s = (this._lastTime - this._times[0]) / 1e3,
+ r = e.easeLinearity,
+ a = o.multiplyBy(r / s),
+ h = a.distanceTo([0, 0]),
+ u = Math.min(e.inertiaMaxSpeed, h),
+ l = a.multiplyBy(u / h),
+ c = u / (e.inertiaDeceleration * r),
+ _ = l.multiplyBy(-c / 2).round();
+ _.x || _.y
+ ? ((_ = i._limitOffset(_, i.options.maxBounds)),
+ M(function () {
+ i.panBy(_, {
+ duration: c,
+ easeLinearity: r,
+ noMoveStart: !0,
+ animate: !0,
+ });
+ }))
+ : i.fire("moveend");
+ }
+ },
+ });
+ Ji.addInitHook("addHandler", "dragging", wn),
+ Ji.mergeOptions({ keyboard: !0, keyboardPanDelta: 80 });
+ var Pn = oe.extend({
+ keyCodes: {
+ left: [37],
+ right: [39],
+ down: [40],
+ up: [38],
+ zoomIn: [187, 107, 61, 171],
+ zoomOut: [189, 109, 54, 173],
+ },
+ initialize: function (t) {
+ (this._map = t),
+ this._setPanDelta(t.options.keyboardPanDelta),
+ this._setZoomDelta(t.options.zoomDelta);
+ },
+ addHooks: function () {
+ var t = this._map._container;
+ t.tabIndex <= 0 && (t.tabIndex = "0"),
+ Ei(
+ t,
+ {
+ focus: this._onFocus,
+ blur: this._onBlur,
+ mousedown: this._onMouseDown,
+ },
+ this,
+ ),
+ this._map.on({ focus: this._addHooks, blur: this._removeHooks }, this);
+ },
+ removeHooks: function () {
+ this._removeHooks(),
+ Bi(
+ this._map._container,
+ {
+ focus: this._onFocus,
+ blur: this._onBlur,
+ mousedown: this._onMouseDown,
+ },
+ this,
+ ),
+ this._map.off({ focus: this._addHooks, blur: this._removeHooks }, this);
+ },
+ _onMouseDown: function () {
+ if (!this._focused) {
+ var t = document.body,
+ i = document.documentElement,
+ e = t.scrollTop || i.scrollTop,
+ n = t.scrollLeft || i.scrollLeft;
+ this._map._container.focus(), window.scrollTo(n, e);
+ }
+ },
+ _onFocus: function () {
+ (this._focused = !0), this._map.fire("focus");
+ },
+ _onBlur: function () {
+ (this._focused = !1), this._map.fire("blur");
+ },
+ _setPanDelta: function (t) {
+ var i,
+ e,
+ n = (this._panKeys = {}),
+ o = this.keyCodes;
+ for (i = 0, e = o.left.length; i < e; i++) n[o.left[i]] = [-1 * t, 0];
+ for (i = 0, e = o.right.length; i < e; i++) n[o.right[i]] = [t, 0];
+ for (i = 0, e = o.down.length; i < e; i++) n[o.down[i]] = [0, t];
+ for (i = 0, e = o.up.length; i < e; i++) n[o.up[i]] = [0, -1 * t];
+ },
+ _setZoomDelta: function (t) {
+ var i,
+ e,
+ n = (this._zoomKeys = {}),
+ o = this.keyCodes;
+ for (i = 0, e = o.zoomIn.length; i < e; i++) n[o.zoomIn[i]] = t;
+ for (i = 0, e = o.zoomOut.length; i < e; i++) n[o.zoomOut[i]] = -t;
+ },
+ _addHooks: function () {
+ Ei(document, "keydown", this._onKeyDown, this);
+ },
+ _removeHooks: function () {
+ Bi(document, "keydown", this._onKeyDown, this);
+ },
+ _onKeyDown: function (t) {
+ if (!(t.altKey || t.ctrlKey || t.metaKey)) {
+ var i,
+ e = t.keyCode,
+ n = this._map;
+ if (e in this._panKeys)
+ (n._panAnim && n._panAnim._inProgress) ||
+ ((i = this._panKeys[e]),
+ t.shiftKey && (i = I(i).multiplyBy(3)),
+ n.panBy(i),
+ n.options.maxBounds && n.panInsideBounds(n.options.maxBounds));
+ else if (e in this._zoomKeys)
+ n.setZoom(n.getZoom() + (t.shiftKey ? 3 : 1) * this._zoomKeys[e]);
+ else {
+ if (27 !== e || !n._popup || !n._popup.options.closeOnEscapeKey)
+ return;
+ n.closePopup();
+ }
+ ji(t);
+ }
+ },
+ });
+ Ji.addInitHook("addHandler", "keyboard", Pn),
+ Ji.mergeOptions({
+ scrollWheelZoom: !0,
+ wheelDebounceTime: 40,
+ wheelPxPerZoomLevel: 60,
+ });
+ var Ln = oe.extend({
+ addHooks: function () {
+ Ei(this._map._container, "mousewheel", this._onWheelScroll, this),
+ (this._delta = 0);
+ },
+ removeHooks: function () {
+ Bi(this._map._container, "mousewheel", this._onWheelScroll, this);
+ },
+ _onWheelScroll: function (t) {
+ var i = Fi(t),
+ e = this._map.options.wheelDebounceTime;
+ (this._delta += i),
+ (this._lastMousePos = this._map.mouseEventToContainerPoint(t)),
+ this._startTime || (this._startTime = +new Date());
+ var n = Math.max(e - (+new Date() - this._startTime), 0);
+ clearTimeout(this._timer),
+ (this._timer = setTimeout(a(this._performZoom, this), n)),
+ ji(t);
+ },
+ _performZoom: function () {
+ var t = this._map,
+ i = t.getZoom(),
+ e = this._map.options.zoomSnap || 0;
+ t._stop();
+ var n = this._delta / (4 * this._map.options.wheelPxPerZoomLevel),
+ o = (4 * Math.log(2 / (1 + Math.exp(-Math.abs(n))))) / Math.LN2,
+ s = e ? Math.ceil(o / e) * e : o,
+ r = t._limitZoom(i + (0 < this._delta ? s : -s)) - i;
+ (this._delta = 0),
+ (this._startTime = null),
+ r &&
+ ("center" === t.options.scrollWheelZoom
+ ? t.setZoom(i + r)
+ : t.setZoomAround(this._lastMousePos, i + r));
+ },
+ });
+ Ji.addInitHook("addHandler", "scrollWheelZoom", Ln),
+ Ji.mergeOptions({ tap: !0, tapTolerance: 15 });
+ var bn = oe.extend({
+ addHooks: function () {
+ Ei(this._map._container, "touchstart", this._onDown, this);
+ },
+ removeHooks: function () {
+ Bi(this._map._container, "touchstart", this._onDown, this);
+ },
+ _onDown: function (t) {
+ if (t.touches) {
+ if ((Di(t), (this._fireClick = !0), 1 < t.touches.length))
+ return (this._fireClick = !1), void clearTimeout(this._holdTimeout);
+ var i = t.touches[0],
+ e = i.target;
+ (this._startPos = this._newPos = new B(i.clientX, i.clientY)),
+ e.tagName &&
+ "a" === e.tagName.toLowerCase() &&
+ pi(e, "leaflet-active"),
+ (this._holdTimeout = setTimeout(
+ a(function () {
+ this._isTapValid() &&
+ ((this._fireClick = !1),
+ this._onUp(),
+ this._simulateEvent("contextmenu", i));
+ }, this),
+ 1e3,
+ )),
+ this._simulateEvent("mousedown", i),
+ Ei(document, { touchmove: this._onMove, touchend: this._onUp }, this);
+ }
+ },
+ _onUp: function (t) {
+ if (
+ (clearTimeout(this._holdTimeout),
+ Bi(document, { touchmove: this._onMove, touchend: this._onUp }, this),
+ this._fireClick && t && t.changedTouches)
+ ) {
+ var i = t.changedTouches[0],
+ e = i.target;
+ e &&
+ e.tagName &&
+ "a" === e.tagName.toLowerCase() &&
+ mi(e, "leaflet-active"),
+ this._simulateEvent("mouseup", i),
+ this._isTapValid() && this._simulateEvent("click", i);
+ }
+ },
+ _isTapValid: function () {
+ return (
+ this._newPos.distanceTo(this._startPos) <=
+ this._map.options.tapTolerance
+ );
+ },
+ _onMove: function (t) {
+ var i = t.touches[0];
+ (this._newPos = new B(i.clientX, i.clientY)),
+ this._simulateEvent("mousemove", i);
+ },
+ _simulateEvent: function (t, i) {
+ var e = document.createEvent("MouseEvents");
+ (e._simulated = !0),
+ (i.target._simulatedClick = !0),
+ e.initMouseEvent(
+ t,
+ !0,
+ !0,
+ window,
+ 1,
+ i.screenX,
+ i.screenY,
+ i.clientX,
+ i.clientY,
+ !1,
+ !1,
+ !1,
+ !1,
+ 0,
+ null,
+ ),
+ i.target.dispatchEvent(e);
+ },
+ });
+ Tt && !bt && Ji.addInitHook("addHandler", "tap", bn),
+ Ji.mergeOptions({ touchZoom: Tt && !rt, bounceAtZoomLimits: !0 });
+ var Tn = oe.extend({
+ addHooks: function () {
+ pi(this._map._container, "leaflet-touch-zoom"),
+ Ei(this._map._container, "touchstart", this._onTouchStart, this);
+ },
+ removeHooks: function () {
+ mi(this._map._container, "leaflet-touch-zoom"),
+ Bi(this._map._container, "touchstart", this._onTouchStart, this);
+ },
+ _onTouchStart: function (t) {
+ var i = this._map;
+ if (
+ t.touches &&
+ 2 === t.touches.length &&
+ !i._animatingZoom &&
+ !this._zooming
+ ) {
+ var e = i.mouseEventToContainerPoint(t.touches[0]),
+ n = i.mouseEventToContainerPoint(t.touches[1]);
+ (this._centerPoint = i.getSize()._divideBy(2)),
+ (this._startLatLng = i.containerPointToLatLng(this._centerPoint)),
+ "center" !== i.options.touchZoom &&
+ (this._pinchStartLatLng = i.containerPointToLatLng(
+ e.add(n)._divideBy(2),
+ )),
+ (this._startDist = e.distanceTo(n)),
+ (this._startZoom = i.getZoom()),
+ (this._moved = !1),
+ (this._zooming = !0),
+ i._stop(),
+ Ei(document, "touchmove", this._onTouchMove, this),
+ Ei(document, "touchend", this._onTouchEnd, this),
+ Di(t);
+ }
+ },
+ _onTouchMove: function (t) {
+ if (t.touches && 2 === t.touches.length && this._zooming) {
+ var i = this._map,
+ e = i.mouseEventToContainerPoint(t.touches[0]),
+ n = i.mouseEventToContainerPoint(t.touches[1]),
+ o = e.distanceTo(n) / this._startDist;
+ if (
+ ((this._zoom = i.getScaleZoom(o, this._startZoom)),
+ !i.options.bounceAtZoomLimits &&
+ ((this._zoom < i.getMinZoom() && o < 1) ||
+ (this._zoom > i.getMaxZoom() && 1 < o)) &&
+ (this._zoom = i._limitZoom(this._zoom)),
+ "center" === i.options.touchZoom)
+ ) {
+ if (((this._center = this._startLatLng), 1 == o)) return;
+ } else {
+ var s = e._add(n)._divideBy(2)._subtract(this._centerPoint);
+ if (1 == o && 0 === s.x && 0 === s.y) return;
+ this._center = i.unproject(
+ i.project(this._pinchStartLatLng, this._zoom).subtract(s),
+ this._zoom,
+ );
+ }
+ this._moved || (i._moveStart(!0, !1), (this._moved = !0)),
+ C(this._animRequest);
+ var r = a(i._move, i, this._center, this._zoom, {
+ pinch: !0,
+ round: !1,
+ });
+ (this._animRequest = M(r, this, !0)), Di(t);
+ }
+ },
+ _onTouchEnd: function () {
+ this._moved && this._zooming
+ ? ((this._zooming = !1),
+ C(this._animRequest),
+ Bi(document, "touchmove", this._onTouchMove),
+ Bi(document, "touchend", this._onTouchEnd),
+ this._map.options.zoomAnimation
+ ? this._map._animateZoom(
+ this._center,
+ this._map._limitZoom(this._zoom),
+ !0,
+ this._map.options.zoomSnap,
+ )
+ : this._map._resetView(
+ this._center,
+ this._map._limitZoom(this._zoom),
+ ))
+ : (this._zooming = !1);
+ },
+ });
+ Ji.addInitHook("addHandler", "touchZoom", Tn),
+ (Ji.BoxZoom = yn),
+ (Ji.DoubleClickZoom = xn),
+ (Ji.Drag = wn),
+ (Ji.Keyboard = Pn),
+ (Ji.ScrollWheelZoom = Ln),
+ (Ji.Tap = bn),
+ (Ji.TouchZoom = Tn),
+ (Object.freeze = i),
+ (t.version = "1.5.1"),
+ (t.Control = Qi),
+ (t.control = $i),
+ (t.Browser = Bt),
+ (t.Evented = k),
+ (t.Mixin = re),
+ (t.Util = S),
+ (t.Class = Z),
+ (t.Handler = oe),
+ (t.extend = h),
+ (t.bind = a),
+ (t.stamp = u),
+ (t.setOptions = p),
+ (t.DomEvent = Yi),
+ (t.DomUtil = Zi),
+ (t.PosAnimation = Xi),
+ (t.Draggable = le),
+ (t.LineUtil = ye),
+ (t.PolyUtil = Pe),
+ (t.Point = B),
+ (t.point = I),
+ (t.Bounds = O),
+ (t.bounds = R),
+ (t.Transformation = G),
+ (t.transformation = K),
+ (t.Projection = Te),
+ (t.LatLng = j),
+ (t.latLng = W),
+ (t.LatLngBounds = N),
+ (t.latLngBounds = D),
+ (t.CRS = F),
+ (t.GeoJSON = We),
+ (t.geoJSON = Xe),
+ (t.geoJson = Je),
+ (t.Layer = Se),
+ (t.LayerGroup = Ze),
+ (t.layerGroup = function (t, i) {
+ return new Ze(t, i);
+ }),
+ (t.FeatureGroup = Ee),
+ (t.featureGroup = function (t) {
+ return new Ee(t);
+ }),
+ (t.ImageOverlay = $e),
+ (t.imageOverlay = function (t, i, e) {
+ return new $e(t, i, e);
+ }),
+ (t.VideoOverlay = Qe),
+ (t.videoOverlay = function (t, i, e) {
+ return new Qe(t, i, e);
+ }),
+ (t.SVGOverlay = tn),
+ (t.svgOverlay = function (t, i, e) {
+ return new tn(t, i, e);
+ }),
+ (t.DivOverlay = en),
+ (t.Popup = nn),
+ (t.popup = function (t, i) {
+ return new nn(t, i);
+ }),
+ (t.Tooltip = on),
+ (t.tooltip = function (t, i) {
+ return new on(t, i);
+ }),
+ (t.Icon = ke),
+ (t.icon = function (t) {
+ return new ke(t);
+ }),
+ (t.DivIcon = sn),
+ (t.divIcon = function (t) {
+ return new sn(t);
+ }),
+ (t.Marker = Ie),
+ (t.marker = function (t, i) {
+ return new Ie(t, i);
+ }),
+ (t.TileLayer = an),
+ (t.tileLayer = hn),
+ (t.GridLayer = rn),
+ (t.gridLayer = function (t) {
+ return new rn(t);
+ }),
+ (t.SVG = fn),
+ (t.svg = gn),
+ (t.Renderer = ln),
+ (t.Canvas = cn),
+ (t.canvas = _n),
+ (t.Path = Oe),
+ (t.CircleMarker = Re),
+ (t.circleMarker = function (t, i) {
+ return new Re(t, i);
+ }),
+ (t.Circle = Ne),
+ (t.circle = function (t, i, e) {
+ return new Ne(t, i, e);
+ }),
+ (t.Polyline = De),
+ (t.polyline = function (t, i) {
+ return new De(t, i);
+ }),
+ (t.Polygon = je),
+ (t.polygon = function (t, i) {
+ return new je(t, i);
+ }),
+ (t.Rectangle = vn),
+ (t.rectangle = function (t, i) {
+ return new vn(t, i);
+ }),
+ (t.Map = Ji),
+ (t.map = function (t, i) {
+ return new Ji(t, i);
+ });
+ var zn = window.L;
+ (t.noConflict = function () {
+ return (window.L = zn), this;
+ }),
+ (window.L = t);
+});
diff --git a/public/assets/js/leaflet.responsive.popup.js b/public/assets/js/leaflet.responsive.popup.js
index 7070f88..16e4a9c 100644
--- a/public/assets/js/leaflet.responsive.popup.js
+++ b/public/assets/js/leaflet.responsive.popup.js
@@ -1,270 +1,360 @@
-/*
- leaflet.responsive.popup 0.6.4
- (c) 2019 https://github.com/yafred
-*/
-
-L.ResponsivePopup = L.Popup.extend({
-
- options: {
- hasTip: true
- /*
- * Inherited from L.Popup
- *
- * - offset
- *
- * - autoPanPadding
- * - autoPanPaddingTopLeft
- * - autoPanPaddingBottomRight
- */
- },
-
- /**
- * Overrides https://github.com/Leaflet/Leaflet/blob/v1.3.4/src/layer/Popup.js#L176
- * This is to add hasTip option
- */
- _initLayout: function () {
-
- var prefix = 'leaflet-rrose',
- container = this._container = L.DomUtil.create('div',
- prefix + ' ' + (this.options.className || '') +
- ' leaflet-zoom-animated');
-
- var wrapper = this._wrapper = L.DomUtil.create('div', prefix + '-content-wrapper', container);
- this._contentNode = L.DomUtil.create('div', prefix + '-content', wrapper);
-
- L.DomEvent.disableClickPropagation(wrapper);
- L.DomEvent.disableScrollPropagation(this._contentNode);
- L.DomEvent.on(wrapper, 'contextmenu', L.DomEvent.stopPropagation);
-
- this._tipContainer = L.DomUtil.create('div', prefix + '-tip-container', container);
- if(!this.options.hasTip) {
- this._tipContainer.style.visibility = 'hidden';
- }
- this._tip = L.DomUtil.create('div', prefix + '-tip', this._tipContainer);
-
- if (this.options.closeButton) {
- var closeButton = this._closeButton = L.DomUtil.create('a', prefix + '-close-button', container);
- closeButton.href = '#close';
- closeButton.innerHTML = '×';
-
- L.DomEvent.on(closeButton, 'click', this._onCloseButtonClick, this);
- }
- },
-
-
-
- /**
- * Overrides https://github.com/Leaflet/Leaflet/blob/v1.3.4/src/layer/DivOverlay.js#L178
- */
- _updatePosition: function () {
-
- if (!this._map) { return; }
-
- var pos = this._map.latLngToLayerPoint(this._latlng),
- basePoint = this._map.layerPointToContainerPoint(pos),
- containerWidth = this._container.offsetWidth,
- containerHeight = this._container.offsetHeight,
- padding = L.point(this.options.autoPanPadding),
- paddingTL = L.point(this.options.autoPanPaddingTopLeft || padding),
- paddingBR = L.point(this.options.autoPanPaddingBottomRight || padding),
- mapSize = this._map.getSize(),
- anchor = this._getAnchor(), // popup anchor
- offset = L.point(this.options.offset); // offset relative to anchor (option from L.DivOverlay. We only use absolute values).
-
- // Leaflet default dimensions (should not be hard coded in the future)
- var tipHeight = 11; //px
- var tipWidth = 22; //px
- var containerRadius = 12; //px
-
- // Tweak offset to include tip dimensions
- var offsetX = Math.abs(offset.x);
- var offsetY = Math.abs(offset.y);
- if(this.options.hasTip) {
- offsetX += tipHeight;
- offsetY += tipHeight;
-
- // clear CSS
- L.DomUtil.removeClass(this._container, 'leaflet-resp-popup-north');
- L.DomUtil.removeClass(this._container, 'leaflet-resp-popup-south');
- L.DomUtil.removeClass(this._container, 'leaflet-resp-popup-east');
- L.DomUtil.removeClass(this._container, 'leaflet-resp-popup-west');
- L.DomUtil.removeClass(this._container, 'leaflet-resp-popup-north-east');
- L.DomUtil.removeClass(this._container, 'leaflet-resp-popup-north-west');
- L.DomUtil.removeClass(this._container, 'leaflet-resp-popup-south-east');
- L.DomUtil.removeClass(this._container, 'leaflet-resp-popup-south-west');
- L.DomUtil.removeClass(this._container, 'leaflet-resp-popup-east-north');
- L.DomUtil.removeClass(this._container, 'leaflet-resp-popup-east-south');
- L.DomUtil.removeClass(this._container, 'leaflet-resp-popup-west-north');
- L.DomUtil.removeClass(this._container, 'leaflet-resp-popup-west-south');
- // this._container.style.display = 'initial'; // this does not work
- }
-
- // Where can we fit the popup ?
- var canGoTop = true,
- canGoBottom = true,
- canGoLeft = true,
- canGoRight = true,
- containerPos = false;
-
- if(basePoint.y + anchor.y - offsetY - containerHeight - Math.abs(paddingTL.y) < 0) {
- canGoTop = false;
- }
- if(basePoint.y + anchor.y + offsetY + containerHeight + Math.abs(paddingBR.y) > mapSize.y) {
- canGoBottom = false;
- }
- if(basePoint.x + anchor.x - offsetX - containerWidth - Math.abs(paddingTL.x) < 0) {
- canGoLeft = false;
- }
- if(basePoint.x + anchor.x + offsetX + containerWidth + Math.abs(paddingBR.x) > mapSize.x) {
- canGoRight = false;
- }
-
- // manage overflows
- var subtractX = containerWidth / 2 - anchor.x,
- subtractY = containerHeight / 2 - anchor.y;
-
- if(canGoTop || canGoBottom) {
- var containerLeft = basePoint.x + anchor.x - (containerWidth / 2);
- var containerRight = basePoint.x + anchor.x + (containerWidth / 2);
- if(containerLeft < Math.abs(paddingTL.x)) { // left overflow
- subtractX = containerWidth / 2 - anchor.x - Math.abs(paddingTL.x) + containerLeft;
- }
- if(containerRight > mapSize.x - Math.abs(paddingBR.x)) { // right overflow
- subtractX = containerWidth / 2 - anchor.x + containerRight - mapSize.x + Math.abs(paddingBR.x);
- }
- }
- if(canGoLeft || canGoRight) {
- var containerTop = basePoint.y + anchor.y - (containerHeight / 2);
- var containerBottom = basePoint.y + anchor.y + (containerHeight / 2);
- if(containerTop < Math.abs(paddingTL.y)) { // top overflow
- subtractY = containerHeight / 2 - anchor.y - Math.abs(paddingTL.y) + containerTop;
- }
- if(containerBottom > mapSize.y - Math.abs(paddingBR.y)) { // bottom overflow
- subtractY = containerHeight / 2 - anchor.y + containerBottom - mapSize.y + Math.abs(paddingBR.y);
- }
- }
-
- // position the popup (order of preference is: top, left, bottom, right, centerOnMap)
- if(canGoTop) {
- containerPos = pos.subtract(L.point(subtractX, -anchor.y + containerHeight + offsetY, true));
- if(this.options.hasTip) {
- if(basePoint.x + anchor.x < paddingTL.x + containerRadius + tipWidth/2) {
- containerPos.x = pos.x + anchor.x;
- L.DomUtil.addClass(this._container, 'leaflet-resp-popup-north-east');
- this._tipContainer.style.top = containerHeight + 'px';
- this._tipContainer.style.left = '0px';
- }
- else if(basePoint.x + anchor.x > mapSize.x - paddingBR.x - containerRadius - tipWidth/2) {
- containerPos.x = pos.x + anchor.x - containerWidth;
- L.DomUtil.addClass(this._container, 'leaflet-resp-popup-north-west');
- this._tipContainer.style.top = containerHeight + 'px';
- this._tipContainer.style.left = containerWidth + 'px';
- }
- else {
- L.DomUtil.addClass(this._container, 'leaflet-resp-popup-north');
- this._tipContainer.style.top = containerHeight + 'px';
- this._tipContainer.style.left = (pos.x + anchor.x - containerPos.x) + 'px';
- }
- }
- }
- else if(canGoLeft) {
- containerPos = pos.subtract(L.point(-anchor.x + containerWidth + offsetX, subtractY, true));
- if(this.options.hasTip) {
- if(basePoint.y + anchor.y < paddingTL.y + containerRadius + tipWidth/2) {
- containerPos.y = pos.y + anchor.y;
- L.DomUtil.addClass(this._container, 'leaflet-resp-popup-west-south');
- this._tipContainer.style.top = '0px';
- this._tipContainer.style.left = containerWidth + 'px';
- }
- else if(basePoint.y + anchor.y > mapSize.y - paddingBR.y - containerRadius - tipWidth/2) {
- containerPos.y = pos.y + anchor.y - containerHeight;
- L.DomUtil.addClass(this._container, 'leaflet-resp-popup-west-north');
- this._tipContainer.style.top = containerHeight + 'px';
- this._tipContainer.style.left = containerWidth + 'px';
- }
- else {
- L.DomUtil.addClass(this._container, 'leaflet-resp-popup-west');
- this._tipContainer.style.top = (pos.y + anchor.y - containerPos.y) + 'px';
- this._tipContainer.style.left = containerWidth + 'px';
- }
- }
- }
- else if(canGoBottom) {
- containerPos = pos.subtract(L.point(subtractX, -anchor.y - offsetY, true));
- if(this.options.hasTip) {
- if(basePoint.x + anchor.x < paddingTL.x + containerRadius + tipWidth/2) {
- containerPos.x = pos.x + anchor.x;
- L.DomUtil.addClass(this._container, 'leaflet-resp-popup-south-east');
- this._tipContainer.style.top = '1px';
- this._tipContainer.style.left = '0px';
- }
- else if(basePoint.x + anchor.x > mapSize.x - paddingBR.x - containerRadius - tipWidth/2) {
- containerPos.x = pos.x + anchor.x - containerWidth;
- L.DomUtil.addClass(this._container, 'leaflet-resp-popup-south-west');
- this._tipContainer.style.top = '0px';
- this._tipContainer.style.left = containerWidth + 'px';
- }
- else {
- L.DomUtil.addClass(this._container, 'leaflet-resp-popup-south');
- this._tipContainer.style.top = '2px';
- this._tipContainer.style.left = (pos.x + anchor.x - containerPos.x) + 'px';
- }
- }
- }
- else if(canGoRight) {
- containerPos = pos.subtract(L.point(-anchor.x - offsetX, subtractY, true));
- if(this.options.hasTip) {
- if(basePoint.y + anchor.y < paddingTL.y + containerRadius + tipWidth/2) {
- containerPos.y = pos.y + anchor.y;
- L.DomUtil.addClass(this._container, 'leaflet-resp-popup-east-south');
- this._tipContainer.style.top = '0px';
- this._tipContainer.style.left = '0px';
- }
- else if(basePoint.y + anchor.y > mapSize.y - paddingBR.y - containerRadius - tipWidth/2) {
- containerPos.y = pos.y + anchor.y - containerHeight;
- L.DomUtil.addClass(this._container, 'leaflet-resp-popup-east-north');
- this._tipContainer.style.top = containerHeight + 'px';
- this._tipContainer.style.left = '0px';
- }
- else {
- L.DomUtil.addClass(this._container, 'leaflet-resp-popup-east');
- this._tipContainer.style.top = (pos.y + anchor.y - containerPos.y) + 'px';
- this._tipContainer.style.left = '4px';
- }
- }
- }
- else {
- var pos = this._map.latLngToLayerPoint(this._map.getCenter());
- containerPos = pos.subtract(L.point(containerWidth / 2, containerHeight / 2));
- if(this.options.hasTip) {
- // this._tipContainer.style.display = 'none'; // this does not work
- }
- }
-
-
- // if point is not visible, just hide the popup
- if(basePoint.x < 0 || basePoint.y < 0 || basePoint.x > mapSize.x || basePoint.y > mapSize.y) {
- // this._container.style.display = 'none'; // this does not work
- }
-
- // if container is too big, just hide the popup
- if(containerWidth - Math.abs(paddingTL.x) - Math.abs(paddingBR.x) > mapSize.x || containerHeight - Math.abs(paddingTL.y) - Math.abs(paddingBR.y) > mapSize.y) {
- // this._container.style.display = 'none'; // this does not work
- }
-
- L.DomUtil.setPosition(this._container, containerPos);
- }
-
-});
-
-
-//Instantiates a `ResponsivePopup` object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the popup with a reference to the Layer to which it refers.
-L.responsivePopup = function (options, source) {
- return new L.ResponsivePopup(options, source);
-};
-
-//Adds Angular support
-if( typeof exports === 'object' && typeof module !== 'undefined') {
- exports.responsivePopup = L.responsivePopup;
- exports.ResponsivePopup = L.ResponsivePopup;
-}
\ No newline at end of file
+/*
+ leaflet.responsive.popup 0.6.4
+ (c) 2019 https://github.com/yafred
+*/
+
+L.ResponsivePopup = L.Popup.extend({
+ options: {
+ hasTip: true,
+ /*
+ * Inherited from L.Popup
+ *
+ * - offset
+ *
+ * - autoPanPadding
+ * - autoPanPaddingTopLeft
+ * - autoPanPaddingBottomRight
+ */
+ },
+
+ /**
+ * Overrides https://github.com/Leaflet/Leaflet/blob/v1.3.4/src/layer/Popup.js#L176
+ * This is to add hasTip option
+ */
+ _initLayout: function () {
+ var prefix = "leaflet-rrose",
+ container = (this._container = L.DomUtil.create(
+ "div",
+ prefix +
+ " " +
+ (this.options.className || "") +
+ " leaflet-zoom-animated",
+ ));
+
+ var wrapper = (this._wrapper = L.DomUtil.create(
+ "div",
+ prefix + "-content-wrapper",
+ container,
+ ));
+ this._contentNode = L.DomUtil.create("div", prefix + "-content", wrapper);
+
+ L.DomEvent.disableClickPropagation(wrapper);
+ L.DomEvent.disableScrollPropagation(this._contentNode);
+ L.DomEvent.on(wrapper, "contextmenu", L.DomEvent.stopPropagation);
+
+ this._tipContainer = L.DomUtil.create(
+ "div",
+ prefix + "-tip-container",
+ container,
+ );
+ if (!this.options.hasTip) {
+ this._tipContainer.style.visibility = "hidden";
+ }
+ this._tip = L.DomUtil.create("div", prefix + "-tip", this._tipContainer);
+
+ if (this.options.closeButton) {
+ var closeButton = (this._closeButton = L.DomUtil.create(
+ "a",
+ prefix + "-close-button",
+ container,
+ ));
+ closeButton.href = "#close";
+ closeButton.innerHTML = "×";
+
+ L.DomEvent.on(closeButton, "click", this._onCloseButtonClick, this);
+ }
+ },
+
+ /**
+ * Overrides https://github.com/Leaflet/Leaflet/blob/v1.3.4/src/layer/DivOverlay.js#L178
+ */
+ _updatePosition: function () {
+ if (!this._map) {
+ return;
+ }
+
+ var pos = this._map.latLngToLayerPoint(this._latlng),
+ basePoint = this._map.layerPointToContainerPoint(pos),
+ containerWidth = this._container.offsetWidth,
+ containerHeight = this._container.offsetHeight,
+ padding = L.point(this.options.autoPanPadding),
+ paddingTL = L.point(this.options.autoPanPaddingTopLeft || padding),
+ paddingBR = L.point(this.options.autoPanPaddingBottomRight || padding),
+ mapSize = this._map.getSize(),
+ anchor = this._getAnchor(), // popup anchor
+ offset = L.point(this.options.offset); // offset relative to anchor (option from L.DivOverlay. We only use absolute values).
+
+ // Leaflet default dimensions (should not be hard coded in the future)
+ var tipHeight = 11; //px
+ var tipWidth = 22; //px
+ var containerRadius = 12; //px
+
+ // Tweak offset to include tip dimensions
+ var offsetX = Math.abs(offset.x);
+ var offsetY = Math.abs(offset.y);
+ if (this.options.hasTip) {
+ offsetX += tipHeight;
+ offsetY += tipHeight;
+
+ // clear CSS
+ L.DomUtil.removeClass(this._container, "leaflet-resp-popup-north");
+ L.DomUtil.removeClass(this._container, "leaflet-resp-popup-south");
+ L.DomUtil.removeClass(this._container, "leaflet-resp-popup-east");
+ L.DomUtil.removeClass(this._container, "leaflet-resp-popup-west");
+ L.DomUtil.removeClass(this._container, "leaflet-resp-popup-north-east");
+ L.DomUtil.removeClass(this._container, "leaflet-resp-popup-north-west");
+ L.DomUtil.removeClass(this._container, "leaflet-resp-popup-south-east");
+ L.DomUtil.removeClass(this._container, "leaflet-resp-popup-south-west");
+ L.DomUtil.removeClass(this._container, "leaflet-resp-popup-east-north");
+ L.DomUtil.removeClass(this._container, "leaflet-resp-popup-east-south");
+ L.DomUtil.removeClass(this._container, "leaflet-resp-popup-west-north");
+ L.DomUtil.removeClass(this._container, "leaflet-resp-popup-west-south");
+ // this._container.style.display = 'initial'; // this does not work
+ }
+
+ // Where can we fit the popup ?
+ var canGoTop = true,
+ canGoBottom = true,
+ canGoLeft = true,
+ canGoRight = true,
+ containerPos = false;
+
+ if (
+ basePoint.y +
+ anchor.y -
+ offsetY -
+ containerHeight -
+ Math.abs(paddingTL.y) <
+ 0
+ ) {
+ canGoTop = false;
+ }
+ if (
+ basePoint.y +
+ anchor.y +
+ offsetY +
+ containerHeight +
+ Math.abs(paddingBR.y) >
+ mapSize.y
+ ) {
+ canGoBottom = false;
+ }
+ if (
+ basePoint.x +
+ anchor.x -
+ offsetX -
+ containerWidth -
+ Math.abs(paddingTL.x) <
+ 0
+ ) {
+ canGoLeft = false;
+ }
+ if (
+ basePoint.x +
+ anchor.x +
+ offsetX +
+ containerWidth +
+ Math.abs(paddingBR.x) >
+ mapSize.x
+ ) {
+ canGoRight = false;
+ }
+
+ // manage overflows
+ var subtractX = containerWidth / 2 - anchor.x,
+ subtractY = containerHeight / 2 - anchor.y;
+
+ if (canGoTop || canGoBottom) {
+ var containerLeft = basePoint.x + anchor.x - containerWidth / 2;
+ var containerRight = basePoint.x + anchor.x + containerWidth / 2;
+ if (containerLeft < Math.abs(paddingTL.x)) {
+ // left overflow
+ subtractX =
+ containerWidth / 2 - anchor.x - Math.abs(paddingTL.x) + containerLeft;
+ }
+ if (containerRight > mapSize.x - Math.abs(paddingBR.x)) {
+ // right overflow
+ subtractX =
+ containerWidth / 2 -
+ anchor.x +
+ containerRight -
+ mapSize.x +
+ Math.abs(paddingBR.x);
+ }
+ }
+ if (canGoLeft || canGoRight) {
+ var containerTop = basePoint.y + anchor.y - containerHeight / 2;
+ var containerBottom = basePoint.y + anchor.y + containerHeight / 2;
+ if (containerTop < Math.abs(paddingTL.y)) {
+ // top overflow
+ subtractY =
+ containerHeight / 2 - anchor.y - Math.abs(paddingTL.y) + containerTop;
+ }
+ if (containerBottom > mapSize.y - Math.abs(paddingBR.y)) {
+ // bottom overflow
+ subtractY =
+ containerHeight / 2 -
+ anchor.y +
+ containerBottom -
+ mapSize.y +
+ Math.abs(paddingBR.y);
+ }
+ }
+
+ // position the popup (order of preference is: top, left, bottom, right, centerOnMap)
+ if (canGoTop) {
+ containerPos = pos.subtract(
+ L.point(subtractX, -anchor.y + containerHeight + offsetY, true),
+ );
+ if (this.options.hasTip) {
+ if (
+ basePoint.x + anchor.x <
+ paddingTL.x + containerRadius + tipWidth / 2
+ ) {
+ containerPos.x = pos.x + anchor.x;
+ L.DomUtil.addClass(this._container, "leaflet-resp-popup-north-east");
+ this._tipContainer.style.top = containerHeight + "px";
+ this._tipContainer.style.left = "0px";
+ } else if (
+ basePoint.x + anchor.x >
+ mapSize.x - paddingBR.x - containerRadius - tipWidth / 2
+ ) {
+ containerPos.x = pos.x + anchor.x - containerWidth;
+ L.DomUtil.addClass(this._container, "leaflet-resp-popup-north-west");
+ this._tipContainer.style.top = containerHeight + "px";
+ this._tipContainer.style.left = containerWidth + "px";
+ } else {
+ L.DomUtil.addClass(this._container, "leaflet-resp-popup-north");
+ this._tipContainer.style.top = containerHeight + "px";
+ this._tipContainer.style.left =
+ pos.x + anchor.x - containerPos.x + "px";
+ }
+ }
+ } else if (canGoLeft) {
+ containerPos = pos.subtract(
+ L.point(-anchor.x + containerWidth + offsetX, subtractY, true),
+ );
+ if (this.options.hasTip) {
+ if (
+ basePoint.y + anchor.y <
+ paddingTL.y + containerRadius + tipWidth / 2
+ ) {
+ containerPos.y = pos.y + anchor.y;
+ L.DomUtil.addClass(this._container, "leaflet-resp-popup-west-south");
+ this._tipContainer.style.top = "0px";
+ this._tipContainer.style.left = containerWidth + "px";
+ } else if (
+ basePoint.y + anchor.y >
+ mapSize.y - paddingBR.y - containerRadius - tipWidth / 2
+ ) {
+ containerPos.y = pos.y + anchor.y - containerHeight;
+ L.DomUtil.addClass(this._container, "leaflet-resp-popup-west-north");
+ this._tipContainer.style.top = containerHeight + "px";
+ this._tipContainer.style.left = containerWidth + "px";
+ } else {
+ L.DomUtil.addClass(this._container, "leaflet-resp-popup-west");
+ this._tipContainer.style.top =
+ pos.y + anchor.y - containerPos.y + "px";
+ this._tipContainer.style.left = containerWidth + "px";
+ }
+ }
+ } else if (canGoBottom) {
+ containerPos = pos.subtract(
+ L.point(subtractX, -anchor.y - offsetY, true),
+ );
+ if (this.options.hasTip) {
+ if (
+ basePoint.x + anchor.x <
+ paddingTL.x + containerRadius + tipWidth / 2
+ ) {
+ containerPos.x = pos.x + anchor.x;
+ L.DomUtil.addClass(this._container, "leaflet-resp-popup-south-east");
+ this._tipContainer.style.top = "1px";
+ this._tipContainer.style.left = "0px";
+ } else if (
+ basePoint.x + anchor.x >
+ mapSize.x - paddingBR.x - containerRadius - tipWidth / 2
+ ) {
+ containerPos.x = pos.x + anchor.x - containerWidth;
+ L.DomUtil.addClass(this._container, "leaflet-resp-popup-south-west");
+ this._tipContainer.style.top = "0px";
+ this._tipContainer.style.left = containerWidth + "px";
+ } else {
+ L.DomUtil.addClass(this._container, "leaflet-resp-popup-south");
+ this._tipContainer.style.top = "2px";
+ this._tipContainer.style.left =
+ pos.x + anchor.x - containerPos.x + "px";
+ }
+ }
+ } else if (canGoRight) {
+ containerPos = pos.subtract(
+ L.point(-anchor.x - offsetX, subtractY, true),
+ );
+ if (this.options.hasTip) {
+ if (
+ basePoint.y + anchor.y <
+ paddingTL.y + containerRadius + tipWidth / 2
+ ) {
+ containerPos.y = pos.y + anchor.y;
+ L.DomUtil.addClass(this._container, "leaflet-resp-popup-east-south");
+ this._tipContainer.style.top = "0px";
+ this._tipContainer.style.left = "0px";
+ } else if (
+ basePoint.y + anchor.y >
+ mapSize.y - paddingBR.y - containerRadius - tipWidth / 2
+ ) {
+ containerPos.y = pos.y + anchor.y - containerHeight;
+ L.DomUtil.addClass(this._container, "leaflet-resp-popup-east-north");
+ this._tipContainer.style.top = containerHeight + "px";
+ this._tipContainer.style.left = "0px";
+ } else {
+ L.DomUtil.addClass(this._container, "leaflet-resp-popup-east");
+ this._tipContainer.style.top =
+ pos.y + anchor.y - containerPos.y + "px";
+ this._tipContainer.style.left = "4px";
+ }
+ }
+ } else {
+ var pos = this._map.latLngToLayerPoint(this._map.getCenter());
+ containerPos = pos.subtract(
+ L.point(containerWidth / 2, containerHeight / 2),
+ );
+ if (this.options.hasTip) {
+ // this._tipContainer.style.display = 'none'; // this does not work
+ }
+ }
+
+ // if point is not visible, just hide the popup
+ if (
+ basePoint.x < 0 ||
+ basePoint.y < 0 ||
+ basePoint.x > mapSize.x ||
+ basePoint.y > mapSize.y
+ ) {
+ // this._container.style.display = 'none'; // this does not work
+ }
+
+ // if container is too big, just hide the popup
+ if (
+ containerWidth - Math.abs(paddingTL.x) - Math.abs(paddingBR.x) >
+ mapSize.x ||
+ containerHeight - Math.abs(paddingTL.y) - Math.abs(paddingBR.y) >
+ mapSize.y
+ ) {
+ // this._container.style.display = 'none'; // this does not work
+ }
+
+ L.DomUtil.setPosition(this._container, containerPos);
+ },
+});
+
+//Instantiates a `ResponsivePopup` object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the popup with a reference to the Layer to which it refers.
+L.responsivePopup = function (options, source) {
+ return new L.ResponsivePopup(options, source);
+};
+
+//Adds Angular support
+if (typeof exports === "object" && typeof module !== "undefined") {
+ exports.responsivePopup = L.responsivePopup;
+ exports.ResponsivePopup = L.ResponsivePopup;
+}
diff --git a/public/assets/js/public.js b/public/assets/js/public.js
index 63cca1a..473bbaf 100644
--- a/public/assets/js/public.js
+++ b/public/assets/js/public.js
@@ -1,802 +1,893 @@
-;(function ($, hotspots, undefined) {
- "use strict";
-
- var Leaflet = L.noConflict();
-
- var ua = window.navigator.userAgent,
- isiOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i),
- isWebkit = !!ua.match(/WebKit/i),
- isWebkitiOS = isiOS && isWebkit,
- isMobileSafari = isiOS && isWebkit && !ua.match(/CriOS/i),
- getBrowserVersion = function(){
- var temp,
- M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
-
- M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
- if ((temp = ua.match(/version\/(\d+)/i)) != null) {
- M.splice(1, 1, temp[1]);
- }
- return parseInt(M[1]);
- }
-
- // Store all the leaflets on the page in an array for access later
- var leaflets = [];
-
- // Store all image maps on the page in an object for access later
- var imageMaps = {};
-
- // Store all the more info area hotspots in an object for access later
- hotspots.infoSpots = {};
-
- var mapSetup = function(){
- $('.da-error').hide();
- $('.hotspot-info').addClass('da-hidden');
-
- var images = $('img.hotspots-image, picture.hotspots-image img'); // Select images as well as images inside picture elements
-
- images.each(function(){
- var img = $(this);
-
- var tester = new Image();
-
- tester.onload = function(){
- markLoaded(img);
- moreInfoSetup(img);
- leafletSetup(img);
- };
- tester.src = img.attr('src');
- });
-
- if (isMobileSafari) {
- window.onpageshow = function(event){
- if (event.persisted) {
- window.location.reload();
- }
- };
- }
- };
-
- var markLoaded = function(img) {
- img.data('status', 'loaded');
- var container = img.parents('.hotspots-container').addClass('loaded');
- img.attr('aria-hidden', true);
- };
-
- var stopAudioVideo = function(el) {
- var iframe = el.querySelector( 'iframe[src*=youtube]');
- var video = el.querySelector( 'video' );
- var audio = el.querySelector( 'audio' );
+(function ($, hotspots, undefined) {
+ "use strict";
+
+ var Leaflet = L.noConflict();
+
+ var ua = window.navigator.userAgent,
+ isiOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i),
+ isWebkit = !!ua.match(/WebKit/i),
+ isWebkitiOS = isiOS && isWebkit,
+ isMobileSafari = isiOS && isWebkit && !ua.match(/CriOS/i),
+ getBrowserVersion = function () {
+ var temp,
+ M =
+ ua.match(
+ /(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i,
+ ) || [];
+
+ M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, "-?"];
+ if ((temp = ua.match(/version\/(\d+)/i)) != null) {
+ M.splice(1, 1, temp[1]);
+ }
+ return parseInt(M[1]);
+ };
+
+ // Store all the leaflets on the page in an array for access later
+ var leaflets = [];
+
+ // Store all image maps on the page in an object for access later
+ var imageMaps = {};
+
+ // Store all the more info area hotspots in an object for access later
+ hotspots.infoSpots = {};
+
+ var mapSetup = function () {
+ $(".da-error").hide();
+ $(".hotspot-info").addClass("da-hidden");
+
+ var images = $("img.hotspots-image, picture.hotspots-image img"); // Select images as well as images inside picture elements
+
+ images.each(function () {
+ var img = $(this);
+
+ var tester = new Image();
+
+ tester.onload = function () {
+ markLoaded(img);
+ moreInfoSetup(img);
+ leafletSetup(img);
+ };
+ tester.src = img.attr("src");
+ });
+
+ if (isMobileSafari) {
+ window.onpageshow = function (event) {
+ if (event.persisted) {
+ window.location.reload();
+ }
+ };
+ }
+ };
+
+ var markLoaded = function (img) {
+ img.data("status", "loaded");
+ var container = img.parents(".hotspots-container").addClass("loaded");
+ img.attr("aria-hidden", true);
+ };
+
+ var stopAudioVideo = function (el) {
+ var iframe = el.querySelector("iframe[src*=youtube]");
+ var video = el.querySelector("video");
+ var audio = el.querySelector("audio");
if (iframe) {
- var iframeSrc = iframe.src;
- iframe.src = iframeSrc;
+ var iframeSrc = iframe.src;
+ iframe.src = iframeSrc;
}
if (video) {
- video.pause();
+ video.pause();
}
if (audio) {
- audio.pause();
+ audio.pause();
+ }
+ };
+
+ var moreInfoSetup = function (img) {
+ var container = img.parents(".hotspots-container");
+
+ if (container.data("layout") == "tooltip") {
+ return;
+ }
+
+ if (container.data("layout") == "lightbox") {
+ lightboxSetup(container, img);
+ return;
+ }
+
+ infoboxSetup(container, img);
+ };
+
+ var infoboxSetup = function (container, img) {
+ var initial = container.find(".hotspot-initial");
+ var content = container.find(".hotspots-placeholder");
+ initial.addClass("visible");
+ container.on("active.responsilight inactive.responsilight", function (e) {
+ var data = $(e.target).data("areaData");
+ var info;
+ if (e.type === "active") {
+ info = $(data.href);
+ } else {
+ info = initial;
+ }
+
+ var visibleContent = content.children(".visible");
+ stopAudioVideo(visibleContent.get(0));
+ visibleContent.removeClass("visible");
+ info.removeClass("da-hidden").addClass("visible").appendTo(content);
+
+ // Check for an embedded video player
+ var video = info.find(".wp-video");
+ if (video.length) {
+ if (!info.data("video-resized")) {
+ info.data("video-resized", true);
+ window.dispatchEvent(new Event("resize"));
+ }
+ }
+ });
+ };
+
+ var lightboxSetup = function (container, img) {
+ container.on("active.responsilight", function (e) {
+ var data = $(e.target).data("areaData"),
+ info = $(data.href),
+ container = info.parent(),
+ target = $(e.target),
+ currentLightbox = $(".featherlight");
+
+ if (e.type === "active" && currentLightbox.length === 0) {
+ $.featherlight('
', {
+ closeLabel: drawattentionData.closeLabel,
+ closeSpeed: 250,
+ closeOnEsc: false,
+ afterContent: function () {
+ var content = $(".featherlight-inner"),
+ lb = $(".featherlight-content"),
+ mapNo = img.data("id");
+
+ info.appendTo(content).show();
+ lb.addClass("lightbox-" + mapNo);
+
+ // Fix accessibility issue - links not focusable by keyboard
+ var untabbables = info.find("a[tabindex=-1]");
+ untabbables.attr("tabindex", 0);
+
+ setTimeout(function () {
+ var img = content.find("img"),
+ contentHeight = content.get(0).scrollHeight,
+ imgHeight = img.height(),
+ lbHeight = lb.outerHeight();
+
+ if (contentHeight > lbHeight) {
+ var diff = contentHeight - lbHeight + 50,
+ newHeight = imgHeight - diff,
+ minHeight = $(window).innerHeight() / 2;
+
+ newHeight = newHeight < minHeight ? minHeight : newHeight;
+
+ var naturalHeight = img.prop("naturalHeight");
+
+ if (newHeight < naturalHeight) {
+ img.css({ width: "auto" });
+ img.animate(
+ {
+ height: newHeight,
+ },
+ 200,
+ );
+ }
+ }
+ }, 100);
+
+ lightboxAnchorLinks(content, target);
+ window.dispatchEvent(new Event("resize")); // Trigger window resize event for [video] shortcode JS
+ },
+ afterOpen: function () {
+ $("body").on("keyup", documentEsc);
+ },
+ afterClose: function () {
+ target.removeClass("hotspot-active");
+ $("body").off("keyup", documentEsc);
+ },
+ beforeClose: function () {
+ stopAudioVideo(document.querySelector(".featherlight-content"));
+ setTimeout(function () {
+ info.hide().appendTo(container);
+ }, 500); // delay hiding content and moving it back outside the lightbox
+ },
+ });
+ }
+ });
+ };
+
+ var documentEsc = function (e) {
+ if (e.keyCode === 27) {
+ $.featherlight.current().close();
}
- }
-
- var moreInfoSetup = function(img) {
- var container = img.parents('.hotspots-container');
-
- if (container.data('layout') == 'tooltip') {
- return;
- }
-
- if (container.data('layout') == 'lightbox') {
- lightboxSetup(container, img);
- return;
- }
-
- infoboxSetup(container, img);
- };
-
- var infoboxSetup = function(container, img) {
- var initial = container.find('.hotspot-initial');
- var content = container.find('.hotspots-placeholder');
- initial.addClass('visible');
- container.on('active.responsilight inactive.responsilight', function(e){
- var data = $(e.target).data('areaData');
- var info;
- if (e.type === 'active') {
- info = $(data.href);
- } else {
- info = initial;
- }
-
- var visibleContent = content.children('.visible');
- stopAudioVideo(visibleContent.get(0));
- visibleContent.removeClass('visible');
- info.removeClass('da-hidden').addClass('visible').appendTo(content);
-
-
- // Check for an embedded video player
- var video = info.find('.wp-video');
- if (video.length) {
- if (!info.data('video-resized')) {
- info.data('video-resized', true);
- window.dispatchEvent(new Event('resize'));
- }
- }
- });
- };
-
- var lightboxSetup = function(container, img) {
- container.on('active.responsilight', function(e){
- var data = $(e.target).data('areaData'),
- info = $(data.href),
- container = info.parent(),
- target = $(e.target),
- currentLightbox = $('.featherlight');
-
- if (e.type === 'active' && currentLightbox.length === 0) {
- $.featherlight('
', {
- closeLabel: drawattentionData.closeLabel,
- closeSpeed: 250,
- closeOnEsc: false,
- afterContent: function(){
- var content = $('.featherlight-inner'),
- lb = $('.featherlight-content'),
- mapNo = img.data('id');
-
- info.appendTo(content).show();
- lb.addClass('lightbox-' + mapNo);
-
- // Fix accessibility issue - links not focusable by keyboard
- var untabbables = info.find('a[tabindex=-1]');
- untabbables.attr('tabindex', 0);
-
- setTimeout(function(){
- var img = content.find('img'),
- contentHeight = content.get(0).scrollHeight,
- imgHeight = img.height(),
- lbHeight = lb.outerHeight();
-
- if (contentHeight > lbHeight) {
- var diff = contentHeight - lbHeight + 50,
- newHeight = imgHeight - diff,
- minHeight = $(window).innerHeight()/2;
-
- newHeight = newHeight < minHeight ? minHeight : newHeight;
-
- var naturalHeight = img.prop('naturalHeight');
-
- if (newHeight < naturalHeight) {
- img.css({'width': 'auto'});
- img.animate({
- 'height': newHeight
- }, 200);
- }
- }
- }, 100);
-
- lightboxAnchorLinks(content, target);
- window.dispatchEvent(new Event('resize')); // Trigger window resize event for [video] shortcode JS
- },
- afterOpen: function() {
- $('body').on('keyup', documentEsc);
- },
- afterClose: function(){
- target.removeClass('hotspot-active');
- $('body').off('keyup', documentEsc);
- },
- beforeClose: function(){
- stopAudioVideo(document.querySelector('.featherlight-content'));
- setTimeout(function(){
- info.hide().appendTo(container);
- }, 500); // delay hiding content and moving it back outside the lightbox
- }
- });
- }
- });
- };
-
- var documentEsc = function(e) {
- if (e.keyCode === 27) {
- $.featherlight.current().close();
- }
- };
-
- var lightboxAnchorLinks = function(content, hotspot){
- var links = content.find('.hotspot-content a[href^="#"]');
- links.on('click', function(e){
- e.preventDefault();
- var targetEl = $(e.target.hash);
- var current = $.featherlight.current();
- if (!current) return
- current.afterClose = function(){
- hotspot.removeClass('hotspot-active');
- $('html').removeClass('with-featherlight');
- $('html, body').animate({
- scrollTop: targetEl.offset().top
- }, 500);
- }
- current.close();
- });
- };
-
- var showTooltip = function(shape, areaData) {
- var container = $(shape._map._container);
- var content = $(areaData.href).html();
-
- var tip = Leaflet.responsivePopup({
- autoPan: false,
- closeButton: areaData.trigger == 'click',
- hasTip: container.width() > 840,
- maxHeight: container.height() * .9,
- offset: new Leaflet.Point(0,0)
- });
-
- tip.setContent(content);
- shape.bindPopup(tip);
-
- if (areaData.trigger === 'click') {
- shape.on('click', function(e){
- if (shape._path.classList.contains('hotspot-active')) {
- shape.closePopup()
- } else {
- shape.openPopup();
- }
- });
- } else {
- shape.on('mouseover', function(){
- shape.openPopup();
- });
- shape.on('mouseout', function(){
- shape.closePopup();
- });
- }
-
- container.on('click', function(e){
- e.stopPropagation();
- });
- $(document).on('click', function(e){
- shape.closePopup();
- shape._path.classList.remove('hotspot-active');
- });
- };
-
- var leafletSetup = function(img) {
- var id = img.data('id');
- var container = $('
');
- var imgWidth = img.width();
- var imgHeight = img.height();
-
- container.css({
- 'width': imgWidth + 'px',
- 'height': imgHeight + 'px'
- });
- img.after(container);
-
- // Check to be sure the container is on the page
- // To prevent errors when loaded in Elementor popup
- var containerTest = $('#hotspots-map-container-' + id);
- if (!containerTest.length) {
- return
- }
-
- var map = Leaflet.map('hotspots-map-container-' + id, {
- attributionControl: false,
- boxZoom: false,
- crs: Leaflet.CRS.Simple,
- doubleClickZoom: false,
- dragging: false,
- keyboard: false,
- minZoom: -20,
- scrollWheelZoom: false,
- // tap: !isWebkitiOS,
- tap: true,
- touchZoom: false,
- zoomControl: false,
- zoomSnap: 0,
- });
-
- var domImg = img.get(0);
- var natHeight = domImg.naturalHeight;
- var natWidth = domImg.naturalWidth;
- img.data('natW', natWidth);
- img.data('natH', natHeight);
- var bounds = [[0,0], [natHeight, natWidth]];
- var imageLayer = Leaflet.imageOverlay(img.attr('src'), bounds).addTo(map);
- map.fitBounds(bounds);
-
- leaflets.push({
- map: map,
- img: img
- });
-
- drawSpots(img, map);
- };
-
- var showContextMenu = function(shape, areaData, e) {
- var hash = areaData.href;
- var container = $(shape._map._container);
-
- if (!hash) {
- return;
- }
-
- $('.da-address-wrapper').remove();
-
- var windowAddress = window.location.href.split('#')[0];
- var shapeAddress = windowAddress + hash;
+ };
+
+ var lightboxAnchorLinks = function (content, hotspot) {
+ var links = content.find('.hotspot-content a[href^="#"]');
+ links.on("click", function (e) {
+ e.preventDefault();
+ var targetEl = $(e.target.hash);
+ var current = $.featherlight.current();
+ if (!current) return;
+ current.afterClose = function () {
+ hotspot.removeClass("hotspot-active");
+ $("html").removeClass("with-featherlight");
+ $("html, body").animate(
+ {
+ scrollTop: targetEl.offset().top,
+ },
+ 500,
+ );
+ };
+ current.close();
+ });
+ };
+
+ var showTooltip = function (shape, areaData) {
+ var container = $(shape._map._container);
+ var content = $(areaData.href).html();
+
+ var tip = Leaflet.responsivePopup({
+ autoPan: false,
+ closeButton: areaData.trigger == "click",
+ hasTip: container.width() > 840,
+ maxHeight: container.height() * 0.9,
+ offset: new Leaflet.Point(0, 0),
+ });
+
+ tip.setContent(content);
+ shape.bindPopup(tip);
+
+ if (areaData.trigger === "click") {
+ shape.on("click", function (e) {
+ if (shape._path.classList.contains("hotspot-active")) {
+ shape.closePopup();
+ } else {
+ shape.openPopup();
+ }
+ });
+ } else {
+ shape.on("mouseover", function () {
+ shape.openPopup();
+ });
+ shape.on("mouseout", function () {
+ shape.closePopup();
+ });
+ }
+
+ container.on("click", function (e) {
+ e.stopPropagation();
+ });
+ $(document).on("click", function (e) {
+ shape.closePopup();
+ shape._path.classList.remove("hotspot-active");
+ });
+ };
+
+ var leafletSetup = function (img) {
+ var id = img.data("id");
+ var container = $(
+ '
',
+ );
+ var imgWidth = img.width();
+ var imgHeight = img.height();
+
+ container.css({
+ width: imgWidth + "px",
+ height: imgHeight + "px",
+ });
+ img.after(container);
+
+ // Check to be sure the container is on the page
+ // To prevent errors when loaded in Elementor popup
+ var containerTest = $("#hotspots-map-container-" + id);
+ if (!containerTest.length) {
+ return;
+ }
+
+ var map = Leaflet.map("hotspots-map-container-" + id, {
+ attributionControl: false,
+ boxZoom: false,
+ crs: Leaflet.CRS.Simple,
+ doubleClickZoom: false,
+ dragging: false,
+ keyboard: false,
+ minZoom: -20,
+ scrollWheelZoom: false,
+ // tap: !isWebkitiOS,
+ tap: true,
+ touchZoom: false,
+ zoomControl: false,
+ zoomSnap: 0,
+ });
+
+ var domImg = img.get(0);
+ var natHeight = domImg.naturalHeight;
+ var natWidth = domImg.naturalWidth;
+ img.data("natW", natWidth);
+ img.data("natH", natHeight);
+ var bounds = [
+ [0, 0],
+ [natHeight, natWidth],
+ ];
+ var imageLayer = Leaflet.imageOverlay(img.attr("src"), bounds).addTo(map);
+ map.fitBounds(bounds);
+
+ leaflets.push({
+ map: map,
+ img: img,
+ });
+
+ drawSpots(img, map);
+ };
+
+ var showContextMenu = function (shape, areaData, e) {
+ var hash = areaData.href;
+ var container = $(shape._map._container);
+
+ if (!hash) {
+ return;
+ }
+
+ $(".da-address-wrapper").remove();
+
+ var windowAddress = window.location.href.split("#")[0];
+ var shapeAddress = windowAddress + hash;
var div = $('
')
- .css({
- 'left': e.originalEvent.pageX + 'px',
- 'top': e.originalEvent.pageY + 'px'
- })
- .append('' + shapeAddress + '
')
- .append('× ')
- .appendTo(document.body);
-
- div.find('.da-address-close').on('click', function(){
- div.remove();
- });
- };
-
- var drawSpots = function(img, map) {
- var id = img.data('id');
-
- /* If the image has a usemap attribute, detach the map and store it in the imageMaps object */
- if (img[0].hasAttribute('usemap')) {
- var mapName = img.attr('usemap').replace('#', '');
- var imageMap = $('map[name="' + mapName + '"]');
- imageMaps[id] = imageMap.detach();
- img.removeAttr('usemap');
- } else { /* Else we've already removed the image map, so we just need to get it */
- var imageMap = imageMaps[id];
- }
-
- var areas = imageMap.find('area');
- var container = img.parents('.hotspots-container');
-
- areas.each(function(){
- var area = $(this);
- var shape = area.attr('shape');
- var coords = area.attr('coords').split(',');
- var areaData = {
- style: area.data('color-scheme') ? area.data('color-scheme') : 'default',
- title: area.attr('title'),
- href: area.attr('href'),
- spot: area.data('id'),
- target: area.attr('target'),
- action: area.data('action'),
- layout: container.data('layout'),
- trigger: container.data('trigger')
- };
- switch(shape) {
- case 'circle':
- renderCircle(coords, map, img, areaData);
- break;
- case 'rect':
- renderPoly(coords, map, img, areaData);
- break
- case 'polygon':
- renderPoly(coords, map, img, areaData);
- break;
- case 'poly': // Leaving this here for backward compatibility
- renderPoly(coords, map, img, areaData);
- break;
- }
- });
- // A11y fixes after all the spots are drawn
- a11yFixes(img, map);
-
- // Link to area after all the spots are drawn
- hotspots.linkToArea();
- };
-
- var renderCircle = function(coords, map, img, areaData) {
- var x = coords[0];
- var y = img.data('natH') - coords[1];
- var rad = coords[2];
- var circle = Leaflet.circle([y,x], {
- radius: rad,
- className: 'hotspot-' + areaData.style,
- title: areaData.title
- });
-
- circle.on('add', function(e) {
- var $circle = $(e.target.getElement());
- $circle.data('areaData', areaData);
- $circle.attr('tabindex', '0');
- $circle.attr('aria-label', areaData.title);
- $circle.attr('name', areaData.title);
- });
-
- circle.addTo(map);
-
- // If this is a more info hotspot, add it to the infoSpots object
- if (areaData.href.charAt(0) === '#') {
- var spotName = areaData.href.replace('#', '');
- hotspots.infoSpots[spotName] = circle;
- }
-
- shapeEvents(circle, areaData);
- };
-
- var renderPoly = function (coords, map, img, areaData) {
- var xCoords = [];
- var yCoords = [];
- for (var i = 0; i < coords.length; i++) {
- if (i % 2 == 0) {
- xCoords.push(coords[i]);
- } else {
- yCoords.push(coords[i]);
- }
- }
-
- var polyCoords = yCoords.map(function(coord, index) {
- return [img.data('natH') - coord, xCoords[index]];
- });
-
- var poly = Leaflet.polygon(polyCoords, {
- className: 'hotspot-' + areaData.style,
- title: areaData.title
- });
-
- // Attach the area data to the path as soon as it's added to the map, a11y attributes
- poly.on('add', function(e) {
- var $poly = $(e.target.getElement());
- $poly.data('areaData', areaData);
- $poly.attr('tabindex', '0');
- $poly.attr('aria-label', areaData.title);
- $poly.attr('name', areaData.title);
- });
-
- poly.addTo(map);
-
- // If this is a more info hotspot, add it to the infoSpots object
- if (areaData.href.charAt(0) === '#') {
- var spotName = areaData.href.replace('#', '');
- hotspots.infoSpots[spotName] = poly;
- }
-
- shapeEvents(poly, areaData);
- };
-
- var shapeOver = function(shape, areaData, e) {
- var $shape = $(e.target.getElement());
- $shape.trigger('over.responsilight');
- if (areaData.trigger === 'hover' && e.type !== 'touchstart' & e.type !== 'keypress') {
- $shape.addClass('hotspot-active');
- $shape.trigger('active.responsilight');
- }
- };
-
- var shapeOut = function(shape, areaData, e) {
- var $shape = $(e.target.getElement());
- $shape.trigger('out.responsilight');
- if (areaData.trigger === 'hover' && e.type !== 'keypress') {
- $shape.removeClass('hotspot-active');
- $shape.trigger('inactive.responsilight');
- // If mouse user, blur hover spots when mouse moves out
- if (e.type === 'mouseout') {
- $shape.trigger('blur');
- }
- }
- };
-
- var shapeClick = function(shape, areaData, e) {
- var $shape = $(e.target.getElement());
- $shape.trigger('areaClick.responsilight');
- if (areaData.trigger === 'hover' && e.type !== 'touchstart' && e.type !== 'keypress' && !isMobileSafari) {
- return;
- }
- $shape.toggleClass('hotspot-active');
- if ($shape.hasClass('hotspot-active')) {
- $shape.trigger('active.responsilight');
- } else {
- $shape.trigger('inactive.responsilight');
- }
- var oldActive = $shape.siblings('.hotspot-active');
- if (oldActive.length) {
- oldActive.removeClass('hotspot-active');
- }
- };
-
- var shapeEvents = function(shape, areaData) {
- // Handle URL spots
- if (areaData.action == 'url') {
- if (areaData.title) {
- shape.bindTooltip(areaData.title);
- }
- shape.on('click', function(e) {
- if (areaData.target == '_new' && !isMobileSafari) { // new window
- window.open(areaData.href, '_blank');
- } else { // same window
- var first = areaData.href.charAt(0);
- var targetElem;
- try {
- targetElem = first === '#' ? $(areaData.href) : null;
- } catch (error) {
- targetElem = null
- }
- if (targetElem && targetElem.length) { // hash link to existing target
- $('html, body').animate({
- scrollTop: targetElem.offset().top - 50
- }, 750, function(){ // callback after scrolling
- history.pushState({}, '', areaData.href);
- })
- } else {
- window.location = areaData.href;
- }
- }
- });
- return;
- }
-
- // Show right-click context menu for logged-in admins only
- if (drawattentionData.isLoggedIn && drawattentionData.isAdmin) {
- shape.on('contextmenu', function(e){
- showContextMenu(shape, areaData, e);
- });
- }
-
- // Handle tooltip spots
- if (areaData.layout === 'tooltip') {
- showTooltip(shape, areaData);
- }
-
- // Add styled tooltip to all non-hover areas
- if (areaData.action === 'url' || areaData.trigger === 'click' && areaData.layout !== 'tooltip') {
- if (areaData.title) {
- shape.bindTooltip(areaData.title);
- }
- }
-
- // Handle all other spots
- var moved = false;
-
- shape.on('touchstart touchmove touchend click mouseover mouseout keypress focus blur', function(e){
- switch(e.type) {
- case 'touchstart':
- moved = false;
- break;
- case 'touchmove':
- moved = true;
- break;
- case 'touchend':
- if (moved) {
- return;
- }
- shapeOver(shape, areaData, e);
- shapeClick(shape, areaData, e);
- break;
- case 'click':
- shapeClick(shape, areaData, e);
- break;
- case 'keypress':
- var key = e.originalEvent.which;
- if ( key == 13 || key == 32) {
- e.originalEvent.preventDefault();
- shapeClick(shape, areaData, e);
- }
- break;
- case 'mouseover':
- if (!isMobileSafari || (isMobileSafari && getBrowserVersion < 13)) {
- shapeOver(shape, areaData, e);
- }
- if (isMobileSafari && !(getBrowserVersion() >= 12)) {
- shapeClick(shape, areaData, e);
- }
- break;
- case 'focus':
- shapeOver(shape, areaData, e);
- break;
- case 'blur':
- shapeOut(shape, areaData, e);
- break;
- case 'mouseout':
- shapeOut(shape, areaData, e);
- break;
- }
- });
- };
-
- var a11yFixes = function(img, map){
- let svg = img.siblings('.leaflet-container').find('.leaflet-overlay-pane svg');
- let id = img.data('id');
-
- // Add title and description to SVG
- svg.prepend('' + img.data('image-description') + ' ');
- svg.prepend('' + img.data('image-title') + ' ');
-
- // Use title and desc to describe the svg
- svg.attr('aria-labelledby', 'img-title-' + id);
- svg.attr('aria-describedby', 'img-desc-' + id);
-
- // Make svg screen reader traversable
- svg.attr('role', 'group');
-
- // Create a traversable list
- var group = svg.find('g').attr('role', 'list');
- group.children().attr('role', 'listitem');
-
- // Handle tooltips for the map
- map.on('popupopen',function(popup) {
- // shift focus to the popup when it opens
- $(popup.popup._container).find('.leaflet-rrose-content').attr('tabindex','-1').focus();
-
- // move the close button to the end of the popup content so screen readers reach it
- // after the main popup content, not before
- var close = $(popup.popup._container).find('.leaflet-rrose-close-button').detach();
- close.attr('aria-label','Close item');
- $(popup.popup._container).append(close);
-
- $(document).on('keydown', function(e){
- if (e.which == 27) {
- map.closePopup();
- }
- });
-
- });
-
- // return focus to the icon we started from before opening the pop up
- map.on('popupclose',function(popup) {
- $(document).off('keydown');
- $(popup.popup._source._path).focus();
- });
-
- };
-
- hotspots.linkToArea = function(){ // Called after the shapes are drawn
- var hash = window.location.hash;
- if (!hash) return;
-
- var spotName = hash.replace('#', '');
- if (!hotspots.infoSpots.hasOwnProperty(spotName)) return;
-
- Object.keys(hotspots.infoSpots).forEach(function(key) {
- hotspots.infoSpots[key].closeTooltip()
- })
-
- hotspots.infoSpots[spotName].fire('click')
- };
-
- hotspots.setup = function(){
- mapSetup();
- };
-
- hotspots.resizeTimer = null;
- hotspots.resizing = false;
-
- hotspots.init = function(){ // For backward compatibility - resets the size of the leaflet on demand
- leaflets.forEach(function(item){
- var isLoaded = item.img.data('status') === 'loaded';
-
- if (!isLoaded) {
- return;
- }
-
- item.img.next('.hotspots-map-container').css({
- 'width': item.img.width() + 'px',
- 'height': item.img.height() + 'px'
- });
- item.map.invalidateSize(true);
- item.map.fitBounds([[0,0], [item.img.data('natH'), item.img.data('natW')]]);
- });
- };
-
- hotspots.compatibilityFixes = function(){
- if (window.Foundation) { /* Fix for Foundation firing tag change event indiscriminately when some items are clicked on the page */
- $(window).on('change.zf.tabs', function(e) {
- if (e.target.tagName !== 'INPUT') {
- hotspots.init();
- }
- });
- }
-
- $(window).on('pageloaded load', function() { /* Listen for pageloaded and load events on the window */
- hotspots.init();
- });
-
- $(window).on('et_hashchange', function() { /* Listen for Divi hashchange */
- setTimeout(function() {
- hotspots.init();
- }, 1000);
- });
-
- $('.ult_tabs').on('click', '.ult_tab a', function() { /* Ultimate tabs */
- setTimeout(function() {
- hotspots.init();
- }, 2000);
- });
-
- $('a[data-vc-accordion], .et_pb_tabs .et_pb_tabs_controls li, .et_pb_toggle_title').on('click', function() { /* Divi tabs, accordion, toggle */
- setTimeout(function() {
- hotspots.init();
- }, 1000);
- });
- $('.vc_tta-tabs-container').on('click', '.vc_tta-tab', function() { /* Visual composer tabs */
- setTimeout(function() {
- hotspots.init();
- }, 1000);
- });
-
- $('.ui-tabs-anchor, .nav-tabs > li').on('click', function() { /* UI Tabs */
- setTimeout(function() {
- hotspots.init();
- }, 750);
- });
-
- $('.fl-accordion-button').on('click', function() { /* Beaver Builder accordion */
- setTimeout(function() {
- hotspots.init();
- }, 500);
- });
-
- $('.responsive-tabs').on('click', '.responsive-tabs__list__item', function() { /* Responsive tabs */
- hotspots.init();
- });
-
- $('.elementor-tabs').on('click', '.elementor-tab-title', function() { /* Elementor tabs */
- hotspots.init();
- });
-
- $('.fl-tabs').on('click', 'a.fl-tabs-label', function() { /* Beaver Builder tabs */
- hotspots.init();
- });
-
- $('.uabb-adv-accordion-button .uabb-tabs').on('click', function() { /* Ultimate Beaver Builder addons accordion and tabs */
- setTimeout(function() {
- hotspots.init();
- }, 250);
- });
- $('.w-tabs-item').on('click', function() { /* Custom Woocommerce tabs */
- setTimeout(function() {
- hotspots.init();
- }, 1000);
- });
- };
-
-}(jQuery, window.hotspots = window.hotspots || {}));
-
-jQuery(function(){
- hotspots.setup();
- hotspots.compatibilityFixes();
+ .css({
+ left: e.originalEvent.pageX + "px",
+ top: e.originalEvent.pageY + "px",
+ })
+ .append("" + shapeAddress + "
")
+ .append('× ')
+ .appendTo(document.body);
+
+ div.find(".da-address-close").on("click", function () {
+ div.remove();
+ });
+ };
+
+ var drawSpots = function (img, map) {
+ var id = img.data("id");
+
+ /* If the image has a usemap attribute, detach the map and store it in the imageMaps object */
+ if (img[0].hasAttribute("usemap")) {
+ var mapName = img.attr("usemap").replace("#", "");
+ var imageMap = $('map[name="' + mapName + '"]');
+ imageMaps[id] = imageMap.detach();
+ img.removeAttr("usemap");
+ } else {
+ /* Else we've already removed the image map, so we just need to get it */
+ var imageMap = imageMaps[id];
+ }
+
+ var areas = imageMap.find("area");
+ var container = img.parents(".hotspots-container");
+
+ areas.each(function () {
+ var area = $(this);
+ var shape = area.attr("shape");
+ var coords = area.attr("coords").split(",");
+ var areaData = {
+ style: area.data("color-scheme")
+ ? area.data("color-scheme")
+ : "default",
+ title: area.attr("title"),
+ href: area.attr("href"),
+ spot: area.data("id"),
+ target: area.attr("target"),
+ action: area.data("action"),
+ layout: container.data("layout"),
+ trigger: container.data("trigger"),
+ };
+ switch (shape) {
+ case "circle":
+ renderCircle(coords, map, img, areaData);
+ break;
+ case "rect":
+ renderPoly(coords, map, img, areaData);
+ break;
+ case "polygon":
+ renderPoly(coords, map, img, areaData);
+ break;
+ case "poly": // Leaving this here for backward compatibility
+ renderPoly(coords, map, img, areaData);
+ break;
+ }
+ });
+ // A11y fixes after all the spots are drawn
+ a11yFixes(img, map);
+
+ // Link to area after all the spots are drawn
+ hotspots.linkToArea();
+ };
+
+ var renderCircle = function (coords, map, img, areaData) {
+ var x = coords[0];
+ var y = img.data("natH") - coords[1];
+ var rad = coords[2];
+ var circle = Leaflet.circle([y, x], {
+ radius: rad,
+ className: "hotspot-" + areaData.style,
+ title: areaData.title,
+ });
+
+ circle.on("add", function (e) {
+ var $circle = $(e.target.getElement());
+ $circle.data("areaData", areaData);
+ $circle.attr("tabindex", "0");
+ $circle.attr("aria-label", areaData.title);
+ $circle.attr("name", areaData.title);
+ });
+
+ circle.addTo(map);
+
+ // If this is a more info hotspot, add it to the infoSpots object
+ if (areaData.href.charAt(0) === "#") {
+ var spotName = areaData.href.replace("#", "");
+ hotspots.infoSpots[spotName] = circle;
+ }
+
+ shapeEvents(circle, areaData);
+ };
+
+ var renderPoly = function (coords, map, img, areaData) {
+ var xCoords = [];
+ var yCoords = [];
+ for (var i = 0; i < coords.length; i++) {
+ if (i % 2 == 0) {
+ xCoords.push(coords[i]);
+ } else {
+ yCoords.push(coords[i]);
+ }
+ }
+
+ var polyCoords = yCoords.map(function (coord, index) {
+ return [img.data("natH") - coord, xCoords[index]];
+ });
+
+ var poly = Leaflet.polygon(polyCoords, {
+ className: "hotspot-" + areaData.style,
+ title: areaData.title,
+ });
+
+ // Attach the area data to the path as soon as it's added to the map, a11y attributes
+ poly.on("add", function (e) {
+ var $poly = $(e.target.getElement());
+ $poly.data("areaData", areaData);
+ $poly.attr("tabindex", "0");
+ $poly.attr("aria-label", areaData.title);
+ $poly.attr("name", areaData.title);
+ });
+
+ poly.addTo(map);
+
+ // If this is a more info hotspot, add it to the infoSpots object
+ if (areaData.href.charAt(0) === "#") {
+ var spotName = areaData.href.replace("#", "");
+ hotspots.infoSpots[spotName] = poly;
+ }
+
+ shapeEvents(poly, areaData);
+ };
+
+ var shapeOver = function (shape, areaData, e) {
+ var $shape = $(e.target.getElement());
+ $shape.trigger("over.responsilight");
+ if (
+ areaData.trigger === "hover" &&
+ (e.type !== "touchstart") & (e.type !== "keypress")
+ ) {
+ $shape.addClass("hotspot-active");
+ $shape.trigger("active.responsilight");
+ }
+ };
+
+ var shapeOut = function (shape, areaData, e) {
+ var $shape = $(e.target.getElement());
+ $shape.trigger("out.responsilight");
+ if (areaData.trigger === "hover" && e.type !== "keypress") {
+ $shape.removeClass("hotspot-active");
+ $shape.trigger("inactive.responsilight");
+ // If mouse user, blur hover spots when mouse moves out
+ if (e.type === "mouseout") {
+ $shape.trigger("blur");
+ }
+ }
+ };
+
+ var shapeClick = function (shape, areaData, e) {
+ var $shape = $(e.target.getElement());
+ $shape.trigger("areaClick.responsilight");
+ if (
+ areaData.trigger === "hover" &&
+ e.type !== "touchstart" &&
+ e.type !== "keypress" &&
+ !isMobileSafari
+ ) {
+ return;
+ }
+ $shape.toggleClass("hotspot-active");
+ if ($shape.hasClass("hotspot-active")) {
+ $shape.trigger("active.responsilight");
+ } else {
+ $shape.trigger("inactive.responsilight");
+ }
+ var oldActive = $shape.siblings(".hotspot-active");
+ if (oldActive.length) {
+ oldActive.removeClass("hotspot-active");
+ }
+ };
+
+ var shapeEvents = function (shape, areaData) {
+ // Handle URL spots
+ if (areaData.action == "url") {
+ if (areaData.title) {
+ shape.bindTooltip(areaData.title);
+ }
+ shape.on("click", function (e) {
+ if (areaData.target == "_new" && !isMobileSafari) {
+ // new window
+ window.open(areaData.href, "_blank");
+ } else {
+ // same window
+ var first = areaData.href.charAt(0);
+ var targetElem;
+ try {
+ targetElem = first === "#" ? $(areaData.href) : null;
+ } catch (error) {
+ targetElem = null;
+ }
+ if (targetElem && targetElem.length) {
+ // hash link to existing target
+ $("html, body").animate(
+ {
+ scrollTop: targetElem.offset().top - 50,
+ },
+ 750,
+ function () {
+ // callback after scrolling
+ history.pushState({}, "", areaData.href);
+ },
+ );
+ } else {
+ window.location = areaData.href;
+ }
+ }
+ });
+ return;
+ }
+
+ // Show right-click context menu for logged-in admins only
+ if (drawattentionData.isLoggedIn && drawattentionData.isAdmin) {
+ shape.on("contextmenu", function (e) {
+ showContextMenu(shape, areaData, e);
+ });
+ }
+
+ // Handle tooltip spots
+ if (areaData.layout === "tooltip") {
+ showTooltip(shape, areaData);
+ }
+
+ // Add styled tooltip to all non-hover areas
+ if (
+ areaData.action === "url" ||
+ (areaData.trigger === "click" && areaData.layout !== "tooltip")
+ ) {
+ if (areaData.title) {
+ shape.bindTooltip(areaData.title);
+ }
+ }
+
+ // Handle all other spots
+ var moved = false;
+
+ shape.on(
+ "touchstart touchmove touchend click mouseover mouseout keypress focus blur",
+ function (e) {
+ switch (e.type) {
+ case "touchstart":
+ moved = false;
+ break;
+ case "touchmove":
+ moved = true;
+ break;
+ case "touchend":
+ if (moved) {
+ return;
+ }
+ shapeOver(shape, areaData, e);
+ shapeClick(shape, areaData, e);
+ break;
+ case "click":
+ shapeClick(shape, areaData, e);
+ break;
+ case "keypress":
+ var key = e.originalEvent.which;
+ if (key == 13 || key == 32) {
+ e.originalEvent.preventDefault();
+ shapeClick(shape, areaData, e);
+ }
+ break;
+ case "mouseover":
+ if (!isMobileSafari || (isMobileSafari && getBrowserVersion < 13)) {
+ shapeOver(shape, areaData, e);
+ }
+ if (isMobileSafari && !(getBrowserVersion() >= 12)) {
+ shapeClick(shape, areaData, e);
+ }
+ break;
+ case "focus":
+ shapeOver(shape, areaData, e);
+ break;
+ case "blur":
+ shapeOut(shape, areaData, e);
+ break;
+ case "mouseout":
+ shapeOut(shape, areaData, e);
+ break;
+ }
+ },
+ );
+ };
+
+ var a11yFixes = function (img, map) {
+ let svg = img
+ .siblings(".leaflet-container")
+ .find(".leaflet-overlay-pane svg");
+ let id = img.data("id");
+
+ // Add title and description to SVG
+ svg.prepend(
+ '' +
+ img.data("image-description") +
+ " ",
+ );
+ svg.prepend(
+ '' +
+ img.data("image-title") +
+ " ",
+ );
+
+ // Use title and desc to describe the svg
+ svg.attr("aria-labelledby", "img-title-" + id);
+ svg.attr("aria-describedby", "img-desc-" + id);
+
+ // Make svg screen reader traversable
+ svg.attr("role", "group");
+
+ // Create a traversable list
+ var group = svg.find("g").attr("role", "list");
+ group.children().attr("role", "listitem");
+
+ // Handle tooltips for the map
+ map.on("popupopen", function (popup) {
+ // shift focus to the popup when it opens
+ $(popup.popup._container)
+ .find(".leaflet-rrose-content")
+ .attr("tabindex", "-1")
+ .focus();
+
+ // move the close button to the end of the popup content so screen readers reach it
+ // after the main popup content, not before
+ var close = $(popup.popup._container)
+ .find(".leaflet-rrose-close-button")
+ .detach();
+ close.attr("aria-label", "Close item");
+ $(popup.popup._container).append(close);
+
+ $(document).on("keydown", function (e) {
+ if (e.which == 27) {
+ map.closePopup();
+ }
+ });
+ });
+
+ // return focus to the icon we started from before opening the pop up
+ map.on("popupclose", function (popup) {
+ $(document).off("keydown");
+ $(popup.popup._source._path).focus();
+ });
+ };
+
+ hotspots.linkToArea = function () {
+ // Called after the shapes are drawn
+ var hash = window.location.hash;
+ if (!hash) return;
+
+ var spotName = hash.replace("#", "");
+ if (!hotspots.infoSpots.hasOwnProperty(spotName)) return;
+
+ Object.keys(hotspots.infoSpots).forEach(function (key) {
+ hotspots.infoSpots[key].closeTooltip();
+ });
+
+ hotspots.infoSpots[spotName].fire("click");
+ };
+
+ hotspots.setup = function () {
+ mapSetup();
+ };
+
+ hotspots.resizeTimer = null;
+ hotspots.resizing = false;
+
+ hotspots.init = function () {
+ // For backward compatibility - resets the size of the leaflet on demand
+ leaflets.forEach(function (item) {
+ var isLoaded = item.img.data("status") === "loaded";
+
+ if (!isLoaded) {
+ return;
+ }
+
+ item.img.next(".hotspots-map-container").css({
+ width: item.img.width() + "px",
+ height: item.img.height() + "px",
+ });
+ item.map.invalidateSize(true);
+ item.map.fitBounds([
+ [0, 0],
+ [item.img.data("natH"), item.img.data("natW")],
+ ]);
+ });
+ };
+
+ hotspots.compatibilityFixes = function () {
+ if (window.Foundation) {
+ /* Fix for Foundation firing tag change event indiscriminately when some items are clicked on the page */
+ $(window).on("change.zf.tabs", function (e) {
+ if (e.target.tagName !== "INPUT") {
+ hotspots.init();
+ }
+ });
+ }
+
+ $(window).on("pageloaded load", function () {
+ /* Listen for pageloaded and load events on the window */
+ hotspots.init();
+ });
+
+ $(window).on("et_hashchange", function () {
+ /* Listen for Divi hashchange */
+ setTimeout(function () {
+ hotspots.init();
+ }, 1000);
+ });
+
+ $(".ult_tabs").on("click", ".ult_tab a", function () {
+ /* Ultimate tabs */
+ setTimeout(function () {
+ hotspots.init();
+ }, 2000);
+ });
+
+ $(
+ "a[data-vc-accordion], .et_pb_tabs .et_pb_tabs_controls li, .et_pb_toggle_title",
+ ).on("click", function () {
+ /* Divi tabs, accordion, toggle */
+ setTimeout(function () {
+ hotspots.init();
+ }, 1000);
+ });
+ $(".vc_tta-tabs-container").on("click", ".vc_tta-tab", function () {
+ /* Visual composer tabs */
+ setTimeout(function () {
+ hotspots.init();
+ }, 1000);
+ });
+
+ $(".ui-tabs-anchor, .nav-tabs > li").on("click", function () {
+ /* UI Tabs */
+ setTimeout(function () {
+ hotspots.init();
+ }, 750);
+ });
+
+ $(".fl-accordion-button").on("click", function () {
+ /* Beaver Builder accordion */
+ setTimeout(function () {
+ hotspots.init();
+ }, 500);
+ });
+
+ $(".responsive-tabs").on(
+ "click",
+ ".responsive-tabs__list__item",
+ function () {
+ /* Responsive tabs */
+ hotspots.init();
+ },
+ );
+
+ $(".elementor-tabs").on("click", ".elementor-tab-title", function () {
+ /* Elementor tabs */
+ hotspots.init();
+ });
+
+ $(".fl-tabs").on("click", "a.fl-tabs-label", function () {
+ /* Beaver Builder tabs */
+ hotspots.init();
+ });
+
+ $(".uabb-adv-accordion-button .uabb-tabs").on("click", function () {
+ /* Ultimate Beaver Builder addons accordion and tabs */
+ setTimeout(function () {
+ hotspots.init();
+ }, 250);
+ });
+ $(".w-tabs-item").on("click", function () {
+ /* Custom Woocommerce tabs */
+ setTimeout(function () {
+ hotspots.init();
+ }, 1000);
+ });
+ };
+})(jQuery, (window.hotspots = window.hotspots || {}));
+
+jQuery(function () {
+ hotspots.setup();
+ hotspots.compatibilityFixes();
});
-jQuery(document).on('elementor/popup/show', function(){
- hotspots.setup();
- hotspots.compatibilityFixes();
+jQuery(document).on("elementor/popup/show", function () {
+ hotspots.setup();
+ hotspots.compatibilityFixes();
});
-jQuery(window).on('resize orientationchange', function(e){
- var $window = jQuery(this);
- if (!hotspots.resizing) {
- $window.trigger('resizeStart.responsilight');
- hotspots.resizing = true;
- }
- clearTimeout(hotspots.resizeTimer);
- hotspots.resizeTimer = setTimeout(function(){
- hotspots.init();
- $window.trigger('resizeComplete.responsilight');
- hotspots.resizing = false;
- }, 250);
+jQuery(window).on("resize orientationchange", function (e) {
+ var $window = jQuery(this);
+ if (!hotspots.resizing) {
+ $window.trigger("resizeStart.responsilight");
+ hotspots.resizing = true;
+ }
+ clearTimeout(hotspots.resizeTimer);
+ hotspots.resizeTimer = setTimeout(function () {
+ hotspots.init();
+ $window.trigger("resizeComplete.responsilight");
+ hotspots.resizing = false;
+ }, 250);
});
-jQuery(window).on('hashchange', function(){
- hotspots.linkToArea();
+jQuery(window).on("hashchange", function () {
+ hotspots.linkToArea();
});
-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;
-}
+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/includes/lib/CMB2/js/cmb2-char-counter.js b/public/includes/lib/CMB2/js/cmb2-char-counter.js
index 4174649..42cc852 100755
--- a/public/includes/lib/CMB2/js/cmb2-char-counter.js
+++ b/public/includes/lib/CMB2/js/cmb2-char-counter.js
@@ -4,208 +4,207 @@
window.CMB2 = window.CMB2 || {};
window.CMB2.charcounter = window.CMB2.charcounter || {};
-( function(window, document, $, cmb, counter ) {
- 'use strict';
-
- if ( ! wp.utils || ! wp.utils.WordCounter ) {
- return cmb.log( 'Cannot find wp.utils!' );
- }
-
- // Private variables
- counter.counters = {};
- var counters = counter.counters;
- var wpCounter = new wp.utils.WordCounter();
-
- /**
- * Update a field's character counter
- *
- * @since 2.7.0
- *
- * @param {string} field_id
- *
- * @return {int}
- */
- counter.updateCounter = function( field_id ) {
- // No counter?
- if ( ! counters.hasOwnProperty( field_id ) ) {
- return null;
- }
-
- var instance = counters[ field_id ];
- var wysiwyg = instance.editor && ! instance.editor.isHidden();
-
- // Are we dealing with WYSIWYG visual editor, or textarea / WYSIWYG textarea?
- var text = wysiwyg ? instance.editor.getContent( { format: 'raw' } ) : cmb.$id( field_id ).val().trim();
- var count = wpCounter.count( text, instance.type );
- var exceeded = instance.max && count > instance.max;
-
- // Number remaining when max is defined
- var val = instance.max ? instance.max - count : count;
-
- // Over maximum?
- instance.$el.parents( '.cmb2-char-counter-wrap' )[ exceeded ? 'addClass' : 'removeClass' ]( 'cmb2-max-exceeded' );
-
- // Update counter, and update counter input width.
- instance.$el.val( val ).outerWidth( ( ( 8 * String( val ).length ) + 15 ) + 'px' );
-
- return count;
- };
-
- counter.instantiate = function( $el ) {
- var data = $el.data();
-
- // Add counter details if not already done
- if ( ! ( data.fieldId in counters ) ) {
-
- var instance = {
- $el : $el,
- max : data.max,
- type : 'words' === data.counterType ? 'words' : 'characters_including_spaces',
- editor : false,
- };
-
- counters[ data.fieldId ] = instance;
-
- // Initialise counter
- counter.updateCounter( data.fieldId );
- }
- };
-
- /**
- * Initializes all character counters. Hooked to cmb_init.
- *
- * @since 2.7.0
- *
- * @param {bool} init First init?
- *
- * @return {void}
- */
- counter.initAll = function() {
-
- // Gather counters and initialise
- $( '.cmb2-char-counter' ).each( function() {
- counter.instantiate( $( this ) );
- });
- };
-
- /**
- * Initializes WYSIWYG editors. Hooked to tinymce-editor-init
- *
- * @since 2.7.0
- *
- * @param {object} evt
- * @param {object} editor
- *
- * @return {void}
- */
- counter.initWysiwyg = function( evt, editor ) {
-
- // Check if it's one of our WYSIWYGs
- // Should have already been registered in counters via hidden textarea
- if ( editor.id in counters ) {
-
- // Add editor to counter
- counters[ editor.id ].editor = editor;
-
- // Add nodechange event
- editor.on( 'nodechange keyup', counter.countWysiwyg );
- }
- };
-
- /**
- * Initializes after a new repeatable row has been added. Hooked to cmb2_add_row
- *
- * @since 2.7.0
- *
- * @param {object} evt A jQuery-normalized event object.
- * @param {object} $row A jQuery dom element object for the group row.
- *
- * @return {void}
- */
- counter.addRow = function( evt, $row ) {
-
- // Character counters in row?
- $row.find( '.cmb2-char-counter' ).each( function() {
-
- // Update attributes
- var $this = $( this );
- var id = $this.attr( 'id' );
- var field_id = id.replace( /^char-counter-/, '' );
- $this.attr( 'data-field-id', field_id ).data( 'field-id', field_id );
-
- counter.instantiate( $this );
- });
- };
-
- /**
- * Clean the counters array.
- * Removes counters after a repeatable row has been removed. Hooked to cmb2_remove_row.
- *
- * @since 2.7.0
- *
- * @return {void}
- */
- counter.cleanCounters = function() {
- var field_id, remove = [];
-
- // Got through counters
- for ( field_id in counters ) {
- // Check for element, gather for removal
- if ( ! document.getElementById( field_id ) ) {
- remove.push( field_id );
- }
- }
-
- // Anything to remove?
- if ( remove.length ) {
- _.each( remove, function( field_id ) {
- delete counters[ field_id ];
- });
- }
- };
-
- /**
- * Counts the value of wysiwyg on the keyup event.
- *
- * @since 2.7.0
- *
- * @param {object} evt
- *
- * @return {void}
- */
- counter.countWysiwyg = _.throttle( function( evt ) {
-
- // Init event
- if ( evt.hasOwnProperty( 'element' ) ) {
- return counter.updateCounter( $( evt.element ).data( 'id' ) );
- }
-
- // Nodechange event
- if ( evt.hasOwnProperty( 'currentTarget' ) ) {
- return counter.updateCounter( $( evt.currentTarget ).data( 'id' ) );
- }
-
- } );
-
- /**
- * Counts the value of textarea on the keyup event.
- *
- * @since 2.7.0
- *
- * @param {object} evt
- *
- * @return {void}
- */
- counter.countTextarea = _.throttle( function(evt) {
- counter.updateCounter( evt.currentTarget.id );
- }, 400 );
-
- // Hook in our event callbacks.
- $( document )
- .on( 'cmb_init', counter.initAll )
- .on( 'tinymce-editor-init', counter.initWysiwyg )
- .on( 'cmb2_add_row', counter.addRow )
- .on( 'cmb2_remove_row', counter.cleanCounters )
- .on( 'input keyup', '.cmb2-count-chars', counter.countTextarea );
-
-} )( window, document, jQuery, window.CMB2, window.CMB2.charcounter );
+(function (window, document, $, cmb, counter) {
+ "use strict";
+
+ if (!wp.utils || !wp.utils.WordCounter) {
+ return cmb.log("Cannot find wp.utils!");
+ }
+
+ // Private variables
+ counter.counters = {};
+ var counters = counter.counters;
+ var wpCounter = new wp.utils.WordCounter();
+
+ /**
+ * Update a field's character counter
+ *
+ * @since 2.7.0
+ *
+ * @param {string} field_id
+ *
+ * @return {int}
+ */
+ counter.updateCounter = function (field_id) {
+ // No counter?
+ if (!counters.hasOwnProperty(field_id)) {
+ return null;
+ }
+
+ var instance = counters[field_id];
+ var wysiwyg = instance.editor && !instance.editor.isHidden();
+
+ // Are we dealing with WYSIWYG visual editor, or textarea / WYSIWYG textarea?
+ var text = wysiwyg
+ ? instance.editor.getContent({ format: "raw" })
+ : cmb.$id(field_id).val().trim();
+ var count = wpCounter.count(text, instance.type);
+ var exceeded = instance.max && count > instance.max;
+
+ // Number remaining when max is defined
+ var val = instance.max ? instance.max - count : count;
+
+ // Over maximum?
+ instance.$el
+ .parents(".cmb2-char-counter-wrap")
+ [exceeded ? "addClass" : "removeClass"]("cmb2-max-exceeded");
+
+ // Update counter, and update counter input width.
+ instance.$el.val(val).outerWidth(8 * String(val).length + 15 + "px");
+
+ return count;
+ };
+
+ counter.instantiate = function ($el) {
+ var data = $el.data();
+
+ // Add counter details if not already done
+ if (!(data.fieldId in counters)) {
+ var instance = {
+ $el: $el,
+ max: data.max,
+ type:
+ "words" === data.counterType
+ ? "words"
+ : "characters_including_spaces",
+ editor: false,
+ };
+
+ counters[data.fieldId] = instance;
+
+ // Initialise counter
+ counter.updateCounter(data.fieldId);
+ }
+ };
+
+ /**
+ * Initializes all character counters. Hooked to cmb_init.
+ *
+ * @since 2.7.0
+ *
+ * @param {bool} init First init?
+ *
+ * @return {void}
+ */
+ counter.initAll = function () {
+ // Gather counters and initialise
+ $(".cmb2-char-counter").each(function () {
+ counter.instantiate($(this));
+ });
+ };
+
+ /**
+ * Initializes WYSIWYG editors. Hooked to tinymce-editor-init
+ *
+ * @since 2.7.0
+ *
+ * @param {object} evt
+ * @param {object} editor
+ *
+ * @return {void}
+ */
+ counter.initWysiwyg = function (evt, editor) {
+ // Check if it's one of our WYSIWYGs
+ // Should have already been registered in counters via hidden textarea
+ if (editor.id in counters) {
+ // Add editor to counter
+ counters[editor.id].editor = editor;
+
+ // Add nodechange event
+ editor.on("nodechange keyup", counter.countWysiwyg);
+ }
+ };
+
+ /**
+ * Initializes after a new repeatable row has been added. Hooked to cmb2_add_row
+ *
+ * @since 2.7.0
+ *
+ * @param {object} evt A jQuery-normalized event object.
+ * @param {object} $row A jQuery dom element object for the group row.
+ *
+ * @return {void}
+ */
+ counter.addRow = function (evt, $row) {
+ // Character counters in row?
+ $row.find(".cmb2-char-counter").each(function () {
+ // Update attributes
+ var $this = $(this);
+ var id = $this.attr("id");
+ var field_id = id.replace(/^char-counter-/, "");
+ $this.attr("data-field-id", field_id).data("field-id", field_id);
+
+ counter.instantiate($this);
+ });
+ };
+
+ /**
+ * Clean the counters array.
+ * Removes counters after a repeatable row has been removed. Hooked to cmb2_remove_row.
+ *
+ * @since 2.7.0
+ *
+ * @return {void}
+ */
+ counter.cleanCounters = function () {
+ var field_id,
+ remove = [];
+
+ // Got through counters
+ for (field_id in counters) {
+ // Check for element, gather for removal
+ if (!document.getElementById(field_id)) {
+ remove.push(field_id);
+ }
+ }
+
+ // Anything to remove?
+ if (remove.length) {
+ _.each(remove, function (field_id) {
+ delete counters[field_id];
+ });
+ }
+ };
+
+ /**
+ * Counts the value of wysiwyg on the keyup event.
+ *
+ * @since 2.7.0
+ *
+ * @param {object} evt
+ *
+ * @return {void}
+ */
+ counter.countWysiwyg = _.throttle(function (evt) {
+ // Init event
+ if (evt.hasOwnProperty("element")) {
+ return counter.updateCounter($(evt.element).data("id"));
+ }
+
+ // Nodechange event
+ if (evt.hasOwnProperty("currentTarget")) {
+ return counter.updateCounter($(evt.currentTarget).data("id"));
+ }
+ });
+
+ /**
+ * Counts the value of textarea on the keyup event.
+ *
+ * @since 2.7.0
+ *
+ * @param {object} evt
+ *
+ * @return {void}
+ */
+ counter.countTextarea = _.throttle(function (evt) {
+ counter.updateCounter(evt.currentTarget.id);
+ }, 400);
+
+ // Hook in our event callbacks.
+ $(document)
+ .on("cmb_init", counter.initAll)
+ .on("tinymce-editor-init", counter.initWysiwyg)
+ .on("cmb2_add_row", counter.addRow)
+ .on("cmb2_remove_row", counter.cleanCounters)
+ .on("input keyup", ".cmb2-count-chars", counter.countTextarea);
+})(window, document, jQuery, window.CMB2, window.CMB2.charcounter);
diff --git a/public/includes/lib/CMB2/js/cmb2-wysiwyg.js b/public/includes/lib/CMB2/js/cmb2-wysiwyg.js
index 111e7ea..cf1fbfe 100755
--- a/public/includes/lib/CMB2/js/cmb2-wysiwyg.js
+++ b/public/includes/lib/CMB2/js/cmb2-wysiwyg.js
@@ -4,342 +4,360 @@
window.CMB2 = window.CMB2 || {};
window.CMB2.wysiwyg = window.CMB2.wysiwyg || {};
-( function(window, document, $, cmb, wysiwyg, undefined ) {
- 'use strict';
-
- // Private variables
- var toBeDestroyed = [];
- var toBeInitialized = [];
- var all = wysiwyg.all = {};
-
- // Private functions
-
- /**
- * Initializes any editors that weren't initialized because they didn't exist yet.
- *
- * @since 2.2.3
- *
- * @return {void}
- */
- function delayedInit() {
-
- // Don't initialize until they've all been destroyed.
- if ( 0 === toBeDestroyed.length ) {
- toBeInitialized.forEach( function ( toInit ) {
- toBeInitialized.splice( toBeInitialized.indexOf( toInit ), 1 );
- wysiwyg.init.apply( wysiwyg, toInit );
- } );
- } else {
- window.setTimeout( delayedInit, 100 );
- }
- }
-
- /**
- * Destroys any editors that weren't destroyed because they didn't exist yet.
- *
- * @since 2.2.3
- *
- * @return {void}
- */
- function delayedDestroy() {
- toBeDestroyed.forEach( function( id ) {
- toBeDestroyed.splice( toBeDestroyed.indexOf( id ), 1 );
- wysiwyg.destroy( id );
- } );
- }
-
- /**
- * Gets the option data for a group (and initializes that data if it doesn't exist).
- *
- * @since 2.2.3
- *
- * @param {object} data The group/field data.
- *
- * @return {object} Options data object for a group.
- */
- function getGroupData( data ) {
- var groupid = data.groupid;
- var fieldid = data.fieldid;
-
- if ( ! all[ groupid ] || ! all[ groupid ][ fieldid ] ) {
- all[ groupid ] = all[ groupid ] || {};
- all[ groupid ][ fieldid ] = {
- template : wp.template( 'cmb2-wysiwyg-' + groupid + '-' + fieldid ),
- defaults : {
-
- // Get the data from the template-wysiwyg initiation.
- mce : $.extend( {}, tinyMCEPreInit.mceInit[ 'cmb2_i_' + groupid + fieldid ] ),
- qt : $.extend( {}, tinyMCEPreInit.qtInit[ 'cmb2_i_' + groupid + fieldid ] )
- }
- };
- // This is the template-wysiwyg data, and we do not want that to be initiated.
- delete tinyMCEPreInit.mceInit[ 'cmb2_i_' + groupid + fieldid ];
- delete tinyMCEPreInit.qtInit[ 'cmb2_i_' + groupid + fieldid ];
- }
-
- return all[ groupid ][ fieldid ];
- }
-
- /**
- * Initiates the tinyMCEPreInit options for a wysiwyg editor instance.
- *
- * @since 2.2.3
- *
- * @param {object} options Options data object for the wysiwyg editor instance.
- *
- * @return {void}
- */
- function initOptions( options ) {
- var nameRegex = new RegExp( 'cmb2_n_' + options.groupid + options.fieldid, 'g' );
- var idRegex = new RegExp( 'cmb2_i_' + options.groupid + options.fieldid, 'g' );
- var prop, newSettings, newQTS;
-
- // If no settings for this field. Clone from placeholder.
- if ( 'undefined' === typeof( tinyMCEPreInit.mceInit[ options.id ] ) ) {
- newSettings = $.extend( {}, options.defaults.mce );
- for ( prop in newSettings ) {
- if ( 'string' === typeof( newSettings[ prop ] ) ) {
- newSettings[ prop ] = newSettings[ prop ]
- .replace( idRegex, options.id )
- .replace( nameRegex, options.name );
- }
- }
- tinyMCEPreInit.mceInit[ options.id ] = newSettings;
- }
-
- // If no Quicktag settings for this field. Clone from placeholder.
- if ( 'undefined' === typeof( tinyMCEPreInit.qtInit[ options.id ] ) ) {
- newQTS = $.extend( {}, options.defaults.qt );
- for ( prop in newQTS ) {
- if ( 'string' === typeof( newQTS[ prop ] ) ) {
- newQTS[ prop ] = newQTS[ prop ]
- .replace( idRegex, options.id )
- .replace( nameRegex, options.name );
- }
- }
- tinyMCEPreInit.qtInit[ options.id ] = newQTS;
- }
- }
-
- /**
- * Initializes all group wysiwyg editors. Hooked to cmb_init.
- *
- * @since 2.2.3
- *
- * @return {void}
- */
- wysiwyg.initAll = function() {
- var $this,data,initiated;
-
- $( '.cmb2-wysiwyg-placeholder' ).each( function() {
- $this = $( this );
- data = $this.data();
-
- if ( data.groupid ) {
-
- data.id = $this.attr( 'id' );
- data.name = $this.attr( 'name' );
- data.value = $this.val();
-
- wysiwyg.init( $this, data, false );
- initiated = true;
- }
- } );
-
- if ( true === initiated ) {
- if ( 'undefined' !== typeof window.QTags ) {
- window.QTags._buttonsInit();
- }
-
- // Hook in our event callbacks.
- $( document )
- .on( 'cmb2_add_row', wysiwyg.addRow )
- .on( 'cmb2_remove_group_row_start', wysiwyg.destroyRowEditors )
- .on( 'cmb2_shift_rows_start', wysiwyg.shiftStart )
- .on( 'cmb2_shift_rows_complete', wysiwyg.shiftComplete );
- }
- };
-
- /**
- * Initiates wysiwyg editors in a new group row. Hooked to cmb2_add_row.
- *
- * @since 2.2.3
- *
- * @param {object} evt A jQuery-normalized event object.
- * @param {object} $row A jQuery dom element object for the group row.
- *
- * @return {void}
- */
- wysiwyg.addRow = function( evt, $row ) {
- wysiwyg.initRow( $row, evt );
- };
-
- /**
- * Destroys wysiwyg editors in a group row when that row is removed. Hooked to cmb2_remove_group_row_start.
- *
- * @since 2.2.3
- *
- * @param {object} evt A jQuery-normalized event object.
- * @param {object} $btn A jQuery dom element object for the remove-row button.
- *
- * @return {void}
- */
- wysiwyg.destroyRowEditors = function( evt, $btn ) {
- wysiwyg.destroy( $btn.parents( '.cmb-repeatable-grouping' ).find( '.wp-editor-area' ).attr( 'id' ) );
- };
-
- /**
- * When a row-shift starts, we need to destroy the wysiwyg editors for the group-rows being shuffled.
- *
- * @since 2.2.3
- *
- * @param {object} evt A jQuery-normalized event object.
- * @param {object} $btn A jQuery dom element object for the remove-row button.
- * @param {object} $from A jQuery dom element object for the row being shifted from.
- * @param {object} $to A jQuery dom element object for the row being shifted to.
- *
- * @return {void}
- */
- wysiwyg.shiftStart = function( evt, $btn, $from, $to ) {
- $from.add( $to ).find( '.wp-editor-wrap textarea' ).each( function() {
- wysiwyg.destroy( $( this ).attr( 'id' ) );
- } );
- };
-
- /**
- * When a row-shift completes, we need to re-init the wysiwyg editors for the group-rows being shuffled.
- *
- * @since 2.2.3
- *
- * @param {object} evt A jQuery-normalized event object.
- * @param {object} $btn A jQuery dom element object for the remove-row button.
- * @param {object} $from A jQuery dom element object for the row being shifted from.
- * @param {object} $to A jQuery dom element object for the row being shifted to.
- *
- * @return {void}
- */
- wysiwyg.shiftComplete = function( evt, $btn, $from, $to ) {
- $from.add( $to ).each( function() {
- wysiwyg.initRow( $( this ), evt );
- } );
- };
-
- /**
- * Initializes editors for a new CMB row.
- *
- * @since 2.2.3
- *
- * @param {object} $row A jQuery dom element object for the group row.
- * @param {object} evt A jQuery-normalized event object.
- *
- * @return {void}
- */
- wysiwyg.initRow = function( $row, evt ) {
- var $toReplace, data, defVal;
-
- $row.find( '.cmb2-wysiwyg-inner-wrap' ).each( function() {
- $toReplace = $( this );
- data = $toReplace.data();
- defVal = cmb.getFieldArg( data.hash, 'default', '' );
- defVal = 'undefined' !== typeof defVal && false !== defVal ? defVal : '';
-
- data.iterator = $row.data( 'iterator' );
- data.fieldid = data.id;
- data.id = data.groupid + '_' + data.iterator + '_' + data.fieldid;
- data.name = data.groupid + '[' + data.iterator + '][' + data.fieldid + ']';
- data.value = 'cmb2_add_row' !== evt.type && $toReplace.find( '.wp-editor-area' ).length ? $toReplace.find( '.wp-editor-area' ).val() : defVal;
-
- // The destroys might not have happened yet. Don't init until they have.
- if ( 0 === toBeDestroyed.length ) {
-
- wysiwyg.init( $toReplace, data );
-
- } else {
- toBeInitialized.push( [$toReplace, data] );
- window.setTimeout( delayedInit, 100 );
- }
- } );
-
- };
-
- /**
- * Initiates a wysiwyg editor instance and replaces the passed dom element w/ the editor html.
- *
- * @since 2.2.3
- *
- * @param {object} $toReplace A jQuery dom element which will be replaced with the wysiwyg editor.
- * @param {object} data Data used to initate the editor.
- * @param {bool} buttonsInit Whether to run QTags._buttonsInit()
- *
- * @return {void}
- */
- wysiwyg.init = function( $toReplace, data, buttonsInit ) {
- if ( ! data.groupid ) {
- return false;
- }
-
- var mceActive = cmb.canTinyMCE();
- var qtActive = 'function' === typeof window.quicktags;
- $.extend( data, getGroupData( data ) );
-
- initOptions( data );
-
- $toReplace.replaceWith( data.template( data ) );
-
- if ( mceActive ) {
- window.tinyMCE.init( tinyMCEPreInit.mceInit[ data.id ] );
- }
-
- if ( qtActive ) {
- window.quicktags( tinyMCEPreInit.qtInit[ data.id ] );
- }
-
- if ( mceActive ) {
- $( document.getElementById( data.id ) ).parents( '.wp-editor-wrap' ).removeClass( 'html-active' ).addClass( 'tmce-active' );
- }
-
- if ( false !== buttonsInit && 'undefined' !== typeof window.QTags ) {
- window.QTags._buttonsInit();
- }
-
- };
-
- /**
- * Destroys a wysiwyg editor instance.
- *
- * @since 2.2.3
- *
- * @param {string} id Editor id.
- *
- * @return {void}
- */
- wysiwyg.destroy = function( id ) {
- if ( ! cmb.canTinyMCE() ) {
- // Nothing to see here.
- return;
- }
-
- // The editor might not be initialized yet. But we need to destroy it once it is.
- var editor = tinyMCE.get( id );
-
- if ( editor !== null && typeof( editor ) !== 'undefined' ) {
- editor.destroy();
-
- if ( 'undefined' === typeof( tinyMCEPreInit.mceInit[ id ] ) ) {
- delete tinyMCEPreInit.mceInit[ id ];
- }
-
- if ( 'undefined' === typeof( tinyMCEPreInit.qtInit[ id ] ) ) {
- delete tinyMCEPreInit.qtInit[ id ];
- }
-
- } else if ( -1 === toBeDestroyed.indexOf( id ) ) {
- toBeDestroyed.push( id );
- window.setTimeout( delayedDestroy, 100 );
- }
- };
-
- // Hook in our event callbacks.
- $( document ).on( 'cmb_init', wysiwyg.initAll );
-
-} )( window, document, jQuery, window.CMB2, window.CMB2.wysiwyg );
+(function (window, document, $, cmb, wysiwyg, undefined) {
+ "use strict";
+
+ // Private variables
+ var toBeDestroyed = [];
+ var toBeInitialized = [];
+ var all = (wysiwyg.all = {});
+
+ // Private functions
+
+ /**
+ * Initializes any editors that weren't initialized because they didn't exist yet.
+ *
+ * @since 2.2.3
+ *
+ * @return {void}
+ */
+ function delayedInit() {
+ // Don't initialize until they've all been destroyed.
+ if (0 === toBeDestroyed.length) {
+ toBeInitialized.forEach(function (toInit) {
+ toBeInitialized.splice(toBeInitialized.indexOf(toInit), 1);
+ wysiwyg.init.apply(wysiwyg, toInit);
+ });
+ } else {
+ window.setTimeout(delayedInit, 100);
+ }
+ }
+
+ /**
+ * Destroys any editors that weren't destroyed because they didn't exist yet.
+ *
+ * @since 2.2.3
+ *
+ * @return {void}
+ */
+ function delayedDestroy() {
+ toBeDestroyed.forEach(function (id) {
+ toBeDestroyed.splice(toBeDestroyed.indexOf(id), 1);
+ wysiwyg.destroy(id);
+ });
+ }
+
+ /**
+ * Gets the option data for a group (and initializes that data if it doesn't exist).
+ *
+ * @since 2.2.3
+ *
+ * @param {object} data The group/field data.
+ *
+ * @return {object} Options data object for a group.
+ */
+ function getGroupData(data) {
+ var groupid = data.groupid;
+ var fieldid = data.fieldid;
+
+ if (!all[groupid] || !all[groupid][fieldid]) {
+ all[groupid] = all[groupid] || {};
+ all[groupid][fieldid] = {
+ template: wp.template("cmb2-wysiwyg-" + groupid + "-" + fieldid),
+ defaults: {
+ // Get the data from the template-wysiwyg initiation.
+ mce: $.extend(
+ {},
+ tinyMCEPreInit.mceInit["cmb2_i_" + groupid + fieldid],
+ ),
+ qt: $.extend(
+ {},
+ tinyMCEPreInit.qtInit["cmb2_i_" + groupid + fieldid],
+ ),
+ },
+ };
+ // This is the template-wysiwyg data, and we do not want that to be initiated.
+ delete tinyMCEPreInit.mceInit["cmb2_i_" + groupid + fieldid];
+ delete tinyMCEPreInit.qtInit["cmb2_i_" + groupid + fieldid];
+ }
+
+ return all[groupid][fieldid];
+ }
+
+ /**
+ * Initiates the tinyMCEPreInit options for a wysiwyg editor instance.
+ *
+ * @since 2.2.3
+ *
+ * @param {object} options Options data object for the wysiwyg editor instance.
+ *
+ * @return {void}
+ */
+ function initOptions(options) {
+ var nameRegex = new RegExp(
+ "cmb2_n_" + options.groupid + options.fieldid,
+ "g",
+ );
+ var idRegex = new RegExp(
+ "cmb2_i_" + options.groupid + options.fieldid,
+ "g",
+ );
+ var prop, newSettings, newQTS;
+
+ // If no settings for this field. Clone from placeholder.
+ if ("undefined" === typeof tinyMCEPreInit.mceInit[options.id]) {
+ newSettings = $.extend({}, options.defaults.mce);
+ for (prop in newSettings) {
+ if ("string" === typeof newSettings[prop]) {
+ newSettings[prop] = newSettings[prop]
+ .replace(idRegex, options.id)
+ .replace(nameRegex, options.name);
+ }
+ }
+ tinyMCEPreInit.mceInit[options.id] = newSettings;
+ }
+
+ // If no Quicktag settings for this field. Clone from placeholder.
+ if ("undefined" === typeof tinyMCEPreInit.qtInit[options.id]) {
+ newQTS = $.extend({}, options.defaults.qt);
+ for (prop in newQTS) {
+ if ("string" === typeof newQTS[prop]) {
+ newQTS[prop] = newQTS[prop]
+ .replace(idRegex, options.id)
+ .replace(nameRegex, options.name);
+ }
+ }
+ tinyMCEPreInit.qtInit[options.id] = newQTS;
+ }
+ }
+
+ /**
+ * Initializes all group wysiwyg editors. Hooked to cmb_init.
+ *
+ * @since 2.2.3
+ *
+ * @return {void}
+ */
+ wysiwyg.initAll = function () {
+ var $this, data, initiated;
+
+ $(".cmb2-wysiwyg-placeholder").each(function () {
+ $this = $(this);
+ data = $this.data();
+
+ if (data.groupid) {
+ data.id = $this.attr("id");
+ data.name = $this.attr("name");
+ data.value = $this.val();
+
+ wysiwyg.init($this, data, false);
+ initiated = true;
+ }
+ });
+
+ if (true === initiated) {
+ if ("undefined" !== typeof window.QTags) {
+ window.QTags._buttonsInit();
+ }
+
+ // Hook in our event callbacks.
+ $(document)
+ .on("cmb2_add_row", wysiwyg.addRow)
+ .on("cmb2_remove_group_row_start", wysiwyg.destroyRowEditors)
+ .on("cmb2_shift_rows_start", wysiwyg.shiftStart)
+ .on("cmb2_shift_rows_complete", wysiwyg.shiftComplete);
+ }
+ };
+
+ /**
+ * Initiates wysiwyg editors in a new group row. Hooked to cmb2_add_row.
+ *
+ * @since 2.2.3
+ *
+ * @param {object} evt A jQuery-normalized event object.
+ * @param {object} $row A jQuery dom element object for the group row.
+ *
+ * @return {void}
+ */
+ wysiwyg.addRow = function (evt, $row) {
+ wysiwyg.initRow($row, evt);
+ };
+
+ /**
+ * Destroys wysiwyg editors in a group row when that row is removed. Hooked to cmb2_remove_group_row_start.
+ *
+ * @since 2.2.3
+ *
+ * @param {object} evt A jQuery-normalized event object.
+ * @param {object} $btn A jQuery dom element object for the remove-row button.
+ *
+ * @return {void}
+ */
+ wysiwyg.destroyRowEditors = function (evt, $btn) {
+ wysiwyg.destroy(
+ $btn
+ .parents(".cmb-repeatable-grouping")
+ .find(".wp-editor-area")
+ .attr("id"),
+ );
+ };
+
+ /**
+ * When a row-shift starts, we need to destroy the wysiwyg editors for the group-rows being shuffled.
+ *
+ * @since 2.2.3
+ *
+ * @param {object} evt A jQuery-normalized event object.
+ * @param {object} $btn A jQuery dom element object for the remove-row button.
+ * @param {object} $from A jQuery dom element object for the row being shifted from.
+ * @param {object} $to A jQuery dom element object for the row being shifted to.
+ *
+ * @return {void}
+ */
+ wysiwyg.shiftStart = function (evt, $btn, $from, $to) {
+ $from
+ .add($to)
+ .find(".wp-editor-wrap textarea")
+ .each(function () {
+ wysiwyg.destroy($(this).attr("id"));
+ });
+ };
+
+ /**
+ * When a row-shift completes, we need to re-init the wysiwyg editors for the group-rows being shuffled.
+ *
+ * @since 2.2.3
+ *
+ * @param {object} evt A jQuery-normalized event object.
+ * @param {object} $btn A jQuery dom element object for the remove-row button.
+ * @param {object} $from A jQuery dom element object for the row being shifted from.
+ * @param {object} $to A jQuery dom element object for the row being shifted to.
+ *
+ * @return {void}
+ */
+ wysiwyg.shiftComplete = function (evt, $btn, $from, $to) {
+ $from.add($to).each(function () {
+ wysiwyg.initRow($(this), evt);
+ });
+ };
+
+ /**
+ * Initializes editors for a new CMB row.
+ *
+ * @since 2.2.3
+ *
+ * @param {object} $row A jQuery dom element object for the group row.
+ * @param {object} evt A jQuery-normalized event object.
+ *
+ * @return {void}
+ */
+ wysiwyg.initRow = function ($row, evt) {
+ var $toReplace, data, defVal;
+
+ $row.find(".cmb2-wysiwyg-inner-wrap").each(function () {
+ $toReplace = $(this);
+ data = $toReplace.data();
+ defVal = cmb.getFieldArg(data.hash, "default", "");
+ defVal = "undefined" !== typeof defVal && false !== defVal ? defVal : "";
+
+ data.iterator = $row.data("iterator");
+ data.fieldid = data.id;
+ data.id = data.groupid + "_" + data.iterator + "_" + data.fieldid;
+ data.name =
+ data.groupid + "[" + data.iterator + "][" + data.fieldid + "]";
+ data.value =
+ "cmb2_add_row" !== evt.type && $toReplace.find(".wp-editor-area").length
+ ? $toReplace.find(".wp-editor-area").val()
+ : defVal;
+
+ // The destroys might not have happened yet. Don't init until they have.
+ if (0 === toBeDestroyed.length) {
+ wysiwyg.init($toReplace, data);
+ } else {
+ toBeInitialized.push([$toReplace, data]);
+ window.setTimeout(delayedInit, 100);
+ }
+ });
+ };
+
+ /**
+ * Initiates a wysiwyg editor instance and replaces the passed dom element w/ the editor html.
+ *
+ * @since 2.2.3
+ *
+ * @param {object} $toReplace A jQuery dom element which will be replaced with the wysiwyg editor.
+ * @param {object} data Data used to initate the editor.
+ * @param {bool} buttonsInit Whether to run QTags._buttonsInit()
+ *
+ * @return {void}
+ */
+ wysiwyg.init = function ($toReplace, data, buttonsInit) {
+ if (!data.groupid) {
+ return false;
+ }
+
+ var mceActive = cmb.canTinyMCE();
+ var qtActive = "function" === typeof window.quicktags;
+ $.extend(data, getGroupData(data));
+
+ initOptions(data);
+
+ $toReplace.replaceWith(data.template(data));
+
+ if (mceActive) {
+ window.tinyMCE.init(tinyMCEPreInit.mceInit[data.id]);
+ }
+
+ if (qtActive) {
+ window.quicktags(tinyMCEPreInit.qtInit[data.id]);
+ }
+
+ if (mceActive) {
+ $(document.getElementById(data.id))
+ .parents(".wp-editor-wrap")
+ .removeClass("html-active")
+ .addClass("tmce-active");
+ }
+
+ if (false !== buttonsInit && "undefined" !== typeof window.QTags) {
+ window.QTags._buttonsInit();
+ }
+ };
+
+ /**
+ * Destroys a wysiwyg editor instance.
+ *
+ * @since 2.2.3
+ *
+ * @param {string} id Editor id.
+ *
+ * @return {void}
+ */
+ wysiwyg.destroy = function (id) {
+ if (!cmb.canTinyMCE()) {
+ // Nothing to see here.
+ return;
+ }
+
+ // The editor might not be initialized yet. But we need to destroy it once it is.
+ var editor = tinyMCE.get(id);
+
+ if (editor !== null && typeof editor !== "undefined") {
+ editor.destroy();
+
+ if ("undefined" === typeof tinyMCEPreInit.mceInit[id]) {
+ delete tinyMCEPreInit.mceInit[id];
+ }
+
+ if ("undefined" === typeof tinyMCEPreInit.qtInit[id]) {
+ delete tinyMCEPreInit.qtInit[id];
+ }
+ } else if (-1 === toBeDestroyed.indexOf(id)) {
+ toBeDestroyed.push(id);
+ window.setTimeout(delayedDestroy, 100);
+ }
+ };
+
+ // Hook in our event callbacks.
+ $(document).on("cmb_init", wysiwyg.initAll);
+})(window, document, jQuery, window.CMB2, window.CMB2.wysiwyg);
diff --git a/public/includes/lib/CMB2/js/cmb2.js b/public/includes/lib/CMB2/js/cmb2.js
index 53be582..63fbd18 100755
--- a/public/includes/lib/CMB2/js/cmb2.js
+++ b/public/includes/lib/CMB2/js/cmb2.js
@@ -9,1340 +9,1498 @@
* Custom jQuery for Custom Metaboxes and Fields
*/
window.CMB2 = window.CMB2 || {};
-(function(window, document, $, cmb, undefined){
- 'use strict';
-
- // localization strings
- var l10n = window.cmb2_l10;
- var setTimeout = window.setTimeout;
- var $document;
- var $id = function( selector ) {
- return $( document.getElementById( selector ) );
- };
- cmb.$id = $id;
- var defaults = {
- idNumber : false,
- repeatEls : 'input:not([type="button"],[id^=filelist]),select,textarea,.cmb2-media-status',
- noEmpty : 'input:not([type="button"]):not([type="radio"]):not([type="checkbox"]),textarea',
- repeatUpdate : 'input:not([type="button"]),select,textarea,label',
- styleBreakPoint : 450,
- mediaHandlers : {},
- defaults : {
- time_picker : l10n.defaults.time_picker,
- date_picker : l10n.defaults.date_picker,
- color_picker : l10n.defaults.color_picker || {},
- code_editor : l10n.defaults.code_editor,
- },
- media : {
- frames : {},
- },
- };
-
- cmb.init = function() {
- $document = $( document );
-
- // Setup the CMB2 object defaults.
- $.extend( cmb, defaults );
-
- cmb.trigger( 'cmb_pre_init' );
-
- var $metabox = cmb.metabox();
- var $repeatGroup = $metabox.find('.cmb-repeatable-group');
-
- // Init time/date/color pickers
- cmb.initPickers( $metabox.find('input[type="text"].cmb2-timepicker'), $metabox.find('input[type="text"].cmb2-datepicker'), $metabox.find('input[type="text"].cmb2-colorpicker') );
-
- // Init code editors.
- cmb.initCodeEditors( $metabox.find( '.cmb2-textarea-code:not(.disable-codemirror)' ) );
-
- // Insert toggle button into DOM wherever there is multicheck. credit: Genesis Framework
- $( '' + l10n.strings.check_toggle + '
' ).insertBefore( '.cmb2-checkbox-list:not(.no-select-all)' );
-
- // Make File List drag/drop sortable:
- cmb.makeListSortable();
- // Make Repeatable fields drag/drop sortable:
- cmb.makeRepeatableSortable();
-
- $metabox
- .on( 'change', '.cmb2_upload_file', function() {
- cmb.media.field = $( this ).attr( 'id' );
- $id( cmb.media.field + '_id' ).val('');
- })
- // Media/file management
- .on( 'click', '.cmb-multicheck-toggle', cmb.toggleCheckBoxes )
- .on( 'click', '.cmb2-upload-button', cmb.handleMedia )
- .on( 'click', '.cmb-attach-list li, .cmb2-media-status .img-status img, .cmb2-media-status .file-status > span', cmb.handleFileClick )
- .on( 'click', '.cmb2-remove-file-button', cmb.handleRemoveMedia )
- // Repeatable content
- .on( 'click', '.cmb-add-group-row', cmb.addGroupRow )
- .on( 'click', '.cmb-add-row-button', cmb.addAjaxRow )
- .on( 'click', '.cmb-remove-group-row', cmb.removeGroupRow )
- .on( 'click', '.cmb-remove-row-button', cmb.removeAjaxRow )
- // Ajax oEmbed display
- .on( 'keyup paste focusout', '.cmb2-oembed', cmb.maybeOembed )
- // Reset titles when removing a row
- .on( 'cmb2_remove_row', '.cmb-repeatable-group', cmb.resetTitlesAndIterator )
- .on( 'click', '.cmbhandle, .cmbhandle + .cmbhandle-title', cmb.toggleHandle );
-
- if ( $repeatGroup.length ) {
- $repeatGroup
- .on( 'cmb2_add_row', cmb.emptyValue )
- .on( 'cmb2_add_row', cmb.setDefaults )
- .filter('.sortable').each( function() {
- // Add sorting arrows
- $( this ).find( '.cmb-remove-group-row-button' ).before( ' ' );
- })
- .on( 'click', '.cmb-shift-rows', cmb.shiftRows );
- }
-
- // on pageload
- setTimeout( cmb.resizeoEmbeds, 500);
- // and on window resize
- $( window ).on( 'resize', cmb.resizeoEmbeds );
-
- if ( $id( 'addtag' ).length ) {
- cmb.listenTagAdd();
- }
-
- $( document ).on( 'cmb_init', cmb.mceEnsureSave );
-
- cmb.trigger( 'cmb_init' );
- };
-
- // Handles updating tiny mce instances when saving a gutenberg post.
- // https://github.com/CMB2/CMB2/issues/1156
- cmb.mceEnsureSave = function() {
- // If no wp.data, do not proceed (no gutenberg)
- if ( ! wp.data || ! wp.data.hasOwnProperty('subscribe') ) {
- return;
- }
-
- // If the current user cannot richedit, or MCE is not available, bail.
- if ( ! cmb.canTinyMCE() ) {
- return;
- }
-
- wp.data.subscribe( function() {
- var editor = wp.data.hasOwnProperty('select') ? wp.data.select( 'core/editor' ) : null;
-
- // the post is currently being saved && we have tinymce editors
- if ( editor && editor.isSavingPost && editor.isSavingPost() && window.tinyMCE.editors.length ) {
- for ( var i = 0; i < window.tinyMCE.editors.length; i++ ) {
- if ( window.tinyMCE.activeEditor !== window.tinyMCE.editors[i] ) {
- window.tinyMCE.editors[i].save();
- }
- }
- }
- });
- };
-
- cmb.canTinyMCE = function() {
- return l10n.user_can_richedit && window.tinyMCE;
- };
-
- cmb.listenTagAdd = function() {
- $document.ajaxSuccess( function( evt, xhr, settings ) {
- if ( settings.data && settings.data.length && -1 !== settings.data.indexOf( 'action=add-tag' ) ) {
- cmb.resetBoxes( $id( 'addtag' ).find( '.cmb2-wrap > .cmb2-metabox' ) );
- }
- });
- };
-
- cmb.resetBoxes = function( $boxes ) {
- $.each( $boxes, function() {
- cmb.resetBox( $( this ) );
- });
- };
-
- cmb.resetBox = function( $box ) {
- $box.find( '.wp-picker-clear' ).trigger( 'click' );
- $box.find( '.cmb2-remove-file-button' ).trigger( 'click' );
- $box.find( '.cmb-row.cmb-repeatable-grouping:not(:first-of-type) .cmb-remove-group-row' ).click();
- $box.find( '.cmb-repeat-row:not(:first-child)' ).remove();
-
- $box.find( 'input:not([type="button"]),select,textarea' ).each( function() {
- var $element = $( this );
- var tagName = $element.prop('tagName');
-
- if ( 'INPUT' === tagName ) {
- var elType = $element.attr( 'type' );
- if ( 'checkbox' === elType || 'radio' === elType ) {
- $element.prop( 'checked', false );
- } else {
- $element.val( '' );
- }
- }
- if ( 'SELECT' === tagName ) {
- $( 'option:selected', this ).prop( 'selected', false );
- }
- if ( 'TEXTAREA' === tagName ) {
- $element.html( '' );
- }
- });
- };
-
- cmb.resetTitlesAndIterator = function( evt ) {
- if ( ! evt.group ) {
- return;
- }
-
- // Loop repeatable group tables
- $( '.cmb-repeatable-group.repeatable' ).each( function() {
- var $table = $( this );
- var groupTitle = $table.find( '.cmb-add-group-row' ).data( 'grouptitle' );
-
- // Loop repeatable group table rows
- $table.find( '.cmb-repeatable-grouping' ).each( function( rowindex ) {
- var $row = $( this );
- var $rowTitle = $row.find( 'h3.cmb-group-title' );
- // Reset rows iterator
- $row.data( 'iterator', rowindex );
- // Reset rows title
- if ( $rowTitle.length ) {
- $rowTitle.text( groupTitle.replace( '{#}', ( rowindex + 1 ) ) );
- }
- });
- });
- };
-
- cmb.toggleHandle = function( evt ) {
- evt.preventDefault();
- cmb.trigger( 'postbox-toggled', $( this ).parent('.postbox').toggleClass('closed') );
- };
-
- cmb.toggleCheckBoxes = function( evt ) {
- evt.preventDefault();
- var $this = $( this );
- var $multicheck = $this.closest( '.cmb-td' ).find( 'input[type=checkbox]:not([disabled])' );
-
- // If the button has already been clicked once...
- if ( $this.data( 'checked' ) ) {
- // clear the checkboxes and remove the flag
- $multicheck.prop( 'checked', false );
- $this.data( 'checked', false );
- }
- // Otherwise mark the checkboxes and add a flag
- else {
- $multicheck.prop( 'checked', true );
- $this.data( 'checked', true );
- }
- };
-
- cmb.handleMedia = function( evt ) {
- evt.preventDefault();
-
- var $el = $( this );
- cmb.attach_id = ! $el.hasClass( 'cmb2-upload-list' ) ? $el.closest( '.cmb-td' ).find( '.cmb2-upload-file-id' ).val() : false;
- // Clean up default 0 value
- cmb.attach_id = '0' !== cmb.attach_id ? cmb.attach_id : false;
-
- cmb._handleMedia( $el.prev('input.cmb2-upload-file').attr('id'), $el.hasClass( 'cmb2-upload-list' ) );
- };
-
- cmb.handleFileClick = function( evt ) {
- if ( $( evt.target ).is( 'a' ) ) {
- return;
- }
-
- evt.preventDefault();
-
- var $el = $( this );
- var $td = $el.closest( '.cmb-td' );
- var isList = $td.find( '.cmb2-upload-button' ).hasClass( 'cmb2-upload-list' );
- cmb.attach_id = isList ? $el.find( 'input[type="hidden"]' ).data( 'id' ) : $td.find( '.cmb2-upload-file-id' ).val();
-
- if ( cmb.attach_id ) {
- cmb._handleMedia( $td.find( 'input.cmb2-upload-file' ).attr( 'id' ), isList, cmb.attach_id );
- }
- };
-
- cmb._handleMedia = function( id, isList ) {
- if ( ! wp ) {
- return;
- }
-
- var media, handlers;
-
- handlers = cmb.mediaHandlers;
- media = cmb.media;
- media.field = id;
- media.$field = $id( media.field );
- media.fieldData = media.$field.data();
- media.previewSize = media.fieldData.previewsize;
- media.sizeName = media.fieldData.sizename;
- media.fieldName = media.$field.attr('name');
- media.isList = isList;
-
- // If this field's media frame already exists, reopen it.
- if ( id in media.frames ) {
- return media.frames[ id ].open();
- }
-
- // Create the media frame.
- media.frames[ id ] = wp.media( {
- title: cmb.metabox().find('label[for="' + id + '"]').text(),
- library : media.fieldData.queryargs || {},
- button: {
- text: l10n.strings[ isList ? 'upload_files' : 'upload_file' ]
- },
- multiple: isList ? 'add' : false
- } );
-
- // Enable the additional media filters: https://github.com/CMB2/CMB2/issues/873
- media.frames[ id ].states.first().set( 'filterable', 'all' );
-
- cmb.trigger( 'cmb_media_modal_init', media );
-
- handlers.list = function( selection, returnIt ) {
-
- // Setup our fileGroup array
- var fileGroup = [];
- var attachmentHtml;
-
- if ( ! handlers.list.templates ) {
- handlers.list.templates = {
- image : wp.template( 'cmb2-list-image' ),
- file : wp.template( 'cmb2-list-file' ),
- };
- }
-
- // Loop through each attachment
- selection.each( function( attachment ) {
-
- // Image preview or standard generic output if it's not an image.
- attachmentHtml = handlers.getAttachmentHtml( attachment, 'list' );
-
- // Add our file to our fileGroup array
- fileGroup.push( attachmentHtml );
- });
-
- if ( ! returnIt ) {
- // Append each item from our fileGroup array to .cmb2-media-status
- media.$field.siblings( '.cmb2-media-status' ).append( fileGroup );
- } else {
- return fileGroup;
- }
-
- };
-
- handlers.single = function( selection ) {
- if ( ! handlers.single.templates ) {
- handlers.single.templates = {
- image : wp.template( 'cmb2-single-image' ),
- file : wp.template( 'cmb2-single-file' ),
- };
- }
-
- // Only get one file from the uploader
- var attachment = selection.first();
-
- media.$field.val( attachment.get( 'url' ) );
- $id( media.field +'_id' ).val( attachment.get( 'id' ) );
-
- // Image preview or standard generic output if it's not an image.
- var attachmentHtml = handlers.getAttachmentHtml( attachment, 'single' );
-
- // add/display our output
- media.$field.siblings( '.cmb2-media-status' ).slideDown().html( attachmentHtml );
- };
-
- handlers.getAttachmentHtml = function( attachment, templatesId ) {
- var isImage = 'image' === attachment.get( 'type' );
- var data = handlers.prepareData( attachment, isImage );
-
- // Image preview or standard generic output if it's not an image.
- return handlers[ templatesId ].templates[ isImage ? 'image' : 'file' ]( data );
- };
-
- handlers.prepareData = function( data, image ) {
- if ( image ) {
- // Set the correct image size data
- handlers.getImageData.call( data, 50 );
- }
-
- data = data.toJSON();
- data.mediaField = media.field;
- data.mediaFieldName = media.fieldName;
- data.stringRemoveImage = l10n.strings.remove_image;
- data.stringFile = l10n.strings.file;
- data.stringDownload = l10n.strings.download;
- data.stringRemoveFile = l10n.strings.remove_file;
-
- return data;
- };
-
- handlers.getImageData = function( fallbackSize ) {
-
- // Preview size dimensions
- var previewW = media.previewSize[0] || fallbackSize;
- var previewH = media.previewSize[1] || fallbackSize;
-
- // Image dimensions and url
- var url = this.get( 'url' );
- var width = this.get( 'width' );
- var height = this.get( 'height' );
- var sizes = this.get( 'sizes' );
-
- // Get the correct dimensions and url if a named size is set and exists
- // fallback to the 'large' size
- if ( sizes ) {
- if ( sizes[ media.sizeName ] ) {
- url = sizes[ media.sizeName ].url;
- width = sizes[ media.sizeName ].width;
- height = sizes[ media.sizeName ].height;
- } else if ( sizes.large ) {
- url = sizes.large.url;
- width = sizes.large.width;
- height = sizes.large.height;
- }
- }
-
- // Fit the image in to the preview size, keeping the correct aspect ratio
- if ( width > previewW ) {
- height = Math.floor( previewW * height / width );
- width = previewW;
- }
-
- if ( height > previewH ) {
- width = Math.floor( previewH * width / height );
- height = previewH;
- }
-
- if ( ! width ) {
- width = previewW;
- }
-
- if ( ! height ) {
- height = 'svg' === this.get( 'filename' ).split( '.' ).pop() ? '100%' : previewH;
- }
-
- this.set( 'sizeUrl', url );
- this.set( 'sizeWidth', width );
- this.set( 'sizeHeight', height );
-
- return this;
- };
-
- handlers.selectFile = function() {
- var selection = media.frames[ id ].state().get( 'selection' );
- var type = isList ? 'list' : 'single';
-
- if ( cmb.attach_id && isList ) {
- $( '[data-id="'+ cmb.attach_id +'"]' ).parents( 'li' ).replaceWith( handlers.list( selection, true ) );
- } else {
- handlers[type]( selection );
- }
-
- cmb.trigger( 'cmb_media_modal_select', selection, media );
- };
-
- handlers.openModal = function() {
- var selection = media.frames[ id ].state().get( 'selection' );
- var attach;
-
- if ( ! cmb.attach_id ) {
- selection.reset();
- } else {
- attach = wp.media.attachment( cmb.attach_id );
- attach.fetch();
- selection.set( attach ? [ attach ] : [] );
- }
-
- cmb.trigger( 'cmb_media_modal_open', selection, media );
- };
-
- // When a file is selected, run a callback.
- media.frames[ id ]
- .on( 'select', handlers.selectFile )
- .on( 'open', handlers.openModal );
-
- // Finally, open the modal
- media.frames[ id ].open();
- };
-
- cmb.handleRemoveMedia = function( evt ) {
- evt.preventDefault();
- var $this = $( this );
- if ( $this.is( '.cmb-attach-list .cmb2-remove-file-button' ) ) {
- $this.parents( '.cmb2-media-item' ).remove();
- return false;
- }
-
- cmb.media.field = $this.attr('rel');
-
- cmb.metabox().find( document.getElementById( cmb.media.field ) ).val('');
- cmb.metabox().find( document.getElementById( cmb.media.field + '_id' ) ).val('');
- $this.parents('.cmb2-media-status').html('');
-
- return false;
- };
-
- cmb.cleanRow = function( $row, prevNum, group ) {
- var $elements = $row.find( cmb.repeatUpdate );
- if ( group ) {
-
- var $other = $row.find( '[id]' ).not( cmb.repeatUpdate );
-
- // Remove extra ajaxed rows
- $row.find('.cmb-repeat-table .cmb-repeat-row:not(:first-child)').remove();
-
- // Update all elements w/ an ID
- if ( $other.length ) {
- $other.each( function() {
- var $_this = $( this );
- var oldID = $_this.attr( 'id' );
- var newID = oldID.replace( '_'+ prevNum, '_'+ cmb.idNumber );
- var $buttons = $row.find('[data-selector="'+ oldID +'"]');
- $_this.attr( 'id', newID );
-
- // Replace data-selector vars
- if ( $buttons.length ) {
- $buttons.attr( 'data-selector', newID ).data( 'selector', newID );
- }
- });
- }
- }
-
- $elements.filter( ':checked' ).removeAttr( 'checked' );
- $elements.find( ':checked' ).removeAttr( 'checked' );
- $elements.filter( ':selected' ).removeAttr( 'selected' );
- $elements.find( ':selected' ).removeAttr( 'selected', false );
-
- if ( $row.find('h3.cmb-group-title').length ) {
- $row.find( 'h3.cmb-group-title' ).text( $row.data( 'title' ).replace( '{#}', ( cmb.idNumber + 1 ) ) );
- }
-
- $elements.each( function() {
- cmb.elReplacements( $( this ), prevNum, group );
- } );
-
- return cmb;
- };
-
- cmb.elReplacements = function( $newInput, prevNum, group ) {
- var oldFor = $newInput.attr( 'for' );
- var oldVal = $newInput.val();
- var type = $newInput.prop( 'type' );
- var defVal = cmb.getFieldArg( $newInput, 'default' );
- var newVal = 'undefined' !== typeof defVal && false !== defVal ? defVal : '';
- var tagName = $newInput.prop('tagName');
- var checkable = 'radio' === type || 'checkbox' === type ? oldVal : false;
- var attrs = {};
- var newID, oldID;
- if ( oldFor ) {
- attrs = { 'for' : oldFor.replace( '_'+ prevNum, '_'+ cmb.idNumber ) };
- } else {
- var oldName = $newInput.attr( 'name' );
- var newName;
- oldID = $newInput.attr( 'id' );
-
- // Handle adding groups vs rows.
- if ( group ) {
- // Expect another bracket after group's index closing bracket.
- newName = oldName ? oldName.replace( '['+ prevNum +'][', '['+ cmb.idNumber +'][' ) : '';
- // Expect another underscore after group's index trailing underscore.
- newID = oldID ? oldID.replace( '_' + prevNum + '_', '_' + cmb.idNumber + '_' ) : '';
- }
- else {
- // Row indexes are at the very end of the string.
- newName = oldName ? cmb.replaceLast( oldName, '[' + prevNum + ']', '[' + cmb.idNumber + ']' ) : '';
- newID = oldID ? cmb.replaceLast( oldID, '_' + prevNum, '_' + cmb.idNumber ) : '';
- }
-
- attrs = {
- id: newID,
- name: newName
- };
-
- }
-
- // Clear out textarea values
- if ( 'TEXTAREA' === tagName ) {
- $newInput.html( newVal );
- }
-
- if ( 'SELECT' === tagName && 'undefined' !== typeof defVal ) {
- var $toSelect = $newInput.find( '[value="'+ defVal + '"]' );
- if ( $toSelect.length ) {
- $toSelect.attr( 'selected', 'selected' ).prop( 'selected', 'selected' );
- }
- }
-
- if ( checkable ) {
- $newInput.removeAttr( 'checked' );
- if ( 'undefined' !== typeof defVal && oldVal === defVal ) {
- $newInput.attr( 'checked', 'checked' ).prop( 'checked', 'checked' );
- }
- }
-
- if ( ! group && $newInput[0].hasAttribute( 'data-iterator' ) ) {
- attrs['data-iterator'] = cmb.idNumber;
- }
-
- $newInput
- .removeClass( 'hasDatepicker' )
- .val( checkable ? checkable : newVal ).attr( attrs );
-
- return $newInput;
- };
-
- cmb.newRowHousekeeping = function( $row ) {
- var $colorPicker = $row.find( '.wp-picker-container' );
- var $list = $row.find( '.cmb2-media-status' );
-
- if ( $colorPicker.length ) {
- // Need to clean-up colorpicker before appending
- $colorPicker.each( function() {
- var $td = $( this ).parent();
- $td.html( $td.find( 'input[type="text"].cmb2-colorpicker' ).attr('style', '') );
- });
- }
-
- // Need to clean-up colorpicker before appending
- if ( $list.length ) {
- $list.empty();
- }
-
- return cmb;
- };
-
- cmb.afterRowInsert = function( $row ) {
- // Init pickers from new row
- cmb.initPickers( $row.find('input[type="text"].cmb2-timepicker'), $row.find('input[type="text"].cmb2-datepicker'), $row.find('input[type="text"].cmb2-colorpicker') );
- };
-
- cmb.updateNameAttr = function () {
- var $this = $( this );
- var name = $this.attr( 'name' ); // get current name
-
- // If name is defined
- if ( 'undefined' !== typeof name ) {
- var prevNum = parseInt( $this.parents( '.cmb-repeatable-grouping' ).data( 'iterator' ), 10 );
- var newNum = prevNum - 1; // Subtract 1 to get new iterator number
-
- // Update field name attributes so data is not orphaned when a row is removed and post is saved
- var $newName = name.replace( '[' + prevNum + ']', '[' + newNum + ']' );
-
- // New name with replaced iterator
- $this.attr( 'name', $newName );
- }
- };
-
- cmb.emptyValue = function( evt, row ) {
- $( cmb.noEmpty, row ).val( '' );
- };
-
- cmb.setDefaults = function( evt, row ) {
- $( cmb.noEmpty, row ).each( function() {
- var $el = $(this);
- var defVal = cmb.getFieldArg( $el, 'default' );
- if ( 'undefined' !== typeof defVal && false !== defVal ) {
- $el.val( defVal );
- }
- });
- };
-
- cmb.addGroupRow = function( evt ) {
- evt.preventDefault();
-
- var $this = $( this );
-
- // before anything significant happens
- cmb.triggerElement( $this, 'cmb2_add_group_row_start', $this );
-
- var $table = $id( $this.data('selector') );
- var $oldRow = $table.find('.cmb-repeatable-grouping').last();
- var prevNum = parseInt( $oldRow.data('iterator'), 10 );
- cmb.idNumber = parseInt( prevNum, 10 ) + 1;
- var $row = $oldRow.clone();
- var nodeName = $row.prop('nodeName') || 'div';
- var getRowId = function( id ) {
- id = id.split('-');
- id.splice(id.length - 1, 1);
- id.push( cmb.idNumber );
- return id.join('-');
- };
-
- // Make sure the next number doesn't exist.
- while ( $table.find( '.cmb-repeatable-grouping[data-iterator="'+ cmb.idNumber +'"]' ).length > 0 ) {
- cmb.idNumber++;
- }
-
- cmb.newRowHousekeeping( $row.data( 'title', $this.data( 'grouptitle' ) ) ).cleanRow( $row, prevNum, true );
- $row.find( '.cmb-add-row-button' ).prop( 'disabled', false );
-
- var $newRow = $( '<' + nodeName + ' id="'+ getRowId( $oldRow.attr('id') ) +'" class="postbox cmb-row cmb-repeatable-grouping" data-iterator="'+ cmb.idNumber +'">'+ $row.html() +'' + nodeName + '>' );
- $oldRow.after( $newRow );
-
- cmb.afterRowInsert( $newRow );
-
- cmb.triggerElement( $table, { type: 'cmb2_add_row', group: true }, $newRow );
-
- };
-
- cmb.addAjaxRow = function( evt ) {
- evt.preventDefault();
-
- var $this = $( this );
- var $table = $id( $this.data('selector') );
- var $row = $table.find('.empty-row');
- var prevNum = parseInt( $row.find('[data-iterator]').data('iterator'), 10 );
- cmb.idNumber = parseInt( prevNum, 10 ) + 1;
- var $emptyrow = $row.clone();
-
- cmb.newRowHousekeeping( $emptyrow ).cleanRow( $emptyrow, prevNum );
-
- $row.removeClass('empty-row hidden').addClass('cmb-repeat-row');
- $row.after( $emptyrow );
-
- cmb.afterRowInsert( $emptyrow );
-
- cmb.triggerElement( $table, { type: 'cmb2_add_row', group: false }, $emptyrow, $row );
- };
-
- cmb.removeGroupRow = function( evt ) {
- evt.preventDefault();
-
- var $this = $( this );
- var confirmation = $this.data('confirm');
-
- // Process further only if deletion confirmation enabled and user agreed.
- if ( confirmation && ! window.confirm( confirmation ) ) {
- return;
- }
-
- var $table = $id( $this.data('selector') );
- var $parent = $this.parents('.cmb-repeatable-grouping');
- var number = $table.find('.cmb-repeatable-grouping').length;
-
- if ( number < 2 ) {
- return cmb.resetRow( $parent.parents('.cmb-repeatable-group').find( '.cmb-add-group-row' ), $this );
- }
-
- cmb.triggerElement( $table, 'cmb2_remove_group_row_start', $this );
-
- // When a group is removed, loop through all next groups and update fields names.
- $parent.nextAll( '.cmb-repeatable-grouping' ).find( cmb.repeatEls ).each( cmb.updateNameAttr );
-
- $parent.remove();
-
- cmb.triggerElement( $table, { type: 'cmb2_remove_row', group: true } );
- };
-
- cmb.removeAjaxRow = function( evt ) {
- evt.preventDefault();
-
- var $this = $( this );
-
- // Check if disabled
- if ( $this.hasClass( 'button-disabled' ) ) {
- return;
- }
-
- var $parent = $this.parents('.cmb-row');
- var $table = $this.parents('.cmb-repeat-table');
- var number = $table.find('.cmb-row').length;
-
- if ( number <= 2 ) {
- return cmb.resetRow( $parent.find( '.cmb-add-row-button' ), $this );
- }
-
- if ( $parent.hasClass('empty-row') ) {
- $parent.prev().addClass( 'empty-row' ).removeClass('cmb-repeat-row');
- }
-
- $this.parents('.cmb-repeat-table .cmb-row').remove();
-
-
- cmb.triggerElement( $table, { type: 'cmb2_remove_row', group: false } );
- };
-
- cmb.resetRow = function( $addNewBtn, $removeBtn ) {
- // Click the "add new" button followed by the "remove this" button
- // in order to reset the repeat row to empty values.
- $addNewBtn.trigger( 'click' );
- $removeBtn.trigger( 'click' );
- };
-
- cmb.shiftRows = function( evt ) {
-
- evt.preventDefault();
-
- var $this = $( this );
- var $from = $this.parents( '.cmb-repeatable-grouping' );
- var $goto = $this.hasClass( 'move-up' ) ? $from.prev( '.cmb-repeatable-grouping' ) : $from.next( '.cmb-repeatable-grouping' );
-
- // Before shift occurs.
- cmb.triggerElement( $this, 'cmb2_shift_rows_enter', $this, $from, $goto );
-
- if ( ! $goto.length ) {
- return;
- }
-
- // About to shift
- cmb.triggerElement( $this, 'cmb2_shift_rows_start', $this, $from, $goto );
-
- var inputVals = [];
- // Loop this item's fields
- $from.find( cmb.repeatEls ).each( function() {
- var $element = $( this );
- var elType = $element.attr( 'type' );
- var val;
-
- if ( $element.hasClass('cmb2-media-status') ) {
- // special case for image previews
- val = $element.html();
- } else if ( 'checkbox' === elType || 'radio' === elType ) {
- val = $element.is(':checked');
- } else if ( 'select' === $element.prop('tagName') ) {
- val = $element.is(':selected');
- } else {
- val = $element.val();
- }
-
- // Get all the current values per element
- inputVals.push( { val: val, $: $element } );
- });
- // And swap them all
- $goto.find( cmb.repeatEls ).each( function( index ) {
- var $element = $( this );
- var elType = $element.attr( 'type' );
- var val;
-
- if ( $element.hasClass('cmb2-media-status') ) {
- var toRowId = $element.closest('.cmb-repeatable-grouping').attr('data-iterator');
- var fromRowId = inputVals[ index ].$.closest('.cmb-repeatable-grouping').attr('data-iterator');
-
- // special case for image previews
- val = $element.html();
- $element.html( inputVals[ index ].val );
- inputVals[ index ].$.html( val );
-
- inputVals[ index ].$.find( 'input' ).each(function() {
- var name = $( this ).attr( 'name' );
- name = name.replace( '['+toRowId+']', '['+fromRowId+']' );
- $( this ).attr( 'name', name );
- });
- $element.find('input').each(function() {
- var name = $( this ).attr('name');
- name = name.replace('['+fromRowId+']', '['+toRowId+']');
- $( this ).attr('name', name);
- });
-
- }
- // handle checkbox swapping
- else if ( 'checkbox' === elType ) {
- inputVals[ index ].$.prop( 'checked', $element.is(':checked') );
- $element.prop( 'checked', inputVals[ index ].val );
- }
- // handle radio swapping
- else if ( 'radio' === elType ) {
- if ( $element.is( ':checked' ) ) {
- inputVals[ index ].$.attr( 'data-checked', 'true' );
- }
- if ( inputVals[ index ].$.is( ':checked' ) ) {
- $element.attr( 'data-checked', 'true' );
- }
- }
- // handle select swapping
- else if ( 'select' === $element.prop('tagName') ) {
- inputVals[ index ].$.prop( 'selected', $element.is(':selected') );
- $element.prop( 'selected', inputVals[ index ].val );
- }
- // handle normal input swapping
- else {
- inputVals[ index ].$.val( $element.val() );
- $element.val( inputVals[ index ].val );
- }
- });
-
- $from.find( 'input[data-checked=true]' ).prop( 'checked', true ).removeAttr( 'data-checked' );
- $goto.find( 'input[data-checked=true]' ).prop( 'checked', true ).removeAttr( 'data-checked' );
-
- // trigger color picker change event
- $from.find( 'input[type="text"].cmb2-colorpicker' ).trigger( 'change' );
- $goto.find( 'input[type="text"].cmb2-colorpicker' ).trigger( 'change' );
-
- // shift done
- cmb.triggerElement( $this, 'cmb2_shift_rows_complete', $this, $from, $goto );
- };
-
- cmb.initPickers = function( $timePickers, $datePickers, $colorPickers ) {
- cmb.trigger( 'cmb_init_pickers', {
- time: $timePickers,
- date: $datePickers,
- color: $colorPickers
- } );
-
- // Initialize jQuery UI timepickers
- cmb.initDateTimePickers( $timePickers, 'timepicker', 'time_picker' );
- // Initialize jQuery UI datepickers
- cmb.initDateTimePickers( $datePickers, 'datepicker', 'date_picker' );
- // Initialize color picker
- cmb.initColorPickers( $colorPickers );
- };
-
- cmb.initDateTimePickers = function( $selector, method, defaultKey ) {
- if ( $selector.length ) {
- $selector[ method ]( 'destroy' ).each( function() {
- var $this = $( this );
- var fieldOpts = $this.data( method ) || {};
- var options = $.extend( {}, cmb.defaults[ defaultKey ], fieldOpts );
- $this[ method ]( cmb.datePickerSetupOpts( fieldOpts, options, method ) );
- } );
- }
- };
-
- cmb.datePickerSetupOpts = function( fieldOpts, options, method ) {
- var existing = $.extend( {}, options );
-
- options.beforeShow = function( input, inst ) {
- if ( 'timepicker' === method ) {
- cmb.addTimePickerClasses( inst.dpDiv );
- }
-
- // Wrap datepicker w/ class to narrow the scope of jQuery UI CSS and prevent conflicts
- $id( 'ui-datepicker-div' ).addClass( 'cmb2-element' );
-
- // Let's be sure to call beforeShow if it was added
- if ( 'function' === typeof existing.beforeShow ) {
- existing.beforeShow( input, inst );
- }
- };
-
- if ( 'timepicker' === method ) {
- options.onChangeMonthYear = function( year, month, inst, picker ) {
- cmb.addTimePickerClasses( inst.dpDiv );
-
- // Let's be sure to call onChangeMonthYear if it was added
- if ( 'function' === typeof existing.onChangeMonthYear ) {
- existing.onChangeMonthYear( year, month, inst, picker );
- }
- };
- }
-
- options.onClose = function( dateText, inst ) {
- // Remove the class when we're done with it (and hide to remove FOUC).
- var $picker = $id( 'ui-datepicker-div' ).removeClass( 'cmb2-element' ).hide();
- if ( 'timepicker' === method && ! $( inst.input ).val() ) {
- // Set the timepicker field value if it's empty.
- inst.input.val( $picker.find( '.ui_tpicker_time' ).text() );
- }
-
- // Let's be sure to call onClose if it was added
- if ( 'function' === typeof existing.onClose ) {
- existing.onClose( dateText, inst );
- }
- };
-
- return options;
- };
-
- // Adds classes to timepicker buttons.
- cmb.addTimePickerClasses = function( $picker ) {
- var func = cmb.addTimePickerClasses;
- func.count = func.count || 0;
-
- // Wait a bit to let the timepicker render, since these are pre-render events.
- setTimeout( function() {
- if ( $picker.find( '.ui-priority-secondary' ).length ) {
- $picker.find( '.ui-priority-secondary' ).addClass( 'button-secondary' );
- $picker.find( '.ui-priority-primary' ).addClass( 'button-primary' );
- func.count = 0;
- } else if ( func.count < 5 ) {
- func.count++;
- func( $picker );
- }
- }, 10 );
- };
-
- cmb.initColorPickers = function( $selector ) {
- if ( ! $selector.length ) {
- return;
- }
- if ( 'object' === typeof jQuery.wp && 'function' === typeof jQuery.wp.wpColorPicker ) {
-
- $selector.each( function() {
- var $this = $( this );
- var fieldOpts = $this.data( 'colorpicker' ) || {};
- $this.wpColorPicker( $.extend( {}, cmb.defaults.color_picker, fieldOpts ) );
- } );
-
- } else {
- $selector.each( function( i ) {
- $( this ).after( '
' );
- $id( 'picker-' + i ).hide().farbtastic( $( this ) );
- } )
- .focus( function() {
- $( this ).next().show();
- } )
- .blur( function() {
- $( this ).next().hide();
- } );
- }
- };
-
- cmb.initCodeEditors = function( $selector ) {
- cmb.trigger( 'cmb_init_code_editors', $selector );
-
- if ( ! cmb.defaults.code_editor || ! wp || ! wp.codeEditor || ! $selector.length ) {
- return;
- }
-
- $selector.each( function() {
- wp.codeEditor.initialize(
- this.id,
- cmb.codeEditorArgs( $( this ).data( 'codeeditor' ) )
- );
- } );
- };
-
- cmb.codeEditorArgs = function( overrides ) {
- var props = [ 'codemirror', 'csslint', 'jshint', 'htmlhint' ];
- var args = $.extend( {}, cmb.defaults.code_editor );
- overrides = overrides || {};
-
- for ( var i = props.length - 1; i >= 0; i-- ) {
- if ( overrides.hasOwnProperty( props[i] ) ) {
- args[ props[i] ] = $.extend( {}, args[ props[i] ] || {}, overrides[ props[i] ] );
- }
- }
-
- return args;
- };
-
- cmb.makeListSortable = function() {
- var $filelist = cmb.metabox().find( '.cmb2-media-status.cmb-attach-list' );
- if ( $filelist.length ) {
- $filelist.sortable({ cursor: 'move' }).disableSelection();
- }
- };
-
- cmb.makeRepeatableSortable = function() {
- var $repeatables = cmb.metabox().find( '.cmb-repeat-table .cmb-field-list' );
-
- if ( $repeatables.length ) {
- $repeatables.sortable({
- items : '.cmb-repeat-row',
- cursor: 'move',
- // The default "cancel" attributes are: "input,textarea,button,select,option".
- // We are appending .CodeMirror.
- // See https://api.jqueryui.com/sortable/#option-cancel
- cancel: 'input,textarea,button,select,option,.CodeMirror'
- });
- }
- };
-
- cmb.maybeOembed = function( evt ) {
- var $this = $( this );
-
- var m = {
- focusout : function() {
- setTimeout( function() {
- // if it's been 2 seconds, hide our spinner
- cmb.spinner( '.cmb2-metabox', true );
- }, 2000);
- },
- keyup : function() {
- var betw = function( min, max ) {
- return ( evt.which <= max && evt.which >= min );
- };
- // Only Ajax on normal keystrokes
- if ( betw( 48, 90 ) || betw( 96, 111 ) || betw( 8, 9 ) || evt.which === 187 || evt.which === 190 ) {
- // fire our ajax function
- cmb.doAjax( $this, evt );
- }
- },
- paste : function() {
- // paste event is fired before the value is filled, so wait a bit
- setTimeout( function() { cmb.doAjax( $this ); }, 100);
- }
- };
-
- m[ evt.type ]();
- };
-
- /**
- * Resize oEmbed videos to fit in their respective metaboxes
- *
- * @since 0.9.4
- *
- * @return {return}
- */
- cmb.resizeoEmbeds = function() {
- cmb.metabox().each( function() {
- var $this = $( this );
- var $tableWrap = $this.parents('.inside');
- var isSide = $this.parents('.inner-sidebar').length || $this.parents( '#side-sortables' ).length;
- var isSmall = isSide;
- var isSmallest = false;
- if ( ! $tableWrap.length ) {
- return true; // continue
- }
-
- // Calculate new width
- var tableW = $tableWrap.width();
-
- if ( cmb.styleBreakPoint > tableW ) {
- isSmall = true;
- isSmallest = ( cmb.styleBreakPoint - 62 ) > tableW;
- }
-
- tableW = isSmall ? tableW : Math.round(($tableWrap.width() * 0.82)*0.97);
- var newWidth = tableW - 30;
- if ( isSmall && ! isSide && ! isSmallest ) {
- newWidth = newWidth - 75;
- }
- if ( newWidth > 639 ) {
- return true; // continue
- }
-
- var $embeds = $this.find('.cmb-type-oembed .embed-status');
- var $children = $embeds.children().not('.cmb2-remove-wrapper');
- if ( ! $children.length ) {
- return true; // continue
- }
-
- $children.each( function() {
- var $this = $( this );
- var iwidth = $this.width();
- var iheight = $this.height();
- var _newWidth = newWidth;
- if ( $this.parents( '.cmb-repeat-row' ).length && ! isSmall ) {
- // Make room for our repeatable "remove" button column
- _newWidth = newWidth - 91;
- _newWidth = 785 > tableW ? _newWidth - 15 : _newWidth;
- }
- // Calc new height
- var newHeight = Math.round((_newWidth * iheight)/iwidth);
- $this.width(_newWidth).height(newHeight);
- });
- });
- };
-
- // function for running our ajax
- cmb.doAjax = function( $obj ) {
- // get typed value
- var oembed_url = $obj.val();
- // only proceed if the field contains more than 6 characters
- if ( oembed_url.length < 6 ) {
- return;
- }
-
- // get field id
- var field_id = $obj.attr('id');
- var $context = $obj.closest( '.cmb-td' );
- var $embed_container = $context.find( '.embed-status' );
- var $embed_wrap = $context.find( '.embed_wrap' );
- var $child_el = $embed_container.find( ':first-child' );
- var oembed_width = $embed_container.length && $child_el.length ? $child_el.width() : $obj.width();
-
- cmb.log( 'oembed_url', oembed_url, field_id );
-
- // show our spinner
- cmb.spinner( $context );
- // clear out previous results
- $embed_wrap.html('');
- // and run our ajax function
- setTimeout( function() {
- // if they haven't typed in 500 ms
- if ( $( '.cmb2-oembed:focus' ).val() !== oembed_url ) {
- return;
- }
- $.ajax({
- type : 'post',
- dataType : 'json',
- url : l10n.ajaxurl,
- data : {
- 'action' : 'cmb2_oembed_handler',
- 'oembed_url' : oembed_url,
- 'oembed_width' : oembed_width > 300 ? oembed_width : 300,
- 'field_id' : field_id,
- 'object_id' : $obj.data( 'objectid' ),
- 'object_type' : $obj.data( 'objecttype' ),
- 'cmb2_ajax_nonce' : l10n.ajax_nonce
- },
- success: function(response) {
- cmb.log( response );
- // hide our spinner
- cmb.spinner( $context, true );
- // and populate our results from ajax response
- $embed_wrap.html( response.data );
- }
- });
-
- }, 500);
-
- };
-
- /**
- * Gets jQuery object containing all CMB metaboxes. Caches the result.
- *
- * @since 1.0.2
- *
- * @return {Object} jQuery object containing all CMB metaboxes.
- */
- cmb.metabox = function() {
- if ( cmb.$metabox ) {
- return cmb.$metabox;
- }
- cmb.$metabox = $('.cmb2-wrap > .cmb2-metabox');
- return cmb.$metabox;
- };
-
- /**
- * Starts/stops contextual spinner.
- *
- * @since 1.0.1
- *
- * @param {object} $context The jQuery parent/context object.
- * @param {bool} hide Whether to hide the spinner (will show by default).
- *
- * @return {void}
- */
- cmb.spinner = function( $context, hide ) {
- var m = hide ? 'removeClass' : 'addClass';
- $('.cmb-spinner', $context )[ m ]( 'is-active' );
- };
-
- /**
- * Triggers a jQuery event on the document object.
- *
- * @since 2.2.3
- *
- * @param {string} evtName The name of the event to trigger.
- *
- * @return {void}
- */
- cmb.trigger = function( evtName ) {
- var args = Array.prototype.slice.call( arguments, 1 );
- args.push( cmb );
- $document.trigger( evtName, args );
- };
-
- /**
- * Triggers a jQuery event on the given jQuery object.
- *
- * @since 2.2.3
- *
- * @param {object} $el The jQuery element object.
- * @param {string} evtName The name of the event to trigger.
- *
- * @return {void}
- */
- cmb.triggerElement = function( $el, evtName ) {
- var args = Array.prototype.slice.call( arguments, 2 );
- args.push( cmb );
- $el.trigger( evtName, args );
- };
-
- /**
- * Get an argument for a given field.
- *
- * @since 2.5.0
- *
- * @param {string|object} hash The field hash, id, or a jQuery object for a field.
- * @param {string} arg The argument to get on the field.
- *
- * @return {mixed} The argument value.
- */
- cmb.getFieldArg = function( hash, arg ) {
- return cmb.getField( hash )[ arg ];
- };
-
- /**
- * Get a field object instances. Can be filtered by passing in a filter callback function.
- * e.g. `const fileFields = CMB2.getFields(f => 'file' === f.type);`
- *
- * @since 2.5.0
- *
- * @param {mixed} filterCb An optional filter callback function.
- *
- * @return array An array of field object instances.
- */
- cmb.getFields = function( filterCb ) {
- if ( 'function' === typeof filterCb ) {
- var fields = [];
- $.each( l10n.fields, function( hash, field ) {
- if ( filterCb( field, hash ) ) {
- fields.push( field );
- }
- });
- return fields;
- }
-
- return l10n.fields;
- };
-
- /**
- * Get a field object instance by hash or id.
- *
- * @since 2.5.0
- *
- * @param {string|object} hash The field hash, id, or a jQuery object for a field.
- *
- * @return {object} The field object or an empty object.
- */
- cmb.getField = function( hash ) {
- var field = {};
- hash = hash instanceof jQuery ? hash.data( 'hash' ) : hash;
- if ( hash ) {
- try {
- if ( l10n.fields[ hash ] ) {
- throw new Error( hash );
- }
-
- cmb.getFields( function( field ) {
- if ( 'function' === typeof hash ) {
- if ( hash( field ) ) {
- throw new Error( field.hash );
- }
- } else if ( field.id && field.id === hash ) {
- throw new Error( field.hash );
- }
- });
- } catch( e ) {
- field = l10n.fields[ e.message ];
- }
- }
-
- return field;
- };
-
- /**
- * Safely log things if query var is set. Accepts same parameters as console.log.
- *
- * @since 1.0.0
- *
- * @return {void}
- */
- cmb.log = function() {
- if ( l10n.script_debug && console && 'function' === typeof console.log ) {
- console.log.apply(console, arguments);
- }
- };
-
- /**
- * Replace the last occurrence of a string.
- *
- * @since 2.2.6
- *
- * @param {string} string String to search/replace.
- * @param {string} search String to search.
- * @param {string} replace String to replace search with.
- *
- * @return {string} Possibly modified string.
- */
- cmb.replaceLast = function( string, search, replace ) {
- // find the index of last time word was used
- var n = string.lastIndexOf( search );
-
- // slice the string in 2, one from the start to the lastIndexOf
- // and then replace the word in the rest
- return string.slice( 0, n ) + string.slice( n ).replace( search, replace );
- };
-
- // Kick it off!
- $( cmb.init );
-
+(function (window, document, $, cmb, undefined) {
+ "use strict";
+
+ // localization strings
+ var l10n = window.cmb2_l10;
+ var setTimeout = window.setTimeout;
+ var $document;
+ var $id = function (selector) {
+ return $(document.getElementById(selector));
+ };
+ cmb.$id = $id;
+ var defaults = {
+ idNumber: false,
+ repeatEls:
+ 'input:not([type="button"],[id^=filelist]),select,textarea,.cmb2-media-status',
+ noEmpty:
+ 'input:not([type="button"]):not([type="radio"]):not([type="checkbox"]),textarea',
+ repeatUpdate: 'input:not([type="button"]),select,textarea,label',
+ styleBreakPoint: 450,
+ mediaHandlers: {},
+ defaults: {
+ time_picker: l10n.defaults.time_picker,
+ date_picker: l10n.defaults.date_picker,
+ color_picker: l10n.defaults.color_picker || {},
+ code_editor: l10n.defaults.code_editor,
+ },
+ media: {
+ frames: {},
+ },
+ };
+
+ cmb.init = function () {
+ $document = $(document);
+
+ // Setup the CMB2 object defaults.
+ $.extend(cmb, defaults);
+
+ cmb.trigger("cmb_pre_init");
+
+ var $metabox = cmb.metabox();
+ var $repeatGroup = $metabox.find(".cmb-repeatable-group");
+
+ // Init time/date/color pickers
+ cmb.initPickers(
+ $metabox.find('input[type="text"].cmb2-timepicker'),
+ $metabox.find('input[type="text"].cmb2-datepicker'),
+ $metabox.find('input[type="text"].cmb2-colorpicker'),
+ );
+
+ // Init code editors.
+ cmb.initCodeEditors(
+ $metabox.find(".cmb2-textarea-code:not(.disable-codemirror)"),
+ );
+
+ // Insert toggle button into DOM wherever there is multicheck. credit: Genesis Framework
+ $(
+ '' +
+ l10n.strings.check_toggle +
+ "
",
+ ).insertBefore(".cmb2-checkbox-list:not(.no-select-all)");
+
+ // Make File List drag/drop sortable:
+ cmb.makeListSortable();
+ // Make Repeatable fields drag/drop sortable:
+ cmb.makeRepeatableSortable();
+
+ $metabox
+ .on("change", ".cmb2_upload_file", function () {
+ cmb.media.field = $(this).attr("id");
+ $id(cmb.media.field + "_id").val("");
+ })
+ // Media/file management
+ .on("click", ".cmb-multicheck-toggle", cmb.toggleCheckBoxes)
+ .on("click", ".cmb2-upload-button", cmb.handleMedia)
+ .on(
+ "click",
+ ".cmb-attach-list li, .cmb2-media-status .img-status img, .cmb2-media-status .file-status > span",
+ cmb.handleFileClick,
+ )
+ .on("click", ".cmb2-remove-file-button", cmb.handleRemoveMedia)
+ // Repeatable content
+ .on("click", ".cmb-add-group-row", cmb.addGroupRow)
+ .on("click", ".cmb-add-row-button", cmb.addAjaxRow)
+ .on("click", ".cmb-remove-group-row", cmb.removeGroupRow)
+ .on("click", ".cmb-remove-row-button", cmb.removeAjaxRow)
+ // Ajax oEmbed display
+ .on("keyup paste focusout", ".cmb2-oembed", cmb.maybeOembed)
+ // Reset titles when removing a row
+ .on(
+ "cmb2_remove_row",
+ ".cmb-repeatable-group",
+ cmb.resetTitlesAndIterator,
+ )
+ .on(
+ "click",
+ ".cmbhandle, .cmbhandle + .cmbhandle-title",
+ cmb.toggleHandle,
+ );
+
+ if ($repeatGroup.length) {
+ $repeatGroup
+ .on("cmb2_add_row", cmb.emptyValue)
+ .on("cmb2_add_row", cmb.setDefaults)
+ .filter(".sortable")
+ .each(function () {
+ // Add sorting arrows
+ $(this)
+ .find(".cmb-remove-group-row-button")
+ .before(
+ ' ',
+ );
+ })
+ .on("click", ".cmb-shift-rows", cmb.shiftRows);
+ }
+
+ // on pageload
+ setTimeout(cmb.resizeoEmbeds, 500);
+ // and on window resize
+ $(window).on("resize", cmb.resizeoEmbeds);
+
+ if ($id("addtag").length) {
+ cmb.listenTagAdd();
+ }
+
+ $(document).on("cmb_init", cmb.mceEnsureSave);
+
+ cmb.trigger("cmb_init");
+ };
+
+ // Handles updating tiny mce instances when saving a gutenberg post.
+ // https://github.com/CMB2/CMB2/issues/1156
+ cmb.mceEnsureSave = function () {
+ // If no wp.data, do not proceed (no gutenberg)
+ if (!wp.data || !wp.data.hasOwnProperty("subscribe")) {
+ return;
+ }
+
+ // If the current user cannot richedit, or MCE is not available, bail.
+ if (!cmb.canTinyMCE()) {
+ return;
+ }
+
+ wp.data.subscribe(function () {
+ var editor = wp.data.hasOwnProperty("select")
+ ? wp.data.select("core/editor")
+ : null;
+
+ // the post is currently being saved && we have tinymce editors
+ if (
+ editor &&
+ editor.isSavingPost &&
+ editor.isSavingPost() &&
+ window.tinyMCE.editors.length
+ ) {
+ for (var i = 0; i < window.tinyMCE.editors.length; i++) {
+ if (window.tinyMCE.activeEditor !== window.tinyMCE.editors[i]) {
+ window.tinyMCE.editors[i].save();
+ }
+ }
+ }
+ });
+ };
+
+ cmb.canTinyMCE = function () {
+ return l10n.user_can_richedit && window.tinyMCE;
+ };
+
+ cmb.listenTagAdd = function () {
+ $document.ajaxSuccess(function (evt, xhr, settings) {
+ if (
+ settings.data &&
+ settings.data.length &&
+ -1 !== settings.data.indexOf("action=add-tag")
+ ) {
+ cmb.resetBoxes($id("addtag").find(".cmb2-wrap > .cmb2-metabox"));
+ }
+ });
+ };
+
+ cmb.resetBoxes = function ($boxes) {
+ $.each($boxes, function () {
+ cmb.resetBox($(this));
+ });
+ };
+
+ cmb.resetBox = function ($box) {
+ $box.find(".wp-picker-clear").trigger("click");
+ $box.find(".cmb2-remove-file-button").trigger("click");
+ $box
+ .find(
+ ".cmb-row.cmb-repeatable-grouping:not(:first-of-type) .cmb-remove-group-row",
+ )
+ .click();
+ $box.find(".cmb-repeat-row:not(:first-child)").remove();
+
+ $box.find('input:not([type="button"]),select,textarea').each(function () {
+ var $element = $(this);
+ var tagName = $element.prop("tagName");
+
+ if ("INPUT" === tagName) {
+ var elType = $element.attr("type");
+ if ("checkbox" === elType || "radio" === elType) {
+ $element.prop("checked", false);
+ } else {
+ $element.val("");
+ }
+ }
+ if ("SELECT" === tagName) {
+ $("option:selected", this).prop("selected", false);
+ }
+ if ("TEXTAREA" === tagName) {
+ $element.html("");
+ }
+ });
+ };
+
+ cmb.resetTitlesAndIterator = function (evt) {
+ if (!evt.group) {
+ return;
+ }
+
+ // Loop repeatable group tables
+ $(".cmb-repeatable-group.repeatable").each(function () {
+ var $table = $(this);
+ var groupTitle = $table.find(".cmb-add-group-row").data("grouptitle");
+
+ // Loop repeatable group table rows
+ $table.find(".cmb-repeatable-grouping").each(function (rowindex) {
+ var $row = $(this);
+ var $rowTitle = $row.find("h3.cmb-group-title");
+ // Reset rows iterator
+ $row.data("iterator", rowindex);
+ // Reset rows title
+ if ($rowTitle.length) {
+ $rowTitle.text(groupTitle.replace("{#}", rowindex + 1));
+ }
+ });
+ });
+ };
+
+ cmb.toggleHandle = function (evt) {
+ evt.preventDefault();
+ cmb.trigger(
+ "postbox-toggled",
+ $(this).parent(".postbox").toggleClass("closed"),
+ );
+ };
+
+ cmb.toggleCheckBoxes = function (evt) {
+ evt.preventDefault();
+ var $this = $(this);
+ var $multicheck = $this
+ .closest(".cmb-td")
+ .find("input[type=checkbox]:not([disabled])");
+
+ // If the button has already been clicked once...
+ if ($this.data("checked")) {
+ // clear the checkboxes and remove the flag
+ $multicheck.prop("checked", false);
+ $this.data("checked", false);
+ }
+ // Otherwise mark the checkboxes and add a flag
+ else {
+ $multicheck.prop("checked", true);
+ $this.data("checked", true);
+ }
+ };
+
+ cmb.handleMedia = function (evt) {
+ evt.preventDefault();
+
+ var $el = $(this);
+ cmb.attach_id = !$el.hasClass("cmb2-upload-list")
+ ? $el.closest(".cmb-td").find(".cmb2-upload-file-id").val()
+ : false;
+ // Clean up default 0 value
+ cmb.attach_id = "0" !== cmb.attach_id ? cmb.attach_id : false;
+
+ cmb._handleMedia(
+ $el.prev("input.cmb2-upload-file").attr("id"),
+ $el.hasClass("cmb2-upload-list"),
+ );
+ };
+
+ cmb.handleFileClick = function (evt) {
+ if ($(evt.target).is("a")) {
+ return;
+ }
+
+ evt.preventDefault();
+
+ var $el = $(this);
+ var $td = $el.closest(".cmb-td");
+ var isList = $td.find(".cmb2-upload-button").hasClass("cmb2-upload-list");
+ cmb.attach_id = isList
+ ? $el.find('input[type="hidden"]').data("id")
+ : $td.find(".cmb2-upload-file-id").val();
+
+ if (cmb.attach_id) {
+ cmb._handleMedia(
+ $td.find("input.cmb2-upload-file").attr("id"),
+ isList,
+ cmb.attach_id,
+ );
+ }
+ };
+
+ cmb._handleMedia = function (id, isList) {
+ if (!wp) {
+ return;
+ }
+
+ var media, handlers;
+
+ handlers = cmb.mediaHandlers;
+ media = cmb.media;
+ media.field = id;
+ media.$field = $id(media.field);
+ media.fieldData = media.$field.data();
+ media.previewSize = media.fieldData.previewsize;
+ media.sizeName = media.fieldData.sizename;
+ media.fieldName = media.$field.attr("name");
+ media.isList = isList;
+
+ // If this field's media frame already exists, reopen it.
+ if (id in media.frames) {
+ return media.frames[id].open();
+ }
+
+ // Create the media frame.
+ media.frames[id] = wp.media({
+ title: cmb
+ .metabox()
+ .find('label[for="' + id + '"]')
+ .text(),
+ library: media.fieldData.queryargs || {},
+ button: {
+ text: l10n.strings[isList ? "upload_files" : "upload_file"],
+ },
+ multiple: isList ? "add" : false,
+ });
+
+ // Enable the additional media filters: https://github.com/CMB2/CMB2/issues/873
+ media.frames[id].states.first().set("filterable", "all");
+
+ cmb.trigger("cmb_media_modal_init", media);
+
+ handlers.list = function (selection, returnIt) {
+ // Setup our fileGroup array
+ var fileGroup = [];
+ var attachmentHtml;
+
+ if (!handlers.list.templates) {
+ handlers.list.templates = {
+ image: wp.template("cmb2-list-image"),
+ file: wp.template("cmb2-list-file"),
+ };
+ }
+
+ // Loop through each attachment
+ selection.each(function (attachment) {
+ // Image preview or standard generic output if it's not an image.
+ attachmentHtml = handlers.getAttachmentHtml(attachment, "list");
+
+ // Add our file to our fileGroup array
+ fileGroup.push(attachmentHtml);
+ });
+
+ if (!returnIt) {
+ // Append each item from our fileGroup array to .cmb2-media-status
+ media.$field.siblings(".cmb2-media-status").append(fileGroup);
+ } else {
+ return fileGroup;
+ }
+ };
+
+ handlers.single = function (selection) {
+ if (!handlers.single.templates) {
+ handlers.single.templates = {
+ image: wp.template("cmb2-single-image"),
+ file: wp.template("cmb2-single-file"),
+ };
+ }
+
+ // Only get one file from the uploader
+ var attachment = selection.first();
+
+ media.$field.val(attachment.get("url"));
+ $id(media.field + "_id").val(attachment.get("id"));
+
+ // Image preview or standard generic output if it's not an image.
+ var attachmentHtml = handlers.getAttachmentHtml(attachment, "single");
+
+ // add/display our output
+ media.$field
+ .siblings(".cmb2-media-status")
+ .slideDown()
+ .html(attachmentHtml);
+ };
+
+ handlers.getAttachmentHtml = function (attachment, templatesId) {
+ var isImage = "image" === attachment.get("type");
+ var data = handlers.prepareData(attachment, isImage);
+
+ // Image preview or standard generic output if it's not an image.
+ return handlers[templatesId].templates[isImage ? "image" : "file"](data);
+ };
+
+ handlers.prepareData = function (data, image) {
+ if (image) {
+ // Set the correct image size data
+ handlers.getImageData.call(data, 50);
+ }
+
+ data = data.toJSON();
+ data.mediaField = media.field;
+ data.mediaFieldName = media.fieldName;
+ data.stringRemoveImage = l10n.strings.remove_image;
+ data.stringFile = l10n.strings.file;
+ data.stringDownload = l10n.strings.download;
+ data.stringRemoveFile = l10n.strings.remove_file;
+
+ return data;
+ };
+
+ handlers.getImageData = function (fallbackSize) {
+ // Preview size dimensions
+ var previewW = media.previewSize[0] || fallbackSize;
+ var previewH = media.previewSize[1] || fallbackSize;
+
+ // Image dimensions and url
+ var url = this.get("url");
+ var width = this.get("width");
+ var height = this.get("height");
+ var sizes = this.get("sizes");
+
+ // Get the correct dimensions and url if a named size is set and exists
+ // fallback to the 'large' size
+ if (sizes) {
+ if (sizes[media.sizeName]) {
+ url = sizes[media.sizeName].url;
+ width = sizes[media.sizeName].width;
+ height = sizes[media.sizeName].height;
+ } else if (sizes.large) {
+ url = sizes.large.url;
+ width = sizes.large.width;
+ height = sizes.large.height;
+ }
+ }
+
+ // Fit the image in to the preview size, keeping the correct aspect ratio
+ if (width > previewW) {
+ height = Math.floor((previewW * height) / width);
+ width = previewW;
+ }
+
+ if (height > previewH) {
+ width = Math.floor((previewH * width) / height);
+ height = previewH;
+ }
+
+ if (!width) {
+ width = previewW;
+ }
+
+ if (!height) {
+ height =
+ "svg" === this.get("filename").split(".").pop() ? "100%" : previewH;
+ }
+
+ this.set("sizeUrl", url);
+ this.set("sizeWidth", width);
+ this.set("sizeHeight", height);
+
+ return this;
+ };
+
+ handlers.selectFile = function () {
+ var selection = media.frames[id].state().get("selection");
+ var type = isList ? "list" : "single";
+
+ if (cmb.attach_id && isList) {
+ $('[data-id="' + cmb.attach_id + '"]')
+ .parents("li")
+ .replaceWith(handlers.list(selection, true));
+ } else {
+ handlers[type](selection);
+ }
+
+ cmb.trigger("cmb_media_modal_select", selection, media);
+ };
+
+ handlers.openModal = function () {
+ var selection = media.frames[id].state().get("selection");
+ var attach;
+
+ if (!cmb.attach_id) {
+ selection.reset();
+ } else {
+ attach = wp.media.attachment(cmb.attach_id);
+ attach.fetch();
+ selection.set(attach ? [attach] : []);
+ }
+
+ cmb.trigger("cmb_media_modal_open", selection, media);
+ };
+
+ // When a file is selected, run a callback.
+ media.frames[id]
+ .on("select", handlers.selectFile)
+ .on("open", handlers.openModal);
+
+ // Finally, open the modal
+ media.frames[id].open();
+ };
+
+ cmb.handleRemoveMedia = function (evt) {
+ evt.preventDefault();
+ var $this = $(this);
+ if ($this.is(".cmb-attach-list .cmb2-remove-file-button")) {
+ $this.parents(".cmb2-media-item").remove();
+ return false;
+ }
+
+ cmb.media.field = $this.attr("rel");
+
+ cmb.metabox().find(document.getElementById(cmb.media.field)).val("");
+ cmb
+ .metabox()
+ .find(document.getElementById(cmb.media.field + "_id"))
+ .val("");
+ $this.parents(".cmb2-media-status").html("");
+
+ return false;
+ };
+
+ cmb.cleanRow = function ($row, prevNum, group) {
+ var $elements = $row.find(cmb.repeatUpdate);
+ if (group) {
+ var $other = $row.find("[id]").not(cmb.repeatUpdate);
+
+ // Remove extra ajaxed rows
+ $row.find(".cmb-repeat-table .cmb-repeat-row:not(:first-child)").remove();
+
+ // Update all elements w/ an ID
+ if ($other.length) {
+ $other.each(function () {
+ var $_this = $(this);
+ var oldID = $_this.attr("id");
+ var newID = oldID.replace("_" + prevNum, "_" + cmb.idNumber);
+ var $buttons = $row.find('[data-selector="' + oldID + '"]');
+ $_this.attr("id", newID);
+
+ // Replace data-selector vars
+ if ($buttons.length) {
+ $buttons.attr("data-selector", newID).data("selector", newID);
+ }
+ });
+ }
+ }
+
+ $elements.filter(":checked").removeAttr("checked");
+ $elements.find(":checked").removeAttr("checked");
+ $elements.filter(":selected").removeAttr("selected");
+ $elements.find(":selected").removeAttr("selected", false);
+
+ if ($row.find("h3.cmb-group-title").length) {
+ $row
+ .find("h3.cmb-group-title")
+ .text($row.data("title").replace("{#}", cmb.idNumber + 1));
+ }
+
+ $elements.each(function () {
+ cmb.elReplacements($(this), prevNum, group);
+ });
+
+ return cmb;
+ };
+
+ cmb.elReplacements = function ($newInput, prevNum, group) {
+ var oldFor = $newInput.attr("for");
+ var oldVal = $newInput.val();
+ var type = $newInput.prop("type");
+ var defVal = cmb.getFieldArg($newInput, "default");
+ var newVal =
+ "undefined" !== typeof defVal && false !== defVal ? defVal : "";
+ var tagName = $newInput.prop("tagName");
+ var checkable = "radio" === type || "checkbox" === type ? oldVal : false;
+ var attrs = {};
+ var newID, oldID;
+ if (oldFor) {
+ attrs = { for: oldFor.replace("_" + prevNum, "_" + cmb.idNumber) };
+ } else {
+ var oldName = $newInput.attr("name");
+ var newName;
+ oldID = $newInput.attr("id");
+
+ // Handle adding groups vs rows.
+ if (group) {
+ // Expect another bracket after group's index closing bracket.
+ newName = oldName
+ ? oldName.replace("[" + prevNum + "][", "[" + cmb.idNumber + "][")
+ : "";
+ // Expect another underscore after group's index trailing underscore.
+ newID = oldID
+ ? oldID.replace("_" + prevNum + "_", "_" + cmb.idNumber + "_")
+ : "";
+ } else {
+ // Row indexes are at the very end of the string.
+ newName = oldName
+ ? cmb.replaceLast(
+ oldName,
+ "[" + prevNum + "]",
+ "[" + cmb.idNumber + "]",
+ )
+ : "";
+ newID = oldID
+ ? cmb.replaceLast(oldID, "_" + prevNum, "_" + cmb.idNumber)
+ : "";
+ }
+
+ attrs = {
+ id: newID,
+ name: newName,
+ };
+ }
+
+ // Clear out textarea values
+ if ("TEXTAREA" === tagName) {
+ $newInput.html(newVal);
+ }
+
+ if ("SELECT" === tagName && "undefined" !== typeof defVal) {
+ var $toSelect = $newInput.find('[value="' + defVal + '"]');
+ if ($toSelect.length) {
+ $toSelect.attr("selected", "selected").prop("selected", "selected");
+ }
+ }
+
+ if (checkable) {
+ $newInput.removeAttr("checked");
+ if ("undefined" !== typeof defVal && oldVal === defVal) {
+ $newInput.attr("checked", "checked").prop("checked", "checked");
+ }
+ }
+
+ if (!group && $newInput[0].hasAttribute("data-iterator")) {
+ attrs["data-iterator"] = cmb.idNumber;
+ }
+
+ $newInput
+ .removeClass("hasDatepicker")
+ .val(checkable ? checkable : newVal)
+ .attr(attrs);
+
+ return $newInput;
+ };
+
+ cmb.newRowHousekeeping = function ($row) {
+ var $colorPicker = $row.find(".wp-picker-container");
+ var $list = $row.find(".cmb2-media-status");
+
+ if ($colorPicker.length) {
+ // Need to clean-up colorpicker before appending
+ $colorPicker.each(function () {
+ var $td = $(this).parent();
+ $td.html(
+ $td.find('input[type="text"].cmb2-colorpicker').attr("style", ""),
+ );
+ });
+ }
+
+ // Need to clean-up colorpicker before appending
+ if ($list.length) {
+ $list.empty();
+ }
+
+ return cmb;
+ };
+
+ cmb.afterRowInsert = function ($row) {
+ // Init pickers from new row
+ cmb.initPickers(
+ $row.find('input[type="text"].cmb2-timepicker'),
+ $row.find('input[type="text"].cmb2-datepicker'),
+ $row.find('input[type="text"].cmb2-colorpicker'),
+ );
+ };
+
+ cmb.updateNameAttr = function () {
+ var $this = $(this);
+ var name = $this.attr("name"); // get current name
+
+ // If name is defined
+ if ("undefined" !== typeof name) {
+ var prevNum = parseInt(
+ $this.parents(".cmb-repeatable-grouping").data("iterator"),
+ 10,
+ );
+ var newNum = prevNum - 1; // Subtract 1 to get new iterator number
+
+ // Update field name attributes so data is not orphaned when a row is removed and post is saved
+ var $newName = name.replace("[" + prevNum + "]", "[" + newNum + "]");
+
+ // New name with replaced iterator
+ $this.attr("name", $newName);
+ }
+ };
+
+ cmb.emptyValue = function (evt, row) {
+ $(cmb.noEmpty, row).val("");
+ };
+
+ cmb.setDefaults = function (evt, row) {
+ $(cmb.noEmpty, row).each(function () {
+ var $el = $(this);
+ var defVal = cmb.getFieldArg($el, "default");
+ if ("undefined" !== typeof defVal && false !== defVal) {
+ $el.val(defVal);
+ }
+ });
+ };
+
+ cmb.addGroupRow = function (evt) {
+ evt.preventDefault();
+
+ var $this = $(this);
+
+ // before anything significant happens
+ cmb.triggerElement($this, "cmb2_add_group_row_start", $this);
+
+ var $table = $id($this.data("selector"));
+ var $oldRow = $table.find(".cmb-repeatable-grouping").last();
+ var prevNum = parseInt($oldRow.data("iterator"), 10);
+ cmb.idNumber = parseInt(prevNum, 10) + 1;
+ var $row = $oldRow.clone();
+ var nodeName = $row.prop("nodeName") || "div";
+ var getRowId = function (id) {
+ id = id.split("-");
+ id.splice(id.length - 1, 1);
+ id.push(cmb.idNumber);
+ return id.join("-");
+ };
+
+ // Make sure the next number doesn't exist.
+ while (
+ $table.find(
+ '.cmb-repeatable-grouping[data-iterator="' + cmb.idNumber + '"]',
+ ).length > 0
+ ) {
+ cmb.idNumber++;
+ }
+
+ cmb
+ .newRowHousekeeping($row.data("title", $this.data("grouptitle")))
+ .cleanRow($row, prevNum, true);
+ $row.find(".cmb-add-row-button").prop("disabled", false);
+
+ var $newRow = $(
+ "<" +
+ nodeName +
+ ' id="' +
+ getRowId($oldRow.attr("id")) +
+ '" class="postbox cmb-row cmb-repeatable-grouping" data-iterator="' +
+ cmb.idNumber +
+ '">' +
+ $row.html() +
+ "" +
+ nodeName +
+ ">",
+ );
+ $oldRow.after($newRow);
+
+ cmb.afterRowInsert($newRow);
+
+ cmb.triggerElement($table, { type: "cmb2_add_row", group: true }, $newRow);
+ };
+
+ cmb.addAjaxRow = function (evt) {
+ evt.preventDefault();
+
+ var $this = $(this);
+ var $table = $id($this.data("selector"));
+ var $row = $table.find(".empty-row");
+ var prevNum = parseInt($row.find("[data-iterator]").data("iterator"), 10);
+ cmb.idNumber = parseInt(prevNum, 10) + 1;
+ var $emptyrow = $row.clone();
+
+ cmb.newRowHousekeeping($emptyrow).cleanRow($emptyrow, prevNum);
+
+ $row.removeClass("empty-row hidden").addClass("cmb-repeat-row");
+ $row.after($emptyrow);
+
+ cmb.afterRowInsert($emptyrow);
+
+ cmb.triggerElement(
+ $table,
+ { type: "cmb2_add_row", group: false },
+ $emptyrow,
+ $row,
+ );
+ };
+
+ cmb.removeGroupRow = function (evt) {
+ evt.preventDefault();
+
+ var $this = $(this);
+ var confirmation = $this.data("confirm");
+
+ // Process further only if deletion confirmation enabled and user agreed.
+ if (confirmation && !window.confirm(confirmation)) {
+ return;
+ }
+
+ var $table = $id($this.data("selector"));
+ var $parent = $this.parents(".cmb-repeatable-grouping");
+ var number = $table.find(".cmb-repeatable-grouping").length;
+
+ if (number < 2) {
+ return cmb.resetRow(
+ $parent.parents(".cmb-repeatable-group").find(".cmb-add-group-row"),
+ $this,
+ );
+ }
+
+ cmb.triggerElement($table, "cmb2_remove_group_row_start", $this);
+
+ // When a group is removed, loop through all next groups and update fields names.
+ $parent
+ .nextAll(".cmb-repeatable-grouping")
+ .find(cmb.repeatEls)
+ .each(cmb.updateNameAttr);
+
+ $parent.remove();
+
+ cmb.triggerElement($table, { type: "cmb2_remove_row", group: true });
+ };
+
+ cmb.removeAjaxRow = function (evt) {
+ evt.preventDefault();
+
+ var $this = $(this);
+
+ // Check if disabled
+ if ($this.hasClass("button-disabled")) {
+ return;
+ }
+
+ var $parent = $this.parents(".cmb-row");
+ var $table = $this.parents(".cmb-repeat-table");
+ var number = $table.find(".cmb-row").length;
+
+ if (number <= 2) {
+ return cmb.resetRow($parent.find(".cmb-add-row-button"), $this);
+ }
+
+ if ($parent.hasClass("empty-row")) {
+ $parent.prev().addClass("empty-row").removeClass("cmb-repeat-row");
+ }
+
+ $this.parents(".cmb-repeat-table .cmb-row").remove();
+
+ cmb.triggerElement($table, { type: "cmb2_remove_row", group: false });
+ };
+
+ cmb.resetRow = function ($addNewBtn, $removeBtn) {
+ // Click the "add new" button followed by the "remove this" button
+ // in order to reset the repeat row to empty values.
+ $addNewBtn.trigger("click");
+ $removeBtn.trigger("click");
+ };
+
+ cmb.shiftRows = function (evt) {
+ evt.preventDefault();
+
+ var $this = $(this);
+ var $from = $this.parents(".cmb-repeatable-grouping");
+ var $goto = $this.hasClass("move-up")
+ ? $from.prev(".cmb-repeatable-grouping")
+ : $from.next(".cmb-repeatable-grouping");
+
+ // Before shift occurs.
+ cmb.triggerElement($this, "cmb2_shift_rows_enter", $this, $from, $goto);
+
+ if (!$goto.length) {
+ return;
+ }
+
+ // About to shift
+ cmb.triggerElement($this, "cmb2_shift_rows_start", $this, $from, $goto);
+
+ var inputVals = [];
+ // Loop this item's fields
+ $from.find(cmb.repeatEls).each(function () {
+ var $element = $(this);
+ var elType = $element.attr("type");
+ var val;
+
+ if ($element.hasClass("cmb2-media-status")) {
+ // special case for image previews
+ val = $element.html();
+ } else if ("checkbox" === elType || "radio" === elType) {
+ val = $element.is(":checked");
+ } else if ("select" === $element.prop("tagName")) {
+ val = $element.is(":selected");
+ } else {
+ val = $element.val();
+ }
+
+ // Get all the current values per element
+ inputVals.push({ val: val, $: $element });
+ });
+ // And swap them all
+ $goto.find(cmb.repeatEls).each(function (index) {
+ var $element = $(this);
+ var elType = $element.attr("type");
+ var val;
+
+ if ($element.hasClass("cmb2-media-status")) {
+ var toRowId = $element
+ .closest(".cmb-repeatable-grouping")
+ .attr("data-iterator");
+ var fromRowId = inputVals[index].$.closest(
+ ".cmb-repeatable-grouping",
+ ).attr("data-iterator");
+
+ // special case for image previews
+ val = $element.html();
+ $element.html(inputVals[index].val);
+ inputVals[index].$.html(val);
+
+ inputVals[index].$.find("input").each(function () {
+ var name = $(this).attr("name");
+ name = name.replace("[" + toRowId + "]", "[" + fromRowId + "]");
+ $(this).attr("name", name);
+ });
+ $element.find("input").each(function () {
+ var name = $(this).attr("name");
+ name = name.replace("[" + fromRowId + "]", "[" + toRowId + "]");
+ $(this).attr("name", name);
+ });
+ }
+ // handle checkbox swapping
+ else if ("checkbox" === elType) {
+ inputVals[index].$.prop("checked", $element.is(":checked"));
+ $element.prop("checked", inputVals[index].val);
+ }
+ // handle radio swapping
+ else if ("radio" === elType) {
+ if ($element.is(":checked")) {
+ inputVals[index].$.attr("data-checked", "true");
+ }
+ if (inputVals[index].$.is(":checked")) {
+ $element.attr("data-checked", "true");
+ }
+ }
+ // handle select swapping
+ else if ("select" === $element.prop("tagName")) {
+ inputVals[index].$.prop("selected", $element.is(":selected"));
+ $element.prop("selected", inputVals[index].val);
+ }
+ // handle normal input swapping
+ else {
+ inputVals[index].$.val($element.val());
+ $element.val(inputVals[index].val);
+ }
+ });
+
+ $from
+ .find("input[data-checked=true]")
+ .prop("checked", true)
+ .removeAttr("data-checked");
+ $goto
+ .find("input[data-checked=true]")
+ .prop("checked", true)
+ .removeAttr("data-checked");
+
+ // trigger color picker change event
+ $from.find('input[type="text"].cmb2-colorpicker').trigger("change");
+ $goto.find('input[type="text"].cmb2-colorpicker').trigger("change");
+
+ // shift done
+ cmb.triggerElement($this, "cmb2_shift_rows_complete", $this, $from, $goto);
+ };
+
+ cmb.initPickers = function ($timePickers, $datePickers, $colorPickers) {
+ cmb.trigger("cmb_init_pickers", {
+ time: $timePickers,
+ date: $datePickers,
+ color: $colorPickers,
+ });
+
+ // Initialize jQuery UI timepickers
+ cmb.initDateTimePickers($timePickers, "timepicker", "time_picker");
+ // Initialize jQuery UI datepickers
+ cmb.initDateTimePickers($datePickers, "datepicker", "date_picker");
+ // Initialize color picker
+ cmb.initColorPickers($colorPickers);
+ };
+
+ cmb.initDateTimePickers = function ($selector, method, defaultKey) {
+ if ($selector.length) {
+ $selector[method]("destroy").each(function () {
+ var $this = $(this);
+ var fieldOpts = $this.data(method) || {};
+ var options = $.extend({}, cmb.defaults[defaultKey], fieldOpts);
+ $this[method](cmb.datePickerSetupOpts(fieldOpts, options, method));
+ });
+ }
+ };
+
+ cmb.datePickerSetupOpts = function (fieldOpts, options, method) {
+ var existing = $.extend({}, options);
+
+ options.beforeShow = function (input, inst) {
+ if ("timepicker" === method) {
+ cmb.addTimePickerClasses(inst.dpDiv);
+ }
+
+ // Wrap datepicker w/ class to narrow the scope of jQuery UI CSS and prevent conflicts
+ $id("ui-datepicker-div").addClass("cmb2-element");
+
+ // Let's be sure to call beforeShow if it was added
+ if ("function" === typeof existing.beforeShow) {
+ existing.beforeShow(input, inst);
+ }
+ };
+
+ if ("timepicker" === method) {
+ options.onChangeMonthYear = function (year, month, inst, picker) {
+ cmb.addTimePickerClasses(inst.dpDiv);
+
+ // Let's be sure to call onChangeMonthYear if it was added
+ if ("function" === typeof existing.onChangeMonthYear) {
+ existing.onChangeMonthYear(year, month, inst, picker);
+ }
+ };
+ }
+
+ options.onClose = function (dateText, inst) {
+ // Remove the class when we're done with it (and hide to remove FOUC).
+ var $picker = $id("ui-datepicker-div").removeClass("cmb2-element").hide();
+ if ("timepicker" === method && !$(inst.input).val()) {
+ // Set the timepicker field value if it's empty.
+ inst.input.val($picker.find(".ui_tpicker_time").text());
+ }
+
+ // Let's be sure to call onClose if it was added
+ if ("function" === typeof existing.onClose) {
+ existing.onClose(dateText, inst);
+ }
+ };
+
+ return options;
+ };
+
+ // Adds classes to timepicker buttons.
+ cmb.addTimePickerClasses = function ($picker) {
+ var func = cmb.addTimePickerClasses;
+ func.count = func.count || 0;
+
+ // Wait a bit to let the timepicker render, since these are pre-render events.
+ setTimeout(function () {
+ if ($picker.find(".ui-priority-secondary").length) {
+ $picker.find(".ui-priority-secondary").addClass("button-secondary");
+ $picker.find(".ui-priority-primary").addClass("button-primary");
+ func.count = 0;
+ } else if (func.count < 5) {
+ func.count++;
+ func($picker);
+ }
+ }, 10);
+ };
+
+ cmb.initColorPickers = function ($selector) {
+ if (!$selector.length) {
+ return;
+ }
+ if (
+ "object" === typeof jQuery.wp &&
+ "function" === typeof jQuery.wp.wpColorPicker
+ ) {
+ $selector.each(function () {
+ var $this = $(this);
+ var fieldOpts = $this.data("colorpicker") || {};
+ $this.wpColorPicker($.extend({}, cmb.defaults.color_picker, fieldOpts));
+ });
+ } else {
+ $selector
+ .each(function (i) {
+ $(this).after(
+ '
',
+ );
+ $id("picker-" + i)
+ .hide()
+ .farbtastic($(this));
+ })
+ .focus(function () {
+ $(this).next().show();
+ })
+ .blur(function () {
+ $(this).next().hide();
+ });
+ }
+ };
+
+ cmb.initCodeEditors = function ($selector) {
+ cmb.trigger("cmb_init_code_editors", $selector);
+
+ if (
+ !cmb.defaults.code_editor ||
+ !wp ||
+ !wp.codeEditor ||
+ !$selector.length
+ ) {
+ return;
+ }
+
+ $selector.each(function () {
+ wp.codeEditor.initialize(
+ this.id,
+ cmb.codeEditorArgs($(this).data("codeeditor")),
+ );
+ });
+ };
+
+ cmb.codeEditorArgs = function (overrides) {
+ var props = ["codemirror", "csslint", "jshint", "htmlhint"];
+ var args = $.extend({}, cmb.defaults.code_editor);
+ overrides = overrides || {};
+
+ for (var i = props.length - 1; i >= 0; i--) {
+ if (overrides.hasOwnProperty(props[i])) {
+ args[props[i]] = $.extend(
+ {},
+ args[props[i]] || {},
+ overrides[props[i]],
+ );
+ }
+ }
+
+ return args;
+ };
+
+ cmb.makeListSortable = function () {
+ var $filelist = cmb.metabox().find(".cmb2-media-status.cmb-attach-list");
+ if ($filelist.length) {
+ $filelist.sortable({ cursor: "move" }).disableSelection();
+ }
+ };
+
+ cmb.makeRepeatableSortable = function () {
+ var $repeatables = cmb.metabox().find(".cmb-repeat-table .cmb-field-list");
+
+ if ($repeatables.length) {
+ $repeatables.sortable({
+ items: ".cmb-repeat-row",
+ cursor: "move",
+ // The default "cancel" attributes are: "input,textarea,button,select,option".
+ // We are appending .CodeMirror.
+ // See https://api.jqueryui.com/sortable/#option-cancel
+ cancel: "input,textarea,button,select,option,.CodeMirror",
+ });
+ }
+ };
+
+ cmb.maybeOembed = function (evt) {
+ var $this = $(this);
+
+ var m = {
+ focusout: function () {
+ setTimeout(function () {
+ // if it's been 2 seconds, hide our spinner
+ cmb.spinner(".cmb2-metabox", true);
+ }, 2000);
+ },
+ keyup: function () {
+ var betw = function (min, max) {
+ return evt.which <= max && evt.which >= min;
+ };
+ // Only Ajax on normal keystrokes
+ if (
+ betw(48, 90) ||
+ betw(96, 111) ||
+ betw(8, 9) ||
+ evt.which === 187 ||
+ evt.which === 190
+ ) {
+ // fire our ajax function
+ cmb.doAjax($this, evt);
+ }
+ },
+ paste: function () {
+ // paste event is fired before the value is filled, so wait a bit
+ setTimeout(function () {
+ cmb.doAjax($this);
+ }, 100);
+ },
+ };
+
+ m[evt.type]();
+ };
+
+ /**
+ * Resize oEmbed videos to fit in their respective metaboxes
+ *
+ * @since 0.9.4
+ *
+ * @return {return}
+ */
+ cmb.resizeoEmbeds = function () {
+ cmb.metabox().each(function () {
+ var $this = $(this);
+ var $tableWrap = $this.parents(".inside");
+ var isSide =
+ $this.parents(".inner-sidebar").length ||
+ $this.parents("#side-sortables").length;
+ var isSmall = isSide;
+ var isSmallest = false;
+ if (!$tableWrap.length) {
+ return true; // continue
+ }
+
+ // Calculate new width
+ var tableW = $tableWrap.width();
+
+ if (cmb.styleBreakPoint > tableW) {
+ isSmall = true;
+ isSmallest = cmb.styleBreakPoint - 62 > tableW;
+ }
+
+ tableW = isSmall ? tableW : Math.round($tableWrap.width() * 0.82 * 0.97);
+ var newWidth = tableW - 30;
+ if (isSmall && !isSide && !isSmallest) {
+ newWidth = newWidth - 75;
+ }
+ if (newWidth > 639) {
+ return true; // continue
+ }
+
+ var $embeds = $this.find(".cmb-type-oembed .embed-status");
+ var $children = $embeds.children().not(".cmb2-remove-wrapper");
+ if (!$children.length) {
+ return true; // continue
+ }
+
+ $children.each(function () {
+ var $this = $(this);
+ var iwidth = $this.width();
+ var iheight = $this.height();
+ var _newWidth = newWidth;
+ if ($this.parents(".cmb-repeat-row").length && !isSmall) {
+ // Make room for our repeatable "remove" button column
+ _newWidth = newWidth - 91;
+ _newWidth = 785 > tableW ? _newWidth - 15 : _newWidth;
+ }
+ // Calc new height
+ var newHeight = Math.round((_newWidth * iheight) / iwidth);
+ $this.width(_newWidth).height(newHeight);
+ });
+ });
+ };
+
+ // function for running our ajax
+ cmb.doAjax = function ($obj) {
+ // get typed value
+ var oembed_url = $obj.val();
+ // only proceed if the field contains more than 6 characters
+ if (oembed_url.length < 6) {
+ return;
+ }
+
+ // get field id
+ var field_id = $obj.attr("id");
+ var $context = $obj.closest(".cmb-td");
+ var $embed_container = $context.find(".embed-status");
+ var $embed_wrap = $context.find(".embed_wrap");
+ var $child_el = $embed_container.find(":first-child");
+ var oembed_width =
+ $embed_container.length && $child_el.length
+ ? $child_el.width()
+ : $obj.width();
+
+ cmb.log("oembed_url", oembed_url, field_id);
+
+ // show our spinner
+ cmb.spinner($context);
+ // clear out previous results
+ $embed_wrap.html("");
+ // and run our ajax function
+ setTimeout(function () {
+ // if they haven't typed in 500 ms
+ if ($(".cmb2-oembed:focus").val() !== oembed_url) {
+ return;
+ }
+ $.ajax({
+ type: "post",
+ dataType: "json",
+ url: l10n.ajaxurl,
+ data: {
+ action: "cmb2_oembed_handler",
+ oembed_url: oembed_url,
+ oembed_width: oembed_width > 300 ? oembed_width : 300,
+ field_id: field_id,
+ object_id: $obj.data("objectid"),
+ object_type: $obj.data("objecttype"),
+ cmb2_ajax_nonce: l10n.ajax_nonce,
+ },
+ success: function (response) {
+ cmb.log(response);
+ // hide our spinner
+ cmb.spinner($context, true);
+ // and populate our results from ajax response
+ $embed_wrap.html(response.data);
+ },
+ });
+ }, 500);
+ };
+
+ /**
+ * Gets jQuery object containing all CMB metaboxes. Caches the result.
+ *
+ * @since 1.0.2
+ *
+ * @return {Object} jQuery object containing all CMB metaboxes.
+ */
+ cmb.metabox = function () {
+ if (cmb.$metabox) {
+ return cmb.$metabox;
+ }
+ cmb.$metabox = $(".cmb2-wrap > .cmb2-metabox");
+ return cmb.$metabox;
+ };
+
+ /**
+ * Starts/stops contextual spinner.
+ *
+ * @since 1.0.1
+ *
+ * @param {object} $context The jQuery parent/context object.
+ * @param {bool} hide Whether to hide the spinner (will show by default).
+ *
+ * @return {void}
+ */
+ cmb.spinner = function ($context, hide) {
+ var m = hide ? "removeClass" : "addClass";
+ $(".cmb-spinner", $context)[m]("is-active");
+ };
+
+ /**
+ * Triggers a jQuery event on the document object.
+ *
+ * @since 2.2.3
+ *
+ * @param {string} evtName The name of the event to trigger.
+ *
+ * @return {void}
+ */
+ cmb.trigger = function (evtName) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ args.push(cmb);
+ $document.trigger(evtName, args);
+ };
+
+ /**
+ * Triggers a jQuery event on the given jQuery object.
+ *
+ * @since 2.2.3
+ *
+ * @param {object} $el The jQuery element object.
+ * @param {string} evtName The name of the event to trigger.
+ *
+ * @return {void}
+ */
+ cmb.triggerElement = function ($el, evtName) {
+ var args = Array.prototype.slice.call(arguments, 2);
+ args.push(cmb);
+ $el.trigger(evtName, args);
+ };
+
+ /**
+ * Get an argument for a given field.
+ *
+ * @since 2.5.0
+ *
+ * @param {string|object} hash The field hash, id, or a jQuery object for a field.
+ * @param {string} arg The argument to get on the field.
+ *
+ * @return {mixed} The argument value.
+ */
+ cmb.getFieldArg = function (hash, arg) {
+ return cmb.getField(hash)[arg];
+ };
+
+ /**
+ * Get a field object instances. Can be filtered by passing in a filter callback function.
+ * e.g. `const fileFields = CMB2.getFields(f => 'file' === f.type);`
+ *
+ * @since 2.5.0
+ *
+ * @param {mixed} filterCb An optional filter callback function.
+ *
+ * @return array An array of field object instances.
+ */
+ cmb.getFields = function (filterCb) {
+ if ("function" === typeof filterCb) {
+ var fields = [];
+ $.each(l10n.fields, function (hash, field) {
+ if (filterCb(field, hash)) {
+ fields.push(field);
+ }
+ });
+ return fields;
+ }
+
+ return l10n.fields;
+ };
+
+ /**
+ * Get a field object instance by hash or id.
+ *
+ * @since 2.5.0
+ *
+ * @param {string|object} hash The field hash, id, or a jQuery object for a field.
+ *
+ * @return {object} The field object or an empty object.
+ */
+ cmb.getField = function (hash) {
+ var field = {};
+ hash = hash instanceof jQuery ? hash.data("hash") : hash;
+ if (hash) {
+ try {
+ if (l10n.fields[hash]) {
+ throw new Error(hash);
+ }
+
+ cmb.getFields(function (field) {
+ if ("function" === typeof hash) {
+ if (hash(field)) {
+ throw new Error(field.hash);
+ }
+ } else if (field.id && field.id === hash) {
+ throw new Error(field.hash);
+ }
+ });
+ } catch (e) {
+ field = l10n.fields[e.message];
+ }
+ }
+
+ return field;
+ };
+
+ /**
+ * Safely log things if query var is set. Accepts same parameters as console.log.
+ *
+ * @since 1.0.0
+ *
+ * @return {void}
+ */
+ cmb.log = function () {
+ if (l10n.script_debug && console && "function" === typeof console.log) {
+ console.log.apply(console, arguments);
+ }
+ };
+
+ /**
+ * Replace the last occurrence of a string.
+ *
+ * @since 2.2.6
+ *
+ * @param {string} string String to search/replace.
+ * @param {string} search String to search.
+ * @param {string} replace String to replace search with.
+ *
+ * @return {string} Possibly modified string.
+ */
+ cmb.replaceLast = function (string, search, replace) {
+ // find the index of last time word was used
+ var n = string.lastIndexOf(search);
+
+ // slice the string in 2, one from the start to the lastIndexOf
+ // and then replace the word in the rest
+ return string.slice(0, n) + string.slice(n).replace(search, replace);
+ };
+
+ // Kick it off!
+ $(cmb.init);
})(window, document, jQuery, window.CMB2);
diff --git a/public/includes/lib/CMB2/js/wp-color-picker-alpha.js b/public/includes/lib/CMB2/js/wp-color-picker-alpha.js
index 2b4a5cb..946f32c 100755
--- a/public/includes/lib/CMB2/js/wp-color-picker-alpha.js
+++ b/public/includes/lib/CMB2/js/wp-color-picker-alpha.js
@@ -8,489 +8,520 @@
* https://github.com/kallookoo/wp-color-picker-alpha
* Licensed under the GPLv2 license.
*/
-( function( $ ) {
- // Prevent double-init.
- if ( $.wp.wpColorPicker.prototype._hasAlpha ) {
- return;
- }
-
- // Variable for some backgrounds ( grid )
- var image = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==',
- // html stuff for wpColorPicker copy of the original color-picker.js
- _after = '
',
- _wrap = '
',
- _button = ' ',
- // Prevent CSS issues in < WordPress 4.9
- _deprecated = ( wpColorPickerL10n.current !== undefined );
- // Declare some global variables when is deprecated or not
- if ( _deprecated ) {
- var _before = ' ';
- } else {
- var _before = ' ',
- _wrappingLabel = ' ',
- _wrappingLabelText = ' ';
- }
- /**
- * Overwrite Color
- * for enable support rbga
- */
- Color.fn.toString = function() {
- if ( this._alpha < 1 )
- return this.toCSS( 'rgba', this._alpha ).replace( /\s+/g, '' );
-
- var hex = parseInt( this._color, 10 ).toString( 16 );
-
- if ( this.error )
- return '';
-
- if ( hex.length < 6 )
- hex = ( '00000' + hex ).substr( -6 );
-
- return '#' + hex;
- };
-
- /**
- * Overwrite wpColorPicker
- */
- $.widget( 'wp.wpColorPicker', $.wp.wpColorPicker, {
- _hasAlpha: true,
- /**
- * @summary Creates the color picker.
- *
- * Creates the color picker, sets default values, css classes and wraps it all in HTML.
- *
- * @since 3.5.0
- *
- * @access private
- *
- * @returns {void}
- */
- _create: function() {
- // Return early if Iris support is missing.
- if ( ! $.support.iris ) {
- return;
- }
-
- var self = this,
- el = self.element;
-
- // Override default options with options bound to the element.
- $.extend( self.options, el.data() );
-
- // Create a color picker which only allows adjustments to the hue.
- if ( self.options.type === 'hue' ) {
- return self._createHueOnly();
- }
-
- // Bind the close event.
- self.close = $.proxy( self.close, self );
-
- self.initialValue = el.val();
-
- // Add a CSS class to the input field.
- el.addClass( 'wp-color-picker' );
-
- if ( _deprecated ) {
- el.hide().wrap( _wrap );
- self.wrap = el.parent();
- self.toggler = $( _before )
- .insertBefore( el )
- .css( { backgroundColor : self.initialValue } )
- .attr( 'title', wpColorPickerL10n.pick )
- .attr( 'data-current', wpColorPickerL10n.current );
- self.pickerContainer = $( _after ).insertAfter( el );
- self.button = $( _button ).addClass('hidden');
- } else {
- /*
- * Check if there's already a wrapping label, e.g. in the Customizer.
- * If there's no label, add a default one to match the Customizer template.
- */
- if ( ! el.parent( 'label' ).length ) {
- // Wrap the input field in the default label.
- el.wrap( _wrappingLabel );
- // Insert the default label text.
- self.wrappingLabelText = $( _wrappingLabelText )
- .insertBefore( el )
- .text( wpColorPickerL10n.defaultLabel );
- }
-
- /*
- * At this point, either it's the standalone version or the Customizer
- * one, we have a wrapping label to use as hook in the DOM, let's store it.
- */
- self.wrappingLabel = el.parent();
-
- // Wrap the label in the main wrapper.
- self.wrappingLabel.wrap( _wrap );
- // Store a reference to the main wrapper.
- self.wrap = self.wrappingLabel.parent();
- // Set up the toggle button and insert it before the wrapping label.
- self.toggler = $( _before )
- .insertBefore( self.wrappingLabel )
- .css( { backgroundColor: self.initialValue } );
- // Set the toggle button span element text.
- self.toggler.find( '.wp-color-result-text' ).text( wpColorPickerL10n.pick );
- // Set up the Iris container and insert it after the wrapping label.
- self.pickerContainer = $( _after ).insertAfter( self.wrappingLabel );
- // Store a reference to the Clear/Default button.
- self.button = $( _button );
- }
-
- // Set up the Clear/Default button.
- if ( self.options.defaultColor ) {
- self.button.addClass( 'wp-picker-default' ).val( wpColorPickerL10n.defaultString );
- if ( ! _deprecated ) {
- self.button.attr( 'aria-label', wpColorPickerL10n.defaultAriaLabel );
- }
- } else {
- self.button.addClass( 'wp-picker-clear' ).val( wpColorPickerL10n.clear );
- if ( ! _deprecated ) {
- self.button.attr( 'aria-label', wpColorPickerL10n.clearAriaLabel );
- }
- }
-
- if ( _deprecated ) {
- el.wrap( ' ' ).after( self.button );
- } else {
- // Wrap the wrapping label in its wrapper and append the Clear/Default button.
- self.wrappingLabel
- .wrap( ' ' )
- .after( self.button );
-
- /*
- * The input wrapper now contains the label+input+Clear/Default button.
- * Store a reference to the input wrapper: we'll use this to toggle
- * the controls visibility.
- */
- self.inputWrapper = el.closest( '.wp-picker-input-wrap' );
- }
-
- el.iris( {
- target: self.pickerContainer,
- hide: self.options.hide,
- width: self.options.width,
- mode: self.options.mode,
- palettes: self.options.palettes,
- /**
- * @summary Handles the onChange event if one has been defined in the options.
- *
- * Handles the onChange event if one has been defined in the options and additionally
- * sets the background color for the toggler element.
- *
- * @since 3.5.0
- *
- * @param {Event} event The event that's being called.
- * @param {HTMLElement} ui The HTMLElement containing the color picker.
- *
- * @returns {void}
- */
- change: function( event, ui ) {
- if ( self.options.alpha ) {
- self.toggler.css( { 'background-image' : 'url(' + image + ')' } );
- if ( _deprecated ) {
- self.toggler.html( ' ' );
- } else {
- self.toggler.css( {
- 'position' : 'relative'
- } );
- if ( self.toggler.find('span.color-alpha').length == 0 ) {
- self.toggler.append(' ');
- }
- }
-
- self.toggler.find( 'span.color-alpha' ).css( {
- 'width' : '30px',
- 'position' : 'absolute',
- 'top' : 0,
- 'bottom' : 0,
- 'left' : 0,
- 'border-top-left-radius' : '2px',
- 'border-bottom-left-radius' : '2px',
- 'background' : ui.color.toString()
- } );
- } else {
- self.toggler.css( { backgroundColor : ui.color.toString() } );
- }
-
- if ( $.isFunction( self.options.change ) ) {
- self.options.change.call( this, event, ui );
- }
- }
- } );
-
- el.val( self.initialValue );
- self._addListeners();
-
- // Force the color picker to always be closed on initial load.
- if ( ! self.options.hide ) {
- self.toggler.click();
- }
- },
- /**
- * @summary Binds event listeners to the color picker.
- *
- * @since 3.5.0
- *
- * @access private
- *
- * @returns {void}
- */
- _addListeners: function() {
- var self = this;
-
- /**
- * @summary Prevent any clicks inside this widget from leaking to the top and closing it.
- *
- * @since 3.5.0
- *
- * @param {Event} event The event that's being called.
- *
- * @returs {void}
- */
- self.wrap.on( 'click.wpcolorpicker', function( event ) {
- event.stopPropagation();
- });
-
- /**
- * @summary Open or close the color picker depending on the class.
- *
- * @since 3.5
- */
- self.toggler.click( function(){
- if ( self.toggler.hasClass( 'wp-picker-open' ) ) {
- self.close();
- } else {
- self.open();
- }
- });
-
- /**
- * @summary Checks if value is empty when changing the color in the color picker.
- *
- * Checks if value is empty when changing the color in the color picker.
- * If so, the background color is cleared.
- *
- * @since 3.5.0
- *
- * @param {Event} event The event that's being called.
- *
- * @returns {void}
- */
- self.element.on( 'change', function( event ) {
- // Empty or Error = clear
- if ( $( this ).val() === '' || self.element.hasClass( 'iris-error' ) ) {
- if ( self.options.alpha ) {
- if ( _deprecated ) {
- self.toggler.removeAttr( 'style' );
- }
- self.toggler.find( 'span.color-alpha' ).css( 'backgroundColor', '' );
- } else {
- self.toggler.css( 'backgroundColor', '' );
- }
-
- // fire clear callback if we have one
- if ( $.isFunction( self.options.clear ) )
- self.options.clear.call( this, event );
- }
- } );
-
- /**
- * @summary Enables the user to clear or revert the color in the color picker.
- *
- * Enables the user to either clear the color in the color picker or revert back to the default color.
- *
- * @since 3.5.0
- *
- * @param {Event} event The event that's being called.
- *
- * @returns {void}
- */
- self.button.on( 'click', function( event ) {
- if ( $( this ).hasClass( 'wp-picker-clear' ) ) {
- self.element.val( '' );
- if ( self.options.alpha ) {
- if ( _deprecated ) {
- self.toggler.removeAttr( 'style' );
- }
- self.toggler.find( 'span.color-alpha' ).css( 'backgroundColor', '' );
- } else {
- self.toggler.css( 'backgroundColor', '' );
- }
-
- if ( $.isFunction( self.options.clear ) )
- self.options.clear.call( this, event );
-
- } else if ( $( this ).hasClass( 'wp-picker-default' ) ) {
- self.element.val( self.options.defaultColor ).change();
- }
- });
- },
- });
-
- /**
- * Overwrite iris
- */
- $.widget( 'a8c.iris', $.a8c.iris, {
- _create: function() {
- this._super();
-
- // Global option for check is mode rbga is enabled
- this.options.alpha = this.element.data( 'alpha' ) || false;
-
- // Is not input disabled
- if ( ! this.element.is( ':input' ) )
- this.options.alpha = false;
-
- if ( typeof this.options.alpha !== 'undefined' && this.options.alpha ) {
- var self = this,
- el = self.element,
- _html = '',
- aContainer = $( _html ).appendTo( self.picker.find( '.iris-picker-inner' ) ),
- aSlider = aContainer.find( '.iris-slider-offset-alpha' ),
- controls = {
- aContainer : aContainer,
- aSlider : aSlider
- };
-
- if ( typeof el.data( 'custom-width' ) !== 'undefined' ) {
- self.options.customWidth = parseInt( el.data( 'custom-width' ) ) || 0;
- } else {
- self.options.customWidth = 100;
- }
-
- // Set default width for input reset
- self.options.defaultWidth = el.width();
-
- // Update width for input
- if ( self._color._alpha < 1 || self._color.toString().indexOf('rgb') != -1 )
- el.width( parseInt( self.options.defaultWidth + self.options.customWidth ) );
-
- // Push new controls
- $.each( controls, function( k, v ) {
- self.controls[k] = v;
- } );
-
- // Change size strip and add margin for sliders
- self.controls.square.css( { 'margin-right': '0' } );
- var emptyWidth = ( self.picker.width() - self.controls.square.width() - 20 ),
- stripsMargin = ( emptyWidth / 6 ),
- stripsWidth = ( ( emptyWidth / 2 ) - stripsMargin );
-
- $.each( [ 'aContainer', 'strip' ], function( k, v ) {
- self.controls[v].width( stripsWidth ).css( { 'margin-left' : stripsMargin + 'px' } );
- } );
-
- // Add new slider
- self._initControls();
-
- // For updated widget
- self._change();
- }
- },
- _initControls: function() {
- this._super();
-
- if ( this.options.alpha ) {
- var self = this,
- controls = self.controls;
-
- controls.aSlider.slider({
- orientation : 'vertical',
- min : 0,
- max : 100,
- step : 1,
- value : parseInt( self._color._alpha * 100 ),
- slide : function( event, ui ) {
- // Update alpha value
- self._color._alpha = parseFloat( ui.value / 100 );
- self._change.apply( self, arguments );
- }
- });
- }
- },
- _change: function() {
- this._super();
-
- var self = this,
- el = self.element;
-
- if ( this.options.alpha ) {
- var controls = self.controls,
- alpha = parseInt( self._color._alpha * 100 ),
- color = self._color.toRgb(),
- gradient = [
- 'rgb(' + color.r + ',' + color.g + ',' + color.b + ') 0%',
- 'rgba(' + color.r + ',' + color.g + ',' + color.b + ', 0) 100%'
- ],
- defaultWidth = self.options.defaultWidth,
- customWidth = self.options.customWidth,
- target = self.picker.closest( '.wp-picker-container' ).find( '.wp-color-result' );
-
- // Generate background slider alpha, only for CSS3 old browser fuck!! :)
- controls.aContainer.css( { 'background' : 'linear-gradient(to bottom, ' + gradient.join( ', ' ) + '), url(' + image + ')' } );
-
- if ( target.hasClass( 'wp-picker-open' ) ) {
- // Update alpha value
- controls.aSlider.slider( 'value', alpha );
-
- /**
- * Disabled change opacity in default slider Saturation ( only is alpha enabled )
- * and change input width for view all value
- */
- if ( self._color._alpha < 1 ) {
- controls.strip.attr( 'style', controls.strip.attr( 'style' ).replace( /rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g, 'rgb($1$3$5)' ) );
- el.width( parseInt( defaultWidth + customWidth ) );
- } else {
- el.width( defaultWidth );
- }
- }
- }
-
- var reset = el.data( 'reset-alpha' ) || false;
-
- if ( reset ) {
- self.picker.find( '.iris-palette-container' ).on( 'click.palette', '.iris-palette', function() {
- self._color._alpha = 1;
- self.active = 'external';
- self._change();
- } );
- }
- },
- _addInputListeners: function( input ) {
- var self = this,
- debounceTimeout = 100,
- callback = function( event ) {
- var color = new Color( input.val() ),
- val = input.val();
-
- input.removeClass( 'iris-error' );
- // we gave a bad color
- if ( color.error ) {
- // don't error on an empty input
- if ( val !== '' )
- input.addClass( 'iris-error' );
- } else {
- if ( color.toString() !== self._color.toString() ) {
- // let's not do this on keyup for hex shortcodes
- if ( ! ( event.type === 'keyup' && val.match( /^[0-9a-fA-F]{3}$/ ) ) )
- self._setOption( 'color', color.toString() );
- }
- }
- };
-
- input.on( 'change', callback ).on( 'keyup', self._debounce( callback, debounceTimeout ) );
-
- // If we initialized hidden, show on first focus. The rest is up to you.
- if ( self.options.hide ) {
- input.on( 'focus', function() {
- self.show();
- } );
- }
- }
- } );
-}( jQuery ) );
+(function ($) {
+ // Prevent double-init.
+ if ($.wp.wpColorPicker.prototype._hasAlpha) {
+ return;
+ }
+
+ // Variable for some backgrounds ( grid )
+ var image =
+ "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",
+ // html stuff for wpColorPicker copy of the original color-picker.js
+ _after = '
',
+ _wrap = '
',
+ _button = ' ',
+ // Prevent CSS issues in < WordPress 4.9
+ _deprecated = wpColorPickerL10n.current !== undefined;
+ // Declare some global variables when is deprecated or not
+ if (_deprecated) {
+ var _before = ' ';
+ } else {
+ var _before =
+ ' ',
+ _wrappingLabel = " ",
+ _wrappingLabelText = ' ';
+ }
+ /**
+ * Overwrite Color
+ * for enable support rbga
+ */
+ Color.fn.toString = function () {
+ if (this._alpha < 1)
+ return this.toCSS("rgba", this._alpha).replace(/\s+/g, "");
+
+ var hex = parseInt(this._color, 10).toString(16);
+
+ if (this.error) return "";
+
+ if (hex.length < 6) hex = ("00000" + hex).substr(-6);
+
+ return "#" + hex;
+ };
+
+ /**
+ * Overwrite wpColorPicker
+ */
+ $.widget("wp.wpColorPicker", $.wp.wpColorPicker, {
+ _hasAlpha: true,
+ /**
+ * @summary Creates the color picker.
+ *
+ * Creates the color picker, sets default values, css classes and wraps it all in HTML.
+ *
+ * @since 3.5.0
+ *
+ * @access private
+ *
+ * @returns {void}
+ */
+ _create: function () {
+ // Return early if Iris support is missing.
+ if (!$.support.iris) {
+ return;
+ }
+
+ var self = this,
+ el = self.element;
+
+ // Override default options with options bound to the element.
+ $.extend(self.options, el.data());
+
+ // Create a color picker which only allows adjustments to the hue.
+ if (self.options.type === "hue") {
+ return self._createHueOnly();
+ }
+
+ // Bind the close event.
+ self.close = $.proxy(self.close, self);
+
+ self.initialValue = el.val();
+
+ // Add a CSS class to the input field.
+ el.addClass("wp-color-picker");
+
+ if (_deprecated) {
+ el.hide().wrap(_wrap);
+ self.wrap = el.parent();
+ self.toggler = $(_before)
+ .insertBefore(el)
+ .css({ backgroundColor: self.initialValue })
+ .attr("title", wpColorPickerL10n.pick)
+ .attr("data-current", wpColorPickerL10n.current);
+ self.pickerContainer = $(_after).insertAfter(el);
+ self.button = $(_button).addClass("hidden");
+ } else {
+ /*
+ * Check if there's already a wrapping label, e.g. in the Customizer.
+ * If there's no label, add a default one to match the Customizer template.
+ */
+ if (!el.parent("label").length) {
+ // Wrap the input field in the default label.
+ el.wrap(_wrappingLabel);
+ // Insert the default label text.
+ self.wrappingLabelText = $(_wrappingLabelText)
+ .insertBefore(el)
+ .text(wpColorPickerL10n.defaultLabel);
+ }
+
+ /*
+ * At this point, either it's the standalone version or the Customizer
+ * one, we have a wrapping label to use as hook in the DOM, let's store it.
+ */
+ self.wrappingLabel = el.parent();
+
+ // Wrap the label in the main wrapper.
+ self.wrappingLabel.wrap(_wrap);
+ // Store a reference to the main wrapper.
+ self.wrap = self.wrappingLabel.parent();
+ // Set up the toggle button and insert it before the wrapping label.
+ self.toggler = $(_before)
+ .insertBefore(self.wrappingLabel)
+ .css({ backgroundColor: self.initialValue });
+ // Set the toggle button span element text.
+ self.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick);
+ // Set up the Iris container and insert it after the wrapping label.
+ self.pickerContainer = $(_after).insertAfter(self.wrappingLabel);
+ // Store a reference to the Clear/Default button.
+ self.button = $(_button);
+ }
+
+ // Set up the Clear/Default button.
+ if (self.options.defaultColor) {
+ self.button
+ .addClass("wp-picker-default")
+ .val(wpColorPickerL10n.defaultString);
+ if (!_deprecated) {
+ self.button.attr("aria-label", wpColorPickerL10n.defaultAriaLabel);
+ }
+ } else {
+ self.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear);
+ if (!_deprecated) {
+ self.button.attr("aria-label", wpColorPickerL10n.clearAriaLabel);
+ }
+ }
+
+ if (_deprecated) {
+ el.wrap(' ').after(self.button);
+ } else {
+ // Wrap the wrapping label in its wrapper and append the Clear/Default button.
+ self.wrappingLabel
+ .wrap(' ')
+ .after(self.button);
+
+ /*
+ * The input wrapper now contains the label+input+Clear/Default button.
+ * Store a reference to the input wrapper: we'll use this to toggle
+ * the controls visibility.
+ */
+ self.inputWrapper = el.closest(".wp-picker-input-wrap");
+ }
+
+ el.iris({
+ target: self.pickerContainer,
+ hide: self.options.hide,
+ width: self.options.width,
+ mode: self.options.mode,
+ palettes: self.options.palettes,
+ /**
+ * @summary Handles the onChange event if one has been defined in the options.
+ *
+ * Handles the onChange event if one has been defined in the options and additionally
+ * sets the background color for the toggler element.
+ *
+ * @since 3.5.0
+ *
+ * @param {Event} event The event that's being called.
+ * @param {HTMLElement} ui The HTMLElement containing the color picker.
+ *
+ * @returns {void}
+ */
+ change: function (event, ui) {
+ if (self.options.alpha) {
+ self.toggler.css({ "background-image": "url(" + image + ")" });
+ if (_deprecated) {
+ self.toggler.html(' ');
+ } else {
+ self.toggler.css({
+ position: "relative",
+ });
+ if (self.toggler.find("span.color-alpha").length == 0) {
+ self.toggler.append(' ');
+ }
+ }
+
+ self.toggler.find("span.color-alpha").css({
+ width: "30px",
+ position: "absolute",
+ top: 0,
+ bottom: 0,
+ left: 0,
+ "border-top-left-radius": "2px",
+ "border-bottom-left-radius": "2px",
+ background: ui.color.toString(),
+ });
+ } else {
+ self.toggler.css({ backgroundColor: ui.color.toString() });
+ }
+
+ if ($.isFunction(self.options.change)) {
+ self.options.change.call(this, event, ui);
+ }
+ },
+ });
+
+ el.val(self.initialValue);
+ self._addListeners();
+
+ // Force the color picker to always be closed on initial load.
+ if (!self.options.hide) {
+ self.toggler.click();
+ }
+ },
+ /**
+ * @summary Binds event listeners to the color picker.
+ *
+ * @since 3.5.0
+ *
+ * @access private
+ *
+ * @returns {void}
+ */
+ _addListeners: function () {
+ var self = this;
+
+ /**
+ * @summary Prevent any clicks inside this widget from leaking to the top and closing it.
+ *
+ * @since 3.5.0
+ *
+ * @param {Event} event The event that's being called.
+ *
+ * @returs {void}
+ */
+ self.wrap.on("click.wpcolorpicker", function (event) {
+ event.stopPropagation();
+ });
+
+ /**
+ * @summary Open or close the color picker depending on the class.
+ *
+ * @since 3.5
+ */
+ self.toggler.click(function () {
+ if (self.toggler.hasClass("wp-picker-open")) {
+ self.close();
+ } else {
+ self.open();
+ }
+ });
+
+ /**
+ * @summary Checks if value is empty when changing the color in the color picker.
+ *
+ * Checks if value is empty when changing the color in the color picker.
+ * If so, the background color is cleared.
+ *
+ * @since 3.5.0
+ *
+ * @param {Event} event The event that's being called.
+ *
+ * @returns {void}
+ */
+ self.element.on("change", function (event) {
+ // Empty or Error = clear
+ if ($(this).val() === "" || self.element.hasClass("iris-error")) {
+ if (self.options.alpha) {
+ if (_deprecated) {
+ self.toggler.removeAttr("style");
+ }
+ self.toggler.find("span.color-alpha").css("backgroundColor", "");
+ } else {
+ self.toggler.css("backgroundColor", "");
+ }
+
+ // fire clear callback if we have one
+ if ($.isFunction(self.options.clear))
+ self.options.clear.call(this, event);
+ }
+ });
+
+ /**
+ * @summary Enables the user to clear or revert the color in the color picker.
+ *
+ * Enables the user to either clear the color in the color picker or revert back to the default color.
+ *
+ * @since 3.5.0
+ *
+ * @param {Event} event The event that's being called.
+ *
+ * @returns {void}
+ */
+ self.button.on("click", function (event) {
+ if ($(this).hasClass("wp-picker-clear")) {
+ self.element.val("");
+ if (self.options.alpha) {
+ if (_deprecated) {
+ self.toggler.removeAttr("style");
+ }
+ self.toggler.find("span.color-alpha").css("backgroundColor", "");
+ } else {
+ self.toggler.css("backgroundColor", "");
+ }
+
+ if ($.isFunction(self.options.clear))
+ self.options.clear.call(this, event);
+ } else if ($(this).hasClass("wp-picker-default")) {
+ self.element.val(self.options.defaultColor).change();
+ }
+ });
+ },
+ });
+
+ /**
+ * Overwrite iris
+ */
+ $.widget("a8c.iris", $.a8c.iris, {
+ _create: function () {
+ this._super();
+
+ // Global option for check is mode rbga is enabled
+ this.options.alpha = this.element.data("alpha") || false;
+
+ // Is not input disabled
+ if (!this.element.is(":input")) this.options.alpha = false;
+
+ if (typeof this.options.alpha !== "undefined" && this.options.alpha) {
+ var self = this,
+ el = self.element,
+ _html =
+ '',
+ aContainer = $(_html).appendTo(
+ self.picker.find(".iris-picker-inner"),
+ ),
+ aSlider = aContainer.find(".iris-slider-offset-alpha"),
+ controls = {
+ aContainer: aContainer,
+ aSlider: aSlider,
+ };
+
+ if (typeof el.data("custom-width") !== "undefined") {
+ self.options.customWidth = parseInt(el.data("custom-width")) || 0;
+ } else {
+ self.options.customWidth = 100;
+ }
+
+ // Set default width for input reset
+ self.options.defaultWidth = el.width();
+
+ // Update width for input
+ if (
+ self._color._alpha < 1 ||
+ self._color.toString().indexOf("rgb") != -1
+ )
+ el.width(
+ parseInt(self.options.defaultWidth + self.options.customWidth),
+ );
+
+ // Push new controls
+ $.each(controls, function (k, v) {
+ self.controls[k] = v;
+ });
+
+ // Change size strip and add margin for sliders
+ self.controls.square.css({ "margin-right": "0" });
+ var emptyWidth =
+ self.picker.width() - self.controls.square.width() - 20,
+ stripsMargin = emptyWidth / 6,
+ stripsWidth = emptyWidth / 2 - stripsMargin;
+
+ $.each(["aContainer", "strip"], function (k, v) {
+ self.controls[v]
+ .width(stripsWidth)
+ .css({ "margin-left": stripsMargin + "px" });
+ });
+
+ // Add new slider
+ self._initControls();
+
+ // For updated widget
+ self._change();
+ }
+ },
+ _initControls: function () {
+ this._super();
+
+ if (this.options.alpha) {
+ var self = this,
+ controls = self.controls;
+
+ controls.aSlider.slider({
+ orientation: "vertical",
+ min: 0,
+ max: 100,
+ step: 1,
+ value: parseInt(self._color._alpha * 100),
+ slide: function (event, ui) {
+ // Update alpha value
+ self._color._alpha = parseFloat(ui.value / 100);
+ self._change.apply(self, arguments);
+ },
+ });
+ }
+ },
+ _change: function () {
+ this._super();
+
+ var self = this,
+ el = self.element;
+
+ if (this.options.alpha) {
+ var controls = self.controls,
+ alpha = parseInt(self._color._alpha * 100),
+ color = self._color.toRgb(),
+ gradient = [
+ "rgb(" + color.r + "," + color.g + "," + color.b + ") 0%",
+ "rgba(" + color.r + "," + color.g + "," + color.b + ", 0) 100%",
+ ],
+ defaultWidth = self.options.defaultWidth,
+ customWidth = self.options.customWidth,
+ target = self.picker
+ .closest(".wp-picker-container")
+ .find(".wp-color-result");
+
+ // Generate background slider alpha, only for CSS3 old browser fuck!! :)
+ controls.aContainer.css({
+ background:
+ "linear-gradient(to bottom, " +
+ gradient.join(", ") +
+ "), url(" +
+ image +
+ ")",
+ });
+
+ if (target.hasClass("wp-picker-open")) {
+ // Update alpha value
+ controls.aSlider.slider("value", alpha);
+
+ /**
+ * Disabled change opacity in default slider Saturation ( only is alpha enabled )
+ * and change input width for view all value
+ */
+ if (self._color._alpha < 1) {
+ controls.strip.attr(
+ "style",
+ controls.strip
+ .attr("style")
+ .replace(
+ /rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,
+ "rgb($1$3$5)",
+ ),
+ );
+ el.width(parseInt(defaultWidth + customWidth));
+ } else {
+ el.width(defaultWidth);
+ }
+ }
+ }
+
+ var reset = el.data("reset-alpha") || false;
+
+ if (reset) {
+ self.picker
+ .find(".iris-palette-container")
+ .on("click.palette", ".iris-palette", function () {
+ self._color._alpha = 1;
+ self.active = "external";
+ self._change();
+ });
+ }
+ },
+ _addInputListeners: function (input) {
+ var self = this,
+ debounceTimeout = 100,
+ callback = function (event) {
+ var color = new Color(input.val()),
+ val = input.val();
+
+ input.removeClass("iris-error");
+ // we gave a bad color
+ if (color.error) {
+ // don't error on an empty input
+ if (val !== "") input.addClass("iris-error");
+ } else {
+ if (color.toString() !== self._color.toString()) {
+ // let's not do this on keyup for hex shortcodes
+ if (!(event.type === "keyup" && val.match(/^[0-9a-fA-F]{3}$/)))
+ self._setOption("color", color.toString());
+ }
+ }
+ };
+
+ input
+ .on("change", callback)
+ .on("keyup", self._debounce(callback, debounceTimeout));
+
+ // If we initialized hidden, show on first focus. The rest is up to you.
+ if (self.options.hide) {
+ input.on("focus", function () {
+ self.show();
+ });
+ }
+ },
+ });
+})(jQuery);
// Auto Call plugin is class is color-picker
-jQuery( document ).ready( function( $ ) {
- $( '.color-picker' ).wpColorPicker();
-} );
+jQuery(document).ready(function ($) {
+ $(".color-picker").wpColorPicker();
+});
diff --git a/public/includes/lib/drag-drop-featured-image/assets/scripts/drag-drop-uploader.js b/public/includes/lib/drag-drop-featured-image/assets/scripts/drag-drop-uploader.js
index fc244c2..905c5f3 100644
--- a/public/includes/lib/drag-drop-featured-image/assets/scripts/drag-drop-uploader.js
+++ b/public/includes/lib/drag-drop-featured-image/assets/scripts/drag-drop-uploader.js
@@ -1,127 +1,120 @@
-jQuery(document).ready(function($){
-
- var uploadContainer = $('#drag_to_upload');
-
- // Media Library button hook (WP >= 3.5):
- $('a#dgd_library_button').click(function(e){
-
- // Prevent default:
- e.preventDefault();
-
- // Set frame object:
- var frame = wp.media({
- id: 'dgd_featured_image',
- title : dgd_strings.panel.title,
- multiple : true,
- library : { type : 'image'},
- button : { text : dgd_strings.panel.button }
- });
-
- // On select image:
- frame.on('select', function(){
- var attachment = frame.state().get('selection').first().toJSON();
- doSetFeaturedImage(attachment.id);
- });
-
- // Display:
- frame.open();
-
- });
-
-
- // Set as featured image hook (WP < 3.5):
- $('body').on('click', 'a.wp-post-thumbnail', function(e){
- parent.tb_remove();
- parent.location.reload(1);
- });
-
- // Remove featured image:
- uploadContainer.on('click', '#remove-post-thumbnail', function (){
- $('#current-uploaded-image').slideUp('medium');
- updateHotspotImages('');
- });
-
-
- // Set featured image:
- function doSetFeaturedImage(attachmentID){
- $.post(ajaxurl, {
- action: 'dgd_set_featured_image',
- postID: dgd_post_id,
- nonce: dgd_set_featured_image_nonce,
- attachmentID: attachmentID
- }, function (response){
- var response = $.parseJSON(response);
- if (response.response_code == 200){
-
- // Publish post:
- if (dgd_page_reload){
- $('div#publishing-action input#publish').trigger('click');
- }
-
- // Fetch image:
- doFetchFeaturedImage();
-
- } else {
- alert(response.response_content);
- }
- });
- }
-
-
- // Fetch featured image function:
- function doFetchFeaturedImage(){
- $.post(ajaxurl, {
- action: 'dgd_get_featured_image',
- post_id: dgd_post_id
- }, function (response){
-
- // Parse response AS JSON:
- var response = $.parseJSON(response);
-
- // Valid response:
- if (response.response_code == 200){
-
- // Find current image and continue:
- $('#current-uploaded-image').slideUp('medium', function(){
-
- // Update image with new info:
- var imageObject = uploadContainer.find('div.inside img.attachment-full');
- imageObject.removeAttr('width');
- imageObject.removeAttr('height');
- imageObject.removeAttr('title');
- imageObject.removeAttr('alt');
- imageObject.removeAttr('srcset');
- imageObject.removeAttr('sizes');
- imageObject.attr('src', response.response_content);
-
- // Hide container:
- imageObject.load(function(){
-
- // Display container:
- $('#current-uploaded-image').slideDown('medium');
-
- // Fade in upload container:
- $('div#plupload-upload-ui').fadeIn('medium');
- $('#uploaderSection .loading').fadeOut('medium');
-
- });
- updateHotspotImages(imageObject.attr('src'));
- });
- } else {
- alert(response.response_content);
- }
-
- });
- }
-
-
- function updateHotspotImages(src) {
- var fields = $('input[name$="[coordinates]"]');
-
- fields.each(function(){
- $(this).attr('data-image-url', src);
- });
-
- }
-
-});
\ No newline at end of file
+jQuery(document).ready(function ($) {
+ var uploadContainer = $("#drag_to_upload");
+
+ // Media Library button hook (WP >= 3.5):
+ $("a#dgd_library_button").click(function (e) {
+ // Prevent default:
+ e.preventDefault();
+
+ // Set frame object:
+ var frame = wp.media({
+ id: "dgd_featured_image",
+ title: dgd_strings.panel.title,
+ multiple: true,
+ library: { type: "image" },
+ button: { text: dgd_strings.panel.button },
+ });
+
+ // On select image:
+ frame.on("select", function () {
+ var attachment = frame.state().get("selection").first().toJSON();
+ doSetFeaturedImage(attachment.id);
+ });
+
+ // Display:
+ frame.open();
+ });
+
+ // Set as featured image hook (WP < 3.5):
+ $("body").on("click", "a.wp-post-thumbnail", function (e) {
+ parent.tb_remove();
+ parent.location.reload(1);
+ });
+
+ // Remove featured image:
+ uploadContainer.on("click", "#remove-post-thumbnail", function () {
+ $("#current-uploaded-image").slideUp("medium");
+ updateHotspotImages("");
+ });
+
+ // Set featured image:
+ function doSetFeaturedImage(attachmentID) {
+ $.post(
+ ajaxurl,
+ {
+ action: "dgd_set_featured_image",
+ postID: dgd_post_id,
+ nonce: dgd_set_featured_image_nonce,
+ attachmentID: attachmentID,
+ },
+ function (response) {
+ var response = $.parseJSON(response);
+ if (response.response_code == 200) {
+ // Publish post:
+ if (dgd_page_reload) {
+ $("div#publishing-action input#publish").trigger("click");
+ }
+
+ // Fetch image:
+ doFetchFeaturedImage();
+ } else {
+ alert(response.response_content);
+ }
+ },
+ );
+ }
+
+ // Fetch featured image function:
+ function doFetchFeaturedImage() {
+ $.post(
+ ajaxurl,
+ {
+ action: "dgd_get_featured_image",
+ post_id: dgd_post_id,
+ },
+ function (response) {
+ // Parse response AS JSON:
+ var response = $.parseJSON(response);
+
+ // Valid response:
+ if (response.response_code == 200) {
+ // Find current image and continue:
+ $("#current-uploaded-image").slideUp("medium", function () {
+ // Update image with new info:
+ var imageObject = uploadContainer.find(
+ "div.inside img.attachment-full",
+ );
+ imageObject.removeAttr("width");
+ imageObject.removeAttr("height");
+ imageObject.removeAttr("title");
+ imageObject.removeAttr("alt");
+ imageObject.removeAttr("srcset");
+ imageObject.removeAttr("sizes");
+ imageObject.attr("src", response.response_content);
+
+ // Hide container:
+ imageObject.load(function () {
+ // Display container:
+ $("#current-uploaded-image").slideDown("medium");
+
+ // Fade in upload container:
+ $("div#plupload-upload-ui").fadeIn("medium");
+ $("#uploaderSection .loading").fadeOut("medium");
+ });
+ updateHotspotImages(imageObject.attr("src"));
+ });
+ } else {
+ alert(response.response_content);
+ }
+ },
+ );
+ }
+
+ function updateHotspotImages(src) {
+ var fields = $('input[name$="[coordinates]"]');
+
+ fields.each(function () {
+ $(this).attr("data-image-url", src);
+ });
+ }
+});
diff --git a/public/includes/lib/drag-drop-featured-image/assets/scripts/drag-to-feature.js b/public/includes/lib/drag-drop-featured-image/assets/scripts/drag-to-feature.js
index f1a7290..6e3cd43 100644
--- a/public/includes/lib/drag-drop-featured-image/assets/scripts/drag-to-feature.js
+++ b/public/includes/lib/drag-drop-featured-image/assets/scripts/drag-to-feature.js
@@ -1,13 +1,14 @@
-jQuery(document).ready(function($){
-
- // Load iOS Switch script:
- $('input.iOSToggle').iToggle();
-
- // Info panel blob jump:
- $('div.blobContainer img').hover(function(){
- $(this).stop(true, false).fadeTo(200, 1.0);
- }, function(){
- $(this).stop(true, false).fadeTo(200, 0.7);
- });
-
-});
\ No newline at end of file
+jQuery(document).ready(function ($) {
+ // Load iOS Switch script:
+ $("input.iOSToggle").iToggle();
+
+ // Info panel blob jump:
+ $("div.blobContainer img").hover(
+ function () {
+ $(this).stop(true, false).fadeTo(200, 1.0);
+ },
+ function () {
+ $(this).stop(true, false).fadeTo(200, 0.7);
+ },
+ );
+});
From d21ef28a409397e22072129bfb436d8207f8aa5b Mon Sep 17 00:00:00 2001
From: hsein-bitar
Date: Tue, 13 Feb 2024 17:17:41 +0200
Subject: [PATCH 04/12] added .prettierignore
---
.prettierignore | 1 +
1 file changed, 1 insertion(+)
create mode 100644 .prettierignore
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 0000000..b584bdc
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1 @@
+*min.*
\ No newline at end of file
From 2086437e9dedf3d6cbb27e9dd29dd493210688e2 Mon Sep 17 00:00:00 2001
From: hsein-bitar
Date: Tue, 13 Feb 2024 17:21:43 +0200
Subject: [PATCH 05/12] test
---
.github/workflows/ci.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 34f010a..29eb653 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,7 +20,7 @@ jobs:
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
+ 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
@@ -81,7 +81,7 @@ jobs:
# run: prettier --write "**/*.vue"
- name: Lint JS files
- run: eslint --fix "**/*.js" --ignore-pattern "**/vendor/**/*" --ignore-pattern "**/node_modules/**/*"
+ 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
From 3ca8093620c511bc07ba580895fbcefe7f697c1e Mon Sep 17 00:00:00 2001
From: hsein-bitar
Date: Tue, 13 Feb 2024 17:32:46 +0200
Subject: [PATCH 06/12] fixed eslint setup
---
.eslintrc.js | 8 ++++++++
package.json | 6 +++++-
2 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 .eslintrc.js
diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 0000000..bab5538
--- /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/package.json b/package.json
index 1f71728..3cb7043 100644
--- a/package.json
+++ b/package.json
@@ -8,10 +8,14 @@
"url": "https://nsqua.red"
},
"devDependencies": {
+ "eslint": "^8.53.0",
+ "eslint-plugin-prettier": "^5.0.1",
+ "eslint-config-prettier": "^9.0.0",
+ "babel-eslint": "^10.1.0",
"grunt": "^1.6.1",
"grunt-cli": "^1.4.3",
- "grunt-contrib-copy": "latest",
"grunt-contrib-clean": "latest",
+ "grunt-contrib-copy": "latest",
"grunt-text-replace": "latest",
"load-grunt-tasks": "^5.1.0"
}
From 11c5f9d06f9c1dda1c984adbe3e076d3defc2856 Mon Sep 17 00:00:00 2001
From: otto-bot-git
Date: Tue, 13 Feb 2024 15:35:50 +0000
Subject: [PATCH 07/12] Automated code formatting on branch done.
---
draw-attention.php | 27 +-
external/actions-scripts/format-changelog.php | 138 +--
public/class-drawattention.php | 238 ++--
.../includes/actions/action-bigcommerce.php | 81 +-
public/includes/actions/action-url.php | 18 +-
public/includes/actions/action.php | 2 +-
public/includes/class-block-image.php | 20 +-
public/includes/cpt.php | 112 +-
public/includes/custom_fields.php | 347 +++---
public/includes/import-export.php | 109 +-
.../includes/lib/CMB2/example-functions.php | 1074 +++++++++--------
public/includes/lib/CMB2/includes/CMB2.php | 50 +-
.../includes/lib/CMB2/includes/CMB2_Ajax.php | 38 +-
.../includes/lib/CMB2/includes/CMB2_Base.php | 8 +-
.../includes/lib/CMB2/includes/CMB2_Field.php | 131 +-
.../lib/CMB2/includes/CMB2_Field_Display.php | 55 +-
.../lib/CMB2/includes/CMB2_Hookup.php | 28 +-
.../lib/CMB2/includes/CMB2_Hookup_Base.php | 2 +-
public/includes/lib/CMB2/includes/CMB2_JS.php | 31 +-
.../lib/CMB2/includes/CMB2_Options.php | 2 +-
.../lib/CMB2/includes/CMB2_Options_Hookup.php | 8 +-
.../lib/CMB2/includes/CMB2_Sanitize.php | 23 +-
.../lib/CMB2/includes/CMB2_Show_Filters.php | 5 +-
.../includes/lib/CMB2/includes/CMB2_Types.php | 93 +-
.../includes/lib/CMB2/includes/CMB2_Utils.php | 15 +-
.../lib/CMB2/includes/helper-functions.php | 24 +-
.../lib/CMB2/includes/rest-api/CMB2_REST.php | 57 +-
.../rest-api/CMB2_REST_Controller.php | 45 +-
.../rest-api/CMB2_REST_Controller_Boxes.php | 65 +-
.../rest-api/CMB2_REST_Controller_Fields.php | 133 +-
.../CMB2/includes/shim/WP_REST_Controller.php | 191 +--
.../CMB2/includes/types/CMB2_Type_Base.php | 1 -
.../includes/types/CMB2_Type_Checkbox.php | 1 -
.../includes/types/CMB2_Type_Colorpicker.php | 10 +-
.../includes/types/CMB2_Type_Counter_Base.php | 15 +-
.../CMB2/includes/types/CMB2_Type_File.php | 118 +-
.../includes/types/CMB2_Type_File_Base.php | 15 +-
.../includes/types/CMB2_Type_File_List.php | 85 +-
.../includes/types/CMB2_Type_Multi_Base.php | 23 +-
.../includes/types/CMB2_Type_Multicheck.php | 22 +-
.../CMB2/includes/types/CMB2_Type_Oembed.php | 33 +-
.../includes/types/CMB2_Type_Picker_Base.php | 2 +-
.../CMB2/includes/types/CMB2_Type_Radio.php | 22 +-
.../CMB2/includes/types/CMB2_Type_Select.php | 17 +-
.../types/CMB2_Type_Select_Timezone.php | 13 +-
.../types/CMB2_Type_Taxonomy_Base.php | 11 +-
.../types/CMB2_Type_Taxonomy_Multicheck.php | 12 +-
..._Type_Taxonomy_Multicheck_Hierarchical.php | 14 +-
.../types/CMB2_Type_Taxonomy_Radio.php | 21 +-
.../CMB2_Type_Taxonomy_Radio_Hierarchical.php | 12 +-
.../types/CMB2_Type_Taxonomy_Select.php | 38 +-
...CMB2_Type_Taxonomy_Select_Hierarchical.php | 16 +-
.../CMB2/includes/types/CMB2_Type_Text.php | 22 +-
.../includes/types/CMB2_Type_Text_Date.php | 16 +-
.../CMB2_Type_Text_Datetime_Timestamp.php | 52 +-
..._Type_Text_Datetime_Timestamp_Timezone.php | 52 +-
.../includes/types/CMB2_Type_Text_Time.php | 17 +-
.../includes/types/CMB2_Type_Textarea.php | 22 +-
.../types/CMB2_Type_Textarea_Code.php | 11 +-
.../CMB2/includes/types/CMB2_Type_Title.php | 18 +-
.../CMB2/includes/types/CMB2_Type_Wysiwyg.php | 78 +-
public/includes/lib/CMB2/init.php | 8 +-
.../assets/views/options.php | 122 +-
.../lib/drag-drop-featured-image/index.php | 690 +++++------
public/includes/themes.php | 86 +-
public/views/more_info_template.php | 8 +-
public/views/shortcode_template.php | 111 +-
public/views/single-da_image.php | 9 +-
uninstall.php | 12 +-
69 files changed, 2748 insertions(+), 2257 deletions(-)
diff --git a/draw-attention.php b/draw-attention.php
index 4b1f60f..244ec97 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 f44a260..3577b86 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 .\n"
- ]
- ],
- [
- "type" => "section",
- "text" => [
- "type" => "mrkdwn",
- "text" => ":white_check_mark: 4.{$values['version']}\n:white_check_mark: 3.{$values['version']}\n:white_check_mark: 2.{$values['version']}\n:no_entry: 1.{$values['version']} (will be released separately)\n"
- ]
- ],
-];
+$slack_payload_blocks = array(
+ array(
+ 'type' => 'divider',
+ ),
+ array(
+ 'type' => 'header',
+ 'text' => array(
+ 'type' => 'plain_text',
+ 'text' => PROJECT . " GitHub Release.\n",
+ ),
+ ),
+ array(
+ 'type' => 'section',
+ 'text' => array(
+ 'type' => 'mrkdwn',
+ 'text' => "You can .\n",
+ ),
+ ),
+ array(
+ 'type' => 'section',
+ 'text' => array(
+ 'type' => 'mrkdwn',
+ 'text' => ":white_check_mark: 4.{$values['version']}\n:white_check_mark: 3.{$values['version']}\n:white_check_mark: 2.{$values['version']}\n:no_entry: 1.{$values['version']} (will be released separately)\n",
+ ),
+ ),
+);
$pattern = '/PR:#(\d+)(.*)/';
try {
- foreach (json_decode(CHANGELOG_JSON) as $key => $array_of_prs) {
- $formatted_key = str_replace('##', '', $key);
- $slack_payload_blocks[] = [
- "type" => "header",
- "text" => [
- "type" => "plain_text",
- "text" => $formatted_key
- ]
- ];
+ foreach ( json_decode( CHANGELOG_JSON ) as $key => $array_of_prs ) {
+ $formatted_key = str_replace( '##', '', $key );
+ $slack_payload_blocks[] = array(
+ 'type' => 'header',
+ 'text' => array(
+ 'type' => 'plain_text',
+ 'text' => $formatted_key,
+ ),
+ );
- foreach ($array_of_prs as $pr) {
- preg_match($pattern, $pr, $matches);
- $pr_number = $matches[1];
- $pr_title = $matches[2];
- $slack_payload_blocks[] = [
- "type" => "section",
- "text" => [
- "type" => "mrkdwn",
- "text" => " $pr_title"
- ]
- ];
+ foreach ( $array_of_prs as $pr ) {
+ preg_match( $pattern, $pr, $matches );
+ $pr_number = $matches[1];
+ $pr_title = $matches[2];
+ $slack_payload_blocks[] = array(
+ 'type' => 'section',
+ 'text' => array(
+ 'type' => 'mrkdwn',
+ 'text' => " $pr_title",
+ ),
+ );
}
}
-} catch (\Throwable $th) {
- echo "Failed to parse CHANGELOG_JSON";
+} catch ( \Throwable $th ) {
+ echo 'Failed to parse CHANGELOG_JSON';
}
-$slack_payload = [
- "text" => "\n\n\n".PROJECT." GitHub Release {$values['version']}\nChangelog:\n" . CHANGELOG_STRING,
- "blocks" => $slack_payload_blocks,
-];
+$slack_payload = array(
+ 'text' => "\n\n\n" . PROJECT . " GitHub Release {$values['version']}\nChangelog:\n" . CHANGELOG_STRING,
+ 'blocks' => $slack_payload_blocks,
+);
-$json = json_encode($slack_payload, JSON_PRETTY_PRINT);
-$fp = fopen($values["out"], 'w');
-fwrite($fp, $json);
-fclose($fp);
+$json = json_encode( $slack_payload, JSON_PRETTY_PRINT );
+$fp = fopen( $values['out'], 'w' );
+fwrite( $fp, $json );
+fclose( $fp );
diff --git a/public/class-drawattention.php b/public/class-drawattention.php
index b563977..b2d5ceb 100644
--- a/public/class-drawattention.php
+++ b/public/class-drawattention.php
@@ -21,7 +21,7 @@
* @package DrawAttention
* @author Nathan Tyler
*/
-if ( !class_exists( 'DrawAttention' ) ) {
+if ( ! class_exists( 'DrawAttention' ) ) {
class DrawAttention {
/**
@@ -32,9 +32,9 @@ class DrawAttention {
* @var string
*/
const VERSION = '2.0.20';
- const file = __FILE__;
- const name = 'Draw Attention';
- const slug = 'drawattention';
+ const file = __FILE__;
+ const name = 'Draw Attention';
+ const slug = 'drawattention';
/**
* @TODO - Rename "hotspots" to the name of your plugin
*
@@ -62,6 +62,7 @@ class DrawAttention {
/**
* Instance of class to register CPT and taxonomies
+ *
* @var DrawAttention_CPT
*/
public $cpt;
@@ -100,28 +101,28 @@ private function __construct() {
add_action( 'template_include', array( $this, 'single_template' ) );
- add_filter( 'jetpack_photon_skip_image', array ($this, 'jetpack_photon_skip_image' ), 10, 3 );
+ add_filter( 'jetpack_photon_skip_image', array( $this, 'jetpack_photon_skip_image' ), 10, 3 );
add_filter( 'cmb2_meta_box_url', array( $this, 'cmb2_meta_box_url' ) );
- /**
- * @TODO - Uncomment requried features
- *
- * Various functionality is separated into external files
- */
- include_once( dirname ( __FILE__ ) . '/includes/cpt.php' );
+ /**
+ * @TODO - Uncomment requried features
+ *
+ * Various functionality is separated into external files
+ */
+ include_once __DIR__ . '/includes/cpt.php';
$this->cpt = new DrawAttention_CPT( $this );
- include_once( dirname ( __FILE__ ) . '/includes/custom_fields.php' );
+ include_once __DIR__ . '/includes/custom_fields.php';
$this->custom_fields = new DrawAttention_CustomFields( $this );
- include_once(dirname ( __FILE__ ) . '/includes/themes.php' );
+ include_once __DIR__ . '/includes/themes.php';
$this->themes = new DrawAttention_Themes( $this );
- include_once( dirname ( __FILE__ ) . '/includes/class-block-image.php' );
+ include_once __DIR__ . '/includes/class-block-image.php';
$this->block_image = new DrawAttention_Block_Image( $this );
- include_once( dirname ( __FILE__ ) . '/includes/import-export.php' );
+ include_once __DIR__ . '/includes/import-export.php';
$this->import_export = new DrawAttention_ImportExport( $this );
}
@@ -147,7 +148,7 @@ public static function get_instance() {
// If the single instance hasn't been set, set it now.
if ( null == self::$instance ) {
- self::$instance = new self;
+ self::$instance = new self();
}
return self::$instance;
@@ -158,16 +159,16 @@ public static function get_instance() {
*
* @since 1.0.0
*
- * @param boolean $network_wide True if WPMU superadmin uses
- * "Network Activate" action, false if
- * WPMU is disabled or plugin is
- * activated on an individual blog.
+ * @param boolean $network_wide True if WPMU superadmin uses
+ * "Network Activate" action, false if
+ * WPMU is disabled or plugin is
+ * activated on an individual blog.
*/
public static function activate( $network_wide ) {
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
- if ( $network_wide ) {
+ if ( $network_wide ) {
// Get all blog ids
$blog_ids = self::get_blog_ids();
@@ -179,15 +180,12 @@ public static function activate( $network_wide ) {
restore_current_blog();
}
-
} else {
self::single_activate();
}
-
} else {
self::single_activate();
}
-
}
/**
@@ -195,10 +193,10 @@ public static function activate( $network_wide ) {
*
* @since 1.0.0
*
- * @param boolean $network_wide True if WPMU superadmin uses
- * "Network Deactivate" action, false if
- * WPMU is disabled or plugin is
- * deactivated on an individual blog.
+ * @param boolean $network_wide True if WPMU superadmin uses
+ * "Network Deactivate" action, false if
+ * WPMU is disabled or plugin is
+ * deactivated on an individual blog.
*/
public static function deactivate( $network_wide ) {
@@ -217,15 +215,12 @@ public static function deactivate( $network_wide ) {
restore_current_blog();
}
-
} else {
self::single_deactivate();
}
-
} else {
self::single_deactivate();
}
-
}
/**
@@ -233,7 +228,7 @@ public static function deactivate( $network_wide ) {
*
* @since 1.0.0
*
- * @param int $blog_id ID of the new blog.
+ * @param int $blog_id ID of the new blog.
*/
public function activate_new_site( $blog_id ) {
@@ -244,7 +239,6 @@ public function activate_new_site( $blog_id ) {
switch_to_blog( $blog_id );
self::single_activate();
restore_current_blog();
-
}
/**
@@ -267,7 +261,6 @@ private static function get_blog_ids() {
AND deleted = '0'";
return $wpdb->get_col( $sql );
-
}
/**
@@ -296,19 +289,17 @@ private static function single_deactivate() {
*/
public function load_plugin_textdomain() {
-
$domain = 'drawattention';
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
- load_plugin_textdomain( $domain, FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages/' );
+ load_plugin_textdomain( $domain, false, basename( plugin_dir_path( __DIR__ ) ) . '/languages/' );
$domain = 'draw-attention';
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
- load_plugin_textdomain( $domain, FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages/' );
-
+ load_plugin_textdomain( $domain, false, basename( plugin_dir_path( __DIR__ ) ) . '/languages/' );
}
/**
@@ -330,25 +321,33 @@ public function enqueue_scripts() {
wp_register_script( $this->plugin_slug . '-leaflet-responsive-popup', plugins_url( 'assets/js/leaflet.responsive.popup-min.js', __FILE__ ), array( $this->plugin_slug . '-leaflet' ), '0.6.4', $in_footer = true );
wp_register_script( $this->plugin_slug . '-plugin-script', plugins_url( 'assets/js/public.js', __FILE__ ), array( $this->plugin_slug . '-leaflet-responsive-popup', 'jquery' ), self::VERSION, true );
- wp_localize_script( $this->plugin_slug . '-plugin-script', 'drawattentionData', array(
- 'isLoggedIn' => is_user_logged_in(),
- 'closeLabel' => __('Close', 'draw-attention'),
- 'isAdmin' => current_user_can( 'administrator' ),
- ) );
+ wp_localize_script(
+ $this->plugin_slug . '-plugin-script',
+ 'drawattentionData',
+ array(
+ 'isLoggedIn' => is_user_logged_in(),
+ 'closeLabel' => __( 'Close', 'draw-attention' ),
+ 'isAdmin' => current_user_can( 'administrator' ),
+ )
+ );
$enqueue = apply_filters( 'da_enqueue_scripts_everywhere', false );
- if ( !empty( $enqueue ) ) {
+ if ( ! empty( $enqueue ) ) {
wp_enqueue_script( $this->plugin_slug . '-plugin-script' );
}
}
function php_52_notice() {
global $pagenow;
- if ( $pagenow != 'post.php' ) return;
- if ( get_post_type() != 'da_image' ) return;
+ if ( $pagenow != 'post.php' ) {
+ return;
+ }
+ if ( get_post_type() != 'da_image' ) {
+ return;
+ }
- if ( version_compare( phpversion(), '5.2.99') <= 0 ) {
- $class = "error";
+ if ( version_compare( phpversion(), '5.2.99' ) <= 0 ) {
+ $class = 'error';
$message = "
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() {
http://php.net/releases/
";
- echo"";
- } else if ( version_compare( phpversion(), '5.5.99' ) <= 0 ) {
- $class = "error";
+ echo "";
+ } elseif ( version_compare( phpversion(), '5.5.99' ) <= 0 ) {
+ $class = 'error';
$message = "
Your server is out of date
Draw Attention (and many other WP plugins) requires PHP version 5.6 or higher . PHP 5.5 support was officially terminated in 2016, and to use Draw Attention you need to at least upgrade to PHP 5.6. We recommend PHP 7.1 or higher for best performance.
@@ -384,7 +383,7 @@ function php_52_notice() {
http://php.net/releases/
";
- echo"";
+ echo "";
}
}
@@ -398,12 +397,12 @@ public function cmb2_meta_box_url( $url ) {
return $url;
}
- $url = self::get_plugin_url().'/public/includes/lib/CMB2/';
+ $url = self::get_plugin_url() . '/public/includes/lib/CMB2/';
return $url;
}
public function jetpack_photon_skip_image( $val, $src, $tag ) {
- foreach ($this->photon_excluded_images as $key => $photon_excluded_image) {
+ foreach ( $this->photon_excluded_images as $key => $photon_excluded_image ) {
if ( strpos( $src, $photon_excluded_image ) !== false ) {
return true;
}
@@ -420,32 +419,31 @@ public function jetpack_photon_skip_image( $val, $src, $tag ) {
public function shortcode( $atts ) {
// Begin settings array
$settings = array(
- 'has_photon' => class_exists( 'Jetpack_Photon' ),
+ 'has_photon' => class_exists( 'Jetpack_Photon' ),
'url_hotspots' => array(),
- 'urls_only' => false,
- 'urls_class' => '',
+ 'urls_only' => false,
+ 'urls_class' => '',
);
// Get the DA image ID
$image_args = array(
- 'post_status' => 'any',
- 'post_type' => $this->cpt->post_type,
+ 'post_status' => 'any',
+ 'post_type' => $this->cpt->post_type,
'posts_per_page' => 1,
- 'order' => 'DESC',
- 'orderby' => 'ID',
+ 'order' => 'DESC',
+ 'orderby' => 'ID',
);
- $image = new WP_Query($image_args);
+ $image = new WP_Query( $image_args );
if ( ! empty( $image->post ) ) {
$settings['image_id'] = $image->post->ID;
} else {
- $latest_da = get_posts('post_type=' . $this->cpt->post_type . '&numberposts=1');
+ $latest_da = get_posts( 'post_type=' . $this->cpt->post_type . '&numberposts=1' );
$settings['image_id'] = $latest_da[0]->ID;
}
-
// WPML Support
- if ( function_exists ( 'icl_object_id' ) ) {
- $settings['image_id'] = icl_object_id($settings['image_id'], 'da_image', true);
+ if ( function_exists( 'icl_object_id' ) ) {
+ $settings['image_id'] = icl_object_id( $settings['image_id'], 'da_image', true );
}
// Get and set DA settings
@@ -457,10 +455,10 @@ public function shortcode( $atts ) {
// Add hotspots to settings
$settings['hotspots'] = get_post_meta( $settings['image_id'], $this->custom_fields->prefix . 'hotspots', true );
- if ( ! empty( $settings['hotspots']) ) {
- foreach( $settings['hotspots'] as $hotspot_key => $hotspot ) {
- if ( empty( $settings['hotspots'][$hotspot_key]['shape'] ) ) {
- $settings['hotspots'][$hotspot_key]['shape'] = 'polygon';
+ if ( ! empty( $settings['hotspots'] ) ) {
+ foreach ( $settings['hotspots'] as $hotspot_key => $hotspot ) {
+ if ( empty( $settings['hotspots'][ $hotspot_key ]['shape'] ) ) {
+ $settings['hotspots'][ $hotspot_key ]['shape'] = 'polygon';
}
}
}
@@ -468,79 +466,82 @@ public function shortcode( $atts ) {
if ( empty( $settings['hotspots'] ) ) {
$settings['url_hotspots'] = array();
} else {
- $settings['url_hotspots'] = array_filter($settings['hotspots'], function($var){
- if ( empty( $var['action'] ) ) {
- return false;
+ $settings['url_hotspots'] = array_filter(
+ $settings['hotspots'],
+ function ( $var ) {
+ if ( empty( $var['action'] ) ) {
+ return false;
+ }
+
+ return $var['action'] == 'url';
}
-
- return $var['action'] == 'url';
- });
+ );
if ( count( $settings['hotspots'] ) == count( $settings['url_hotspots'] ) ) {
- $settings['urls_only'] = true;
+ $settings['urls_only'] = true;
$settings['urls_class'] = 'links-only';
}
}
// Set default values for free settings
- $settings['layout'] = 'left';
- $settings['event_trigger'] = 'click';
+ $settings['layout'] = 'left';
+ $settings['event_trigger'] = 'click';
$settings['always_visible'] = 'false';
// Add styles to settings
- $settings['border_width'] = $settings['img_settings'][$this->custom_fields->prefix.'map_border_width'][0];
- $settings['border_opacity'] = $settings['img_settings'][$this->custom_fields->prefix.'map_border_opacity'][0];
- $settings['more_info_bg'] = ( !empty( $settings['img_settings'][$this->custom_fields->prefix.'map_background_color'][0] ) ) ? $settings['img_settings'][$this->custom_fields->prefix.'map_background_color'][0] : '';
- $settings['more_info_text'] = ( !empty( $settings['img_settings'][$this->custom_fields->prefix.'map_text_color'][0] ) ) ? $settings['img_settings'][$this->custom_fields->prefix.'map_text_color'][0] : '';
- $settings['more_info_title'] = ( !empty( $settings['img_settings'][$this->custom_fields->prefix.'map_title_color'][0] ) ) ? $settings['img_settings'][$this->custom_fields->prefix.'map_title_color'][0] : '';
- $settings['img_bg'] = ( !empty( $settings['img_settings'][$this->custom_fields->prefix.'image_background_color'][0] ) ) ? $settings['img_settings'][$this->custom_fields->prefix.'image_background_color'][0] : '#efefef';
+ $settings['border_width'] = $settings['img_settings'][ $this->custom_fields->prefix . 'map_border_width' ][0];
+ $settings['border_opacity'] = $settings['img_settings'][ $this->custom_fields->prefix . 'map_border_opacity' ][0];
+ $settings['more_info_bg'] = ( ! empty( $settings['img_settings'][ $this->custom_fields->prefix . 'map_background_color' ][0] ) ) ? $settings['img_settings'][ $this->custom_fields->prefix . 'map_background_color' ][0] : '';
+ $settings['more_info_text'] = ( ! empty( $settings['img_settings'][ $this->custom_fields->prefix . 'map_text_color' ][0] ) ) ? $settings['img_settings'][ $this->custom_fields->prefix . 'map_text_color' ][0] : '';
+ $settings['more_info_title'] = ( ! empty( $settings['img_settings'][ $this->custom_fields->prefix . 'map_title_color' ][0] ) ) ? $settings['img_settings'][ $this->custom_fields->prefix . 'map_title_color' ][0] : '';
+ $settings['img_bg'] = ( ! empty( $settings['img_settings'][ $this->custom_fields->prefix . 'image_background_color' ][0] ) ) ? $settings['img_settings'][ $this->custom_fields->prefix . 'image_background_color' ][0] : '#efefef';
// Create hotspot style
if ( empty( $settings['styles'] ) ) {
$settings['styles'] = array();
}
$settings['styles'][] = array(
- 'title' => 'default',
- 'map_highlight_color' => !empty( $settings['img_settings'][$this->custom_fields->prefix.'map_highlight_color'][0] ) ? $settings['img_settings'][$this->custom_fields->prefix.'map_highlight_color'][0] : '',
- 'map_highlight_opacity' => !empty( $settings['img_settings'][$this->custom_fields->prefix.'map_highlight_opacity'][0] ) ? $settings['img_settings'][$this->custom_fields->prefix.'map_highlight_opacity'][0] : '',
- 'map_border_color' => !empty( $settings['img_settings'][$this->custom_fields->prefix.'map_border_color'][0] ) ? $settings['img_settings'][$this->custom_fields->prefix.'map_border_color'][0] : '',
- '_da_map_hover_color' => !empty( $settings['img_settings'][$this->custom_fields->prefix.'map_hover_color'][0] ) ? $settings['img_settings'][$this->custom_fields->prefix.'map_hover_color'][0] : '',
- '_da_map_hover_opacity' => !empty( $settings['img_settings'][$this->custom_fields->prefix.'map_hover_opacity'][0] ) ? $settings['img_settings'][$this->custom_fields->prefix.'map_hover_opacity'][0] : ''
+ 'title' => 'default',
+ 'map_highlight_color' => ! empty( $settings['img_settings'][ $this->custom_fields->prefix . 'map_highlight_color' ][0] ) ? $settings['img_settings'][ $this->custom_fields->prefix . 'map_highlight_color' ][0] : '',
+ 'map_highlight_opacity' => ! empty( $settings['img_settings'][ $this->custom_fields->prefix . 'map_highlight_opacity' ][0] ) ? $settings['img_settings'][ $this->custom_fields->prefix . 'map_highlight_opacity' ][0] : '',
+ 'map_border_color' => ! empty( $settings['img_settings'][ $this->custom_fields->prefix . 'map_border_color' ][0] ) ? $settings['img_settings'][ $this->custom_fields->prefix . 'map_border_color' ][0] : '',
+ '_da_map_hover_color' => ! empty( $settings['img_settings'][ $this->custom_fields->prefix . 'map_hover_color' ][0] ) ? $settings['img_settings'][ $this->custom_fields->prefix . 'map_hover_color' ][0] : '',
+ '_da_map_hover_opacity' => ! empty( $settings['img_settings'][ $this->custom_fields->prefix . 'map_hover_opacity' ][0] ) ? $settings['img_settings'][ $this->custom_fields->prefix . 'map_hover_opacity' ][0] : '',
);
// Create formatted array of styles
$formatted_styles = array();
- foreach ($settings['styles'] as $key => $style) {
+ foreach ( $settings['styles'] as $key => $style ) {
if ( empty( $style['title'] ) ) {
$style['title'] = 'Custom';
}
$new_style = array(
- 'name' => 'default',
+ 'name' => 'default',
'borderWidth' => $settings['border_width'],
);
$new_style['display'] = array(
- 'fillColor' => '#ffffff',
- 'fillOpacity' => 0,
- 'borderColor' => '#ffffff',
+ 'fillColor' => '#ffffff',
+ 'fillOpacity' => 0,
+ 'borderColor' => '#ffffff',
'borderOpacity' => 0,
);
- $new_style['hover'] = array(
- 'fillColor' => $style['map_highlight_color'],
- 'fillOpacity' => $style['map_highlight_opacity'],
- 'borderColor' => $style['map_border_color'],
+ $new_style['hover'] = array(
+ 'fillColor' => $style['map_highlight_color'],
+ 'fillOpacity' => $style['map_highlight_opacity'],
+ 'borderColor' => $style['map_border_color'],
'borderOpacity' => $settings['border_opacity'],
);
- array_push($formatted_styles, $new_style);
+ array_push( $formatted_styles, $new_style );
}
// Get image post, src, and meta
- $settings['img_post'] = get_post($settings['image_id']);
- $settings['img_src'] = wp_get_attachment_image_src( get_post_thumbnail_id( $settings['image_id'] ), 'full' );
- $settings['img_url'] = $settings['img_src'][0];
- $settings['img_width'] = $settings['img_src'][1];
+ $settings['img_post'] = get_post( $settings['image_id'] );
+ $settings['img_src'] = wp_get_attachment_image_src( get_post_thumbnail_id( $settings['image_id'] ), 'full' );
+ $settings['img_url'] = $settings['img_src'][0];
+ $settings['img_width'] = $settings['img_src'][1];
$settings['img_height'] = $settings['img_src'][2];
- $settings['img_alt'] = get_post_meta( get_post_thumbnail_id( $settings['img_post'] ), '_wp_attachment_image_alt', true );
+ $settings['img_alt'] = get_post_meta( get_post_thumbnail_id( $settings['img_post'] ), '_wp_attachment_image_alt', true );
if ( empty( $settings['img_alt'] ) ) {
$settings['img_alt'] = get_the_title( $settings['img_post'] );
}
@@ -555,13 +556,13 @@ public function shortcode( $atts ) {
ob_start();
- require( $this->get_plugin_dir() . '/public/views/shortcode_template.php' );
+ require $this->get_plugin_dir() . '/public/views/shortcode_template.php';
return ob_get_clean();
}
function add_shortcode_metabox() {
- add_meta_box( 'da_shortcode', __('Copy Shortcode', 'draw-attention' ), array( $this, 'display_shortcode_metabox' ), $this->cpt->post_type, 'side', 'low');
+ add_meta_box( 'da_shortcode', __( 'Copy Shortcode', 'draw-attention' ), array( $this, 'display_shortcode_metabox' ), $this->cpt->post_type, 'side', 'low' );
}
function display_shortcode_metabox() {
@@ -589,16 +590,16 @@ public static function locate_template( $template_name, $template_path = '', $de
$template = locate_template(
array(
trailingslashit( $template_path ) . $template_name,
- $template_name
- )
- );
+ $template_name,
+ )
+ );
// Get default template
if ( ! $template ) {
$template = $default_path . $template_name;
}
// Return what we found
- return apply_filters( self::slug.'_locate_template', $template, $template_name, $template_path );
+ return apply_filters( self::slug . '_locate_template', $template, $template_name, $template_path );
}
public static function get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
@@ -614,13 +615,13 @@ public static function get_template( $template_name, $args = array(), $template_
}
// Allow 3rd party plugin filter template file from their plugin
- $located = apply_filters( self::slug.'get_template', $located, $template_name, $args, $template_path, $default_path );
+ $located = apply_filters( self::slug . 'get_template', $located, $template_name, $args, $template_path, $default_path );
- do_action( self::slug.'_before_template_part', $template_name, $template_path, $located, $args );
+ do_action( self::slug . '_before_template_part', $template_name, $template_path, $located, $args );
- include( $located );
+ include $located;
- do_action( self::slug.'_after_template_part', $template_name, $template_path, $located, $args );
+ do_action( self::slug . '_after_template_part', $template_name, $template_path, $located, $args );
}
public static function get_template_part( $slug, $name = '' ) {
@@ -643,7 +644,7 @@ public static function get_template_part( $slug, $name = '' ) {
// Allow 3rd party plugin filter template file from their plugin
if ( $template ) {
- $template = apply_filters( self::slug.'_get_template_part', $template, $slug, $name );
+ $template = apply_filters( self::slug . '_get_template_part', $template, $slug, $name );
}
if ( $template ) {
@@ -656,13 +657,12 @@ public static function template_path() {
}
public static function get_plugin_dir() {
- return dirname( dirname( __FILE__ ) );
+ return dirname( __DIR__ );
}
public static function get_plugin_url() {
return dirname( plugin_dir_url( __FILE__ ) );
}
-
}
} elseif ( function_exists( 'da_deactivate_free_version' ) ) {
add_action( 'init', 'da_deactivate_free_version' );
diff --git a/public/includes/actions/action-bigcommerce.php b/public/includes/actions/action-bigcommerce.php
index c7492f4..5f02b4f 100644
--- a/public/includes/actions/action-bigcommerce.php
+++ b/public/includes/actions/action-bigcommerce.php
@@ -7,7 +7,7 @@ public static function is_active() {
'\BigCommerce\Templates\Quick_View_Image',
);
- foreach ( $classes as $class ) {
+ foreach ( $classes as $class ) {
if ( ! class_exists( $class ) ) {
return false;
}
@@ -25,23 +25,25 @@ function add_action_fields( $group_details ) {
$product_options = get_transient( 'da_bc_product_options' );
if ( empty( $product_options ) ) {
- $products = new WP_Query(array(
- 'post_type' => 'bigcommerce_product',
- 'posts_per_page' => -1,
- ) );
+ $products = new WP_Query(
+ array(
+ 'post_type' => 'bigcommerce_product',
+ 'posts_per_page' => -1,
+ )
+ );
$product_options = wp_list_pluck( $products->posts, 'post_title', 'ID' );
set_transient( 'da_bc_product_options', $product_options, 3600 );
}
-
+
$select_options = array( '' => 'Select a Product...' );
$select_options = array_replace( $select_options, $product_options );
$group_details['fields'][0]['fields']['action-bigcommerce-product-id'] = array(
- 'name' => __('Big Commerce Product', 'draw-attention' ),
- 'id' => 'action-bigcommerce-product-id',
- 'type' => 'select',
- 'options' => $select_options,
+ 'name' => __( 'Big Commerce Product', 'draw-attention' ),
+ 'id' => 'action-bigcommerce-product-id',
+ 'type' => 'select',
+ 'options' => $select_options,
'attributes' => array(
'data-action' => 'bigcommerce',
),
@@ -49,19 +51,19 @@ function add_action_fields( $group_details ) {
// TODO: Add display options
// $group_details['fields'][0]['fields']['action-bigcommerce-display-parts'] = array(
- // 'name' => __('BigCommerce Sections to Display', 'draw-attention' ),
- // 'id' => 'action-bigcommerce-display-parts',
- // 'type' => 'multicheck',
- // 'options' => array(
- // 'image' => __( 'Image', 'draw-attention' ),
- // 'title' => __( 'Title', 'draw-attention' ),
- // 'description' => __( 'Description', 'draw-attention' ),
- // 'reviews' => __( 'Reviews', 'draw-attention' ),
- // 'add_to_cart' => __( 'Add to Cart', 'draw-attention' ),
- // ),
- // 'attributes' => array(
- // 'data-action' => 'bigcommerce',
- // ),
+ // 'name' => __('BigCommerce Sections to Display', 'draw-attention' ),
+ // 'id' => 'action-bigcommerce-display-parts',
+ // 'type' => 'multicheck',
+ // 'options' => array(
+ // 'image' => __( 'Image', 'draw-attention' ),
+ // 'title' => __( 'Title', 'draw-attention' ),
+ // 'description' => __( 'Description', 'draw-attention' ),
+ // 'reviews' => __( 'Reviews', 'draw-attention' ),
+ // 'add_to_cart' => __( 'Add to Cart', 'draw-attention' ),
+ // ),
+ // 'attributes' => array(
+ // 'data-action' => 'bigcommerce',
+ // ),
// );
return $group_details;
@@ -76,27 +78,30 @@ public static function render_hotspot_content( $hotspot, $settings ) {
return;
}
- $product_post_id = (int)$hotspot['action-bigcommerce-product-id'];
- $product_post = get_post( $product_post_id );
+ $product_post_id = (int) $hotspot['action-bigcommerce-product-id'];
+ $product_post = get_post( $product_post_id );
if ( empty( $product_post->ID ) ) {
return;
}
- $product = new \BigCommerce\Post_Types\Product\Product( $product_post_id );
- $image_component = \BigCommerce\Templates\Product_Featured_Image::factory( [
- \BigCommerce\Templates\Product_Featured_Image::PRODUCT => $product,
- ] );
- $attributes = array();
-
- $quick_view_component = \BigCommerce\Templates\Quick_View_Image::factory( [
- \BigCommerce\Templates\Quick_View_Image::PRODUCT => $product,
- \BigCommerce\Templates\Quick_View_Image::IMAGE => $image_component->render(),
- \BigCommerce\Templates\Quick_View_Image::ATTRIBUTES => $attributes,
- ] );
+ $product = new \BigCommerce\Post_Types\Product\Product( $product_post_id );
+ $image_component = \BigCommerce\Templates\Product_Featured_Image::factory(
+ array(
+ \BigCommerce\Templates\Product_Featured_Image::PRODUCT => $product,
+ )
+ );
+ $attributes = array();
+
+ $quick_view_component = \BigCommerce\Templates\Quick_View_Image::factory(
+ array(
+ \BigCommerce\Templates\Quick_View_Image::PRODUCT => $product,
+ \BigCommerce\Templates\Quick_View_Image::IMAGE => $image_component->render(),
+ \BigCommerce\Templates\Quick_View_Image::ATTRIBUTES => $attributes,
+ )
+ );
$data = $quick_view_component->get_data();
return $data['quick_view'];
-
}
-}
\ No newline at end of file
+}
diff --git a/public/includes/actions/action-url.php b/public/includes/actions/action-url.php
index c7d1027..5974809 100644
--- a/public/includes/actions/action-url.php
+++ b/public/includes/actions/action-url.php
@@ -4,13 +4,13 @@ function add_action_fields( $group_details ) {
if ( ! $this->is_active() ) {
return $group_details;
}
-
+
$group_details['fields'][0]['fields']['action']['options']['url'] = __( 'Go to URL', 'draw-attention' );
$group_details['fields'][0]['fields']['action-url-url'] = array(
- 'name' => __('URL', 'draw-attention' ),
- 'id' => 'action-url-url',
- 'type' => 'text_url',
+ 'name' => __( 'URL', 'draw-attention' ),
+ 'id' => 'action-url-url',
+ 'type' => 'text_url',
'attributes' => array(
'placeholder' => site_url( 'custom/url/' ),
'data-action' => 'url',
@@ -18,14 +18,14 @@ function add_action_fields( $group_details ) {
);
$group_details['fields'][0]['fields']['action-url-open-in-window'] = array(
- 'name' => __('Open in New Window', 'draw-attention' ),
- 'id' => 'action-url-open-in-window',
- 'type' => 'checkbox',
+ 'name' => __( 'Open in New Window', 'draw-attention' ),
+ 'id' => 'action-url-open-in-window',
+ 'type' => 'checkbox',
'attributes' => array(
'data-action' => 'url',
),
);
return $group_details;
- }
-}
\ No newline at end of file
+ }
+}
diff --git a/public/includes/actions/action.php b/public/includes/actions/action.php
index 880c92c..5f40659 100644
--- a/public/includes/actions/action.php
+++ b/public/includes/actions/action.php
@@ -15,4 +15,4 @@ function add_action_fields( $group_details ) {
return $group_details;
}
-}
\ No newline at end of file
+}
diff --git a/public/includes/class-block-image.php b/public/includes/class-block-image.php
index 5a3386b..93d8fc1 100644
--- a/public/includes/class-block-image.php
+++ b/public/includes/class-block-image.php
@@ -43,7 +43,7 @@ public function hooks() {
}
function register_image_block() {
- if( function_exists('register_block_type') ){
+ if ( function_exists( 'register_block_type' ) ) {
wp_register_script(
'drawattention-image-block-js',
trailingslashit( $this->plugin->get_plugin_url() ) . 'admin/assets/js/draw-attention-block.js',
@@ -55,19 +55,21 @@ function register_image_block() {
trailingslashit( $this->plugin->get_plugin_url() ) . 'admin/assets/css/draw-attention-block.css'
);
- register_block_type( 'draw-attention/image', array(
- 'api_version' => 2,
- 'editor_script' => 'drawattention-image-block-js',
- 'editor_style' => 'drawattention-image-block-css',
- 'keywords' => array( 'image', 'hotspot', 'map' ),
+ register_block_type(
+ 'draw-attention/image',
+ array(
+ 'api_version' => 2,
+ 'editor_script' => 'drawattention-image-block-js',
+ 'editor_style' => 'drawattention-image-block-css',
+ 'keywords' => array( 'image', 'hotspot', 'map' ),
- 'render_callback' => array( $this, 'render' ),
- ) );
+ 'render_callback' => array( $this, 'render' ),
+ )
+ );
}
}
function render( $atts ) {
return $this->plugin->shortcode( $atts );
}
-
}
diff --git a/public/includes/cpt.php b/public/includes/cpt.php
index a90027b..76ba935 100644
--- a/public/includes/cpt.php
+++ b/public/includes/cpt.php
@@ -1,24 +1,26 @@
post_type . '_columns', array( $this, 'register_custom_column_headings' ), 10, 1 );
// add_action( 'manage_' . $this->post_type .'_posts_custom_column', array( $this, 'register_custom_columns' ), 10, 2 );
add_action( 'init', array( $this, 'load_drag_drop_featured_image' ) );
- remove_filter( 'post_type_link', array('MWCPPost', 'post_type_link'), 10, 4 );
+ remove_filter( 'post_type_link', array( 'MWCPPost', 'post_type_link' ), 10, 4 );
}
function load_drag_drop_featured_image() {
global $drag_drop_featured_image_map;
- if ( empty( $drag_drop_featured_image_map ) || !class_exists( 'WP_Drag_Drop_Featured_Image_Map' ) ) {
- include_once( 'lib/drag-drop-featured-image/index.php' );
- if ( !class_exists( 'WP_Drag_Drop_Featured_Image_Map' ) ) return;
- $drag_drop_featured_image_map = new WP_Drag_Drop_Featured_Image_Map;
+ if ( empty( $drag_drop_featured_image_map ) || ! class_exists( 'WP_Drag_Drop_Featured_Image_Map' ) ) {
+ include_once 'lib/drag-drop-featured-image/index.php';
+ if ( ! class_exists( 'WP_Drag_Drop_Featured_Image_Map' ) ) {
+ return;
+ }
+ $drag_drop_featured_image_map = new WP_Drag_Drop_Featured_Image_Map();
}
}
@@ -26,51 +28,54 @@ function load_drag_drop_featured_image() {
function register_cpt() {
- $result = register_post_type( $this->post_type, /* (http://codex.wordpress.org/Function_Reference/register_post_type) */
- // let's now add all the options for this post type
- array('labels' => array(
- 'name' => __('Draw Attention', $this->post_type.' general name', 'draw-attention' ), /* This is the Title of the Group */
- 'singular_name' => __('Image', $this->post_type.' singular name', 'draw-attention' ), /* This is the individual type */
- 'all_items' => __('All Images', 'draw-attention' ), /* the all items menu item */
- 'add_new' => __('Add New', 'custom '.$this->post_type.' item', 'draw-attention' ), /* The add new menu item */
- 'add_new_item' => __('Add New Image', 'draw-attention' ), /* Add New Display Title */
- 'edit' => __( 'Edit' ), /* Edit Dialog */
- 'edit_item' => __('Edit Image', 'draw-attention' ), /* Edit Display Title */
- 'new_item' => __('New Image', 'draw-attention' ), /* New Display Title */
- 'view_item' => __('View Image', 'draw-attention' ), /* View Display Title */
- 'search_items' => __('Search Images', 'draw-attention' ), /* Search CPT_SINGULAR_NAME Title */
- 'not_found' => __('Nothing found in the Database.', 'draw-attention' ), /* This displays if there are no entries yet */
- 'not_found_in_trash' => __('Nothing found in Trash', 'draw-attention' ), /* This displays if there is nothing in the trash */
- 'parent_item_colon' => ''
+ $result = register_post_type(
+ $this->post_type, /*
+ (http://codex.wordpress.org/Function_Reference/register_post_type) */
+ // let's now add all the options for this post type
+ array(
+ 'labels' => array(
+ 'name' => __( 'Draw Attention', $this->post_type . ' general name', 'draw-attention' ), /* This is the Title of the Group */
+ 'singular_name' => __( 'Image', $this->post_type . ' singular name', 'draw-attention' ), /* This is the individual type */
+ 'all_items' => __( 'All Images', 'draw-attention' ), /* the all items menu item */
+ 'add_new' => __( 'Add New', 'custom ' . $this->post_type . ' item', 'draw-attention' ), /* The add new menu item */
+ 'add_new_item' => __( 'Add New Image', 'draw-attention' ), /* Add New Display Title */
+ 'edit' => __( 'Edit' ), /* Edit Dialog */
+ 'edit_item' => __( 'Edit Image', 'draw-attention' ), /* Edit Display Title */
+ 'new_item' => __( 'New Image', 'draw-attention' ), /* New Display Title */
+ 'view_item' => __( 'View Image', 'draw-attention' ), /* View Display Title */
+ 'search_items' => __( 'Search Images', 'draw-attention' ), /* Search CPT_SINGULAR_NAME Title */
+ 'not_found' => __( 'Nothing found in the Database.', 'draw-attention' ), /* This displays if there are no entries yet */
+ 'not_found_in_trash' => __( 'Nothing found in Trash', 'draw-attention' ), /* This displays if there is nothing in the trash */
+ 'parent_item_colon' => '',
), /* end of arrays */
- 'description' => __( 'Stores '.$this->post_type.'s in the database', 'draw-attention' ), /* CPT_SINGULAR_NAME Description */
- 'public' => true,
- 'publicly_queryable' => true,
+ 'description' => __( 'Stores ' . $this->post_type . 's in the database', 'draw-attention' ), /* CPT_SINGULAR_NAME Description */
+ 'public' => true,
+ 'publicly_queryable' => true,
'exclude_from_search' => true,
- 'show_ui' => true,
- 'query_var' => true,
- 'menu_position' => 8, /* this is what order you want it to appear in on the left hand side menu */
- 'menu_icon' => 'dashicons-images-alt2', /* the icon for the custom post type menu */
- 'rewrite' => false,
- 'has_archive' => $this->post_type.'s', /* you can rename the slug here */
- 'capabilities' => array(
- 'edit_post' => 'edit_others_posts',
- 'edit_posts' => 'edit_others_posts',
- 'edit_others_posts' => 'edit_others_posts',
- 'publish_posts' => 'edit_others_posts',
- 'read_post' => 'edit_others_posts',
+ 'show_ui' => true,
+ 'query_var' => true,
+ 'menu_position' => 8, /* this is what order you want it to appear in on the left hand side menu */
+ 'menu_icon' => 'dashicons-images-alt2', /* the icon for the custom post type menu */
+ 'rewrite' => false,
+ 'has_archive' => $this->post_type . 's', /* you can rename the slug here */
+ 'capabilities' => array(
+ 'edit_post' => 'edit_others_posts',
+ 'edit_posts' => 'edit_others_posts',
+ 'edit_others_posts' => 'edit_others_posts',
+ 'publish_posts' => 'edit_others_posts',
+ 'read_post' => 'edit_others_posts',
'read_private_posts' => 'edit_others_posts',
- 'delete_post' => 'edit_others_posts'
+ 'delete_post' => 'edit_others_posts',
),
- 'hierarchical' => false,
+ 'hierarchical' => false,
/* the next one is important, it tells what's enabled in the post editor */
- 'supports' => array( 'title', 'thumbnail' ),
- ) /* end of options */
+ 'supports' => array( 'title', 'thumbnail' ),
+ ) /* end of options */
); /* end of register post type */
}
- function get_image ( $id, $size = 'projects-thumbnail' ) {
+ function get_image( $id, $size = 'projects-thumbnail' ) {
$response = '';
if ( has_post_thumbnail( $id ) ) {
@@ -91,11 +96,11 @@ function get_image ( $id, $size = 'projects-thumbnail' ) {
*
* @access public
* @param string $column_name
- * @param int $id
+ * @param int $id
* @since 1.0.0
* @return void
*/
- public function register_custom_columns ( $column_name, $id ) {
+ public function register_custom_columns( $column_name, $id ) {
global $wpdb, $post;
$meta = get_post_custom( $id );
@@ -103,15 +108,15 @@ public function register_custom_columns ( $column_name, $id ) {
switch ( $column_name ) {
case 'image':
- $value = '';
+ $value = '';
- $value = $this->get_image( $id, 120 );
+ $value = $this->get_image( $id, 120 );
- echo $value;
- break;
+ echo $value;
+ break;
default:
- break;
+ break;
}
} // End register_custom_columns()
@@ -124,7 +129,7 @@ public function register_custom_columns ( $column_name, $id ) {
* @since 1.0.0
* @return void
*/
- public function register_custom_column_headings ( $defaults ) {
+ public function register_custom_column_headings( $defaults ) {
$new_columns = array();
$new_columns['cb'] = $defaults['cb'];
@@ -132,7 +137,8 @@ public function register_custom_column_headings ( $defaults ) {
$last_item = '';
- if ( isset( $defaults['date'] ) ) { unset( $defaults['date'] ); }
+ if ( isset( $defaults['date'] ) ) {
+ unset( $defaults['date'] ); }
if ( count( $defaults ) > 2 ) {
$last_item = array_slice( $defaults, -1 );
@@ -143,7 +149,7 @@ public function register_custom_column_headings ( $defaults ) {
if ( $last_item != '' ) {
foreach ( $last_item as $k => $v ) {
- $defaults[$k] = $v;
+ $defaults[ $k ] = $v;
break;
}
}
diff --git a/public/includes/custom_fields.php b/public/includes/custom_fields.php
index 8a95a95..3f99228 100644
--- a/public/includes/custom_fields.php
+++ b/public/includes/custom_fields.php
@@ -1,16 +1,16 @@
parent = $parent;
- if ( !class_exists( 'CMB2' ) ) {
- if ( file_exists( __DIR__ .'/lib/cmb2/init.php' ) ) {
- require_once __DIR__ .'/lib/cmb2/init.php';
- } elseif ( file_exists( __DIR__ .'/lib/CMB2/init.php' ) ) {
- require_once __DIR__ .'/lib/CMB2/init.php';
+ if ( ! class_exists( 'CMB2' ) ) {
+ if ( file_exists( __DIR__ . '/lib/cmb2/init.php' ) ) {
+ require_once __DIR__ . '/lib/cmb2/init.php';
+ } elseif ( file_exists( __DIR__ . '/lib/CMB2/init.php' ) ) {
+ require_once __DIR__ . '/lib/CMB2/init.php';
}
}
@@ -36,61 +36,82 @@ function __construct( $parent ) {
}
function cmb2_render_text_number( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
- if ( $escaped_value == "-1" ) $escaped_value = 0;
- if ( $escaped_value === '' ) $escaped_value = 1;
- echo $field_type_object->input( array( 'class' => 'cmb2-text-small', 'type' => 'number', 'value' => $escaped_value, ) ).'px';
+ if ( $escaped_value == '-1' ) {
+ $escaped_value = 0;
+ }
+ if ( $escaped_value === '' ) {
+ $escaped_value = 1;
+ }
+ echo $field_type_object->input(
+ array(
+ 'class' => 'cmb2-text-small',
+ 'type' => 'number',
+ 'value' => $escaped_value,
+ )
+ ) . 'px';
}
function cmb2_sanitize_text_number( $new, $value, $object_id, $args, $field ) {
- $new = preg_replace( "/[^0-9]/", "", $value );
- if ( empty( $new ) ) $new = -1;
+ $new = preg_replace( '/[^0-9]/', '', $value );
+ if ( empty( $new ) ) {
+ $new = -1;
+ }
return $new;
}
function cmb2_render_opacity( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
- echo $field_type_object->input( array( 'class' => 'cmb2-text-small', 'type' => 'range', 'min' => 0.01, 'max' => 1.01, 'step' => 0.05, ) );
- echo ''.( ( $escaped_value - .01 ) * 100).' %';
+ echo $field_type_object->input(
+ array(
+ 'class' => 'cmb2-text-small',
+ 'type' => 'range',
+ 'min' => 0.01,
+ 'max' => 1.01,
+ 'step' => 0.05,
+ )
+ );
+ echo '' . ( ( $escaped_value - .01 ) * 100 ) . ' %';
}
function cmb2_sanitize_opacity( $new ) {
return $new;
}
public function add_hotspot_area_details_table_metabox() {
- add_meta_box( 'hotspot_area_details_table',
- __('Hotspot Areas', 'draw-attention' ),
+ add_meta_box(
+ 'hotspot_area_details_table',
+ __( 'Hotspot Areas', 'draw-attention' ),
array( $this, 'hotspot_area_details_table_metabox_callback' ),
$page,
'normal',
'default'
- ) ;
+ );
}
function highlight_styling_metabox( $metaboxes ) {
if ( ! is_array( $metaboxes ) ) {
$metaboxes = array();
}
-
+
$metaboxes['highlight_styling'] = array(
- 'id' => 'highlight_styling_metabox',
- 'title' => __( 'Highlight Styling', 'draw-attention' ),
- 'object_types' => array( $this->parent->cpt->post_type, ),
- 'context' => 'normal',
- 'priority' => 'high',
- 'fields' => array(
+ 'id' => 'highlight_styling_metabox',
+ 'title' => __( 'Highlight Styling', 'draw-attention' ),
+ 'object_types' => array( $this->parent->cpt->post_type ),
+ 'context' => 'normal',
+ 'priority' => 'high',
+ 'fields' => array(
array(
'name' => __( 'Highlight Color', 'draw-attention' ),
'desc' => '',
'id' => $this->prefix . 'map_highlight_color',
'type' => 'colorpicker',
- 'default' => '#ffffff'
+ 'default' => '#ffffff',
),
array(
- 'name' => __( 'Highlight Opacity', 'draw-attention' ),
- 'desc' => '',
- 'id' => $this->prefix . 'map_highlight_opacity',
- 'type' => 'opacity',
- 'default' => '0.81',
+ 'name' => __( 'Highlight Opacity', 'draw-attention' ),
+ 'desc' => '',
+ 'id' => $this->prefix . 'map_highlight_opacity',
+ 'type' => 'opacity',
+ 'default' => '0.81',
'escape_cb' => array( $this, 'cmb2_allow_0_value' ),
),
array(
@@ -98,23 +119,22 @@ function highlight_styling_metabox( $metaboxes ) {
'desc' => '',
'id' => $this->prefix . 'map_border_color',
'type' => 'colorpicker',
- 'default' => '#ffffff'
+ 'default' => '#ffffff',
),
array(
'name' => __( 'Border Opacity', 'draw-attention' ),
'desc' => '',
'id' => $this->prefix . 'map_border_opacity',
'type' => 'opacity',
- 'default' => '0.81'
+ 'default' => '0.81',
),
array(
- 'name' => __( 'Border Width', 'draw-attention' ),
- 'desc' => '',
- 'id' => $this->prefix . 'map_border_width',
- 'type' => 'text_number',
+ 'name' => __( 'Border Width', 'draw-attention' ),
+ 'desc' => '',
+ 'id' => $this->prefix . 'map_border_width',
+ 'type' => 'text_number',
),
-
),
);
@@ -122,28 +142,28 @@ function highlight_styling_metabox( $metaboxes ) {
}
// function cmb2_allow_0_value( $meta_value, $args, $field ) {
- // return $meta_value;
+ // return $meta_value;
// }
function moreinfo_metabox( $metaboxes ) {
if ( ! is_array( $metaboxes ) ) {
$metaboxes = array();
}
-
+
$metaboxes['moreinfo'] = array(
- 'id' => 'moreinfo_metabox',
- 'title' => __( 'More Info Box Styling', 'draw-attention' ),
- 'object_types' => array( $this->parent->cpt->post_type, ),
- 'context' => 'normal',
- 'priority' => 'high',
- 'fields' => array(
+ 'id' => 'moreinfo_metabox',
+ 'title' => __( 'More Info Box Styling', 'draw-attention' ),
+ 'object_types' => array( $this->parent->cpt->post_type ),
+ 'context' => 'normal',
+ 'priority' => 'high',
+ 'fields' => array(
array(
'name' => __( 'Image Background Color', 'draw-attention' ),
'desc' => __( 'Set the background color of behind the image', 'draw-attention' ),
'id' => $this->prefix . 'image_background_color',
'type' => 'colorpicker',
- 'default' => '#efefef'
+ 'default' => '#efefef',
),
array(
@@ -151,7 +171,7 @@ function moreinfo_metabox( $metaboxes ) {
'desc' => __( 'Set the color of titles in More Info box', 'draw-attention' ),
'id' => $this->prefix . 'map_title_color',
'type' => 'colorpicker',
- 'default' => '#000000'
+ 'default' => '#000000',
),
array(
@@ -159,7 +179,7 @@ function moreinfo_metabox( $metaboxes ) {
'desc' => __( 'Set the color of body text in More Info box', 'draw-attention' ),
'id' => $this->prefix . 'map_text_color',
'type' => 'colorpicker',
- 'default' => '#000000'
+ 'default' => '#000000',
),
array(
@@ -167,16 +187,16 @@ function moreinfo_metabox( $metaboxes ) {
'desc' => __( 'Set the background color of the More Info box', 'draw-attention' ),
'id' => $this->prefix . 'map_background_color',
'type' => 'colorpicker',
- 'default' => '#ffffff'
+ 'default' => '#ffffff',
),
array(
- 'name' => __( 'Default More Info', 'draw-attention' ),
- 'desc' => __( 'Set the text to show up in the more info box (when no area is selected)', 'draw-attention' ),
- 'id' => $this->prefix . 'map_more_info',
- 'type' => 'textarea_small',
+ 'name' => __( 'Default More Info', 'draw-attention' ),
+ 'desc' => __( 'Set the text to show up in the more info box (when no area is selected)', 'draw-attention' ),
+ 'id' => $this->prefix . 'map_more_info',
+ 'type' => 'textarea_small',
),
-
+
),
);
@@ -187,148 +207,163 @@ function hotspot_area_group_details_metabox( $metaboxes ) {
if ( ! is_array( $metaboxes ) ) {
$metaboxes = array();
}
-
- if ( empty( $_REQUEST['post'] ) && empty( $_POST ) ) { return $metaboxes; }
- if ( !empty( $_REQUEST['post'] ) ) {
+ if ( empty( $_REQUEST['post'] ) && empty( $_POST ) ) {
+ return $metaboxes; }
+
+ if ( ! empty( $_REQUEST['post'] ) ) {
$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( esc_attr( $_REQUEST['post'] ) ), 'full' );
}
- $metaboxes['field_group'] = apply_filters( 'da_hotspot_area_group_details', array(
- 'id' => 'field_group',
- 'title' => __( 'Hotspot Areas', 'draw-attention' ),
- 'object_types' => array( $this->parent->cpt->post_type, ),
- 'fields' => array(
- array(
- 'id' => $this->prefix . 'hotspots',
- 'type' => 'group',
- 'description' => __( 'Draw the clickable areas of your image', 'draw-attention' ),
- 'options' => array(
- 'group_title' => __( 'Clickable Area #{#}', 'draw-attention' ), // {#} gets replaced by row number
- 'add_button' => __( 'Add Another Area', 'draw-attention' ),
- 'remove_button' => __( 'Remove Area', 'draw-attention' ),
- 'sortable' => false, // beta
- 'remove_confirm' => esc_html__( 'Are you sure you want to delete this? There is no undo.', 'draw-attention' ), // Performs confirmation before removing group
- ),
- // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed.
- 'fields' => array(
- 'coordinates' => array(
- 'name' => __( 'Coordinates', 'draw-attention' ),
- 'id' => 'coordinates',
- 'type' => 'text',
- 'attributes' => array(
- 'data-image-url' => ( !empty( $thumbnail_src[0] ) ) ? $thumbnail_src[0] : '',
- ),
- ),
- 'shape' => array(
- 'name' => __( 'Shape', 'draw-attention' ),
- 'id' => 'shape',
- 'type' => 'text',
- 'default' => 'polygon'
+ $metaboxes['field_group'] = apply_filters(
+ 'da_hotspot_area_group_details',
+ array(
+ 'id' => 'field_group',
+ 'title' => __( 'Hotspot Areas', 'draw-attention' ),
+ 'object_types' => array( $this->parent->cpt->post_type ),
+ 'fields' => array(
+ array(
+ 'id' => $this->prefix . 'hotspots',
+ 'type' => 'group',
+ 'description' => __( 'Draw the clickable areas of your image', 'draw-attention' ),
+ 'options' => array(
+ 'group_title' => __( 'Clickable Area #{#}', 'draw-attention' ), // {#} gets replaced by row number
+ 'add_button' => __( 'Add Another Area', 'draw-attention' ),
+ 'remove_button' => __( 'Remove Area', 'draw-attention' ),
+ 'sortable' => false, // beta
+ 'remove_confirm' => esc_html__( 'Are you sure you want to delete this? There is no undo.', 'draw-attention' ), // Performs confirmation before removing group
),
- 'title' => array(
- 'name' => __('Title', 'draw-attention' ),
- 'id' => 'title',
- 'type' => 'text',
- ),
- 'action' => array(
- 'name' => __('Action', 'draw-attention' ),
- 'description' => '',
- 'id' => 'action',
- 'attributes' => array(
- 'class' => 'cmb2_select action',
+ // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed.
+ 'fields' => array(
+ 'coordinates' => array(
+ 'name' => __( 'Coordinates', 'draw-attention' ),
+ 'id' => 'coordinates',
+ 'type' => 'text',
+ 'attributes' => array(
+ 'data-image-url' => ( ! empty( $thumbnail_src[0] ) ) ? $thumbnail_src[0] : '',
+ ),
),
- // 'type' => 'textarea_small',
- 'type' => 'select',
- 'options' => array(
- '' => 'Show More Info',
+ 'shape' => array(
+ 'name' => __( 'Shape', 'draw-attention' ),
+ 'id' => 'shape',
+ 'type' => 'text',
+ 'default' => 'polygon',
),
- ),
- 'description' => array(
- 'name' => __('Description', 'draw-attention' ),
- 'description' => '',
- 'id' => 'description',
- // 'type' => 'textarea_small',
- 'type' => 'wysiwyg',
- 'options' => array(
- // 'wpautop' => true, // use wpautop?
- 'media_buttons' => false, // show insert/upload button(s)
- // 'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here
- 'textarea_rows' => get_option('default_post_edit_rows', 7), // rows="..."
- // 'tabindex' => '',
- // 'editor_css' => '', // intended for extra styles for both visual and HTML editors buttons, needs to include the `
-
+
window.daStyles =
-
-*/ ?>
+
+ */
+ ?>
- get_plugin_dir() . '/public/views/image_template.php' );
- } else {
- require( $this->get_plugin_dir() . '/public/views/more_info_template.php' );
- require( $this->get_plugin_dir() . '/public/views/image_template.php' );
- } ?>
+ get_plugin_dir() . '/public/views/image_template.php';
+ } else {
+ require $this->get_plugin_dir() . '/public/views/more_info_template.php';
+ require $this->get_plugin_dir() . '/public/views/image_template.php';
+ }
+ ?>
- $hotspot ) : ?>
+ $hotspot ) : ?>
-
+
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 .
- $hotspot ) : ?>
-
+ $hotspot ) :
+ ?>
+
- "
?>
';
@@ -199,23 +211,26 @@ class=""
?>
' . $hotspot['title'] . '', $hotspot ); ?>
-
+
';
+ $detail_image_img_tag = '
';
}
echo $detail_image_img_tag;
?>
-
+
- autoembed( $wp_embed->run_shortcode( $hotspot['description'] ) ) ) ); ?>
+ autoembed( $wp_embed->run_shortcode( $hotspot['description'] ) ) ) );}
+ ?>
diff --git a/public/views/single-da_image.php b/public/views/single-da_image.php
index 43d5b6f..9660127 100644
--- a/public/views/single-da_image.php
+++ b/public/views/single-da_image.php
@@ -9,9 +9,12 @@
-
-
-
+
+
+
diff --git a/uninstall.php b/uninstall.php
index fe4f1f2..e2683e8 100644
--- a/uninstall.php
+++ b/uninstall.php
@@ -19,7 +19,8 @@
if ( is_multisite() ) {
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A );
- /* @TODO: delete all transient, options and files you may have added
+ /*
+ @TODO: delete all transient, options and files you may have added
delete_transient( 'TRANSIENT_NAME' );
delete_option('OPTION_NAME');
//info: remove custom file directory for main site
@@ -34,9 +35,10 @@
*/
if ( $blogs ) {
- foreach ( $blogs as $blog ) {
+ foreach ( $blogs as $blog ) {
switch_to_blog( $blog['blog_id'] );
- /* @TODO: delete all transient, options and files you may have added
+ /*
+ @TODO: delete all transient, options and files you may have added
delete_transient( 'TRANSIENT_NAME' );
delete_option('OPTION_NAME');
//info: remove custom file directory for main site
@@ -55,9 +57,9 @@
restore_current_blog();
}
}
-
} else {
- /* @TODO: delete all transient, options and files you may have added
+ /*
+ @TODO: delete all transient, options and files you may have added
delete_transient( 'TRANSIENT_NAME' );
delete_option('OPTION_NAME');
//info: remove custom file directory for main site
From 242c466645369372d4ce5fc567af0d7b9c9ecfac Mon Sep 17 00:00:00 2001
From: hsein-bitar
Date: Tue, 13 Feb 2024 17:39:48 +0200
Subject: [PATCH 08/12] test again
From 96728d5b4efe24e5d6658c6ebd17b481327c1eac Mon Sep 17 00:00:00 2001
From: otto-bot-git
Date: Wed, 14 Feb 2024 00:08:44 +0000
Subject: [PATCH 09/12] Requiring review from 'cynhu92' ci bypass
---
.github/code-review/require-person/cynhu92/PR-50 | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 .github/code-review/require-person/cynhu92/PR-50
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 0000000..e69de29
From 56ffd0bbc6b00ca2c2ddbb331f681f6d3e1871fb Mon Sep 17 00:00:00 2001
From: hsein-bitar
Date: Wed, 14 Feb 2024 17:03:36 +0200
Subject: [PATCH 10/12] avoid formatting minified file
public/assets/js/leaflet.js
---
.prettierignore | 3 +-
public/assets/js/leaflet.js | 7107 +----------------------------------
2 files changed, 3 insertions(+), 7107 deletions(-)
diff --git a/.prettierignore b/.prettierignore
index b584bdc..ba648dd 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1 +1,2 @@
-*min.*
\ No newline at end of file
+*min.*
+public/assets/js/leaflet.js
\ No newline at end of file
diff --git a/public/assets/js/leaflet.js b/public/assets/js/leaflet.js
index 175efa5..f914d94 100644
--- a/public/assets/js/leaflet.js
+++ b/public/assets/js/leaflet.js
@@ -2,7109 +2,4 @@
* Leaflet 1.5.1, a JS library for interactive maps. http://leafletjs.com
* (c) 2010-2018 Vladimir Agafonkin, (c) 2010-2011 CloudMade
*/
-!(function (t, i) {
- "object" == typeof exports && "undefined" != typeof module
- ? i(exports)
- : "function" == typeof define && define.amd
- ? define(["exports"], i)
- : i((t.L = {}));
-})(this, function (t) {
- "use strict";
- var i = Object.freeze;
- function h(t) {
- var i, e, n, o;
- for (e = 1, n = arguments.length; e < n; e++)
- for (i in (o = arguments[e])) t[i] = o[i];
- return t;
- }
- Object.freeze = function (t) {
- return t;
- };
- var s =
- Object.create ||
- function (t) {
- return (e.prototype = t), new e();
- };
- function e() {}
- function a(t, i) {
- var e = Array.prototype.slice;
- if (t.bind) return t.bind.apply(t, e.call(arguments, 1));
- var n = e.call(arguments, 2);
- return function () {
- return t.apply(i, n.length ? n.concat(e.call(arguments)) : arguments);
- };
- }
- var n = 0;
- function u(t) {
- return (t._leaflet_id = t._leaflet_id || ++n), t._leaflet_id;
- }
- function o(t, i, e) {
- var n, o, s, r;
- return (
- (r = function () {
- (n = !1), o && (s.apply(e, o), (o = !1));
- }),
- (s = function () {
- n
- ? (o = arguments)
- : (t.apply(e, arguments), setTimeout(r, i), (n = !0));
- })
- );
- }
- function r(t, i, e) {
- var n = i[1],
- o = i[0],
- s = n - o;
- return t === n && e ? t : ((((t - o) % s) + s) % s) + o;
- }
- function l() {
- return !1;
- }
- function c(t, i) {
- return (i = void 0 === i ? 6 : i), +(Math.round(t + "e+" + i) + "e-" + i);
- }
- function _(t) {
- return t.trim ? t.trim() : t.replace(/^\s+|\s+$/g, "");
- }
- function d(t) {
- return _(t).split(/\s+/);
- }
- function p(t, i) {
- for (var e in (t.hasOwnProperty("options") ||
- (t.options = t.options ? s(t.options) : {}),
- i))
- t.options[e] = i[e];
- return t.options;
- }
- function m(t, i, e) {
- var n = [];
- for (var o in t)
- n.push(
- encodeURIComponent(e ? o.toUpperCase() : o) +
- "=" +
- encodeURIComponent(t[o]),
- );
- return (i && -1 !== i.indexOf("?") ? "&" : "?") + n.join("&");
- }
- var f = /\{ *([\w_-]+) *\}/g;
- function g(t, n) {
- return t.replace(f, function (t, i) {
- var e = n[i];
- if (void 0 === e) throw new Error("No value provided for variable " + t);
- return "function" == typeof e && (e = e(n)), e;
- });
- }
- var v =
- Array.isArray ||
- function (t) {
- return "[object Array]" === Object.prototype.toString.call(t);
- };
- function y(t, i) {
- for (var e = 0; e < t.length; e++) if (t[e] === i) return e;
- return -1;
- }
- var x = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";
- function w(t) {
- return window["webkit" + t] || window["moz" + t] || window["ms" + t];
- }
- var P = 0;
- function b(t) {
- var i = +new Date(),
- e = Math.max(0, 16 - (i - P));
- return (P = i + e), window.setTimeout(t, e);
- }
- var T = window.requestAnimationFrame || w("RequestAnimationFrame") || b,
- z =
- window.cancelAnimationFrame ||
- w("CancelAnimationFrame") ||
- w("CancelRequestAnimationFrame") ||
- function (t) {
- window.clearTimeout(t);
- };
- function M(t, i, e) {
- if (!e || T !== b) return T.call(window, a(t, i));
- t.call(i);
- }
- function C(t) {
- t && z.call(window, t);
- }
- var S = (Object.freeze || Object)({
- freeze: i,
- extend: h,
- create: s,
- bind: a,
- lastId: n,
- stamp: u,
- throttle: o,
- wrapNum: r,
- falseFn: l,
- formatNum: c,
- trim: _,
- splitWords: d,
- setOptions: p,
- getParamString: m,
- template: g,
- isArray: v,
- indexOf: y,
- emptyImageUrl: x,
- requestFn: T,
- cancelFn: z,
- requestAnimFrame: M,
- cancelAnimFrame: C,
- });
- function Z() {}
- (Z.extend = function (t) {
- function i() {
- this.initialize && this.initialize.apply(this, arguments),
- this.callInitHooks();
- }
- var e = (i.__super__ = this.prototype),
- n = s(e);
- for (var o in (((n.constructor = i).prototype = n), this))
- this.hasOwnProperty(o) &&
- "prototype" !== o &&
- "__super__" !== o &&
- (i[o] = this[o]);
- return (
- t.statics && (h(i, t.statics), delete t.statics),
- t.includes &&
- ((function (t) {
- if ("undefined" == typeof L || !L || !L.Mixin) return;
- t = v(t) ? t : [t];
- for (var i = 0; i < t.length; i++)
- t[i] === L.Mixin.Events &&
- console.warn(
- "Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",
- new Error().stack,
- );
- })(t.includes),
- h.apply(null, [n].concat(t.includes)),
- delete t.includes),
- n.options && (t.options = h(s(n.options), t.options)),
- h(n, t),
- (n._initHooks = []),
- (n.callInitHooks = function () {
- if (!this._initHooksCalled) {
- e.callInitHooks && e.callInitHooks.call(this),
- (this._initHooksCalled = !0);
- for (var t = 0, i = n._initHooks.length; t < i; t++)
- n._initHooks[t].call(this);
- }
- }),
- i
- );
- }),
- (Z.include = function (t) {
- return h(this.prototype, t), this;
- }),
- (Z.mergeOptions = function (t) {
- return h(this.prototype.options, t), this;
- }),
- (Z.addInitHook = function (t) {
- var i = Array.prototype.slice.call(arguments, 1),
- e =
- "function" == typeof t
- ? t
- : function () {
- this[t].apply(this, i);
- };
- return (
- (this.prototype._initHooks = this.prototype._initHooks || []),
- this.prototype._initHooks.push(e),
- this
- );
- });
- var E = {
- on: function (t, i, e) {
- if ("object" == typeof t) for (var n in t) this._on(n, t[n], i);
- else
- for (var o = 0, s = (t = d(t)).length; o < s; o++) this._on(t[o], i, e);
- return this;
- },
- off: function (t, i, e) {
- if (t)
- if ("object" == typeof t) for (var n in t) this._off(n, t[n], i);
- else
- for (var o = 0, s = (t = d(t)).length; o < s; o++)
- this._off(t[o], i, e);
- else delete this._events;
- return this;
- },
- _on: function (t, i, e) {
- this._events = this._events || {};
- var n = this._events[t];
- n || ((n = []), (this._events[t] = n)), e === this && (e = void 0);
- for (var o = { fn: i, ctx: e }, s = n, r = 0, a = s.length; r < a; r++)
- if (s[r].fn === i && s[r].ctx === e) return;
- s.push(o);
- },
- _off: function (t, i, e) {
- var n, o, s;
- if (this._events && (n = this._events[t]))
- if (i) {
- if ((e === this && (e = void 0), n))
- for (o = 0, s = n.length; o < s; o++) {
- var r = n[o];
- if (r.ctx === e && r.fn === i)
- return (
- (r.fn = l),
- this._firingCount && (this._events[t] = n = n.slice()),
- void n.splice(o, 1)
- );
- }
- } else {
- for (o = 0, s = n.length; o < s; o++) n[o].fn = l;
- delete this._events[t];
- }
- },
- fire: function (t, i, e) {
- if (!this.listens(t, e)) return this;
- var n = h({}, i, {
- type: t,
- target: this,
- sourceTarget: (i && i.sourceTarget) || this,
- });
- if (this._events) {
- var o = this._events[t];
- if (o) {
- this._firingCount = this._firingCount + 1 || 1;
- for (var s = 0, r = o.length; s < r; s++) {
- var a = o[s];
- a.fn.call(a.ctx || this, n);
- }
- this._firingCount--;
- }
- }
- return e && this._propagateEvent(n), this;
- },
- listens: function (t, i) {
- var e = this._events && this._events[t];
- if (e && e.length) return !0;
- if (i)
- for (var n in this._eventParents)
- if (this._eventParents[n].listens(t, i)) return !0;
- return !1;
- },
- once: function (t, i, e) {
- if ("object" == typeof t) {
- for (var n in t) this.once(n, t[n], i);
- return this;
- }
- var o = a(function () {
- this.off(t, i, e).off(t, o, e);
- }, this);
- return this.on(t, i, e).on(t, o, e);
- },
- addEventParent: function (t) {
- return (
- (this._eventParents = this._eventParents || {}),
- (this._eventParents[u(t)] = t),
- this
- );
- },
- removeEventParent: function (t) {
- return this._eventParents && delete this._eventParents[u(t)], this;
- },
- _propagateEvent: function (t) {
- for (var i in this._eventParents)
- this._eventParents[i].fire(
- t.type,
- h({ layer: t.target, propagatedFrom: t.target }, t),
- !0,
- );
- },
- };
- (E.addEventListener = E.on),
- (E.removeEventListener = E.clearAllEventListeners = E.off),
- (E.addOneTimeEventListener = E.once),
- (E.fireEvent = E.fire),
- (E.hasEventListeners = E.listens);
- var k = Z.extend(E);
- function B(t, i, e) {
- (this.x = e ? Math.round(t) : t), (this.y = e ? Math.round(i) : i);
- }
- var A =
- Math.trunc ||
- function (t) {
- return 0 < t ? Math.floor(t) : Math.ceil(t);
- };
- function I(t, i, e) {
- return t instanceof B
- ? t
- : v(t)
- ? new B(t[0], t[1])
- : null == t
- ? t
- : "object" == typeof t && "x" in t && "y" in t
- ? new B(t.x, t.y)
- : new B(t, i, e);
- }
- function O(t, i) {
- if (t)
- for (var e = i ? [t, i] : t, n = 0, o = e.length; n < o; n++)
- this.extend(e[n]);
- }
- function R(t, i) {
- return !t || t instanceof O ? t : new O(t, i);
- }
- function N(t, i) {
- if (t)
- for (var e = i ? [t, i] : t, n = 0, o = e.length; n < o; n++)
- this.extend(e[n]);
- }
- function D(t, i) {
- return t instanceof N ? t : new N(t, i);
- }
- function j(t, i, e) {
- if (isNaN(t) || isNaN(i))
- throw new Error("Invalid LatLng object: (" + t + ", " + i + ")");
- (this.lat = +t), (this.lng = +i), void 0 !== e && (this.alt = +e);
- }
- function W(t, i, e) {
- return t instanceof j
- ? t
- : v(t) && "object" != typeof t[0]
- ? 3 === t.length
- ? new j(t[0], t[1], t[2])
- : 2 === t.length
- ? new j(t[0], t[1])
- : null
- : null == t
- ? t
- : "object" == typeof t && "lat" in t
- ? new j(t.lat, "lng" in t ? t.lng : t.lon, t.alt)
- : void 0 === i
- ? null
- : new j(t, i, e);
- }
- (B.prototype = {
- clone: function () {
- return new B(this.x, this.y);
- },
- add: function (t) {
- return this.clone()._add(I(t));
- },
- _add: function (t) {
- return (this.x += t.x), (this.y += t.y), this;
- },
- subtract: function (t) {
- return this.clone()._subtract(I(t));
- },
- _subtract: function (t) {
- return (this.x -= t.x), (this.y -= t.y), this;
- },
- divideBy: function (t) {
- return this.clone()._divideBy(t);
- },
- _divideBy: function (t) {
- return (this.x /= t), (this.y /= t), this;
- },
- multiplyBy: function (t) {
- return this.clone()._multiplyBy(t);
- },
- _multiplyBy: function (t) {
- return (this.x *= t), (this.y *= t), this;
- },
- scaleBy: function (t) {
- return new B(this.x * t.x, this.y * t.y);
- },
- unscaleBy: function (t) {
- return new B(this.x / t.x, this.y / t.y);
- },
- round: function () {
- return this.clone()._round();
- },
- _round: function () {
- return (this.x = Math.round(this.x)), (this.y = Math.round(this.y)), this;
- },
- floor: function () {
- return this.clone()._floor();
- },
- _floor: function () {
- return (this.x = Math.floor(this.x)), (this.y = Math.floor(this.y)), this;
- },
- ceil: function () {
- return this.clone()._ceil();
- },
- _ceil: function () {
- return (this.x = Math.ceil(this.x)), (this.y = Math.ceil(this.y)), this;
- },
- trunc: function () {
- return this.clone()._trunc();
- },
- _trunc: function () {
- return (this.x = A(this.x)), (this.y = A(this.y)), this;
- },
- distanceTo: function (t) {
- var i = (t = I(t)).x - this.x,
- e = t.y - this.y;
- return Math.sqrt(i * i + e * e);
- },
- equals: function (t) {
- return (t = I(t)).x === this.x && t.y === this.y;
- },
- contains: function (t) {
- return (
- (t = I(t)),
- Math.abs(t.x) <= Math.abs(this.x) && Math.abs(t.y) <= Math.abs(this.y)
- );
- },
- toString: function () {
- return "Point(" + c(this.x) + ", " + c(this.y) + ")";
- },
- }),
- (O.prototype = {
- extend: function (t) {
- return (
- (t = I(t)),
- this.min || this.max
- ? ((this.min.x = Math.min(t.x, this.min.x)),
- (this.max.x = Math.max(t.x, this.max.x)),
- (this.min.y = Math.min(t.y, this.min.y)),
- (this.max.y = Math.max(t.y, this.max.y)))
- : ((this.min = t.clone()), (this.max = t.clone())),
- this
- );
- },
- getCenter: function (t) {
- return new B(
- (this.min.x + this.max.x) / 2,
- (this.min.y + this.max.y) / 2,
- t,
- );
- },
- getBottomLeft: function () {
- return new B(this.min.x, this.max.y);
- },
- getTopRight: function () {
- return new B(this.max.x, this.min.y);
- },
- getTopLeft: function () {
- return this.min;
- },
- getBottomRight: function () {
- return this.max;
- },
- getSize: function () {
- return this.max.subtract(this.min);
- },
- contains: function (t) {
- var i, e;
- return (
- (t =
- "number" == typeof t[0] || t instanceof B ? I(t) : R(t)) instanceof
- O
- ? ((i = t.min), (e = t.max))
- : (i = e = t),
- i.x >= this.min.x &&
- e.x <= this.max.x &&
- i.y >= this.min.y &&
- e.y <= this.max.y
- );
- },
- intersects: function (t) {
- t = R(t);
- var i = this.min,
- e = this.max,
- n = t.min,
- o = t.max,
- s = o.x >= i.x && n.x <= e.x,
- r = o.y >= i.y && n.y <= e.y;
- return s && r;
- },
- overlaps: function (t) {
- t = R(t);
- var i = this.min,
- e = this.max,
- n = t.min,
- o = t.max,
- s = o.x > i.x && n.x < e.x,
- r = o.y > i.y && n.y < e.y;
- return s && r;
- },
- isValid: function () {
- return !(!this.min || !this.max);
- },
- }),
- (N.prototype = {
- extend: function (t) {
- var i,
- e,
- n = this._southWest,
- o = this._northEast;
- if (t instanceof j) e = i = t;
- else {
- if (!(t instanceof N)) return t ? this.extend(W(t) || D(t)) : this;
- if (((i = t._southWest), (e = t._northEast), !i || !e)) return this;
- }
- return (
- n || o
- ? ((n.lat = Math.min(i.lat, n.lat)),
- (n.lng = Math.min(i.lng, n.lng)),
- (o.lat = Math.max(e.lat, o.lat)),
- (o.lng = Math.max(e.lng, o.lng)))
- : ((this._southWest = new j(i.lat, i.lng)),
- (this._northEast = new j(e.lat, e.lng))),
- this
- );
- },
- pad: function (t) {
- var i = this._southWest,
- e = this._northEast,
- n = Math.abs(i.lat - e.lat) * t,
- o = Math.abs(i.lng - e.lng) * t;
- return new N(new j(i.lat - n, i.lng - o), new j(e.lat + n, e.lng + o));
- },
- getCenter: function () {
- return new j(
- (this._southWest.lat + this._northEast.lat) / 2,
- (this._southWest.lng + this._northEast.lng) / 2,
- );
- },
- getSouthWest: function () {
- return this._southWest;
- },
- getNorthEast: function () {
- return this._northEast;
- },
- getNorthWest: function () {
- return new j(this.getNorth(), this.getWest());
- },
- getSouthEast: function () {
- return new j(this.getSouth(), this.getEast());
- },
- getWest: function () {
- return this._southWest.lng;
- },
- getSouth: function () {
- return this._southWest.lat;
- },
- getEast: function () {
- return this._northEast.lng;
- },
- getNorth: function () {
- return this._northEast.lat;
- },
- contains: function (t) {
- t =
- "number" == typeof t[0] || t instanceof j || "lat" in t ? W(t) : D(t);
- var i,
- e,
- n = this._southWest,
- o = this._northEast;
- return (
- t instanceof N
- ? ((i = t.getSouthWest()), (e = t.getNorthEast()))
- : (i = e = t),
- i.lat >= n.lat && e.lat <= o.lat && i.lng >= n.lng && e.lng <= o.lng
- );
- },
- intersects: function (t) {
- t = D(t);
- var i = this._southWest,
- e = this._northEast,
- n = t.getSouthWest(),
- o = t.getNorthEast(),
- s = o.lat >= i.lat && n.lat <= e.lat,
- r = o.lng >= i.lng && n.lng <= e.lng;
- return s && r;
- },
- overlaps: function (t) {
- t = D(t);
- var i = this._southWest,
- e = this._northEast,
- n = t.getSouthWest(),
- o = t.getNorthEast(),
- s = o.lat > i.lat && n.lat < e.lat,
- r = o.lng > i.lng && n.lng < e.lng;
- return s && r;
- },
- toBBoxString: function () {
- return [
- this.getWest(),
- this.getSouth(),
- this.getEast(),
- this.getNorth(),
- ].join(",");
- },
- equals: function (t, i) {
- return (
- !!t &&
- ((t = D(t)),
- this._southWest.equals(t.getSouthWest(), i) &&
- this._northEast.equals(t.getNorthEast(), i))
- );
- },
- isValid: function () {
- return !(!this._southWest || !this._northEast);
- },
- });
- var H,
- F = {
- latLngToPoint: function (t, i) {
- var e = this.projection.project(t),
- n = this.scale(i);
- return this.transformation._transform(e, n);
- },
- pointToLatLng: function (t, i) {
- var e = this.scale(i),
- n = this.transformation.untransform(t, e);
- return this.projection.unproject(n);
- },
- project: function (t) {
- return this.projection.project(t);
- },
- unproject: function (t) {
- return this.projection.unproject(t);
- },
- scale: function (t) {
- return 256 * Math.pow(2, t);
- },
- zoom: function (t) {
- return Math.log(t / 256) / Math.LN2;
- },
- getProjectedBounds: function (t) {
- if (this.infinite) return null;
- var i = this.projection.bounds,
- e = this.scale(t);
- return new O(
- this.transformation.transform(i.min, e),
- this.transformation.transform(i.max, e),
- );
- },
- infinite: !(j.prototype = {
- equals: function (t, i) {
- return (
- !!t &&
- ((t = W(t)),
- Math.max(Math.abs(this.lat - t.lat), Math.abs(this.lng - t.lng)) <=
- (void 0 === i ? 1e-9 : i))
- );
- },
- toString: function (t) {
- return "LatLng(" + c(this.lat, t) + ", " + c(this.lng, t) + ")";
- },
- distanceTo: function (t) {
- return U.distance(this, W(t));
- },
- wrap: function () {
- return U.wrapLatLng(this);
- },
- toBounds: function (t) {
- var i = (180 * t) / 40075017,
- e = i / Math.cos((Math.PI / 180) * this.lat);
- return D([this.lat - i, this.lng - e], [this.lat + i, this.lng + e]);
- },
- clone: function () {
- return new j(this.lat, this.lng, this.alt);
- },
- }),
- wrapLatLng: function (t) {
- var i = this.wrapLng ? r(t.lng, this.wrapLng, !0) : t.lng;
- return new j(
- this.wrapLat ? r(t.lat, this.wrapLat, !0) : t.lat,
- i,
- t.alt,
- );
- },
- wrapLatLngBounds: function (t) {
- var i = t.getCenter(),
- e = this.wrapLatLng(i),
- n = i.lat - e.lat,
- o = i.lng - e.lng;
- if (0 == n && 0 == o) return t;
- var s = t.getSouthWest(),
- r = t.getNorthEast();
- return new N(new j(s.lat - n, s.lng - o), new j(r.lat - n, r.lng - o));
- },
- },
- U = h({}, F, {
- wrapLng: [-180, 180],
- R: 6371e3,
- distance: function (t, i) {
- var e = Math.PI / 180,
- n = t.lat * e,
- o = i.lat * e,
- s = Math.sin(((i.lat - t.lat) * e) / 2),
- r = Math.sin(((i.lng - t.lng) * e) / 2),
- a = s * s + Math.cos(n) * Math.cos(o) * r * r,
- h = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
- return this.R * h;
- },
- }),
- V = 6378137,
- q = {
- R: V,
- MAX_LATITUDE: 85.0511287798,
- project: function (t) {
- var i = Math.PI / 180,
- e = this.MAX_LATITUDE,
- n = Math.max(Math.min(e, t.lat), -e),
- o = Math.sin(n * i);
- return new B(
- this.R * t.lng * i,
- (this.R * Math.log((1 + o) / (1 - o))) / 2,
- );
- },
- unproject: function (t) {
- var i = 180 / Math.PI;
- return new j(
- (2 * Math.atan(Math.exp(t.y / this.R)) - Math.PI / 2) * i,
- (t.x * i) / this.R,
- );
- },
- bounds: ((H = V * Math.PI), new O([-H, -H], [H, H])),
- };
- function G(t, i, e, n) {
- if (v(t))
- return (
- (this._a = t[0]),
- (this._b = t[1]),
- (this._c = t[2]),
- void (this._d = t[3])
- );
- (this._a = t), (this._b = i), (this._c = e), (this._d = n);
- }
- function K(t, i, e, n) {
- return new G(t, i, e, n);
- }
- G.prototype = {
- transform: function (t, i) {
- return this._transform(t.clone(), i);
- },
- _transform: function (t, i) {
- return (
- (i = i || 1),
- (t.x = i * (this._a * t.x + this._b)),
- (t.y = i * (this._c * t.y + this._d)),
- t
- );
- },
- untransform: function (t, i) {
- return (
- (i = i || 1),
- new B((t.x / i - this._b) / this._a, (t.y / i - this._d) / this._c)
- );
- },
- };
- var Y,
- X = h({}, U, {
- code: "EPSG:3857",
- projection: q,
- transformation: ((Y = 0.5 / (Math.PI * q.R)), K(Y, 0.5, -Y, 0.5)),
- }),
- J = h({}, X, { code: "EPSG:900913" });
- function $(t) {
- return document.createElementNS("http://www.w3.org/2000/svg", t);
- }
- function Q(t, i) {
- var e,
- n,
- o,
- s,
- r,
- a,
- h = "";
- for (e = 0, o = t.length; e < o; e++) {
- for (n = 0, s = (r = t[e]).length; n < s; n++)
- h += (n ? "L" : "M") + (a = r[n]).x + " " + a.y;
- h += i ? (Zt ? "z" : "x") : "";
- }
- return h || "M0 0";
- }
- var tt = document.documentElement.style,
- it = "ActiveXObject" in window,
- et = it && !document.addEventListener,
- nt = "msLaunchUri" in navigator && !("documentMode" in document),
- ot = kt("webkit"),
- st = kt("android"),
- rt = kt("android 2") || kt("android 3"),
- at = parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10),
- ht = st && kt("Google") && at < 537 && !("AudioNode" in window),
- ut = !!window.opera,
- lt = kt("chrome"),
- ct = kt("gecko") && !ot && !ut && !it,
- _t = !lt && kt("safari"),
- dt = kt("phantom"),
- pt = "OTransition" in tt,
- mt = 0 === navigator.platform.indexOf("Win"),
- ft = it && "transition" in tt,
- gt =
- "WebKitCSSMatrix" in window &&
- "m11" in new window.WebKitCSSMatrix() &&
- !rt,
- vt = "MozPerspective" in tt,
- yt = !window.L_DISABLE_3D && (ft || gt || vt) && !pt && !dt,
- xt = "undefined" != typeof orientation || kt("mobile"),
- wt = xt && ot,
- Pt = xt && gt,
- Lt = !window.PointerEvent && window.MSPointerEvent,
- bt = !(!window.PointerEvent && !Lt),
- Tt =
- !window.L_NO_TOUCH &&
- (bt ||
- "ontouchstart" in window ||
- (window.DocumentTouch && document instanceof window.DocumentTouch)),
- zt = xt && ut,
- Mt = xt && ct,
- Ct =
- 1 <
- (window.devicePixelRatio ||
- window.screen.deviceXDPI / window.screen.logicalXDPI),
- St = !!document.createElement("canvas").getContext,
- Zt = !(!document.createElementNS || !$("svg").createSVGRect),
- Et =
- !Zt &&
- (function () {
- try {
- var t = document.createElement("div");
- t.innerHTML = ' ';
- var i = t.firstChild;
- return (
- (i.style.behavior = "url(#default#VML)"),
- i && "object" == typeof i.adj
- );
- } catch (t) {
- return !1;
- }
- })();
- function kt(t) {
- return 0 <= navigator.userAgent.toLowerCase().indexOf(t);
- }
- var Bt = (Object.freeze || Object)({
- ie: it,
- ielt9: et,
- edge: nt,
- webkit: ot,
- android: st,
- android23: rt,
- androidStock: ht,
- opera: ut,
- chrome: lt,
- gecko: ct,
- safari: _t,
- phantom: dt,
- opera12: pt,
- win: mt,
- ie3d: ft,
- webkit3d: gt,
- gecko3d: vt,
- any3d: yt,
- mobile: xt,
- mobileWebkit: wt,
- mobileWebkit3d: Pt,
- msPointer: Lt,
- pointer: bt,
- touch: Tt,
- mobileOpera: zt,
- mobileGecko: Mt,
- retina: Ct,
- canvas: St,
- svg: Zt,
- vml: Et,
- }),
- At = Lt ? "MSPointerDown" : "pointerdown",
- It = Lt ? "MSPointerMove" : "pointermove",
- Ot = Lt ? "MSPointerUp" : "pointerup",
- Rt = Lt ? "MSPointerCancel" : "pointercancel",
- Nt = ["INPUT", "SELECT", "OPTION"],
- Dt = {},
- jt = !1,
- Wt = 0;
- function Ht(t, i, e, n) {
- return (
- "touchstart" === i
- ? (function (t, i, e) {
- var n = a(function (t) {
- if (
- "mouse" !== t.pointerType &&
- t.MSPOINTER_TYPE_MOUSE &&
- t.pointerType !== t.MSPOINTER_TYPE_MOUSE
- ) {
- if (!(Nt.indexOf(t.target.tagName) < 0)) return;
- Di(t);
- }
- qt(t, i);
- });
- (t["_leaflet_touchstart" + e] = n),
- t.addEventListener(At, n, !1),
- jt ||
- (document.documentElement.addEventListener(At, Ft, !0),
- document.documentElement.addEventListener(It, Ut, !0),
- document.documentElement.addEventListener(Ot, Vt, !0),
- document.documentElement.addEventListener(Rt, Vt, !0),
- (jt = !0));
- })(t, e, n)
- : "touchmove" === i
- ? (function (t, i, e) {
- var n = function (t) {
- ((t.pointerType !== t.MSPOINTER_TYPE_MOUSE &&
- "mouse" !== t.pointerType) ||
- 0 !== t.buttons) &&
- qt(t, i);
- };
- (t["_leaflet_touchmove" + e] = n), t.addEventListener(It, n, !1);
- })(t, e, n)
- : "touchend" === i &&
- (function (t, i, e) {
- var n = function (t) {
- qt(t, i);
- };
- (t["_leaflet_touchend" + e] = n),
- t.addEventListener(Ot, n, !1),
- t.addEventListener(Rt, n, !1);
- })(t, e, n),
- this
- );
- }
- function Ft(t) {
- (Dt[t.pointerId] = t), Wt++;
- }
- function Ut(t) {
- Dt[t.pointerId] && (Dt[t.pointerId] = t);
- }
- function Vt(t) {
- delete Dt[t.pointerId], Wt--;
- }
- function qt(t, i) {
- for (var e in ((t.touches = []), Dt)) t.touches.push(Dt[e]);
- (t.changedTouches = [t]), i(t);
- }
- var Gt = Lt ? "MSPointerDown" : bt ? "pointerdown" : "touchstart",
- Kt = Lt ? "MSPointerUp" : bt ? "pointerup" : "touchend",
- Yt = "_leaflet_";
- function Xt(t, o, i) {
- var s,
- r,
- a = !1;
- function e(t) {
- var i;
- if (bt) {
- if (!nt || "mouse" === t.pointerType) return;
- i = Wt;
- } else i = t.touches.length;
- if (!(1 < i)) {
- var e = Date.now(),
- n = e - (s || e);
- (r = t.touches ? t.touches[0] : t), (a = 0 < n && n <= 250), (s = e);
- }
- }
- function n(t) {
- if (a && !r.cancelBubble) {
- if (bt) {
- if (!nt || "mouse" === t.pointerType) return;
- var i,
- e,
- n = {};
- for (e in r) (i = r[e]), (n[e] = i && i.bind ? i.bind(r) : i);
- r = n;
- }
- (r.type = "dblclick"), (r.button = 0), o(r), (s = null);
- }
- }
- return (
- (t[Yt + Gt + i] = e),
- (t[Yt + Kt + i] = n),
- (t[Yt + "dblclick" + i] = o),
- t.addEventListener(Gt, e, !1),
- t.addEventListener(Kt, n, !1),
- t.addEventListener("dblclick", o, !1),
- this
- );
- }
- function Jt(t, i) {
- var e = t[Yt + Gt + i],
- n = t[Yt + Kt + i],
- o = t[Yt + "dblclick" + i];
- return (
- t.removeEventListener(Gt, e, !1),
- t.removeEventListener(Kt, n, !1),
- nt || t.removeEventListener("dblclick", o, !1),
- this
- );
- }
- var $t,
- Qt,
- ti,
- ii,
- ei,
- ni = yi([
- "transform",
- "webkitTransform",
- "OTransform",
- "MozTransform",
- "msTransform",
- ]),
- oi = yi([
- "webkitTransition",
- "transition",
- "OTransition",
- "MozTransition",
- "msTransition",
- ]),
- si =
- "webkitTransition" === oi || "OTransition" === oi
- ? oi + "End"
- : "transitionend";
- function ri(t) {
- return "string" == typeof t ? document.getElementById(t) : t;
- }
- function ai(t, i) {
- var e = t.style[i] || (t.currentStyle && t.currentStyle[i]);
- if ((!e || "auto" === e) && document.defaultView) {
- var n = document.defaultView.getComputedStyle(t, null);
- e = n ? n[i] : null;
- }
- return "auto" === e ? null : e;
- }
- function hi(t, i, e) {
- var n = document.createElement(t);
- return (n.className = i || ""), e && e.appendChild(n), n;
- }
- function ui(t) {
- var i = t.parentNode;
- i && i.removeChild(t);
- }
- function li(t) {
- for (; t.firstChild; ) t.removeChild(t.firstChild);
- }
- function ci(t) {
- var i = t.parentNode;
- i && i.lastChild !== t && i.appendChild(t);
- }
- function _i(t) {
- var i = t.parentNode;
- i && i.firstChild !== t && i.insertBefore(t, i.firstChild);
- }
- function di(t, i) {
- if (void 0 !== t.classList) return t.classList.contains(i);
- var e = gi(t);
- return 0 < e.length && new RegExp("(^|\\s)" + i + "(\\s|$)").test(e);
- }
- function pi(t, i) {
- if (void 0 !== t.classList)
- for (var e = d(i), n = 0, o = e.length; n < o; n++) t.classList.add(e[n]);
- else if (!di(t, i)) {
- var s = gi(t);
- fi(t, (s ? s + " " : "") + i);
- }
- }
- function mi(t, i) {
- void 0 !== t.classList
- ? t.classList.remove(i)
- : fi(t, _((" " + gi(t) + " ").replace(" " + i + " ", " ")));
- }
- function fi(t, i) {
- void 0 === t.className.baseVal
- ? (t.className = i)
- : (t.className.baseVal = i);
- }
- function gi(t) {
- return (
- t.correspondingElement && (t = t.correspondingElement),
- void 0 === t.className.baseVal ? t.className : t.className.baseVal
- );
- }
- function vi(t, i) {
- "opacity" in t.style
- ? (t.style.opacity = i)
- : "filter" in t.style &&
- (function (t, i) {
- var e = !1,
- n = "DXImageTransform.Microsoft.Alpha";
- try {
- e = t.filters.item(n);
- } catch (t) {
- if (1 === i) return;
- }
- (i = Math.round(100 * i)),
- e
- ? ((e.Enabled = 100 !== i), (e.Opacity = i))
- : (t.style.filter += " progid:" + n + "(opacity=" + i + ")");
- })(t, i);
- }
- function yi(t) {
- for (var i = document.documentElement.style, e = 0; e < t.length; e++)
- if (t[e] in i) return t[e];
- return !1;
- }
- function xi(t, i, e) {
- var n = i || new B(0, 0);
- t.style[ni] =
- (ft
- ? "translate(" + n.x + "px," + n.y + "px)"
- : "translate3d(" + n.x + "px," + n.y + "px,0)") +
- (e ? " scale(" + e + ")" : "");
- }
- function wi(t, i) {
- (t._leaflet_pos = i),
- yt ? xi(t, i) : ((t.style.left = i.x + "px"), (t.style.top = i.y + "px"));
- }
- function Pi(t) {
- return t._leaflet_pos || new B(0, 0);
- }
- if ("onselectstart" in document)
- ($t = function () {
- Ei(window, "selectstart", Di);
- }),
- (Qt = function () {
- Bi(window, "selectstart", Di);
- });
- else {
- var Li = yi([
- "userSelect",
- "WebkitUserSelect",
- "OUserSelect",
- "MozUserSelect",
- "msUserSelect",
- ]);
- ($t = function () {
- if (Li) {
- var t = document.documentElement.style;
- (ti = t[Li]), (t[Li] = "none");
- }
- }),
- (Qt = function () {
- Li && ((document.documentElement.style[Li] = ti), (ti = void 0));
- });
- }
- function bi() {
- Ei(window, "dragstart", Di);
- }
- function Ti() {
- Bi(window, "dragstart", Di);
- }
- function zi(t) {
- for (; -1 === t.tabIndex; ) t = t.parentNode;
- t.style &&
- (Mi(),
- (ei = (ii = t).style.outline),
- (t.style.outline = "none"),
- Ei(window, "keydown", Mi));
- }
- function Mi() {
- ii &&
- ((ii.style.outline = ei), (ei = ii = void 0), Bi(window, "keydown", Mi));
- }
- function Ci(t) {
- for (
- ;
- !(
- ((t = t.parentNode).offsetWidth && t.offsetHeight) ||
- t === document.body
- );
-
- );
- return t;
- }
- function Si(t) {
- var i = t.getBoundingClientRect();
- return {
- x: i.width / t.offsetWidth || 1,
- y: i.height / t.offsetHeight || 1,
- boundingClientRect: i,
- };
- }
- var Zi = (Object.freeze || Object)({
- TRANSFORM: ni,
- TRANSITION: oi,
- TRANSITION_END: si,
- get: ri,
- getStyle: ai,
- create: hi,
- remove: ui,
- empty: li,
- toFront: ci,
- toBack: _i,
- hasClass: di,
- addClass: pi,
- removeClass: mi,
- setClass: fi,
- getClass: gi,
- setOpacity: vi,
- testProp: yi,
- setTransform: xi,
- setPosition: wi,
- getPosition: Pi,
- disableTextSelection: $t,
- enableTextSelection: Qt,
- disableImageDrag: bi,
- enableImageDrag: Ti,
- preventOutline: zi,
- restoreOutline: Mi,
- getSizedParentNode: Ci,
- getScale: Si,
- });
- function Ei(t, i, e, n) {
- if ("object" == typeof i) for (var o in i) Ai(t, o, i[o], e);
- else for (var s = 0, r = (i = d(i)).length; s < r; s++) Ai(t, i[s], e, n);
- return this;
- }
- var ki = "_leaflet_events";
- function Bi(t, i, e, n) {
- if ("object" == typeof i) for (var o in i) Ii(t, o, i[o], e);
- else if (i)
- for (var s = 0, r = (i = d(i)).length; s < r; s++) Ii(t, i[s], e, n);
- else {
- for (var a in t[ki]) Ii(t, a, t[ki][a]);
- delete t[ki];
- }
- return this;
- }
- function Ai(i, t, e, n) {
- var o = t + u(e) + (n ? "_" + u(n) : "");
- if (i[ki] && i[ki][o]) return this;
- var s = function (t) {
- return e.call(n || i, t || window.event);
- },
- r = s;
- bt && 0 === t.indexOf("touch")
- ? Ht(i, t, s, o)
- : !Tt || "dblclick" !== t || (bt && lt)
- ? "addEventListener" in i
- ? "mousewheel" === t
- ? i.addEventListener("onwheel" in i ? "wheel" : "mousewheel", s, !1)
- : "mouseenter" === t || "mouseleave" === t
- ? ((s = function (t) {
- (t = t || window.event), Ki(i, t) && r(t);
- }),
- i.addEventListener(
- "mouseenter" === t ? "mouseover" : "mouseout",
- s,
- !1,
- ))
- : ("click" === t &&
- st &&
- (s = function (t) {
- !(function (t, i) {
- var e =
- t.timeStamp ||
- (t.originalEvent && t.originalEvent.timeStamp),
- n = Ui && e - Ui;
- if (
- (n && 100 < n && n < 500) ||
- (t.target._simulatedClick && !t._simulated)
- )
- return ji(t);
- (Ui = e), i(t);
- })(t, r);
- }),
- i.addEventListener(t, s, !1))
- : "attachEvent" in i && i.attachEvent("on" + t, s)
- : Xt(i, s, o),
- (i[ki] = i[ki] || {}),
- (i[ki][o] = s);
- }
- function Ii(t, i, e, n) {
- var o = i + u(e) + (n ? "_" + u(n) : ""),
- s = t[ki] && t[ki][o];
- if (!s) return this;
- bt && 0 === i.indexOf("touch")
- ? (function (t, i, e) {
- var n = t["_leaflet_" + i + e];
- "touchstart" === i
- ? t.removeEventListener(At, n, !1)
- : "touchmove" === i
- ? t.removeEventListener(It, n, !1)
- : "touchend" === i &&
- (t.removeEventListener(Ot, n, !1),
- t.removeEventListener(Rt, n, !1));
- })(t, i, o)
- : !Tt || "dblclick" !== i || (bt && lt)
- ? "removeEventListener" in t
- ? "mousewheel" === i
- ? t.removeEventListener(
- "onwheel" in t ? "wheel" : "mousewheel",
- s,
- !1,
- )
- : t.removeEventListener(
- "mouseenter" === i
- ? "mouseover"
- : "mouseleave" === i
- ? "mouseout"
- : i,
- s,
- !1,
- )
- : "detachEvent" in t && t.detachEvent("on" + i, s)
- : Jt(t, o),
- (t[ki][o] = null);
- }
- function Oi(t) {
- return (
- t.stopPropagation
- ? t.stopPropagation()
- : t.originalEvent
- ? (t.originalEvent._stopped = !0)
- : (t.cancelBubble = !0),
- Gi(t),
- this
- );
- }
- function Ri(t) {
- return Ai(t, "mousewheel", Oi), this;
- }
- function Ni(t) {
- return Ei(t, "mousedown touchstart dblclick", Oi), Ai(t, "click", qi), this;
- }
- function Di(t) {
- return t.preventDefault ? t.preventDefault() : (t.returnValue = !1), this;
- }
- function ji(t) {
- return Di(t), Oi(t), this;
- }
- function Wi(t, i) {
- if (!i) return new B(t.clientX, t.clientY);
- var e = Si(i),
- n = e.boundingClientRect;
- return new B(
- (t.clientX - n.left) / e.x - i.clientLeft,
- (t.clientY - n.top) / e.y - i.clientTop,
- );
- }
- var Hi =
- mt && lt ? 2 * window.devicePixelRatio : ct ? window.devicePixelRatio : 1;
- function Fi(t) {
- return nt
- ? t.wheelDeltaY / 2
- : t.deltaY && 0 === t.deltaMode
- ? -t.deltaY / Hi
- : t.deltaY && 1 === t.deltaMode
- ? 20 * -t.deltaY
- : t.deltaY && 2 === t.deltaMode
- ? 60 * -t.deltaY
- : t.deltaX || t.deltaZ
- ? 0
- : t.wheelDelta
- ? (t.wheelDeltaY || t.wheelDelta) / 2
- : t.detail && Math.abs(t.detail) < 32765
- ? 20 * -t.detail
- : t.detail
- ? (t.detail / -32765) * 60
- : 0;
- }
- var Ui,
- Vi = {};
- function qi(t) {
- Vi[t.type] = !0;
- }
- function Gi(t) {
- var i = Vi[t.type];
- return (Vi[t.type] = !1), i;
- }
- function Ki(t, i) {
- var e = i.relatedTarget;
- if (!e) return !0;
- try {
- for (; e && e !== t; ) e = e.parentNode;
- } catch (t) {
- return !1;
- }
- return e !== t;
- }
- var Yi = (Object.freeze || Object)({
- on: Ei,
- off: Bi,
- stopPropagation: Oi,
- disableScrollPropagation: Ri,
- disableClickPropagation: Ni,
- preventDefault: Di,
- stop: ji,
- getMousePosition: Wi,
- getWheelDelta: Fi,
- fakeStop: qi,
- skipped: Gi,
- isExternalTarget: Ki,
- addListener: Ei,
- removeListener: Bi,
- }),
- Xi = k.extend({
- run: function (t, i, e, n) {
- this.stop(),
- (this._el = t),
- (this._inProgress = !0),
- (this._duration = e || 0.25),
- (this._easeOutPower = 1 / Math.max(n || 0.5, 0.2)),
- (this._startPos = Pi(t)),
- (this._offset = i.subtract(this._startPos)),
- (this._startTime = +new Date()),
- this.fire("start"),
- this._animate();
- },
- stop: function () {
- this._inProgress && (this._step(!0), this._complete());
- },
- _animate: function () {
- (this._animId = M(this._animate, this)), this._step();
- },
- _step: function (t) {
- var i = +new Date() - this._startTime,
- e = 1e3 * this._duration;
- i < e
- ? this._runFrame(this._easeOut(i / e), t)
- : (this._runFrame(1), this._complete());
- },
- _runFrame: function (t, i) {
- var e = this._startPos.add(this._offset.multiplyBy(t));
- i && e._round(), wi(this._el, e), this.fire("step");
- },
- _complete: function () {
- C(this._animId), (this._inProgress = !1), this.fire("end");
- },
- _easeOut: function (t) {
- return 1 - Math.pow(1 - t, this._easeOutPower);
- },
- }),
- Ji = k.extend({
- options: {
- crs: X,
- center: void 0,
- zoom: void 0,
- minZoom: void 0,
- maxZoom: void 0,
- layers: [],
- maxBounds: void 0,
- renderer: void 0,
- zoomAnimation: !0,
- zoomAnimationThreshold: 4,
- fadeAnimation: !0,
- markerZoomAnimation: !0,
- transform3DLimit: 8388608,
- zoomSnap: 1,
- zoomDelta: 1,
- trackResize: !0,
- },
- initialize: function (t, i) {
- (i = p(this, i)),
- (this._handlers = []),
- (this._layers = {}),
- (this._zoomBoundLayers = {}),
- (this._sizeChanged = !0),
- this._initContainer(t),
- this._initLayout(),
- (this._onResize = a(this._onResize, this)),
- this._initEvents(),
- i.maxBounds && this.setMaxBounds(i.maxBounds),
- void 0 !== i.zoom && (this._zoom = this._limitZoom(i.zoom)),
- i.center &&
- void 0 !== i.zoom &&
- this.setView(W(i.center), i.zoom, { reset: !0 }),
- this.callInitHooks(),
- (this._zoomAnimated = oi && yt && !zt && this.options.zoomAnimation),
- this._zoomAnimated &&
- (this._createAnimProxy(),
- Ei(this._proxy, si, this._catchTransitionEnd, this)),
- this._addLayers(this.options.layers);
- },
- setView: function (t, i, e) {
- if (
- ((i = void 0 === i ? this._zoom : this._limitZoom(i)),
- (t = this._limitCenter(W(t), i, this.options.maxBounds)),
- (e = e || {}),
- this._stop(),
- this._loaded && !e.reset && !0 !== e) &&
- (void 0 !== e.animate &&
- ((e.zoom = h({ animate: e.animate }, e.zoom)),
- (e.pan = h({ animate: e.animate, duration: e.duration }, e.pan))),
- this._zoom !== i
- ? this._tryAnimatedZoom && this._tryAnimatedZoom(t, i, e.zoom)
- : this._tryAnimatedPan(t, e.pan))
- )
- return clearTimeout(this._sizeTimer), this;
- return this._resetView(t, i), this;
- },
- setZoom: function (t, i) {
- return this._loaded
- ? this.setView(this.getCenter(), t, { zoom: i })
- : ((this._zoom = t), this);
- },
- zoomIn: function (t, i) {
- return (
- (t = t || (yt ? this.options.zoomDelta : 1)),
- this.setZoom(this._zoom + t, i)
- );
- },
- zoomOut: function (t, i) {
- return (
- (t = t || (yt ? this.options.zoomDelta : 1)),
- this.setZoom(this._zoom - t, i)
- );
- },
- setZoomAround: function (t, i, e) {
- var n = this.getZoomScale(i),
- o = this.getSize().divideBy(2),
- s = (t instanceof B ? t : this.latLngToContainerPoint(t))
- .subtract(o)
- .multiplyBy(1 - 1 / n),
- r = this.containerPointToLatLng(o.add(s));
- return this.setView(r, i, { zoom: e });
- },
- _getBoundsCenterZoom: function (t, i) {
- (i = i || {}), (t = t.getBounds ? t.getBounds() : D(t));
- var e = I(i.paddingTopLeft || i.padding || [0, 0]),
- n = I(i.paddingBottomRight || i.padding || [0, 0]),
- o = this.getBoundsZoom(t, !1, e.add(n));
- if (
- (o = "number" == typeof i.maxZoom ? Math.min(i.maxZoom, o) : o) ===
- 1 / 0
- )
- return { center: t.getCenter(), zoom: o };
- var s = n.subtract(e).divideBy(2),
- r = this.project(t.getSouthWest(), o),
- a = this.project(t.getNorthEast(), o);
- return {
- center: this.unproject(r.add(a).divideBy(2).add(s), o),
- zoom: o,
- };
- },
- fitBounds: function (t, i) {
- if (!(t = D(t)).isValid()) throw new Error("Bounds are not valid.");
- var e = this._getBoundsCenterZoom(t, i);
- return this.setView(e.center, e.zoom, i);
- },
- fitWorld: function (t) {
- return this.fitBounds(
- [
- [-90, -180],
- [90, 180],
- ],
- t,
- );
- },
- panTo: function (t, i) {
- return this.setView(t, this._zoom, { pan: i });
- },
- panBy: function (t, i) {
- if (((i = i || {}), !(t = I(t).round()).x && !t.y))
- return this.fire("moveend");
- if (!0 !== i.animate && !this.getSize().contains(t))
- return (
- this._resetView(
- this.unproject(this.project(this.getCenter()).add(t)),
- this.getZoom(),
- ),
- this
- );
- if (
- (this._panAnim ||
- ((this._panAnim = new Xi()),
- this._panAnim.on(
- {
- step: this._onPanTransitionStep,
- end: this._onPanTransitionEnd,
- },
- this,
- )),
- i.noMoveStart || this.fire("movestart"),
- !1 !== i.animate)
- ) {
- pi(this._mapPane, "leaflet-pan-anim");
- var e = this._getMapPanePos().subtract(t).round();
- this._panAnim.run(
- this._mapPane,
- e,
- i.duration || 0.25,
- i.easeLinearity,
- );
- } else this._rawPanBy(t), this.fire("move").fire("moveend");
- return this;
- },
- flyTo: function (n, o, t) {
- if (!1 === (t = t || {}).animate || !yt) return this.setView(n, o, t);
- this._stop();
- var s = this.project(this.getCenter()),
- r = this.project(n),
- i = this.getSize(),
- a = this._zoom;
- (n = W(n)), (o = void 0 === o ? a : o);
- var h = Math.max(i.x, i.y),
- u = h * this.getZoomScale(a, o),
- l = r.distanceTo(s) || 1,
- c = 1.42,
- _ = c * c;
- function e(t) {
- var i =
- (u * u - h * h + (t ? -1 : 1) * _ * _ * l * l) /
- (2 * (t ? u : h) * _ * l),
- e = Math.sqrt(i * i + 1) - i;
- return e < 1e-9 ? -18 : Math.log(e);
- }
- function d(t) {
- return (Math.exp(t) - Math.exp(-t)) / 2;
- }
- function p(t) {
- return (Math.exp(t) + Math.exp(-t)) / 2;
- }
- var m = e(0);
- function f(t) {
- return (
- (h *
- (p(m) *
- (function (t) {
- return d(t) / p(t);
- })(m + c * t) -
- d(m))) /
- _
- );
- }
- var g = Date.now(),
- v = (e(1) - m) / c,
- y = t.duration ? 1e3 * t.duration : 1e3 * v * 0.8;
- return (
- this._moveStart(!0, t.noMoveStart),
- function t() {
- var i = (Date.now() - g) / y,
- e =
- (function (t) {
- return 1 - Math.pow(1 - t, 1.5);
- })(i) * v;
- i <= 1
- ? ((this._flyToFrame = M(t, this)),
- this._move(
- this.unproject(s.add(r.subtract(s).multiplyBy(f(e) / l)), a),
- this.getScaleZoom(
- h /
- (function (t) {
- return h * (p(m) / p(m + c * t));
- })(e),
- a,
- ),
- { flyTo: !0 },
- ))
- : this._move(n, o)._moveEnd(!0);
- }.call(this),
- this
- );
- },
- flyToBounds: function (t, i) {
- var e = this._getBoundsCenterZoom(t, i);
- return this.flyTo(e.center, e.zoom, i);
- },
- setMaxBounds: function (t) {
- return (t = D(t)).isValid()
- ? (this.options.maxBounds &&
- this.off("moveend", this._panInsideMaxBounds),
- (this.options.maxBounds = t),
- this._loaded && this._panInsideMaxBounds(),
- this.on("moveend", this._panInsideMaxBounds))
- : ((this.options.maxBounds = null),
- this.off("moveend", this._panInsideMaxBounds));
- },
- setMinZoom: function (t) {
- var i = this.options.minZoom;
- return (
- (this.options.minZoom = t),
- this._loaded &&
- i !== t &&
- (this.fire("zoomlevelschange"), this.getZoom() < this.options.minZoom)
- ? this.setZoom(t)
- : this
- );
- },
- setMaxZoom: function (t) {
- var i = this.options.maxZoom;
- return (
- (this.options.maxZoom = t),
- this._loaded &&
- i !== t &&
- (this.fire("zoomlevelschange"), this.getZoom() > this.options.maxZoom)
- ? this.setZoom(t)
- : this
- );
- },
- panInsideBounds: function (t, i) {
- this._enforcingBounds = !0;
- var e = this.getCenter(),
- n = this._limitCenter(e, this._zoom, D(t));
- return (
- e.equals(n) || this.panTo(n, i), (this._enforcingBounds = !1), this
- );
- },
- panInside: function (t, i) {
- var e = I((i = i || {}).paddingTopLeft || i.padding || [0, 0]),
- n = I(i.paddingBottomRight || i.padding || [0, 0]),
- o = this.getCenter(),
- s = this.project(o),
- r = this.project(t),
- a = this.getPixelBounds(),
- h = a.getSize().divideBy(2),
- u = R([a.min.add(e), a.max.subtract(n)]);
- if (!u.contains(r)) {
- this._enforcingBounds = !0;
- var l = s.subtract(r),
- c = I(r.x + l.x, r.y + l.y);
- (r.x < u.min.x || r.x > u.max.x) &&
- ((c.x = s.x - l.x),
- 0 < l.x ? (c.x += h.x - e.x) : (c.x -= h.x - n.x)),
- (r.y < u.min.y || r.y > u.max.y) &&
- ((c.y = s.y - l.y),
- 0 < l.y ? (c.y += h.y - e.y) : (c.y -= h.y - n.y)),
- this.panTo(this.unproject(c), i),
- (this._enforcingBounds = !1);
- }
- return this;
- },
- invalidateSize: function (t) {
- if (!this._loaded) return this;
- t = h({ animate: !1, pan: !0 }, !0 === t ? { animate: !0 } : t);
- var i = this.getSize();
- (this._sizeChanged = !0), (this._lastCenter = null);
- var e = this.getSize(),
- n = i.divideBy(2).round(),
- o = e.divideBy(2).round(),
- s = n.subtract(o);
- return s.x || s.y
- ? (t.animate && t.pan
- ? this.panBy(s)
- : (t.pan && this._rawPanBy(s),
- this.fire("move"),
- t.debounceMoveend
- ? (clearTimeout(this._sizeTimer),
- (this._sizeTimer = setTimeout(
- a(this.fire, this, "moveend"),
- 200,
- )))
- : this.fire("moveend")),
- this.fire("resize", { oldSize: i, newSize: e }))
- : this;
- },
- stop: function () {
- return (
- this.setZoom(this._limitZoom(this._zoom)),
- this.options.zoomSnap || this.fire("viewreset"),
- this._stop()
- );
- },
- locate: function (t) {
- if (
- ((t = this._locateOptions = h({ timeout: 1e4, watch: !1 }, t)),
- !("geolocation" in navigator))
- )
- return (
- this._handleGeolocationError({
- code: 0,
- message: "Geolocation not supported.",
- }),
- this
- );
- var i = a(this._handleGeolocationResponse, this),
- e = a(this._handleGeolocationError, this);
- return (
- t.watch
- ? (this._locationWatchId = navigator.geolocation.watchPosition(
- i,
- e,
- t,
- ))
- : navigator.geolocation.getCurrentPosition(i, e, t),
- this
- );
- },
- stopLocate: function () {
- return (
- navigator.geolocation &&
- navigator.geolocation.clearWatch &&
- navigator.geolocation.clearWatch(this._locationWatchId),
- this._locateOptions && (this._locateOptions.setView = !1),
- this
- );
- },
- _handleGeolocationError: function (t) {
- var i = t.code,
- e =
- t.message ||
- (1 === i
- ? "permission denied"
- : 2 === i
- ? "position unavailable"
- : "timeout");
- this._locateOptions.setView && !this._loaded && this.fitWorld(),
- this.fire("locationerror", {
- code: i,
- message: "Geolocation error: " + e + ".",
- });
- },
- _handleGeolocationResponse: function (t) {
- var i = new j(t.coords.latitude, t.coords.longitude),
- e = i.toBounds(2 * t.coords.accuracy),
- n = this._locateOptions;
- if (n.setView) {
- var o = this.getBoundsZoom(e);
- this.setView(i, n.maxZoom ? Math.min(o, n.maxZoom) : o);
- }
- var s = { latlng: i, bounds: e, timestamp: t.timestamp };
- for (var r in t.coords)
- "number" == typeof t.coords[r] && (s[r] = t.coords[r]);
- this.fire("locationfound", s);
- },
- addHandler: function (t, i) {
- if (!i) return this;
- var e = (this[t] = new i(this));
- return this._handlers.push(e), this.options[t] && e.enable(), this;
- },
- remove: function () {
- if (
- (this._initEvents(!0),
- this._containerId !== this._container._leaflet_id)
- )
- throw new Error("Map container is being reused by another instance");
- try {
- delete this._container._leaflet_id, delete this._containerId;
- } catch (t) {
- (this._container._leaflet_id = void 0), (this._containerId = void 0);
- }
- var t;
- for (t in (void 0 !== this._locationWatchId && this.stopLocate(),
- this._stop(),
- ui(this._mapPane),
- this._clearControlPos && this._clearControlPos(),
- this._resizeRequest &&
- (C(this._resizeRequest), (this._resizeRequest = null)),
- this._clearHandlers(),
- this._loaded && this.fire("unload"),
- this._layers))
- this._layers[t].remove();
- for (t in this._panes) ui(this._panes[t]);
- return (
- (this._layers = []),
- (this._panes = []),
- delete this._mapPane,
- delete this._renderer,
- this
- );
- },
- createPane: function (t, i) {
- var e = hi(
- "div",
- "leaflet-pane" +
- (t ? " leaflet-" + t.replace("Pane", "") + "-pane" : ""),
- i || this._mapPane,
- );
- return t && (this._panes[t] = e), e;
- },
- getCenter: function () {
- return (
- this._checkIfLoaded(),
- this._lastCenter && !this._moved()
- ? this._lastCenter
- : this.layerPointToLatLng(this._getCenterLayerPoint())
- );
- },
- getZoom: function () {
- return this._zoom;
- },
- getBounds: function () {
- var t = this.getPixelBounds();
- return new N(
- this.unproject(t.getBottomLeft()),
- this.unproject(t.getTopRight()),
- );
- },
- getMinZoom: function () {
- return void 0 === this.options.minZoom
- ? this._layersMinZoom || 0
- : this.options.minZoom;
- },
- getMaxZoom: function () {
- return void 0 === this.options.maxZoom
- ? void 0 === this._layersMaxZoom
- ? 1 / 0
- : this._layersMaxZoom
- : this.options.maxZoom;
- },
- getBoundsZoom: function (t, i, e) {
- (t = D(t)), (e = I(e || [0, 0]));
- var n = this.getZoom() || 0,
- o = this.getMinZoom(),
- s = this.getMaxZoom(),
- r = t.getNorthWest(),
- a = t.getSouthEast(),
- h = this.getSize().subtract(e),
- u = R(this.project(a, n), this.project(r, n)).getSize(),
- l = yt ? this.options.zoomSnap : 1,
- c = h.x / u.x,
- _ = h.y / u.y,
- d = i ? Math.max(c, _) : Math.min(c, _);
- return (
- (n = this.getScaleZoom(d, n)),
- l &&
- ((n = Math.round(n / (l / 100)) * (l / 100)),
- (n = i ? Math.ceil(n / l) * l : Math.floor(n / l) * l)),
- Math.max(o, Math.min(s, n))
- );
- },
- getSize: function () {
- return (
- (this._size && !this._sizeChanged) ||
- ((this._size = new B(
- this._container.clientWidth || 0,
- this._container.clientHeight || 0,
- )),
- (this._sizeChanged = !1)),
- this._size.clone()
- );
- },
- getPixelBounds: function (t, i) {
- var e = this._getTopLeftPoint(t, i);
- return new O(e, e.add(this.getSize()));
- },
- getPixelOrigin: function () {
- return this._checkIfLoaded(), this._pixelOrigin;
- },
- getPixelWorldBounds: function (t) {
- return this.options.crs.getProjectedBounds(
- void 0 === t ? this.getZoom() : t,
- );
- },
- getPane: function (t) {
- return "string" == typeof t ? this._panes[t] : t;
- },
- getPanes: function () {
- return this._panes;
- },
- getContainer: function () {
- return this._container;
- },
- getZoomScale: function (t, i) {
- var e = this.options.crs;
- return (i = void 0 === i ? this._zoom : i), e.scale(t) / e.scale(i);
- },
- getScaleZoom: function (t, i) {
- var e = this.options.crs;
- i = void 0 === i ? this._zoom : i;
- var n = e.zoom(t * e.scale(i));
- return isNaN(n) ? 1 / 0 : n;
- },
- project: function (t, i) {
- return (
- (i = void 0 === i ? this._zoom : i),
- this.options.crs.latLngToPoint(W(t), i)
- );
- },
- unproject: function (t, i) {
- return (
- (i = void 0 === i ? this._zoom : i),
- this.options.crs.pointToLatLng(I(t), i)
- );
- },
- layerPointToLatLng: function (t) {
- var i = I(t).add(this.getPixelOrigin());
- return this.unproject(i);
- },
- latLngToLayerPoint: function (t) {
- return this.project(W(t))._round()._subtract(this.getPixelOrigin());
- },
- wrapLatLng: function (t) {
- return this.options.crs.wrapLatLng(W(t));
- },
- wrapLatLngBounds: function (t) {
- return this.options.crs.wrapLatLngBounds(D(t));
- },
- distance: function (t, i) {
- return this.options.crs.distance(W(t), W(i));
- },
- containerPointToLayerPoint: function (t) {
- return I(t).subtract(this._getMapPanePos());
- },
- layerPointToContainerPoint: function (t) {
- return I(t).add(this._getMapPanePos());
- },
- containerPointToLatLng: function (t) {
- var i = this.containerPointToLayerPoint(I(t));
- return this.layerPointToLatLng(i);
- },
- latLngToContainerPoint: function (t) {
- return this.layerPointToContainerPoint(this.latLngToLayerPoint(W(t)));
- },
- mouseEventToContainerPoint: function (t) {
- return Wi(t, this._container);
- },
- mouseEventToLayerPoint: function (t) {
- return this.containerPointToLayerPoint(
- this.mouseEventToContainerPoint(t),
- );
- },
- mouseEventToLatLng: function (t) {
- return this.layerPointToLatLng(this.mouseEventToLayerPoint(t));
- },
- _initContainer: function (t) {
- var i = (this._container = ri(t));
- if (!i) throw new Error("Map container not found.");
- if (i._leaflet_id)
- throw new Error("Map container is already initialized.");
- Ei(i, "scroll", this._onScroll, this), (this._containerId = u(i));
- },
- _initLayout: function () {
- var t = this._container;
- (this._fadeAnimated = this.options.fadeAnimation && yt),
- pi(
- t,
- "leaflet-container" +
- (Tt ? " leaflet-touch" : "") +
- (Ct ? " leaflet-retina" : "") +
- (et ? " leaflet-oldie" : "") +
- (_t ? " leaflet-safari" : "") +
- (this._fadeAnimated ? " leaflet-fade-anim" : ""),
- );
- var i = ai(t, "position");
- "absolute" !== i &&
- "relative" !== i &&
- "fixed" !== i &&
- (t.style.position = "relative"),
- this._initPanes(),
- this._initControlPos && this._initControlPos();
- },
- _initPanes: function () {
- var t = (this._panes = {});
- (this._paneRenderers = {}),
- (this._mapPane = this.createPane("mapPane", this._container)),
- wi(this._mapPane, new B(0, 0)),
- this.createPane("tilePane"),
- this.createPane("shadowPane"),
- this.createPane("overlayPane"),
- this.createPane("markerPane"),
- this.createPane("tooltipPane"),
- this.createPane("popupPane"),
- this.options.markerZoomAnimation ||
- (pi(t.markerPane, "leaflet-zoom-hide"),
- pi(t.shadowPane, "leaflet-zoom-hide"));
- },
- _resetView: function (t, i) {
- wi(this._mapPane, new B(0, 0));
- var e = !this._loaded;
- (this._loaded = !0),
- (i = this._limitZoom(i)),
- this.fire("viewprereset");
- var n = this._zoom !== i;
- this._moveStart(n, !1)._move(t, i)._moveEnd(n),
- this.fire("viewreset"),
- e && this.fire("load");
- },
- _moveStart: function (t, i) {
- return t && this.fire("zoomstart"), i || this.fire("movestart"), this;
- },
- _move: function (t, i, e) {
- void 0 === i && (i = this._zoom);
- var n = this._zoom !== i;
- return (
- (this._zoom = i),
- (this._lastCenter = t),
- (this._pixelOrigin = this._getNewPixelOrigin(t)),
- (n || (e && e.pinch)) && this.fire("zoom", e),
- this.fire("move", e)
- );
- },
- _moveEnd: function (t) {
- return t && this.fire("zoomend"), this.fire("moveend");
- },
- _stop: function () {
- return C(this._flyToFrame), this._panAnim && this._panAnim.stop(), this;
- },
- _rawPanBy: function (t) {
- wi(this._mapPane, this._getMapPanePos().subtract(t));
- },
- _getZoomSpan: function () {
- return this.getMaxZoom() - this.getMinZoom();
- },
- _panInsideMaxBounds: function () {
- this._enforcingBounds || this.panInsideBounds(this.options.maxBounds);
- },
- _checkIfLoaded: function () {
- if (!this._loaded) throw new Error("Set map center and zoom first.");
- },
- _initEvents: function (t) {
- this._targets = {};
- var i = t ? Bi : Ei;
- i(
- (this._targets[u(this._container)] = this)._container,
- "click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",
- this._handleDOMEvent,
- this,
- ),
- this.options.trackResize && i(window, "resize", this._onResize, this),
- yt &&
- this.options.transform3DLimit &&
- (t ? this.off : this.on).call(this, "moveend", this._onMoveEnd);
- },
- _onResize: function () {
- C(this._resizeRequest),
- (this._resizeRequest = M(function () {
- this.invalidateSize({ debounceMoveend: !0 });
- }, this));
- },
- _onScroll: function () {
- (this._container.scrollTop = 0), (this._container.scrollLeft = 0);
- },
- _onMoveEnd: function () {
- var t = this._getMapPanePos();
- Math.max(Math.abs(t.x), Math.abs(t.y)) >=
- this.options.transform3DLimit &&
- this._resetView(this.getCenter(), this.getZoom());
- },
- _findEventTargets: function (t, i) {
- for (
- var e,
- n = [],
- o = "mouseout" === i || "mouseover" === i,
- s = t.target || t.srcElement,
- r = !1;
- s;
-
- ) {
- if (
- (e = this._targets[u(s)]) &&
- ("click" === i || "preclick" === i) &&
- !t._simulated &&
- this._draggableMoved(e)
- ) {
- r = !0;
- break;
- }
- if (e && e.listens(i, !0)) {
- if (o && !Ki(s, t)) break;
- if ((n.push(e), o)) break;
- }
- if (s === this._container) break;
- s = s.parentNode;
- }
- return n.length || r || o || !Ki(s, t) || (n = [this]), n;
- },
- _handleDOMEvent: function (t) {
- if (this._loaded && !Gi(t)) {
- var i = t.type;
- ("mousedown" !== i &&
- "keypress" !== i &&
- "keyup" !== i &&
- "keydown" !== i) ||
- zi(t.target || t.srcElement),
- this._fireDOMEvent(t, i);
- }
- },
- _mouseEvents: [
- "click",
- "dblclick",
- "mouseover",
- "mouseout",
- "contextmenu",
- ],
- _fireDOMEvent: function (t, i, e) {
- if ("click" === t.type) {
- var n = h({}, t);
- (n.type = "preclick"), this._fireDOMEvent(n, n.type, e);
- }
- if (
- !t._stopped &&
- (e = (e || []).concat(this._findEventTargets(t, i))).length
- ) {
- var o = e[0];
- "contextmenu" === i && o.listens(i, !0) && Di(t);
- var s = { originalEvent: t };
- if (
- "keypress" !== t.type &&
- "keydown" !== t.type &&
- "keyup" !== t.type
- ) {
- var r = o.getLatLng && (!o._radius || o._radius <= 10);
- (s.containerPoint = r
- ? this.latLngToContainerPoint(o.getLatLng())
- : this.mouseEventToContainerPoint(t)),
- (s.layerPoint = this.containerPointToLayerPoint(
- s.containerPoint,
- )),
- (s.latlng = r
- ? o.getLatLng()
- : this.layerPointToLatLng(s.layerPoint));
- }
- for (var a = 0; a < e.length; a++)
- if (
- (e[a].fire(i, s, !0),
- s.originalEvent._stopped ||
- (!1 === e[a].options.bubblingMouseEvents &&
- -1 !== y(this._mouseEvents, i)))
- )
- return;
- }
- },
- _draggableMoved: function (t) {
- return (
- ((t = t.dragging && t.dragging.enabled() ? t : this).dragging &&
- t.dragging.moved()) ||
- (this.boxZoom && this.boxZoom.moved())
- );
- },
- _clearHandlers: function () {
- for (var t = 0, i = this._handlers.length; t < i; t++)
- this._handlers[t].disable();
- },
- whenReady: function (t, i) {
- return (
- this._loaded
- ? t.call(i || this, { target: this })
- : this.on("load", t, i),
- this
- );
- },
- _getMapPanePos: function () {
- return Pi(this._mapPane) || new B(0, 0);
- },
- _moved: function () {
- var t = this._getMapPanePos();
- return t && !t.equals([0, 0]);
- },
- _getTopLeftPoint: function (t, i) {
- return (
- t && void 0 !== i
- ? this._getNewPixelOrigin(t, i)
- : this.getPixelOrigin()
- ).subtract(this._getMapPanePos());
- },
- _getNewPixelOrigin: function (t, i) {
- var e = this.getSize()._divideBy(2);
- return this.project(t, i)
- ._subtract(e)
- ._add(this._getMapPanePos())
- ._round();
- },
- _latLngToNewLayerPoint: function (t, i, e) {
- var n = this._getNewPixelOrigin(e, i);
- return this.project(t, i)._subtract(n);
- },
- _latLngBoundsToNewLayerBounds: function (t, i, e) {
- var n = this._getNewPixelOrigin(e, i);
- return R([
- this.project(t.getSouthWest(), i)._subtract(n),
- this.project(t.getNorthWest(), i)._subtract(n),
- this.project(t.getSouthEast(), i)._subtract(n),
- this.project(t.getNorthEast(), i)._subtract(n),
- ]);
- },
- _getCenterLayerPoint: function () {
- return this.containerPointToLayerPoint(this.getSize()._divideBy(2));
- },
- _getCenterOffset: function (t) {
- return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint());
- },
- _limitCenter: function (t, i, e) {
- if (!e) return t;
- var n = this.project(t, i),
- o = this.getSize().divideBy(2),
- s = new O(n.subtract(o), n.add(o)),
- r = this._getBoundsOffset(s, e, i);
- return r.round().equals([0, 0]) ? t : this.unproject(n.add(r), i);
- },
- _limitOffset: function (t, i) {
- if (!i) return t;
- var e = this.getPixelBounds(),
- n = new O(e.min.add(t), e.max.add(t));
- return t.add(this._getBoundsOffset(n, i));
- },
- _getBoundsOffset: function (t, i, e) {
- var n = R(
- this.project(i.getNorthEast(), e),
- this.project(i.getSouthWest(), e),
- ),
- o = n.min.subtract(t.min),
- s = n.max.subtract(t.max);
- return new B(this._rebound(o.x, -s.x), this._rebound(o.y, -s.y));
- },
- _rebound: function (t, i) {
- return 0 < t + i
- ? Math.round(t - i) / 2
- : Math.max(0, Math.ceil(t)) - Math.max(0, Math.floor(i));
- },
- _limitZoom: function (t) {
- var i = this.getMinZoom(),
- e = this.getMaxZoom(),
- n = yt ? this.options.zoomSnap : 1;
- return n && (t = Math.round(t / n) * n), Math.max(i, Math.min(e, t));
- },
- _onPanTransitionStep: function () {
- this.fire("move");
- },
- _onPanTransitionEnd: function () {
- mi(this._mapPane, "leaflet-pan-anim"), this.fire("moveend");
- },
- _tryAnimatedPan: function (t, i) {
- var e = this._getCenterOffset(t)._trunc();
- return (
- !(!0 !== (i && i.animate) && !this.getSize().contains(e)) &&
- (this.panBy(e, i), !0)
- );
- },
- _createAnimProxy: function () {
- var t = (this._proxy = hi(
- "div",
- "leaflet-proxy leaflet-zoom-animated",
- ));
- this._panes.mapPane.appendChild(t),
- this.on(
- "zoomanim",
- function (t) {
- var i = ni,
- e = this._proxy.style[i];
- xi(
- this._proxy,
- this.project(t.center, t.zoom),
- this.getZoomScale(t.zoom, 1),
- ),
- e === this._proxy.style[i] &&
- this._animatingZoom &&
- this._onZoomTransitionEnd();
- },
- this,
- ),
- this.on(
- "load moveend",
- function () {
- var t = this.getCenter(),
- i = this.getZoom();
- xi(this._proxy, this.project(t, i), this.getZoomScale(i, 1));
- },
- this,
- ),
- this._on("unload", this._destroyAnimProxy, this);
- },
- _destroyAnimProxy: function () {
- ui(this._proxy), delete this._proxy;
- },
- _catchTransitionEnd: function (t) {
- this._animatingZoom &&
- 0 <= t.propertyName.indexOf("transform") &&
- this._onZoomTransitionEnd();
- },
- _nothingToAnimate: function () {
- return !this._container.getElementsByClassName("leaflet-zoom-animated")
- .length;
- },
- _tryAnimatedZoom: function (t, i, e) {
- if (this._animatingZoom) return !0;
- if (
- ((e = e || {}),
- !this._zoomAnimated ||
- !1 === e.animate ||
- this._nothingToAnimate() ||
- Math.abs(i - this._zoom) > this.options.zoomAnimationThreshold)
- )
- return !1;
- var n = this.getZoomScale(i),
- o = this._getCenterOffset(t)._divideBy(1 - 1 / n);
- return (
- !(!0 !== e.animate && !this.getSize().contains(o)) &&
- (M(function () {
- this._moveStart(!0, !1)._animateZoom(t, i, !0);
- }, this),
- !0)
- );
- },
- _animateZoom: function (t, i, e, n) {
- this._mapPane &&
- (e &&
- ((this._animatingZoom = !0),
- (this._animateToCenter = t),
- (this._animateToZoom = i),
- pi(this._mapPane, "leaflet-zoom-anim")),
- this.fire("zoomanim", { center: t, zoom: i, noUpdate: n }),
- setTimeout(a(this._onZoomTransitionEnd, this), 250));
- },
- _onZoomTransitionEnd: function () {
- this._animatingZoom &&
- (this._mapPane && mi(this._mapPane, "leaflet-zoom-anim"),
- (this._animatingZoom = !1),
- this._move(this._animateToCenter, this._animateToZoom),
- M(function () {
- this._moveEnd(!0);
- }, this));
- },
- });
- function $i(t) {
- return new Qi(t);
- }
- var Qi = Z.extend({
- options: { position: "topright" },
- initialize: function (t) {
- p(this, t);
- },
- getPosition: function () {
- return this.options.position;
- },
- setPosition: function (t) {
- var i = this._map;
- return (
- i && i.removeControl(this),
- (this.options.position = t),
- i && i.addControl(this),
- this
- );
- },
- getContainer: function () {
- return this._container;
- },
- addTo: function (t) {
- this.remove(), (this._map = t);
- var i = (this._container = this.onAdd(t)),
- e = this.getPosition(),
- n = t._controlCorners[e];
- return (
- pi(i, "leaflet-control"),
- -1 !== e.indexOf("bottom")
- ? n.insertBefore(i, n.firstChild)
- : n.appendChild(i),
- this._map.on("unload", this.remove, this),
- this
- );
- },
- remove: function () {
- return (
- this._map &&
- (ui(this._container),
- this.onRemove && this.onRemove(this._map),
- this._map.off("unload", this.remove, this),
- (this._map = null)),
- this
- );
- },
- _refocusOnMap: function (t) {
- this._map &&
- t &&
- 0 < t.screenX &&
- 0 < t.screenY &&
- this._map.getContainer().focus();
- },
- });
- Ji.include({
- addControl: function (t) {
- return t.addTo(this), this;
- },
- removeControl: function (t) {
- return t.remove(), this;
- },
- _initControlPos: function () {
- var n = (this._controlCorners = {}),
- o = "leaflet-",
- s = (this._controlContainer = hi(
- "div",
- o + "control-container",
- this._container,
- ));
- function t(t, i) {
- var e = o + t + " " + o + i;
- n[t + i] = hi("div", e, s);
- }
- t("top", "left"),
- t("top", "right"),
- t("bottom", "left"),
- t("bottom", "right");
- },
- _clearControlPos: function () {
- for (var t in this._controlCorners) ui(this._controlCorners[t]);
- ui(this._controlContainer),
- delete this._controlCorners,
- delete this._controlContainer;
- },
- });
- var te = Qi.extend({
- options: {
- collapsed: !0,
- position: "topright",
- autoZIndex: !0,
- hideSingleBase: !1,
- sortLayers: !1,
- sortFunction: function (t, i, e, n) {
- return e < n ? -1 : n < e ? 1 : 0;
- },
- },
- initialize: function (t, i, e) {
- for (var n in (p(this, e),
- (this._layerControlInputs = []),
- (this._layers = []),
- (this._lastZIndex = 0),
- (this._handlingClick = !1),
- t))
- this._addLayer(t[n], n);
- for (n in i) this._addLayer(i[n], n, !0);
- },
- onAdd: function (t) {
- this._initLayout(),
- this._update(),
- (this._map = t).on("zoomend", this._checkDisabledLayers, this);
- for (var i = 0; i < this._layers.length; i++)
- this._layers[i].layer.on("add remove", this._onLayerChange, this);
- return this._container;
- },
- addTo: function (t) {
- return Qi.prototype.addTo.call(this, t), this._expandIfNotCollapsed();
- },
- onRemove: function () {
- this._map.off("zoomend", this._checkDisabledLayers, this);
- for (var t = 0; t < this._layers.length; t++)
- this._layers[t].layer.off("add remove", this._onLayerChange, this);
- },
- addBaseLayer: function (t, i) {
- return this._addLayer(t, i), this._map ? this._update() : this;
- },
- addOverlay: function (t, i) {
- return this._addLayer(t, i, !0), this._map ? this._update() : this;
- },
- removeLayer: function (t) {
- t.off("add remove", this._onLayerChange, this);
- var i = this._getLayer(u(t));
- return (
- i && this._layers.splice(this._layers.indexOf(i), 1),
- this._map ? this._update() : this
- );
- },
- expand: function () {
- pi(this._container, "leaflet-control-layers-expanded"),
- (this._section.style.height = null);
- var t = this._map.getSize().y - (this._container.offsetTop + 50);
- return (
- t < this._section.clientHeight
- ? (pi(this._section, "leaflet-control-layers-scrollbar"),
- (this._section.style.height = t + "px"))
- : mi(this._section, "leaflet-control-layers-scrollbar"),
- this._checkDisabledLayers(),
- this
- );
- },
- collapse: function () {
- return mi(this._container, "leaflet-control-layers-expanded"), this;
- },
- _initLayout: function () {
- var t = "leaflet-control-layers",
- i = (this._container = hi("div", t)),
- e = this.options.collapsed;
- i.setAttribute("aria-haspopup", !0), Ni(i), Ri(i);
- var n = (this._section = hi("section", t + "-list"));
- e &&
- (this._map.on("click", this.collapse, this),
- st ||
- Ei(
- i,
- { mouseenter: this.expand, mouseleave: this.collapse },
- this,
- ));
- var o = (this._layersLink = hi("a", t + "-toggle", i));
- (o.href = "#"),
- (o.title = "Layers"),
- Tt
- ? (Ei(o, "click", ji), Ei(o, "click", this.expand, this))
- : Ei(o, "focus", this.expand, this),
- e || this.expand(),
- (this._baseLayersList = hi("div", t + "-base", n)),
- (this._separator = hi("div", t + "-separator", n)),
- (this._overlaysList = hi("div", t + "-overlays", n)),
- i.appendChild(n);
- },
- _getLayer: function (t) {
- for (var i = 0; i < this._layers.length; i++)
- if (this._layers[i] && u(this._layers[i].layer) === t)
- return this._layers[i];
- },
- _addLayer: function (t, i, e) {
- this._map && t.on("add remove", this._onLayerChange, this),
- this._layers.push({ layer: t, name: i, overlay: e }),
- this.options.sortLayers &&
- this._layers.sort(
- a(function (t, i) {
- return this.options.sortFunction(
- t.layer,
- i.layer,
- t.name,
- i.name,
- );
- }, this),
- ),
- this.options.autoZIndex &&
- t.setZIndex &&
- (this._lastZIndex++, t.setZIndex(this._lastZIndex)),
- this._expandIfNotCollapsed();
- },
- _update: function () {
- if (!this._container) return this;
- li(this._baseLayersList),
- li(this._overlaysList),
- (this._layerControlInputs = []);
- var t,
- i,
- e,
- n,
- o = 0;
- for (e = 0; e < this._layers.length; e++)
- (n = this._layers[e]),
- this._addItem(n),
- (i = i || n.overlay),
- (t = t || !n.overlay),
- (o += n.overlay ? 0 : 1);
- return (
- this.options.hideSingleBase &&
- ((t = t && 1 < o),
- (this._baseLayersList.style.display = t ? "" : "none")),
- (this._separator.style.display = i && t ? "" : "none"),
- this
- );
- },
- _onLayerChange: function (t) {
- this._handlingClick || this._update();
- var i = this._getLayer(u(t.target)),
- e = i.overlay
- ? "add" === t.type
- ? "overlayadd"
- : "overlayremove"
- : "add" === t.type
- ? "baselayerchange"
- : null;
- e && this._map.fire(e, i);
- },
- _createRadioElement: function (t, i) {
- var e =
- ' ",
- n = document.createElement("div");
- return (n.innerHTML = e), n.firstChild;
- },
- _addItem: function (t) {
- var i,
- e = document.createElement("label"),
- n = this._map.hasLayer(t.layer);
- t.overlay
- ? (((i = document.createElement("input")).type = "checkbox"),
- (i.className = "leaflet-control-layers-selector"),
- (i.defaultChecked = n))
- : (i = this._createRadioElement("leaflet-base-layers_" + u(this), n)),
- this._layerControlInputs.push(i),
- (i.layerId = u(t.layer)),
- Ei(i, "click", this._onInputClick, this);
- var o = document.createElement("span");
- o.innerHTML = " " + t.name;
- var s = document.createElement("div");
- return (
- e.appendChild(s),
- s.appendChild(i),
- s.appendChild(o),
- (t.overlay ? this._overlaysList : this._baseLayersList).appendChild(
- e,
- ),
- this._checkDisabledLayers(),
- e
- );
- },
- _onInputClick: function () {
- var t,
- i,
- e = this._layerControlInputs,
- n = [],
- o = [];
- this._handlingClick = !0;
- for (var s = e.length - 1; 0 <= s; s--)
- (t = e[s]),
- (i = this._getLayer(t.layerId).layer),
- t.checked ? n.push(i) : t.checked || o.push(i);
- for (s = 0; s < o.length; s++)
- this._map.hasLayer(o[s]) && this._map.removeLayer(o[s]);
- for (s = 0; s < n.length; s++)
- this._map.hasLayer(n[s]) || this._map.addLayer(n[s]);
- (this._handlingClick = !1), this._refocusOnMap();
- },
- _checkDisabledLayers: function () {
- for (
- var t,
- i,
- e = this._layerControlInputs,
- n = this._map.getZoom(),
- o = e.length - 1;
- 0 <= o;
- o--
- )
- (t = e[o]),
- (i = this._getLayer(t.layerId).layer),
- (t.disabled =
- (void 0 !== i.options.minZoom && n < i.options.minZoom) ||
- (void 0 !== i.options.maxZoom && n > i.options.maxZoom));
- },
- _expandIfNotCollapsed: function () {
- return this._map && !this.options.collapsed && this.expand(), this;
- },
- _expand: function () {
- return this.expand();
- },
- _collapse: function () {
- return this.collapse();
- },
- }),
- ie = Qi.extend({
- options: {
- position: "topleft",
- zoomInText: "+",
- zoomInTitle: "Zoom in",
- zoomOutText: "−",
- zoomOutTitle: "Zoom out",
- },
- onAdd: function (t) {
- var i = "leaflet-control-zoom",
- e = hi("div", i + " leaflet-bar"),
- n = this.options;
- return (
- (this._zoomInButton = this._createButton(
- n.zoomInText,
- n.zoomInTitle,
- i + "-in",
- e,
- this._zoomIn,
- )),
- (this._zoomOutButton = this._createButton(
- n.zoomOutText,
- n.zoomOutTitle,
- i + "-out",
- e,
- this._zoomOut,
- )),
- this._updateDisabled(),
- t.on("zoomend zoomlevelschange", this._updateDisabled, this),
- e
- );
- },
- onRemove: function (t) {
- t.off("zoomend zoomlevelschange", this._updateDisabled, this);
- },
- disable: function () {
- return (this._disabled = !0), this._updateDisabled(), this;
- },
- enable: function () {
- return (this._disabled = !1), this._updateDisabled(), this;
- },
- _zoomIn: function (t) {
- !this._disabled &&
- this._map._zoom < this._map.getMaxZoom() &&
- this._map.zoomIn(this._map.options.zoomDelta * (t.shiftKey ? 3 : 1));
- },
- _zoomOut: function (t) {
- !this._disabled &&
- this._map._zoom > this._map.getMinZoom() &&
- this._map.zoomOut(this._map.options.zoomDelta * (t.shiftKey ? 3 : 1));
- },
- _createButton: function (t, i, e, n, o) {
- var s = hi("a", e, n);
- return (
- (s.innerHTML = t),
- (s.href = "#"),
- (s.title = i),
- s.setAttribute("role", "button"),
- s.setAttribute("aria-label", i),
- Ni(s),
- Ei(s, "click", ji),
- Ei(s, "click", o, this),
- Ei(s, "click", this._refocusOnMap, this),
- s
- );
- },
- _updateDisabled: function () {
- var t = this._map,
- i = "leaflet-disabled";
- mi(this._zoomInButton, i),
- mi(this._zoomOutButton, i),
- (!this._disabled && t._zoom !== t.getMinZoom()) ||
- pi(this._zoomOutButton, i),
- (!this._disabled && t._zoom !== t.getMaxZoom()) ||
- pi(this._zoomInButton, i);
- },
- });
- Ji.mergeOptions({ zoomControl: !0 }),
- Ji.addInitHook(function () {
- this.options.zoomControl &&
- ((this.zoomControl = new ie()), this.addControl(this.zoomControl));
- });
- var ee = Qi.extend({
- options: {
- position: "bottomleft",
- maxWidth: 100,
- metric: !0,
- imperial: !0,
- },
- onAdd: function (t) {
- var i = "leaflet-control-scale",
- e = hi("div", i),
- n = this.options;
- return (
- this._addScales(n, i + "-line", e),
- t.on(n.updateWhenIdle ? "moveend" : "move", this._update, this),
- t.whenReady(this._update, this),
- e
- );
- },
- onRemove: function (t) {
- t.off(
- this.options.updateWhenIdle ? "moveend" : "move",
- this._update,
- this,
- );
- },
- _addScales: function (t, i, e) {
- t.metric && (this._mScale = hi("div", i, e)),
- t.imperial && (this._iScale = hi("div", i, e));
- },
- _update: function () {
- var t = this._map,
- i = t.getSize().y / 2,
- e = t.distance(
- t.containerPointToLatLng([0, i]),
- t.containerPointToLatLng([this.options.maxWidth, i]),
- );
- this._updateScales(e);
- },
- _updateScales: function (t) {
- this.options.metric && t && this._updateMetric(t),
- this.options.imperial && t && this._updateImperial(t);
- },
- _updateMetric: function (t) {
- var i = this._getRoundNum(t),
- e = i < 1e3 ? i + " m" : i / 1e3 + " km";
- this._updateScale(this._mScale, e, i / t);
- },
- _updateImperial: function (t) {
- var i,
- e,
- n,
- o = 3.2808399 * t;
- 5280 < o
- ? ((i = o / 5280),
- (e = this._getRoundNum(i)),
- this._updateScale(this._iScale, e + " mi", e / i))
- : ((n = this._getRoundNum(o)),
- this._updateScale(this._iScale, n + " ft", n / o));
- },
- _updateScale: function (t, i, e) {
- (t.style.width = Math.round(this.options.maxWidth * e) + "px"),
- (t.innerHTML = i);
- },
- _getRoundNum: function (t) {
- var i = Math.pow(10, (Math.floor(t) + "").length - 1),
- e = t / i;
- return (
- i * (e = 10 <= e ? 10 : 5 <= e ? 5 : 3 <= e ? 3 : 2 <= e ? 2 : 1)
- );
- },
- }),
- ne = Qi.extend({
- options: {
- position: "bottomright",
- prefix:
- 'Leaflet ',
- },
- initialize: function (t) {
- p(this, t), (this._attributions = {});
- },
- onAdd: function (t) {
- for (var i in (((t.attributionControl = this)._container = hi(
- "div",
- "leaflet-control-attribution",
- )),
- Ni(this._container),
- t._layers))
- t._layers[i].getAttribution &&
- this.addAttribution(t._layers[i].getAttribution());
- return this._update(), this._container;
- },
- setPrefix: function (t) {
- return (this.options.prefix = t), this._update(), this;
- },
- addAttribution: function (t) {
- return (
- t &&
- (this._attributions[t] || (this._attributions[t] = 0),
- this._attributions[t]++,
- this._update()),
- this
- );
- },
- removeAttribution: function (t) {
- return (
- t &&
- this._attributions[t] &&
- (this._attributions[t]--, this._update()),
- this
- );
- },
- _update: function () {
- if (this._map) {
- var t = [];
- for (var i in this._attributions) this._attributions[i] && t.push(i);
- var e = [];
- this.options.prefix && e.push(this.options.prefix),
- t.length && e.push(t.join(", ")),
- (this._container.innerHTML = e.join(" | "));
- }
- },
- });
- Ji.mergeOptions({ attributionControl: !0 }),
- Ji.addInitHook(function () {
- this.options.attributionControl && new ne().addTo(this);
- });
- (Qi.Layers = te),
- (Qi.Zoom = ie),
- (Qi.Scale = ee),
- (Qi.Attribution = ne),
- ($i.layers = function (t, i, e) {
- return new te(t, i, e);
- }),
- ($i.zoom = function (t) {
- return new ie(t);
- }),
- ($i.scale = function (t) {
- return new ee(t);
- }),
- ($i.attribution = function (t) {
- return new ne(t);
- });
- var oe = Z.extend({
- initialize: function (t) {
- this._map = t;
- },
- enable: function () {
- return this._enabled || ((this._enabled = !0), this.addHooks()), this;
- },
- disable: function () {
- return this._enabled && ((this._enabled = !1), this.removeHooks()), this;
- },
- enabled: function () {
- return !!this._enabled;
- },
- });
- oe.addTo = function (t, i) {
- return t.addHandler(i, this), this;
- };
- var se,
- re = { Events: E },
- ae = Tt ? "touchstart mousedown" : "mousedown",
- he = {
- mousedown: "mouseup",
- touchstart: "touchend",
- pointerdown: "touchend",
- MSPointerDown: "touchend",
- },
- ue = {
- mousedown: "mousemove",
- touchstart: "touchmove",
- pointerdown: "touchmove",
- MSPointerDown: "touchmove",
- },
- le = k.extend({
- options: { clickTolerance: 3 },
- initialize: function (t, i, e, n) {
- p(this, n),
- (this._element = t),
- (this._dragStartTarget = i || t),
- (this._preventOutline = e);
- },
- enable: function () {
- this._enabled ||
- (Ei(this._dragStartTarget, ae, this._onDown, this),
- (this._enabled = !0));
- },
- disable: function () {
- this._enabled &&
- (le._dragging === this && this.finishDrag(),
- Bi(this._dragStartTarget, ae, this._onDown, this),
- (this._enabled = !1),
- (this._moved = !1));
- },
- _onDown: function (t) {
- if (
- !t._simulated &&
- this._enabled &&
- ((this._moved = !1),
- !di(this._element, "leaflet-zoom-anim") &&
- !(
- le._dragging ||
- t.shiftKey ||
- (1 !== t.which && 1 !== t.button && !t.touches) ||
- ((le._dragging = this)._preventOutline && zi(this._element),
- bi(),
- $t(),
- this._moving)
- ))
- ) {
- this.fire("down");
- var i = t.touches ? t.touches[0] : t,
- e = Ci(this._element);
- (this._startPoint = new B(i.clientX, i.clientY)),
- (this._parentScale = Si(e)),
- Ei(document, ue[t.type], this._onMove, this),
- Ei(document, he[t.type], this._onUp, this);
- }
- },
- _onMove: function (t) {
- if (!t._simulated && this._enabled)
- if (t.touches && 1 < t.touches.length) this._moved = !0;
- else {
- var i = t.touches && 1 === t.touches.length ? t.touches[0] : t,
- e = new B(i.clientX, i.clientY)._subtract(this._startPoint);
- (e.x || e.y) &&
- (Math.abs(e.x) + Math.abs(e.y) < this.options.clickTolerance ||
- ((e.x /= this._parentScale.x),
- (e.y /= this._parentScale.y),
- Di(t),
- this._moved ||
- (this.fire("dragstart"),
- (this._moved = !0),
- (this._startPos = Pi(this._element).subtract(e)),
- pi(document.body, "leaflet-dragging"),
- (this._lastTarget = t.target || t.srcElement),
- window.SVGElementInstance &&
- this._lastTarget instanceof SVGElementInstance &&
- (this._lastTarget =
- this._lastTarget.correspondingUseElement),
- pi(this._lastTarget, "leaflet-drag-target")),
- (this._newPos = this._startPos.add(e)),
- (this._moving = !0),
- C(this._animRequest),
- (this._lastEvent = t),
- (this._animRequest = M(this._updatePosition, this, !0))));
- }
- },
- _updatePosition: function () {
- var t = { originalEvent: this._lastEvent };
- this.fire("predrag", t),
- wi(this._element, this._newPos),
- this.fire("drag", t);
- },
- _onUp: function (t) {
- !t._simulated && this._enabled && this.finishDrag();
- },
- finishDrag: function () {
- for (var t in (mi(document.body, "leaflet-dragging"),
- this._lastTarget &&
- (mi(this._lastTarget, "leaflet-drag-target"),
- (this._lastTarget = null)),
- ue))
- Bi(document, ue[t], this._onMove, this),
- Bi(document, he[t], this._onUp, this);
- Ti(),
- Qt(),
- this._moved &&
- this._moving &&
- (C(this._animRequest),
- this.fire("dragend", {
- distance: this._newPos.distanceTo(this._startPos),
- })),
- (this._moving = !1),
- (le._dragging = !1);
- },
- });
- function ce(t, i) {
- if (!i || !t.length) return t.slice();
- var e = i * i;
- return (t = (function (t, i) {
- var e = t.length,
- n = new (typeof Uint8Array != void 0 + "" ? Uint8Array : Array)(e);
- (n[0] = n[e - 1] = 1),
- (function t(i, e, n, o, s) {
- var r,
- a,
- h,
- u = 0;
- for (a = o + 1; a <= s - 1; a++)
- (h = fe(i[a], i[o], i[s], !0)), u < h && ((r = a), (u = h));
- n < u && ((e[r] = 1), t(i, e, n, o, r), t(i, e, n, r, s));
- })(t, n, i, 0, e - 1);
- var o,
- s = [];
- for (o = 0; o < e; o++) n[o] && s.push(t[o]);
- return s;
- })(
- (t = (function (t, i) {
- for (var e = [t[0]], n = 1, o = 0, s = t.length; n < s; n++)
- (r = t[n]),
- (a = t[o]),
- void 0,
- (h = a.x - r.x),
- (u = a.y - r.y),
- i < h * h + u * u && (e.push(t[n]), (o = n));
- var r, a, h, u;
- o < s - 1 && e.push(t[s - 1]);
- return e;
- })(t, e)),
- e,
- ));
- }
- function _e(t, i, e) {
- return Math.sqrt(fe(t, i, e, !0));
- }
- function de(t, i, e, n, o) {
- var s,
- r,
- a,
- h = n ? se : me(t, e),
- u = me(i, e);
- for (se = u; ; ) {
- if (!(h | u)) return [t, i];
- if (h & u) return !1;
- (a = me((r = pe(t, i, (s = h || u), e, o)), e)),
- s === h ? ((t = r), (h = a)) : ((i = r), (u = a));
- }
- }
- function pe(t, i, e, n, o) {
- var s,
- r,
- a = i.x - t.x,
- h = i.y - t.y,
- u = n.min,
- l = n.max;
- return (
- 8 & e
- ? ((s = t.x + (a * (l.y - t.y)) / h), (r = l.y))
- : 4 & e
- ? ((s = t.x + (a * (u.y - t.y)) / h), (r = u.y))
- : 2 & e
- ? ((s = l.x), (r = t.y + (h * (l.x - t.x)) / a))
- : 1 & e && ((s = u.x), (r = t.y + (h * (u.x - t.x)) / a)),
- new B(s, r, o)
- );
- }
- function me(t, i) {
- var e = 0;
- return (
- t.x < i.min.x ? (e |= 1) : t.x > i.max.x && (e |= 2),
- t.y < i.min.y ? (e |= 4) : t.y > i.max.y && (e |= 8),
- e
- );
- }
- function fe(t, i, e, n) {
- var o,
- s = i.x,
- r = i.y,
- a = e.x - s,
- h = e.y - r,
- u = a * a + h * h;
- return (
- 0 < u &&
- (1 < (o = ((t.x - s) * a + (t.y - r) * h) / u)
- ? ((s = e.x), (r = e.y))
- : 0 < o && ((s += a * o), (r += h * o))),
- (a = t.x - s),
- (h = t.y - r),
- n ? a * a + h * h : new B(s, r)
- );
- }
- function ge(t) {
- return !v(t[0]) || ("object" != typeof t[0][0] && void 0 !== t[0][0]);
- }
- function ve(t) {
- return (
- console.warn(
- "Deprecated use of _flat, please use L.LineUtil.isFlat instead.",
- ),
- ge(t)
- );
- }
- var ye = (Object.freeze || Object)({
- simplify: ce,
- pointToSegmentDistance: _e,
- closestPointOnSegment: function (t, i, e) {
- return fe(t, i, e);
- },
- clipSegment: de,
- _getEdgeIntersection: pe,
- _getBitCode: me,
- _sqClosestPointOnSegment: fe,
- isFlat: ge,
- _flat: ve,
- });
- function xe(t, i, e) {
- var n,
- o,
- s,
- r,
- a,
- h,
- u,
- l,
- c,
- _ = [1, 4, 2, 8];
- for (o = 0, u = t.length; o < u; o++) t[o]._code = me(t[o], i);
- for (r = 0; r < 4; r++) {
- for (l = _[r], n = [], o = 0, s = (u = t.length) - 1; o < u; s = o++)
- (a = t[o]),
- (h = t[s]),
- a._code & l
- ? h._code & l ||
- (((c = pe(h, a, l, i, e))._code = me(c, i)), n.push(c))
- : (h._code & l &&
- (((c = pe(h, a, l, i, e))._code = me(c, i)), n.push(c)),
- n.push(a));
- t = n;
- }
- return t;
- }
- var we,
- Pe = (Object.freeze || Object)({ clipPolygon: xe }),
- Le = {
- project: function (t) {
- return new B(t.lng, t.lat);
- },
- unproject: function (t) {
- return new j(t.y, t.x);
- },
- bounds: new O([-180, -90], [180, 90]),
- },
- be = {
- R: 6378137,
- R_MINOR: 6356752.314245179,
- bounds: new O(
- [-20037508.34279, -15496570.73972],
- [20037508.34279, 18764656.23138],
- ),
- project: function (t) {
- var i = Math.PI / 180,
- e = this.R,
- n = t.lat * i,
- o = this.R_MINOR / e,
- s = Math.sqrt(1 - o * o),
- r = s * Math.sin(n),
- a =
- Math.tan(Math.PI / 4 - n / 2) / Math.pow((1 - r) / (1 + r), s / 2);
- return (n = -e * Math.log(Math.max(a, 1e-10))), new B(t.lng * i * e, n);
- },
- unproject: function (t) {
- for (
- var i,
- e = 180 / Math.PI,
- n = this.R,
- o = this.R_MINOR / n,
- s = Math.sqrt(1 - o * o),
- r = Math.exp(-t.y / n),
- a = Math.PI / 2 - 2 * Math.atan(r),
- h = 0,
- u = 0.1;
- h < 15 && 1e-7 < Math.abs(u);
- h++
- )
- (i = s * Math.sin(a)),
- (i = Math.pow((1 - i) / (1 + i), s / 2)),
- (a += u = Math.PI / 2 - 2 * Math.atan(r * i) - a);
- return new j(a * e, (t.x * e) / n);
- },
- },
- Te = (Object.freeze || Object)({
- LonLat: Le,
- Mercator: be,
- SphericalMercator: q,
- }),
- ze = h({}, U, {
- code: "EPSG:3395",
- projection: be,
- transformation: ((we = 0.5 / (Math.PI * be.R)), K(we, 0.5, -we, 0.5)),
- }),
- Me = h({}, U, {
- code: "EPSG:4326",
- projection: Le,
- transformation: K(1 / 180, 1, -1 / 180, 0.5),
- }),
- Ce = h({}, F, {
- projection: Le,
- transformation: K(1, 0, -1, 0),
- scale: function (t) {
- return Math.pow(2, t);
- },
- zoom: function (t) {
- return Math.log(t) / Math.LN2;
- },
- distance: function (t, i) {
- var e = i.lng - t.lng,
- n = i.lat - t.lat;
- return Math.sqrt(e * e + n * n);
- },
- infinite: !0,
- });
- (F.Earth = U),
- (F.EPSG3395 = ze),
- (F.EPSG3857 = X),
- (F.EPSG900913 = J),
- (F.EPSG4326 = Me),
- (F.Simple = Ce);
- var Se = k.extend({
- options: {
- pane: "overlayPane",
- attribution: null,
- bubblingMouseEvents: !0,
- },
- addTo: function (t) {
- return t.addLayer(this), this;
- },
- remove: function () {
- return this.removeFrom(this._map || this._mapToAdd);
- },
- removeFrom: function (t) {
- return t && t.removeLayer(this), this;
- },
- getPane: function (t) {
- return this._map.getPane(t ? this.options[t] || t : this.options.pane);
- },
- addInteractiveTarget: function (t) {
- return (this._map._targets[u(t)] = this);
- },
- removeInteractiveTarget: function (t) {
- return delete this._map._targets[u(t)], this;
- },
- getAttribution: function () {
- return this.options.attribution;
- },
- _layerAdd: function (t) {
- var i = t.target;
- if (i.hasLayer(this)) {
- if (
- ((this._map = i),
- (this._zoomAnimated = i._zoomAnimated),
- this.getEvents)
- ) {
- var e = this.getEvents();
- i.on(e, this),
- this.once(
- "remove",
- function () {
- i.off(e, this);
- },
- this,
- );
- }
- this.onAdd(i),
- this.getAttribution &&
- i.attributionControl &&
- i.attributionControl.addAttribution(this.getAttribution()),
- this.fire("add"),
- i.fire("layeradd", { layer: this });
- }
- },
- });
- Ji.include({
- addLayer: function (t) {
- if (!t._layerAdd) throw new Error("The provided object is not a Layer.");
- var i = u(t);
- return (
- this._layers[i] ||
- (((this._layers[i] = t)._mapToAdd = this),
- t.beforeAdd && t.beforeAdd(this),
- this.whenReady(t._layerAdd, t)),
- this
- );
- },
- removeLayer: function (t) {
- var i = u(t);
- return (
- this._layers[i] &&
- (this._loaded && t.onRemove(this),
- t.getAttribution &&
- this.attributionControl &&
- this.attributionControl.removeAttribution(t.getAttribution()),
- delete this._layers[i],
- this._loaded &&
- (this.fire("layerremove", { layer: t }), t.fire("remove")),
- (t._map = t._mapToAdd = null)),
- this
- );
- },
- hasLayer: function (t) {
- return !!t && u(t) in this._layers;
- },
- eachLayer: function (t, i) {
- for (var e in this._layers) t.call(i, this._layers[e]);
- return this;
- },
- _addLayers: function (t) {
- for (var i = 0, e = (t = t ? (v(t) ? t : [t]) : []).length; i < e; i++)
- this.addLayer(t[i]);
- },
- _addZoomLimit: function (t) {
- (!isNaN(t.options.maxZoom) && isNaN(t.options.minZoom)) ||
- ((this._zoomBoundLayers[u(t)] = t), this._updateZoomLevels());
- },
- _removeZoomLimit: function (t) {
- var i = u(t);
- this._zoomBoundLayers[i] &&
- (delete this._zoomBoundLayers[i], this._updateZoomLevels());
- },
- _updateZoomLevels: function () {
- var t = 1 / 0,
- i = -1 / 0,
- e = this._getZoomSpan();
- for (var n in this._zoomBoundLayers) {
- var o = this._zoomBoundLayers[n].options;
- (t = void 0 === o.minZoom ? t : Math.min(t, o.minZoom)),
- (i = void 0 === o.maxZoom ? i : Math.max(i, o.maxZoom));
- }
- (this._layersMaxZoom = i === -1 / 0 ? void 0 : i),
- (this._layersMinZoom = t === 1 / 0 ? void 0 : t),
- e !== this._getZoomSpan() && this.fire("zoomlevelschange"),
- void 0 === this.options.maxZoom &&
- this._layersMaxZoom &&
- this.getZoom() > this._layersMaxZoom &&
- this.setZoom(this._layersMaxZoom),
- void 0 === this.options.minZoom &&
- this._layersMinZoom &&
- this.getZoom() < this._layersMinZoom &&
- this.setZoom(this._layersMinZoom);
- },
- });
- var Ze = Se.extend({
- initialize: function (t, i) {
- var e, n;
- if ((p(this, i), (this._layers = {}), t))
- for (e = 0, n = t.length; e < n; e++) this.addLayer(t[e]);
- },
- addLayer: function (t) {
- var i = this.getLayerId(t);
- return (this._layers[i] = t), this._map && this._map.addLayer(t), this;
- },
- removeLayer: function (t) {
- var i = t in this._layers ? t : this.getLayerId(t);
- return (
- this._map &&
- this._layers[i] &&
- this._map.removeLayer(this._layers[i]),
- delete this._layers[i],
- this
- );
- },
- hasLayer: function (t) {
- return !!t && (t in this._layers || this.getLayerId(t) in this._layers);
- },
- clearLayers: function () {
- return this.eachLayer(this.removeLayer, this);
- },
- invoke: function (t) {
- var i,
- e,
- n = Array.prototype.slice.call(arguments, 1);
- for (i in this._layers) (e = this._layers[i])[t] && e[t].apply(e, n);
- return this;
- },
- onAdd: function (t) {
- this.eachLayer(t.addLayer, t);
- },
- onRemove: function (t) {
- this.eachLayer(t.removeLayer, t);
- },
- eachLayer: function (t, i) {
- for (var e in this._layers) t.call(i, this._layers[e]);
- return this;
- },
- getLayer: function (t) {
- return this._layers[t];
- },
- getLayers: function () {
- var t = [];
- return this.eachLayer(t.push, t), t;
- },
- setZIndex: function (t) {
- return this.invoke("setZIndex", t);
- },
- getLayerId: function (t) {
- return u(t);
- },
- }),
- Ee = Ze.extend({
- addLayer: function (t) {
- return this.hasLayer(t)
- ? this
- : (t.addEventParent(this),
- Ze.prototype.addLayer.call(this, t),
- this.fire("layeradd", { layer: t }));
- },
- removeLayer: function (t) {
- return this.hasLayer(t)
- ? (t in this._layers && (t = this._layers[t]),
- t.removeEventParent(this),
- Ze.prototype.removeLayer.call(this, t),
- this.fire("layerremove", { layer: t }))
- : this;
- },
- setStyle: function (t) {
- return this.invoke("setStyle", t);
- },
- bringToFront: function () {
- return this.invoke("bringToFront");
- },
- bringToBack: function () {
- return this.invoke("bringToBack");
- },
- getBounds: function () {
- var t = new N();
- for (var i in this._layers) {
- var e = this._layers[i];
- t.extend(e.getBounds ? e.getBounds() : e.getLatLng());
- }
- return t;
- },
- }),
- ke = Z.extend({
- options: { popupAnchor: [0, 0], tooltipAnchor: [0, 0] },
- initialize: function (t) {
- p(this, t);
- },
- createIcon: function (t) {
- return this._createIcon("icon", t);
- },
- createShadow: function (t) {
- return this._createIcon("shadow", t);
- },
- _createIcon: function (t, i) {
- var e = this._getIconUrl(t);
- if (!e) {
- if ("icon" === t)
- throw new Error("iconUrl not set in Icon options (see the docs).");
- return null;
- }
- var n = this._createImg(e, i && "IMG" === i.tagName ? i : null);
- return this._setIconStyles(n, t), n;
- },
- _setIconStyles: function (t, i) {
- var e = this.options,
- n = e[i + "Size"];
- "number" == typeof n && (n = [n, n]);
- var o = I(n),
- s = I(
- ("shadow" === i && e.shadowAnchor) ||
- e.iconAnchor ||
- (o && o.divideBy(2, !0)),
- );
- (t.className = "leaflet-marker-" + i + " " + (e.className || "")),
- s &&
- ((t.style.marginLeft = -s.x + "px"),
- (t.style.marginTop = -s.y + "px")),
- o && ((t.style.width = o.x + "px"), (t.style.height = o.y + "px"));
- },
- _createImg: function (t, i) {
- return ((i = i || document.createElement("img")).src = t), i;
- },
- _getIconUrl: function (t) {
- return (Ct && this.options[t + "RetinaUrl"]) || this.options[t + "Url"];
- },
- });
- var Be = ke.extend({
- options: {
- iconUrl: "marker-icon.png",
- iconRetinaUrl: "marker-icon-2x.png",
- shadowUrl: "marker-shadow.png",
- iconSize: [25, 41],
- iconAnchor: [12, 41],
- popupAnchor: [1, -34],
- tooltipAnchor: [16, -28],
- shadowSize: [41, 41],
- },
- _getIconUrl: function (t) {
- return (
- Be.imagePath || (Be.imagePath = this._detectIconPath()),
- (this.options.imagePath || Be.imagePath) +
- ke.prototype._getIconUrl.call(this, t)
- );
- },
- _detectIconPath: function () {
- var t = hi("div", "leaflet-default-icon-path", document.body),
- i = ai(t, "background-image") || ai(t, "backgroundImage");
- return (
- document.body.removeChild(t),
- (i =
- null === i || 0 !== i.indexOf("url")
- ? ""
- : i
- .replace(/^url\(["']?/, "")
- .replace(/marker-icon\.png["']?\)$/, ""))
- );
- },
- }),
- Ae = oe.extend({
- initialize: function (t) {
- this._marker = t;
- },
- addHooks: function () {
- var t = this._marker._icon;
- this._draggable || (this._draggable = new le(t, t, !0)),
- this._draggable
- .on(
- {
- dragstart: this._onDragStart,
- predrag: this._onPreDrag,
- drag: this._onDrag,
- dragend: this._onDragEnd,
- },
- this,
- )
- .enable(),
- pi(t, "leaflet-marker-draggable");
- },
- removeHooks: function () {
- this._draggable
- .off(
- {
- dragstart: this._onDragStart,
- predrag: this._onPreDrag,
- drag: this._onDrag,
- dragend: this._onDragEnd,
- },
- this,
- )
- .disable(),
- this._marker._icon &&
- mi(this._marker._icon, "leaflet-marker-draggable");
- },
- moved: function () {
- return this._draggable && this._draggable._moved;
- },
- _adjustPan: function (t) {
- var i = this._marker,
- e = i._map,
- n = this._marker.options.autoPanSpeed,
- o = this._marker.options.autoPanPadding,
- s = Pi(i._icon),
- r = e.getPixelBounds(),
- a = e.getPixelOrigin(),
- h = R(r.min._subtract(a).add(o), r.max._subtract(a).subtract(o));
- if (!h.contains(s)) {
- var u = I(
- (Math.max(h.max.x, s.x) - h.max.x) / (r.max.x - h.max.x) -
- (Math.min(h.min.x, s.x) - h.min.x) / (r.min.x - h.min.x),
- (Math.max(h.max.y, s.y) - h.max.y) / (r.max.y - h.max.y) -
- (Math.min(h.min.y, s.y) - h.min.y) / (r.min.y - h.min.y),
- ).multiplyBy(n);
- e.panBy(u, { animate: !1 }),
- this._draggable._newPos._add(u),
- this._draggable._startPos._add(u),
- wi(i._icon, this._draggable._newPos),
- this._onDrag(t),
- (this._panRequest = M(this._adjustPan.bind(this, t)));
- }
- },
- _onDragStart: function () {
- (this._oldLatLng = this._marker.getLatLng()),
- this._marker.closePopup().fire("movestart").fire("dragstart");
- },
- _onPreDrag: function (t) {
- this._marker.options.autoPan &&
- (C(this._panRequest),
- (this._panRequest = M(this._adjustPan.bind(this, t))));
- },
- _onDrag: function (t) {
- var i = this._marker,
- e = i._shadow,
- n = Pi(i._icon),
- o = i._map.layerPointToLatLng(n);
- e && wi(e, n),
- (i._latlng = o),
- (t.latlng = o),
- (t.oldLatLng = this._oldLatLng),
- i.fire("move", t).fire("drag", t);
- },
- _onDragEnd: function (t) {
- C(this._panRequest),
- delete this._oldLatLng,
- this._marker.fire("moveend").fire("dragend", t);
- },
- }),
- Ie = Se.extend({
- options: {
- icon: new Be(),
- interactive: !0,
- keyboard: !0,
- title: "",
- alt: "",
- zIndexOffset: 0,
- opacity: 1,
- riseOnHover: !1,
- riseOffset: 250,
- pane: "markerPane",
- shadowPane: "shadowPane",
- bubblingMouseEvents: !1,
- draggable: !1,
- autoPan: !1,
- autoPanPadding: [50, 50],
- autoPanSpeed: 10,
- },
- initialize: function (t, i) {
- p(this, i), (this._latlng = W(t));
- },
- onAdd: function (t) {
- (this._zoomAnimated =
- this._zoomAnimated && t.options.markerZoomAnimation),
- this._zoomAnimated && t.on("zoomanim", this._animateZoom, this),
- this._initIcon(),
- this.update();
- },
- onRemove: function (t) {
- this.dragging &&
- this.dragging.enabled() &&
- ((this.options.draggable = !0), this.dragging.removeHooks()),
- delete this.dragging,
- this._zoomAnimated && t.off("zoomanim", this._animateZoom, this),
- this._removeIcon(),
- this._removeShadow();
- },
- getEvents: function () {
- return { zoom: this.update, viewreset: this.update };
- },
- getLatLng: function () {
- return this._latlng;
- },
- setLatLng: function (t) {
- var i = this._latlng;
- return (
- (this._latlng = W(t)),
- this.update(),
- this.fire("move", { oldLatLng: i, latlng: this._latlng })
- );
- },
- setZIndexOffset: function (t) {
- return (this.options.zIndexOffset = t), this.update();
- },
- getIcon: function () {
- return this.options.icon;
- },
- setIcon: function (t) {
- return (
- (this.options.icon = t),
- this._map && (this._initIcon(), this.update()),
- this._popup && this.bindPopup(this._popup, this._popup.options),
- this
- );
- },
- getElement: function () {
- return this._icon;
- },
- update: function () {
- if (this._icon && this._map) {
- var t = this._map.latLngToLayerPoint(this._latlng).round();
- this._setPos(t);
- }
- return this;
- },
- _initIcon: function () {
- var t = this.options,
- i = "leaflet-zoom-" + (this._zoomAnimated ? "animated" : "hide"),
- e = t.icon.createIcon(this._icon),
- n = !1;
- e !== this._icon &&
- (this._icon && this._removeIcon(),
- (n = !0),
- t.title && (e.title = t.title),
- "IMG" === e.tagName && (e.alt = t.alt || "")),
- pi(e, i),
- t.keyboard && (e.tabIndex = "0"),
- (this._icon = e),
- t.riseOnHover &&
- this.on({
- mouseover: this._bringToFront,
- mouseout: this._resetZIndex,
- });
- var o = t.icon.createShadow(this._shadow),
- s = !1;
- o !== this._shadow && (this._removeShadow(), (s = !0)),
- o && (pi(o, i), (o.alt = "")),
- (this._shadow = o),
- t.opacity < 1 && this._updateOpacity(),
- n && this.getPane().appendChild(this._icon),
- this._initInteraction(),
- o && s && this.getPane(t.shadowPane).appendChild(this._shadow);
- },
- _removeIcon: function () {
- this.options.riseOnHover &&
- this.off({
- mouseover: this._bringToFront,
- mouseout: this._resetZIndex,
- }),
- ui(this._icon),
- this.removeInteractiveTarget(this._icon),
- (this._icon = null);
- },
- _removeShadow: function () {
- this._shadow && ui(this._shadow), (this._shadow = null);
- },
- _setPos: function (t) {
- wi(this._icon, t),
- this._shadow && wi(this._shadow, t),
- (this._zIndex = t.y + this.options.zIndexOffset),
- this._resetZIndex();
- },
- _updateZIndex: function (t) {
- this._icon.style.zIndex = this._zIndex + t;
- },
- _animateZoom: function (t) {
- var i = this._map
- ._latLngToNewLayerPoint(this._latlng, t.zoom, t.center)
- .round();
- this._setPos(i);
- },
- _initInteraction: function () {
- if (
- this.options.interactive &&
- (pi(this._icon, "leaflet-interactive"),
- this.addInteractiveTarget(this._icon),
- Ae)
- ) {
- var t = this.options.draggable;
- this.dragging &&
- ((t = this.dragging.enabled()), this.dragging.disable()),
- (this.dragging = new Ae(this)),
- t && this.dragging.enable();
- }
- },
- setOpacity: function (t) {
- return (
- (this.options.opacity = t), this._map && this._updateOpacity(), this
- );
- },
- _updateOpacity: function () {
- var t = this.options.opacity;
- this._icon && vi(this._icon, t), this._shadow && vi(this._shadow, t);
- },
- _bringToFront: function () {
- this._updateZIndex(this.options.riseOffset);
- },
- _resetZIndex: function () {
- this._updateZIndex(0);
- },
- _getPopupAnchor: function () {
- return this.options.icon.options.popupAnchor;
- },
- _getTooltipAnchor: function () {
- return this.options.icon.options.tooltipAnchor;
- },
- });
- var Oe = Se.extend({
- options: {
- stroke: !0,
- color: "#3388ff",
- weight: 3,
- opacity: 1,
- lineCap: "round",
- lineJoin: "round",
- dashArray: null,
- dashOffset: null,
- fill: !1,
- fillColor: null,
- fillOpacity: 0.2,
- fillRule: "evenodd",
- interactive: !0,
- bubblingMouseEvents: !0,
- },
- beforeAdd: function (t) {
- this._renderer = t.getRenderer(this);
- },
- onAdd: function () {
- this._renderer._initPath(this),
- this._reset(),
- this._renderer._addPath(this);
- },
- onRemove: function () {
- this._renderer._removePath(this);
- },
- redraw: function () {
- return this._map && this._renderer._updatePath(this), this;
- },
- setStyle: function (t) {
- return (
- p(this, t),
- this._renderer &&
- (this._renderer._updateStyle(this),
- this.options.stroke &&
- t.hasOwnProperty("weight") &&
- this._updateBounds()),
- this
- );
- },
- bringToFront: function () {
- return this._renderer && this._renderer._bringToFront(this), this;
- },
- bringToBack: function () {
- return this._renderer && this._renderer._bringToBack(this), this;
- },
- getElement: function () {
- return this._path;
- },
- _reset: function () {
- this._project(), this._update();
- },
- _clickTolerance: function () {
- return (
- (this.options.stroke ? this.options.weight / 2 : 0) +
- this._renderer.options.tolerance
- );
- },
- }),
- Re = Oe.extend({
- options: { fill: !0, radius: 10 },
- initialize: function (t, i) {
- p(this, i), (this._latlng = W(t)), (this._radius = this.options.radius);
- },
- setLatLng: function (t) {
- return (
- (this._latlng = W(t)),
- this.redraw(),
- this.fire("move", { latlng: this._latlng })
- );
- },
- getLatLng: function () {
- return this._latlng;
- },
- setRadius: function (t) {
- return (this.options.radius = this._radius = t), this.redraw();
- },
- getRadius: function () {
- return this._radius;
- },
- setStyle: function (t) {
- var i = (t && t.radius) || this._radius;
- return Oe.prototype.setStyle.call(this, t), this.setRadius(i), this;
- },
- _project: function () {
- (this._point = this._map.latLngToLayerPoint(this._latlng)),
- this._updateBounds();
- },
- _updateBounds: function () {
- var t = this._radius,
- i = this._radiusY || t,
- e = this._clickTolerance(),
- n = [t + e, i + e];
- this._pxBounds = new O(this._point.subtract(n), this._point.add(n));
- },
- _update: function () {
- this._map && this._updatePath();
- },
- _updatePath: function () {
- this._renderer._updateCircle(this);
- },
- _empty: function () {
- return (
- this._radius && !this._renderer._bounds.intersects(this._pxBounds)
- );
- },
- _containsPoint: function (t) {
- return (
- t.distanceTo(this._point) <= this._radius + this._clickTolerance()
- );
- },
- });
- var Ne = Re.extend({
- initialize: function (t, i, e) {
- if (
- ("number" == typeof i && (i = h({}, e, { radius: i })),
- p(this, i),
- (this._latlng = W(t)),
- isNaN(this.options.radius))
- )
- throw new Error("Circle radius cannot be NaN");
- this._mRadius = this.options.radius;
- },
- setRadius: function (t) {
- return (this._mRadius = t), this.redraw();
- },
- getRadius: function () {
- return this._mRadius;
- },
- getBounds: function () {
- var t = [this._radius, this._radiusY || this._radius];
- return new N(
- this._map.layerPointToLatLng(this._point.subtract(t)),
- this._map.layerPointToLatLng(this._point.add(t)),
- );
- },
- setStyle: Oe.prototype.setStyle,
- _project: function () {
- var t = this._latlng.lng,
- i = this._latlng.lat,
- e = this._map,
- n = e.options.crs;
- if (n.distance === U.distance) {
- var o = Math.PI / 180,
- s = this._mRadius / U.R / o,
- r = e.project([i + s, t]),
- a = e.project([i - s, t]),
- h = r.add(a).divideBy(2),
- u = e.unproject(h).lat,
- l =
- Math.acos(
- (Math.cos(s * o) - Math.sin(i * o) * Math.sin(u * o)) /
- (Math.cos(i * o) * Math.cos(u * o)),
- ) / o;
- (!isNaN(l) && 0 !== l) || (l = s / Math.cos((Math.PI / 180) * i)),
- (this._point = h.subtract(e.getPixelOrigin())),
- (this._radius = isNaN(l) ? 0 : h.x - e.project([u, t - l]).x),
- (this._radiusY = h.y - r.y);
- } else {
- var c = n.unproject(
- n.project(this._latlng).subtract([this._mRadius, 0]),
- );
- (this._point = e.latLngToLayerPoint(this._latlng)),
- (this._radius = this._point.x - e.latLngToLayerPoint(c).x);
- }
- this._updateBounds();
- },
- });
- var De = Oe.extend({
- options: { smoothFactor: 1, noClip: !1 },
- initialize: function (t, i) {
- p(this, i), this._setLatLngs(t);
- },
- getLatLngs: function () {
- return this._latlngs;
- },
- setLatLngs: function (t) {
- return this._setLatLngs(t), this.redraw();
- },
- isEmpty: function () {
- return !this._latlngs.length;
- },
- closestLayerPoint: function (t) {
- for (
- var i, e, n = 1 / 0, o = null, s = fe, r = 0, a = this._parts.length;
- r < a;
- r++
- )
- for (var h = this._parts[r], u = 1, l = h.length; u < l; u++) {
- var c = s(t, (i = h[u - 1]), (e = h[u]), !0);
- c < n && ((n = c), (o = s(t, i, e)));
- }
- return o && (o.distance = Math.sqrt(n)), o;
- },
- getCenter: function () {
- if (!this._map)
- throw new Error("Must add layer to map before using getCenter()");
- var t,
- i,
- e,
- n,
- o,
- s,
- r,
- a = this._rings[0],
- h = a.length;
- if (!h) return null;
- for (i = t = 0; t < h - 1; t++) i += a[t].distanceTo(a[t + 1]) / 2;
- if (0 === i) return this._map.layerPointToLatLng(a[0]);
- for (n = t = 0; t < h - 1; t++)
- if (((o = a[t]), (s = a[t + 1]), i < (n += e = o.distanceTo(s))))
- return (
- (r = (n - i) / e),
- this._map.layerPointToLatLng([
- s.x - r * (s.x - o.x),
- s.y - r * (s.y - o.y),
- ])
- );
- },
- getBounds: function () {
- return this._bounds;
- },
- addLatLng: function (t, i) {
- return (
- (i = i || this._defaultShape()),
- (t = W(t)),
- i.push(t),
- this._bounds.extend(t),
- this.redraw()
- );
- },
- _setLatLngs: function (t) {
- (this._bounds = new N()), (this._latlngs = this._convertLatLngs(t));
- },
- _defaultShape: function () {
- return ge(this._latlngs) ? this._latlngs : this._latlngs[0];
- },
- _convertLatLngs: function (t) {
- for (var i = [], e = ge(t), n = 0, o = t.length; n < o; n++)
- e
- ? ((i[n] = W(t[n])), this._bounds.extend(i[n]))
- : (i[n] = this._convertLatLngs(t[n]));
- return i;
- },
- _project: function () {
- var t = new O();
- (this._rings = []),
- this._projectLatlngs(this._latlngs, this._rings, t),
- this._bounds.isValid() &&
- t.isValid() &&
- ((this._rawPxBounds = t), this._updateBounds());
- },
- _updateBounds: function () {
- var t = this._clickTolerance(),
- i = new B(t, t);
- this._pxBounds = new O([
- this._rawPxBounds.min.subtract(i),
- this._rawPxBounds.max.add(i),
- ]);
- },
- _projectLatlngs: function (t, i, e) {
- var n,
- o,
- s = t[0] instanceof j,
- r = t.length;
- if (s) {
- for (o = [], n = 0; n < r; n++)
- (o[n] = this._map.latLngToLayerPoint(t[n])), e.extend(o[n]);
- i.push(o);
- } else for (n = 0; n < r; n++) this._projectLatlngs(t[n], i, e);
- },
- _clipPoints: function () {
- var t = this._renderer._bounds;
- if (((this._parts = []), this._pxBounds && this._pxBounds.intersects(t)))
- if (this.options.noClip) this._parts = this._rings;
- else {
- var i,
- e,
- n,
- o,
- s,
- r,
- a,
- h = this._parts;
- for (n = i = 0, o = this._rings.length; i < o; i++)
- for (e = 0, s = (a = this._rings[i]).length; e < s - 1; e++)
- (r = de(a[e], a[e + 1], t, e, !0)) &&
- ((h[n] = h[n] || []),
- h[n].push(r[0]),
- (r[1] === a[e + 1] && e !== s - 2) || (h[n].push(r[1]), n++));
- }
- },
- _simplifyPoints: function () {
- for (
- var t = this._parts, i = this.options.smoothFactor, e = 0, n = t.length;
- e < n;
- e++
- )
- t[e] = ce(t[e], i);
- },
- _update: function () {
- this._map &&
- (this._clipPoints(), this._simplifyPoints(), this._updatePath());
- },
- _updatePath: function () {
- this._renderer._updatePoly(this);
- },
- _containsPoint: function (t, i) {
- var e,
- n,
- o,
- s,
- r,
- a,
- h = this._clickTolerance();
- if (!this._pxBounds || !this._pxBounds.contains(t)) return !1;
- for (e = 0, s = this._parts.length; e < s; e++)
- for (n = 0, o = (r = (a = this._parts[e]).length) - 1; n < r; o = n++)
- if ((i || 0 !== n) && _e(t, a[o], a[n]) <= h) return !0;
- return !1;
- },
- });
- De._flat = ve;
- var je = De.extend({
- options: { fill: !0 },
- isEmpty: function () {
- return !this._latlngs.length || !this._latlngs[0].length;
- },
- getCenter: function () {
- if (!this._map)
- throw new Error("Must add layer to map before using getCenter()");
- var t,
- i,
- e,
- n,
- o,
- s,
- r,
- a,
- h,
- u = this._rings[0],
- l = u.length;
- if (!l) return null;
- for (s = r = a = 0, t = 0, i = l - 1; t < l; i = t++)
- (e = u[t]),
- (n = u[i]),
- (o = e.y * n.x - n.y * e.x),
- (r += (e.x + n.x) * o),
- (a += (e.y + n.y) * o),
- (s += 3 * o);
- return (
- (h = 0 === s ? u[0] : [r / s, a / s]), this._map.layerPointToLatLng(h)
- );
- },
- _convertLatLngs: function (t) {
- var i = De.prototype._convertLatLngs.call(this, t),
- e = i.length;
- return 2 <= e && i[0] instanceof j && i[0].equals(i[e - 1]) && i.pop(), i;
- },
- _setLatLngs: function (t) {
- De.prototype._setLatLngs.call(this, t),
- ge(this._latlngs) && (this._latlngs = [this._latlngs]);
- },
- _defaultShape: function () {
- return ge(this._latlngs[0]) ? this._latlngs[0] : this._latlngs[0][0];
- },
- _clipPoints: function () {
- var t = this._renderer._bounds,
- i = this.options.weight,
- e = new B(i, i);
- if (
- ((t = new O(t.min.subtract(e), t.max.add(e))),
- (this._parts = []),
- this._pxBounds && this._pxBounds.intersects(t))
- )
- if (this.options.noClip) this._parts = this._rings;
- else
- for (var n, o = 0, s = this._rings.length; o < s; o++)
- (n = xe(this._rings[o], t, !0)).length && this._parts.push(n);
- },
- _updatePath: function () {
- this._renderer._updatePoly(this, !0);
- },
- _containsPoint: function (t) {
- var i,
- e,
- n,
- o,
- s,
- r,
- a,
- h,
- u = !1;
- if (!this._pxBounds || !this._pxBounds.contains(t)) return !1;
- for (o = 0, a = this._parts.length; o < a; o++)
- for (s = 0, r = (h = (i = this._parts[o]).length) - 1; s < h; r = s++)
- (e = i[s]),
- (n = i[r]),
- e.y > t.y != n.y > t.y &&
- t.x < ((n.x - e.x) * (t.y - e.y)) / (n.y - e.y) + e.x &&
- (u = !u);
- return u || De.prototype._containsPoint.call(this, t, !0);
- },
- });
- var We = Ee.extend({
- initialize: function (t, i) {
- p(this, i), (this._layers = {}), t && this.addData(t);
- },
- addData: function (t) {
- var i,
- e,
- n,
- o = v(t) ? t : t.features;
- if (o) {
- for (i = 0, e = o.length; i < e; i++)
- ((n = o[i]).geometries ||
- n.geometry ||
- n.features ||
- n.coordinates) &&
- this.addData(n);
- return this;
- }
- var s = this.options;
- if (s.filter && !s.filter(t)) return this;
- var r = He(t, s);
- return r
- ? ((r.feature = Ke(t)),
- (r.defaultOptions = r.options),
- this.resetStyle(r),
- s.onEachFeature && s.onEachFeature(t, r),
- this.addLayer(r))
- : this;
- },
- resetStyle: function (t) {
- return (
- (t.options = h({}, t.defaultOptions)),
- this._setLayerStyle(t, this.options.style),
- this
- );
- },
- setStyle: function (i) {
- return this.eachLayer(function (t) {
- this._setLayerStyle(t, i);
- }, this);
- },
- _setLayerStyle: function (t, i) {
- t.setStyle &&
- ("function" == typeof i && (i = i(t.feature)), t.setStyle(i));
- },
- });
- function He(t, i) {
- var e,
- n,
- o,
- s,
- r = "Feature" === t.type ? t.geometry : t,
- a = r ? r.coordinates : null,
- h = [],
- u = i && i.pointToLayer,
- l = (i && i.coordsToLatLng) || Fe;
- if (!a && !r) return null;
- switch (r.type) {
- case "Point":
- return (e = l(a)), u ? u(t, e) : new Ie(e);
- case "MultiPoint":
- for (o = 0, s = a.length; o < s; o++)
- (e = l(a[o])), h.push(u ? u(t, e) : new Ie(e));
- return new Ee(h);
- case "LineString":
- case "MultiLineString":
- return (n = Ue(a, "LineString" === r.type ? 0 : 1, l)), new De(n, i);
- case "Polygon":
- case "MultiPolygon":
- return (n = Ue(a, "Polygon" === r.type ? 1 : 2, l)), new je(n, i);
- case "GeometryCollection":
- for (o = 0, s = r.geometries.length; o < s; o++) {
- var c = He(
- {
- geometry: r.geometries[o],
- type: "Feature",
- properties: t.properties,
- },
- i,
- );
- c && h.push(c);
- }
- return new Ee(h);
- default:
- throw new Error("Invalid GeoJSON object.");
- }
- }
- function Fe(t) {
- return new j(t[1], t[0], t[2]);
- }
- function Ue(t, i, e) {
- for (var n, o = [], s = 0, r = t.length; s < r; s++)
- (n = i ? Ue(t[s], i - 1, e) : (e || Fe)(t[s])), o.push(n);
- return o;
- }
- function Ve(t, i) {
- return (
- (i = "number" == typeof i ? i : 6),
- void 0 !== t.alt
- ? [c(t.lng, i), c(t.lat, i), c(t.alt, i)]
- : [c(t.lng, i), c(t.lat, i)]
- );
- }
- function qe(t, i, e, n) {
- for (var o = [], s = 0, r = t.length; s < r; s++)
- o.push(i ? qe(t[s], i - 1, e, n) : Ve(t[s], n));
- return !i && e && o.push(o[0]), o;
- }
- function Ge(t, i) {
- return t.feature ? h({}, t.feature, { geometry: i }) : Ke(i);
- }
- function Ke(t) {
- return "Feature" === t.type || "FeatureCollection" === t.type
- ? t
- : { type: "Feature", properties: {}, geometry: t };
- }
- var Ye = {
- toGeoJSON: function (t) {
- return Ge(this, { type: "Point", coordinates: Ve(this.getLatLng(), t) });
- },
- };
- function Xe(t, i) {
- return new We(t, i);
- }
- Ie.include(Ye),
- Ne.include(Ye),
- Re.include(Ye),
- De.include({
- toGeoJSON: function (t) {
- var i = !ge(this._latlngs);
- return Ge(this, {
- type: (i ? "Multi" : "") + "LineString",
- coordinates: qe(this._latlngs, i ? 1 : 0, !1, t),
- });
- },
- }),
- je.include({
- toGeoJSON: function (t) {
- var i = !ge(this._latlngs),
- e = i && !ge(this._latlngs[0]),
- n = qe(this._latlngs, e ? 2 : i ? 1 : 0, !0, t);
- return (
- i || (n = [n]),
- Ge(this, { type: (e ? "Multi" : "") + "Polygon", coordinates: n })
- );
- },
- }),
- Ze.include({
- toMultiPoint: function (i) {
- var e = [];
- return (
- this.eachLayer(function (t) {
- e.push(t.toGeoJSON(i).geometry.coordinates);
- }),
- Ge(this, { type: "MultiPoint", coordinates: e })
- );
- },
- toGeoJSON: function (n) {
- var t =
- this.feature && this.feature.geometry && this.feature.geometry.type;
- if ("MultiPoint" === t) return this.toMultiPoint(n);
- var o = "GeometryCollection" === t,
- s = [];
- return (
- this.eachLayer(function (t) {
- if (t.toGeoJSON) {
- var i = t.toGeoJSON(n);
- if (o) s.push(i.geometry);
- else {
- var e = Ke(i);
- "FeatureCollection" === e.type
- ? s.push.apply(s, e.features)
- : s.push(e);
- }
- }
- }),
- o
- ? Ge(this, { geometries: s, type: "GeometryCollection" })
- : { type: "FeatureCollection", features: s }
- );
- },
- });
- var Je = Xe,
- $e = Se.extend({
- options: {
- opacity: 1,
- alt: "",
- interactive: !1,
- crossOrigin: !1,
- errorOverlayUrl: "",
- zIndex: 1,
- className: "",
- },
- initialize: function (t, i, e) {
- (this._url = t), (this._bounds = D(i)), p(this, e);
- },
- onAdd: function () {
- this._image ||
- (this._initImage(),
- this.options.opacity < 1 && this._updateOpacity()),
- this.options.interactive &&
- (pi(this._image, "leaflet-interactive"),
- this.addInteractiveTarget(this._image)),
- this.getPane().appendChild(this._image),
- this._reset();
- },
- onRemove: function () {
- ui(this._image),
- this.options.interactive && this.removeInteractiveTarget(this._image);
- },
- setOpacity: function (t) {
- return (
- (this.options.opacity = t), this._image && this._updateOpacity(), this
- );
- },
- setStyle: function (t) {
- return t.opacity && this.setOpacity(t.opacity), this;
- },
- bringToFront: function () {
- return this._map && ci(this._image), this;
- },
- bringToBack: function () {
- return this._map && _i(this._image), this;
- },
- setUrl: function (t) {
- return (this._url = t), this._image && (this._image.src = t), this;
- },
- setBounds: function (t) {
- return (this._bounds = D(t)), this._map && this._reset(), this;
- },
- getEvents: function () {
- var t = { zoom: this._reset, viewreset: this._reset };
- return this._zoomAnimated && (t.zoomanim = this._animateZoom), t;
- },
- setZIndex: function (t) {
- return (this.options.zIndex = t), this._updateZIndex(), this;
- },
- getBounds: function () {
- return this._bounds;
- },
- getElement: function () {
- return this._image;
- },
- _initImage: function () {
- var t = "IMG" === this._url.tagName,
- i = (this._image = t ? this._url : hi("img"));
- pi(i, "leaflet-image-layer"),
- this._zoomAnimated && pi(i, "leaflet-zoom-animated"),
- this.options.className && pi(i, this.options.className),
- (i.onselectstart = l),
- (i.onmousemove = l),
- (i.onload = a(this.fire, this, "load")),
- (i.onerror = a(this._overlayOnError, this, "error")),
- (!this.options.crossOrigin && "" !== this.options.crossOrigin) ||
- (i.crossOrigin =
- !0 === this.options.crossOrigin ? "" : this.options.crossOrigin),
- this.options.zIndex && this._updateZIndex(),
- t
- ? (this._url = i.src)
- : ((i.src = this._url), (i.alt = this.options.alt));
- },
- _animateZoom: function (t) {
- var i = this._map.getZoomScale(t.zoom),
- e = this._map._latLngBoundsToNewLayerBounds(
- this._bounds,
- t.zoom,
- t.center,
- ).min;
- xi(this._image, e, i);
- },
- _reset: function () {
- var t = this._image,
- i = new O(
- this._map.latLngToLayerPoint(this._bounds.getNorthWest()),
- this._map.latLngToLayerPoint(this._bounds.getSouthEast()),
- ),
- e = i.getSize();
- wi(t, i.min),
- (t.style.width = e.x + "px"),
- (t.style.height = e.y + "px");
- },
- _updateOpacity: function () {
- vi(this._image, this.options.opacity);
- },
- _updateZIndex: function () {
- this._image &&
- void 0 !== this.options.zIndex &&
- null !== this.options.zIndex &&
- (this._image.style.zIndex = this.options.zIndex);
- },
- _overlayOnError: function () {
- this.fire("error");
- var t = this.options.errorOverlayUrl;
- t && this._url !== t && ((this._url = t), (this._image.src = t));
- },
- }),
- Qe = $e.extend({
- options: { autoplay: !0, loop: !0, keepAspectRatio: !0 },
- _initImage: function () {
- var t = "VIDEO" === this._url.tagName,
- i = (this._image = t ? this._url : hi("video"));
- if (
- (pi(i, "leaflet-image-layer"),
- this._zoomAnimated && pi(i, "leaflet-zoom-animated"),
- (i.onselectstart = l),
- (i.onmousemove = l),
- (i.onloadeddata = a(this.fire, this, "load")),
- t)
- ) {
- for (
- var e = i.getElementsByTagName("source"), n = [], o = 0;
- o < e.length;
- o++
- )
- n.push(e[o].src);
- this._url = 0 < e.length ? n : [i.src];
- } else {
- v(this._url) || (this._url = [this._url]),
- !this.options.keepAspectRatio &&
- i.style.hasOwnProperty("objectFit") &&
- (i.style.objectFit = "fill"),
- (i.autoplay = !!this.options.autoplay),
- (i.loop = !!this.options.loop);
- for (var s = 0; s < this._url.length; s++) {
- var r = hi("source");
- (r.src = this._url[s]), i.appendChild(r);
- }
- }
- },
- });
- var tn = $e.extend({
- _initImage: function () {
- var t = (this._image = this._url);
- pi(t, "leaflet-image-layer"),
- this._zoomAnimated && pi(t, "leaflet-zoom-animated"),
- (t.onselectstart = l),
- (t.onmousemove = l);
- },
- });
- var en = Se.extend({
- options: { offset: [0, 7], className: "", pane: "popupPane" },
- initialize: function (t, i) {
- p(this, t), (this._source = i);
- },
- onAdd: function (t) {
- (this._zoomAnimated = t._zoomAnimated),
- this._container || this._initLayout(),
- t._fadeAnimated && vi(this._container, 0),
- clearTimeout(this._removeTimeout),
- this.getPane().appendChild(this._container),
- this.update(),
- t._fadeAnimated && vi(this._container, 1),
- this.bringToFront();
- },
- onRemove: function (t) {
- t._fadeAnimated
- ? (vi(this._container, 0),
- (this._removeTimeout = setTimeout(
- a(ui, void 0, this._container),
- 200,
- )))
- : ui(this._container);
- },
- getLatLng: function () {
- return this._latlng;
- },
- setLatLng: function (t) {
- return (
- (this._latlng = W(t)),
- this._map && (this._updatePosition(), this._adjustPan()),
- this
- );
- },
- getContent: function () {
- return this._content;
- },
- setContent: function (t) {
- return (this._content = t), this.update(), this;
- },
- getElement: function () {
- return this._container;
- },
- update: function () {
- this._map &&
- ((this._container.style.visibility = "hidden"),
- this._updateContent(),
- this._updateLayout(),
- this._updatePosition(),
- (this._container.style.visibility = ""),
- this._adjustPan());
- },
- getEvents: function () {
- var t = { zoom: this._updatePosition, viewreset: this._updatePosition };
- return this._zoomAnimated && (t.zoomanim = this._animateZoom), t;
- },
- isOpen: function () {
- return !!this._map && this._map.hasLayer(this);
- },
- bringToFront: function () {
- return this._map && ci(this._container), this;
- },
- bringToBack: function () {
- return this._map && _i(this._container), this;
- },
- _prepareOpen: function (t, i, e) {
- if ((i instanceof Se || ((e = i), (i = t)), i instanceof Ee))
- for (var n in t._layers) {
- i = t._layers[n];
- break;
- }
- if (!e)
- if (i.getCenter) e = i.getCenter();
- else {
- if (!i.getLatLng)
- throw new Error("Unable to get source layer LatLng.");
- e = i.getLatLng();
- }
- return (this._source = i), this.update(), e;
- },
- _updateContent: function () {
- if (this._content) {
- var t = this._contentNode,
- i =
- "function" == typeof this._content
- ? this._content(this._source || this)
- : this._content;
- if ("string" == typeof i) t.innerHTML = i;
- else {
- for (; t.hasChildNodes(); ) t.removeChild(t.firstChild);
- t.appendChild(i);
- }
- this.fire("contentupdate");
- }
- },
- _updatePosition: function () {
- if (this._map) {
- var t = this._map.latLngToLayerPoint(this._latlng),
- i = I(this.options.offset),
- e = this._getAnchor();
- this._zoomAnimated
- ? wi(this._container, t.add(e))
- : (i = i.add(t).add(e));
- var n = (this._containerBottom = -i.y),
- o = (this._containerLeft =
- -Math.round(this._containerWidth / 2) + i.x);
- (this._container.style.bottom = n + "px"),
- (this._container.style.left = o + "px");
- }
- },
- _getAnchor: function () {
- return [0, 0];
- },
- }),
- nn = en.extend({
- options: {
- maxWidth: 300,
- minWidth: 50,
- maxHeight: null,
- autoPan: !0,
- autoPanPaddingTopLeft: null,
- autoPanPaddingBottomRight: null,
- autoPanPadding: [5, 5],
- keepInView: !1,
- closeButton: !0,
- autoClose: !0,
- closeOnEscapeKey: !0,
- className: "",
- },
- openOn: function (t) {
- return t.openPopup(this), this;
- },
- onAdd: function (t) {
- en.prototype.onAdd.call(this, t),
- t.fire("popupopen", { popup: this }),
- this._source &&
- (this._source.fire("popupopen", { popup: this }, !0),
- this._source instanceof Oe || this._source.on("preclick", Oi));
- },
- onRemove: function (t) {
- en.prototype.onRemove.call(this, t),
- t.fire("popupclose", { popup: this }),
- this._source &&
- (this._source.fire("popupclose", { popup: this }, !0),
- this._source instanceof Oe || this._source.off("preclick", Oi));
- },
- getEvents: function () {
- var t = en.prototype.getEvents.call(this);
- return (
- (void 0 !== this.options.closeOnClick
- ? this.options.closeOnClick
- : this._map.options.closePopupOnClick) &&
- (t.preclick = this._close),
- this.options.keepInView && (t.moveend = this._adjustPan),
- t
- );
- },
- _close: function () {
- this._map && this._map.closePopup(this);
- },
- _initLayout: function () {
- var t = "leaflet-popup",
- i = (this._container = hi(
- "div",
- t + " " + (this.options.className || "") + " leaflet-zoom-animated",
- )),
- e = (this._wrapper = hi("div", t + "-content-wrapper", i));
- if (
- ((this._contentNode = hi("div", t + "-content", e)),
- Ni(e),
- Ri(this._contentNode),
- Ei(e, "contextmenu", Oi),
- (this._tipContainer = hi("div", t + "-tip-container", i)),
- (this._tip = hi("div", t + "-tip", this._tipContainer)),
- this.options.closeButton)
- ) {
- var n = (this._closeButton = hi("a", t + "-close-button", i));
- (n.href = "#close"),
- (n.innerHTML = "×"),
- Ei(n, "click", this._onCloseButtonClick, this);
- }
- },
- _updateLayout: function () {
- var t = this._contentNode,
- i = t.style;
- (i.width = ""), (i.whiteSpace = "nowrap");
- var e = t.offsetWidth;
- (e = Math.min(e, this.options.maxWidth)),
- (e = Math.max(e, this.options.minWidth)),
- (i.width = e + 1 + "px"),
- (i.whiteSpace = ""),
- (i.height = "");
- var n = t.offsetHeight,
- o = this.options.maxHeight,
- s = "leaflet-popup-scrolled";
- o && o < n ? ((i.height = o + "px"), pi(t, s)) : mi(t, s),
- (this._containerWidth = this._container.offsetWidth);
- },
- _animateZoom: function (t) {
- var i = this._map._latLngToNewLayerPoint(
- this._latlng,
- t.zoom,
- t.center,
- ),
- e = this._getAnchor();
- wi(this._container, i.add(e));
- },
- _adjustPan: function () {
- if (this.options.autoPan) {
- this._map._panAnim && this._map._panAnim.stop();
- var t = this._map,
- i = parseInt(ai(this._container, "marginBottom"), 10) || 0,
- e = this._container.offsetHeight + i,
- n = this._containerWidth,
- o = new B(this._containerLeft, -e - this._containerBottom);
- o._add(Pi(this._container));
- var s = t.layerPointToContainerPoint(o),
- r = I(this.options.autoPanPadding),
- a = I(this.options.autoPanPaddingTopLeft || r),
- h = I(this.options.autoPanPaddingBottomRight || r),
- u = t.getSize(),
- l = 0,
- c = 0;
- s.x + n + h.x > u.x && (l = s.x + n - u.x + h.x),
- s.x - l - a.x < 0 && (l = s.x - a.x),
- s.y + e + h.y > u.y && (c = s.y + e - u.y + h.y),
- s.y - c - a.y < 0 && (c = s.y - a.y),
- (l || c) && t.fire("autopanstart").panBy([l, c]);
- }
- },
- _onCloseButtonClick: function (t) {
- this._close(), ji(t);
- },
- _getAnchor: function () {
- return I(
- this._source && this._source._getPopupAnchor
- ? this._source._getPopupAnchor()
- : [0, 0],
- );
- },
- });
- Ji.mergeOptions({ closePopupOnClick: !0 }),
- Ji.include({
- openPopup: function (t, i, e) {
- return (
- t instanceof nn || (t = new nn(e).setContent(t)),
- i && t.setLatLng(i),
- this.hasLayer(t)
- ? this
- : (this._popup &&
- this._popup.options.autoClose &&
- this.closePopup(),
- (this._popup = t),
- this.addLayer(t))
- );
- },
- closePopup: function (t) {
- return (
- (t && t !== this._popup) || ((t = this._popup), (this._popup = null)),
- t && this.removeLayer(t),
- this
- );
- },
- }),
- Se.include({
- bindPopup: function (t, i) {
- return (
- t instanceof nn
- ? (p(t, i), ((this._popup = t)._source = this))
- : ((this._popup && !i) || (this._popup = new nn(i, this)),
- this._popup.setContent(t)),
- this._popupHandlersAdded ||
- (this.on({
- click: this._openPopup,
- keypress: this._onKeyPress,
- remove: this.closePopup,
- move: this._movePopup,
- }),
- (this._popupHandlersAdded = !0)),
- this
- );
- },
- unbindPopup: function () {
- return (
- this._popup &&
- (this.off({
- click: this._openPopup,
- keypress: this._onKeyPress,
- remove: this.closePopup,
- move: this._movePopup,
- }),
- (this._popupHandlersAdded = !1),
- (this._popup = null)),
- this
- );
- },
- openPopup: function (t, i) {
- return (
- this._popup &&
- this._map &&
- ((i = this._popup._prepareOpen(this, t, i)),
- this._map.openPopup(this._popup, i)),
- this
- );
- },
- closePopup: function () {
- return this._popup && this._popup._close(), this;
- },
- togglePopup: function (t) {
- return (
- this._popup &&
- (this._popup._map ? this.closePopup() : this.openPopup(t)),
- this
- );
- },
- isPopupOpen: function () {
- return !!this._popup && this._popup.isOpen();
- },
- setPopupContent: function (t) {
- return this._popup && this._popup.setContent(t), this;
- },
- getPopup: function () {
- return this._popup;
- },
- _openPopup: function (t) {
- var i = t.layer || t.target;
- this._popup &&
- this._map &&
- (ji(t),
- i instanceof Oe
- ? this.openPopup(t.layer || t.target, t.latlng)
- : this._map.hasLayer(this._popup) && this._popup._source === i
- ? this.closePopup()
- : this.openPopup(i, t.latlng));
- },
- _movePopup: function (t) {
- this._popup.setLatLng(t.latlng);
- },
- _onKeyPress: function (t) {
- 13 === t.originalEvent.keyCode && this._openPopup(t);
- },
- });
- var on = en.extend({
- options: {
- pane: "tooltipPane",
- offset: [0, 0],
- direction: "auto",
- permanent: !1,
- sticky: !1,
- interactive: !1,
- opacity: 0.9,
- },
- onAdd: function (t) {
- en.prototype.onAdd.call(this, t),
- this.setOpacity(this.options.opacity),
- t.fire("tooltipopen", { tooltip: this }),
- this._source && this._source.fire("tooltipopen", { tooltip: this }, !0);
- },
- onRemove: function (t) {
- en.prototype.onRemove.call(this, t),
- t.fire("tooltipclose", { tooltip: this }),
- this._source &&
- this._source.fire("tooltipclose", { tooltip: this }, !0);
- },
- getEvents: function () {
- var t = en.prototype.getEvents.call(this);
- return Tt && !this.options.permanent && (t.preclick = this._close), t;
- },
- _close: function () {
- this._map && this._map.closeTooltip(this);
- },
- _initLayout: function () {
- var t =
- "leaflet-tooltip " +
- (this.options.className || "") +
- " leaflet-zoom-" +
- (this._zoomAnimated ? "animated" : "hide");
- this._contentNode = this._container = hi("div", t);
- },
- _updateLayout: function () {},
- _adjustPan: function () {},
- _setPosition: function (t) {
- var i = this._map,
- e = this._container,
- n = i.latLngToContainerPoint(i.getCenter()),
- o = i.layerPointToContainerPoint(t),
- s = this.options.direction,
- r = e.offsetWidth,
- a = e.offsetHeight,
- h = I(this.options.offset),
- u = this._getAnchor();
- (t =
- "top" === s
- ? t.add(I(-r / 2 + h.x, -a + h.y + u.y, !0))
- : "bottom" === s
- ? t.subtract(I(r / 2 - h.x, -h.y, !0))
- : "center" === s
- ? t.subtract(I(r / 2 + h.x, a / 2 - u.y + h.y, !0))
- : "right" === s || ("auto" === s && o.x < n.x)
- ? ((s = "right"), t.add(I(h.x + u.x, u.y - a / 2 + h.y, !0)))
- : ((s = "left"),
- t.subtract(I(r + u.x - h.x, a / 2 - u.y - h.y, !0)))),
- mi(e, "leaflet-tooltip-right"),
- mi(e, "leaflet-tooltip-left"),
- mi(e, "leaflet-tooltip-top"),
- mi(e, "leaflet-tooltip-bottom"),
- pi(e, "leaflet-tooltip-" + s),
- wi(e, t);
- },
- _updatePosition: function () {
- var t = this._map.latLngToLayerPoint(this._latlng);
- this._setPosition(t);
- },
- setOpacity: function (t) {
- (this.options.opacity = t), this._container && vi(this._container, t);
- },
- _animateZoom: function (t) {
- var i = this._map._latLngToNewLayerPoint(this._latlng, t.zoom, t.center);
- this._setPosition(i);
- },
- _getAnchor: function () {
- return I(
- this._source && this._source._getTooltipAnchor && !this.options.sticky
- ? this._source._getTooltipAnchor()
- : [0, 0],
- );
- },
- });
- Ji.include({
- openTooltip: function (t, i, e) {
- return (
- t instanceof on || (t = new on(e).setContent(t)),
- i && t.setLatLng(i),
- this.hasLayer(t) ? this : this.addLayer(t)
- );
- },
- closeTooltip: function (t) {
- return t && this.removeLayer(t), this;
- },
- }),
- Se.include({
- bindTooltip: function (t, i) {
- return (
- t instanceof on
- ? (p(t, i), ((this._tooltip = t)._source = this))
- : ((this._tooltip && !i) || (this._tooltip = new on(i, this)),
- this._tooltip.setContent(t)),
- this._initTooltipInteractions(),
- this._tooltip.options.permanent &&
- this._map &&
- this._map.hasLayer(this) &&
- this.openTooltip(),
- this
- );
- },
- unbindTooltip: function () {
- return (
- this._tooltip &&
- (this._initTooltipInteractions(!0),
- this.closeTooltip(),
- (this._tooltip = null)),
- this
- );
- },
- _initTooltipInteractions: function (t) {
- if (t || !this._tooltipHandlersAdded) {
- var i = t ? "off" : "on",
- e = { remove: this.closeTooltip, move: this._moveTooltip };
- this._tooltip.options.permanent
- ? (e.add = this._openTooltip)
- : ((e.mouseover = this._openTooltip),
- (e.mouseout = this.closeTooltip),
- this._tooltip.options.sticky && (e.mousemove = this._moveTooltip),
- Tt && (e.click = this._openTooltip)),
- this[i](e),
- (this._tooltipHandlersAdded = !t);
- }
- },
- openTooltip: function (t, i) {
- return (
- this._tooltip &&
- this._map &&
- ((i = this._tooltip._prepareOpen(this, t, i)),
- this._map.openTooltip(this._tooltip, i),
- this._tooltip.options.interactive &&
- this._tooltip._container &&
- (pi(this._tooltip._container, "leaflet-clickable"),
- this.addInteractiveTarget(this._tooltip._container))),
- this
- );
- },
- closeTooltip: function () {
- return (
- this._tooltip &&
- (this._tooltip._close(),
- this._tooltip.options.interactive &&
- this._tooltip._container &&
- (mi(this._tooltip._container, "leaflet-clickable"),
- this.removeInteractiveTarget(this._tooltip._container))),
- this
- );
- },
- toggleTooltip: function (t) {
- return (
- this._tooltip &&
- (this._tooltip._map ? this.closeTooltip() : this.openTooltip(t)),
- this
- );
- },
- isTooltipOpen: function () {
- return this._tooltip.isOpen();
- },
- setTooltipContent: function (t) {
- return this._tooltip && this._tooltip.setContent(t), this;
- },
- getTooltip: function () {
- return this._tooltip;
- },
- _openTooltip: function (t) {
- var i = t.layer || t.target;
- this._tooltip &&
- this._map &&
- this.openTooltip(i, this._tooltip.options.sticky ? t.latlng : void 0);
- },
- _moveTooltip: function (t) {
- var i,
- e,
- n = t.latlng;
- this._tooltip.options.sticky &&
- t.originalEvent &&
- ((i = this._map.mouseEventToContainerPoint(t.originalEvent)),
- (e = this._map.containerPointToLayerPoint(i)),
- (n = this._map.layerPointToLatLng(e))),
- this._tooltip.setLatLng(n);
- },
- });
- var sn = ke.extend({
- options: {
- iconSize: [12, 12],
- html: !1,
- bgPos: null,
- className: "leaflet-div-icon",
- },
- createIcon: function (t) {
- var i = t && "DIV" === t.tagName ? t : document.createElement("div"),
- e = this.options;
- if (
- (e.html instanceof Element
- ? (li(i), i.appendChild(e.html))
- : (i.innerHTML = !1 !== e.html ? e.html : ""),
- e.bgPos)
- ) {
- var n = I(e.bgPos);
- i.style.backgroundPosition = -n.x + "px " + -n.y + "px";
- }
- return this._setIconStyles(i, "icon"), i;
- },
- createShadow: function () {
- return null;
- },
- });
- ke.Default = Be;
- var rn = Se.extend({
- options: {
- tileSize: 256,
- opacity: 1,
- updateWhenIdle: xt,
- updateWhenZooming: !0,
- updateInterval: 200,
- zIndex: 1,
- bounds: null,
- minZoom: 0,
- maxZoom: void 0,
- maxNativeZoom: void 0,
- minNativeZoom: void 0,
- noWrap: !1,
- pane: "tilePane",
- className: "",
- keepBuffer: 2,
- },
- initialize: function (t) {
- p(this, t);
- },
- onAdd: function () {
- this._initContainer(),
- (this._levels = {}),
- (this._tiles = {}),
- this._resetView(),
- this._update();
- },
- beforeAdd: function (t) {
- t._addZoomLimit(this);
- },
- onRemove: function (t) {
- this._removeAllTiles(),
- ui(this._container),
- t._removeZoomLimit(this),
- (this._container = null),
- (this._tileZoom = void 0);
- },
- bringToFront: function () {
- return (
- this._map && (ci(this._container), this._setAutoZIndex(Math.max)), this
- );
- },
- bringToBack: function () {
- return (
- this._map && (_i(this._container), this._setAutoZIndex(Math.min)), this
- );
- },
- getContainer: function () {
- return this._container;
- },
- setOpacity: function (t) {
- return (this.options.opacity = t), this._updateOpacity(), this;
- },
- setZIndex: function (t) {
- return (this.options.zIndex = t), this._updateZIndex(), this;
- },
- isLoading: function () {
- return this._loading;
- },
- redraw: function () {
- return this._map && (this._removeAllTiles(), this._update()), this;
- },
- getEvents: function () {
- var t = {
- viewprereset: this._invalidateAll,
- viewreset: this._resetView,
- zoom: this._resetView,
- moveend: this._onMoveEnd,
- };
- return (
- this.options.updateWhenIdle ||
- (this._onMove ||
- (this._onMove = o(
- this._onMoveEnd,
- this.options.updateInterval,
- this,
- )),
- (t.move = this._onMove)),
- this._zoomAnimated && (t.zoomanim = this._animateZoom),
- t
- );
- },
- createTile: function () {
- return document.createElement("div");
- },
- getTileSize: function () {
- var t = this.options.tileSize;
- return t instanceof B ? t : new B(t, t);
- },
- _updateZIndex: function () {
- this._container &&
- void 0 !== this.options.zIndex &&
- null !== this.options.zIndex &&
- (this._container.style.zIndex = this.options.zIndex);
- },
- _setAutoZIndex: function (t) {
- for (
- var i,
- e = this.getPane().children,
- n = -t(-1 / 0, 1 / 0),
- o = 0,
- s = e.length;
- o < s;
- o++
- )
- (i = e[o].style.zIndex),
- e[o] !== this._container && i && (n = t(n, +i));
- isFinite(n) &&
- ((this.options.zIndex = n + t(-1, 1)), this._updateZIndex());
- },
- _updateOpacity: function () {
- if (this._map && !et) {
- vi(this._container, this.options.opacity);
- var t = +new Date(),
- i = !1,
- e = !1;
- for (var n in this._tiles) {
- var o = this._tiles[n];
- if (o.current && o.loaded) {
- var s = Math.min(1, (t - o.loaded) / 200);
- vi(o.el, s),
- s < 1
- ? (i = !0)
- : (o.active ? (e = !0) : this._onOpaqueTile(o),
- (o.active = !0));
- }
- }
- e && !this._noPrune && this._pruneTiles(),
- i &&
- (C(this._fadeFrame),
- (this._fadeFrame = M(this._updateOpacity, this)));
- }
- },
- _onOpaqueTile: l,
- _initContainer: function () {
- this._container ||
- ((this._container = hi(
- "div",
- "leaflet-layer " + (this.options.className || ""),
- )),
- this._updateZIndex(),
- this.options.opacity < 1 && this._updateOpacity(),
- this.getPane().appendChild(this._container));
- },
- _updateLevels: function () {
- var t = this._tileZoom,
- i = this.options.maxZoom;
- if (void 0 !== t) {
- for (var e in this._levels)
- this._levels[e].el.children.length || e === t
- ? ((this._levels[e].el.style.zIndex = i - Math.abs(t - e)),
- this._onUpdateLevel(e))
- : (ui(this._levels[e].el),
- this._removeTilesAtZoom(e),
- this._onRemoveLevel(e),
- delete this._levels[e]);
- var n = this._levels[t],
- o = this._map;
- return (
- n ||
- (((n = this._levels[t] = {}).el = hi(
- "div",
- "leaflet-tile-container leaflet-zoom-animated",
- this._container,
- )),
- (n.el.style.zIndex = i),
- (n.origin = o.project(o.unproject(o.getPixelOrigin()), t).round()),
- (n.zoom = t),
- this._setZoomTransform(n, o.getCenter(), o.getZoom()),
- n.el.offsetWidth,
- this._onCreateLevel(n)),
- (this._level = n)
- );
- }
- },
- _onUpdateLevel: l,
- _onRemoveLevel: l,
- _onCreateLevel: l,
- _pruneTiles: function () {
- if (this._map) {
- var t,
- i,
- e = this._map.getZoom();
- if (e > this.options.maxZoom || e < this.options.minZoom)
- this._removeAllTiles();
- else {
- for (t in this._tiles) (i = this._tiles[t]).retain = i.current;
- for (t in this._tiles)
- if ((i = this._tiles[t]).current && !i.active) {
- var n = i.coords;
- this._retainParent(n.x, n.y, n.z, n.z - 5) ||
- this._retainChildren(n.x, n.y, n.z, n.z + 2);
- }
- for (t in this._tiles) this._tiles[t].retain || this._removeTile(t);
- }
- }
- },
- _removeTilesAtZoom: function (t) {
- for (var i in this._tiles)
- this._tiles[i].coords.z === t && this._removeTile(i);
- },
- _removeAllTiles: function () {
- for (var t in this._tiles) this._removeTile(t);
- },
- _invalidateAll: function () {
- for (var t in this._levels)
- ui(this._levels[t].el), this._onRemoveLevel(t), delete this._levels[t];
- this._removeAllTiles(), (this._tileZoom = void 0);
- },
- _retainParent: function (t, i, e, n) {
- var o = Math.floor(t / 2),
- s = Math.floor(i / 2),
- r = e - 1,
- a = new B(+o, +s);
- a.z = +r;
- var h = this._tileCoordsToKey(a),
- u = this._tiles[h];
- return u && u.active
- ? (u.retain = !0)
- : (u && u.loaded && (u.retain = !0),
- n < r && this._retainParent(o, s, r, n));
- },
- _retainChildren: function (t, i, e, n) {
- for (var o = 2 * t; o < 2 * t + 2; o++)
- for (var s = 2 * i; s < 2 * i + 2; s++) {
- var r = new B(o, s);
- r.z = e + 1;
- var a = this._tileCoordsToKey(r),
- h = this._tiles[a];
- h && h.active
- ? (h.retain = !0)
- : (h && h.loaded && (h.retain = !0),
- e + 1 < n && this._retainChildren(o, s, e + 1, n));
- }
- },
- _resetView: function (t) {
- var i = t && (t.pinch || t.flyTo);
- this._setView(this._map.getCenter(), this._map.getZoom(), i, i);
- },
- _animateZoom: function (t) {
- this._setView(t.center, t.zoom, !0, t.noUpdate);
- },
- _clampZoom: function (t) {
- var i = this.options;
- return void 0 !== i.minNativeZoom && t < i.minNativeZoom
- ? i.minNativeZoom
- : void 0 !== i.maxNativeZoom && i.maxNativeZoom < t
- ? i.maxNativeZoom
- : t;
- },
- _setView: function (t, i, e, n) {
- var o = this._clampZoom(Math.round(i));
- ((void 0 !== this.options.maxZoom && o > this.options.maxZoom) ||
- (void 0 !== this.options.minZoom && o < this.options.minZoom)) &&
- (o = void 0);
- var s = this.options.updateWhenZooming && o !== this._tileZoom;
- (n && !s) ||
- ((this._tileZoom = o),
- this._abortLoading && this._abortLoading(),
- this._updateLevels(),
- this._resetGrid(),
- void 0 !== o && this._update(t),
- e || this._pruneTiles(),
- (this._noPrune = !!e)),
- this._setZoomTransforms(t, i);
- },
- _setZoomTransforms: function (t, i) {
- for (var e in this._levels) this._setZoomTransform(this._levels[e], t, i);
- },
- _setZoomTransform: function (t, i, e) {
- var n = this._map.getZoomScale(e, t.zoom),
- o = t.origin
- .multiplyBy(n)
- .subtract(this._map._getNewPixelOrigin(i, e))
- .round();
- yt ? xi(t.el, o, n) : wi(t.el, o);
- },
- _resetGrid: function () {
- var t = this._map,
- i = t.options.crs,
- e = (this._tileSize = this.getTileSize()),
- n = this._tileZoom,
- o = this._map.getPixelWorldBounds(this._tileZoom);
- o && (this._globalTileRange = this._pxBoundsToTileRange(o)),
- (this._wrapX = i.wrapLng &&
- !this.options.noWrap && [
- Math.floor(t.project([0, i.wrapLng[0]], n).x / e.x),
- Math.ceil(t.project([0, i.wrapLng[1]], n).x / e.y),
- ]),
- (this._wrapY = i.wrapLat &&
- !this.options.noWrap && [
- Math.floor(t.project([i.wrapLat[0], 0], n).y / e.x),
- Math.ceil(t.project([i.wrapLat[1], 0], n).y / e.y),
- ]);
- },
- _onMoveEnd: function () {
- this._map && !this._map._animatingZoom && this._update();
- },
- _getTiledPixelBounds: function (t) {
- var i = this._map,
- e = i._animatingZoom
- ? Math.max(i._animateToZoom, i.getZoom())
- : i.getZoom(),
- n = i.getZoomScale(e, this._tileZoom),
- o = i.project(t, this._tileZoom).floor(),
- s = i.getSize().divideBy(2 * n);
- return new O(o.subtract(s), o.add(s));
- },
- _update: function (t) {
- var i = this._map;
- if (i) {
- var e = this._clampZoom(i.getZoom());
- if ((void 0 === t && (t = i.getCenter()), void 0 !== this._tileZoom)) {
- var n = this._getTiledPixelBounds(t),
- o = this._pxBoundsToTileRange(n),
- s = o.getCenter(),
- r = [],
- a = this.options.keepBuffer,
- h = new O(
- o.getBottomLeft().subtract([a, -a]),
- o.getTopRight().add([a, -a]),
- );
- if (
- !(
- isFinite(o.min.x) &&
- isFinite(o.min.y) &&
- isFinite(o.max.x) &&
- isFinite(o.max.y)
- )
- )
- throw new Error("Attempted to load an infinite number of tiles");
- for (var u in this._tiles) {
- var l = this._tiles[u].coords;
- (l.z === this._tileZoom && h.contains(new B(l.x, l.y))) ||
- (this._tiles[u].current = !1);
- }
- if (1 < Math.abs(e - this._tileZoom)) this._setView(t, e);
- else {
- for (var c = o.min.y; c <= o.max.y; c++)
- for (var _ = o.min.x; _ <= o.max.x; _++) {
- var d = new B(_, c);
- if (((d.z = this._tileZoom), this._isValidTile(d))) {
- var p = this._tiles[this._tileCoordsToKey(d)];
- p ? (p.current = !0) : r.push(d);
- }
- }
- if (
- (r.sort(function (t, i) {
- return t.distanceTo(s) - i.distanceTo(s);
- }),
- 0 !== r.length)
- ) {
- this._loading || ((this._loading = !0), this.fire("loading"));
- var m = document.createDocumentFragment();
- for (_ = 0; _ < r.length; _++) this._addTile(r[_], m);
- this._level.el.appendChild(m);
- }
- }
- }
- }
- },
- _isValidTile: function (t) {
- var i = this._map.options.crs;
- if (!i.infinite) {
- var e = this._globalTileRange;
- if (
- (!i.wrapLng && (t.x < e.min.x || t.x > e.max.x)) ||
- (!i.wrapLat && (t.y < e.min.y || t.y > e.max.y))
- )
- return !1;
- }
- if (!this.options.bounds) return !0;
- var n = this._tileCoordsToBounds(t);
- return D(this.options.bounds).overlaps(n);
- },
- _keyToBounds: function (t) {
- return this._tileCoordsToBounds(this._keyToTileCoords(t));
- },
- _tileCoordsToNwSe: function (t) {
- var i = this._map,
- e = this.getTileSize(),
- n = t.scaleBy(e),
- o = n.add(e);
- return [i.unproject(n, t.z), i.unproject(o, t.z)];
- },
- _tileCoordsToBounds: function (t) {
- var i = this._tileCoordsToNwSe(t),
- e = new N(i[0], i[1]);
- return this.options.noWrap || (e = this._map.wrapLatLngBounds(e)), e;
- },
- _tileCoordsToKey: function (t) {
- return t.x + ":" + t.y + ":" + t.z;
- },
- _keyToTileCoords: function (t) {
- var i = t.split(":"),
- e = new B(+i[0], +i[1]);
- return (e.z = +i[2]), e;
- },
- _removeTile: function (t) {
- var i = this._tiles[t];
- i &&
- (ui(i.el),
- delete this._tiles[t],
- this.fire("tileunload", {
- tile: i.el,
- coords: this._keyToTileCoords(t),
- }));
- },
- _initTile: function (t) {
- pi(t, "leaflet-tile");
- var i = this.getTileSize();
- (t.style.width = i.x + "px"),
- (t.style.height = i.y + "px"),
- (t.onselectstart = l),
- (t.onmousemove = l),
- et && this.options.opacity < 1 && vi(t, this.options.opacity),
- st && !rt && (t.style.WebkitBackfaceVisibility = "hidden");
- },
- _addTile: function (t, i) {
- var e = this._getTilePos(t),
- n = this._tileCoordsToKey(t),
- o = this.createTile(this._wrapCoords(t), a(this._tileReady, this, t));
- this._initTile(o),
- this.createTile.length < 2 && M(a(this._tileReady, this, t, null, o)),
- wi(o, e),
- (this._tiles[n] = { el: o, coords: t, current: !0 }),
- i.appendChild(o),
- this.fire("tileloadstart", { tile: o, coords: t });
- },
- _tileReady: function (t, i, e) {
- i && this.fire("tileerror", { error: i, tile: e, coords: t });
- var n = this._tileCoordsToKey(t);
- (e = this._tiles[n]) &&
- ((e.loaded = +new Date()),
- this._map._fadeAnimated
- ? (vi(e.el, 0),
- C(this._fadeFrame),
- (this._fadeFrame = M(this._updateOpacity, this)))
- : ((e.active = !0), this._pruneTiles()),
- i ||
- (pi(e.el, "leaflet-tile-loaded"),
- this.fire("tileload", { tile: e.el, coords: t })),
- this._noTilesToLoad() &&
- ((this._loading = !1),
- this.fire("load"),
- et || !this._map._fadeAnimated
- ? M(this._pruneTiles, this)
- : setTimeout(a(this._pruneTiles, this), 250)));
- },
- _getTilePos: function (t) {
- return t.scaleBy(this.getTileSize()).subtract(this._level.origin);
- },
- _wrapCoords: function (t) {
- var i = new B(
- this._wrapX ? r(t.x, this._wrapX) : t.x,
- this._wrapY ? r(t.y, this._wrapY) : t.y,
- );
- return (i.z = t.z), i;
- },
- _pxBoundsToTileRange: function (t) {
- var i = this.getTileSize();
- return new O(
- t.min.unscaleBy(i).floor(),
- t.max.unscaleBy(i).ceil().subtract([1, 1]),
- );
- },
- _noTilesToLoad: function () {
- for (var t in this._tiles) if (!this._tiles[t].loaded) return !1;
- return !0;
- },
- });
- var an = rn.extend({
- options: {
- minZoom: 0,
- maxZoom: 18,
- subdomains: "abc",
- errorTileUrl: "",
- zoomOffset: 0,
- tms: !1,
- zoomReverse: !1,
- detectRetina: !1,
- crossOrigin: !1,
- },
- initialize: function (t, i) {
- (this._url = t),
- (i = p(this, i)).detectRetina &&
- Ct &&
- 0 < i.maxZoom &&
- ((i.tileSize = Math.floor(i.tileSize / 2)),
- i.zoomReverse
- ? (i.zoomOffset--, i.minZoom++)
- : (i.zoomOffset++, i.maxZoom--),
- (i.minZoom = Math.max(0, i.minZoom))),
- "string" == typeof i.subdomains &&
- (i.subdomains = i.subdomains.split("")),
- st || this.on("tileunload", this._onTileRemove);
- },
- setUrl: function (t, i) {
- return (
- this._url === t && void 0 === i && (i = !0),
- (this._url = t),
- i || this.redraw(),
- this
- );
- },
- createTile: function (t, i) {
- var e = document.createElement("img");
- return (
- Ei(e, "load", a(this._tileOnLoad, this, i, e)),
- Ei(e, "error", a(this._tileOnError, this, i, e)),
- (!this.options.crossOrigin && "" !== this.options.crossOrigin) ||
- (e.crossOrigin =
- !0 === this.options.crossOrigin ? "" : this.options.crossOrigin),
- (e.alt = ""),
- e.setAttribute("role", "presentation"),
- (e.src = this.getTileUrl(t)),
- e
- );
- },
- getTileUrl: function (t) {
- var i = {
- r: Ct ? "@2x" : "",
- s: this._getSubdomain(t),
- x: t.x,
- y: t.y,
- z: this._getZoomForUrl(),
- };
- if (this._map && !this._map.options.crs.infinite) {
- var e = this._globalTileRange.max.y - t.y;
- this.options.tms && (i.y = e), (i["-y"] = e);
- }
- return g(this._url, h(i, this.options));
- },
- _tileOnLoad: function (t, i) {
- et ? setTimeout(a(t, this, null, i), 0) : t(null, i);
- },
- _tileOnError: function (t, i, e) {
- var n = this.options.errorTileUrl;
- n && i.getAttribute("src") !== n && (i.src = n), t(e, i);
- },
- _onTileRemove: function (t) {
- t.tile.onload = null;
- },
- _getZoomForUrl: function () {
- var t = this._tileZoom,
- i = this.options.maxZoom;
- return (
- this.options.zoomReverse && (t = i - t), t + this.options.zoomOffset
- );
- },
- _getSubdomain: function (t) {
- var i = Math.abs(t.x + t.y) % this.options.subdomains.length;
- return this.options.subdomains[i];
- },
- _abortLoading: function () {
- var t, i;
- for (t in this._tiles)
- this._tiles[t].coords.z !== this._tileZoom &&
- (((i = this._tiles[t].el).onload = l),
- (i.onerror = l),
- i.complete || ((i.src = x), ui(i), delete this._tiles[t]));
- },
- _removeTile: function (t) {
- var i = this._tiles[t];
- if (i)
- return (
- ht || i.el.setAttribute("src", x),
- rn.prototype._removeTile.call(this, t)
- );
- },
- _tileReady: function (t, i, e) {
- if (this._map && (!e || e.getAttribute("src") !== x))
- return rn.prototype._tileReady.call(this, t, i, e);
- },
- });
- function hn(t, i) {
- return new an(t, i);
- }
- var un = an.extend({
- defaultWmsParams: {
- service: "WMS",
- request: "GetMap",
- layers: "",
- styles: "",
- format: "image/jpeg",
- transparent: !1,
- version: "1.1.1",
- },
- options: { crs: null, uppercase: !1 },
- initialize: function (t, i) {
- this._url = t;
- var e = h({}, this.defaultWmsParams);
- for (var n in i) n in this.options || (e[n] = i[n]);
- var o = (i = p(this, i)).detectRetina && Ct ? 2 : 1,
- s = this.getTileSize();
- (e.width = s.x * o), (e.height = s.y * o), (this.wmsParams = e);
- },
- onAdd: function (t) {
- (this._crs = this.options.crs || t.options.crs),
- (this._wmsVersion = parseFloat(this.wmsParams.version));
- var i = 1.3 <= this._wmsVersion ? "crs" : "srs";
- (this.wmsParams[i] = this._crs.code), an.prototype.onAdd.call(this, t);
- },
- getTileUrl: function (t) {
- var i = this._tileCoordsToNwSe(t),
- e = this._crs,
- n = R(e.project(i[0]), e.project(i[1])),
- o = n.min,
- s = n.max,
- r = (
- 1.3 <= this._wmsVersion && this._crs === Me
- ? [o.y, o.x, s.y, s.x]
- : [o.x, o.y, s.x, s.y]
- ).join(","),
- a = an.prototype.getTileUrl.call(this, t);
- return (
- a +
- m(this.wmsParams, a, this.options.uppercase) +
- (this.options.uppercase ? "&BBOX=" : "&bbox=") +
- r
- );
- },
- setParams: function (t, i) {
- return h(this.wmsParams, t), i || this.redraw(), this;
- },
- });
- (an.WMS = un),
- (hn.wms = function (t, i) {
- return new un(t, i);
- });
- var ln = Se.extend({
- options: { padding: 0.1, tolerance: 0 },
- initialize: function (t) {
- p(this, t), u(this), (this._layers = this._layers || {});
- },
- onAdd: function () {
- this._container ||
- (this._initContainer(),
- this._zoomAnimated && pi(this._container, "leaflet-zoom-animated")),
- this.getPane().appendChild(this._container),
- this._update(),
- this.on("update", this._updatePaths, this);
- },
- onRemove: function () {
- this.off("update", this._updatePaths, this), this._destroyContainer();
- },
- getEvents: function () {
- var t = {
- viewreset: this._reset,
- zoom: this._onZoom,
- moveend: this._update,
- zoomend: this._onZoomEnd,
- };
- return this._zoomAnimated && (t.zoomanim = this._onAnimZoom), t;
- },
- _onAnimZoom: function (t) {
- this._updateTransform(t.center, t.zoom);
- },
- _onZoom: function () {
- this._updateTransform(this._map.getCenter(), this._map.getZoom());
- },
- _updateTransform: function (t, i) {
- var e = this._map.getZoomScale(i, this._zoom),
- n = Pi(this._container),
- o = this._map.getSize().multiplyBy(0.5 + this.options.padding),
- s = this._map.project(this._center, i),
- r = this._map.project(t, i).subtract(s),
- a = o.multiplyBy(-e).add(n).add(o).subtract(r);
- yt ? xi(this._container, a, e) : wi(this._container, a);
- },
- _reset: function () {
- for (var t in (this._update(),
- this._updateTransform(this._center, this._zoom),
- this._layers))
- this._layers[t]._reset();
- },
- _onZoomEnd: function () {
- for (var t in this._layers) this._layers[t]._project();
- },
- _updatePaths: function () {
- for (var t in this._layers) this._layers[t]._update();
- },
- _update: function () {
- var t = this.options.padding,
- i = this._map.getSize(),
- e = this._map.containerPointToLayerPoint(i.multiplyBy(-t)).round();
- (this._bounds = new O(e, e.add(i.multiplyBy(1 + 2 * t)).round())),
- (this._center = this._map.getCenter()),
- (this._zoom = this._map.getZoom());
- },
- }),
- cn = ln.extend({
- getEvents: function () {
- var t = ln.prototype.getEvents.call(this);
- return (t.viewprereset = this._onViewPreReset), t;
- },
- _onViewPreReset: function () {
- this._postponeUpdatePaths = !0;
- },
- onAdd: function () {
- ln.prototype.onAdd.call(this), this._draw();
- },
- _initContainer: function () {
- var t = (this._container = document.createElement("canvas"));
- Ei(t, "mousemove", o(this._onMouseMove, 32, this), this),
- Ei(
- t,
- "click dblclick mousedown mouseup contextmenu",
- this._onClick,
- this,
- ),
- Ei(t, "mouseout", this._handleMouseOut, this),
- (this._ctx = t.getContext("2d"));
- },
- _destroyContainer: function () {
- C(this._redrawRequest),
- delete this._ctx,
- ui(this._container),
- Bi(this._container),
- delete this._container;
- },
- _updatePaths: function () {
- if (!this._postponeUpdatePaths) {
- for (var t in ((this._redrawBounds = null), this._layers))
- this._layers[t]._update();
- this._redraw();
- }
- },
- _update: function () {
- if (!this._map._animatingZoom || !this._bounds) {
- ln.prototype._update.call(this);
- var t = this._bounds,
- i = this._container,
- e = t.getSize(),
- n = Ct ? 2 : 1;
- wi(i, t.min),
- (i.width = n * e.x),
- (i.height = n * e.y),
- (i.style.width = e.x + "px"),
- (i.style.height = e.y + "px"),
- Ct && this._ctx.scale(2, 2),
- this._ctx.translate(-t.min.x, -t.min.y),
- this.fire("update");
- }
- },
- _reset: function () {
- ln.prototype._reset.call(this),
- this._postponeUpdatePaths &&
- ((this._postponeUpdatePaths = !1), this._updatePaths());
- },
- _initPath: function (t) {
- this._updateDashArray(t);
- var i = ((this._layers[u(t)] = t)._order = {
- layer: t,
- prev: this._drawLast,
- next: null,
- });
- this._drawLast && (this._drawLast.next = i),
- (this._drawLast = i),
- (this._drawFirst = this._drawFirst || this._drawLast);
- },
- _addPath: function (t) {
- this._requestRedraw(t);
- },
- _removePath: function (t) {
- var i = t._order,
- e = i.next,
- n = i.prev;
- e ? (e.prev = n) : (this._drawLast = n),
- n ? (n.next = e) : (this._drawFirst = e),
- delete t._order,
- delete this._layers[u(t)],
- this._requestRedraw(t);
- },
- _updatePath: function (t) {
- this._extendRedrawBounds(t),
- t._project(),
- t._update(),
- this._requestRedraw(t);
- },
- _updateStyle: function (t) {
- this._updateDashArray(t), this._requestRedraw(t);
- },
- _updateDashArray: function (t) {
- if ("string" == typeof t.options.dashArray) {
- var i,
- e,
- n = t.options.dashArray.split(/[, ]+/),
- o = [];
- for (e = 0; e < n.length; e++) {
- if (((i = Number(n[e])), isNaN(i))) return;
- o.push(i);
- }
- t.options._dashArray = o;
- } else t.options._dashArray = t.options.dashArray;
- },
- _requestRedraw: function (t) {
- this._map &&
- (this._extendRedrawBounds(t),
- (this._redrawRequest = this._redrawRequest || M(this._redraw, this)));
- },
- _extendRedrawBounds: function (t) {
- if (t._pxBounds) {
- var i = (t.options.weight || 0) + 1;
- (this._redrawBounds = this._redrawBounds || new O()),
- this._redrawBounds.extend(t._pxBounds.min.subtract([i, i])),
- this._redrawBounds.extend(t._pxBounds.max.add([i, i]));
- }
- },
- _redraw: function () {
- (this._redrawRequest = null),
- this._redrawBounds &&
- (this._redrawBounds.min._floor(), this._redrawBounds.max._ceil()),
- this._clear(),
- this._draw(),
- (this._redrawBounds = null);
- },
- _clear: function () {
- var t = this._redrawBounds;
- if (t) {
- var i = t.getSize();
- this._ctx.clearRect(t.min.x, t.min.y, i.x, i.y);
- } else
- this._ctx.clearRect(
- 0,
- 0,
- this._container.width,
- this._container.height,
- );
- },
- _draw: function () {
- var t,
- i = this._redrawBounds;
- if ((this._ctx.save(), i)) {
- var e = i.getSize();
- this._ctx.beginPath(),
- this._ctx.rect(i.min.x, i.min.y, e.x, e.y),
- this._ctx.clip();
- }
- this._drawing = !0;
- for (var n = this._drawFirst; n; n = n.next)
- (t = n.layer),
- (!i || (t._pxBounds && t._pxBounds.intersects(i))) &&
- t._updatePath();
- (this._drawing = !1), this._ctx.restore();
- },
- _updatePoly: function (t, i) {
- if (this._drawing) {
- var e,
- n,
- o,
- s,
- r = t._parts,
- a = r.length,
- h = this._ctx;
- if (a) {
- for (h.beginPath(), e = 0; e < a; e++) {
- for (n = 0, o = r[e].length; n < o; n++)
- (s = r[e][n]), h[n ? "lineTo" : "moveTo"](s.x, s.y);
- i && h.closePath();
- }
- this._fillStroke(h, t);
- }
- }
- },
- _updateCircle: function (t) {
- if (this._drawing && !t._empty()) {
- var i = t._point,
- e = this._ctx,
- n = Math.max(Math.round(t._radius), 1),
- o = (Math.max(Math.round(t._radiusY), 1) || n) / n;
- 1 != o && (e.save(), e.scale(1, o)),
- e.beginPath(),
- e.arc(i.x, i.y / o, n, 0, 2 * Math.PI, !1),
- 1 != o && e.restore(),
- this._fillStroke(e, t);
- }
- },
- _fillStroke: function (t, i) {
- var e = i.options;
- e.fill &&
- ((t.globalAlpha = e.fillOpacity),
- (t.fillStyle = e.fillColor || e.color),
- t.fill(e.fillRule || "evenodd")),
- e.stroke &&
- 0 !== e.weight &&
- (t.setLineDash &&
- t.setLineDash((i.options && i.options._dashArray) || []),
- (t.globalAlpha = e.opacity),
- (t.lineWidth = e.weight),
- (t.strokeStyle = e.color),
- (t.lineCap = e.lineCap),
- (t.lineJoin = e.lineJoin),
- t.stroke());
- },
- _onClick: function (t) {
- for (
- var i,
- e,
- n = this._map.mouseEventToLayerPoint(t),
- o = this._drawFirst;
- o;
- o = o.next
- )
- (i = o.layer).options.interactive &&
- i._containsPoint(n) &&
- !this._map._draggableMoved(i) &&
- (e = i);
- e && (qi(t), this._fireEvent([e], t));
- },
- _onMouseMove: function (t) {
- if (
- this._map &&
- !this._map.dragging.moving() &&
- !this._map._animatingZoom
- ) {
- var i = this._map.mouseEventToLayerPoint(t);
- this._handleMouseHover(t, i);
- }
- },
- _handleMouseOut: function (t) {
- var i = this._hoveredLayer;
- i &&
- (mi(this._container, "leaflet-interactive"),
- this._fireEvent([i], t, "mouseout"),
- (this._hoveredLayer = null));
- },
- _handleMouseHover: function (t, i) {
- for (var e, n, o = this._drawFirst; o; o = o.next)
- (e = o.layer).options.interactive && e._containsPoint(i) && (n = e);
- n !== this._hoveredLayer &&
- (this._handleMouseOut(t),
- n &&
- (pi(this._container, "leaflet-interactive"),
- this._fireEvent([n], t, "mouseover"),
- (this._hoveredLayer = n))),
- this._hoveredLayer && this._fireEvent([this._hoveredLayer], t);
- },
- _fireEvent: function (t, i, e) {
- this._map._fireDOMEvent(i, e || i.type, t);
- },
- _bringToFront: function (t) {
- var i = t._order;
- if (i) {
- var e = i.next,
- n = i.prev;
- e &&
- ((e.prev = n) ? (n.next = e) : e && (this._drawFirst = e),
- (i.prev = this._drawLast),
- ((this._drawLast.next = i).next = null),
- (this._drawLast = i),
- this._requestRedraw(t));
- }
- },
- _bringToBack: function (t) {
- var i = t._order;
- if (i) {
- var e = i.next,
- n = i.prev;
- n &&
- ((n.next = e) ? (e.prev = n) : n && (this._drawLast = n),
- (i.prev = null),
- (i.next = this._drawFirst),
- (this._drawFirst.prev = i),
- (this._drawFirst = i),
- this._requestRedraw(t));
- }
- },
- });
- function _n(t) {
- return St ? new cn(t) : null;
- }
- var dn = (function () {
- try {
- return (
- document.namespaces.add("lvml", "urn:schemas-microsoft-com:vml"),
- function (t) {
- return document.createElement("');
- }
- );
- } catch (t) {
- return function (t) {
- return document.createElement(
- "<" + t + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">',
- );
- };
- }
- })(),
- pn = {
- _initContainer: function () {
- this._container = hi("div", "leaflet-vml-container");
- },
- _update: function () {
- this._map._animatingZoom ||
- (ln.prototype._update.call(this), this.fire("update"));
- },
- _initPath: function (t) {
- var i = (t._container = dn("shape"));
- pi(i, "leaflet-vml-shape " + (this.options.className || "")),
- (i.coordsize = "1 1"),
- (t._path = dn("path")),
- i.appendChild(t._path),
- this._updateStyle(t),
- (this._layers[u(t)] = t);
- },
- _addPath: function (t) {
- var i = t._container;
- this._container.appendChild(i),
- t.options.interactive && t.addInteractiveTarget(i);
- },
- _removePath: function (t) {
- var i = t._container;
- ui(i), t.removeInteractiveTarget(i), delete this._layers[u(t)];
- },
- _updateStyle: function (t) {
- var i = t._stroke,
- e = t._fill,
- n = t.options,
- o = t._container;
- (o.stroked = !!n.stroke),
- (o.filled = !!n.fill),
- n.stroke
- ? (i || (i = t._stroke = dn("stroke")),
- o.appendChild(i),
- (i.weight = n.weight + "px"),
- (i.color = n.color),
- (i.opacity = n.opacity),
- n.dashArray
- ? (i.dashStyle = v(n.dashArray)
- ? n.dashArray.join(" ")
- : n.dashArray.replace(/( *, *)/g, " "))
- : (i.dashStyle = ""),
- (i.endcap = n.lineCap.replace("butt", "flat")),
- (i.joinstyle = n.lineJoin))
- : i && (o.removeChild(i), (t._stroke = null)),
- n.fill
- ? (e || (e = t._fill = dn("fill")),
- o.appendChild(e),
- (e.color = n.fillColor || n.color),
- (e.opacity = n.fillOpacity))
- : e && (o.removeChild(e), (t._fill = null));
- },
- _updateCircle: function (t) {
- var i = t._point.round(),
- e = Math.round(t._radius),
- n = Math.round(t._radiusY || e);
- this._setPath(
- t,
- t._empty()
- ? "M0 0"
- : "AL " + i.x + "," + i.y + " " + e + "," + n + " 0,23592600",
- );
- },
- _setPath: function (t, i) {
- t._path.v = i;
- },
- _bringToFront: function (t) {
- ci(t._container);
- },
- _bringToBack: function (t) {
- _i(t._container);
- },
- },
- mn = Et ? dn : $,
- fn = ln.extend({
- getEvents: function () {
- var t = ln.prototype.getEvents.call(this);
- return (t.zoomstart = this._onZoomStart), t;
- },
- _initContainer: function () {
- (this._container = mn("svg")),
- this._container.setAttribute("pointer-events", "none"),
- (this._rootGroup = mn("g")),
- this._container.appendChild(this._rootGroup);
- },
- _destroyContainer: function () {
- ui(this._container),
- Bi(this._container),
- delete this._container,
- delete this._rootGroup,
- delete this._svgSize;
- },
- _onZoomStart: function () {
- this._update();
- },
- _update: function () {
- if (!this._map._animatingZoom || !this._bounds) {
- ln.prototype._update.call(this);
- var t = this._bounds,
- i = t.getSize(),
- e = this._container;
- (this._svgSize && this._svgSize.equals(i)) ||
- ((this._svgSize = i),
- e.setAttribute("width", i.x),
- e.setAttribute("height", i.y)),
- wi(e, t.min),
- e.setAttribute("viewBox", [t.min.x, t.min.y, i.x, i.y].join(" ")),
- this.fire("update");
- }
- },
- _initPath: function (t) {
- var i = (t._path = mn("path"));
- t.options.className && pi(i, t.options.className),
- t.options.interactive && pi(i, "leaflet-interactive"),
- this._updateStyle(t),
- (this._layers[u(t)] = t);
- },
- _addPath: function (t) {
- this._rootGroup || this._initContainer(),
- this._rootGroup.appendChild(t._path),
- t.addInteractiveTarget(t._path);
- },
- _removePath: function (t) {
- ui(t._path),
- t.removeInteractiveTarget(t._path),
- delete this._layers[u(t)];
- },
- _updatePath: function (t) {
- t._project(), t._update();
- },
- _updateStyle: function (t) {
- var i = t._path,
- e = t.options;
- i &&
- (e.stroke
- ? (i.setAttribute("stroke", e.color),
- i.setAttribute("stroke-opacity", e.opacity),
- i.setAttribute("stroke-width", e.weight),
- i.setAttribute("stroke-linecap", e.lineCap),
- i.setAttribute("stroke-linejoin", e.lineJoin),
- e.dashArray
- ? i.setAttribute("stroke-dasharray", e.dashArray)
- : i.removeAttribute("stroke-dasharray"),
- e.dashOffset
- ? i.setAttribute("stroke-dashoffset", e.dashOffset)
- : i.removeAttribute("stroke-dashoffset"))
- : i.setAttribute("stroke", "none"),
- e.fill
- ? (i.setAttribute("fill", e.fillColor || e.color),
- i.setAttribute("fill-opacity", e.fillOpacity),
- i.setAttribute("fill-rule", e.fillRule || "evenodd"))
- : i.setAttribute("fill", "none"));
- },
- _updatePoly: function (t, i) {
- this._setPath(t, Q(t._parts, i));
- },
- _updateCircle: function (t) {
- var i = t._point,
- e = Math.max(Math.round(t._radius), 1),
- n =
- "a" +
- e +
- "," +
- (Math.max(Math.round(t._radiusY), 1) || e) +
- " 0 1,0 ",
- o = t._empty()
- ? "M0 0"
- : "M" +
- (i.x - e) +
- "," +
- i.y +
- n +
- 2 * e +
- ",0 " +
- n +
- 2 * -e +
- ",0 ";
- this._setPath(t, o);
- },
- _setPath: function (t, i) {
- t._path.setAttribute("d", i);
- },
- _bringToFront: function (t) {
- ci(t._path);
- },
- _bringToBack: function (t) {
- _i(t._path);
- },
- });
- function gn(t) {
- return Zt || Et ? new fn(t) : null;
- }
- Et && fn.include(pn),
- Ji.include({
- getRenderer: function (t) {
- var i =
- t.options.renderer ||
- this._getPaneRenderer(t.options.pane) ||
- this.options.renderer ||
- this._renderer;
- return (
- i || (i = this._renderer = this._createRenderer()),
- this.hasLayer(i) || this.addLayer(i),
- i
- );
- },
- _getPaneRenderer: function (t) {
- if ("overlayPane" === t || void 0 === t) return !1;
- var i = this._paneRenderers[t];
- return (
- void 0 === i &&
- ((i = this._createRenderer({ pane: t })),
- (this._paneRenderers[t] = i)),
- i
- );
- },
- _createRenderer: function (t) {
- return (this.options.preferCanvas && _n(t)) || gn(t);
- },
- });
- var vn = je.extend({
- initialize: function (t, i) {
- je.prototype.initialize.call(this, this._boundsToLatLngs(t), i);
- },
- setBounds: function (t) {
- return this.setLatLngs(this._boundsToLatLngs(t));
- },
- _boundsToLatLngs: function (t) {
- return [
- (t = D(t)).getSouthWest(),
- t.getNorthWest(),
- t.getNorthEast(),
- t.getSouthEast(),
- ];
- },
- });
- (fn.create = mn),
- (fn.pointsToPath = Q),
- (We.geometryToLayer = He),
- (We.coordsToLatLng = Fe),
- (We.coordsToLatLngs = Ue),
- (We.latLngToCoords = Ve),
- (We.latLngsToCoords = qe),
- (We.getFeature = Ge),
- (We.asFeature = Ke),
- Ji.mergeOptions({ boxZoom: !0 });
- var yn = oe.extend({
- initialize: function (t) {
- (this._map = t),
- (this._container = t._container),
- (this._pane = t._panes.overlayPane),
- (this._resetStateTimeout = 0),
- t.on("unload", this._destroy, this);
- },
- addHooks: function () {
- Ei(this._container, "mousedown", this._onMouseDown, this);
- },
- removeHooks: function () {
- Bi(this._container, "mousedown", this._onMouseDown, this);
- },
- moved: function () {
- return this._moved;
- },
- _destroy: function () {
- ui(this._pane), delete this._pane;
- },
- _resetState: function () {
- (this._resetStateTimeout = 0), (this._moved = !1);
- },
- _clearDeferredResetState: function () {
- 0 !== this._resetStateTimeout &&
- (clearTimeout(this._resetStateTimeout), (this._resetStateTimeout = 0));
- },
- _onMouseDown: function (t) {
- if (!t.shiftKey || (1 !== t.which && 1 !== t.button)) return !1;
- this._clearDeferredResetState(),
- this._resetState(),
- $t(),
- bi(),
- (this._startPoint = this._map.mouseEventToContainerPoint(t)),
- Ei(
- document,
- {
- contextmenu: ji,
- mousemove: this._onMouseMove,
- mouseup: this._onMouseUp,
- keydown: this._onKeyDown,
- },
- this,
- );
- },
- _onMouseMove: function (t) {
- this._moved ||
- ((this._moved = !0),
- (this._box = hi("div", "leaflet-zoom-box", this._container)),
- pi(this._container, "leaflet-crosshair"),
- this._map.fire("boxzoomstart")),
- (this._point = this._map.mouseEventToContainerPoint(t));
- var i = new O(this._point, this._startPoint),
- e = i.getSize();
- wi(this._box, i.min),
- (this._box.style.width = e.x + "px"),
- (this._box.style.height = e.y + "px");
- },
- _finish: function () {
- this._moved && (ui(this._box), mi(this._container, "leaflet-crosshair")),
- Qt(),
- Ti(),
- Bi(
- document,
- {
- contextmenu: ji,
- mousemove: this._onMouseMove,
- mouseup: this._onMouseUp,
- keydown: this._onKeyDown,
- },
- this,
- );
- },
- _onMouseUp: function (t) {
- if ((1 === t.which || 1 === t.button) && (this._finish(), this._moved)) {
- this._clearDeferredResetState(),
- (this._resetStateTimeout = setTimeout(a(this._resetState, this), 0));
- var i = new N(
- this._map.containerPointToLatLng(this._startPoint),
- this._map.containerPointToLatLng(this._point),
- );
- this._map.fitBounds(i).fire("boxzoomend", { boxZoomBounds: i });
- }
- },
- _onKeyDown: function (t) {
- 27 === t.keyCode && this._finish();
- },
- });
- Ji.addInitHook("addHandler", "boxZoom", yn),
- Ji.mergeOptions({ doubleClickZoom: !0 });
- var xn = oe.extend({
- addHooks: function () {
- this._map.on("dblclick", this._onDoubleClick, this);
- },
- removeHooks: function () {
- this._map.off("dblclick", this._onDoubleClick, this);
- },
- _onDoubleClick: function (t) {
- var i = this._map,
- e = i.getZoom(),
- n = i.options.zoomDelta,
- o = t.originalEvent.shiftKey ? e - n : e + n;
- "center" === i.options.doubleClickZoom
- ? i.setZoom(o)
- : i.setZoomAround(t.containerPoint, o);
- },
- });
- Ji.addInitHook("addHandler", "doubleClickZoom", xn),
- Ji.mergeOptions({
- dragging: !0,
- inertia: !rt,
- inertiaDeceleration: 3400,
- inertiaMaxSpeed: 1 / 0,
- easeLinearity: 0.2,
- worldCopyJump: !1,
- maxBoundsViscosity: 0,
- });
- var wn = oe.extend({
- addHooks: function () {
- if (!this._draggable) {
- var t = this._map;
- (this._draggable = new le(t._mapPane, t._container)),
- this._draggable.on(
- {
- dragstart: this._onDragStart,
- drag: this._onDrag,
- dragend: this._onDragEnd,
- },
- this,
- ),
- this._draggable.on("predrag", this._onPreDragLimit, this),
- t.options.worldCopyJump &&
- (this._draggable.on("predrag", this._onPreDragWrap, this),
- t.on("zoomend", this._onZoomEnd, this),
- t.whenReady(this._onZoomEnd, this));
- }
- pi(this._map._container, "leaflet-grab leaflet-touch-drag"),
- this._draggable.enable(),
- (this._positions = []),
- (this._times = []);
- },
- removeHooks: function () {
- mi(this._map._container, "leaflet-grab"),
- mi(this._map._container, "leaflet-touch-drag"),
- this._draggable.disable();
- },
- moved: function () {
- return this._draggable && this._draggable._moved;
- },
- moving: function () {
- return this._draggable && this._draggable._moving;
- },
- _onDragStart: function () {
- var t = this._map;
- if (
- (t._stop(),
- this._map.options.maxBounds && this._map.options.maxBoundsViscosity)
- ) {
- var i = D(this._map.options.maxBounds);
- (this._offsetLimit = R(
- this._map.latLngToContainerPoint(i.getNorthWest()).multiplyBy(-1),
- this._map
- .latLngToContainerPoint(i.getSouthEast())
- .multiplyBy(-1)
- .add(this._map.getSize()),
- )),
- (this._viscosity = Math.min(
- 1,
- Math.max(0, this._map.options.maxBoundsViscosity),
- ));
- } else this._offsetLimit = null;
- t.fire("movestart").fire("dragstart"),
- t.options.inertia && ((this._positions = []), (this._times = []));
- },
- _onDrag: function (t) {
- if (this._map.options.inertia) {
- var i = (this._lastTime = +new Date()),
- e = (this._lastPos =
- this._draggable._absPos || this._draggable._newPos);
- this._positions.push(e), this._times.push(i), this._prunePositions(i);
- }
- this._map.fire("move", t).fire("drag", t);
- },
- _prunePositions: function (t) {
- for (; 1 < this._positions.length && 50 < t - this._times[0]; )
- this._positions.shift(), this._times.shift();
- },
- _onZoomEnd: function () {
- var t = this._map.getSize().divideBy(2),
- i = this._map.latLngToLayerPoint([0, 0]);
- (this._initialWorldOffset = i.subtract(t).x),
- (this._worldWidth = this._map.getPixelWorldBounds().getSize().x);
- },
- _viscousLimit: function (t, i) {
- return t - (t - i) * this._viscosity;
- },
- _onPreDragLimit: function () {
- if (this._viscosity && this._offsetLimit) {
- var t = this._draggable._newPos.subtract(this._draggable._startPos),
- i = this._offsetLimit;
- t.x < i.min.x && (t.x = this._viscousLimit(t.x, i.min.x)),
- t.y < i.min.y && (t.y = this._viscousLimit(t.y, i.min.y)),
- t.x > i.max.x && (t.x = this._viscousLimit(t.x, i.max.x)),
- t.y > i.max.y && (t.y = this._viscousLimit(t.y, i.max.y)),
- (this._draggable._newPos = this._draggable._startPos.add(t));
- }
- },
- _onPreDragWrap: function () {
- var t = this._worldWidth,
- i = Math.round(t / 2),
- e = this._initialWorldOffset,
- n = this._draggable._newPos.x,
- o = ((n - i + e) % t) + i - e,
- s = ((n + i + e) % t) - i - e,
- r = Math.abs(o + e) < Math.abs(s + e) ? o : s;
- (this._draggable._absPos = this._draggable._newPos.clone()),
- (this._draggable._newPos.x = r);
- },
- _onDragEnd: function (t) {
- var i = this._map,
- e = i.options,
- n = !e.inertia || this._times.length < 2;
- if ((i.fire("dragend", t), n)) i.fire("moveend");
- else {
- this._prunePositions(+new Date());
- var o = this._lastPos.subtract(this._positions[0]),
- s = (this._lastTime - this._times[0]) / 1e3,
- r = e.easeLinearity,
- a = o.multiplyBy(r / s),
- h = a.distanceTo([0, 0]),
- u = Math.min(e.inertiaMaxSpeed, h),
- l = a.multiplyBy(u / h),
- c = u / (e.inertiaDeceleration * r),
- _ = l.multiplyBy(-c / 2).round();
- _.x || _.y
- ? ((_ = i._limitOffset(_, i.options.maxBounds)),
- M(function () {
- i.panBy(_, {
- duration: c,
- easeLinearity: r,
- noMoveStart: !0,
- animate: !0,
- });
- }))
- : i.fire("moveend");
- }
- },
- });
- Ji.addInitHook("addHandler", "dragging", wn),
- Ji.mergeOptions({ keyboard: !0, keyboardPanDelta: 80 });
- var Pn = oe.extend({
- keyCodes: {
- left: [37],
- right: [39],
- down: [40],
- up: [38],
- zoomIn: [187, 107, 61, 171],
- zoomOut: [189, 109, 54, 173],
- },
- initialize: function (t) {
- (this._map = t),
- this._setPanDelta(t.options.keyboardPanDelta),
- this._setZoomDelta(t.options.zoomDelta);
- },
- addHooks: function () {
- var t = this._map._container;
- t.tabIndex <= 0 && (t.tabIndex = "0"),
- Ei(
- t,
- {
- focus: this._onFocus,
- blur: this._onBlur,
- mousedown: this._onMouseDown,
- },
- this,
- ),
- this._map.on({ focus: this._addHooks, blur: this._removeHooks }, this);
- },
- removeHooks: function () {
- this._removeHooks(),
- Bi(
- this._map._container,
- {
- focus: this._onFocus,
- blur: this._onBlur,
- mousedown: this._onMouseDown,
- },
- this,
- ),
- this._map.off({ focus: this._addHooks, blur: this._removeHooks }, this);
- },
- _onMouseDown: function () {
- if (!this._focused) {
- var t = document.body,
- i = document.documentElement,
- e = t.scrollTop || i.scrollTop,
- n = t.scrollLeft || i.scrollLeft;
- this._map._container.focus(), window.scrollTo(n, e);
- }
- },
- _onFocus: function () {
- (this._focused = !0), this._map.fire("focus");
- },
- _onBlur: function () {
- (this._focused = !1), this._map.fire("blur");
- },
- _setPanDelta: function (t) {
- var i,
- e,
- n = (this._panKeys = {}),
- o = this.keyCodes;
- for (i = 0, e = o.left.length; i < e; i++) n[o.left[i]] = [-1 * t, 0];
- for (i = 0, e = o.right.length; i < e; i++) n[o.right[i]] = [t, 0];
- for (i = 0, e = o.down.length; i < e; i++) n[o.down[i]] = [0, t];
- for (i = 0, e = o.up.length; i < e; i++) n[o.up[i]] = [0, -1 * t];
- },
- _setZoomDelta: function (t) {
- var i,
- e,
- n = (this._zoomKeys = {}),
- o = this.keyCodes;
- for (i = 0, e = o.zoomIn.length; i < e; i++) n[o.zoomIn[i]] = t;
- for (i = 0, e = o.zoomOut.length; i < e; i++) n[o.zoomOut[i]] = -t;
- },
- _addHooks: function () {
- Ei(document, "keydown", this._onKeyDown, this);
- },
- _removeHooks: function () {
- Bi(document, "keydown", this._onKeyDown, this);
- },
- _onKeyDown: function (t) {
- if (!(t.altKey || t.ctrlKey || t.metaKey)) {
- var i,
- e = t.keyCode,
- n = this._map;
- if (e in this._panKeys)
- (n._panAnim && n._panAnim._inProgress) ||
- ((i = this._panKeys[e]),
- t.shiftKey && (i = I(i).multiplyBy(3)),
- n.panBy(i),
- n.options.maxBounds && n.panInsideBounds(n.options.maxBounds));
- else if (e in this._zoomKeys)
- n.setZoom(n.getZoom() + (t.shiftKey ? 3 : 1) * this._zoomKeys[e]);
- else {
- if (27 !== e || !n._popup || !n._popup.options.closeOnEscapeKey)
- return;
- n.closePopup();
- }
- ji(t);
- }
- },
- });
- Ji.addInitHook("addHandler", "keyboard", Pn),
- Ji.mergeOptions({
- scrollWheelZoom: !0,
- wheelDebounceTime: 40,
- wheelPxPerZoomLevel: 60,
- });
- var Ln = oe.extend({
- addHooks: function () {
- Ei(this._map._container, "mousewheel", this._onWheelScroll, this),
- (this._delta = 0);
- },
- removeHooks: function () {
- Bi(this._map._container, "mousewheel", this._onWheelScroll, this);
- },
- _onWheelScroll: function (t) {
- var i = Fi(t),
- e = this._map.options.wheelDebounceTime;
- (this._delta += i),
- (this._lastMousePos = this._map.mouseEventToContainerPoint(t)),
- this._startTime || (this._startTime = +new Date());
- var n = Math.max(e - (+new Date() - this._startTime), 0);
- clearTimeout(this._timer),
- (this._timer = setTimeout(a(this._performZoom, this), n)),
- ji(t);
- },
- _performZoom: function () {
- var t = this._map,
- i = t.getZoom(),
- e = this._map.options.zoomSnap || 0;
- t._stop();
- var n = this._delta / (4 * this._map.options.wheelPxPerZoomLevel),
- o = (4 * Math.log(2 / (1 + Math.exp(-Math.abs(n))))) / Math.LN2,
- s = e ? Math.ceil(o / e) * e : o,
- r = t._limitZoom(i + (0 < this._delta ? s : -s)) - i;
- (this._delta = 0),
- (this._startTime = null),
- r &&
- ("center" === t.options.scrollWheelZoom
- ? t.setZoom(i + r)
- : t.setZoomAround(this._lastMousePos, i + r));
- },
- });
- Ji.addInitHook("addHandler", "scrollWheelZoom", Ln),
- Ji.mergeOptions({ tap: !0, tapTolerance: 15 });
- var bn = oe.extend({
- addHooks: function () {
- Ei(this._map._container, "touchstart", this._onDown, this);
- },
- removeHooks: function () {
- Bi(this._map._container, "touchstart", this._onDown, this);
- },
- _onDown: function (t) {
- if (t.touches) {
- if ((Di(t), (this._fireClick = !0), 1 < t.touches.length))
- return (this._fireClick = !1), void clearTimeout(this._holdTimeout);
- var i = t.touches[0],
- e = i.target;
- (this._startPos = this._newPos = new B(i.clientX, i.clientY)),
- e.tagName &&
- "a" === e.tagName.toLowerCase() &&
- pi(e, "leaflet-active"),
- (this._holdTimeout = setTimeout(
- a(function () {
- this._isTapValid() &&
- ((this._fireClick = !1),
- this._onUp(),
- this._simulateEvent("contextmenu", i));
- }, this),
- 1e3,
- )),
- this._simulateEvent("mousedown", i),
- Ei(document, { touchmove: this._onMove, touchend: this._onUp }, this);
- }
- },
- _onUp: function (t) {
- if (
- (clearTimeout(this._holdTimeout),
- Bi(document, { touchmove: this._onMove, touchend: this._onUp }, this),
- this._fireClick && t && t.changedTouches)
- ) {
- var i = t.changedTouches[0],
- e = i.target;
- e &&
- e.tagName &&
- "a" === e.tagName.toLowerCase() &&
- mi(e, "leaflet-active"),
- this._simulateEvent("mouseup", i),
- this._isTapValid() && this._simulateEvent("click", i);
- }
- },
- _isTapValid: function () {
- return (
- this._newPos.distanceTo(this._startPos) <=
- this._map.options.tapTolerance
- );
- },
- _onMove: function (t) {
- var i = t.touches[0];
- (this._newPos = new B(i.clientX, i.clientY)),
- this._simulateEvent("mousemove", i);
- },
- _simulateEvent: function (t, i) {
- var e = document.createEvent("MouseEvents");
- (e._simulated = !0),
- (i.target._simulatedClick = !0),
- e.initMouseEvent(
- t,
- !0,
- !0,
- window,
- 1,
- i.screenX,
- i.screenY,
- i.clientX,
- i.clientY,
- !1,
- !1,
- !1,
- !1,
- 0,
- null,
- ),
- i.target.dispatchEvent(e);
- },
- });
- Tt && !bt && Ji.addInitHook("addHandler", "tap", bn),
- Ji.mergeOptions({ touchZoom: Tt && !rt, bounceAtZoomLimits: !0 });
- var Tn = oe.extend({
- addHooks: function () {
- pi(this._map._container, "leaflet-touch-zoom"),
- Ei(this._map._container, "touchstart", this._onTouchStart, this);
- },
- removeHooks: function () {
- mi(this._map._container, "leaflet-touch-zoom"),
- Bi(this._map._container, "touchstart", this._onTouchStart, this);
- },
- _onTouchStart: function (t) {
- var i = this._map;
- if (
- t.touches &&
- 2 === t.touches.length &&
- !i._animatingZoom &&
- !this._zooming
- ) {
- var e = i.mouseEventToContainerPoint(t.touches[0]),
- n = i.mouseEventToContainerPoint(t.touches[1]);
- (this._centerPoint = i.getSize()._divideBy(2)),
- (this._startLatLng = i.containerPointToLatLng(this._centerPoint)),
- "center" !== i.options.touchZoom &&
- (this._pinchStartLatLng = i.containerPointToLatLng(
- e.add(n)._divideBy(2),
- )),
- (this._startDist = e.distanceTo(n)),
- (this._startZoom = i.getZoom()),
- (this._moved = !1),
- (this._zooming = !0),
- i._stop(),
- Ei(document, "touchmove", this._onTouchMove, this),
- Ei(document, "touchend", this._onTouchEnd, this),
- Di(t);
- }
- },
- _onTouchMove: function (t) {
- if (t.touches && 2 === t.touches.length && this._zooming) {
- var i = this._map,
- e = i.mouseEventToContainerPoint(t.touches[0]),
- n = i.mouseEventToContainerPoint(t.touches[1]),
- o = e.distanceTo(n) / this._startDist;
- if (
- ((this._zoom = i.getScaleZoom(o, this._startZoom)),
- !i.options.bounceAtZoomLimits &&
- ((this._zoom < i.getMinZoom() && o < 1) ||
- (this._zoom > i.getMaxZoom() && 1 < o)) &&
- (this._zoom = i._limitZoom(this._zoom)),
- "center" === i.options.touchZoom)
- ) {
- if (((this._center = this._startLatLng), 1 == o)) return;
- } else {
- var s = e._add(n)._divideBy(2)._subtract(this._centerPoint);
- if (1 == o && 0 === s.x && 0 === s.y) return;
- this._center = i.unproject(
- i.project(this._pinchStartLatLng, this._zoom).subtract(s),
- this._zoom,
- );
- }
- this._moved || (i._moveStart(!0, !1), (this._moved = !0)),
- C(this._animRequest);
- var r = a(i._move, i, this._center, this._zoom, {
- pinch: !0,
- round: !1,
- });
- (this._animRequest = M(r, this, !0)), Di(t);
- }
- },
- _onTouchEnd: function () {
- this._moved && this._zooming
- ? ((this._zooming = !1),
- C(this._animRequest),
- Bi(document, "touchmove", this._onTouchMove),
- Bi(document, "touchend", this._onTouchEnd),
- this._map.options.zoomAnimation
- ? this._map._animateZoom(
- this._center,
- this._map._limitZoom(this._zoom),
- !0,
- this._map.options.zoomSnap,
- )
- : this._map._resetView(
- this._center,
- this._map._limitZoom(this._zoom),
- ))
- : (this._zooming = !1);
- },
- });
- Ji.addInitHook("addHandler", "touchZoom", Tn),
- (Ji.BoxZoom = yn),
- (Ji.DoubleClickZoom = xn),
- (Ji.Drag = wn),
- (Ji.Keyboard = Pn),
- (Ji.ScrollWheelZoom = Ln),
- (Ji.Tap = bn),
- (Ji.TouchZoom = Tn),
- (Object.freeze = i),
- (t.version = "1.5.1"),
- (t.Control = Qi),
- (t.control = $i),
- (t.Browser = Bt),
- (t.Evented = k),
- (t.Mixin = re),
- (t.Util = S),
- (t.Class = Z),
- (t.Handler = oe),
- (t.extend = h),
- (t.bind = a),
- (t.stamp = u),
- (t.setOptions = p),
- (t.DomEvent = Yi),
- (t.DomUtil = Zi),
- (t.PosAnimation = Xi),
- (t.Draggable = le),
- (t.LineUtil = ye),
- (t.PolyUtil = Pe),
- (t.Point = B),
- (t.point = I),
- (t.Bounds = O),
- (t.bounds = R),
- (t.Transformation = G),
- (t.transformation = K),
- (t.Projection = Te),
- (t.LatLng = j),
- (t.latLng = W),
- (t.LatLngBounds = N),
- (t.latLngBounds = D),
- (t.CRS = F),
- (t.GeoJSON = We),
- (t.geoJSON = Xe),
- (t.geoJson = Je),
- (t.Layer = Se),
- (t.LayerGroup = Ze),
- (t.layerGroup = function (t, i) {
- return new Ze(t, i);
- }),
- (t.FeatureGroup = Ee),
- (t.featureGroup = function (t) {
- return new Ee(t);
- }),
- (t.ImageOverlay = $e),
- (t.imageOverlay = function (t, i, e) {
- return new $e(t, i, e);
- }),
- (t.VideoOverlay = Qe),
- (t.videoOverlay = function (t, i, e) {
- return new Qe(t, i, e);
- }),
- (t.SVGOverlay = tn),
- (t.svgOverlay = function (t, i, e) {
- return new tn(t, i, e);
- }),
- (t.DivOverlay = en),
- (t.Popup = nn),
- (t.popup = function (t, i) {
- return new nn(t, i);
- }),
- (t.Tooltip = on),
- (t.tooltip = function (t, i) {
- return new on(t, i);
- }),
- (t.Icon = ke),
- (t.icon = function (t) {
- return new ke(t);
- }),
- (t.DivIcon = sn),
- (t.divIcon = function (t) {
- return new sn(t);
- }),
- (t.Marker = Ie),
- (t.marker = function (t, i) {
- return new Ie(t, i);
- }),
- (t.TileLayer = an),
- (t.tileLayer = hn),
- (t.GridLayer = rn),
- (t.gridLayer = function (t) {
- return new rn(t);
- }),
- (t.SVG = fn),
- (t.svg = gn),
- (t.Renderer = ln),
- (t.Canvas = cn),
- (t.canvas = _n),
- (t.Path = Oe),
- (t.CircleMarker = Re),
- (t.circleMarker = function (t, i) {
- return new Re(t, i);
- }),
- (t.Circle = Ne),
- (t.circle = function (t, i, e) {
- return new Ne(t, i, e);
- }),
- (t.Polyline = De),
- (t.polyline = function (t, i) {
- return new De(t, i);
- }),
- (t.Polygon = je),
- (t.polygon = function (t, i) {
- return new je(t, i);
- }),
- (t.Rectangle = vn),
- (t.rectangle = function (t, i) {
- return new vn(t, i);
- }),
- (t.Map = Ji),
- (t.map = function (t, i) {
- return new Ji(t, i);
- });
- var zn = window.L;
- (t.noConflict = function () {
- return (window.L = zn), this;
- }),
- (window.L = t);
-});
+!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i(t.L={})}(this,function(t){"use strict";var i=Object.freeze;function h(t){var i,e,n,o;for(e=1,n=arguments.length;e=this.min.x&&e.x<=this.max.x&&i.y>=this.min.y&&e.y<=this.max.y},intersects:function(t){t=R(t);var i=this.min,e=this.max,n=t.min,o=t.max,s=o.x>=i.x&&n.x<=e.x,r=o.y>=i.y&&n.y<=e.y;return s&&r},overlaps:function(t){t=R(t);var i=this.min,e=this.max,n=t.min,o=t.max,s=o.x>i.x&&n.xi.y&&n.y=n.lat&&e.lat<=o.lat&&i.lng>=n.lng&&e.lng<=o.lng},intersects:function(t){t=D(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=i.lat&&n.lat<=e.lat,r=o.lng>=i.lng&&n.lng<=e.lng;return s&&r},overlaps:function(t){t=D(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>i.lat&&n.lati.lng&&n.lng ';var i=t.firstChild;return i.style.behavior="url(#default#VML)",i&&"object"==typeof i.adj}catch(t){return!1}}();function kt(t){return 0<=navigator.userAgent.toLowerCase().indexOf(t)}var Bt=(Object.freeze||Object)({ie:it,ielt9:et,edge:nt,webkit:ot,android:st,android23:rt,androidStock:ht,opera:ut,chrome:lt,gecko:ct,safari:_t,phantom:dt,opera12:pt,win:mt,ie3d:ft,webkit3d:gt,gecko3d:vt,any3d:yt,mobile:xt,mobileWebkit:wt,mobileWebkit3d:Pt,msPointer:Lt,pointer:bt,touch:Tt,mobileOpera:zt,mobileGecko:Mt,retina:Ct,canvas:St,svg:Zt,vml:Et}),At=Lt?"MSPointerDown":"pointerdown",It=Lt?"MSPointerMove":"pointermove",Ot=Lt?"MSPointerUp":"pointerup",Rt=Lt?"MSPointerCancel":"pointercancel",Nt=["INPUT","SELECT","OPTION"],Dt={},jt=!1,Wt=0;function Ht(t,i,e,n){return"touchstart"===i?function(t,i,e){var n=a(function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(Nt.indexOf(t.target.tagName)<0))return;Di(t)}qt(t,i)});t["_leaflet_touchstart"+e]=n,t.addEventListener(At,n,!1),jt||(document.documentElement.addEventListener(At,Ft,!0),document.documentElement.addEventListener(It,Ut,!0),document.documentElement.addEventListener(Ot,Vt,!0),document.documentElement.addEventListener(Rt,Vt,!0),jt=!0)}(t,e,n):"touchmove"===i?function(t,i,e){var n=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&qt(t,i)};t["_leaflet_touchmove"+e]=n,t.addEventListener(It,n,!1)}(t,e,n):"touchend"===i&&function(t,i,e){var n=function(t){qt(t,i)};t["_leaflet_touchend"+e]=n,t.addEventListener(Ot,n,!1),t.addEventListener(Rt,n,!1)}(t,e,n),this}function Ft(t){Dt[t.pointerId]=t,Wt++}function Ut(t){Dt[t.pointerId]&&(Dt[t.pointerId]=t)}function Vt(t){delete Dt[t.pointerId],Wt--}function qt(t,i){for(var e in t.touches=[],Dt)t.touches.push(Dt[e]);t.changedTouches=[t],i(t)}var Gt=Lt?"MSPointerDown":bt?"pointerdown":"touchstart",Kt=Lt?"MSPointerUp":bt?"pointerup":"touchend",Yt="_leaflet_";function Xt(t,o,i){var s,r,a=!1;function e(t){var i;if(bt){if(!nt||"mouse"===t.pointerType)return;i=Wt}else i=t.touches.length;if(!(1this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,i){this._enforcingBounds=!0;var e=this.getCenter(),n=this._limitCenter(e,this._zoom,D(t));return e.equals(n)||this.panTo(n,i),this._enforcingBounds=!1,this},panInside:function(t,i){var e=I((i=i||{}).paddingTopLeft||i.padding||[0,0]),n=I(i.paddingBottomRight||i.padding||[0,0]),o=this.getCenter(),s=this.project(o),r=this.project(t),a=this.getPixelBounds(),h=a.getSize().divideBy(2),u=R([a.min.add(e),a.max.subtract(n)]);if(!u.contains(r)){this._enforcingBounds=!0;var l=s.subtract(r),c=I(r.x+l.x,r.y+l.y);(r.xu.max.x)&&(c.x=s.x-l.x,0u.max.y)&&(c.y=s.y-l.y,0=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,i){for(var e,n=[],o="mouseout"===i||"mouseover"===i,s=t.target||t.srcElement,r=!1;s;){if((e=this._targets[u(s)])&&("click"===i||"preclick"===i)&&!t._simulated&&this._draggableMoved(e)){r=!0;break}if(e&&e.listens(i,!0)){if(o&&!Ki(s,t))break;if(n.push(e),o)break}if(s===this._container)break;s=s.parentNode}return n.length||r||o||!Ki(s,t)||(n=[this]),n},_handleDOMEvent:function(t){if(this._loaded&&!Gi(t)){var i=t.type;"mousedown"!==i&&"keypress"!==i&&"keyup"!==i&&"keydown"!==i||zi(t.target||t.srcElement),this._fireDOMEvent(t,i)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,i,e){if("click"===t.type){var n=h({},t);n.type="preclick",this._fireDOMEvent(n,n.type,e)}if(!t._stopped&&(e=(e||[]).concat(this._findEventTargets(t,i))).length){var o=e[0];"contextmenu"===i&&o.listens(i,!0)&&Di(t);var s={originalEvent:t};if("keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type){var r=o.getLatLng&&(!o._radius||o._radius<=10);s.containerPoint=r?this.latLngToContainerPoint(o.getLatLng()):this.mouseEventToContainerPoint(t),s.layerPoint=this.containerPointToLayerPoint(s.containerPoint),s.latlng=r?o.getLatLng():this.layerPointToLatLng(s.layerPoint)}for(var a=0;athis.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(i),o=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==e.animate&&!this.getSize().contains(o))&&(M(function(){this._moveStart(!0,!1)._animateZoom(t,i,!0)},this),!0)},_animateZoom:function(t,i,e,n){this._mapPane&&(e&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=i,pi(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:i,noUpdate:n}),setTimeout(a(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&mi(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),M(function(){this._moveEnd(!0)},this))}});function $i(t){return new Qi(t)}var Qi=Z.extend({options:{position:"topright"},initialize:function(t){p(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var i=this._map;return i&&i.removeControl(this),this.options.position=t,i&&i.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var i=this._container=this.onAdd(t),e=this.getPosition(),n=t._controlCorners[e];return pi(i,"leaflet-control"),-1!==e.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(ui(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0 ",n=document.createElement("div");return n.innerHTML=e,n.firstChild},_addItem:function(t){var i,e=document.createElement("label"),n=this._map.hasLayer(t.layer);t.overlay?((i=document.createElement("input")).type="checkbox",i.className="leaflet-control-layers-selector",i.defaultChecked=n):i=this._createRadioElement("leaflet-base-layers_"+u(this),n),this._layerControlInputs.push(i),i.layerId=u(t.layer),Ei(i,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+t.name;var s=document.createElement("div");return e.appendChild(s),s.appendChild(i),s.appendChild(o),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){var t,i,e=this._layerControlInputs,n=[],o=[];this._handlingClick=!0;for(var s=e.length-1;0<=s;s--)t=e[s],i=this._getLayer(t.layerId).layer,t.checked?n.push(i):t.checked||o.push(i);for(s=0;si.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),ie=Qi.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"−",zoomOutTitle:"Zoom out"},onAdd:function(t){var i="leaflet-control-zoom",e=hi("div",i+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,i+"-in",e,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,i+"-out",e,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),e},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,i,e,n,o){var s=hi("a",e,n);return s.innerHTML=t,s.href="#",s.title=i,s.setAttribute("role","button"),s.setAttribute("aria-label",i),Ni(s),Ei(s,"click",ji),Ei(s,"click",o,this),Ei(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,i="leaflet-disabled";mi(this._zoomInButton,i),mi(this._zoomOutButton,i),!this._disabled&&t._zoom!==t.getMinZoom()||pi(this._zoomOutButton,i),!this._disabled&&t._zoom!==t.getMaxZoom()||pi(this._zoomInButton,i)}});Ji.mergeOptions({zoomControl:!0}),Ji.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new ie,this.addControl(this.zoomControl))});var ee=Qi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var i="leaflet-control-scale",e=hi("div",i),n=this.options;return this._addScales(n,i+"-line",e),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),e},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,i,e){t.metric&&(this._mScale=hi("div",i,e)),t.imperial&&(this._iScale=hi("div",i,e))},_update:function(){var t=this._map,i=t.getSize().y/2,e=t.distance(t.containerPointToLatLng([0,i]),t.containerPointToLatLng([this.options.maxWidth,i]));this._updateScales(e)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var i=this._getRoundNum(t),e=i<1e3?i+" m":i/1e3+" km";this._updateScale(this._mScale,e,i/t)},_updateImperial:function(t){var i,e,n,o=3.2808399*t;5280Leaflet'},initialize:function(t){p(this,t),this._attributions={}},onAdd:function(t){for(var i in(t.attributionControl=this)._container=hi("div","leaflet-control-attribution"),Ni(this._container),t._layers)t._layers[i].getAttribution&&this.addAttribution(t._layers[i].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var t=[];for(var i in this._attributions)this._attributions[i]&&t.push(i);var e=[];this.options.prefix&&e.push(this.options.prefix),t.length&&e.push(t.join(", ")),this._container.innerHTML=e.join(" | ")}}});Ji.mergeOptions({attributionControl:!0}),Ji.addInitHook(function(){this.options.attributionControl&&(new ne).addTo(this)});Qi.Layers=te,Qi.Zoom=ie,Qi.Scale=ee,Qi.Attribution=ne,$i.layers=function(t,i,e){return new te(t,i,e)},$i.zoom=function(t){return new ie(t)},$i.scale=function(t){return new ee(t)},$i.attribution=function(t){return new ne(t)};var oe=Z.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}});oe.addTo=function(t,i){return t.addHandler(i,this),this};var se,re={Events:E},ae=Tt?"touchstart mousedown":"mousedown",he={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},ue={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},le=k.extend({options:{clickTolerance:3},initialize:function(t,i,e,n){p(this,n),this._element=t,this._dragStartTarget=i||t,this._preventOutline=e},enable:function(){this._enabled||(Ei(this._dragStartTarget,ae,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(le._dragging===this&&this.finishDrag(),Bi(this._dragStartTarget,ae,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!di(this._element,"leaflet-zoom-anim")&&!(le._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||((le._dragging=this)._preventOutline&&zi(this._element),bi(),$t(),this._moving)))){this.fire("down");var i=t.touches?t.touches[0]:t,e=Ci(this._element);this._startPoint=new B(i.clientX,i.clientY),this._parentScale=Si(e),Ei(document,ue[t.type],this._onMove,this),Ei(document,he[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&1i.max.x&&(e|=2),t.yi.max.y&&(e|=8),e}function fe(t,i,e,n){var o,s=i.x,r=i.y,a=e.x-s,h=e.y-r,u=a*a+h*h;return 0this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()t.y!=n.y>t.y&&t.x<(n.x-e.x)*(t.y-e.y)/(n.y-e.y)+e.x&&(u=!u);return u||De.prototype._containsPoint.call(this,t,!0)}});var We=Ee.extend({initialize:function(t,i){p(this,i),this._layers={},t&&this.addData(t)},addData:function(t){var i,e,n,o=v(t)?t:t.features;if(o){for(i=0,e=o.length;iu.x&&(l=s.x+n-u.x+h.x),s.x-l-a.x<0&&(l=s.x-a.x),s.y+e+h.y>u.y&&(c=s.y+e-u.y+h.y),s.y-c-a.y<0&&(c=s.y-a.y),(l||c)&&t.fire("autopanstart").panBy([l,c])}},_onCloseButtonClick:function(t){this._close(),ji(t)},_getAnchor:function(){return I(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}});Ji.mergeOptions({closePopupOnClick:!0}),Ji.include({openPopup:function(t,i,e){return t instanceof nn||(t=new nn(e).setContent(t)),i&&t.setLatLng(i),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Se.include({bindPopup:function(t,i){return t instanceof nn?(p(t,i),(this._popup=t)._source=this):(this._popup&&!i||(this._popup=new nn(i,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,i){return this._popup&&this._map&&(i=this._popup._prepareOpen(this,t,i),this._map.openPopup(this._popup,i)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var i=t.layer||t.target;this._popup&&this._map&&(ji(t),i instanceof Oe?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===i?this.closePopup():this.openPopup(i,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var on=en.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){en.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){en.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=en.prototype.getEvents.call(this);return Tt&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=hi("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var i=this._map,e=this._container,n=i.latLngToContainerPoint(i.getCenter()),o=i.layerPointToContainerPoint(t),s=this.options.direction,r=e.offsetWidth,a=e.offsetHeight,h=I(this.options.offset),u=this._getAnchor();t="top"===s?t.add(I(-r/2+h.x,-a+h.y+u.y,!0)):"bottom"===s?t.subtract(I(r/2-h.x,-h.y,!0)):"center"===s?t.subtract(I(r/2+h.x,a/2-u.y+h.y,!0)):"right"===s||"auto"===s&&o.xthis.options.maxZoom||ethis.options.maxZoom||void 0!==this.options.minZoom&&oe.max.x)||!i.wrapLat&&(t.ye.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return D(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var i=this._map,e=this.getTileSize(),n=t.scaleBy(e),o=n.add(e);return[i.unproject(n,t.z),i.unproject(o,t.z)]},_tileCoordsToBounds:function(t){var i=this._tileCoordsToNwSe(t),e=new N(i[0],i[1]);return this.options.noWrap||(e=this._map.wrapLatLngBounds(e)),e},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var i=t.split(":"),e=new B(+i[0],+i[1]);return e.z=+i[2],e},_removeTile:function(t){var i=this._tiles[t];i&&(ui(i.el),delete this._tiles[t],this.fire("tileunload",{tile:i.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){pi(t,"leaflet-tile");var i=this.getTileSize();t.style.width=i.x+"px",t.style.height=i.y+"px",t.onselectstart=l,t.onmousemove=l,et&&this.options.opacity<1&&vi(t,this.options.opacity),st&&!rt&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,i){var e=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),a(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&M(a(this._tileReady,this,t,null,o)),wi(o,e),this._tiles[n]={el:o,coords:t,current:!0},i.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,i,e){i&&this.fire("tileerror",{error:i,tile:e,coords:t});var n=this._tileCoordsToKey(t);(e=this._tiles[n])&&(e.loaded=+new Date,this._map._fadeAnimated?(vi(e.el,0),C(this._fadeFrame),this._fadeFrame=M(this._updateOpacity,this)):(e.active=!0,this._pruneTiles()),i||(pi(e.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:e.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),et||!this._map._fadeAnimated?M(this._pruneTiles,this):setTimeout(a(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var i=new B(this._wrapX?r(t.x,this._wrapX):t.x,this._wrapY?r(t.y,this._wrapY):t.y);return i.z=t.z,i},_pxBoundsToTileRange:function(t){var i=this.getTileSize();return new O(t.min.unscaleBy(i).floor(),t.max.unscaleBy(i).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});var an=rn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,i){this._url=t,(i=p(this,i)).detectRetina&&Ct&&0')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),pn={_initContainer:function(){this._container=hi("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(ln.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var i=t._container=dn("shape");pi(i,"leaflet-vml-shape "+(this.options.className||"")),i.coordsize="1 1",t._path=dn("path"),i.appendChild(t._path),this._updateStyle(t),this._layers[u(t)]=t},_addPath:function(t){var i=t._container;this._container.appendChild(i),t.options.interactive&&t.addInteractiveTarget(i)},_removePath:function(t){var i=t._container;ui(i),t.removeInteractiveTarget(i),delete this._layers[u(t)]},_updateStyle:function(t){var i=t._stroke,e=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(i||(i=t._stroke=dn("stroke")),o.appendChild(i),i.weight=n.weight+"px",i.color=n.color,i.opacity=n.opacity,n.dashArray?i.dashStyle=v(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):i.dashStyle="",i.endcap=n.lineCap.replace("butt","flat"),i.joinstyle=n.lineJoin):i&&(o.removeChild(i),t._stroke=null),n.fill?(e||(e=t._fill=dn("fill")),o.appendChild(e),e.color=n.fillColor||n.color,e.opacity=n.fillOpacity):e&&(o.removeChild(e),t._fill=null)},_updateCircle:function(t){var i=t._point.round(),e=Math.round(t._radius),n=Math.round(t._radiusY||e);this._setPath(t,t._empty()?"M0 0":"AL "+i.x+","+i.y+" "+e+","+n+" 0,23592600")},_setPath:function(t,i){t._path.v=i},_bringToFront:function(t){ci(t._container)},_bringToBack:function(t){_i(t._container)}},mn=Et?dn:$,fn=ln.extend({getEvents:function(){var t=ln.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=mn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=mn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ui(this._container),Bi(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){ln.prototype._update.call(this);var t=this._bounds,i=t.getSize(),e=this._container;this._svgSize&&this._svgSize.equals(i)||(this._svgSize=i,e.setAttribute("width",i.x),e.setAttribute("height",i.y)),wi(e,t.min),e.setAttribute("viewBox",[t.min.x,t.min.y,i.x,i.y].join(" ")),this.fire("update")}},_initPath:function(t){var i=t._path=mn("path");t.options.className&&pi(i,t.options.className),t.options.interactive&&pi(i,"leaflet-interactive"),this._updateStyle(t),this._layers[u(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ui(t._path),t.removeInteractiveTarget(t._path),delete this._layers[u(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var i=t._path,e=t.options;i&&(e.stroke?(i.setAttribute("stroke",e.color),i.setAttribute("stroke-opacity",e.opacity),i.setAttribute("stroke-width",e.weight),i.setAttribute("stroke-linecap",e.lineCap),i.setAttribute("stroke-linejoin",e.lineJoin),e.dashArray?i.setAttribute("stroke-dasharray",e.dashArray):i.removeAttribute("stroke-dasharray"),e.dashOffset?i.setAttribute("stroke-dashoffset",e.dashOffset):i.removeAttribute("stroke-dashoffset")):i.setAttribute("stroke","none"),e.fill?(i.setAttribute("fill",e.fillColor||e.color),i.setAttribute("fill-opacity",e.fillOpacity),i.setAttribute("fill-rule",e.fillRule||"evenodd")):i.setAttribute("fill","none"))},_updatePoly:function(t,i){this._setPath(t,Q(t._parts,i))},_updateCircle:function(t){var i=t._point,e=Math.max(Math.round(t._radius),1),n="a"+e+","+(Math.max(Math.round(t._radiusY),1)||e)+" 0 1,0 ",o=t._empty()?"M0 0":"M"+(i.x-e)+","+i.y+n+2*e+",0 "+n+2*-e+",0 ";this._setPath(t,o)},_setPath:function(t,i){t._path.setAttribute("d",i)},_bringToFront:function(t){ci(t._path)},_bringToBack:function(t){_i(t._path)}});function gn(t){return Zt||Et?new fn(t):null}Et&&fn.include(pn),Ji.include({getRenderer:function(t){var i=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return i||(i=this._renderer=this._createRenderer()),this.hasLayer(i)||this.addLayer(i),i},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var i=this._paneRenderers[t];return void 0===i&&(i=this._createRenderer({pane:t}),this._paneRenderers[t]=i),i},_createRenderer:function(t){return this.options.preferCanvas&&_n(t)||gn(t)}});var vn=je.extend({initialize:function(t,i){je.prototype.initialize.call(this,this._boundsToLatLngs(t),i)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=D(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});fn.create=mn,fn.pointsToPath=Q,We.geometryToLayer=He,We.coordsToLatLng=Fe,We.coordsToLatLngs=Ue,We.latLngToCoords=Ve,We.latLngsToCoords=qe,We.getFeature=Ge,We.asFeature=Ke,Ji.mergeOptions({boxZoom:!0});var yn=oe.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){Ei(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Bi(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ui(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),$t(),bi(),this._startPoint=this._map.mouseEventToContainerPoint(t),Ei(document,{contextmenu:ji,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=hi("div","leaflet-zoom-box",this._container),pi(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var i=new O(this._point,this._startPoint),e=i.getSize();wi(this._box,i.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(ui(this._box),mi(this._container,"leaflet-crosshair")),Qt(),Ti(),Bi(document,{contextmenu:ji,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(a(this._resetState,this),0);var i=new N(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(i).fire("boxzoomend",{boxZoomBounds:i})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});Ji.addInitHook("addHandler","boxZoom",yn),Ji.mergeOptions({doubleClickZoom:!0});var xn=oe.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var i=this._map,e=i.getZoom(),n=i.options.zoomDelta,o=t.originalEvent.shiftKey?e-n:e+n;"center"===i.options.doubleClickZoom?i.setZoom(o):i.setZoomAround(t.containerPoint,o)}});Ji.addInitHook("addHandler","doubleClickZoom",xn),Ji.mergeOptions({dragging:!0,inertia:!rt,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var wn=oe.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new le(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}pi(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){mi(this._map._container,"leaflet-grab"),mi(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var i=D(this._map.options.maxBounds);this._offsetLimit=R(this._map.latLngToContainerPoint(i.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(i.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var i=this._lastTime=+new Date,e=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(e),this._times.push(i),this._prunePositions(i)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;1i.max.x&&(t.x=this._viscousLimit(t.x,i.max.x)),t.y>i.max.y&&(t.y=this._viscousLimit(t.y,i.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,i=Math.round(t/2),e=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-i+e)%t+i-e,s=(n+i+e)%t-i-e,r=Math.abs(o+e)i.getMaxZoom()&&1
Date: Wed, 14 Feb 2024 17:22:51 +0000
Subject: [PATCH 11/12] Requiring review from 'gnarza' ci bypass
---
.github/code-review/require-person/{cynhu92 => gnarza}/PR-50 | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename .github/code-review/require-person/{cynhu92 => gnarza}/PR-50 (100%)
diff --git a/.github/code-review/require-person/cynhu92/PR-50 b/.github/code-review/require-person/gnarza/PR-50
similarity index 100%
rename from .github/code-review/require-person/cynhu92/PR-50
rename to .github/code-review/require-person/gnarza/PR-50
From ed3d4ae709ce79506fb3eaff150a86bc03f060a1 Mon Sep 17 00:00:00 2001
From: otto-bot-git
Date: Wed, 14 Feb 2024 17:23:02 +0000
Subject: [PATCH 12/12] Requiring review from 'cynhu92' ci bypass
---
.github/code-review/require-person/cynhu92/PR-50 | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 .github/code-review/require-person/cynhu92/PR-50
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 0000000..e69de29