weaver 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/data/weaver/css/bootstrap.css +647 -205
  3. data/data/weaver/css/bootstrap.css.map +1 -0
  4. data/data/weaver/css/bootstrap.min.css +3 -3
  5. data/data/weaver/css/crossfade_style.css +19 -0
  6. data/data/weaver/css/patterns/1.png +0 -0
  7. data/data/weaver/css/patterns/2.png +0 -0
  8. data/data/weaver/css/patterns/3.png +0 -0
  9. data/data/weaver/css/patterns/4.png +0 -0
  10. data/data/weaver/css/patterns/5.png +0 -0
  11. data/data/weaver/css/patterns/6.png +0 -0
  12. data/data/weaver/css/patterns/7.png +0 -0
  13. data/data/weaver/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css +251 -0
  14. data/data/weaver/css/plugins/chartist/chartist.min.css +773 -0
  15. data/data/weaver/css/plugins/clockpicker/clockpicker.css +168 -0
  16. data/data/weaver/css/plugins/dataTables/dataTables.bootstrap.css +118 -190
  17. data/data/weaver/css/plugins/dataTables/dataTables.tableTools.min.css +1 -1
  18. data/data/weaver/css/plugins/daterangepicker/daterangepicker-bs3.css +335 -0
  19. data/data/weaver/css/plugins/footable/fonts/footable.eot +0 -0
  20. data/data/weaver/css/plugins/footable/fonts/footable.svg +78 -0
  21. data/data/weaver/css/plugins/footable/fonts/footable.ttf +0 -0
  22. data/data/weaver/css/plugins/footable/fonts/footable.woff +0 -0
  23. data/data/weaver/css/plugins/footable/footable.core.css +178 -0
  24. data/data/weaver/css/plugins/select2/select2.min.css +1 -0
  25. data/data/weaver/css/plugins/slick/ajax-loader.gif +0 -0
  26. data/data/weaver/css/plugins/slick/fonts/slick.eot +0 -0
  27. data/data/weaver/css/plugins/slick/fonts/slick.svg +14 -0
  28. data/data/weaver/css/plugins/slick/fonts/slick.ttf +0 -0
  29. data/data/weaver/css/plugins/slick/fonts/slick.woff +0 -0
  30. data/data/weaver/css/plugins/slick/slick-theme.css +201 -0
  31. data/data/weaver/css/plugins/slick/slick.css +119 -0
  32. data/data/weaver/css/plugins/sweetalert/sweetalert.css +715 -0
  33. data/data/weaver/css/style.css +4352 -1310
  34. data/data/weaver/css/style.min.css +1 -1
  35. data/data/weaver/fonts/glyphicons-halflings-regular.eot +0 -0
  36. data/data/weaver/fonts/glyphicons-halflings-regular.svg +273 -214
  37. data/data/weaver/fonts/glyphicons-halflings-regular.ttf +0 -0
  38. data/data/weaver/fonts/glyphicons-halflings-regular.woff +0 -0
  39. data/data/weaver/fonts/glyphicons-halflings-regular.woff2 +0 -0
  40. data/data/weaver/js/bootstrap.js +299 -212
  41. data/data/weaver/js/bootstrap.min.js +5 -5
  42. data/data/weaver/js/inspinia.js +184 -42
  43. data/data/weaver/js/plugins/chartist/chartist.min.js +9 -0
  44. data/data/weaver/js/plugins/chartist/chartist.min.js.map +1 -0
  45. data/data/weaver/js/plugins/clockpicker/clockpicker.js +729 -0
  46. data/data/weaver/js/plugins/dataTables/dataTables.bootstrap.js +195 -234
  47. data/data/weaver/js/plugins/dataTables/dataTables.tableTools.min.js +46 -45
  48. data/data/weaver/js/plugins/dataTables/jquery.dataTables.js +628 -373
  49. data/data/weaver/js/plugins/dataTables/swf/copy_csv_xls.swf +0 -0
  50. data/data/weaver/js/plugins/dataTables/swf/copy_csv_xls_pdf.swf +0 -0
  51. data/data/weaver/js/plugins/daterangepicker/daterangepicker.js +1304 -0
  52. data/data/weaver/js/plugins/diff_match_patch/COPYING +177 -0
  53. data/data/weaver/js/plugins/diff_match_patch/README.txt +43 -0
  54. data/data/weaver/js/plugins/diff_match_patch/javascript/diff_match_patch.js +49 -0
  55. data/data/weaver/js/plugins/footable/footable.all.min.js +14 -0
  56. data/data/weaver/js/plugins/fullcalendar/moment.min.js +3 -3
  57. data/data/weaver/js/plugins/idle-timer/idle-timer.min.js +2 -0
  58. data/data/weaver/js/plugins/jvectormap/jquery-jvectormap-2.0.2.css +130 -0
  59. data/data/weaver/js/plugins/jvectormap/jquery-jvectormap-2.0.2.min.js +3328 -0
  60. data/data/weaver/js/plugins/masonary/masonry.pkgd.min.js +9 -0
  61. data/data/weaver/js/plugins/metisMenu/jquery.metisMenu.js +3 -113
  62. data/data/weaver/js/plugins/morris/morris.js +27 -23
  63. data/data/weaver/js/plugins/pace/pace.min.js +2 -2
  64. data/data/weaver/js/plugins/preetyTextDiff/jquery.pretty-text-diff.min.js +76 -0
  65. data/data/weaver/js/plugins/select2/select2.full.min.js +3 -0
  66. data/data/weaver/js/plugins/slick/slick.min.js +18 -0
  67. data/data/weaver/js/plugins/slimscroll/jquery.slimscroll.js +96 -90
  68. data/data/weaver/js/plugins/slimscroll/jquery.slimscroll.min.js +10 -10
  69. data/data/weaver/js/plugins/sweetalert/sweetalert.min.js +1 -0
  70. data/data/weaver/js/plugins/tinycon/tinycon.min.js +8 -0
  71. data/data/weaver/js/plugins/wow/wow.min.js +2 -0
  72. data/{bin → exe}/weaver +3 -2
  73. data/lib/weaver.rb +236 -53
  74. data/lib/weaver/version.rb +1 -1
  75. data/weaver.gemspec +2 -2
  76. metadata +50 -7
  77. data/data/weaver/js/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js +0 -8
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,43 @@
1
+ Diff, Match and Patch Library
2
+ http://code.google.com/p/google-diff-match-patch/
3
+ Neil Fraser
4
+
5
+ This library is currently available in seven different ports, all using the same API.
6
+ Every version includes a full set of unit tests.
7
+
8
+ C++:
9
+ * Ported by Mike Slemmer.
10
+ * Currently requires the Qt library.
11
+
12
+ C#:
13
+ * Ported by Matthaeus G. Chajdas.
14
+
15
+ Dart:
16
+ * The Dart language is still growing and evolving, so this port is only as
17
+ stable as the underlying language.
18
+
19
+ Java:
20
+ * Included is both the source and a Maven package.
21
+
22
+ JavaScript:
23
+ * diff_match_patch_uncompressed.js is the human-readable version.
24
+ Users of node.js should 'require' this uncompressed version since the
25
+ compressed version is not guaranteed to work outside of a web browser.
26
+ * diff_match_patch.js has been compressed using Google's internal JavaScript compressor.
27
+ Non-Google hackers who wish to recompress the source can use:
28
+ http://dean.edwards.name/packer/
29
+
30
+ Lua:
31
+ * Ported by Duncan Cross.
32
+ * Does not support line-mode speedup.
33
+
34
+ Objective C:
35
+ * Ported by Jan Weiss.
36
+ * Includes speed test (this is a separate bundle for other languages).
37
+
38
+ Python:
39
+ * Two versions, one for Python 2.x, the other for Python 3.x.
40
+ * Runs 10x faster under PyPy than CPython.
41
+
42
+ Demos:
43
+ * Separate demos for Diff, Match and Patch in JavaScript.
@@ -0,0 +1,49 @@
1
+ (function(){function diff_match_patch(){this.Diff_Timeout=1;this.Diff_EditCost=4;this.Match_Threshold=0.5;this.Match_Distance=1E3;this.Patch_DeleteThreshold=0.5;this.Patch_Margin=4;this.Match_MaxBits=32}
2
+ diff_match_patch.prototype.diff_main=function(a,b,c,d){"undefined"==typeof d&&(d=0>=this.Diff_Timeout?Number.MAX_VALUE:(new Date).getTime()+1E3*this.Diff_Timeout);if(null==a||null==b)throw Error("Null input. (diff_main)");if(a==b)return a?[[0,a]]:[];"undefined"==typeof c&&(c=!0);var e=c,f=this.diff_commonPrefix(a,b);c=a.substring(0,f);a=a.substring(f);b=b.substring(f);var f=this.diff_commonSuffix(a,b),g=a.substring(a.length-f);a=a.substring(0,a.length-f);b=b.substring(0,b.length-f);a=this.diff_compute_(a,
3
+ b,e,d);c&&a.unshift([0,c]);g&&a.push([0,g]);this.diff_cleanupMerge(a);return a};
4
+ diff_match_patch.prototype.diff_compute_=function(a,b,c,d){if(!a)return[[1,b]];if(!b)return[[-1,a]];var e=a.length>b.length?a:b,f=a.length>b.length?b:a,g=e.indexOf(f);return-1!=g?(c=[[1,e.substring(0,g)],[0,f],[1,e.substring(g+f.length)]],a.length>b.length&&(c[0][0]=c[2][0]=-1),c):1==f.length?[[-1,a],[1,b]]:(e=this.diff_halfMatch_(a,b))?(f=e[0],a=e[1],g=e[2],b=e[3],e=e[4],f=this.diff_main(f,g,c,d),c=this.diff_main(a,b,c,d),f.concat([[0,e]],c)):c&&100<a.length&&100<b.length?this.diff_lineMode_(a,b,
5
+ d):this.diff_bisect_(a,b,d)};
6
+ diff_match_patch.prototype.diff_lineMode_=function(a,b,c){var d=this.diff_linesToChars_(a,b);a=d.chars1;b=d.chars2;d=d.lineArray;a=this.diff_main(a,b,!1,c);this.diff_charsToLines_(a,d);this.diff_cleanupSemantic(a);a.push([0,""]);for(var e=d=b=0,f="",g="";b<a.length;){switch(a[b][0]){case 1:e++;g+=a[b][1];break;case -1:d++;f+=a[b][1];break;case 0:if(1<=d&&1<=e){a.splice(b-d-e,d+e);b=b-d-e;d=this.diff_main(f,g,!1,c);for(e=d.length-1;0<=e;e--)a.splice(b,0,d[e]);b+=d.length}d=e=0;g=f=""}b++}a.pop();return a};
7
+ diff_match_patch.prototype.diff_bisect_=function(a,b,c){for(var d=a.length,e=b.length,f=Math.ceil((d+e)/2),g=f,h=2*f,j=Array(h),i=Array(h),k=0;k<h;k++)j[k]=-1,i[k]=-1;j[g+1]=0;i[g+1]=0;for(var k=d-e,q=0!=k%2,r=0,t=0,p=0,w=0,v=0;v<f&&!((new Date).getTime()>c);v++){for(var n=-v+r;n<=v-t;n+=2){var l=g+n,m;m=n==-v||n!=v&&j[l-1]<j[l+1]?j[l+1]:j[l-1]+1;for(var s=m-n;m<d&&s<e&&a.charAt(m)==b.charAt(s);)m++,s++;j[l]=m;if(m>d)t+=2;else if(s>e)r+=2;else if(q&&(l=g+k-n,0<=l&&l<h&&-1!=i[l])){var u=d-i[l];if(m>=
8
+ u)return this.diff_bisectSplit_(a,b,m,s,c)}}for(n=-v+p;n<=v-w;n+=2){l=g+n;u=n==-v||n!=v&&i[l-1]<i[l+1]?i[l+1]:i[l-1]+1;for(m=u-n;u<d&&m<e&&a.charAt(d-u-1)==b.charAt(e-m-1);)u++,m++;i[l]=u;if(u>d)w+=2;else if(m>e)p+=2;else if(!q&&(l=g+k-n,0<=l&&(l<h&&-1!=j[l])&&(m=j[l],s=g+m-l,u=d-u,m>=u)))return this.diff_bisectSplit_(a,b,m,s,c)}}return[[-1,a],[1,b]]};
9
+ diff_match_patch.prototype.diff_bisectSplit_=function(a,b,c,d,e){var f=a.substring(0,c),g=b.substring(0,d);a=a.substring(c);b=b.substring(d);f=this.diff_main(f,g,!1,e);e=this.diff_main(a,b,!1,e);return f.concat(e)};
10
+ diff_match_patch.prototype.diff_linesToChars_=function(a,b){function c(a){for(var b="",c=0,f=-1,g=d.length;f<a.length-1;){f=a.indexOf("\n",c);-1==f&&(f=a.length-1);var r=a.substring(c,f+1),c=f+1;(e.hasOwnProperty?e.hasOwnProperty(r):void 0!==e[r])?b+=String.fromCharCode(e[r]):(b+=String.fromCharCode(g),e[r]=g,d[g++]=r)}return b}var d=[],e={};d[0]="";var f=c(a),g=c(b);return{chars1:f,chars2:g,lineArray:d}};
11
+ diff_match_patch.prototype.diff_charsToLines_=function(a,b){for(var c=0;c<a.length;c++){for(var d=a[c][1],e=[],f=0;f<d.length;f++)e[f]=b[d.charCodeAt(f)];a[c][1]=e.join("")}};diff_match_patch.prototype.diff_commonPrefix=function(a,b){if(!a||!b||a.charAt(0)!=b.charAt(0))return 0;for(var c=0,d=Math.min(a.length,b.length),e=d,f=0;c<e;)a.substring(f,e)==b.substring(f,e)?f=c=e:d=e,e=Math.floor((d-c)/2+c);return e};
12
+ diff_match_patch.prototype.diff_commonSuffix=function(a,b){if(!a||!b||a.charAt(a.length-1)!=b.charAt(b.length-1))return 0;for(var c=0,d=Math.min(a.length,b.length),e=d,f=0;c<e;)a.substring(a.length-e,a.length-f)==b.substring(b.length-e,b.length-f)?f=c=e:d=e,e=Math.floor((d-c)/2+c);return e};
13
+ diff_match_patch.prototype.diff_commonOverlap_=function(a,b){var c=a.length,d=b.length;if(0==c||0==d)return 0;c>d?a=a.substring(c-d):c<d&&(b=b.substring(0,c));c=Math.min(c,d);if(a==b)return c;for(var d=0,e=1;;){var f=a.substring(c-e),f=b.indexOf(f);if(-1==f)return d;e+=f;if(0==f||a.substring(c-e)==b.substring(0,e))d=e,e++}};
14
+ diff_match_patch.prototype.diff_halfMatch_=function(a,b){function c(a,b,c){for(var d=a.substring(c,c+Math.floor(a.length/4)),e=-1,g="",h,j,n,l;-1!=(e=b.indexOf(d,e+1));){var m=f.diff_commonPrefix(a.substring(c),b.substring(e)),s=f.diff_commonSuffix(a.substring(0,c),b.substring(0,e));g.length<s+m&&(g=b.substring(e-s,e)+b.substring(e,e+m),h=a.substring(0,c-s),j=a.substring(c+m),n=b.substring(0,e-s),l=b.substring(e+m))}return 2*g.length>=a.length?[h,j,n,l,g]:null}if(0>=this.Diff_Timeout)return null;
15
+ var d=a.length>b.length?a:b,e=a.length>b.length?b:a;if(4>d.length||2*e.length<d.length)return null;var f=this,g=c(d,e,Math.ceil(d.length/4)),d=c(d,e,Math.ceil(d.length/2)),h;if(!g&&!d)return null;h=d?g?g[4].length>d[4].length?g:d:d:g;var j;a.length>b.length?(g=h[0],d=h[1],e=h[2],j=h[3]):(e=h[0],j=h[1],g=h[2],d=h[3]);h=h[4];return[g,d,e,j,h]};
16
+ diff_match_patch.prototype.diff_cleanupSemantic=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=0,h=0,j=0,i=0;f<a.length;)0==a[f][0]?(c[d++]=f,g=j,h=i,i=j=0,e=a[f][1]):(1==a[f][0]?j+=a[f][1].length:i+=a[f][1].length,e&&(e.length<=Math.max(g,h)&&e.length<=Math.max(j,i))&&(a.splice(c[d-1],0,[-1,e]),a[c[d-1]+1][0]=1,d--,d--,f=0<d?c[d-1]:-1,i=j=h=g=0,e=null,b=!0)),f++;b&&this.diff_cleanupMerge(a);this.diff_cleanupSemanticLossless(a);for(f=1;f<a.length;){if(-1==a[f-1][0]&&1==a[f][0]){b=a[f-1][1];c=a[f][1];
17
+ d=this.diff_commonOverlap_(b,c);e=this.diff_commonOverlap_(c,b);if(d>=e){if(d>=b.length/2||d>=c.length/2)a.splice(f,0,[0,c.substring(0,d)]),a[f-1][1]=b.substring(0,b.length-d),a[f+1][1]=c.substring(d),f++}else if(e>=b.length/2||e>=c.length/2)a.splice(f,0,[0,b.substring(0,e)]),a[f-1][0]=1,a[f-1][1]=c.substring(0,c.length-e),a[f+1][0]=-1,a[f+1][1]=b.substring(e),f++;f++}f++}};
18
+ diff_match_patch.prototype.diff_cleanupSemanticLossless=function(a){function b(a,b){if(!a||!b)return 6;var c=a.charAt(a.length-1),d=b.charAt(0),e=c.match(diff_match_patch.nonAlphaNumericRegex_),f=d.match(diff_match_patch.nonAlphaNumericRegex_),g=e&&c.match(diff_match_patch.whitespaceRegex_),h=f&&d.match(diff_match_patch.whitespaceRegex_),c=g&&c.match(diff_match_patch.linebreakRegex_),d=h&&d.match(diff_match_patch.linebreakRegex_),i=c&&a.match(diff_match_patch.blanklineEndRegex_),j=d&&b.match(diff_match_patch.blanklineStartRegex_);
19
+ return i||j?5:c||d?4:e&&!g&&h?3:g||h?2:e||f?1:0}for(var c=1;c<a.length-1;){if(0==a[c-1][0]&&0==a[c+1][0]){var d=a[c-1][1],e=a[c][1],f=a[c+1][1],g=this.diff_commonSuffix(d,e);if(g)var h=e.substring(e.length-g),d=d.substring(0,d.length-g),e=h+e.substring(0,e.length-g),f=h+f;for(var g=d,h=e,j=f,i=b(d,e)+b(e,f);e.charAt(0)===f.charAt(0);){var d=d+e.charAt(0),e=e.substring(1)+f.charAt(0),f=f.substring(1),k=b(d,e)+b(e,f);k>=i&&(i=k,g=d,h=e,j=f)}a[c-1][1]!=g&&(g?a[c-1][1]=g:(a.splice(c-1,1),c--),a[c][1]=
20
+ h,j?a[c+1][1]=j:(a.splice(c+1,1),c--))}c++}};diff_match_patch.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;diff_match_patch.whitespaceRegex_=/\s/;diff_match_patch.linebreakRegex_=/[\r\n]/;diff_match_patch.blanklineEndRegex_=/\n\r?\n$/;diff_match_patch.blanklineStartRegex_=/^\r?\n\r?\n/;
21
+ diff_match_patch.prototype.diff_cleanupEfficiency=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=!1,h=!1,j=!1,i=!1;f<a.length;){if(0==a[f][0])a[f][1].length<this.Diff_EditCost&&(j||i)?(c[d++]=f,g=j,h=i,e=a[f][1]):(d=0,e=null),j=i=!1;else if(-1==a[f][0]?i=!0:j=!0,e&&(g&&h&&j&&i||e.length<this.Diff_EditCost/2&&3==g+h+j+i))a.splice(c[d-1],0,[-1,e]),a[c[d-1]+1][0]=1,d--,e=null,g&&h?(j=i=!0,d=0):(d--,f=0<d?c[d-1]:-1,j=i=!1),b=!0;f++}b&&this.diff_cleanupMerge(a)};
22
+ diff_match_patch.prototype.diff_cleanupMerge=function(a){a.push([0,""]);for(var b=0,c=0,d=0,e="",f="",g;b<a.length;)switch(a[b][0]){case 1:d++;f+=a[b][1];b++;break;case -1:c++;e+=a[b][1];b++;break;case 0:1<c+d?(0!==c&&0!==d&&(g=this.diff_commonPrefix(f,e),0!==g&&(0<b-c-d&&0==a[b-c-d-1][0]?a[b-c-d-1][1]+=f.substring(0,g):(a.splice(0,0,[0,f.substring(0,g)]),b++),f=f.substring(g),e=e.substring(g)),g=this.diff_commonSuffix(f,e),0!==g&&(a[b][1]=f.substring(f.length-g)+a[b][1],f=f.substring(0,f.length-
23
+ g),e=e.substring(0,e.length-g))),0===c?a.splice(b-d,c+d,[1,f]):0===d?a.splice(b-c,c+d,[-1,e]):a.splice(b-c-d,c+d,[-1,e],[1,f]),b=b-c-d+(c?1:0)+(d?1:0)+1):0!==b&&0==a[b-1][0]?(a[b-1][1]+=a[b][1],a.splice(b,1)):b++,c=d=0,f=e=""}""===a[a.length-1][1]&&a.pop();c=!1;for(b=1;b<a.length-1;)0==a[b-1][0]&&0==a[b+1][0]&&(a[b][1].substring(a[b][1].length-a[b-1][1].length)==a[b-1][1]?(a[b][1]=a[b-1][1]+a[b][1].substring(0,a[b][1].length-a[b-1][1].length),a[b+1][1]=a[b-1][1]+a[b+1][1],a.splice(b-1,1),c=!0):a[b][1].substring(0,
24
+ a[b+1][1].length)==a[b+1][1]&&(a[b-1][1]+=a[b+1][1],a[b][1]=a[b][1].substring(a[b+1][1].length)+a[b+1][1],a.splice(b+1,1),c=!0)),b++;c&&this.diff_cleanupMerge(a)};diff_match_patch.prototype.diff_xIndex=function(a,b){var c=0,d=0,e=0,f=0,g;for(g=0;g<a.length;g++){1!==a[g][0]&&(c+=a[g][1].length);-1!==a[g][0]&&(d+=a[g][1].length);if(c>b)break;e=c;f=d}return a.length!=g&&-1===a[g][0]?f:f+(b-e)};
25
+ diff_match_patch.prototype.diff_prettyHtml=function(a){for(var b=[],c=/&/g,d=/</g,e=/>/g,f=/\n/g,g=0;g<a.length;g++){var h=a[g][0],j=a[g][1],j=j.replace(c,"&amp;").replace(d,"&lt;").replace(e,"&gt;").replace(f,"&para;<br>");switch(h){case 1:b[g]='<ins style="background:#e6ffe6;">'+j+"</ins>";break;case -1:b[g]='<del style="background:#ffe6e6;">'+j+"</del>";break;case 0:b[g]="<span>"+j+"</span>"}}return b.join("")};
26
+ diff_match_patch.prototype.diff_text1=function(a){for(var b=[],c=0;c<a.length;c++)1!==a[c][0]&&(b[c]=a[c][1]);return b.join("")};diff_match_patch.prototype.diff_text2=function(a){for(var b=[],c=0;c<a.length;c++)-1!==a[c][0]&&(b[c]=a[c][1]);return b.join("")};diff_match_patch.prototype.diff_levenshtein=function(a){for(var b=0,c=0,d=0,e=0;e<a.length;e++){var f=a[e][0],g=a[e][1];switch(f){case 1:c+=g.length;break;case -1:d+=g.length;break;case 0:b+=Math.max(c,d),d=c=0}}return b+=Math.max(c,d)};
27
+ diff_match_patch.prototype.diff_toDelta=function(a){for(var b=[],c=0;c<a.length;c++)switch(a[c][0]){case 1:b[c]="+"+encodeURI(a[c][1]);break;case -1:b[c]="-"+a[c][1].length;break;case 0:b[c]="="+a[c][1].length}return b.join("\t").replace(/%20/g," ")};
28
+ diff_match_patch.prototype.diff_fromDelta=function(a,b){for(var c=[],d=0,e=0,f=b.split(/\t/g),g=0;g<f.length;g++){var h=f[g].substring(1);switch(f[g].charAt(0)){case "+":try{c[d++]=[1,decodeURI(h)]}catch(j){throw Error("Illegal escape in diff_fromDelta: "+h);}break;case "-":case "=":var i=parseInt(h,10);if(isNaN(i)||0>i)throw Error("Invalid number in diff_fromDelta: "+h);h=a.substring(e,e+=i);"="==f[g].charAt(0)?c[d++]=[0,h]:c[d++]=[-1,h];break;default:if(f[g])throw Error("Invalid diff operation in diff_fromDelta: "+
29
+ f[g]);}}if(e!=a.length)throw Error("Delta length ("+e+") does not equal source text length ("+a.length+").");return c};diff_match_patch.prototype.match_main=function(a,b,c){if(null==a||null==b||null==c)throw Error("Null input. (match_main)");c=Math.max(0,Math.min(c,a.length));return a==b?0:a.length?a.substring(c,c+b.length)==b?c:this.match_bitap_(a,b,c):-1};
30
+ diff_match_patch.prototype.match_bitap_=function(a,b,c){function d(a,d){var e=a/b.length,g=Math.abs(c-d);return!f.Match_Distance?g?1:e:e+g/f.Match_Distance}if(b.length>this.Match_MaxBits)throw Error("Pattern too long for this browser.");var e=this.match_alphabet_(b),f=this,g=this.Match_Threshold,h=a.indexOf(b,c);-1!=h&&(g=Math.min(d(0,h),g),h=a.lastIndexOf(b,c+b.length),-1!=h&&(g=Math.min(d(0,h),g)));for(var j=1<<b.length-1,h=-1,i,k,q=b.length+a.length,r,t=0;t<b.length;t++){i=0;for(k=q;i<k;)d(t,c+
31
+ k)<=g?i=k:q=k,k=Math.floor((q-i)/2+i);q=k;i=Math.max(1,c-k+1);var p=Math.min(c+k,a.length)+b.length;k=Array(p+2);for(k[p+1]=(1<<t)-1;p>=i;p--){var w=e[a.charAt(p-1)];k[p]=0===t?(k[p+1]<<1|1)&w:(k[p+1]<<1|1)&w|((r[p+1]|r[p])<<1|1)|r[p+1];if(k[p]&j&&(w=d(t,p-1),w<=g))if(g=w,h=p-1,h>c)i=Math.max(1,2*c-h);else break}if(d(t+1,c)>g)break;r=k}return h};
32
+ diff_match_patch.prototype.match_alphabet_=function(a){for(var b={},c=0;c<a.length;c++)b[a.charAt(c)]=0;for(c=0;c<a.length;c++)b[a.charAt(c)]|=1<<a.length-c-1;return b};
33
+ diff_match_patch.prototype.patch_addContext_=function(a,b){if(0!=b.length){for(var c=b.substring(a.start2,a.start2+a.length1),d=0;b.indexOf(c)!=b.lastIndexOf(c)&&c.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)d+=this.Patch_Margin,c=b.substring(a.start2-d,a.start2+a.length1+d);d+=this.Patch_Margin;(c=b.substring(a.start2-d,a.start2))&&a.diffs.unshift([0,c]);(d=b.substring(a.start2+a.length1,a.start2+a.length1+d))&&a.diffs.push([0,d]);a.start1-=c.length;a.start2-=c.length;a.length1+=
34
+ c.length+d.length;a.length2+=c.length+d.length}};
35
+ diff_match_patch.prototype.patch_make=function(a,b,c){var d;if("string"==typeof a&&"string"==typeof b&&"undefined"==typeof c)d=a,b=this.diff_main(d,b,!0),2<b.length&&(this.diff_cleanupSemantic(b),this.diff_cleanupEfficiency(b));else if(a&&"object"==typeof a&&"undefined"==typeof b&&"undefined"==typeof c)b=a,d=this.diff_text1(b);else if("string"==typeof a&&b&&"object"==typeof b&&"undefined"==typeof c)d=a;else if("string"==typeof a&&"string"==typeof b&&c&&"object"==typeof c)d=a,b=c;else throw Error("Unknown call format to patch_make.");
36
+ if(0===b.length)return[];c=[];a=new diff_match_patch.patch_obj;for(var e=0,f=0,g=0,h=d,j=0;j<b.length;j++){var i=b[j][0],k=b[j][1];!e&&0!==i&&(a.start1=f,a.start2=g);switch(i){case 1:a.diffs[e++]=b[j];a.length2+=k.length;d=d.substring(0,g)+k+d.substring(g);break;case -1:a.length1+=k.length;a.diffs[e++]=b[j];d=d.substring(0,g)+d.substring(g+k.length);break;case 0:k.length<=2*this.Patch_Margin&&e&&b.length!=j+1?(a.diffs[e++]=b[j],a.length1+=k.length,a.length2+=k.length):k.length>=2*this.Patch_Margin&&
37
+ e&&(this.patch_addContext_(a,h),c.push(a),a=new diff_match_patch.patch_obj,e=0,h=d,f=g)}1!==i&&(f+=k.length);-1!==i&&(g+=k.length)}e&&(this.patch_addContext_(a,h),c.push(a));return c};diff_match_patch.prototype.patch_deepCopy=function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c],e=new diff_match_patch.patch_obj;e.diffs=[];for(var f=0;f<d.diffs.length;f++)e.diffs[f]=d.diffs[f].slice();e.start1=d.start1;e.start2=d.start2;e.length1=d.length1;e.length2=d.length2;b[c]=e}return b};
38
+ diff_match_patch.prototype.patch_apply=function(a,b){if(0==a.length)return[b,[]];a=this.patch_deepCopy(a);var c=this.patch_addPadding(a);b=c+b+c;this.patch_splitMax(a);for(var d=0,e=[],f=0;f<a.length;f++){var g=a[f].start2+d,h=this.diff_text1(a[f].diffs),j,i=-1;if(h.length>this.Match_MaxBits){if(j=this.match_main(b,h.substring(0,this.Match_MaxBits),g),-1!=j&&(i=this.match_main(b,h.substring(h.length-this.Match_MaxBits),g+h.length-this.Match_MaxBits),-1==i||j>=i))j=-1}else j=this.match_main(b,h,g);
39
+ if(-1==j)e[f]=!1,d-=a[f].length2-a[f].length1;else if(e[f]=!0,d=j-g,g=-1==i?b.substring(j,j+h.length):b.substring(j,i+this.Match_MaxBits),h==g)b=b.substring(0,j)+this.diff_text2(a[f].diffs)+b.substring(j+h.length);else if(g=this.diff_main(h,g,!1),h.length>this.Match_MaxBits&&this.diff_levenshtein(g)/h.length>this.Patch_DeleteThreshold)e[f]=!1;else{this.diff_cleanupSemanticLossless(g);for(var h=0,k,i=0;i<a[f].diffs.length;i++){var q=a[f].diffs[i];0!==q[0]&&(k=this.diff_xIndex(g,h));1===q[0]?b=b.substring(0,
40
+ j+k)+q[1]+b.substring(j+k):-1===q[0]&&(b=b.substring(0,j+k)+b.substring(j+this.diff_xIndex(g,h+q[1].length)));-1!==q[0]&&(h+=q[1].length)}}}b=b.substring(c.length,b.length-c.length);return[b,e]};
41
+ diff_match_patch.prototype.patch_addPadding=function(a){for(var b=this.Patch_Margin,c="",d=1;d<=b;d++)c+=String.fromCharCode(d);for(d=0;d<a.length;d++)a[d].start1+=b,a[d].start2+=b;var d=a[0],e=d.diffs;if(0==e.length||0!=e[0][0])e.unshift([0,c]),d.start1-=b,d.start2-=b,d.length1+=b,d.length2+=b;else if(b>e[0][1].length){var f=b-e[0][1].length;e[0][1]=c.substring(e[0][1].length)+e[0][1];d.start1-=f;d.start2-=f;d.length1+=f;d.length2+=f}d=a[a.length-1];e=d.diffs;0==e.length||0!=e[e.length-1][0]?(e.push([0,
42
+ c]),d.length1+=b,d.length2+=b):b>e[e.length-1][1].length&&(f=b-e[e.length-1][1].length,e[e.length-1][1]+=c.substring(0,f),d.length1+=f,d.length2+=f);return c};
43
+ diff_match_patch.prototype.patch_splitMax=function(a){for(var b=this.Match_MaxBits,c=0;c<a.length;c++)if(!(a[c].length1<=b)){var d=a[c];a.splice(c--,1);for(var e=d.start1,f=d.start2,g="";0!==d.diffs.length;){var h=new diff_match_patch.patch_obj,j=!0;h.start1=e-g.length;h.start2=f-g.length;""!==g&&(h.length1=h.length2=g.length,h.diffs.push([0,g]));for(;0!==d.diffs.length&&h.length1<b-this.Patch_Margin;){var g=d.diffs[0][0],i=d.diffs[0][1];1===g?(h.length2+=i.length,f+=i.length,h.diffs.push(d.diffs.shift()),
44
+ j=!1):-1===g&&1==h.diffs.length&&0==h.diffs[0][0]&&i.length>2*b?(h.length1+=i.length,e+=i.length,j=!1,h.diffs.push([g,i]),d.diffs.shift()):(i=i.substring(0,b-h.length1-this.Patch_Margin),h.length1+=i.length,e+=i.length,0===g?(h.length2+=i.length,f+=i.length):j=!1,h.diffs.push([g,i]),i==d.diffs[0][1]?d.diffs.shift():d.diffs[0][1]=d.diffs[0][1].substring(i.length))}g=this.diff_text2(h.diffs);g=g.substring(g.length-this.Patch_Margin);i=this.diff_text1(d.diffs).substring(0,this.Patch_Margin);""!==i&&
45
+ (h.length1+=i.length,h.length2+=i.length,0!==h.diffs.length&&0===h.diffs[h.diffs.length-1][0]?h.diffs[h.diffs.length-1][1]+=i:h.diffs.push([0,i]));j||a.splice(++c,0,h)}}};diff_match_patch.prototype.patch_toText=function(a){for(var b=[],c=0;c<a.length;c++)b[c]=a[c];return b.join("")};
46
+ diff_match_patch.prototype.patch_fromText=function(a){var b=[];if(!a)return b;a=a.split("\n");for(var c=0,d=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;c<a.length;){var e=a[c].match(d);if(!e)throw Error("Invalid patch string: "+a[c]);var f=new diff_match_patch.patch_obj;b.push(f);f.start1=parseInt(e[1],10);""===e[2]?(f.start1--,f.length1=1):"0"==e[2]?f.length1=0:(f.start1--,f.length1=parseInt(e[2],10));f.start2=parseInt(e[3],10);""===e[4]?(f.start2--,f.length2=1):"0"==e[4]?f.length2=0:(f.start2--,f.length2=
47
+ parseInt(e[4],10));for(c++;c<a.length;){e=a[c].charAt(0);try{var g=decodeURI(a[c].substring(1))}catch(h){throw Error("Illegal escape in patch_fromText: "+g);}if("-"==e)f.diffs.push([-1,g]);else if("+"==e)f.diffs.push([1,g]);else if(" "==e)f.diffs.push([0,g]);else if("@"==e)break;else if(""!==e)throw Error('Invalid patch mode "'+e+'" in: '+g);c++}}return b};diff_match_patch.patch_obj=function(){this.diffs=[];this.start2=this.start1=null;this.length2=this.length1=0};
48
+ diff_match_patch.patch_obj.prototype.toString=function(){var a,b;a=0===this.length1?this.start1+",0":1==this.length1?this.start1+1:this.start1+1+","+this.length1;b=0===this.length2?this.start2+",0":1==this.length2?this.start2+1:this.start2+1+","+this.length2;a=["@@ -"+a+" +"+b+" @@\n"];var c;for(b=0;b<this.diffs.length;b++){switch(this.diffs[b][0]){case 1:c="+";break;case -1:c="-";break;case 0:c=" "}a[b+1]=c+encodeURI(this.diffs[b][1])+"\n"}return a.join("").replace(/%20/g," ")};
49
+ this.diff_match_patch=diff_match_patch;this.DIFF_DELETE=-1;this.DIFF_INSERT=1;this.DIFF_EQUAL=0;})()
@@ -0,0 +1,14 @@
1
+ /*!
2
+ * FooTable - Awesome Responsive Tables
3
+ * Version : 2.0.3
4
+ * http://fooplugins.com/plugins/footable-jquery/
5
+ *
6
+ * Requires jQuery - http://jquery.com/
7
+ *
8
+ * Copyright 2014 Steven Usher & Brad Vincent
9
+ * Released under the MIT license
10
+ * You are free to use FooTable in commercial projects as long as this copyright header is left intact.
11
+ *
12
+ * Date: 11 Nov 2014
13
+ */
14
+ (function(e,t){function a(){var e=this;e.id=null,e.busy=!1,e.start=function(t,a){e.busy||(e.stop(),e.id=setTimeout(function(){t(),e.id=null,e.busy=!1},a),e.busy=!0)},e.stop=function(){null!==e.id&&(clearTimeout(e.id),e.id=null,e.busy=!1)}}function i(i,o,n){var r=this;r.id=n,r.table=i,r.options=o,r.breakpoints=[],r.breakpointNames="",r.columns={},r.plugins=t.footable.plugins.load(r);var l=r.options,d=l.classes,s=l.events,u=l.triggers,f=0;return r.timers={resize:new a,register:function(e){return r.timers[e]=new a,r.timers[e]}},r.init=function(){var a=e(t),i=e(r.table);if(t.footable.plugins.init(r),i.hasClass(d.loaded))return r.raise(s.alreadyInitialized),undefined;r.raise(s.initializing),i.addClass(d.loading),i.find(l.columnDataSelector).each(function(){var e=r.getColumnData(this);r.columns[e.index]=e});for(var o in l.breakpoints)r.breakpoints.push({name:o,width:l.breakpoints[o]}),r.breakpointNames+=o+" ";r.breakpoints.sort(function(e,t){return e.width-t.width}),i.unbind(u.initialize).bind(u.initialize,function(){i.removeData("footable_info"),i.data("breakpoint",""),i.trigger(u.resize),i.removeClass(d.loading),i.addClass(d.loaded).addClass(d.main),r.raise(s.initialized)}).unbind(u.redraw).bind(u.redraw,function(){r.redraw()}).unbind(u.resize).bind(u.resize,function(){r.resize()}).unbind(u.expandFirstRow).bind(u.expandFirstRow,function(){i.find(l.toggleSelector).first().not("."+d.detailShow).trigger(u.toggleRow)}).unbind(u.expandAll).bind(u.expandAll,function(){i.find(l.toggleSelector).not("."+d.detailShow).trigger(u.toggleRow)}).unbind(u.collapseAll).bind(u.collapseAll,function(){i.find("."+d.detailShow).trigger(u.toggleRow)}),i.trigger(u.initialize),a.bind("resize.footable",function(){r.timers.resize.stop(),r.timers.resize.start(function(){r.raise(u.resize)},l.delay)})},r.addRowToggle=function(){if(l.addRowToggle){var t=e(r.table),a=!1;t.find("span."+d.toggle).remove();for(var i in r.columns){var o=r.columns[i];if(o.toggle){a=!0;var n="> tbody > tr:not(."+d.detail+",."+d.disabled+") > td:nth-child("+(parseInt(o.index,10)+1)+"),"+"> tbody > tr:not(."+d.detail+",."+d.disabled+") > th:nth-child("+(parseInt(o.index,10)+1)+")";return t.find(n).not("."+d.detailCell).prepend(e(l.toggleHTMLElement).addClass(d.toggle)),undefined}}a||t.find("> tbody > tr:not(."+d.detail+",."+d.disabled+") > td:first-child").add("> tbody > tr:not(."+d.detail+",."+d.disabled+") > th:first-child").not("."+d.detailCell).prepend(e(l.toggleHTMLElement).addClass(d.toggle))}},r.setColumnClasses=function(){var t=e(r.table);for(var a in r.columns){var i=r.columns[a];if(null!==i.className){var o="",n=!0;e.each(i.matches,function(e,t){n||(o+=", "),o+="> tbody > tr:not(."+d.detail+") > td:nth-child("+(parseInt(t,10)+1)+")",n=!1}),t.find(o).not("."+d.detailCell).addClass(i.className)}}},r.bindToggleSelectors=function(){var t=e(r.table);r.hasAnyBreakpointColumn()&&(t.find(l.toggleSelector).unbind(u.toggleRow).bind(u.toggleRow,function(){var t=e(this).is("tr")?e(this):e(this).parents("tr:first");r.toggleDetail(t)}),t.find(l.toggleSelector).unbind("click.footable").bind("click.footable",function(a){t.is(".breakpoint")&&e(a.target).is("td,th,."+d.toggle)&&e(this).trigger(u.toggleRow)}))},r.parse=function(e,t){var a=l.parsers[t.type]||l.parsers.alpha;return a(e)},r.getColumnData=function(t){var a=e(t),i=a.data("hide"),o=a.index();i=i||"",i=jQuery.map(i.split(","),function(e){return jQuery.trim(e)});var n={index:o,hide:{},type:a.data("type")||"alpha",name:a.data("name")||e.trim(a.text()),ignore:a.data("ignore")||!1,toggle:a.data("toggle")||!1,className:a.data("class")||null,matches:[],names:{},group:a.data("group")||null,groupName:null,isEditable:a.data("editable")};if(null!==n.group){var d=e(r.table).find('> thead > tr.footable-group-row > th[data-group="'+n.group+'"], > thead > tr.footable-group-row > td[data-group="'+n.group+'"]').first();n.groupName=r.parse(d,{type:"alpha"})}var u=parseInt(a.prev().attr("colspan")||0,10);f+=u>1?u-1:0;var p=parseInt(a.attr("colspan")||0,10),c=n.index+f;if(p>1){var b=a.data("names");b=b||"",b=b.split(",");for(var g=0;p>g;g++)n.matches.push(g+c),b.length>g&&(n.names[g+c]=b[g])}else n.matches.push(c);n.hide["default"]="all"===a.data("hide")||e.inArray("default",i)>=0;var h=!1;for(var m in l.breakpoints)n.hide[m]="all"===a.data("hide")||e.inArray(m,i)>=0,h=h||n.hide[m];n.hasBreakpoint=h;var v=r.raise(s.columnData,{column:{data:n,th:t}});return v.column.data},r.getViewportWidth=function(){return window.innerWidth||(document.body?document.body.offsetWidth:0)},r.calculateWidth=function(e,t){return jQuery.isFunction(l.calculateWidthOverride)?l.calculateWidthOverride(e,t):(t.viewportWidth<t.width&&(t.width=t.viewportWidth),t.parentWidth<t.width&&(t.width=t.parentWidth),t)},r.hasBreakpointColumn=function(e){for(var t in r.columns)if(r.columns[t].hide[e]){if(r.columns[t].ignore)continue;return!0}return!1},r.hasAnyBreakpointColumn=function(){for(var e in r.columns)if(r.columns[e].hasBreakpoint)return!0;return!1},r.resize=function(){var t=e(r.table);if(t.is(":visible")){if(!r.hasAnyBreakpointColumn())return t.trigger(u.redraw),undefined;var a={width:t.width(),viewportWidth:r.getViewportWidth(),parentWidth:t.parent().width()};a=r.calculateWidth(t,a);var i=t.data("footable_info");if(t.data("footable_info",a),r.raise(s.resizing,{old:i,info:a}),!i||i&&i.width&&i.width!==a.width){for(var o,n=null,l=0;r.breakpoints.length>l;l++)if(o=r.breakpoints[l],o&&o.width&&a.width<=o.width){n=o;break}var d=null===n?"default":n.name,f=r.hasBreakpointColumn(d),p=t.data("breakpoint");t.data("breakpoint",d).removeClass("default breakpoint").removeClass(r.breakpointNames).addClass(d+(f?" breakpoint":"")),d!==p&&(t.trigger(u.redraw),r.raise(s.breakpoint,{breakpoint:d,info:a}))}r.raise(s.resized,{old:i,info:a})}},r.redraw=function(){r.addRowToggle(),r.bindToggleSelectors(),r.setColumnClasses();var t=e(r.table),a=t.data("breakpoint"),i=r.hasBreakpointColumn(a);t.find("> tbody > tr:not(."+d.detail+")").data("detail_created",!1).end().find("> thead > tr:last-child > th").each(function(){var i=r.columns[e(this).index()],o="",n=!0;e.each(i.matches,function(e,t){n||(o+=", ");var a=t+1;o+="> tbody > tr:not(."+d.detail+") > td:nth-child("+a+")",o+=", > tfoot > tr:not(."+d.detail+") > td:nth-child("+a+")",o+=", > colgroup > col:nth-child("+a+")",n=!1}),o+=', > thead > tr[data-group-row="true"] > th[data-group="'+i.group+'"]';var l=t.find(o).add(this);if(""!==a&&(i.hide[a]===!1?l.addClass("footable-visible").show():l.removeClass("footable-visible").hide()),1===t.find("> thead > tr.footable-group-row").length){var s=t.find('> thead > tr:last-child > th[data-group="'+i.group+'"]:visible, > thead > tr:last-child > th[data-group="'+i.group+'"]:visible'),u=t.find('> thead > tr.footable-group-row > th[data-group="'+i.group+'"], > thead > tr.footable-group-row > td[data-group="'+i.group+'"]'),f=0;e.each(s,function(){f+=parseInt(e(this).attr("colspan")||1,10)}),f>0?u.attr("colspan",f).show():u.hide()}}).end().find("> tbody > tr."+d.detailShow).each(function(){r.createOrUpdateDetailRow(this)}),t.find("[data-bind-name]").each(function(){r.toggleInput(this)}),t.find("> tbody > tr."+d.detailShow+":visible").each(function(){var t=e(this).next();t.hasClass(d.detail)&&(i?t.show():t.hide())}),t.find("> thead > tr > th.footable-last-column, > tbody > tr > td.footable-last-column").removeClass("footable-last-column"),t.find("> thead > tr > th.footable-first-column, > tbody > tr > td.footable-first-column").removeClass("footable-first-column"),t.find("> thead > tr, > tbody > tr").find("> th.footable-visible:last, > td.footable-visible:last").addClass("footable-last-column").end().find("> th.footable-visible:first, > td.footable-visible:first").addClass("footable-first-column"),r.raise(s.redrawn)},r.toggleDetail=function(t){var a=t.jquery?t:e(t),i=a.next();a.hasClass(d.detailShow)?(a.removeClass(d.detailShow),i.hasClass(d.detail)&&i.hide(),r.raise(s.rowCollapsed,{row:a[0]})):(r.createOrUpdateDetailRow(a[0]),a.addClass(d.detailShow).next().show(),r.raise(s.rowExpanded,{row:a[0]}))},r.removeRow=function(t){var a=t.jquery?t:e(t);a.hasClass(d.detail)&&(a=a.prev());var i=a.next();a.data("detail_created")===!0&&i.remove(),a.remove(),r.raise(s.rowRemoved)},r.appendRow=function(t){var a=t.jquery?t:e(t);e(r.table).find("tbody").append(a),r.redraw()},r.getColumnFromTdIndex=function(t){var a=null;for(var i in r.columns)if(e.inArray(t,r.columns[i].matches)>=0){a=r.columns[i];break}return a},r.createOrUpdateDetailRow=function(t){var a,i=e(t),o=i.next(),n=[];if(i.data("detail_created")===!0)return!0;if(i.is(":hidden"))return!1;if(r.raise(s.rowDetailUpdating,{row:i,detail:o}),i.find("> td:hidden").each(function(){var t=e(this).index(),a=r.getColumnFromTdIndex(t),i=a.name;if(a.ignore===!0)return!0;t in a.names&&(i=a.names[t]);var o=e(this).attr("data-bind-name");if(null!=o&&e(this).is(":empty")){var l=e("."+d.detailInnerValue+"["+'data-bind-value="'+o+'"]');e(this).html(e(l).contents().detach())}var s;return a.isEditable!==!1&&(a.isEditable||e(this).find(":input").length>0)&&(null==o&&(o="bind-"+e.now()+"-"+t,e(this).attr("data-bind-name",o)),s=e(this).contents().detach()),s||(s=e(this).contents().clone(!0,!0)),n.push({name:i,value:r.parse(this,a),display:s,group:a.group,groupName:a.groupName,bindName:o}),!0}),0===n.length)return!1;var u=i.find("> td:visible").length,f=o.hasClass(d.detail);return f||(o=e('<tr class="'+d.detail+'"><td class="'+d.detailCell+'"><div class="'+d.detailInner+'"></div></td></tr>'),i.after(o)),o.find("> td:first").attr("colspan",u),a=o.find("."+d.detailInner).empty(),l.createDetail(a,n,l.createGroupedDetail,l.detailSeparator,d),i.data("detail_created",!0),r.raise(s.rowDetailUpdated,{row:i,detail:o}),!f},r.raise=function(t,a){r.options.debug===!0&&e.isFunction(r.options.log)&&r.options.log(t,"event"),a=a||{};var i={ft:r};e.extend(!0,i,a);var o=e.Event(t,i);return o.ft||e.extend(!0,o,i),e(r.table).trigger(o),o},r.reset=function(){var t=e(r.table);t.removeData("footable_info").data("breakpoint","").removeClass(d.loading).removeClass(d.loaded),t.find(l.toggleSelector).unbind(u.toggleRow).unbind("click.footable"),t.find("> tbody > tr").removeClass(d.detailShow),t.find("> tbody > tr."+d.detail).remove(),r.raise(s.reset)},r.toggleInput=function(t){var a=e(t).attr("data-bind-name");if(null!=a){var i=e("."+d.detailInnerValue+"["+'data-bind-value="'+a+'"]');null!=i&&(e(t).is(":visible")?e(i).is(":empty")||e(t).html(e(i).contents().detach()):e(t).is(":empty")||e(i).html(e(t).contents().detach()))}},r.init(),r}t.footable={options:{delay:100,breakpoints:{phone:480,tablet:1024},parsers:{alpha:function(t){return e(t).data("value")||e.trim(e(t).text())},numeric:function(t){var a=e(t).data("value")||e(t).text().replace(/[^0-9.\-]/g,"");return a=parseFloat(a),isNaN(a)&&(a=0),a}},addRowToggle:!0,calculateWidthOverride:null,toggleSelector:" > tbody > tr:not(.footable-row-detail)",columnDataSelector:"> thead > tr:last-child > th, > thead > tr:last-child > td",detailSeparator:":",toggleHTMLElement:"<span />",createGroupedDetail:function(e){for(var t={_none:{name:null,data:[]}},a=0;e.length>a;a++){var i=e[a].group;null!==i?(i in t||(t[i]={name:e[a].groupName||e[a].group,data:[]}),t[i].data.push(e[a])):t._none.data.push(e[a])}return t},createDetail:function(t,a,i,o,n){var r=i(a);for(var l in r)if(0!==r[l].data.length){"_none"!==l&&t.append('<div class="'+n.detailInnerGroup+'">'+r[l].name+"</div>");for(var d=0;r[l].data.length>d;d++){var s=r[l].data[d].name?o:"";t.append(e("<div></div>").addClass(n.detailInnerRow).append(e("<div></div>").addClass(n.detailInnerName).append(r[l].data[d].name+s)).append(e("<div></div>").addClass(n.detailInnerValue).attr("data-bind-value",r[l].data[d].bindName).append(r[l].data[d].display)))}}},classes:{main:"footable",loading:"footable-loading",loaded:"footable-loaded",toggle:"footable-toggle",disabled:"footable-disabled",detail:"footable-row-detail",detailCell:"footable-row-detail-cell",detailInner:"footable-row-detail-inner",detailInnerRow:"footable-row-detail-row",detailInnerGroup:"footable-row-detail-group",detailInnerName:"footable-row-detail-name",detailInnerValue:"footable-row-detail-value",detailShow:"footable-detail-show"},triggers:{initialize:"footable_initialize",resize:"footable_resize",redraw:"footable_redraw",toggleRow:"footable_toggle_row",expandFirstRow:"footable_expand_first_row",expandAll:"footable_expand_all",collapseAll:"footable_collapse_all"},events:{alreadyInitialized:"footable_already_initialized",initializing:"footable_initializing",initialized:"footable_initialized",resizing:"footable_resizing",resized:"footable_resized",redrawn:"footable_redrawn",breakpoint:"footable_breakpoint",columnData:"footable_column_data",rowDetailUpdating:"footable_row_detail_updating",rowDetailUpdated:"footable_row_detail_updated",rowCollapsed:"footable_row_collapsed",rowExpanded:"footable_row_expanded",rowRemoved:"footable_row_removed",reset:"footable_reset"},debug:!1,log:null},version:{major:0,minor:5,toString:function(){return t.footable.version.major+"."+t.footable.version.minor},parse:function(e){var t=/(\d+)\.?(\d+)?\.?(\d+)?/.exec(e);return{major:parseInt(t[1],10)||0,minor:parseInt(t[2],10)||0,patch:parseInt(t[3],10)||0}}},plugins:{_validate:function(a){if(!e.isFunction(a))return t.footable.options.debug===!0&&console.error('Validation failed, expected type "function", received type "{0}".',typeof a),!1;var i=new a;return"string"!=typeof i.name?(t.footable.options.debug===!0&&console.error('Validation failed, plugin does not implement a string property called "name".',i),!1):e.isFunction(i.init)?(t.footable.options.debug===!0&&console.log('Validation succeeded for plugin "'+i.name+'".',i),!0):(t.footable.options.debug===!0&&console.error('Validation failed, plugin "'+i.name+'" does not implement a function called "init".',i),!1)},registered:[],register:function(a,i){t.footable.plugins._validate(a)&&(t.footable.plugins.registered.push(a),"object"==typeof i&&e.extend(!0,t.footable.options,i))},load:function(e){var a,i,o=[];for(i=0;t.footable.plugins.registered.length>i;i++)try{a=t.footable.plugins.registered[i],o.push(new a(e))}catch(n){t.footable.options.debug===!0&&console.error(n)}return o},init:function(e){for(var a=0;e.plugins.length>a;a++)try{e.plugins[a].init(e)}catch(i){t.footable.options.debug===!0&&console.error(i)}}}};var o=0;e.fn.footable=function(a){a=a||{};var n=e.extend(!0,{},t.footable.options,a);return this.each(function(){o++;var t=new i(this,n,o);e(this).data("footable",t)})}})(jQuery,window);;(function(e,t,undefined){function a(t){var a=e("<th>"+t.title+"</th>");return e.isPlainObject(t.data)&&a.data(t.data),e.isPlainObject(t.style)&&a.css(t.style),t.className&&a.addClass(t.className),a}function o(t,o){var i=t.find("thead");0===i.size()&&(i=e("<thead>").appendTo(t));for(var n=e("<tr>").appendTo(i),r=0,l=o.cols.length;l>r;r++)n.append(a(o.cols[r]))}function i(t){var a=t.find("tbody");0===a.size()&&(a=e("<tbody>").appendTo(t))}function n(t,a,o){if(o){t.attr("data-page-size",o["page-size"]);var i=t.find("tfoot");0===i.size()&&(i=e('<tfoot class="hide-if-no-paging"></tfoot>').appendTo(t)),i.append("<tr><td colspan="+a.length+"></td></tr>");var n=e("<div>").appendTo(i.find("tr:last-child td"));n.addClass(o["pagination-class"])}}function r(t){for(var a=t[0],o=0,i=t.length;i>o;o++){var n=t[o];if(n.data&&(n.data.toggle===!0||"true"===n.data.toggle))return}a.data=e.extend(a.data,{toggle:!0})}function l(e,t,a){0===e.find("tr.emptyInfo").size()&&e.find("tbody").append('<tr class="emptyInfo"><td colspan="'+t.length+'">'+a+"</td></tr>")}function d(t,a,o,i){t.find("tr:not(."+o+")").each(function(){var t=e(this),o=a.data("index"),n=parseInt(t.data("index"),0),r=n+i;n>=o&&this!==a.get(0)&&t.attr("data-index",r).data("index",r)})}function s(){function t(t,a,o){var i=e("<td>");return t.formatter?i.html(t.formatter(a,i,o)):i.html(a||""),i}var a=this;a.name="Footable Grid",a.init=function(t){var d=t.options.classes.toggle,s=t.options.classes.detail,f=t.options.grid;if(f.cols){a.footable=t;var u=e(t.table);u.data("grid",a),e.isPlainObject(f.data)&&u.data(f.data),a._items=[],r(f.cols),f.showCheckbox&&(f.multiSelect=!0,f.cols.unshift({title:f.checkboxFormatter(!0),name:"",data:{"sort-ignore":!0},formatter:f.checkboxFormatter})),f.showIndex&&f.cols.unshift({title:"#",name:"index",data:{"sort-ignore":!0},formatter:f.indexFormatter}),o(u,f),i(u),n(u,f.cols,f.pagination),u.off(".grid").on({"footable_initialized.grid":function(){f.url||f.ajax?e.ajax(f.ajax||{url:f.url}).then(function(e){a.newItem(e),t.raise(f.events.loaded)},function(){throw"load data from "+(f.url||f.ajax.url)+" fail"}):(a.newItem(f.items||[]),t.raise(f.events.loaded))},"footable_sorted.grid footable_grid_created.grid footable_grid_removed.grid":function(){f.showIndex&&a.getItem().length>0&&u.find("tbody tr:not(."+s+")").each(function(t){var a=e(this).find("td:first");a.html(f.indexFormatter(null,a,t))})},"footable_redrawn.grid footable_row_removed.grid":function(){0===a.getItem().length&&f.showEmptyInfo&&l(u,f.cols,f.emptyInfo)}}).on({"click.grid":function(a){if(e(a.target).closest("td").find(">."+d).size()>0)return!0;var o=e(a.currentTarget);return o.hasClass(s)?!0:(f.multiSelect||o.hasClass(f.activeClass)||u.find("tbody tr."+f.activeClass).removeClass(f.activeClass),o.toggleClass(f.activeClass),f.showCheckbox&&o.find("input:checkbox.check").prop("checked",function(e,t){return a.target===this?t:!t}),t.toggleDetail(o),undefined)}},"tbody tr").on("click.grid","thead input:checkbox.checkAll",function(e){var t=!!e.currentTarget.checked;t?u.find("tbody tr").addClass(f.activeClass):u.find("tbody tr").removeClass(f.activeClass),u.find("tbody input:checkbox.check").prop("checked",t)})}},a.getSelected=function(){var t=a.footable.options.grid,o=e(a.footable.table).find("tbody>tr."+t.activeClass);return o.map(function(){return e(this).data("index")})},a.getItem=function(t){return t!==undefined?e.isArray(t)?e.map(t,function(e){return a._items[e]}):a._items[t]:a._items},a._makeRow=function(o,i){var n,r=a.footable.options.grid;if(e.isFunction(r.template))n=e(r.template(e.extend({},{__index:i},o)));else{n=e("<tr>");for(var l=0,d=r.cols.length;d>l;l++){var s=r.cols[l];n.append(t(s,o[s.name]||"",i))}}return n.attr("data-index",i),n},a.newItem=function(t,o,i){var n=e(a.footable.table).find("tbody"),r=a.footable.options.classes.detail;if(n.find("tr.emptyInfo").remove(),e.isArray(t)){for(var l;l=t.pop();)a.newItem(l,o,!0);return a.footable.redraw(),a.footable.raise(a.footable.options.grid.events.created,{item:t,index:o}),undefined}if(e.isPlainObject(t)){var s,f=a._items.length;if(o===undefined||0>o||o>f)s=a._makeRow(t,f++),a._items.push(t),n.append(s);else{if(s=a._makeRow(t,o),0===o)a._items.unshift(t),n.prepend(s);else{var u=n.find("tr[data-index="+(o-1)+"]");a._items.splice(o,0,t),u.data("detail_created")===!0&&(u=u.next()),u.after(s)}d(n,s,r,1)}i||(a.footable.redraw(),a.footable.raise(a.footable.options.grid.events.created,{item:t,index:o}))}},a.setItem=function(t,o){if(e.isPlainObject(t)){var i=e(a.footable.table).find("tbody"),n=a._makeRow(t,o);e.extend(a._items[o],t);var r=i.find("tr").eq(o);r.html(n.html()),a.footable.redraw(),a.footable.raise(a.footable.options.grid.events.updated,{item:t,index:o})}},a.removeItem=function(t){var o=e(a.footable.table).find("tbody"),i=a.footable.options.classes.detail,n=[];if(e.isArray(t)){for(var r;r=t.pop();)n.push(a.removeItem(r));return a.footable.raise(a.footable.options.grid.events.removed,{item:n,index:t}),n}if(t===undefined)o.find("tr").each(function(){n.push(a._items.shift()),a.footable.removeRow(this)});else{var l=o.find("tr[data-index="+t+"]");n=a._items.splice(t,1)[0],a.footable.removeRow(l),d(o,l,i,-1)}return a.footable.raise(a.footable.options.grid.events.removed,{item:n,index:t}),n}}if(t.footable===undefined||null===t.foobox)throw Error("Please check and make sure footable.js is included in the page and is loaded prior to this script.");var f={grid:{enabled:!0,data:null,template:null,cols:null,items:null,url:null,ajax:null,activeClass:"active",multiSelect:!1,showIndex:!1,showCheckbox:!1,showEmptyInfo:!1,emptyInfo:'<p class="text-center text-warning">No Data</p>',pagination:{"page-size":20,"pagination-class":"pagination pagination-centered"},indexFormatter:function(e,t,a){return a+1},checkboxFormatter:function(e){return'<input type="checkbox" class="'+(e?"checkAll":"check")+'">'},events:{loaded:"footable_grid_loaded",created:"footable_grid_created",removed:"footable_grid_removed",updated:"footable_grid_updated"}}};t.footable.plugins.register(s,f)})(jQuery,window);;(function(t,e,undefined){function a(){var e=this;e.name="Footable Filter",e.init=function(a){if(e.footable=a,a.options.filter.enabled===!0){if(t(a.table).data("filter")===!1)return;a.timers.register("filter"),t(a.table).unbind(".filtering").bind({"footable_initialized.filtering":function(){var i=t(a.table),o={input:i.data("filter")||a.options.filter.input,timeout:i.data("filter-timeout")||a.options.filter.timeout,minimum:i.data("filter-minimum")||a.options.filter.minimum,disableEnter:i.data("filter-disable-enter")||a.options.filter.disableEnter};o.disableEnter&&t(o.input).keypress(function(t){return window.event?13!==window.event.keyCode:13!==t.which}),i.bind("footable_clear_filter",function(){t(o.input).val(""),e.clearFilter()}),i.bind("footable_filter",function(t,a){e.filter(a.filter)}),t(o.input).keyup(function(i){a.timers.filter.stop(),27===i.which&&t(o.input).val(""),a.timers.filter.start(function(){var a=t(o.input).val()||"";e.filter(a)},o.timeout)})},"footable_redrawn.filtering":function(){var i=t(a.table),o=i.data("filter-string");o&&e.filter(o)}}).data("footable-filter",e)}},e.filter=function(a){var i=e.footable,o=t(i.table),n=o.data("filter-minimum")||i.options.filter.minimum,r=!a,l=i.raise("footable_filtering",{filter:a,clear:r});if(!(l&&l.result===!1||l.filter&&n>l.filter.length))if(l.clear)e.clearFilter();else{var d=l.filter.split(" ");o.find("> tbody > tr").hide().addClass("footable-filtered");var s=o.find("> tbody > tr:not(.footable-row-detail)");t.each(d,function(t,e){e&&e.length>0&&(o.data("current-filter",e),s=s.filter(i.options.filter.filterFunction))}),s.each(function(){e.showRow(this,i),t(this).removeClass("footable-filtered")}),o.data("filter-string",l.filter),i.raise("footable_filtered",{filter:l.filter,clear:!1})}},e.clearFilter=function(){var a=e.footable,i=t(a.table);i.find("> tbody > tr:not(.footable-row-detail)").removeClass("footable-filtered").each(function(){e.showRow(this,a)}),i.removeData("filter-string"),a.raise("footable_filtered",{clear:!0})},e.showRow=function(e,a){var i=t(e),o=i.next(),n=t(a.table);i.is(":visible")||(n.hasClass("breakpoint")&&i.hasClass("footable-detail-show")&&o.hasClass("footable-row-detail")?(i.add(o).show(),a.createOrUpdateDetailRow(e)):i.show())}}if(e.footable===undefined||null===e.footable)throw Error("Please check and make sure footable.js is included in the page and is loaded prior to this script.");var i={filter:{enabled:!0,input:".footable-filter",timeout:300,minimum:2,disableEnter:!1,filterFunction:function(){var e=t(this),a=e.parents("table:first"),i=a.data("current-filter").toUpperCase(),o=e.find("td").text();return a.data("filter-text-only")||e.find("td[data-value]").each(function(){o+=t(this).data("value")}),o.toUpperCase().indexOf(i)>=0}}};e.footable.plugins.register(a,i)})(jQuery,window);;(function(e,t,undefined){function a(t){var a=e(t.table),i=a.data();this.pageNavigation=i.pageNavigation||t.options.pageNavigation,this.pageSize=i.pageSize||t.options.pageSize,this.firstText=i.firstText||t.options.firstText,this.previousText=i.previousText||t.options.previousText,this.nextText=i.nextText||t.options.nextText,this.lastText=i.lastText||t.options.lastText,this.limitNavigation=parseInt(i.limitNavigation||t.options.limitNavigation||o.limitNavigation,10),this.limitPreviousText=i.limitPreviousText||t.options.limitPreviousText,this.limitNextText=i.limitNextText||t.options.limitNextText,this.limit=this.limitNavigation>0,this.currentPage=i.currentPage||0,this.pages=[],this.control=!1}function i(){var t=this;t.name="Footable Paginate",t.init=function(a){if(a.options.paginate===!0){if(e(a.table).data("page")===!1)return;t.footable=a,e(a.table).unbind(".paging").bind({"footable_initialized.paging footable_row_removed.paging footable_redrawn.paging footable_sorted.paging footable_filtered.paging":function(){t.setupPaging()}}).data("footable-paging",t)}},t.setupPaging=function(){var i=t.footable,o=e(i.table).find("> tbody");i.pageInfo=new a(i),t.createPages(i,o),t.createNavigation(i,o),t.fillPage(i,o,i.pageInfo.currentPage)},t.createPages=function(t,a){var i=1,o=t.pageInfo,n=i*o.pageSize,r=[],l=[];o.pages=[];var d=a.find("> tr:not(.footable-filtered,.footable-row-detail)");d.each(function(e,t){r.push(t),e===n-1?(o.pages.push(r),i++,n=i*o.pageSize,r=[]):e>=d.length-d.length%o.pageSize&&l.push(t)}),l.length>0&&o.pages.push(l),o.currentPage>=o.pages.length&&(o.currentPage=o.pages.length-1),0>o.currentPage&&(o.currentPage=0),1===o.pages.length?e(t.table).addClass("no-paging"):e(t.table).removeClass("no-paging")},t.createNavigation=function(a){var i=e(a.table).find(a.pageInfo.pageNavigation);if(0===i.length){if(i=e(a.pageInfo.pageNavigation),i.parents("table:first").length>0&&i.parents("table:first")!==e(a.table))return;i.length>1&&a.options.debug===!0&&console.error("More than one pagination control was found!")}if(0!==i.length){i.is("ul")||(0===i.find("ul:first").length&&i.append("<ul />"),i=i.find("ul")),i.find("li").remove();var o=a.pageInfo;o.control=i,o.pages.length>0&&(i.append('<li class="footable-page-arrow"><a data-page="first" href="#first">'+a.pageInfo.firstText+"</a>"),i.append('<li class="footable-page-arrow"><a data-page="prev" href="#prev">'+a.pageInfo.previousText+"</a></li>"),o.limit&&i.append('<li class="footable-page-arrow"><a data-page="limit-prev" href="#limit-prev">'+a.pageInfo.limitPreviousText+"</a></li>"),o.limit||e.each(o.pages,function(e,t){t.length>0&&i.append('<li class="footable-page"><a data-page="'+e+'" href="#">'+(e+1)+"</a></li>")}),o.limit&&(i.append('<li class="footable-page-arrow"><a data-page="limit-next" href="#limit-next">'+a.pageInfo.limitNextText+"</a></li>"),t.createLimited(i,o,0)),i.append('<li class="footable-page-arrow"><a data-page="next" href="#next">'+a.pageInfo.nextText+"</a></li>"),i.append('<li class="footable-page-arrow"><a data-page="last" href="#last">'+a.pageInfo.lastText+"</a></li>")),i.off("click","a[data-page]").on("click","a[data-page]",function(n){n.preventDefault();var r=e(this).data("page"),l=o.currentPage;if("first"===r)l=0;else if("prev"===r)l>0&&l--;else if("next"===r)o.pages.length-1>l&&l++;else if("last"===r)l=o.pages.length-1;else if("limit-prev"===r){l=-1;var d=i.find(".footable-page:first a").data("page");t.createLimited(i,o,d-o.limitNavigation),t.setPagingClasses(i,o.currentPage,o.pages.length)}else if("limit-next"===r){l=-1;var s=i.find(".footable-page:last a").data("page");t.createLimited(i,o,s+1),t.setPagingClasses(i,o.currentPage,o.pages.length)}else l=r;if(l>=0){if(o.limit&&o.currentPage!=l){for(var f=l;0!==f%o.limitNavigation;)f-=1;t.createLimited(i,o,f)}t.paginate(a,l)}}),t.setPagingClasses(i,o.currentPage,o.pages.length)}},t.createLimited=function(e,t,a){a=a||0,e.find("li.footable-page").remove();var i,o,n=e.find('li.footable-page-arrow > a[data-page="limit-prev"]').parent(),r=e.find('li.footable-page-arrow > a[data-page="limit-next"]').parent();for(i=t.pages.length-1;i>=0;i--)o=t.pages[i],i>=a&&a+t.limitNavigation>i&&o.length>0&&n.after('<li class="footable-page"><a data-page="'+i+'" href="#">'+(i+1)+"</a></li>");0===a?n.hide():n.show(),a+t.limitNavigation>=t.pages.length?r.hide():r.show()},t.paginate=function(a,i){var o=a.pageInfo;if(o.currentPage!==i){var n=e(a.table).find("> tbody"),r=a.raise("footable_paging",{page:i,size:o.pageSize});if(r&&r.result===!1)return;t.fillPage(a,n,i),o.control.find("li").removeClass("active disabled"),t.setPagingClasses(o.control,o.currentPage,o.pages.length)}},t.setPagingClasses=function(e,t,a){e.find("li.footable-page > a[data-page="+t+"]").parent().addClass("active"),t>=a-1&&(e.find('li.footable-page-arrow > a[data-page="next"]').parent().addClass("disabled"),e.find('li.footable-page-arrow > a[data-page="last"]').parent().addClass("disabled")),1>t&&(e.find('li.footable-page-arrow > a[data-page="first"]').parent().addClass("disabled"),e.find('li.footable-page-arrow > a[data-page="prev"]').parent().addClass("disabled"))},t.fillPage=function(a,i,o){a.pageInfo.currentPage=o,e(a.table).data("currentPage",o),i.find("> tr").hide(),e(a.pageInfo.pages[o]).each(function(){t.showRow(this,a)}),a.raise("footable_page_filled")},t.showRow=function(t,a){var i=e(t),o=i.next(),n=e(a.table);n.hasClass("breakpoint")&&i.hasClass("footable-detail-show")&&o.hasClass("footable-row-detail")?(i.add(o).show(),a.createOrUpdateDetailRow(t)):i.show()}}if(t.footable===undefined||null===t.footable)throw Error("Please check and make sure footable.js is included in the page and is loaded prior to this script.");var o={paginate:!0,pageSize:10,pageNavigation:".pagination",firstText:"&laquo;",previousText:"&lsaquo;",nextText:"&rsaquo;",lastText:"&raquo;",limitNavigation:0,limitPreviousText:"...",limitNextText:"..."};t.footable.plugins.register(i,o)})(jQuery,window);;(function(t,e,undefined){function a(){var e=this;e.name="Footable Sortable",e.init=function(a){e.footable=a,a.options.sort===!0&&t(a.table).unbind(".sorting").bind({"footable_initialized.sorting":function(){var i,o,n=t(a.table),r=(n.find("> tbody"),a.options.classes.sort);if(n.data("sort")!==!1){n.find("> thead > tr:last-child > th, > thead > tr:last-child > td").each(function(){var e=t(this),i=a.columns[e.index()];i.sort.ignore===!0||e.hasClass(r.sortable)||(e.addClass(r.sortable),t("<span />").addClass(r.indicator).appendTo(e))}),n.find("> thead > tr:last-child > th."+r.sortable+", > thead > tr:last-child > td."+r.sortable).unbind("click.footable").bind("click.footable",function(a){a.preventDefault(),o=t(this);var i=!o.hasClass(r.sorted);return e.doSort(o.index(),i),!1});var l=!1;for(var s in a.columns)if(i=a.columns[s],i.sort.initial){var d="descending"!==i.sort.initial;e.doSort(i.index,d);break}l&&a.bindToggleSelectors()}},"footable_redrawn.sorting":function(){var i=t(a.table),o=a.options.classes.sort;i.data("sorted")>=0&&i.find("> thead > tr:last-child > th").each(function(a){var i=t(this);return i.hasClass(o.sorted)||i.hasClass(o.descending)?(e.doSort(a),undefined):undefined})},"footable_column_data.sorting":function(e){var a=t(e.column.th);e.column.data.sort=e.column.data.sort||{},e.column.data.sort.initial=a.data("sort-initial")||!1,e.column.data.sort.ignore=a.data("sort-ignore")||!1,e.column.data.sort.selector=a.data("sort-selector")||null;var i=a.data("sort-match")||0;i>=e.column.data.matches.length&&(i=0),e.column.data.sort.match=e.column.data.matches[i]}}).data("footable-sort",e)},e.doSort=function(a,i){var o=e.footable;if(t(o.table).data("sort")!==!1){var n=t(o.table),r=n.find("> tbody"),l=o.columns[a],s=n.find("> thead > tr:last-child > th:eq("+a+")"),d=o.options.classes.sort,f=o.options.events.sort;if(i=i===undefined?s.hasClass(d.sorted):"toggle"===i?!s.hasClass(d.sorted):i,l.sort.ignore===!0)return!0;var u=o.raise(f.sorting,{column:l,direction:i?"ASC":"DESC"});u&&u.result===!1||(n.data("sorted",l.index),n.find("> thead > tr:last-child > th, > thead > tr:last-child > td").not(s).removeClass(d.sorted+" "+d.descending),i===undefined&&(i=s.hasClass(d.sorted)),i?s.removeClass(d.descending).addClass(d.sorted):s.removeClass(d.sorted).addClass(d.descending),e.sort(o,r,l,i),o.bindToggleSelectors(),o.raise(f.sorted,{column:l,direction:i?"ASC":"DESC"}))}},e.rows=function(e,a,i){var o=[];return a.find("> tr").each(function(){var a=t(this),n=null;if(a.hasClass(e.options.classes.detail))return!0;a.next().hasClass(e.options.classes.detail)&&(n=a.next().get(0));var r={row:a,detail:n};return i!==undefined&&(r.value=e.parse(this.cells[i.sort.match],i)),o.push(r),!0}).detach(),o},e.sort=function(t,a,i,o){var n=e.rows(t,a,i),r=t.options.sorters[i.type]||t.options.sorters.alpha;n.sort(function(t,e){return o?r(t.value,e.value):r(e.value,t.value)});for(var l=0;n.length>l;l++)a.append(n[l].row),null!==n[l].detail&&a.append(n[l].detail)}}if(e.footable===undefined||null===e.footable)throw Error("Please check and make sure footable.js is included in the page and is loaded prior to this script.");var i={sort:!0,sorters:{alpha:function(t,e){return"string"==typeof t&&(t=t.toLowerCase()),"string"==typeof e&&(e=e.toLowerCase()),t===e?0:e>t?-1:1},numeric:function(t,e){return t-e}},classes:{sort:{sortable:"footable-sortable",sorted:"footable-sorted",descending:"footable-sorted-desc",indicator:"footable-sort-indicator"}},events:{sort:{sorting:"footable_sorting",sorted:"footable_sorted"}}};e.footable.plugins.register(a,i)})(jQuery,window);;(function(t,e,undefined){function a(){var e=this;e.name="Footable Striping",e.init=function(a){e.footable=a,t(a.table).unbind("striping").bind({"footable_initialized.striping footable_row_removed.striping footable_redrawn.striping footable_sorted.striping footable_filtered.striping":function(){t(this).data("striping")!==!1&&e.setupStriping(a)}})},e.setupStriping=function(e){var a=0;t(e.table).find("> tbody > tr:not(.footable-row-detail)").each(function(){var i=t(this);i.removeClass(e.options.classes.striping.even).removeClass(e.options.classes.striping.odd),0===a%2?i.addClass(e.options.classes.striping.even):i.addClass(e.options.classes.striping.odd),a++})}}if(e.footable===undefined||null===e.foobox)throw Error("Please check and make sure footable.js is included in the page and is loaded prior to this script.");var i={striping:{enabled:!0},classes:{striping:{odd:"footable-odd",even:"footable-even"}}};e.footable.plugins.register(a,i)})(jQuery,window);;(function(t,e,undefined){function a(t,e){e=e?e:location.hash;var a=RegExp("&"+t+"(?:=([^&]*))?(?=&|$)","i");return(e=e.replace(/^\#/,"&").match(a))?e[1]===undefined?"":decodeURIComponent(e[1]):undefined}function i(e,a){var i=t(e.table).find("tbody").find("tr:not(.footable-row-detail, .footable-filtered)").length;t(e.table).data("status_num_total",i);var o=t(e.table).find("tbody").find("tr:not(.footable-row-detail)").filter(":visible").length;t(e.table).data("status_num_shown",o);var n=t(e.table).data("sorted"),r=t(e.table).find("th")[n],l=t(r).hasClass("footable-sorted-desc");if(t(e.table).data("status_descending",l),e.pageInfo){var s=e.pageInfo.currentPage;t(e.table).data("status_pagenum",s)}var d="",f=t(e.table).data("filter");t(f).length&&(d=t(f).val()),t(e.table).data("status_filter_val",d);var u,p,c;if("footable_row_expanded"==a.type&&(u=a.row,u&&(p=t(e.table).data("expanded_rows"),c=[],p&&(c=p.split(",")),c.push(u.rowIndex),t(e.table).data("expanded_rows",c.join(",")))),"footable_row_collapsed"==a.type&&(u=a.row)){p=t(e.table).data("expanded_rows"),c=[],p&&(c=p.split(","));var g=[];for(var b in c)if(c[b]==u.rowIndex){g=c.splice(b,1);break}t(e.table).data("expanded_rows",g.join(","))}}function o(){var e=this;e.name="Footable LucidBookmarkable",e.init=function(e){e.options.bookmarkable.enabled&&t(e.table).bind({footable_initialized:function(){var i=e.table.id,o=a(i+"_f"),n=a(i+"_p"),r=a(i+"_s"),l=a(i+"_d"),s=a(i+"_e");if(o){var d=t(e.table).data("filter");t(d).val(o),t(e.table).trigger("footable_filter",{filter:o})}if(n&&t(e.table).data("currentPage",n),r!==undefined){var f=t(e.table).data("footable-sort"),u=!0;"true"==l&&(u=!1),f.doSort(r,u)}else t(e.table).trigger("footable_setup_paging");if(s){var p=s.split(",");for(var c in p){var g=t(e.table.rows[p[c]]);g.find("> td:first").trigger("footable_toggle_row")}}e.lucid_bookmark_read=!0},"footable_page_filled footable_redrawn footable_filtered footable_sorted footable_row_expanded footable_row_collapsed":function(a){if(i(e,a),e.lucid_bookmark_read){var o=e.table.id,n=o+"_f",r=o+"_p",l=o+"_s",s=o+"_d",d=o+"_e",f=location.hash.replace(/^\#/,"&"),u=[n,r,l,s,d];for(var p in u){var c=RegExp("&"+u[p]+"=([^&]*)","g");f=f.replace(c,"")}var g={};g[n]=t(e.table).data("status_filter_val"),g[r]=t(e.table).data("status_pagenum"),g[l]=t(e.table).data("sorted"),g[s]=t(e.table).data("status_descending"),g[d]=t(e.table).data("expanded_rows");var b=[];for(var h in g)g[h]!==undefined&&b.push(h+"="+encodeURIComponent(g[h]));f.length&&b.push(f),location.hash=b.join("&")}}})}}if(e.footable===undefined||null===e.foobox)throw Error("Please check and make sure footable.js is included in the page and is loaded prior to this script.");var n={bookmarkable:{enabled:!1}};e.footable.plugins.register(o,n)})(jQuery,window);
@@ -1,7 +1,7 @@
1
1
  //! moment.js
2
- //! version : 2.8.3
2
+ //! version : 2.9.0
3
3
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
4
4
  //! license : MIT
5
5
  //! momentjs.com
6
- (function(a){function b(a,b,c){switch(arguments.length){case 2:return null!=a?a:b;case 3:return null!=a?a:null!=b?b:c;default:throw new Error("Implement me")}}function c(a,b){return zb.call(a,b)}function d(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function e(a){tb.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+a)}function f(a,b){var c=!0;return m(function(){return c&&(e(a),c=!1),b.apply(this,arguments)},b)}function g(a,b){qc[a]||(e(b),qc[a]=!0)}function h(a,b){return function(c){return p(a.call(this,c),b)}}function i(a,b){return function(c){return this.localeData().ordinal(a.call(this,c),b)}}function j(){}function k(a,b){b!==!1&&F(a),n(this,a),this._d=new Date(+a._d)}function l(a){var b=y(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+36e5*h,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=tb.localeData(),this._bubble()}function m(a,b){for(var d in b)c(b,d)&&(a[d]=b[d]);return c(b,"toString")&&(a.toString=b.toString),c(b,"valueOf")&&(a.valueOf=b.valueOf),a}function n(a,b){var c,d,e;if("undefined"!=typeof b._isAMomentObject&&(a._isAMomentObject=b._isAMomentObject),"undefined"!=typeof b._i&&(a._i=b._i),"undefined"!=typeof b._f&&(a._f=b._f),"undefined"!=typeof b._l&&(a._l=b._l),"undefined"!=typeof b._strict&&(a._strict=b._strict),"undefined"!=typeof b._tzm&&(a._tzm=b._tzm),"undefined"!=typeof b._isUTC&&(a._isUTC=b._isUTC),"undefined"!=typeof b._offset&&(a._offset=b._offset),"undefined"!=typeof b._pf&&(a._pf=b._pf),"undefined"!=typeof b._locale&&(a._locale=b._locale),Ib.length>0)for(c in Ib)d=Ib[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function o(a){return 0>a?Math.ceil(a):Math.floor(a)}function p(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.length<b;)d="0"+d;return(e?c?"+":"":"-")+d}function q(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function r(a,b){var c;return b=K(b,a),a.isBefore(b)?c=q(a,b):(c=q(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function s(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(g(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=tb.duration(c,d),t(this,e,a),this}}function t(a,b,c,d){var e=b._milliseconds,f=b._days,g=b._months;d=null==d?!0:d,e&&a._d.setTime(+a._d+e*c),f&&nb(a,"Date",mb(a,"Date")+f*c),g&&lb(a,mb(a,"Month")+g*c),d&&tb.updateOffset(a,f||g)}function u(a){return"[object Array]"===Object.prototype.toString.call(a)}function v(a){return"[object Date]"===Object.prototype.toString.call(a)||a instanceof Date}function w(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&A(a[d])!==A(b[d]))&&g++;return g+f}function x(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=jc[a]||kc[b]||b}return a}function y(a){var b,d,e={};for(d in a)c(a,d)&&(b=x(d),b&&(e[b]=a[d]));return e}function z(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}tb[b]=function(e,f){var g,h,i=tb._locale[b],j=[];if("number"==typeof e&&(f=e,e=a),h=function(a){var b=tb().utc().set(d,a);return i.call(tb._locale,b,e||"")},null!=f)return h(f);for(g=0;c>g;g++)j.push(h(g));return j}}function A(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function B(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function C(a,b,c){return hb(tb([a,11,31+b-c]),b,c).week}function D(a){return E(a)?366:365}function E(a){return a%4===0&&a%100!==0||a%400===0}function F(a){var b;a._a&&-2===a._pf.overflow&&(b=a._a[Bb]<0||a._a[Bb]>11?Bb:a._a[Cb]<1||a._a[Cb]>B(a._a[Ab],a._a[Bb])?Cb:a._a[Db]<0||a._a[Db]>23?Db:a._a[Eb]<0||a._a[Eb]>59?Eb:a._a[Fb]<0||a._a[Fb]>59?Fb:a._a[Gb]<0||a._a[Gb]>999?Gb:-1,a._pf._overflowDayOfYear&&(Ab>b||b>Cb)&&(b=Cb),a._pf.overflow=b)}function G(a){return null==a._isValid&&(a._isValid=!isNaN(a._d.getTime())&&a._pf.overflow<0&&!a._pf.empty&&!a._pf.invalidMonth&&!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===a._pf.charsLeftOver&&0===a._pf.unusedTokens.length)),a._isValid}function H(a){return a?a.toLowerCase().replace("_","-"):a}function I(a){for(var b,c,d,e,f=0;f<a.length;){for(e=H(a[f]).split("-"),b=e.length,c=H(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=J(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&w(e,c,!0)>=b-1)break;b--}f++}return null}function J(a){var b=null;if(!Hb[a]&&Jb)try{b=tb.locale(),require("./locale/"+a),tb.locale(b)}catch(c){}return Hb[a]}function K(a,b){return b._isUTC?tb(a).zone(b._offset||0):tb(a).local()}function L(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function M(a){var b,c,d=a.match(Nb);for(b=0,c=d.length;c>b;b++)d[b]=pc[d[b]]?pc[d[b]]:L(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function N(a,b){return a.isValid()?(b=O(b,a.localeData()),lc[b]||(lc[b]=M(b)),lc[b](a)):a.localeData().invalidDate()}function O(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Ob.lastIndex=0;d>=0&&Ob.test(a);)a=a.replace(Ob,c),Ob.lastIndex=0,d-=1;return a}function P(a,b){var c,d=b._strict;switch(a){case"Q":return Zb;case"DDDD":return _b;case"YYYY":case"GGGG":case"gggg":return d?ac:Rb;case"Y":case"G":case"g":return cc;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return d?bc:Sb;case"S":if(d)return Zb;case"SS":if(d)return $b;case"SSS":if(d)return _b;case"DDD":return Qb;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Ub;case"a":case"A":return b._locale._meridiemParse;case"X":return Xb;case"Z":case"ZZ":return Vb;case"T":return Wb;case"SSSS":return Tb;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return d?$b:Pb;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Pb;case"Do":return Yb;default:return c=new RegExp(Y(X(a.replace("\\","")),"i"))}}function Q(a){a=a||"";var b=a.match(Vb)||[],c=b[b.length-1]||[],d=(c+"").match(hc)||["-",0,0],e=+(60*d[1])+A(d[2]);return"+"===d[0]?-e:e}function R(a,b,c){var d,e=c._a;switch(a){case"Q":null!=b&&(e[Bb]=3*(A(b)-1));break;case"M":case"MM":null!=b&&(e[Bb]=A(b)-1);break;case"MMM":case"MMMM":d=c._locale.monthsParse(b),null!=d?e[Bb]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[Cb]=A(b));break;case"Do":null!=b&&(e[Cb]=A(parseInt(b,10)));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=A(b));break;case"YY":e[Ab]=tb.parseTwoDigitYear(b);break;case"YYYY":case"YYYYY":case"YYYYYY":e[Ab]=A(b);break;case"a":case"A":c._isPm=c._locale.isPM(b);break;case"H":case"HH":case"h":case"hh":e[Db]=A(b);break;case"m":case"mm":e[Eb]=A(b);break;case"s":case"ss":e[Fb]=A(b);break;case"S":case"SS":case"SSS":case"SSSS":e[Gb]=A(1e3*("0."+b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=Q(b);break;case"dd":case"ddd":case"dddd":d=c._locale.weekdaysParse(b),null!=d?(c._w=c._w||{},c._w.d=d):c._pf.invalidWeekday=b;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":a=a.substr(0,1);case"gggg":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=A(b));break;case"gg":case"GG":c._w=c._w||{},c._w[a]=tb.parseTwoDigitYear(b)}}function S(a){var c,d,e,f,g,h,i;c=a._w,null!=c.GG||null!=c.W||null!=c.E?(g=1,h=4,d=b(c.GG,a._a[Ab],hb(tb(),1,4).year),e=b(c.W,1),f=b(c.E,1)):(g=a._locale._week.dow,h=a._locale._week.doy,d=b(c.gg,a._a[Ab],hb(tb(),g,h).year),e=b(c.w,1),null!=c.d?(f=c.d,g>f&&++e):f=null!=c.e?c.e+g:g),i=ib(d,e,f,h,g),a._a[Ab]=i.year,a._dayOfYear=i.dayOfYear}function T(a){var c,d,e,f,g=[];if(!a._d){for(e=V(a),a._w&&null==a._a[Cb]&&null==a._a[Bb]&&S(a),a._dayOfYear&&(f=b(a._a[Ab],e[Ab]),a._dayOfYear>D(f)&&(a._pf._overflowDayOfYear=!0),d=db(f,0,a._dayOfYear),a._a[Bb]=d.getUTCMonth(),a._a[Cb]=d.getUTCDate()),c=0;3>c&&null==a._a[c];++c)a._a[c]=g[c]=e[c];for(;7>c;c++)a._a[c]=g[c]=null==a._a[c]?2===c?1:0:a._a[c];a._d=(a._useUTC?db:cb).apply(null,g),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()+a._tzm)}}function U(a){var b;a._d||(b=y(a._i),a._a=[b.year,b.month,b.day,b.hour,b.minute,b.second,b.millisecond],T(a))}function V(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function W(a){if(a._f===tb.ISO_8601)return void $(a);a._a=[],a._pf.empty=!0;var b,c,d,e,f,g=""+a._i,h=g.length,i=0;for(d=O(a._f,a._locale).match(Nb)||[],b=0;b<d.length;b++)e=d[b],c=(g.match(P(e,a))||[])[0],c&&(f=g.substr(0,g.indexOf(c)),f.length>0&&a._pf.unusedInput.push(f),g=g.slice(g.indexOf(c)+c.length),i+=c.length),pc[e]?(c?a._pf.empty=!1:a._pf.unusedTokens.push(e),R(e,c,a)):a._strict&&!c&&a._pf.unusedTokens.push(e);a._pf.charsLeftOver=h-i,g.length>0&&a._pf.unusedInput.push(g),a._isPm&&a._a[Db]<12&&(a._a[Db]+=12),a._isPm===!1&&12===a._a[Db]&&(a._a[Db]=0),T(a),F(a)}function X(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function Y(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Z(a){var b,c,e,f,g;if(0===a._f.length)return a._pf.invalidFormat=!0,void(a._d=new Date(0/0));for(f=0;f<a._f.length;f++)g=0,b=n({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._pf=d(),b._f=a._f[f],W(b),G(b)&&(g+=b._pf.charsLeftOver,g+=10*b._pf.unusedTokens.length,b._pf.score=g,(null==e||e>g)&&(e=g,c=b));m(a,c||b)}function $(a){var b,c,d=a._i,e=dc.exec(d);if(e){for(a._pf.iso=!0,b=0,c=fc.length;c>b;b++)if(fc[b][1].exec(d)){a._f=fc[b][0]+(e[6]||" ");break}for(b=0,c=gc.length;c>b;b++)if(gc[b][1].exec(d)){a._f+=gc[b][0];break}d.match(Vb)&&(a._f+="Z"),W(a)}else a._isValid=!1}function _(a){$(a),a._isValid===!1&&(delete a._isValid,tb.createFromInputFallback(a))}function ab(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function bb(b){var c,d=b._i;d===a?b._d=new Date:v(d)?b._d=new Date(+d):null!==(c=Kb.exec(d))?b._d=new Date(+c[1]):"string"==typeof d?_(b):u(d)?(b._a=ab(d.slice(0),function(a){return parseInt(a,10)}),T(b)):"object"==typeof d?U(b):"number"==typeof d?b._d=new Date(d):tb.createFromInputFallback(b)}function cb(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function db(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function eb(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function fb(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function gb(a,b,c){var d=tb.duration(a).abs(),e=yb(d.as("s")),f=yb(d.as("m")),g=yb(d.as("h")),h=yb(d.as("d")),i=yb(d.as("M")),j=yb(d.as("y")),k=e<mc.s&&["s",e]||1===f&&["m"]||f<mc.m&&["mm",f]||1===g&&["h"]||g<mc.h&&["hh",g]||1===h&&["d"]||h<mc.d&&["dd",h]||1===i&&["M"]||i<mc.M&&["MM",i]||1===j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,fb.apply({},k)}function hb(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=tb(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ib(a,b,c,d,e){var f,g,h=db(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:D(a-1)+g}}function jb(b){var c=b._i,d=b._f;return b._locale=b._locale||tb.localeData(b._l),null===c||d===a&&""===c?tb.invalid({nullInput:!0}):("string"==typeof c&&(b._i=c=b._locale.preparse(c)),tb.isMoment(c)?new k(c,!0):(d?u(d)?Z(b):W(b):bb(b),new k(b)))}function kb(a,b){var c,d;if(1===b.length&&u(b[0])&&(b=b[0]),!b.length)return tb();for(c=b[0],d=1;d<b.length;++d)b[d][a](c)&&(c=b[d]);return c}function lb(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),B(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function mb(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function nb(a,b,c){return"Month"===b?lb(a,c):a._d["set"+(a._isUTC?"UTC":"")+b](c)}function ob(a,b){return function(c){return null!=c?(nb(this,a,c),tb.updateOffset(this,b),this):mb(this,a)}}function pb(a){return 400*a/146097}function qb(a){return 146097*a/400}function rb(a){tb.duration.fn[a]=function(){return this._data[a]}}function sb(a){"undefined"==typeof ender&&(ub=xb.moment,xb.moment=a?f("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.",tb):tb)}for(var tb,ub,vb,wb="2.8.3",xb="undefined"!=typeof global?global:this,yb=Math.round,zb=Object.prototype.hasOwnProperty,Ab=0,Bb=1,Cb=2,Db=3,Eb=4,Fb=5,Gb=6,Hb={},Ib=[],Jb="undefined"!=typeof module&&module.exports,Kb=/^\/?Date\((\-?\d+)/i,Lb=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Mb=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,Nb=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,Ob=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,Pb=/\d\d?/,Qb=/\d{1,3}/,Rb=/\d{1,4}/,Sb=/[+\-]?\d{1,6}/,Tb=/\d+/,Ub=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Vb=/Z|[\+\-]\d\d:?\d\d/gi,Wb=/T/i,Xb=/[\+\-]?\d+(\.\d{1,3})?/,Yb=/\d{1,2}/,Zb=/\d/,$b=/\d\d/,_b=/\d{3}/,ac=/\d{4}/,bc=/[+-]?\d{6}/,cc=/[+-]?\d+/,dc=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ec="YYYY-MM-DDTHH:mm:ssZ",fc=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],gc=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],hc=/([\+\-]|\d\d)/gi,ic=("Date|Hours|Minutes|Seconds|Milliseconds".split("|"),{Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6}),jc={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",Q:"quarter",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},kc={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},lc={},mc={s:45,m:45,h:22,d:26,M:11},nc="DDD w W M D d".split(" "),oc="M D H h m s w W".split(" "),pc={M:function(){return this.month()+1},MMM:function(a){return this.localeData().monthsShort(this,a)},MMMM:function(a){return this.localeData().months(this,a)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.localeData().weekdaysMin(this,a)},ddd:function(a){return this.localeData().weekdaysShort(this,a)},dddd:function(a){return this.localeData().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return p(this.year()%100,2)},YYYY:function(){return p(this.year(),4)},YYYYY:function(){return p(this.year(),5)},YYYYYY:function(){var a=this.year(),b=a>=0?"+":"-";return b+p(Math.abs(a),6)},gg:function(){return p(this.weekYear()%100,2)},gggg:function(){return p(this.weekYear(),4)},ggggg:function(){return p(this.weekYear(),5)},GG:function(){return p(this.isoWeekYear()%100,2)},GGGG:function(){return p(this.isoWeekYear(),4)},GGGGG:function(){return p(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return A(this.milliseconds()/100)},SS:function(){return p(A(this.milliseconds()/10),2)},SSS:function(){return p(this.milliseconds(),3)},SSSS:function(){return p(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+p(A(a/60),2)+":"+p(A(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+p(A(a/60),2)+p(A(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},qc={},rc=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];nc.length;)vb=nc.pop(),pc[vb+"o"]=i(pc[vb],vb);for(;oc.length;)vb=oc.pop(),pc[vb+vb]=h(pc[vb],2);pc.DDDD=h(pc.DDD,3),m(j.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var b,c,d;for(this._monthsParse||(this._monthsParse=[]),b=0;12>b;b++)if(this._monthsParse[b]||(c=tb.utc([2e3,b]),d="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=new RegExp(d.replace(".",""),"i")),this._monthsParse[b].test(a))return b},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=tb([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return"function"==typeof c?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return hb(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),tb=function(b,c,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._i=b,g._f=c,g._l=e,g._strict=f,g._isUTC=!1,g._pf=d(),jb(g)},tb.suppressDeprecationWarnings=!1,tb.createFromInputFallback=f("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i)}),tb.min=function(){var a=[].slice.call(arguments,0);return kb("isBefore",a)},tb.max=function(){var a=[].slice.call(arguments,0);return kb("isAfter",a)},tb.utc=function(b,c,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._useUTC=!0,g._isUTC=!0,g._l=e,g._i=b,g._f=c,g._strict=f,g._pf=d(),jb(g).utc()},tb.unix=function(a){return tb(1e3*a)},tb.duration=function(a,b){var d,e,f,g,h=a,i=null;return tb.isDuration(a)?h={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(h={},b?h[b]=a:h.milliseconds=a):(i=Lb.exec(a))?(d="-"===i[1]?-1:1,h={y:0,d:A(i[Cb])*d,h:A(i[Db])*d,m:A(i[Eb])*d,s:A(i[Fb])*d,ms:A(i[Gb])*d}):(i=Mb.exec(a))?(d="-"===i[1]?-1:1,f=function(a){var b=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*d},h={y:f(i[2]),M:f(i[3]),d:f(i[4]),h:f(i[5]),m:f(i[6]),s:f(i[7]),w:f(i[8])}):"object"==typeof h&&("from"in h||"to"in h)&&(g=r(tb(h.from),tb(h.to)),h={},h.ms=g.milliseconds,h.M=g.months),e=new l(h),tb.isDuration(a)&&c(a,"_locale")&&(e._locale=a._locale),e},tb.version=wb,tb.defaultFormat=ec,tb.ISO_8601=function(){},tb.momentProperties=Ib,tb.updateOffset=function(){},tb.relativeTimeThreshold=function(b,c){return mc[b]===a?!1:c===a?mc[b]:(mc[b]=c,!0)},tb.lang=f("moment.lang is deprecated. Use moment.locale instead.",function(a,b){return tb.locale(a,b)}),tb.locale=function(a,b){var c;return a&&(c="undefined"!=typeof b?tb.defineLocale(a,b):tb.localeData(a),c&&(tb.duration._locale=tb._locale=c)),tb._locale._abbr},tb.defineLocale=function(a,b){return null!==b?(b.abbr=a,Hb[a]||(Hb[a]=new j),Hb[a].set(b),tb.locale(a),Hb[a]):(delete Hb[a],null)},tb.langData=f("moment.langData is deprecated. Use moment.localeData instead.",function(a){return tb.localeData(a)}),tb.localeData=function(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return tb._locale;if(!u(a)){if(b=J(a))return b;a=[a]}return I(a)},tb.isMoment=function(a){return a instanceof k||null!=a&&c(a,"_isAMomentObject")},tb.isDuration=function(a){return a instanceof l};for(vb=rc.length-1;vb>=0;--vb)z(rc[vb]);tb.normalizeUnits=function(a){return x(a)},tb.invalid=function(a){var b=tb.utc(0/0);return null!=a?m(b._pf,a):b._pf.userInvalidated=!0,b},tb.parseZone=function(){return tb.apply(null,arguments).parseZone()},tb.parseTwoDigitYear=function(a){return A(a)+(A(a)>68?1900:2e3)},m(tb.fn=k.prototype,{clone:function(){return tb(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=tb(this).utc();return 0<a.year()&&a.year()<=9999?N(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):N(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds()]},isValid:function(){return G(this)},isDSTShifted:function(){return this._a?this.isValid()&&w(this._a,(this._isUTC?tb.utc(this._a):tb(this._a)).toArray())>0:!1},parsingFlags:function(){return m({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(a){return this.zone(0,a)},local:function(a){return this._isUTC&&(this.zone(0,a),this._isUTC=!1,a&&this.add(this._dateTzOffset(),"m")),this},format:function(a){var b=N(this,a||tb.defaultFormat);return this.localeData().postformat(b)},add:s(1,"add"),subtract:s(-1,"subtract"),diff:function(a,b,c){var d,e,f,g=K(a,this),h=6e4*(this.zone()-g.zone());return b=x(b),"year"===b||"month"===b?(d=432e5*(this.daysInMonth()+g.daysInMonth()),e=12*(this.year()-g.year())+(this.month()-g.month()),f=this-tb(this).startOf("month")-(g-tb(g).startOf("month")),f-=6e4*(this.zone()-tb(this).startOf("month").zone()-(g.zone()-tb(g).startOf("month").zone())),e+=f/d,"year"===b&&(e/=12)):(d=this-g,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-h)/864e5:"week"===b?(d-h)/6048e5:d),c?e:o(e)},from:function(a,b){return tb.duration({to:this,from:a}).locale(this.locale()).humanize(!b)},fromNow:function(a){return this.from(tb(),a)},calendar:function(a){var b=a||tb(),c=K(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this))},isLeapYear:function(){return E(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=eb(a,this.localeData()),this.add(a-b,"d")):b},month:ob("Month",!0),startOf:function(a){switch(a=x(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this},endOf:function(a){return a=x(a),this.startOf(a).add(1,"isoWeek"===a?"week":a).subtract(1,"ms")},isAfter:function(a,b){return b=x("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=tb.isMoment(a)?a:tb(a),+this>+a):+this.clone().startOf(b)>+tb(a).startOf(b)},isBefore:function(a,b){return b=x("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=tb.isMoment(a)?a:tb(a),+a>+this):+this.clone().startOf(b)<+tb(a).startOf(b)},isSame:function(a,b){return b=x(b||"millisecond"),"millisecond"===b?(a=tb.isMoment(a)?a:tb(a),+this===+a):+this.clone().startOf(b)===+K(a,this).startOf(b)},min:f("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(a){return a=tb.apply(null,arguments),this>a?this:a}),max:f("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(a){return a=tb.apply(null,arguments),a>this?this:a}),zone:function(a,b){var c,d=this._offset||0;return null==a?this._isUTC?d:this._dateTzOffset():("string"==typeof a&&(a=Q(a)),Math.abs(a)<16&&(a=60*a),!this._isUTC&&b&&(c=this._dateTzOffset()),this._offset=a,this._isUTC=!0,null!=c&&this.subtract(c,"m"),d!==a&&(!b||this._changeInProgress?t(this,tb.duration(d-a,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,tb.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(a){return a=a?tb(a).zone():0,(this.zone()-a)%60===0},daysInMonth:function(){return B(this.year(),this.month())},dayOfYear:function(a){var b=yb((tb(this).startOf("day")-tb(this).startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")},quarter:function(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)},weekYear:function(a){var b=hb(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==a?b:this.add(a-b,"y")},isoWeekYear:function(a){var b=hb(this,1,4).year;return null==a?b:this.add(a-b,"y")},week:function(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")},isoWeek:function(a){var b=hb(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")},weekday:function(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},isoWeeksInYear:function(){return C(this.year(),1,4)},weeksInYear:function(){var a=this.localeData()._week;return C(this.year(),a.dow,a.doy)},get:function(a){return a=x(a),this[a]()},set:function(a,b){return a=x(a),"function"==typeof this[a]&&this[a](b),this},locale:function(b){var c;return b===a?this._locale._abbr:(c=tb.localeData(b),null!=c&&(this._locale=c),this)},lang:f("moment().lang() is deprecated. Use moment().localeData() instead.",function(b){return b===a?this.localeData():this.locale(b)}),localeData:function(){return this._locale},_dateTzOffset:function(){return 15*Math.round(this._d.getTimezoneOffset()/15)}}),tb.fn.millisecond=tb.fn.milliseconds=ob("Milliseconds",!1),tb.fn.second=tb.fn.seconds=ob("Seconds",!1),tb.fn.minute=tb.fn.minutes=ob("Minutes",!1),tb.fn.hour=tb.fn.hours=ob("Hours",!0),tb.fn.date=ob("Date",!0),tb.fn.dates=f("dates accessor is deprecated. Use date instead.",ob("Date",!0)),tb.fn.year=ob("FullYear",!0),tb.fn.years=f("years accessor is deprecated. Use year instead.",ob("FullYear",!0)),tb.fn.days=tb.fn.day,tb.fn.months=tb.fn.month,tb.fn.weeks=tb.fn.week,tb.fn.isoWeeks=tb.fn.isoWeek,tb.fn.quarters=tb.fn.quarter,tb.fn.toJSON=tb.fn.toISOString,m(tb.duration.fn=l.prototype,{_bubble:function(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;g.milliseconds=d%1e3,a=o(d/1e3),g.seconds=a%60,b=o(a/60),g.minutes=b%60,c=o(b/60),g.hours=c%24,e+=o(c/24),h=o(pb(e)),e-=o(qb(h)),f+=o(e/30),e%=30,h+=o(f/12),f%=12,g.days=e,g.months=f,g.years=h},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return o(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*A(this._months/12)},humanize:function(a){var b=gb(this,!a,this.localeData());return a&&(b=this.localeData().pastFuture(+this,b)),this.localeData().postformat(b)},add:function(a,b){var c=tb.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=tb.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=x(a),this[a.toLowerCase()+"s"]()},as:function(a){var b,c;if(a=x(a),"month"===a||"year"===a)return b=this._days+this._milliseconds/864e5,c=this._months+12*pb(b),"month"===a?c:c/12;switch(b=this._days+qb(this._months/12),a){case"week":return b/7+this._milliseconds/6048e5;case"day":return b+this._milliseconds/864e5;case"hour":return 24*b+this._milliseconds/36e5;case"minute":return 24*b*60+this._milliseconds/6e4;case"second":return 24*b*60*60+this._milliseconds/1e3;case"millisecond":return Math.floor(24*b*60*60*1e3)+this._milliseconds;default:throw new Error("Unknown unit "+a)}},lang:tb.fn.lang,locale:tb.fn.locale,toIsoString:f("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",function(){return this.toISOString()}),toISOString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"},localeData:function(){return this._locale}}),tb.duration.fn.toString=tb.duration.fn.toISOString;for(vb in ic)c(ic,vb)&&rb(vb.toLowerCase());tb.duration.fn.asMilliseconds=function(){return this.as("ms")},tb.duration.fn.asSeconds=function(){return this.as("s")},tb.duration.fn.asMinutes=function(){return this.as("m")},tb.duration.fn.asHours=function(){return this.as("h")},tb.duration.fn.asDays=function(){return this.as("d")},tb.duration.fn.asWeeks=function(){return this.as("weeks")},tb.duration.fn.asMonths=function(){return this.as("M")},tb.duration.fn.asYears=function(){return this.as("y")},tb.locale("en",{ordinal:function(a){var b=a%10,c=1===A(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";
7
- return a+c}}),Jb?module.exports=tb:"function"==typeof define&&define.amd?(define("moment",function(a,b,c){return c.config&&c.config()&&c.config().noGlobal===!0&&(xb.moment=ub),tb}),sb(!0)):sb()}).call(this);
6
+ (function(a){function b(a,b,c){switch(arguments.length){case 2:return null!=a?a:b;case 3:return null!=a?a:null!=b?b:c;default:throw new Error("Implement me")}}function c(a,b){return Bb.call(a,b)}function d(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function e(a){vb.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+a)}function f(a,b){var c=!0;return o(function(){return c&&(e(a),c=!1),b.apply(this,arguments)},b)}function g(a,b){sc[a]||(e(b),sc[a]=!0)}function h(a,b){return function(c){return r(a.call(this,c),b)}}function i(a,b){return function(c){return this.localeData().ordinal(a.call(this,c),b)}}function j(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function k(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function l(){}function m(a,b){b!==!1&&H(a),p(this,a),this._d=new Date(+a._d),uc===!1&&(uc=!0,vb.updateOffset(this),uc=!1)}function n(a){var b=A(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+36e5*h,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=vb.localeData(),this._bubble()}function o(a,b){for(var d in b)c(b,d)&&(a[d]=b[d]);return c(b,"toString")&&(a.toString=b.toString),c(b,"valueOf")&&(a.valueOf=b.valueOf),a}function p(a,b){var c,d,e;if("undefined"!=typeof b._isAMomentObject&&(a._isAMomentObject=b._isAMomentObject),"undefined"!=typeof b._i&&(a._i=b._i),"undefined"!=typeof b._f&&(a._f=b._f),"undefined"!=typeof b._l&&(a._l=b._l),"undefined"!=typeof b._strict&&(a._strict=b._strict),"undefined"!=typeof b._tzm&&(a._tzm=b._tzm),"undefined"!=typeof b._isUTC&&(a._isUTC=b._isUTC),"undefined"!=typeof b._offset&&(a._offset=b._offset),"undefined"!=typeof b._pf&&(a._pf=b._pf),"undefined"!=typeof b._locale&&(a._locale=b._locale),Kb.length>0)for(c in Kb)d=Kb[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function q(a){return 0>a?Math.ceil(a):Math.floor(a)}function r(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.length<b;)d="0"+d;return(e?c?"+":"":"-")+d}function s(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function t(a,b){var c;return b=M(b,a),a.isBefore(b)?c=s(a,b):(c=s(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function u(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(g(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=vb.duration(c,d),v(this,e,a),this}}function v(a,b,c,d){var e=b._milliseconds,f=b._days,g=b._months;d=null==d?!0:d,e&&a._d.setTime(+a._d+e*c),f&&pb(a,"Date",ob(a,"Date")+f*c),g&&nb(a,ob(a,"Month")+g*c),d&&vb.updateOffset(a,f||g)}function w(a){return"[object Array]"===Object.prototype.toString.call(a)}function x(a){return"[object Date]"===Object.prototype.toString.call(a)||a instanceof Date}function y(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&C(a[d])!==C(b[d]))&&g++;return g+f}function z(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=lc[a]||mc[b]||b}return a}function A(a){var b,d,e={};for(d in a)c(a,d)&&(b=z(d),b&&(e[b]=a[d]));return e}function B(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}vb[b]=function(e,f){var g,h,i=vb._locale[b],j=[];if("number"==typeof e&&(f=e,e=a),h=function(a){var b=vb().utc().set(d,a);return i.call(vb._locale,b,e||"")},null!=f)return h(f);for(g=0;c>g;g++)j.push(h(g));return j}}function C(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function D(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function E(a,b,c){return jb(vb([a,11,31+b-c]),b,c).week}function F(a){return G(a)?366:365}function G(a){return a%4===0&&a%100!==0||a%400===0}function H(a){var b;a._a&&-2===a._pf.overflow&&(b=a._a[Db]<0||a._a[Db]>11?Db:a._a[Eb]<1||a._a[Eb]>D(a._a[Cb],a._a[Db])?Eb:a._a[Fb]<0||a._a[Fb]>24||24===a._a[Fb]&&(0!==a._a[Gb]||0!==a._a[Hb]||0!==a._a[Ib])?Fb:a._a[Gb]<0||a._a[Gb]>59?Gb:a._a[Hb]<0||a._a[Hb]>59?Hb:a._a[Ib]<0||a._a[Ib]>999?Ib:-1,a._pf._overflowDayOfYear&&(Cb>b||b>Eb)&&(b=Eb),a._pf.overflow=b)}function I(b){return null==b._isValid&&(b._isValid=!isNaN(b._d.getTime())&&b._pf.overflow<0&&!b._pf.empty&&!b._pf.invalidMonth&&!b._pf.nullInput&&!b._pf.invalidFormat&&!b._pf.userInvalidated,b._strict&&(b._isValid=b._isValid&&0===b._pf.charsLeftOver&&0===b._pf.unusedTokens.length&&b._pf.bigHour===a)),b._isValid}function J(a){return a?a.toLowerCase().replace("_","-"):a}function K(a){for(var b,c,d,e,f=0;f<a.length;){for(e=J(a[f]).split("-"),b=e.length,c=J(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=L(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&y(e,c,!0)>=b-1)break;b--}f++}return null}function L(a){var b=null;if(!Jb[a]&&Lb)try{b=vb.locale(),require("./locale/"+a),vb.locale(b)}catch(c){}return Jb[a]}function M(a,b){var c,d;return b._isUTC?(c=b.clone(),d=(vb.isMoment(a)||x(a)?+a:+vb(a))-+c,c._d.setTime(+c._d+d),vb.updateOffset(c,!1),c):vb(a).local()}function N(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function O(a){var b,c,d=a.match(Pb);for(b=0,c=d.length;c>b;b++)d[b]=rc[d[b]]?rc[d[b]]:N(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function P(a,b){return a.isValid()?(b=Q(b,a.localeData()),nc[b]||(nc[b]=O(b)),nc[b](a)):a.localeData().invalidDate()}function Q(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Qb.lastIndex=0;d>=0&&Qb.test(a);)a=a.replace(Qb,c),Qb.lastIndex=0,d-=1;return a}function R(a,b){var c,d=b._strict;switch(a){case"Q":return _b;case"DDDD":return bc;case"YYYY":case"GGGG":case"gggg":return d?cc:Tb;case"Y":case"G":case"g":return ec;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return d?dc:Ub;case"S":if(d)return _b;case"SS":if(d)return ac;case"SSS":if(d)return bc;case"DDD":return Sb;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Wb;case"a":case"A":return b._locale._meridiemParse;case"x":return Zb;case"X":return $b;case"Z":case"ZZ":return Xb;case"T":return Yb;case"SSSS":return Vb;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return d?ac:Rb;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Rb;case"Do":return d?b._locale._ordinalParse:b._locale._ordinalParseLenient;default:return c=new RegExp($(Z(a.replace("\\","")),"i"))}}function S(a){a=a||"";var b=a.match(Xb)||[],c=b[b.length-1]||[],d=(c+"").match(jc)||["-",0,0],e=+(60*d[1])+C(d[2]);return"+"===d[0]?e:-e}function T(a,b,c){var d,e=c._a;switch(a){case"Q":null!=b&&(e[Db]=3*(C(b)-1));break;case"M":case"MM":null!=b&&(e[Db]=C(b)-1);break;case"MMM":case"MMMM":d=c._locale.monthsParse(b,a,c._strict),null!=d?e[Db]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[Eb]=C(b));break;case"Do":null!=b&&(e[Eb]=C(parseInt(b.match(/\d{1,2}/)[0],10)));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=C(b));break;case"YY":e[Cb]=vb.parseTwoDigitYear(b);break;case"YYYY":case"YYYYY":case"YYYYYY":e[Cb]=C(b);break;case"a":case"A":c._meridiem=b;break;case"h":case"hh":c._pf.bigHour=!0;case"H":case"HH":e[Fb]=C(b);break;case"m":case"mm":e[Gb]=C(b);break;case"s":case"ss":e[Hb]=C(b);break;case"S":case"SS":case"SSS":case"SSSS":e[Ib]=C(1e3*("0."+b));break;case"x":c._d=new Date(C(b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=S(b);break;case"dd":case"ddd":case"dddd":d=c._locale.weekdaysParse(b),null!=d?(c._w=c._w||{},c._w.d=d):c._pf.invalidWeekday=b;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":a=a.substr(0,1);case"gggg":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=C(b));break;case"gg":case"GG":c._w=c._w||{},c._w[a]=vb.parseTwoDigitYear(b)}}function U(a){var c,d,e,f,g,h,i;c=a._w,null!=c.GG||null!=c.W||null!=c.E?(g=1,h=4,d=b(c.GG,a._a[Cb],jb(vb(),1,4).year),e=b(c.W,1),f=b(c.E,1)):(g=a._locale._week.dow,h=a._locale._week.doy,d=b(c.gg,a._a[Cb],jb(vb(),g,h).year),e=b(c.w,1),null!=c.d?(f=c.d,g>f&&++e):f=null!=c.e?c.e+g:g),i=kb(d,e,f,h,g),a._a[Cb]=i.year,a._dayOfYear=i.dayOfYear}function V(a){var c,d,e,f,g=[];if(!a._d){for(e=X(a),a._w&&null==a._a[Eb]&&null==a._a[Db]&&U(a),a._dayOfYear&&(f=b(a._a[Cb],e[Cb]),a._dayOfYear>F(f)&&(a._pf._overflowDayOfYear=!0),d=fb(f,0,a._dayOfYear),a._a[Db]=d.getUTCMonth(),a._a[Eb]=d.getUTCDate()),c=0;3>c&&null==a._a[c];++c)a._a[c]=g[c]=e[c];for(;7>c;c++)a._a[c]=g[c]=null==a._a[c]?2===c?1:0:a._a[c];24===a._a[Fb]&&0===a._a[Gb]&&0===a._a[Hb]&&0===a._a[Ib]&&(a._nextDay=!0,a._a[Fb]=0),a._d=(a._useUTC?fb:eb).apply(null,g),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[Fb]=24)}}function W(a){var b;a._d||(b=A(a._i),a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],V(a))}function X(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function Y(b){if(b._f===vb.ISO_8601)return void ab(b);b._a=[],b._pf.empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=Q(b._f,b._locale).match(Pb)||[],c=0;c<e.length;c++)f=e[c],d=(h.match(R(f,b))||[])[0],d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&b._pf.unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),rc[f]?(d?b._pf.empty=!1:b._pf.unusedTokens.push(f),T(f,d,b)):b._strict&&!d&&b._pf.unusedTokens.push(f);b._pf.charsLeftOver=i-j,h.length>0&&b._pf.unusedInput.push(h),b._pf.bigHour===!0&&b._a[Fb]<=12&&(b._pf.bigHour=a),b._a[Fb]=k(b._locale,b._a[Fb],b._meridiem),V(b),H(b)}function Z(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function $(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function _(a){var b,c,e,f,g;if(0===a._f.length)return a._pf.invalidFormat=!0,void(a._d=new Date(0/0));for(f=0;f<a._f.length;f++)g=0,b=p({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._pf=d(),b._f=a._f[f],Y(b),I(b)&&(g+=b._pf.charsLeftOver,g+=10*b._pf.unusedTokens.length,b._pf.score=g,(null==e||e>g)&&(e=g,c=b));o(a,c||b)}function ab(a){var b,c,d=a._i,e=fc.exec(d);if(e){for(a._pf.iso=!0,b=0,c=hc.length;c>b;b++)if(hc[b][1].exec(d)){a._f=hc[b][0]+(e[6]||" ");break}for(b=0,c=ic.length;c>b;b++)if(ic[b][1].exec(d)){a._f+=ic[b][0];break}d.match(Xb)&&(a._f+="Z"),Y(a)}else a._isValid=!1}function bb(a){ab(a),a._isValid===!1&&(delete a._isValid,vb.createFromInputFallback(a))}function cb(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function db(b){var c,d=b._i;d===a?b._d=new Date:x(d)?b._d=new Date(+d):null!==(c=Mb.exec(d))?b._d=new Date(+c[1]):"string"==typeof d?bb(b):w(d)?(b._a=cb(d.slice(0),function(a){return parseInt(a,10)}),V(b)):"object"==typeof d?W(b):"number"==typeof d?b._d=new Date(d):vb.createFromInputFallback(b)}function eb(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function fb(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function gb(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function hb(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function ib(a,b,c){var d=vb.duration(a).abs(),e=Ab(d.as("s")),f=Ab(d.as("m")),g=Ab(d.as("h")),h=Ab(d.as("d")),i=Ab(d.as("M")),j=Ab(d.as("y")),k=e<oc.s&&["s",e]||1===f&&["m"]||f<oc.m&&["mm",f]||1===g&&["h"]||g<oc.h&&["hh",g]||1===h&&["d"]||h<oc.d&&["dd",h]||1===i&&["M"]||i<oc.M&&["MM",i]||1===j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,hb.apply({},k)}function jb(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=vb(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function kb(a,b,c,d,e){var f,g,h=fb(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:F(a-1)+g}}function lb(b){var c,d=b._i,e=b._f;return b._locale=b._locale||vb.localeData(b._l),null===d||e===a&&""===d?vb.invalid({nullInput:!0}):("string"==typeof d&&(b._i=d=b._locale.preparse(d)),vb.isMoment(d)?new m(d,!0):(e?w(e)?_(b):Y(b):db(b),c=new m(b),c._nextDay&&(c.add(1,"d"),c._nextDay=a),c))}function mb(a,b){var c,d;if(1===b.length&&w(b[0])&&(b=b[0]),!b.length)return vb();for(c=b[0],d=1;d<b.length;++d)b[d][a](c)&&(c=b[d]);return c}function nb(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),D(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function ob(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function pb(a,b,c){return"Month"===b?nb(a,c):a._d["set"+(a._isUTC?"UTC":"")+b](c)}function qb(a,b){return function(c){return null!=c?(pb(this,a,c),vb.updateOffset(this,b),this):ob(this,a)}}function rb(a){return 400*a/146097}function sb(a){return 146097*a/400}function tb(a){vb.duration.fn[a]=function(){return this._data[a]}}function ub(a){"undefined"==typeof ender&&(wb=zb.moment,zb.moment=a?f("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.",vb):vb)}for(var vb,wb,xb,yb="2.9.0",zb="undefined"==typeof global||"undefined"!=typeof window&&window!==global.window?this:global,Ab=Math.round,Bb=Object.prototype.hasOwnProperty,Cb=0,Db=1,Eb=2,Fb=3,Gb=4,Hb=5,Ib=6,Jb={},Kb=[],Lb="undefined"!=typeof module&&module&&module.exports,Mb=/^\/?Date\((\-?\d+)/i,Nb=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Ob=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,Pb=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g,Qb=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Rb=/\d\d?/,Sb=/\d{1,3}/,Tb=/\d{1,4}/,Ub=/[+\-]?\d{1,6}/,Vb=/\d+/,Wb=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Xb=/Z|[\+\-]\d\d:?\d\d/gi,Yb=/T/i,Zb=/[\+\-]?\d+/,$b=/[\+\-]?\d+(\.\d{1,3})?/,_b=/\d/,ac=/\d\d/,bc=/\d{3}/,cc=/\d{4}/,dc=/[+-]?\d{6}/,ec=/[+-]?\d+/,fc=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,gc="YYYY-MM-DDTHH:mm:ssZ",hc=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],ic=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],jc=/([\+\-]|\d\d)/gi,kc=("Date|Hours|Minutes|Seconds|Milliseconds".split("|"),{Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6}),lc={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",Q:"quarter",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},mc={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},nc={},oc={s:45,m:45,h:22,d:26,M:11},pc="DDD w W M D d".split(" "),qc="M D H h m s w W".split(" "),rc={M:function(){return this.month()+1},MMM:function(a){return this.localeData().monthsShort(this,a)},MMMM:function(a){return this.localeData().months(this,a)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.localeData().weekdaysMin(this,a)},ddd:function(a){return this.localeData().weekdaysShort(this,a)},dddd:function(a){return this.localeData().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return r(this.year()%100,2)},YYYY:function(){return r(this.year(),4)},YYYYY:function(){return r(this.year(),5)},YYYYYY:function(){var a=this.year(),b=a>=0?"+":"-";return b+r(Math.abs(a),6)},gg:function(){return r(this.weekYear()%100,2)},gggg:function(){return r(this.weekYear(),4)},ggggg:function(){return r(this.weekYear(),5)},GG:function(){return r(this.isoWeekYear()%100,2)},GGGG:function(){return r(this.isoWeekYear(),4)},GGGGG:function(){return r(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return C(this.milliseconds()/100)},SS:function(){return r(C(this.milliseconds()/10),2)},SSS:function(){return r(this.milliseconds(),3)},SSSS:function(){return r(this.milliseconds(),3)},Z:function(){var a=this.utcOffset(),b="+";return 0>a&&(a=-a,b="-"),b+r(C(a/60),2)+":"+r(C(a)%60,2)},ZZ:function(){var a=this.utcOffset(),b="+";return 0>a&&(a=-a,b="-"),b+r(C(a/60),2)+r(C(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},x:function(){return this.valueOf()},X:function(){return this.unix()},Q:function(){return this.quarter()}},sc={},tc=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"],uc=!1;pc.length;)xb=pc.pop(),rc[xb+"o"]=i(rc[xb],xb);for(;qc.length;)xb=qc.pop(),rc[xb+xb]=h(rc[xb],2);rc.DDDD=h(rc.DDD,3),o(l.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a,b,c){var d,e,f;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=vb.utc([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=vb([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.apply(b,[c]):d},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",_ordinalParse:/\d{1,2}/,preparse:function(a){return a},postformat:function(a){return a},week:function(a){return jb(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},firstDayOfWeek:function(){return this._week.dow},firstDayOfYear:function(){return this._week.doy},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),vb=function(b,c,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._i=b,g._f=c,g._l=e,g._strict=f,g._isUTC=!1,g._pf=d(),lb(g)},vb.suppressDeprecationWarnings=!1,vb.createFromInputFallback=f("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),vb.min=function(){var a=[].slice.call(arguments,0);return mb("isBefore",a)},vb.max=function(){var a=[].slice.call(arguments,0);return mb("isAfter",a)},vb.utc=function(b,c,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._useUTC=!0,g._isUTC=!0,g._l=e,g._i=b,g._f=c,g._strict=f,g._pf=d(),lb(g).utc()},vb.unix=function(a){return vb(1e3*a)},vb.duration=function(a,b){var d,e,f,g,h=a,i=null;return vb.isDuration(a)?h={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(h={},b?h[b]=a:h.milliseconds=a):(i=Nb.exec(a))?(d="-"===i[1]?-1:1,h={y:0,d:C(i[Eb])*d,h:C(i[Fb])*d,m:C(i[Gb])*d,s:C(i[Hb])*d,ms:C(i[Ib])*d}):(i=Ob.exec(a))?(d="-"===i[1]?-1:1,f=function(a){var b=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*d},h={y:f(i[2]),M:f(i[3]),d:f(i[4]),h:f(i[5]),m:f(i[6]),s:f(i[7]),w:f(i[8])}):null==h?h={}:"object"==typeof h&&("from"in h||"to"in h)&&(g=t(vb(h.from),vb(h.to)),h={},h.ms=g.milliseconds,h.M=g.months),e=new n(h),vb.isDuration(a)&&c(a,"_locale")&&(e._locale=a._locale),e},vb.version=yb,vb.defaultFormat=gc,vb.ISO_8601=function(){},vb.momentProperties=Kb,vb.updateOffset=function(){},vb.relativeTimeThreshold=function(b,c){return oc[b]===a?!1:c===a?oc[b]:(oc[b]=c,!0)},vb.lang=f("moment.lang is deprecated. Use moment.locale instead.",function(a,b){return vb.locale(a,b)}),vb.locale=function(a,b){var c;return a&&(c="undefined"!=typeof b?vb.defineLocale(a,b):vb.localeData(a),c&&(vb.duration._locale=vb._locale=c)),vb._locale._abbr},vb.defineLocale=function(a,b){return null!==b?(b.abbr=a,Jb[a]||(Jb[a]=new l),Jb[a].set(b),vb.locale(a),Jb[a]):(delete Jb[a],null)},vb.langData=f("moment.langData is deprecated. Use moment.localeData instead.",function(a){return vb.localeData(a)}),vb.localeData=function(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return vb._locale;if(!w(a)){if(b=L(a))return b;a=[a]}return K(a)},vb.isMoment=function(a){return a instanceof m||null!=a&&c(a,"_isAMomentObject")},vb.isDuration=function(a){return a instanceof n};for(xb=tc.length-1;xb>=0;--xb)B(tc[xb]);vb.normalizeUnits=function(a){return z(a)},vb.invalid=function(a){var b=vb.utc(0/0);return null!=a?o(b._pf,a):b._pf.userInvalidated=!0,b},vb.parseZone=function(){return vb.apply(null,arguments).parseZone()},vb.parseTwoDigitYear=function(a){return C(a)+(C(a)>68?1900:2e3)},vb.isDate=x,o(vb.fn=m.prototype,{clone:function(){return vb(this)},valueOf:function(){return+this._d-6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=vb(this).utc();return 0<a.year()&&a.year()<=9999?"function"==typeof Date.prototype.toISOString?this.toDate().toISOString():P(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):P(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds()]},isValid:function(){return I(this)},isDSTShifted:function(){return this._a?this.isValid()&&y(this._a,(this._isUTC?vb.utc(this._a):vb(this._a)).toArray())>0:!1},parsingFlags:function(){return o({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(a){return this.utcOffset(0,a)},local:function(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(this._dateUtcOffset(),"m")),this},format:function(a){var b=P(this,a||vb.defaultFormat);return this.localeData().postformat(b)},add:u(1,"add"),subtract:u(-1,"subtract"),diff:function(a,b,c){var d,e,f=M(a,this),g=6e4*(f.utcOffset()-this.utcOffset());return b=z(b),"year"===b||"month"===b||"quarter"===b?(e=j(this,f),"quarter"===b?e/=3:"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:q(e)},from:function(a,b){return vb.duration({to:this,from:a}).locale(this.locale()).humanize(!b)},fromNow:function(a){return this.from(vb(),a)},calendar:function(a){var b=a||vb(),c=M(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this,vb(b)))},isLeapYear:function(){return G(this.year())},isDST:function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=gb(a,this.localeData()),this.add(a-b,"d")):b},month:qb("Month",!0),startOf:function(a){switch(a=z(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this},endOf:function(b){return b=z(b),b===a||"millisecond"===b?this:this.startOf(b).add(1,"isoWeek"===b?"week":b).subtract(1,"ms")},isAfter:function(a,b){var c;return b=z("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=vb.isMoment(a)?a:vb(a),+this>+a):(c=vb.isMoment(a)?+a:+vb(a),c<+this.clone().startOf(b))},isBefore:function(a,b){var c;return b=z("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=vb.isMoment(a)?a:vb(a),+a>+this):(c=vb.isMoment(a)?+a:+vb(a),+this.clone().endOf(b)<c)},isBetween:function(a,b,c){return this.isAfter(a,c)&&this.isBefore(b,c)},isSame:function(a,b){var c;return b=z(b||"millisecond"),"millisecond"===b?(a=vb.isMoment(a)?a:vb(a),+this===+a):(c=+vb(a),+this.clone().startOf(b)<=c&&c<=+this.clone().endOf(b))},min:f("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(a){return a=vb.apply(null,arguments),this>a?this:a}),max:f("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(a){return a=vb.apply(null,arguments),a>this?this:a}),zone:f("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",function(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}),utcOffset:function(a,b){var c,d=this._offset||0;return null!=a?("string"==typeof a&&(a=S(a)),Math.abs(a)<16&&(a=60*a),!this._isUTC&&b&&(c=this._dateUtcOffset()),this._offset=a,this._isUTC=!0,null!=c&&this.add(c,"m"),d!==a&&(!b||this._changeInProgress?v(this,vb.duration(a-d,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,vb.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?d:this._dateUtcOffset()},isLocal:function(){return!this._isUTC},isUtcOffset:function(){return this._isUTC},isUtc:function(){return this._isUTC&&0===this._offset},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(S(this._i)),this},hasAlignedHourOffset:function(a){return a=a?vb(a).utcOffset():0,(this.utcOffset()-a)%60===0},daysInMonth:function(){return D(this.year(),this.month())},dayOfYear:function(a){var b=Ab((vb(this).startOf("day")-vb(this).startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")},quarter:function(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)},weekYear:function(a){var b=jb(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==a?b:this.add(a-b,"y")},isoWeekYear:function(a){var b=jb(this,1,4).year;return null==a?b:this.add(a-b,"y")},week:function(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")},isoWeek:function(a){var b=jb(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")},weekday:function(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},isoWeeksInYear:function(){return E(this.year(),1,4)},weeksInYear:function(){var a=this.localeData()._week;return E(this.year(),a.dow,a.doy)},get:function(a){return a=z(a),this[a]()},set:function(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else a=z(a),"function"==typeof this[a]&&this[a](b);return this},locale:function(b){var c;return b===a?this._locale._abbr:(c=vb.localeData(b),null!=c&&(this._locale=c),this)},lang:f("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(b){return b===a?this.localeData():this.locale(b)}),localeData:function(){return this._locale},_dateUtcOffset:function(){return 15*-Math.round(this._d.getTimezoneOffset()/15)}}),vb.fn.millisecond=vb.fn.milliseconds=qb("Milliseconds",!1),vb.fn.second=vb.fn.seconds=qb("Seconds",!1),vb.fn.minute=vb.fn.minutes=qb("Minutes",!1),vb.fn.hour=vb.fn.hours=qb("Hours",!0),vb.fn.date=qb("Date",!0),vb.fn.dates=f("dates accessor is deprecated. Use date instead.",qb("Date",!0)),vb.fn.year=qb("FullYear",!0),vb.fn.years=f("years accessor is deprecated. Use year instead.",qb("FullYear",!0)),vb.fn.days=vb.fn.day,vb.fn.months=vb.fn.month,vb.fn.weeks=vb.fn.week,vb.fn.isoWeeks=vb.fn.isoWeek,vb.fn.quarters=vb.fn.quarter,vb.fn.toJSON=vb.fn.toISOString,vb.fn.isUTC=vb.fn.isUtc,o(vb.duration.fn=n.prototype,{_bubble:function(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;g.milliseconds=d%1e3,a=q(d/1e3),g.seconds=a%60,b=q(a/60),g.minutes=b%60,c=q(b/60),g.hours=c%24,e+=q(c/24),h=q(rb(e)),e-=q(sb(h)),f+=q(e/30),e%=30,h+=q(f/12),f%=12,g.days=e,g.months=f,g.years=h},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return q(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*C(this._months/12)
7
+ },humanize:function(a){var b=ib(this,!a,this.localeData());return a&&(b=this.localeData().pastFuture(+this,b)),this.localeData().postformat(b)},add:function(a,b){var c=vb.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=vb.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=z(a),this[a.toLowerCase()+"s"]()},as:function(a){var b,c;if(a=z(a),"month"===a||"year"===a)return b=this._days+this._milliseconds/864e5,c=this._months+12*rb(b),"month"===a?c:c/12;switch(b=this._days+Math.round(sb(this._months/12)),a){case"week":return b/7+this._milliseconds/6048e5;case"day":return b+this._milliseconds/864e5;case"hour":return 24*b+this._milliseconds/36e5;case"minute":return 24*b*60+this._milliseconds/6e4;case"second":return 24*b*60*60+this._milliseconds/1e3;case"millisecond":return Math.floor(24*b*60*60*1e3)+this._milliseconds;default:throw new Error("Unknown unit "+a)}},lang:vb.fn.lang,locale:vb.fn.locale,toIsoString:f("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",function(){return this.toISOString()}),toISOString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"},localeData:function(){return this._locale},toJSON:function(){return this.toISOString()}}),vb.duration.fn.toString=vb.duration.fn.toISOString;for(xb in kc)c(kc,xb)&&tb(xb.toLowerCase());vb.duration.fn.asMilliseconds=function(){return this.as("ms")},vb.duration.fn.asSeconds=function(){return this.as("s")},vb.duration.fn.asMinutes=function(){return this.as("m")},vb.duration.fn.asHours=function(){return this.as("h")},vb.duration.fn.asDays=function(){return this.as("d")},vb.duration.fn.asWeeks=function(){return this.as("weeks")},vb.duration.fn.asMonths=function(){return this.as("M")},vb.duration.fn.asYears=function(){return this.as("y")},vb.locale("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===C(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),Lb?module.exports=vb:"function"==typeof define&&define.amd?(define(function(a,b,c){return c.config&&c.config()&&c.config().noGlobal===!0&&(zb.moment=wb),vb}),ub(!0)):ub()}).call(this);
@@ -0,0 +1,2 @@
1
+ /*! Idle Timer v1.0.1 2014-03-21 | https://github.com/thorst/jquery-idletimer | (c) 2014 Paul Irish | Licensed MIT */
2
+ !function(a){a.idleTimer=function(b,c){var d;"object"==typeof b?(d=b,b=null):"number"==typeof b&&(d={timeout:b},b=null),c=c||document,d=a.extend({idle:!1,timeout:3e4,events:"mousemove keydown wheel DOMMouseScroll mousewheel mousedown touchstart touchmove MSPointerDown MSPointerMove"},d);var e=a(c),f=e.data("idleTimerObj")||{},g=function(b){var d=a.data(c,"idleTimerObj")||{};d.idle=!d.idle,d.olddate=+new Date;var e=a.Event((d.idle?"idle":"active")+".idleTimer");a(c).trigger(e,[c,a.extend({},d),b])},h=function(b){var d=a.data(c,"idleTimerObj")||{};if(null==d.remaining){if("mousemove"===b.type){if(b.pageX===d.pageX&&b.pageY===d.pageY)return;if("undefined"==typeof b.pageX&&"undefined"==typeof b.pageY)return;var e=+new Date-d.olddate;if(200>e)return}clearTimeout(d.tId),d.idle&&g(b),d.lastActive=+new Date,d.pageX=b.pageX,d.pageY=b.pageY,d.tId=setTimeout(g,d.timeout)}},i=function(){var b=a.data(c,"idleTimerObj")||{};b.idle=b.idleBackup,b.olddate=+new Date,b.lastActive=b.olddate,b.remaining=null,clearTimeout(b.tId),b.idle||(b.tId=setTimeout(g,b.timeout))},j=function(){var b=a.data(c,"idleTimerObj")||{};null==b.remaining&&(b.remaining=b.timeout-(+new Date-b.olddate),clearTimeout(b.tId))},k=function(){var b=a.data(c,"idleTimerObj")||{};null!=b.remaining&&(b.idle||(b.tId=setTimeout(g,b.remaining)),b.remaining=null)},l=function(){var b=a.data(c,"idleTimerObj")||{};clearTimeout(b.tId),e.removeData("idleTimerObj"),e.off("._idleTimer")},m=function(){var b=a.data(c,"idleTimerObj")||{};if(b.idle)return 0;if(null!=b.remaining)return b.remaining;var d=b.timeout-(+new Date-b.lastActive);return 0>d&&(d=0),d};if(null===b&&"undefined"!=typeof f.idle)return i(),e;if(null===b);else{if(null!==b&&"undefined"==typeof f.idle)return!1;if("destroy"===b)return l(),e;if("pause"===b)return j(),e;if("resume"===b)return k(),e;if("reset"===b)return i(),e;if("getRemainingTime"===b)return m();if("getElapsedTime"===b)return+new Date-f.olddate;if("getLastActiveTime"===b)return f.lastActive;if("isIdle"===b)return f.idle}return e.on(a.trim((d.events+" ").split(" ").join("._idleTimer ")),function(a){h(a)}),f=a.extend({},{olddate:+new Date,lastActive:+new Date,idle:d.idle,idleBackup:d.idle,timeout:d.timeout,remaining:null,tId:null,pageX:null,pageY:null}),f.idle||(f.tId=setTimeout(g,f.timeout)),a.data(c,"idleTimerObj",f),e},a.fn.idleTimer=function(b){return this[0]?a.idleTimer(b,this[0]):this}}(jQuery);
@@ -0,0 +1,130 @@
1
+ .jvectormap-container {
2
+ width: 100%;
3
+ height: 100%;
4
+ position: relative;
5
+ overflow: hidden;
6
+ }
7
+
8
+ .jvectormap-tip {
9
+ position: absolute;
10
+ display: none;
11
+ border: solid 1px #CDCDCD;
12
+ border-radius: 3px;
13
+ background: #292929;
14
+ color: white;
15
+ font-family: sans-serif, Verdana;
16
+ font-size: smaller;
17
+ padding: 3px;
18
+ }
19
+
20
+ .jvectormap-zoomin, .jvectormap-zoomout, .jvectormap-goback {
21
+ position: absolute;
22
+ left: 10px;
23
+ border-radius: 3px;
24
+ background: #292929;
25
+ padding: 3px;
26
+ color: white;
27
+ cursor: pointer;
28
+ line-height: 10px;
29
+ text-align: center;
30
+ box-sizing: content-box;
31
+ }
32
+
33
+ .jvectormap-zoomin, .jvectormap-zoomout {
34
+ width: 10px;
35
+ height: 10px;
36
+ }
37
+
38
+ .jvectormap-zoomin {
39
+ top: 10px;
40
+ }
41
+
42
+ .jvectormap-zoomout {
43
+ top: 30px;
44
+ }
45
+
46
+ .jvectormap-goback {
47
+ bottom: 10px;
48
+ z-index: 1000;
49
+ padding: 6px;
50
+ }
51
+
52
+ .jvectormap-spinner {
53
+ position: absolute;
54
+ left: 0;
55
+ top: 0;
56
+ right: 0;
57
+ bottom: 0;
58
+ background: center no-repeat url(data:image/gif;base64,R0lGODlhIAAgAPMAAP///wAAAMbGxoSEhLa2tpqamjY2NlZWVtjY2OTk5Ly8vB4eHgQEBAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAIAAgAAAE5xDISWlhperN52JLhSSdRgwVo1ICQZRUsiwHpTJT4iowNS8vyW2icCF6k8HMMBkCEDskxTBDAZwuAkkqIfxIQyhBQBFvAQSDITM5VDW6XNE4KagNh6Bgwe60smQUB3d4Rz1ZBApnFASDd0hihh12BkE9kjAJVlycXIg7CQIFA6SlnJ87paqbSKiKoqusnbMdmDC2tXQlkUhziYtyWTxIfy6BE8WJt5YJvpJivxNaGmLHT0VnOgSYf0dZXS7APdpB309RnHOG5gDqXGLDaC457D1zZ/V/nmOM82XiHRLYKhKP1oZmADdEAAAh+QQJCgAAACwAAAAAIAAgAAAE6hDISWlZpOrNp1lGNRSdRpDUolIGw5RUYhhHukqFu8DsrEyqnWThGvAmhVlteBvojpTDDBUEIFwMFBRAmBkSgOrBFZogCASwBDEY/CZSg7GSE0gSCjQBMVG023xWBhklAnoEdhQEfyNqMIcKjhRsjEdnezB+A4k8gTwJhFuiW4dokXiloUepBAp5qaKpp6+Ho7aWW54wl7obvEe0kRuoplCGepwSx2jJvqHEmGt6whJpGpfJCHmOoNHKaHx61WiSR92E4lbFoq+B6QDtuetcaBPnW6+O7wDHpIiK9SaVK5GgV543tzjgGcghAgAh+QQJCgAAACwAAAAAIAAgAAAE7hDISSkxpOrN5zFHNWRdhSiVoVLHspRUMoyUakyEe8PTPCATW9A14E0UvuAKMNAZKYUZCiBMuBakSQKG8G2FzUWox2AUtAQFcBKlVQoLgQReZhQlCIJesQXI5B0CBnUMOxMCenoCfTCEWBsJColTMANldx15BGs8B5wlCZ9Po6OJkwmRpnqkqnuSrayqfKmqpLajoiW5HJq7FL1Gr2mMMcKUMIiJgIemy7xZtJsTmsM4xHiKv5KMCXqfyUCJEonXPN2rAOIAmsfB3uPoAK++G+w48edZPK+M6hLJpQg484enXIdQFSS1u6UhksENEQAAIfkECQoAAAAsAAAAACAAIAAABOcQyEmpGKLqzWcZRVUQnZYg1aBSh2GUVEIQ2aQOE+G+cD4ntpWkZQj1JIiZIogDFFyHI0UxQwFugMSOFIPJftfVAEoZLBbcLEFhlQiqGp1Vd140AUklUN3eCA51C1EWMzMCezCBBmkxVIVHBWd3HHl9JQOIJSdSnJ0TDKChCwUJjoWMPaGqDKannasMo6WnM562R5YluZRwur0wpgqZE7NKUm+FNRPIhjBJxKZteWuIBMN4zRMIVIhffcgojwCF117i4nlLnY5ztRLsnOk+aV+oJY7V7m76PdkS4trKcdg0Zc0tTcKkRAAAIfkECQoAAAAsAAAAACAAIAAABO4QyEkpKqjqzScpRaVkXZWQEximw1BSCUEIlDohrft6cpKCk5xid5MNJTaAIkekKGQkWyKHkvhKsR7ARmitkAYDYRIbUQRQjWBwJRzChi9CRlBcY1UN4g0/VNB0AlcvcAYHRyZPdEQFYV8ccwR5HWxEJ02YmRMLnJ1xCYp0Y5idpQuhopmmC2KgojKasUQDk5BNAwwMOh2RtRq5uQuPZKGIJQIGwAwGf6I0JXMpC8C7kXWDBINFMxS4DKMAWVWAGYsAdNqW5uaRxkSKJOZKaU3tPOBZ4DuK2LATgJhkPJMgTwKCdFjyPHEnKxFCDhEAACH5BAkKAAAALAAAAAAgACAAAATzEMhJaVKp6s2nIkolIJ2WkBShpkVRWqqQrhLSEu9MZJKK9y1ZrqYK9WiClmvoUaF8gIQSNeF1Er4MNFn4SRSDARWroAIETg1iVwuHjYB1kYc1mwruwXKC9gmsJXliGxc+XiUCby9ydh1sOSdMkpMTBpaXBzsfhoc5l58Gm5yToAaZhaOUqjkDgCWNHAULCwOLaTmzswadEqggQwgHuQsHIoZCHQMMQgQGubVEcxOPFAcMDAYUA85eWARmfSRQCdcMe0zeP1AAygwLlJtPNAAL19DARdPzBOWSm1brJBi45soRAWQAAkrQIykShQ9wVhHCwCQCACH5BAkKAAAALAAAAAAgACAAAATrEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq+E71SRQeyqUToLA7VxF0JDyIQh/MVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiRMDjI0Fd30/iI2UA5GSS5UDj2l6NoqgOgN4gksEBgYFf0FDqKgHnyZ9OX8HrgYHdHpcHQULXAS2qKpENRg7eAMLC7kTBaixUYFkKAzWAAnLC7FLVxLWDBLKCwaKTULgEwbLA4hJtOkSBNqITT3xEgfLpBtzE/jiuL04RGEBgwWhShRgQExHBAAh+QQJCgAAACwAAAAAIAAgAAAE7xDISWlSqerNpyJKhWRdlSAVoVLCWk6JKlAqAavhO9UkUHsqlE6CwO1cRdCQ8iEIfzFVTzLdRAmZX3I2SfZiCqGk5dTESJeaOAlClzsJsqwiJwiqnFrb2nS9kmIcgEsjQydLiIlHehhpejaIjzh9eomSjZR+ipslWIRLAgMDOR2DOqKogTB9pCUJBagDBXR6XB0EBkIIsaRsGGMMAxoDBgYHTKJiUYEGDAzHC9EACcUGkIgFzgwZ0QsSBcXHiQvOwgDdEwfFs0sDzt4S6BK4xYjkDOzn0unFeBzOBijIm1Dgmg5YFQwsCMjp1oJ8LyIAACH5BAkKAAAALAAAAAAgACAAAATwEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq+E71SRQeyqUToLA7VxF0JDyIQh/MVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiUd6GGl6NoiPOH16iZKNlH6KmyWFOggHhEEvAwwMA0N9GBsEC6amhnVcEwavDAazGwIDaH1ipaYLBUTCGgQDA8NdHz0FpqgTBwsLqAbWAAnIA4FWKdMLGdYGEgraigbT0OITBcg5QwPT4xLrROZL6AuQAPUS7bxLpoWidY0JtxLHKhwwMJBTHgPKdEQAACH5BAkKAAAALAAAAAAgACAAAATrEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq+E71SRQeyqUToLA7VxF0JDyIQh/MVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiUd6GAULDJCRiXo1CpGXDJOUjY+Yip9DhToJA4RBLwMLCwVDfRgbBAaqqoZ1XBMHswsHtxtFaH1iqaoGNgAIxRpbFAgfPQSqpbgGBqUD1wBXeCYp1AYZ19JJOYgH1KwA4UBvQwXUBxPqVD9L3sbp2BNk2xvvFPJd+MFCN6HAAIKgNggY0KtEBAAh+QQJCgAAACwAAAAAIAAgAAAE6BDISWlSqerNpyJKhWRdlSAVoVLCWk6JKlAqAavhO9UkUHsqlE6CwO1cRdCQ8iEIfzFVTzLdRAmZX3I2SfYIDMaAFdTESJeaEDAIMxYFqrOUaNW4E4ObYcCXaiBVEgULe0NJaxxtYksjh2NLkZISgDgJhHthkpU4mW6blRiYmZOlh4JWkDqILwUGBnE6TYEbCgevr0N1gH4At7gHiRpFaLNrrq8HNgAJA70AWxQIH1+vsYMDAzZQPC9VCNkDWUhGkuE5PxJNwiUK4UfLzOlD4WvzAHaoG9nxPi5d+jYUqfAhhykOFwJWiAAAIfkECQoAAAAsAAAAACAAIAAABPAQyElpUqnqzaciSoVkXVUMFaFSwlpOCcMYlErAavhOMnNLNo8KsZsMZItJEIDIFSkLGQoQTNhIsFehRww2CQLKF0tYGKYSg+ygsZIuNqJksKgbfgIGepNo2cIUB3V1B3IvNiBYNQaDSTtfhhx0CwVPI0UJe0+bm4g5VgcGoqOcnjmjqDSdnhgEoamcsZuXO1aWQy8KAwOAuTYYGwi7w5h+Kr0SJ8MFihpNbx+4Erq7BYBuzsdiH1jCAzoSfl0rVirNbRXlBBlLX+BP0XJLAPGzTkAuAOqb0WT5AH7OcdCm5B8TgRwSRKIHQtaLCwg1RAAAOwAAAAAAAAAAAA==);
59
+ }
60
+
61
+ .jvectormap-legend-title {
62
+ font-weight: bold;
63
+ font-size: 14px;
64
+ text-align: center;
65
+ }
66
+
67
+ .jvectormap-legend-cnt {
68
+ position: absolute;
69
+ }
70
+
71
+ .jvectormap-legend-cnt-h {
72
+ bottom: 0;
73
+ right: 0;
74
+ }
75
+
76
+ .jvectormap-legend-cnt-v {
77
+ top: 0;
78
+ right: 0;
79
+ }
80
+
81
+ .jvectormap-legend {
82
+ background: black;
83
+ color: white;
84
+ border-radius: 3px;
85
+ }
86
+
87
+ .jvectormap-legend-cnt-h .jvectormap-legend {
88
+ float: left;
89
+ margin: 0 10px 10px 0;
90
+ padding: 3px 3px 1px 3px;
91
+ }
92
+
93
+ .jvectormap-legend-cnt-h .jvectormap-legend .jvectormap-legend-tick {
94
+ float: left;
95
+ }
96
+
97
+ .jvectormap-legend-cnt-v .jvectormap-legend {
98
+ margin: 10px 10px 0 0;
99
+ padding: 3px;
100
+ }
101
+
102
+ .jvectormap-legend-cnt-h .jvectormap-legend-tick {
103
+ width: 40px;
104
+ }
105
+
106
+ .jvectormap-legend-cnt-h .jvectormap-legend-tick-sample {
107
+ height: 15px;
108
+ }
109
+
110
+ .jvectormap-legend-cnt-v .jvectormap-legend-tick-sample {
111
+ height: 20px;
112
+ width: 20px;
113
+ display: inline-block;
114
+ vertical-align: middle;
115
+ }
116
+
117
+ .jvectormap-legend-tick-text {
118
+ font-size: 12px;
119
+ }
120
+
121
+ .jvectormap-legend-cnt-h .jvectormap-legend-tick-text {
122
+ text-align: center;
123
+ }
124
+
125
+ .jvectormap-legend-cnt-v .jvectormap-legend-tick-text {
126
+ display: inline-block;
127
+ vertical-align: middle;
128
+ line-height: 20px;
129
+ padding-left: 3px;
130
+ }
@@ -0,0 +1,3328 @@
1
+ /**
2
+ * jVectorMap version 2.0.2
3
+ *
4
+ * Copyright 2011-2014, Kirill Lebedev
5
+ *
6
+ */
7
+
8
+ (function( $ ){
9
+ var apiParams = {
10
+ set: {
11
+ colors: 1,
12
+ values: 1,
13
+ backgroundColor: 1,
14
+ scaleColors: 1,
15
+ normalizeFunction: 1,
16
+ focus: 1
17
+ },
18
+ get: {
19
+ selectedRegions: 1,
20
+ selectedMarkers: 1,
21
+ mapObject: 1,
22
+ regionName: 1
23
+ }
24
+ };
25
+
26
+ $.fn.vectorMap = function(options) {
27
+ var map,
28
+ methodName,
29
+ map = this.children('.jvectormap-container').data('mapObject');
30
+
31
+ if (options === 'addMap') {
32
+ jvm.Map.maps[arguments[1]] = arguments[2];
33
+ } else if ((options === 'set' || options === 'get') && apiParams[options][arguments[1]]) {
34
+ methodName = arguments[1].charAt(0).toUpperCase()+arguments[1].substr(1);
35
+ return map[options+methodName].apply(map, Array.prototype.slice.call(arguments, 2));
36
+ } else {
37
+ options = options || {};
38
+ options.container = this;
39
+ map = new jvm.Map(options);
40
+ }
41
+
42
+ return this;
43
+ };
44
+ })( jQuery );
45
+ /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
46
+ * Licensed under the MIT License (LICENSE.txt).
47
+ *
48
+ * Version: 3.1.9
49
+ *
50
+ * Requires: jQuery 1.2.2+
51
+ */
52
+
53
+ (function (factory) {
54
+ if ( typeof define === 'function' && define.amd ) {
55
+ // AMD. Register as an anonymous module.
56
+ define(['jquery'], factory);
57
+ } else if (typeof exports === 'object') {
58
+ // Node/CommonJS style for Browserify
59
+ module.exports = factory;
60
+ } else {
61
+ // Browser globals
62
+ factory(jQuery);
63
+ }
64
+ }(function ($) {
65
+
66
+ var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
67
+ toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
68
+ ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
69
+ slice = Array.prototype.slice,
70
+ nullLowestDeltaTimeout, lowestDelta;
71
+
72
+ if ( $.event.fixHooks ) {
73
+ for ( var i = toFix.length; i; ) {
74
+ $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
75
+ }
76
+ }
77
+
78
+ var special = $.event.special.mousewheel = {
79
+ version: '3.1.9',
80
+
81
+ setup: function() {
82
+ if ( this.addEventListener ) {
83
+ for ( var i = toBind.length; i; ) {
84
+ this.addEventListener( toBind[--i], handler, false );
85
+ }
86
+ } else {
87
+ this.onmousewheel = handler;
88
+ }
89
+ // Store the line height and page height for this particular element
90
+ $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
91
+ $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
92
+ },
93
+
94
+ teardown: function() {
95
+ if ( this.removeEventListener ) {
96
+ for ( var i = toBind.length; i; ) {
97
+ this.removeEventListener( toBind[--i], handler, false );
98
+ }
99
+ } else {
100
+ this.onmousewheel = null;
101
+ }
102
+ },
103
+
104
+ getLineHeight: function(elem) {
105
+ return parseInt($(elem)['offsetParent' in $.fn ? 'offsetParent' : 'parent']().css('fontSize'), 10);
106
+ },
107
+
108
+ getPageHeight: function(elem) {
109
+ return $(elem).height();
110
+ },
111
+
112
+ settings: {
113
+ adjustOldDeltas: true
114
+ }
115
+ };
116
+
117
+ $.fn.extend({
118
+ mousewheel: function(fn) {
119
+ return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
120
+ },
121
+
122
+ unmousewheel: function(fn) {
123
+ return this.unbind('mousewheel', fn);
124
+ }
125
+ });
126
+
127
+
128
+ function handler(event) {
129
+ var orgEvent = event || window.event,
130
+ args = slice.call(arguments, 1),
131
+ delta = 0,
132
+ deltaX = 0,
133
+ deltaY = 0,
134
+ absDelta = 0;
135
+ event = $.event.fix(orgEvent);
136
+ event.type = 'mousewheel';
137
+
138
+ // Old school scrollwheel delta
139
+ if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
140
+ if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
141
+ if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
142
+ if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
143
+
144
+ // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
145
+ if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
146
+ deltaX = deltaY * -1;
147
+ deltaY = 0;
148
+ }
149
+
150
+ // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
151
+ delta = deltaY === 0 ? deltaX : deltaY;
152
+
153
+ // New school wheel delta (wheel event)
154
+ if ( 'deltaY' in orgEvent ) {
155
+ deltaY = orgEvent.deltaY * -1;
156
+ delta = deltaY;
157
+ }
158
+ if ( 'deltaX' in orgEvent ) {
159
+ deltaX = orgEvent.deltaX;
160
+ if ( deltaY === 0 ) { delta = deltaX * -1; }
161
+ }
162
+
163
+ // No change actually happened, no reason to go any further
164
+ if ( deltaY === 0 && deltaX === 0 ) { return; }
165
+
166
+ // Need to convert lines and pages to pixels if we aren't already in pixels
167
+ // There are three delta modes:
168
+ // * deltaMode 0 is by pixels, nothing to do
169
+ // * deltaMode 1 is by lines
170
+ // * deltaMode 2 is by pages
171
+ if ( orgEvent.deltaMode === 1 ) {
172
+ var lineHeight = $.data(this, 'mousewheel-line-height');
173
+ delta *= lineHeight;
174
+ deltaY *= lineHeight;
175
+ deltaX *= lineHeight;
176
+ } else if ( orgEvent.deltaMode === 2 ) {
177
+ var pageHeight = $.data(this, 'mousewheel-page-height');
178
+ delta *= pageHeight;
179
+ deltaY *= pageHeight;
180
+ deltaX *= pageHeight;
181
+ }
182
+
183
+ // Store lowest absolute delta to normalize the delta values
184
+ absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
185
+
186
+ if ( !lowestDelta || absDelta < lowestDelta ) {
187
+ lowestDelta = absDelta;
188
+
189
+ // Adjust older deltas if necessary
190
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
191
+ lowestDelta /= 40;
192
+ }
193
+ }
194
+
195
+ // Adjust older deltas if necessary
196
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
197
+ // Divide all the things by 40!
198
+ delta /= 40;
199
+ deltaX /= 40;
200
+ deltaY /= 40;
201
+ }
202
+
203
+ // Get a whole, normalized value for the deltas
204
+ delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
205
+ deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
206
+ deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
207
+
208
+ // Add information to the event object
209
+ event.deltaX = deltaX;
210
+ event.deltaY = deltaY;
211
+ event.deltaFactor = lowestDelta;
212
+ // Go ahead and set deltaMode to 0 since we converted to pixels
213
+ // Although this is a little odd since we overwrite the deltaX/Y
214
+ // properties with normalized deltas.
215
+ event.deltaMode = 0;
216
+
217
+ // Add event and delta to the front of the arguments
218
+ args.unshift(event, delta, deltaX, deltaY);
219
+
220
+ // Clearout lowestDelta after sometime to better
221
+ // handle multiple device types that give different
222
+ // a different lowestDelta
223
+ // Ex: trackpad = 3 and mouse wheel = 120
224
+ if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
225
+ nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
226
+
227
+ return ($.event.dispatch || $.event.handle).apply(this, args);
228
+ }
229
+
230
+ function nullLowestDelta() {
231
+ lowestDelta = null;
232
+ }
233
+
234
+ function shouldAdjustOldDeltas(orgEvent, absDelta) {
235
+ // If this is an older event and the delta is divisable by 120,
236
+ // then we are assuming that the browser is treating this as an
237
+ // older mouse wheel event and that we should divide the deltas
238
+ // by 40 to try and get a more usable deltaFactor.
239
+ // Side note, this actually impacts the reported scroll distance
240
+ // in older browsers and can cause scrolling to be slower than native.
241
+ // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
242
+ return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
243
+ }
244
+
245
+ }));/**
246
+ * @namespace jvm Holds core methods and classes used by jVectorMap.
247
+ */
248
+ var jvm = {
249
+
250
+ /**
251
+ * Inherits child's prototype from the parent's one.
252
+ * @param {Function} child
253
+ * @param {Function} parent
254
+ */
255
+ inherits: function(child, parent) {
256
+ function temp() {}
257
+ temp.prototype = parent.prototype;
258
+ child.prototype = new temp();
259
+ child.prototype.constructor = child;
260
+ child.parentClass = parent;
261
+ },
262
+
263
+ /**
264
+ * Mixes in methods from the source constructor to the target one.
265
+ * @param {Function} target
266
+ * @param {Function} source
267
+ */
268
+ mixin: function(target, source){
269
+ var prop;
270
+
271
+ for (prop in source.prototype) {
272
+ if (source.prototype.hasOwnProperty(prop)) {
273
+ target.prototype[prop] = source.prototype[prop];
274
+ }
275
+ }
276
+ },
277
+
278
+ min: function(values){
279
+ var min = Number.MAX_VALUE,
280
+ i;
281
+
282
+ if (values instanceof Array) {
283
+ for (i = 0; i < values.length; i++) {
284
+ if (values[i] < min) {
285
+ min = values[i];
286
+ }
287
+ }
288
+ } else {
289
+ for (i in values) {
290
+ if (values[i] < min) {
291
+ min = values[i];
292
+ }
293
+ }
294
+ }
295
+ return min;
296
+ },
297
+
298
+ max: function(values){
299
+ var max = Number.MIN_VALUE,
300
+ i;
301
+
302
+ if (values instanceof Array) {
303
+ for (i = 0; i < values.length; i++) {
304
+ if (values[i] > max) {
305
+ max = values[i];
306
+ }
307
+ }
308
+ } else {
309
+ for (i in values) {
310
+ if (values[i] > max) {
311
+ max = values[i];
312
+ }
313
+ }
314
+ }
315
+ return max;
316
+ },
317
+
318
+ keys: function(object){
319
+ var keys = [],
320
+ key;
321
+
322
+ for (key in object) {
323
+ keys.push(key);
324
+ }
325
+ return keys;
326
+ },
327
+
328
+ values: function(object){
329
+ var values = [],
330
+ key,
331
+ i;
332
+
333
+ for (i = 0; i < arguments.length; i++) {
334
+ object = arguments[i];
335
+ for (key in object) {
336
+ values.push(object[key]);
337
+ }
338
+ }
339
+ return values;
340
+ },
341
+
342
+ whenImageLoaded: function(url){
343
+ var deferred = new jvm.$.Deferred(),
344
+ img = jvm.$('<img/>');
345
+
346
+ img.error(function(){
347
+ deferred.reject();
348
+ }).load(function(){
349
+ deferred.resolve(img);
350
+ });
351
+ img.attr('src', url);
352
+
353
+ return deferred;
354
+ },
355
+
356
+ isImageUrl: function(s){
357
+ return /\.\w{3,4}$/.test(s);
358
+ }
359
+ };
360
+
361
+ jvm.$ = jQuery;
362
+
363
+ /**
364
+ * indexOf polyfill for IE < 9
365
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
366
+ */
367
+ if (!Array.prototype.indexOf) {
368
+ Array.prototype.indexOf = function (searchElement, fromIndex) {
369
+
370
+ var k;
371
+
372
+ // 1. Let O be the result of calling ToObject passing
373
+ // the this value as the argument.
374
+ if (this == null) {
375
+ throw new TypeError('"this" is null or not defined');
376
+ }
377
+
378
+ var O = Object(this);
379
+
380
+ // 2. Let lenValue be the result of calling the Get
381
+ // internal method of O with the argument "length".
382
+ // 3. Let len be ToUint32(lenValue).
383
+ var len = O.length >>> 0;
384
+
385
+ // 4. If len is 0, return -1.
386
+ if (len === 0) {
387
+ return -1;
388
+ }
389
+
390
+ // 5. If argument fromIndex was passed let n be
391
+ // ToInteger(fromIndex); else let n be 0.
392
+ var n = +fromIndex || 0;
393
+
394
+ if (Math.abs(n) === Infinity) {
395
+ n = 0;
396
+ }
397
+
398
+ // 6. If n >= len, return -1.
399
+ if (n >= len) {
400
+ return -1;
401
+ }
402
+
403
+ // 7. If n >= 0, then Let k be n.
404
+ // 8. Else, n<0, Let k be len - abs(n).
405
+ // If k is less than 0, then let k be 0.
406
+ k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
407
+
408
+ // 9. Repeat, while k < len
409
+ while (k < len) {
410
+ // a. Let Pk be ToString(k).
411
+ // This is implicit for LHS operands of the in operator
412
+ // b. Let kPresent be the result of calling the
413
+ // HasProperty internal method of O with argument Pk.
414
+ // This step can be combined with c
415
+ // c. If kPresent is true, then
416
+ // i. Let elementK be the result of calling the Get
417
+ // internal method of O with the argument ToString(k).
418
+ // ii. Let same be the result of applying the
419
+ // Strict Equality Comparison Algorithm to
420
+ // searchElement and elementK.
421
+ // iii. If same is true, return k.
422
+ if (k in O && O[k] === searchElement) {
423
+ return k;
424
+ }
425
+ k++;
426
+ }
427
+ return -1;
428
+ };
429
+ }/**
430
+ * Basic wrapper for DOM element.
431
+ * @constructor
432
+ * @param {String} name Tag name of the element
433
+ * @param {Object} config Set of parameters to initialize element with
434
+ */
435
+ jvm.AbstractElement = function(name, config){
436
+ /**
437
+ * Underlying DOM element
438
+ * @type {DOMElement}
439
+ * @private
440
+ */
441
+ this.node = this.createElement(name);
442
+
443
+ /**
444
+ * Name of underlying element
445
+ * @type {String}
446
+ * @private
447
+ */
448
+ this.name = name;
449
+
450
+ /**
451
+ * Internal store of attributes
452
+ * @type {Object}
453
+ * @private
454
+ */
455
+ this.properties = {};
456
+
457
+ if (config) {
458
+ this.set(config);
459
+ }
460
+ };
461
+
462
+ /**
463
+ * Set attribute of the underlying DOM element.
464
+ * @param {String} name Name of attribute
465
+ * @param {Number|String} config Set of parameters to initialize element with
466
+ */
467
+ jvm.AbstractElement.prototype.set = function(property, value){
468
+ var key;
469
+
470
+ if (typeof property === 'object') {
471
+ for (key in property) {
472
+ this.properties[key] = property[key];
473
+ this.applyAttr(key, property[key]);
474
+ }
475
+ } else {
476
+ this.properties[property] = value;
477
+ this.applyAttr(property, value);
478
+ }
479
+ };
480
+
481
+ /**
482
+ * Returns value of attribute.
483
+ * @param {String} name Name of attribute
484
+ */
485
+ jvm.AbstractElement.prototype.get = function(property){
486
+ return this.properties[property];
487
+ };
488
+
489
+ /**
490
+ * Applies attribute value to the underlying DOM element.
491
+ * @param {String} name Name of attribute
492
+ * @param {Number|String} config Value of attribute to apply
493
+ * @private
494
+ */
495
+ jvm.AbstractElement.prototype.applyAttr = function(property, value){
496
+ this.node.setAttribute(property, value);
497
+ };
498
+
499
+ jvm.AbstractElement.prototype.remove = function(){
500
+ jvm.$(this.node).remove();
501
+ };/**
502
+ * Implements abstract vector canvas.
503
+ * @constructor
504
+ * @param {HTMLElement} container Container to put element to.
505
+ * @param {Number} width Width of canvas.
506
+ * @param {Number} height Height of canvas.
507
+ */
508
+ jvm.AbstractCanvasElement = function(container, width, height){
509
+ this.container = container;
510
+ this.setSize(width, height);
511
+ this.rootElement = new jvm[this.classPrefix+'GroupElement']();
512
+ this.node.appendChild( this.rootElement.node );
513
+ this.container.appendChild(this.node);
514
+ }
515
+
516
+ /**
517
+ * Add element to the certain group inside of the canvas.
518
+ * @param {HTMLElement} element Element to add to canvas.
519
+ * @param {HTMLElement} group Group to add element into or into root group if not provided.
520
+ */
521
+ jvm.AbstractCanvasElement.prototype.add = function(element, group){
522
+ group = group || this.rootElement;
523
+ group.add(element);
524
+ element.canvas = this;
525
+ }
526
+
527
+ /**
528
+ * Create path and add it to the canvas.
529
+ * @param {Object} config Parameters of path to create.
530
+ * @param {Object} style Styles of the path to create.
531
+ * @param {HTMLElement} group Group to add path into.
532
+ */
533
+ jvm.AbstractCanvasElement.prototype.addPath = function(config, style, group){
534
+ var el = new jvm[this.classPrefix+'PathElement'](config, style);
535
+
536
+ this.add(el, group);
537
+ return el;
538
+ };
539
+
540
+ /**
541
+ * Create circle and add it to the canvas.
542
+ * @param {Object} config Parameters of path to create.
543
+ * @param {Object} style Styles of the path to create.
544
+ * @param {HTMLElement} group Group to add circle into.
545
+ */
546
+ jvm.AbstractCanvasElement.prototype.addCircle = function(config, style, group){
547
+ var el = new jvm[this.classPrefix+'CircleElement'](config, style);
548
+
549
+ this.add(el, group);
550
+ return el;
551
+ };
552
+
553
+ /**
554
+ * Create circle and add it to the canvas.
555
+ * @param {Object} config Parameters of path to create.
556
+ * @param {Object} style Styles of the path to create.
557
+ * @param {HTMLElement} group Group to add circle into.
558
+ */
559
+ jvm.AbstractCanvasElement.prototype.addImage = function(config, style, group){
560
+ var el = new jvm[this.classPrefix+'ImageElement'](config, style);
561
+
562
+ this.add(el, group);
563
+ return el;
564
+ };
565
+
566
+ /**
567
+ * Create text and add it to the canvas.
568
+ * @param {Object} config Parameters of path to create.
569
+ * @param {Object} style Styles of the path to create.
570
+ * @param {HTMLElement} group Group to add circle into.
571
+ */
572
+ jvm.AbstractCanvasElement.prototype.addText = function(config, style, group){
573
+ var el = new jvm[this.classPrefix+'TextElement'](config, style);
574
+
575
+ this.add(el, group);
576
+ return el;
577
+ };
578
+
579
+ /**
580
+ * Add group to the another group inside of the canvas.
581
+ * @param {HTMLElement} group Group to add circle into or root group if not provided.
582
+ */
583
+ jvm.AbstractCanvasElement.prototype.addGroup = function(parentGroup){
584
+ var el = new jvm[this.classPrefix+'GroupElement']();
585
+
586
+ if (parentGroup) {
587
+ parentGroup.node.appendChild(el.node);
588
+ } else {
589
+ this.node.appendChild(el.node);
590
+ }
591
+ el.canvas = this;
592
+ return el;
593
+ };/**
594
+ * Abstract shape element. Shape element represents some visual vector or raster object.
595
+ * @constructor
596
+ * @param {String} name Tag name of the element.
597
+ * @param {Object} config Set of parameters to initialize element with.
598
+ * @param {Object} style Object with styles to set on element initialization.
599
+ */
600
+ jvm.AbstractShapeElement = function(name, config, style){
601
+ this.style = style || {};
602
+ this.style.current = this.style.current || {};
603
+ this.isHovered = false;
604
+ this.isSelected = false;
605
+ this.updateStyle();
606
+ };
607
+
608
+ /**
609
+ * Set element's style.
610
+ * @param {Object|String} property Could be string to set only one property or object to set several style properties at once.
611
+ * @param {String} value Value to set in case only one property should be set.
612
+ */
613
+ jvm.AbstractShapeElement.prototype.setStyle = function(property, value){
614
+ var styles = {};
615
+
616
+ if (typeof property === 'object') {
617
+ styles = property;
618
+ } else {
619
+ styles[property] = value;
620
+ }
621
+ jvm.$.extend(this.style.current, styles);
622
+ this.updateStyle();
623
+ };
624
+
625
+
626
+ jvm.AbstractShapeElement.prototype.updateStyle = function(){
627
+ var attrs = {};
628
+
629
+ jvm.AbstractShapeElement.mergeStyles(attrs, this.style.initial);
630
+ jvm.AbstractShapeElement.mergeStyles(attrs, this.style.current);
631
+ if (this.isHovered) {
632
+ jvm.AbstractShapeElement.mergeStyles(attrs, this.style.hover);
633
+ }
634
+ if (this.isSelected) {
635
+ jvm.AbstractShapeElement.mergeStyles(attrs, this.style.selected);
636
+ if (this.isHovered) {
637
+ jvm.AbstractShapeElement.mergeStyles(attrs, this.style.selectedHover);
638
+ }
639
+ }
640
+ this.set(attrs);
641
+ };
642
+
643
+ jvm.AbstractShapeElement.mergeStyles = function(styles, newStyles){
644
+ var key;
645
+
646
+ newStyles = newStyles || {};
647
+ for (key in newStyles) {
648
+ if (newStyles[key] === null) {
649
+ delete styles[key];
650
+ } else {
651
+ styles[key] = newStyles[key];
652
+ }
653
+ }
654
+ }/**
655
+ * Wrapper for SVG element.
656
+ * @constructor
657
+ * @extends jvm.AbstractElement
658
+ * @param {String} name Tag name of the element
659
+ * @param {Object} config Set of parameters to initialize element with
660
+ */
661
+
662
+ jvm.SVGElement = function(name, config){
663
+ jvm.SVGElement.parentClass.apply(this, arguments);
664
+ }
665
+
666
+ jvm.inherits(jvm.SVGElement, jvm.AbstractElement);
667
+
668
+ jvm.SVGElement.svgns = "http://www.w3.org/2000/svg";
669
+
670
+ /**
671
+ * Creates DOM element.
672
+ * @param {String} tagName Name of element
673
+ * @private
674
+ * @returns DOMElement
675
+ */
676
+ jvm.SVGElement.prototype.createElement = function( tagName ){
677
+ return document.createElementNS( jvm.SVGElement.svgns, tagName );
678
+ };
679
+
680
+ /**
681
+ * Adds CSS class for underlying DOM element.
682
+ * @param {String} className Name of CSS class name
683
+ */
684
+ jvm.SVGElement.prototype.addClass = function( className ){
685
+ this.node.setAttribute('class', className);
686
+ };
687
+
688
+ /**
689
+ * Returns constructor for element by name prefixed with 'VML'.
690
+ * @param {String} ctr Name of basic constructor to return
691
+ * proper implementation for.
692
+ * @returns Function
693
+ * @private
694
+ */
695
+ jvm.SVGElement.prototype.getElementCtr = function( ctr ){
696
+ return jvm['SVG'+ctr];
697
+ };
698
+
699
+ jvm.SVGElement.prototype.getBBox = function(){
700
+ return this.node.getBBox();
701
+ };jvm.SVGGroupElement = function(){
702
+ jvm.SVGGroupElement.parentClass.call(this, 'g');
703
+ }
704
+
705
+ jvm.inherits(jvm.SVGGroupElement, jvm.SVGElement);
706
+
707
+ jvm.SVGGroupElement.prototype.add = function(element){
708
+ this.node.appendChild( element.node );
709
+ };jvm.SVGCanvasElement = function(container, width, height){
710
+ this.classPrefix = 'SVG';
711
+ jvm.SVGCanvasElement.parentClass.call(this, 'svg');
712
+
713
+ this.defsElement = new jvm.SVGElement('defs');
714
+ this.node.appendChild( this.defsElement.node );
715
+
716
+ jvm.AbstractCanvasElement.apply(this, arguments);
717
+ }
718
+
719
+ jvm.inherits(jvm.SVGCanvasElement, jvm.SVGElement);
720
+ jvm.mixin(jvm.SVGCanvasElement, jvm.AbstractCanvasElement);
721
+
722
+ jvm.SVGCanvasElement.prototype.setSize = function(width, height){
723
+ this.width = width;
724
+ this.height = height;
725
+ this.node.setAttribute('width', width);
726
+ this.node.setAttribute('height', height);
727
+ };
728
+
729
+ jvm.SVGCanvasElement.prototype.applyTransformParams = function(scale, transX, transY) {
730
+ this.scale = scale;
731
+ this.transX = transX;
732
+ this.transY = transY;
733
+ this.rootElement.node.setAttribute('transform', 'scale('+scale+') translate('+transX+', '+transY+')');
734
+ };jvm.SVGShapeElement = function(name, config, style){
735
+ jvm.SVGShapeElement.parentClass.call(this, name, config);
736
+ jvm.AbstractShapeElement.apply(this, arguments);
737
+ };
738
+
739
+ jvm.inherits(jvm.SVGShapeElement, jvm.SVGElement);
740
+ jvm.mixin(jvm.SVGShapeElement, jvm.AbstractShapeElement);
741
+
742
+ jvm.SVGShapeElement.prototype.applyAttr = function(attr, value){
743
+ var patternEl,
744
+ imageEl,
745
+ that = this;
746
+
747
+ if (attr === 'fill' && jvm.isImageUrl(value)) {
748
+ if (!jvm.SVGShapeElement.images[value]) {
749
+ jvm.whenImageLoaded(value).then(function(img){
750
+ imageEl = new jvm.SVGElement('image');
751
+ imageEl.node.setAttributeNS('http://www.w3.org/1999/xlink', 'href', value);
752
+ imageEl.applyAttr('x', '0');
753
+ imageEl.applyAttr('y', '0');
754
+ imageEl.applyAttr('width', img[0].width);
755
+ imageEl.applyAttr('height', img[0].height);
756
+
757
+ patternEl = new jvm.SVGElement('pattern');
758
+ patternEl.applyAttr('id', 'image'+jvm.SVGShapeElement.imageCounter);
759
+ patternEl.applyAttr('x', 0);
760
+ patternEl.applyAttr('y', 0);
761
+ patternEl.applyAttr('width', img[0].width / 2);
762
+ patternEl.applyAttr('height', img[0].height / 2);
763
+ patternEl.applyAttr('viewBox', '0 0 '+img[0].width+' '+img[0].height);
764
+ patternEl.applyAttr('patternUnits', 'userSpaceOnUse');
765
+ patternEl.node.appendChild( imageEl.node );
766
+
767
+ that.canvas.defsElement.node.appendChild( patternEl.node );
768
+
769
+ jvm.SVGShapeElement.images[value] = jvm.SVGShapeElement.imageCounter++;
770
+
771
+ that.applyAttr('fill', 'url(#image'+jvm.SVGShapeElement.images[value]+')');
772
+ });
773
+ } else {
774
+ this.applyAttr('fill', 'url(#image'+jvm.SVGShapeElement.images[value]+')');
775
+ }
776
+ } else {
777
+ jvm.SVGShapeElement.parentClass.prototype.applyAttr.apply(this, arguments);
778
+ }
779
+ };
780
+
781
+ jvm.SVGShapeElement.imageCounter = 1;
782
+ jvm.SVGShapeElement.images = {};jvm.SVGPathElement = function(config, style){
783
+ jvm.SVGPathElement.parentClass.call(this, 'path', config, style);
784
+ this.node.setAttribute('fill-rule', 'evenodd');
785
+ }
786
+
787
+ jvm.inherits(jvm.SVGPathElement, jvm.SVGShapeElement);jvm.SVGCircleElement = function(config, style){
788
+ jvm.SVGCircleElement.parentClass.call(this, 'circle', config, style);
789
+ };
790
+
791
+ jvm.inherits(jvm.SVGCircleElement, jvm.SVGShapeElement);jvm.SVGImageElement = function(config, style){
792
+ jvm.SVGImageElement.parentClass.call(this, 'image', config, style);
793
+ };
794
+
795
+ jvm.inherits(jvm.SVGImageElement, jvm.SVGShapeElement);
796
+
797
+ jvm.SVGImageElement.prototype.applyAttr = function(attr, value){
798
+ var that = this;
799
+
800
+ if (attr == 'image') {
801
+ jvm.whenImageLoaded(value).then(function(img){
802
+ that.node.setAttributeNS('http://www.w3.org/1999/xlink', 'href', value);
803
+ that.width = img[0].width;
804
+ that.height = img[0].height;
805
+ that.applyAttr('width', that.width);
806
+ that.applyAttr('height', that.height);
807
+
808
+ that.applyAttr('x', that.cx - that.width / 2);
809
+ that.applyAttr('y', that.cy - that.height / 2);
810
+
811
+ jvm.$(that.node).trigger('imageloaded', [img]);
812
+ });
813
+ } else if(attr == 'cx') {
814
+ this.cx = value;
815
+ if (this.width) {
816
+ this.applyAttr('x', value - this.width / 2);
817
+ }
818
+ } else if(attr == 'cy') {
819
+ this.cy = value;
820
+ if (this.height) {
821
+ this.applyAttr('y', value - this.height / 2);
822
+ }
823
+ } else {
824
+ jvm.SVGImageElement.parentClass.prototype.applyAttr.apply(this, arguments);
825
+ }
826
+ };jvm.SVGTextElement = function(config, style){
827
+ jvm.SVGTextElement.parentClass.call(this, 'text', config, style);
828
+ }
829
+
830
+ jvm.inherits(jvm.SVGTextElement, jvm.SVGShapeElement);
831
+
832
+ jvm.SVGTextElement.prototype.applyAttr = function(attr, value){
833
+ if (attr === 'text') {
834
+ this.node.textContent = value;
835
+ } else {
836
+ jvm.SVGTextElement.parentClass.prototype.applyAttr.apply(this, arguments);
837
+ }
838
+ };/**
839
+ * Wrapper for VML element.
840
+ * @constructor
841
+ * @extends jvm.AbstractElement
842
+ * @param {String} name Tag name of the element
843
+ * @param {Object} config Set of parameters to initialize element with
844
+ */
845
+
846
+ jvm.VMLElement = function(name, config){
847
+ if (!jvm.VMLElement.VMLInitialized) {
848
+ jvm.VMLElement.initializeVML();
849
+ }
850
+
851
+ jvm.VMLElement.parentClass.apply(this, arguments);
852
+ };
853
+
854
+ jvm.inherits(jvm.VMLElement, jvm.AbstractElement);
855
+
856
+ /**
857
+ * Shows if VML was already initialized for the current document or not.
858
+ * @static
859
+ * @private
860
+ * @type {Boolean}
861
+ */
862
+ jvm.VMLElement.VMLInitialized = false;
863
+
864
+ /**
865
+ * Initializes VML handling before creating the first element
866
+ * (adds CSS class and creates namespace). Adds one of two forms
867
+ * of createElement method depending of support by browser.
868
+ * @static
869
+ * @private
870
+ */
871
+
872
+ // The following method of VML handling is borrowed from the
873
+ // Raphael library by Dmitry Baranovsky.
874
+
875
+ jvm.VMLElement.initializeVML = function(){
876
+ try {
877
+ if (!document.namespaces.rvml) {
878
+ document.namespaces.add("rvml","urn:schemas-microsoft-com:vml");
879
+ }
880
+ /**
881
+ * Creates DOM element.
882
+ * @param {String} tagName Name of element
883
+ * @private
884
+ * @returns DOMElement
885
+ */
886
+ jvm.VMLElement.prototype.createElement = function (tagName) {
887
+ return document.createElement('<rvml:' + tagName + ' class="rvml">');
888
+ };
889
+ } catch (e) {
890
+ /**
891
+ * @private
892
+ */
893
+ jvm.VMLElement.prototype.createElement = function (tagName) {
894
+ return document.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');
895
+ };
896
+ }
897
+ document.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)");
898
+ jvm.VMLElement.VMLInitialized = true;
899
+ };
900
+
901
+ /**
902
+ * Returns constructor for element by name prefixed with 'VML'.
903
+ * @param {String} ctr Name of basic constructor to return
904
+ * proper implementation for.
905
+ * @returns Function
906
+ * @private
907
+ */
908
+ jvm.VMLElement.prototype.getElementCtr = function( ctr ){
909
+ return jvm['VML'+ctr];
910
+ };
911
+
912
+ /**
913
+ * Adds CSS class for underlying DOM element.
914
+ * @param {String} className Name of CSS class name
915
+ */
916
+ jvm.VMLElement.prototype.addClass = function( className ){
917
+ jvm.$(this.node).addClass(className);
918
+ };
919
+
920
+ /**
921
+ * Applies attribute value to the underlying DOM element.
922
+ * @param {String} name Name of attribute
923
+ * @param {Number|String} config Value of attribute to apply
924
+ * @private
925
+ */
926
+ jvm.VMLElement.prototype.applyAttr = function( attr, value ){
927
+ this.node[attr] = value;
928
+ };
929
+
930
+ /**
931
+ * Returns boundary box for the element.
932
+ * @returns {Object} Boundary box with numeric fields: x, y, width, height
933
+ * @override
934
+ */
935
+ jvm.VMLElement.prototype.getBBox = function(){
936
+ var node = jvm.$(this.node);
937
+
938
+ return {
939
+ x: node.position().left / this.canvas.scale,
940
+ y: node.position().top / this.canvas.scale,
941
+ width: node.width() / this.canvas.scale,
942
+ height: node.height() / this.canvas.scale
943
+ };
944
+ };jvm.VMLGroupElement = function(){
945
+ jvm.VMLGroupElement.parentClass.call(this, 'group');
946
+
947
+ this.node.style.left = '0px';
948
+ this.node.style.top = '0px';
949
+ this.node.coordorigin = "0 0";
950
+ };
951
+
952
+ jvm.inherits(jvm.VMLGroupElement, jvm.VMLElement);
953
+
954
+ jvm.VMLGroupElement.prototype.add = function(element){
955
+ this.node.appendChild( element.node );
956
+ };jvm.VMLCanvasElement = function(container, width, height){
957
+ this.classPrefix = 'VML';
958
+ jvm.VMLCanvasElement.parentClass.call(this, 'group');
959
+ jvm.AbstractCanvasElement.apply(this, arguments);
960
+ this.node.style.position = 'absolute';
961
+ };
962
+
963
+ jvm.inherits(jvm.VMLCanvasElement, jvm.VMLElement);
964
+ jvm.mixin(jvm.VMLCanvasElement, jvm.AbstractCanvasElement);
965
+
966
+ jvm.VMLCanvasElement.prototype.setSize = function(width, height){
967
+ var paths,
968
+ groups,
969
+ i,
970
+ l;
971
+
972
+ this.width = width;
973
+ this.height = height;
974
+ this.node.style.width = width + "px";
975
+ this.node.style.height = height + "px";
976
+ this.node.coordsize = width+' '+height;
977
+ this.node.coordorigin = "0 0";
978
+ if (this.rootElement) {
979
+ paths = this.rootElement.node.getElementsByTagName('shape');
980
+ for(i = 0, l = paths.length; i < l; i++) {
981
+ paths[i].coordsize = width+' '+height;
982
+ paths[i].style.width = width+'px';
983
+ paths[i].style.height = height+'px';
984
+ }
985
+ groups = this.node.getElementsByTagName('group');
986
+ for(i = 0, l = groups.length; i < l; i++) {
987
+ groups[i].coordsize = width+' '+height;
988
+ groups[i].style.width = width+'px';
989
+ groups[i].style.height = height+'px';
990
+ }
991
+ }
992
+ };
993
+
994
+ jvm.VMLCanvasElement.prototype.applyTransformParams = function(scale, transX, transY) {
995
+ this.scale = scale;
996
+ this.transX = transX;
997
+ this.transY = transY;
998
+ this.rootElement.node.coordorigin = (this.width-transX-this.width/100)+','+(this.height-transY-this.height/100);
999
+ this.rootElement.node.coordsize = this.width/scale+','+this.height/scale;
1000
+ };jvm.VMLShapeElement = function(name, config){
1001
+ jvm.VMLShapeElement.parentClass.call(this, name, config);
1002
+
1003
+ this.fillElement = new jvm.VMLElement('fill');
1004
+ this.strokeElement = new jvm.VMLElement('stroke');
1005
+ this.node.appendChild(this.fillElement.node);
1006
+ this.node.appendChild(this.strokeElement.node);
1007
+ this.node.stroked = false;
1008
+
1009
+ jvm.AbstractShapeElement.apply(this, arguments);
1010
+ };
1011
+
1012
+ jvm.inherits(jvm.VMLShapeElement, jvm.VMLElement);
1013
+ jvm.mixin(jvm.VMLShapeElement, jvm.AbstractShapeElement);
1014
+
1015
+ jvm.VMLShapeElement.prototype.applyAttr = function(attr, value){
1016
+ switch (attr) {
1017
+ case 'fill':
1018
+ this.node.fillcolor = value;
1019
+ break;
1020
+ case 'fill-opacity':
1021
+ this.fillElement.node.opacity = Math.round(value*100)+'%';
1022
+ break;
1023
+ case 'stroke':
1024
+ if (value === 'none') {
1025
+ this.node.stroked = false;
1026
+ } else {
1027
+ this.node.stroked = true;
1028
+ }
1029
+ this.node.strokecolor = value;
1030
+ break;
1031
+ case 'stroke-opacity':
1032
+ this.strokeElement.node.opacity = Math.round(value*100)+'%';
1033
+ break;
1034
+ case 'stroke-width':
1035
+ if (parseInt(value, 10) === 0) {
1036
+ this.node.stroked = false;
1037
+ } else {
1038
+ this.node.stroked = true;
1039
+ }
1040
+ this.node.strokeweight = value;
1041
+ break;
1042
+ case 'd':
1043
+ this.node.path = jvm.VMLPathElement.pathSvgToVml(value);
1044
+ break;
1045
+ default:
1046
+ jvm.VMLShapeElement.parentClass.prototype.applyAttr.apply(this, arguments);
1047
+ }
1048
+ };jvm.VMLPathElement = function(config, style){
1049
+ var scale = new jvm.VMLElement('skew');
1050
+
1051
+ jvm.VMLPathElement.parentClass.call(this, 'shape', config, style);
1052
+
1053
+ this.node.coordorigin = "0 0";
1054
+
1055
+ scale.node.on = true;
1056
+ scale.node.matrix = '0.01,0,0,0.01,0,0';
1057
+ scale.node.offset = '0,0';
1058
+
1059
+ this.node.appendChild(scale.node);
1060
+ };
1061
+
1062
+ jvm.inherits(jvm.VMLPathElement, jvm.VMLShapeElement);
1063
+
1064
+ jvm.VMLPathElement.prototype.applyAttr = function(attr, value){
1065
+ if (attr === 'd') {
1066
+ this.node.path = jvm.VMLPathElement.pathSvgToVml(value);
1067
+ } else {
1068
+ jvm.VMLShapeElement.prototype.applyAttr.call(this, attr, value);
1069
+ }
1070
+ };
1071
+
1072
+ jvm.VMLPathElement.pathSvgToVml = function(path) {
1073
+ var cx = 0, cy = 0, ctrlx, ctrly;
1074
+
1075
+ path = path.replace(/(-?\d+)e(-?\d+)/g, '0');
1076
+ return path.replace(/([MmLlHhVvCcSs])\s*((?:-?\d*(?:\.\d+)?\s*,?\s*)+)/g, function(segment, letter, coords, index){
1077
+ coords = coords.replace(/(\d)-/g, '$1,-')
1078
+ .replace(/^\s+/g, '')
1079
+ .replace(/\s+$/g, '')
1080
+ .replace(/\s+/g, ',').split(',');
1081
+ if (!coords[0]) coords.shift();
1082
+ for (var i=0, l=coords.length; i<l; i++) {
1083
+ coords[i] = Math.round(100*coords[i]);
1084
+ }
1085
+ switch (letter) {
1086
+ case 'm':
1087
+ cx += coords[0];
1088
+ cy += coords[1];
1089
+ return 't'+coords.join(',');
1090
+ case 'M':
1091
+ cx = coords[0];
1092
+ cy = coords[1];
1093
+ return 'm'+coords.join(',');
1094
+ case 'l':
1095
+ cx += coords[0];
1096
+ cy += coords[1];
1097
+ return 'r'+coords.join(',');
1098
+ case 'L':
1099
+ cx = coords[0];
1100
+ cy = coords[1];
1101
+ return 'l'+coords.join(',');
1102
+ case 'h':
1103
+ cx += coords[0];
1104
+ return 'r'+coords[0]+',0';
1105
+ case 'H':
1106
+ cx = coords[0];
1107
+ return 'l'+cx+','+cy;
1108
+ case 'v':
1109
+ cy += coords[0];
1110
+ return 'r0,'+coords[0];
1111
+ case 'V':
1112
+ cy = coords[0];
1113
+ return 'l'+cx+','+cy;
1114
+ case 'c':
1115
+ ctrlx = cx + coords[coords.length-4];
1116
+ ctrly = cy + coords[coords.length-3];
1117
+ cx += coords[coords.length-2];
1118
+ cy += coords[coords.length-1];
1119
+ return 'v'+coords.join(',');
1120
+ case 'C':
1121
+ ctrlx = coords[coords.length-4];
1122
+ ctrly = coords[coords.length-3];
1123
+ cx = coords[coords.length-2];
1124
+ cy = coords[coords.length-1];
1125
+ return 'c'+coords.join(',');
1126
+ case 's':
1127
+ coords.unshift(cy-ctrly);
1128
+ coords.unshift(cx-ctrlx);
1129
+ ctrlx = cx + coords[coords.length-4];
1130
+ ctrly = cy + coords[coords.length-3];
1131
+ cx += coords[coords.length-2];
1132
+ cy += coords[coords.length-1];
1133
+ return 'v'+coords.join(',');
1134
+ case 'S':
1135
+ coords.unshift(cy+cy-ctrly);
1136
+ coords.unshift(cx+cx-ctrlx);
1137
+ ctrlx = coords[coords.length-4];
1138
+ ctrly = coords[coords.length-3];
1139
+ cx = coords[coords.length-2];
1140
+ cy = coords[coords.length-1];
1141
+ return 'c'+coords.join(',');
1142
+ }
1143
+ return '';
1144
+ }).replace(/z/g, 'e');
1145
+ };jvm.VMLCircleElement = function(config, style){
1146
+ jvm.VMLCircleElement.parentClass.call(this, 'oval', config, style);
1147
+ };
1148
+
1149
+ jvm.inherits(jvm.VMLCircleElement, jvm.VMLShapeElement);
1150
+
1151
+ jvm.VMLCircleElement.prototype.applyAttr = function(attr, value){
1152
+ switch (attr) {
1153
+ case 'r':
1154
+ this.node.style.width = value*2+'px';
1155
+ this.node.style.height = value*2+'px';
1156
+ this.applyAttr('cx', this.get('cx') || 0);
1157
+ this.applyAttr('cy', this.get('cy') || 0);
1158
+ break;
1159
+ case 'cx':
1160
+ if (!value) return;
1161
+ this.node.style.left = value - (this.get('r') || 0) + 'px';
1162
+ break;
1163
+ case 'cy':
1164
+ if (!value) return;
1165
+ this.node.style.top = value - (this.get('r') || 0) + 'px';
1166
+ break;
1167
+ default:
1168
+ jvm.VMLCircleElement.parentClass.prototype.applyAttr.call(this, attr, value);
1169
+ }
1170
+ };/**
1171
+ * Class for vector images manipulations.
1172
+ * @constructor
1173
+ * @param {DOMElement} container to place canvas to
1174
+ * @param {Number} width
1175
+ * @param {Number} height
1176
+ */
1177
+ jvm.VectorCanvas = function(container, width, height) {
1178
+ this.mode = window.SVGAngle ? 'svg' : 'vml';
1179
+
1180
+ if (this.mode == 'svg') {
1181
+ this.impl = new jvm.SVGCanvasElement(container, width, height);
1182
+ } else {
1183
+ this.impl = new jvm.VMLCanvasElement(container, width, height);
1184
+ }
1185
+ this.impl.mode = this.mode;
1186
+ return this.impl;
1187
+ };jvm.SimpleScale = function(scale){
1188
+ this.scale = scale;
1189
+ };
1190
+
1191
+ jvm.SimpleScale.prototype.getValue = function(value){
1192
+ return value;
1193
+ };jvm.OrdinalScale = function(scale){
1194
+ this.scale = scale;
1195
+ };
1196
+
1197
+ jvm.OrdinalScale.prototype.getValue = function(value){
1198
+ return this.scale[value];
1199
+ };
1200
+
1201
+ jvm.OrdinalScale.prototype.getTicks = function(){
1202
+ var ticks = [],
1203
+ key;
1204
+
1205
+ for (key in this.scale) {
1206
+ ticks.push({
1207
+ label: key,
1208
+ value: this.scale[key]
1209
+ });
1210
+ }
1211
+
1212
+ return ticks;
1213
+ };jvm.NumericScale = function(scale, normalizeFunction, minValue, maxValue) {
1214
+ this.scale = [];
1215
+
1216
+ normalizeFunction = normalizeFunction || 'linear';
1217
+
1218
+ if (scale) this.setScale(scale);
1219
+ if (normalizeFunction) this.setNormalizeFunction(normalizeFunction);
1220
+ if (typeof minValue !== 'undefined' ) this.setMin(minValue);
1221
+ if (typeof maxValue !== 'undefined' ) this.setMax(maxValue);
1222
+ };
1223
+
1224
+ jvm.NumericScale.prototype = {
1225
+ setMin: function(min) {
1226
+ this.clearMinValue = min;
1227
+ if (typeof this.normalize === 'function') {
1228
+ this.minValue = this.normalize(min);
1229
+ } else {
1230
+ this.minValue = min;
1231
+ }
1232
+ },
1233
+
1234
+ setMax: function(max) {
1235
+ this.clearMaxValue = max;
1236
+ if (typeof this.normalize === 'function') {
1237
+ this.maxValue = this.normalize(max);
1238
+ } else {
1239
+ this.maxValue = max;
1240
+ }
1241
+ },
1242
+
1243
+ setScale: function(scale) {
1244
+ var i;
1245
+
1246
+ this.scale = [];
1247
+ for (i = 0; i < scale.length; i++) {
1248
+ this.scale[i] = [scale[i]];
1249
+ }
1250
+ },
1251
+
1252
+ setNormalizeFunction: function(f) {
1253
+ if (f === 'polynomial') {
1254
+ this.normalize = function(value) {
1255
+ return Math.pow(value, 0.2);
1256
+ }
1257
+ } else if (f === 'linear') {
1258
+ delete this.normalize;
1259
+ } else {
1260
+ this.normalize = f;
1261
+ }
1262
+ this.setMin(this.clearMinValue);
1263
+ this.setMax(this.clearMaxValue);
1264
+ },
1265
+
1266
+ getValue: function(value) {
1267
+ var lengthes = [],
1268
+ fullLength = 0,
1269
+ l,
1270
+ i = 0,
1271
+ c;
1272
+
1273
+ if (typeof this.normalize === 'function') {
1274
+ value = this.normalize(value);
1275
+ }
1276
+ for (i = 0; i < this.scale.length-1; i++) {
1277
+ l = this.vectorLength(this.vectorSubtract(this.scale[i+1], this.scale[i]));
1278
+ lengthes.push(l);
1279
+ fullLength += l;
1280
+ }
1281
+
1282
+ c = (this.maxValue - this.minValue) / fullLength;
1283
+ for (i=0; i<lengthes.length; i++) {
1284
+ lengthes[i] *= c;
1285
+ }
1286
+
1287
+ i = 0;
1288
+ value -= this.minValue;
1289
+ while (value - lengthes[i] >= 0) {
1290
+ value -= lengthes[i];
1291
+ i++;
1292
+ }
1293
+
1294
+ if (i == this.scale.length - 1) {
1295
+ value = this.vectorToNum(this.scale[i])
1296
+ } else {
1297
+ value = (
1298
+ this.vectorToNum(
1299
+ this.vectorAdd(this.scale[i],
1300
+ this.vectorMult(
1301
+ this.vectorSubtract(this.scale[i+1], this.scale[i]),
1302
+ (value) / (lengthes[i])
1303
+ )
1304
+ )
1305
+ )
1306
+ );
1307
+ }
1308
+
1309
+ return value;
1310
+ },
1311
+
1312
+ vectorToNum: function(vector) {
1313
+ var num = 0,
1314
+ i;
1315
+
1316
+ for (i = 0; i < vector.length; i++) {
1317
+ num += Math.round(vector[i])*Math.pow(256, vector.length-i-1);
1318
+ }
1319
+ return num;
1320
+ },
1321
+
1322
+ vectorSubtract: function(vector1, vector2) {
1323
+ var vector = [],
1324
+ i;
1325
+
1326
+ for (i = 0; i < vector1.length; i++) {
1327
+ vector[i] = vector1[i] - vector2[i];
1328
+ }
1329
+ return vector;
1330
+ },
1331
+
1332
+ vectorAdd: function(vector1, vector2) {
1333
+ var vector = [],
1334
+ i;
1335
+
1336
+ for (i = 0; i < vector1.length; i++) {
1337
+ vector[i] = vector1[i] + vector2[i];
1338
+ }
1339
+ return vector;
1340
+ },
1341
+
1342
+ vectorMult: function(vector, num) {
1343
+ var result = [],
1344
+ i;
1345
+
1346
+ for (i = 0; i < vector.length; i++) {
1347
+ result[i] = vector[i] * num;
1348
+ }
1349
+ return result;
1350
+ },
1351
+
1352
+ vectorLength: function(vector) {
1353
+ var result = 0,
1354
+ i;
1355
+ for (i = 0; i < vector.length; i++) {
1356
+ result += vector[i] * vector[i];
1357
+ }
1358
+ return Math.sqrt(result);
1359
+ },
1360
+
1361
+ /* Derived from d3 implementation https://github.com/mbostock/d3/blob/master/src/scale/linear.js#L94 */
1362
+ getTicks: function(){
1363
+ var m = 5,
1364
+ extent = [this.clearMinValue, this.clearMaxValue],
1365
+ span = extent[1] - extent[0],
1366
+ step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)),
1367
+ err = m / span * step,
1368
+ ticks = [],
1369
+ tick,
1370
+ v;
1371
+
1372
+ if (err <= .15) step *= 10;
1373
+ else if (err <= .35) step *= 5;
1374
+ else if (err <= .75) step *= 2;
1375
+
1376
+ extent[0] = Math.floor(extent[0] / step) * step;
1377
+ extent[1] = Math.ceil(extent[1] / step) * step;
1378
+
1379
+ tick = extent[0];
1380
+ while (tick <= extent[1]) {
1381
+ if (tick == extent[0]) {
1382
+ v = this.clearMinValue;
1383
+ } else if (tick == extent[1]) {
1384
+ v = this.clearMaxValue;
1385
+ } else {
1386
+ v = tick;
1387
+ }
1388
+ ticks.push({
1389
+ label: tick,
1390
+ value: this.getValue(v)
1391
+ });
1392
+ tick += step;
1393
+ }
1394
+
1395
+ return ticks;
1396
+ }
1397
+ };
1398
+ jvm.ColorScale = function(colors, normalizeFunction, minValue, maxValue) {
1399
+ jvm.ColorScale.parentClass.apply(this, arguments);
1400
+ }
1401
+
1402
+ jvm.inherits(jvm.ColorScale, jvm.NumericScale);
1403
+
1404
+ jvm.ColorScale.prototype.setScale = function(scale) {
1405
+ var i;
1406
+
1407
+ for (i = 0; i < scale.length; i++) {
1408
+ this.scale[i] = jvm.ColorScale.rgbToArray(scale[i]);
1409
+ }
1410
+ };
1411
+
1412
+ jvm.ColorScale.prototype.getValue = function(value) {
1413
+ return jvm.ColorScale.numToRgb(jvm.ColorScale.parentClass.prototype.getValue.call(this, value));
1414
+ };
1415
+
1416
+ jvm.ColorScale.arrayToRgb = function(ar) {
1417
+ var rgb = '#',
1418
+ d,
1419
+ i;
1420
+
1421
+ for (i = 0; i < ar.length; i++) {
1422
+ d = ar[i].toString(16);
1423
+ rgb += d.length == 1 ? '0'+d : d;
1424
+ }
1425
+ return rgb;
1426
+ };
1427
+
1428
+ jvm.ColorScale.numToRgb = function(num) {
1429
+ num = num.toString(16);
1430
+
1431
+ while (num.length < 6) {
1432
+ num = '0' + num;
1433
+ }
1434
+
1435
+ return '#'+num;
1436
+ };
1437
+
1438
+ jvm.ColorScale.rgbToArray = function(rgb) {
1439
+ rgb = rgb.substr(1);
1440
+ return [parseInt(rgb.substr(0, 2), 16), parseInt(rgb.substr(2, 2), 16), parseInt(rgb.substr(4, 2), 16)];
1441
+ };/**
1442
+ * Represents map legend.
1443
+ * @constructor
1444
+ * @param {Object} params Configuration parameters.
1445
+ * @param {String} params.cssClass Additional CSS class to apply to legend element.
1446
+ * @param {Boolean} params.vertical If <code>true</code> legend will be rendered as vertical.
1447
+ * @param {String} params.title Legend title.
1448
+ * @param {Function} params.labelRender Method to convert series values to legend labels.
1449
+ */
1450
+ jvm.Legend = function(params) {
1451
+ this.params = params || {};
1452
+ this.map = this.params.map;
1453
+ this.series = this.params.series;
1454
+ this.body = jvm.$('<div/>');
1455
+ this.body.addClass('jvectormap-legend');
1456
+ if (this.params.cssClass) {
1457
+ this.body.addClass(this.params.cssClass);
1458
+ }
1459
+
1460
+ if (params.vertical) {
1461
+ this.map.legendCntVertical.append( this.body );
1462
+ } else {
1463
+ this.map.legendCntHorizontal.append( this.body );
1464
+ }
1465
+
1466
+ this.render();
1467
+ }
1468
+
1469
+ jvm.Legend.prototype.render = function(){
1470
+ var ticks = this.series.scale.getTicks(),
1471
+ i,
1472
+ inner = jvm.$('<div/>').addClass('jvectormap-legend-inner'),
1473
+ tick,
1474
+ sample,
1475
+ label;
1476
+
1477
+ this.body.html('');
1478
+ if (this.params.title) {
1479
+ this.body.append(
1480
+ jvm.$('<div/>').addClass('jvectormap-legend-title').html(this.params.title)
1481
+ );
1482
+ }
1483
+ this.body.append(inner);
1484
+
1485
+ for (i = 0; i < ticks.length; i++) {
1486
+ tick = jvm.$('<div/>').addClass('jvectormap-legend-tick');
1487
+ sample = jvm.$('<div/>').addClass('jvectormap-legend-tick-sample');
1488
+
1489
+ switch (this.series.params.attribute) {
1490
+ case 'fill':
1491
+ if (jvm.isImageUrl(ticks[i].value)) {
1492
+ sample.css('background', 'url('+ticks[i].value+')');
1493
+ } else {
1494
+ sample.css('background', ticks[i].value);
1495
+ }
1496
+ break;
1497
+ case 'stroke':
1498
+ sample.css('background', ticks[i].value);
1499
+ break;
1500
+ case 'image':
1501
+ sample.css('background', 'url('+ticks[i].value+') no-repeat center center');
1502
+ break;
1503
+ case 'r':
1504
+ jvm.$('<div/>').css({
1505
+ 'border-radius': ticks[i].value,
1506
+ border: this.map.params.markerStyle.initial['stroke-width']+'px '+
1507
+ this.map.params.markerStyle.initial['stroke']+' solid',
1508
+ width: ticks[i].value * 2 + 'px',
1509
+ height: ticks[i].value * 2 + 'px',
1510
+ background: this.map.params.markerStyle.initial['fill']
1511
+ }).appendTo(sample);
1512
+ break;
1513
+ }
1514
+ tick.append( sample );
1515
+ label = ticks[i].label;
1516
+ if (this.params.labelRender) {
1517
+ label = this.params.labelRender(label);
1518
+ }
1519
+ tick.append( jvm.$('<div>'+label+' </div>').addClass('jvectormap-legend-tick-text') );
1520
+ inner.append(tick);
1521
+ }
1522
+ inner.append( jvm.$('<div/>').css('clear', 'both') );
1523
+ }/**
1524
+ * Creates data series.
1525
+ * @constructor
1526
+ * @param {Object} params Parameters to initialize series with.
1527
+ * @param {Array} params.values The data set to visualize.
1528
+ * @param {String} params.attribute Numberic or color attribute to use for data visualization. This could be: <code>fill</code>, <code>stroke</code>, <code>fill-opacity</code>, <code>stroke-opacity</code> for markers and regions and <code>r</code> (radius) for markers only.
1529
+ * @param {Array} params.scale Values used to map a dimension of data to a visual representation. The first value sets visualization for minimum value from the data set and the last value sets visualization for the maximum value. There also could be intermidiate values. Default value is <code>['#C8EEFF', '#0071A4']</code>
1530
+ * @param {Function|String} params.normalizeFunction The function used to map input values to the provided scale. This parameter could be provided as function or one of the strings: <code>'linear'</code> or <code>'polynomial'</code>, while <code>'linear'</code> is used by default. The function provided takes value from the data set as an input and returns corresponding value from the scale.
1531
+ * @param {Number} params.min Minimum value of the data set. Could be calculated automatically if not provided.
1532
+ * @param {Number} params.min Maximum value of the data set. Could be calculated automatically if not provided.
1533
+ */
1534
+ jvm.DataSeries = function(params, elements, map) {
1535
+ var scaleConstructor;
1536
+
1537
+ params = params || {};
1538
+ params.attribute = params.attribute || 'fill';
1539
+
1540
+ this.elements = elements;
1541
+ this.params = params;
1542
+ this.map = map;
1543
+
1544
+ if (params.attributes) {
1545
+ this.setAttributes(params.attributes);
1546
+ }
1547
+
1548
+ if (jvm.$.isArray(params.scale)) {
1549
+ scaleConstructor = (params.attribute === 'fill' || params.attribute === 'stroke') ? jvm.ColorScale : jvm.NumericScale;
1550
+ this.scale = new scaleConstructor(params.scale, params.normalizeFunction, params.min, params.max);
1551
+ } else if (params.scale) {
1552
+ this.scale = new jvm.OrdinalScale(params.scale);
1553
+ } else {
1554
+ this.scale = new jvm.SimpleScale(params.scale);
1555
+ }
1556
+
1557
+ this.values = params.values || {};
1558
+ this.setValues(this.values);
1559
+
1560
+ if (this.params.legend) {
1561
+ this.legend = new jvm.Legend($.extend({
1562
+ map: this.map,
1563
+ series: this
1564
+ }, this.params.legend))
1565
+ }
1566
+ };
1567
+
1568
+ jvm.DataSeries.prototype = {
1569
+ setAttributes: function(key, attr){
1570
+ var attrs = key,
1571
+ code;
1572
+
1573
+ if (typeof key == 'string') {
1574
+ if (this.elements[key]) {
1575
+ this.elements[key].setStyle(this.params.attribute, attr);
1576
+ }
1577
+ } else {
1578
+ for (code in attrs) {
1579
+ if (this.elements[code]) {
1580
+ this.elements[code].element.setStyle(this.params.attribute, attrs[code]);
1581
+ }
1582
+ }
1583
+ }
1584
+ },
1585
+
1586
+ /**
1587
+ * Set values for the data set.
1588
+ * @param {Object} values Object which maps codes of regions or markers to values.
1589
+ */
1590
+ setValues: function(values) {
1591
+ var max = -Number.MAX_VALUE,
1592
+ min = Number.MAX_VALUE,
1593
+ val,
1594
+ cc,
1595
+ attrs = {};
1596
+
1597
+ if (!(this.scale instanceof jvm.OrdinalScale) && !(this.scale instanceof jvm.SimpleScale)) {
1598
+ // we have a color scale as an array
1599
+ if (typeof this.params.min === 'undefined' || typeof this.params.max === 'undefined') {
1600
+ // min and/or max are not defined, so calculate them
1601
+ for (cc in values) {
1602
+ val = parseFloat(values[cc]);
1603
+ if (val > max) max = val;
1604
+ if (val < min) min = val;
1605
+ }
1606
+ }
1607
+
1608
+ if (typeof this.params.min === 'undefined') {
1609
+ this.scale.setMin(min);
1610
+ this.params.min = min;
1611
+ } else {
1612
+ this.scale.setMin(this.params.min);
1613
+ }
1614
+
1615
+ if (typeof this.params.max === 'undefined') {
1616
+ this.scale.setMax(max);
1617
+ this.params.max = max;
1618
+ } else {
1619
+ this.scale.setMax(this.params.max);
1620
+ }
1621
+
1622
+ for (cc in values) {
1623
+ if (cc != 'indexOf') {
1624
+ val = parseFloat(values[cc]);
1625
+ if (!isNaN(val)) {
1626
+ attrs[cc] = this.scale.getValue(val);
1627
+ } else {
1628
+ attrs[cc] = this.elements[cc].element.style.initial[this.params.attribute];
1629
+ }
1630
+ }
1631
+ }
1632
+ } else {
1633
+ for (cc in values) {
1634
+ if (values[cc]) {
1635
+ attrs[cc] = this.scale.getValue(values[cc]);
1636
+ } else {
1637
+ attrs[cc] = this.elements[cc].element.style.initial[this.params.attribute];
1638
+ }
1639
+ }
1640
+ }
1641
+
1642
+ this.setAttributes(attrs);
1643
+ jvm.$.extend(this.values, values);
1644
+ },
1645
+
1646
+ clear: function(){
1647
+ var key,
1648
+ attrs = {};
1649
+
1650
+ for (key in this.values) {
1651
+ if (this.elements[key]) {
1652
+ attrs[key] = this.elements[key].element.shape.style.initial[this.params.attribute];
1653
+ }
1654
+ }
1655
+ this.setAttributes(attrs);
1656
+ this.values = {};
1657
+ },
1658
+
1659
+ /**
1660
+ * Set scale of the data series.
1661
+ * @param {Array} scale Values representing scale.
1662
+ */
1663
+ setScale: function(scale) {
1664
+ this.scale.setScale(scale);
1665
+ if (this.values) {
1666
+ this.setValues(this.values);
1667
+ }
1668
+ },
1669
+
1670
+ /**
1671
+ * Set normalize function of the data series.
1672
+ * @param {Function|String} normilizeFunction.
1673
+ */
1674
+ setNormalizeFunction: function(f) {
1675
+ this.scale.setNormalizeFunction(f);
1676
+ if (this.values) {
1677
+ this.setValues(this.values);
1678
+ }
1679
+ }
1680
+ };
1681
+ /**
1682
+ * Contains methods for transforming point on sphere to
1683
+ * Cartesian coordinates using various projections.
1684
+ * @class
1685
+ */
1686
+ jvm.Proj = {
1687
+ degRad: 180 / Math.PI,
1688
+ radDeg: Math.PI / 180,
1689
+ radius: 6381372,
1690
+
1691
+ sgn: function(n){
1692
+ if (n > 0) {
1693
+ return 1;
1694
+ } else if (n < 0) {
1695
+ return -1;
1696
+ } else {
1697
+ return n;
1698
+ }
1699
+ },
1700
+
1701
+ /**
1702
+ * Converts point on sphere to the Cartesian coordinates using Miller projection
1703
+ * @param {Number} lat Latitude in degrees
1704
+ * @param {Number} lng Longitude in degrees
1705
+ * @param {Number} c Central meridian in degrees
1706
+ */
1707
+ mill: function(lat, lng, c){
1708
+ return {
1709
+ x: this.radius * (lng - c) * this.radDeg,
1710
+ y: - this.radius * Math.log(Math.tan((45 + 0.4 * lat) * this.radDeg)) / 0.8
1711
+ };
1712
+ },
1713
+
1714
+ /**
1715
+ * Inverse function of mill()
1716
+ * Converts Cartesian coordinates to point on sphere using Miller projection
1717
+ * @param {Number} x X of point in Cartesian system as integer
1718
+ * @param {Number} y Y of point in Cartesian system as integer
1719
+ * @param {Number} c Central meridian in degrees
1720
+ */
1721
+ mill_inv: function(x, y, c){
1722
+ return {
1723
+ lat: (2.5 * Math.atan(Math.exp(0.8 * y / this.radius)) - 5 * Math.PI / 8) * this.degRad,
1724
+ lng: (c * this.radDeg + x / this.radius) * this.degRad
1725
+ };
1726
+ },
1727
+
1728
+ /**
1729
+ * Converts point on sphere to the Cartesian coordinates using Mercator projection
1730
+ * @param {Number} lat Latitude in degrees
1731
+ * @param {Number} lng Longitude in degrees
1732
+ * @param {Number} c Central meridian in degrees
1733
+ */
1734
+ merc: function(lat, lng, c){
1735
+ return {
1736
+ x: this.radius * (lng - c) * this.radDeg,
1737
+ y: - this.radius * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360))
1738
+ };
1739
+ },
1740
+
1741
+ /**
1742
+ * Inverse function of merc()
1743
+ * Converts Cartesian coordinates to point on sphere using Mercator projection
1744
+ * @param {Number} x X of point in Cartesian system as integer
1745
+ * @param {Number} y Y of point in Cartesian system as integer
1746
+ * @param {Number} c Central meridian in degrees
1747
+ */
1748
+ merc_inv: function(x, y, c){
1749
+ return {
1750
+ lat: (2 * Math.atan(Math.exp(y / this.radius)) - Math.PI / 2) * this.degRad,
1751
+ lng: (c * this.radDeg + x / this.radius) * this.degRad
1752
+ };
1753
+ },
1754
+
1755
+ /**
1756
+ * Converts point on sphere to the Cartesian coordinates using Albers Equal-Area Conic
1757
+ * projection
1758
+ * @see <a href="http://mathworld.wolfram.com/AlbersEqual-AreaConicProjection.html">Albers Equal-Area Conic projection</a>
1759
+ * @param {Number} lat Latitude in degrees
1760
+ * @param {Number} lng Longitude in degrees
1761
+ * @param {Number} c Central meridian in degrees
1762
+ */
1763
+ aea: function(lat, lng, c){
1764
+ var fi0 = 0,
1765
+ lambda0 = c * this.radDeg,
1766
+ fi1 = 29.5 * this.radDeg,
1767
+ fi2 = 45.5 * this.radDeg,
1768
+ fi = lat * this.radDeg,
1769
+ lambda = lng * this.radDeg,
1770
+ n = (Math.sin(fi1)+Math.sin(fi2)) / 2,
1771
+ C = Math.cos(fi1)*Math.cos(fi1)+2*n*Math.sin(fi1),
1772
+ theta = n*(lambda-lambda0),
1773
+ ro = Math.sqrt(C-2*n*Math.sin(fi))/n,
1774
+ ro0 = Math.sqrt(C-2*n*Math.sin(fi0))/n;
1775
+
1776
+ return {
1777
+ x: ro * Math.sin(theta) * this.radius,
1778
+ y: - (ro0 - ro * Math.cos(theta)) * this.radius
1779
+ };
1780
+ },
1781
+
1782
+ /**
1783
+ * Converts Cartesian coordinates to the point on sphere using Albers Equal-Area Conic
1784
+ * projection
1785
+ * @see <a href="http://mathworld.wolfram.com/AlbersEqual-AreaConicProjection.html">Albers Equal-Area Conic projection</a>
1786
+ * @param {Number} x X of point in Cartesian system as integer
1787
+ * @param {Number} y Y of point in Cartesian system as integer
1788
+ * @param {Number} c Central meridian in degrees
1789
+ */
1790
+ aea_inv: function(xCoord, yCoord, c){
1791
+ var x = xCoord / this.radius,
1792
+ y = yCoord / this.radius,
1793
+ fi0 = 0,
1794
+ lambda0 = c * this.radDeg,
1795
+ fi1 = 29.5 * this.radDeg,
1796
+ fi2 = 45.5 * this.radDeg,
1797
+ n = (Math.sin(fi1)+Math.sin(fi2)) / 2,
1798
+ C = Math.cos(fi1)*Math.cos(fi1)+2*n*Math.sin(fi1),
1799
+ ro0 = Math.sqrt(C-2*n*Math.sin(fi0))/n,
1800
+ ro = Math.sqrt(x*x+(ro0-y)*(ro0-y)),
1801
+ theta = Math.atan( x / (ro0 - y) );
1802
+
1803
+ return {
1804
+ lat: (Math.asin((C - ro * ro * n * n) / (2 * n))) * this.degRad,
1805
+ lng: (lambda0 + theta / n) * this.degRad
1806
+ };
1807
+ },
1808
+
1809
+ /**
1810
+ * Converts point on sphere to the Cartesian coordinates using Lambert conformal
1811
+ * conic projection
1812
+ * @see <a href="http://mathworld.wolfram.com/LambertConformalConicProjection.html">Lambert Conformal Conic Projection</a>
1813
+ * @param {Number} lat Latitude in degrees
1814
+ * @param {Number} lng Longitude in degrees
1815
+ * @param {Number} c Central meridian in degrees
1816
+ */
1817
+ lcc: function(lat, lng, c){
1818
+ var fi0 = 0,
1819
+ lambda0 = c * this.radDeg,
1820
+ lambda = lng * this.radDeg,
1821
+ fi1 = 33 * this.radDeg,
1822
+ fi2 = 45 * this.radDeg,
1823
+ fi = lat * this.radDeg,
1824
+ 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) ) ),
1825
+ F = ( Math.cos(fi1) * Math.pow( Math.tan( Math.PI / 4 + fi1 / 2 ), n ) ) / n,
1826
+ ro = F * Math.pow( 1 / Math.tan( Math.PI / 4 + fi / 2 ), n ),
1827
+ ro0 = F * Math.pow( 1 / Math.tan( Math.PI / 4 + fi0 / 2 ), n );
1828
+
1829
+ return {
1830
+ x: ro * Math.sin( n * (lambda - lambda0) ) * this.radius,
1831
+ y: - (ro0 - ro * Math.cos( n * (lambda - lambda0) ) ) * this.radius
1832
+ };
1833
+ },
1834
+
1835
+ /**
1836
+ * Converts Cartesian coordinates to the point on sphere using Lambert conformal conic
1837
+ * projection
1838
+ * @see <a href="http://mathworld.wolfram.com/LambertConformalConicProjection.html">Lambert Conformal Conic Projection</a>
1839
+ * @param {Number} x X of point in Cartesian system as integer
1840
+ * @param {Number} y Y of point in Cartesian system as integer
1841
+ * @param {Number} c Central meridian in degrees
1842
+ */
1843
+ lcc_inv: function(xCoord, yCoord, c){
1844
+ var x = xCoord / this.radius,
1845
+ y = yCoord / this.radius,
1846
+ fi0 = 0,
1847
+ lambda0 = c * this.radDeg,
1848
+ fi1 = 33 * this.radDeg,
1849
+ fi2 = 45 * this.radDeg,
1850
+ 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) ) ),
1851
+ F = ( Math.cos(fi1) * Math.pow( Math.tan( Math.PI / 4 + fi1 / 2 ), n ) ) / n,
1852
+ ro0 = F * Math.pow( 1 / Math.tan( Math.PI / 4 + fi0 / 2 ), n ),
1853
+ ro = this.sgn(n) * Math.sqrt(x*x+(ro0-y)*(ro0-y)),
1854
+ theta = Math.atan( x / (ro0 - y) );
1855
+
1856
+ return {
1857
+ lat: (2 * Math.atan(Math.pow(F/ro, 1/n)) - Math.PI / 2) * this.degRad,
1858
+ lng: (lambda0 + theta / n) * this.degRad
1859
+ };
1860
+ }
1861
+ };jvm.MapObject = function(config){};
1862
+
1863
+ jvm.MapObject.prototype.getLabelText = function(key){
1864
+ var text;
1865
+
1866
+ if (this.config.label) {
1867
+ if (typeof this.config.label.render === 'function') {
1868
+ text = this.config.label.render(key);
1869
+ } else {
1870
+ text = key;
1871
+ }
1872
+ } else {
1873
+ text = null;
1874
+ }
1875
+ return text;
1876
+ }
1877
+
1878
+ jvm.MapObject.prototype.getLabelOffsets = function(key){
1879
+ var offsets;
1880
+
1881
+ if (this.config.label) {
1882
+ if (typeof this.config.label.offsets === 'function') {
1883
+ offsets = this.config.label.offsets(key);
1884
+ } else if (typeof this.config.label.offsets === 'object') {
1885
+ offsets = this.config.label.offsets[key];
1886
+ }
1887
+ }
1888
+ return offsets || [0, 0];
1889
+ }
1890
+
1891
+ /**
1892
+ * Set hovered state to the element. Hovered state means mouse cursor is over element. Styles will be updates respectively.
1893
+ * @param {Boolean} isHovered <code>true</code> to make element hovered, <code>false</code> otherwise.
1894
+ */
1895
+ jvm.MapObject.prototype.setHovered = function(isHovered){
1896
+ if (this.isHovered !== isHovered) {
1897
+ this.isHovered = isHovered;
1898
+ this.shape.isHovered = isHovered;
1899
+ this.shape.updateStyle();
1900
+ if (this.label) {
1901
+ this.label.isHovered = isHovered;
1902
+ this.label.updateStyle();
1903
+ }
1904
+ }
1905
+ };
1906
+
1907
+ /**
1908
+ * Set selected state to the element. Styles will be updates respectively.
1909
+ * @param {Boolean} isSelected <code>true</code> to make element selected, <code>false</code> otherwise.
1910
+ */
1911
+ jvm.MapObject.prototype.setSelected = function(isSelected){
1912
+ if (this.isSelected !== isSelected) {
1913
+ this.isSelected = isSelected;
1914
+ this.shape.isSelected = isSelected;
1915
+ this.shape.updateStyle();
1916
+ if (this.label) {
1917
+ this.label.isSelected = isSelected;
1918
+ this.label.updateStyle();
1919
+ }
1920
+ jvm.$(this.shape).trigger('selected', [isSelected]);
1921
+ }
1922
+ };
1923
+
1924
+ jvm.MapObject.prototype.setStyle = function(){
1925
+ this.shape.setStyle.apply(this.shape, arguments);
1926
+ };
1927
+
1928
+ jvm.MapObject.prototype.remove = function(){
1929
+ this.shape.remove();
1930
+ if (this.label) {
1931
+ this.label.remove();
1932
+ }
1933
+ };jvm.Region = function(config){
1934
+ var bbox,
1935
+ text,
1936
+ offsets,
1937
+ labelDx,
1938
+ labelDy;
1939
+
1940
+ this.config = config;
1941
+ this.map = this.config.map;
1942
+
1943
+ this.shape = config.canvas.addPath({
1944
+ d: config.path,
1945
+ 'data-code': config.code
1946
+ }, config.style, config.canvas.rootElement);
1947
+ this.shape.addClass('jvectormap-region jvectormap-element');
1948
+
1949
+ bbox = this.shape.getBBox();
1950
+
1951
+ text = this.getLabelText(config.code);
1952
+ if (this.config.label && text) {
1953
+ offsets = this.getLabelOffsets(config.code);
1954
+ this.labelX = bbox.x + bbox.width / 2 + offsets[0];
1955
+ this.labelY = bbox.y + bbox.height / 2 + offsets[1];
1956
+ this.label = config.canvas.addText({
1957
+ text: text,
1958
+ 'text-anchor': 'middle',
1959
+ 'alignment-baseline': 'central',
1960
+ x: this.labelX,
1961
+ y: this.labelY,
1962
+ 'data-code': config.code
1963
+ }, config.labelStyle, config.labelsGroup);
1964
+ this.label.addClass('jvectormap-region jvectormap-element');
1965
+ }
1966
+ };
1967
+
1968
+ jvm.inherits(jvm.Region, jvm.MapObject);
1969
+
1970
+ jvm.Region.prototype.updateLabelPosition = function(){
1971
+ if (this.label) {
1972
+ this.label.set({
1973
+ x: this.labelX * this.map.scale + this.map.transX * this.map.scale,
1974
+ y: this.labelY * this.map.scale + this.map.transY * this.map.scale
1975
+ });
1976
+ }
1977
+ };jvm.Marker = function(config){
1978
+ var text,
1979
+ offsets;
1980
+
1981
+ this.config = config;
1982
+ this.map = this.config.map;
1983
+
1984
+ this.isImage = !!this.config.style.initial.image;
1985
+ this.createShape();
1986
+
1987
+ text = this.getLabelText(config.index);
1988
+ if (this.config.label && text) {
1989
+ this.offsets = this.getLabelOffsets(config.index);
1990
+ this.labelX = config.cx / this.map.scale - this.map.transX;
1991
+ this.labelY = config.cy / this.map.scale - this.map.transY;
1992
+ this.label = config.canvas.addText({
1993
+ text: text,
1994
+ 'data-index': config.index,
1995
+ dy: "0.6ex",
1996
+ x: this.labelX,
1997
+ y: this.labelY
1998
+ }, config.labelStyle, config.labelsGroup);
1999
+
2000
+ this.label.addClass('jvectormap-marker jvectormap-element');
2001
+ }
2002
+ };
2003
+
2004
+ jvm.inherits(jvm.Marker, jvm.MapObject);
2005
+
2006
+ jvm.Marker.prototype.createShape = function(){
2007
+ var that = this;
2008
+
2009
+ if (this.shape) {
2010
+ this.shape.remove();
2011
+ }
2012
+ this.shape = this.config.canvas[this.isImage ? 'addImage' : 'addCircle']({
2013
+ "data-index": this.config.index,
2014
+ cx: this.config.cx,
2015
+ cy: this.config.cy
2016
+ }, this.config.style, this.config.group);
2017
+
2018
+ this.shape.addClass('jvectormap-marker jvectormap-element');
2019
+
2020
+ if (this.isImage) {
2021
+ jvm.$(this.shape.node).on('imageloaded', function(){
2022
+ that.updateLabelPosition();
2023
+ });
2024
+ }
2025
+ };
2026
+
2027
+ jvm.Marker.prototype.updateLabelPosition = function(){
2028
+ if (this.label) {
2029
+ this.label.set({
2030
+ x: this.labelX * this.map.scale + this.offsets[0] +
2031
+ this.map.transX * this.map.scale + 5 + (this.isImage ? (this.shape.width || 0) / 2 : this.shape.properties.r),
2032
+ y: this.labelY * this.map.scale + this.map.transY * this.map.scale + this.offsets[1]
2033
+ });
2034
+ }
2035
+ };
2036
+
2037
+ jvm.Marker.prototype.setStyle = function(property, value){
2038
+ var isImage;
2039
+
2040
+ jvm.Marker.parentClass.prototype.setStyle.apply(this, arguments);
2041
+
2042
+ if (property === 'r') {
2043
+ this.updateLabelPosition();
2044
+ }
2045
+
2046
+ isImage = !!this.shape.get('image');
2047
+ if (isImage != this.isImage) {
2048
+ this.isImage = isImage;
2049
+ this.config.style = jvm.$.extend(true, {}, this.shape.style);
2050
+ this.createShape();
2051
+ }
2052
+ };/**
2053
+ * Creates map, draws paths, binds events.
2054
+ * @constructor
2055
+ * @param {Object} params Parameters to initialize map with.
2056
+ * @param {String} params.map Name of the map in the format <code>territory_proj_lang</code> where <code>territory</code> is a unique code or name of the territory which the map represents (ISO 3166 standard is used where possible), <code>proj</code> is a name of projection used to generate representation of the map on the plane (projections are named according to the conventions of proj4 utility) and <code>lang</code> is a code of the language, used for the names of regions.
2057
+ * @param {String} params.backgroundColor Background color of the map in CSS format.
2058
+ * @param {Boolean} params.zoomOnScroll When set to true map could be zoomed using mouse scroll. Default value is <code>true</code>.
2059
+ * @param {Boolean} params.zoomOnScrollSpeed Mouse scroll speed. Number from 1 to 10. Default value is <code>3</code>.
2060
+ * @param {Boolean} params.panOnDrag When set to true, the map pans when being dragged. Default value is <code>true</code>.
2061
+ * @param {Number} params.zoomMax Indicates the maximum zoom ratio which could be reached zooming the map. Default value is <code>8</code>.
2062
+ * @param {Number} params.zoomMin Indicates the minimum zoom ratio which could be reached zooming the map. Default value is <code>1</code>.
2063
+ * @param {Number} params.zoomStep Indicates the multiplier used to zoom map with +/- buttons. Default value is <code>1.6</code>.
2064
+ * @param {Boolean} params.zoomAnimate Indicates whether or not to animate changing of map zoom with zoom buttons.
2065
+ * @param {Boolean} params.regionsSelectable When set to true regions of the map could be selected. Default value is <code>false</code>.
2066
+ * @param {Boolean} params.regionsSelectableOne Allow only one region to be selected at the moment. Default value is <code>false</code>.
2067
+ * @param {Boolean} params.markersSelectable When set to true markers on the map could be selected. Default value is <code>false</code>.
2068
+ * @param {Boolean} params.markersSelectableOne Allow only one marker to be selected at the moment. Default value is <code>false</code>.
2069
+ * @param {Object} params.regionStyle Set the styles for the map's regions. Each region or marker has four states: <code>initial</code> (default state), <code>hover</code> (when the mouse cursor is over the region or marker), <code>selected</code> (when region or marker is selected), <code>selectedHover</code> (when the mouse cursor is over the region or marker and it's selected simultaneously). Styles could be set for each of this states. Default value for that parameter is:
2070
+ <pre>{
2071
+ initial: {
2072
+ fill: 'white',
2073
+ "fill-opacity": 1,
2074
+ stroke: 'none',
2075
+ "stroke-width": 0,
2076
+ "stroke-opacity": 1
2077
+ },
2078
+ hover: {
2079
+ "fill-opacity": 0.8,
2080
+ cursor: 'pointer'
2081
+ },
2082
+ selected: {
2083
+ fill: 'yellow'
2084
+ },
2085
+ selectedHover: {
2086
+ }
2087
+ }</pre>
2088
+ * @param {Object} params.regionLabelStyle Set the styles for the regions' labels. Each region or marker has four states: <code>initial</code> (default state), <code>hover</code> (when the mouse cursor is over the region or marker), <code>selected</code> (when region or marker is selected), <code>selectedHover</code> (when the mouse cursor is over the region or marker and it's selected simultaneously). Styles could be set for each of this states. Default value for that parameter is:
2089
+ <pre>{
2090
+ initial: {
2091
+ 'font-family': 'Verdana',
2092
+ 'font-size': '12',
2093
+ 'font-weight': 'bold',
2094
+ cursor: 'default',
2095
+ fill: 'black'
2096
+ },
2097
+ hover: {
2098
+ cursor: 'pointer'
2099
+ }
2100
+ }</pre>
2101
+ * @param {Object} params.markerStyle Set the styles for the map's markers. Any parameter suitable for <code>regionStyle</code> could be used as well as numeric parameter <code>r</code> to set the marker's radius. Default value for that parameter is:
2102
+ <pre>{
2103
+ initial: {
2104
+ fill: 'grey',
2105
+ stroke: '#505050',
2106
+ "fill-opacity": 1,
2107
+ "stroke-width": 1,
2108
+ "stroke-opacity": 1,
2109
+ r: 5
2110
+ },
2111
+ hover: {
2112
+ stroke: 'black',
2113
+ "stroke-width": 2,
2114
+ cursor: 'pointer'
2115
+ },
2116
+ selected: {
2117
+ fill: 'blue'
2118
+ },
2119
+ selectedHover: {
2120
+ }
2121
+ }</pre>
2122
+ * @param {Object} params.markerLabelStyle Set the styles for the markers' labels. Default value for that parameter is:
2123
+ <pre>{
2124
+ initial: {
2125
+ 'font-family': 'Verdana',
2126
+ 'font-size': '12',
2127
+ 'font-weight': 'bold',
2128
+ cursor: 'default',
2129
+ fill: 'black'
2130
+ },
2131
+ hover: {
2132
+ cursor: 'pointer'
2133
+ }
2134
+ }</pre>
2135
+ * @param {Object|Array} params.markers Set of markers to add to the map during initialization. In case of array is provided, codes of markers will be set as string representations of array indexes. Each marker is represented by <code>latLng</code> (array of two numeric values), <code>name</code> (string which will be show on marker's tip) and any marker styles.
2136
+ * @param {Object} params.series Object with two keys: <code>markers</code> and <code>regions</code>. Each of which is an array of series configs to be applied to the respective map elements. See <a href="jvm.DataSeries.html">DataSeries</a> description for a list of parameters available.
2137
+ * @param {Object|String} params.focusOn This parameter sets the initial position and scale of the map viewport. See <code>setFocus</code> docuemntation for possible parameters.
2138
+ * @param {Object} params.labels Defines parameters for rendering static labels. Object could contain two keys: <code>regions</code> and <code>markers</code>. Each key value defines configuration object with the following possible options:
2139
+ <ul>
2140
+ <li><code>render {Function}</code> - defines method for converting region code or marker index to actual label value.</li>
2141
+ <li><code>offsets {Object|Function}</code> - provides method or object which could be used to define label offset by region code or marker index.</li>
2142
+ </ul>
2143
+ <b>Plase note: static labels feature is not supported in Internet Explorer 8 and below.</b>
2144
+ * @param {Array|Object|String} params.selectedRegions Set initially selected regions.
2145
+ * @param {Array|Object|String} params.selectedMarkers Set initially selected markers.
2146
+ * @param {Function} params.onRegionTipShow <code>(Event e, Object tip, String code)</code> Will be called right before the region tip is going to be shown.
2147
+ * @param {Function} params.onRegionOver <code>(Event e, String code)</code> Will be called on region mouse over event.
2148
+ * @param {Function} params.onRegionOut <code>(Event e, String code)</code> Will be called on region mouse out event.
2149
+ * @param {Function} params.onRegionClick <code>(Event e, String code)</code> Will be called on region click event.
2150
+ * @param {Function} params.onRegionSelected <code>(Event e, String code, Boolean isSelected, Array selectedRegions)</code> Will be called when region is (de)selected. <code>isSelected</code> parameter of the callback indicates whether region is selected or not. <code>selectedRegions</code> contains codes of all currently selected regions.
2151
+ * @param {Function} params.onMarkerTipShow <code>(Event e, Object tip, String code)</code> Will be called right before the marker tip is going to be shown.
2152
+ * @param {Function} params.onMarkerOver <code>(Event e, String code)</code> Will be called on marker mouse over event.
2153
+ * @param {Function} params.onMarkerOut <code>(Event e, String code)</code> Will be called on marker mouse out event.
2154
+ * @param {Function} params.onMarkerClick <code>(Event e, String code)</code> Will be called on marker click event.
2155
+ * @param {Function} params.onMarkerSelected <code>(Event e, String code, Boolean isSelected, Array selectedMarkers)</code> Will be called when marker is (de)selected. <code>isSelected</code> parameter of the callback indicates whether marker is selected or not. <code>selectedMarkers</code> contains codes of all currently selected markers.
2156
+ * @param {Function} params.onViewportChange <code>(Event e, Number scale)</code> Triggered when the map's viewport is changed (map was panned or zoomed).
2157
+ */
2158
+ jvm.Map = function(params) {
2159
+ var map = this,
2160
+ e;
2161
+
2162
+ this.params = jvm.$.extend(true, {}, jvm.Map.defaultParams, params);
2163
+
2164
+ if (!jvm.Map.maps[this.params.map]) {
2165
+ throw new Error('Attempt to use map which was not loaded: '+this.params.map);
2166
+ }
2167
+
2168
+ this.mapData = jvm.Map.maps[this.params.map];
2169
+ this.markers = {};
2170
+ this.regions = {};
2171
+ this.regionsColors = {};
2172
+ this.regionsData = {};
2173
+
2174
+ this.container = jvm.$('<div>').addClass('jvectormap-container');
2175
+ if (this.params.container) {
2176
+ this.params.container.append( this.container );
2177
+ }
2178
+ this.container.data('mapObject', this);
2179
+
2180
+ this.defaultWidth = this.mapData.width;
2181
+ this.defaultHeight = this.mapData.height;
2182
+
2183
+ this.setBackgroundColor(this.params.backgroundColor);
2184
+
2185
+ this.onResize = function(){
2186
+ map.updateSize();
2187
+ }
2188
+ jvm.$(window).resize(this.onResize);
2189
+
2190
+ for (e in jvm.Map.apiEvents) {
2191
+ if (this.params[e]) {
2192
+ this.container.bind(jvm.Map.apiEvents[e]+'.jvectormap', this.params[e]);
2193
+ }
2194
+ }
2195
+
2196
+ this.canvas = new jvm.VectorCanvas(this.container[0], this.width, this.height);
2197
+
2198
+ if ( ('ontouchstart' in window) || (window.DocumentTouch && document instanceof DocumentTouch) ) {
2199
+ if (this.params.bindTouchEvents) {
2200
+ this.bindContainerTouchEvents();
2201
+ }
2202
+ }
2203
+ this.bindContainerEvents();
2204
+ this.bindElementEvents();
2205
+ this.createTip();
2206
+ if (this.params.zoomButtons) {
2207
+ this.bindZoomButtons();
2208
+ }
2209
+
2210
+ this.createRegions();
2211
+ this.createMarkers(this.params.markers || {});
2212
+
2213
+ this.updateSize();
2214
+
2215
+ if (this.params.focusOn) {
2216
+ if (typeof this.params.focusOn === 'string') {
2217
+ this.params.focusOn = {region: this.params.focusOn};
2218
+ } else if (jvm.$.isArray(this.params.focusOn)) {
2219
+ this.params.focusOn = {regions: this.params.focusOn};
2220
+ }
2221
+ this.setFocus(this.params.focusOn);
2222
+ }
2223
+
2224
+ if (this.params.selectedRegions) {
2225
+ this.setSelectedRegions(this.params.selectedRegions);
2226
+ }
2227
+ if (this.params.selectedMarkers) {
2228
+ this.setSelectedMarkers(this.params.selectedMarkers);
2229
+ }
2230
+
2231
+ this.legendCntHorizontal = jvm.$('<div/>').addClass('jvectormap-legend-cnt jvectormap-legend-cnt-h');
2232
+ this.legendCntVertical = jvm.$('<div/>').addClass('jvectormap-legend-cnt jvectormap-legend-cnt-v');
2233
+ this.container.append(this.legendCntHorizontal);
2234
+ this.container.append(this.legendCntVertical);
2235
+
2236
+ if (this.params.series) {
2237
+ this.createSeries();
2238
+ }
2239
+ };
2240
+
2241
+ jvm.Map.prototype = {
2242
+ transX: 0,
2243
+ transY: 0,
2244
+ scale: 1,
2245
+ baseTransX: 0,
2246
+ baseTransY: 0,
2247
+ baseScale: 1,
2248
+
2249
+ width: 0,
2250
+ height: 0,
2251
+
2252
+ /**
2253
+ * Set background color of the map.
2254
+ * @param {String} backgroundColor Background color in CSS format.
2255
+ */
2256
+ setBackgroundColor: function(backgroundColor) {
2257
+ this.container.css('background-color', backgroundColor);
2258
+ },
2259
+
2260
+ resize: function() {
2261
+ var curBaseScale = this.baseScale;
2262
+ if (this.width / this.height > this.defaultWidth / this.defaultHeight) {
2263
+ this.baseScale = this.height / this.defaultHeight;
2264
+ this.baseTransX = Math.abs(this.width - this.defaultWidth * this.baseScale) / (2 * this.baseScale);
2265
+ } else {
2266
+ this.baseScale = this.width / this.defaultWidth;
2267
+ this.baseTransY = Math.abs(this.height - this.defaultHeight * this.baseScale) / (2 * this.baseScale);
2268
+ }
2269
+ this.scale *= this.baseScale / curBaseScale;
2270
+ this.transX *= this.baseScale / curBaseScale;
2271
+ this.transY *= this.baseScale / curBaseScale;
2272
+ },
2273
+
2274
+ /**
2275
+ * Synchronize the size of the map with the size of the container. Suitable in situations where the size of the container is changed programmatically or container is shown after it became visible.
2276
+ */
2277
+ updateSize: function(){
2278
+ this.width = this.container.width();
2279
+ this.height = this.container.height();
2280
+ this.resize();
2281
+ this.canvas.setSize(this.width, this.height);
2282
+ this.applyTransform();
2283
+ },
2284
+
2285
+ /**
2286
+ * Reset all the series and show the map with the initial zoom.
2287
+ */
2288
+ reset: function() {
2289
+ var key,
2290
+ i;
2291
+
2292
+ for (key in this.series) {
2293
+ for (i = 0; i < this.series[key].length; i++) {
2294
+ this.series[key][i].clear();
2295
+ }
2296
+ }
2297
+ this.scale = this.baseScale;
2298
+ this.transX = this.baseTransX;
2299
+ this.transY = this.baseTransY;
2300
+ this.applyTransform();
2301
+ },
2302
+
2303
+ applyTransform: function() {
2304
+ var maxTransX,
2305
+ maxTransY,
2306
+ minTransX,
2307
+ minTransY;
2308
+
2309
+ if (this.defaultWidth * this.scale <= this.width) {
2310
+ maxTransX = (this.width - this.defaultWidth * this.scale) / (2 * this.scale);
2311
+ minTransX = (this.width - this.defaultWidth * this.scale) / (2 * this.scale);
2312
+ } else {
2313
+ maxTransX = 0;
2314
+ minTransX = (this.width - this.defaultWidth * this.scale) / this.scale;
2315
+ }
2316
+
2317
+ if (this.defaultHeight * this.scale <= this.height) {
2318
+ maxTransY = (this.height - this.defaultHeight * this.scale) / (2 * this.scale);
2319
+ minTransY = (this.height - this.defaultHeight * this.scale) / (2 * this.scale);
2320
+ } else {
2321
+ maxTransY = 0;
2322
+ minTransY = (this.height - this.defaultHeight * this.scale) / this.scale;
2323
+ }
2324
+
2325
+ if (this.transY > maxTransY) {
2326
+ this.transY = maxTransY;
2327
+ } else if (this.transY < minTransY) {
2328
+ this.transY = minTransY;
2329
+ }
2330
+ if (this.transX > maxTransX) {
2331
+ this.transX = maxTransX;
2332
+ } else if (this.transX < minTransX) {
2333
+ this.transX = minTransX;
2334
+ }
2335
+
2336
+ this.canvas.applyTransformParams(this.scale, this.transX, this.transY);
2337
+
2338
+ if (this.markers) {
2339
+ this.repositionMarkers();
2340
+ }
2341
+
2342
+ this.repositionLabels();
2343
+
2344
+ this.container.trigger('viewportChange', [this.scale/this.baseScale, this.transX, this.transY]);
2345
+ },
2346
+
2347
+ bindContainerEvents: function(){
2348
+ var mouseDown = false,
2349
+ oldPageX,
2350
+ oldPageY,
2351
+ map = this;
2352
+
2353
+ if (this.params.panOnDrag) {
2354
+ this.container.mousemove(function(e){
2355
+ if (mouseDown) {
2356
+ map.transX -= (oldPageX - e.pageX) / map.scale;
2357
+ map.transY -= (oldPageY - e.pageY) / map.scale;
2358
+
2359
+ map.applyTransform();
2360
+
2361
+ oldPageX = e.pageX;
2362
+ oldPageY = e.pageY;
2363
+ }
2364
+ return false;
2365
+ }).mousedown(function(e){
2366
+ mouseDown = true;
2367
+ oldPageX = e.pageX;
2368
+ oldPageY = e.pageY;
2369
+ return false;
2370
+ });
2371
+
2372
+ this.onContainerMouseUp = function(){
2373
+ mouseDown = false;
2374
+ };
2375
+ jvm.$('body').mouseup(this.onContainerMouseUp);
2376
+ }
2377
+
2378
+ if (this.params.zoomOnScroll) {
2379
+ this.container.mousewheel(function(event, delta, deltaX, deltaY) {
2380
+ var offset = jvm.$(map.container).offset(),
2381
+ centerX = event.pageX - offset.left,
2382
+ centerY = event.pageY - offset.top,
2383
+ zoomStep = Math.pow(1 + map.params.zoomOnScrollSpeed / 1000, event.deltaFactor * event.deltaY);
2384
+
2385
+ map.tip.hide();
2386
+
2387
+ map.setScale(map.scale * zoomStep, centerX, centerY);
2388
+ event.preventDefault();
2389
+ });
2390
+ }
2391
+ },
2392
+
2393
+ bindContainerTouchEvents: function(){
2394
+ var touchStartScale,
2395
+ touchStartDistance,
2396
+ map = this,
2397
+ touchX,
2398
+ touchY,
2399
+ centerTouchX,
2400
+ centerTouchY,
2401
+ lastTouchesLength,
2402
+ handleTouchEvent = function(e){
2403
+ var touches = e.originalEvent.touches,
2404
+ offset,
2405
+ scale,
2406
+ transXOld,
2407
+ transYOld;
2408
+
2409
+ if (e.type == 'touchstart') {
2410
+ lastTouchesLength = 0;
2411
+ }
2412
+
2413
+ if (touches.length == 1) {
2414
+ if (lastTouchesLength == 1) {
2415
+ transXOld = map.transX;
2416
+ transYOld = map.transY;
2417
+ map.transX -= (touchX - touches[0].pageX) / map.scale;
2418
+ map.transY -= (touchY - touches[0].pageY) / map.scale;
2419
+ map.applyTransform();
2420
+ map.tip.hide();
2421
+ if (transXOld != map.transX || transYOld != map.transY) {
2422
+ e.preventDefault();
2423
+ }
2424
+ }
2425
+ touchX = touches[0].pageX;
2426
+ touchY = touches[0].pageY;
2427
+ } else if (touches.length == 2) {
2428
+ if (lastTouchesLength == 2) {
2429
+ scale = Math.sqrt(
2430
+ Math.pow(touches[0].pageX - touches[1].pageX, 2) +
2431
+ Math.pow(touches[0].pageY - touches[1].pageY, 2)
2432
+ ) / touchStartDistance;
2433
+ map.setScale(
2434
+ touchStartScale * scale,
2435
+ centerTouchX,
2436
+ centerTouchY
2437
+ )
2438
+ map.tip.hide();
2439
+ e.preventDefault();
2440
+ } else {
2441
+ offset = jvm.$(map.container).offset();
2442
+ if (touches[0].pageX > touches[1].pageX) {
2443
+ centerTouchX = touches[1].pageX + (touches[0].pageX - touches[1].pageX) / 2;
2444
+ } else {
2445
+ centerTouchX = touches[0].pageX + (touches[1].pageX - touches[0].pageX) / 2;
2446
+ }
2447
+ if (touches[0].pageY > touches[1].pageY) {
2448
+ centerTouchY = touches[1].pageY + (touches[0].pageY - touches[1].pageY) / 2;
2449
+ } else {
2450
+ centerTouchY = touches[0].pageY + (touches[1].pageY - touches[0].pageY) / 2;
2451
+ }
2452
+ centerTouchX -= offset.left;
2453
+ centerTouchY -= offset.top;
2454
+ touchStartScale = map.scale;
2455
+ touchStartDistance = Math.sqrt(
2456
+ Math.pow(touches[0].pageX - touches[1].pageX, 2) +
2457
+ Math.pow(touches[0].pageY - touches[1].pageY, 2)
2458
+ );
2459
+ }
2460
+ }
2461
+
2462
+ lastTouchesLength = touches.length;
2463
+ };
2464
+
2465
+ jvm.$(this.container).bind('touchstart', handleTouchEvent);
2466
+ jvm.$(this.container).bind('touchmove', handleTouchEvent);
2467
+ },
2468
+
2469
+ bindElementEvents: function(){
2470
+ var map = this,
2471
+ mouseMoved;
2472
+
2473
+ this.container.mousemove(function(){
2474
+ mouseMoved = true;
2475
+ });
2476
+
2477
+ /* Can not use common class selectors here because of the bug in jQuery
2478
+ SVG handling, use with caution. */
2479
+ this.container.delegate("[class~='jvectormap-element']", 'mouseover mouseout', function(e){
2480
+ var baseVal = jvm.$(this).attr('class').baseVal || jvm.$(this).attr('class'),
2481
+ type = baseVal.indexOf('jvectormap-region') === -1 ? 'marker' : 'region',
2482
+ code = type == 'region' ? jvm.$(this).attr('data-code') : jvm.$(this).attr('data-index'),
2483
+ element = type == 'region' ? map.regions[code].element : map.markers[code].element,
2484
+ tipText = type == 'region' ? map.mapData.paths[code].name : (map.markers[code].config.name || ''),
2485
+ tipShowEvent = jvm.$.Event(type+'TipShow.jvectormap'),
2486
+ overEvent = jvm.$.Event(type+'Over.jvectormap');
2487
+
2488
+ if (e.type == 'mouseover') {
2489
+ map.container.trigger(overEvent, [code]);
2490
+ if (!overEvent.isDefaultPrevented()) {
2491
+ element.setHovered(true);
2492
+ }
2493
+
2494
+ map.tip.text(tipText);
2495
+ map.container.trigger(tipShowEvent, [map.tip, code]);
2496
+ if (!tipShowEvent.isDefaultPrevented()) {
2497
+ map.tip.show();
2498
+ map.tipWidth = map.tip.width();
2499
+ map.tipHeight = map.tip.height();
2500
+ }
2501
+ } else {
2502
+ element.setHovered(false);
2503
+ map.tip.hide();
2504
+ map.container.trigger(type+'Out.jvectormap', [code]);
2505
+ }
2506
+ });
2507
+
2508
+ /* Can not use common class selectors here because of the bug in jQuery
2509
+ SVG handling, use with caution. */
2510
+ this.container.delegate("[class~='jvectormap-element']", 'mousedown', function(){
2511
+ mouseMoved = false;
2512
+ });
2513
+
2514
+ /* Can not use common class selectors here because of the bug in jQuery
2515
+ SVG handling, use with caution. */
2516
+ this.container.delegate("[class~='jvectormap-element']", 'mouseup', function(){
2517
+ var baseVal = jvm.$(this).attr('class').baseVal ? jvm.$(this).attr('class').baseVal : jvm.$(this).attr('class'),
2518
+ type = baseVal.indexOf('jvectormap-region') === -1 ? 'marker' : 'region',
2519
+ code = type == 'region' ? jvm.$(this).attr('data-code') : jvm.$(this).attr('data-index'),
2520
+ clickEvent = jvm.$.Event(type+'Click.jvectormap'),
2521
+ element = type == 'region' ? map.regions[code].element : map.markers[code].element;
2522
+
2523
+ if (!mouseMoved) {
2524
+ map.container.trigger(clickEvent, [code]);
2525
+ if ((type === 'region' && map.params.regionsSelectable) || (type === 'marker' && map.params.markersSelectable)) {
2526
+ if (!clickEvent.isDefaultPrevented()) {
2527
+ if (map.params[type+'sSelectableOne']) {
2528
+ map.clearSelected(type+'s');
2529
+ }
2530
+ element.setSelected(!element.isSelected);
2531
+ }
2532
+ }
2533
+ }
2534
+ });
2535
+ },
2536
+
2537
+ bindZoomButtons: function() {
2538
+ var map = this;
2539
+
2540
+ jvm.$('<div/>').addClass('jvectormap-zoomin').text('+').appendTo(this.container);
2541
+ jvm.$('<div/>').addClass('jvectormap-zoomout').html('&#x2212;').appendTo(this.container);
2542
+
2543
+ this.container.find('.jvectormap-zoomin').click(function(){
2544
+ map.setScale(map.scale * map.params.zoomStep, map.width / 2, map.height / 2, false, map.params.zoomAnimate);
2545
+ });
2546
+ this.container.find('.jvectormap-zoomout').click(function(){
2547
+ map.setScale(map.scale / map.params.zoomStep, map.width / 2, map.height / 2, false, map.params.zoomAnimate);
2548
+ });
2549
+ },
2550
+
2551
+ createTip: function(){
2552
+ var map = this;
2553
+
2554
+ this.tip = jvm.$('<div/>').addClass('jvectormap-tip').appendTo(jvm.$('body'));
2555
+
2556
+ this.container.mousemove(function(e){
2557
+ var left = e.pageX-15-map.tipWidth,
2558
+ top = e.pageY-15-map.tipHeight;
2559
+
2560
+ if (left < 5) {
2561
+ left = e.pageX + 15;
2562
+ }
2563
+ if (top < 5) {
2564
+ top = e.pageY + 15;
2565
+ }
2566
+
2567
+ map.tip.css({
2568
+ left: left,
2569
+ top: top
2570
+ });
2571
+ });
2572
+ },
2573
+
2574
+ setScale: function(scale, anchorX, anchorY, isCentered, animate) {
2575
+ var viewportChangeEvent = jvm.$.Event('zoom.jvectormap'),
2576
+ interval,
2577
+ that = this,
2578
+ i = 0,
2579
+ count = Math.abs(Math.round((scale - this.scale) * 60 / Math.max(scale, this.scale))),
2580
+ scaleStart,
2581
+ scaleDiff,
2582
+ transXStart,
2583
+ transXDiff,
2584
+ transYStart,
2585
+ transYDiff,
2586
+ transX,
2587
+ transY,
2588
+ deferred = new jvm.$.Deferred();
2589
+
2590
+ if (scale > this.params.zoomMax * this.baseScale) {
2591
+ scale = this.params.zoomMax * this.baseScale;
2592
+ } else if (scale < this.params.zoomMin * this.baseScale) {
2593
+ scale = this.params.zoomMin * this.baseScale;
2594
+ }
2595
+
2596
+ if (typeof anchorX != 'undefined' && typeof anchorY != 'undefined') {
2597
+ zoomStep = scale / this.scale;
2598
+ if (isCentered) {
2599
+ transX = anchorX + this.defaultWidth * (this.width / (this.defaultWidth * scale)) / 2;
2600
+ transY = anchorY + this.defaultHeight * (this.height / (this.defaultHeight * scale)) / 2;
2601
+ } else {
2602
+ transX = this.transX - (zoomStep - 1) / scale * anchorX;
2603
+ transY = this.transY - (zoomStep - 1) / scale * anchorY;
2604
+ }
2605
+ }
2606
+
2607
+ if (animate && count > 0) {
2608
+ scaleStart = this.scale;
2609
+ scaleDiff = (scale - scaleStart) / count;
2610
+ transXStart = this.transX * this.scale;
2611
+ transYStart = this.transY * this.scale;
2612
+ transXDiff = (transX * scale - transXStart) / count;
2613
+ transYDiff = (transY * scale - transYStart) / count;
2614
+ interval = setInterval(function(){
2615
+ i += 1;
2616
+ that.scale = scaleStart + scaleDiff * i;
2617
+ that.transX = (transXStart + transXDiff * i) / that.scale;
2618
+ that.transY = (transYStart + transYDiff * i) / that.scale;
2619
+ that.applyTransform();
2620
+ if (i == count) {
2621
+ clearInterval(interval);
2622
+ that.container.trigger(viewportChangeEvent, [scale/that.baseScale]);
2623
+ deferred.resolve();
2624
+ }
2625
+ }, 10);
2626
+ } else {
2627
+ this.transX = transX;
2628
+ this.transY = transY;
2629
+ this.scale = scale;
2630
+ this.applyTransform();
2631
+ this.container.trigger(viewportChangeEvent, [scale/this.baseScale]);
2632
+ deferred.resolve();
2633
+ }
2634
+
2635
+ return deferred;
2636
+ },
2637
+
2638
+ /**
2639
+ * Set the map's viewport to the specific point and set zoom of the map to the specific level. Point and zoom level could be defined in two ways: using the code of some region to focus on or a central point and zoom level as numbers.
2640
+ * @param This method takes a configuration object as the single argument. The options passed to it are the following:
2641
+ * @param {Array} params.regions Array of region codes to zoom to.
2642
+ * @param {String} params.region Region code to zoom to.
2643
+ * @param {Number} params.scale Map scale to set.
2644
+ * @param {Number} params.lat Latitude to set viewport to.
2645
+ * @param {Number} params.lng Longitude to set viewport to.
2646
+ * @param {Number} params.x Number from 0 to 1 specifying the horizontal coordinate of the central point of the viewport.
2647
+ * @param {Number} params.y Number from 0 to 1 specifying the vertical coordinate of the central point of the viewport.
2648
+ * @param {Boolean} params.animate Indicates whether or not to animate the scale change and transition.
2649
+ */
2650
+ setFocus: function(config){
2651
+ var bbox,
2652
+ itemBbox,
2653
+ newBbox,
2654
+ codes,
2655
+ i,
2656
+ point;
2657
+
2658
+ config = config || {};
2659
+
2660
+ if (config.region) {
2661
+ codes = [config.region];
2662
+ } else if (config.regions) {
2663
+ codes = config.regions;
2664
+ }
2665
+
2666
+ if (codes) {
2667
+ for (i = 0; i < codes.length; i++) {
2668
+ if (this.regions[codes[i]]) {
2669
+ itemBbox = this.regions[codes[i]].element.shape.getBBox();
2670
+ if (itemBbox) {
2671
+ if (typeof bbox == 'undefined') {
2672
+ bbox = itemBbox;
2673
+ } else {
2674
+ newBbox = {
2675
+ x: Math.min(bbox.x, itemBbox.x),
2676
+ y: Math.min(bbox.y, itemBbox.y),
2677
+ width: Math.max(bbox.x + bbox.width, itemBbox.x + itemBbox.width) - Math.min(bbox.x, itemBbox.x),
2678
+ height: Math.max(bbox.y + bbox.height, itemBbox.y + itemBbox.height) - Math.min(bbox.y, itemBbox.y)
2679
+ }
2680
+ bbox = newBbox;
2681
+ }
2682
+ }
2683
+ }
2684
+ }
2685
+ return this.setScale(
2686
+ Math.min(this.width / bbox.width, this.height / bbox.height),
2687
+ - (bbox.x + bbox.width / 2),
2688
+ - (bbox.y + bbox.height / 2),
2689
+ true,
2690
+ config.animate
2691
+ );
2692
+ } else {
2693
+ if (config.lat && config.lng) {
2694
+ point = this.latLngToPoint(config.lat, config.lng);
2695
+ config.x = this.transX - point.x / this.scale;
2696
+ config.y = this.transY - point.y / this.scale;
2697
+ } else if (config.x && config.y) {
2698
+ config.x *= -this.defaultWidth;
2699
+ config.y *= -this.defaultHeight;
2700
+ }
2701
+ return this.setScale(config.scale * this.baseScale, config.x, config.y, true, config.animate);
2702
+ }
2703
+ },
2704
+
2705
+ getSelected: function(type){
2706
+ var key,
2707
+ selected = [];
2708
+
2709
+ for (key in this[type]) {
2710
+ if (this[type][key].element.isSelected) {
2711
+ selected.push(key);
2712
+ }
2713
+ }
2714
+ return selected;
2715
+ },
2716
+
2717
+ /**
2718
+ * Return the codes of currently selected regions.
2719
+ * @returns {Array}
2720
+ */
2721
+ getSelectedRegions: function(){
2722
+ return this.getSelected('regions');
2723
+ },
2724
+
2725
+ /**
2726
+ * Return the codes of currently selected markers.
2727
+ * @returns {Array}
2728
+ */
2729
+ getSelectedMarkers: function(){
2730
+ return this.getSelected('markers');
2731
+ },
2732
+
2733
+ setSelected: function(type, keys){
2734
+ var i;
2735
+
2736
+ if (typeof keys != 'object') {
2737
+ keys = [keys];
2738
+ }
2739
+
2740
+ if (jvm.$.isArray(keys)) {
2741
+ for (i = 0; i < keys.length; i++) {
2742
+ this[type][keys[i]].element.setSelected(true);
2743
+ }
2744
+ } else {
2745
+ for (i in keys) {
2746
+ this[type][i].element.setSelected(!!keys[i]);
2747
+ }
2748
+ }
2749
+ },
2750
+
2751
+ /**
2752
+ * Set or remove selected state for the regions.
2753
+ * @param {String|Array|Object} keys If <code>String</code> or <code>Array</code> the region(s) with the corresponding code(s) will be selected. If <code>Object</code> was provided its keys are codes of regions, state of which should be changed. Selected state will be set if value is true, removed otherwise.
2754
+ */
2755
+ setSelectedRegions: function(keys){
2756
+ this.setSelected('regions', keys);
2757
+ },
2758
+
2759
+ /**
2760
+ * Set or remove selected state for the markers.
2761
+ * @param {String|Array|Object} keys If <code>String</code> or <code>Array</code> the marker(s) with the corresponding code(s) will be selected. If <code>Object</code> was provided its keys are codes of markers, state of which should be changed. Selected state will be set if value is true, removed otherwise.
2762
+ */
2763
+ setSelectedMarkers: function(keys){
2764
+ this.setSelected('markers', keys);
2765
+ },
2766
+
2767
+ clearSelected: function(type){
2768
+ var select = {},
2769
+ selected = this.getSelected(type),
2770
+ i;
2771
+
2772
+ for (i = 0; i < selected.length; i++) {
2773
+ select[selected[i]] = false;
2774
+ };
2775
+
2776
+ this.setSelected(type, select);
2777
+ },
2778
+
2779
+ /**
2780
+ * Remove the selected state from all the currently selected regions.
2781
+ */
2782
+ clearSelectedRegions: function(){
2783
+ this.clearSelected('regions');
2784
+ },
2785
+
2786
+ /**
2787
+ * Remove the selected state from all the currently selected markers.
2788
+ */
2789
+ clearSelectedMarkers: function(){
2790
+ this.clearSelected('markers');
2791
+ },
2792
+
2793
+ /**
2794
+ * Return the instance of Map. Useful when instantiated as a jQuery plug-in.
2795
+ * @returns {Map}
2796
+ */
2797
+ getMapObject: function(){
2798
+ return this;
2799
+ },
2800
+
2801
+ /**
2802
+ * Return the name of the region by region code.
2803
+ * @returns {String}
2804
+ */
2805
+ getRegionName: function(code){
2806
+ return this.mapData.paths[code].name;
2807
+ },
2808
+
2809
+ createRegions: function(){
2810
+ var key,
2811
+ region,
2812
+ map = this;
2813
+
2814
+ this.regionLabelsGroup = this.regionLabelsGroup || this.canvas.addGroup();
2815
+
2816
+ for (key in this.mapData.paths) {
2817
+ region = new jvm.Region({
2818
+ map: this,
2819
+ path: this.mapData.paths[key].path,
2820
+ code: key,
2821
+ style: jvm.$.extend(true, {}, this.params.regionStyle),
2822
+ labelStyle: jvm.$.extend(true, {}, this.params.regionLabelStyle),
2823
+ canvas: this.canvas,
2824
+ labelsGroup: this.regionLabelsGroup,
2825
+ label: this.canvas.mode != 'vml' ? (this.params.labels && this.params.labels.regions) : null
2826
+ });
2827
+
2828
+ jvm.$(region.shape).bind('selected', function(e, isSelected){
2829
+ map.container.trigger('regionSelected.jvectormap', [jvm.$(this.node).attr('data-code'), isSelected, map.getSelectedRegions()]);
2830
+ });
2831
+ this.regions[key] = {
2832
+ element: region,
2833
+ config: this.mapData.paths[key]
2834
+ };
2835
+ }
2836
+ },
2837
+
2838
+ createMarkers: function(markers) {
2839
+ var i,
2840
+ marker,
2841
+ point,
2842
+ markerConfig,
2843
+ markersArray,
2844
+ map = this;
2845
+
2846
+ this.markersGroup = this.markersGroup || this.canvas.addGroup();
2847
+ this.markerLabelsGroup = this.markerLabelsGroup || this.canvas.addGroup();
2848
+
2849
+ if (jvm.$.isArray(markers)) {
2850
+ markersArray = markers.slice();
2851
+ markers = {};
2852
+ for (i = 0; i < markersArray.length; i++) {
2853
+ markers[i] = markersArray[i];
2854
+ }
2855
+ }
2856
+
2857
+ for (i in markers) {
2858
+ markerConfig = markers[i] instanceof Array ? {latLng: markers[i]} : markers[i];
2859
+ point = this.getMarkerPosition( markerConfig );
2860
+
2861
+ if (point !== false) {
2862
+ marker = new jvm.Marker({
2863
+ map: this,
2864
+ style: jvm.$.extend(true, {}, this.params.markerStyle, {initial: markerConfig.style || {}}),
2865
+ labelStyle: jvm.$.extend(true, {}, this.params.markerLabelStyle),
2866
+ index: i,
2867
+ cx: point.x,
2868
+ cy: point.y,
2869
+ group: this.markersGroup,
2870
+ canvas: this.canvas,
2871
+ labelsGroup: this.markerLabelsGroup,
2872
+ label: this.canvas.mode != 'vml' ? (this.params.labels && this.params.labels.markers) : null
2873
+ });
2874
+
2875
+ jvm.$(marker.shape).bind('selected', function(e, isSelected){
2876
+ map.container.trigger('markerSelected.jvectormap', [jvm.$(this.node).attr('data-index'), isSelected, map.getSelectedMarkers()]);
2877
+ });
2878
+ if (this.markers[i]) {
2879
+ this.removeMarkers([i]);
2880
+ }
2881
+ this.markers[i] = {element: marker, config: markerConfig};
2882
+ }
2883
+ }
2884
+ },
2885
+
2886
+ repositionMarkers: function() {
2887
+ var i,
2888
+ point;
2889
+
2890
+ for (i in this.markers) {
2891
+ point = this.getMarkerPosition( this.markers[i].config );
2892
+ if (point !== false) {
2893
+ this.markers[i].element.setStyle({cx: point.x, cy: point.y});
2894
+ }
2895
+ }
2896
+ },
2897
+
2898
+ repositionLabels: function() {
2899
+ var key;
2900
+
2901
+ for (key in this.regions) {
2902
+ this.regions[key].element.updateLabelPosition();
2903
+ }
2904
+
2905
+ for (key in this.markers) {
2906
+ this.markers[key].element.updateLabelPosition();
2907
+ }
2908
+ },
2909
+
2910
+ getMarkerPosition: function(markerConfig) {
2911
+ if (jvm.Map.maps[this.params.map].projection) {
2912
+ return this.latLngToPoint.apply(this, markerConfig.latLng || [0, 0]);
2913
+ } else {
2914
+ return {
2915
+ x: markerConfig.coords[0]*this.scale + this.transX*this.scale,
2916
+ y: markerConfig.coords[1]*this.scale + this.transY*this.scale
2917
+ };
2918
+ }
2919
+ },
2920
+
2921
+ /**
2922
+ * Add one marker to the map.
2923
+ * @param {String} key Marker unique code.
2924
+ * @param {Object} marker Marker configuration parameters.
2925
+ * @param {Array} seriesData Values to add to the data series.
2926
+ */
2927
+ addMarker: function(key, marker, seriesData){
2928
+ var markers = {},
2929
+ data = [],
2930
+ values,
2931
+ i,
2932
+ seriesData = seriesData || [];
2933
+
2934
+ markers[key] = marker;
2935
+
2936
+ for (i = 0; i < seriesData.length; i++) {
2937
+ values = {};
2938
+ if (typeof seriesData[i] !== 'undefined') {
2939
+ values[key] = seriesData[i];
2940
+ }
2941
+ data.push(values);
2942
+ }
2943
+ this.addMarkers(markers, data);
2944
+ },
2945
+
2946
+ /**
2947
+ * Add set of marker to the map.
2948
+ * @param {Object|Array} markers Markers to add to the map. In case of array is provided, codes of markers will be set as string representations of array indexes.
2949
+ * @param {Array} seriesData Values to add to the data series.
2950
+ */
2951
+ addMarkers: function(markers, seriesData){
2952
+ var i;
2953
+
2954
+ seriesData = seriesData || [];
2955
+
2956
+ this.createMarkers(markers);
2957
+ for (i = 0; i < seriesData.length; i++) {
2958
+ this.series.markers[i].setValues(seriesData[i] || {});
2959
+ };
2960
+ },
2961
+
2962
+ /**
2963
+ * Remove some markers from the map.
2964
+ * @param {Array} markers Array of marker codes to be removed.
2965
+ */
2966
+ removeMarkers: function(markers){
2967
+ var i;
2968
+
2969
+ for (i = 0; i < markers.length; i++) {
2970
+ this.markers[ markers[i] ].element.remove();
2971
+ delete this.markers[ markers[i] ];
2972
+ };
2973
+ },
2974
+
2975
+ /**
2976
+ * Remove all markers from the map.
2977
+ */
2978
+ removeAllMarkers: function(){
2979
+ var i,
2980
+ markers = [];
2981
+
2982
+ for (i in this.markers) {
2983
+ markers.push(i);
2984
+ }
2985
+ this.removeMarkers(markers)
2986
+ },
2987
+
2988
+ /**
2989
+ * Converts coordinates expressed as latitude and longitude to the coordinates in pixels on the map.
2990
+ * @param {Number} lat Latitide of point in degrees.
2991
+ * @param {Number} lng Longitude of point in degrees.
2992
+ */
2993
+ latLngToPoint: function(lat, lng) {
2994
+ var point,
2995
+ proj = jvm.Map.maps[this.params.map].projection,
2996
+ centralMeridian = proj.centralMeridian,
2997
+ inset,
2998
+ bbox;
2999
+
3000
+ if (lng < (-180 + centralMeridian)) {
3001
+ lng += 360;
3002
+ }
3003
+
3004
+ point = jvm.Proj[proj.type](lat, lng, centralMeridian);
3005
+
3006
+ inset = this.getInsetForPoint(point.x, point.y);
3007
+ if (inset) {
3008
+ bbox = inset.bbox;
3009
+
3010
+ point.x = (point.x - bbox[0].x) / (bbox[1].x - bbox[0].x) * inset.width * this.scale;
3011
+ point.y = (point.y - bbox[0].y) / (bbox[1].y - bbox[0].y) * inset.height * this.scale;
3012
+
3013
+ return {
3014
+ x: point.x + this.transX*this.scale + inset.left*this.scale,
3015
+ y: point.y + this.transY*this.scale + inset.top*this.scale
3016
+ };
3017
+ } else {
3018
+ return false;
3019
+ }
3020
+ },
3021
+
3022
+ /**
3023
+ * Converts cartesian coordinates into coordinates expressed as latitude and longitude.
3024
+ * @param {Number} x X-axis of point on map in pixels.
3025
+ * @param {Number} y Y-axis of point on map in pixels.
3026
+ */
3027
+ pointToLatLng: function(x, y) {
3028
+ var proj = jvm.Map.maps[this.params.map].projection,
3029
+ centralMeridian = proj.centralMeridian,
3030
+ insets = jvm.Map.maps[this.params.map].insets,
3031
+ i,
3032
+ inset,
3033
+ bbox,
3034
+ nx,
3035
+ ny;
3036
+
3037
+ for (i = 0; i < insets.length; i++) {
3038
+ inset = insets[i];
3039
+ bbox = inset.bbox;
3040
+
3041
+ nx = x - (this.transX*this.scale + inset.left*this.scale);
3042
+ ny = y - (this.transY*this.scale + inset.top*this.scale);
3043
+
3044
+ nx = (nx / (inset.width * this.scale)) * (bbox[1].x - bbox[0].x) + bbox[0].x;
3045
+ ny = (ny / (inset.height * this.scale)) * (bbox[1].y - bbox[0].y) + bbox[0].y;
3046
+
3047
+ if (nx > bbox[0].x && nx < bbox[1].x && ny > bbox[0].y && ny < bbox[1].y) {
3048
+ return jvm.Proj[proj.type + '_inv'](nx, -ny, centralMeridian);
3049
+ }
3050
+ }
3051
+
3052
+ return false;
3053
+ },
3054
+
3055
+ getInsetForPoint: function(x, y){
3056
+ var insets = jvm.Map.maps[this.params.map].insets,
3057
+ i,
3058
+ bbox;
3059
+
3060
+ for (i = 0; i < insets.length; i++) {
3061
+ bbox = insets[i].bbox;
3062
+ if (x > bbox[0].x && x < bbox[1].x && y > bbox[0].y && y < bbox[1].y) {
3063
+ return insets[i];
3064
+ }
3065
+ }
3066
+ },
3067
+
3068
+ createSeries: function(){
3069
+ var i,
3070
+ key;
3071
+
3072
+ this.series = {
3073
+ markers: [],
3074
+ regions: []
3075
+ };
3076
+
3077
+ for (key in this.params.series) {
3078
+ for (i = 0; i < this.params.series[key].length; i++) {
3079
+ this.series[key][i] = new jvm.DataSeries(
3080
+ this.params.series[key][i],
3081
+ this[key],
3082
+ this
3083
+ );
3084
+ }
3085
+ }
3086
+ },
3087
+
3088
+ /**
3089
+ * Gracefully remove the map and and all its accessories, unbind event handlers.
3090
+ */
3091
+ remove: function(){
3092
+ this.tip.remove();
3093
+ this.container.remove();
3094
+ jvm.$(window).unbind('resize', this.onResize);
3095
+ jvm.$('body').unbind('mouseup', this.onContainerMouseUp);
3096
+ }
3097
+ };
3098
+
3099
+ jvm.Map.maps = {};
3100
+ jvm.Map.defaultParams = {
3101
+ map: 'world_mill_en',
3102
+ backgroundColor: '#505050',
3103
+ zoomButtons: true,
3104
+ zoomOnScroll: true,
3105
+ zoomOnScrollSpeed: 3,
3106
+ panOnDrag: true,
3107
+ zoomMax: 8,
3108
+ zoomMin: 1,
3109
+ zoomStep: 1.6,
3110
+ zoomAnimate: true,
3111
+ regionsSelectable: false,
3112
+ markersSelectable: false,
3113
+ bindTouchEvents: true,
3114
+ regionStyle: {
3115
+ initial: {
3116
+ fill: 'white',
3117
+ "fill-opacity": 1,
3118
+ stroke: 'none',
3119
+ "stroke-width": 0,
3120
+ "stroke-opacity": 1
3121
+ },
3122
+ hover: {
3123
+ "fill-opacity": 0.8,
3124
+ cursor: 'pointer'
3125
+ },
3126
+ selected: {
3127
+ fill: 'yellow'
3128
+ },
3129
+ selectedHover: {
3130
+ }
3131
+ },
3132
+ regionLabelStyle: {
3133
+ initial: {
3134
+ 'font-family': 'Verdana',
3135
+ 'font-size': '12',
3136
+ 'font-weight': 'bold',
3137
+ cursor: 'default',
3138
+ fill: 'black'
3139
+ },
3140
+ hover: {
3141
+ cursor: 'pointer'
3142
+ }
3143
+ },
3144
+ markerStyle: {
3145
+ initial: {
3146
+ fill: 'grey',
3147
+ stroke: '#505050',
3148
+ "fill-opacity": 1,
3149
+ "stroke-width": 1,
3150
+ "stroke-opacity": 1,
3151
+ r: 5
3152
+ },
3153
+ hover: {
3154
+ stroke: 'black',
3155
+ "stroke-width": 2,
3156
+ cursor: 'pointer'
3157
+ },
3158
+ selected: {
3159
+ fill: 'blue'
3160
+ },
3161
+ selectedHover: {
3162
+ }
3163
+ },
3164
+ markerLabelStyle: {
3165
+ initial: {
3166
+ 'font-family': 'Verdana',
3167
+ 'font-size': '12',
3168
+ 'font-weight': 'bold',
3169
+ cursor: 'default',
3170
+ fill: 'black'
3171
+ },
3172
+ hover: {
3173
+ cursor: 'pointer'
3174
+ }
3175
+ }
3176
+ };
3177
+ jvm.Map.apiEvents = {
3178
+ onRegionTipShow: 'regionTipShow',
3179
+ onRegionOver: 'regionOver',
3180
+ onRegionOut: 'regionOut',
3181
+ onRegionClick: 'regionClick',
3182
+ onRegionSelected: 'regionSelected',
3183
+ onMarkerTipShow: 'markerTipShow',
3184
+ onMarkerOver: 'markerOver',
3185
+ onMarkerOut: 'markerOut',
3186
+ onMarkerClick: 'markerClick',
3187
+ onMarkerSelected: 'markerSelected',
3188
+ onViewportChange: 'viewportChange'
3189
+ };
3190
+ /**
3191
+ * Creates map with drill-down functionality.
3192
+ * @constructor
3193
+ * @param {Object} params Parameters to initialize map with.
3194
+ * @param {Number} params.maxLevel Maximum number of levels user can go through
3195
+ * @param {Object} params.main Config of the main map. See <a href="./jvm-map/">jvm.Map</a> for more information.
3196
+ * @param {Function} params.mapNameByCode Function go generate map name by region code. Default value is:
3197
+ <pre>
3198
+ function(code, multiMap) {
3199
+ return code.toLowerCase()+'_'+
3200
+ multiMap.defaultProjection+'_en';
3201
+ }
3202
+ </pre>
3203
+ * @param {Function} params.mapUrlByCode Function to generate map url by region code. Default value is:
3204
+ <pre>
3205
+ function(code, multiMap){
3206
+ return 'jquery-jvectormap-data-'+
3207
+ code.toLowerCase()+'-'+
3208
+ multiMap.defaultProjection+'-en.js';
3209
+ }
3210
+ </pre>
3211
+ */
3212
+ jvm.MultiMap = function(params) {
3213
+ var that = this;
3214
+
3215
+ this.maps = {};
3216
+ this.params = jvm.$.extend(true, {}, jvm.MultiMap.defaultParams, params);
3217
+ this.params.maxLevel = this.params.maxLevel || Number.MAX_VALUE;
3218
+ this.params.main = this.params.main || {};
3219
+ this.params.main.multiMapLevel = 0;
3220
+ this.history = [ this.addMap(this.params.main.map, this.params.main) ];
3221
+ this.defaultProjection = this.history[0].mapData.projection.type;
3222
+ this.mapsLoaded = {};
3223
+
3224
+ this.params.container.css({position: 'relative'});
3225
+ this.backButton = jvm.$('<div/>').addClass('jvectormap-goback').text('Back').appendTo(this.params.container);
3226
+ this.backButton.hide();
3227
+ this.backButton.click(function(){
3228
+ that.goBack();
3229
+ });
3230
+
3231
+ this.spinner = jvm.$('<div/>').addClass('jvectormap-spinner').appendTo(this.params.container);
3232
+ this.spinner.hide();
3233
+ };
3234
+
3235
+ jvm.MultiMap.prototype = {
3236
+ addMap: function(name, config){
3237
+ var cnt = jvm.$('<div/>').css({
3238
+ width: '100%',
3239
+ height: '100%'
3240
+ });
3241
+
3242
+ this.params.container.append(cnt);
3243
+
3244
+ this.maps[name] = new jvm.Map(jvm.$.extend(config, {container: cnt}));
3245
+ if (this.params.maxLevel > config.multiMapLevel) {
3246
+ this.maps[name].container.on('regionClick.jvectormap', {scope: this}, function(e, code){
3247
+ var multimap = e.data.scope,
3248
+ mapName = multimap.params.mapNameByCode(code, multimap);
3249
+
3250
+ if (!multimap.drillDownPromise || multimap.drillDownPromise.state() !== 'pending') {
3251
+ multimap.drillDown(mapName, code);
3252
+ }
3253
+ });
3254
+ }
3255
+
3256
+
3257
+ return this.maps[name];
3258
+ },
3259
+
3260
+ downloadMap: function(code){
3261
+ var that = this,
3262
+ deferred = jvm.$.Deferred();
3263
+
3264
+ if (!this.mapsLoaded[code]) {
3265
+ jvm.$.get(this.params.mapUrlByCode(code, this)).then(function(){
3266
+ that.mapsLoaded[code] = true;
3267
+ deferred.resolve();
3268
+ }, function(){
3269
+ deferred.reject();
3270
+ });
3271
+ } else {
3272
+ deferred.resolve();
3273
+ }
3274
+ return deferred;
3275
+ },
3276
+
3277
+ drillDown: function(name, code){
3278
+ var currentMap = this.history[this.history.length - 1],
3279
+ that = this,
3280
+ focusPromise = currentMap.setFocus({region: code, animate: true}),
3281
+ downloadPromise = this.downloadMap(code);
3282
+
3283
+ focusPromise.then(function(){
3284
+ if (downloadPromise.state() === 'pending') {
3285
+ that.spinner.show();
3286
+ }
3287
+ });
3288
+ downloadPromise.always(function(){
3289
+ that.spinner.hide();
3290
+ });
3291
+ this.drillDownPromise = jvm.$.when(downloadPromise, focusPromise);
3292
+ this.drillDownPromise.then(function(){
3293
+ currentMap.params.container.hide();
3294
+ if (!that.maps[name]) {
3295
+ that.addMap(name, {map: name, multiMapLevel: currentMap.params.multiMapLevel + 1});
3296
+ } else {
3297
+ that.maps[name].params.container.show();
3298
+ }
3299
+ that.history.push( that.maps[name] );
3300
+ that.backButton.show();
3301
+ });
3302
+ },
3303
+
3304
+ goBack: function(){
3305
+ var currentMap = this.history.pop(),
3306
+ prevMap = this.history[this.history.length - 1],
3307
+ that = this;
3308
+
3309
+ currentMap.setFocus({scale: 1, x: 0.5, y: 0.5, animate: true}).then(function(){
3310
+ currentMap.params.container.hide();
3311
+ prevMap.params.container.show();
3312
+ prevMap.updateSize();
3313
+ if (that.history.length === 1) {
3314
+ that.backButton.hide();
3315
+ }
3316
+ prevMap.setFocus({scale: 1, x: 0.5, y: 0.5, animate: true});
3317
+ });
3318
+ }
3319
+ };
3320
+
3321
+ jvm.MultiMap.defaultParams = {
3322
+ mapNameByCode: function(code, multiMap){
3323
+ return code.toLowerCase()+'_'+multiMap.defaultProjection+'_en';
3324
+ },
3325
+ mapUrlByCode: function(code, multiMap){
3326
+ return 'jquery-jvectormap-data-'+code.toLowerCase()+'-'+multiMap.defaultProjection+'-en.js';
3327
+ }
3328
+ }