@tabler/core 1.0.0-beta16 → 1.0.0-beta18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +25 -9
  3. package/dist/.DS_Store +0 -0
  4. package/dist/css/demo.css +27 -52
  5. package/dist/css/demo.min.css +5 -5
  6. package/dist/css/demo.rtl.css +27 -52
  7. package/dist/css/demo.rtl.min.css +5 -5
  8. package/dist/css/tabler-flags.css +9 -7
  9. package/dist/css/tabler-flags.min.css +5 -5
  10. package/dist/css/tabler-flags.rtl.css +9 -7
  11. package/dist/css/tabler-flags.rtl.min.css +5 -5
  12. package/dist/css/tabler-payments.css +16 -6
  13. package/dist/css/tabler-payments.min.css +5 -5
  14. package/dist/css/tabler-payments.rtl.css +16 -6
  15. package/dist/css/tabler-payments.rtl.min.css +5 -5
  16. package/dist/css/tabler-social.css +10 -0
  17. package/dist/css/tabler-social.min.css +8 -0
  18. package/dist/css/tabler-social.rtl.css +10 -0
  19. package/dist/css/tabler-social.rtl.min.css +8 -0
  20. package/dist/css/tabler-vendors.css +105 -46
  21. package/dist/css/tabler-vendors.min.css +5 -5
  22. package/dist/css/tabler-vendors.rtl.css +105 -46
  23. package/dist/css/tabler-vendors.rtl.min.css +5 -5
  24. package/dist/css/tabler.css +4967 -2563
  25. package/dist/css/tabler.min.css +9 -10
  26. package/dist/css/tabler.rtl.css +4966 -2563
  27. package/dist/css/tabler.rtl.min.css +9 -10
  28. package/dist/img/payments/epayco-dark.svg +1 -0
  29. package/dist/img/payments/epayco.svg +1 -0
  30. package/dist/js/demo-theme.js +11 -8
  31. package/dist/js/demo-theme.min.js +5 -5
  32. package/dist/js/demo.js +45 -42
  33. package/dist/js/demo.min.js +5 -5
  34. package/dist/js/tabler.esm.js +2274 -3125
  35. package/dist/js/tabler.esm.min.js +8 -8
  36. package/dist/js/tabler.js +2274 -3125
  37. package/dist/js/tabler.min.js +8 -8
  38. package/dist/libs/apexcharts/dist/apexcharts.amd.js +1 -1
  39. package/dist/libs/apexcharts/dist/apexcharts.common.js +5 -5
  40. package/dist/libs/apexcharts/dist/apexcharts.esm.js +5 -5
  41. package/dist/libs/apexcharts/dist/apexcharts.js +3010 -2741
  42. package/dist/libs/apexcharts/dist/apexcharts.min.js +5 -5
  43. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js +659 -1448
  44. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js.map +1 -1
  45. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js +3 -3
  46. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -1
  47. package/dist/libs/bootstrap/dist/js/bootstrap.esm.js +628 -1416
  48. package/dist/libs/bootstrap/dist/js/bootstrap.esm.js.map +1 -1
  49. package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js +3 -3
  50. package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js.map +1 -1
  51. package/dist/libs/bootstrap/dist/js/bootstrap.js +631 -1420
  52. package/dist/libs/bootstrap/dist/js/bootstrap.js.map +1 -1
  53. package/dist/libs/bootstrap/dist/js/bootstrap.min.js +3 -3
  54. package/dist/libs/bootstrap/dist/js/bootstrap.min.js.map +1 -1
  55. package/dist/libs/countup.js/dist/countUp.d.ts +8 -3
  56. package/dist/libs/countup.js/dist/countUp.js +26 -8
  57. package/dist/libs/countup.js/dist/countUp.min.js +1 -1
  58. package/dist/libs/countup.js/dist/countUp.umd.js +1 -293
  59. package/dist/libs/countup.js/dist/requestAnimationFrame.polyfill.js +26 -0
  60. package/dist/libs/fslightbox/README.md +39 -33
  61. package/dist/libs/fslightbox/index.js +1 -1
  62. package/dist/libs/fslightbox/package.json +10 -44
  63. package/dist/libs/jsvectormap/dist/js/jsvectormap.js +517 -857
  64. package/dist/libs/jsvectormap/dist/js/jsvectormap.min.js +1 -1
  65. package/dist/libs/nouislider/dist/nouislider.d.ts +2 -0
  66. package/dist/libs/nouislider/dist/nouislider.js +28 -0
  67. package/dist/libs/nouislider/dist/nouislider.min.js +1 -1
  68. package/dist/libs/nouislider/dist/nouislider.min.mjs +1 -1
  69. package/dist/libs/nouislider/dist/nouislider.mjs +28 -0
  70. package/dist/libs/plyr/dist/plyr.css +1 -1
  71. package/dist/libs/plyr/dist/plyr.js +2225 -2231
  72. package/dist/libs/plyr/dist/plyr.min.js +1 -1
  73. package/dist/libs/plyr/dist/plyr.min.js.map +1 -1
  74. package/dist/libs/plyr/dist/plyr.min.mjs +1 -1
  75. package/dist/libs/plyr/dist/plyr.min.mjs.map +1 -1
  76. package/dist/libs/plyr/dist/plyr.mjs +2225 -2231
  77. package/dist/libs/plyr/dist/plyr.polyfilled.js +2239 -2310
  78. package/dist/libs/plyr/dist/plyr.polyfilled.min.js +1 -1
  79. package/dist/libs/plyr/dist/plyr.polyfilled.min.js.map +1 -1
  80. package/dist/libs/plyr/dist/plyr.polyfilled.min.mjs +1 -1
  81. package/dist/libs/plyr/dist/plyr.polyfilled.min.mjs.map +1 -1
  82. package/dist/libs/plyr/dist/plyr.polyfilled.mjs +2239 -2310
  83. package/dist/libs/tinymce/CHANGELOG.md +161 -0
  84. package/dist/libs/tinymce/composer.json +1 -1
  85. package/dist/libs/tinymce/icons/default/icons.js +6 -1
  86. package/dist/libs/tinymce/icons/default/icons.min.js +1 -1
  87. package/dist/libs/tinymce/models/dom/model.js +79 -23
  88. package/dist/libs/tinymce/models/dom/model.min.js +2 -2
  89. package/dist/libs/tinymce/package.json +1 -1
  90. package/dist/libs/tinymce/plugins/advlist/plugin.js +34 -28
  91. package/dist/libs/tinymce/plugins/advlist/plugin.min.js +2 -2
  92. package/dist/libs/tinymce/plugins/anchor/plugin.js +1 -1
  93. package/dist/libs/tinymce/plugins/anchor/plugin.min.js +1 -1
  94. package/dist/libs/tinymce/plugins/autolink/plugin.js +1 -1
  95. package/dist/libs/tinymce/plugins/autolink/plugin.min.js +1 -1
  96. package/dist/libs/tinymce/plugins/autoresize/plugin.js +46 -11
  97. package/dist/libs/tinymce/plugins/autoresize/plugin.min.js +2 -2
  98. package/dist/libs/tinymce/plugins/autosave/plugin.js +1 -1
  99. package/dist/libs/tinymce/plugins/autosave/plugin.min.js +1 -1
  100. package/dist/libs/tinymce/plugins/charmap/plugin.js +1 -1
  101. package/dist/libs/tinymce/plugins/charmap/plugin.min.js +1 -1
  102. package/dist/libs/tinymce/plugins/code/plugin.js +1 -1
  103. package/dist/libs/tinymce/plugins/code/plugin.min.js +1 -1
  104. package/dist/libs/tinymce/plugins/codesample/plugin.js +1 -1
  105. package/dist/libs/tinymce/plugins/codesample/plugin.min.js +1 -1
  106. package/dist/libs/tinymce/plugins/directionality/plugin.js +1 -1
  107. package/dist/libs/tinymce/plugins/directionality/plugin.min.js +1 -1
  108. package/dist/libs/tinymce/plugins/emoticons/plugin.js +1 -1
  109. package/dist/libs/tinymce/plugins/emoticons/plugin.min.js +1 -1
  110. package/dist/libs/tinymce/plugins/fullscreen/plugin.js +1 -1
  111. package/dist/libs/tinymce/plugins/fullscreen/plugin.min.js +1 -1
  112. package/dist/libs/tinymce/plugins/help/plugin.js +25 -7
  113. package/dist/libs/tinymce/plugins/help/plugin.min.js +2 -2
  114. package/dist/libs/tinymce/plugins/image/plugin.js +1 -1
  115. package/dist/libs/tinymce/plugins/image/plugin.min.js +1 -1
  116. package/dist/libs/tinymce/plugins/importcss/plugin.js +1 -1
  117. package/dist/libs/tinymce/plugins/importcss/plugin.min.js +1 -1
  118. package/dist/libs/tinymce/plugins/insertdatetime/plugin.js +1 -1
  119. package/dist/libs/tinymce/plugins/insertdatetime/plugin.min.js +1 -1
  120. package/dist/libs/tinymce/plugins/link/plugin.js +32 -9
  121. package/dist/libs/tinymce/plugins/link/plugin.min.js +2 -2
  122. package/dist/libs/tinymce/plugins/lists/plugin.js +132 -50
  123. package/dist/libs/tinymce/plugins/lists/plugin.min.js +2 -2
  124. package/dist/libs/tinymce/plugins/media/plugin.js +7 -2
  125. package/dist/libs/tinymce/plugins/media/plugin.min.js +2 -2
  126. package/dist/libs/tinymce/plugins/nonbreaking/plugin.js +1 -1
  127. package/dist/libs/tinymce/plugins/nonbreaking/plugin.min.js +1 -1
  128. package/dist/libs/tinymce/plugins/pagebreak/plugin.js +1 -1
  129. package/dist/libs/tinymce/plugins/pagebreak/plugin.min.js +1 -1
  130. package/dist/libs/tinymce/plugins/preview/plugin.js +1 -1
  131. package/dist/libs/tinymce/plugins/preview/plugin.min.js +1 -1
  132. package/dist/libs/tinymce/plugins/quickbars/plugin.js +39 -24
  133. package/dist/libs/tinymce/plugins/quickbars/plugin.min.js +2 -2
  134. package/dist/libs/tinymce/plugins/save/plugin.js +1 -1
  135. package/dist/libs/tinymce/plugins/save/plugin.min.js +1 -1
  136. package/dist/libs/tinymce/plugins/searchreplace/plugin.js +56 -43
  137. package/dist/libs/tinymce/plugins/searchreplace/plugin.min.js +2 -2
  138. package/dist/libs/tinymce/plugins/table/plugin.js +73 -55
  139. package/dist/libs/tinymce/plugins/table/plugin.min.js +2 -2
  140. package/dist/libs/tinymce/plugins/template/plugin.js +17 -14
  141. package/dist/libs/tinymce/plugins/template/plugin.min.js +2 -2
  142. package/dist/libs/tinymce/plugins/visualblocks/plugin.js +1 -1
  143. package/dist/libs/tinymce/plugins/visualblocks/plugin.min.js +1 -1
  144. package/dist/libs/tinymce/plugins/visualchars/plugin.js +58 -7
  145. package/dist/libs/tinymce/plugins/visualchars/plugin.min.js +2 -2
  146. package/dist/libs/tinymce/plugins/wordcount/plugin.js +1 -1
  147. package/dist/libs/tinymce/plugins/wordcount/plugin.min.js +1 -1
  148. package/dist/libs/tinymce/skins/ui/oxide/content.css +3 -0
  149. package/dist/libs/tinymce/skins/ui/oxide/content.inline.css +3 -0
  150. package/dist/libs/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
  151. package/dist/libs/tinymce/skins/ui/oxide/content.min.css +1 -1
  152. package/dist/libs/tinymce/skins/ui/oxide/skin.css +567 -45
  153. package/dist/libs/tinymce/skins/ui/oxide/skin.min.css +1 -1
  154. package/dist/libs/tinymce/skins/ui/oxide-dark/content.css +3 -0
  155. package/dist/libs/tinymce/skins/ui/oxide-dark/content.inline.css +3 -0
  156. package/dist/libs/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
  157. package/dist/libs/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
  158. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.css +561 -39
  159. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  160. package/dist/libs/tinymce/skins/ui/tinymce-5/content.css +3 -0
  161. package/dist/libs/tinymce/skins/ui/tinymce-5/content.inline.css +3 -0
  162. package/dist/libs/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -1
  163. package/dist/libs/tinymce/skins/ui/tinymce-5/content.min.css +1 -1
  164. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.css +571 -45
  165. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
  166. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.css +3 -0
  167. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.inline.css +3 -0
  168. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
  169. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -1
  170. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.css +564 -38
  171. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
  172. package/dist/libs/tinymce/themes/silver/theme.js +5391 -2074
  173. package/dist/libs/tinymce/themes/silver/theme.min.js +2 -2
  174. package/dist/libs/tinymce/tinymce.d.ts +361 -247
  175. package/dist/libs/tinymce/tinymce.js +2471 -1869
  176. package/dist/libs/tinymce/tinymce.min.js +2 -2
  177. package/package.json +68 -53
  178. package/src/js/demo-theme.js +13 -10
  179. package/src/js/demo.js +18 -15
  180. package/src/js/tabler.esm.js +7 -8
  181. package/src/js/tabler.js +12 -12
  182. package/src/scss/_bootstrap-components.scss +33 -33
  183. package/src/scss/_bootstrap-config.scss +6 -5
  184. package/src/scss/_bootstrap-override.scss +8 -12
  185. package/src/scss/_config.scss +2 -1
  186. package/src/scss/_core.scss +2 -1
  187. package/src/scss/_debug.scss +41 -30
  188. package/src/scss/_utilities.scss +21 -19
  189. package/src/scss/_variables-dark.scss +17 -0
  190. package/src/scss/_variables.scss +256 -172
  191. package/src/scss/demo/_examples.scss +1 -17
  192. package/src/scss/demo.scss +36 -25
  193. package/src/scss/layout/_core.scss +1 -2
  194. package/src/scss/layout/_dark.scss +47 -168
  195. package/src/scss/layout/_navbar.scss +84 -94
  196. package/src/scss/layout/_page.scss +35 -6
  197. package/src/scss/layout/_root.scss +22 -6
  198. package/src/scss/mixins/_functions.scss +2 -6
  199. package/src/scss/mixins/_mixins.scss +11 -38
  200. package/src/scss/tabler-social.scss +1 -0
  201. package/src/scss/tabler.scss +0 -1
  202. package/src/scss/ui/_avatars.scss +18 -10
  203. package/src/scss/ui/_buttons.scss +3 -1
  204. package/src/scss/ui/_cards.scss +2 -2
  205. package/src/scss/ui/_dropdowns.scss +1 -3
  206. package/src/scss/ui/_forms.scss +2 -1
  207. package/src/scss/ui/_grid.scss +0 -16
  208. package/src/scss/ui/_lists.scss +0 -95
  209. package/src/scss/ui/_pagination.scss +1 -1
  210. package/src/scss/ui/_payments.scss +1 -1
  211. package/src/scss/ui/_progress.scss +1 -1
  212. package/src/scss/ui/_status.scss +1 -11
  213. package/src/scss/ui/_tables.scss +2 -17
  214. package/src/scss/ui/_timeline.scss +61 -0
  215. package/src/scss/ui/_type.scss +6 -4
  216. package/src/scss/ui/forms/_form-imagecheck.scss +1 -1
  217. package/src/scss/utils/_colors.scss +7 -3
  218. package/src/scss/vendor/_apexcharts.scss +16 -0
  219. package/src/scss/vendor/_dropzone.scss +2 -2
  220. package/src/scss/vendor/_jsvectormap.scss +1 -1
  221. package/src/scss/vendor/_nouislider.scss +1 -1
  222. package/src/scss/vendor/_tinymce.scss +5 -7
  223. package/src/scss/vendor/_tom-select.scss +44 -2
  224. package/dist/libs/countup.js/dist/countUp.withPolyfill.min.js +0 -1
  225. package/dist/libs/fslightbox/jest-setup.js +0 -1
@@ -4,21 +4,72 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.jsVectorMap = factory());
5
5
  })(this, (function () { 'use strict';
6
6
 
7
+ function _inheritsLoose(subClass, superClass) {
8
+ subClass.prototype = Object.create(superClass.prototype);
9
+ subClass.prototype.constructor = subClass;
10
+ _setPrototypeOf(subClass, superClass);
11
+ }
12
+ function _setPrototypeOf(o, p) {
13
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
14
+ o.__proto__ = p;
15
+ return o;
16
+ };
17
+ return _setPrototypeOf(o, p);
18
+ }
19
+ function _assertThisInitialized(self) {
20
+ if (self === void 0) {
21
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
22
+ }
23
+ return self;
24
+ }
25
+ function _readOnlyError(name) {
26
+ throw new TypeError("\"" + name + "\" is read-only");
27
+ }
28
+ function _unsupportedIterableToArray(o, minLen) {
29
+ if (!o) return;
30
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
31
+ var n = Object.prototype.toString.call(o).slice(8, -1);
32
+ if (n === "Object" && o.constructor) n = o.constructor.name;
33
+ if (n === "Map" || n === "Set") return Array.from(o);
34
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
35
+ }
36
+ function _arrayLikeToArray(arr, len) {
37
+ if (len == null || len > arr.length) len = arr.length;
38
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
39
+ return arr2;
40
+ }
41
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
42
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
43
+ if (it) return (it = it.call(o)).next.bind(it);
44
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
45
+ if (it) o = it;
46
+ var i = 0;
47
+ return function () {
48
+ if (i >= o.length) return {
49
+ done: true
50
+ };
51
+ return {
52
+ done: false,
53
+ value: o[i++]
54
+ };
55
+ };
56
+ }
57
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
58
+ }
59
+
7
60
  // Matches polyfill
8
61
  // https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
9
62
  if (!Element.prototype.matches) {
10
63
  Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function (s) {
11
- var matches = (this.document || this.ownerDocument).querySelectorAll(s),
12
- i = matches.length;
13
-
14
- while (--i >= 0 && matches.item(i) !== this) {}
15
-
64
+ var matches = (this.document || this.ownerDocument).querySelectorAll(s);
65
+ var i = matches.length;
66
+ while ((_readOnlyError("i")) >= 0 && matches.item(i) !== this) {}
16
67
  return i > -1;
17
68
  };
18
- } // Object.assign polyfill
19
- // https://gist.github.com/spiralx/68cf40d7010d829340cb
20
-
69
+ }
21
70
 
71
+ // Object.assign polyfill
72
+ // https://gist.github.com/spiralx/68cf40d7010d829340cb
22
73
  if (!Object.assign) {
23
74
  Object.defineProperty(Object, 'assign', {
24
75
  enumerable: false,
@@ -29,29 +80,22 @@
29
80
  if (target === undefined || target === null) {
30
81
  throw new TypeError('Cannot convert first argument to object');
31
82
  }
32
-
33
83
  var to = Object(target);
34
-
35
84
  for (var i = 1; i < arguments.length; i++) {
36
85
  var nextSource = arguments[i];
37
-
38
86
  if (nextSource === undefined || nextSource === null) {
39
87
  continue;
40
88
  }
41
-
42
89
  nextSource = Object(nextSource);
43
90
  var keysArray = Object.keys(Object(nextSource));
44
-
45
91
  for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
46
92
  var nextKey = keysArray[nextIndex];
47
93
  var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
48
-
49
94
  if (desc !== undefined && desc.enumerable) {
50
95
  to[nextKey] = nextSource[nextKey];
51
96
  }
52
97
  }
53
98
  }
54
-
55
99
  return to;
56
100
  }
57
101
  });
@@ -64,70 +108,58 @@
64
108
  var isMergeableObject = function isMergeableObject(value) {
65
109
  return isNonNullObject(value) && !isSpecial(value);
66
110
  };
67
-
68
111
  function isNonNullObject(value) {
69
112
  return !!value && typeof value === 'object';
70
113
  }
71
-
72
114
  function isSpecial(value) {
73
115
  var stringValue = Object.prototype.toString.call(value);
74
116
  return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isNode(value) || isReactElement(value);
75
- } // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
76
-
117
+ }
77
118
 
119
+ // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
78
120
  var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
79
121
  var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
80
-
81
122
  function isReactElement(value) {
82
123
  return value.$$typeof === REACT_ELEMENT_TYPE;
83
124
  }
84
-
85
125
  function isNode(value) {
86
126
  return value instanceof Node;
87
127
  }
88
-
89
128
  function emptyTarget(val) {
90
129
  return Array.isArray(val) ? [] : {};
91
130
  }
92
-
93
131
  function cloneUnlessOtherwiseSpecified(value, options) {
94
132
  return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
95
133
  }
96
-
97
134
  function defaultArrayMerge(target, source, options) {
98
135
  return target.concat(source).map(function (element) {
99
136
  return cloneUnlessOtherwiseSpecified(element, options);
100
137
  });
101
138
  }
102
-
103
139
  function getMergeFunction(key, options) {
104
140
  if (!options.customMerge) {
105
141
  return deepmerge;
106
142
  }
107
-
108
143
  var customMerge = options.customMerge(key);
109
144
  return typeof customMerge === 'function' ? customMerge : deepmerge;
110
145
  }
111
-
112
146
  function getEnumerableOwnPropertySymbols(target) {
113
147
  return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function (symbol) {
114
148
  return target.propertyIsEnumerable(symbol);
115
149
  }) : [];
116
150
  }
117
-
118
151
  function getKeys(target) {
119
152
  return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
120
153
  }
121
-
122
154
  function propertyIsOnObject(object, property) {
123
155
  try {
124
156
  return property in object;
125
157
  } catch (_) {
126
158
  return false;
127
159
  }
128
- } // Protects from prototype poisoning and unexpected merging up the prototype chain.
129
-
160
+ }
130
161
 
162
+ // Protects from prototype poisoning and unexpected merging up the prototype chain.
131
163
  function propertyIsUnsafe(target, key) {
132
164
  return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
133
165
  && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
@@ -136,18 +168,15 @@
136
168
 
137
169
  function mergeObject(target, source, options) {
138
170
  var destination = {};
139
-
140
171
  if (options.isMergeableObject(target)) {
141
172
  getKeys(target).forEach(function (key) {
142
173
  destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
143
174
  });
144
175
  }
145
-
146
176
  getKeys(source).forEach(function (key) {
147
177
  if (propertyIsUnsafe(target, key)) {
148
178
  return;
149
179
  }
150
-
151
180
  if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
152
181
  destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
153
182
  } else {
@@ -156,18 +185,16 @@
156
185
  });
157
186
  return destination;
158
187
  }
159
-
160
188
  var deepmerge = function deepmerge(target, source, options) {
161
189
  options = options || {};
162
190
  options.arrayMerge = options.arrayMerge || defaultArrayMerge;
163
- options.isMergeableObject = options.isMergeableObject || isMergeableObject; // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
191
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
192
+ // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
164
193
  // implementations can use it. The caller may not replace it.
165
-
166
194
  options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
167
195
  var sourceIsArray = Array.isArray(source);
168
196
  var targetIsArray = Array.isArray(target);
169
197
  var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
170
-
171
198
  if (!sourceAndTargetTypesMatch) {
172
199
  return cloneUnlessOtherwiseSpecified(source, options);
173
200
  } else if (sourceIsArray) {
@@ -182,89 +209,71 @@
182
209
  * Public Util Api
183
210
  * --------------------------------------------------------------------------
184
211
  */
185
-
186
212
  var getElement = function getElement(selector) {
187
213
  if (typeof selector === 'object' && typeof selector.nodeType !== 'undefined') {
188
214
  return selector;
189
215
  }
190
-
191
216
  if (typeof selector === 'string') {
192
217
  return document.querySelector(selector);
193
218
  }
194
-
195
219
  return null;
196
220
  };
197
-
198
221
  var createElement = function createElement(type, classes, content, html) {
199
222
  if (html === void 0) {
200
223
  html = false;
201
224
  }
202
-
203
225
  var el = document.createElement(type);
204
-
205
226
  if (content) {
206
227
  el[!html ? 'textContent' : 'innerHTML'] = content;
207
228
  }
208
-
209
229
  if (classes) {
210
230
  el.className = classes;
211
231
  }
212
-
213
232
  return el;
214
233
  };
215
-
216
234
  var findElement = function findElement(parentElement, selector) {
217
235
  return Element.prototype.querySelector.call(parentElement, selector);
218
236
  };
219
-
220
237
  var removeElement = function removeElement(target) {
221
238
  target.parentNode.removeChild(target);
222
239
  };
223
-
224
240
  var isImageUrl = function isImageUrl(url) {
225
241
  return /\.(jpg|gif|png)$/.test(url);
226
242
  };
227
-
228
243
  var hyphenate = function hyphenate(string) {
229
244
  return string.replace(/[\w]([A-Z])/g, function (m) {
230
245
  return m[0] + "-" + m[1];
231
246
  }).toLowerCase();
232
247
  };
233
-
234
248
  var merge = function merge(target, source, deep) {
235
249
  if (deep === void 0) {
236
250
  deep = false;
237
251
  }
238
-
239
252
  if (deep) {
240
253
  return deepmerge(target, source);
241
254
  }
242
-
243
255
  return Object.assign(target, source);
244
256
  };
245
-
246
257
  var getLineUid = function getLineUid(from, to) {
247
258
  return from.toLowerCase() + ":to:" + to.toLowerCase();
248
259
  };
249
-
250
260
  var inherit = function inherit(target, source) {
251
261
  Object.assign(target.prototype, source);
252
262
  };
253
263
 
254
264
  var eventRegistry = {};
255
265
  var eventUid = 1;
266
+
256
267
  /**
257
268
  * ------------------------------------------------------------------------
258
269
  * Event Handler
259
270
  * ------------------------------------------------------------------------
260
271
  */
261
-
262
272
  var EventHandler = {
263
273
  on: function on(element, event, handler, options) {
264
274
  if (options === void 0) {
265
275
  options = {};
266
276
  }
267
-
268
277
  var uid = "jvm:" + event + "::" + eventUid++;
269
278
  eventRegistry[uid] = {
270
279
  selector: element,
@@ -278,7 +287,6 @@
278
287
  event.forEach(function (eventName) {
279
288
  EventHandler.on(element, eventName, function (e) {
280
289
  var target = e.target;
281
-
282
290
  if (target.matches(selector)) {
283
291
  handler.call(target, e);
284
292
  }
@@ -302,23 +310,18 @@
302
310
 
303
311
  function setupContainerEvents() {
304
312
  var _this = this;
305
-
306
- var mouseDown = false,
307
- oldPageX,
308
- oldPageY,
309
- map = this;
310
-
313
+ var map = this;
314
+ var mouseDown = false;
315
+ var oldPageX;
316
+ var oldPageY;
311
317
  if (this.params.draggable) {
312
318
  EventHandler.on(this.container, 'mousemove', function (e) {
313
319
  if (!mouseDown) {
314
320
  return false;
315
321
  }
316
-
317
322
  map.transX -= (oldPageX - e.pageX) / map.scale;
318
323
  map.transY -= (oldPageY - e.pageY) / map.scale;
319
-
320
324
  map._applyTransform();
321
-
322
325
  oldPageX = e.pageX;
323
326
  oldPageY = e.pageY;
324
327
  });
@@ -332,30 +335,24 @@
332
335
  mouseDown = false;
333
336
  });
334
337
  }
335
-
336
338
  if (this.params.zoomOnScroll) {
337
339
  EventHandler.on(this.container, 'wheel', function (event) {
338
- var deltaY = 0;
339
- deltaY = (event.deltaY || -event.wheelDelta || event.detail) >> 10 || 1;
340
- deltaY = deltaY * 75;
341
-
342
- var rect = _this.container.getBoundingClientRect(),
343
- offsetX = event.pageX - rect.left - window.pageXOffset,
344
- offsetY = event.pageY - rect.top - window.pageYOffset,
345
- zoomStep = Math.pow(1 + map.params.zoomOnScrollSpeed / 1000, -1.5 * deltaY);
346
-
340
+ var deltaY = ((event.deltaY || -event.wheelDelta || event.detail) >> 10 || 1) * 75;
341
+ var rect = _this.container.getBoundingClientRect();
342
+ var offsetX = event.pageX - rect.left - window.pageXOffset;
343
+ var offsetY = event.pageY - rect.top - window.pageYOffset;
344
+ var zoomStep = Math.pow(1 + map.params.zoomOnScrollSpeed / 1000, -1.5 * deltaY);
347
345
  if (map.tooltip) {
348
- map.tooltip.hide();
346
+ map._tooltip.hide();
349
347
  }
350
-
351
348
  map._setScale(map.scale * zoomStep, offsetX, offsetY);
352
-
353
349
  event.preventDefault();
354
350
  });
355
351
  }
356
352
  }
357
353
 
358
354
  var Events = {
355
+ onLoaded: 'map:loaded',
359
356
  onViewportChange: 'viewport:changed',
360
357
  onRegionClick: 'region:clicked',
361
358
  onMarkerClick: 'marker:clicked',
@@ -363,270 +360,184 @@
363
360
  onMarkerSelected: 'marker:selected',
364
361
  onRegionTooltipShow: 'region.tooltip:show',
365
362
  onMarkerTooltipShow: 'marker.tooltip:show',
366
- onLoaded: 'map:loaded',
367
363
  onDestroyed: 'map:destroyed'
368
364
  };
369
365
 
370
- function parseEvent(map, selector, isTooltip) {
371
- var element = getElement(selector),
372
- classes = element.getAttribute('class'),
373
- type = classes.indexOf('jvm-region') === -1 ? 'marker' : 'region',
374
- code = type === 'region' ? element.getAttribute('data-code') : element.getAttribute('data-index'),
375
- event = type + ":selected"; // Init tooltip event
366
+ var parseEvent = function parseEvent(map, selector, isTooltip) {
367
+ var element = getElement(selector);
368
+ var type = element.getAttribute('class').indexOf('jvm-region') === -1 ? 'marker' : 'region';
369
+ var isRegion = type === 'region';
370
+ var code = isRegion ? element.getAttribute('data-code') : element.getAttribute('data-index');
371
+ var event = isRegion ? Events.onRegionSelected : Events.onMarkerSelected;
376
372
 
373
+ // Init tooltip event
377
374
  if (isTooltip) {
378
- event = type + ".tooltip:show";
375
+ event = isRegion ? Events.onRegionTooltipShow : Events.onMarkerTooltipShow;
379
376
  }
380
-
381
377
  return {
382
- event: event,
383
378
  type: type,
384
379
  code: code,
385
- element: type === 'region' ? map.regions[code].element : map.markers[code].element,
386
- tooltipText: type === 'region' ? map.mapData.paths[code].name || '' : map.markers[code].config.name || ''
380
+ event: event,
381
+ element: isRegion ? map.regions[code].element : map._markers[code].element,
382
+ tooltipText: isRegion ? map._mapData.paths[code].name || '' : map._markers[code].config.name || ''
387
383
  };
388
- }
389
-
384
+ };
390
385
  function setupElementEvents() {
391
- var map = this,
392
- container = this.container;
386
+ var map = this;
387
+ var container = this.container;
393
388
  var pageX, pageY, mouseMoved;
394
389
  EventHandler.on(container, 'mousemove', function (event) {
395
390
  if (Math.abs(pageX - event.pageX) + Math.abs(pageY - event.pageY) > 2) {
396
391
  mouseMoved = true;
397
392
  }
398
- }); // When the mouse is pressed
393
+ });
399
394
 
395
+ // When the mouse is pressed
400
396
  EventHandler.delegate(container, 'mousedown', '.jvm-element', function (event) {
401
397
  pageX = event.pageX;
402
398
  pageY = event.pageY;
403
399
  mouseMoved = false;
404
- }); // When the mouse is over the region/marker | When the mouse is out the region/marker
400
+ });
405
401
 
402
+ // When the mouse is over the region/marker | When the mouse is out the region/marker
406
403
  EventHandler.delegate(container, 'mouseover mouseout', '.jvm-element', function (event) {
407
404
  var data = parseEvent(map, this, true);
408
405
  var showTooltip = map.params.showTooltip;
409
-
410
406
  if (event.type === 'mouseover') {
411
407
  data.element.hover(true);
412
- map.tooltip.text(data.tooltipText);
413
-
414
- map._emit(data.event, [event, map.tooltip, data.code]);
415
-
416
- if (!event.defaultPrevented) {
417
- if (showTooltip) {
418
- map.tooltip.show();
419
- }
408
+ if (showTooltip) {
409
+ map._tooltip.text(data.tooltipText);
410
+ map._tooltip.show();
411
+ map._emit(data.event, [event, map._tooltip, data.code]);
420
412
  }
421
413
  } else {
422
414
  data.element.hover(false);
423
-
424
415
  if (showTooltip) {
425
- map.tooltip.hide();
416
+ map._tooltip.hide();
426
417
  }
427
418
  }
428
- }); // When the click is released
419
+ });
429
420
 
421
+ // When the click is released
430
422
  EventHandler.delegate(container, 'mouseup', '.jvm-element', function (event) {
431
423
  var data = parseEvent(map, this);
432
-
433
424
  if (mouseMoved) {
434
425
  return;
435
426
  }
436
-
437
427
  if (data.type === 'region' && map.params.regionsSelectable || data.type === 'marker' && map.params.markersSelectable) {
438
- var element = data.element; // We're checking if regions/markers|SelectableOne option is presented
428
+ var element = data.element;
439
429
 
430
+ // We're checking if regions/markers|SelectableOne option is presented
440
431
  if (map.params[data.type + "sSelectableOne"]) {
441
432
  map._clearSelected(data.type + "s");
442
433
  }
443
-
444
434
  if (data.element.isSelected) {
445
435
  element.select(false);
446
436
  } else {
447
437
  element.select(true);
448
438
  }
449
-
450
439
  map._emit(data.event, [data.code, element.isSelected, map._getSelected(data.type + "s")]);
451
440
  }
452
- }); // When region/marker is clicked
441
+ });
453
442
 
443
+ // When region/marker is clicked
454
444
  EventHandler.delegate(container, 'click', '.jvm-element', function (event) {
455
445
  var _parseEvent = parseEvent(map, this),
456
- type = _parseEvent.type,
457
- code = _parseEvent.code;
458
-
446
+ type = _parseEvent.type,
447
+ code = _parseEvent.code;
459
448
  map._emit(type === 'region' ? Events.onRegionClick : Events.onMarkerClick, [event, code]);
460
449
  });
461
450
  }
462
451
 
463
452
  function setupZoomButtons() {
464
453
  var _this = this;
465
-
466
- var map = this;
467
454
  var zoomin = createElement('div', 'jvm-zoom-btn jvm-zoomin', '&#43;', true);
468
455
  var zoomout = createElement('div', 'jvm-zoom-btn jvm-zoomout', '&#x2212', true);
469
456
  this.container.appendChild(zoomin);
470
457
  this.container.appendChild(zoomout);
471
- EventHandler.on(zoomin, 'click', function () {
472
- _this._setScale(map.scale * map.params.zoomStep, map.width / 2, map.height / 2, false, map.params.zoomAnimate);
473
- });
474
- EventHandler.on(zoomout, 'click', function () {
475
- _this._setScale(map.scale / map.params.zoomStep, map.width / 2, map.height / 2, false, map.params.zoomAnimate);
476
- });
458
+ var handler = function handler(zoomin) {
459
+ if (zoomin === void 0) {
460
+ zoomin = true;
461
+ }
462
+ return function () {
463
+ return _this._setScale(zoomin ? _this.scale * _this.params.zoomStep : _this.scale / _this.params.zoomStep, _this._width / 2, _this._height / 2, false, _this.params.zoomAnimate);
464
+ };
465
+ };
466
+ EventHandler.on(zoomin, 'click', handler());
467
+ EventHandler.on(zoomout, 'click', handler(false));
477
468
  }
478
469
 
479
470
  function setupContainerTouchEvents() {
480
471
  var map = this,
481
- touchStartScale,
482
- touchStartDistance,
483
- touchX,
484
- touchY,
485
- centerTouchX,
486
- centerTouchY,
487
- lastTouchesLength;
488
-
472
+ touchStartScale,
473
+ touchStartDistance,
474
+ touchX,
475
+ touchY,
476
+ centerTouchX,
477
+ centerTouchY,
478
+ lastTouchesLength;
489
479
  var handleTouchEvent = function handleTouchEvent(e) {
490
- var touches = e.touches,
491
- offset,
492
- scale,
493
- transXOld,
494
- transYOld;
495
-
480
+ var touches = e.touches;
481
+ var offset, scale, transXOld, transYOld;
496
482
  if (e.type == 'touchstart') {
497
483
  lastTouchesLength = 0;
498
484
  }
499
-
500
485
  if (touches.length == 1) {
501
486
  if (lastTouchesLength == 1) {
502
487
  transXOld = map.transX;
503
488
  transYOld = map.transY;
504
489
  map.transX -= (touchX - touches[0].pageX) / map.scale;
505
490
  map.transY -= (touchY - touches[0].pageY) / map.scale;
506
- map.tooltip.hide();
507
-
491
+ map._tooltip.hide();
508
492
  map._applyTransform();
509
-
510
493
  if (transXOld != map.transX || transYOld != map.transY) {
511
494
  e.preventDefault();
512
495
  }
513
496
  }
514
-
515
497
  touchX = touches[0].pageX;
516
498
  touchY = touches[0].pageY;
517
499
  } else if (touches.length == 2) {
518
500
  if (lastTouchesLength == 2) {
519
501
  scale = Math.sqrt(Math.pow(touches[0].pageX - touches[1].pageX, 2) + Math.pow(touches[0].pageY - touches[1].pageY, 2)) / touchStartDistance;
520
-
521
502
  map._setScale(touchStartScale * scale, centerTouchX, centerTouchY);
522
-
523
- map.tooltip.hide();
503
+ map._tooltip.hide();
524
504
  e.preventDefault();
525
505
  } else {
526
- var rect = map.container.selector.getBoundingClientRect();
506
+ var rect = map.container.getBoundingClientRect();
527
507
  offset = {
528
508
  top: rect.top + window.scrollY,
529
509
  left: rect.left + window.scrollX
530
510
  };
531
-
532
511
  if (touches[0].pageX > touches[1].pageX) {
533
512
  centerTouchX = touches[1].pageX + (touches[0].pageX - touches[1].pageX) / 2;
534
513
  } else {
535
514
  centerTouchX = touches[0].pageX + (touches[1].pageX - touches[0].pageX) / 2;
536
515
  }
537
-
538
516
  if (touches[0].pageY > touches[1].pageY) {
539
517
  centerTouchY = touches[1].pageY + (touches[0].pageY - touches[1].pageY) / 2;
540
518
  } else {
541
519
  centerTouchY = touches[0].pageY + (touches[1].pageY - touches[0].pageY) / 2;
542
520
  }
543
-
544
521
  centerTouchX -= offset.left;
545
522
  centerTouchY -= offset.top;
546
523
  touchStartScale = map.scale;
547
524
  touchStartDistance = Math.sqrt(Math.pow(touches[0].pageX - touches[1].pageX, 2) + Math.pow(touches[0].pageY - touches[1].pageY, 2));
548
525
  }
549
526
  }
550
-
551
527
  lastTouchesLength = touches.length;
552
528
  };
553
-
554
529
  EventHandler.on(map.container, 'touchstart', handleTouchEvent);
555
530
  EventHandler.on(map.container, 'touchmove', handleTouchEvent);
556
531
  }
557
532
 
558
- function _inheritsLoose(subClass, superClass) {
559
- subClass.prototype = Object.create(superClass.prototype);
560
- subClass.prototype.constructor = subClass;
561
-
562
- _setPrototypeOf(subClass, superClass);
563
- }
564
-
565
- function _setPrototypeOf(o, p) {
566
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
567
- o.__proto__ = p;
568
- return o;
569
- };
570
- return _setPrototypeOf(o, p);
571
- }
572
-
573
- function _assertThisInitialized(self) {
574
- if (self === void 0) {
575
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
576
- }
577
-
578
- return self;
579
- }
580
-
581
- function _unsupportedIterableToArray(o, minLen) {
582
- if (!o) return;
583
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
584
- var n = Object.prototype.toString.call(o).slice(8, -1);
585
- if (n === "Object" && o.constructor) n = o.constructor.name;
586
- if (n === "Map" || n === "Set") return Array.from(o);
587
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
588
- }
589
-
590
- function _arrayLikeToArray(arr, len) {
591
- if (len == null || len > arr.length) len = arr.length;
592
-
593
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
594
-
595
- return arr2;
596
- }
597
-
598
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
599
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
600
- if (it) return (it = it.call(o)).next.bind(it);
601
-
602
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
603
- if (it) o = it;
604
- var i = 0;
605
- return function () {
606
- if (i >= o.length) return {
607
- done: true
608
- };
609
- return {
610
- done: false,
611
- value: o[i++]
612
- };
613
- };
614
- }
615
-
616
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
617
- }
618
-
619
533
  /**
620
534
  * ------------------------------------------------------------------------
621
535
  * Class Definition
622
536
  * ------------------------------------------------------------------------
623
537
  */
624
-
625
538
  var BaseComponent = /*#__PURE__*/function () {
626
539
  function BaseComponent() {}
627
-
628
540
  var _proto = BaseComponent.prototype;
629
-
630
541
  _proto.dispose = function dispose() {
631
542
  if (this._tooltip) {
632
543
  removeElement(this._tooltip);
@@ -634,13 +545,11 @@
634
545
  // @todo: move shape in base component in v2
635
546
  this.shape.remove();
636
547
  }
637
-
638
548
  for (var _iterator = _createForOfIteratorHelperLoose(Object.getOwnPropertyNames(this)), _step; !(_step = _iterator()).done;) {
639
549
  var propertyName = _step.value;
640
550
  this[propertyName] = null;
641
551
  }
642
552
  };
643
-
644
553
  return BaseComponent;
645
554
  }();
646
555
 
@@ -654,31 +563,29 @@
654
563
  if (!label) {
655
564
  return;
656
565
  }
657
-
658
566
  if (typeof label.render === 'function') {
659
- var params = []; // Pass additional paramater (Marker config object) in case it's a Marker.
567
+ var params = [];
660
568
 
569
+ // Pass additional paramater (Marker config object) in case it's a Marker.
661
570
  if (this.config && this.config.marker) {
662
571
  params.push(this.config.marker);
663
- } // Becuase we need to add the key always at the end
664
-
572
+ }
665
573
 
574
+ // Becuase we need to add the key always at the end
666
575
  params.push(key);
667
576
  return label.render.apply(this, params);
668
577
  }
669
-
670
578
  return key;
671
579
  },
672
580
  getLabelOffsets: function getLabelOffsets(key, label) {
673
581
  if (typeof label.offsets === 'function') {
674
582
  return label.offsets(key);
675
- } // If offsets are an array of offsets e.g offsets: [ [0, 25], [10, 15] ]
676
-
583
+ }
677
584
 
585
+ // If offsets are an array of offsets e.g offsets: [ [0, 25], [10, 15] ]
678
586
  if (Array.isArray(label.offsets)) {
679
587
  return label.offsets[key];
680
588
  }
681
-
682
589
  return [0, 0];
683
590
  },
684
591
  setStyle: function setStyle(property, value) {
@@ -699,7 +606,6 @@
699
606
  this.shape[property] = state;
700
607
  this.shape.updateStyle();
701
608
  this[property] = state;
702
-
703
609
  if (this.label) {
704
610
  this.label[property] = state;
705
611
  this.label.updateStyle();
@@ -712,32 +618,26 @@
712
618
  * Class Definition
713
619
  * ------------------------------------------------------------------------
714
620
  */
715
-
716
621
  var Region = /*#__PURE__*/function (_BaseComponent) {
717
622
  _inheritsLoose(Region, _BaseComponent);
718
-
719
623
  function Region(_ref) {
720
624
  var _this;
721
-
722
625
  var map = _ref.map,
723
- code = _ref.code,
724
- path = _ref.path,
725
- style = _ref.style,
726
- label = _ref.label,
727
- labelStyle = _ref.labelStyle,
728
- labelsGroup = _ref.labelsGroup;
626
+ code = _ref.code,
627
+ path = _ref.path,
628
+ style = _ref.style,
629
+ label = _ref.label,
630
+ labelStyle = _ref.labelStyle,
631
+ labelsGroup = _ref.labelsGroup;
729
632
  _this = _BaseComponent.call(this) || this;
730
633
  _this._map = map;
731
634
  _this.shape = _this._createRegion(path, code, style);
635
+ var text = _this.getLabelText(code, label);
732
636
 
733
- var bbox = _this.shape.getBBox();
734
-
735
- var text = _this.getLabelText(code, label); // If label is passed and render function returns something
736
-
737
-
637
+ // If label is passed and render function returns something
738
638
  if (label && text) {
639
+ var bbox = _this.shape.getBBox();
739
640
  var offsets = _this.getLabelOffsets(code, label);
740
-
741
641
  _this.labelX = bbox.x + bbox.width / 2 + offsets[0];
742
642
  _this.labelY = bbox.y + bbox.height / 2 + offsets[1];
743
643
  _this.label = _this._map.canvas.createText({
@@ -748,15 +648,11 @@
748
648
  x: _this.labelX,
749
649
  y: _this.labelY
750
650
  }, labelStyle, labelsGroup);
751
-
752
651
  _this.label.addClass('jvm-region jvm-element');
753
652
  }
754
-
755
653
  return _this;
756
654
  }
757
-
758
655
  var _proto = Region.prototype;
759
-
760
656
  _proto._createRegion = function _createRegion(path, code, style) {
761
657
  path = this._map.canvas.createPath({
762
658
  d: path,
@@ -765,7 +661,6 @@
765
661
  path.addClass('jvm-region jvm-element');
766
662
  return path;
767
663
  };
768
-
769
664
  _proto.updateLabelPosition = function updateLabelPosition() {
770
665
  if (this.label) {
771
666
  this.label.set({
@@ -774,28 +669,24 @@
774
669
  });
775
670
  }
776
671
  };
777
-
778
672
  return Region;
779
673
  }(BaseComponent);
780
-
781
674
  inherit(Region, Interactable);
782
675
 
783
676
  function createRegions() {
784
- var code, region;
785
677
  this._regionLabelsGroup = this._regionLabelsGroup || this.canvas.createGroup('jvm-regions-labels-group');
786
-
787
- for (code in this.mapData.paths) {
788
- region = new Region({
678
+ for (var code in this._mapData.paths) {
679
+ var region = new Region({
789
680
  map: this,
790
681
  code: code,
791
- path: this.mapData.paths[code].path,
682
+ path: this._mapData.paths[code].path,
792
683
  style: merge({}, this.params.regionStyle),
793
684
  labelStyle: this.params.regionLabelStyle,
794
685
  labelsGroup: this._regionLabelsGroup,
795
686
  label: this.params.labels && this.params.labels.regions
796
687
  });
797
688
  this.regions[code] = {
798
- config: this.mapData.paths[code],
689
+ config: this._mapData.paths[code],
799
690
  element: region
800
691
  };
801
692
  }
@@ -806,22 +697,19 @@
806
697
  * Class Definition
807
698
  * ------------------------------------------------------------------------
808
699
  */
809
-
810
700
  var Line = /*#__PURE__*/function (_BaseComponent) {
811
701
  _inheritsLoose(Line, _BaseComponent);
812
-
813
702
  function Line(_ref) {
814
703
  var _this;
815
-
816
704
  var index = _ref.index,
817
- map = _ref.map,
818
- style = _ref.style,
819
- x1 = _ref.x1,
820
- y1 = _ref.y1,
821
- x2 = _ref.x2,
822
- y2 = _ref.y2,
823
- group = _ref.group,
824
- config = _ref.config;
705
+ map = _ref.map,
706
+ style = _ref.style,
707
+ x1 = _ref.x1,
708
+ y1 = _ref.y1,
709
+ x2 = _ref.x2,
710
+ y2 = _ref.y2,
711
+ group = _ref.group,
712
+ config = _ref.config;
825
713
  _this = _BaseComponent.call(this) || this;
826
714
  _this.config = config;
827
715
  _this.shape = map.canvas.createLine({
@@ -831,18 +719,13 @@
831
719
  y2: y2,
832
720
  dataIndex: index
833
721
  }, style, group);
834
-
835
722
  _this.shape.addClass('jvm-line');
836
-
837
723
  return _this;
838
724
  }
839
-
840
725
  var _proto = Line.prototype;
841
-
842
726
  _proto.setStyle = function setStyle(property, value) {
843
727
  this.shape.setStyle(property, value);
844
728
  };
845
-
846
729
  return Line;
847
730
  }(BaseComponent);
848
731
 
@@ -850,32 +733,27 @@
850
733
  if (isRecentlyCreated === void 0) {
851
734
  isRecentlyCreated = false;
852
735
  }
853
-
854
736
  var point1 = false,
855
- point2 = false; // Create group for holding lines
737
+ point2 = false;
738
+
739
+ // Create group for holding lines
856
740
  // we're checking if `linesGroup` exists or not becuase we may add lines
857
741
  // after the map has loaded so we will append the futured lines to this group as well.
858
-
859
742
  this.linesGroup = this.linesGroup || this.canvas.createGroup('jvm-lines-group');
860
-
861
743
  for (var index in lines) {
862
744
  var config = lines[index];
863
-
864
745
  for (var mindex in markers) {
865
746
  var markerConfig = isRecentlyCreated ? markers[mindex].config : markers[mindex];
866
-
867
747
  if (markerConfig.name === config.from) {
868
748
  point1 = this.getMarkerPosition(markerConfig);
869
749
  }
870
-
871
750
  if (markerConfig.name === config.to) {
872
751
  point2 = this.getMarkerPosition(markerConfig);
873
752
  }
874
753
  }
875
-
876
754
  if (point1 !== false && point2 !== false) {
877
755
  // Register lines with unique keys
878
- this.lines[getLineUid(config.from, config.to)] = new Line({
756
+ this._lines[getLineUid(config.from, config.to)] = new Line({
879
757
  index: index,
880
758
  map: this,
881
759
  // Merge the default `lineStyle` object with the custom `line` config style
@@ -900,47 +778,40 @@
900
778
  * Class Definition
901
779
  * ------------------------------------------------------------------------
902
780
  */
903
-
904
781
  var Marker = /*#__PURE__*/function (_BaseComponent) {
905
782
  _inheritsLoose(Marker, _BaseComponent);
906
-
907
783
  function Marker(_ref) {
908
784
  var _this;
909
-
910
785
  var index = _ref.index,
911
- style = _ref.style,
912
- label = _ref.label,
913
- cx = _ref.cx,
914
- cy = _ref.cy,
915
- map = _ref.map,
916
- group = _ref.group;
917
- _this = _BaseComponent.call(this) || this; // Private
786
+ style = _ref.style,
787
+ label = _ref.label,
788
+ cx = _ref.cx,
789
+ cy = _ref.cy,
790
+ map = _ref.map,
791
+ group = _ref.group;
792
+ _this = _BaseComponent.call(this) || this;
918
793
 
794
+ // Private
919
795
  _this._map = map;
920
- _this._isImage = !!style.initial.image; // Protected
796
+ _this._isImage = !!style.initial.image;
921
797
 
798
+ // Protected
922
799
  _this.config = arguments[0];
923
800
  _this.shape = map.canvas[_this._isImage ? 'createImage' : 'createCircle']({
924
801
  dataIndex: index,
925
802
  cx: cx,
926
803
  cy: cy
927
804
  }, style, group);
928
-
929
805
  _this.shape.addClass('jvm-marker jvm-element');
930
-
931
806
  if (_this._isImage) {
932
807
  _this.updateLabelPosition();
933
808
  }
934
-
935
809
  if (label) {
936
810
  _this._createLabel(_this.config);
937
811
  }
938
-
939
812
  return _this;
940
813
  }
941
-
942
814
  var _proto = Marker.prototype;
943
-
944
815
  _proto.updateLabelPosition = function updateLabelPosition() {
945
816
  if (this.label) {
946
817
  this.label.set({
@@ -949,16 +820,15 @@
949
820
  });
950
821
  }
951
822
  };
952
-
953
823
  _proto._createLabel = function _createLabel(_ref2) {
954
824
  var index = _ref2.index,
955
- map = _ref2.map,
956
- label = _ref2.label,
957
- labelsGroup = _ref2.labelsGroup,
958
- cx = _ref2.cx,
959
- cy = _ref2.cy,
960
- marker = _ref2.marker,
961
- isRecentlyCreated = _ref2.isRecentlyCreated;
825
+ map = _ref2.map,
826
+ label = _ref2.label,
827
+ labelsGroup = _ref2.labelsGroup,
828
+ cx = _ref2.cx,
829
+ cy = _ref2.cy,
830
+ marker = _ref2.marker,
831
+ isRecentlyCreated = _ref2.isRecentlyCreated;
962
832
  var labelText = this.getLabelText(index, label);
963
833
  this._labelX = cx / map.scale - map.transX;
964
834
  this._labelY = cy / map.scale - map.transY;
@@ -971,84 +841,77 @@
971
841
  dy: '0.6ex'
972
842
  }, map.params.markerLabelStyle, labelsGroup);
973
843
  this.label.addClass('jvm-marker jvm-element');
974
-
975
844
  if (isRecentlyCreated) {
976
845
  this.updateLabelPosition();
977
846
  }
978
847
  };
979
-
980
848
  return Marker;
981
849
  }(BaseComponent);
982
-
983
850
  inherit(Marker, Interactable);
984
851
 
985
852
  function createMarkers(markers, isRecentlyCreated) {
986
853
  var _this = this;
987
-
988
854
  if (markers === void 0) {
989
855
  markers = {};
990
856
  }
991
-
992
857
  if (isRecentlyCreated === void 0) {
993
858
  isRecentlyCreated = false;
994
859
  }
995
-
996
- var config, marker, point, uid; // Create groups for holding markers and markers labels
860
+ // Create groups for holding markers and markers labels
997
861
  // We're checking if `markersGroup` exists or not becuase we may add markers after the map has loaded
998
862
  // So we will append the futured markers to this group as well.
999
-
1000
863
  this._markersGroup = this._markersGroup || this.canvas.createGroup('jvm-markers-group');
1001
864
  this._markerLabelsGroup = this._markerLabelsGroup || this.canvas.createGroup('jvm-markers-labels-group');
1002
-
1003
- for (var index in markers) {
1004
- config = markers[index];
1005
- point = this.getMarkerPosition(config);
1006
- uid = config.coords.join(':');
1007
-
865
+ var _loop = function _loop() {
866
+ var config = markers[index];
867
+ var point = _this.getMarkerPosition(config);
868
+ var uid = config.coords.join(':');
1008
869
  if (!point) {
1009
- continue;
1010
- } // We're checking if recently created marker does already exist
1011
- // If exists we don't need to create it again, so we'll continute
1012
- // Becuase we may have more than one marker submitted via `addMarkers` method.
1013
-
870
+ return "continue";
871
+ }
1014
872
 
873
+ // We're checking if recently created marker does already exist
874
+ // If it does we don't need to create it again, so we'll continue
875
+ // Becuase we may have more than one marker submitted via `addMarkers` method.
1015
876
  if (isRecentlyCreated) {
1016
- if (Object.keys(this.markers).filter(function (i) {
1017
- return _this.markers[i]._uid === uid;
877
+ if (Object.keys(_this._markers).filter(function (i) {
878
+ return _this._markers[i]._uid === uid;
1018
879
  }).length) {
1019
- continue;
880
+ return "continue";
1020
881
  }
1021
-
1022
- index = Object.keys(this.markers).length;
882
+ index = Object.keys(_this._markers).length;
1023
883
  }
1024
-
1025
- marker = new Marker({
884
+ var marker = new Marker({
1026
885
  index: index,
1027
- map: this,
886
+ map: _this,
1028
887
  // Merge the `markerStyle` object with the marker config `style` if presented.
1029
- style: merge(this.params.markerStyle, {
888
+ style: merge(_this.params.markerStyle, {
1030
889
  initial: config.style || {}
1031
890
  }, true),
1032
- label: this.params.labels && this.params.labels.markers,
1033
- labelsGroup: this._markerLabelsGroup,
891
+ label: _this.params.labels && _this.params.labels.markers,
892
+ labelsGroup: _this._markerLabelsGroup,
1034
893
  cx: point.x,
1035
894
  cy: point.y,
1036
- group: this._markersGroup,
895
+ group: _this._markersGroup,
1037
896
  marker: config,
1038
897
  isRecentlyCreated: isRecentlyCreated
1039
- }); // Check for marker duplication
898
+ });
899
+
900
+ // Check for marker duplication
1040
901
  // this is useful when for example: a user clicks a button for creating marker two times
1041
902
  // so it will remove the old one and the new one will take its place.
1042
-
1043
- if (this.markers[index]) {
1044
- this.removeMarkers([index]);
903
+ if (_this._markers[index]) {
904
+ _this.removeMarkers([index]);
1045
905
  }
1046
-
1047
- this.markers[index] = {
906
+ _this._markers[index] = {
1048
907
  _uid: uid,
1049
908
  config: config,
1050
909
  element: marker
1051
910
  };
911
+ };
912
+ for (var index in markers) {
913
+ var _ret = _loop();
914
+ if (_ret === "continue") continue;
1052
915
  }
1053
916
  }
1054
917
 
@@ -1057,54 +920,38 @@
1057
920
  * Class Definition
1058
921
  * ------------------------------------------------------------------------
1059
922
  */
1060
-
1061
923
  var Legend = /*#__PURE__*/function () {
1062
924
  function Legend(options) {
1063
925
  if (options === void 0) {
1064
926
  options = {};
1065
927
  }
1066
-
1067
928
  this._options = options;
1068
929
  this._map = this._options.map;
1069
930
  this._series = this._options.series;
1070
931
  this._body = createElement('div', 'jvm-legend');
1071
-
1072
932
  if (this._options.cssClass) {
1073
933
  this._body.setAttribute('class', this._options.cssClass);
1074
934
  }
1075
-
1076
935
  if (options.vertical) {
1077
936
  this._map.legendVertical.appendChild(this._body);
1078
937
  } else {
1079
938
  this._map.legendHorizontal.appendChild(this._body);
1080
939
  }
1081
-
1082
940
  this.render();
1083
941
  }
1084
-
1085
942
  var _proto = Legend.prototype;
1086
-
1087
943
  _proto.render = function render() {
1088
- var ticks = this._series.scale.getTicks(),
1089
- inner = createElement('div', 'jvm-legend-inner'),
1090
- tick,
1091
- sample,
1092
- label;
1093
-
944
+ var ticks = this._series.scale.getTicks();
945
+ var inner = createElement('div', 'jvm-legend-inner');
1094
946
  this._body.innderHTML = '';
1095
-
1096
947
  if (this._options.title) {
1097
948
  var legendTitle = createElement('div', 'jvm-legend-title', this._options.title);
1098
-
1099
949
  this._body.appendChild(legendTitle);
1100
950
  }
1101
-
1102
951
  this._body.appendChild(inner);
1103
-
1104
952
  for (var i = 0; i < ticks.length; i++) {
1105
- tick = createElement('div', 'jvm-legend-tick');
1106
- sample = createElement('div', 'jvm-legend-tick-sample');
1107
-
953
+ var tick = createElement('div', 'jvm-legend-tick');
954
+ var sample = createElement('div', 'jvm-legend-tick-sample');
1108
955
  switch (this._series.config.attribute) {
1109
956
  case 'fill':
1110
957
  if (isImageUrl(ticks[i].value)) {
@@ -1112,32 +959,25 @@
1112
959
  } else {
1113
960
  sample.style.background = ticks[i].value;
1114
961
  }
1115
-
1116
962
  break;
1117
-
1118
963
  case 'stroke':
1119
964
  sample.style.background = ticks[i].value;
1120
965
  break;
1121
-
1122
966
  case 'image':
1123
967
  sample.style.background = "url(" + (typeof ticks[i].value === 'object' ? ticks[i].value.url : ticks[i].value) + ") no-repeat center center";
1124
968
  sample.style.backgroundSize = 'cover';
1125
969
  break;
1126
970
  }
1127
-
1128
971
  tick.appendChild(sample);
1129
- label = ticks[i].label;
1130
-
972
+ var label = ticks[i].label;
1131
973
  if (this._options.labelRender) {
1132
974
  label = this._options.labelRender(label);
1133
975
  }
1134
-
1135
976
  var tickText = createElement('div', 'jvm-legend-tick-text', label);
1136
977
  tick.appendChild(tickText);
1137
978
  inner.appendChild(tick);
1138
979
  }
1139
980
  };
1140
-
1141
981
  return Legend;
1142
982
  }();
1143
983
 
@@ -1150,26 +990,20 @@
1150
990
  function OrdinalScale(scale) {
1151
991
  this._scale = scale;
1152
992
  }
1153
-
1154
993
  var _proto = OrdinalScale.prototype;
1155
-
1156
994
  _proto.getValue = function getValue(value) {
1157
995
  return this._scale[value];
1158
996
  };
1159
-
1160
997
  _proto.getTicks = function getTicks() {
1161
998
  var ticks = [];
1162
-
1163
999
  for (var key in this._scale) {
1164
1000
  ticks.push({
1165
1001
  label: key,
1166
1002
  value: this._scale[key]
1167
1003
  });
1168
1004
  }
1169
-
1170
1005
  return ticks;
1171
1006
  };
1172
-
1173
1007
  return OrdinalScale;
1174
1008
  }();
1175
1009
 
@@ -1178,54 +1012,45 @@
1178
1012
  * Class Definition
1179
1013
  * ------------------------------------------------------------------------
1180
1014
  */
1181
-
1182
1015
  var Series = /*#__PURE__*/function () {
1183
1016
  function Series(config, elements, map) {
1184
1017
  if (config === void 0) {
1185
1018
  config = {};
1186
1019
  }
1187
-
1188
1020
  // Private
1189
1021
  this._map = map;
1190
1022
  this._elements = elements; // Could be markers or regions
1023
+ this._values = config.values || {};
1191
1024
 
1192
- this._values = config.values || {}; // Protected
1193
-
1025
+ // Protected
1194
1026
  this.config = config;
1195
- this.config.attribute = config.attribute || 'fill'; // Set initial attributes
1027
+ this.config.attribute = config.attribute || 'fill';
1196
1028
 
1029
+ // Set initial attributes
1197
1030
  if (config.attributes) {
1198
1031
  this.setAttributes(config.attributes);
1199
1032
  }
1200
-
1201
1033
  if (typeof config.scale === 'object') {
1202
1034
  this.scale = new OrdinalScale(config.scale);
1203
1035
  }
1204
-
1205
1036
  if (this.config.legend) {
1206
1037
  this.legend = new Legend(merge({
1207
1038
  map: this._map,
1208
1039
  series: this
1209
1040
  }, this.config.legend));
1210
1041
  }
1211
-
1212
1042
  this.setValues(this._values);
1213
1043
  }
1214
-
1215
1044
  var _proto = Series.prototype;
1216
-
1217
1045
  _proto.setValues = function setValues(values) {
1218
1046
  var attrs = {};
1219
-
1220
1047
  for (var key in values) {
1221
1048
  if (values[key]) {
1222
1049
  attrs[key] = this.scale.getValue(values[key]);
1223
1050
  }
1224
1051
  }
1225
-
1226
1052
  this.setAttributes(attrs);
1227
1053
  };
1228
-
1229
1054
  _proto.setAttributes = function setAttributes(attrs) {
1230
1055
  for (var code in attrs) {
1231
1056
  if (this._elements[code]) {
@@ -1233,21 +1058,17 @@
1233
1058
  }
1234
1059
  }
1235
1060
  };
1236
-
1237
1061
  _proto.clear = function clear() {
1238
1062
  var key,
1239
- attrs = {};
1240
-
1063
+ attrs = {};
1241
1064
  for (key in this._values) {
1242
1065
  if (this._elements[key]) {
1243
1066
  attrs[key] = this._elements[key].element.shape.style.initial[this.config.attribute];
1244
1067
  }
1245
1068
  }
1246
-
1247
1069
  this.setAttributes(attrs);
1248
1070
  this._values = {};
1249
1071
  };
1250
-
1251
1072
  return Series;
1252
1073
  }();
1253
1074
 
@@ -1256,108 +1077,92 @@
1256
1077
  markers: [],
1257
1078
  regions: []
1258
1079
  };
1259
-
1260
1080
  for (var key in this.params.series) {
1261
1081
  for (var i = 0; i < this.params.series[key].length; i++) {
1262
- this.series[key][i] = new Series(this.params.series[key][i], this[key], this);
1082
+ this.series[key][i] = new Series(this.params.series[key][i], key === 'markers' ? this._markers : this.regions, this);
1263
1083
  }
1264
1084
  }
1265
1085
  }
1266
1086
 
1267
1087
  function applyTransform() {
1268
1088
  var maxTransX, maxTransY, minTransX, minTransY;
1269
-
1270
- if (this.defaultWidth * this.scale <= this.width) {
1271
- maxTransX = (this.width - this.defaultWidth * this.scale) / (2 * this.scale);
1272
- minTransX = (this.width - this.defaultWidth * this.scale) / (2 * this.scale);
1089
+ if (this._defaultWidth * this.scale <= this._width) {
1090
+ maxTransX = (this._width - this._defaultWidth * this.scale) / (2 * this.scale);
1091
+ minTransX = (this._width - this._defaultWidth * this.scale) / (2 * this.scale);
1273
1092
  } else {
1274
1093
  maxTransX = 0;
1275
- minTransX = (this.width - this.defaultWidth * this.scale) / this.scale;
1094
+ minTransX = (this._width - this._defaultWidth * this.scale) / this.scale;
1276
1095
  }
1277
-
1278
- if (this.defaultHeight * this.scale <= this.height) {
1279
- maxTransY = (this.height - this.defaultHeight * this.scale) / (2 * this.scale);
1280
- minTransY = (this.height - this.defaultHeight * this.scale) / (2 * this.scale);
1096
+ if (this._defaultHeight * this.scale <= this._height) {
1097
+ maxTransY = (this._height - this._defaultHeight * this.scale) / (2 * this.scale);
1098
+ minTransY = (this._height - this._defaultHeight * this.scale) / (2 * this.scale);
1281
1099
  } else {
1282
1100
  maxTransY = 0;
1283
- minTransY = (this.height - this.defaultHeight * this.scale) / this.scale;
1101
+ minTransY = (this._height - this._defaultHeight * this.scale) / this.scale;
1284
1102
  }
1285
-
1286
1103
  if (this.transY > maxTransY) {
1287
1104
  this.transY = maxTransY;
1288
1105
  } else if (this.transY < minTransY) {
1289
1106
  this.transY = minTransY;
1290
1107
  }
1291
-
1292
1108
  if (this.transX > maxTransX) {
1293
1109
  this.transX = maxTransX;
1294
1110
  } else if (this.transX < minTransX) {
1295
1111
  this.transX = minTransX;
1296
1112
  }
1297
-
1298
1113
  this.canvas.applyTransformParams(this.scale, this.transX, this.transY);
1299
-
1300
- if (this.markers) {
1114
+ if (this._markers) {
1301
1115
  this._repositionMarkers();
1302
1116
  }
1303
-
1304
- if (this.lines) {
1117
+ if (this._lines) {
1305
1118
  this._repositionLines();
1306
1119
  }
1307
-
1308
1120
  this._repositionLabels();
1309
1121
  }
1310
1122
 
1311
1123
  function resize() {
1312
- var curBaseScale = this.baseScale;
1313
-
1314
- if (this.width / this.height > this.defaultWidth / this.defaultHeight) {
1315
- this.baseScale = this.height / this.defaultHeight;
1316
- this.baseTransX = Math.abs(this.width - this.defaultWidth * this.baseScale) / (2 * this.baseScale);
1124
+ var curBaseScale = this._baseScale;
1125
+ if (this._width / this._height > this._defaultWidth / this._defaultHeight) {
1126
+ this._baseScale = this._height / this._defaultHeight;
1127
+ this._baseTransX = Math.abs(this._width - this._defaultWidth * this._baseScale) / (2 * this._baseScale);
1317
1128
  } else {
1318
- this.baseScale = this.width / this.defaultWidth;
1319
- this.baseTransY = Math.abs(this.height - this.defaultHeight * this.baseScale) / (2 * this.baseScale);
1129
+ this._baseScale = this._width / this._defaultWidth;
1130
+ this._baseTransY = Math.abs(this._height - this._defaultHeight * this._baseScale) / (2 * this._baseScale);
1320
1131
  }
1321
-
1322
- this.scale *= this.baseScale / curBaseScale;
1323
- this.transX *= this.baseScale / curBaseScale;
1324
- this.transY *= this.baseScale / curBaseScale;
1132
+ this.scale *= this._baseScale / curBaseScale;
1133
+ this.transX *= this._baseScale / curBaseScale;
1134
+ this.transY *= this._baseScale / curBaseScale;
1325
1135
  }
1326
1136
 
1327
1137
  function setScale(scale, anchorX, anchorY, isCentered, animate) {
1328
1138
  var _this = this;
1329
-
1330
1139
  var zoomStep,
1331
- interval,
1332
- i = 0,
1333
- count = Math.abs(Math.round((scale - this.scale) * 60 / Math.max(scale, this.scale))),
1334
- scaleStart,
1335
- scaleDiff,
1336
- transXStart,
1337
- transXDiff,
1338
- transYStart,
1339
- transYDiff,
1340
- transX,
1341
- transY;
1342
-
1343
- if (scale > this.params.zoomMax * this.baseScale) {
1344
- scale = this.params.zoomMax * this.baseScale;
1345
- } else if (scale < this.params.zoomMin * this.baseScale) {
1346
- scale = this.params.zoomMin * this.baseScale;
1140
+ interval,
1141
+ i = 0,
1142
+ count = Math.abs(Math.round((scale - this.scale) * 60 / Math.max(scale, this.scale))),
1143
+ scaleStart,
1144
+ scaleDiff,
1145
+ transXStart,
1146
+ transXDiff,
1147
+ transYStart,
1148
+ transYDiff,
1149
+ transX,
1150
+ transY;
1151
+ if (scale > this.params.zoomMax * this._baseScale) {
1152
+ scale = this.params.zoomMax * this._baseScale;
1153
+ } else if (scale < this.params.zoomMin * this._baseScale) {
1154
+ scale = this.params.zoomMin * this._baseScale;
1347
1155
  }
1348
-
1349
1156
  if (typeof anchorX != 'undefined' && typeof anchorY != 'undefined') {
1350
1157
  zoomStep = scale / this.scale;
1351
-
1352
1158
  if (isCentered) {
1353
- transX = anchorX + this.defaultWidth * (this.width / (this.defaultWidth * scale)) / 2;
1354
- transY = anchorY + this.defaultHeight * (this.height / (this.defaultHeight * scale)) / 2;
1159
+ transX = anchorX + this._defaultWidth * (this._width / (this._defaultWidth * scale)) / 2;
1160
+ transY = anchorY + this._defaultHeight * (this._height / (this._defaultHeight * scale)) / 2;
1355
1161
  } else {
1356
1162
  transX = this.transX - (zoomStep - 1) / scale * anchorX;
1357
1163
  transY = this.transY - (zoomStep - 1) / scale * anchorY;
1358
1164
  }
1359
1165
  }
1360
-
1361
1166
  if (animate && count > 0) {
1362
1167
  scaleStart = this.scale;
1363
1168
  scaleDiff = (scale - scaleStart) / count;
@@ -1370,12 +1175,9 @@
1370
1175
  _this.scale = scaleStart + scaleDiff * i;
1371
1176
  _this.transX = (transXStart + transXDiff * i) / _this.scale;
1372
1177
  _this.transY = (transYStart + transYDiff * i) / _this.scale;
1373
-
1374
1178
  _this._applyTransform();
1375
-
1376
1179
  if (i == count) {
1377
1180
  clearInterval(interval);
1378
-
1379
1181
  _this._emit(Events.onViewportChange, [_this.scale, _this.transX, _this.transY]);
1380
1182
  }
1381
1183
  }, 10);
@@ -1383,34 +1185,27 @@
1383
1185
  this.transX = transX;
1384
1186
  this.transY = transY;
1385
1187
  this.scale = scale;
1386
-
1387
1188
  this._applyTransform();
1388
-
1389
1189
  this._emit(Events.onViewportChange, [this.scale, this.transX, this.transY]);
1390
1190
  }
1391
1191
  }
1392
1192
 
1393
1193
  function setFocus(config) {
1394
1194
  var _this = this;
1395
-
1396
1195
  if (config === void 0) {
1397
1196
  config = {};
1398
1197
  }
1399
-
1400
1198
  var bbox,
1401
- codes = [];
1402
-
1199
+ codes = [];
1403
1200
  if (config.region) {
1404
1201
  codes.push(config.region);
1405
1202
  } else if (config.regions) {
1406
1203
  codes = config.regions;
1407
1204
  }
1408
-
1409
1205
  if (codes.length) {
1410
1206
  codes.forEach(function (code) {
1411
1207
  if (_this.regions[code]) {
1412
1208
  var itemBbox = _this.regions[code].element.shape.getBBox();
1413
-
1414
1209
  if (itemBbox) {
1415
1210
  // Handle the first loop
1416
1211
  if (typeof bbox == 'undefined') {
@@ -1428,23 +1223,20 @@
1428
1223
  }
1429
1224
  }
1430
1225
  });
1431
- return this._setScale(Math.min(this.width / bbox.width, this.height / bbox.height), -(bbox.x + bbox.width / 2), -(bbox.y + bbox.height / 2), true, config.animate);
1226
+ return this._setScale(Math.min(this._width / bbox.width, this._height / bbox.height), -(bbox.x + bbox.width / 2), -(bbox.y + bbox.height / 2), true, config.animate);
1432
1227
  } else if (config.coords) {
1433
1228
  var point = this.coordsToPoint(config.coords[0], config.coords[1]);
1434
1229
  var x = this.transX - point.x / this.scale;
1435
1230
  var y = this.transY - point.y / this.scale;
1436
- return this._setScale(config.scale * this.baseScale, x, y, true, config.animate);
1231
+ return this._setScale(config.scale * this._baseScale, x, y, true, config.animate);
1437
1232
  }
1438
1233
  }
1439
1234
 
1440
1235
  function updateSize() {
1441
- this.width = this.container.offsetWidth;
1442
- this.height = this.container.offsetHeight;
1443
-
1236
+ this._width = this.container.offsetWidth;
1237
+ this._height = this.container.offsetHeight;
1444
1238
  this._resize();
1445
-
1446
- this.canvas.setSize(this.width, this.height);
1447
-
1239
+ this.canvas.setSize(this._width, this._height);
1448
1240
  this._applyTransform();
1449
1241
  }
1450
1242
 
@@ -1469,7 +1261,6 @@
1469
1261
  y: -this.radius * Math.log(Math.tan((45 + 0.4 * lat) * this.radDeg)) / 0.8
1470
1262
  };
1471
1263
  },
1472
-
1473
1264
  /* mill_inv(x, y, c) {
1474
1265
  return {
1475
1266
  lat: (2.5 * Math.atan(Math.exp(0.8 * y / this.radius)) - 5 * Math.PI / 8) * this.degRad,
@@ -1482,7 +1273,6 @@
1482
1273
  y: -this.radius * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360))
1483
1274
  };
1484
1275
  },
1485
-
1486
1276
  /* merc_inv(x, y, c) {
1487
1277
  return {
1488
1278
  lat: (2 * Math.atan(Math.exp(y / this.radius)) - Math.PI / 2) * this.degRad,
@@ -1491,22 +1281,21 @@
1491
1281
  }, */
1492
1282
  aea: function aea(lat, lng, c) {
1493
1283
  var fi0 = 0,
1494
- lambda0 = c * this.radDeg,
1495
- fi1 = 29.5 * this.radDeg,
1496
- fi2 = 45.5 * this.radDeg,
1497
- fi = lat * this.radDeg,
1498
- lambda = lng * this.radDeg,
1499
- n = (Math.sin(fi1) + Math.sin(fi2)) / 2,
1500
- C = Math.cos(fi1) * Math.cos(fi1) + 2 * n * Math.sin(fi1),
1501
- theta = n * (lambda - lambda0),
1502
- ro = Math.sqrt(C - 2 * n * Math.sin(fi)) / n,
1503
- ro0 = Math.sqrt(C - 2 * n * Math.sin(fi0)) / n;
1284
+ lambda0 = c * this.radDeg,
1285
+ fi1 = 29.5 * this.radDeg,
1286
+ fi2 = 45.5 * this.radDeg,
1287
+ fi = lat * this.radDeg,
1288
+ lambda = lng * this.radDeg,
1289
+ n = (Math.sin(fi1) + Math.sin(fi2)) / 2,
1290
+ C = Math.cos(fi1) * Math.cos(fi1) + 2 * n * Math.sin(fi1),
1291
+ theta = n * (lambda - lambda0),
1292
+ ro = Math.sqrt(C - 2 * n * Math.sin(fi)) / n,
1293
+ ro0 = Math.sqrt(C - 2 * n * Math.sin(fi0)) / n;
1504
1294
  return {
1505
1295
  x: ro * Math.sin(theta) * this.radius,
1506
1296
  y: -(ro0 - ro * Math.cos(theta)) * this.radius
1507
1297
  };
1508
1298
  },
1509
-
1510
1299
  /* aea_inv(xCoord, yCoord, c) {
1511
1300
  var x = xCoord / this.radius,
1512
1301
  y = yCoord / this.radius,
@@ -1526,15 +1315,15 @@
1526
1315
  }, */
1527
1316
  lcc: function lcc(lat, lng, c) {
1528
1317
  var fi0 = 0,
1529
- lambda0 = c * this.radDeg,
1530
- lambda = lng * this.radDeg,
1531
- fi1 = 33 * this.radDeg,
1532
- fi2 = 45 * this.radDeg,
1533
- fi = lat * this.radDeg,
1534
- n = Math.log(Math.cos(fi1) * (1 / Math.cos(fi2))) / Math.log(Math.tan(Math.PI / 4 + fi2 / 2) * (1 / Math.tan(Math.PI / 4 + fi1 / 2))),
1535
- F = Math.cos(fi1) * Math.pow(Math.tan(Math.PI / 4 + fi1 / 2), n) / n,
1536
- ro = F * Math.pow(1 / Math.tan(Math.PI / 4 + fi / 2), n),
1537
- ro0 = F * Math.pow(1 / Math.tan(Math.PI / 4 + fi0 / 2), n);
1318
+ lambda0 = c * this.radDeg,
1319
+ lambda = lng * this.radDeg,
1320
+ fi1 = 33 * this.radDeg,
1321
+ fi2 = 45 * this.radDeg,
1322
+ fi = lat * this.radDeg,
1323
+ n = Math.log(Math.cos(fi1) * (1 / Math.cos(fi2))) / Math.log(Math.tan(Math.PI / 4 + fi2 / 2) * (1 / Math.tan(Math.PI / 4 + fi1 / 2))),
1324
+ F = Math.cos(fi1) * Math.pow(Math.tan(Math.PI / 4 + fi1 / 2), n) / n,
1325
+ ro = F * Math.pow(1 / Math.tan(Math.PI / 4 + fi / 2), n),
1326
+ ro0 = F * Math.pow(1 / Math.tan(Math.PI / 4 + fi0 / 2), n);
1538
1327
  return {
1539
1328
  x: ro * Math.sin(n * (lambda - lambda0)) * this.radius,
1540
1329
  y: -(ro0 - ro * Math.cos(n * (lambda - lambda0))) * this.radius
@@ -1557,43 +1346,36 @@
1557
1346
  lng: (lambda0 + theta / n) * this.degRad
1558
1347
  };
1559
1348
  } */
1560
-
1561
1349
  };
1562
1350
  Proj.degRad = 180 / Math.PI;
1563
1351
  Proj.radDeg = Math.PI / 180;
1564
1352
  Proj.radius = 6381372;
1565
1353
 
1566
1354
  function coordsToPoint(lat, lng) {
1567
- var point,
1568
- proj = Map.maps[this.params.map].projection,
1569
- centralMeridian = proj.centralMeridian,
1570
- inset,
1571
- bbox;
1572
- point = Proj[proj.type](lat, lng, centralMeridian);
1573
- inset = this.getInsetForPoint(point.x, point.y);
1574
-
1575
- if (inset) {
1576
- bbox = inset.bbox;
1577
- point.x = (point.x - bbox[0].x) / (bbox[1].x - bbox[0].x) * inset.width * this.scale;
1578
- point.y = (point.y - bbox[0].y) / (bbox[1].y - bbox[0].y) * inset.height * this.scale;
1579
- return {
1580
- x: point.x + this.transX * this.scale + inset.left * this.scale,
1581
- y: point.y + this.transY * this.scale + inset.top * this.scale
1582
- };
1355
+ var projection = Map.maps[this.params.map].projection;
1356
+ var _Proj$projection$type = Proj[projection.type](lat, lng, projection.centralMeridian),
1357
+ x = _Proj$projection$type.x,
1358
+ y = _Proj$projection$type.y;
1359
+ var inset = this.getInsetForPoint(x, y);
1360
+ if (!inset) {
1361
+ return false;
1583
1362
  }
1584
-
1585
- return false;
1363
+ var bbox = inset.bbox;
1364
+ x = (x - bbox[0].x) / (bbox[1].x - bbox[0].x) * inset.width * this.scale;
1365
+ y = (y - bbox[0].y) / (bbox[1].y - bbox[0].y) * inset.height * this.scale;
1366
+ return {
1367
+ x: x + this.transX * this.scale + inset.left * this.scale,
1368
+ y: y + this.transY * this.scale + inset.top * this.scale
1369
+ };
1586
1370
  }
1587
1371
 
1588
1372
  function getInsetForPoint(x, y) {
1589
- var index,
1590
- bbox,
1591
- insets = Map.maps[this.params.map].insets;
1592
-
1593
- for (index = 0; index < insets.length; index++) {
1594
- bbox = insets[index].bbox;
1595
-
1596
- if (x > bbox[0].x && x < bbox[1].x && y > bbox[0].y && y < bbox[1].y) {
1373
+ var insets = Map.maps[this.params.map].insets;
1374
+ for (var index = 0; index < insets.length; index++) {
1375
+ var _insets$index$bbox = insets[index].bbox,
1376
+ start = _insets$index$bbox[0],
1377
+ end = _insets$index$bbox[1];
1378
+ if (x > start.x && x < end.x && y > start.y && y < end.y) {
1597
1379
  return insets[index];
1598
1380
  }
1599
1381
  }
@@ -1601,11 +1383,9 @@
1601
1383
 
1602
1384
  function getMarkerPosition(_ref) {
1603
1385
  var coords = _ref.coords;
1604
-
1605
1386
  if (Map.maps[this.params.map].projection) {
1606
1387
  return this.coordsToPoint.apply(this, coords);
1607
1388
  }
1608
-
1609
1389
  return {
1610
1390
  x: coords[0] * this.scale + this.transX * this.scale,
1611
1391
  y: coords[1] * this.scale + this.transY * this.scale
@@ -1614,23 +1394,19 @@
1614
1394
 
1615
1395
  function repositionLines() {
1616
1396
  var point1 = false,
1617
- point2 = false;
1618
-
1619
- for (var index in this.lines) {
1620
- for (var mindex in this.markers) {
1621
- var marker = this.markers[mindex]; // console.log(this.lines[index], index);
1622
-
1623
- if (marker.config.name === this.lines[index].config.from) {
1397
+ point2 = false;
1398
+ for (var index in this._lines) {
1399
+ for (var mindex in this._markers) {
1400
+ var marker = this._markers[mindex];
1401
+ if (marker.config.name === this._lines[index].config.from) {
1624
1402
  point1 = this.getMarkerPosition(marker.config);
1625
1403
  }
1626
-
1627
- if (marker.config.name === this.lines[index].config.to) {
1404
+ if (marker.config.name === this._lines[index].config.to) {
1628
1405
  point2 = this.getMarkerPosition(marker.config);
1629
1406
  }
1630
1407
  }
1631
-
1632
1408
  if (point1 !== false && point2 !== false) {
1633
- this.lines[index].setStyle({
1409
+ this._lines[index].setStyle({
1634
1410
  x1: point1.x,
1635
1411
  y1: point1.y,
1636
1412
  x2: point2.x,
@@ -1641,13 +1417,10 @@
1641
1417
  }
1642
1418
 
1643
1419
  function repositionMarkers() {
1644
- var point;
1645
-
1646
- for (var index in this.markers) {
1647
- point = this.getMarkerPosition(this.markers[index].config);
1648
-
1420
+ for (var index in this._markers) {
1421
+ var point = this.getMarkerPosition(this._markers[index].config);
1649
1422
  if (point !== false) {
1650
- this.markers[index].element.setStyle({
1423
+ this._markers[index].element.setStyle({
1651
1424
  cx: point.x,
1652
1425
  cy: point.y
1653
1426
  });
@@ -1657,22 +1430,21 @@
1657
1430
 
1658
1431
  function repositionLabels() {
1659
1432
  var labels = this.params.labels;
1660
-
1661
1433
  if (!labels) {
1662
1434
  return;
1663
- } // Regions labels
1664
-
1435
+ }
1665
1436
 
1437
+ // Regions labels
1666
1438
  if (labels.regions) {
1667
1439
  for (var key in this.regions) {
1668
1440
  this.regions[key].element.updateLabelPosition();
1669
1441
  }
1670
- } // Markers labels
1671
-
1442
+ }
1672
1443
 
1444
+ // Markers labels
1673
1445
  if (labels.markers) {
1674
- for (var _key in this.markers) {
1675
- this.markers[_key].element.updateLabelPosition();
1446
+ for (var _key in this._markers) {
1447
+ this._markers[_key].element.updateLabelPosition();
1676
1448
  }
1677
1449
  }
1678
1450
  }
@@ -1791,33 +1563,29 @@
1791
1563
  * Class Definition
1792
1564
  * ------------------------------------------------------------------------
1793
1565
  */
1794
-
1795
1566
  var SVGElement = /*#__PURE__*/function () {
1796
1567
  function SVGElement(name, config) {
1797
1568
  this.node = this._createElement(name);
1798
-
1799
1569
  if (config) {
1800
1570
  this.set(config);
1801
1571
  }
1802
- } // Create new SVG element `svg`, `g`, `path`, `line`, `circle`, `image`, etc.
1803
- // https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS#important_namespace_uris
1804
-
1572
+ }
1805
1573
 
1574
+ // Create new SVG element `svg`, `g`, `path`, `line`, `circle`, `image`, etc.
1575
+ // https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS#important_namespace_uris
1806
1576
  var _proto = SVGElement.prototype;
1807
-
1808
1577
  _proto._createElement = function _createElement(tagName) {
1809
1578
  return document.createElementNS('http://www.w3.org/2000/svg', tagName);
1810
1579
  };
1811
-
1812
1580
  _proto.addClass = function addClass(className) {
1813
1581
  this.node.setAttribute('class', className);
1814
1582
  };
1815
-
1816
1583
  _proto.getBBox = function getBBox() {
1817
1584
  return this.node.getBBox();
1818
- } // Apply attributes on the current node element
1819
- ;
1585
+ }
1820
1586
 
1587
+ // Apply attributes on the current node element
1588
+ ;
1821
1589
  _proto.set = function set(property, value) {
1822
1590
  if (typeof property === 'object') {
1823
1591
  for (var attr in property) {
@@ -1827,19 +1595,15 @@
1827
1595
  this.applyAttr(property, value);
1828
1596
  }
1829
1597
  };
1830
-
1831
1598
  _proto.get = function get(property) {
1832
1599
  return this.style.initial[property];
1833
1600
  };
1834
-
1835
1601
  _proto.applyAttr = function applyAttr(property, value) {
1836
1602
  this.node.setAttribute(hyphenate(property), value);
1837
1603
  };
1838
-
1839
1604
  _proto.remove = function remove() {
1840
1605
  removeElement(this.node);
1841
1606
  };
1842
-
1843
1607
  return SVGElement;
1844
1608
  }();
1845
1609
 
@@ -1848,62 +1612,46 @@
1848
1612
  * Class Definition
1849
1613
  * ------------------------------------------------------------------------
1850
1614
  */
1851
-
1852
1615
  var SVGShapeElement = /*#__PURE__*/function (_SVGElement) {
1853
1616
  _inheritsLoose(SVGShapeElement, _SVGElement);
1854
-
1855
1617
  function SVGShapeElement(name, config, style) {
1856
1618
  var _this;
1857
-
1858
1619
  if (style === void 0) {
1859
1620
  style = {};
1860
1621
  }
1861
-
1862
1622
  _this = _SVGElement.call(this, name, config) || this;
1863
1623
  _this.isHovered = false;
1864
1624
  _this.isSelected = false;
1865
1625
  _this.style = style;
1866
1626
  _this.style.current = {};
1867
-
1868
1627
  _this.updateStyle();
1869
-
1870
1628
  return _this;
1871
1629
  }
1872
-
1873
1630
  var _proto = SVGShapeElement.prototype;
1874
-
1875
1631
  _proto.setStyle = function setStyle(property, value) {
1876
1632
  if (typeof property === 'object') {
1877
1633
  merge(this.style.current, property);
1878
1634
  } else {
1879
1635
  var _merge;
1880
-
1881
1636
  merge(this.style.current, (_merge = {}, _merge[property] = value, _merge));
1882
1637
  }
1883
-
1884
1638
  this.updateStyle();
1885
1639
  };
1886
-
1887
1640
  _proto.updateStyle = function updateStyle() {
1888
1641
  var attrs = {};
1889
1642
  merge(attrs, this.style.initial);
1890
1643
  merge(attrs, this.style.current);
1891
-
1892
1644
  if (this.isHovered) {
1893
1645
  merge(attrs, this.style.hover);
1894
1646
  }
1895
-
1896
1647
  if (this.isSelected) {
1897
1648
  merge(attrs, this.style.selected);
1898
-
1899
1649
  if (this.isHovered) {
1900
1650
  merge(attrs, this.style.selectedHover);
1901
1651
  }
1902
1652
  }
1903
-
1904
1653
  this.set(attrs);
1905
1654
  };
1906
-
1907
1655
  return SVGShapeElement;
1908
1656
  }(SVGElement);
1909
1657
 
@@ -1912,20 +1660,15 @@
1912
1660
  * Class Definition
1913
1661
  * ------------------------------------------------------------------------
1914
1662
  */
1915
-
1916
1663
  var SVGTextElement = /*#__PURE__*/function (_SVGShapeElement) {
1917
1664
  _inheritsLoose(SVGTextElement, _SVGShapeElement);
1918
-
1919
1665
  function SVGTextElement(config, style) {
1920
1666
  return _SVGShapeElement.call(this, 'text', config, style) || this;
1921
1667
  }
1922
-
1923
1668
  var _proto = SVGTextElement.prototype;
1924
-
1925
1669
  _proto.applyAttr = function applyAttr(attr, value) {
1926
1670
  attr === 'text' ? this.node.textContent = value : _SVGShapeElement.prototype.applyAttr.call(this, attr, value);
1927
1671
  };
1928
-
1929
1672
  return SVGTextElement;
1930
1673
  }(SVGShapeElement);
1931
1674
 
@@ -1934,19 +1677,14 @@
1934
1677
  * Class Definition
1935
1678
  * ------------------------------------------------------------------------
1936
1679
  */
1937
-
1938
1680
  var SVGImageElement = /*#__PURE__*/function (_SVGShapeElement) {
1939
1681
  _inheritsLoose(SVGImageElement, _SVGShapeElement);
1940
-
1941
1682
  function SVGImageElement(config, style) {
1942
1683
  return _SVGShapeElement.call(this, 'image', config, style) || this;
1943
1684
  }
1944
-
1945
1685
  var _proto = SVGImageElement.prototype;
1946
-
1947
1686
  _proto.applyAttr = function applyAttr(attr, value) {
1948
1687
  var imageUrl;
1949
-
1950
1688
  if (attr === 'image') {
1951
1689
  // This get executed when we have url in series.markers[0].scale.someScale.url
1952
1690
  if (typeof value === 'object') {
@@ -1956,9 +1694,9 @@
1956
1694
  imageUrl = value;
1957
1695
  this.offset = [0, 0];
1958
1696
  }
1697
+ this.node.setAttributeNS('http://www.w3.org/1999/xlink', 'href', imageUrl);
1959
1698
 
1960
- this.node.setAttributeNS('http://www.w3.org/1999/xlink', 'href', imageUrl); // Set width and height then call this `applyAttr` again
1961
-
1699
+ // Set width and height then call this `applyAttr` again
1962
1700
  this.width = 23;
1963
1701
  this.height = 23;
1964
1702
  this.applyAttr('width', this.width);
@@ -1967,13 +1705,11 @@
1967
1705
  this.applyAttr('y', this.cy - this.height / 2 + this.offset[1]);
1968
1706
  } else if (attr == 'cx') {
1969
1707
  this.cx = value;
1970
-
1971
1708
  if (this.width) {
1972
1709
  this.applyAttr('x', value - this.width / 2 + this.offset[0]);
1973
1710
  }
1974
1711
  } else if (attr == 'cy') {
1975
1712
  this.cy = value;
1976
-
1977
1713
  if (this.height) {
1978
1714
  this.applyAttr('y', value - this.height / 2 + this.offset[1]);
1979
1715
  }
@@ -1982,7 +1718,6 @@
1982
1718
  _SVGShapeElement.prototype.applyAttr.apply(this, arguments);
1983
1719
  }
1984
1720
  };
1985
-
1986
1721
  return SVGImageElement;
1987
1722
  }(SVGShapeElement);
1988
1723
 
@@ -1991,98 +1726,96 @@
1991
1726
  * Class Definition
1992
1727
  * ------------------------------------------------------------------------
1993
1728
  */
1994
-
1995
1729
  var SVGCanvasElement = /*#__PURE__*/function (_SVGElement) {
1996
1730
  _inheritsLoose(SVGCanvasElement, _SVGElement);
1997
-
1998
1731
  function SVGCanvasElement(container) {
1999
1732
  var _this;
2000
-
2001
1733
  _this = _SVGElement.call(this, 'svg') || this; // Create svg element for holding the whole map
2002
1734
 
2003
- _this._container = container; // Create the defs element
1735
+ _this._container = container;
2004
1736
 
2005
- _this._defsElement = new SVGElement('defs'); // Create group element which will hold the paths (regions)
1737
+ // Create the defs element
1738
+ _this._defsElement = new SVGElement('defs');
2006
1739
 
1740
+ // Create group element which will hold the paths (regions)
2007
1741
  _this._rootElement = new SVGElement('g', {
2008
1742
  id: 'jvm-regions-group'
2009
- }); // Append the defs element to the this.node (SVG tag)
2010
-
2011
- _this.node.appendChild(_this._defsElement.node); // Append the group to this.node (SVG tag)
2012
-
1743
+ });
2013
1744
 
2014
- _this.node.appendChild(_this._rootElement.node); // Append this.node (SVG tag) to the container
1745
+ // Append the defs element to the this.node (SVG tag)
1746
+ _this.node.appendChild(_this._defsElement.node);
2015
1747
 
1748
+ // Append the group to this.node (SVG tag)
1749
+ _this.node.appendChild(_this._rootElement.node);
2016
1750
 
1751
+ // Append this.node (SVG tag) to the container
2017
1752
  _this._container.appendChild(_this.node);
2018
-
2019
1753
  return _this;
2020
1754
  }
2021
-
2022
1755
  var _proto = SVGCanvasElement.prototype;
2023
-
2024
1756
  _proto.setSize = function setSize(width, height) {
2025
1757
  this.node.setAttribute('width', width);
2026
1758
  this.node.setAttribute('height', height);
2027
1759
  };
2028
-
2029
1760
  _proto.applyTransformParams = function applyTransformParams(scale, transX, transY) {
2030
1761
  this._rootElement.node.setAttribute('transform', "scale(" + scale + ") translate(" + transX + ", " + transY + ")");
2031
- } // Create `path` element
2032
- ;
1762
+ }
2033
1763
 
1764
+ // Create `path` element
1765
+ ;
2034
1766
  _proto.createPath = function createPath(config, style) {
2035
1767
  var path = new SVGShapeElement('path', config, style);
2036
1768
  path.node.setAttribute('fill-rule', 'evenodd');
2037
- return this.add(path);
2038
- } // Create `circle` element
2039
- ;
1769
+ return this._add(path);
1770
+ }
2040
1771
 
1772
+ // Create `circle` element
1773
+ ;
2041
1774
  _proto.createCircle = function createCircle(config, style, group) {
2042
1775
  var circle = new SVGShapeElement('circle', config, style);
2043
- return this.add(circle, group);
2044
- } // Create `line` element
2045
- ;
1776
+ return this._add(circle, group);
1777
+ }
2046
1778
 
1779
+ // Create `line` element
1780
+ ;
2047
1781
  _proto.createLine = function createLine(config, style, group) {
2048
1782
  var line = new SVGShapeElement('line', config, style);
2049
- return this.add(line, group);
2050
- } // Create `text` element
2051
- ;
1783
+ return this._add(line, group);
1784
+ }
2052
1785
 
1786
+ // Create `text` element
1787
+ ;
2053
1788
  _proto.createText = function createText(config, style, group) {
2054
- var text = new SVGTextElement(config, style); // extends SVGShapeElement
1789
+ var text = new SVGTextElement(config, style);
1790
+ return this._add(text, group);
1791
+ }
2055
1792
 
2056
- return this.add(text, group);
2057
- } // Create `image` element
1793
+ // Create `image` element
2058
1794
  ;
2059
-
2060
1795
  _proto.createImage = function createImage(config, style, group) {
2061
- var image = new SVGImageElement(config, style); // extends SVGShapeElement
1796
+ var image = new SVGImageElement(config, style);
1797
+ return this._add(image, group);
1798
+ }
2062
1799
 
2063
- return this.add(image, group);
2064
- } // Create `g` element
1800
+ // Create `g` element
2065
1801
  ;
2066
-
2067
1802
  _proto.createGroup = function createGroup(id) {
2068
1803
  var group = new SVGElement('g');
2069
1804
  this.node.appendChild(group.node);
2070
-
2071
1805
  if (id) {
2072
1806
  group.node.id = id;
2073
1807
  }
2074
-
2075
1808
  group.canvas = this;
2076
1809
  return group;
2077
- } // Add some element to a spcific group or the root element if the group isn't given
2078
- ;
1810
+ }
2079
1811
 
2080
- _proto.add = function add(element, group) {
1812
+ // Add some element to a spcific group or the root element if the group isn't given
1813
+ ;
1814
+ _proto._add = function _add(element, group) {
2081
1815
  group = group || this._rootElement;
2082
1816
  group.node.appendChild(element.node);
2083
1817
  return element;
2084
1818
  };
2085
-
2086
1819
  return SVGCanvasElement;
2087
1820
  }(SVGElement);
2088
1821
 
@@ -2091,110 +1824,88 @@
2091
1824
  * Class Definition
2092
1825
  * ------------------------------------------------------------------------
2093
1826
  */
2094
-
2095
1827
  var Tooltip = /*#__PURE__*/function (_BaseComponent) {
2096
1828
  _inheritsLoose(Tooltip, _BaseComponent);
2097
-
2098
1829
  function Tooltip(map) {
2099
1830
  var _this;
2100
-
2101
1831
  _this = _BaseComponent.call(this) || this;
2102
1832
  var tooltip = createElement('div', 'jvm-tooltip');
2103
1833
  _this._map = map;
2104
1834
  _this._tooltip = document.body.appendChild(tooltip);
2105
-
2106
1835
  _this._bindEventListeners();
2107
-
2108
1836
  return _assertThisInitialized(_this) || _assertThisInitialized(_this);
2109
1837
  }
2110
-
2111
1838
  var _proto = Tooltip.prototype;
2112
-
2113
1839
  _proto._bindEventListeners = function _bindEventListeners() {
2114
1840
  var _this2 = this;
2115
-
2116
1841
  EventHandler.on(this._map.container, 'mousemove', function (event) {
2117
1842
  if (!_this2._tooltip.classList.contains('active')) {
2118
1843
  return;
2119
1844
  }
2120
-
2121
1845
  var container = findElement(_this2._map.container, '#jvm-regions-group').getBoundingClientRect();
2122
1846
  var space = 5; // Space between the cursor and tooltip element
2123
- // Tooltip
2124
1847
 
1848
+ // Tooltip
2125
1849
  var _this2$_tooltip$getBo = _this2._tooltip.getBoundingClientRect(),
2126
- height = _this2$_tooltip$getBo.height,
2127
- width = _this2$_tooltip$getBo.width;
2128
-
1850
+ height = _this2$_tooltip$getBo.height,
1851
+ width = _this2$_tooltip$getBo.width;
2129
1852
  var topIsPassed = event.clientY <= container.top + height + space;
2130
1853
  var top = event.pageY - height - space;
2131
- var left = event.pageX - width - space; // Ensure the tooltip will never cross outside the canvas area(map)
1854
+ var left = event.pageX - width - space;
2132
1855
 
1856
+ // Ensure the tooltip will never cross outside the canvas area(map)
2133
1857
  if (topIsPassed) {
2134
1858
  // Top:
2135
- top += height + space; // The cursor is a bit larger from left side
1859
+ top += height + space;
2136
1860
 
1861
+ // The cursor is a bit larger from left side
2137
1862
  left -= space * 2;
2138
1863
  }
2139
-
2140
1864
  if (event.clientX < container.left + width + space) {
2141
1865
  // Left:
2142
1866
  left = event.pageX + space + 2;
2143
-
2144
1867
  if (topIsPassed) {
2145
1868
  left += space * 2;
2146
1869
  }
2147
1870
  }
2148
-
2149
1871
  _this2.css({
2150
1872
  top: top + "px",
2151
1873
  left: left + "px"
2152
1874
  });
2153
1875
  });
2154
1876
  };
2155
-
2156
1877
  _proto.getElement = function getElement() {
2157
1878
  return this._tooltip;
2158
1879
  };
2159
-
2160
1880
  _proto.show = function show() {
2161
1881
  this._tooltip.classList.add('active');
2162
1882
  };
2163
-
2164
1883
  _proto.hide = function hide() {
2165
1884
  this._tooltip.classList.remove('active');
2166
1885
  };
2167
-
2168
1886
  _proto.text = function text(string, html) {
2169
1887
  if (html === void 0) {
2170
1888
  html = false;
2171
1889
  }
2172
-
2173
1890
  var property = html ? 'innerHTML' : 'textContent';
2174
-
2175
1891
  if (!string) {
2176
1892
  return this._tooltip[property];
2177
1893
  }
2178
-
2179
1894
  this._tooltip[property] = string;
2180
1895
  };
2181
-
2182
1896
  _proto.css = function css(_css) {
2183
1897
  for (var style in _css) {
2184
1898
  this._tooltip.style[style] = _css[style];
2185
1899
  }
2186
-
2187
1900
  return this;
2188
1901
  };
2189
-
2190
1902
  return Tooltip;
2191
1903
  }(BaseComponent);
2192
1904
 
2193
1905
  var DataVisualization = /*#__PURE__*/function () {
2194
1906
  function DataVisualization(_ref, map) {
2195
1907
  var scale = _ref.scale,
2196
- values = _ref.values;
2197
- // Private
1908
+ values = _ref.values;
2198
1909
  this._scale = scale;
2199
1910
  this._values = values;
2200
1911
  this._fromColor = this.hexToRgb(scale[0]);
@@ -2203,41 +1914,31 @@
2203
1914
  this.setMinMaxValues(values);
2204
1915
  this.visualize();
2205
1916
  }
2206
-
2207
1917
  var _proto = DataVisualization.prototype;
2208
-
2209
1918
  _proto.setMinMaxValues = function setMinMaxValues(values) {
2210
1919
  this.min = Number.MAX_VALUE;
2211
1920
  this.max = 0;
2212
-
2213
1921
  for (var value in values) {
2214
1922
  value = parseFloat(values[value]);
2215
-
2216
1923
  if (value > this.max) {
2217
1924
  this.max = value;
2218
1925
  }
2219
-
2220
1926
  if (value < this.min) {
2221
1927
  this.min = value;
2222
1928
  }
2223
1929
  }
2224
1930
  };
2225
-
2226
1931
  _proto.visualize = function visualize() {
2227
1932
  var attrs = {},
2228
- value;
2229
-
1933
+ value;
2230
1934
  for (var regionCode in this._values) {
2231
1935
  value = parseFloat(this._values[regionCode]);
2232
-
2233
1936
  if (!isNaN(value)) {
2234
1937
  attrs[regionCode] = this.getValue(value);
2235
1938
  }
2236
1939
  }
2237
-
2238
1940
  this.setAttributes(attrs);
2239
1941
  };
2240
-
2241
1942
  _proto.setAttributes = function setAttributes(attrs) {
2242
1943
  for (var code in attrs) {
2243
1944
  if (this._map.regions[code]) {
@@ -2245,37 +1946,30 @@
2245
1946
  }
2246
1947
  }
2247
1948
  };
2248
-
2249
1949
  _proto.getValue = function getValue(value) {
2250
1950
  var hex,
2251
- color = "#";
2252
-
1951
+ color = '#';
2253
1952
  for (var i = 0; i < 3; i++) {
2254
1953
  hex = Math.round(this._fromColor[i] + (this._toColor[i] - this._fromColor[i]) * ((value - this.min) / (this.max - this.min))).toString(16);
2255
- color += (hex.length === 1 ? "0" : "") + hex;
1954
+ color += (hex.length === 1 ? '0' : '') + hex;
2256
1955
  }
2257
-
2258
1956
  return color;
2259
1957
  };
2260
-
2261
1958
  _proto.hexToRgb = function hexToRgb(h) {
2262
1959
  var r = 0,
2263
- g = 0,
2264
- b = 0;
2265
-
1960
+ g = 0,
1961
+ b = 0;
2266
1962
  if (h.length == 4) {
2267
- r = "0x" + h[1] + h[1];
2268
- g = "0x" + h[2] + h[2];
2269
- b = "0x" + h[3] + h[3];
1963
+ r = '0x' + h[1] + h[1];
1964
+ g = '0x' + h[2] + h[2];
1965
+ b = '0x' + h[3] + h[3];
2270
1966
  } else if (h.length == 7) {
2271
- r = "0x" + h[1] + h[2];
2272
- g = "0x" + h[3] + h[4];
2273
- b = "0x" + h[5] + h[6];
1967
+ r = '0x' + h[1] + h[2];
1968
+ g = '0x' + h[3] + h[4];
1969
+ b = '0x' + h[5] + h[6];
2274
1970
  }
2275
-
2276
1971
  return [parseInt(r), parseInt(g), parseInt(b)];
2277
1972
  };
2278
-
2279
1973
  return DataVisualization;
2280
1974
  }();
2281
1975
 
@@ -2284,38 +1978,36 @@
2284
1978
  * Class Definition
2285
1979
  * ------------------------------------------------------------------------
2286
1980
  */
2287
-
2288
1981
  var Map = /*#__PURE__*/function () {
2289
1982
  function Map(options) {
2290
1983
  var _this = this;
2291
-
2292
1984
  if (options === void 0) {
2293
1985
  options = {};
2294
1986
  }
2295
-
2296
1987
  // Merge the given options with the default options
2297
- this.params = merge(Map.defaults, options, true); // Throw an error if the given map name doesn't match
2298
- // the map that was set in map file
1988
+ this.params = merge(Map.defaults, options, true);
2299
1989
 
1990
+ // Throw an error if the given map name doesn't match
1991
+ // the map that was set in map file
2300
1992
  if (!Map.maps[this.params.map]) {
2301
1993
  throw new Error("Attempt to use map which was not loaded: " + options.map);
2302
1994
  }
2303
-
2304
- this.mapData = Map.maps[this.params.map];
2305
1995
  this.regions = {};
2306
- this.markers = {};
2307
- this.lines = {};
2308
- this.defaultWidth = this.mapData.width;
2309
- this.defaultHeight = this.mapData.height;
2310
- this.height = 0;
2311
- this.width = 0;
2312
1996
  this.scale = 1;
2313
- this.baseScale = 1;
2314
1997
  this.transX = 0;
2315
1998
  this.transY = 0;
2316
- this.baseTransX = 0;
2317
- this.baseTransY = 0; // `document` is already ready, just initialise now
2318
-
1999
+ this._mapData = Map.maps[this.params.map];
2000
+ this._markers = {};
2001
+ this._lines = {};
2002
+ this._defaultWidth = this._mapData.width;
2003
+ this._defaultHeight = this._mapData.height;
2004
+ this._height = 0;
2005
+ this._width = 0;
2006
+ this._baseScale = 1;
2007
+ this._baseTransX = 0;
2008
+ this._baseTransY = 0;
2009
+
2010
+ // `document` is already ready, just initialise now
2319
2011
  if (document.readyState !== 'loading') {
2320
2012
  this._init();
2321
2013
  } else {
@@ -2325,202 +2017,150 @@
2325
2017
  });
2326
2018
  }
2327
2019
  }
2328
-
2329
2020
  var _proto = Map.prototype;
2330
-
2331
2021
  _proto._init = function _init() {
2332
2022
  var options = this.params;
2333
2023
  this.container = getElement(options.selector);
2334
- this.container.classList.add('jvm-container'); // The map canvas element
2335
-
2336
- this.canvas = new SVGCanvasElement(this.container); // Set the map's background color
2337
-
2338
- this.setBackgroundColor(options.backgroundColor); // Create regions
2339
-
2340
- this._createRegions(); // Update size
2341
-
2024
+ this.container.classList.add('jvm-container');
2342
2025
 
2343
- this.updateSize(); // Create lines
2026
+ // The map canvas element
2027
+ this.canvas = new SVGCanvasElement(this.container);
2344
2028
 
2345
- this._createLines(options.lines || {}, options.markers || {}); // Create markers
2029
+ // Set the map's background color
2030
+ this.setBackgroundColor(options.backgroundColor);
2346
2031
 
2032
+ // Create regions
2033
+ this._createRegions();
2347
2034
 
2348
- this._createMarkers(options.markers); // Position labels
2035
+ // Update size
2036
+ this.updateSize();
2349
2037
 
2038
+ // Create lines
2039
+ this._createLines(options.lines || {}, options.markers || {});
2350
2040
 
2351
- this._repositionLabels(); // Setup the container events
2041
+ // Create markers
2042
+ this._createMarkers(options.markers);
2352
2043
 
2044
+ // Position labels
2045
+ this._repositionLabels();
2353
2046
 
2354
- this._setupContainerEvents(); // Setup regions/markers events
2355
-
2356
-
2357
- this._setupElementEvents(); // Create zoom buttons if `zoomButtons` is presented
2047
+ // Setup the container events
2048
+ this._setupContainerEvents();
2358
2049
 
2050
+ // Setup regions/markers events
2051
+ this._setupElementEvents();
2359
2052
 
2053
+ // Create zoom buttons if `zoomButtons` is presented
2360
2054
  if (options.zoomButtons) {
2361
2055
  this._setupZoomButtons();
2362
- } // Create toolip
2363
-
2056
+ }
2364
2057
 
2058
+ // Create toolip
2365
2059
  if (options.showTooltip) {
2366
- this.tooltip = new Tooltip(this);
2367
- } // Set selected regions if any
2368
-
2060
+ this._tooltip = new Tooltip(this);
2061
+ }
2369
2062
 
2063
+ // Set selected regions if any
2370
2064
  if (options.selectedRegions) {
2371
2065
  this._setSelected('regions', options.selectedRegions);
2372
- } // Set selected regions if any
2373
-
2066
+ }
2374
2067
 
2068
+ // Set selected regions if any
2375
2069
  if (options.selectedMarkers) {
2376
- this._setSelected('markers', options.selectedMarkers);
2377
- } // Set focus on a spcific region
2378
-
2070
+ this._setSelected('_markers', options.selectedMarkers);
2071
+ }
2379
2072
 
2073
+ // Set focus on a spcific region
2380
2074
  if (options.focusOn) {
2381
2075
  this.setFocus(options.focusOn);
2382
- } // Data visualization
2383
-
2076
+ }
2384
2077
 
2078
+ // Data visualization
2385
2079
  if (options.visualizeData) {
2386
2080
  this.dataVisualization = new DataVisualization(options.visualizeData, this);
2387
- } // Bind touch events if true
2388
-
2081
+ }
2389
2082
 
2083
+ // Bind touch events if true
2390
2084
  if (options.bindTouchEvents) {
2391
2085
  if ('ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch) {
2392
2086
  this._setupContainerTouchEvents();
2393
2087
  }
2394
- } // Create series if any
2395
-
2088
+ }
2396
2089
 
2090
+ // Create series if any
2397
2091
  if (options.series) {
2398
2092
  this.container.appendChild(this.legendHorizontal = createElement('div', 'jvm-series-container jvm-series-h'));
2399
2093
  this.container.appendChild(this.legendVertical = createElement('div', 'jvm-series-container jvm-series-v'));
2400
-
2401
2094
  this._createSeries();
2402
- } // Fire loaded event
2403
-
2095
+ }
2404
2096
 
2097
+ // Fire loaded event
2405
2098
  this._emit(Events.onLoaded, [this]);
2406
- };
2099
+ }
2407
2100
 
2408
- _proto._emit = function _emit(eventName, args) {
2409
- for (var event in Events) {
2410
- if (Events[event] === eventName && typeof this.params[event] === 'function') {
2411
- this.params[event].apply(this, args);
2412
- }
2413
- }
2414
- } // Public
2101
+ // Public
2415
2102
  ;
2416
-
2417
2103
  _proto.setBackgroundColor = function setBackgroundColor(color) {
2418
2104
  this.container.style.backgroundColor = color;
2419
- } // Get selected markers/regions
2420
- ;
2421
-
2422
- _proto._getSelected = function _getSelected(type) {
2423
- var key,
2424
- selected = [];
2425
-
2426
- for (key in this[type]) {
2427
- if (this[type][key].element.isSelected) {
2428
- selected.push(key);
2429
- }
2430
- }
2431
-
2432
- return selected;
2433
- };
2434
-
2435
- _proto._setSelected = function _setSelected(type, keys) {
2436
- var _this2 = this;
2437
-
2438
- keys.forEach(function (key) {
2439
- if (_this2[type][key]) {
2440
- _this2[type][key].element.select(true);
2441
- }
2442
- });
2443
- };
2444
-
2445
- _proto._clearSelected = function _clearSelected(type) {
2446
- var _this3 = this;
2105
+ }
2447
2106
 
2448
- this._getSelected(type).forEach(function (i) {
2449
- _this3[type][i].element.select(false);
2450
- });
2451
- } // Region methods
2107
+ // Region methods
2452
2108
  ;
2453
-
2454
2109
  _proto.getSelectedRegions = function getSelectedRegions() {
2455
2110
  return this._getSelected('regions');
2456
2111
  };
2457
-
2458
2112
  _proto.clearSelectedRegions = function clearSelectedRegions() {
2459
2113
  this._clearSelected('regions');
2460
- } // Markers methods
2461
- ;
2114
+ }
2462
2115
 
2116
+ // Markers methods
2117
+ ;
2463
2118
  _proto.getSelectedMarkers = function getSelectedMarkers() {
2464
- return this._getSelected('markers');
2119
+ return this._getSelected('_markers');
2465
2120
  };
2466
-
2467
2121
  _proto.clearSelectedMarkers = function clearSelectedMarkers() {
2468
- this._clearSelected('markers');
2122
+ this._clearSelected('_markers');
2469
2123
  };
2470
-
2471
2124
  _proto.addMarkers = function addMarkers(config) {
2472
2125
  if (Array.isArray(config)) {
2473
2126
  return this._createMarkers(config, true);
2474
2127
  }
2475
-
2476
2128
  this._createMarkers([config], true);
2477
2129
  };
2478
-
2479
2130
  _proto.removeMarkers = function removeMarkers(markers) {
2480
- var _this4 = this;
2481
-
2131
+ var _this2 = this;
2482
2132
  if (!markers) {
2483
- markers = Object.keys(this.markers);
2133
+ markers = Object.keys(this._markers);
2484
2134
  }
2485
-
2486
2135
  markers.forEach(function (index) {
2487
2136
  // Remove the element from the DOM
2488
- _this4.markers[index].element.remove(); // Remove the element from markers object
2489
-
2490
-
2491
- delete _this4.markers[index];
2137
+ _this2._markers[index].element.remove();
2138
+ // Remove the element from markers object
2139
+ delete _this2._markers[index];
2492
2140
  });
2493
2141
  };
2494
-
2495
2142
  _proto.addLine = function addLine(from, to, style) {
2496
2143
  if (style === void 0) {
2497
2144
  style = {};
2498
2145
  }
2499
-
2500
2146
  console.warn('`addLine` method is deprecated, please use `addLines` instead.');
2501
-
2502
2147
  this._createLines([{
2503
2148
  from: from,
2504
2149
  to: to,
2505
2150
  style: style
2506
- }], this.markers, true);
2151
+ }], this._markers, true);
2507
2152
  };
2508
-
2509
2153
  _proto.addLines = function addLines(config) {
2510
2154
  var uids = this._getLinesAsUids();
2511
-
2512
2155
  if (!Array.isArray(config)) {
2513
2156
  config = [config];
2514
2157
  }
2515
-
2516
2158
  this._createLines(config.filter(function (line) {
2517
2159
  return !(uids.indexOf(getLineUid(line.from, line.to)) > -1);
2518
- }), this.markers, true);
2160
+ }), this._markers, true);
2519
2161
  };
2520
-
2521
2162
  _proto.removeLines = function removeLines(lines) {
2522
- var _this5 = this;
2523
-
2163
+ var _this3 = this;
2524
2164
  if (Array.isArray(lines)) {
2525
2165
  lines = lines.map(function (line) {
2526
2166
  return getLineUid(line.from, line.to);
@@ -2528,93 +2168,117 @@
2528
2168
  } else {
2529
2169
  lines = this._getLinesAsUids();
2530
2170
  }
2531
-
2532
2171
  lines.forEach(function (uid) {
2533
- _this5.lines[uid].dispose();
2534
-
2535
- delete _this5.lines[uid];
2172
+ _this3._lines[uid].dispose();
2173
+ delete _this3._lines[uid];
2536
2174
  });
2537
2175
  };
2538
-
2539
- _proto._getLinesAsUids = function _getLinesAsUids() {
2540
- return Object.keys(this.lines);
2541
- };
2542
-
2543
2176
  _proto.removeLine = function removeLine(from, to) {
2544
2177
  console.warn('`removeLine` method is deprecated, please use `removeLines` instead.');
2545
2178
  var uid = getLineUid(from, to);
2546
-
2547
- if (this.lines.hasOwnProperty(uid)) {
2548
- this.lines[uid].element.remove();
2549
- delete this.lines[uid];
2179
+ if (this._lines.hasOwnProperty(uid)) {
2180
+ this._lines[uid].element.remove();
2181
+ delete this._lines[uid];
2550
2182
  }
2551
- } // Reset map
2552
- ;
2183
+ }
2553
2184
 
2185
+ // Reset map
2186
+ ;
2554
2187
  _proto.reset = function reset() {
2555
2188
  for (var key in this.series) {
2556
2189
  for (var i = 0; i < this.series[key].length; i++) {
2557
2190
  this.series[key][i].clear();
2558
2191
  }
2559
2192
  }
2560
-
2561
2193
  if (this.legendHorizontal) {
2562
2194
  removeElement(this.legendHorizontal);
2563
2195
  this.legendHorizontal = null;
2564
2196
  }
2565
-
2566
2197
  if (this.legendVertical) {
2567
2198
  removeElement(this.legendVertical);
2568
2199
  this.legendVertical = null;
2569
2200
  }
2570
-
2571
- this.scale = this.baseScale;
2572
- this.transX = this.baseTransX;
2573
- this.transY = this.baseTransY;
2574
-
2201
+ this.scale = this._baseScale;
2202
+ this.transX = this._baseTransX;
2203
+ this.transY = this._baseTransY;
2575
2204
  this._applyTransform();
2576
-
2577
2205
  this.clearSelectedMarkers();
2578
2206
  this.clearSelectedRegions();
2579
2207
  this.removeMarkers();
2580
- } // Destroy the map
2581
- ;
2208
+ }
2582
2209
 
2210
+ // Destroy the map
2211
+ ;
2583
2212
  _proto.destroy = function destroy(destroyInstance) {
2584
- var _this6 = this;
2585
-
2213
+ var _this4 = this;
2586
2214
  if (destroyInstance === void 0) {
2587
2215
  destroyInstance = true;
2588
2216
  }
2589
-
2590
2217
  // Remove event registry
2591
- EventHandler.flush(); // Remove tooltip from DOM and memory
2592
-
2593
- this.tooltip.dispose(); // Fire destroyed event
2218
+ EventHandler.flush();
2594
2219
 
2595
- this._emit(Events.onDestroyed); // Remove references
2220
+ // Remove tooltip from DOM and memory
2221
+ this._tooltip.dispose();
2596
2222
 
2223
+ // Fire destroyed event
2224
+ this._emit(Events.onDestroyed);
2597
2225
 
2226
+ // Remove references
2598
2227
  if (destroyInstance) {
2599
2228
  Object.keys(this).forEach(function (key) {
2600
2229
  try {
2601
- delete _this6[key];
2230
+ delete _this4[key];
2602
2231
  } catch (e) {}
2603
2232
  });
2604
2233
  }
2605
2234
  };
2606
-
2607
2235
  _proto.extend = function extend(name, callback) {
2608
2236
  if (typeof this[name] === 'function') {
2609
- throw new Error("The method [" + name + "] already exists internally please use another name.");
2237
+ throw new Error("The method [" + name + "] does already exist, please use another name.");
2610
2238
  }
2611
-
2612
2239
  Map.prototype[name] = callback;
2613
- };
2240
+ }
2614
2241
 
2242
+ // Private
2243
+ ;
2244
+ _proto._emit = function _emit(eventName, args) {
2245
+ for (var event in Events) {
2246
+ if (Events[event] === eventName && typeof this.params[event] === 'function') {
2247
+ this.params[event].apply(this, args);
2248
+ }
2249
+ }
2250
+ }
2251
+
2252
+ // Get selected markers/regions
2253
+ ;
2254
+ _proto._getSelected = function _getSelected(type) {
2255
+ var selected = [];
2256
+ for (var key in this[type]) {
2257
+ if (this[type][key].element.isSelected) {
2258
+ selected.push(key);
2259
+ }
2260
+ }
2261
+ return selected;
2262
+ };
2263
+ _proto._setSelected = function _setSelected(type, keys) {
2264
+ var _this5 = this;
2265
+ keys.forEach(function (key) {
2266
+ if (_this5[type][key]) {
2267
+ _this5[type][key].element.select(true);
2268
+ }
2269
+ });
2270
+ };
2271
+ _proto._clearSelected = function _clearSelected(type) {
2272
+ var _this6 = this;
2273
+ this._getSelected(type).forEach(function (key) {
2274
+ _this6[type][key].element.select(false);
2275
+ });
2276
+ };
2277
+ _proto._getLinesAsUids = function _getLinesAsUids() {
2278
+ return Object.keys(this._lines);
2279
+ };
2615
2280
  return Map;
2616
2281
  }();
2617
-
2618
2282
  Map.maps = {};
2619
2283
  Map.defaults = Defaults;
2620
2284
  Object.assign(Map.prototype, core);
@@ -2624,35 +2288,31 @@
2624
2288
  * Copyrights (c) Mustafa Omar https://github.com/themustafaomar
2625
2289
  * Released under the MIT License.
2626
2290
  */
2291
+
2627
2292
  /**
2628
2293
  * ------------------------------------------------------------------------
2629
2294
  * Class Definition
2630
2295
  * ------------------------------------------------------------------------
2631
2296
  */
2632
-
2633
2297
  var jsVectorMap = /*#__PURE__*/function () {
2634
2298
  function jsVectorMap(options) {
2635
2299
  if (options === void 0) {
2636
2300
  options = {};
2637
2301
  }
2638
-
2639
2302
  if (!options.selector) {
2640
2303
  throw new Error('Selector is not given.');
2641
2304
  }
2642
-
2643
2305
  return new Map(options);
2644
- } // Public
2645
-
2306
+ }
2646
2307
 
2308
+ // Public
2647
2309
  jsVectorMap.addMap = function addMap(name, map) {
2648
2310
  Map.maps[name] = map;
2649
2311
  };
2650
-
2651
2312
  return jsVectorMap;
2652
2313
  }();
2314
+ var index = window.jsVectorMap = jsVectorMap;
2653
2315
 
2654
- var jsvectormap = window.jsVectorMap = jsVectorMap;
2655
-
2656
- return jsvectormap;
2316
+ return index;
2657
2317
 
2658
2318
  }));