@cloudbase/weda-ui 0.2.15 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/README.md +41 -169
  2. package/package.json +28 -15
  3. package/src/configs/components/calendar.json +78 -0
  4. package/src/configs/components/carousel.json +273 -0
  5. package/src/configs/components/chart/bar.json +724 -0
  6. package/src/configs/components/chart/line.json +679 -0
  7. package/src/configs/components/chart/pie.json +497 -0
  8. package/src/configs/components/chart/statisticsCard.json +379 -0
  9. package/src/configs/components/container.json +7 -2
  10. package/src/configs/components/dataView.json +154 -0
  11. package/src/configs/components/form/checkbox.json +97 -5
  12. package/src/configs/components/form/location.json +152 -0
  13. package/src/configs/components/form/radio.json +96 -4
  14. package/src/configs/components/form/select.json +245 -11
  15. package/src/configs/components/form/uploaderFile.json +2 -1
  16. package/src/configs/components/graphicCard.json +410 -0
  17. package/src/configs/components/image.json +7 -2
  18. package/src/configs/components/link.json +20 -4
  19. package/src/configs/components/listView.json +277 -0
  20. package/src/configs/components/modal.json +37 -5
  21. package/src/configs/components/navLayout.json +362 -0
  22. package/src/configs/components/navigationBar.json +59 -0
  23. package/src/configs/components/richtextview.json +4 -1
  24. package/src/configs/components/scrollVeiw.json +74 -22
  25. package/src/configs/components/swiper.json +6 -3
  26. package/src/configs/components/tabs.json +51 -8
  27. package/src/configs/components/text.json +33 -25
  28. package/src/configs/components/wxOpenApi/phone.json +141 -0
  29. package/src/configs/components/wxOpenApi/phoneCode.json +121 -0
  30. package/src/configs/components/wxOpenApi/share.json +167 -0
  31. package/src/configs/components/wxOpenApi/userInfo.json +174 -0
  32. package/src/configs/index.js +34 -0
  33. package/src/mp/components/button/index.js +12 -13
  34. package/src/mp/components/button/index.wxml +1 -1
  35. package/src/mp/components/calendar/arrowright--line.svg +11 -0
  36. package/src/mp/components/calendar/index.js +238 -0
  37. package/src/mp/components/calendar/index.json +4 -0
  38. package/src/mp/components/calendar/index.wxml +37 -0
  39. package/src/mp/components/calendar/index.wxss +178 -0
  40. package/src/mp/components/carousel/index.js +88 -0
  41. package/src/mp/components/carousel/index.json +7 -0
  42. package/src/mp/components/carousel/index.wxml +6 -0
  43. package/src/mp/components/chart/bar/index.js +258 -0
  44. package/src/mp/components/chart/bar/index.json +6 -0
  45. package/src/mp/components/chart/bar/index.wxml +3 -0
  46. package/src/mp/components/chart/bar/index.wxss +9 -0
  47. package/src/mp/components/chart/common/config/bar.js +50 -0
  48. package/src/mp/components/chart/common/config/global.js +16 -0
  49. package/src/mp/components/chart/common/config/line.js +48 -0
  50. package/src/mp/components/chart/common/config/pie.js +36 -0
  51. package/src/mp/components/chart/common/core/eChartBar.js +263 -0
  52. package/src/mp/components/chart/common/core/eChartBase.js +375 -0
  53. package/src/mp/components/chart/common/core/eChartLine.js +229 -0
  54. package/src/mp/components/chart/common/core/eChartPie.js +166 -0
  55. package/src/mp/components/chart/common/lib/echarts.min.js +18 -0
  56. package/src/mp/components/chart/ec-canvas/ec-canvas.js +277 -0
  57. package/src/mp/components/chart/ec-canvas/ec-canvas.json +4 -0
  58. package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +4 -0
  59. package/src/mp/components/chart/ec-canvas/ec-canvas.wxss +4 -0
  60. package/src/mp/components/chart/ec-canvas/wx-canvas.js +107 -0
  61. package/src/mp/components/chart/line/index.js +247 -0
  62. package/src/mp/components/chart/line/index.json +6 -0
  63. package/src/mp/components/chart/line/index.wxml +3 -0
  64. package/src/mp/components/chart/line/index.wxss +9 -0
  65. package/src/mp/components/chart/pie/index.js +182 -0
  66. package/src/mp/components/chart/pie/index.json +6 -0
  67. package/src/mp/components/chart/pie/index.wxml +4 -0
  68. package/src/mp/components/chart/pie/index.wxss +9 -0
  69. package/src/mp/components/chart/statisticsCard/index.js +253 -0
  70. package/src/mp/components/chart/statisticsCard/index.json +4 -0
  71. package/src/mp/components/chart/statisticsCard/index.wxml +9 -0
  72. package/src/mp/components/chart/statisticsCard/index.wxss +45 -0
  73. package/src/mp/components/dataView/index.js +34 -0
  74. package/src/mp/components/dataView/index.json +7 -0
  75. package/src/mp/components/dataView/index.wxml +15 -0
  76. package/src/mp/components/dataView/index.wxss +0 -0
  77. package/src/mp/components/form/checkbox/index.js +41 -2
  78. package/src/mp/components/form/checkbox/index.wxml +1 -1
  79. package/src/mp/components/form/input/index.js +1 -1
  80. package/src/mp/components/form/location/components/mapChoose/index.js +201 -0
  81. package/src/mp/components/form/location/components/mapChoose/index.json +4 -0
  82. package/src/mp/components/form/location/components/mapChoose/index.wxml +42 -0
  83. package/src/mp/components/form/location/components/mapChoose/index.wxss +188 -0
  84. package/src/mp/components/form/location/index.js +382 -0
  85. package/src/mp/components/form/location/index.json +6 -0
  86. package/src/mp/components/form/location/index.wxml +25 -0
  87. package/src/mp/components/form/location/index.wxss +91 -0
  88. package/src/mp/components/form/radio/index.js +38 -0
  89. package/src/mp/components/form/select/index.js +360 -40
  90. package/src/mp/components/form/select/index.wxml +21 -6
  91. package/src/mp/components/form/select/region/index.js +98 -0
  92. package/src/mp/components/form/textarea/index.wxml +6 -5
  93. package/src/mp/components/form/uploader/index.js +84 -48
  94. package/src/mp/components/form/uploader/index.wxml +15 -3
  95. package/src/mp/components/form/uploaderFile/index.js +106 -27
  96. package/src/mp/components/graphicCard/chevron-right.svg +3 -0
  97. package/src/mp/components/graphicCard/index.js +203 -0
  98. package/src/mp/components/graphicCard/index.json +4 -0
  99. package/src/mp/components/graphicCard/index.wxml +29 -0
  100. package/src/mp/components/graphicCard/index.wxss +157 -0
  101. package/src/mp/components/image/index.js +0 -1
  102. package/src/mp/components/listView/arrow-right-line.svg +3 -0
  103. package/src/mp/components/listView/index.js +285 -0
  104. package/src/mp/components/listView/index.json +4 -0
  105. package/src/mp/components/listView/index.wxml +40 -0
  106. package/src/mp/components/listView/index.wxss +155 -0
  107. package/src/mp/components/listView/more-line.svg +3 -0
  108. package/src/mp/components/navLayout/index.js +123 -0
  109. package/src/mp/components/navLayout/index.json +7 -0
  110. package/src/mp/components/navLayout/index.wxml +25 -0
  111. package/src/mp/components/navLayout/index.wxss +1193 -0
  112. package/src/mp/components/navigationBar/index.js +193 -0
  113. package/src/mp/components/navigationBar/index.json +6 -0
  114. package/src/mp/components/navigationBar/index.wxml +88 -0
  115. package/src/mp/components/navigationBar/index.wxss +1257 -0
  116. package/src/mp/components/swiper/index.wxml +2 -0
  117. package/src/mp/components/tabs/index.js +7 -2
  118. package/src/mp/components/tabs/index.wxml +2 -1
  119. package/src/mp/components/text/index.js +0 -25
  120. package/src/mp/components/text/index.wxml +3 -3
  121. package/src/mp/components/wxOpenApi/phone/index.js +117 -0
  122. package/src/mp/components/wxOpenApi/phone/index.json +4 -0
  123. package/src/mp/components/wxOpenApi/phone/index.wxml +15 -0
  124. package/src/mp/components/wxOpenApi/phone/index.wxss +22 -0
  125. package/src/mp/components/wxOpenApi/phoneCode/index.js +89 -0
  126. package/src/mp/components/wxOpenApi/phoneCode/index.json +4 -0
  127. package/src/mp/components/wxOpenApi/phoneCode/index.wxml +15 -0
  128. package/src/mp/components/wxOpenApi/phoneCode/index.wxss +22 -0
  129. package/src/mp/components/wxOpenApi/share/index.js +117 -0
  130. package/src/mp/components/wxOpenApi/share/index.json +4 -0
  131. package/src/mp/components/wxOpenApi/share/index.wxml +15 -0
  132. package/src/mp/components/wxOpenApi/share/index.wxss +22 -0
  133. package/src/mp/components/wxOpenApi/userInfo/index.js +88 -0
  134. package/src/mp/components/wxOpenApi/userInfo/index.json +4 -0
  135. package/src/mp/components/wxOpenApi/userInfo/index.wxml +14 -0
  136. package/src/mp/components/wxOpenApi/userInfo/index.wxss +22 -0
  137. package/src/mp/index.json +18 -2
  138. package/src/mp/style/weda-ui.wxss +2 -0
  139. package/src/mp/utils/debounce.js +133 -0
  140. package/src/mp/utils/destr.js +48 -0
  141. package/src/mp/utils/dr_square_point.js +25 -0
  142. package/src/mp/utils/platform.js +25 -0
  143. package/src/mp/utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js +1336 -0
  144. package/src/mp/utils/spark-md5.js +776 -0
  145. package/src/mp/utils/tcb.js +62 -0
  146. package/src/setupTests.js +2 -1
  147. package/src/web/components/button/index.css +8 -1
  148. package/src/web/components/button/index.tsx +3 -2
  149. package/src/web/components/calendar/index.css +382 -0
  150. package/src/web/components/calendar/index.jsx +312 -0
  151. package/src/web/components/calendar/util.js +90 -0
  152. package/src/web/components/carousel/index.css +119 -0
  153. package/src/web/components/carousel/index.tsx +417 -0
  154. package/src/web/components/chart/bar/index.tsx +140 -0
  155. package/src/web/components/chart/common/config/bar.js +49 -0
  156. package/src/web/components/chart/common/config/global.js +16 -0
  157. package/src/web/components/chart/common/config/line.js +50 -0
  158. package/src/web/components/chart/common/config/pie.js +37 -0
  159. package/src/web/components/chart/common/core/eChartBar.js +265 -0
  160. package/src/web/components/chart/common/core/eChartBase.ts +383 -0
  161. package/src/web/components/chart/common/core/eChartLine.js +231 -0
  162. package/src/web/components/chart/common/core/eChartPie.js +170 -0
  163. package/src/web/components/chart/common/core/type.ts +34 -0
  164. package/src/web/components/chart/common/echart.css +106 -0
  165. package/src/web/components/chart/common/echarts.ts +33 -0
  166. package/src/web/components/chart/common/useChart.tsx +69 -0
  167. package/src/web/components/chart/line/index.tsx +136 -0
  168. package/src/web/components/chart/pie/index.tsx +99 -0
  169. package/src/web/components/chart/statisticsCard/index.css +62 -0
  170. package/src/web/components/chart/statisticsCard/index.tsx +307 -0
  171. package/src/web/components/chart/statisticsCard/interface.ts +14 -0
  172. package/src/web/components/dataView/index.tsx +20 -0
  173. package/src/web/components/dataView/interface.ts +6 -0
  174. package/src/web/components/form/checkbox/index.tsx +55 -23
  175. package/src/web/components/form/location/common/mapChoose.css +178 -0
  176. package/src/web/components/form/location/common/mapChoose.jsx +343 -0
  177. package/src/web/components/form/location/common/mapView.jsx +190 -0
  178. package/src/web/components/form/location/common/propsConfig.js +54 -0
  179. package/src/web/components/form/location/common/selectModal.css +44 -0
  180. package/src/web/components/form/location/common/selectModal.jsx +82 -0
  181. package/src/web/components/form/location/common/useLocationInfo.js +100 -0
  182. package/src/web/components/form/location/components/LocationH5/index.css +243 -0
  183. package/src/web/components/form/location/components/LocationH5/location.h5.jsx +403 -0
  184. package/src/web/components/form/location/components/LocationPC/Header.jsx +109 -0
  185. package/src/web/components/form/location/components/LocationPC/index.css +44 -0
  186. package/src/web/components/form/location/components/LocationPC/location.PC.jsx +323 -0
  187. package/src/web/components/form/location/constants.js +4 -0
  188. package/src/web/components/form/location/index.css +0 -0
  189. package/src/web/components/form/location/index.jsx +25 -0
  190. package/src/web/components/form/radio/index.tsx +84 -53
  191. package/src/web/components/form/select/h5.tsx +389 -71
  192. package/src/web/components/form/select/index.css +10 -0
  193. package/src/web/components/form/select/index.tsx +404 -144
  194. package/src/web/components/form/select/region/index.ts +122 -31
  195. package/src/web/components/form/select/time.jsx +90 -0
  196. package/src/web/components/form/select/year.tsx +170 -0
  197. package/src/web/components/form/uploader/uploader.h5.tsx +19 -4
  198. package/src/web/components/form/uploader/uploader.pc.tsx +8 -7
  199. package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +132 -113
  200. package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +16 -11
  201. package/src/web/components/graphicCard/index.css +159 -0
  202. package/src/web/components/graphicCard/index.tsx +310 -0
  203. package/src/web/components/image/image.tsx +1 -2
  204. package/src/web/components/image/index.tsx +1 -1
  205. package/src/web/components/index.js +24 -2
  206. package/src/web/components/link/index.tsx +6 -3
  207. package/src/web/components/listView/arrow-right-line.svg +3 -0
  208. package/src/web/components/listView/index.css +143 -0
  209. package/src/web/components/listView/index.tsx +359 -0
  210. package/src/web/components/listView/interface.ts +98 -0
  211. package/src/web/components/modal/index.tsx +3 -1
  212. package/src/web/components/navLayout/index.css +332 -0
  213. package/src/web/components/navLayout/index.tsx +247 -0
  214. package/src/web/components/navigationBar/chevron-right--double.svg +3 -0
  215. package/src/web/components/navigationBar/common.tsx +198 -0
  216. package/src/web/components/navigationBar/h5Menu.tsx +179 -0
  217. package/src/web/components/navigationBar/horizontalMenu.tsx +200 -0
  218. package/src/web/components/navigationBar/index.css +762 -0
  219. package/src/web/components/navigationBar/index.tsx +231 -0
  220. package/src/web/components/navigationBar/type.d.ts +111 -0
  221. package/src/web/components/navigationBar/verticalMenu.tsx +81 -0
  222. package/src/web/components/phone/index.css +0 -0
  223. package/src/web/components/phone/index.tsx +22 -0
  224. package/src/web/components/phoneCode/index.css +0 -0
  225. package/src/web/components/phoneCode/index.tsx +22 -0
  226. package/src/web/components/richTextView/index.tsx +3 -5
  227. package/src/web/components/share/index.css +0 -0
  228. package/src/web/components/share/index.tsx +38 -0
  229. package/src/web/components/tabs/index.tsx +4 -2
  230. package/src/web/components/tabs/tabs.h5.tsx +50 -37
  231. package/src/web/components/tabs/tabs.pc.tsx +23 -10
  232. package/src/web/components/text/index.tsx +6 -14
  233. package/src/web/components/uploaderFileView/index.css +9 -9
  234. package/src/web/components/uploaderFileView/index.jsx +32 -23
  235. package/src/web/components/userInfo/index.css +0 -0
  236. package/src/web/components/userInfo/index.tsx +30 -0
  237. package/src/web/types.d.ts +15 -14
  238. package/src/web/utils/debounce.js +98 -0
  239. package/src/web/utils/platform.js +40 -0
  240. package/src/web/utils/tcb.js +49 -0
  241. package/src/web/utils/tmap.js +4 -0
  242. package/src/web/weda-ui.css +2 -0
  243. package/CHANGELOG.md +0 -240
  244. package/src/.DS_Store +0 -0
  245. package/src/configs/.DS_Store +0 -0
  246. package/src/mp/.gitignore +0 -10
  247. package/src/web/.DS_Store +0 -0
  248. package/src/web/components/form/select/region/cities.ts +0 -2410
  249. package/src/web/components/form/select/region/provinces.ts +0 -240
  250. package/src/web/components/form/select/region/regions.ts +0 -20645
@@ -0,0 +1,776 @@
1
+ (function (factory) {
2
+ if (typeof exports === 'object') {
3
+ // Node/CommonJS
4
+ module.exports = factory();
5
+ }
6
+ // else if (typeof define === 'function' && define.amd) {
7
+ // // AMD
8
+ // define(factory);
9
+ // }
10
+ else {
11
+ // Browser globals (with support for web workers)
12
+ var glob;
13
+
14
+ try {
15
+ glob = window;
16
+ } catch (e) {
17
+ glob = self;
18
+ }
19
+
20
+ glob.SparkMD5 = factory();
21
+ }
22
+ })(function (factory = undefined) {
23
+ // 'use strict';
24
+
25
+ /*
26
+ * Fastest md5 implementation around (JKM md5).
27
+ * Credits: Joseph Myers
28
+ *
29
+ * @see http://www.myersdaily.org/joseph/javascript/md5-text.html
30
+ * @see http://jsperf.com/md5-shootout/7
31
+ */
32
+
33
+ /* this function is much faster,
34
+ so if possible we use it. Some IEs
35
+ are the only ones I know of that
36
+ need the idiotic second function,
37
+ generated by an if clause. */
38
+ var add32 = function (a, b) {
39
+ return (a + b) & 0xffffffff;
40
+ },
41
+ hex_chr = [
42
+ '0',
43
+ '1',
44
+ '2',
45
+ '3',
46
+ '4',
47
+ '5',
48
+ '6',
49
+ '7',
50
+ '8',
51
+ '9',
52
+ 'a',
53
+ 'b',
54
+ 'c',
55
+ 'd',
56
+ 'e',
57
+ 'f',
58
+ ];
59
+
60
+ function cmn(q, a, b, x, s, t) {
61
+ a = add32(add32(a, q), add32(x, t));
62
+ return add32((a << s) | (a >>> (32 - s)), b);
63
+ }
64
+
65
+ function md5cycle(x, k) {
66
+ var a = x[0],
67
+ b = x[1],
68
+ c = x[2],
69
+ d = x[3];
70
+
71
+ a += (((b & c) | (~b & d)) + k[0] - 680876936) | 0;
72
+ a = (((a << 7) | (a >>> 25)) + b) | 0;
73
+ d += (((a & b) | (~a & c)) + k[1] - 389564586) | 0;
74
+ d = (((d << 12) | (d >>> 20)) + a) | 0;
75
+ c += (((d & a) | (~d & b)) + k[2] + 606105819) | 0;
76
+ c = (((c << 17) | (c >>> 15)) + d) | 0;
77
+ b += (((c & d) | (~c & a)) + k[3] - 1044525330) | 0;
78
+ b = (((b << 22) | (b >>> 10)) + c) | 0;
79
+ a += (((b & c) | (~b & d)) + k[4] - 176418897) | 0;
80
+ a = (((a << 7) | (a >>> 25)) + b) | 0;
81
+ d += (((a & b) | (~a & c)) + k[5] + 1200080426) | 0;
82
+ d = (((d << 12) | (d >>> 20)) + a) | 0;
83
+ c += (((d & a) | (~d & b)) + k[6] - 1473231341) | 0;
84
+ c = (((c << 17) | (c >>> 15)) + d) | 0;
85
+ b += (((c & d) | (~c & a)) + k[7] - 45705983) | 0;
86
+ b = (((b << 22) | (b >>> 10)) + c) | 0;
87
+ a += (((b & c) | (~b & d)) + k[8] + 1770035416) | 0;
88
+ a = (((a << 7) | (a >>> 25)) + b) | 0;
89
+ d += (((a & b) | (~a & c)) + k[9] - 1958414417) | 0;
90
+ d = (((d << 12) | (d >>> 20)) + a) | 0;
91
+ c += (((d & a) | (~d & b)) + k[10] - 42063) | 0;
92
+ c = (((c << 17) | (c >>> 15)) + d) | 0;
93
+ b += (((c & d) | (~c & a)) + k[11] - 1990404162) | 0;
94
+ b = (((b << 22) | (b >>> 10)) + c) | 0;
95
+ a += (((b & c) | (~b & d)) + k[12] + 1804603682) | 0;
96
+ a = (((a << 7) | (a >>> 25)) + b) | 0;
97
+ d += (((a & b) | (~a & c)) + k[13] - 40341101) | 0;
98
+ d = (((d << 12) | (d >>> 20)) + a) | 0;
99
+ c += (((d & a) | (~d & b)) + k[14] - 1502002290) | 0;
100
+ c = (((c << 17) | (c >>> 15)) + d) | 0;
101
+ b += (((c & d) | (~c & a)) + k[15] + 1236535329) | 0;
102
+ b = (((b << 22) | (b >>> 10)) + c) | 0;
103
+
104
+ a += (((b & d) | (c & ~d)) + k[1] - 165796510) | 0;
105
+ a = (((a << 5) | (a >>> 27)) + b) | 0;
106
+ d += (((a & c) | (b & ~c)) + k[6] - 1069501632) | 0;
107
+ d = (((d << 9) | (d >>> 23)) + a) | 0;
108
+ c += (((d & b) | (a & ~b)) + k[11] + 643717713) | 0;
109
+ c = (((c << 14) | (c >>> 18)) + d) | 0;
110
+ b += (((c & a) | (d & ~a)) + k[0] - 373897302) | 0;
111
+ b = (((b << 20) | (b >>> 12)) + c) | 0;
112
+ a += (((b & d) | (c & ~d)) + k[5] - 701558691) | 0;
113
+ a = (((a << 5) | (a >>> 27)) + b) | 0;
114
+ d += (((a & c) | (b & ~c)) + k[10] + 38016083) | 0;
115
+ d = (((d << 9) | (d >>> 23)) + a) | 0;
116
+ c += (((d & b) | (a & ~b)) + k[15] - 660478335) | 0;
117
+ c = (((c << 14) | (c >>> 18)) + d) | 0;
118
+ b += (((c & a) | (d & ~a)) + k[4] - 405537848) | 0;
119
+ b = (((b << 20) | (b >>> 12)) + c) | 0;
120
+ a += (((b & d) | (c & ~d)) + k[9] + 568446438) | 0;
121
+ a = (((a << 5) | (a >>> 27)) + b) | 0;
122
+ d += (((a & c) | (b & ~c)) + k[14] - 1019803690) | 0;
123
+ d = (((d << 9) | (d >>> 23)) + a) | 0;
124
+ c += (((d & b) | (a & ~b)) + k[3] - 187363961) | 0;
125
+ c = (((c << 14) | (c >>> 18)) + d) | 0;
126
+ b += (((c & a) | (d & ~a)) + k[8] + 1163531501) | 0;
127
+ b = (((b << 20) | (b >>> 12)) + c) | 0;
128
+ a += (((b & d) | (c & ~d)) + k[13] - 1444681467) | 0;
129
+ a = (((a << 5) | (a >>> 27)) + b) | 0;
130
+ d += (((a & c) | (b & ~c)) + k[2] - 51403784) | 0;
131
+ d = (((d << 9) | (d >>> 23)) + a) | 0;
132
+ c += (((d & b) | (a & ~b)) + k[7] + 1735328473) | 0;
133
+ c = (((c << 14) | (c >>> 18)) + d) | 0;
134
+ b += (((c & a) | (d & ~a)) + k[12] - 1926607734) | 0;
135
+ b = (((b << 20) | (b >>> 12)) + c) | 0;
136
+
137
+ a += ((b ^ c ^ d) + k[5] - 378558) | 0;
138
+ a = (((a << 4) | (a >>> 28)) + b) | 0;
139
+ d += ((a ^ b ^ c) + k[8] - 2022574463) | 0;
140
+ d = (((d << 11) | (d >>> 21)) + a) | 0;
141
+ c += ((d ^ a ^ b) + k[11] + 1839030562) | 0;
142
+ c = (((c << 16) | (c >>> 16)) + d) | 0;
143
+ b += ((c ^ d ^ a) + k[14] - 35309556) | 0;
144
+ b = (((b << 23) | (b >>> 9)) + c) | 0;
145
+ a += ((b ^ c ^ d) + k[1] - 1530992060) | 0;
146
+ a = (((a << 4) | (a >>> 28)) + b) | 0;
147
+ d += ((a ^ b ^ c) + k[4] + 1272893353) | 0;
148
+ d = (((d << 11) | (d >>> 21)) + a) | 0;
149
+ c += ((d ^ a ^ b) + k[7] - 155497632) | 0;
150
+ c = (((c << 16) | (c >>> 16)) + d) | 0;
151
+ b += ((c ^ d ^ a) + k[10] - 1094730640) | 0;
152
+ b = (((b << 23) | (b >>> 9)) + c) | 0;
153
+ a += ((b ^ c ^ d) + k[13] + 681279174) | 0;
154
+ a = (((a << 4) | (a >>> 28)) + b) | 0;
155
+ d += ((a ^ b ^ c) + k[0] - 358537222) | 0;
156
+ d = (((d << 11) | (d >>> 21)) + a) | 0;
157
+ c += ((d ^ a ^ b) + k[3] - 722521979) | 0;
158
+ c = (((c << 16) | (c >>> 16)) + d) | 0;
159
+ b += ((c ^ d ^ a) + k[6] + 76029189) | 0;
160
+ b = (((b << 23) | (b >>> 9)) + c) | 0;
161
+ a += ((b ^ c ^ d) + k[9] - 640364487) | 0;
162
+ a = (((a << 4) | (a >>> 28)) + b) | 0;
163
+ d += ((a ^ b ^ c) + k[12] - 421815835) | 0;
164
+ d = (((d << 11) | (d >>> 21)) + a) | 0;
165
+ c += ((d ^ a ^ b) + k[15] + 530742520) | 0;
166
+ c = (((c << 16) | (c >>> 16)) + d) | 0;
167
+ b += ((c ^ d ^ a) + k[2] - 995338651) | 0;
168
+ b = (((b << 23) | (b >>> 9)) + c) | 0;
169
+
170
+ a += ((c ^ (b | ~d)) + k[0] - 198630844) | 0;
171
+ a = (((a << 6) | (a >>> 26)) + b) | 0;
172
+ d += ((b ^ (a | ~c)) + k[7] + 1126891415) | 0;
173
+ d = (((d << 10) | (d >>> 22)) + a) | 0;
174
+ c += ((a ^ (d | ~b)) + k[14] - 1416354905) | 0;
175
+ c = (((c << 15) | (c >>> 17)) + d) | 0;
176
+ b += ((d ^ (c | ~a)) + k[5] - 57434055) | 0;
177
+ b = (((b << 21) | (b >>> 11)) + c) | 0;
178
+ a += ((c ^ (b | ~d)) + k[12] + 1700485571) | 0;
179
+ a = (((a << 6) | (a >>> 26)) + b) | 0;
180
+ d += ((b ^ (a | ~c)) + k[3] - 1894986606) | 0;
181
+ d = (((d << 10) | (d >>> 22)) + a) | 0;
182
+ c += ((a ^ (d | ~b)) + k[10] - 1051523) | 0;
183
+ c = (((c << 15) | (c >>> 17)) + d) | 0;
184
+ b += ((d ^ (c | ~a)) + k[1] - 2054922799) | 0;
185
+ b = (((b << 21) | (b >>> 11)) + c) | 0;
186
+ a += ((c ^ (b | ~d)) + k[8] + 1873313359) | 0;
187
+ a = (((a << 6) | (a >>> 26)) + b) | 0;
188
+ d += ((b ^ (a | ~c)) + k[15] - 30611744) | 0;
189
+ d = (((d << 10) | (d >>> 22)) + a) | 0;
190
+ c += ((a ^ (d | ~b)) + k[6] - 1560198380) | 0;
191
+ c = (((c << 15) | (c >>> 17)) + d) | 0;
192
+ b += ((d ^ (c | ~a)) + k[13] + 1309151649) | 0;
193
+ b = (((b << 21) | (b >>> 11)) + c) | 0;
194
+ a += ((c ^ (b | ~d)) + k[4] - 145523070) | 0;
195
+ a = (((a << 6) | (a >>> 26)) + b) | 0;
196
+ d += ((b ^ (a | ~c)) + k[11] - 1120210379) | 0;
197
+ d = (((d << 10) | (d >>> 22)) + a) | 0;
198
+ c += ((a ^ (d | ~b)) + k[2] + 718787259) | 0;
199
+ c = (((c << 15) | (c >>> 17)) + d) | 0;
200
+ b += ((d ^ (c | ~a)) + k[9] - 343485551) | 0;
201
+ b = (((b << 21) | (b >>> 11)) + c) | 0;
202
+
203
+ x[0] = (a + x[0]) | 0;
204
+ x[1] = (b + x[1]) | 0;
205
+ x[2] = (c + x[2]) | 0;
206
+ x[3] = (d + x[3]) | 0;
207
+ }
208
+
209
+ function md5blk(s) {
210
+ var md5blks = [],
211
+ i; /* Andy King said do it this way. */
212
+
213
+ for (i = 0; i < 64; i += 4) {
214
+ md5blks[i >> 2] =
215
+ s.charCodeAt(i) +
216
+ (s.charCodeAt(i + 1) << 8) +
217
+ (s.charCodeAt(i + 2) << 16) +
218
+ (s.charCodeAt(i + 3) << 24);
219
+ }
220
+ return md5blks;
221
+ }
222
+
223
+ function md5blk_array(a) {
224
+ var md5blks = [],
225
+ i; /* Andy King said do it this way. */
226
+
227
+ for (i = 0; i < 64; i += 4) {
228
+ md5blks[i >> 2] =
229
+ a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);
230
+ }
231
+ return md5blks;
232
+ }
233
+
234
+ function md51(s) {
235
+ var n = s.length,
236
+ state = [1732584193, -271733879, -1732584194, 271733878],
237
+ i,
238
+ length,
239
+ tail,
240
+ tmp,
241
+ lo,
242
+ hi;
243
+
244
+ for (i = 64; i <= n; i += 64) {
245
+ md5cycle(state, md5blk(s.substring(i - 64, i)));
246
+ }
247
+ s = s.substring(i - 64);
248
+ length = s.length;
249
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
250
+ for (i = 0; i < length; i += 1) {
251
+ tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);
252
+ }
253
+ tail[i >> 2] |= 0x80 << (i % 4 << 3);
254
+ if (i > 55) {
255
+ md5cycle(state, tail);
256
+ for (i = 0; i < 16; i += 1) {
257
+ tail[i] = 0;
258
+ }
259
+ }
260
+
261
+ // Beware that the final length might not fit in 32 bits so we take care of that
262
+ tmp = n * 8;
263
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
264
+ lo = parseInt(tmp[2], 16);
265
+ hi = parseInt(tmp[1], 16) || 0;
266
+
267
+ tail[14] = lo;
268
+ tail[15] = hi;
269
+
270
+ md5cycle(state, tail);
271
+ return state;
272
+ }
273
+
274
+ function md51_array(a) {
275
+ var n = a.length,
276
+ state = [1732584193, -271733879, -1732584194, 271733878],
277
+ i,
278
+ length,
279
+ tail,
280
+ tmp,
281
+ lo,
282
+ hi;
283
+
284
+ for (i = 64; i <= n; i += 64) {
285
+ md5cycle(state, md5blk_array(a.subarray(i - 64, i)));
286
+ }
287
+
288
+ // Not sure if it is a bug, however IE10 will always produce a sub array of length 1
289
+ // containing the last element of the parent array if the sub array specified starts
290
+ // beyond the length of the parent array - weird.
291
+ // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue
292
+ a = i - 64 < n ? a.subarray(i - 64) : new Uint8Array(0);
293
+
294
+ length = a.length;
295
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
296
+ for (i = 0; i < length; i += 1) {
297
+ tail[i >> 2] |= a[i] << (i % 4 << 3);
298
+ }
299
+
300
+ tail[i >> 2] |= 0x80 << (i % 4 << 3);
301
+ if (i > 55) {
302
+ md5cycle(state, tail);
303
+ for (i = 0; i < 16; i += 1) {
304
+ tail[i] = 0;
305
+ }
306
+ }
307
+
308
+ // Beware that the final length might not fit in 32 bits so we take care of that
309
+ tmp = n * 8;
310
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
311
+ lo = parseInt(tmp[2], 16);
312
+ hi = parseInt(tmp[1], 16) || 0;
313
+
314
+ tail[14] = lo;
315
+ tail[15] = hi;
316
+
317
+ md5cycle(state, tail);
318
+
319
+ return state;
320
+ }
321
+
322
+ function rhex(n) {
323
+ var s = '',
324
+ j;
325
+ for (j = 0; j < 4; j += 1) {
326
+ s += hex_chr[(n >> (j * 8 + 4)) & 0x0f] + hex_chr[(n >> (j * 8)) & 0x0f];
327
+ }
328
+ return s;
329
+ }
330
+
331
+ function hex(x) {
332
+ var i;
333
+ for (i = 0; i < x.length; i += 1) {
334
+ x[i] = rhex(x[i]);
335
+ }
336
+ return x.join('');
337
+ }
338
+
339
+ // In some cases the fast add32 function cannot be used..
340
+ if (hex(md51('hello')) !== '5d41402abc4b2a76b9719d911017c592') {
341
+ add32 = function (x, y) {
342
+ var lsw = (x & 0xffff) + (y & 0xffff),
343
+ msw = (x >> 16) + (y >> 16) + (lsw >> 16);
344
+ return (msw << 16) | (lsw & 0xffff);
345
+ };
346
+ }
347
+
348
+ // ---------------------------------------------------
349
+
350
+ /**
351
+ * ArrayBuffer slice polyfill.
352
+ *
353
+ * @see https://github.com/ttaubert/node-arraybuffer-slice
354
+ */
355
+
356
+ if (typeof ArrayBuffer !== 'undefined' && !ArrayBuffer.prototype.slice) {
357
+ (function () {
358
+ function clamp(val, length) {
359
+ val = val | 0 || 0;
360
+
361
+ if (val < 0) {
362
+ return Math.max(val + length, 0);
363
+ }
364
+
365
+ return Math.min(val, length);
366
+ }
367
+
368
+ ArrayBuffer.prototype.slice = function (from, to) {
369
+ var length = this.byteLength,
370
+ begin = clamp(from, length),
371
+ end = length,
372
+ num,
373
+ target,
374
+ targetArray,
375
+ sourceArray;
376
+
377
+ if (to !== undefined) {
378
+ end = clamp(to, length);
379
+ }
380
+
381
+ if (begin > end) {
382
+ return new ArrayBuffer(0);
383
+ }
384
+
385
+ num = end - begin;
386
+ target = new ArrayBuffer(num);
387
+ targetArray = new Uint8Array(target);
388
+
389
+ sourceArray = new Uint8Array(this, begin, num);
390
+ targetArray.set(sourceArray);
391
+
392
+ return target;
393
+ };
394
+ })();
395
+ }
396
+
397
+ // ---------------------------------------------------
398
+
399
+ /**
400
+ * Helpers.
401
+ */
402
+
403
+ function toUtf8(str) {
404
+ if (/[\u0080-\uFFFF]/.test(str)) {
405
+ str = unescape(encodeURIComponent(str));
406
+ }
407
+
408
+ return str;
409
+ }
410
+
411
+ function utf8Str2ArrayBuffer(str, returnUInt8Array) {
412
+ var length = str.length,
413
+ buff = new ArrayBuffer(length),
414
+ arr = new Uint8Array(buff),
415
+ i;
416
+
417
+ for (i = 0; i < length; i += 1) {
418
+ arr[i] = str.charCodeAt(i);
419
+ }
420
+
421
+ return returnUInt8Array ? arr : buff;
422
+ }
423
+
424
+ function arrayBuffer2Utf8Str(buff) {
425
+ return String.fromCharCode.apply(null, new Uint8Array(buff));
426
+ }
427
+
428
+ function concatenateArrayBuffers(first, second, returnUInt8Array) {
429
+ var result = new Uint8Array(first.byteLength + second.byteLength);
430
+
431
+ result.set(new Uint8Array(first));
432
+ result.set(new Uint8Array(second), first.byteLength);
433
+
434
+ return returnUInt8Array ? result : result.buffer;
435
+ }
436
+
437
+ function hexToBinaryString(hex) {
438
+ var bytes = [],
439
+ length = hex.length,
440
+ x;
441
+
442
+ for (x = 0; x < length - 1; x += 2) {
443
+ bytes.push(parseInt(hex.substr(x, 2), 16));
444
+ }
445
+
446
+ return String.fromCharCode.apply(String, bytes);
447
+ }
448
+
449
+ // ---------------------------------------------------
450
+
451
+ /**
452
+ * SparkMD5 OOP implementation.
453
+ *
454
+ * Use this class to perform an incremental md5, otherwise use the
455
+ * static methods instead.
456
+ */
457
+
458
+ function SparkMD5() {
459
+ // call reset to init the instance
460
+ this.reset();
461
+ }
462
+
463
+ /**
464
+ * Appends a string.
465
+ * A conversion will be applied if an utf8 string is detected.
466
+ *
467
+ * @param {String} str The string to be appended
468
+ *
469
+ * @return {SparkMD5} The instance itself
470
+ */
471
+ SparkMD5.prototype.append = function (str) {
472
+ // Converts the string to utf8 bytes if necessary
473
+ // Then append as binary
474
+ this.appendBinary(toUtf8(str));
475
+
476
+ return this;
477
+ };
478
+
479
+ /**
480
+ * Appends a binary string.
481
+ *
482
+ * @param {String} contents The binary string to be appended
483
+ *
484
+ * @return {SparkMD5} The instance itself
485
+ */
486
+ SparkMD5.prototype.appendBinary = function (contents) {
487
+ this._buff += contents;
488
+ this._length += contents.length;
489
+
490
+ var length = this._buff.length,
491
+ i;
492
+
493
+ for (i = 64; i <= length; i += 64) {
494
+ md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));
495
+ }
496
+
497
+ this._buff = this._buff.substring(i - 64);
498
+
499
+ return this;
500
+ };
501
+
502
+ /**
503
+ * Finishes the incremental computation, reseting the internal state and
504
+ * returning the result.
505
+ *
506
+ * @param {Boolean} raw True to get the raw string, false to get the hex string
507
+ *
508
+ * @return {String} The result
509
+ */
510
+ SparkMD5.prototype.end = function (raw) {
511
+ var buff = this._buff,
512
+ length = buff.length,
513
+ i,
514
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
515
+ ret;
516
+
517
+ for (i = 0; i < length; i += 1) {
518
+ tail[i >> 2] |= buff.charCodeAt(i) << (i % 4 << 3);
519
+ }
520
+
521
+ this._finish(tail, length);
522
+ ret = hex(this._hash);
523
+
524
+ if (raw) {
525
+ ret = hexToBinaryString(ret);
526
+ }
527
+
528
+ this.reset();
529
+
530
+ return ret;
531
+ };
532
+
533
+ /**
534
+ * Resets the internal state of the computation.
535
+ *
536
+ * @return {SparkMD5} The instance itself
537
+ */
538
+ SparkMD5.prototype.reset = function () {
539
+ this._buff = '';
540
+ this._length = 0;
541
+ this._hash = [1732584193, -271733879, -1732584194, 271733878];
542
+
543
+ return this;
544
+ };
545
+
546
+ /**
547
+ * Gets the internal state of the computation.
548
+ *
549
+ * @return {Object} The state
550
+ */
551
+ SparkMD5.prototype.getState = function () {
552
+ return {
553
+ buff: this._buff,
554
+ length: this._length,
555
+ hash: this._hash,
556
+ };
557
+ };
558
+
559
+ /**
560
+ * Gets the internal state of the computation.
561
+ *
562
+ * @param {Object} state The state
563
+ *
564
+ * @return {SparkMD5} The instance itself
565
+ */
566
+ SparkMD5.prototype.setState = function (state) {
567
+ this._buff = state.buff;
568
+ this._length = state.length;
569
+ this._hash = state.hash;
570
+
571
+ return this;
572
+ };
573
+
574
+ /**
575
+ * Releases memory used by the incremental buffer and other additional
576
+ * resources. If you plan to use the instance again, use reset instead.
577
+ */
578
+ SparkMD5.prototype.destroy = function () {
579
+ delete this._hash;
580
+ delete this._buff;
581
+ delete this._length;
582
+ };
583
+
584
+ /**
585
+ * Finish the final calculation based on the tail.
586
+ *
587
+ * @param {Array} tail The tail (will be modified)
588
+ * @param {Number} length The length of the remaining buffer
589
+ */
590
+ SparkMD5.prototype._finish = function (tail, length) {
591
+ var i = length,
592
+ tmp,
593
+ lo,
594
+ hi;
595
+
596
+ tail[i >> 2] |= 0x80 << (i % 4 << 3);
597
+ if (i > 55) {
598
+ md5cycle(this._hash, tail);
599
+ for (i = 0; i < 16; i += 1) {
600
+ tail[i] = 0;
601
+ }
602
+ }
603
+
604
+ // Do the final computation based on the tail and length
605
+ // Beware that the final length may not fit in 32 bits so we take care of that
606
+ tmp = this._length * 8;
607
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
608
+ lo = parseInt(tmp[2], 16);
609
+ hi = parseInt(tmp[1], 16) || 0;
610
+
611
+ tail[14] = lo;
612
+ tail[15] = hi;
613
+ md5cycle(this._hash, tail);
614
+ };
615
+
616
+ /**
617
+ * Performs the md5 hash on a string.
618
+ * A conversion will be applied if utf8 string is detected.
619
+ *
620
+ * @param {String} str The string
621
+ * @param {Boolean} [raw] True to get the raw string, false to get the hex string
622
+ *
623
+ * @return {String} The result
624
+ */
625
+ SparkMD5.hash = function (str, raw) {
626
+ // Converts the string to utf8 bytes if necessary
627
+ // Then compute it using the binary function
628
+ return SparkMD5.hashBinary(toUtf8(str), raw);
629
+ };
630
+
631
+ /**
632
+ * Performs the md5 hash on a binary string.
633
+ *
634
+ * @param {String} content The binary string
635
+ * @param {Boolean} [raw] True to get the raw string, false to get the hex string
636
+ *
637
+ * @return {String} The result
638
+ */
639
+ SparkMD5.hashBinary = function (content, raw) {
640
+ var hash = md51(content),
641
+ ret = hex(hash);
642
+
643
+ return raw ? hexToBinaryString(ret) : ret;
644
+ };
645
+
646
+ // ---------------------------------------------------
647
+
648
+ /**
649
+ * SparkMD5 OOP implementation for array buffers.
650
+ *
651
+ * Use this class to perform an incremental md5 ONLY for array buffers.
652
+ */
653
+ SparkMD5.ArrayBuffer = function () {
654
+ // call reset to init the instance
655
+ this.reset();
656
+ };
657
+
658
+ /**
659
+ * Appends an array buffer.
660
+ *
661
+ * @param {ArrayBuffer} arr The array to be appended
662
+ *
663
+ * @return {SparkMD5.ArrayBuffer} The instance itself
664
+ */
665
+ SparkMD5.ArrayBuffer.prototype.append = function (arr) {
666
+ var buff = concatenateArrayBuffers(this._buff.buffer, arr, true),
667
+ length = buff.length,
668
+ i;
669
+
670
+ this._length += arr.byteLength;
671
+
672
+ for (i = 64; i <= length; i += 64) {
673
+ md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));
674
+ }
675
+
676
+ this._buff =
677
+ i - 64 < length
678
+ ? new Uint8Array(buff.buffer.slice(i - 64))
679
+ : new Uint8Array(0);
680
+
681
+ return this;
682
+ };
683
+
684
+ /**
685
+ * Finishes the incremental computation, reseting the internal state and
686
+ * returning the result.
687
+ *
688
+ * @param {Boolean} raw True to get the raw string, false to get the hex string
689
+ *
690
+ * @return {String} The result
691
+ */
692
+ SparkMD5.ArrayBuffer.prototype.end = function (raw) {
693
+ var buff = this._buff,
694
+ length = buff.length,
695
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
696
+ i,
697
+ ret;
698
+
699
+ for (i = 0; i < length; i += 1) {
700
+ tail[i >> 2] |= buff[i] << (i % 4 << 3);
701
+ }
702
+
703
+ this._finish(tail, length);
704
+ ret = hex(this._hash);
705
+
706
+ if (raw) {
707
+ ret = hexToBinaryString(ret);
708
+ }
709
+
710
+ this.reset();
711
+
712
+ return ret;
713
+ };
714
+
715
+ /**
716
+ * Resets the internal state of the computation.
717
+ *
718
+ * @return {SparkMD5.ArrayBuffer} The instance itself
719
+ */
720
+ SparkMD5.ArrayBuffer.prototype.reset = function () {
721
+ this._buff = new Uint8Array(0);
722
+ this._length = 0;
723
+ this._hash = [1732584193, -271733879, -1732584194, 271733878];
724
+
725
+ return this;
726
+ };
727
+
728
+ /**
729
+ * Gets the internal state of the computation.
730
+ *
731
+ * @return {Object} The state
732
+ */
733
+ SparkMD5.ArrayBuffer.prototype.getState = function () {
734
+ var state = SparkMD5.prototype.getState.call(this);
735
+
736
+ // Convert buffer to a string
737
+ state.buff = arrayBuffer2Utf8Str(state.buff);
738
+
739
+ return state;
740
+ };
741
+
742
+ /**
743
+ * Gets the internal state of the computation.
744
+ *
745
+ * @param {Object} state The state
746
+ *
747
+ * @return {SparkMD5.ArrayBuffer} The instance itself
748
+ */
749
+ SparkMD5.ArrayBuffer.prototype.setState = function (state) {
750
+ // Convert string to buffer
751
+ state.buff = utf8Str2ArrayBuffer(state.buff, true);
752
+
753
+ return SparkMD5.prototype.setState.call(this, state);
754
+ };
755
+
756
+ SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;
757
+
758
+ SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;
759
+
760
+ /**
761
+ * Performs the md5 hash on an array buffer.
762
+ *
763
+ * @param {ArrayBuffer} arr The array buffer
764
+ * @param {Boolean} [raw] True to get the raw string, false to get the hex one
765
+ *
766
+ * @return {String} The result
767
+ */
768
+ SparkMD5.ArrayBuffer.hash = function (arr, raw) {
769
+ var hash = md51_array(new Uint8Array(arr)),
770
+ ret = hex(hash);
771
+
772
+ return raw ? hexToBinaryString(ret) : ret;
773
+ };
774
+
775
+ return SparkMD5;
776
+ });