@epxing/utils 0.0.0-stage → 5.3.0-beta.2
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.
- package/API.md +602 -0
- package/README.md +22 -2
- package/dist/_vendor/.pnpm/jsencrypt@3.5.4/_vendor/jsencrypt/bin/jsencrypt.min.js +1691 -0
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/jsencrypt.min.js +31 -0
- package/dist/_virtual/jsencrypt.min2.js +4 -0
- package/dist/_virtual/preload-helper.js +88 -0
- package/dist/assets/ai-BBFn3QRy.png +0 -0
- package/dist/assets/ai_import-BxQ7Ohn6.png +0 -0
- package/dist/assets/app-DBNIokDP.png +0 -0
- package/dist/assets/approval-DGcBv-re.png +0 -0
- package/dist/assets/create_market_system-BH__UVbt.png +0 -0
- package/dist/assets/create_system-irg--ePh.png +0 -0
- package/dist/assets/custom-C-ujlHz1.png +0 -0
- package/dist/assets/default-icon-2193FMjv.png +0 -0
- package/dist/assets/ex_link-4fYPd9nh.png +0 -0
- package/dist/assets/excel-BYqRm2Y8.png +0 -0
- package/dist/assets/folder-CFVsNbjj.png +0 -0
- package/dist/assets/form-DD9HV-jN.png +0 -0
- package/dist/assets/import-tfKWbWVS.png +0 -0
- package/dist/assets/meta-Qorpi70B.png +0 -0
- package/dist/assets/module-DQrs7VAS.png +0 -0
- package/dist/assets/null-B2An29h4.png +0 -0
- package/dist/assets/option-CG02tIgh.svg +1 -0
- package/dist/assets/photo-uscRzRXF.png +0 -0
- package/dist/assets/process-Dcndu9m2.png +0 -0
- package/dist/assets/rule-DcYhYse0.png +0 -0
- package/dist/assets/service-CLYLpPl3.png +0 -0
- package/dist/assets/single_file-B3TJtJli.png +0 -0
- package/dist/assets/snapshot-history-BsVY9cVj.png +0 -0
- package/dist/assets/snapshot-manual-DBRfFHYI.png +0 -0
- package/dist/assets/snapshot-realtime-DjHnJI6C.png +0 -0
- package/dist/assets/staff-Bn_-_00l.png +0 -0
- package/dist/assets/sync_append-Bm8mtvZs.png +0 -0
- package/dist/assets/sync_append_update-DzjxqJ_U.png +0 -0
- package/dist/assets/sync_loading-D7LoNPFP.png +0 -0
- package/dist/assets/sync_replace-Cbbzz327.png +0 -0
- package/dist/assets/sync_update-Birao6Cr.png +0 -0
- package/dist/assets/userRole-D1LAdM6N.png +0 -0
- package/dist/assets/user_bg-BFHtaZjz.png +0 -0
- package/dist/src/Config.js +25 -0
- package/dist/src/asset-images.js +125 -0
- package/dist/src/assets/images/add.png.js +4 -0
- package/dist/src/assets/images/ai-button.png.js +4 -0
- package/dist/src/assets/images/ai.png.js +4 -0
- package/dist/src/assets/images/ai_import.png.js +4 -0
- package/dist/src/assets/images/app.png.js +4 -0
- package/dist/src/assets/images/approval.png.js +4 -0
- package/dist/src/assets/images/book.png.js +4 -0
- package/dist/src/assets/images/canvas-editor/alignment.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/arrow-left.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/arrow-right.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/block.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/bold.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/catalog.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/center.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/checkbox.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/close.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/codeblock.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/color.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/control.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/date.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/exit-fullscreen.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/format.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/highlight.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/hyperlink.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/image.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/italic.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/justify.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/latex.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/left.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/line-dash-dot-dot.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/line-dash-dot.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/line-dash-large-gap.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/line-dash-small-gap.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/line-dot.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/line-double.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/line-single.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/line-wavy.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/list.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/option.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/page-break.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/page-mode.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/page-scale-add.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/page-scale-minus.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/painter.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/paper-direction.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/paper-margin.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/paper-size.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/print.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/radio.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/redo.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/request-fullscreen.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/right.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/row-margin.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/search.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/separator.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/signature-undo.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/signature.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/size-add.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/size-minus.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/strikeout.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/subscript.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/superscript.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/table.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/title.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/trash.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/underline.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/undo.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/watermark.svg.js +4 -0
- package/dist/src/assets/images/canvas-editor/word-tool.svg.js +4 -0
- package/dist/src/assets/images/clear.png.js +4 -0
- package/dist/src/assets/images/create_market_system.png.js +4 -0
- package/dist/src/assets/images/create_system.png.js +4 -0
- package/dist/src/assets/images/custom.png.js +4 -0
- package/dist/src/assets/images/default-icon.png.js +4 -0
- package/dist/src/assets/images/ex_link.png.js +4 -0
- package/dist/src/assets/images/excel.png.js +4 -0
- package/dist/src/assets/images/file.png.js +4 -0
- package/dist/src/assets/images/folder.png.js +4 -0
- package/dist/src/assets/images/hall/form.png.js +4 -0
- package/dist/src/assets/images/hall/meta.png.js +4 -0
- package/dist/src/assets/images/hall/process.png.js +4 -0
- package/dist/src/assets/images/hall/rule.png.js +4 -0
- package/dist/src/assets/images/hall/service.png.js +4 -0
- package/dist/src/assets/images/hall/userRole.png.js +4 -0
- package/dist/src/assets/images/hr.png.js +4 -0
- package/dist/src/assets/images/import.png.js +4 -0
- package/dist/src/assets/images/jian.png.js +4 -0
- package/dist/src/assets/images/module.png.js +4 -0
- package/dist/src/assets/images/null.png.js +4 -0
- package/dist/src/assets/images/photo.png.js +4 -0
- package/dist/src/assets/images/qq.png.js +4 -0
- package/dist/src/assets/images/robot.png.js +4 -0
- package/dist/src/assets/images/single_file.png.js +4 -0
- package/dist/src/assets/images/snapshot-history.png.js +4 -0
- package/dist/src/assets/images/snapshot-manual.png.js +4 -0
- package/dist/src/assets/images/snapshot-realtime.png.js +4 -0
- package/dist/src/assets/images/staff.png.js +4 -0
- package/dist/src/assets/images/switch_app.png.js +4 -0
- package/dist/src/assets/images/sync_append.png.js +4 -0
- package/dist/src/assets/images/sync_append_update.png.js +4 -0
- package/dist/src/assets/images/sync_loading.png.js +4 -0
- package/dist/src/assets/images/sync_replace.png.js +4 -0
- package/dist/src/assets/images/sync_update.png.js +4 -0
- package/dist/src/assets/images/user_bg.png.js +4 -0
- package/dist/src/assets/images/weixin.png.js +4 -0
- package/dist/src/chart-config-update.js +17 -0
- package/dist/src/chart-data-adapters.js +112 -0
- package/dist/src/chart-option-override.js +128 -0
- package/dist/src/chart-option-paths.js +64 -0
- package/dist/src/chart-registry.js +46 -0
- package/dist/src/chart-render-host.js +57 -0
- package/dist/src/chart-request-broker.js +176 -0
- package/dist/src/chartTheme.js +683 -0
- package/dist/src/collection.js +25 -0
- package/dist/src/date-helper.js +60 -0
- package/dist/src/dom-helper.js +22 -0
- package/dist/src/eval-with.js +14 -0
- package/dist/src/fieldFactory.js +5 -0
- package/dist/src/formula.js +365 -0
- package/dist/src/hljs-lite.js +29 -0
- package/dist/src/index.js +24 -0
- package/dist/src/lazy-jsencrypt.js +13 -0
- package/dist/src/legacy.js +25 -0
- package/dist/src/locale.js +88 -0
- package/dist/src/menu-open.js +43 -0
- package/dist/src/mermaid.js +79 -0
- package/dist/src/meta.js +4 -0
- package/dist/src/mobile-chart-appearance.js +148 -0
- package/dist/src/moment-compat.js +558 -0
- package/dist/src/nav-history.js +184 -0
- package/dist/src/page.js +116 -0
- package/dist/src/pdf.viewer.js +4 -0
- package/dist/src/placeholder.js +64 -0
- package/dist/src/public.js +49 -0
- package/dist/src/security.js +26 -0
- package/dist/src/storage.js +107 -0
- package/dist/src/token-storage.js +108 -0
- package/dist/src/util.js +4 -0
- package/package.json +109 -3
- package/src/Config.js +25 -0
- package/src/asset-images.js +16 -0
- package/src/chart-config-update.js +16 -0
- package/src/chart-data-adapters.js +106 -0
- package/src/chart-option-override.js +126 -0
- package/src/chart-option-paths.js +63 -0
- package/src/chart-registry.js +41 -0
- package/src/chart-render-host.js +56 -0
- package/src/chart-request-broker.js +171 -0
- package/src/chartTheme.js +711 -0
- package/src/collection.js +28 -0
- package/src/date-helper.js +72 -0
- package/src/dom-helper.js +26 -0
- package/src/eval-with.js +21 -0
- package/src/fieldFactory.js +3 -0
- package/src/formula.js +362 -0
- package/src/hljs-lite.js +41 -0
- package/src/index.js +2 -0
- package/src/lazy-jsencrypt.js +36 -0
- package/src/legacy.js +29 -0
- package/src/locale.js +104 -0
- package/src/menu-open.js +72 -0
- package/src/mermaid.js +115 -0
- package/src/meta.js +2 -0
- package/src/mobile-chart-appearance.js +147 -0
- package/src/moment-compat.d.ts +91 -0
- package/src/moment-compat.js +744 -0
- package/src/nav-history.js +274 -0
- package/src/page.js +129 -0
- package/src/pdf.viewer.js +2 -0
- package/src/placeholder.js +107 -0
- package/src/public.js +11 -0
- package/src/security.js +29 -0
- package/src/storage.js +135 -0
- package/src/token-storage.js +120 -0
- package/src/util.js +2 -0
- package/types/Config.d.ts +4 -0
- package/types/collection.d.ts +40 -0
- package/types/date-helper.d.ts +11 -0
- package/types/date-time.d.ts +2 -0
- package/types/date.d.ts +1 -0
- package/types/dom-helper.d.ts +3 -0
- package/types/dom.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/moment-compat.d.ts +91 -0
- package/types/page.d.ts +56 -0
- package/types/placeholder.d.ts +42 -0
- package/types/public.d.ts +10 -0
- package/types/storage.d.ts +31 -0
|
@@ -0,0 +1,1691 @@
|
|
|
1
|
+
import { __module as jsencrypt_min$1 } from "../../../../../../_virtual/jsencrypt.min2.js";
|
|
2
|
+
var jsencrypt_min = jsencrypt_min$1.exports;
|
|
3
|
+
var hasRequiredJsencrypt_min;
|
|
4
|
+
function requireJsencrypt_min() {
|
|
5
|
+
if (hasRequiredJsencrypt_min) return jsencrypt_min$1.exports;
|
|
6
|
+
hasRequiredJsencrypt_min = 1;
|
|
7
|
+
(function(module, exports) {
|
|
8
|
+
!(function(t, e) {
|
|
9
|
+
module.exports = e();
|
|
10
|
+
})(jsencrypt_min, function() {
|
|
11
|
+
return (function() {
|
|
12
|
+
var t = { 606: function(t2) {
|
|
13
|
+
var e2, r2, i2 = t2.exports = {};
|
|
14
|
+
function n() {
|
|
15
|
+
throw new Error("setTimeout has not been defined");
|
|
16
|
+
}
|
|
17
|
+
function s() {
|
|
18
|
+
throw new Error("clearTimeout has not been defined");
|
|
19
|
+
}
|
|
20
|
+
function o(t3) {
|
|
21
|
+
if (e2 === setTimeout) return setTimeout(t3, 0);
|
|
22
|
+
if ((e2 === n || !e2) && setTimeout) return e2 = setTimeout, setTimeout(t3, 0);
|
|
23
|
+
try {
|
|
24
|
+
return e2(t3, 0);
|
|
25
|
+
} catch (r3) {
|
|
26
|
+
try {
|
|
27
|
+
return e2.call(null, t3, 0);
|
|
28
|
+
} catch (r4) {
|
|
29
|
+
return e2.call(this, t3, 0);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
!(function() {
|
|
34
|
+
try {
|
|
35
|
+
e2 = "function" == typeof setTimeout ? setTimeout : n;
|
|
36
|
+
} catch (t3) {
|
|
37
|
+
e2 = n;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
r2 = "function" == typeof clearTimeout ? clearTimeout : s;
|
|
41
|
+
} catch (t3) {
|
|
42
|
+
r2 = s;
|
|
43
|
+
}
|
|
44
|
+
})();
|
|
45
|
+
var h, a = [], u = false, c = -1;
|
|
46
|
+
function f() {
|
|
47
|
+
u && h && (u = false, h.length ? a = h.concat(a) : c = -1, a.length && l());
|
|
48
|
+
}
|
|
49
|
+
function l() {
|
|
50
|
+
if (!u) {
|
|
51
|
+
var t3 = o(f);
|
|
52
|
+
u = true;
|
|
53
|
+
for (var e3 = a.length; e3; ) {
|
|
54
|
+
for (h = a, a = []; ++c < e3; ) h && h[c].run();
|
|
55
|
+
c = -1, e3 = a.length;
|
|
56
|
+
}
|
|
57
|
+
h = null, u = false, (function(t4) {
|
|
58
|
+
if (r2 === clearTimeout) return clearTimeout(t4);
|
|
59
|
+
if ((r2 === s || !r2) && clearTimeout) return r2 = clearTimeout, clearTimeout(t4);
|
|
60
|
+
try {
|
|
61
|
+
return r2(t4);
|
|
62
|
+
} catch (e4) {
|
|
63
|
+
try {
|
|
64
|
+
return r2.call(null, t4);
|
|
65
|
+
} catch (e5) {
|
|
66
|
+
return r2.call(this, t4);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
})(t3);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function p(t3, e3) {
|
|
73
|
+
this.fun = t3, this.array = e3;
|
|
74
|
+
}
|
|
75
|
+
function g() {
|
|
76
|
+
}
|
|
77
|
+
i2.nextTick = function(t3) {
|
|
78
|
+
var e3 = new Array(arguments.length - 1);
|
|
79
|
+
if (arguments.length > 1) for (var r3 = 1; r3 < arguments.length; r3++) e3[r3 - 1] = arguments[r3];
|
|
80
|
+
a.push(new p(t3, e3)), 1 !== a.length || u || o(l);
|
|
81
|
+
}, p.prototype.run = function() {
|
|
82
|
+
this.fun.apply(null, this.array);
|
|
83
|
+
}, i2.title = "browser", i2.browser = true, i2.env = {}, i2.argv = [], i2.version = "", i2.versions = {}, i2.on = g, i2.addListener = g, i2.once = g, i2.off = g, i2.removeListener = g, i2.removeAllListeners = g, i2.emit = g, i2.prependListener = g, i2.prependOnceListener = g, i2.listeners = function(t3) {
|
|
84
|
+
return [];
|
|
85
|
+
}, i2.binding = function(t3) {
|
|
86
|
+
throw new Error("process.binding is not supported");
|
|
87
|
+
}, i2.cwd = function() {
|
|
88
|
+
return "/";
|
|
89
|
+
}, i2.chdir = function(t3) {
|
|
90
|
+
throw new Error("process.chdir is not supported");
|
|
91
|
+
}, i2.umask = function() {
|
|
92
|
+
return 0;
|
|
93
|
+
};
|
|
94
|
+
} }, e = {};
|
|
95
|
+
function r(i2) {
|
|
96
|
+
var n = e[i2];
|
|
97
|
+
if (void 0 !== n) return n.exports;
|
|
98
|
+
var s = e[i2] = { exports: {} };
|
|
99
|
+
return t[i2](s, s.exports, r), s.exports;
|
|
100
|
+
}
|
|
101
|
+
r.d = function(t2, e2) {
|
|
102
|
+
for (var i2 in e2) r.o(e2, i2) && !r.o(t2, i2) && Object.defineProperty(t2, i2, { enumerable: true, get: e2[i2] });
|
|
103
|
+
}, r.o = function(t2, e2) {
|
|
104
|
+
return Object.prototype.hasOwnProperty.call(t2, e2);
|
|
105
|
+
};
|
|
106
|
+
var i = {};
|
|
107
|
+
return (function() {
|
|
108
|
+
r.d(i, { default: function() {
|
|
109
|
+
return Et;
|
|
110
|
+
} });
|
|
111
|
+
function t2(t3) {
|
|
112
|
+
return "0123456789abcdefghijklmnopqrstuvwxyz".charAt(t3);
|
|
113
|
+
}
|
|
114
|
+
function e2(t3, e3) {
|
|
115
|
+
return t3 & e3;
|
|
116
|
+
}
|
|
117
|
+
function n(t3, e3) {
|
|
118
|
+
return t3 | e3;
|
|
119
|
+
}
|
|
120
|
+
function s(t3, e3) {
|
|
121
|
+
return t3 ^ e3;
|
|
122
|
+
}
|
|
123
|
+
function o(t3, e3) {
|
|
124
|
+
return t3 & ~e3;
|
|
125
|
+
}
|
|
126
|
+
function h(t3) {
|
|
127
|
+
if (0 == t3) return -1;
|
|
128
|
+
var e3 = 0;
|
|
129
|
+
return 65535 & t3 || (t3 >>= 16, e3 += 16), 255 & t3 || (t3 >>= 8, e3 += 8), 15 & t3 || (t3 >>= 4, e3 += 4), 3 & t3 || (t3 >>= 2, e3 += 2), 1 & t3 || ++e3, e3;
|
|
130
|
+
}
|
|
131
|
+
function a(t3) {
|
|
132
|
+
for (var e3 = 0; 0 != t3; ) t3 &= t3 - 1, ++e3;
|
|
133
|
+
return e3;
|
|
134
|
+
}
|
|
135
|
+
var u, c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
136
|
+
function f(t3) {
|
|
137
|
+
var e3, r2, i2 = "";
|
|
138
|
+
for (e3 = 0; e3 + 3 <= t3.length; e3 += 3) r2 = parseInt(t3.substring(e3, e3 + 3), 16), i2 += c.charAt(r2 >> 6) + c.charAt(63 & r2);
|
|
139
|
+
for (e3 + 1 == t3.length ? (r2 = parseInt(t3.substring(e3, e3 + 1), 16), i2 += c.charAt(r2 << 2)) : e3 + 2 == t3.length && (r2 = parseInt(t3.substring(e3, e3 + 2), 16), i2 += c.charAt(r2 >> 2) + c.charAt((3 & r2) << 4)); (3 & i2.length) > 0; ) i2 += "=";
|
|
140
|
+
return i2;
|
|
141
|
+
}
|
|
142
|
+
function l(e3) {
|
|
143
|
+
var r2, i2 = "", n2 = 0, s2 = 0;
|
|
144
|
+
for (r2 = 0; r2 < e3.length && "=" != e3.charAt(r2); ++r2) {
|
|
145
|
+
var o2 = c.indexOf(e3.charAt(r2));
|
|
146
|
+
o2 < 0 || (0 == n2 ? (i2 += t2(o2 >> 2), s2 = 3 & o2, n2 = 1) : 1 == n2 ? (i2 += t2(s2 << 2 | o2 >> 4), s2 = 15 & o2, n2 = 2) : 2 == n2 ? (i2 += t2(s2), i2 += t2(o2 >> 2), s2 = 3 & o2, n2 = 3) : (i2 += t2(s2 << 2 | o2 >> 4), i2 += t2(15 & o2), n2 = 0));
|
|
147
|
+
}
|
|
148
|
+
return 1 == n2 && (i2 += t2(s2 << 2)), i2;
|
|
149
|
+
}
|
|
150
|
+
var p, g = function(t3) {
|
|
151
|
+
var e3;
|
|
152
|
+
if (void 0 === u) {
|
|
153
|
+
var r2 = "0123456789ABCDEF", i2 = " \f\n\r \u2028\u2029";
|
|
154
|
+
for (u = {}, e3 = 0; e3 < 16; ++e3) u[r2.charAt(e3)] = e3;
|
|
155
|
+
for (r2 = r2.toLowerCase(), e3 = 10; e3 < 16; ++e3) u[r2.charAt(e3)] = e3;
|
|
156
|
+
for (e3 = 0; e3 < 8; ++e3) u[i2.charAt(e3)] = -1;
|
|
157
|
+
}
|
|
158
|
+
var n2 = [], s2 = 0, o2 = 0;
|
|
159
|
+
for (e3 = 0; e3 < t3.length; ++e3) {
|
|
160
|
+
var h2 = t3.charAt(e3);
|
|
161
|
+
if ("=" == h2) break;
|
|
162
|
+
if (-1 != (h2 = u[h2])) {
|
|
163
|
+
if (void 0 === h2) throw new Error("Illegal character at offset " + e3);
|
|
164
|
+
s2 |= h2, ++o2 >= 2 ? (n2[n2.length] = s2, s2 = 0, o2 = 0) : s2 <<= 4;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (o2) throw new Error("Hex encoding incomplete: 4 bits missing");
|
|
168
|
+
return n2;
|
|
169
|
+
}, d = { decode: function(t3) {
|
|
170
|
+
var e3;
|
|
171
|
+
if (void 0 === p) {
|
|
172
|
+
var r2 = "= \f\n\r \u2028\u2029";
|
|
173
|
+
for (p = /* @__PURE__ */ Object.create(null), e3 = 0; e3 < 64; ++e3) p["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e3)] = e3;
|
|
174
|
+
for (p["-"] = 62, p._ = 63, e3 = 0; e3 < 9; ++e3) p[r2.charAt(e3)] = -1;
|
|
175
|
+
}
|
|
176
|
+
var i2 = [], n2 = 0, s2 = 0;
|
|
177
|
+
for (e3 = 0; e3 < t3.length; ++e3) {
|
|
178
|
+
var o2 = t3.charAt(e3);
|
|
179
|
+
if ("=" == o2) break;
|
|
180
|
+
if (-1 != (o2 = p[o2])) {
|
|
181
|
+
if (void 0 === o2) throw new Error("Illegal character at offset " + e3);
|
|
182
|
+
n2 |= o2, ++s2 >= 4 ? (i2[i2.length] = n2 >> 16, i2[i2.length] = n2 >> 8 & 255, i2[i2.length] = 255 & n2, n2 = 0, s2 = 0) : n2 <<= 6;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
switch (s2) {
|
|
186
|
+
case 1:
|
|
187
|
+
throw new Error("Base64 encoding incomplete: at least 2 bits missing");
|
|
188
|
+
case 2:
|
|
189
|
+
i2[i2.length] = n2 >> 10;
|
|
190
|
+
break;
|
|
191
|
+
case 3:
|
|
192
|
+
i2[i2.length] = n2 >> 16, i2[i2.length] = n2 >> 8 & 255;
|
|
193
|
+
}
|
|
194
|
+
return i2;
|
|
195
|
+
}, re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/, unarmor: function(t3) {
|
|
196
|
+
var e3 = d.re.exec(t3);
|
|
197
|
+
if (e3) if (e3[1]) t3 = e3[1];
|
|
198
|
+
else {
|
|
199
|
+
if (!e3[2]) throw new Error("RegExp out of sync");
|
|
200
|
+
t3 = e3[2];
|
|
201
|
+
}
|
|
202
|
+
return d.decode(t3);
|
|
203
|
+
} }, v = 1e13, y = (function() {
|
|
204
|
+
function t3(t4) {
|
|
205
|
+
this.buf = [+t4 || 0];
|
|
206
|
+
}
|
|
207
|
+
return t3.prototype.mulAdd = function(t4, e3) {
|
|
208
|
+
var r2, i2, n2 = this.buf, s2 = n2.length;
|
|
209
|
+
for (r2 = 0; r2 < s2; ++r2) (i2 = n2[r2] * t4 + e3) < v ? e3 = 0 : i2 -= (e3 = 0 | i2 / v) * v, n2[r2] = i2;
|
|
210
|
+
e3 > 0 && (n2[r2] = e3);
|
|
211
|
+
}, t3.prototype.sub = function(t4) {
|
|
212
|
+
var e3, r2, i2 = this.buf, n2 = i2.length;
|
|
213
|
+
for (e3 = 0; e3 < n2; ++e3) (r2 = i2[e3] - t4) < 0 ? (r2 += v, t4 = 1) : t4 = 0, i2[e3] = r2;
|
|
214
|
+
for (; 0 === i2[i2.length - 1]; ) i2.pop();
|
|
215
|
+
}, t3.prototype.toString = function(t4) {
|
|
216
|
+
if (10 != (t4 || 10)) throw new Error("only base 10 is supported");
|
|
217
|
+
for (var e3 = this.buf, r2 = e3[e3.length - 1].toString(), i2 = e3.length - 2; i2 >= 0; --i2) r2 += (v + e3[i2]).toString().substring(1);
|
|
218
|
+
return r2;
|
|
219
|
+
}, t3.prototype.valueOf = function() {
|
|
220
|
+
for (var t4 = this.buf, e3 = 0, r2 = t4.length - 1; r2 >= 0; --r2) e3 = e3 * v + t4[r2];
|
|
221
|
+
return e3;
|
|
222
|
+
}, t3.prototype.simplify = function() {
|
|
223
|
+
var t4 = this.buf;
|
|
224
|
+
return 1 == t4.length ? t4[0] : this;
|
|
225
|
+
}, t3;
|
|
226
|
+
})(), m = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/, b = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;
|
|
227
|
+
function T(t3, e3) {
|
|
228
|
+
return t3.length > e3 && (t3 = t3.substring(0, e3) + "…"), t3;
|
|
229
|
+
}
|
|
230
|
+
var S, E = (function() {
|
|
231
|
+
function t3(e3, r2) {
|
|
232
|
+
this.hexDigits = "0123456789ABCDEF", e3 instanceof t3 ? (this.enc = e3.enc, this.pos = e3.pos) : (this.enc = e3, this.pos = r2);
|
|
233
|
+
}
|
|
234
|
+
return t3.prototype.get = function(t4) {
|
|
235
|
+
if (void 0 === t4 && (t4 = this.pos++), t4 >= this.enc.length) throw new Error("Requesting byte offset ".concat(t4, " on a stream of length ").concat(this.enc.length));
|
|
236
|
+
return "string" == typeof this.enc ? this.enc.charCodeAt(t4) : this.enc[t4];
|
|
237
|
+
}, t3.prototype.hexByte = function(t4) {
|
|
238
|
+
return this.hexDigits.charAt(t4 >> 4 & 15) + this.hexDigits.charAt(15 & t4);
|
|
239
|
+
}, t3.prototype.hexDump = function(t4, e3, r2) {
|
|
240
|
+
for (var i2 = "", n2 = t4; n2 < e3; ++n2) if (i2 += this.hexByte(this.get(n2)), true !== r2) switch (15 & n2) {
|
|
241
|
+
case 7:
|
|
242
|
+
i2 += " ";
|
|
243
|
+
break;
|
|
244
|
+
case 15:
|
|
245
|
+
i2 += "\n";
|
|
246
|
+
break;
|
|
247
|
+
default:
|
|
248
|
+
i2 += " ";
|
|
249
|
+
}
|
|
250
|
+
return i2;
|
|
251
|
+
}, t3.prototype.isASCII = function(t4, e3) {
|
|
252
|
+
for (var r2 = t4; r2 < e3; ++r2) {
|
|
253
|
+
var i2 = this.get(r2);
|
|
254
|
+
if (i2 < 32 || i2 > 176) return false;
|
|
255
|
+
}
|
|
256
|
+
return true;
|
|
257
|
+
}, t3.prototype.parseStringISO = function(t4, e3) {
|
|
258
|
+
for (var r2 = "", i2 = t4; i2 < e3; ++i2) r2 += String.fromCharCode(this.get(i2));
|
|
259
|
+
return r2;
|
|
260
|
+
}, t3.prototype.parseStringUTF = function(t4, e3) {
|
|
261
|
+
for (var r2 = "", i2 = t4; i2 < e3; ) {
|
|
262
|
+
var n2 = this.get(i2++);
|
|
263
|
+
r2 += n2 < 128 ? String.fromCharCode(n2) : n2 > 191 && n2 < 224 ? String.fromCharCode((31 & n2) << 6 | 63 & this.get(i2++)) : String.fromCharCode((15 & n2) << 12 | (63 & this.get(i2++)) << 6 | 63 & this.get(i2++));
|
|
264
|
+
}
|
|
265
|
+
return r2;
|
|
266
|
+
}, t3.prototype.parseStringBMP = function(t4, e3) {
|
|
267
|
+
for (var r2, i2, n2 = "", s2 = t4; s2 < e3; ) r2 = this.get(s2++), i2 = this.get(s2++), n2 += String.fromCharCode(r2 << 8 | i2);
|
|
268
|
+
return n2;
|
|
269
|
+
}, t3.prototype.parseTime = function(t4, e3, r2) {
|
|
270
|
+
var i2 = this.parseStringISO(t4, e3), n2 = (r2 ? m : b).exec(i2);
|
|
271
|
+
return n2 ? (r2 && (n2[1] = +n2[1], n2[1] += +n2[1] < 70 ? 2e3 : 1900), i2 = n2[1] + "-" + n2[2] + "-" + n2[3] + " " + n2[4], n2[5] && (i2 += ":" + n2[5], n2[6] && (i2 += ":" + n2[6], n2[7] && (i2 += "." + n2[7]))), n2[8] && (i2 += " UTC", "Z" != n2[8] && (i2 += n2[8], n2[9] && (i2 += ":" + n2[9]))), i2) : "Unrecognized time: " + i2;
|
|
272
|
+
}, t3.prototype.parseInteger = function(t4, e3) {
|
|
273
|
+
for (var r2, i2 = this.get(t4), n2 = i2 > 127, s2 = n2 ? 255 : 0, o2 = ""; i2 == s2 && ++t4 < e3; ) i2 = this.get(t4);
|
|
274
|
+
if (0 === (r2 = e3 - t4)) return n2 ? -1 : 0;
|
|
275
|
+
if (r2 > 4) {
|
|
276
|
+
for (o2 = i2, r2 <<= 3; !(128 & (+o2 ^ s2)); ) o2 = +o2 << 1, --r2;
|
|
277
|
+
o2 = "(" + r2 + " bit)\n";
|
|
278
|
+
}
|
|
279
|
+
n2 && (i2 -= 256);
|
|
280
|
+
for (var h2 = new y(i2), a2 = t4 + 1; a2 < e3; ++a2) h2.mulAdd(256, this.get(a2));
|
|
281
|
+
return o2 + h2.toString();
|
|
282
|
+
}, t3.prototype.parseBitString = function(t4, e3, r2) {
|
|
283
|
+
for (var i2 = this.get(t4), n2 = "(" + ((e3 - t4 - 1 << 3) - i2) + " bit)\n", s2 = "", o2 = t4 + 1; o2 < e3; ++o2) {
|
|
284
|
+
for (var h2 = this.get(o2), a2 = o2 == e3 - 1 ? i2 : 0, u2 = 7; u2 >= a2; --u2) s2 += h2 >> u2 & 1 ? "1" : "0";
|
|
285
|
+
if (s2.length > r2) return n2 + T(s2, r2);
|
|
286
|
+
}
|
|
287
|
+
return n2 + s2;
|
|
288
|
+
}, t3.prototype.parseOctetString = function(t4, e3, r2) {
|
|
289
|
+
if (this.isASCII(t4, e3)) return T(this.parseStringISO(t4, e3), r2);
|
|
290
|
+
var i2 = e3 - t4, n2 = "(" + i2 + " byte)\n";
|
|
291
|
+
i2 > (r2 /= 2) && (e3 = t4 + r2);
|
|
292
|
+
for (var s2 = t4; s2 < e3; ++s2) n2 += this.hexByte(this.get(s2));
|
|
293
|
+
return i2 > r2 && (n2 += "…"), n2;
|
|
294
|
+
}, t3.prototype.parseOID = function(t4, e3, r2) {
|
|
295
|
+
for (var i2 = "", n2 = new y(), s2 = 0, o2 = t4; o2 < e3; ++o2) {
|
|
296
|
+
var h2 = this.get(o2);
|
|
297
|
+
if (n2.mulAdd(128, 127 & h2), s2 += 7, !(128 & h2)) {
|
|
298
|
+
if ("" === i2) if ((n2 = n2.simplify()) instanceof y) n2.sub(80), i2 = "2." + n2.toString();
|
|
299
|
+
else {
|
|
300
|
+
var a2 = n2 < 80 ? n2 < 40 ? 0 : 1 : 2;
|
|
301
|
+
i2 = a2 + "." + (n2 - 40 * a2);
|
|
302
|
+
}
|
|
303
|
+
else i2 += "." + n2.toString();
|
|
304
|
+
if (i2.length > r2) return T(i2, r2);
|
|
305
|
+
n2 = new y(), s2 = 0;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return s2 > 0 && (i2 += ".incomplete"), i2;
|
|
309
|
+
}, t3;
|
|
310
|
+
})(), w = (function() {
|
|
311
|
+
function t3(t4, e3, r2, i2, n2) {
|
|
312
|
+
if (!(i2 instanceof D)) throw new Error("Invalid tag value.");
|
|
313
|
+
this.stream = t4, this.header = e3, this.length = r2, this.tag = i2, this.sub = n2;
|
|
314
|
+
}
|
|
315
|
+
return t3.prototype.typeName = function() {
|
|
316
|
+
switch (this.tag.tagClass) {
|
|
317
|
+
case 0:
|
|
318
|
+
switch (this.tag.tagNumber) {
|
|
319
|
+
case 0:
|
|
320
|
+
return "EOC";
|
|
321
|
+
case 1:
|
|
322
|
+
return "BOOLEAN";
|
|
323
|
+
case 2:
|
|
324
|
+
return "INTEGER";
|
|
325
|
+
case 3:
|
|
326
|
+
return "BIT_STRING";
|
|
327
|
+
case 4:
|
|
328
|
+
return "OCTET_STRING";
|
|
329
|
+
case 5:
|
|
330
|
+
return "NULL";
|
|
331
|
+
case 6:
|
|
332
|
+
return "OBJECT_IDENTIFIER";
|
|
333
|
+
case 7:
|
|
334
|
+
return "ObjectDescriptor";
|
|
335
|
+
case 8:
|
|
336
|
+
return "EXTERNAL";
|
|
337
|
+
case 9:
|
|
338
|
+
return "REAL";
|
|
339
|
+
case 10:
|
|
340
|
+
return "ENUMERATED";
|
|
341
|
+
case 11:
|
|
342
|
+
return "EMBEDDED_PDV";
|
|
343
|
+
case 12:
|
|
344
|
+
return "UTF8String";
|
|
345
|
+
case 16:
|
|
346
|
+
return "SEQUENCE";
|
|
347
|
+
case 17:
|
|
348
|
+
return "SET";
|
|
349
|
+
case 18:
|
|
350
|
+
return "NumericString";
|
|
351
|
+
case 19:
|
|
352
|
+
return "PrintableString";
|
|
353
|
+
case 20:
|
|
354
|
+
return "TeletexString";
|
|
355
|
+
case 21:
|
|
356
|
+
return "VideotexString";
|
|
357
|
+
case 22:
|
|
358
|
+
return "IA5String";
|
|
359
|
+
case 23:
|
|
360
|
+
return "UTCTime";
|
|
361
|
+
case 24:
|
|
362
|
+
return "GeneralizedTime";
|
|
363
|
+
case 25:
|
|
364
|
+
return "GraphicString";
|
|
365
|
+
case 26:
|
|
366
|
+
return "VisibleString";
|
|
367
|
+
case 27:
|
|
368
|
+
return "GeneralString";
|
|
369
|
+
case 28:
|
|
370
|
+
return "UniversalString";
|
|
371
|
+
case 30:
|
|
372
|
+
return "BMPString";
|
|
373
|
+
}
|
|
374
|
+
return "Universal_" + this.tag.tagNumber.toString();
|
|
375
|
+
case 1:
|
|
376
|
+
return "Application_" + this.tag.tagNumber.toString();
|
|
377
|
+
case 2:
|
|
378
|
+
return "[" + this.tag.tagNumber.toString() + "]";
|
|
379
|
+
case 3:
|
|
380
|
+
return "Private_" + this.tag.tagNumber.toString();
|
|
381
|
+
}
|
|
382
|
+
}, t3.prototype.content = function(t4) {
|
|
383
|
+
if (void 0 === this.tag) return null;
|
|
384
|
+
void 0 === t4 && (t4 = 1 / 0);
|
|
385
|
+
var e3 = this.posContent(), r2 = Math.abs(this.length);
|
|
386
|
+
if (!this.tag.isUniversal()) return null !== this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(e3, e3 + r2, t4);
|
|
387
|
+
switch (this.tag.tagNumber) {
|
|
388
|
+
case 1:
|
|
389
|
+
return 0 === this.stream.get(e3) ? "false" : "true";
|
|
390
|
+
case 2:
|
|
391
|
+
return this.stream.parseInteger(e3, e3 + r2);
|
|
392
|
+
case 3:
|
|
393
|
+
return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(e3, e3 + r2, t4);
|
|
394
|
+
case 4:
|
|
395
|
+
return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(e3, e3 + r2, t4);
|
|
396
|
+
case 6:
|
|
397
|
+
return this.stream.parseOID(e3, e3 + r2, t4);
|
|
398
|
+
case 16:
|
|
399
|
+
case 17:
|
|
400
|
+
return null !== this.sub ? "(" + this.sub.length + " elem)" : "(no elem)";
|
|
401
|
+
case 12:
|
|
402
|
+
return T(this.stream.parseStringUTF(e3, e3 + r2), t4);
|
|
403
|
+
case 18:
|
|
404
|
+
case 19:
|
|
405
|
+
case 20:
|
|
406
|
+
case 21:
|
|
407
|
+
case 22:
|
|
408
|
+
case 26:
|
|
409
|
+
return T(this.stream.parseStringISO(e3, e3 + r2), t4);
|
|
410
|
+
case 30:
|
|
411
|
+
return T(this.stream.parseStringBMP(e3, e3 + r2), t4);
|
|
412
|
+
case 23:
|
|
413
|
+
case 24:
|
|
414
|
+
return this.stream.parseTime(e3, e3 + r2, 23 == this.tag.tagNumber);
|
|
415
|
+
}
|
|
416
|
+
return null;
|
|
417
|
+
}, t3.prototype.toString = function() {
|
|
418
|
+
return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (null === this.sub ? "null" : this.sub.length) + "]";
|
|
419
|
+
}, t3.prototype.toPrettyString = function(t4) {
|
|
420
|
+
void 0 === t4 && (t4 = "");
|
|
421
|
+
var e3 = t4 + this.typeName() + " @" + this.stream.pos;
|
|
422
|
+
if (this.length >= 0 && (e3 += "+"), e3 += this.length, this.tag.tagConstructed ? e3 += " (constructed)" : !this.tag.isUniversal() || 3 != this.tag.tagNumber && 4 != this.tag.tagNumber || null === this.sub || (e3 += " (encapsulates)"), e3 += "\n", null !== this.sub) {
|
|
423
|
+
t4 += " ";
|
|
424
|
+
for (var r2 = 0, i2 = this.sub.length; r2 < i2; ++r2) e3 += this.sub[r2].toPrettyString(t4);
|
|
425
|
+
}
|
|
426
|
+
return e3;
|
|
427
|
+
}, t3.prototype.posStart = function() {
|
|
428
|
+
return this.stream.pos;
|
|
429
|
+
}, t3.prototype.posContent = function() {
|
|
430
|
+
return this.stream.pos + this.header;
|
|
431
|
+
}, t3.prototype.posEnd = function() {
|
|
432
|
+
return this.stream.pos + this.header + Math.abs(this.length);
|
|
433
|
+
}, t3.prototype.toHexString = function() {
|
|
434
|
+
return this.stream.hexDump(this.posStart(), this.posEnd(), true);
|
|
435
|
+
}, t3.decodeLength = function(t4) {
|
|
436
|
+
var e3 = t4.get(), r2 = 127 & e3;
|
|
437
|
+
if (r2 == e3) return r2;
|
|
438
|
+
if (r2 > 6) throw new Error("Length over 48 bits not supported at position " + (t4.pos - 1));
|
|
439
|
+
if (0 === r2) return null;
|
|
440
|
+
e3 = 0;
|
|
441
|
+
for (var i2 = 0; i2 < r2; ++i2) e3 = 256 * e3 + t4.get();
|
|
442
|
+
return e3;
|
|
443
|
+
}, t3.prototype.getHexStringValue = function() {
|
|
444
|
+
var t4 = this.toHexString(), e3 = 2 * this.header, r2 = 2 * this.length;
|
|
445
|
+
return t4.substring(e3, e3 + r2);
|
|
446
|
+
}, t3.decode = function(e3) {
|
|
447
|
+
var r2;
|
|
448
|
+
r2 = e3 instanceof E ? e3 : new E(e3, 0);
|
|
449
|
+
var i2 = new E(r2), n2 = new D(r2), s2 = t3.decodeLength(r2), o2 = r2.pos, h2 = o2 - i2.pos, a2 = null, u2 = function() {
|
|
450
|
+
var e4 = [];
|
|
451
|
+
if (null !== s2) {
|
|
452
|
+
for (var i3 = o2 + s2; r2.pos < i3; ) e4[e4.length] = t3.decode(r2);
|
|
453
|
+
if (r2.pos != i3) throw new Error("Content size is not correct for container starting at offset " + o2);
|
|
454
|
+
} else try {
|
|
455
|
+
for (; ; ) {
|
|
456
|
+
var n3 = t3.decode(r2);
|
|
457
|
+
if (n3.tag.isEOC()) break;
|
|
458
|
+
e4[e4.length] = n3;
|
|
459
|
+
}
|
|
460
|
+
s2 = o2 - r2.pos;
|
|
461
|
+
} catch (t4) {
|
|
462
|
+
throw new Error("Exception while decoding undefined length content: " + t4);
|
|
463
|
+
}
|
|
464
|
+
return e4;
|
|
465
|
+
};
|
|
466
|
+
if (n2.tagConstructed) a2 = u2();
|
|
467
|
+
else if (n2.isUniversal() && (3 == n2.tagNumber || 4 == n2.tagNumber)) try {
|
|
468
|
+
if (3 == n2.tagNumber && 0 != r2.get()) throw new Error("BIT STRINGs with unused bits cannot encapsulate.");
|
|
469
|
+
a2 = u2();
|
|
470
|
+
for (var c2 = 0; c2 < a2.length; ++c2) if (a2[c2].tag.isEOC()) throw new Error("EOC is not supposed to be actual content.");
|
|
471
|
+
} catch (t4) {
|
|
472
|
+
a2 = null;
|
|
473
|
+
}
|
|
474
|
+
if (null === a2) {
|
|
475
|
+
if (null === s2) throw new Error("We can't skip over an invalid tag with undefined length at offset " + o2);
|
|
476
|
+
r2.pos = o2 + Math.abs(s2);
|
|
477
|
+
}
|
|
478
|
+
return new t3(i2, h2, s2, n2, a2);
|
|
479
|
+
}, t3;
|
|
480
|
+
})(), D = (function() {
|
|
481
|
+
function t3(t4) {
|
|
482
|
+
var e3 = t4.get();
|
|
483
|
+
if (this.tagClass = e3 >> 6, this.tagConstructed = !!(32 & e3), this.tagNumber = 31 & e3, 31 == this.tagNumber) {
|
|
484
|
+
var r2 = new y();
|
|
485
|
+
do {
|
|
486
|
+
e3 = t4.get(), r2.mulAdd(128, 127 & e3);
|
|
487
|
+
} while (128 & e3);
|
|
488
|
+
this.tagNumber = r2.simplify();
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return t3.prototype.isUniversal = function() {
|
|
492
|
+
return 0 === this.tagClass;
|
|
493
|
+
}, t3.prototype.isEOC = function() {
|
|
494
|
+
return 0 === this.tagClass && 0 === this.tagNumber;
|
|
495
|
+
}, t3;
|
|
496
|
+
})(), x = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], R = (1 << 26) / x[x.length - 1], A = (function() {
|
|
497
|
+
function r2(t3, e3, r3) {
|
|
498
|
+
null != t3 && ("number" == typeof t3 ? this.fromNumber(t3, e3, r3) : null == e3 && "string" != typeof t3 ? this.fromString(t3, 256) : this.fromString(t3, e3));
|
|
499
|
+
}
|
|
500
|
+
return r2.prototype.toString = function(e3) {
|
|
501
|
+
if (this.s < 0) return "-" + this.negate().toString(e3);
|
|
502
|
+
var r3;
|
|
503
|
+
if (16 == e3) r3 = 4;
|
|
504
|
+
else if (8 == e3) r3 = 3;
|
|
505
|
+
else if (2 == e3) r3 = 1;
|
|
506
|
+
else if (32 == e3) r3 = 5;
|
|
507
|
+
else {
|
|
508
|
+
if (4 != e3) return this.toRadix(e3);
|
|
509
|
+
r3 = 2;
|
|
510
|
+
}
|
|
511
|
+
var i2, n2 = (1 << r3) - 1, s2 = false, o2 = "", h2 = this.t, a2 = this.DB - h2 * this.DB % r3;
|
|
512
|
+
if (h2-- > 0) for (a2 < this.DB && (i2 = this[h2] >> a2) > 0 && (s2 = true, o2 = t2(i2)); h2 >= 0; ) a2 < r3 ? (i2 = (this[h2] & (1 << a2) - 1) << r3 - a2, i2 |= this[--h2] >> (a2 += this.DB - r3)) : (i2 = this[h2] >> (a2 -= r3) & n2, a2 <= 0 && (a2 += this.DB, --h2)), i2 > 0 && (s2 = true), s2 && (o2 += t2(i2));
|
|
513
|
+
return s2 ? o2 : "0";
|
|
514
|
+
}, r2.prototype.negate = function() {
|
|
515
|
+
var t3 = N();
|
|
516
|
+
return r2.ZERO.subTo(this, t3), t3;
|
|
517
|
+
}, r2.prototype.abs = function() {
|
|
518
|
+
return this.s < 0 ? this.negate() : this;
|
|
519
|
+
}, r2.prototype.compareTo = function(t3) {
|
|
520
|
+
var e3 = this.s - t3.s;
|
|
521
|
+
if (0 != e3) return e3;
|
|
522
|
+
var r3 = this.t;
|
|
523
|
+
if (0 != (e3 = r3 - t3.t)) return this.s < 0 ? -e3 : e3;
|
|
524
|
+
for (; --r3 >= 0; ) if (0 != (e3 = this[r3] - t3[r3])) return e3;
|
|
525
|
+
return 0;
|
|
526
|
+
}, r2.prototype.bitLength = function() {
|
|
527
|
+
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + F(this[this.t - 1] ^ this.s & this.DM);
|
|
528
|
+
}, r2.prototype.mod = function(t3) {
|
|
529
|
+
var e3 = N();
|
|
530
|
+
return this.abs().divRemTo(t3, null, e3), this.s < 0 && e3.compareTo(r2.ZERO) > 0 && t3.subTo(e3, e3), e3;
|
|
531
|
+
}, r2.prototype.modPowInt = function(t3, e3) {
|
|
532
|
+
var r3;
|
|
533
|
+
return r3 = t3 < 256 || e3.isEven() ? new O(e3) : new V(e3), this.exp(t3, r3);
|
|
534
|
+
}, r2.prototype.clone = function() {
|
|
535
|
+
var t3 = N();
|
|
536
|
+
return this.copyTo(t3), t3;
|
|
537
|
+
}, r2.prototype.intValue = function() {
|
|
538
|
+
if (this.s < 0) {
|
|
539
|
+
if (1 == this.t) return this[0] - this.DV;
|
|
540
|
+
if (0 == this.t) return -1;
|
|
541
|
+
} else {
|
|
542
|
+
if (1 == this.t) return this[0];
|
|
543
|
+
if (0 == this.t) return 0;
|
|
544
|
+
}
|
|
545
|
+
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
|
|
546
|
+
}, r2.prototype.byteValue = function() {
|
|
547
|
+
return 0 == this.t ? this.s : this[0] << 24 >> 24;
|
|
548
|
+
}, r2.prototype.shortValue = function() {
|
|
549
|
+
return 0 == this.t ? this.s : this[0] << 16 >> 16;
|
|
550
|
+
}, r2.prototype.signum = function() {
|
|
551
|
+
return this.s < 0 ? -1 : this.t <= 0 || 1 == this.t && this[0] <= 0 ? 0 : 1;
|
|
552
|
+
}, r2.prototype.toByteArray = function() {
|
|
553
|
+
var t3 = this.t, e3 = [];
|
|
554
|
+
e3[0] = this.s;
|
|
555
|
+
var r3, i2 = this.DB - t3 * this.DB % 8, n2 = 0;
|
|
556
|
+
if (t3-- > 0) for (i2 < this.DB && (r3 = this[t3] >> i2) != (this.s & this.DM) >> i2 && (e3[n2++] = r3 | this.s << this.DB - i2); t3 >= 0; ) i2 < 8 ? (r3 = (this[t3] & (1 << i2) - 1) << 8 - i2, r3 |= this[--t3] >> (i2 += this.DB - 8)) : (r3 = this[t3] >> (i2 -= 8) & 255, i2 <= 0 && (i2 += this.DB, --t3)), 128 & r3 && (r3 |= -256), 0 == n2 && (128 & this.s) != (128 & r3) && ++n2, (n2 > 0 || r3 != this.s) && (e3[n2++] = r3);
|
|
557
|
+
return e3;
|
|
558
|
+
}, r2.prototype.equals = function(t3) {
|
|
559
|
+
return 0 == this.compareTo(t3);
|
|
560
|
+
}, r2.prototype.min = function(t3) {
|
|
561
|
+
return this.compareTo(t3) < 0 ? this : t3;
|
|
562
|
+
}, r2.prototype.max = function(t3) {
|
|
563
|
+
return this.compareTo(t3) > 0 ? this : t3;
|
|
564
|
+
}, r2.prototype.and = function(t3) {
|
|
565
|
+
var r3 = N();
|
|
566
|
+
return this.bitwiseTo(t3, e2, r3), r3;
|
|
567
|
+
}, r2.prototype.or = function(t3) {
|
|
568
|
+
var e3 = N();
|
|
569
|
+
return this.bitwiseTo(t3, n, e3), e3;
|
|
570
|
+
}, r2.prototype.xor = function(t3) {
|
|
571
|
+
var e3 = N();
|
|
572
|
+
return this.bitwiseTo(t3, s, e3), e3;
|
|
573
|
+
}, r2.prototype.andNot = function(t3) {
|
|
574
|
+
var e3 = N();
|
|
575
|
+
return this.bitwiseTo(t3, o, e3), e3;
|
|
576
|
+
}, r2.prototype.not = function() {
|
|
577
|
+
for (var t3 = N(), e3 = 0; e3 < this.t; ++e3) t3[e3] = this.DM & ~this[e3];
|
|
578
|
+
return t3.t = this.t, t3.s = ~this.s, t3;
|
|
579
|
+
}, r2.prototype.shiftLeft = function(t3) {
|
|
580
|
+
var e3 = N();
|
|
581
|
+
return t3 < 0 ? this.rShiftTo(-t3, e3) : this.lShiftTo(t3, e3), e3;
|
|
582
|
+
}, r2.prototype.shiftRight = function(t3) {
|
|
583
|
+
var e3 = N();
|
|
584
|
+
return t3 < 0 ? this.lShiftTo(-t3, e3) : this.rShiftTo(t3, e3), e3;
|
|
585
|
+
}, r2.prototype.getLowestSetBit = function() {
|
|
586
|
+
for (var t3 = 0; t3 < this.t; ++t3) if (0 != this[t3]) return t3 * this.DB + h(this[t3]);
|
|
587
|
+
return this.s < 0 ? this.t * this.DB : -1;
|
|
588
|
+
}, r2.prototype.bitCount = function() {
|
|
589
|
+
for (var t3 = 0, e3 = this.s & this.DM, r3 = 0; r3 < this.t; ++r3) t3 += a(this[r3] ^ e3);
|
|
590
|
+
return t3;
|
|
591
|
+
}, r2.prototype.testBit = function(t3) {
|
|
592
|
+
var e3 = Math.floor(t3 / this.DB);
|
|
593
|
+
return e3 >= this.t ? 0 != this.s : !!(this[e3] & 1 << t3 % this.DB);
|
|
594
|
+
}, r2.prototype.setBit = function(t3) {
|
|
595
|
+
return this.changeBit(t3, n);
|
|
596
|
+
}, r2.prototype.clearBit = function(t3) {
|
|
597
|
+
return this.changeBit(t3, o);
|
|
598
|
+
}, r2.prototype.flipBit = function(t3) {
|
|
599
|
+
return this.changeBit(t3, s);
|
|
600
|
+
}, r2.prototype.add = function(t3) {
|
|
601
|
+
var e3 = N();
|
|
602
|
+
return this.addTo(t3, e3), e3;
|
|
603
|
+
}, r2.prototype.subtract = function(t3) {
|
|
604
|
+
var e3 = N();
|
|
605
|
+
return this.subTo(t3, e3), e3;
|
|
606
|
+
}, r2.prototype.multiply = function(t3) {
|
|
607
|
+
var e3 = N();
|
|
608
|
+
return this.multiplyTo(t3, e3), e3;
|
|
609
|
+
}, r2.prototype.divide = function(t3) {
|
|
610
|
+
var e3 = N();
|
|
611
|
+
return this.divRemTo(t3, e3, null), e3;
|
|
612
|
+
}, r2.prototype.remainder = function(t3) {
|
|
613
|
+
var e3 = N();
|
|
614
|
+
return this.divRemTo(t3, null, e3), e3;
|
|
615
|
+
}, r2.prototype.divideAndRemainder = function(t3) {
|
|
616
|
+
var e3 = N(), r3 = N();
|
|
617
|
+
return this.divRemTo(t3, e3, r3), [e3, r3];
|
|
618
|
+
}, r2.prototype.modPow = function(t3, e3) {
|
|
619
|
+
var r3, i2, n2 = t3.bitLength(), s2 = H(1);
|
|
620
|
+
if (n2 <= 0) return s2;
|
|
621
|
+
r3 = n2 < 18 ? 1 : n2 < 48 ? 3 : n2 < 144 ? 4 : n2 < 768 ? 5 : 6, i2 = n2 < 8 ? new O(e3) : e3.isEven() ? new I(e3) : new V(e3);
|
|
622
|
+
var o2 = [], h2 = 3, a2 = r3 - 1, u2 = (1 << r3) - 1;
|
|
623
|
+
if (o2[1] = i2.convert(this), r3 > 1) {
|
|
624
|
+
var c2 = N();
|
|
625
|
+
for (i2.sqrTo(o2[1], c2); h2 <= u2; ) o2[h2] = N(), i2.mulTo(c2, o2[h2 - 2], o2[h2]), h2 += 2;
|
|
626
|
+
}
|
|
627
|
+
var f2, l2, p2 = t3.t - 1, g2 = true, d2 = N();
|
|
628
|
+
for (n2 = F(t3[p2]) - 1; p2 >= 0; ) {
|
|
629
|
+
for (n2 >= a2 ? f2 = t3[p2] >> n2 - a2 & u2 : (f2 = (t3[p2] & (1 << n2 + 1) - 1) << a2 - n2, p2 > 0 && (f2 |= t3[p2 - 1] >> this.DB + n2 - a2)), h2 = r3; !(1 & f2); ) f2 >>= 1, --h2;
|
|
630
|
+
if ((n2 -= h2) < 0 && (n2 += this.DB, --p2), g2) o2[f2].copyTo(s2), g2 = false;
|
|
631
|
+
else {
|
|
632
|
+
for (; h2 > 1; ) i2.sqrTo(s2, d2), i2.sqrTo(d2, s2), h2 -= 2;
|
|
633
|
+
h2 > 0 ? i2.sqrTo(s2, d2) : (l2 = s2, s2 = d2, d2 = l2), i2.mulTo(d2, o2[f2], s2);
|
|
634
|
+
}
|
|
635
|
+
for (; p2 >= 0 && !(t3[p2] & 1 << n2); ) i2.sqrTo(s2, d2), l2 = s2, s2 = d2, d2 = l2, --n2 < 0 && (n2 = this.DB - 1, --p2);
|
|
636
|
+
}
|
|
637
|
+
return i2.revert(s2);
|
|
638
|
+
}, r2.prototype.modInverse = function(t3) {
|
|
639
|
+
var e3 = t3.isEven();
|
|
640
|
+
if (this.isEven() && e3 || 0 == t3.signum()) return r2.ZERO;
|
|
641
|
+
for (var i2 = t3.clone(), n2 = this.clone(), s2 = H(1), o2 = H(0), h2 = H(0), a2 = H(1); 0 != i2.signum(); ) {
|
|
642
|
+
for (; i2.isEven(); ) i2.rShiftTo(1, i2), e3 ? (s2.isEven() && o2.isEven() || (s2.addTo(this, s2), o2.subTo(t3, o2)), s2.rShiftTo(1, s2)) : o2.isEven() || o2.subTo(t3, o2), o2.rShiftTo(1, o2);
|
|
643
|
+
for (; n2.isEven(); ) n2.rShiftTo(1, n2), e3 ? (h2.isEven() && a2.isEven() || (h2.addTo(this, h2), a2.subTo(t3, a2)), h2.rShiftTo(1, h2)) : a2.isEven() || a2.subTo(t3, a2), a2.rShiftTo(1, a2);
|
|
644
|
+
i2.compareTo(n2) >= 0 ? (i2.subTo(n2, i2), e3 && s2.subTo(h2, s2), o2.subTo(a2, o2)) : (n2.subTo(i2, n2), e3 && h2.subTo(s2, h2), a2.subTo(o2, a2));
|
|
645
|
+
}
|
|
646
|
+
return 0 != n2.compareTo(r2.ONE) ? r2.ZERO : a2.compareTo(t3) >= 0 ? a2.subtract(t3) : a2.signum() < 0 ? (a2.addTo(t3, a2), a2.signum() < 0 ? a2.add(t3) : a2) : a2;
|
|
647
|
+
}, r2.prototype.pow = function(t3) {
|
|
648
|
+
return this.exp(t3, new B());
|
|
649
|
+
}, r2.prototype.gcd = function(t3) {
|
|
650
|
+
var e3 = this.s < 0 ? this.negate() : this.clone(), r3 = t3.s < 0 ? t3.negate() : t3.clone();
|
|
651
|
+
if (e3.compareTo(r3) < 0) {
|
|
652
|
+
var i2 = e3;
|
|
653
|
+
e3 = r3, r3 = i2;
|
|
654
|
+
}
|
|
655
|
+
var n2 = e3.getLowestSetBit(), s2 = r3.getLowestSetBit();
|
|
656
|
+
if (s2 < 0) return e3;
|
|
657
|
+
for (n2 < s2 && (s2 = n2), s2 > 0 && (e3.rShiftTo(s2, e3), r3.rShiftTo(s2, r3)); e3.signum() > 0; ) (n2 = e3.getLowestSetBit()) > 0 && e3.rShiftTo(n2, e3), (n2 = r3.getLowestSetBit()) > 0 && r3.rShiftTo(n2, r3), e3.compareTo(r3) >= 0 ? (e3.subTo(r3, e3), e3.rShiftTo(1, e3)) : (r3.subTo(e3, r3), r3.rShiftTo(1, r3));
|
|
658
|
+
return s2 > 0 && r3.lShiftTo(s2, r3), r3;
|
|
659
|
+
}, r2.prototype.isProbablePrime = function(t3) {
|
|
660
|
+
var e3, r3 = this.abs();
|
|
661
|
+
if (1 == r3.t && r3[0] <= x[x.length - 1]) {
|
|
662
|
+
for (e3 = 0; e3 < x.length; ++e3) if (r3[0] == x[e3]) return true;
|
|
663
|
+
return false;
|
|
664
|
+
}
|
|
665
|
+
if (r3.isEven()) return false;
|
|
666
|
+
for (e3 = 1; e3 < x.length; ) {
|
|
667
|
+
for (var i2 = x[e3], n2 = e3 + 1; n2 < x.length && i2 < R; ) i2 *= x[n2++];
|
|
668
|
+
for (i2 = r3.modInt(i2); e3 < n2; ) if (i2 % x[e3++] == 0) return false;
|
|
669
|
+
}
|
|
670
|
+
return r3.millerRabin(t3);
|
|
671
|
+
}, r2.prototype.copyTo = function(t3) {
|
|
672
|
+
for (var e3 = this.t - 1; e3 >= 0; --e3) t3[e3] = this[e3];
|
|
673
|
+
t3.t = this.t, t3.s = this.s;
|
|
674
|
+
}, r2.prototype.fromInt = function(t3) {
|
|
675
|
+
this.t = 1, this.s = t3 < 0 ? -1 : 0, t3 > 0 ? this[0] = t3 : t3 < -1 ? this[0] = t3 + this.DV : this.t = 0;
|
|
676
|
+
}, r2.prototype.fromString = function(t3, e3) {
|
|
677
|
+
var i2;
|
|
678
|
+
if (16 == e3) i2 = 4;
|
|
679
|
+
else if (8 == e3) i2 = 3;
|
|
680
|
+
else if (256 == e3) i2 = 8;
|
|
681
|
+
else if (2 == e3) i2 = 1;
|
|
682
|
+
else if (32 == e3) i2 = 5;
|
|
683
|
+
else {
|
|
684
|
+
if (4 != e3) return void this.fromRadix(t3, e3);
|
|
685
|
+
i2 = 2;
|
|
686
|
+
}
|
|
687
|
+
this.t = 0, this.s = 0;
|
|
688
|
+
for (var n2 = t3.length, s2 = false, o2 = 0; --n2 >= 0; ) {
|
|
689
|
+
var h2 = 8 == i2 ? 255 & +t3[n2] : C(t3, n2);
|
|
690
|
+
h2 < 0 ? "-" == t3.charAt(n2) && (s2 = true) : (s2 = false, 0 == o2 ? this[this.t++] = h2 : o2 + i2 > this.DB ? (this[this.t - 1] |= (h2 & (1 << this.DB - o2) - 1) << o2, this[this.t++] = h2 >> this.DB - o2) : this[this.t - 1] |= h2 << o2, (o2 += i2) >= this.DB && (o2 -= this.DB));
|
|
691
|
+
}
|
|
692
|
+
8 == i2 && 128 & +t3[0] && (this.s = -1, o2 > 0 && (this[this.t - 1] |= (1 << this.DB - o2) - 1 << o2)), this.clamp(), s2 && r2.ZERO.subTo(this, this);
|
|
693
|
+
}, r2.prototype.clamp = function() {
|
|
694
|
+
for (var t3 = this.s & this.DM; this.t > 0 && this[this.t - 1] == t3; ) --this.t;
|
|
695
|
+
}, r2.prototype.dlShiftTo = function(t3, e3) {
|
|
696
|
+
var r3;
|
|
697
|
+
for (r3 = this.t - 1; r3 >= 0; --r3) e3[r3 + t3] = this[r3];
|
|
698
|
+
for (r3 = t3 - 1; r3 >= 0; --r3) e3[r3] = 0;
|
|
699
|
+
e3.t = this.t + t3, e3.s = this.s;
|
|
700
|
+
}, r2.prototype.drShiftTo = function(t3, e3) {
|
|
701
|
+
for (var r3 = t3; r3 < this.t; ++r3) e3[r3 - t3] = this[r3];
|
|
702
|
+
e3.t = Math.max(this.t - t3, 0), e3.s = this.s;
|
|
703
|
+
}, r2.prototype.lShiftTo = function(t3, e3) {
|
|
704
|
+
for (var r3 = t3 % this.DB, i2 = this.DB - r3, n2 = (1 << i2) - 1, s2 = Math.floor(t3 / this.DB), o2 = this.s << r3 & this.DM, h2 = this.t - 1; h2 >= 0; --h2) e3[h2 + s2 + 1] = this[h2] >> i2 | o2, o2 = (this[h2] & n2) << r3;
|
|
705
|
+
for (h2 = s2 - 1; h2 >= 0; --h2) e3[h2] = 0;
|
|
706
|
+
e3[s2] = o2, e3.t = this.t + s2 + 1, e3.s = this.s, e3.clamp();
|
|
707
|
+
}, r2.prototype.rShiftTo = function(t3, e3) {
|
|
708
|
+
e3.s = this.s;
|
|
709
|
+
var r3 = Math.floor(t3 / this.DB);
|
|
710
|
+
if (r3 >= this.t) e3.t = 0;
|
|
711
|
+
else {
|
|
712
|
+
var i2 = t3 % this.DB, n2 = this.DB - i2, s2 = (1 << i2) - 1;
|
|
713
|
+
e3[0] = this[r3] >> i2;
|
|
714
|
+
for (var o2 = r3 + 1; o2 < this.t; ++o2) e3[o2 - r3 - 1] |= (this[o2] & s2) << n2, e3[o2 - r3] = this[o2] >> i2;
|
|
715
|
+
i2 > 0 && (e3[this.t - r3 - 1] |= (this.s & s2) << n2), e3.t = this.t - r3, e3.clamp();
|
|
716
|
+
}
|
|
717
|
+
}, r2.prototype.subTo = function(t3, e3) {
|
|
718
|
+
for (var r3 = 0, i2 = 0, n2 = Math.min(t3.t, this.t); r3 < n2; ) i2 += this[r3] - t3[r3], e3[r3++] = i2 & this.DM, i2 >>= this.DB;
|
|
719
|
+
if (t3.t < this.t) {
|
|
720
|
+
for (i2 -= t3.s; r3 < this.t; ) i2 += this[r3], e3[r3++] = i2 & this.DM, i2 >>= this.DB;
|
|
721
|
+
i2 += this.s;
|
|
722
|
+
} else {
|
|
723
|
+
for (i2 += this.s; r3 < t3.t; ) i2 -= t3[r3], e3[r3++] = i2 & this.DM, i2 >>= this.DB;
|
|
724
|
+
i2 -= t3.s;
|
|
725
|
+
}
|
|
726
|
+
e3.s = i2 < 0 ? -1 : 0, i2 < -1 ? e3[r3++] = this.DV + i2 : i2 > 0 && (e3[r3++] = i2), e3.t = r3, e3.clamp();
|
|
727
|
+
}, r2.prototype.multiplyTo = function(t3, e3) {
|
|
728
|
+
var i2 = this.abs(), n2 = t3.abs(), s2 = i2.t;
|
|
729
|
+
for (e3.t = s2 + n2.t; --s2 >= 0; ) e3[s2] = 0;
|
|
730
|
+
for (s2 = 0; s2 < n2.t; ++s2) e3[s2 + i2.t] = i2.am(0, n2[s2], e3, s2, 0, i2.t);
|
|
731
|
+
e3.s = 0, e3.clamp(), this.s != t3.s && r2.ZERO.subTo(e3, e3);
|
|
732
|
+
}, r2.prototype.squareTo = function(t3) {
|
|
733
|
+
for (var e3 = this.abs(), r3 = t3.t = 2 * e3.t; --r3 >= 0; ) t3[r3] = 0;
|
|
734
|
+
for (r3 = 0; r3 < e3.t - 1; ++r3) {
|
|
735
|
+
var i2 = e3.am(r3, e3[r3], t3, 2 * r3, 0, 1);
|
|
736
|
+
(t3[r3 + e3.t] += e3.am(r3 + 1, 2 * e3[r3], t3, 2 * r3 + 1, i2, e3.t - r3 - 1)) >= e3.DV && (t3[r3 + e3.t] -= e3.DV, t3[r3 + e3.t + 1] = 1);
|
|
737
|
+
}
|
|
738
|
+
t3.t > 0 && (t3[t3.t - 1] += e3.am(r3, e3[r3], t3, 2 * r3, 0, 1)), t3.s = 0, t3.clamp();
|
|
739
|
+
}, r2.prototype.divRemTo = function(t3, e3, i2) {
|
|
740
|
+
var n2 = t3.abs();
|
|
741
|
+
if (!(n2.t <= 0)) {
|
|
742
|
+
var s2 = this.abs();
|
|
743
|
+
if (s2.t < n2.t) return null != e3 && e3.fromInt(0), void (null != i2 && this.copyTo(i2));
|
|
744
|
+
null == i2 && (i2 = N());
|
|
745
|
+
var o2 = N(), h2 = this.s, a2 = t3.s, u2 = this.DB - F(n2[n2.t - 1]);
|
|
746
|
+
u2 > 0 ? (n2.lShiftTo(u2, o2), s2.lShiftTo(u2, i2)) : (n2.copyTo(o2), s2.copyTo(i2));
|
|
747
|
+
var c2 = o2.t, f2 = o2[c2 - 1];
|
|
748
|
+
if (0 != f2) {
|
|
749
|
+
var l2 = f2 * (1 << this.F1) + (c2 > 1 ? o2[c2 - 2] >> this.F2 : 0), p2 = this.FV / l2, g2 = (1 << this.F1) / l2, d2 = 1 << this.F2, v2 = i2.t, y2 = v2 - c2, m2 = null == e3 ? N() : e3;
|
|
750
|
+
for (o2.dlShiftTo(y2, m2), i2.compareTo(m2) >= 0 && (i2[i2.t++] = 1, i2.subTo(m2, i2)), r2.ONE.dlShiftTo(c2, m2), m2.subTo(o2, o2); o2.t < c2; ) o2[o2.t++] = 0;
|
|
751
|
+
for (; --y2 >= 0; ) {
|
|
752
|
+
var b2 = i2[--v2] == f2 ? this.DM : Math.floor(i2[v2] * p2 + (i2[v2 - 1] + d2) * g2);
|
|
753
|
+
if ((i2[v2] += o2.am(0, b2, i2, y2, 0, c2)) < b2) for (o2.dlShiftTo(y2, m2), i2.subTo(m2, i2); i2[v2] < --b2; ) i2.subTo(m2, i2);
|
|
754
|
+
}
|
|
755
|
+
null != e3 && (i2.drShiftTo(c2, e3), h2 != a2 && r2.ZERO.subTo(e3, e3)), i2.t = c2, i2.clamp(), u2 > 0 && i2.rShiftTo(u2, i2), h2 < 0 && r2.ZERO.subTo(i2, i2);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}, r2.prototype.invDigit = function() {
|
|
759
|
+
if (this.t < 1) return 0;
|
|
760
|
+
var t3 = this[0];
|
|
761
|
+
if (!(1 & t3)) return 0;
|
|
762
|
+
var e3 = 3 & t3;
|
|
763
|
+
return (e3 = (e3 = (e3 = (e3 = e3 * (2 - (15 & t3) * e3) & 15) * (2 - (255 & t3) * e3) & 255) * (2 - ((65535 & t3) * e3 & 65535)) & 65535) * (2 - t3 * e3 % this.DV) % this.DV) > 0 ? this.DV - e3 : -e3;
|
|
764
|
+
}, r2.prototype.isEven = function() {
|
|
765
|
+
return 0 == (this.t > 0 ? 1 & this[0] : this.s);
|
|
766
|
+
}, r2.prototype.exp = function(t3, e3) {
|
|
767
|
+
if (t3 > 4294967295 || t3 < 1) return r2.ONE;
|
|
768
|
+
var i2 = N(), n2 = N(), s2 = e3.convert(this), o2 = F(t3) - 1;
|
|
769
|
+
for (s2.copyTo(i2); --o2 >= 0; ) if (e3.sqrTo(i2, n2), (t3 & 1 << o2) > 0) e3.mulTo(n2, s2, i2);
|
|
770
|
+
else {
|
|
771
|
+
var h2 = i2;
|
|
772
|
+
i2 = n2, n2 = h2;
|
|
773
|
+
}
|
|
774
|
+
return e3.revert(i2);
|
|
775
|
+
}, r2.prototype.chunkSize = function(t3) {
|
|
776
|
+
return Math.floor(Math.LN2 * this.DB / Math.log(t3));
|
|
777
|
+
}, r2.prototype.toRadix = function(t3) {
|
|
778
|
+
if (null == t3 && (t3 = 10), 0 == this.signum() || t3 < 2 || t3 > 36) return "0";
|
|
779
|
+
var e3 = this.chunkSize(t3), r3 = Math.pow(t3, e3), i2 = H(r3), n2 = N(), s2 = N(), o2 = "";
|
|
780
|
+
for (this.divRemTo(i2, n2, s2); n2.signum() > 0; ) o2 = (r3 + s2.intValue()).toString(t3).substring(1) + o2, n2.divRemTo(i2, n2, s2);
|
|
781
|
+
return s2.intValue().toString(t3) + o2;
|
|
782
|
+
}, r2.prototype.fromRadix = function(t3, e3) {
|
|
783
|
+
this.fromInt(0), null == e3 && (e3 = 10);
|
|
784
|
+
for (var i2 = this.chunkSize(e3), n2 = Math.pow(e3, i2), s2 = false, o2 = 0, h2 = 0, a2 = 0; a2 < t3.length; ++a2) {
|
|
785
|
+
var u2 = C(t3, a2);
|
|
786
|
+
u2 < 0 ? "-" == t3.charAt(a2) && 0 == this.signum() && (s2 = true) : (h2 = e3 * h2 + u2, ++o2 >= i2 && (this.dMultiply(n2), this.dAddOffset(h2, 0), o2 = 0, h2 = 0));
|
|
787
|
+
}
|
|
788
|
+
o2 > 0 && (this.dMultiply(Math.pow(e3, o2)), this.dAddOffset(h2, 0)), s2 && r2.ZERO.subTo(this, this);
|
|
789
|
+
}, r2.prototype.fromNumber = function(t3, e3, i2) {
|
|
790
|
+
if ("number" == typeof e3) if (t3 < 2) this.fromInt(1);
|
|
791
|
+
else for (this.fromNumber(t3, i2), this.testBit(t3 - 1) || this.bitwiseTo(r2.ONE.shiftLeft(t3 - 1), n, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(e3); ) this.dAddOffset(2, 0), this.bitLength() > t3 && this.subTo(r2.ONE.shiftLeft(t3 - 1), this);
|
|
792
|
+
else {
|
|
793
|
+
var s2 = [], o2 = 7 & t3;
|
|
794
|
+
s2.length = 1 + (t3 >> 3), e3.nextBytes(s2), o2 > 0 ? s2[0] &= (1 << o2) - 1 : s2[0] = 0, this.fromString(s2, 256);
|
|
795
|
+
}
|
|
796
|
+
}, r2.prototype.bitwiseTo = function(t3, e3, r3) {
|
|
797
|
+
var i2, n2, s2 = Math.min(t3.t, this.t);
|
|
798
|
+
for (i2 = 0; i2 < s2; ++i2) r3[i2] = e3(this[i2], t3[i2]);
|
|
799
|
+
if (t3.t < this.t) {
|
|
800
|
+
for (n2 = t3.s & this.DM, i2 = s2; i2 < this.t; ++i2) r3[i2] = e3(this[i2], n2);
|
|
801
|
+
r3.t = this.t;
|
|
802
|
+
} else {
|
|
803
|
+
for (n2 = this.s & this.DM, i2 = s2; i2 < t3.t; ++i2) r3[i2] = e3(n2, t3[i2]);
|
|
804
|
+
r3.t = t3.t;
|
|
805
|
+
}
|
|
806
|
+
r3.s = e3(this.s, t3.s), r3.clamp();
|
|
807
|
+
}, r2.prototype.changeBit = function(t3, e3) {
|
|
808
|
+
var i2 = r2.ONE.shiftLeft(t3);
|
|
809
|
+
return this.bitwiseTo(i2, e3, i2), i2;
|
|
810
|
+
}, r2.prototype.addTo = function(t3, e3) {
|
|
811
|
+
for (var r3 = 0, i2 = 0, n2 = Math.min(t3.t, this.t); r3 < n2; ) i2 += this[r3] + t3[r3], e3[r3++] = i2 & this.DM, i2 >>= this.DB;
|
|
812
|
+
if (t3.t < this.t) {
|
|
813
|
+
for (i2 += t3.s; r3 < this.t; ) i2 += this[r3], e3[r3++] = i2 & this.DM, i2 >>= this.DB;
|
|
814
|
+
i2 += this.s;
|
|
815
|
+
} else {
|
|
816
|
+
for (i2 += this.s; r3 < t3.t; ) i2 += t3[r3], e3[r3++] = i2 & this.DM, i2 >>= this.DB;
|
|
817
|
+
i2 += t3.s;
|
|
818
|
+
}
|
|
819
|
+
e3.s = i2 < 0 ? -1 : 0, i2 > 0 ? e3[r3++] = i2 : i2 < -1 && (e3[r3++] = this.DV + i2), e3.t = r3, e3.clamp();
|
|
820
|
+
}, r2.prototype.dMultiply = function(t3) {
|
|
821
|
+
this[this.t] = this.am(0, t3 - 1, this, 0, 0, this.t), ++this.t, this.clamp();
|
|
822
|
+
}, r2.prototype.dAddOffset = function(t3, e3) {
|
|
823
|
+
if (0 != t3) {
|
|
824
|
+
for (; this.t <= e3; ) this[this.t++] = 0;
|
|
825
|
+
for (this[e3] += t3; this[e3] >= this.DV; ) this[e3] -= this.DV, ++e3 >= this.t && (this[this.t++] = 0), ++this[e3];
|
|
826
|
+
}
|
|
827
|
+
}, r2.prototype.multiplyLowerTo = function(t3, e3, r3) {
|
|
828
|
+
var i2 = Math.min(this.t + t3.t, e3);
|
|
829
|
+
for (r3.s = 0, r3.t = i2; i2 > 0; ) r3[--i2] = 0;
|
|
830
|
+
for (var n2 = r3.t - this.t; i2 < n2; ++i2) r3[i2 + this.t] = this.am(0, t3[i2], r3, i2, 0, this.t);
|
|
831
|
+
for (n2 = Math.min(t3.t, e3); i2 < n2; ++i2) this.am(0, t3[i2], r3, i2, 0, e3 - i2);
|
|
832
|
+
r3.clamp();
|
|
833
|
+
}, r2.prototype.multiplyUpperTo = function(t3, e3, r3) {
|
|
834
|
+
--e3;
|
|
835
|
+
var i2 = r3.t = this.t + t3.t - e3;
|
|
836
|
+
for (r3.s = 0; --i2 >= 0; ) r3[i2] = 0;
|
|
837
|
+
for (i2 = Math.max(e3 - this.t, 0); i2 < t3.t; ++i2) r3[this.t + i2 - e3] = this.am(e3 - i2, t3[i2], r3, 0, 0, this.t + i2 - e3);
|
|
838
|
+
r3.clamp(), r3.drShiftTo(1, r3);
|
|
839
|
+
}, r2.prototype.modInt = function(t3) {
|
|
840
|
+
if (t3 <= 0) return 0;
|
|
841
|
+
var e3 = this.DV % t3, r3 = this.s < 0 ? t3 - 1 : 0;
|
|
842
|
+
if (this.t > 0) if (0 == e3) r3 = this[0] % t3;
|
|
843
|
+
else for (var i2 = this.t - 1; i2 >= 0; --i2) r3 = (e3 * r3 + this[i2]) % t3;
|
|
844
|
+
return r3;
|
|
845
|
+
}, r2.prototype.millerRabin = function(t3) {
|
|
846
|
+
var e3 = this.subtract(r2.ONE), i2 = e3.getLowestSetBit();
|
|
847
|
+
if (i2 <= 0) return false;
|
|
848
|
+
var n2 = e3.shiftRight(i2);
|
|
849
|
+
(t3 = t3 + 1 >> 1) > x.length && (t3 = x.length);
|
|
850
|
+
for (var s2 = N(), o2 = 0; o2 < t3; ++o2) {
|
|
851
|
+
s2.fromInt(x[Math.floor(Math.random() * x.length)]);
|
|
852
|
+
var h2 = s2.modPow(n2, this);
|
|
853
|
+
if (0 != h2.compareTo(r2.ONE) && 0 != h2.compareTo(e3)) {
|
|
854
|
+
for (var a2 = 1; a2++ < i2 && 0 != h2.compareTo(e3); ) if (0 == (h2 = h2.modPowInt(2, this)).compareTo(r2.ONE)) return false;
|
|
855
|
+
if (0 != h2.compareTo(e3)) return false;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
return true;
|
|
859
|
+
}, r2.prototype.square = function() {
|
|
860
|
+
var t3 = N();
|
|
861
|
+
return this.squareTo(t3), t3;
|
|
862
|
+
}, r2.prototype.gcda = function(t3, e3) {
|
|
863
|
+
var r3 = this.s < 0 ? this.negate() : this.clone(), i2 = t3.s < 0 ? t3.negate() : t3.clone();
|
|
864
|
+
if (r3.compareTo(i2) < 0) {
|
|
865
|
+
var n2 = r3;
|
|
866
|
+
r3 = i2, i2 = n2;
|
|
867
|
+
}
|
|
868
|
+
var s2 = r3.getLowestSetBit(), o2 = i2.getLowestSetBit();
|
|
869
|
+
if (o2 < 0) e3(r3);
|
|
870
|
+
else {
|
|
871
|
+
s2 < o2 && (o2 = s2), o2 > 0 && (r3.rShiftTo(o2, r3), i2.rShiftTo(o2, i2));
|
|
872
|
+
var h2 = function() {
|
|
873
|
+
(s2 = r3.getLowestSetBit()) > 0 && r3.rShiftTo(s2, r3), (s2 = i2.getLowestSetBit()) > 0 && i2.rShiftTo(s2, i2), r3.compareTo(i2) >= 0 ? (r3.subTo(i2, r3), r3.rShiftTo(1, r3)) : (i2.subTo(r3, i2), i2.rShiftTo(1, i2)), r3.signum() > 0 ? setTimeout(h2, 0) : (o2 > 0 && i2.lShiftTo(o2, i2), setTimeout(function() {
|
|
874
|
+
e3(i2);
|
|
875
|
+
}, 0));
|
|
876
|
+
};
|
|
877
|
+
setTimeout(h2, 10);
|
|
878
|
+
}
|
|
879
|
+
}, r2.prototype.fromNumberAsync = function(t3, e3, i2, s2) {
|
|
880
|
+
if ("number" == typeof e3) if (t3 < 2) this.fromInt(1);
|
|
881
|
+
else {
|
|
882
|
+
this.fromNumber(t3, i2), this.testBit(t3 - 1) || this.bitwiseTo(r2.ONE.shiftLeft(t3 - 1), n, this), this.isEven() && this.dAddOffset(1, 0);
|
|
883
|
+
var o2 = this, h2 = function() {
|
|
884
|
+
o2.dAddOffset(2, 0), o2.bitLength() > t3 && o2.subTo(r2.ONE.shiftLeft(t3 - 1), o2), o2.isProbablePrime(e3) ? setTimeout(function() {
|
|
885
|
+
s2();
|
|
886
|
+
}, 0) : setTimeout(h2, 0);
|
|
887
|
+
};
|
|
888
|
+
setTimeout(h2, 0);
|
|
889
|
+
}
|
|
890
|
+
else {
|
|
891
|
+
var a2 = [], u2 = 7 & t3;
|
|
892
|
+
a2.length = 1 + (t3 >> 3), e3.nextBytes(a2), u2 > 0 ? a2[0] &= (1 << u2) - 1 : a2[0] = 0, this.fromString(a2, 256);
|
|
893
|
+
}
|
|
894
|
+
}, r2;
|
|
895
|
+
})(), B = (function() {
|
|
896
|
+
function t3() {
|
|
897
|
+
}
|
|
898
|
+
return t3.prototype.convert = function(t4) {
|
|
899
|
+
return t4;
|
|
900
|
+
}, t3.prototype.revert = function(t4) {
|
|
901
|
+
return t4;
|
|
902
|
+
}, t3.prototype.mulTo = function(t4, e3, r2) {
|
|
903
|
+
t4.multiplyTo(e3, r2);
|
|
904
|
+
}, t3.prototype.sqrTo = function(t4, e3) {
|
|
905
|
+
t4.squareTo(e3);
|
|
906
|
+
}, t3;
|
|
907
|
+
})(), O = (function() {
|
|
908
|
+
function t3(t4) {
|
|
909
|
+
this.m = t4;
|
|
910
|
+
}
|
|
911
|
+
return t3.prototype.convert = function(t4) {
|
|
912
|
+
return t4.s < 0 || t4.compareTo(this.m) >= 0 ? t4.mod(this.m) : t4;
|
|
913
|
+
}, t3.prototype.revert = function(t4) {
|
|
914
|
+
return t4;
|
|
915
|
+
}, t3.prototype.reduce = function(t4) {
|
|
916
|
+
t4.divRemTo(this.m, null, t4);
|
|
917
|
+
}, t3.prototype.mulTo = function(t4, e3, r2) {
|
|
918
|
+
t4.multiplyTo(e3, r2), this.reduce(r2);
|
|
919
|
+
}, t3.prototype.sqrTo = function(t4, e3) {
|
|
920
|
+
t4.squareTo(e3), this.reduce(e3);
|
|
921
|
+
}, t3;
|
|
922
|
+
})(), V = (function() {
|
|
923
|
+
function t3(t4) {
|
|
924
|
+
this.m = t4, this.mp = t4.invDigit(), this.mpl = 32767 & this.mp, this.mph = this.mp >> 15, this.um = (1 << t4.DB - 15) - 1, this.mt2 = 2 * t4.t;
|
|
925
|
+
}
|
|
926
|
+
return t3.prototype.convert = function(t4) {
|
|
927
|
+
var e3 = N();
|
|
928
|
+
return t4.abs().dlShiftTo(this.m.t, e3), e3.divRemTo(this.m, null, e3), t4.s < 0 && e3.compareTo(A.ZERO) > 0 && this.m.subTo(e3, e3), e3;
|
|
929
|
+
}, t3.prototype.revert = function(t4) {
|
|
930
|
+
var e3 = N();
|
|
931
|
+
return t4.copyTo(e3), this.reduce(e3), e3;
|
|
932
|
+
}, t3.prototype.reduce = function(t4) {
|
|
933
|
+
for (; t4.t <= this.mt2; ) t4[t4.t++] = 0;
|
|
934
|
+
for (var e3 = 0; e3 < this.m.t; ++e3) {
|
|
935
|
+
var r2 = 32767 & t4[e3], i2 = r2 * this.mpl + ((r2 * this.mph + (t4[e3] >> 15) * this.mpl & this.um) << 15) & t4.DM;
|
|
936
|
+
for (t4[r2 = e3 + this.m.t] += this.m.am(0, i2, t4, e3, 0, this.m.t); t4[r2] >= t4.DV; ) t4[r2] -= t4.DV, t4[++r2]++;
|
|
937
|
+
}
|
|
938
|
+
t4.clamp(), t4.drShiftTo(this.m.t, t4), t4.compareTo(this.m) >= 0 && t4.subTo(this.m, t4);
|
|
939
|
+
}, t3.prototype.mulTo = function(t4, e3, r2) {
|
|
940
|
+
t4.multiplyTo(e3, r2), this.reduce(r2);
|
|
941
|
+
}, t3.prototype.sqrTo = function(t4, e3) {
|
|
942
|
+
t4.squareTo(e3), this.reduce(e3);
|
|
943
|
+
}, t3;
|
|
944
|
+
})(), I = (function() {
|
|
945
|
+
function t3(t4) {
|
|
946
|
+
this.m = t4, this.r2 = N(), this.q3 = N(), A.ONE.dlShiftTo(2 * t4.t, this.r2), this.mu = this.r2.divide(t4);
|
|
947
|
+
}
|
|
948
|
+
return t3.prototype.convert = function(t4) {
|
|
949
|
+
if (t4.s < 0 || t4.t > 2 * this.m.t) return t4.mod(this.m);
|
|
950
|
+
if (t4.compareTo(this.m) < 0) return t4;
|
|
951
|
+
var e3 = N();
|
|
952
|
+
return t4.copyTo(e3), this.reduce(e3), e3;
|
|
953
|
+
}, t3.prototype.revert = function(t4) {
|
|
954
|
+
return t4;
|
|
955
|
+
}, t3.prototype.reduce = function(t4) {
|
|
956
|
+
for (t4.drShiftTo(this.m.t - 1, this.r2), t4.t > this.m.t + 1 && (t4.t = this.m.t + 1, t4.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t4.compareTo(this.r2) < 0; ) t4.dAddOffset(1, this.m.t + 1);
|
|
957
|
+
for (t4.subTo(this.r2, t4); t4.compareTo(this.m) >= 0; ) t4.subTo(this.m, t4);
|
|
958
|
+
}, t3.prototype.mulTo = function(t4, e3, r2) {
|
|
959
|
+
t4.multiplyTo(e3, r2), this.reduce(r2);
|
|
960
|
+
}, t3.prototype.sqrTo = function(t4, e3) {
|
|
961
|
+
t4.squareTo(e3), this.reduce(e3);
|
|
962
|
+
}, t3;
|
|
963
|
+
})();
|
|
964
|
+
function N() {
|
|
965
|
+
return new A(null);
|
|
966
|
+
}
|
|
967
|
+
function P(t3, e3) {
|
|
968
|
+
return new A(t3, e3);
|
|
969
|
+
}
|
|
970
|
+
var M = "undefined" != typeof navigator;
|
|
971
|
+
M && "Microsoft Internet Explorer" == navigator.appName ? (A.prototype.am = function(t3, e3, r2, i2, n2, s2) {
|
|
972
|
+
for (var o2 = 32767 & e3, h2 = e3 >> 15; --s2 >= 0; ) {
|
|
973
|
+
var a2 = 32767 & this[t3], u2 = this[t3++] >> 15, c2 = h2 * a2 + u2 * o2;
|
|
974
|
+
n2 = ((a2 = o2 * a2 + ((32767 & c2) << 15) + r2[i2] + (1073741823 & n2)) >>> 30) + (c2 >>> 15) + h2 * u2 + (n2 >>> 30), r2[i2++] = 1073741823 & a2;
|
|
975
|
+
}
|
|
976
|
+
return n2;
|
|
977
|
+
}, S = 30) : M && "Netscape" != navigator.appName ? (A.prototype.am = function(t3, e3, r2, i2, n2, s2) {
|
|
978
|
+
for (; --s2 >= 0; ) {
|
|
979
|
+
var o2 = e3 * this[t3++] + r2[i2] + n2;
|
|
980
|
+
n2 = Math.floor(o2 / 67108864), r2[i2++] = 67108863 & o2;
|
|
981
|
+
}
|
|
982
|
+
return n2;
|
|
983
|
+
}, S = 26) : (A.prototype.am = function(t3, e3, r2, i2, n2, s2) {
|
|
984
|
+
for (var o2 = 16383 & e3, h2 = e3 >> 14; --s2 >= 0; ) {
|
|
985
|
+
var a2 = 16383 & this[t3], u2 = this[t3++] >> 14, c2 = h2 * a2 + u2 * o2;
|
|
986
|
+
n2 = ((a2 = o2 * a2 + ((16383 & c2) << 14) + r2[i2] + n2) >> 28) + (c2 >> 14) + h2 * u2, r2[i2++] = 268435455 & a2;
|
|
987
|
+
}
|
|
988
|
+
return n2;
|
|
989
|
+
}, S = 28), A.prototype.DB = S, A.prototype.DM = (1 << S) - 1, A.prototype.DV = 1 << S;
|
|
990
|
+
A.prototype.FV = Math.pow(2, 52), A.prototype.F1 = 52 - S, A.prototype.F2 = 2 * S - 52;
|
|
991
|
+
var L, j, q = [];
|
|
992
|
+
for (L = "0".charCodeAt(0), j = 0; j <= 9; ++j) q[L++] = j;
|
|
993
|
+
for (L = "a".charCodeAt(0), j = 10; j < 36; ++j) q[L++] = j;
|
|
994
|
+
for (L = "A".charCodeAt(0), j = 10; j < 36; ++j) q[L++] = j;
|
|
995
|
+
function C(t3, e3) {
|
|
996
|
+
var r2 = q[t3.charCodeAt(e3)];
|
|
997
|
+
return null == r2 ? -1 : r2;
|
|
998
|
+
}
|
|
999
|
+
function H(t3) {
|
|
1000
|
+
var e3 = N();
|
|
1001
|
+
return e3.fromInt(t3), e3;
|
|
1002
|
+
}
|
|
1003
|
+
function F(t3) {
|
|
1004
|
+
var e3, r2 = 1;
|
|
1005
|
+
return 0 != (e3 = t3 >>> 16) && (t3 = e3, r2 += 16), 0 != (e3 = t3 >> 8) && (t3 = e3, r2 += 8), 0 != (e3 = t3 >> 4) && (t3 = e3, r2 += 4), 0 != (e3 = t3 >> 2) && (t3 = e3, r2 += 2), 0 != (e3 = t3 >> 1) && (t3 = e3, r2 += 1), r2;
|
|
1006
|
+
}
|
|
1007
|
+
A.ZERO = H(0), A.ONE = H(1);
|
|
1008
|
+
var K = (function() {
|
|
1009
|
+
function t3() {
|
|
1010
|
+
this.i = 0, this.j = 0, this.S = [];
|
|
1011
|
+
}
|
|
1012
|
+
return t3.prototype.init = function(t4) {
|
|
1013
|
+
var e3, r2, i2;
|
|
1014
|
+
for (e3 = 0; e3 < 256; ++e3) this.S[e3] = e3;
|
|
1015
|
+
for (r2 = 0, e3 = 0; e3 < 256; ++e3) r2 = r2 + this.S[e3] + t4[e3 % t4.length] & 255, i2 = this.S[e3], this.S[e3] = this.S[r2], this.S[r2] = i2;
|
|
1016
|
+
this.i = 0, this.j = 0;
|
|
1017
|
+
}, t3.prototype.next = function() {
|
|
1018
|
+
var t4;
|
|
1019
|
+
return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, t4 = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = t4, this.S[t4 + this.S[this.i] & 255];
|
|
1020
|
+
}, t3;
|
|
1021
|
+
})();
|
|
1022
|
+
var U, k, _ = null;
|
|
1023
|
+
if (null == _) {
|
|
1024
|
+
_ = [], k = 0;
|
|
1025
|
+
var z = void 0;
|
|
1026
|
+
if ("undefined" != typeof window && self.crypto && self.crypto.getRandomValues) {
|
|
1027
|
+
var Z = new Uint32Array(256);
|
|
1028
|
+
for (self.crypto.getRandomValues(Z), z = 0; z < Z.length; ++z) _[k++] = 255 & Z[z];
|
|
1029
|
+
}
|
|
1030
|
+
var G = 0, $ = function(t3) {
|
|
1031
|
+
if ((G = G || 0) >= 256 || k >= 256) self.removeEventListener ? self.removeEventListener("mousemove", $, false) : self.detachEvent && self.detachEvent("onmousemove", $);
|
|
1032
|
+
else try {
|
|
1033
|
+
var e3 = t3.x + t3.y;
|
|
1034
|
+
_[k++] = 255 & e3, G += 1;
|
|
1035
|
+
} catch (t4) {
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
"undefined" != typeof window && (self.addEventListener ? self.addEventListener("mousemove", $, false) : self.attachEvent && self.attachEvent("onmousemove", $));
|
|
1039
|
+
}
|
|
1040
|
+
function Y() {
|
|
1041
|
+
if (null == U) {
|
|
1042
|
+
for (U = new K(); k < 256; ) {
|
|
1043
|
+
var t3 = Math.floor(65536 * Math.random());
|
|
1044
|
+
_[k++] = 255 & t3;
|
|
1045
|
+
}
|
|
1046
|
+
for (U.init(_), k = 0; k < _.length; ++k) _[k] = 0;
|
|
1047
|
+
k = 0;
|
|
1048
|
+
}
|
|
1049
|
+
return U.next();
|
|
1050
|
+
}
|
|
1051
|
+
var J = (function() {
|
|
1052
|
+
function t3() {
|
|
1053
|
+
}
|
|
1054
|
+
return t3.prototype.nextBytes = function(t4) {
|
|
1055
|
+
for (var e3 = 0; e3 < t4.length; ++e3) t4[e3] = Y();
|
|
1056
|
+
}, t3;
|
|
1057
|
+
})();
|
|
1058
|
+
function X(t3) {
|
|
1059
|
+
return (function(t4) {
|
|
1060
|
+
for (var e3 = "", r2 = 0; r2 < 32 * t4.length; r2 += 8) e3 += String.fromCharCode(t4[r2 >> 5] >>> 24 - r2 % 32 & 255);
|
|
1061
|
+
return e3;
|
|
1062
|
+
})((function(t4, e3) {
|
|
1063
|
+
var r2, i2, n2, s2, o2, h2, a2, u2, c2, f2, l2, p2, g2 = new Array(1779033703, -1150833019, 1013904242, -1521486534, 1359893119, -1694144372, 528734635, 1541459225), d2 = new Array(64);
|
|
1064
|
+
for (t4[e3 >> 5] |= 128 << 24 - e3 % 32, t4[15 + (e3 + 64 >> 9 << 4)] = e3, c2 = 0; c2 < t4.length; c2 += 16) {
|
|
1065
|
+
for (r2 = g2[0], i2 = g2[1], n2 = g2[2], s2 = g2[3], o2 = g2[4], h2 = g2[5], a2 = g2[6], u2 = g2[7], f2 = 0; f2 < 64; f2++) d2[f2] = f2 < 16 ? t4[f2 + c2] : at(at(at(ot(d2[f2 - 2]), d2[f2 - 7]), st(d2[f2 - 15])), d2[f2 - 16]), l2 = at(at(at(at(u2, nt(o2)), et(o2, h2, a2)), ht[f2]), d2[f2]), p2 = at(it(r2), rt(r2, i2, n2)), u2 = a2, a2 = h2, h2 = o2, o2 = at(s2, l2), s2 = n2, n2 = i2, i2 = r2, r2 = at(l2, p2);
|
|
1066
|
+
g2[0] = at(r2, g2[0]), g2[1] = at(i2, g2[1]), g2[2] = at(n2, g2[2]), g2[3] = at(s2, g2[3]), g2[4] = at(o2, g2[4]), g2[5] = at(h2, g2[5]), g2[6] = at(a2, g2[6]), g2[7] = at(u2, g2[7]);
|
|
1067
|
+
}
|
|
1068
|
+
return g2;
|
|
1069
|
+
})((function(t4) {
|
|
1070
|
+
for (var e3 = Array(t4.length >> 2), r2 = 0; r2 < e3.length; r2++) e3[r2] = 0;
|
|
1071
|
+
for (r2 = 0; r2 < 8 * t4.length; r2 += 8) e3[r2 >> 5] |= (255 & t4.charCodeAt(r2 / 8)) << 24 - r2 % 32;
|
|
1072
|
+
return e3;
|
|
1073
|
+
})(t3), 8 * t3.length));
|
|
1074
|
+
}
|
|
1075
|
+
function Q(t3) {
|
|
1076
|
+
for (var e3 = "0123456789abcdef", r2 = "", i2 = 0; i2 < t3.length; i2++) {
|
|
1077
|
+
var n2 = t3.charCodeAt(i2);
|
|
1078
|
+
r2 += e3.charAt(n2 >>> 4 & 15) + e3.charAt(15 & n2);
|
|
1079
|
+
}
|
|
1080
|
+
return r2;
|
|
1081
|
+
}
|
|
1082
|
+
function W(t3, e3) {
|
|
1083
|
+
return t3 >>> e3 | t3 << 32 - e3;
|
|
1084
|
+
}
|
|
1085
|
+
function tt(t3, e3) {
|
|
1086
|
+
return t3 >>> e3;
|
|
1087
|
+
}
|
|
1088
|
+
function et(t3, e3, r2) {
|
|
1089
|
+
return t3 & e3 ^ ~t3 & r2;
|
|
1090
|
+
}
|
|
1091
|
+
function rt(t3, e3, r2) {
|
|
1092
|
+
return t3 & e3 ^ t3 & r2 ^ e3 & r2;
|
|
1093
|
+
}
|
|
1094
|
+
function it(t3) {
|
|
1095
|
+
return W(t3, 2) ^ W(t3, 13) ^ W(t3, 22);
|
|
1096
|
+
}
|
|
1097
|
+
function nt(t3) {
|
|
1098
|
+
return W(t3, 6) ^ W(t3, 11) ^ W(t3, 25);
|
|
1099
|
+
}
|
|
1100
|
+
function st(t3) {
|
|
1101
|
+
return W(t3, 7) ^ W(t3, 18) ^ tt(t3, 3);
|
|
1102
|
+
}
|
|
1103
|
+
function ot(t3) {
|
|
1104
|
+
return W(t3, 17) ^ W(t3, 19) ^ tt(t3, 10);
|
|
1105
|
+
}
|
|
1106
|
+
var ht = new Array(1116352408, 1899447441, -1245643825, -373957723, 961987163, 1508970993, -1841331548, -1424204075, -670586216, 310598401, 607225278, 1426881987, 1925078388, -2132889090, -1680079193, -1046744716, -459576895, -272742522, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, -1740746414, -1473132947, -1341970488, -1084653625, -958395405, -710438585, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, -2117940946, -1838011259, -1564481375, -1474664885, -1035236496, -949202525, -778901479, -694614492, -200395387, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, -2067236844, -1933114872, -1866530822, -1538233109, -1090935817, -965641998);
|
|
1107
|
+
function at(t3, e3) {
|
|
1108
|
+
var r2 = (65535 & t3) + (65535 & e3);
|
|
1109
|
+
return (t3 >> 16) + (e3 >> 16) + (r2 >> 16) << 16 | 65535 & r2;
|
|
1110
|
+
}
|
|
1111
|
+
function ut(t3, e3) {
|
|
1112
|
+
if (e3 < t3.length + 11) return console.error("Message too long for RSA"), null;
|
|
1113
|
+
for (var r2 = [], i2 = t3.length - 1; i2 >= 0 && e3 > 0; ) {
|
|
1114
|
+
var n2 = t3.charCodeAt(i2--);
|
|
1115
|
+
n2 < 128 ? r2[--e3] = n2 : n2 > 127 && n2 < 2048 ? (r2[--e3] = 63 & n2 | 128, r2[--e3] = n2 >> 6 | 192) : (r2[--e3] = 63 & n2 | 128, r2[--e3] = n2 >> 6 & 63 | 128, r2[--e3] = n2 >> 12 | 224);
|
|
1116
|
+
}
|
|
1117
|
+
r2[--e3] = 0;
|
|
1118
|
+
for (var s2 = new J(), o2 = []; e3 > 2; ) {
|
|
1119
|
+
for (o2[0] = 0; 0 == o2[0]; ) s2.nextBytes(o2);
|
|
1120
|
+
r2[--e3] = o2[0];
|
|
1121
|
+
}
|
|
1122
|
+
return r2[--e3] = 2, r2[--e3] = 0, new A(r2);
|
|
1123
|
+
}
|
|
1124
|
+
function ct(t3, e3, r2) {
|
|
1125
|
+
for (var i2 = "", n2 = 0; i2.length < e3; ) i2 += r2(String.fromCharCode.apply(String, t3.concat([(4278190080 & n2) >> 24, (16711680 & n2) >> 16, (65280 & n2) >> 8, 255 & n2]))), n2 += 1;
|
|
1126
|
+
return i2;
|
|
1127
|
+
}
|
|
1128
|
+
function ft(t3, e3) {
|
|
1129
|
+
var r2 = X;
|
|
1130
|
+
if (t3.length + 64 + 2 > e3) throw "Message too long for RSA";
|
|
1131
|
+
var i2, n2 = "";
|
|
1132
|
+
for (i2 = 0; i2 < e3 - t3.length - 64 - 2; i2 += 1) n2 += "\0";
|
|
1133
|
+
var s2 = r2("") + n2 + "" + t3, o2 = new Array(32);
|
|
1134
|
+
new J().nextBytes(o2);
|
|
1135
|
+
var h2 = ct(o2, s2.length, r2), a2 = [];
|
|
1136
|
+
for (i2 = 0; i2 < s2.length; i2 += 1) a2[i2] = s2.charCodeAt(i2) ^ h2.charCodeAt(i2);
|
|
1137
|
+
var u2 = ct(a2, o2.length, r2), c2 = [0];
|
|
1138
|
+
for (i2 = 0; i2 < o2.length; i2 += 1) c2[i2 + 1] = o2[i2] ^ u2.charCodeAt(i2);
|
|
1139
|
+
return new A(c2.concat(a2));
|
|
1140
|
+
}
|
|
1141
|
+
var lt = (function() {
|
|
1142
|
+
function t3() {
|
|
1143
|
+
this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null;
|
|
1144
|
+
}
|
|
1145
|
+
return t3.prototype.doPublic = function(t4) {
|
|
1146
|
+
return t4.modPowInt(this.e, this.n);
|
|
1147
|
+
}, t3.prototype.doPrivate = function(t4) {
|
|
1148
|
+
if (null == this.p || null == this.q) return t4.modPow(this.d, this.n);
|
|
1149
|
+
for (var e3 = t4.mod(this.p).modPow(this.dmp1, this.p), r2 = t4.mod(this.q).modPow(this.dmq1, this.q); e3.compareTo(r2) < 0; ) e3 = e3.add(this.p);
|
|
1150
|
+
return e3.subtract(r2).multiply(this.coeff).mod(this.p).multiply(this.q).add(r2);
|
|
1151
|
+
}, t3.prototype.setPublic = function(t4, e3) {
|
|
1152
|
+
null != t4 && null != e3 && t4.length > 0 && e3.length > 0 ? (this.n = P(t4, 16), this.e = parseInt(e3, 16)) : console.error("Invalid RSA public key");
|
|
1153
|
+
}, t3.prototype.encrypt = function(t4, e3) {
|
|
1154
|
+
void 0 === e3 && (e3 = ut);
|
|
1155
|
+
var r2 = this.n.bitLength() + 7 >> 3, i2 = e3(t4, r2);
|
|
1156
|
+
if (null == i2) return null;
|
|
1157
|
+
var n2 = this.doPublic(i2);
|
|
1158
|
+
if (null == n2) return null;
|
|
1159
|
+
for (var s2 = n2.toString(16), o2 = s2.length, h2 = 0; h2 < 2 * r2 - o2; h2++) s2 = "0" + s2;
|
|
1160
|
+
return s2;
|
|
1161
|
+
}, t3.prototype.setPrivate = function(t4, e3, r2) {
|
|
1162
|
+
null != t4 && null != e3 && t4.length > 0 && e3.length > 0 ? (this.n = P(t4, 16), this.e = parseInt(e3, 16), this.d = P(r2, 16)) : console.error("Invalid RSA private key");
|
|
1163
|
+
}, t3.prototype.setPrivateEx = function(t4, e3, r2, i2, n2, s2, o2, h2) {
|
|
1164
|
+
null != t4 && null != e3 && t4.length > 0 && e3.length > 0 ? (this.n = P(t4, 16), this.e = parseInt(e3, 16), this.d = P(r2, 16), this.p = P(i2, 16), this.q = P(n2, 16), this.dmp1 = P(s2, 16), this.dmq1 = P(o2, 16), this.coeff = P(h2, 16)) : console.error("Invalid RSA private key");
|
|
1165
|
+
}, t3.prototype.generate = function(t4, e3) {
|
|
1166
|
+
var r2 = new J(), i2 = t4 >> 1;
|
|
1167
|
+
this.e = parseInt(e3, 16);
|
|
1168
|
+
for (var n2 = new A(e3, 16); ; ) {
|
|
1169
|
+
for (; this.p = new A(t4 - i2, 1, r2), 0 != this.p.subtract(A.ONE).gcd(n2).compareTo(A.ONE) || !this.p.isProbablePrime(10); ) ;
|
|
1170
|
+
for (; this.q = new A(i2, 1, r2), 0 != this.q.subtract(A.ONE).gcd(n2).compareTo(A.ONE) || !this.q.isProbablePrime(10); ) ;
|
|
1171
|
+
if (this.p.compareTo(this.q) <= 0) {
|
|
1172
|
+
var s2 = this.p;
|
|
1173
|
+
this.p = this.q, this.q = s2;
|
|
1174
|
+
}
|
|
1175
|
+
var o2 = this.p.subtract(A.ONE), h2 = this.q.subtract(A.ONE), a2 = o2.multiply(h2);
|
|
1176
|
+
if (0 == a2.gcd(n2).compareTo(A.ONE)) {
|
|
1177
|
+
this.n = this.p.multiply(this.q), this.d = n2.modInverse(a2), this.dmp1 = this.d.mod(o2), this.dmq1 = this.d.mod(h2), this.coeff = this.q.modInverse(this.p);
|
|
1178
|
+
break;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
}, t3.prototype.decrypt = function(t4) {
|
|
1182
|
+
var e3 = P(t4, 16), r2 = this.doPrivate(e3);
|
|
1183
|
+
return null == r2 ? null : (function(t5, e4) {
|
|
1184
|
+
var r3 = t5.toByteArray(), i2 = 0;
|
|
1185
|
+
for (; i2 < r3.length && 0 == r3[i2]; ) ++i2;
|
|
1186
|
+
if (r3.length - i2 != e4 - 1 || 2 != r3[i2]) return null;
|
|
1187
|
+
++i2;
|
|
1188
|
+
for (; 0 != r3[i2]; ) if (++i2 >= r3.length) return null;
|
|
1189
|
+
var n2 = "";
|
|
1190
|
+
for (; ++i2 < r3.length; ) {
|
|
1191
|
+
var s2 = 255 & r3[i2];
|
|
1192
|
+
s2 < 128 ? n2 += String.fromCharCode(s2) : s2 > 191 && s2 < 224 ? (n2 += String.fromCharCode((31 & s2) << 6 | 63 & r3[i2 + 1]), ++i2) : (n2 += String.fromCharCode((15 & s2) << 12 | (63 & r3[i2 + 1]) << 6 | 63 & r3[i2 + 2]), i2 += 2);
|
|
1193
|
+
}
|
|
1194
|
+
return n2;
|
|
1195
|
+
})(r2, this.n.bitLength() + 7 >> 3);
|
|
1196
|
+
}, t3.prototype.generateAsync = function(t4, e3, r2) {
|
|
1197
|
+
var i2 = new J(), n2 = t4 >> 1;
|
|
1198
|
+
this.e = parseInt(e3, 16);
|
|
1199
|
+
var s2 = new A(e3, 16), o2 = this, h2 = function() {
|
|
1200
|
+
var e4 = function() {
|
|
1201
|
+
if (o2.p.compareTo(o2.q) <= 0) {
|
|
1202
|
+
var t5 = o2.p;
|
|
1203
|
+
o2.p = o2.q, o2.q = t5;
|
|
1204
|
+
}
|
|
1205
|
+
var e5 = o2.p.subtract(A.ONE), i3 = o2.q.subtract(A.ONE), n3 = e5.multiply(i3);
|
|
1206
|
+
0 == n3.gcd(s2).compareTo(A.ONE) ? (o2.n = o2.p.multiply(o2.q), o2.d = s2.modInverse(n3), o2.dmp1 = o2.d.mod(e5), o2.dmq1 = o2.d.mod(i3), o2.coeff = o2.q.modInverse(o2.p), setTimeout(function() {
|
|
1207
|
+
r2();
|
|
1208
|
+
}, 0)) : setTimeout(h2, 0);
|
|
1209
|
+
}, a2 = function() {
|
|
1210
|
+
o2.q = N(), o2.q.fromNumberAsync(n2, 1, i2, function() {
|
|
1211
|
+
o2.q.subtract(A.ONE).gcda(s2, function(t5) {
|
|
1212
|
+
0 == t5.compareTo(A.ONE) && o2.q.isProbablePrime(10) ? setTimeout(e4, 0) : setTimeout(a2, 0);
|
|
1213
|
+
});
|
|
1214
|
+
});
|
|
1215
|
+
}, u2 = function() {
|
|
1216
|
+
o2.p = N(), o2.p.fromNumberAsync(t4 - n2, 1, i2, function() {
|
|
1217
|
+
o2.p.subtract(A.ONE).gcda(s2, function(t5) {
|
|
1218
|
+
0 == t5.compareTo(A.ONE) && o2.p.isProbablePrime(10) ? setTimeout(a2, 0) : setTimeout(u2, 0);
|
|
1219
|
+
});
|
|
1220
|
+
});
|
|
1221
|
+
};
|
|
1222
|
+
setTimeout(u2, 0);
|
|
1223
|
+
};
|
|
1224
|
+
setTimeout(h2, 0);
|
|
1225
|
+
}, t3.prototype.sign = function(t4, e3, r2) {
|
|
1226
|
+
var i2 = (pt[r2] || "") + e3(t4).toString(), n2 = this.n.bitLength() / 4, s2 = (function(t5, e4) {
|
|
1227
|
+
if (e4 < t5.length + 22) return console.error("Message too long for RSA"), null;
|
|
1228
|
+
for (var r3 = e4 - t5.length - 6, i3 = "", n3 = 0; n3 < r3; n3 += 2) i3 += "ff";
|
|
1229
|
+
return P("0001" + i3 + "00" + t5, 16);
|
|
1230
|
+
})(i2, n2);
|
|
1231
|
+
if (null == s2) return null;
|
|
1232
|
+
var o2 = this.doPrivate(s2);
|
|
1233
|
+
if (null == o2) return null;
|
|
1234
|
+
for (var h2 = o2.toString(16), a2 = h2.length, u2 = 0; u2 < n2 - a2; u2++) h2 = "0" + h2;
|
|
1235
|
+
return h2;
|
|
1236
|
+
}, t3.prototype.verify = function(t4, e3, r2) {
|
|
1237
|
+
var i2 = P(e3, 16), n2 = this.doPublic(i2);
|
|
1238
|
+
return null == n2 ? null : (function(t5) {
|
|
1239
|
+
for (var e4 in pt) if (pt.hasOwnProperty(e4)) {
|
|
1240
|
+
var r3 = pt[e4], i3 = r3.length;
|
|
1241
|
+
if (t5.substring(0, i3) == r3) return t5.substring(i3);
|
|
1242
|
+
}
|
|
1243
|
+
return t5;
|
|
1244
|
+
})(n2.toString(16).replace(/^1f+00/, "")) == r2(t4).toString();
|
|
1245
|
+
}, t3;
|
|
1246
|
+
})();
|
|
1247
|
+
var pt = { md2: "3020300c06082a864886f70d020205000410", md5: "3020300c06082a864886f70d020505000410", sha1: "3021300906052b0e03021a05000414", sha224: "302d300d06096086480165030402040500041c", sha256: "3031300d060960864801650304020105000420", sha384: "3041300d060960864801650304020205000430", sha512: "3051300d060960864801650304020305000440", ripemd160: "3021300906052b2403020105000414" };
|
|
1248
|
+
function gt(t3, e3, r2) {
|
|
1249
|
+
if (!e3 || !t3) throw new Error("extend failed, please check that all dependencies are included.");
|
|
1250
|
+
var i2 = function() {
|
|
1251
|
+
};
|
|
1252
|
+
if (i2.prototype = e3.prototype, t3.prototype = new i2(), t3.prototype.constructor = t3, t3.superclass = e3.prototype, e3.prototype.constructor == Object.prototype.constructor && (e3.prototype.constructor = e3), r2) ;
|
|
1253
|
+
}
|
|
1254
|
+
var dt = {};
|
|
1255
|
+
void 0 !== dt.asn1 && dt.asn1 || (dt.asn1 = {}), dt.asn1.ASN1Util = new function() {
|
|
1256
|
+
this.integerToByteHex = function(t3) {
|
|
1257
|
+
var e3 = t3.toString(16);
|
|
1258
|
+
return e3.length % 2 == 1 && (e3 = "0" + e3), e3;
|
|
1259
|
+
}, this.bigIntToMinTwosComplementsHex = function(t3) {
|
|
1260
|
+
var e3 = t3.toString(16);
|
|
1261
|
+
if ("-" != e3.substring(0, 1)) e3.length % 2 == 1 ? e3 = "0" + e3 : e3.match(/^[0-7]/) || (e3 = "00" + e3);
|
|
1262
|
+
else {
|
|
1263
|
+
var r2 = e3.substring(1).length;
|
|
1264
|
+
r2 % 2 == 1 ? r2 += 1 : e3.match(/^[0-7]/) || (r2 += 2);
|
|
1265
|
+
for (var i2 = "", n2 = 0; n2 < r2; n2++) i2 += "f";
|
|
1266
|
+
e3 = new A(i2, 16).xor(t3).add(A.ONE).toString(16).replace(/^-/, "");
|
|
1267
|
+
}
|
|
1268
|
+
return e3;
|
|
1269
|
+
}, this.getPEMStringFromHex = function(t3, e3) {
|
|
1270
|
+
return hextopem(t3, e3);
|
|
1271
|
+
}, this.newObject = function(t3) {
|
|
1272
|
+
var e3 = dt.asn1, r2 = e3.DERBoolean, i2 = e3.DERInteger, n2 = e3.DERBitString, s2 = e3.DEROctetString, o2 = e3.DERNull, h2 = e3.DERObjectIdentifier, a2 = e3.DEREnumerated, u2 = e3.DERUTF8String, c2 = e3.DERNumericString, f2 = e3.DERPrintableString, l2 = e3.DERTeletexString, p2 = e3.DERIA5String, g2 = e3.DERUTCTime, d2 = e3.DERGeneralizedTime, v2 = e3.DERSequence, y2 = e3.DERSet, m2 = e3.DERTaggedObject, b2 = e3.ASN1Util.newObject, T2 = Object.keys(t3);
|
|
1273
|
+
if (1 != T2.length) throw "key of param shall be only one.";
|
|
1274
|
+
var S2 = T2[0];
|
|
1275
|
+
if (-1 == ":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + S2 + ":")) throw "undefined key: " + S2;
|
|
1276
|
+
if ("bool" == S2) return new r2(t3[S2]);
|
|
1277
|
+
if ("int" == S2) return new i2(t3[S2]);
|
|
1278
|
+
if ("bitstr" == S2) return new n2(t3[S2]);
|
|
1279
|
+
if ("octstr" == S2) return new s2(t3[S2]);
|
|
1280
|
+
if ("null" == S2) return new o2(t3[S2]);
|
|
1281
|
+
if ("oid" == S2) return new h2(t3[S2]);
|
|
1282
|
+
if ("enum" == S2) return new a2(t3[S2]);
|
|
1283
|
+
if ("utf8str" == S2) return new u2(t3[S2]);
|
|
1284
|
+
if ("numstr" == S2) return new c2(t3[S2]);
|
|
1285
|
+
if ("prnstr" == S2) return new f2(t3[S2]);
|
|
1286
|
+
if ("telstr" == S2) return new l2(t3[S2]);
|
|
1287
|
+
if ("ia5str" == S2) return new p2(t3[S2]);
|
|
1288
|
+
if ("utctime" == S2) return new g2(t3[S2]);
|
|
1289
|
+
if ("gentime" == S2) return new d2(t3[S2]);
|
|
1290
|
+
if ("seq" == S2) {
|
|
1291
|
+
for (var E2 = t3[S2], w2 = [], D2 = 0; D2 < E2.length; D2++) {
|
|
1292
|
+
var x2 = b2(E2[D2]);
|
|
1293
|
+
w2.push(x2);
|
|
1294
|
+
}
|
|
1295
|
+
return new v2({ array: w2 });
|
|
1296
|
+
}
|
|
1297
|
+
if ("set" == S2) {
|
|
1298
|
+
for (E2 = t3[S2], w2 = [], D2 = 0; D2 < E2.length; D2++) {
|
|
1299
|
+
x2 = b2(E2[D2]);
|
|
1300
|
+
w2.push(x2);
|
|
1301
|
+
}
|
|
1302
|
+
return new y2({ array: w2 });
|
|
1303
|
+
}
|
|
1304
|
+
if ("tag" == S2) {
|
|
1305
|
+
var R2 = t3[S2];
|
|
1306
|
+
if ("[object Array]" === Object.prototype.toString.call(R2) && 3 == R2.length) {
|
|
1307
|
+
var A2 = b2(R2[2]);
|
|
1308
|
+
return new m2({ tag: R2[0], explicit: R2[1], obj: A2 });
|
|
1309
|
+
}
|
|
1310
|
+
var B2 = {};
|
|
1311
|
+
if (void 0 !== R2.explicit && (B2.explicit = R2.explicit), void 0 !== R2.tag && (B2.tag = R2.tag), void 0 === R2.obj) throw "obj shall be specified for 'tag'.";
|
|
1312
|
+
return B2.obj = b2(R2.obj), new m2(B2);
|
|
1313
|
+
}
|
|
1314
|
+
}, this.jsonToASN1HEX = function(t3) {
|
|
1315
|
+
return this.newObject(t3).getEncodedHex();
|
|
1316
|
+
};
|
|
1317
|
+
}(), dt.asn1.ASN1Util.oidHexToInt = function(t3) {
|
|
1318
|
+
for (var e3 = "", r2 = parseInt(t3.substring(0, 2), 16), i2 = (e3 = Math.floor(r2 / 40) + "." + r2 % 40, ""), n2 = 2; n2 < t3.length; n2 += 2) {
|
|
1319
|
+
var s2 = ("00000000" + parseInt(t3.substring(n2, n2 + 2), 16).toString(2)).slice(-8);
|
|
1320
|
+
if (i2 += s2.substring(1, 8), "0" == s2.substring(0, 1)) e3 = e3 + "." + new A(i2, 2).toString(10), i2 = "";
|
|
1321
|
+
}
|
|
1322
|
+
return e3;
|
|
1323
|
+
}, dt.asn1.ASN1Util.oidIntToHex = function(t3) {
|
|
1324
|
+
var e3 = function(t4) {
|
|
1325
|
+
var e4 = t4.toString(16);
|
|
1326
|
+
return 1 == e4.length && (e4 = "0" + e4), e4;
|
|
1327
|
+
}, r2 = function(t4) {
|
|
1328
|
+
var r3 = "", i3 = new A(t4, 10).toString(2), n3 = 7 - i3.length % 7;
|
|
1329
|
+
7 == n3 && (n3 = 0);
|
|
1330
|
+
for (var s3 = "", o3 = 0; o3 < n3; o3++) s3 += "0";
|
|
1331
|
+
i3 = s3 + i3;
|
|
1332
|
+
for (o3 = 0; o3 < i3.length - 1; o3 += 7) {
|
|
1333
|
+
var h2 = i3.substring(o3, o3 + 7);
|
|
1334
|
+
o3 != i3.length - 7 && (h2 = "1" + h2), r3 += e3(parseInt(h2, 2));
|
|
1335
|
+
}
|
|
1336
|
+
return r3;
|
|
1337
|
+
};
|
|
1338
|
+
if (!t3.match(/^[0-9.]+$/)) throw "malformed oid string: " + t3;
|
|
1339
|
+
var i2 = "", n2 = t3.split("."), s2 = 40 * parseInt(n2[0]) + parseInt(n2[1]);
|
|
1340
|
+
i2 += e3(s2), n2.splice(0, 2);
|
|
1341
|
+
for (var o2 = 0; o2 < n2.length; o2++) i2 += r2(n2[o2]);
|
|
1342
|
+
return i2;
|
|
1343
|
+
}, dt.asn1.ASN1Object = function() {
|
|
1344
|
+
this.getLengthHexFromValue = function() {
|
|
1345
|
+
if (void 0 === this.hV || null == this.hV) throw "this.hV is null or undefined.";
|
|
1346
|
+
if (this.hV.length % 2 == 1) throw "value hex must be even length: n=0,v=" + this.hV;
|
|
1347
|
+
var t3 = this.hV.length / 2, e3 = t3.toString(16);
|
|
1348
|
+
if (e3.length % 2 == 1 && (e3 = "0" + e3), t3 < 128) return e3;
|
|
1349
|
+
var r2 = e3.length / 2;
|
|
1350
|
+
if (r2 > 15) throw "ASN.1 length too long to represent by 8x: n = " + t3.toString(16);
|
|
1351
|
+
return (128 + r2).toString(16) + e3;
|
|
1352
|
+
}, this.getEncodedHex = function() {
|
|
1353
|
+
return (null == this.hTLV || this.isModified) && (this.hV = this.getFreshValueHex(), this.hL = this.getLengthHexFromValue(), this.hTLV = this.hT + this.hL + this.hV, this.isModified = false), this.hTLV;
|
|
1354
|
+
}, this.getValueHex = function() {
|
|
1355
|
+
return this.getEncodedHex(), this.hV;
|
|
1356
|
+
}, this.getFreshValueHex = function() {
|
|
1357
|
+
return "";
|
|
1358
|
+
};
|
|
1359
|
+
}, dt.asn1.DERAbstractString = function(t3) {
|
|
1360
|
+
dt.asn1.DERAbstractString.superclass.constructor.call(this);
|
|
1361
|
+
this.getString = function() {
|
|
1362
|
+
return this.s;
|
|
1363
|
+
}, this.setString = function(t4) {
|
|
1364
|
+
this.hTLV = null, this.isModified = true, this.s = t4, this.hV = stohex(this.s);
|
|
1365
|
+
}, this.setStringHex = function(t4) {
|
|
1366
|
+
this.hTLV = null, this.isModified = true, this.s = null, this.hV = t4;
|
|
1367
|
+
}, this.getFreshValueHex = function() {
|
|
1368
|
+
return this.hV;
|
|
1369
|
+
}, void 0 !== t3 && ("string" == typeof t3 ? this.setString(t3) : void 0 !== t3.str ? this.setString(t3.str) : void 0 !== t3.hex && this.setStringHex(t3.hex));
|
|
1370
|
+
}, gt(dt.asn1.DERAbstractString, dt.asn1.ASN1Object), dt.asn1.DERAbstractTime = function(t3) {
|
|
1371
|
+
dt.asn1.DERAbstractTime.superclass.constructor.call(this);
|
|
1372
|
+
this.localDateToUTC = function(t4) {
|
|
1373
|
+
return utc = t4.getTime() + 6e4 * t4.getTimezoneOffset(), new Date(utc);
|
|
1374
|
+
}, this.formatDate = function(t4, e3, r2) {
|
|
1375
|
+
var i2 = this.zeroPadding, n2 = this.localDateToUTC(t4), s2 = String(n2.getFullYear());
|
|
1376
|
+
"utc" == e3 && (s2 = s2.substring(2, 4));
|
|
1377
|
+
var o2 = s2 + i2(String(n2.getMonth() + 1), 2) + i2(String(n2.getDate()), 2) + i2(String(n2.getHours()), 2) + i2(String(n2.getMinutes()), 2) + i2(String(n2.getSeconds()), 2);
|
|
1378
|
+
if (true === r2) {
|
|
1379
|
+
var h2 = n2.getMilliseconds();
|
|
1380
|
+
if (0 != h2) {
|
|
1381
|
+
var a2 = i2(String(h2), 3);
|
|
1382
|
+
o2 = o2 + "." + (a2 = a2.replace(/[0]+$/, ""));
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
return o2 + "Z";
|
|
1386
|
+
}, this.zeroPadding = function(t4, e3) {
|
|
1387
|
+
return t4.length >= e3 ? t4 : new Array(e3 - t4.length + 1).join("0") + t4;
|
|
1388
|
+
}, this.getString = function() {
|
|
1389
|
+
return this.s;
|
|
1390
|
+
}, this.setString = function(t4) {
|
|
1391
|
+
this.hTLV = null, this.isModified = true, this.s = t4, this.hV = stohex(t4);
|
|
1392
|
+
}, this.setByDateValue = function(t4, e3, r2, i2, n2, s2) {
|
|
1393
|
+
var o2 = new Date(Date.UTC(t4, e3 - 1, r2, i2, n2, s2, 0));
|
|
1394
|
+
this.setByDate(o2);
|
|
1395
|
+
}, this.getFreshValueHex = function() {
|
|
1396
|
+
return this.hV;
|
|
1397
|
+
};
|
|
1398
|
+
}, gt(dt.asn1.DERAbstractTime, dt.asn1.ASN1Object), dt.asn1.DERAbstractStructured = function(t3) {
|
|
1399
|
+
dt.asn1.DERAbstractString.superclass.constructor.call(this);
|
|
1400
|
+
this.setByASN1ObjectArray = function(t4) {
|
|
1401
|
+
this.hTLV = null, this.isModified = true, this.asn1Array = t4;
|
|
1402
|
+
}, this.appendASN1Object = function(t4) {
|
|
1403
|
+
this.hTLV = null, this.isModified = true, this.asn1Array.push(t4);
|
|
1404
|
+
}, this.asn1Array = new Array(), void 0 !== t3 && void 0 !== t3.array && (this.asn1Array = t3.array);
|
|
1405
|
+
}, gt(dt.asn1.DERAbstractStructured, dt.asn1.ASN1Object), dt.asn1.DERBoolean = function() {
|
|
1406
|
+
dt.asn1.DERBoolean.superclass.constructor.call(this), this.hT = "01", this.hTLV = "0101ff";
|
|
1407
|
+
}, gt(dt.asn1.DERBoolean, dt.asn1.ASN1Object), dt.asn1.DERInteger = function(t3) {
|
|
1408
|
+
dt.asn1.DERInteger.superclass.constructor.call(this), this.hT = "02", this.setByBigInteger = function(t4) {
|
|
1409
|
+
this.hTLV = null, this.isModified = true, this.hV = dt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t4);
|
|
1410
|
+
}, this.setByInteger = function(t4) {
|
|
1411
|
+
var e3 = new A(String(t4), 10);
|
|
1412
|
+
this.setByBigInteger(e3);
|
|
1413
|
+
}, this.setValueHex = function(t4) {
|
|
1414
|
+
this.hV = t4;
|
|
1415
|
+
}, this.getFreshValueHex = function() {
|
|
1416
|
+
return this.hV;
|
|
1417
|
+
}, void 0 !== t3 && (void 0 !== t3.bigint ? this.setByBigInteger(t3.bigint) : void 0 !== t3.int ? this.setByInteger(t3.int) : "number" == typeof t3 ? this.setByInteger(t3) : void 0 !== t3.hex && this.setValueHex(t3.hex));
|
|
1418
|
+
}, gt(dt.asn1.DERInteger, dt.asn1.ASN1Object), dt.asn1.DERBitString = function(t3) {
|
|
1419
|
+
if (void 0 !== t3 && void 0 !== t3.obj) {
|
|
1420
|
+
var e3 = dt.asn1.ASN1Util.newObject(t3.obj);
|
|
1421
|
+
t3.hex = "00" + e3.getEncodedHex();
|
|
1422
|
+
}
|
|
1423
|
+
dt.asn1.DERBitString.superclass.constructor.call(this), this.hT = "03", this.setHexValueIncludingUnusedBits = function(t4) {
|
|
1424
|
+
this.hTLV = null, this.isModified = true, this.hV = t4;
|
|
1425
|
+
}, this.setUnusedBitsAndHexValue = function(t4, e4) {
|
|
1426
|
+
if (t4 < 0 || 7 < t4) throw "unused bits shall be from 0 to 7: u = " + t4;
|
|
1427
|
+
var r2 = "0" + t4;
|
|
1428
|
+
this.hTLV = null, this.isModified = true, this.hV = r2 + e4;
|
|
1429
|
+
}, this.setByBinaryString = function(t4) {
|
|
1430
|
+
var e4 = 8 - (t4 = t4.replace(/0+$/, "")).length % 8;
|
|
1431
|
+
8 == e4 && (e4 = 0);
|
|
1432
|
+
for (var r2 = 0; r2 <= e4; r2++) t4 += "0";
|
|
1433
|
+
var i2 = "";
|
|
1434
|
+
for (r2 = 0; r2 < t4.length - 1; r2 += 8) {
|
|
1435
|
+
var n2 = t4.substring(r2, r2 + 8), s2 = parseInt(n2, 2).toString(16);
|
|
1436
|
+
1 == s2.length && (s2 = "0" + s2), i2 += s2;
|
|
1437
|
+
}
|
|
1438
|
+
this.hTLV = null, this.isModified = true, this.hV = "0" + e4 + i2;
|
|
1439
|
+
}, this.setByBooleanArray = function(t4) {
|
|
1440
|
+
for (var e4 = "", r2 = 0; r2 < t4.length; r2++) 1 == t4[r2] ? e4 += "1" : e4 += "0";
|
|
1441
|
+
this.setByBinaryString(e4);
|
|
1442
|
+
}, this.newFalseArray = function(t4) {
|
|
1443
|
+
for (var e4 = new Array(t4), r2 = 0; r2 < t4; r2++) e4[r2] = false;
|
|
1444
|
+
return e4;
|
|
1445
|
+
}, this.getFreshValueHex = function() {
|
|
1446
|
+
return this.hV;
|
|
1447
|
+
}, void 0 !== t3 && ("string" == typeof t3 && t3.toLowerCase().match(/^[0-9a-f]+$/) ? this.setHexValueIncludingUnusedBits(t3) : void 0 !== t3.hex ? this.setHexValueIncludingUnusedBits(t3.hex) : void 0 !== t3.bin ? this.setByBinaryString(t3.bin) : void 0 !== t3.array && this.setByBooleanArray(t3.array));
|
|
1448
|
+
}, gt(dt.asn1.DERBitString, dt.asn1.ASN1Object), dt.asn1.DEROctetString = function(t3) {
|
|
1449
|
+
if (void 0 !== t3 && void 0 !== t3.obj) {
|
|
1450
|
+
var e3 = dt.asn1.ASN1Util.newObject(t3.obj);
|
|
1451
|
+
t3.hex = e3.getEncodedHex();
|
|
1452
|
+
}
|
|
1453
|
+
dt.asn1.DEROctetString.superclass.constructor.call(this, t3), this.hT = "04";
|
|
1454
|
+
}, gt(dt.asn1.DEROctetString, dt.asn1.DERAbstractString), dt.asn1.DERNull = function() {
|
|
1455
|
+
dt.asn1.DERNull.superclass.constructor.call(this), this.hT = "05", this.hTLV = "0500";
|
|
1456
|
+
}, gt(dt.asn1.DERNull, dt.asn1.ASN1Object), dt.asn1.DERObjectIdentifier = function(t3) {
|
|
1457
|
+
var e3 = function(t4) {
|
|
1458
|
+
var e4 = t4.toString(16);
|
|
1459
|
+
return 1 == e4.length && (e4 = "0" + e4), e4;
|
|
1460
|
+
}, r2 = function(t4) {
|
|
1461
|
+
var r3 = "", i2 = new A(t4, 10).toString(2), n2 = 7 - i2.length % 7;
|
|
1462
|
+
7 == n2 && (n2 = 0);
|
|
1463
|
+
for (var s2 = "", o2 = 0; o2 < n2; o2++) s2 += "0";
|
|
1464
|
+
i2 = s2 + i2;
|
|
1465
|
+
for (o2 = 0; o2 < i2.length - 1; o2 += 7) {
|
|
1466
|
+
var h2 = i2.substring(o2, o2 + 7);
|
|
1467
|
+
o2 != i2.length - 7 && (h2 = "1" + h2), r3 += e3(parseInt(h2, 2));
|
|
1468
|
+
}
|
|
1469
|
+
return r3;
|
|
1470
|
+
};
|
|
1471
|
+
dt.asn1.DERObjectIdentifier.superclass.constructor.call(this), this.hT = "06", this.setValueHex = function(t4) {
|
|
1472
|
+
this.hTLV = null, this.isModified = true, this.s = null, this.hV = t4;
|
|
1473
|
+
}, this.setValueOidString = function(t4) {
|
|
1474
|
+
if (!t4.match(/^[0-9.]+$/)) throw "malformed oid string: " + t4;
|
|
1475
|
+
var i2 = "", n2 = t4.split("."), s2 = 40 * parseInt(n2[0]) + parseInt(n2[1]);
|
|
1476
|
+
i2 += e3(s2), n2.splice(0, 2);
|
|
1477
|
+
for (var o2 = 0; o2 < n2.length; o2++) i2 += r2(n2[o2]);
|
|
1478
|
+
this.hTLV = null, this.isModified = true, this.s = null, this.hV = i2;
|
|
1479
|
+
}, this.setValueName = function(t4) {
|
|
1480
|
+
var e4 = dt.asn1.x509.OID.name2oid(t4);
|
|
1481
|
+
if ("" === e4) throw "DERObjectIdentifier oidName undefined: " + t4;
|
|
1482
|
+
this.setValueOidString(e4);
|
|
1483
|
+
}, this.getFreshValueHex = function() {
|
|
1484
|
+
return this.hV;
|
|
1485
|
+
}, void 0 !== t3 && ("string" == typeof t3 ? t3.match(/^[0-2].[0-9.]+$/) ? this.setValueOidString(t3) : this.setValueName(t3) : void 0 !== t3.oid ? this.setValueOidString(t3.oid) : void 0 !== t3.hex ? this.setValueHex(t3.hex) : void 0 !== t3.name && this.setValueName(t3.name));
|
|
1486
|
+
}, gt(dt.asn1.DERObjectIdentifier, dt.asn1.ASN1Object), dt.asn1.DEREnumerated = function(t3) {
|
|
1487
|
+
dt.asn1.DEREnumerated.superclass.constructor.call(this), this.hT = "0a", this.setByBigInteger = function(t4) {
|
|
1488
|
+
this.hTLV = null, this.isModified = true, this.hV = dt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t4);
|
|
1489
|
+
}, this.setByInteger = function(t4) {
|
|
1490
|
+
var e3 = new A(String(t4), 10);
|
|
1491
|
+
this.setByBigInteger(e3);
|
|
1492
|
+
}, this.setValueHex = function(t4) {
|
|
1493
|
+
this.hV = t4;
|
|
1494
|
+
}, this.getFreshValueHex = function() {
|
|
1495
|
+
return this.hV;
|
|
1496
|
+
}, void 0 !== t3 && (void 0 !== t3.int ? this.setByInteger(t3.int) : "number" == typeof t3 ? this.setByInteger(t3) : void 0 !== t3.hex && this.setValueHex(t3.hex));
|
|
1497
|
+
}, gt(dt.asn1.DEREnumerated, dt.asn1.ASN1Object), dt.asn1.DERUTF8String = function(t3) {
|
|
1498
|
+
dt.asn1.DERUTF8String.superclass.constructor.call(this, t3), this.hT = "0c";
|
|
1499
|
+
}, gt(dt.asn1.DERUTF8String, dt.asn1.DERAbstractString), dt.asn1.DERNumericString = function(t3) {
|
|
1500
|
+
dt.asn1.DERNumericString.superclass.constructor.call(this, t3), this.hT = "12";
|
|
1501
|
+
}, gt(dt.asn1.DERNumericString, dt.asn1.DERAbstractString), dt.asn1.DERPrintableString = function(t3) {
|
|
1502
|
+
dt.asn1.DERPrintableString.superclass.constructor.call(this, t3), this.hT = "13";
|
|
1503
|
+
}, gt(dt.asn1.DERPrintableString, dt.asn1.DERAbstractString), dt.asn1.DERTeletexString = function(t3) {
|
|
1504
|
+
dt.asn1.DERTeletexString.superclass.constructor.call(this, t3), this.hT = "14";
|
|
1505
|
+
}, gt(dt.asn1.DERTeletexString, dt.asn1.DERAbstractString), dt.asn1.DERIA5String = function(t3) {
|
|
1506
|
+
dt.asn1.DERIA5String.superclass.constructor.call(this, t3), this.hT = "16";
|
|
1507
|
+
}, gt(dt.asn1.DERIA5String, dt.asn1.DERAbstractString), dt.asn1.DERUTCTime = function(t3) {
|
|
1508
|
+
dt.asn1.DERUTCTime.superclass.constructor.call(this, t3), this.hT = "17", this.setByDate = function(t4) {
|
|
1509
|
+
this.hTLV = null, this.isModified = true, this.date = t4, this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s);
|
|
1510
|
+
}, this.getFreshValueHex = function() {
|
|
1511
|
+
return void 0 === this.date && void 0 === this.s && (this.date = /* @__PURE__ */ new Date(), this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s)), this.hV;
|
|
1512
|
+
}, void 0 !== t3 && (void 0 !== t3.str ? this.setString(t3.str) : "string" == typeof t3 && t3.match(/^[0-9]{12}Z$/) ? this.setString(t3) : void 0 !== t3.hex ? this.setStringHex(t3.hex) : void 0 !== t3.date && this.setByDate(t3.date));
|
|
1513
|
+
}, gt(dt.asn1.DERUTCTime, dt.asn1.DERAbstractTime), dt.asn1.DERGeneralizedTime = function(t3) {
|
|
1514
|
+
dt.asn1.DERGeneralizedTime.superclass.constructor.call(this, t3), this.hT = "18", this.withMillis = false, this.setByDate = function(t4) {
|
|
1515
|
+
this.hTLV = null, this.isModified = true, this.date = t4, this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s);
|
|
1516
|
+
}, this.getFreshValueHex = function() {
|
|
1517
|
+
return void 0 === this.date && void 0 === this.s && (this.date = /* @__PURE__ */ new Date(), this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s)), this.hV;
|
|
1518
|
+
}, void 0 !== t3 && (void 0 !== t3.str ? this.setString(t3.str) : "string" == typeof t3 && t3.match(/^[0-9]{14}Z$/) ? this.setString(t3) : void 0 !== t3.hex ? this.setStringHex(t3.hex) : void 0 !== t3.date && this.setByDate(t3.date), true === t3.millis && (this.withMillis = true));
|
|
1519
|
+
}, gt(dt.asn1.DERGeneralizedTime, dt.asn1.DERAbstractTime), dt.asn1.DERSequence = function(t3) {
|
|
1520
|
+
dt.asn1.DERSequence.superclass.constructor.call(this, t3), this.hT = "30", this.getFreshValueHex = function() {
|
|
1521
|
+
for (var t4 = "", e3 = 0; e3 < this.asn1Array.length; e3++) {
|
|
1522
|
+
t4 += this.asn1Array[e3].getEncodedHex();
|
|
1523
|
+
}
|
|
1524
|
+
return this.hV = t4, this.hV;
|
|
1525
|
+
};
|
|
1526
|
+
}, gt(dt.asn1.DERSequence, dt.asn1.DERAbstractStructured), dt.asn1.DERSet = function(t3) {
|
|
1527
|
+
dt.asn1.DERSet.superclass.constructor.call(this, t3), this.hT = "31", this.sortFlag = true, this.getFreshValueHex = function() {
|
|
1528
|
+
for (var t4 = new Array(), e3 = 0; e3 < this.asn1Array.length; e3++) {
|
|
1529
|
+
var r2 = this.asn1Array[e3];
|
|
1530
|
+
t4.push(r2.getEncodedHex());
|
|
1531
|
+
}
|
|
1532
|
+
return 1 == this.sortFlag && t4.sort(), this.hV = t4.join(""), this.hV;
|
|
1533
|
+
}, void 0 !== t3 && void 0 !== t3.sortflag && 0 == t3.sortflag && (this.sortFlag = false);
|
|
1534
|
+
}, gt(dt.asn1.DERSet, dt.asn1.DERAbstractStructured), dt.asn1.DERTaggedObject = function(t3) {
|
|
1535
|
+
dt.asn1.DERTaggedObject.superclass.constructor.call(this), this.hT = "a0", this.hV = "", this.isExplicit = true, this.asn1Object = null, this.setASN1Object = function(t4, e3, r2) {
|
|
1536
|
+
this.hT = e3, this.isExplicit = t4, this.asn1Object = r2, this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(), this.hTLV = null, this.isModified = true) : (this.hV = null, this.hTLV = r2.getEncodedHex(), this.hTLV = this.hTLV.replace(/^../, e3), this.isModified = false);
|
|
1537
|
+
}, this.getFreshValueHex = function() {
|
|
1538
|
+
return this.hV;
|
|
1539
|
+
}, void 0 !== t3 && (void 0 !== t3.tag && (this.hT = t3.tag), void 0 !== t3.explicit && (this.isExplicit = t3.explicit), void 0 !== t3.obj && (this.asn1Object = t3.obj, this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)));
|
|
1540
|
+
}, gt(dt.asn1.DERTaggedObject, dt.asn1.ASN1Object);
|
|
1541
|
+
var vt, yt, mt = (vt = function(t3, e3) {
|
|
1542
|
+
return vt = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t4, e4) {
|
|
1543
|
+
t4.__proto__ = e4;
|
|
1544
|
+
} || function(t4, e4) {
|
|
1545
|
+
for (var r2 in e4) Object.prototype.hasOwnProperty.call(e4, r2) && (t4[r2] = e4[r2]);
|
|
1546
|
+
}, vt(t3, e3);
|
|
1547
|
+
}, function(t3, e3) {
|
|
1548
|
+
if ("function" != typeof e3 && null !== e3) throw new TypeError("Class extends value " + String(e3) + " is not a constructor or null");
|
|
1549
|
+
function r2() {
|
|
1550
|
+
this.constructor = t3;
|
|
1551
|
+
}
|
|
1552
|
+
vt(t3, e3), t3.prototype = null === e3 ? Object.create(e3) : (r2.prototype = e3.prototype, new r2());
|
|
1553
|
+
}), bt = (function(t3) {
|
|
1554
|
+
function e3(r2) {
|
|
1555
|
+
var i2 = t3.call(this) || this;
|
|
1556
|
+
return r2 && ("string" == typeof r2 ? i2.parseKey(r2) : (e3.hasPrivateKeyProperty(r2) || e3.hasPublicKeyProperty(r2)) && i2.parsePropertiesFrom(r2)), i2;
|
|
1557
|
+
}
|
|
1558
|
+
return mt(e3, t3), e3.prototype.parseKey = function(t4) {
|
|
1559
|
+
try {
|
|
1560
|
+
var e4 = 0, r2 = 0, i2 = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t4) ? g(t4) : d.unarmor(t4), n2 = w.decode(i2);
|
|
1561
|
+
if (3 === n2.sub.length && (n2 = n2.sub[2].sub[0]), 9 === n2.sub.length) {
|
|
1562
|
+
e4 = n2.sub[1].getHexStringValue(), this.n = P(e4, 16), r2 = n2.sub[2].getHexStringValue(), this.e = parseInt(r2, 16);
|
|
1563
|
+
var s2 = n2.sub[3].getHexStringValue();
|
|
1564
|
+
this.d = P(s2, 16);
|
|
1565
|
+
var o2 = n2.sub[4].getHexStringValue();
|
|
1566
|
+
this.p = P(o2, 16);
|
|
1567
|
+
var h2 = n2.sub[5].getHexStringValue();
|
|
1568
|
+
this.q = P(h2, 16);
|
|
1569
|
+
var a2 = n2.sub[6].getHexStringValue();
|
|
1570
|
+
this.dmp1 = P(a2, 16);
|
|
1571
|
+
var u2 = n2.sub[7].getHexStringValue();
|
|
1572
|
+
this.dmq1 = P(u2, 16);
|
|
1573
|
+
var c2 = n2.sub[8].getHexStringValue();
|
|
1574
|
+
this.coeff = P(c2, 16);
|
|
1575
|
+
} else {
|
|
1576
|
+
if (2 !== n2.sub.length) return false;
|
|
1577
|
+
if (n2.sub[0].sub) {
|
|
1578
|
+
var f2 = n2.sub[1].sub[0];
|
|
1579
|
+
e4 = f2.sub[0].getHexStringValue(), this.n = P(e4, 16), r2 = f2.sub[1].getHexStringValue(), this.e = parseInt(r2, 16);
|
|
1580
|
+
} else e4 = n2.sub[0].getHexStringValue(), this.n = P(e4, 16), r2 = n2.sub[1].getHexStringValue(), this.e = parseInt(r2, 16);
|
|
1581
|
+
}
|
|
1582
|
+
return true;
|
|
1583
|
+
} catch (t5) {
|
|
1584
|
+
return false;
|
|
1585
|
+
}
|
|
1586
|
+
}, e3.prototype.getPrivateBaseKey = function() {
|
|
1587
|
+
var t4 = { array: [new dt.asn1.DERInteger({ int: 0 }), new dt.asn1.DERInteger({ bigint: this.n }), new dt.asn1.DERInteger({ int: this.e }), new dt.asn1.DERInteger({ bigint: this.d }), new dt.asn1.DERInteger({ bigint: this.p }), new dt.asn1.DERInteger({ bigint: this.q }), new dt.asn1.DERInteger({ bigint: this.dmp1 }), new dt.asn1.DERInteger({ bigint: this.dmq1 }), new dt.asn1.DERInteger({ bigint: this.coeff })] };
|
|
1588
|
+
return new dt.asn1.DERSequence(t4).getEncodedHex();
|
|
1589
|
+
}, e3.prototype.getPrivateBaseKeyB64 = function() {
|
|
1590
|
+
return f(this.getPrivateBaseKey());
|
|
1591
|
+
}, e3.prototype.getPublicBaseKey = function() {
|
|
1592
|
+
var t4 = new dt.asn1.DERSequence({ array: [new dt.asn1.DERObjectIdentifier({ oid: "1.2.840.113549.1.1.1" }), new dt.asn1.DERNull()] }), e4 = new dt.asn1.DERSequence({ array: [new dt.asn1.DERInteger({ bigint: this.n }), new dt.asn1.DERInteger({ int: this.e })] }), r2 = new dt.asn1.DERBitString({ hex: "00" + e4.getEncodedHex() });
|
|
1593
|
+
return new dt.asn1.DERSequence({ array: [t4, r2] }).getEncodedHex();
|
|
1594
|
+
}, e3.prototype.getPublicBaseKeyB64 = function() {
|
|
1595
|
+
return f(this.getPublicBaseKey());
|
|
1596
|
+
}, e3.wordwrap = function(t4, e4) {
|
|
1597
|
+
if (!t4) return t4;
|
|
1598
|
+
var r2 = "(.{1," + (e4 = e4 || 64) + "})( +|$\n?)|(.{1," + e4 + "})";
|
|
1599
|
+
return t4.match(RegExp(r2, "g")).join("\n");
|
|
1600
|
+
}, e3.prototype.getPrivateKey = function() {
|
|
1601
|
+
var t4 = "-----BEGIN RSA PRIVATE KEY-----\n";
|
|
1602
|
+
return t4 += e3.wordwrap(this.getPrivateBaseKeyB64()) + "\n", t4 += "-----END RSA PRIVATE KEY-----";
|
|
1603
|
+
}, e3.prototype.getPublicKey = function() {
|
|
1604
|
+
var t4 = "-----BEGIN PUBLIC KEY-----\n";
|
|
1605
|
+
return t4 += e3.wordwrap(this.getPublicBaseKeyB64()) + "\n", t4 += "-----END PUBLIC KEY-----";
|
|
1606
|
+
}, e3.hasPublicKeyProperty = function(t4) {
|
|
1607
|
+
return (t4 = t4 || {}).hasOwnProperty("n") && t4.hasOwnProperty("e");
|
|
1608
|
+
}, e3.hasPrivateKeyProperty = function(t4) {
|
|
1609
|
+
return (t4 = t4 || {}).hasOwnProperty("n") && t4.hasOwnProperty("e") && t4.hasOwnProperty("d") && t4.hasOwnProperty("p") && t4.hasOwnProperty("q") && t4.hasOwnProperty("dmp1") && t4.hasOwnProperty("dmq1") && t4.hasOwnProperty("coeff");
|
|
1610
|
+
}, e3.prototype.parsePropertiesFrom = function(t4) {
|
|
1611
|
+
this.n = t4.n, this.e = t4.e, t4.hasOwnProperty("d") && (this.d = t4.d, this.p = t4.p, this.q = t4.q, this.dmp1 = t4.dmp1, this.dmq1 = t4.dmq1, this.coeff = t4.coeff);
|
|
1612
|
+
}, e3;
|
|
1613
|
+
})(lt), Tt = r(606), St = void 0 !== Tt ? null === (yt = Tt.env) || void 0 === yt ? void 0 : "3.5.4" : void 0, Et = (function() {
|
|
1614
|
+
function t3(t4) {
|
|
1615
|
+
void 0 === t4 && (t4 = {}), this.default_key_size = t4.default_key_size ? parseInt(t4.default_key_size, 10) : 1024, this.default_public_exponent = t4.default_public_exponent || "010001", this.log = t4.log || false, this.key = t4.key || null;
|
|
1616
|
+
}
|
|
1617
|
+
return t3.prototype.setKey = function(t4) {
|
|
1618
|
+
t4 ? (this.log && this.key && console.warn("A key was already set, overriding existing."), this.key = new bt(t4)) : !this.key && this.log && console.error("A key was not set.");
|
|
1619
|
+
}, t3.prototype.setPrivateKey = function(t4) {
|
|
1620
|
+
this.setKey(t4);
|
|
1621
|
+
}, t3.prototype.setPublicKey = function(t4) {
|
|
1622
|
+
this.setKey(t4);
|
|
1623
|
+
}, t3.prototype.decrypt = function(t4) {
|
|
1624
|
+
try {
|
|
1625
|
+
return this.getKey().decrypt(l(t4));
|
|
1626
|
+
} catch (t5) {
|
|
1627
|
+
return false;
|
|
1628
|
+
}
|
|
1629
|
+
}, t3.prototype.encrypt = function(t4) {
|
|
1630
|
+
try {
|
|
1631
|
+
return f(this.getKey().encrypt(t4));
|
|
1632
|
+
} catch (t5) {
|
|
1633
|
+
return false;
|
|
1634
|
+
}
|
|
1635
|
+
}, t3.prototype.encryptOAEP = function(t4) {
|
|
1636
|
+
try {
|
|
1637
|
+
return f(this.getKey().encrypt(t4, ft));
|
|
1638
|
+
} catch (t5) {
|
|
1639
|
+
return false;
|
|
1640
|
+
}
|
|
1641
|
+
}, t3.prototype.sign = function(t4, e3, r2) {
|
|
1642
|
+
void 0 === e3 && (e3 = function(t5) {
|
|
1643
|
+
return t5;
|
|
1644
|
+
}), void 0 === r2 && (r2 = "");
|
|
1645
|
+
try {
|
|
1646
|
+
return f(this.getKey().sign(t4, e3, r2));
|
|
1647
|
+
} catch (t5) {
|
|
1648
|
+
return false;
|
|
1649
|
+
}
|
|
1650
|
+
}, t3.prototype.signSha256 = function(t4) {
|
|
1651
|
+
return this.sign(t4, function(t5) {
|
|
1652
|
+
return Q(X(t5));
|
|
1653
|
+
}, "sha256");
|
|
1654
|
+
}, t3.prototype.verify = function(t4, e3, r2) {
|
|
1655
|
+
void 0 === r2 && (r2 = function(t5) {
|
|
1656
|
+
return t5;
|
|
1657
|
+
});
|
|
1658
|
+
try {
|
|
1659
|
+
return this.getKey().verify(t4, l(e3), r2);
|
|
1660
|
+
} catch (t5) {
|
|
1661
|
+
return false;
|
|
1662
|
+
}
|
|
1663
|
+
}, t3.prototype.verifySha256 = function(t4, e3) {
|
|
1664
|
+
return this.verify(t4, e3, function(t5) {
|
|
1665
|
+
return Q(X(t5));
|
|
1666
|
+
});
|
|
1667
|
+
}, t3.prototype.getKey = function(t4) {
|
|
1668
|
+
if (!this.key) {
|
|
1669
|
+
if (this.key = new bt(), t4 && "[object Function]" === {}.toString.call(t4)) return void this.key.generateAsync(this.default_key_size, this.default_public_exponent, t4);
|
|
1670
|
+
this.key.generate(this.default_key_size, this.default_public_exponent);
|
|
1671
|
+
}
|
|
1672
|
+
return this.key;
|
|
1673
|
+
}, t3.prototype.getPrivateKey = function() {
|
|
1674
|
+
return this.getKey().getPrivateKey();
|
|
1675
|
+
}, t3.prototype.getPrivateKeyB64 = function() {
|
|
1676
|
+
return this.getKey().getPrivateBaseKeyB64();
|
|
1677
|
+
}, t3.prototype.getPublicKey = function() {
|
|
1678
|
+
return this.getKey().getPublicKey();
|
|
1679
|
+
}, t3.prototype.getPublicKeyB64 = function() {
|
|
1680
|
+
return this.getKey().getPublicBaseKeyB64();
|
|
1681
|
+
}, t3.version = St, t3;
|
|
1682
|
+
})();
|
|
1683
|
+
})(), i = i.default;
|
|
1684
|
+
})();
|
|
1685
|
+
});
|
|
1686
|
+
})(jsencrypt_min$1);
|
|
1687
|
+
return jsencrypt_min$1.exports;
|
|
1688
|
+
}
|
|
1689
|
+
export {
|
|
1690
|
+
requireJsencrypt_min as __require
|
|
1691
|
+
};
|