window.formatMiddle = function() {
var g = {
cfx_getNextNounce: 1,
cfx_getBalance: 1,
cfx_getBlockByEpochNumber: 0,
cfx_epochNumber: 0,
cfx_getBlocksByEpoch: 0,
cfx_call: 1,
cfx_getCode: 1
};
return function(h) {
var c = void 0 === h ? {} : h,
b = void 0 === c.method ? "" : c.method;
c = void 0 === c.params ? {} : c.params;
b && (b = b.replace("eth_", "cfx_"), b = b.replace("getTransactionCount", "getNextNonce"), b = b.replace(/estimateGas$/, "estimateGasAndCollateral"), b = b.replace("getBlockByNumber", "getBlockByEpochNumber"), b = b.replace("cfx_blockNumber", "cfx_epochNumber"));
void 0 === g[b] || Array.isArray(c) && void 0 !== c[g[b]] && "latest_mined" !== c[g[b]] && "latest" !== c[g[b]] || (Array.isArray(c) || (c = []), c[g[b]] = "latest_state");
h.method = b;
h.params = c;
return h
}
}();
parcelRequire = function(e, r, n, t) {
var i = "function" == typeof parcelRequire && parcelRequire,
o = "function" == typeof require && require;
function u(n, t) {
if (!r[n]) {
if (!e[n]) {
var f = "function" == typeof parcelRequire && parcelRequire;
if (!t && f) return f(n, !0);
if (i) return i(n, !0);
if (o && "string" == typeof n) return o(n);
var c = new Error("Cannot find module '" + n + "'");
throw c.code = "MODULE_NOT_FOUND", c
}
p.resolve = function(r) {
return e[n][1][r] || r
}, p.cache = {};
var l = r[n] = new u.Module(n);
e[n][0].call(l.exports, p, l, l.exports, this)
}
return r[n].exports;
function p(e) {
return u(p.resolve(e))
}
}
u.isParcelRequire = !0, u.Module = function(e) {
this.id = e, this.bundle = u, this.exports = {}
}, u.modules = e, u.cache = r, u.parent = i, u.register = function(r, n) {
e[r] = [function(e, r) {
r.exports = n
}, {}]
};
for (var f = 0; f < n.length; f++) u(n[f]);
if (n.length) {
var c = u(n[n.length - 1]);
"object" == typeof exports && "undefined" != typeof module ? module.exports = c : "function" == typeof define && define.amd ? define(function() {
return c
}) : t && (this[t] = c)
}
return u
}({
"_ConfluxJs": [function(t, e, r) {
(function(t) {
! function(e) {
if ("object" == typeof exports && "undefined" != typeof module) module.exports = e();
else if ("function" == typeof define && define.amd) define([], e);
else {
("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).ConfluxJSSDK = e()
}
}((function() {
return function e(t, r, n) {
function i(a, s) {
if (!r[a]) {
if (!t[a]) {
var u = "function" == typeof require && require;
if (!s && u) return u(a, !0);
if (o) return o(a, !0);
var f = new Error("Cannot find module '" + a + "'");
throw f.code = "MODULE_NOT_FOUND", f
}
var c = r[a] = {
exports: {}
};
t[a][0].call(c.exports, (function(e) {
return i(t[a][1][e] || e)
}), c, c.exports, e, t, r, n)
}
return r[a].exports
}
for (var o = "function" == typeof require && require, a = 0; a < n.length; a++) i(n[a]);
return i
}({
1: [function(e, t, r) {
t.exports = function(e, t) {
(null == t || t > e.length) && (t = e.length);
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
return n
}
}, {}],
2: [function(e, t, r) {
t.exports = function(e) {
if (Array.isArray(e)) return e
}
}, {}],
3: [function(e, t, r) {
var n = e("./arrayLikeToArray");
t.exports = function(e) {
if (Array.isArray(e)) return n(e)
}
}, {
"./arrayLikeToArray": 1
}],
4: [function(e, t, r) {
t.exports = function(e) {
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}
}, {}],
5: [function(e, t, r) {
function n(e, t, r, n, i, o, a) {
try {
var s = e[o](a),
u = s.value
} catch (e) {
return void r(e)
}
s.done ? t(u) : Promise.resolve(u).then(n, i)
}
t.exports = function(e) {
return function() {
var t = this,
r = arguments;
return new Promise((function(i, o) {
var a = e.apply(t, r);
function s(e) {
n(a, i, o, s, u, "next", e)
}
function u(e) {
n(a, i, o, s, u, "throw", e)
}
s(void 0)
}))
}
}
}, {}],
6: [function(e, t, r) {
t.exports = function(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
}, {}],
7: [function(e, t, r) {
var n = e("./setPrototypeOf"),
i = e("./isNativeReflectConstruct");
function o(e, r, a) {
return i() ? t.exports = o = Reflect.construct : t.exports = o = function(e, t, r) {
var i = [null];
i.push.apply(i, t);
var o = new(Function.bind.apply(e, i));
return r && n(o, r.prototype), o
}, o.apply(null, arguments)
}
t.exports = o
}, {
"./isNativeReflectConstruct": 15,
"./setPrototypeOf": 23
}],
8: [function(e, t, r) {
function n(e, t) {
for (var r = 0; r < t.length; r++) {
var n = t[r];
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
}
}
t.exports = function(e, t, r) {
return t && n(e.prototype, t), r && n(e, r), e
}
}, {}],
9: [function(e, t, r) {
t.exports = function(e, t, r) {
return t in e ? Object.defineProperty(e, t, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = r, e
}
}, {}],
10: [function(e, t, r) {
var n = e("./superPropBase");
function i(e, r, o) {
return "undefined" != typeof Reflect && Reflect.get ? t.exports = i = Reflect.get : t.exports = i = function(e, t, r) {
var i = n(e, t);
if (i) {
var o = Object.getOwnPropertyDescriptor(i, t);
return o.get ? o.get.call(r) : o.value
}
}, i(e, r, o || e)
}
t.exports = i
}, {
"./superPropBase": 25
}],
11: [function(e, t, r) {
function n(e) {
return t.exports = n = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
return e.__proto__ || Object.getPrototypeOf(e)
}, n(e)
}
t.exports = n
}, {}],
12: [function(e, t, r) {
var n = e("./setPrototypeOf");
t.exports = function(e, t) {
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}), t && n(e, t)
}
}, {
"./setPrototypeOf": 23
}],
13: [function(e, t, r) {
t.exports = function(e) {
return e && e.__esModule ? e : {
default: e
}
}
}, {}],
14: [function(e, t, r) {
t.exports = function(e) {
return -1 !== Function.toString.call(e).indexOf("[native code]")
}
}, {}],
15: [function(e, t, r) {
t.exports = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Date.prototype.toString.call(Reflect.construct(Date, [], (function() {}))), !0
} catch (e) {
return !1
}
}
}, {}],
16: [function(e, t, r) {
t.exports = function(e) {
if ("undefined" != typeof Symbol && Symbol.iterator in Object(e)) return Array.from(e)
}
}, {}],
17: [function(e, t, r) {
t.exports = function(e, t) {
if ("undefined" != typeof Symbol && Symbol.iterator in Object(e)) {
var r = [],
n = !0,
i = !1,
o = void 0;
try {
for (var a, s = e[Symbol.iterator](); !(n = (a = s.next()).done) && (r.push(a.value), !t || r.length !== t); n = !0);
} catch (e) {
i = !0, o = e
} finally {
try {
n || null == s.return || s.return()
} finally {
if (i) throw o
}
}
return r
}
}
}, {}],
18: [function(e, t, r) {
t.exports = function() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
}
}, {}],
19: [function(e, t, r) {
t.exports = function() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
}
}, {}],
20: [function(e, t, r) {
var n = e("./objectWithoutPropertiesLoose");
t.exports = function(e, t) {
if (null == e) return {};
var r, i, o = n(e, t);
if (Object.getOwnPropertySymbols) {
var a = Object.getOwnPropertySymbols(e);
for (i = 0; i < a.length; i++) r = a[i], t.indexOf(r) >= 0 || Object.prototype.propertyIsEnumerable.call(e, r) && (o[r] = e[r])
}
return o
}
}, {
"./objectWithoutPropertiesLoose": 21
}],
21: [function(e, t, r) {
t.exports = function(e, t) {
if (null == e) return {};
var r, n, i = {},
o = Object.keys(e);
for (n = 0; n < o.length; n++) r = o[n], t.indexOf(r) >= 0 || (i[r] = e[r]);
return i
}
}, {}],
22: [function(e, t, r) {
var n = e("@babel/runtime/helpers/typeof"),
i = e("./assertThisInitialized");
t.exports = function(e, t) {
return !t || "object" !== n(t) && "function" != typeof t ? i(e) : t
}
}, {
"./assertThisInitialized": 4,
"@babel/runtime/helpers/typeof": 27
}],
23: [function(e, t, r) {
function n(e, r) {
return t.exports = n = Object.setPrototypeOf || function(e, t) {
return e.__proto__ = t, e
}, n(e, r)
}
t.exports = n
}, {}],
24: [function(e, t, r) {
var n = e("./arrayWithHoles"),
i = e("./iterableToArrayLimit"),
o = e("./unsupportedIterableToArray"),
a = e("./nonIterableRest");
t.exports = function(e, t) {
return n(e) || i(e, t) || o(e, t) || a()
}
}, {
"./arrayWithHoles": 2,
"./iterableToArrayLimit": 17,
"./nonIterableRest": 18,
"./unsupportedIterableToArray": 28
}],
25: [function(e, t, r) {
var n = e("./getPrototypeOf");
t.exports = function(e, t) {
for (; !Object.prototype.hasOwnProperty.call(e, t) && null !== (e = n(e)););
return e
}
}, {
"./getPrototypeOf": 11
}],
26: [function(e, t, r) {
var n = e("./arrayWithoutHoles"),
i = e("./iterableToArray"),
o = e("./unsupportedIterableToArray"),
a = e("./nonIterableSpread");
t.exports = function(e) {
return n(e) || i(e) || o(e) || a()
}
}, {
"./arrayWithoutHoles": 3,
"./iterableToArray": 16,
"./nonIterableSpread": 19,
"./unsupportedIterableToArray": 28
}],
27: [function(e, t, r) {
function n(e) {
return "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? t.exports = n = function(e) {
return typeof e
} : t.exports = n = function(e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
}, n(e)
}
t.exports = n
}, {}],
28: [function(e, t, r) {
var n = e("./arrayLikeToArray");
t.exports = function(e, t) {
if (e) {
if ("string" == typeof e) return n(e, t);
var r = Object.prototype.toString.call(e).slice(8, -1);
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? n(e, t) : void 0
}
}
}, {
"./arrayLikeToArray": 1
}],
29: [function(e, t, r) {
var n = e("./getPrototypeOf"),
i = e("./setPrototypeOf"),
o = e("./isNativeFunction"),
a = e("./construct");
function s(e) {
var r = "function" == typeof Map ? new Map : void 0;
return t.exports = s = function(e) {
if (null === e || !o(e)) return e;
if ("function" != typeof e) throw new TypeError("Super expression must either be null or a function");
if (void 0 !== r) {
if (r.has(e)) return r.get(e);
r.set(e, t)
}
function t() {
return a(e, arguments, n(this).constructor)
}
return t.prototype = Object.create(e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}), i(t, e)
}, s(e)
}
t.exports = s
}, {
"./construct": 7,
"./getPrototypeOf": 11,
"./isNativeFunction": 14,
"./setPrototypeOf": 23
}],
30: [function(e, t, r) {
t.exports = e("regenerator-runtime")
}, {
"regenerator-runtime": 227
}],
31: [function(e, t, r) {
"use strict";
const n = r;
n.bignum = e("bn.js"), n.define = e("./asn1/api").define, n.base = e("./asn1/base"), n.constants = e("./asn1/constants"), n.decoders = e("./asn1/decoders"), n.encoders = e("./asn1/encoders")
}, {
"./asn1/api": 32,
"./asn1/base": 34,
"./asn1/constants": 38,
"./asn1/decoders": 40,
"./asn1/encoders": 43,
"bn.js": 56
}],
32: [function(e, t, r) {
"use strict";
const n = e("./encoders"),
i = e("./decoders"),
o = e("inherits");
function a(e, t) {
this.name = e, this.body = t, this.decoders = {}, this.encoders = {}
}
r.define = function(e, t) {
return new a(e, t)
}, a.prototype._createNamed = function(e) {
const t = this.name;
function r(e) {
this._initNamed(e, t)
}
return o(r, e), r.prototype._initNamed = function(t, r) {
e.call(this, t, r)
}, new r(this)
}, a.prototype._getDecoder = function(e) {
return e = e || "der", this.decoders.hasOwnProperty(e) || (this.decoders[e] = this._createNamed(i[e])), this.decoders[e]
}, a.prototype.decode = function(e, t, r) {
return this._getDecoder(t).decode(e, r)
}, a.prototype._getEncoder = function(e) {
return e = e || "der", this.encoders.hasOwnProperty(e) || (this.encoders[e] = this._createNamed(n[e])), this.encoders[e]
}, a.prototype.encode = function(e, t, r) {
return this._getEncoder(t).encode(e, r)
}
}, {
"./decoders": 40,
"./encoders": 43,
inherits: 175
}],
33: [function(e, t, r) {
"use strict";
const n = e("inherits"),
i = e("../base/reporter").Reporter,
o = e("safer-buffer").Buffer;
function a(e, t) {
i.call(this, t), o.isBuffer(e) ? (this.base = e, this.offset = 0, this.length = e.length) : this.error("Input not Buffer")
}
function s(e, t) {
if (Array.isArray(e)) this.length = 0, this.value = e.map((function(e) {
return s.isEncoderBuffer(e) || (e = new s(e, t)), this.length += e.length, e
}), this);
else if ("number" == typeof e) {
if (!(0 <= e && e <= 255)) return t.error("non-byte EncoderBuffer value");
this.value = e, this.length = 1
} else if ("string" == typeof e) this.value = e, this.length = o.byteLength(e);
else {
if (!o.isBuffer(e)) return t.error("Unsupported type: " + typeof e);
this.value = e, this.length = e.length
}
}
n(a, i), r.DecoderBuffer = a, a.isDecoderBuffer = function(e) {
if (e instanceof a) return !0;
return "object" == typeof e && o.isBuffer(e.base) && "DecoderBuffer" === e.constructor.name && "number" == typeof e.offset && "number" == typeof e.length && "function" == typeof e.save && "function" == typeof e.restore && "function" == typeof e.isEmpty && "function" == typeof e.readUInt8 && "function" == typeof e.skip && "function" == typeof e.raw
}, a.prototype.save = function() {
return {
offset: this.offset,
reporter: i.prototype.save.call(this)
}
}, a.prototype.restore = function(e) {
const t = new a(this.base);
return t.offset = e.offset, t.length = this.offset, this.offset = e.offset, i.prototype.restore.call(this, e.reporter), t
}, a.prototype.isEmpty = function() {
return this.offset === this.length
}, a.prototype.readUInt8 = function(e) {
return this.offset + 1 <= this.length ? this.base.readUInt8(this.offset++, !0) : this.error(e || "DecoderBuffer overrun")
}, a.prototype.skip = function(e, t) {
if (!(this.offset + e <= this.length)) return this.error(t || "DecoderBuffer overrun");
const r = new a(this.base);
return r._reporterState = this._reporterState, r.offset = this.offset, r.length = this.offset + e, this.offset += e, r
}, a.prototype.raw = function(e) {
return this.base.slice(e ? e.offset : this.offset, this.length)
}, r.EncoderBuffer = s, s.isEncoderBuffer = function(e) {
if (e instanceof s) return !0;
return "object" == typeof e && "EncoderBuffer" === e.constructor.name && "number" == typeof e.length && "function" == typeof e.join
}, s.prototype.join = function(e, t) {
return e || (e = o.alloc(this.length)), t || (t = 0), 0 === this.length || (Array.isArray(this.value) ? this.value.forEach((function(r) {
r.join(e, t), t += r.length
})) : ("number" == typeof this.value ? e[t] = this.value : "string" == typeof this.value ? e.write(this.value, t) : o.isBuffer(this.value) && this.value.copy(e, t), t += this.length)), e
}
}, {
"../base/reporter": 36,
inherits: 175,
"safer-buffer": 230
}],
34: [function(e, t, r) {
"use strict";
const n = r;
n.Reporter = e("./reporter").Reporter, n.DecoderBuffer = e("./buffer").DecoderBuffer, n.EncoderBuffer = e("./buffer").EncoderBuffer, n.Node = e("./node")
}, {
"./buffer": 33,
"./node": 35,
"./reporter": 36
}],
35: [function(e, t, r) {
"use strict";
const n = e("../base/reporter").Reporter,
i = e("../base/buffer").EncoderBuffer,
o = e("../base/buffer").DecoderBuffer,
a = e("minimalistic-assert"),
s = ["seq", "seqof", "set", "setof", "objid", "bool", "gentime", "utctime", "null_", "enum", "int", "objDesc", "bitstr", "bmpstr", "charstr", "genstr", "graphstr", "ia5str", "iso646str", "numstr", "octstr", "printstr", "t61str", "unistr", "utf8str", "videostr"],
u = ["key", "obj", "use", "optional", "explicit", "implicit", "def", "choice", "any", "contains"].concat(s);
function f(e, t, r) {
const n = {};
this._baseState = n, n.name = r, n.enc = e, n.parent = t || null, n.children = null, n.tag = null, n.args = null, n.reverseArgs = null, n.choice = null, n.optional = !1, n.any = !1, n.obj = !1, n.use = null, n.useDecoder = null, n.key = null, n.default = null, n.explicit = null, n.implicit = null, n.contains = null, n.parent || (n.children = [], this._wrap())
}
t.exports = f;
const c = ["enc", "parent", "children", "tag", "args", "reverseArgs", "choice", "optional", "any", "obj", "use", "alteredUse", "key", "default", "explicit", "implicit", "contains"];
f.prototype.clone = function() {
const e = this._baseState,
t = {};
c.forEach((function(r) {
t[r] = e[r]
}));
const r = new this.constructor(t.parent);
return r._baseState = t, r
}, f.prototype._wrap = function() {
const e = this._baseState;
u.forEach((function(t) {
this[t] = function() {
const r = new this.constructor(this);
return e.children.push(r), r[t].apply(r, arguments)
}
}), this)
}, f.prototype._init = function(e) {
const t = this._baseState;
a(null === t.parent), e.call(this), t.children = t.children.filter((function(e) {
return e._baseState.parent === this
}), this), a.equal(t.children.length, 1, "Root node can have only one child")
}, f.prototype._useArgs = function(e) {
const t = this._baseState,
r = e.filter((function(e) {
return e instanceof this.constructor
}), this);
e = e.filter((function(e) {
return !(e instanceof this.constructor)
}), this), 0 !== r.length && (a(null === t.children), t.children = r, r.forEach((function(e) {
e._baseState.parent = this
}), this)), 0 !== e.length && (a(null === t.args), t.args = e, t.reverseArgs = e.map((function(e) {
if ("object" != typeof e || e.constructor !== Object) return e;
const t = {};
return Object.keys(e).forEach((function(r) {
r == (0 | r) && (r |= 0);
const n = e[r];
t[n] = r
})), t
})))
}, ["_peekTag", "_decodeTag", "_use", "_decodeStr", "_decodeObjid", "_decodeTime", "_decodeNull", "_decodeInt", "_decodeBool", "_decodeList", "_encodeComposite", "_encodeStr", "_encodeObjid", "_encodeTime", "_encodeNull", "_encodeInt", "_encodeBool"].forEach((function(e) {
f.prototype[e] = function() {
const t = this._baseState;
throw new Error(e + " not implemented for encoding: " + t.enc)
}
})), s.forEach((function(e) {
f.prototype[e] = function() {
const t = this._baseState,
r = Array.prototype.slice.call(arguments);
return a(null === t.tag), t.tag = e, this._useArgs(r), this
}
})), f.prototype.use = function(e) {
a(e);
const t = this._baseState;
return a(null === t.use), t.use = e, this
}, f.prototype.optional = function() {
return this._baseState.optional = !0, this
}, f.prototype.def = function(e) {
const t = this._baseState;
return a(null === t.default), t.default = e, t.optional = !0, this
}, f.prototype.explicit = function(e) {
const t = this._baseState;
return a(null === t.explicit && null === t.implicit), t.explicit = e, this
}, f.prototype.implicit = function(e) {
const t = this._baseState;
return a(null === t.explicit && null === t.implicit), t.implicit = e, this
}, f.prototype.obj = function() {
const e = this._baseState,
t = Array.prototype.slice.call(arguments);
return e.obj = !0, 0 !== t.length && this._useArgs(t), this
}, f.prototype.key = function(e) {
const t = this._baseState;
return a(null === t.key), t.key = e, this
}, f.prototype.any = function() {
return this._baseState.any = !0, this
}, f.prototype.choice = function(e) {
const t = this._baseState;
return a(null === t.choice), t.choice = e, this._useArgs(Object.keys(e).map((function(t) {
return e[t]
}))), this
}, f.prototype.contains = function(e) {
const t = this._baseState;
return a(null === t.use), t.contains = e, this
}, f.prototype._decode = function(e, t) {
const r = this._baseState;
if (null === r.parent) return e.wrapResult(r.children[0]._decode(e, t));
let n, i = r.default,
a = !0,
s = null;
if (null !== r.key && (s = e.enterKey(r.key)), r.optional) {
let n = null;
if (null !== r.explicit ? n = r.explicit : null !== r.implicit ? n = r.implicit : null !== r.tag && (n = r.tag), null !== n || r.any) {
if (a = this._peekTag(e, n, r.any), e.isError(a)) return a
} else {
const n = e.save();
try {
null === r.choice ? this._decodeGeneric(r.tag, e, t) : this._decodeChoice(e, t), a = !0
} catch (e) {
a = !1
}
e.restore(n)
}
}
if (r.obj && a && (n = e.enterObject()), a) {
if (null !== r.explicit) {
const t = this._decodeTag(e, r.explicit);
if (e.isError(t)) return t;
e = t
}
const n = e.offset;
if (null === r.use && null === r.choice) {
let t;
r.any && (t = e.save());
const n = this._decodeTag(e, null !== r.implicit ? r.implicit : r.tag, r.any);
if (e.isError(n)) return n;
r.any ? i = e.raw(t) : e = n
}
if (t && t.track && null !== r.tag && t.track(e.path(), n, e.length, "tagged"), t && t.track && null !== r.tag && t.track(e.path(), e.offset, e.length, "content"), r.any || (i = null === r.choice ? this._decodeGeneric(r.tag, e, t) : this._decodeChoice(e, t)), e.isError(i)) return i;
if (r.any || null !== r.choice || null === r.children || r.children.forEach((function(r) {
r._decode(e, t)
})), r.contains && ("octstr" === r.tag || "bitstr" === r.tag)) {
const n = new o(i);
i = this._getUse(r.contains, e._reporterState.obj)._decode(n, t)
}
}
return r.obj && a && (i = e.leaveObject(n)), null === r.key || null === i && !0 !== a ? null !== s && e.exitKey(s) : e.leaveKey(s, r.key, i), i
}, f.prototype._decodeGeneric = function(e, t, r) {
const n = this._baseState;
return "seq" === e || "set" === e ? null : "seqof" === e || "setof" === e ? this._decodeList(t, e, n.args[0], r) : /str$/.test(e) ? this._decodeStr(t, e, r) : "objid" === e && n.args ? this._decodeObjid(t, n.args[0], n.args[1], r) : "objid" === e ? this._decodeObjid(t, null, null, r) : "gentime" === e || "utctime" === e ? this._decodeTime(t, e, r) : "null_" === e ? this._decodeNull(t, r) : "bool" === e ? this._decodeBool(t, r) : "objDesc" === e ? this._decodeStr(t, e, r) : "int" === e || "enum" === e ? this._decodeInt(t, n.args && n.args[0], r) : null !== n.use ? this._getUse(n.use, t._reporterState.obj)._decode(t, r) : t.error("unknown tag: " + e)
}, f.prototype._getUse = function(e, t) {
const r = this._baseState;
return r.useDecoder = this._use(e, t), a(null === r.useDecoder._baseState.parent), r.useDecoder = r.useDecoder._baseState.children[0], r.implicit !== r.useDecoder._baseState.implicit && (r.useDecoder = r.useDecoder.clone(), r.useDecoder._baseState.implicit = r.implicit), r.useDecoder
}, f.prototype._decodeChoice = function(e, t) {
const r = this._baseState;
let n = null,
i = !1;
return Object.keys(r.choice).some((function(o) {
const a = e.save(),
s = r.choice[o];
try {
const r = s._decode(e, t);
if (e.isError(r)) return !1;
n = {
type: o,
value: r
}, i = !0
} catch (t) {
return e.restore(a), !1
}
return !0
}), this), i ? n : e.error("Choice not matched")
}, f.prototype._createEncoderBuffer = function(e) {
return new i(e, this.reporter)
}, f.prototype._encode = function(e, t, r) {
const n = this._baseState;
if (null !== n.default && n.default === e) return;
const i = this._encodeValue(e, t, r);
return void 0 === i || this._skipDefault(i, t, r) ? void 0 : i
}, f.prototype._encodeValue = function(e, t, r) {
const i = this._baseState;
if (null === i.parent) return i.children[0]._encode(e, t || new n);
let o = null;
if (this.reporter = t, i.optional && void 0 === e) {
if (null === i.default) return;
e = i.default
}
let a = null,
s = !1;
if (i.any) o = this._createEncoderBuffer(e);
else if (i.choice) o = this._encodeChoice(e, t);
else if (i.contains) a = this._getUse(i.contains, r)._encode(e, t), s = !0;
else if (i.children) a = i.children.map((function(r) {
if ("null_" === r._baseState.tag) return r._encode(null, t, e);
if (null === r._baseState.key) return t.error("Child should have a key");
const n = t.enterKey(r._baseState.key);
if ("object" != typeof e) return t.error("Child expected, but input is not object");
const i = r._encode(e[r._baseState.key], t, e);
return t.leaveKey(n), i
}), this).filter((function(e) {
return e
})), a = this._createEncoderBuffer(a);
else if ("seqof" === i.tag || "setof" === i.tag) {
if (!i.args || 1 !== i.args.length) return t.error("Too many args for : " + i.tag);
if (!Array.isArray(e)) return t.error("seqof/setof, but data is not Array");
const r = this.clone();
r._baseState.implicit = null, a = this._createEncoderBuffer(e.map((function(r) {
const n = this._baseState;
return this._getUse(n.args[0], e)._encode(r, t)
}), r))
} else null !== i.use ? o = this._getUse(i.use, r)._encode(e, t) : (a = this._encodePrimitive(i.tag, e), s = !0);
if (!i.any && null === i.choice) {
const e = null !== i.implicit ? i.implicit : i.tag,
r = null === i.implicit ? "universal" : "context";
null === e ? null === i.use && t.error("Tag could be omitted only for .use()") : null === i.use && (o = this._encodeComposite(e, s, r, a))
}
return null !== i.explicit && (o = this._encodeComposite(i.explicit, !1, "context", o)), o
}, f.prototype._encodeChoice = function(e, t) {
const r = this._baseState,
n = r.choice[e.type];
return n || a(!1, e.type + " not found in " + JSON.stringify(Object.keys(r.choice))), n._encode(e.value, t)
}, f.prototype._encodePrimitive = function(e, t) {
const r = this._baseState;
if (/str$/.test(e)) return this._encodeStr(t, e);
if ("objid" === e && r.args) return this._encodeObjid(t, r.reverseArgs[0], r.args[1]);
if ("objid" === e) return this._encodeObjid(t, null, null);
if ("gentime" === e || "utctime" === e) return this._encodeTime(t, e);
if ("null_" === e) return this._encodeNull();
if ("int" === e || "enum" === e) return this._encodeInt(t, r.args && r.reverseArgs[0]);
if ("bool" === e) return this._encodeBool(t);
if ("objDesc" === e) return this._encodeStr(t, e);
throw new Error("Unsupported tag: " + e)
}, f.prototype._isNumstr = function(e) {
return /^[0-9 ]*$/.test(e)
}, f.prototype._isPrintstr = function(e) {
return /^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)
}
}, {
"../base/buffer": 33,
"../base/reporter": 36,
"minimalistic-assert": 188
}],
36: [function(e, t, r) {
"use strict";
const n = e("inherits");
function i(e) {
this._reporterState = {
obj: null,
path: [],
options: e || {},
errors: []
}
}
function o(e, t) {
this.path = e, this.rethrow(t)
}
r.Reporter = i, i.prototype.isError = function(e) {
return e instanceof o
}, i.prototype.save = function() {
const e = this._reporterState;
return {
obj: e.obj,
pathLen: e.path.length
}
}, i.prototype.restore = function(e) {
const t = this._reporterState;
t.obj = e.obj, t.path = t.path.slice(0, e.pathLen)
}, i.prototype.enterKey = function(e) {
return this._reporterState.path.push(e)
}, i.prototype.exitKey = function(e) {
const t = this._reporterState;
t.path = t.path.slice(0, e - 1)
}, i.prototype.leaveKey = function(e, t, r) {
const n = this._reporterState;
this.exitKey(e), null !== n.obj && (n.obj[t] = r)
}, i.prototype.path = function() {
return this._reporterState.path.join("/")
}, i.prototype.enterObject = function() {
const e = this._reporterState,
t = e.obj;
return e.obj = {}, t
}, i.prototype.leaveObject = function(e) {
const t = this._reporterState,
r = t.obj;
return t.obj = e, r
}, i.prototype.error = function(e) {
let t;
const r = this._reporterState,
n = e instanceof o;
if (t = n ? e : new o(r.path.map((function(e) {
return "[" + JSON.stringify(e) + "]"
})).join(""), e.message || e, e.stack), !r.options.partial) throw t;
return n || r.errors.push(t), t
}, i.prototype.wrapResult = function(e) {
const t = this._reporterState;
return t.options.partial ? {
result: this.isError(e) ? null : e,
errors: t.errors
} : e
}, n(o, Error), o.prototype.rethrow = function(e) {
if (this.message = e + " at: " + (this.path || "(shallow)"), Error.captureStackTrace && Error.captureStackTrace(this, o), !this.stack) try {
throw new Error(this.message)
} catch (e) {
this.stack = e.stack
}
return this
}
}, {
inherits: 175
}],
37: [function(e, t, r) {
"use strict";
function n(e) {
const t = {};
return Object.keys(e).forEach((function(r) {
(0 | r) == r && (r |= 0);
const n = e[r];
t[n] = r
})), t
}
r.tagClass = {
0: "universal",
1: "application",
2: "context",
3: "private"
}, r.tagClassByName = n(r.tagClass), r.tag = {
0: "end",
1: "bool",
2: "int",
3: "bitstr",
4: "octstr",
5: "null_",
6: "objid",
7: "objDesc",
8: "external",
9: "real",
10: "enum",
11: "embed",
12: "utf8str",
13: "relativeOid",
16: "seq",
17: "set",
18: "numstr",
19: "printstr",
20: "t61str",
21: "videostr",
22: "ia5str",
23: "utctime",
24: "gentime",
25: "graphstr",
26: "iso646str",
27: "genstr",
28: "unistr",
29: "charstr",
30: "bmpstr"
}, r.tagByName = n(r.tag)
}, {}],
38: [function(e, t, r) {
"use strict";
const n = r;
n._reverse = function(e) {
const t = {};
return Object.keys(e).forEach((function(r) {
(0 | r) == r && (r |= 0);
const n = e[r];
t[n] = r
})), t
}, n.der = e("./der")
}, {
"./der": 37
}],
39: [function(e, t, r) {
"use strict";
const n = e("inherits"),
i = e("bn.js"),
o = e("../base/buffer").DecoderBuffer,
a = e("../base/node"),
s = e("../constants/der");
function u(e) {
this.enc = "der", this.name = e.name, this.entity = e, this.tree = new f, this.tree._init(e.body)
}
function f(e) {
a.call(this, "der", e)
}
function c(e, t) {
let r = e.readUInt8(t);
if (e.isError(r)) return r;
const n = s.tagClass[r >> 6],
i = 0 == (32 & r);
if (31 == (31 & r)) {
let n = r;
for (r = 0; 128 == (128 & n);) {
if (n = e.readUInt8(t), e.isError(n)) return n;
r <<= 7, r |= 127 & n
}
} else r &= 31;
return {
cls: n,
primitive: i,
tag: r,
tagStr: s.tag[r]
}
}
function l(e, t, r) {
let n = e.readUInt8(r);
if (e.isError(n)) return n;
if (!t && 128 === n) return null;
if (0 == (128 & n)) return n;
const i = 127 & n;
if (i > 4) return e.error("length octect is too long");
n = 0;
for (let t = 0; t < i; t++) {
n <<= 8;
const t = e.readUInt8(r);
if (e.isError(t)) return t;
n |= t
}
return n
}
t.exports = u, u.prototype.decode = function(e, t) {
return o.isDecoderBuffer(e) || (e = new o(e, t)), this.tree._decode(e, t)
}, n(f, a), f.prototype._peekTag = function(e, t, r) {
if (e.isEmpty()) return !1;
const n = e.save(),
i = c(e, 'Failed to peek tag: "' + t + '"');
return e.isError(i) ? i : (e.restore(n), i.tag === t || i.tagStr === t || i.tagStr + "of" === t || r)
}, f.prototype._decodeTag = function(e, t, r) {
const n = c(e, 'Failed to decode tag of "' + t + '"');
if (e.isError(n)) return n;
let i = l(e, n.primitive, 'Failed to get length of "' + t + '"');
if (e.isError(i)) return i;
if (!r && n.tag !== t && n.tagStr !== t && n.tagStr + "of" !== t) return e.error('Failed to match tag: "' + t + '"');
if (n.primitive || null !== i) return e.skip(i, 'Failed to match body of: "' + t + '"');
const o = e.save(),
a = this._skipUntilEnd(e, 'Failed to skip indefinite length body: "' + this.tag + '"');
return e.isError(a) ? a : (i = e.offset - o.offset, e.restore(o), e.skip(i, 'Failed to match body of: "' + t + '"'))
}, f.prototype._skipUntilEnd = function(e, t) {
for (;;) {
const r = c(e, t);
if (e.isError(r)) return r;
const n = l(e, r.primitive, t);
if (e.isError(n)) return n;
let i;
if (i = r.primitive || null !== n ? e.skip(n) : this._skipUntilEnd(e, t), e.isError(i)) return i;
if ("end" === r.tagStr) break
}
}, f.prototype._decodeList = function(e, t, r, n) {
const i = [];
for (; !e.isEmpty();) {
const t = this._peekTag(e, "end");
if (e.isError(t)) return t;
const o = r.decode(e, "der", n);
if (e.isError(o) && t) break;
i.push(o)
}
return i
}, f.prototype._decodeStr = function(e, t) {
if ("bitstr" === t) {
const t = e.readUInt8();
return e.isError(t) ? t : {
unused: t,
data: e.raw()
}
}
if ("bmpstr" === t) {
const t = e.raw();
if (t.length % 2 == 1) return e.error("Decoding of string type: bmpstr length mismatch");
let r = "";
for (let e = 0; e < t.length / 2; e++) r += String.fromCharCode(t.readUInt16BE(2 * e));
return r
}
if ("numstr" === t) {
const t = e.raw().toString("ascii");
return this._isNumstr(t) ? t : e.error("Decoding of string type: numstr unsupported characters")
}
if ("octstr" === t) return e.raw();
if ("objDesc" === t) return e.raw();
if ("printstr" === t) {
const t = e.raw().toString("ascii");
return this._isPrintstr(t) ? t : e.error("Decoding of string type: printstr unsupported characters")
}
return /str$/.test(t) ? e.raw().toString() : e.error("Decoding of string type: " + t + " unsupported")
}, f.prototype._decodeObjid = function(e, t, r) {
let n;
const i = [];
let o = 0,
a = 0;
for (; !e.isEmpty();) a = e.readUInt8(), o <<= 7, o |= 127 & a, 0 == (128 & a) && (i.push(o), o = 0);
128 & a && i.push(o);
const s = i[0] / 40 | 0,
u = i[0] % 40;
if (n = r ? i : [s, u].concat(i.slice(1)), t) {
let e = t[n.join(" ")];
void 0 === e && (e = t[n.join(".")]), void 0 !== e && (n = e)
}
return n
}, f.prototype._decodeTime = function(e, t) {
const r = e.raw().toString();
let n, i, o, a, s, u;
if ("gentime" === t) n = 0 | r.slice(0, 4), i = 0 | r.slice(4, 6), o = 0 | r.slice(6, 8), a = 0 | r.slice(8, 10), s = 0 | r.slice(10, 12), u = 0 | r.slice(12, 14);
else {
if ("utctime" !== t) return e.error("Decoding " + t + " time is not supported yet");
n = 0 | r.slice(0, 2), i = 0 | r.slice(2, 4), o = 0 | r.slice(4, 6), a = 0 | r.slice(6, 8), s = 0 | r.slice(8, 10), u = 0 | r.slice(10, 12), n = n < 70 ? 2e3 + n : 1900 + n
}
return Date.UTC(n, i - 1, o, a, s, u, 0)
}, f.prototype._decodeNull = function() {
return null
}, f.prototype._decodeBool = function(e) {
const t = e.readUInt8();
return e.isError(t) ? t : 0 !== t
}, f.prototype._decodeInt = function(e, t) {
const r = e.raw();
let n = new i(r);
return t && (n = t[n.toString(10)] || n), n
}, f.prototype._use = function(e, t) {
return "function" == typeof e && (e = e(t)), e._getDecoder("der").tree
}
}, {
"../base/buffer": 33,
"../base/node": 35,
"../constants/der": 37,
"bn.js": 56,
inherits: 175
}],
40: [function(e, t, r) {
"use strict";
const n = r;
n.der = e("./der"), n.pem = e("./pem")
}, {
"./der": 39,
"./pem": 41
}],
41: [function(e, t, r) {
"use strict";
const n = e("inherits"),
i = e("safer-buffer").Buffer,
o = e("./der");
function a(e) {
o.call(this, e), this.enc = "pem"
}
n(a, o), t.exports = a, a.prototype.decode = function(e, t) {
const r = e.toString().split(/[\r\n]+/g),
n = t.label.toUpperCase(),
a = /^-----(BEGIN|END) ([^-]+)-----$/;
let s = -1,
u = -1;
for (let e = 0; e < r.length; e++) {
const t = r[e].match(a);
if (null !== t && t[2] === n) {
if (-1 !== s) {
if ("END" !== t[1]) break;
u = e;
break
}
if ("BEGIN" !== t[1]) break;
s = e
}
}
if (-1 === s || -1 === u) throw new Error("PEM section not found for: " + n);
const f = r.slice(s + 1, u).join("");
f.replace(/[^a-z0-9+/=]+/gi, "");
const c = i.from(f, "base64");
return o.prototype.decode.call(this, c, t)
}
}, {
"./der": 39,
inherits: 175,
"safer-buffer": 230
}],
42: [function(e, t, r) {
"use strict";
const n = e("inherits"),
i = e("safer-buffer").Buffer,
o = e("../base/node"),
a = e("../constants/der");
function s(e) {
this.enc = "der", this.name = e.name, this.entity = e, this.tree = new u, this.tree._init(e.body)
}
function u(e) {
o.call(this, "der", e)
}
function f(e) {
return e < 10 ? "0" + e : e
}
t.exports = s, s.prototype.encode = function(e, t) {
return this.tree._encode(e, t).join()
}, n(u, o), u.prototype._encodeComposite = function(e, t, r, n) {
const o = function(e, t, r, n) {
let i;
"seqof" === e ? e = "seq" : "setof" === e && (e = "set");
if (a.tagByName.hasOwnProperty(e)) i = a.tagByName[e];
else {
if ("number" != typeof e || (0 | e) !== e) return n.error("Unknown tag: " + e);
i = e
}
if (i >= 31) return n.error("Multi-octet tag encoding unsupported");
t || (i |= 32);
return i |= a.tagClassByName[r || "universal"] << 6, i
}(e, t, r, this.reporter);
if (n.length < 128) {
const e = i.alloc(2);
return e[0] = o, e[1] = n.length, this._createEncoderBuffer([e, n])
}
let s = 1;
for (let e = n.length; e >= 256; e >>= 8) s++;
const u = i.alloc(2 + s);
u[0] = o, u[1] = 128 | s;
for (let e = 1 + s, t = n.length; t > 0; e--, t >>= 8) u[e] = 255 & t;
return this._createEncoderBuffer([u, n])
}, u.prototype._encodeStr = function(e, t) {
if ("bitstr" === t) return this._createEncoderBuffer([0 | e.unused, e.data]);
if ("bmpstr" === t) {
const t = i.alloc(2 * e.length);
for (let r = 0; r < e.length; r++) t.writeUInt16BE(e.charCodeAt(r), 2 * r);
return this._createEncoderBuffer(t)
}
return "numstr" === t ? this._isNumstr(e) ? this._createEncoderBuffer(e) : this.reporter.error("Encoding of string type: numstr supports only digits and space") : "printstr" === t ? this._isPrintstr(e) ? this._createEncoderBuffer(e) : this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark") : /str$/.test(t) || "objDesc" === t ? this._createEncoderBuffer(e) : this.reporter.error("Encoding of string type: " + t + " unsupported")
}, u.prototype._encodeObjid = function(e, t, r) {
if ("string" == typeof e) {
if (!t) return this.reporter.error("string objid given, but no values map found");
if (!t.hasOwnProperty(e)) return this.reporter.error("objid not found in values map");
e = t[e].split(/[\s.]+/g);
for (let t = 0; t < e.length; t++) e[t] |= 0
} else if (Array.isArray(e)) {
e = e.slice();
for (let t = 0; t < e.length; t++) e[t] |= 0
}
if (!Array.isArray(e)) return this.reporter.error("objid() should be either array or string, got: " + JSON.stringify(e));
if (!r) {
if (e[1] >= 40) return this.reporter.error("Second objid identifier OOB");
e.splice(0, 2, 40 * e[0] + e[1])
}
let n = 0;
for (let t = 0; t < e.length; t++) {
let r = e[t];
for (n++; r >= 128; r >>= 7) n++
}
const o = i.alloc(n);
let a = o.length - 1;
for (let t = e.length - 1; t >= 0; t--) {
let r = e[t];
for (o[a--] = 127 & r;
(r >>= 7) > 0;) o[a--] = 128 | 127 & r
}
return this._createEncoderBuffer(o)
}, u.prototype._encodeTime = function(e, t) {
let r;
const n = new Date(e);
return "gentime" === t ? r = [f(n.getUTCFullYear()), f(n.getUTCMonth() + 1), f(n.getUTCDate()), f(n.getUTCHours()), f(n.getUTCMinutes()), f(n.getUTCSeconds()), "Z"].join("") : "utctime" === t ? r = [f(n.getUTCFullYear() % 100), f(n.getUTCMonth() + 1), f(n.getUTCDate()), f(n.getUTCHours()), f(n.getUTCMinutes()), f(n.getUTCSeconds()), "Z"].join("") : this.reporter.error("Encoding " + t + " time is not supported yet"), this._encodeStr(r, "octstr")
}, u.prototype._encodeNull = function() {
return this._createEncoderBuffer("")
}, u.prototype._encodeInt = function(e, t) {
if ("string" == typeof e) {
if (!t) return this.reporter.error("String int or enum given, but no values map");
if (!t.hasOwnProperty(e)) return this.reporter.error("Values map doesn't contain: " + JSON.stringify(e));
e = t[e]
}
if ("number" != typeof e && !i.isBuffer(e)) {
const t = e.toArray();
!e.sign && 128 & t[0] && t.unshift(0), e = i.from(t)
}
if (i.isBuffer(e)) {
let t = e.length;
0 === e.length && t++;
const r = i.alloc(t);
return e.copy(r), 0 === e.length && (r[0] = 0), this._createEncoderBuffer(r)
}
if (e < 128) return this._createEncoderBuffer(e);
if (e < 256) return this._createEncoderBuffer([0, e]);
let r = 1;
for (let t = e; t >= 256; t >>= 8) r++;
const n = new Array(r);
for (let t = n.length - 1; t >= 0; t--) n[t] = 255 & e, e >>= 8;
return 128 & n[0] && n.unshift(0), this._createEncoderBuffer(i.from(n))
}, u.prototype._encodeBool = function(e) {
return this._createEncoderBuffer(e ? 255 : 0)
}, u.prototype._use = function(e, t) {
return "function" == typeof e && (e = e(t)), e._getEncoder("der").tree
}, u.prototype._skipDefault = function(e, t, r) {
const n = this._baseState;
let i;
if (null === n.default) return !1;
const o = e.join();
if (void 0 === n.defaultBuffer && (n.defaultBuffer = this._encodeValue(n.default, t, r).join()), o.length !== n.defaultBuffer.length) return !1;
for (i = 0; i < o.length; i++)
if (o[i] !== n.defaultBuffer[i]) return !1;
return !0
}
}, {
"../base/node": 35,
"../constants/der": 37,
inherits: 175,
"safer-buffer": 230
}],
43: [function(e, t, r) {
"use strict";
const n = r;
n.der = e("./der"), n.pem = e("./pem")
}, {
"./der": 42,
"./pem": 44
}],
44: [function(e, t, r) {
"use strict";
const n = e("inherits"),
i = e("./der");
function o(e) {
i.call(this, e), this.enc = "pem"
}
n(o, i), t.exports = o, o.prototype.encode = function(e, t) {
const r = i.prototype.encode.call(this, e).toString("base64"),
n = ["-----BEGIN " + t.label + "-----"];
for (let e = 0; e < r.length; e += 64) n.push(r.slice(e, e + 64));
return n.push("-----END " + t.label + "-----"), n.join("\n")
}
}, {
"./der": 42,
inherits: 175
}],
45: [function(e, t, r) {
(function(r) {
(function() {
"use strict";
var n = e("object-assign");