amos-tool 1.4.4 → 1.4.8

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 (100) hide show
  1. package/.prettierignore +2 -2
  2. package/.prettierrc +50 -50
  3. package/README.md +667 -653
  4. package/apis/objectPath.md +129 -129
  5. package/index.d.ts +50 -5
  6. package/index.js +3 -3
  7. package/lib/_browser.js +10 -8
  8. package/lib/_clone.js +67 -62
  9. package/lib/_cookie.js +35 -32
  10. package/lib/_deepCopy.js +17 -29
  11. package/lib/_deepEqual.js +6 -13
  12. package/lib/_fastDeepEqual.js +28 -44
  13. package/lib/_flashSupport.js +13 -10
  14. package/lib/_forOwn.js +8 -7
  15. package/lib/_funcThrottle.js +16 -15
  16. package/lib/_isnode.js +2 -1
  17. package/lib/_list.js +55 -67
  18. package/lib/_object.assign.js +14 -24
  19. package/lib/_object.entries.js +6 -5
  20. package/lib/_object.values.js +5 -4
  21. package/lib/_omit.js +12 -12
  22. package/lib/_parseJson.js +7 -6
  23. package/lib/_pick.js +14 -0
  24. package/lib/_queue.js +24 -21
  25. package/lib/_shallowCopy.js +24 -23
  26. package/lib/_stringify.js +14 -17
  27. package/lib/_supportWs.js +5 -5
  28. package/lib/_trim.js +5 -4
  29. package/lib/_typeOfList.js +22 -21
  30. package/lib/_uuids.js +30 -35
  31. package/lib/amostool.js +15 -63
  32. package/lib/array2tree.js +9 -10
  33. package/lib/arrayFilter.js +17 -20
  34. package/lib/arrayUtils.js +13 -11
  35. package/lib/browser/Cookie.js +34 -35
  36. package/lib/browser/indexDB.js +71 -82
  37. package/lib/browserSupport.js +76 -71
  38. package/lib/completeUnit.js +7 -4
  39. package/lib/consts.js +2 -1
  40. package/lib/dom/canvas2img.js +61 -73
  41. package/lib/dom/canvasTools.js +9 -14
  42. package/lib/dom/downloadFile.js +15 -12
  43. package/lib/dom/eventHelper.js +8 -6
  44. package/lib/dom/fileBlob.js +14 -14
  45. package/lib/dom/fileSaveAs.js +54 -61
  46. package/lib/dom/getFontSize.js +7 -10
  47. package/lib/dom/minfyImg.js +30 -25
  48. package/lib/encrypt/_base64.js +32 -25
  49. package/lib/encrypt/_md5.js +68 -31
  50. package/lib/encrypt/des.js +426 -363
  51. package/lib/extra/_common.js +119 -166
  52. package/lib/extra/filterNull.js +3 -2
  53. package/lib/extra/find.js +10 -11
  54. package/lib/extra/index.js +4 -3
  55. package/lib/extra/memo.js +18 -0
  56. package/lib/extra/pathToTree.js +48 -42
  57. package/lib/extra/pwdStrength.js +4 -2
  58. package/lib/extra/sortBy.js +28 -30
  59. package/lib/flat.js +15 -0
  60. package/lib/locationParams.js +94 -99
  61. package/lib/log.js +20 -26
  62. package/lib/math/_keyColor.js +154 -0
  63. package/lib/math/addition.js +9 -7
  64. package/lib/math/amountCase.js +8 -12
  65. package/lib/math/coinFormat.js +7 -5
  66. package/lib/math/colorUtil.js +96 -92
  67. package/lib/math/dateTime.js +76 -94
  68. package/lib/math/operations.js +33 -37
  69. package/lib/math/pwdStrength.js +4 -2
  70. package/lib/math/randomColor.js +17 -5
  71. package/lib/math/subtraction.js +10 -9
  72. package/lib/merged.js +9 -9
  73. package/lib/objectPath.js +88 -95
  74. package/lib/parseText.js +8 -7
  75. package/lib/png/Identicon.js +36 -38
  76. package/lib/png/pnglib.js +58 -32
  77. package/lib/png/randomPic.js +9 -12
  78. package/lib/positionFactory.js +25 -80
  79. package/lib/pwdPolicy.js +27 -31
  80. package/lib/qs/_assign.js +7 -5
  81. package/lib/qs/_merge.js +19 -28
  82. package/lib/qs/_tools.js +3 -2
  83. package/lib/qs/formats.js +6 -5
  84. package/lib/qs/index.js +4 -4
  85. package/lib/qs/parse.js +55 -50
  86. package/lib/qs/stringify.js +55 -77
  87. package/lib/qs/utils.js +69 -88
  88. package/lib/random.js +5 -4
  89. package/lib/shallowEqual.js +24 -34
  90. package/lib/store.js +93 -98
  91. package/lib/strUtils.js +51 -42
  92. package/lib/tableFilter.js +178 -169
  93. package/lib/throttleDebounce.js +18 -22
  94. package/lib/url/encodeUrl.js +5 -4
  95. package/lib/url/restfulUrl.js +8 -7
  96. package/lib/utils.js +169 -223
  97. package/lib/xss/htmlEncode.js +3 -2
  98. package/lib/xss/implementEncode.js +36 -37
  99. package/lib/xss/index.js +4 -3
  100. package/package.json +9 -8
@@ -1,23 +1,18 @@
1
1
  "use strict";
2
+
2
3
  var drawPolygon = function(t, o) {
3
- var a = o && o.x || 0,
4
- l = o && o.y || 0,
5
- e = o && o.num || 3,
6
- r = o && o.r || 100,
7
- i = o && o.width || 5,
8
- n = o && o.strokeStyle,
9
- h = o && o.fillStyle;
4
+ var a = o && o.x || 0, l = o && o.y || 0, e = o && o.num || 3, r = o && o.r || 100, i = o && o.width || 5, n = o && o.strokeStyle, h = o && o.fillStyle;
10
5
  t.beginPath();
11
- var s = a + r * Math.cos(2 * Math.PI * 0 / e),
12
- P = l + r * Math.sin(2 * Math.PI * 0 / e);
6
+ var s = a + r * Math.cos(2 * Math.PI * 0 / e), P = l + r * Math.sin(2 * Math.PI * 0 / e);
13
7
  t.moveTo(s, P);
14
8
  for (var y = 1; y <= e; y++) {
15
- var M = a + r * Math.cos(2 * Math.PI * y / e),
16
- d = l + r * Math.sin(2 * Math.PI * y / e);
17
- t.lineTo(M, d)
9
+ var M = a + r * Math.cos(2 * Math.PI * y / e), d = l + r * Math.sin(2 * Math.PI * y / e);
10
+ t.lineTo(M, d);
18
11
  }
19
- t.closePath(), n && (t.strokeStyle = n, t.lineWidth = i, t.lineJoin = "round", t.stroke()), h && (t.fillStyle = h, t.fill())
12
+ t.closePath(), n && (t.strokeStyle = n, t.lineWidth = i, t.lineJoin = "round", t.stroke()),
13
+ h && (t.fillStyle = h, t.fill());
20
14
  };
15
+
21
16
  module.exports = {
22
17
  drawPolygon: drawPolygon
23
- };
18
+ };
@@ -1,17 +1,20 @@
1
1
  "use strict";
2
- var objectAssign = require("./../_object.assign"),
3
- createTags = function(t) {
4
- return document.createElement(t)
5
- };
2
+
3
+ var objectAssign = require("./../_object.assign"), createTags = function(t) {
4
+ return document.createElement(t);
5
+ };
6
+
6
7
  module.exports = function(t) {
7
8
  var e = objectAssign({}, {
8
- method: "post"
9
- }, t),
10
- a = createTags("iframe");
9
+ method: "post"
10
+ }, t), a = createTags("iframe");
11
11
  a.setAttribute("id", "down-file-iframe");
12
- var r, i = createTags("form");
13
- for (var o in i.setAttribute("target", "down-file-iframe"), i.setAttribute("method", e.method), i.setAttribute("action", e.url), e.data) {
14
- Object.prototype.hasOwnProperty.call(e.data, o) && ((r = createTags("input")).setAttribute("type", "hidden"), r.setAttribute("name", o), r.value = e.data[o], i.appendChild(r))
12
+ var r = createTags("form");
13
+ for (var i in r.setAttribute("target", "down-file-iframe"), r.setAttribute("method", e.method),
14
+ r.setAttribute("action", e.url), e.data) if (Object.prototype.hasOwnProperty.call(e.data, i)) {
15
+ var o = createTags("input");
16
+ o.setAttribute("type", "hidden"), o.setAttribute("name", i), o.value = e.data[i],
17
+ r.appendChild(o);
15
18
  }
16
- a.appendChild(i), document.body.appendChild(a), i.submit(), a.remove()
17
- };
19
+ a.appendChild(r), document.body.appendChild(a), r.submit(), a.remove();
20
+ };
@@ -1,18 +1,20 @@
1
1
  "use strict";
2
+
2
3
  module.exports = {
3
4
  stopPropagation: function(e) {
4
- (e = e || window.event).stopPropagation(), void 0 !== e.cancelBubble && (e.cancelBubble = !0)
5
+ (e = e || window.event).stopPropagation(), void 0 !== e.cancelBubble && (e.cancelBubble = !0);
5
6
  },
6
7
  preventDefault: function(e) {
7
- e.preventDefault(), void 0 !== e.returnValue && (e.returnValue = !1)
8
+ e.preventDefault(), void 0 !== e.returnValue && (e.returnValue = !1);
8
9
  },
9
10
  stopEvent: function(e) {
10
- (e = e || window.event).stopPropagation(), void 0 !== e.cancelBubble && (e.cancelBubble = !0), e.preventDefault(), void 0 !== e.returnValue && (e.returnValue = !1)
11
+ (e = e || window.event).stopPropagation(), void 0 !== e.cancelBubble && (e.cancelBubble = !0),
12
+ e.preventDefault(), void 0 !== e.returnValue && (e.returnValue = !1);
11
13
  },
12
14
  addHandler: function(e, t, n) {
13
- e.addEventListener ? e.addEventListener(t, n, !1) : e.attachEvent && e.attachEvent("on" + t, n)
15
+ e.addEventListener ? e.addEventListener(t, n, !1) : e.attachEvent && e.attachEvent("on" + t, n);
14
16
  },
15
17
  removeHandler: function(e, t, n) {
16
- e.removeEventListener ? e.removeEventListener(t, n, !1) : e.detachEvent && e.detachEvent("on" + t, n)
18
+ e.removeEventListener ? e.removeEventListener(t, n, !1) : e.detachEvent && e.detachEvent("on" + t, n);
17
19
  }
18
- };
20
+ };
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
+
2
3
  var getArrayBuffer = function(e) {
3
- for (var r = e.length, t = new ArrayBuffer(r), i = new Uint8Array(t); r--;) i[r] = e.charCodeAt(r);
4
- return t
5
- },
6
- getFileBlob = function(e) {
7
- return new Blob([getArrayBuffer()], {
8
- type: e
9
- })
10
- },
11
- mimeType = {
12
- pdf: "application/pdf",
13
- png: "image/png",
14
- jpeg: "image/jpeg"
15
- };
4
+ for (var r = e.length, t = new ArrayBuffer(r), i = new Uint8Array(t); r--; ) i[r] = e.charCodeAt(r);
5
+ return t;
6
+ }, getFileBlob = function(e) {
7
+ return new Blob([ getArrayBuffer() ], {
8
+ type: e
9
+ });
10
+ }, mimeType = {
11
+ pdf: "application/pdf",
12
+ png: "image/png",
13
+ jpeg: "image/jpeg"
14
+ };
15
+
16
16
  module.exports = {
17
17
  getFileBlob: getFileBlob,
18
18
  mimeType: mimeType
19
- };
19
+ };
@@ -1,68 +1,61 @@
1
1
  "use strict";
2
- var _saveAs = function(c) {
3
- if (!(void 0 === c || "undefined" != typeof navigator && /MSIE [1-9]\./.test(navigator.userAgent))) {
4
- var e = c.document,
5
- d = function() {
6
- return c.URL || c.webkitURL || c
7
- },
8
- s = e.createElementNS("http://www.w3.org/1999/xhtml", "a"),
9
- u = "download" in s,
10
- f = /constructor/i.test(c.HTMLElement) || c.safari,
11
- l = /CriOS\/[\d]+/.test(navigator.userAgent),
12
- v = function(e) {
13
- setTimeout(function() {
14
- "string" == typeof e ? d().revokeObjectURL(e) : e.remove()
15
- }, 4e4)
16
- },
17
- p = function(e, t, n) {
18
- for (var o = (t = [].concat(t)).length; o--;) {
2
+
3
+ var _saveAs = function(e) {
4
+ if (!(void 0 === e || "undefined" != typeof navigator && /MSIE [1-9]\./.test(navigator.userAgent))) {
5
+ var t = e.document, n = function() {
6
+ return e.URL || e.webkitURL || e;
7
+ }, o = t.createElementNS("http://www.w3.org/1999/xhtml", "a"), r = "download" in o, a = /constructor/i.test(e.HTMLElement) || e.safari, i = /CriOS\/[\d]+/.test(navigator.userAgent), c = function(t) {
8
+ (e.setImmediate || e.setTimeout)((function() {
9
+ throw t;
10
+ }), 0);
11
+ }, d = function(e) {
12
+ setTimeout((function() {
13
+ "string" == typeof e ? n().revokeObjectURL(e) : e.remove();
14
+ }), 4e4);
15
+ }, s = function(e) {
16
+ return /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type) ? new Blob([ String.fromCharCode(65279), e ], {
17
+ type: e.type
18
+ }) : e;
19
+ }, f = function(t, f, u) {
20
+ u || (t = s(t));
21
+ var l, v = this, p = "application/octet-stream" === t.type, w = function() {
22
+ !function(e, t, n) {
23
+ for (var o = (t = [].concat(t)).length; o--; ) {
19
24
  var r = e["on" + t[o]];
20
25
  if ("function" == typeof r) try {
21
- r.call(e, n || e)
26
+ r.call(e, n || e);
22
27
  } catch (e) {
23
- ! function(e) {
24
- (c.setImmediate || c.setTimeout)(function() {
25
- throw e
26
- }, 0)
27
- }(e)
28
+ c(e);
28
29
  }
29
30
  }
30
- },
31
- w = function(e) {
32
- return /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type) ? new Blob([String.fromCharCode(65279), e], {
33
- type: e.type
34
- }) : e
35
- },
36
- o = function(e, n, t) {
37
- t || (e = w(e));
31
+ }(v, "writestart progress write writeend".split(" "));
32
+ };
33
+ if (v.readyState = v.INIT, r) return l = n().createObjectURL(t), void setTimeout((function() {
34
+ var e, t;
35
+ o.href = l, o.download = f, e = o, t = new MouseEvent("click"), e.dispatchEvent(t),
36
+ w(), d(l), v.readyState = v.DONE;
37
+ }));
38
+ !function() {
39
+ if ((i || p && a) && e.FileReader) {
40
+ var o = new FileReader;
41
+ return o.onloadend = function() {
42
+ var t = i ? o.result : o.result.replace(/^data:[^;]*;/, "data:attachment/file;");
43
+ e.open(t, "_blank") || (e.location.href = t), t = void 0, v.readyState = v.DONE,
44
+ w();
45
+ }, o.readAsDataURL(t), void (v.readyState = v.INIT);
46
+ }
47
+ (l || (l = n().createObjectURL(t)), p) ? e.location.href = l : e.open(l, "_blank") || (e.location.href = l);
48
+ v.readyState = v.DONE, w(), d(l);
49
+ }();
50
+ }, u = f.prototype;
51
+ return "undefined" != typeof navigator && navigator.msSaveOrOpenBlob ? function(e, t, n) {
52
+ return t = t || e.name || "download", n || (e = s(e)), navigator.msSaveOrOpenBlob(e, t);
53
+ } : (u.abort = function() {}, u.readyState = u.INIT = 0, u.WRITING = 1, u.DONE = 2,
54
+ u.error = u.onwritestart = u.onprogress = u.onwrite = u.onabort = u.onerror = u.onwriteend = null,
55
+ function(e, t, n) {
56
+ return new f(e, t || e.name || "download", n);
57
+ });
58
+ }
59
+ }, view = "undefined" != typeof self && self || "undefined" != typeof window && window || (void 0).content;
38
60
 
39
- function o() {
40
- p(a, "writestart progress write writeend".split(" "))
41
- }
42
- var r, a = this,
43
- i = "application/octet-stream" === e.type;
44
- if (a.readyState = a.INIT, u) return r = d().createObjectURL(e), void setTimeout(function() {
45
- var e, t;
46
- s.href = r, s.download = n, e = s, t = new MouseEvent("click"), e.dispatchEvent(t), o(), v(r), a.readyState = a.DONE
47
- });
48
- ! function() {
49
- if ((l || i && f) && c.FileReader) {
50
- var t = new FileReader;
51
- return t.onloadend = function() {
52
- var e = l ? t.result : t.result.replace(/^data:[^;]*;/, "data:attachment/file;");
53
- c.open(e, "_blank") || (c.location.href = e), e = void 0, a.readyState = a.DONE, o()
54
- }, t.readAsDataURL(e), a.readyState = a.INIT
55
- }
56
- r = r || d().createObjectURL(e), !i && c.open(r, "_blank") || (c.location.href = r), a.readyState = a.DONE, o(), v(r)
57
- }()
58
- },
59
- t = o.prototype;
60
- return "undefined" != typeof navigator && navigator.msSaveOrOpenBlob ? function(e, t, n) {
61
- return t = t || e.name || "download", n || (e = w(e)), navigator.msSaveOrOpenBlob(e, t)
62
- } : (t.abort = function() {}, t.readyState = t.INIT = 0, t.WRITING = 1, t.DONE = 2, t.error = t.onwritestart = t.onprogress = t.onwrite = t.onabort = t.onerror = t.onwriteend = null, function(e, t, n) {
63
- return new o(e, t || e.name || "download", n)
64
- })
65
- }
66
- },
67
- view = "undefined" != typeof self && self || "undefined" != typeof window && window || (void 0).content;
68
- module.exports = _saveAs(view);
61
+ module.exports = _saveAs(view);
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
+
2
3
  module.exports = function() {
3
- function e() {
4
- var e = i.clientWidth;
5
- e && (750 < e && (e = 750), i.style.fontSize = e / 750 * 100 + "px")
6
- }
7
- var n = document,
8
- t = window,
9
- i = n.documentElement,
10
- o = "orientationchange" in window ? "orientationchange" : "resize";
11
- t.addEventListener(o, e, !1), n.addEventListener("DOMContentLoaded", e, !1)
12
- };
4
+ var e = document, n = window, t = e.documentElement, i = "orientationchange" in window ? "orientationchange" : "resize", o = function() {
5
+ var e = t.clientWidth;
6
+ e && (e > 750 && (e = 750), t.style.fontSize = e / 750 * 100 + "px");
7
+ };
8
+ n.addEventListener(i, o, !1), e.addEventListener("DOMContentLoaded", o, !1);
9
+ };
@@ -1,28 +1,33 @@
1
1
  "use strict";
2
2
 
3
- function imageCompress(e, r, o) {
4
- var t, n, a;
5
- o = o || .92, t = e, n = function(e) {
6
- var t, n, a;
7
- t = e, n = function(e) {
8
- var t;
9
- t = function(e) {
10
- for (var t = atob(e.split(",")[1]), n = new ArrayBuffer(t.length), a = new Uint8Array(n), r = 0; r < t.length; r++) a[r] = t.charCodeAt(r);
11
- return new Blob([n], {
12
- type: "image/jpeg"
13
- })
14
- }(function(e) {
15
- var t = document.createElement("canvas"),
16
- n = e.width,
17
- a = e.height;
18
- return t.width = n, t.height = a, t.getContext("2d").drawImage(e, 0, 0, n, a), t.toDataURL("image/jpeg", o)
19
- }(e)), r(t)
20
- }, (a = new Image).onload = function() {
21
- n(a)
22
- }, a.src = t
23
- }, (a = new FileReader).onload = function() {
24
- var e = this.result;
25
- n(e)
26
- }, a.readAsDataURL(t)
3
+ function imageCompress(e, t, n) {
4
+ n || (n = .92), function(e, t) {
5
+ var n = new FileReader;
6
+ n.onload = function() {
7
+ var e = this.result;
8
+ t(e);
9
+ }, n.readAsDataURL(e);
10
+ }(e, (function(e) {
11
+ !function(e, t) {
12
+ var n = new Image;
13
+ n.onload = function() {
14
+ t(n);
15
+ }, n.src = e;
16
+ }(e, (function(e) {
17
+ !function(e) {
18
+ var a = function(e) {
19
+ for (var t = atob(e.split(",")[1]), n = new ArrayBuffer(t.length), a = new Uint8Array(n), r = 0; r < t.length; r++) a[r] = t.charCodeAt(r);
20
+ return new Blob([ n ], {
21
+ type: "image/jpeg"
22
+ });
23
+ }(function(e) {
24
+ var t = document.createElement("canvas"), a = e.width, r = e.height;
25
+ return t.width = a, t.height = r, t.getContext("2d").drawImage(e, 0, 0, a, r), t.toDataURL("image/jpeg", n);
26
+ }(e));
27
+ t(a);
28
+ }(e);
29
+ }));
30
+ }));
27
31
  }
28
- module.exports = imageCompress;
32
+
33
+ module.exports = imageCompress;
@@ -1,28 +1,35 @@
1
1
  "use strict";
2
- var utils = require("../utils"),
3
- Base64 = function() {
4
- var C = this,
5
- f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6
- this.encode = function(r) {
7
- var t, e, o, a, n, h, i, d = "",
8
- c = 0;
9
- for (utils.isString(r) || (r += ""), r = C._utf8_encode(r); c < r.length;) a = (t = r.charCodeAt(c++)) >> 2, n = (3 & t) << 4 | (e = r.charCodeAt(c++)) >> 4, h = (15 & e) << 2 | (o = r.charCodeAt(c++)) >> 6, i = 63 & o, isNaN(e) ? h = i = 64 : isNaN(o) && (i = 64), d = d + f.charAt(a) + f.charAt(n) + f.charAt(h) + f.charAt(i);
10
- return d
11
- }, this.decode = function(r) {
12
- var t, e, o, a, n, h, i = "",
13
- d = 0;
14
- for (r = r.replace(/[^A-Za-z0-9\+\/\=]/g, ""); d < r.length;) t = f.indexOf(r.charAt(d++)) << 2 | (a = f.indexOf(r.charAt(d++))) >> 4, e = (15 & a) << 4 | (n = f.indexOf(r.charAt(d++))) >> 2, o = (3 & n) << 6 | (h = f.indexOf(r.charAt(d++))), i += String.fromCharCode(t), 64 != n && (i += String.fromCharCode(e)), 64 != h && (i += String.fromCharCode(o));
15
- return i = C._utf8_decode(i)
16
- }, this._utf8_encode = function(r) {
17
- r = r.replace(/\r\n/g, "\n");
18
- for (var t = "", e = 0; e < r.length; e++) {
19
- var o = r.charCodeAt(e);
20
- o < 128 ? t += String.fromCharCode(o) : (127 < o && o < 2048 ? t += String.fromCharCode(o >> 6 | 192) : (t += String.fromCharCode(o >> 12 | 224), t += String.fromCharCode(o >> 6 & 63 | 128)), t += String.fromCharCode(63 & o | 128))
21
- }
22
- return t
23
- }, this._utf8_decode = function(r) {
24
- for (var t, e, o = "", a = 0, n = 0; a < r.length;)(t = r.charCodeAt(a)) < 128 ? (o += String.fromCharCode(t), a++) : 191 < t && t < 224 ? (n = r.charCodeAt(a + 1), o += String.fromCharCode((31 & t) << 6 | 63 & n), a += 2) : (n = r.charCodeAt(a + 1), e = r.charCodeAt(a + 2), o += String.fromCharCode((15 & t) << 12 | (63 & n) << 6 | 63 & e), a += 3);
25
- return o
2
+
3
+ var utils = require("../utils"), Base64 = function() {
4
+ var r = this, t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
5
+ this.encode = function(e) {
6
+ var o, a, n, h, i, d, C, c = "", f = 0;
7
+ for (utils.isString(e) || (e += ""), e = r._utf8_encode(e); f < e.length; ) h = (o = e.charCodeAt(f++)) >> 2,
8
+ i = (3 & o) << 4 | (a = e.charCodeAt(f++)) >> 4, d = (15 & a) << 2 | (n = e.charCodeAt(f++)) >> 6,
9
+ C = 63 & n, isNaN(a) ? d = C = 64 : isNaN(n) && (C = 64), c = c + t.charAt(h) + t.charAt(i) + t.charAt(d) + t.charAt(C);
10
+ return c;
11
+ }, this.decode = function(e) {
12
+ var o, a, n, h, i, d, C = "", c = 0;
13
+ for (e = e.replace(/[^A-Za-z0-9\+\/\=]/g, ""); c < e.length; ) o = t.indexOf(e.charAt(c++)) << 2 | (h = t.indexOf(e.charAt(c++))) >> 4,
14
+ a = (15 & h) << 4 | (i = t.indexOf(e.charAt(c++))) >> 2, n = (3 & i) << 6 | (d = t.indexOf(e.charAt(c++))),
15
+ C += String.fromCharCode(o), 64 != i && (C += String.fromCharCode(a)), 64 != d && (C += String.fromCharCode(n));
16
+ return C = r._utf8_decode(C);
17
+ }, this._utf8_encode = function(r) {
18
+ r = r.replace(/\r\n/g, "\n");
19
+ for (var t = "", e = 0; e < r.length; e++) {
20
+ var o = r.charCodeAt(e);
21
+ o < 128 ? t += String.fromCharCode(o) : o > 127 && o < 2048 ? (t += String.fromCharCode(o >> 6 | 192),
22
+ t += String.fromCharCode(63 & o | 128)) : (t += String.fromCharCode(o >> 12 | 224),
23
+ t += String.fromCharCode(o >> 6 & 63 | 128), t += String.fromCharCode(63 & o | 128));
26
24
  }
25
+ return t;
26
+ }, this._utf8_decode = function(r) {
27
+ for (var t = "", e = 0, o = 0, a = 0, n = 0; e < r.length; ) (o = r.charCodeAt(e)) < 128 ? (t += String.fromCharCode(o),
28
+ e++) : o > 191 && o < 224 ? (a = r.charCodeAt(e + 1), t += String.fromCharCode((31 & o) << 6 | 63 & a),
29
+ e += 2) : (a = r.charCodeAt(e + 1), n = r.charCodeAt(e + 2), t += String.fromCharCode((15 & o) << 12 | (63 & a) << 6 | 63 & n),
30
+ e += 3);
31
+ return t;
27
32
  };
28
- module.exports = Base64;
33
+ };
34
+
35
+ module.exports = Base64;
@@ -2,88 +2,125 @@
2
2
 
3
3
  function safeAdd(r, d) {
4
4
  var n = (65535 & r) + (65535 & d);
5
- return (r >> 16) + (d >> 16) + (n >> 16) << 16 | 65535 & n
5
+ return (r >> 16) + (d >> 16) + (n >> 16) << 16 | 65535 & n;
6
6
  }
7
7
 
8
8
  function bitRotateLeft(r, d) {
9
- return r << d | r >>> 32 - d
9
+ return r << d | r >>> 32 - d;
10
10
  }
11
11
 
12
12
  function md5cmn(r, d, n, t, m, f) {
13
- return safeAdd(bitRotateLeft(safeAdd(safeAdd(d, r), safeAdd(t, f)), m), n)
13
+ return safeAdd(bitRotateLeft(safeAdd(safeAdd(d, r), safeAdd(t, f)), m), n);
14
14
  }
15
15
 
16
16
  function md5ff(r, d, n, t, m, f, i) {
17
- return md5cmn(d & n | ~d & t, r, d, m, f, i)
17
+ return md5cmn(d & n | ~d & t, r, d, m, f, i);
18
18
  }
19
19
 
20
20
  function md5gg(r, d, n, t, m, f, i) {
21
- return md5cmn(d & t | n & ~t, r, d, m, f, i)
21
+ return md5cmn(d & t | n & ~t, r, d, m, f, i);
22
22
  }
23
23
 
24
24
  function md5hh(r, d, n, t, m, f, i) {
25
- return md5cmn(d ^ n ^ t, r, d, m, f, i)
25
+ return md5cmn(d ^ n ^ t, r, d, m, f, i);
26
26
  }
27
27
 
28
28
  function md5ii(r, d, n, t, m, f, i) {
29
- return md5cmn(n ^ (d | ~t), r, d, m, f, i)
29
+ return md5cmn(n ^ (d | ~t), r, d, m, f, i);
30
30
  }
31
31
 
32
32
  function binlMD5(r, d) {
33
- var n, t, m, f;
33
+ var n, t, m, f, i;
34
34
  r[d >> 5] |= 128 << d % 32, r[14 + (d + 64 >>> 9 << 4)] = d;
35
- for (var i = 1732584193, e = -271733879, h = -1732584194, g = 271733878, u = 0; u < r.length; u += 16) i = md5ff(n = i, t = e, m = h, f = g, r[u], 7, -680876936), g = md5ff(g, i, e, h, r[u + 1], 12, -389564586), h = md5ff(h, g, i, e, r[u + 2], 17, 606105819), e = md5ff(e, h, g, i, r[u + 3], 22, -1044525330), i = md5ff(i, e, h, g, r[u + 4], 7, -176418897), g = md5ff(g, i, e, h, r[u + 5], 12, 1200080426), h = md5ff(h, g, i, e, r[u + 6], 17, -1473231341), e = md5ff(e, h, g, i, r[u + 7], 22, -45705983), i = md5ff(i, e, h, g, r[u + 8], 7, 1770035416), g = md5ff(g, i, e, h, r[u + 9], 12, -1958414417), h = md5ff(h, g, i, e, r[u + 10], 17, -42063), e = md5ff(e, h, g, i, r[u + 11], 22, -1990404162), i = md5ff(i, e, h, g, r[u + 12], 7, 1804603682), g = md5ff(g, i, e, h, r[u + 13], 12, -40341101), h = md5ff(h, g, i, e, r[u + 14], 17, -1502002290), i = md5gg(i, e = md5ff(e, h, g, i, r[u + 15], 22, 1236535329), h, g, r[u + 1], 5, -165796510), g = md5gg(g, i, e, h, r[u + 6], 9, -1069501632), h = md5gg(h, g, i, e, r[u + 11], 14, 643717713), e = md5gg(e, h, g, i, r[u], 20, -373897302), i = md5gg(i, e, h, g, r[u + 5], 5, -701558691), g = md5gg(g, i, e, h, r[u + 10], 9, 38016083), h = md5gg(h, g, i, e, r[u + 15], 14, -660478335), e = md5gg(e, h, g, i, r[u + 4], 20, -405537848), i = md5gg(i, e, h, g, r[u + 9], 5, 568446438), g = md5gg(g, i, e, h, r[u + 14], 9, -1019803690), h = md5gg(h, g, i, e, r[u + 3], 14, -187363961), e = md5gg(e, h, g, i, r[u + 8], 20, 1163531501), i = md5gg(i, e, h, g, r[u + 13], 5, -1444681467), g = md5gg(g, i, e, h, r[u + 2], 9, -51403784), h = md5gg(h, g, i, e, r[u + 7], 14, 1735328473), i = md5hh(i, e = md5gg(e, h, g, i, r[u + 12], 20, -1926607734), h, g, r[u + 5], 4, -378558), g = md5hh(g, i, e, h, r[u + 8], 11, -2022574463), h = md5hh(h, g, i, e, r[u + 11], 16, 1839030562), e = md5hh(e, h, g, i, r[u + 14], 23, -35309556), i = md5hh(i, e, h, g, r[u + 1], 4, -1530992060), g = md5hh(g, i, e, h, r[u + 4], 11, 1272893353), h = md5hh(h, g, i, e, r[u + 7], 16, -155497632), e = md5hh(e, h, g, i, r[u + 10], 23, -1094730640), i = md5hh(i, e, h, g, r[u + 13], 4, 681279174), g = md5hh(g, i, e, h, r[u], 11, -358537222), h = md5hh(h, g, i, e, r[u + 3], 16, -722521979), e = md5hh(e, h, g, i, r[u + 6], 23, 76029189), i = md5hh(i, e, h, g, r[u + 9], 4, -640364487), g = md5hh(g, i, e, h, r[u + 12], 11, -421815835), h = md5hh(h, g, i, e, r[u + 15], 16, 530742520), i = md5ii(i, e = md5hh(e, h, g, i, r[u + 2], 23, -995338651), h, g, r[u], 6, -198630844), g = md5ii(g, i, e, h, r[u + 7], 10, 1126891415), h = md5ii(h, g, i, e, r[u + 14], 15, -1416354905), e = md5ii(e, h, g, i, r[u + 5], 21, -57434055), i = md5ii(i, e, h, g, r[u + 12], 6, 1700485571), g = md5ii(g, i, e, h, r[u + 3], 10, -1894986606), h = md5ii(h, g, i, e, r[u + 10], 15, -1051523), e = md5ii(e, h, g, i, r[u + 1], 21, -2054922799), i = md5ii(i, e, h, g, r[u + 8], 6, 1873313359), g = md5ii(g, i, e, h, r[u + 15], 10, -30611744), h = md5ii(h, g, i, e, r[u + 6], 15, -1560198380), e = md5ii(e, h, g, i, r[u + 13], 21, 1309151649), i = md5ii(i, e, h, g, r[u + 4], 6, -145523070), g = md5ii(g, i, e, h, r[u + 11], 10, -1120210379), h = md5ii(h, g, i, e, r[u + 2], 15, 718787259), e = md5ii(e, h, g, i, r[u + 9], 21, -343485551), i = safeAdd(i, n), e = safeAdd(e, t), h = safeAdd(h, m), g = safeAdd(g, f);
36
- return [i, e, h, g]
35
+ var e = 1732584193, h = -271733879, g = -1732584194, u = 271733878;
36
+ for (n = 0; n < r.length; n += 16) t = e, m = h, f = g, i = u, e = md5ff(e, h, g, u, r[n], 7, -680876936),
37
+ u = md5ff(u, e, h, g, r[n + 1], 12, -389564586), g = md5ff(g, u, e, h, r[n + 2], 17, 606105819),
38
+ h = md5ff(h, g, u, e, r[n + 3], 22, -1044525330), e = md5ff(e, h, g, u, r[n + 4], 7, -176418897),
39
+ u = md5ff(u, e, h, g, r[n + 5], 12, 1200080426), g = md5ff(g, u, e, h, r[n + 6], 17, -1473231341),
40
+ h = md5ff(h, g, u, e, r[n + 7], 22, -45705983), e = md5ff(e, h, g, u, r[n + 8], 7, 1770035416),
41
+ u = md5ff(u, e, h, g, r[n + 9], 12, -1958414417), g = md5ff(g, u, e, h, r[n + 10], 17, -42063),
42
+ h = md5ff(h, g, u, e, r[n + 11], 22, -1990404162), e = md5ff(e, h, g, u, r[n + 12], 7, 1804603682),
43
+ u = md5ff(u, e, h, g, r[n + 13], 12, -40341101), g = md5ff(g, u, e, h, r[n + 14], 17, -1502002290),
44
+ e = md5gg(e, h = md5ff(h, g, u, e, r[n + 15], 22, 1236535329), g, u, r[n + 1], 5, -165796510),
45
+ u = md5gg(u, e, h, g, r[n + 6], 9, -1069501632), g = md5gg(g, u, e, h, r[n + 11], 14, 643717713),
46
+ h = md5gg(h, g, u, e, r[n], 20, -373897302), e = md5gg(e, h, g, u, r[n + 5], 5, -701558691),
47
+ u = md5gg(u, e, h, g, r[n + 10], 9, 38016083), g = md5gg(g, u, e, h, r[n + 15], 14, -660478335),
48
+ h = md5gg(h, g, u, e, r[n + 4], 20, -405537848), e = md5gg(e, h, g, u, r[n + 9], 5, 568446438),
49
+ u = md5gg(u, e, h, g, r[n + 14], 9, -1019803690), g = md5gg(g, u, e, h, r[n + 3], 14, -187363961),
50
+ h = md5gg(h, g, u, e, r[n + 8], 20, 1163531501), e = md5gg(e, h, g, u, r[n + 13], 5, -1444681467),
51
+ u = md5gg(u, e, h, g, r[n + 2], 9, -51403784), g = md5gg(g, u, e, h, r[n + 7], 14, 1735328473),
52
+ e = md5hh(e, h = md5gg(h, g, u, e, r[n + 12], 20, -1926607734), g, u, r[n + 5], 4, -378558),
53
+ u = md5hh(u, e, h, g, r[n + 8], 11, -2022574463), g = md5hh(g, u, e, h, r[n + 11], 16, 1839030562),
54
+ h = md5hh(h, g, u, e, r[n + 14], 23, -35309556), e = md5hh(e, h, g, u, r[n + 1], 4, -1530992060),
55
+ u = md5hh(u, e, h, g, r[n + 4], 11, 1272893353), g = md5hh(g, u, e, h, r[n + 7], 16, -155497632),
56
+ h = md5hh(h, g, u, e, r[n + 10], 23, -1094730640), e = md5hh(e, h, g, u, r[n + 13], 4, 681279174),
57
+ u = md5hh(u, e, h, g, r[n], 11, -358537222), g = md5hh(g, u, e, h, r[n + 3], 16, -722521979),
58
+ h = md5hh(h, g, u, e, r[n + 6], 23, 76029189), e = md5hh(e, h, g, u, r[n + 9], 4, -640364487),
59
+ u = md5hh(u, e, h, g, r[n + 12], 11, -421815835), g = md5hh(g, u, e, h, r[n + 15], 16, 530742520),
60
+ e = md5ii(e, h = md5hh(h, g, u, e, r[n + 2], 23, -995338651), g, u, r[n], 6, -198630844),
61
+ u = md5ii(u, e, h, g, r[n + 7], 10, 1126891415), g = md5ii(g, u, e, h, r[n + 14], 15, -1416354905),
62
+ h = md5ii(h, g, u, e, r[n + 5], 21, -57434055), e = md5ii(e, h, g, u, r[n + 12], 6, 1700485571),
63
+ u = md5ii(u, e, h, g, r[n + 3], 10, -1894986606), g = md5ii(g, u, e, h, r[n + 10], 15, -1051523),
64
+ h = md5ii(h, g, u, e, r[n + 1], 21, -2054922799), e = md5ii(e, h, g, u, r[n + 8], 6, 1873313359),
65
+ u = md5ii(u, e, h, g, r[n + 15], 10, -30611744), g = md5ii(g, u, e, h, r[n + 6], 15, -1560198380),
66
+ h = md5ii(h, g, u, e, r[n + 13], 21, 1309151649), e = md5ii(e, h, g, u, r[n + 4], 6, -145523070),
67
+ u = md5ii(u, e, h, g, r[n + 11], 10, -1120210379), g = md5ii(g, u, e, h, r[n + 2], 15, 718787259),
68
+ h = md5ii(h, g, u, e, r[n + 9], 21, -343485551), e = safeAdd(e, t), h = safeAdd(h, m),
69
+ g = safeAdd(g, f), u = safeAdd(u, i);
70
+ return [ e, h, g, u ];
37
71
  }
38
72
 
39
73
  function binl2rstr(r) {
40
- for (var d = "", n = 32 * r.length, t = 0; t < n; t += 8) d += String.fromCharCode(r[t >> 5] >>> t % 32 & 255);
41
- return d
74
+ var d, n = "", t = 32 * r.length;
75
+ for (d = 0; d < t; d += 8) n += String.fromCharCode(r[d >> 5] >>> d % 32 & 255);
76
+ return n;
42
77
  }
43
78
 
44
79
  function rstr2binl(r) {
45
- var d = [];
46
- for (d[(r.length >> 2) - 1] = void 0, t = 0; t < d.length; t += 1) d[t] = 0;
47
- for (var n = 8 * r.length, t = 0; t < n; t += 8) d[t >> 5] |= (255 & r.charCodeAt(t / 8)) << t % 32;
48
- return d
80
+ var d, n = [];
81
+ for (n[(r.length >> 2) - 1] = void 0, d = 0; d < n.length; d += 1) n[d] = 0;
82
+ var t = 8 * r.length;
83
+ for (d = 0; d < t; d += 8) n[d >> 5] |= (255 & r.charCodeAt(d / 8)) << d % 32;
84
+ return n;
49
85
  }
50
86
 
51
87
  function rstrMD5(r) {
52
- return binl2rstr(binlMD5(rstr2binl(r), 8 * r.length))
88
+ return binl2rstr(binlMD5(rstr2binl(r), 8 * r.length));
53
89
  }
54
90
 
55
91
  function rstrHMACMD5(r, d) {
56
- var n, t, m = rstr2binl(r),
57
- f = [],
58
- i = [];
59
- for (f[15] = i[15] = void 0, 16 < m.length && (m = binlMD5(m, 8 * r.length)), n = 0; n < 16; n += 1) f[n] = 909522486 ^ m[n], i[n] = 1549556828 ^ m[n];
60
- return t = binlMD5(f.concat(rstr2binl(d)), 512 + 8 * d.length), binl2rstr(binlMD5(i.concat(t), 640))
92
+ var n, t, m = rstr2binl(r), f = [], i = [];
93
+ for (f[15] = i[15] = void 0, m.length > 16 && (m = binlMD5(m, 8 * r.length)), n = 0; n < 16; n += 1) f[n] = 909522486 ^ m[n],
94
+ i[n] = 1549556828 ^ m[n];
95
+ return t = binlMD5(f.concat(rstr2binl(d)), 512 + 8 * d.length), binl2rstr(binlMD5(i.concat(t), 640));
61
96
  }
62
97
 
63
98
  function rstr2hex(r) {
64
- for (var d, n = "0123456789abcdef", t = "", m = 0; m < r.length; m += 1) d = r.charCodeAt(m), t += n.charAt(d >>> 4 & 15) + n.charAt(15 & d);
65
- return t
99
+ var d, n, t = "0123456789abcdef", m = "";
100
+ for (n = 0; n < r.length; n += 1) d = r.charCodeAt(n), m += t.charAt(d >>> 4 & 15) + t.charAt(15 & d);
101
+ return m;
66
102
  }
67
103
 
68
104
  function str2rstrUTF8(r) {
69
- return unescape(encodeURIComponent(r))
105
+ return unescape(encodeURIComponent(r));
70
106
  }
71
107
 
72
108
  function rawMD5(r) {
73
- return rstrMD5(str2rstrUTF8(r))
109
+ return rstrMD5(str2rstrUTF8(r));
74
110
  }
75
111
 
76
112
  function hexMD5(r) {
77
- return rstr2hex(rawMD5(r))
113
+ return rstr2hex(rawMD5(r));
78
114
  }
79
115
 
80
116
  function rawHMACMD5(r, d) {
81
- return rstrHMACMD5(str2rstrUTF8(r), str2rstrUTF8(d))
117
+ return rstrHMACMD5(str2rstrUTF8(r), str2rstrUTF8(d));
82
118
  }
83
119
 
84
120
  function hexHMACMD5(r, d) {
85
- return rstr2hex(rawHMACMD5(r, d))
121
+ return rstr2hex(rawHMACMD5(r, d));
86
122
  }
123
+
87
124
  module.exports = function(r, d, n) {
88
- return d ? (n ? rawHMACMD5 : hexHMACMD5)(d, r) : (n ? rawMD5 : hexMD5)(r)
89
- };
125
+ return d ? n ? rawHMACMD5(d, r) : hexHMACMD5(d, r) : n ? rawMD5(r) : hexMD5(r);
126
+ };