diff --git a/app.json b/app.json index 2e1ffae..f9d9bcf 100644 --- a/app.json +++ b/app.json @@ -1,10 +1,7 @@ { "pages": [ + "pages/noLoginIndex", "pages/user/login/login", - "pages/index/index", - "pages/index/settle/index", - "pages/index/settle/passWord/index", - "pages/index/settle/eSign/index", "component/pop-up/index", "pages/drawee/drawee", "pages/drawee/add/add", @@ -27,17 +24,28 @@ "pages/statistics/statistics", "pages/user/region/region", "pages/finance/index", - "pages/index/majorDetail/majorDetail", "pages/resources/resources", "pages/resources/detail/detail", - "pages/resources/edit/edit" + "pages/resources/edit/edit", + "pages/phoneLogin" ], "subPackages": [ + { + "root": "pages/index/", + "pages": [ + "index", + "settle/index", + "settle/passWord/index", + "settle/eSign/index", + "majorDetail/majorDetail" + ] + }, { "root": "pages/handle/", "pages": [ "liist", - "expenditureAudit/expenditureAudit" + "expenditureAudit/expenditureAudit", + "expenditureAuditNew/expenditureAuditNew" ] }, { @@ -50,7 +58,8 @@ "paymentTemplate/add/add", "paymentTemplate/add/upLoad/upLoad", "paymentTemplate/add/upError/upError", - "paymentTemplate/add/payeeList/payee" + "paymentTemplate/add/payeeList/payee", + "paymentTemplate/addNew/addNew" ] }, { diff --git a/image/apply/BOC.png b/image/apply/BOC.png new file mode 100644 index 0000000..93700b6 Binary files /dev/null and b/image/apply/BOC.png differ diff --git a/image/apply/EMS.png b/image/apply/EMS.png new file mode 100644 index 0000000..4d7926c Binary files /dev/null and b/image/apply/EMS.png differ diff --git a/image/apply/ZYB.png b/image/apply/ZYB.png new file mode 100644 index 0000000..32e2852 Binary files /dev/null and b/image/apply/ZYB.png differ diff --git a/image/apply/icon_BOC.png b/image/apply/icon_BOC.png new file mode 100644 index 0000000..799b605 Binary files /dev/null and b/image/apply/icon_BOC.png differ diff --git a/image/apply/icon_EMS.png b/image/apply/icon_EMS.png new file mode 100644 index 0000000..e366855 Binary files /dev/null and b/image/apply/icon_EMS.png differ diff --git a/image/apply/icon_ZYB.png b/image/apply/icon_ZYB.png new file mode 100644 index 0000000..dab0e41 Binary files /dev/null and b/image/apply/icon_ZYB.png differ diff --git a/image/apply/other.png b/image/apply/other.png new file mode 100644 index 0000000..cb2b568 Binary files /dev/null and b/image/apply/other.png differ diff --git a/image/icon/input_name.png b/image/icon/input_name.png new file mode 100644 index 0000000..82e20d8 Binary files /dev/null and b/image/icon/input_name.png differ diff --git a/image/icon/input_password.png b/image/icon/input_password.png new file mode 100644 index 0000000..405d3db Binary files /dev/null and b/image/icon/input_password.png differ diff --git a/image/icon/input_yzm.png b/image/icon/input_yzm.png new file mode 100644 index 0000000..3ea9727 Binary files /dev/null and b/image/icon/input_yzm.png differ diff --git a/miniprogram_npm/@vant/weapp/empty/index.wxss b/miniprogram_npm/@vant/weapp/empty/index.wxss index 56607a5..0fb74fe 100644 --- a/miniprogram_npm/@vant/weapp/empty/index.wxss +++ b/miniprogram_npm/@vant/weapp/empty/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-empty{align-items:center;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;padding:32px 0}.van-empty__image{height:100px;width:100px}.van-empty__image:empty{display:none}.van-empty__image__img{height:100%;width:100%}.van-empty__image:not(:empty)+.van-empty__image{display:none}.van-empty__description{color:#969799;font-size:14px;line-height:20px;margin-top:16px;padding:0 60px}.van-empty__description:empty,.van-empty__description:not(:empty)+.van-empty__description{display:none}.van-empty__bottom{margin-top:24px} \ No newline at end of file +@import '../common/index.wxss';.van-empty{align-items:center;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;padding:32px 0}.van-empty__image{height:160px;width:160px}.van-empty__image:empty{display:none}.van-empty__image__img{height:100%;width:100%}.van-empty__image:not(:empty)+.van-empty__image{display:none}.van-empty__description{color:#969799;font-size:14px;line-height:20px;margin-top:16px;padding:0 60px}.van-empty__description:empty,.van-empty__description:not(:empty)+.van-empty__description{display:none}.van-empty__bottom{margin-top:24px} \ No newline at end of file diff --git a/miniprogram_npm/jsencrypt/index.js b/miniprogram_npm/jsencrypt/index.js new file mode 100644 index 0000000..d3d712e --- /dev/null +++ b/miniprogram_npm/jsencrypt/index.js @@ -0,0 +1,275 @@ +module.exports = (function() { +var __MODS__ = {}; +var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; }; +var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; }; +var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } }; +var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; }; +__DEFINE__(1709513243593, function(require, module, exports) { +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["JSEncrypt"] = factory(); + else + root["JSEncrypt"] = factory(); +})(window, () => { +return /******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "./lib/JSEncrypt.js": +/*!**************************!*\ + !*** ./lib/JSEncrypt.js ***! + \**************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"JSEncrypt\": () => (/* binding */ JSEncrypt)\n/* harmony export */ });\n/* harmony import */ var _lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/jsbn/base64 */ \"./lib/lib/jsbn/base64.js\");\n/* harmony import */ var _JSEncryptRSAKey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./JSEncryptRSAKey */ \"./lib/JSEncryptRSAKey.js\");\n/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"./node_modules/process/browser.js\");\nvar _a;\n\n\nvar version = typeof process !== 'undefined'\n ? (_a = process.env) === null || _a === void 0 ? void 0 : \"3.3.2\"\n : undefined;\n/**\n *\n * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour\n * possible parameters are:\n * - default_key_size {number} default: 1024 the key size in bit\n * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent\n * - log {boolean} default: false whether log warn/error or not\n * @constructor\n */\nvar JSEncrypt = /** @class */ (function () {\n function JSEncrypt(options) {\n if (options === void 0) { options = {}; }\n options = options || {};\n this.default_key_size = options.default_key_size\n ? parseInt(options.default_key_size, 10)\n : 1024;\n this.default_public_exponent = options.default_public_exponent || \"010001\"; // 65537 default openssl public exponent for rsa key type\n this.log = options.log || false;\n // The private and public key.\n this.key = null;\n }\n /**\n * Method to set the rsa key parameter (one method is enough to set both the public\n * and the private key, since the private key contains the public key paramenters)\n * Log a warning if logs are enabled\n * @param {Object|string} key the pem encoded string or an object (with or without header/footer)\n * @public\n */\n JSEncrypt.prototype.setKey = function (key) {\n if (this.log && this.key) {\n console.warn(\"A key was already set, overriding existing.\");\n }\n this.key = new _JSEncryptRSAKey__WEBPACK_IMPORTED_MODULE_1__.JSEncryptRSAKey(key);\n };\n /**\n * Proxy method for setKey, for api compatibility\n * @see setKey\n * @public\n */\n JSEncrypt.prototype.setPrivateKey = function (privkey) {\n // Create the key.\n this.setKey(privkey);\n };\n /**\n * Proxy method for setKey, for api compatibility\n * @see setKey\n * @public\n */\n JSEncrypt.prototype.setPublicKey = function (pubkey) {\n // Sets the public key.\n this.setKey(pubkey);\n };\n /**\n * Proxy method for RSAKey object's decrypt, decrypt the string using the private\n * components of the rsa key object. Note that if the object was not set will be created\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\n * @param {string} str base64 encoded crypted string to decrypt\n * @return {string} the decrypted string\n * @public\n */\n JSEncrypt.prototype.decrypt = function (str) {\n // Return the decrypted string.\n try {\n return this.getKey().decrypt((0,_lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__.b64tohex)(str));\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Proxy method for RSAKey object's encrypt, encrypt the string using the public\n * components of the rsa key object. Note that if the object was not set will be created\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\n * @param {string} str the string to encrypt\n * @return {string} the encrypted string encoded in base64\n * @public\n */\n JSEncrypt.prototype.encrypt = function (str) {\n // Return the encrypted string.\n try {\n return (0,_lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__.hex2b64)(this.getKey().encrypt(str));\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Proxy method for RSAKey object's sign.\n * @param {string} str the string to sign\n * @param {function} digestMethod hash method\n * @param {string} digestName the name of the hash algorithm\n * @return {string} the signature encoded in base64\n * @public\n */\n JSEncrypt.prototype.sign = function (str, digestMethod, digestName) {\n // return the RSA signature of 'str' in 'hex' format.\n try {\n return (0,_lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__.hex2b64)(this.getKey().sign(str, digestMethod, digestName));\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Proxy method for RSAKey object's verify.\n * @param {string} str the string to verify\n * @param {string} signature the signature encoded in base64 to compare the string to\n * @param {function} digestMethod hash method\n * @return {boolean} whether the data and signature match\n * @public\n */\n JSEncrypt.prototype.verify = function (str, signature, digestMethod) {\n // Return the decrypted 'digest' of the signature.\n try {\n return this.getKey().verify(str, (0,_lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__.b64tohex)(signature), digestMethod);\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object\n * will be created and returned\n * @param {callback} [cb] the callback to be called if we want the key to be generated\n * in an async fashion\n * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object\n * @public\n */\n JSEncrypt.prototype.getKey = function (cb) {\n // Only create new if it does not exist.\n if (!this.key) {\n // Get a new private key.\n this.key = new _JSEncryptRSAKey__WEBPACK_IMPORTED_MODULE_1__.JSEncryptRSAKey();\n if (cb && {}.toString.call(cb) === \"[object Function]\") {\n this.key.generateAsync(this.default_key_size, this.default_public_exponent, cb);\n return;\n }\n // Generate the key.\n this.key.generate(this.default_key_size, this.default_public_exponent);\n }\n return this.key;\n };\n /**\n * Returns the pem encoded representation of the private key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the private key WITH header and footer\n * @public\n */\n JSEncrypt.prototype.getPrivateKey = function () {\n // Return the private representation of this key.\n return this.getKey().getPrivateKey();\n };\n /**\n * Returns the pem encoded representation of the private key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the private key WITHOUT header and footer\n * @public\n */\n JSEncrypt.prototype.getPrivateKeyB64 = function () {\n // Return the private representation of this key.\n return this.getKey().getPrivateBaseKeyB64();\n };\n /**\n * Returns the pem encoded representation of the public key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the public key WITH header and footer\n * @public\n */\n JSEncrypt.prototype.getPublicKey = function () {\n // Return the private representation of this key.\n return this.getKey().getPublicKey();\n };\n /**\n * Returns the pem encoded representation of the public key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the public key WITHOUT header and footer\n * @public\n */\n JSEncrypt.prototype.getPublicKeyB64 = function () {\n // Return the private representation of this key.\n return this.getKey().getPublicBaseKeyB64();\n };\n JSEncrypt.version = version;\n return JSEncrypt;\n}());\n\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/JSEncrypt.js?"); + +/***/ }), + +/***/ "./lib/JSEncryptRSAKey.js": +/*!********************************!*\ + !*** ./lib/JSEncryptRSAKey.js ***! + \********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"JSEncryptRSAKey\": () => (/* binding */ JSEncryptRSAKey)\n/* harmony export */ });\n/* harmony import */ var _lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/jsbn/base64 */ \"./lib/lib/jsbn/base64.js\");\n/* harmony import */ var _lib_asn1js_hex__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/asn1js/hex */ \"./lib/lib/asn1js/hex.js\");\n/* harmony import */ var _lib_asn1js_base64__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/asn1js/base64 */ \"./lib/lib/asn1js/base64.js\");\n/* harmony import */ var _lib_asn1js_asn1__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/asn1js/asn1 */ \"./lib/lib/asn1js/asn1.js\");\n/* harmony import */ var _lib_jsbn_rsa__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/jsbn/rsa */ \"./lib/lib/jsbn/rsa.js\");\n/* harmony import */ var _lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/jsbn/jsbn */ \"./lib/lib/jsbn/jsbn.js\");\n/* harmony import */ var _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./lib/jsrsasign/asn1-1.0 */ \"./lib/lib/jsrsasign/asn1-1.0.js\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n\n\n\n\n\n/**\n * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object.\n * This object is just a decorator for parsing the key parameter\n * @param {string|Object} key - The key in string format, or an object containing\n * the parameters needed to build a RSAKey object.\n * @constructor\n */\nvar JSEncryptRSAKey = /** @class */ (function (_super) {\n __extends(JSEncryptRSAKey, _super);\n function JSEncryptRSAKey(key) {\n var _this = _super.call(this) || this;\n // Call the super constructor.\n // RSAKey.call(this);\n // If a key key was provided.\n if (key) {\n // If this is a string...\n if (typeof key === \"string\") {\n _this.parseKey(key);\n }\n else if (JSEncryptRSAKey.hasPrivateKeyProperty(key) ||\n JSEncryptRSAKey.hasPublicKeyProperty(key)) {\n // Set the values for the key.\n _this.parsePropertiesFrom(key);\n }\n }\n return _this;\n }\n /**\n * Method to parse a pem encoded string containing both a public or private key.\n * The method will translate the pem encoded string in a der encoded string and\n * will parse private key and public key parameters. This method accepts public key\n * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1).\n *\n * @todo Check how many rsa formats use the same format of pkcs #1.\n *\n * The format is defined as:\n * PublicKeyInfo ::= SEQUENCE {\n * algorithm AlgorithmIdentifier,\n * PublicKey BIT STRING\n * }\n * Where AlgorithmIdentifier is:\n * AlgorithmIdentifier ::= SEQUENCE {\n * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm\n * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)\n * }\n * and PublicKey is a SEQUENCE encapsulated in a BIT STRING\n * RSAPublicKey ::= SEQUENCE {\n * modulus INTEGER, -- n\n * publicExponent INTEGER -- e\n * }\n * it's possible to examine the structure of the keys obtained from openssl using\n * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/\n * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer\n * @private\n */\n JSEncryptRSAKey.prototype.parseKey = function (pem) {\n try {\n var modulus = 0;\n var public_exponent = 0;\n var reHex = /^\\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\\s*)+$/;\n var der = reHex.test(pem) ? _lib_asn1js_hex__WEBPACK_IMPORTED_MODULE_1__.Hex.decode(pem) : _lib_asn1js_base64__WEBPACK_IMPORTED_MODULE_2__.Base64.unarmor(pem);\n var asn1 = _lib_asn1js_asn1__WEBPACK_IMPORTED_MODULE_3__.ASN1.decode(der);\n // Fixes a bug with OpenSSL 1.0+ private keys\n if (asn1.sub.length === 3) {\n asn1 = asn1.sub[2].sub[0];\n }\n if (asn1.sub.length === 9) {\n // Parse the private key.\n modulus = asn1.sub[1].getHexStringValue(); // bigint\n this.n = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(modulus, 16);\n public_exponent = asn1.sub[2].getHexStringValue(); // int\n this.e = parseInt(public_exponent, 16);\n var private_exponent = asn1.sub[3].getHexStringValue(); // bigint\n this.d = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(private_exponent, 16);\n var prime1 = asn1.sub[4].getHexStringValue(); // bigint\n this.p = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(prime1, 16);\n var prime2 = asn1.sub[5].getHexStringValue(); // bigint\n this.q = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(prime2, 16);\n var exponent1 = asn1.sub[6].getHexStringValue(); // bigint\n this.dmp1 = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(exponent1, 16);\n var exponent2 = asn1.sub[7].getHexStringValue(); // bigint\n this.dmq1 = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(exponent2, 16);\n var coefficient = asn1.sub[8].getHexStringValue(); // bigint\n this.coeff = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(coefficient, 16);\n }\n else if (asn1.sub.length === 2) {\n if (asn1.sub[0].sub) {\n // Parse ASN.1 SubjectPublicKeyInfo type as defined by X.509\n var bit_string = asn1.sub[1];\n var sequence = bit_string.sub[0];\n modulus = sequence.sub[0].getHexStringValue();\n this.n = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(modulus, 16);\n public_exponent = sequence.sub[1].getHexStringValue();\n this.e = parseInt(public_exponent, 16);\n }\n else {\n // Parse ASN.1 RSAPublicKey type as defined by PKCS #1\n modulus = asn1.sub[0].getHexStringValue();\n this.n = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(modulus, 16);\n public_exponent = asn1.sub[1].getHexStringValue();\n this.e = parseInt(public_exponent, 16);\n }\n }\n else {\n return false;\n }\n return true;\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Translate rsa parameters in a hex encoded string representing the rsa key.\n *\n * The translation follow the ASN.1 notation :\n * RSAPrivateKey ::= SEQUENCE {\n * version Version,\n * modulus INTEGER, -- n\n * publicExponent INTEGER, -- e\n * privateExponent INTEGER, -- d\n * prime1 INTEGER, -- p\n * prime2 INTEGER, -- q\n * exponent1 INTEGER, -- d mod (p1)\n * exponent2 INTEGER, -- d mod (q-1)\n * coefficient INTEGER, -- (inverse of q) mod p\n * }\n * @returns {string} DER Encoded String representing the rsa private key\n * @private\n */\n JSEncryptRSAKey.prototype.getPrivateBaseKey = function () {\n var options = {\n array: [\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ int: 0 }),\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.n }),\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ int: this.e }),\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.d }),\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.p }),\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.q }),\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.dmp1 }),\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.dmq1 }),\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.coeff }),\n ],\n };\n var seq = new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERSequence(options);\n return seq.getEncodedHex();\n };\n /**\n * base64 (pem) encoded version of the DER encoded representation\n * @returns {string} pem encoded representation without header and footer\n * @public\n */\n JSEncryptRSAKey.prototype.getPrivateBaseKeyB64 = function () {\n return (0,_lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__.hex2b64)(this.getPrivateBaseKey());\n };\n /**\n * Translate rsa parameters in a hex encoded string representing the rsa public key.\n * The representation follow the ASN.1 notation :\n * PublicKeyInfo ::= SEQUENCE {\n * algorithm AlgorithmIdentifier,\n * PublicKey BIT STRING\n * }\n * Where AlgorithmIdentifier is:\n * AlgorithmIdentifier ::= SEQUENCE {\n * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm\n * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)\n * }\n * and PublicKey is a SEQUENCE encapsulated in a BIT STRING\n * RSAPublicKey ::= SEQUENCE {\n * modulus INTEGER, -- n\n * publicExponent INTEGER -- e\n * }\n * @returns {string} DER Encoded String representing the rsa public key\n * @private\n */\n JSEncryptRSAKey.prototype.getPublicBaseKey = function () {\n var first_sequence = new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERSequence({\n array: [\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERObjectIdentifier({ oid: \"1.2.840.113549.1.1.1\" }),\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERNull(),\n ],\n });\n var second_sequence = new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERSequence({\n array: [\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.n }),\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ int: this.e }),\n ],\n });\n var bit_string = new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERBitString({\n hex: \"00\" + second_sequence.getEncodedHex(),\n });\n var seq = new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERSequence({\n array: [first_sequence, bit_string],\n });\n return seq.getEncodedHex();\n };\n /**\n * base64 (pem) encoded version of the DER encoded representation\n * @returns {string} pem encoded representation without header and footer\n * @public\n */\n JSEncryptRSAKey.prototype.getPublicBaseKeyB64 = function () {\n return (0,_lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__.hex2b64)(this.getPublicBaseKey());\n };\n /**\n * wrap the string in block of width chars. The default value for rsa keys is 64\n * characters.\n * @param {string} str the pem encoded string without header and footer\n * @param {Number} [width=64] - the length the string has to be wrapped at\n * @returns {string}\n * @private\n */\n JSEncryptRSAKey.wordwrap = function (str, width) {\n width = width || 64;\n if (!str) {\n return str;\n }\n var regex = \"(.{1,\" + width + \"})( +|$\\n?)|(.{1,\" + width + \"})\";\n return str.match(RegExp(regex, \"g\")).join(\"\\n\");\n };\n /**\n * Retrieve the pem encoded private key\n * @returns {string} the pem encoded private key with header/footer\n * @public\n */\n JSEncryptRSAKey.prototype.getPrivateKey = function () {\n var key = \"-----BEGIN RSA PRIVATE KEY-----\\n\";\n key += JSEncryptRSAKey.wordwrap(this.getPrivateBaseKeyB64()) + \"\\n\";\n key += \"-----END RSA PRIVATE KEY-----\";\n return key;\n };\n /**\n * Retrieve the pem encoded public key\n * @returns {string} the pem encoded public key with header/footer\n * @public\n */\n JSEncryptRSAKey.prototype.getPublicKey = function () {\n var key = \"-----BEGIN PUBLIC KEY-----\\n\";\n key += JSEncryptRSAKey.wordwrap(this.getPublicBaseKeyB64()) + \"\\n\";\n key += \"-----END PUBLIC KEY-----\";\n return key;\n };\n /**\n * Check if the object contains the necessary parameters to populate the rsa modulus\n * and public exponent parameters.\n * @param {Object} [obj={}] - An object that may contain the two public key\n * parameters\n * @returns {boolean} true if the object contains both the modulus and the public exponent\n * properties (n and e)\n * @todo check for types of n and e. N should be a parseable bigInt object, E should\n * be a parseable integer number\n * @private\n */\n JSEncryptRSAKey.hasPublicKeyProperty = function (obj) {\n obj = obj || {};\n return obj.hasOwnProperty(\"n\") && obj.hasOwnProperty(\"e\");\n };\n /**\n * Check if the object contains ALL the parameters of an RSA key.\n * @param {Object} [obj={}] - An object that may contain nine rsa key\n * parameters\n * @returns {boolean} true if the object contains all the parameters needed\n * @todo check for types of the parameters all the parameters but the public exponent\n * should be parseable bigint objects, the public exponent should be a parseable integer number\n * @private\n */\n JSEncryptRSAKey.hasPrivateKeyProperty = function (obj) {\n obj = obj || {};\n return (obj.hasOwnProperty(\"n\") &&\n obj.hasOwnProperty(\"e\") &&\n obj.hasOwnProperty(\"d\") &&\n obj.hasOwnProperty(\"p\") &&\n obj.hasOwnProperty(\"q\") &&\n obj.hasOwnProperty(\"dmp1\") &&\n obj.hasOwnProperty(\"dmq1\") &&\n obj.hasOwnProperty(\"coeff\"));\n };\n /**\n * Parse the properties of obj in the current rsa object. Obj should AT LEAST\n * include the modulus and public exponent (n, e) parameters.\n * @param {Object} obj - the object containing rsa parameters\n * @private\n */\n JSEncryptRSAKey.prototype.parsePropertiesFrom = function (obj) {\n this.n = obj.n;\n this.e = obj.e;\n if (obj.hasOwnProperty(\"d\")) {\n this.d = obj.d;\n this.p = obj.p;\n this.q = obj.q;\n this.dmp1 = obj.dmp1;\n this.dmq1 = obj.dmq1;\n this.coeff = obj.coeff;\n }\n };\n return JSEncryptRSAKey;\n}(_lib_jsbn_rsa__WEBPACK_IMPORTED_MODULE_4__.RSAKey));\n\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/JSEncryptRSAKey.js?"); + +/***/ }), + +/***/ "./lib/index.js": +/*!**********************!*\ + !*** ./lib/index.js ***! + \**********************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"JSEncrypt\": () => (/* reexport safe */ _JSEncrypt__WEBPACK_IMPORTED_MODULE_0__.JSEncrypt),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _JSEncrypt__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./JSEncrypt */ \"./lib/JSEncrypt.js\");\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_JSEncrypt__WEBPACK_IMPORTED_MODULE_0__.JSEncrypt);\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/index.js?"); + +/***/ }), + +/***/ "./lib/lib/asn1js/asn1.js": +/*!********************************!*\ + !*** ./lib/lib/asn1js/asn1.js ***! + \********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ASN1\": () => (/* binding */ ASN1),\n/* harmony export */ \"ASN1Tag\": () => (/* binding */ ASN1Tag),\n/* harmony export */ \"Stream\": () => (/* binding */ Stream)\n/* harmony export */ });\n/* harmony import */ var _int10__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./int10 */ \"./lib/lib/asn1js/int10.js\");\n// ASN.1 JavaScript decoder\n// Copyright (c) 2008-2014 Lapo Luchini \n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\n/*global oids */\n\nvar ellipsis = \"\\u2026\";\nvar reTimeS = /^(\\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)?)?$/;\nvar reTimeL = /^(\\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)?)?$/;\nfunction stringCut(str, len) {\n if (str.length > len) {\n str = str.substring(0, len) + ellipsis;\n }\n return str;\n}\nvar Stream = /** @class */ (function () {\n function Stream(enc, pos) {\n this.hexDigits = \"0123456789ABCDEF\";\n if (enc instanceof Stream) {\n this.enc = enc.enc;\n this.pos = enc.pos;\n }\n else {\n // enc should be an array or a binary string\n this.enc = enc;\n this.pos = pos;\n }\n }\n Stream.prototype.get = function (pos) {\n if (pos === undefined) {\n pos = this.pos++;\n }\n if (pos >= this.enc.length) {\n throw new Error(\"Requesting byte offset \".concat(pos, \" on a stream of length \").concat(this.enc.length));\n }\n return (\"string\" === typeof this.enc) ? this.enc.charCodeAt(pos) : this.enc[pos];\n };\n Stream.prototype.hexByte = function (b) {\n return this.hexDigits.charAt((b >> 4) & 0xF) + this.hexDigits.charAt(b & 0xF);\n };\n Stream.prototype.hexDump = function (start, end, raw) {\n var s = \"\";\n for (var i = start; i < end; ++i) {\n s += this.hexByte(this.get(i));\n if (raw !== true) {\n switch (i & 0xF) {\n case 0x7:\n s += \" \";\n break;\n case 0xF:\n s += \"\\n\";\n break;\n default:\n s += \" \";\n }\n }\n }\n return s;\n };\n Stream.prototype.isASCII = function (start, end) {\n for (var i = start; i < end; ++i) {\n var c = this.get(i);\n if (c < 32 || c > 176) {\n return false;\n }\n }\n return true;\n };\n Stream.prototype.parseStringISO = function (start, end) {\n var s = \"\";\n for (var i = start; i < end; ++i) {\n s += String.fromCharCode(this.get(i));\n }\n return s;\n };\n Stream.prototype.parseStringUTF = function (start, end) {\n var s = \"\";\n for (var i = start; i < end;) {\n var c = this.get(i++);\n if (c < 128) {\n s += String.fromCharCode(c);\n }\n else if ((c > 191) && (c < 224)) {\n s += String.fromCharCode(((c & 0x1F) << 6) | (this.get(i++) & 0x3F));\n }\n else {\n s += String.fromCharCode(((c & 0x0F) << 12) | ((this.get(i++) & 0x3F) << 6) | (this.get(i++) & 0x3F));\n }\n }\n return s;\n };\n Stream.prototype.parseStringBMP = function (start, end) {\n var str = \"\";\n var hi;\n var lo;\n for (var i = start; i < end;) {\n hi = this.get(i++);\n lo = this.get(i++);\n str += String.fromCharCode((hi << 8) | lo);\n }\n return str;\n };\n Stream.prototype.parseTime = function (start, end, shortYear) {\n var s = this.parseStringISO(start, end);\n var m = (shortYear ? reTimeS : reTimeL).exec(s);\n if (!m) {\n return \"Unrecognized time: \" + s;\n }\n if (shortYear) {\n // to avoid querying the timer, use the fixed range [1970, 2069]\n // it will conform with ITU X.400 [-10, +40] sliding window until 2030\n m[1] = +m[1];\n m[1] += (+m[1] < 70) ? 2000 : 1900;\n }\n s = m[1] + \"-\" + m[2] + \"-\" + m[3] + \" \" + m[4];\n if (m[5]) {\n s += \":\" + m[5];\n if (m[6]) {\n s += \":\" + m[6];\n if (m[7]) {\n s += \".\" + m[7];\n }\n }\n }\n if (m[8]) {\n s += \" UTC\";\n if (m[8] != \"Z\") {\n s += m[8];\n if (m[9]) {\n s += \":\" + m[9];\n }\n }\n }\n return s;\n };\n Stream.prototype.parseInteger = function (start, end) {\n var v = this.get(start);\n var neg = (v > 127);\n var pad = neg ? 255 : 0;\n var len;\n var s = \"\";\n // skip unuseful bits (not allowed in DER)\n while (v == pad && ++start < end) {\n v = this.get(start);\n }\n len = end - start;\n if (len === 0) {\n return neg ? -1 : 0;\n }\n // show bit length of huge integers\n if (len > 4) {\n s = v;\n len <<= 3;\n while (((+s ^ pad) & 0x80) == 0) {\n s = +s << 1;\n --len;\n }\n s = \"(\" + len + \" bit)\\n\";\n }\n // decode the integer\n if (neg) {\n v = v - 256;\n }\n var n = new _int10__WEBPACK_IMPORTED_MODULE_0__.Int10(v);\n for (var i = start + 1; i < end; ++i) {\n n.mulAdd(256, this.get(i));\n }\n return s + n.toString();\n };\n Stream.prototype.parseBitString = function (start, end, maxLength) {\n var unusedBit = this.get(start);\n var lenBit = ((end - start - 1) << 3) - unusedBit;\n var intro = \"(\" + lenBit + \" bit)\\n\";\n var s = \"\";\n for (var i = start + 1; i < end; ++i) {\n var b = this.get(i);\n var skip = (i == end - 1) ? unusedBit : 0;\n for (var j = 7; j >= skip; --j) {\n s += (b >> j) & 1 ? \"1\" : \"0\";\n }\n if (s.length > maxLength) {\n return intro + stringCut(s, maxLength);\n }\n }\n return intro + s;\n };\n Stream.prototype.parseOctetString = function (start, end, maxLength) {\n if (this.isASCII(start, end)) {\n return stringCut(this.parseStringISO(start, end), maxLength);\n }\n var len = end - start;\n var s = \"(\" + len + \" byte)\\n\";\n maxLength /= 2; // we work in bytes\n if (len > maxLength) {\n end = start + maxLength;\n }\n for (var i = start; i < end; ++i) {\n s += this.hexByte(this.get(i));\n }\n if (len > maxLength) {\n s += ellipsis;\n }\n return s;\n };\n Stream.prototype.parseOID = function (start, end, maxLength) {\n var s = \"\";\n var n = new _int10__WEBPACK_IMPORTED_MODULE_0__.Int10();\n var bits = 0;\n for (var i = start; i < end; ++i) {\n var v = this.get(i);\n n.mulAdd(128, v & 0x7F);\n bits += 7;\n if (!(v & 0x80)) { // finished\n if (s === \"\") {\n n = n.simplify();\n if (n instanceof _int10__WEBPACK_IMPORTED_MODULE_0__.Int10) {\n n.sub(80);\n s = \"2.\" + n.toString();\n }\n else {\n var m = n < 80 ? n < 40 ? 0 : 1 : 2;\n s = m + \".\" + (n - m * 40);\n }\n }\n else {\n s += \".\" + n.toString();\n }\n if (s.length > maxLength) {\n return stringCut(s, maxLength);\n }\n n = new _int10__WEBPACK_IMPORTED_MODULE_0__.Int10();\n bits = 0;\n }\n }\n if (bits > 0) {\n s += \".incomplete\";\n }\n return s;\n };\n return Stream;\n}());\n\nvar ASN1 = /** @class */ (function () {\n function ASN1(stream, header, length, tag, sub) {\n if (!(tag instanceof ASN1Tag)) {\n throw new Error(\"Invalid tag value.\");\n }\n this.stream = stream;\n this.header = header;\n this.length = length;\n this.tag = tag;\n this.sub = sub;\n }\n ASN1.prototype.typeName = function () {\n switch (this.tag.tagClass) {\n case 0: // universal\n switch (this.tag.tagNumber) {\n case 0x00:\n return \"EOC\";\n case 0x01:\n return \"BOOLEAN\";\n case 0x02:\n return \"INTEGER\";\n case 0x03:\n return \"BIT_STRING\";\n case 0x04:\n return \"OCTET_STRING\";\n case 0x05:\n return \"NULL\";\n case 0x06:\n return \"OBJECT_IDENTIFIER\";\n case 0x07:\n return \"ObjectDescriptor\";\n case 0x08:\n return \"EXTERNAL\";\n case 0x09:\n return \"REAL\";\n case 0x0A:\n return \"ENUMERATED\";\n case 0x0B:\n return \"EMBEDDED_PDV\";\n case 0x0C:\n return \"UTF8String\";\n case 0x10:\n return \"SEQUENCE\";\n case 0x11:\n return \"SET\";\n case 0x12:\n return \"NumericString\";\n case 0x13:\n return \"PrintableString\"; // ASCII subset\n case 0x14:\n return \"TeletexString\"; // aka T61String\n case 0x15:\n return \"VideotexString\";\n case 0x16:\n return \"IA5String\"; // ASCII\n case 0x17:\n return \"UTCTime\";\n case 0x18:\n return \"GeneralizedTime\";\n case 0x19:\n return \"GraphicString\";\n case 0x1A:\n return \"VisibleString\"; // ASCII subset\n case 0x1B:\n return \"GeneralString\";\n case 0x1C:\n return \"UniversalString\";\n case 0x1E:\n return \"BMPString\";\n }\n return \"Universal_\" + this.tag.tagNumber.toString();\n case 1:\n return \"Application_\" + this.tag.tagNumber.toString();\n case 2:\n return \"[\" + this.tag.tagNumber.toString() + \"]\"; // Context\n case 3:\n return \"Private_\" + this.tag.tagNumber.toString();\n }\n };\n ASN1.prototype.content = function (maxLength) {\n if (this.tag === undefined) {\n return null;\n }\n if (maxLength === undefined) {\n maxLength = Infinity;\n }\n var content = this.posContent();\n var len = Math.abs(this.length);\n if (!this.tag.isUniversal()) {\n if (this.sub !== null) {\n return \"(\" + this.sub.length + \" elem)\";\n }\n return this.stream.parseOctetString(content, content + len, maxLength);\n }\n switch (this.tag.tagNumber) {\n case 0x01: // BOOLEAN\n return (this.stream.get(content) === 0) ? \"false\" : \"true\";\n case 0x02: // INTEGER\n return this.stream.parseInteger(content, content + len);\n case 0x03: // BIT_STRING\n return this.sub ? \"(\" + this.sub.length + \" elem)\" :\n this.stream.parseBitString(content, content + len, maxLength);\n case 0x04: // OCTET_STRING\n return this.sub ? \"(\" + this.sub.length + \" elem)\" :\n this.stream.parseOctetString(content, content + len, maxLength);\n // case 0x05: // NULL\n case 0x06: // OBJECT_IDENTIFIER\n return this.stream.parseOID(content, content + len, maxLength);\n // case 0x07: // ObjectDescriptor\n // case 0x08: // EXTERNAL\n // case 0x09: // REAL\n // case 0x0A: // ENUMERATED\n // case 0x0B: // EMBEDDED_PDV\n case 0x10: // SEQUENCE\n case 0x11: // SET\n if (this.sub !== null) {\n return \"(\" + this.sub.length + \" elem)\";\n }\n else {\n return \"(no elem)\";\n }\n case 0x0C: // UTF8String\n return stringCut(this.stream.parseStringUTF(content, content + len), maxLength);\n case 0x12: // NumericString\n case 0x13: // PrintableString\n case 0x14: // TeletexString\n case 0x15: // VideotexString\n case 0x16: // IA5String\n // case 0x19: // GraphicString\n case 0x1A: // VisibleString\n // case 0x1B: // GeneralString\n // case 0x1C: // UniversalString\n return stringCut(this.stream.parseStringISO(content, content + len), maxLength);\n case 0x1E: // BMPString\n return stringCut(this.stream.parseStringBMP(content, content + len), maxLength);\n case 0x17: // UTCTime\n case 0x18: // GeneralizedTime\n return this.stream.parseTime(content, content + len, (this.tag.tagNumber == 0x17));\n }\n return null;\n };\n ASN1.prototype.toString = function () {\n return this.typeName() + \"@\" + this.stream.pos + \"[header:\" + this.header + \",length:\" + this.length + \",sub:\" + ((this.sub === null) ? \"null\" : this.sub.length) + \"]\";\n };\n ASN1.prototype.toPrettyString = function (indent) {\n if (indent === undefined) {\n indent = \"\";\n }\n var s = indent + this.typeName() + \" @\" + this.stream.pos;\n if (this.length >= 0) {\n s += \"+\";\n }\n s += this.length;\n if (this.tag.tagConstructed) {\n s += \" (constructed)\";\n }\n else if ((this.tag.isUniversal() && ((this.tag.tagNumber == 0x03) || (this.tag.tagNumber == 0x04))) && (this.sub !== null)) {\n s += \" (encapsulates)\";\n }\n s += \"\\n\";\n if (this.sub !== null) {\n indent += \" \";\n for (var i = 0, max = this.sub.length; i < max; ++i) {\n s += this.sub[i].toPrettyString(indent);\n }\n }\n return s;\n };\n ASN1.prototype.posStart = function () {\n return this.stream.pos;\n };\n ASN1.prototype.posContent = function () {\n return this.stream.pos + this.header;\n };\n ASN1.prototype.posEnd = function () {\n return this.stream.pos + this.header + Math.abs(this.length);\n };\n ASN1.prototype.toHexString = function () {\n return this.stream.hexDump(this.posStart(), this.posEnd(), true);\n };\n ASN1.decodeLength = function (stream) {\n var buf = stream.get();\n var len = buf & 0x7F;\n if (len == buf) {\n return len;\n }\n // no reason to use Int10, as it would be a huge buffer anyways\n if (len > 6) {\n throw new Error(\"Length over 48 bits not supported at position \" + (stream.pos - 1));\n }\n if (len === 0) {\n return null;\n } // undefined\n buf = 0;\n for (var i = 0; i < len; ++i) {\n buf = (buf * 256) + stream.get();\n }\n return buf;\n };\n /**\n * Retrieve the hexadecimal value (as a string) of the current ASN.1 element\n * @returns {string}\n * @public\n */\n ASN1.prototype.getHexStringValue = function () {\n var hexString = this.toHexString();\n var offset = this.header * 2;\n var length = this.length * 2;\n return hexString.substr(offset, length);\n };\n ASN1.decode = function (str) {\n var stream;\n if (!(str instanceof Stream)) {\n stream = new Stream(str, 0);\n }\n else {\n stream = str;\n }\n var streamStart = new Stream(stream);\n var tag = new ASN1Tag(stream);\n var len = ASN1.decodeLength(stream);\n var start = stream.pos;\n var header = start - streamStart.pos;\n var sub = null;\n var getSub = function () {\n var ret = [];\n if (len !== null) {\n // definite length\n var end = start + len;\n while (stream.pos < end) {\n ret[ret.length] = ASN1.decode(stream);\n }\n if (stream.pos != end) {\n throw new Error(\"Content size is not correct for container starting at offset \" + start);\n }\n }\n else {\n // undefined length\n try {\n for (;;) {\n var s = ASN1.decode(stream);\n if (s.tag.isEOC()) {\n break;\n }\n ret[ret.length] = s;\n }\n len = start - stream.pos; // undefined lengths are represented as negative values\n }\n catch (e) {\n throw new Error(\"Exception while decoding undefined length content: \" + e);\n }\n }\n return ret;\n };\n if (tag.tagConstructed) {\n // must have valid content\n sub = getSub();\n }\n else if (tag.isUniversal() && ((tag.tagNumber == 0x03) || (tag.tagNumber == 0x04))) {\n // sometimes BitString and OctetString are used to encapsulate ASN.1\n try {\n if (tag.tagNumber == 0x03) {\n if (stream.get() != 0) {\n throw new Error(\"BIT STRINGs with unused bits cannot encapsulate.\");\n }\n }\n sub = getSub();\n for (var i = 0; i < sub.length; ++i) {\n if (sub[i].tag.isEOC()) {\n throw new Error(\"EOC is not supposed to be actual content.\");\n }\n }\n }\n catch (e) {\n // but silently ignore when they don't\n sub = null;\n }\n }\n if (sub === null) {\n if (len === null) {\n throw new Error(\"We can't skip over an invalid tag with undefined length at offset \" + start);\n }\n stream.pos = start + Math.abs(len);\n }\n return new ASN1(streamStart, header, len, tag, sub);\n };\n return ASN1;\n}());\n\nvar ASN1Tag = /** @class */ (function () {\n function ASN1Tag(stream) {\n var buf = stream.get();\n this.tagClass = buf >> 6;\n this.tagConstructed = ((buf & 0x20) !== 0);\n this.tagNumber = buf & 0x1F;\n if (this.tagNumber == 0x1F) { // long tag\n var n = new _int10__WEBPACK_IMPORTED_MODULE_0__.Int10();\n do {\n buf = stream.get();\n n.mulAdd(128, buf & 0x7F);\n } while (buf & 0x80);\n this.tagNumber = n.simplify();\n }\n }\n ASN1Tag.prototype.isUniversal = function () {\n return this.tagClass === 0x00;\n };\n ASN1Tag.prototype.isEOC = function () {\n return this.tagClass === 0x00 && this.tagNumber === 0x00;\n };\n return ASN1Tag;\n}());\n\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/lib/asn1js/asn1.js?"); + +/***/ }), + +/***/ "./lib/lib/asn1js/base64.js": +/*!**********************************!*\ + !*** ./lib/lib/asn1js/base64.js ***! + \**********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Base64\": () => (/* binding */ Base64)\n/* harmony export */ });\n// Base64 JavaScript decoder\n// Copyright (c) 2008-2013 Lapo Luchini \n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\nvar decoder;\nvar Base64 = {\n decode: function (a) {\n var i;\n if (decoder === undefined) {\n var b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var ignore = \"= \\f\\n\\r\\t\\u00A0\\u2028\\u2029\";\n decoder = Object.create(null);\n for (i = 0; i < 64; ++i) {\n decoder[b64.charAt(i)] = i;\n }\n decoder['-'] = 62; //+\n decoder['_'] = 63; //-\n for (i = 0; i < ignore.length; ++i) {\n decoder[ignore.charAt(i)] = -1;\n }\n }\n var out = [];\n var bits = 0;\n var char_count = 0;\n for (i = 0; i < a.length; ++i) {\n var c = a.charAt(i);\n if (c == \"=\") {\n break;\n }\n c = decoder[c];\n if (c == -1) {\n continue;\n }\n if (c === undefined) {\n throw new Error(\"Illegal character at offset \" + i);\n }\n bits |= c;\n if (++char_count >= 4) {\n out[out.length] = (bits >> 16);\n out[out.length] = (bits >> 8) & 0xFF;\n out[out.length] = bits & 0xFF;\n bits = 0;\n char_count = 0;\n }\n else {\n bits <<= 6;\n }\n }\n switch (char_count) {\n case 1:\n throw new Error(\"Base64 encoding incomplete: at least 2 bits missing\");\n case 2:\n out[out.length] = (bits >> 10);\n break;\n case 3:\n out[out.length] = (bits >> 16);\n out[out.length] = (bits >> 8) & 0xFF;\n break;\n }\n return out;\n },\n re: /-----BEGIN [^-]+-----([A-Za-z0-9+\\/=\\s]+)-----END [^-]+-----|begin-base64[^\\n]+\\n([A-Za-z0-9+\\/=\\s]+)====/,\n unarmor: function (a) {\n var m = Base64.re.exec(a);\n if (m) {\n if (m[1]) {\n a = m[1];\n }\n else if (m[2]) {\n a = m[2];\n }\n else {\n throw new Error(\"RegExp out of sync\");\n }\n }\n return Base64.decode(a);\n }\n};\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/lib/asn1js/base64.js?"); + +/***/ }), + +/***/ "./lib/lib/asn1js/hex.js": +/*!*******************************!*\ + !*** ./lib/lib/asn1js/hex.js ***! + \*******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Hex\": () => (/* binding */ Hex)\n/* harmony export */ });\n// Hex JavaScript decoder\n// Copyright (c) 2008-2013 Lapo Luchini \n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\nvar decoder;\nvar Hex = {\n decode: function (a) {\n var i;\n if (decoder === undefined) {\n var hex = \"0123456789ABCDEF\";\n var ignore = \" \\f\\n\\r\\t\\u00A0\\u2028\\u2029\";\n decoder = {};\n for (i = 0; i < 16; ++i) {\n decoder[hex.charAt(i)] = i;\n }\n hex = hex.toLowerCase();\n for (i = 10; i < 16; ++i) {\n decoder[hex.charAt(i)] = i;\n }\n for (i = 0; i < ignore.length; ++i) {\n decoder[ignore.charAt(i)] = -1;\n }\n }\n var out = [];\n var bits = 0;\n var char_count = 0;\n for (i = 0; i < a.length; ++i) {\n var c = a.charAt(i);\n if (c == \"=\") {\n break;\n }\n c = decoder[c];\n if (c == -1) {\n continue;\n }\n if (c === undefined) {\n throw new Error(\"Illegal character at offset \" + i);\n }\n bits |= c;\n if (++char_count >= 2) {\n out[out.length] = bits;\n bits = 0;\n char_count = 0;\n }\n else {\n bits <<= 4;\n }\n }\n if (char_count) {\n throw new Error(\"Hex encoding incomplete: 4 bits missing\");\n }\n return out;\n }\n};\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/lib/asn1js/hex.js?"); + +/***/ }), + +/***/ "./lib/lib/asn1js/int10.js": +/*!*********************************!*\ + !*** ./lib/lib/asn1js/int10.js ***! + \*********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Int10\": () => (/* binding */ Int10)\n/* harmony export */ });\n// Big integer base-10 printing library\n// Copyright (c) 2014 Lapo Luchini \n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\nvar max = 10000000000000; // biggest integer that can still fit 2^53 when multiplied by 256\nvar Int10 = /** @class */ (function () {\n function Int10(value) {\n this.buf = [+value || 0];\n }\n Int10.prototype.mulAdd = function (m, c) {\n // assert(m <= 256)\n var b = this.buf;\n var l = b.length;\n var i;\n var t;\n for (i = 0; i < l; ++i) {\n t = b[i] * m + c;\n if (t < max) {\n c = 0;\n }\n else {\n c = 0 | (t / max);\n t -= c * max;\n }\n b[i] = t;\n }\n if (c > 0) {\n b[i] = c;\n }\n };\n Int10.prototype.sub = function (c) {\n // assert(m <= 256)\n var b = this.buf;\n var l = b.length;\n var i;\n var t;\n for (i = 0; i < l; ++i) {\n t = b[i] - c;\n if (t < 0) {\n t += max;\n c = 1;\n }\n else {\n c = 0;\n }\n b[i] = t;\n }\n while (b[b.length - 1] === 0) {\n b.pop();\n }\n };\n Int10.prototype.toString = function (base) {\n if ((base || 10) != 10) {\n throw new Error(\"only base 10 is supported\");\n }\n var b = this.buf;\n var s = b[b.length - 1].toString();\n for (var i = b.length - 2; i >= 0; --i) {\n s += (max + b[i]).toString().substring(1);\n }\n return s;\n };\n Int10.prototype.valueOf = function () {\n var b = this.buf;\n var v = 0;\n for (var i = b.length - 1; i >= 0; --i) {\n v = v * max + b[i];\n }\n return v;\n };\n Int10.prototype.simplify = function () {\n var b = this.buf;\n return (b.length == 1) ? b[0] : this;\n };\n return Int10;\n}());\n\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/lib/asn1js/int10.js?"); + +/***/ }), + +/***/ "./lib/lib/jsbn/base64.js": +/*!********************************!*\ + !*** ./lib/lib/jsbn/base64.js ***! + \********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"b64toBA\": () => (/* binding */ b64toBA),\n/* harmony export */ \"b64tohex\": () => (/* binding */ b64tohex),\n/* harmony export */ \"hex2b64\": () => (/* binding */ hex2b64)\n/* harmony export */ });\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ \"./lib/lib/jsbn/util.js\");\n\nvar b64map = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar b64pad = \"=\";\nfunction hex2b64(h) {\n var i;\n var c;\n var ret = \"\";\n for (i = 0; i + 3 <= h.length; i += 3) {\n c = parseInt(h.substring(i, i + 3), 16);\n ret += b64map.charAt(c >> 6) + b64map.charAt(c & 63);\n }\n if (i + 1 == h.length) {\n c = parseInt(h.substring(i, i + 1), 16);\n ret += b64map.charAt(c << 2);\n }\n else if (i + 2 == h.length) {\n c = parseInt(h.substring(i, i + 2), 16);\n ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4);\n }\n while ((ret.length & 3) > 0) {\n ret += b64pad;\n }\n return ret;\n}\n// convert a base64 string to hex\nfunction b64tohex(s) {\n var ret = \"\";\n var i;\n var k = 0; // b64 state, 0-3\n var slop = 0;\n for (i = 0; i < s.length; ++i) {\n if (s.charAt(i) == b64pad) {\n break;\n }\n var v = b64map.indexOf(s.charAt(i));\n if (v < 0) {\n continue;\n }\n if (k == 0) {\n ret += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)(v >> 2);\n slop = v & 3;\n k = 1;\n }\n else if (k == 1) {\n ret += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)((slop << 2) | (v >> 4));\n slop = v & 0xf;\n k = 2;\n }\n else if (k == 2) {\n ret += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)(slop);\n ret += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)(v >> 2);\n slop = v & 3;\n k = 3;\n }\n else {\n ret += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)((slop << 2) | (v >> 4));\n ret += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)(v & 0xf);\n k = 0;\n }\n }\n if (k == 1) {\n ret += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)(slop << 2);\n }\n return ret;\n}\n// convert a base64 string to a byte/number array\nfunction b64toBA(s) {\n // piggyback on b64tohex for now, optimize later\n var h = b64tohex(s);\n var i;\n var a = [];\n for (i = 0; 2 * i < h.length; ++i) {\n a[i] = parseInt(h.substring(2 * i, 2 * i + 2), 16);\n }\n return a;\n}\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsbn/base64.js?"); + +/***/ }), + +/***/ "./lib/lib/jsbn/jsbn.js": +/*!******************************!*\ + !*** ./lib/lib/jsbn/jsbn.js ***! + \******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BigInteger\": () => (/* binding */ BigInteger),\n/* harmony export */ \"intAt\": () => (/* binding */ intAt),\n/* harmony export */ \"nbi\": () => (/* binding */ nbi),\n/* harmony export */ \"nbits\": () => (/* binding */ nbits),\n/* harmony export */ \"nbv\": () => (/* binding */ nbv),\n/* harmony export */ \"parseBigInt\": () => (/* binding */ parseBigInt)\n/* harmony export */ });\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ \"./lib/lib/jsbn/util.js\");\n// Copyright (c) 2005 Tom Wu\n// All Rights Reserved.\n// See \"LICENSE\" for details.\n// Basic JavaScript BN library - subset useful for RSA encryption.\n\n// Bits per digit\nvar dbits;\n// JavaScript engine analysis\nvar canary = 0xdeadbeefcafe;\nvar j_lm = ((canary & 0xffffff) == 0xefcafe);\n//#region\nvar lowprimes = [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];\nvar lplim = (1 << 26) / lowprimes[lowprimes.length - 1];\n//#endregion\n// (public) Constructor\nvar BigInteger = /** @class */ (function () {\n function BigInteger(a, b, c) {\n if (a != null) {\n if (\"number\" == typeof a) {\n this.fromNumber(a, b, c);\n }\n else if (b == null && \"string\" != typeof a) {\n this.fromString(a, 256);\n }\n else {\n this.fromString(a, b);\n }\n }\n }\n //#region PUBLIC\n // BigInteger.prototype.toString = bnToString;\n // (public) return string representation in given radix\n BigInteger.prototype.toString = function (b) {\n if (this.s < 0) {\n return \"-\" + this.negate().toString(b);\n }\n var k;\n if (b == 16) {\n k = 4;\n }\n else if (b == 8) {\n k = 3;\n }\n else if (b == 2) {\n k = 1;\n }\n else if (b == 32) {\n k = 5;\n }\n else if (b == 4) {\n k = 2;\n }\n else {\n return this.toRadix(b);\n }\n var km = (1 << k) - 1;\n var d;\n var m = false;\n var r = \"\";\n var i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n }\n else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) {\n m = true;\n }\n if (m) {\n r += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)(d);\n }\n }\n }\n return m ? r : \"0\";\n };\n // BigInteger.prototype.negate = bnNegate;\n // (public) -this\n BigInteger.prototype.negate = function () {\n var r = nbi();\n BigInteger.ZERO.subTo(this, r);\n return r;\n };\n // BigInteger.prototype.abs = bnAbs;\n // (public) |this|\n BigInteger.prototype.abs = function () {\n return (this.s < 0) ? this.negate() : this;\n };\n // BigInteger.prototype.compareTo = bnCompareTo;\n // (public) return + if this > a, - if this < a, 0 if equal\n BigInteger.prototype.compareTo = function (a) {\n var r = this.s - a.s;\n if (r != 0) {\n return r;\n }\n var i = this.t;\n r = i - a.t;\n if (r != 0) {\n return (this.s < 0) ? -r : r;\n }\n while (--i >= 0) {\n if ((r = this[i] - a[i]) != 0) {\n return r;\n }\n }\n return 0;\n };\n // BigInteger.prototype.bitLength = bnBitLength;\n // (public) return the number of bits in \"this\"\n BigInteger.prototype.bitLength = function () {\n if (this.t <= 0) {\n return 0;\n }\n return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM));\n };\n // BigInteger.prototype.mod = bnMod;\n // (public) this mod a\n BigInteger.prototype.mod = function (a) {\n var r = nbi();\n this.abs().divRemTo(a, null, r);\n if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) {\n a.subTo(r, r);\n }\n return r;\n };\n // BigInteger.prototype.modPowInt = bnModPowInt;\n // (public) this^e % m, 0 <= e < 2^32\n BigInteger.prototype.modPowInt = function (e, m) {\n var z;\n if (e < 256 || m.isEven()) {\n z = new Classic(m);\n }\n else {\n z = new Montgomery(m);\n }\n return this.exp(e, z);\n };\n // BigInteger.prototype.clone = bnClone;\n // (public)\n BigInteger.prototype.clone = function () {\n var r = nbi();\n this.copyTo(r);\n return r;\n };\n // BigInteger.prototype.intValue = bnIntValue;\n // (public) return value as integer\n BigInteger.prototype.intValue = function () {\n if (this.s < 0) {\n if (this.t == 1) {\n return this[0] - this.DV;\n }\n else if (this.t == 0) {\n return -1;\n }\n }\n else if (this.t == 1) {\n return this[0];\n }\n else if (this.t == 0) {\n return 0;\n }\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0];\n };\n // BigInteger.prototype.byteValue = bnByteValue;\n // (public) return value as byte\n BigInteger.prototype.byteValue = function () {\n return (this.t == 0) ? this.s : (this[0] << 24) >> 24;\n };\n // BigInteger.prototype.shortValue = bnShortValue;\n // (public) return value as short (assumes DB>=16)\n BigInteger.prototype.shortValue = function () {\n return (this.t == 0) ? this.s : (this[0] << 16) >> 16;\n };\n // BigInteger.prototype.signum = bnSigNum;\n // (public) 0 if this == 0, 1 if this > 0\n BigInteger.prototype.signum = function () {\n if (this.s < 0) {\n return -1;\n }\n else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) {\n return 0;\n }\n else {\n return 1;\n }\n };\n // BigInteger.prototype.toByteArray = bnToByteArray;\n // (public) convert to bigendian byte array\n BigInteger.prototype.toByteArray = function () {\n var i = this.t;\n var r = [];\n r[0] = this.s;\n var p = this.DB - (i * this.DB) % 8;\n var d;\n var k = 0;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p) {\n r[k++] = d | (this.s << (this.DB - p));\n }\n while (i >= 0) {\n if (p < 8) {\n d = (this[i] & ((1 << p) - 1)) << (8 - p);\n d |= this[--i] >> (p += this.DB - 8);\n }\n else {\n d = (this[i] >> (p -= 8)) & 0xff;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if ((d & 0x80) != 0) {\n d |= -256;\n }\n if (k == 0 && (this.s & 0x80) != (d & 0x80)) {\n ++k;\n }\n if (k > 0 || d != this.s) {\n r[k++] = d;\n }\n }\n }\n return r;\n };\n // BigInteger.prototype.equals = bnEquals;\n BigInteger.prototype.equals = function (a) {\n return (this.compareTo(a) == 0);\n };\n // BigInteger.prototype.min = bnMin;\n BigInteger.prototype.min = function (a) {\n return (this.compareTo(a) < 0) ? this : a;\n };\n // BigInteger.prototype.max = bnMax;\n BigInteger.prototype.max = function (a) {\n return (this.compareTo(a) > 0) ? this : a;\n };\n // BigInteger.prototype.and = bnAnd;\n BigInteger.prototype.and = function (a) {\n var r = nbi();\n this.bitwiseTo(a, _util__WEBPACK_IMPORTED_MODULE_0__.op_and, r);\n return r;\n };\n // BigInteger.prototype.or = bnOr;\n BigInteger.prototype.or = function (a) {\n var r = nbi();\n this.bitwiseTo(a, _util__WEBPACK_IMPORTED_MODULE_0__.op_or, r);\n return r;\n };\n // BigInteger.prototype.xor = bnXor;\n BigInteger.prototype.xor = function (a) {\n var r = nbi();\n this.bitwiseTo(a, _util__WEBPACK_IMPORTED_MODULE_0__.op_xor, r);\n return r;\n };\n // BigInteger.prototype.andNot = bnAndNot;\n BigInteger.prototype.andNot = function (a) {\n var r = nbi();\n this.bitwiseTo(a, _util__WEBPACK_IMPORTED_MODULE_0__.op_andnot, r);\n return r;\n };\n // BigInteger.prototype.not = bnNot;\n // (public) ~this\n BigInteger.prototype.not = function () {\n var r = nbi();\n for (var i = 0; i < this.t; ++i) {\n r[i] = this.DM & ~this[i];\n }\n r.t = this.t;\n r.s = ~this.s;\n return r;\n };\n // BigInteger.prototype.shiftLeft = bnShiftLeft;\n // (public) this << n\n BigInteger.prototype.shiftLeft = function (n) {\n var r = nbi();\n if (n < 0) {\n this.rShiftTo(-n, r);\n }\n else {\n this.lShiftTo(n, r);\n }\n return r;\n };\n // BigInteger.prototype.shiftRight = bnShiftRight;\n // (public) this >> n\n BigInteger.prototype.shiftRight = function (n) {\n var r = nbi();\n if (n < 0) {\n this.lShiftTo(-n, r);\n }\n else {\n this.rShiftTo(n, r);\n }\n return r;\n };\n // BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;\n // (public) returns index of lowest 1-bit (or -1 if none)\n BigInteger.prototype.getLowestSetBit = function () {\n for (var i = 0; i < this.t; ++i) {\n if (this[i] != 0) {\n return i * this.DB + (0,_util__WEBPACK_IMPORTED_MODULE_0__.lbit)(this[i]);\n }\n }\n if (this.s < 0) {\n return this.t * this.DB;\n }\n return -1;\n };\n // BigInteger.prototype.bitCount = bnBitCount;\n // (public) return number of set bits\n BigInteger.prototype.bitCount = function () {\n var r = 0;\n var x = this.s & this.DM;\n for (var i = 0; i < this.t; ++i) {\n r += (0,_util__WEBPACK_IMPORTED_MODULE_0__.cbit)(this[i] ^ x);\n }\n return r;\n };\n // BigInteger.prototype.testBit = bnTestBit;\n // (public) true iff nth bit is set\n BigInteger.prototype.testBit = function (n) {\n var j = Math.floor(n / this.DB);\n if (j >= this.t) {\n return (this.s != 0);\n }\n return ((this[j] & (1 << (n % this.DB))) != 0);\n };\n // BigInteger.prototype.setBit = bnSetBit;\n // (public) this | (1< 1) {\n var g2 = nbi();\n z.sqrTo(g[1], g2);\n while (n <= km) {\n g[n] = nbi();\n z.mulTo(g2, g[n - 2], g[n]);\n n += 2;\n }\n }\n var j = e.t - 1;\n var w;\n var is1 = true;\n var r2 = nbi();\n var t;\n i = nbits(e[j]) - 1;\n while (j >= 0) {\n if (i >= k1) {\n w = (e[j] >> (i - k1)) & km;\n }\n else {\n w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i);\n if (j > 0) {\n w |= e[j - 1] >> (this.DB + i - k1);\n }\n }\n n = k;\n while ((w & 1) == 0) {\n w >>= 1;\n --n;\n }\n if ((i -= n) < 0) {\n i += this.DB;\n --j;\n }\n if (is1) { // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n }\n else {\n while (n > 1) {\n z.sqrTo(r, r2);\n z.sqrTo(r2, r);\n n -= 2;\n }\n if (n > 0) {\n z.sqrTo(r, r2);\n }\n else {\n t = r;\n r = r2;\n r2 = t;\n }\n z.mulTo(r2, g[w], r);\n }\n while (j >= 0 && (e[j] & (1 << i)) == 0) {\n z.sqrTo(r, r2);\n t = r;\n r = r2;\n r2 = t;\n if (--i < 0) {\n i = this.DB - 1;\n --j;\n }\n }\n }\n return z.revert(r);\n };\n // BigInteger.prototype.modInverse = bnModInverse;\n // (public) 1/this % m (HAC 14.61)\n BigInteger.prototype.modInverse = function (m) {\n var ac = m.isEven();\n if ((this.isEven() && ac) || m.signum() == 0) {\n return BigInteger.ZERO;\n }\n var u = m.clone();\n var v = this.clone();\n var a = nbv(1);\n var b = nbv(0);\n var c = nbv(0);\n var d = nbv(1);\n while (u.signum() != 0) {\n while (u.isEven()) {\n u.rShiftTo(1, u);\n if (ac) {\n if (!a.isEven() || !b.isEven()) {\n a.addTo(this, a);\n b.subTo(m, b);\n }\n a.rShiftTo(1, a);\n }\n else if (!b.isEven()) {\n b.subTo(m, b);\n }\n b.rShiftTo(1, b);\n }\n while (v.isEven()) {\n v.rShiftTo(1, v);\n if (ac) {\n if (!c.isEven() || !d.isEven()) {\n c.addTo(this, c);\n d.subTo(m, d);\n }\n c.rShiftTo(1, c);\n }\n else if (!d.isEven()) {\n d.subTo(m, d);\n }\n d.rShiftTo(1, d);\n }\n if (u.compareTo(v) >= 0) {\n u.subTo(v, u);\n if (ac) {\n a.subTo(c, a);\n }\n b.subTo(d, b);\n }\n else {\n v.subTo(u, v);\n if (ac) {\n c.subTo(a, c);\n }\n d.subTo(b, d);\n }\n }\n if (v.compareTo(BigInteger.ONE) != 0) {\n return BigInteger.ZERO;\n }\n if (d.compareTo(m) >= 0) {\n return d.subtract(m);\n }\n if (d.signum() < 0) {\n d.addTo(m, d);\n }\n else {\n return d;\n }\n if (d.signum() < 0) {\n return d.add(m);\n }\n else {\n return d;\n }\n };\n // BigInteger.prototype.pow = bnPow;\n // (public) this^e\n BigInteger.prototype.pow = function (e) {\n return this.exp(e, new NullExp());\n };\n // BigInteger.prototype.gcd = bnGCD;\n // (public) gcd(this,a) (HAC 14.54)\n BigInteger.prototype.gcd = function (a) {\n var x = (this.s < 0) ? this.negate() : this.clone();\n var y = (a.s < 0) ? a.negate() : a.clone();\n if (x.compareTo(y) < 0) {\n var t = x;\n x = y;\n y = t;\n }\n var i = x.getLowestSetBit();\n var g = y.getLowestSetBit();\n if (g < 0) {\n return x;\n }\n if (i < g) {\n g = i;\n }\n if (g > 0) {\n x.rShiftTo(g, x);\n y.rShiftTo(g, y);\n }\n while (x.signum() > 0) {\n if ((i = x.getLowestSetBit()) > 0) {\n x.rShiftTo(i, x);\n }\n if ((i = y.getLowestSetBit()) > 0) {\n y.rShiftTo(i, y);\n }\n if (x.compareTo(y) >= 0) {\n x.subTo(y, x);\n x.rShiftTo(1, x);\n }\n else {\n y.subTo(x, y);\n y.rShiftTo(1, y);\n }\n }\n if (g > 0) {\n y.lShiftTo(g, y);\n }\n return y;\n };\n // BigInteger.prototype.isProbablePrime = bnIsProbablePrime;\n // (public) test primality with certainty >= 1-.5^t\n BigInteger.prototype.isProbablePrime = function (t) {\n var i;\n var x = this.abs();\n if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {\n for (i = 0; i < lowprimes.length; ++i) {\n if (x[0] == lowprimes[i]) {\n return true;\n }\n }\n return false;\n }\n if (x.isEven()) {\n return false;\n }\n i = 1;\n while (i < lowprimes.length) {\n var m = lowprimes[i];\n var j = i + 1;\n while (j < lowprimes.length && m < lplim) {\n m *= lowprimes[j++];\n }\n m = x.modInt(m);\n while (i < j) {\n if (m % lowprimes[i++] == 0) {\n return false;\n }\n }\n }\n return x.millerRabin(t);\n };\n //#endregion PUBLIC\n //#region PROTECTED\n // BigInteger.prototype.copyTo = bnpCopyTo;\n // (protected) copy this to r\n BigInteger.prototype.copyTo = function (r) {\n for (var i = this.t - 1; i >= 0; --i) {\n r[i] = this[i];\n }\n r.t = this.t;\n r.s = this.s;\n };\n // BigInteger.prototype.fromInt = bnpFromInt;\n // (protected) set from integer value x, -DV <= x < DV\n BigInteger.prototype.fromInt = function (x) {\n this.t = 1;\n this.s = (x < 0) ? -1 : 0;\n if (x > 0) {\n this[0] = x;\n }\n else if (x < -1) {\n this[0] = x + this.DV;\n }\n else {\n this.t = 0;\n }\n };\n // BigInteger.prototype.fromString = bnpFromString;\n // (protected) set from string and radix\n BigInteger.prototype.fromString = function (s, b) {\n var k;\n if (b == 16) {\n k = 4;\n }\n else if (b == 8) {\n k = 3;\n }\n else if (b == 256) {\n k = 8;\n /* byte array */\n }\n else if (b == 2) {\n k = 1;\n }\n else if (b == 32) {\n k = 5;\n }\n else if (b == 4) {\n k = 2;\n }\n else {\n this.fromRadix(s, b);\n return;\n }\n this.t = 0;\n this.s = 0;\n var i = s.length;\n var mi = false;\n var sh = 0;\n while (--i >= 0) {\n var x = (k == 8) ? (+s[i]) & 0xff : intAt(s, i);\n if (x < 0) {\n if (s.charAt(i) == \"-\") {\n mi = true;\n }\n continue;\n }\n mi = false;\n if (sh == 0) {\n this[this.t++] = x;\n }\n else if (sh + k > this.DB) {\n this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;\n this[this.t++] = (x >> (this.DB - sh));\n }\n else {\n this[this.t - 1] |= x << sh;\n }\n sh += k;\n if (sh >= this.DB) {\n sh -= this.DB;\n }\n }\n if (k == 8 && ((+s[0]) & 0x80) != 0) {\n this.s = -1;\n if (sh > 0) {\n this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;\n }\n }\n this.clamp();\n if (mi) {\n BigInteger.ZERO.subTo(this, this);\n }\n };\n // BigInteger.prototype.clamp = bnpClamp;\n // (protected) clamp off excess high words\n BigInteger.prototype.clamp = function () {\n var c = this.s & this.DM;\n while (this.t > 0 && this[this.t - 1] == c) {\n --this.t;\n }\n };\n // BigInteger.prototype.dlShiftTo = bnpDLShiftTo;\n // (protected) r = this << n*DB\n BigInteger.prototype.dlShiftTo = function (n, r) {\n var i;\n for (i = this.t - 1; i >= 0; --i) {\n r[i + n] = this[i];\n }\n for (i = n - 1; i >= 0; --i) {\n r[i] = 0;\n }\n r.t = this.t + n;\n r.s = this.s;\n };\n // BigInteger.prototype.drShiftTo = bnpDRShiftTo;\n // (protected) r = this >> n*DB\n BigInteger.prototype.drShiftTo = function (n, r) {\n for (var i = n; i < this.t; ++i) {\n r[i - n] = this[i];\n }\n r.t = Math.max(this.t - n, 0);\n r.s = this.s;\n };\n // BigInteger.prototype.lShiftTo = bnpLShiftTo;\n // (protected) r = this << n\n BigInteger.prototype.lShiftTo = function (n, r) {\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << cbs) - 1;\n var ds = Math.floor(n / this.DB);\n var c = (this.s << bs) & this.DM;\n for (var i = this.t - 1; i >= 0; --i) {\n r[i + ds + 1] = (this[i] >> cbs) | c;\n c = (this[i] & bm) << bs;\n }\n for (var i = ds - 1; i >= 0; --i) {\n r[i] = 0;\n }\n r[ds] = c;\n r.t = this.t + ds + 1;\n r.s = this.s;\n r.clamp();\n };\n // BigInteger.prototype.rShiftTo = bnpRShiftTo;\n // (protected) r = this >> n\n BigInteger.prototype.rShiftTo = function (n, r) {\n r.s = this.s;\n var ds = Math.floor(n / this.DB);\n if (ds >= this.t) {\n r.t = 0;\n return;\n }\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << bs) - 1;\n r[0] = this[ds] >> bs;\n for (var i = ds + 1; i < this.t; ++i) {\n r[i - ds - 1] |= (this[i] & bm) << cbs;\n r[i - ds] = this[i] >> bs;\n }\n if (bs > 0) {\n r[this.t - ds - 1] |= (this.s & bm) << cbs;\n }\n r.t = this.t - ds;\n r.clamp();\n };\n // BigInteger.prototype.subTo = bnpSubTo;\n // (protected) r = this - a\n BigInteger.prototype.subTo = function (a, r) {\n var i = 0;\n var c = 0;\n var m = Math.min(a.t, this.t);\n while (i < m) {\n c += this[i] - a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n if (a.t < this.t) {\n c -= a.s;\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += this.s;\n }\n else {\n c += this.s;\n while (i < a.t) {\n c -= a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c -= a.s;\n }\n r.s = (c < 0) ? -1 : 0;\n if (c < -1) {\n r[i++] = this.DV + c;\n }\n else if (c > 0) {\n r[i++] = c;\n }\n r.t = i;\n r.clamp();\n };\n // BigInteger.prototype.multiplyTo = bnpMultiplyTo;\n // (protected) r = this * a, r != this,a (HAC 14.12)\n // \"this\" should be the larger one if appropriate.\n BigInteger.prototype.multiplyTo = function (a, r) {\n var x = this.abs();\n var y = a.abs();\n var i = x.t;\n r.t = i + y.t;\n while (--i >= 0) {\n r[i] = 0;\n }\n for (i = 0; i < y.t; ++i) {\n r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\n }\n r.s = 0;\n r.clamp();\n if (this.s != a.s) {\n BigInteger.ZERO.subTo(r, r);\n }\n };\n // BigInteger.prototype.squareTo = bnpSquareTo;\n // (protected) r = this^2, r != this (HAC 14.16)\n BigInteger.prototype.squareTo = function (r) {\n var x = this.abs();\n var i = r.t = 2 * x.t;\n while (--i >= 0) {\n r[i] = 0;\n }\n for (i = 0; i < x.t - 1; ++i) {\n var c = x.am(i, x[i], r, 2 * i, 0, 1);\n if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\n r[i + x.t] -= x.DV;\n r[i + x.t + 1] = 1;\n }\n }\n if (r.t > 0) {\n r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\n }\n r.s = 0;\n r.clamp();\n };\n // BigInteger.prototype.divRemTo = bnpDivRemTo;\n // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n // r != q, this != m. q or r may be null.\n BigInteger.prototype.divRemTo = function (m, q, r) {\n var pm = m.abs();\n if (pm.t <= 0) {\n return;\n }\n var pt = this.abs();\n if (pt.t < pm.t) {\n if (q != null) {\n q.fromInt(0);\n }\n if (r != null) {\n this.copyTo(r);\n }\n return;\n }\n if (r == null) {\n r = nbi();\n }\n var y = nbi();\n var ts = this.s;\n var ms = m.s;\n var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus\n if (nsh > 0) {\n pm.lShiftTo(nsh, y);\n pt.lShiftTo(nsh, r);\n }\n else {\n pm.copyTo(y);\n pt.copyTo(r);\n }\n var ys = y.t;\n var y0 = y[ys - 1];\n if (y0 == 0) {\n return;\n }\n var yt = y0 * (1 << this.F1) + ((ys > 1) ? y[ys - 2] >> this.F2 : 0);\n var d1 = this.FV / yt;\n var d2 = (1 << this.F1) / yt;\n var e = 1 << this.F2;\n var i = r.t;\n var j = i - ys;\n var t = (q == null) ? nbi() : q;\n y.dlShiftTo(j, t);\n if (r.compareTo(t) >= 0) {\n r[r.t++] = 1;\n r.subTo(t, r);\n }\n BigInteger.ONE.dlShiftTo(ys, t);\n t.subTo(y, y); // \"negative\" y so we can replace sub with am later\n while (y.t < ys) {\n y[y.t++] = 0;\n }\n while (--j >= 0) {\n // Estimate quotient digit\n var qd = (r[--i] == y0) ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\n if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out\n y.dlShiftTo(j, t);\n r.subTo(t, r);\n while (r[i] < --qd) {\n r.subTo(t, r);\n }\n }\n }\n if (q != null) {\n r.drShiftTo(ys, q);\n if (ts != ms) {\n BigInteger.ZERO.subTo(q, q);\n }\n }\n r.t = ys;\n r.clamp();\n if (nsh > 0) {\n r.rShiftTo(nsh, r);\n } // Denormalize remainder\n if (ts < 0) {\n BigInteger.ZERO.subTo(r, r);\n }\n };\n // BigInteger.prototype.invDigit = bnpInvDigit;\n // (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n // justification:\n // xy == 1 (mod m)\n // xy = 1+km\n // xy(2-xy) = (1+km)(1-km)\n // x[y(2-xy)] = 1-k^2m^2\n // x[y(2-xy)] == 1 (mod m^2)\n // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n // should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n // JS multiply \"overflows\" differently from C/C++, so care is needed here.\n BigInteger.prototype.invDigit = function () {\n if (this.t < 1) {\n return 0;\n }\n var x = this[0];\n if ((x & 1) == 0) {\n return 0;\n }\n var y = x & 3; // y == 1/x mod 2^2\n y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4\n y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8\n y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16\n // last step - calculate inverse mod DV directly;\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits\n // we really want the negative inverse, and -DV < y < DV\n return (y > 0) ? this.DV - y : -y;\n };\n // BigInteger.prototype.isEven = bnpIsEven;\n // (protected) true iff this is even\n BigInteger.prototype.isEven = function () {\n return ((this.t > 0) ? (this[0] & 1) : this.s) == 0;\n };\n // BigInteger.prototype.exp = bnpExp;\n // (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\n BigInteger.prototype.exp = function (e, z) {\n if (e > 0xffffffff || e < 1) {\n return BigInteger.ONE;\n }\n var r = nbi();\n var r2 = nbi();\n var g = z.convert(this);\n var i = nbits(e) - 1;\n g.copyTo(r);\n while (--i >= 0) {\n z.sqrTo(r, r2);\n if ((e & (1 << i)) > 0) {\n z.mulTo(r2, g, r);\n }\n else {\n var t = r;\n r = r2;\n r2 = t;\n }\n }\n return z.revert(r);\n };\n // BigInteger.prototype.chunkSize = bnpChunkSize;\n // (protected) return x s.t. r^x < DV\n BigInteger.prototype.chunkSize = function (r) {\n return Math.floor(Math.LN2 * this.DB / Math.log(r));\n };\n // BigInteger.prototype.toRadix = bnpToRadix;\n // (protected) convert to radix string\n BigInteger.prototype.toRadix = function (b) {\n if (b == null) {\n b = 10;\n }\n if (this.signum() == 0 || b < 2 || b > 36) {\n return \"0\";\n }\n var cs = this.chunkSize(b);\n var a = Math.pow(b, cs);\n var d = nbv(a);\n var y = nbi();\n var z = nbi();\n var r = \"\";\n this.divRemTo(d, y, z);\n while (y.signum() > 0) {\n r = (a + z.intValue()).toString(b).substr(1) + r;\n y.divRemTo(d, y, z);\n }\n return z.intValue().toString(b) + r;\n };\n // BigInteger.prototype.fromRadix = bnpFromRadix;\n // (protected) convert from radix string\n BigInteger.prototype.fromRadix = function (s, b) {\n this.fromInt(0);\n if (b == null) {\n b = 10;\n }\n var cs = this.chunkSize(b);\n var d = Math.pow(b, cs);\n var mi = false;\n var j = 0;\n var w = 0;\n for (var i = 0; i < s.length; ++i) {\n var x = intAt(s, i);\n if (x < 0) {\n if (s.charAt(i) == \"-\" && this.signum() == 0) {\n mi = true;\n }\n continue;\n }\n w = b * w + x;\n if (++j >= cs) {\n this.dMultiply(d);\n this.dAddOffset(w, 0);\n j = 0;\n w = 0;\n }\n }\n if (j > 0) {\n this.dMultiply(Math.pow(b, j));\n this.dAddOffset(w, 0);\n }\n if (mi) {\n BigInteger.ZERO.subTo(this, this);\n }\n };\n // BigInteger.prototype.fromNumber = bnpFromNumber;\n // (protected) alternate constructor\n BigInteger.prototype.fromNumber = function (a, b, c) {\n if (\"number\" == typeof b) {\n // new BigInteger(int,int,RNG)\n if (a < 2) {\n this.fromInt(1);\n }\n else {\n this.fromNumber(a, c);\n if (!this.testBit(a - 1)) {\n // force MSB set\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), _util__WEBPACK_IMPORTED_MODULE_0__.op_or, this);\n }\n if (this.isEven()) {\n this.dAddOffset(1, 0);\n } // force odd\n while (!this.isProbablePrime(b)) {\n this.dAddOffset(2, 0);\n if (this.bitLength() > a) {\n this.subTo(BigInteger.ONE.shiftLeft(a - 1), this);\n }\n }\n }\n }\n else {\n // new BigInteger(int,RNG)\n var x = [];\n var t = a & 7;\n x.length = (a >> 3) + 1;\n b.nextBytes(x);\n if (t > 0) {\n x[0] &= ((1 << t) - 1);\n }\n else {\n x[0] = 0;\n }\n this.fromString(x, 256);\n }\n };\n // BigInteger.prototype.bitwiseTo = bnpBitwiseTo;\n // (protected) r = this op a (bitwise)\n BigInteger.prototype.bitwiseTo = function (a, op, r) {\n var i;\n var f;\n var m = Math.min(a.t, this.t);\n for (i = 0; i < m; ++i) {\n r[i] = op(this[i], a[i]);\n }\n if (a.t < this.t) {\n f = a.s & this.DM;\n for (i = m; i < this.t; ++i) {\n r[i] = op(this[i], f);\n }\n r.t = this.t;\n }\n else {\n f = this.s & this.DM;\n for (i = m; i < a.t; ++i) {\n r[i] = op(f, a[i]);\n }\n r.t = a.t;\n }\n r.s = op(this.s, a.s);\n r.clamp();\n };\n // BigInteger.prototype.changeBit = bnpChangeBit;\n // (protected) this op (1<>= this.DB;\n }\n if (a.t < this.t) {\n c += a.s;\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += this.s;\n }\n else {\n c += this.s;\n while (i < a.t) {\n c += a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += a.s;\n }\n r.s = (c < 0) ? -1 : 0;\n if (c > 0) {\n r[i++] = c;\n }\n else if (c < -1) {\n r[i++] = this.DV + c;\n }\n r.t = i;\n r.clamp();\n };\n // BigInteger.prototype.dMultiply = bnpDMultiply;\n // (protected) this *= n, this >= 0, 1 < n < DV\n BigInteger.prototype.dMultiply = function (n) {\n this[this.t] = this.am(0, n - 1, this, 0, 0, this.t);\n ++this.t;\n this.clamp();\n };\n // BigInteger.prototype.dAddOffset = bnpDAddOffset;\n // (protected) this += n << w words, this >= 0\n BigInteger.prototype.dAddOffset = function (n, w) {\n if (n == 0) {\n return;\n }\n while (this.t <= w) {\n this[this.t++] = 0;\n }\n this[w] += n;\n while (this[w] >= this.DV) {\n this[w] -= this.DV;\n if (++w >= this.t) {\n this[this.t++] = 0;\n }\n ++this[w];\n }\n };\n // BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;\n // (protected) r = lower n words of \"this * a\", a.t <= n\n // \"this\" should be the larger one if appropriate.\n BigInteger.prototype.multiplyLowerTo = function (a, n, r) {\n var i = Math.min(this.t + a.t, n);\n r.s = 0; // assumes a,this >= 0\n r.t = i;\n while (i > 0) {\n r[--i] = 0;\n }\n for (var j = r.t - this.t; i < j; ++i) {\n r[i + this.t] = this.am(0, a[i], r, i, 0, this.t);\n }\n for (var j = Math.min(a.t, n); i < j; ++i) {\n this.am(0, a[i], r, i, 0, n - i);\n }\n r.clamp();\n };\n // BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;\n // (protected) r = \"this * a\" without lower n words, n > 0\n // \"this\" should be the larger one if appropriate.\n BigInteger.prototype.multiplyUpperTo = function (a, n, r) {\n --n;\n var i = r.t = this.t + a.t - n;\n r.s = 0; // assumes a,this >= 0\n while (--i >= 0) {\n r[i] = 0;\n }\n for (i = Math.max(n - this.t, 0); i < a.t; ++i) {\n r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n);\n }\n r.clamp();\n r.drShiftTo(1, r);\n };\n // BigInteger.prototype.modInt = bnpModInt;\n // (protected) this % n, n < 2^26\n BigInteger.prototype.modInt = function (n) {\n if (n <= 0) {\n return 0;\n }\n var d = this.DV % n;\n var r = (this.s < 0) ? n - 1 : 0;\n if (this.t > 0) {\n if (d == 0) {\n r = this[0] % n;\n }\n else {\n for (var i = this.t - 1; i >= 0; --i) {\n r = (d * r + this[i]) % n;\n }\n }\n }\n return r;\n };\n // BigInteger.prototype.millerRabin = bnpMillerRabin;\n // (protected) true if probably prime (HAC 4.24, Miller-Rabin)\n BigInteger.prototype.millerRabin = function (t) {\n var n1 = this.subtract(BigInteger.ONE);\n var k = n1.getLowestSetBit();\n if (k <= 0) {\n return false;\n }\n var r = n1.shiftRight(k);\n t = (t + 1) >> 1;\n if (t > lowprimes.length) {\n t = lowprimes.length;\n }\n var a = nbi();\n for (var i = 0; i < t; ++i) {\n // Pick bases at random, instead of starting at 2\n a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);\n var y = a.modPow(r, this);\n if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {\n var j = 1;\n while (j++ < k && y.compareTo(n1) != 0) {\n y = y.modPowInt(2, this);\n if (y.compareTo(BigInteger.ONE) == 0) {\n return false;\n }\n }\n if (y.compareTo(n1) != 0) {\n return false;\n }\n }\n }\n return true;\n };\n // BigInteger.prototype.square = bnSquare;\n // (public) this^2\n BigInteger.prototype.square = function () {\n var r = nbi();\n this.squareTo(r);\n return r;\n };\n //#region ASYNC\n // Public API method\n BigInteger.prototype.gcda = function (a, callback) {\n var x = (this.s < 0) ? this.negate() : this.clone();\n var y = (a.s < 0) ? a.negate() : a.clone();\n if (x.compareTo(y) < 0) {\n var t = x;\n x = y;\n y = t;\n }\n var i = x.getLowestSetBit();\n var g = y.getLowestSetBit();\n if (g < 0) {\n callback(x);\n return;\n }\n if (i < g) {\n g = i;\n }\n if (g > 0) {\n x.rShiftTo(g, x);\n y.rShiftTo(g, y);\n }\n // Workhorse of the algorithm, gets called 200 - 800 times per 512 bit keygen.\n var gcda1 = function () {\n if ((i = x.getLowestSetBit()) > 0) {\n x.rShiftTo(i, x);\n }\n if ((i = y.getLowestSetBit()) > 0) {\n y.rShiftTo(i, y);\n }\n if (x.compareTo(y) >= 0) {\n x.subTo(y, x);\n x.rShiftTo(1, x);\n }\n else {\n y.subTo(x, y);\n y.rShiftTo(1, y);\n }\n if (!(x.signum() > 0)) {\n if (g > 0) {\n y.lShiftTo(g, y);\n }\n setTimeout(function () { callback(y); }, 0); // escape\n }\n else {\n setTimeout(gcda1, 0);\n }\n };\n setTimeout(gcda1, 10);\n };\n // (protected) alternate constructor\n BigInteger.prototype.fromNumberAsync = function (a, b, c, callback) {\n if (\"number\" == typeof b) {\n if (a < 2) {\n this.fromInt(1);\n }\n else {\n this.fromNumber(a, c);\n if (!this.testBit(a - 1)) {\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), _util__WEBPACK_IMPORTED_MODULE_0__.op_or, this);\n }\n if (this.isEven()) {\n this.dAddOffset(1, 0);\n }\n var bnp_1 = this;\n var bnpfn1_1 = function () {\n bnp_1.dAddOffset(2, 0);\n if (bnp_1.bitLength() > a) {\n bnp_1.subTo(BigInteger.ONE.shiftLeft(a - 1), bnp_1);\n }\n if (bnp_1.isProbablePrime(b)) {\n setTimeout(function () { callback(); }, 0); // escape\n }\n else {\n setTimeout(bnpfn1_1, 0);\n }\n };\n setTimeout(bnpfn1_1, 0);\n }\n }\n else {\n var x = [];\n var t = a & 7;\n x.length = (a >> 3) + 1;\n b.nextBytes(x);\n if (t > 0) {\n x[0] &= ((1 << t) - 1);\n }\n else {\n x[0] = 0;\n }\n this.fromString(x, 256);\n }\n };\n return BigInteger;\n}());\n\n//#region REDUCERS\n//#region NullExp\nvar NullExp = /** @class */ (function () {\n function NullExp() {\n }\n // NullExp.prototype.convert = nNop;\n NullExp.prototype.convert = function (x) {\n return x;\n };\n // NullExp.prototype.revert = nNop;\n NullExp.prototype.revert = function (x) {\n return x;\n };\n // NullExp.prototype.mulTo = nMulTo;\n NullExp.prototype.mulTo = function (x, y, r) {\n x.multiplyTo(y, r);\n };\n // NullExp.prototype.sqrTo = nSqrTo;\n NullExp.prototype.sqrTo = function (x, r) {\n x.squareTo(r);\n };\n return NullExp;\n}());\n// Modular reduction using \"classic\" algorithm\nvar Classic = /** @class */ (function () {\n function Classic(m) {\n this.m = m;\n }\n // Classic.prototype.convert = cConvert;\n Classic.prototype.convert = function (x) {\n if (x.s < 0 || x.compareTo(this.m) >= 0) {\n return x.mod(this.m);\n }\n else {\n return x;\n }\n };\n // Classic.prototype.revert = cRevert;\n Classic.prototype.revert = function (x) {\n return x;\n };\n // Classic.prototype.reduce = cReduce;\n Classic.prototype.reduce = function (x) {\n x.divRemTo(this.m, null, x);\n };\n // Classic.prototype.mulTo = cMulTo;\n Classic.prototype.mulTo = function (x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n };\n // Classic.prototype.sqrTo = cSqrTo;\n Classic.prototype.sqrTo = function (x, r) {\n x.squareTo(r);\n this.reduce(r);\n };\n return Classic;\n}());\n//#endregion\n//#region Montgomery\n// Montgomery reduction\nvar Montgomery = /** @class */ (function () {\n function Montgomery(m) {\n this.m = m;\n this.mp = m.invDigit();\n this.mpl = this.mp & 0x7fff;\n this.mph = this.mp >> 15;\n this.um = (1 << (m.DB - 15)) - 1;\n this.mt2 = 2 * m.t;\n }\n // Montgomery.prototype.convert = montConvert;\n // xR mod m\n Montgomery.prototype.convert = function (x) {\n var r = nbi();\n x.abs().dlShiftTo(this.m.t, r);\n r.divRemTo(this.m, null, r);\n if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) {\n this.m.subTo(r, r);\n }\n return r;\n };\n // Montgomery.prototype.revert = montRevert;\n // x/R mod m\n Montgomery.prototype.revert = function (x) {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n };\n // Montgomery.prototype.reduce = montReduce;\n // x = x/R mod m (HAC 14.32)\n Montgomery.prototype.reduce = function (x) {\n while (x.t <= this.mt2) {\n // pad x so am has enough room later\n x[x.t++] = 0;\n }\n for (var i = 0; i < this.m.t; ++i) {\n // faster way of calculating u0 = x[i]*mp mod DV\n var j = x[i] & 0x7fff;\n var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM;\n // use am to combine the multiply-shift-add into one call\n j = i + this.m.t;\n x[j] += this.m.am(0, u0, x, i, 0, this.m.t);\n // propagate carry\n while (x[j] >= x.DV) {\n x[j] -= x.DV;\n x[++j]++;\n }\n }\n x.clamp();\n x.drShiftTo(this.m.t, x);\n if (x.compareTo(this.m) >= 0) {\n x.subTo(this.m, x);\n }\n };\n // Montgomery.prototype.mulTo = montMulTo;\n // r = \"xy/R mod m\"; x,y != r\n Montgomery.prototype.mulTo = function (x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n };\n // Montgomery.prototype.sqrTo = montSqrTo;\n // r = \"x^2/R mod m\"; x != r\n Montgomery.prototype.sqrTo = function (x, r) {\n x.squareTo(r);\n this.reduce(r);\n };\n return Montgomery;\n}());\n//#endregion Montgomery\n//#region Barrett\n// Barrett modular reduction\nvar Barrett = /** @class */ (function () {\n function Barrett(m) {\n this.m = m;\n // setup Barrett\n this.r2 = nbi();\n this.q3 = nbi();\n BigInteger.ONE.dlShiftTo(2 * m.t, this.r2);\n this.mu = this.r2.divide(m);\n }\n // Barrett.prototype.convert = barrettConvert;\n Barrett.prototype.convert = function (x) {\n if (x.s < 0 || x.t > 2 * this.m.t) {\n return x.mod(this.m);\n }\n else if (x.compareTo(this.m) < 0) {\n return x;\n }\n else {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n }\n };\n // Barrett.prototype.revert = barrettRevert;\n Barrett.prototype.revert = function (x) {\n return x;\n };\n // Barrett.prototype.reduce = barrettReduce;\n // x = x mod m (HAC 14.42)\n Barrett.prototype.reduce = function (x) {\n x.drShiftTo(this.m.t - 1, this.r2);\n if (x.t > this.m.t + 1) {\n x.t = this.m.t + 1;\n x.clamp();\n }\n this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3);\n this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);\n while (x.compareTo(this.r2) < 0) {\n x.dAddOffset(1, this.m.t + 1);\n }\n x.subTo(this.r2, x);\n while (x.compareTo(this.m) >= 0) {\n x.subTo(this.m, x);\n }\n };\n // Barrett.prototype.mulTo = barrettMulTo;\n // r = x*y mod m; x,y != r\n Barrett.prototype.mulTo = function (x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n };\n // Barrett.prototype.sqrTo = barrettSqrTo;\n // r = x^2 mod m; x != r\n Barrett.prototype.sqrTo = function (x, r) {\n x.squareTo(r);\n this.reduce(r);\n };\n return Barrett;\n}());\n//#endregion\n//#endregion REDUCERS\n// return new, unset BigInteger\nfunction nbi() { return new BigInteger(null); }\nfunction parseBigInt(str, r) {\n return new BigInteger(str, r);\n}\n// am: Compute w_j += (x*this_i), propagate carries,\n// c is initial carry, returns final carry.\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n// We need to select the fastest one that works in this environment.\nvar inBrowser = typeof navigator !== \"undefined\";\nif (inBrowser && j_lm && (navigator.appName == \"Microsoft Internet Explorer\")) {\n // am2 avoids a big mult-and-extract completely.\n // Max digit bits should be <= 30 because we do bitwise ops\n // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\n BigInteger.prototype.am = function am2(i, x, w, j, c, n) {\n var xl = x & 0x7fff;\n var xh = x >> 15;\n while (--n >= 0) {\n var l = this[i] & 0x7fff;\n var h = this[i++] >> 15;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\n c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\n w[j++] = l & 0x3fffffff;\n }\n return c;\n };\n dbits = 30;\n}\nelse if (inBrowser && j_lm && (navigator.appName != \"Netscape\")) {\n // am1: use a single mult and divide to get the high bits,\n // max digit bits should be 26 because\n // max internal value = 2*dvalue^2-2*dvalue (< 2^53)\n BigInteger.prototype.am = function am1(i, x, w, j, c, n) {\n while (--n >= 0) {\n var v = x * this[i++] + w[j] + c;\n c = Math.floor(v / 0x4000000);\n w[j++] = v & 0x3ffffff;\n }\n return c;\n };\n dbits = 26;\n}\nelse { // Mozilla/Netscape seems to prefer am3\n // Alternately, set max digit bits to 28 since some\n // browsers slow down when dealing with 32-bit numbers.\n BigInteger.prototype.am = function am3(i, x, w, j, c, n) {\n var xl = x & 0x3fff;\n var xh = x >> 14;\n while (--n >= 0) {\n var l = this[i] & 0x3fff;\n var h = this[i++] >> 14;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\n c = (l >> 28) + (m >> 14) + xh * h;\n w[j++] = l & 0xfffffff;\n }\n return c;\n };\n dbits = 28;\n}\nBigInteger.prototype.DB = dbits;\nBigInteger.prototype.DM = ((1 << dbits) - 1);\nBigInteger.prototype.DV = (1 << dbits);\nvar BI_FP = 52;\nBigInteger.prototype.FV = Math.pow(2, BI_FP);\nBigInteger.prototype.F1 = BI_FP - dbits;\nBigInteger.prototype.F2 = 2 * dbits - BI_FP;\n// Digit conversions\nvar BI_RC = [];\nvar rr;\nvar vv;\nrr = \"0\".charCodeAt(0);\nfor (vv = 0; vv <= 9; ++vv) {\n BI_RC[rr++] = vv;\n}\nrr = \"a\".charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv) {\n BI_RC[rr++] = vv;\n}\nrr = \"A\".charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv) {\n BI_RC[rr++] = vv;\n}\nfunction intAt(s, i) {\n var c = BI_RC[s.charCodeAt(i)];\n return (c == null) ? -1 : c;\n}\n// return bigint initialized to value\nfunction nbv(i) {\n var r = nbi();\n r.fromInt(i);\n return r;\n}\n// returns bit length of the integer x\nfunction nbits(x) {\n var r = 1;\n var t;\n if ((t = x >>> 16) != 0) {\n x = t;\n r += 16;\n }\n if ((t = x >> 8) != 0) {\n x = t;\n r += 8;\n }\n if ((t = x >> 4) != 0) {\n x = t;\n r += 4;\n }\n if ((t = x >> 2) != 0) {\n x = t;\n r += 2;\n }\n if ((t = x >> 1) != 0) {\n x = t;\n r += 1;\n }\n return r;\n}\n// \"constants\"\nBigInteger.ZERO = nbv(0);\nBigInteger.ONE = nbv(1);\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsbn/jsbn.js?"); + +/***/ }), + +/***/ "./lib/lib/jsbn/prng4.js": +/*!*******************************!*\ + !*** ./lib/lib/jsbn/prng4.js ***! + \*******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Arcfour\": () => (/* binding */ Arcfour),\n/* harmony export */ \"prng_newstate\": () => (/* binding */ prng_newstate),\n/* harmony export */ \"rng_psize\": () => (/* binding */ rng_psize)\n/* harmony export */ });\n// prng4.js - uses Arcfour as a PRNG\nvar Arcfour = /** @class */ (function () {\n function Arcfour() {\n this.i = 0;\n this.j = 0;\n this.S = [];\n }\n // Arcfour.prototype.init = ARC4init;\n // Initialize arcfour context from key, an array of ints, each from [0..255]\n Arcfour.prototype.init = function (key) {\n var i;\n var j;\n var t;\n for (i = 0; i < 256; ++i) {\n this.S[i] = i;\n }\n j = 0;\n for (i = 0; i < 256; ++i) {\n j = (j + this.S[i] + key[i % key.length]) & 255;\n t = this.S[i];\n this.S[i] = this.S[j];\n this.S[j] = t;\n }\n this.i = 0;\n this.j = 0;\n };\n // Arcfour.prototype.next = ARC4next;\n Arcfour.prototype.next = function () {\n var t;\n this.i = (this.i + 1) & 255;\n this.j = (this.j + this.S[this.i]) & 255;\n t = this.S[this.i];\n this.S[this.i] = this.S[this.j];\n this.S[this.j] = t;\n return this.S[(t + this.S[this.i]) & 255];\n };\n return Arcfour;\n}());\n\n// Plug in your RNG constructor here\nfunction prng_newstate() {\n return new Arcfour();\n}\n// Pool size must be a multiple of 4 and greater than 32.\n// An array of bytes the size of the pool will be passed to init()\nvar rng_psize = 256;\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsbn/prng4.js?"); + +/***/ }), + +/***/ "./lib/lib/jsbn/rng.js": +/*!*****************************!*\ + !*** ./lib/lib/jsbn/rng.js ***! + \*****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"SecureRandom\": () => (/* binding */ SecureRandom)\n/* harmony export */ });\n/* harmony import */ var _prng4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./prng4 */ \"./lib/lib/jsbn/prng4.js\");\n// Random number generator - requires a PRNG backend, e.g. prng4.js\n\nvar rng_state;\nvar rng_pool = null;\nvar rng_pptr;\n// Initialize the pool with junk if needed.\nif (rng_pool == null) {\n rng_pool = [];\n rng_pptr = 0;\n var t = void 0;\n if (typeof window !== 'undefined' && window.crypto && window.crypto.getRandomValues) {\n // Extract entropy (2048 bits) from RNG if available\n var z = new Uint32Array(256);\n window.crypto.getRandomValues(z);\n for (t = 0; t < z.length; ++t) {\n rng_pool[rng_pptr++] = z[t] & 255;\n }\n }\n // Use mouse events for entropy, if we do not have enough entropy by the time\n // we need it, entropy will be generated by Math.random.\n var count = 0;\n var onMouseMoveListener_1 = function (ev) {\n count = count || 0;\n if (count >= 256 || rng_pptr >= _prng4__WEBPACK_IMPORTED_MODULE_0__.rng_psize) {\n if (window.removeEventListener) {\n window.removeEventListener(\"mousemove\", onMouseMoveListener_1, false);\n }\n else if (window.detachEvent) {\n window.detachEvent(\"onmousemove\", onMouseMoveListener_1);\n }\n return;\n }\n try {\n var mouseCoordinates = ev.x + ev.y;\n rng_pool[rng_pptr++] = mouseCoordinates & 255;\n count += 1;\n }\n catch (e) {\n // Sometimes Firefox will deny permission to access event properties for some reason. Ignore.\n }\n };\n if (typeof window !== 'undefined') {\n if (window.addEventListener) {\n window.addEventListener(\"mousemove\", onMouseMoveListener_1, false);\n }\n else if (window.attachEvent) {\n window.attachEvent(\"onmousemove\", onMouseMoveListener_1);\n }\n }\n}\nfunction rng_get_byte() {\n if (rng_state == null) {\n rng_state = (0,_prng4__WEBPACK_IMPORTED_MODULE_0__.prng_newstate)();\n // At this point, we may not have collected enough entropy. If not, fall back to Math.random\n while (rng_pptr < _prng4__WEBPACK_IMPORTED_MODULE_0__.rng_psize) {\n var random = Math.floor(65536 * Math.random());\n rng_pool[rng_pptr++] = random & 255;\n }\n rng_state.init(rng_pool);\n for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) {\n rng_pool[rng_pptr] = 0;\n }\n rng_pptr = 0;\n }\n // TODO: allow reseeding after first request\n return rng_state.next();\n}\nvar SecureRandom = /** @class */ (function () {\n function SecureRandom() {\n }\n SecureRandom.prototype.nextBytes = function (ba) {\n for (var i = 0; i < ba.length; ++i) {\n ba[i] = rng_get_byte();\n }\n };\n return SecureRandom;\n}());\n\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsbn/rng.js?"); + +/***/ }), + +/***/ "./lib/lib/jsbn/rsa.js": +/*!*****************************!*\ + !*** ./lib/lib/jsbn/rsa.js ***! + \*****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"RSAKey\": () => (/* binding */ RSAKey)\n/* harmony export */ });\n/* harmony import */ var _jsbn__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsbn */ \"./lib/lib/jsbn/jsbn.js\");\n/* harmony import */ var _rng__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rng */ \"./lib/lib/jsbn/rng.js\");\n// Depends on jsbn.js and rng.js\n// Version 1.1: support utf-8 encoding in pkcs1pad2\n// convert a (hex) string to a bignum object\n\n\n// function linebrk(s,n) {\n// var ret = \"\";\n// var i = 0;\n// while(i + n < s.length) {\n// ret += s.substring(i,i+n) + \"\\n\";\n// i += n;\n// }\n// return ret + s.substring(i,s.length);\n// }\n// function byte2Hex(b) {\n// if(b < 0x10)\n// return \"0\" + b.toString(16);\n// else\n// return b.toString(16);\n// }\nfunction pkcs1pad1(s, n) {\n if (n < s.length + 22) {\n console.error(\"Message too long for RSA\");\n return null;\n }\n var len = n - s.length - 6;\n var filler = \"\";\n for (var f = 0; f < len; f += 2) {\n filler += \"ff\";\n }\n var m = \"0001\" + filler + \"00\" + s;\n return (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(m, 16);\n}\n// PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint\nfunction pkcs1pad2(s, n) {\n if (n < s.length + 11) { // TODO: fix for utf-8\n console.error(\"Message too long for RSA\");\n return null;\n }\n var ba = [];\n var i = s.length - 1;\n while (i >= 0 && n > 0) {\n var c = s.charCodeAt(i--);\n if (c < 128) { // encode using utf-8\n ba[--n] = c;\n }\n else if ((c > 127) && (c < 2048)) {\n ba[--n] = (c & 63) | 128;\n ba[--n] = (c >> 6) | 192;\n }\n else {\n ba[--n] = (c & 63) | 128;\n ba[--n] = ((c >> 6) & 63) | 128;\n ba[--n] = (c >> 12) | 224;\n }\n }\n ba[--n] = 0;\n var rng = new _rng__WEBPACK_IMPORTED_MODULE_1__.SecureRandom();\n var x = [];\n while (n > 2) { // random non-zero pad\n x[0] = 0;\n while (x[0] == 0) {\n rng.nextBytes(x);\n }\n ba[--n] = x[0];\n }\n ba[--n] = 2;\n ba[--n] = 0;\n return new _jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(ba);\n}\n// \"empty\" RSA key constructor\nvar RSAKey = /** @class */ (function () {\n function RSAKey() {\n this.n = null;\n this.e = 0;\n this.d = null;\n this.p = null;\n this.q = null;\n this.dmp1 = null;\n this.dmq1 = null;\n this.coeff = null;\n }\n //#region PROTECTED\n // protected\n // RSAKey.prototype.doPublic = RSADoPublic;\n // Perform raw public operation on \"x\": return x^e (mod n)\n RSAKey.prototype.doPublic = function (x) {\n return x.modPowInt(this.e, this.n);\n };\n // RSAKey.prototype.doPrivate = RSADoPrivate;\n // Perform raw private operation on \"x\": return x^d (mod n)\n RSAKey.prototype.doPrivate = function (x) {\n if (this.p == null || this.q == null) {\n return x.modPow(this.d, this.n);\n }\n // TODO: re-calculate any missing CRT params\n var xp = x.mod(this.p).modPow(this.dmp1, this.p);\n var xq = x.mod(this.q).modPow(this.dmq1, this.q);\n while (xp.compareTo(xq) < 0) {\n xp = xp.add(this.p);\n }\n return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq);\n };\n //#endregion PROTECTED\n //#region PUBLIC\n // RSAKey.prototype.setPublic = RSASetPublic;\n // Set the public key fields N and e from hex strings\n RSAKey.prototype.setPublic = function (N, E) {\n if (N != null && E != null && N.length > 0 && E.length > 0) {\n this.n = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(N, 16);\n this.e = parseInt(E, 16);\n }\n else {\n console.error(\"Invalid RSA public key\");\n }\n };\n // RSAKey.prototype.encrypt = RSAEncrypt;\n // Return the PKCS#1 RSA encryption of \"text\" as an even-length hex string\n RSAKey.prototype.encrypt = function (text) {\n var maxLength = (this.n.bitLength() + 7) >> 3;\n var m = pkcs1pad2(text, maxLength);\n if (m == null) {\n return null;\n }\n var c = this.doPublic(m);\n if (c == null) {\n return null;\n }\n var h = c.toString(16);\n var length = h.length;\n // fix zero before result\n for (var i = 0; i < maxLength * 2 - length; i++) {\n h = \"0\" + h;\n }\n return h;\n };\n // RSAKey.prototype.setPrivate = RSASetPrivate;\n // Set the private key fields N, e, and d from hex strings\n RSAKey.prototype.setPrivate = function (N, E, D) {\n if (N != null && E != null && N.length > 0 && E.length > 0) {\n this.n = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(N, 16);\n this.e = parseInt(E, 16);\n this.d = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(D, 16);\n }\n else {\n console.error(\"Invalid RSA private key\");\n }\n };\n // RSAKey.prototype.setPrivateEx = RSASetPrivateEx;\n // Set the private key fields N, e, d and CRT params from hex strings\n RSAKey.prototype.setPrivateEx = function (N, E, D, P, Q, DP, DQ, C) {\n if (N != null && E != null && N.length > 0 && E.length > 0) {\n this.n = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(N, 16);\n this.e = parseInt(E, 16);\n this.d = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(D, 16);\n this.p = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(P, 16);\n this.q = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(Q, 16);\n this.dmp1 = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(DP, 16);\n this.dmq1 = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(DQ, 16);\n this.coeff = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(C, 16);\n }\n else {\n console.error(\"Invalid RSA private key\");\n }\n };\n // RSAKey.prototype.generate = RSAGenerate;\n // Generate a new random private key B bits long, using public expt E\n RSAKey.prototype.generate = function (B, E) {\n var rng = new _rng__WEBPACK_IMPORTED_MODULE_1__.SecureRandom();\n var qs = B >> 1;\n this.e = parseInt(E, 16);\n var ee = new _jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(E, 16);\n for (;;) {\n for (;;) {\n this.p = new _jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(B - qs, 1, rng);\n if (this.p.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE).gcd(ee).compareTo(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) {\n break;\n }\n }\n for (;;) {\n this.q = new _jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(qs, 1, rng);\n if (this.q.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE).gcd(ee).compareTo(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) {\n break;\n }\n }\n if (this.p.compareTo(this.q) <= 0) {\n var t = this.p;\n this.p = this.q;\n this.q = t;\n }\n var p1 = this.p.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE);\n var q1 = this.q.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE);\n var phi = p1.multiply(q1);\n if (phi.gcd(ee).compareTo(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE) == 0) {\n this.n = this.p.multiply(this.q);\n this.d = ee.modInverse(phi);\n this.dmp1 = this.d.mod(p1);\n this.dmq1 = this.d.mod(q1);\n this.coeff = this.q.modInverse(this.p);\n break;\n }\n }\n };\n // RSAKey.prototype.decrypt = RSADecrypt;\n // Return the PKCS#1 RSA decryption of \"ctext\".\n // \"ctext\" is an even-length hex string and the output is a plain string.\n RSAKey.prototype.decrypt = function (ctext) {\n var c = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(ctext, 16);\n var m = this.doPrivate(c);\n if (m == null) {\n return null;\n }\n return pkcs1unpad2(m, (this.n.bitLength() + 7) >> 3);\n };\n // Generate a new random private key B bits long, using public expt E\n RSAKey.prototype.generateAsync = function (B, E, callback) {\n var rng = new _rng__WEBPACK_IMPORTED_MODULE_1__.SecureRandom();\n var qs = B >> 1;\n this.e = parseInt(E, 16);\n var ee = new _jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(E, 16);\n var rsa = this;\n // These functions have non-descript names because they were originally for(;;) loops.\n // I don't know about cryptography to give them better names than loop1-4.\n var loop1 = function () {\n var loop4 = function () {\n if (rsa.p.compareTo(rsa.q) <= 0) {\n var t = rsa.p;\n rsa.p = rsa.q;\n rsa.q = t;\n }\n var p1 = rsa.p.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE);\n var q1 = rsa.q.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE);\n var phi = p1.multiply(q1);\n if (phi.gcd(ee).compareTo(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE) == 0) {\n rsa.n = rsa.p.multiply(rsa.q);\n rsa.d = ee.modInverse(phi);\n rsa.dmp1 = rsa.d.mod(p1);\n rsa.dmq1 = rsa.d.mod(q1);\n rsa.coeff = rsa.q.modInverse(rsa.p);\n setTimeout(function () { callback(); }, 0); // escape\n }\n else {\n setTimeout(loop1, 0);\n }\n };\n var loop3 = function () {\n rsa.q = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.nbi)();\n rsa.q.fromNumberAsync(qs, 1, rng, function () {\n rsa.q.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE).gcda(ee, function (r) {\n if (r.compareTo(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE) == 0 && rsa.q.isProbablePrime(10)) {\n setTimeout(loop4, 0);\n }\n else {\n setTimeout(loop3, 0);\n }\n });\n });\n };\n var loop2 = function () {\n rsa.p = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.nbi)();\n rsa.p.fromNumberAsync(B - qs, 1, rng, function () {\n rsa.p.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE).gcda(ee, function (r) {\n if (r.compareTo(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE) == 0 && rsa.p.isProbablePrime(10)) {\n setTimeout(loop3, 0);\n }\n else {\n setTimeout(loop2, 0);\n }\n });\n });\n };\n setTimeout(loop2, 0);\n };\n setTimeout(loop1, 0);\n };\n RSAKey.prototype.sign = function (text, digestMethod, digestName) {\n var header = getDigestHeader(digestName);\n var digest = header + digestMethod(text).toString();\n var m = pkcs1pad1(digest, this.n.bitLength() / 4);\n if (m == null) {\n return null;\n }\n var c = this.doPrivate(m);\n if (c == null) {\n return null;\n }\n var h = c.toString(16);\n if ((h.length & 1) == 0) {\n return h;\n }\n else {\n return \"0\" + h;\n }\n };\n RSAKey.prototype.verify = function (text, signature, digestMethod) {\n var c = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(signature, 16);\n var m = this.doPublic(c);\n if (m == null) {\n return null;\n }\n var unpadded = m.toString(16).replace(/^1f+00/, \"\");\n var digest = removeDigestHeader(unpadded);\n return digest == digestMethod(text).toString();\n };\n return RSAKey;\n}());\n\n// Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext\nfunction pkcs1unpad2(d, n) {\n var b = d.toByteArray();\n var i = 0;\n while (i < b.length && b[i] == 0) {\n ++i;\n }\n if (b.length - i != n - 1 || b[i] != 2) {\n return null;\n }\n ++i;\n while (b[i] != 0) {\n if (++i >= b.length) {\n return null;\n }\n }\n var ret = \"\";\n while (++i < b.length) {\n var c = b[i] & 255;\n if (c < 128) { // utf-8 decode\n ret += String.fromCharCode(c);\n }\n else if ((c > 191) && (c < 224)) {\n ret += String.fromCharCode(((c & 31) << 6) | (b[i + 1] & 63));\n ++i;\n }\n else {\n ret += String.fromCharCode(((c & 15) << 12) | ((b[i + 1] & 63) << 6) | (b[i + 2] & 63));\n i += 2;\n }\n }\n return ret;\n}\n// https://tools.ietf.org/html/rfc3447#page-43\nvar DIGEST_HEADERS = {\n md2: \"3020300c06082a864886f70d020205000410\",\n md5: \"3020300c06082a864886f70d020505000410\",\n sha1: \"3021300906052b0e03021a05000414\",\n sha224: \"302d300d06096086480165030402040500041c\",\n sha256: \"3031300d060960864801650304020105000420\",\n sha384: \"3041300d060960864801650304020205000430\",\n sha512: \"3051300d060960864801650304020305000440\",\n ripemd160: \"3021300906052b2403020105000414\"\n};\nfunction getDigestHeader(name) {\n return DIGEST_HEADERS[name] || \"\";\n}\nfunction removeDigestHeader(str) {\n for (var name_1 in DIGEST_HEADERS) {\n if (DIGEST_HEADERS.hasOwnProperty(name_1)) {\n var header = DIGEST_HEADERS[name_1];\n var len = header.length;\n if (str.substr(0, len) == header) {\n return str.substr(len);\n }\n }\n }\n return str;\n}\n// Return the PKCS#1 RSA encryption of \"text\" as a Base64-encoded string\n// function RSAEncryptB64(text) {\n// var h = this.encrypt(text);\n// if(h) return hex2b64(h); else return null;\n// }\n// public\n// RSAKey.prototype.encrypt_b64 = RSAEncryptB64;\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsbn/rsa.js?"); + +/***/ }), + +/***/ "./lib/lib/jsbn/util.js": +/*!******************************!*\ + !*** ./lib/lib/jsbn/util.js ***! + \******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"cbit\": () => (/* binding */ cbit),\n/* harmony export */ \"int2char\": () => (/* binding */ int2char),\n/* harmony export */ \"lbit\": () => (/* binding */ lbit),\n/* harmony export */ \"op_and\": () => (/* binding */ op_and),\n/* harmony export */ \"op_andnot\": () => (/* binding */ op_andnot),\n/* harmony export */ \"op_or\": () => (/* binding */ op_or),\n/* harmony export */ \"op_xor\": () => (/* binding */ op_xor)\n/* harmony export */ });\nvar BI_RM = \"0123456789abcdefghijklmnopqrstuvwxyz\";\nfunction int2char(n) {\n return BI_RM.charAt(n);\n}\n//#region BIT_OPERATIONS\n// (public) this & a\nfunction op_and(x, y) {\n return x & y;\n}\n// (public) this | a\nfunction op_or(x, y) {\n return x | y;\n}\n// (public) this ^ a\nfunction op_xor(x, y) {\n return x ^ y;\n}\n// (public) this & ~a\nfunction op_andnot(x, y) {\n return x & ~y;\n}\n// return index of lowest 1-bit in x, x < 2^31\nfunction lbit(x) {\n if (x == 0) {\n return -1;\n }\n var r = 0;\n if ((x & 0xffff) == 0) {\n x >>= 16;\n r += 16;\n }\n if ((x & 0xff) == 0) {\n x >>= 8;\n r += 8;\n }\n if ((x & 0xf) == 0) {\n x >>= 4;\n r += 4;\n }\n if ((x & 3) == 0) {\n x >>= 2;\n r += 2;\n }\n if ((x & 1) == 0) {\n ++r;\n }\n return r;\n}\n// return number of 1 bits in x\nfunction cbit(x) {\n var r = 0;\n while (x != 0) {\n x &= x - 1;\n ++r;\n }\n return r;\n}\n//#endregion BIT_OPERATIONS\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsbn/util.js?"); + +/***/ }), + +/***/ "./lib/lib/jsrsasign/asn1-1.0.js": +/*!***************************************!*\ + !*** ./lib/lib/jsrsasign/asn1-1.0.js ***! + \***************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"KJUR\": () => (/* binding */ KJUR)\n/* harmony export */ });\n/* harmony import */ var _jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../jsbn/jsbn */ \"./lib/lib/jsbn/jsbn.js\");\n/* harmony import */ var _yahoo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./yahoo */ \"./lib/lib/jsrsasign/yahoo.js\");\n/* asn1-1.0.13.js (c) 2013-2017 Kenji Urushima | kjur.github.com/jsrsasign/license\n */\n/*\n * asn1.js - ASN.1 DER encoder classes\n *\n * Copyright (c) 2013-2017 Kenji Urushima (kenji.urushima@gmail.com)\n *\n * This software is licensed under the terms of the MIT License.\n * https://kjur.github.io/jsrsasign/license\n *\n * The above copyright and license notice shall be\n * included in all copies or substantial portions of the Software.\n */\n\n\n/**\n * @fileOverview\n * @name asn1-1.0.js\n * @author Kenji Urushima kenji.urushima@gmail.com\n * @version asn1 1.0.13 (2017-Jun-02)\n * @since jsrsasign 2.1\n * @license MIT License\n */\n/**\n * kjur's class library name space\n *

\n * This name space provides following name spaces:\n *

    \n *
  • {@link KJUR.asn1} - ASN.1 primitive hexadecimal encoder
  • \n *
  • {@link KJUR.asn1.x509} - ASN.1 structure for X.509 certificate and CRL
  • \n *
  • {@link KJUR.crypto} - Java Cryptographic Extension(JCE) style MessageDigest/Signature\n * class and utilities
  • \n *
\n *

\n * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.\n * @name KJUR\n * @namespace kjur's class library name space\n */\nvar KJUR = {};\n/**\n * kjur's ASN.1 class library name space\n *

\n * This is ITU-T X.690 ASN.1 DER encoder class library and\n * class structure and methods is very similar to\n * org.bouncycastle.asn1 package of\n * well known BouncyCaslte Cryptography Library.\n *

PROVIDING ASN.1 PRIMITIVES

\n * Here are ASN.1 DER primitive classes.\n *
    \n *
  • 0x01 {@link KJUR.asn1.DERBoolean}
  • \n *
  • 0x02 {@link KJUR.asn1.DERInteger}
  • \n *
  • 0x03 {@link KJUR.asn1.DERBitString}
  • \n *
  • 0x04 {@link KJUR.asn1.DEROctetString}
  • \n *
  • 0x05 {@link KJUR.asn1.DERNull}
  • \n *
  • 0x06 {@link KJUR.asn1.DERObjectIdentifier}
  • \n *
  • 0x0a {@link KJUR.asn1.DEREnumerated}
  • \n *
  • 0x0c {@link KJUR.asn1.DERUTF8String}
  • \n *
  • 0x12 {@link KJUR.asn1.DERNumericString}
  • \n *
  • 0x13 {@link KJUR.asn1.DERPrintableString}
  • \n *
  • 0x14 {@link KJUR.asn1.DERTeletexString}
  • \n *
  • 0x16 {@link KJUR.asn1.DERIA5String}
  • \n *
  • 0x17 {@link KJUR.asn1.DERUTCTime}
  • \n *
  • 0x18 {@link KJUR.asn1.DERGeneralizedTime}
  • \n *
  • 0x30 {@link KJUR.asn1.DERSequence}
  • \n *
  • 0x31 {@link KJUR.asn1.DERSet}
  • \n *
\n *

OTHER ASN.1 CLASSES

\n *
    \n *
  • {@link KJUR.asn1.ASN1Object}
  • \n *
  • {@link KJUR.asn1.DERAbstractString}
  • \n *
  • {@link KJUR.asn1.DERAbstractTime}
  • \n *
  • {@link KJUR.asn1.DERAbstractStructured}
  • \n *
  • {@link KJUR.asn1.DERTaggedObject}
  • \n *
\n *

SUB NAME SPACES

\n *
    \n *
  • {@link KJUR.asn1.cades} - CAdES long term signature format
  • \n *
  • {@link KJUR.asn1.cms} - Cryptographic Message Syntax
  • \n *
  • {@link KJUR.asn1.csr} - Certificate Signing Request (CSR/PKCS#10)
  • \n *
  • {@link KJUR.asn1.tsp} - RFC 3161 Timestamping Protocol Format
  • \n *
  • {@link KJUR.asn1.x509} - RFC 5280 X.509 certificate and CRL
  • \n *
\n *

\n * NOTE: Please ignore method summary and document of this namespace.\n * This caused by a bug of jsdoc2.\n * @name KJUR.asn1\n * @namespace\n */\nif (typeof KJUR.asn1 == \"undefined\" || !KJUR.asn1)\n KJUR.asn1 = {};\n/**\n * ASN1 utilities class\n * @name KJUR.asn1.ASN1Util\n * @class ASN1 utilities class\n * @since asn1 1.0.2\n */\nKJUR.asn1.ASN1Util = new function () {\n this.integerToByteHex = function (i) {\n var h = i.toString(16);\n if ((h.length % 2) == 1)\n h = '0' + h;\n return h;\n };\n this.bigIntToMinTwosComplementsHex = function (bigIntegerValue) {\n var h = bigIntegerValue.toString(16);\n if (h.substr(0, 1) != '-') {\n if (h.length % 2 == 1) {\n h = '0' + h;\n }\n else {\n if (!h.match(/^[0-7]/)) {\n h = '00' + h;\n }\n }\n }\n else {\n var hPos = h.substr(1);\n var xorLen = hPos.length;\n if (xorLen % 2 == 1) {\n xorLen += 1;\n }\n else {\n if (!h.match(/^[0-7]/)) {\n xorLen += 2;\n }\n }\n var hMask = '';\n for (var i = 0; i < xorLen; i++) {\n hMask += 'f';\n }\n var biMask = new _jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(hMask, 16);\n var biNeg = biMask.xor(bigIntegerValue).add(_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE);\n h = biNeg.toString(16).replace(/^-/, '');\n }\n return h;\n };\n /**\n * get PEM string from hexadecimal data and header string\n * @name getPEMStringFromHex\n * @memberOf KJUR.asn1.ASN1Util\n * @function\n * @param {String} dataHex hexadecimal string of PEM body\n * @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY')\n * @return {String} PEM formatted string of input data\n * @description\n * This method converts a hexadecimal string to a PEM string with\n * a specified header. Its line break will be CRLF(\"\\r\\n\").\n * @example\n * var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY');\n * // value of pem will be:\n * -----BEGIN PRIVATE KEY-----\n * YWFh\n * -----END PRIVATE KEY-----\n */\n this.getPEMStringFromHex = function (dataHex, pemHeader) {\n return hextopem(dataHex, pemHeader);\n };\n /**\n * generate ASN1Object specifed by JSON parameters\n * @name newObject\n * @memberOf KJUR.asn1.ASN1Util\n * @function\n * @param {Array} param JSON parameter to generate ASN1Object\n * @return {KJUR.asn1.ASN1Object} generated object\n * @since asn1 1.0.3\n * @description\n * generate any ASN1Object specified by JSON param\n * including ASN.1 primitive or structured.\n * Generally 'param' can be described as follows:\n *
\n * {TYPE-OF-ASNOBJ: ASN1OBJ-PARAMETER}\n *
\n * 'TYPE-OF-ASN1OBJ' can be one of following symbols:\n *
    \n *
  • 'bool' - DERBoolean
  • \n *
  • 'int' - DERInteger
  • \n *
  • 'bitstr' - DERBitString
  • \n *
  • 'octstr' - DEROctetString
  • \n *
  • 'null' - DERNull
  • \n *
  • 'oid' - DERObjectIdentifier
  • \n *
  • 'enum' - DEREnumerated
  • \n *
  • 'utf8str' - DERUTF8String
  • \n *
  • 'numstr' - DERNumericString
  • \n *
  • 'prnstr' - DERPrintableString
  • \n *
  • 'telstr' - DERTeletexString
  • \n *
  • 'ia5str' - DERIA5String
  • \n *
  • 'utctime' - DERUTCTime
  • \n *
  • 'gentime' - DERGeneralizedTime
  • \n *
  • 'seq' - DERSequence
  • \n *
  • 'set' - DERSet
  • \n *
  • 'tag' - DERTaggedObject
  • \n *
\n * @example\n * newObject({'prnstr': 'aaa'});\n * newObject({'seq': [{'int': 3}, {'prnstr': 'aaa'}]})\n * // ASN.1 Tagged Object\n * newObject({'tag': {'tag': 'a1',\n * 'explicit': true,\n * 'obj': {'seq': [{'int': 3}, {'prnstr': 'aaa'}]}}});\n * // more simple representation of ASN.1 Tagged Object\n * newObject({'tag': ['a1',\n * true,\n * {'seq': [\n * {'int': 3},\n * {'prnstr': 'aaa'}]}\n * ]});\n */\n this.newObject = function (param) {\n var _KJUR = KJUR, _KJUR_asn1 = _KJUR.asn1, _DERBoolean = _KJUR_asn1.DERBoolean, _DERInteger = _KJUR_asn1.DERInteger, _DERBitString = _KJUR_asn1.DERBitString, _DEROctetString = _KJUR_asn1.DEROctetString, _DERNull = _KJUR_asn1.DERNull, _DERObjectIdentifier = _KJUR_asn1.DERObjectIdentifier, _DEREnumerated = _KJUR_asn1.DEREnumerated, _DERUTF8String = _KJUR_asn1.DERUTF8String, _DERNumericString = _KJUR_asn1.DERNumericString, _DERPrintableString = _KJUR_asn1.DERPrintableString, _DERTeletexString = _KJUR_asn1.DERTeletexString, _DERIA5String = _KJUR_asn1.DERIA5String, _DERUTCTime = _KJUR_asn1.DERUTCTime, _DERGeneralizedTime = _KJUR_asn1.DERGeneralizedTime, _DERSequence = _KJUR_asn1.DERSequence, _DERSet = _KJUR_asn1.DERSet, _DERTaggedObject = _KJUR_asn1.DERTaggedObject, _newObject = _KJUR_asn1.ASN1Util.newObject;\n var keys = Object.keys(param);\n if (keys.length != 1)\n throw \"key of param shall be only one.\";\n var key = keys[0];\n if (\":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:\".indexOf(\":\" + key + \":\") == -1)\n throw \"undefined key: \" + key;\n if (key == \"bool\")\n return new _DERBoolean(param[key]);\n if (key == \"int\")\n return new _DERInteger(param[key]);\n if (key == \"bitstr\")\n return new _DERBitString(param[key]);\n if (key == \"octstr\")\n return new _DEROctetString(param[key]);\n if (key == \"null\")\n return new _DERNull(param[key]);\n if (key == \"oid\")\n return new _DERObjectIdentifier(param[key]);\n if (key == \"enum\")\n return new _DEREnumerated(param[key]);\n if (key == \"utf8str\")\n return new _DERUTF8String(param[key]);\n if (key == \"numstr\")\n return new _DERNumericString(param[key]);\n if (key == \"prnstr\")\n return new _DERPrintableString(param[key]);\n if (key == \"telstr\")\n return new _DERTeletexString(param[key]);\n if (key == \"ia5str\")\n return new _DERIA5String(param[key]);\n if (key == \"utctime\")\n return new _DERUTCTime(param[key]);\n if (key == \"gentime\")\n return new _DERGeneralizedTime(param[key]);\n if (key == \"seq\") {\n var paramList = param[key];\n var a = [];\n for (var i = 0; i < paramList.length; i++) {\n var asn1Obj = _newObject(paramList[i]);\n a.push(asn1Obj);\n }\n return new _DERSequence({ 'array': a });\n }\n if (key == \"set\") {\n var paramList = param[key];\n var a = [];\n for (var i = 0; i < paramList.length; i++) {\n var asn1Obj = _newObject(paramList[i]);\n a.push(asn1Obj);\n }\n return new _DERSet({ 'array': a });\n }\n if (key == \"tag\") {\n var tagParam = param[key];\n if (Object.prototype.toString.call(tagParam) === '[object Array]' &&\n tagParam.length == 3) {\n var obj = _newObject(tagParam[2]);\n return new _DERTaggedObject({ tag: tagParam[0],\n explicit: tagParam[1],\n obj: obj });\n }\n else {\n var newParam = {};\n if (tagParam.explicit !== undefined)\n newParam.explicit = tagParam.explicit;\n if (tagParam.tag !== undefined)\n newParam.tag = tagParam.tag;\n if (tagParam.obj === undefined)\n throw \"obj shall be specified for 'tag'.\";\n newParam.obj = _newObject(tagParam.obj);\n return new _DERTaggedObject(newParam);\n }\n }\n };\n /**\n * get encoded hexadecimal string of ASN1Object specifed by JSON parameters\n * @name jsonToASN1HEX\n * @memberOf KJUR.asn1.ASN1Util\n * @function\n * @param {Array} param JSON parameter to generate ASN1Object\n * @return hexadecimal string of ASN1Object\n * @since asn1 1.0.4\n * @description\n * As for ASN.1 object representation of JSON object,\n * please see {@link newObject}.\n * @example\n * jsonToASN1HEX({'prnstr': 'aaa'});\n */\n this.jsonToASN1HEX = function (param) {\n var asn1Obj = this.newObject(param);\n return asn1Obj.getEncodedHex();\n };\n};\n/**\n * get dot noted oid number string from hexadecimal value of OID\n * @name oidHexToInt\n * @memberOf KJUR.asn1.ASN1Util\n * @function\n * @param {String} hex hexadecimal value of object identifier\n * @return {String} dot noted string of object identifier\n * @since jsrsasign 4.8.3 asn1 1.0.7\n * @description\n * This static method converts from hexadecimal string representation of\n * ASN.1 value of object identifier to oid number string.\n * @example\n * KJUR.asn1.ASN1Util.oidHexToInt('550406') → \"2.5.4.6\"\n */\nKJUR.asn1.ASN1Util.oidHexToInt = function (hex) {\n var s = \"\";\n var i01 = parseInt(hex.substr(0, 2), 16);\n var i0 = Math.floor(i01 / 40);\n var i1 = i01 % 40;\n var s = i0 + \".\" + i1;\n var binbuf = \"\";\n for (var i = 2; i < hex.length; i += 2) {\n var value = parseInt(hex.substr(i, 2), 16);\n var bin = (\"00000000\" + value.toString(2)).slice(-8);\n binbuf = binbuf + bin.substr(1, 7);\n if (bin.substr(0, 1) == \"0\") {\n var bi = new _jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(binbuf, 2);\n s = s + \".\" + bi.toString(10);\n binbuf = \"\";\n }\n }\n ;\n return s;\n};\n/**\n * get hexadecimal value of object identifier from dot noted oid value\n * @name oidIntToHex\n * @memberOf KJUR.asn1.ASN1Util\n * @function\n * @param {String} oidString dot noted string of object identifier\n * @return {String} hexadecimal value of object identifier\n * @since jsrsasign 4.8.3 asn1 1.0.7\n * @description\n * This static method converts from object identifier value string.\n * to hexadecimal string representation of it.\n * @example\n * KJUR.asn1.ASN1Util.oidIntToHex(\"2.5.4.6\") → \"550406\"\n */\nKJUR.asn1.ASN1Util.oidIntToHex = function (oidString) {\n var itox = function (i) {\n var h = i.toString(16);\n if (h.length == 1)\n h = '0' + h;\n return h;\n };\n var roidtox = function (roid) {\n var h = '';\n var bi = new _jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(roid, 10);\n var b = bi.toString(2);\n var padLen = 7 - b.length % 7;\n if (padLen == 7)\n padLen = 0;\n var bPad = '';\n for (var i = 0; i < padLen; i++)\n bPad += '0';\n b = bPad + b;\n for (var i = 0; i < b.length - 1; i += 7) {\n var b8 = b.substr(i, 7);\n if (i != b.length - 7)\n b8 = '1' + b8;\n h += itox(parseInt(b8, 2));\n }\n return h;\n };\n if (!oidString.match(/^[0-9.]+$/)) {\n throw \"malformed oid string: \" + oidString;\n }\n var h = '';\n var a = oidString.split('.');\n var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);\n h += itox(i0);\n a.splice(0, 2);\n for (var i = 0; i < a.length; i++) {\n h += roidtox(a[i]);\n }\n return h;\n};\n// ********************************************************************\n// Abstract ASN.1 Classes\n// ********************************************************************\n// ********************************************************************\n/**\n * base class for ASN.1 DER encoder object\n * @name KJUR.asn1.ASN1Object\n * @class base class for ASN.1 DER encoder object\n * @property {Boolean} isModified flag whether internal data was changed\n * @property {String} hTLV hexadecimal string of ASN.1 TLV\n * @property {String} hT hexadecimal string of ASN.1 TLV tag(T)\n * @property {String} hL hexadecimal string of ASN.1 TLV length(L)\n * @property {String} hV hexadecimal string of ASN.1 TLV value(V)\n * @description\n */\nKJUR.asn1.ASN1Object = function () {\n var isModified = true;\n var hTLV = null;\n var hT = '00';\n var hL = '00';\n var hV = '';\n /**\n * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V)\n * @name getLengthHexFromValue\n * @memberOf KJUR.asn1.ASN1Object#\n * @function\n * @return {String} hexadecimal string of ASN.1 TLV length(L)\n */\n this.getLengthHexFromValue = function () {\n if (typeof this.hV == \"undefined\" || this.hV == null) {\n throw \"this.hV is null or undefined.\";\n }\n if (this.hV.length % 2 == 1) {\n throw \"value hex must be even length: n=\" + hV.length + \",v=\" + this.hV;\n }\n var n = this.hV.length / 2;\n var hN = n.toString(16);\n if (hN.length % 2 == 1) {\n hN = \"0\" + hN;\n }\n if (n < 128) {\n return hN;\n }\n else {\n var hNlen = hN.length / 2;\n if (hNlen > 15) {\n throw \"ASN.1 length too long to represent by 8x: n = \" + n.toString(16);\n }\n var head = 128 + hNlen;\n return head.toString(16) + hN;\n }\n };\n /**\n * get hexadecimal string of ASN.1 TLV bytes\n * @name getEncodedHex\n * @memberOf KJUR.asn1.ASN1Object#\n * @function\n * @return {String} hexadecimal string of ASN.1 TLV\n */\n this.getEncodedHex = function () {\n if (this.hTLV == null || this.isModified) {\n this.hV = this.getFreshValueHex();\n this.hL = this.getLengthHexFromValue();\n this.hTLV = this.hT + this.hL + this.hV;\n this.isModified = false;\n //alert(\"first time: \" + this.hTLV);\n }\n return this.hTLV;\n };\n /**\n * get hexadecimal string of ASN.1 TLV value(V) bytes\n * @name getValueHex\n * @memberOf KJUR.asn1.ASN1Object#\n * @function\n * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes\n */\n this.getValueHex = function () {\n this.getEncodedHex();\n return this.hV;\n };\n this.getFreshValueHex = function () {\n return '';\n };\n};\n// == BEGIN DERAbstractString ================================================\n/**\n * base class for ASN.1 DER string classes\n * @name KJUR.asn1.DERAbstractString\n * @class base class for ASN.1 DER string classes\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @property {String} s internal string of value\n * @extends KJUR.asn1.ASN1Object\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • str - specify initial ASN.1 value(V) by a string
  • \n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \n *
\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERAbstractString = function (params) {\n KJUR.asn1.DERAbstractString.superclass.constructor.call(this);\n var s = null;\n var hV = null;\n /**\n * get string value of this string object\n * @name getString\n * @memberOf KJUR.asn1.DERAbstractString#\n * @function\n * @return {String} string value of this string object\n */\n this.getString = function () {\n return this.s;\n };\n /**\n * set value by a string\n * @name setString\n * @memberOf KJUR.asn1.DERAbstractString#\n * @function\n * @param {String} newS value by a string to set\n */\n this.setString = function (newS) {\n this.hTLV = null;\n this.isModified = true;\n this.s = newS;\n this.hV = stohex(this.s);\n };\n /**\n * set value by a hexadecimal string\n * @name setStringHex\n * @memberOf KJUR.asn1.DERAbstractString#\n * @function\n * @param {String} newHexString value by a hexadecimal string to set\n */\n this.setStringHex = function (newHexString) {\n this.hTLV = null;\n this.isModified = true;\n this.s = null;\n this.hV = newHexString;\n };\n this.getFreshValueHex = function () {\n return this.hV;\n };\n if (typeof params != \"undefined\") {\n if (typeof params == \"string\") {\n this.setString(params);\n }\n else if (typeof params['str'] != \"undefined\") {\n this.setString(params['str']);\n }\n else if (typeof params['hex'] != \"undefined\") {\n this.setStringHex(params['hex']);\n }\n }\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object);\n// == END DERAbstractString ================================================\n// == BEGIN DERAbstractTime ==================================================\n/**\n * base class for ASN.1 DER Generalized/UTCTime class\n * @name KJUR.asn1.DERAbstractTime\n * @class base class for ASN.1 DER Generalized/UTCTime class\n * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERAbstractTime = function (params) {\n KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);\n var s = null;\n var date = null;\n // --- PRIVATE METHODS --------------------\n this.localDateToUTC = function (d) {\n utc = d.getTime() + (d.getTimezoneOffset() * 60000);\n var utcDate = new Date(utc);\n return utcDate;\n };\n /*\n * format date string by Data object\n * @name formatDate\n * @memberOf KJUR.asn1.AbstractTime;\n * @param {Date} dateObject\n * @param {string} type 'utc' or 'gen'\n * @param {boolean} withMillis flag for with millisections or not\n * @description\n * 'withMillis' flag is supported from asn1 1.0.6.\n */\n this.formatDate = function (dateObject, type, withMillis) {\n var pad = this.zeroPadding;\n var d = this.localDateToUTC(dateObject);\n var year = String(d.getFullYear());\n if (type == 'utc')\n year = year.substr(2, 2);\n var month = pad(String(d.getMonth() + 1), 2);\n var day = pad(String(d.getDate()), 2);\n var hour = pad(String(d.getHours()), 2);\n var min = pad(String(d.getMinutes()), 2);\n var sec = pad(String(d.getSeconds()), 2);\n var s = year + month + day + hour + min + sec;\n if (withMillis === true) {\n var millis = d.getMilliseconds();\n if (millis != 0) {\n var sMillis = pad(String(millis), 3);\n sMillis = sMillis.replace(/[0]+$/, \"\");\n s = s + \".\" + sMillis;\n }\n }\n return s + \"Z\";\n };\n this.zeroPadding = function (s, len) {\n if (s.length >= len)\n return s;\n return new Array(len - s.length + 1).join('0') + s;\n };\n // --- PUBLIC METHODS --------------------\n /**\n * get string value of this string object\n * @name getString\n * @memberOf KJUR.asn1.DERAbstractTime#\n * @function\n * @return {String} string value of this time object\n */\n this.getString = function () {\n return this.s;\n };\n /**\n * set value by a string\n * @name setString\n * @memberOf KJUR.asn1.DERAbstractTime#\n * @function\n * @param {String} newS value by a string to set such like \"130430235959Z\"\n */\n this.setString = function (newS) {\n this.hTLV = null;\n this.isModified = true;\n this.s = newS;\n this.hV = stohex(newS);\n };\n /**\n * set value by a Date object\n * @name setByDateValue\n * @memberOf KJUR.asn1.DERAbstractTime#\n * @function\n * @param {Integer} year year of date (ex. 2013)\n * @param {Integer} month month of date between 1 and 12 (ex. 12)\n * @param {Integer} day day of month\n * @param {Integer} hour hours of date\n * @param {Integer} min minutes of date\n * @param {Integer} sec seconds of date\n */\n this.setByDateValue = function (year, month, day, hour, min, sec) {\n var dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0));\n this.setByDate(dateObject);\n };\n this.getFreshValueHex = function () {\n return this.hV;\n };\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object);\n// == END DERAbstractTime ==================================================\n// == BEGIN DERAbstractStructured ============================================\n/**\n * base class for ASN.1 DER structured class\n * @name KJUR.asn1.DERAbstractStructured\n * @class base class for ASN.1 DER structured class\n * @property {Array} asn1Array internal array of ASN1Object\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERAbstractStructured = function (params) {\n KJUR.asn1.DERAbstractString.superclass.constructor.call(this);\n var asn1Array = null;\n /**\n * set value by array of ASN1Object\n * @name setByASN1ObjectArray\n * @memberOf KJUR.asn1.DERAbstractStructured#\n * @function\n * @param {array} asn1ObjectArray array of ASN1Object to set\n */\n this.setByASN1ObjectArray = function (asn1ObjectArray) {\n this.hTLV = null;\n this.isModified = true;\n this.asn1Array = asn1ObjectArray;\n };\n /**\n * append an ASN1Object to internal array\n * @name appendASN1Object\n * @memberOf KJUR.asn1.DERAbstractStructured#\n * @function\n * @param {ASN1Object} asn1Object to add\n */\n this.appendASN1Object = function (asn1Object) {\n this.hTLV = null;\n this.isModified = true;\n this.asn1Array.push(asn1Object);\n };\n this.asn1Array = new Array();\n if (typeof params != \"undefined\") {\n if (typeof params['array'] != \"undefined\") {\n this.asn1Array = params['array'];\n }\n }\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object);\n// ********************************************************************\n// ASN.1 Object Classes\n// ********************************************************************\n// ********************************************************************\n/**\n * class for ASN.1 DER Boolean\n * @name KJUR.asn1.DERBoolean\n * @class class for ASN.1 DER Boolean\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERBoolean = function () {\n KJUR.asn1.DERBoolean.superclass.constructor.call(this);\n this.hT = \"01\";\n this.hTLV = \"0101ff\";\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object);\n// ********************************************************************\n/**\n * class for ASN.1 DER Integer\n * @name KJUR.asn1.DERInteger\n * @class class for ASN.1 DER Integer\n * @extends KJUR.asn1.ASN1Object\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • int - specify initial ASN.1 value(V) by integer value
  • \n *
  • bigint - specify initial ASN.1 value(V) by BigInteger object
  • \n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \n *
\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERInteger = function (params) {\n KJUR.asn1.DERInteger.superclass.constructor.call(this);\n this.hT = \"02\";\n /**\n * set value by Tom Wu's BigInteger object\n * @name setByBigInteger\n * @memberOf KJUR.asn1.DERInteger#\n * @function\n * @param {BigInteger} bigIntegerValue to set\n */\n this.setByBigInteger = function (bigIntegerValue) {\n this.hTLV = null;\n this.isModified = true;\n this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);\n };\n /**\n * set value by integer value\n * @name setByInteger\n * @memberOf KJUR.asn1.DERInteger\n * @function\n * @param {Integer} integer value to set\n */\n this.setByInteger = function (intValue) {\n var bi = new _jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(String(intValue), 10);\n this.setByBigInteger(bi);\n };\n /**\n * set value by integer value\n * @name setValueHex\n * @memberOf KJUR.asn1.DERInteger#\n * @function\n * @param {String} hexadecimal string of integer value\n * @description\n *
\n * NOTE: Value shall be represented by minimum octet length of\n * two's complement representation.\n * @example\n * new KJUR.asn1.DERInteger(123);\n * new KJUR.asn1.DERInteger({'int': 123});\n * new KJUR.asn1.DERInteger({'hex': '1fad'});\n */\n this.setValueHex = function (newHexString) {\n this.hV = newHexString;\n };\n this.getFreshValueHex = function () {\n return this.hV;\n };\n if (typeof params != \"undefined\") {\n if (typeof params['bigint'] != \"undefined\") {\n this.setByBigInteger(params['bigint']);\n }\n else if (typeof params['int'] != \"undefined\") {\n this.setByInteger(params['int']);\n }\n else if (typeof params == \"number\") {\n this.setByInteger(params);\n }\n else if (typeof params['hex'] != \"undefined\") {\n this.setValueHex(params['hex']);\n }\n }\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object);\n// ********************************************************************\n/**\n * class for ASN.1 DER encoded BitString primitive\n * @name KJUR.asn1.DERBitString\n * @class class for ASN.1 DER encoded BitString primitive\n * @extends KJUR.asn1.ASN1Object\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • bin - specify binary string (ex. '10111')
  • \n *
  • array - specify array of boolean (ex. [true,false,true,true])
  • \n *
  • hex - specify hexadecimal string of ASN.1 value(V) including unused bits
  • \n *
  • obj - specify {@link KJUR.asn1.ASN1Util.newObject}\n * argument for \"BitString encapsulates\" structure.
  • \n *
\n * NOTE1: 'params' can be omitted.
\n * NOTE2: 'obj' parameter have been supported since\n * asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).
\n * @example\n * // default constructor\n * o = new KJUR.asn1.DERBitString();\n * // initialize with binary string\n * o = new KJUR.asn1.DERBitString({bin: \"1011\"});\n * // initialize with boolean array\n * o = new KJUR.asn1.DERBitString({array: [true,false,true,true]});\n * // initialize with hexadecimal string (04 is unused bits)\n * o = new KJUR.asn1.DEROctetString({hex: \"04bac0\"});\n * // initialize with ASN1Util.newObject argument for encapsulated\n * o = new KJUR.asn1.DERBitString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}});\n * // above generates a ASN.1 data like this:\n * // BIT STRING, encapsulates {\n * // SEQUENCE {\n * // INTEGER 3\n * // PrintableString 'aaa'\n * // }\n * // }\n */\nKJUR.asn1.DERBitString = function (params) {\n if (params !== undefined && typeof params.obj !== \"undefined\") {\n var o = KJUR.asn1.ASN1Util.newObject(params.obj);\n params.hex = \"00\" + o.getEncodedHex();\n }\n KJUR.asn1.DERBitString.superclass.constructor.call(this);\n this.hT = \"03\";\n /**\n * set ASN.1 value(V) by a hexadecimal string including unused bits\n * @name setHexValueIncludingUnusedBits\n * @memberOf KJUR.asn1.DERBitString#\n * @function\n * @param {String} newHexStringIncludingUnusedBits\n */\n this.setHexValueIncludingUnusedBits = function (newHexStringIncludingUnusedBits) {\n this.hTLV = null;\n this.isModified = true;\n this.hV = newHexStringIncludingUnusedBits;\n };\n /**\n * set ASN.1 value(V) by unused bit and hexadecimal string of value\n * @name setUnusedBitsAndHexValue\n * @memberOf KJUR.asn1.DERBitString#\n * @function\n * @param {Integer} unusedBits\n * @param {String} hValue\n */\n this.setUnusedBitsAndHexValue = function (unusedBits, hValue) {\n if (unusedBits < 0 || 7 < unusedBits) {\n throw \"unused bits shall be from 0 to 7: u = \" + unusedBits;\n }\n var hUnusedBits = \"0\" + unusedBits;\n this.hTLV = null;\n this.isModified = true;\n this.hV = hUnusedBits + hValue;\n };\n /**\n * set ASN.1 DER BitString by binary string
\n * @name setByBinaryString\n * @memberOf KJUR.asn1.DERBitString#\n * @function\n * @param {String} binaryString binary value string (i.e. '10111')\n * @description\n * Its unused bits will be calculated automatically by length of\n * 'binaryValue'.
\n * NOTE: Trailing zeros '0' will be ignored.\n * @example\n * o = new KJUR.asn1.DERBitString();\n * o.setByBooleanArray(\"01011\");\n */\n this.setByBinaryString = function (binaryString) {\n binaryString = binaryString.replace(/0+$/, '');\n var unusedBits = 8 - binaryString.length % 8;\n if (unusedBits == 8)\n unusedBits = 0;\n for (var i = 0; i <= unusedBits; i++) {\n binaryString += '0';\n }\n var h = '';\n for (var i = 0; i < binaryString.length - 1; i += 8) {\n var b = binaryString.substr(i, 8);\n var x = parseInt(b, 2).toString(16);\n if (x.length == 1)\n x = '0' + x;\n h += x;\n }\n this.hTLV = null;\n this.isModified = true;\n this.hV = '0' + unusedBits + h;\n };\n /**\n * set ASN.1 TLV value(V) by an array of boolean
\n * @name setByBooleanArray\n * @memberOf KJUR.asn1.DERBitString#\n * @function\n * @param {array} booleanArray array of boolean (ex. [true, false, true])\n * @description\n * NOTE: Trailing falses will be ignored in the ASN.1 DER Object.\n * @example\n * o = new KJUR.asn1.DERBitString();\n * o.setByBooleanArray([false, true, false, true, true]);\n */\n this.setByBooleanArray = function (booleanArray) {\n var s = '';\n for (var i = 0; i < booleanArray.length; i++) {\n if (booleanArray[i] == true) {\n s += '1';\n }\n else {\n s += '0';\n }\n }\n this.setByBinaryString(s);\n };\n /**\n * generate an array of falses with specified length
\n * @name newFalseArray\n * @memberOf KJUR.asn1.DERBitString\n * @function\n * @param {Integer} nLength length of array to generate\n * @return {array} array of boolean falses\n * @description\n * This static method may be useful to initialize boolean array.\n * @example\n * o = new KJUR.asn1.DERBitString();\n * o.newFalseArray(3) → [false, false, false]\n */\n this.newFalseArray = function (nLength) {\n var a = new Array(nLength);\n for (var i = 0; i < nLength; i++) {\n a[i] = false;\n }\n return a;\n };\n this.getFreshValueHex = function () {\n return this.hV;\n };\n if (typeof params != \"undefined\") {\n if (typeof params == \"string\" && params.toLowerCase().match(/^[0-9a-f]+$/)) {\n this.setHexValueIncludingUnusedBits(params);\n }\n else if (typeof params['hex'] != \"undefined\") {\n this.setHexValueIncludingUnusedBits(params['hex']);\n }\n else if (typeof params['bin'] != \"undefined\") {\n this.setByBinaryString(params['bin']);\n }\n else if (typeof params['array'] != \"undefined\") {\n this.setByBooleanArray(params['array']);\n }\n }\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object);\n// ********************************************************************\n/**\n * class for ASN.1 DER OctetString
\n * @name KJUR.asn1.DEROctetString\n * @class class for ASN.1 DER OctetString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * This class provides ASN.1 OctetString simple type.
\n * Supported \"params\" attributes are:\n *
    \n *
  • str - to set a string as a value
  • \n *
  • hex - to set a hexadecimal string as a value
  • \n *
  • obj - to set a encapsulated ASN.1 value by JSON object\n * which is defined in {@link KJUR.asn1.ASN1Util.newObject}
  • \n *
\n * NOTE: A parameter 'obj' have been supported\n * for \"OCTET STRING, encapsulates\" structure.\n * since asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).\n * @see KJUR.asn1.DERAbstractString - superclass\n * @example\n * // default constructor\n * o = new KJUR.asn1.DEROctetString();\n * // initialize with string\n * o = new KJUR.asn1.DEROctetString({str: \"aaa\"});\n * // initialize with hexadecimal string\n * o = new KJUR.asn1.DEROctetString({hex: \"616161\"});\n * // initialize with ASN1Util.newObject argument\n * o = new KJUR.asn1.DEROctetString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}});\n * // above generates a ASN.1 data like this:\n * // OCTET STRING, encapsulates {\n * // SEQUENCE {\n * // INTEGER 3\n * // PrintableString 'aaa'\n * // }\n * // }\n */\nKJUR.asn1.DEROctetString = function (params) {\n if (params !== undefined && typeof params.obj !== \"undefined\") {\n var o = KJUR.asn1.ASN1Util.newObject(params.obj);\n params.hex = o.getEncodedHex();\n }\n KJUR.asn1.DEROctetString.superclass.constructor.call(this, params);\n this.hT = \"04\";\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString);\n// ********************************************************************\n/**\n * class for ASN.1 DER Null\n * @name KJUR.asn1.DERNull\n * @class class for ASN.1 DER Null\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERNull = function () {\n KJUR.asn1.DERNull.superclass.constructor.call(this);\n this.hT = \"05\";\n this.hTLV = \"0500\";\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object);\n// ********************************************************************\n/**\n * class for ASN.1 DER ObjectIdentifier\n * @name KJUR.asn1.DERObjectIdentifier\n * @class class for ASN.1 DER ObjectIdentifier\n * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'})\n * @extends KJUR.asn1.ASN1Object\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)
  • \n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \n *
\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERObjectIdentifier = function (params) {\n var itox = function (i) {\n var h = i.toString(16);\n if (h.length == 1)\n h = '0' + h;\n return h;\n };\n var roidtox = function (roid) {\n var h = '';\n var bi = new _jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(roid, 10);\n var b = bi.toString(2);\n var padLen = 7 - b.length % 7;\n if (padLen == 7)\n padLen = 0;\n var bPad = '';\n for (var i = 0; i < padLen; i++)\n bPad += '0';\n b = bPad + b;\n for (var i = 0; i < b.length - 1; i += 7) {\n var b8 = b.substr(i, 7);\n if (i != b.length - 7)\n b8 = '1' + b8;\n h += itox(parseInt(b8, 2));\n }\n return h;\n };\n KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this);\n this.hT = \"06\";\n /**\n * set value by a hexadecimal string\n * @name setValueHex\n * @memberOf KJUR.asn1.DERObjectIdentifier#\n * @function\n * @param {String} newHexString hexadecimal value of OID bytes\n */\n this.setValueHex = function (newHexString) {\n this.hTLV = null;\n this.isModified = true;\n this.s = null;\n this.hV = newHexString;\n };\n /**\n * set value by a OID string
\n * @name setValueOidString\n * @memberOf KJUR.asn1.DERObjectIdentifier#\n * @function\n * @param {String} oidString OID string (ex. 2.5.4.13)\n * @example\n * o = new KJUR.asn1.DERObjectIdentifier();\n * o.setValueOidString(\"2.5.4.13\");\n */\n this.setValueOidString = function (oidString) {\n if (!oidString.match(/^[0-9.]+$/)) {\n throw \"malformed oid string: \" + oidString;\n }\n var h = '';\n var a = oidString.split('.');\n var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);\n h += itox(i0);\n a.splice(0, 2);\n for (var i = 0; i < a.length; i++) {\n h += roidtox(a[i]);\n }\n this.hTLV = null;\n this.isModified = true;\n this.s = null;\n this.hV = h;\n };\n /**\n * set value by a OID name\n * @name setValueName\n * @memberOf KJUR.asn1.DERObjectIdentifier#\n * @function\n * @param {String} oidName OID name (ex. 'serverAuth')\n * @since 1.0.1\n * @description\n * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'.\n * Otherwise raise error.\n * @example\n * o = new KJUR.asn1.DERObjectIdentifier();\n * o.setValueName(\"serverAuth\");\n */\n this.setValueName = function (oidName) {\n var oid = KJUR.asn1.x509.OID.name2oid(oidName);\n if (oid !== '') {\n this.setValueOidString(oid);\n }\n else {\n throw \"DERObjectIdentifier oidName undefined: \" + oidName;\n }\n };\n this.getFreshValueHex = function () {\n return this.hV;\n };\n if (params !== undefined) {\n if (typeof params === \"string\") {\n if (params.match(/^[0-2].[0-9.]+$/)) {\n this.setValueOidString(params);\n }\n else {\n this.setValueName(params);\n }\n }\n else if (params.oid !== undefined) {\n this.setValueOidString(params.oid);\n }\n else if (params.hex !== undefined) {\n this.setValueHex(params.hex);\n }\n else if (params.name !== undefined) {\n this.setValueName(params.name);\n }\n }\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object);\n// ********************************************************************\n/**\n * class for ASN.1 DER Enumerated\n * @name KJUR.asn1.DEREnumerated\n * @class class for ASN.1 DER Enumerated\n * @extends KJUR.asn1.ASN1Object\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • int - specify initial ASN.1 value(V) by integer value
  • \n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \n *
\n * NOTE: 'params' can be omitted.\n * @example\n * new KJUR.asn1.DEREnumerated(123);\n * new KJUR.asn1.DEREnumerated({int: 123});\n * new KJUR.asn1.DEREnumerated({hex: '1fad'});\n */\nKJUR.asn1.DEREnumerated = function (params) {\n KJUR.asn1.DEREnumerated.superclass.constructor.call(this);\n this.hT = \"0a\";\n /**\n * set value by Tom Wu's BigInteger object\n * @name setByBigInteger\n * @memberOf KJUR.asn1.DEREnumerated#\n * @function\n * @param {BigInteger} bigIntegerValue to set\n */\n this.setByBigInteger = function (bigIntegerValue) {\n this.hTLV = null;\n this.isModified = true;\n this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);\n };\n /**\n * set value by integer value\n * @name setByInteger\n * @memberOf KJUR.asn1.DEREnumerated#\n * @function\n * @param {Integer} integer value to set\n */\n this.setByInteger = function (intValue) {\n var bi = new _jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(String(intValue), 10);\n this.setByBigInteger(bi);\n };\n /**\n * set value by integer value\n * @name setValueHex\n * @memberOf KJUR.asn1.DEREnumerated#\n * @function\n * @param {String} hexadecimal string of integer value\n * @description\n *
\n * NOTE: Value shall be represented by minimum octet length of\n * two's complement representation.\n */\n this.setValueHex = function (newHexString) {\n this.hV = newHexString;\n };\n this.getFreshValueHex = function () {\n return this.hV;\n };\n if (typeof params != \"undefined\") {\n if (typeof params['int'] != \"undefined\") {\n this.setByInteger(params['int']);\n }\n else if (typeof params == \"number\") {\n this.setByInteger(params);\n }\n else if (typeof params['hex'] != \"undefined\") {\n this.setValueHex(params['hex']);\n }\n }\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object);\n// ********************************************************************\n/**\n * class for ASN.1 DER UTF8String\n * @name KJUR.asn1.DERUTF8String\n * @class class for ASN.1 DER UTF8String\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERUTF8String = function (params) {\n KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params);\n this.hT = \"0c\";\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString);\n// ********************************************************************\n/**\n * class for ASN.1 DER NumericString\n * @name KJUR.asn1.DERNumericString\n * @class class for ASN.1 DER NumericString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERNumericString = function (params) {\n KJUR.asn1.DERNumericString.superclass.constructor.call(this, params);\n this.hT = \"12\";\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString);\n// ********************************************************************\n/**\n * class for ASN.1 DER PrintableString\n * @name KJUR.asn1.DERPrintableString\n * @class class for ASN.1 DER PrintableString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERPrintableString = function (params) {\n KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params);\n this.hT = \"13\";\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString);\n// ********************************************************************\n/**\n * class for ASN.1 DER TeletexString\n * @name KJUR.asn1.DERTeletexString\n * @class class for ASN.1 DER TeletexString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERTeletexString = function (params) {\n KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params);\n this.hT = \"14\";\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString);\n// ********************************************************************\n/**\n * class for ASN.1 DER IA5String\n * @name KJUR.asn1.DERIA5String\n * @class class for ASN.1 DER IA5String\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERIA5String = function (params) {\n KJUR.asn1.DERIA5String.superclass.constructor.call(this, params);\n this.hT = \"16\";\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString);\n// ********************************************************************\n/**\n * class for ASN.1 DER UTCTime\n * @name KJUR.asn1.DERUTCTime\n * @class class for ASN.1 DER UTCTime\n * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})\n * @extends KJUR.asn1.DERAbstractTime\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')
  • \n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \n *
  • date - specify Date object.
  • \n *
\n * NOTE: 'params' can be omitted.\n *

EXAMPLES

\n * @example\n * d1 = new KJUR.asn1.DERUTCTime();\n * d1.setString('130430125959Z');\n *\n * d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'});\n * d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))});\n * d4 = new KJUR.asn1.DERUTCTime('130430125959Z');\n */\nKJUR.asn1.DERUTCTime = function (params) {\n KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params);\n this.hT = \"17\";\n /**\n * set value by a Date object
\n * @name setByDate\n * @memberOf KJUR.asn1.DERUTCTime#\n * @function\n * @param {Date} dateObject Date object to set ASN.1 value(V)\n * @example\n * o = new KJUR.asn1.DERUTCTime();\n * o.setByDate(new Date(\"2016/12/31\"));\n */\n this.setByDate = function (dateObject) {\n this.hTLV = null;\n this.isModified = true;\n this.date = dateObject;\n this.s = this.formatDate(this.date, 'utc');\n this.hV = stohex(this.s);\n };\n this.getFreshValueHex = function () {\n if (typeof this.date == \"undefined\" && typeof this.s == \"undefined\") {\n this.date = new Date();\n this.s = this.formatDate(this.date, 'utc');\n this.hV = stohex(this.s);\n }\n return this.hV;\n };\n if (params !== undefined) {\n if (params.str !== undefined) {\n this.setString(params.str);\n }\n else if (typeof params == \"string\" && params.match(/^[0-9]{12}Z$/)) {\n this.setString(params);\n }\n else if (params.hex !== undefined) {\n this.setStringHex(params.hex);\n }\n else if (params.date !== undefined) {\n this.setByDate(params.date);\n }\n }\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime);\n// ********************************************************************\n/**\n * class for ASN.1 DER GeneralizedTime\n * @name KJUR.asn1.DERGeneralizedTime\n * @class class for ASN.1 DER GeneralizedTime\n * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'})\n * @property {Boolean} withMillis flag to show milliseconds or not\n * @extends KJUR.asn1.DERAbstractTime\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')
  • \n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \n *
  • date - specify Date object.
  • \n *
  • millis - specify flag to show milliseconds (from 1.0.6)
  • \n *
\n * NOTE1: 'params' can be omitted.\n * NOTE2: 'withMillis' property is supported from asn1 1.0.6.\n */\nKJUR.asn1.DERGeneralizedTime = function (params) {\n KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params);\n this.hT = \"18\";\n this.withMillis = false;\n /**\n * set value by a Date object\n * @name setByDate\n * @memberOf KJUR.asn1.DERGeneralizedTime#\n * @function\n * @param {Date} dateObject Date object to set ASN.1 value(V)\n * @example\n * When you specify UTC time, use 'Date.UTC' method like this:
\n * o1 = new DERUTCTime();\n * o1.setByDate(date);\n *\n * date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59\n */\n this.setByDate = function (dateObject) {\n this.hTLV = null;\n this.isModified = true;\n this.date = dateObject;\n this.s = this.formatDate(this.date, 'gen', this.withMillis);\n this.hV = stohex(this.s);\n };\n this.getFreshValueHex = function () {\n if (this.date === undefined && this.s === undefined) {\n this.date = new Date();\n this.s = this.formatDate(this.date, 'gen', this.withMillis);\n this.hV = stohex(this.s);\n }\n return this.hV;\n };\n if (params !== undefined) {\n if (params.str !== undefined) {\n this.setString(params.str);\n }\n else if (typeof params == \"string\" && params.match(/^[0-9]{14}Z$/)) {\n this.setString(params);\n }\n else if (params.hex !== undefined) {\n this.setStringHex(params.hex);\n }\n else if (params.date !== undefined) {\n this.setByDate(params.date);\n }\n if (params.millis === true) {\n this.withMillis = true;\n }\n }\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime);\n// ********************************************************************\n/**\n * class for ASN.1 DER Sequence\n * @name KJUR.asn1.DERSequence\n * @class class for ASN.1 DER Sequence\n * @extends KJUR.asn1.DERAbstractStructured\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • array - specify array of ASN1Object to set elements of content
  • \n *
\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERSequence = function (params) {\n KJUR.asn1.DERSequence.superclass.constructor.call(this, params);\n this.hT = \"30\";\n this.getFreshValueHex = function () {\n var h = '';\n for (var i = 0; i < this.asn1Array.length; i++) {\n var asn1Obj = this.asn1Array[i];\n h += asn1Obj.getEncodedHex();\n }\n this.hV = h;\n return this.hV;\n };\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured);\n// ********************************************************************\n/**\n * class for ASN.1 DER Set\n * @name KJUR.asn1.DERSet\n * @class class for ASN.1 DER Set\n * @extends KJUR.asn1.DERAbstractStructured\n * @description\n *
\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n *
    \n *
  • array - specify array of ASN1Object to set elements of content
  • \n *
  • sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.
  • \n *
\n * NOTE1: 'params' can be omitted.
\n * NOTE2: sortflag is supported since 1.0.5.\n */\nKJUR.asn1.DERSet = function (params) {\n KJUR.asn1.DERSet.superclass.constructor.call(this, params);\n this.hT = \"31\";\n this.sortFlag = true; // item shall be sorted only in ASN.1 DER\n this.getFreshValueHex = function () {\n var a = new Array();\n for (var i = 0; i < this.asn1Array.length; i++) {\n var asn1Obj = this.asn1Array[i];\n a.push(asn1Obj.getEncodedHex());\n }\n if (this.sortFlag == true)\n a.sort();\n this.hV = a.join('');\n return this.hV;\n };\n if (typeof params != \"undefined\") {\n if (typeof params.sortflag != \"undefined\" &&\n params.sortflag == false)\n this.sortFlag = false;\n }\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured);\n// ********************************************************************\n/**\n * class for ASN.1 DER TaggedObject\n * @name KJUR.asn1.DERTaggedObject\n * @class class for ASN.1 DER TaggedObject\n * @extends KJUR.asn1.ASN1Object\n * @description\n *
\n * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object.\n * For example, if you find '[1]' tag in a ASN.1 dump,\n * 'tagNoHex' will be 'a1'.\n *
\n * As for optional argument 'params' for constructor, you can specify *ANY* of\n * following properties:\n *
    \n *
  • explicit - specify true if this is explicit tag otherwise false\n * (default is 'true').
  • \n *
  • tag - specify tag (default is 'a0' which means [0])
  • \n *
  • obj - specify ASN1Object which is tagged
  • \n *
\n * @example\n * d1 = new KJUR.asn1.DERUTF8String({'str':'a'});\n * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1});\n * hex = d2.getEncodedHex();\n */\nKJUR.asn1.DERTaggedObject = function (params) {\n KJUR.asn1.DERTaggedObject.superclass.constructor.call(this);\n this.hT = \"a0\";\n this.hV = '';\n this.isExplicit = true;\n this.asn1Object = null;\n /**\n * set value by an ASN1Object\n * @name setString\n * @memberOf KJUR.asn1.DERTaggedObject#\n * @function\n * @param {Boolean} isExplicitFlag flag for explicit/implicit tag\n * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag\n * @param {ASN1Object} asn1Object ASN.1 to encapsulate\n */\n this.setASN1Object = function (isExplicitFlag, tagNoHex, asn1Object) {\n this.hT = tagNoHex;\n this.isExplicit = isExplicitFlag;\n this.asn1Object = asn1Object;\n if (this.isExplicit) {\n this.hV = this.asn1Object.getEncodedHex();\n this.hTLV = null;\n this.isModified = true;\n }\n else {\n this.hV = null;\n this.hTLV = asn1Object.getEncodedHex();\n this.hTLV = this.hTLV.replace(/^../, tagNoHex);\n this.isModified = false;\n }\n };\n this.getFreshValueHex = function () {\n return this.hV;\n };\n if (typeof params != \"undefined\") {\n if (typeof params['tag'] != \"undefined\") {\n this.hT = params['tag'];\n }\n if (typeof params['explicit'] != \"undefined\") {\n this.isExplicit = params['explicit'];\n }\n if (typeof params['obj'] != \"undefined\") {\n this.asn1Object = params['obj'];\n this.setASN1Object(this.isExplicit, this.hT, this.asn1Object);\n }\n }\n};\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsrsasign/asn1-1.0.js?"); + +/***/ }), + +/***/ "./lib/lib/jsrsasign/yahoo.js": +/*!************************************!*\ + !*** ./lib/lib/jsrsasign/yahoo.js ***! + \************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"YAHOO\": () => (/* binding */ YAHOO)\n/* harmony export */ });\n/*!\nCopyright (c) 2011, Yahoo! Inc. All rights reserved.\nCode licensed under the BSD License:\nhttp://developer.yahoo.com/yui/license.html\nversion: 2.9.0\n*/\nvar YAHOO = {};\nYAHOO.lang = {\n /**\n * Utility to set up the prototype, constructor and superclass properties to\n * support an inheritance strategy that can chain constructors and methods.\n * Static members will not be inherited.\n *\n * @method extend\n * @static\n * @param {Function} subc the object to modify\n * @param {Function} superc the object to inherit\n * @param {Object} overrides additional properties/methods to add to the\n * subclass prototype. These will override the\n * matching items obtained from the superclass\n * if present.\n */\n extend: function (subc, superc, overrides) {\n if (!superc || !subc) {\n throw new Error(\"YAHOO.lang.extend failed, please check that \" +\n \"all dependencies are included.\");\n }\n var F = function () { };\n F.prototype = superc.prototype;\n subc.prototype = new F();\n subc.prototype.constructor = subc;\n subc.superclass = superc.prototype;\n if (superc.prototype.constructor == Object.prototype.constructor) {\n superc.prototype.constructor = superc;\n }\n if (overrides) {\n var i;\n for (i in overrides) {\n subc.prototype[i] = overrides[i];\n }\n /*\n * IE will not enumerate native functions in a derived object even if the\n * function was overridden. This is a workaround for specific functions\n * we care about on the Object prototype.\n * @property _IEEnumFix\n * @param {Function} r the object to receive the augmentation\n * @param {Function} s the object that supplies the properties to augment\n * @static\n * @private\n */\n var _IEEnumFix = function () { }, ADD = [\"toString\", \"valueOf\"];\n try {\n if (/MSIE/.test(navigator.userAgent)) {\n _IEEnumFix = function (r, s) {\n for (i = 0; i < ADD.length; i = i + 1) {\n var fname = ADD[i], f = s[fname];\n if (typeof f === 'function' && f != Object.prototype[fname]) {\n r[fname] = f;\n }\n }\n };\n }\n }\n catch (ex) { }\n ;\n _IEEnumFix(subc.prototype, overrides);\n }\n }\n};\n\n\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsrsasign/yahoo.js?"); + +/***/ }), + +/***/ "./node_modules/process/browser.js": +/*!*****************************************!*\ + !*** ./node_modules/process/browser.js ***! + \*****************************************/ +/***/ ((module) => { + +eval("// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n//# sourceURL=webpack://JSEncrypt/./node_modules/process/browser.js?"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module can't be inlined because the eval devtool is used. +/******/ var __webpack_exports__ = __webpack_require__("./lib/index.js"); +/******/ __webpack_exports__ = __webpack_exports__["default"]; +/******/ +/******/ return __webpack_exports__; +/******/ })() +; +}); +}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); }) +return __REQUIRE__(1709513243593); +})() +//miniprogram-npm-outsideDeps=[] +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/miniprogram_npm/jsencrypt/index.js.map b/miniprogram_npm/jsencrypt/index.js.map new file mode 100644 index 0000000..147beef --- /dev/null +++ b/miniprogram_npm/jsencrypt/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["jsencrypt.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["/*\n * ATTENTION: The \"eval\" devtool has been used (maybe by default in mode: \"development\").\n * This devtool is neither made for production nor for readable output files.\n * It uses \"eval()\" calls to create a separate source file in the browser devtools.\n * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)\n * or disable the default devtool with \"devtool: false\".\n * If you are looking for production-ready output files, see mode: \"production\" (https://webpack.js.org/configuration/mode/).\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"JSEncrypt\"] = factory();\n\telse\n\t\troot[\"JSEncrypt\"] = factory();\n})(window, () => {\nreturn /******/ (() => { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ \"./lib/JSEncrypt.js\":\n/*!**************************!*\\\n !*** ./lib/JSEncrypt.js ***!\n \\**************************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"JSEncrypt\\\": () => (/* binding */ JSEncrypt)\\n/* harmony export */ });\\n/* harmony import */ var _lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/jsbn/base64 */ \\\"./lib/lib/jsbn/base64.js\\\");\\n/* harmony import */ var _JSEncryptRSAKey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./JSEncryptRSAKey */ \\\"./lib/JSEncryptRSAKey.js\\\");\\n/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \\\"./node_modules/process/browser.js\\\");\\nvar _a;\\n\\n\\nvar version = typeof process !== 'undefined'\\n ? (_a = process.env) === null || _a === void 0 ? void 0 : \\\"3.3.2\\\"\\n : undefined;\\n/**\\n *\\n * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour\\n * possible parameters are:\\n * - default_key_size {number} default: 1024 the key size in bit\\n * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent\\n * - log {boolean} default: false whether log warn/error or not\\n * @constructor\\n */\\nvar JSEncrypt = /** @class */ (function () {\\n function JSEncrypt(options) {\\n if (options === void 0) { options = {}; }\\n options = options || {};\\n this.default_key_size = options.default_key_size\\n ? parseInt(options.default_key_size, 10)\\n : 1024;\\n this.default_public_exponent = options.default_public_exponent || \\\"010001\\\"; // 65537 default openssl public exponent for rsa key type\\n this.log = options.log || false;\\n // The private and public key.\\n this.key = null;\\n }\\n /**\\n * Method to set the rsa key parameter (one method is enough to set both the public\\n * and the private key, since the private key contains the public key paramenters)\\n * Log a warning if logs are enabled\\n * @param {Object|string} key the pem encoded string or an object (with or without header/footer)\\n * @public\\n */\\n JSEncrypt.prototype.setKey = function (key) {\\n if (this.log && this.key) {\\n console.warn(\\\"A key was already set, overriding existing.\\\");\\n }\\n this.key = new _JSEncryptRSAKey__WEBPACK_IMPORTED_MODULE_1__.JSEncryptRSAKey(key);\\n };\\n /**\\n * Proxy method for setKey, for api compatibility\\n * @see setKey\\n * @public\\n */\\n JSEncrypt.prototype.setPrivateKey = function (privkey) {\\n // Create the key.\\n this.setKey(privkey);\\n };\\n /**\\n * Proxy method for setKey, for api compatibility\\n * @see setKey\\n * @public\\n */\\n JSEncrypt.prototype.setPublicKey = function (pubkey) {\\n // Sets the public key.\\n this.setKey(pubkey);\\n };\\n /**\\n * Proxy method for RSAKey object's decrypt, decrypt the string using the private\\n * components of the rsa key object. Note that if the object was not set will be created\\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\\n * @param {string} str base64 encoded crypted string to decrypt\\n * @return {string} the decrypted string\\n * @public\\n */\\n JSEncrypt.prototype.decrypt = function (str) {\\n // Return the decrypted string.\\n try {\\n return this.getKey().decrypt((0,_lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__.b64tohex)(str));\\n }\\n catch (ex) {\\n return false;\\n }\\n };\\n /**\\n * Proxy method for RSAKey object's encrypt, encrypt the string using the public\\n * components of the rsa key object. Note that if the object was not set will be created\\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\\n * @param {string} str the string to encrypt\\n * @return {string} the encrypted string encoded in base64\\n * @public\\n */\\n JSEncrypt.prototype.encrypt = function (str) {\\n // Return the encrypted string.\\n try {\\n return (0,_lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__.hex2b64)(this.getKey().encrypt(str));\\n }\\n catch (ex) {\\n return false;\\n }\\n };\\n /**\\n * Proxy method for RSAKey object's sign.\\n * @param {string} str the string to sign\\n * @param {function} digestMethod hash method\\n * @param {string} digestName the name of the hash algorithm\\n * @return {string} the signature encoded in base64\\n * @public\\n */\\n JSEncrypt.prototype.sign = function (str, digestMethod, digestName) {\\n // return the RSA signature of 'str' in 'hex' format.\\n try {\\n return (0,_lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__.hex2b64)(this.getKey().sign(str, digestMethod, digestName));\\n }\\n catch (ex) {\\n return false;\\n }\\n };\\n /**\\n * Proxy method for RSAKey object's verify.\\n * @param {string} str the string to verify\\n * @param {string} signature the signature encoded in base64 to compare the string to\\n * @param {function} digestMethod hash method\\n * @return {boolean} whether the data and signature match\\n * @public\\n */\\n JSEncrypt.prototype.verify = function (str, signature, digestMethod) {\\n // Return the decrypted 'digest' of the signature.\\n try {\\n return this.getKey().verify(str, (0,_lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__.b64tohex)(signature), digestMethod);\\n }\\n catch (ex) {\\n return false;\\n }\\n };\\n /**\\n * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object\\n * will be created and returned\\n * @param {callback} [cb] the callback to be called if we want the key to be generated\\n * in an async fashion\\n * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object\\n * @public\\n */\\n JSEncrypt.prototype.getKey = function (cb) {\\n // Only create new if it does not exist.\\n if (!this.key) {\\n // Get a new private key.\\n this.key = new _JSEncryptRSAKey__WEBPACK_IMPORTED_MODULE_1__.JSEncryptRSAKey();\\n if (cb && {}.toString.call(cb) === \\\"[object Function]\\\") {\\n this.key.generateAsync(this.default_key_size, this.default_public_exponent, cb);\\n return;\\n }\\n // Generate the key.\\n this.key.generate(this.default_key_size, this.default_public_exponent);\\n }\\n return this.key;\\n };\\n /**\\n * Returns the pem encoded representation of the private key\\n * If the key doesn't exists a new key will be created\\n * @returns {string} pem encoded representation of the private key WITH header and footer\\n * @public\\n */\\n JSEncrypt.prototype.getPrivateKey = function () {\\n // Return the private representation of this key.\\n return this.getKey().getPrivateKey();\\n };\\n /**\\n * Returns the pem encoded representation of the private key\\n * If the key doesn't exists a new key will be created\\n * @returns {string} pem encoded representation of the private key WITHOUT header and footer\\n * @public\\n */\\n JSEncrypt.prototype.getPrivateKeyB64 = function () {\\n // Return the private representation of this key.\\n return this.getKey().getPrivateBaseKeyB64();\\n };\\n /**\\n * Returns the pem encoded representation of the public key\\n * If the key doesn't exists a new key will be created\\n * @returns {string} pem encoded representation of the public key WITH header and footer\\n * @public\\n */\\n JSEncrypt.prototype.getPublicKey = function () {\\n // Return the private representation of this key.\\n return this.getKey().getPublicKey();\\n };\\n /**\\n * Returns the pem encoded representation of the public key\\n * If the key doesn't exists a new key will be created\\n * @returns {string} pem encoded representation of the public key WITHOUT header and footer\\n * @public\\n */\\n JSEncrypt.prototype.getPublicKeyB64 = function () {\\n // Return the private representation of this key.\\n return this.getKey().getPublicBaseKeyB64();\\n };\\n JSEncrypt.version = version;\\n return JSEncrypt;\\n}());\\n\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/JSEncrypt.js?\");\n\n/***/ }),\n\n/***/ \"./lib/JSEncryptRSAKey.js\":\n/*!********************************!*\\\n !*** ./lib/JSEncryptRSAKey.js ***!\n \\********************************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"JSEncryptRSAKey\\\": () => (/* binding */ JSEncryptRSAKey)\\n/* harmony export */ });\\n/* harmony import */ var _lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/jsbn/base64 */ \\\"./lib/lib/jsbn/base64.js\\\");\\n/* harmony import */ var _lib_asn1js_hex__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/asn1js/hex */ \\\"./lib/lib/asn1js/hex.js\\\");\\n/* harmony import */ var _lib_asn1js_base64__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/asn1js/base64 */ \\\"./lib/lib/asn1js/base64.js\\\");\\n/* harmony import */ var _lib_asn1js_asn1__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/asn1js/asn1 */ \\\"./lib/lib/asn1js/asn1.js\\\");\\n/* harmony import */ var _lib_jsbn_rsa__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/jsbn/rsa */ \\\"./lib/lib/jsbn/rsa.js\\\");\\n/* harmony import */ var _lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/jsbn/jsbn */ \\\"./lib/lib/jsbn/jsbn.js\\\");\\n/* harmony import */ var _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./lib/jsrsasign/asn1-1.0 */ \\\"./lib/lib/jsrsasign/asn1-1.0.js\\\");\\nvar __extends = (undefined && undefined.__extends) || (function () {\\n var extendStatics = function (d, b) {\\n extendStatics = Object.setPrototypeOf ||\\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\\n return extendStatics(d, b);\\n };\\n return function (d, b) {\\n if (typeof b !== \\\"function\\\" && b !== null)\\n throw new TypeError(\\\"Class extends value \\\" + String(b) + \\\" is not a constructor or null\\\");\\n extendStatics(d, b);\\n function __() { this.constructor = d; }\\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\\n };\\n})();\\n\\n\\n\\n\\n\\n\\n\\n/**\\n * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object.\\n * This object is just a decorator for parsing the key parameter\\n * @param {string|Object} key - The key in string format, or an object containing\\n * the parameters needed to build a RSAKey object.\\n * @constructor\\n */\\nvar JSEncryptRSAKey = /** @class */ (function (_super) {\\n __extends(JSEncryptRSAKey, _super);\\n function JSEncryptRSAKey(key) {\\n var _this = _super.call(this) || this;\\n // Call the super constructor.\\n // RSAKey.call(this);\\n // If a key key was provided.\\n if (key) {\\n // If this is a string...\\n if (typeof key === \\\"string\\\") {\\n _this.parseKey(key);\\n }\\n else if (JSEncryptRSAKey.hasPrivateKeyProperty(key) ||\\n JSEncryptRSAKey.hasPublicKeyProperty(key)) {\\n // Set the values for the key.\\n _this.parsePropertiesFrom(key);\\n }\\n }\\n return _this;\\n }\\n /**\\n * Method to parse a pem encoded string containing both a public or private key.\\n * The method will translate the pem encoded string in a der encoded string and\\n * will parse private key and public key parameters. This method accepts public key\\n * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1).\\n *\\n * @todo Check how many rsa formats use the same format of pkcs #1.\\n *\\n * The format is defined as:\\n * PublicKeyInfo ::= SEQUENCE {\\n * algorithm AlgorithmIdentifier,\\n * PublicKey BIT STRING\\n * }\\n * Where AlgorithmIdentifier is:\\n * AlgorithmIdentifier ::= SEQUENCE {\\n * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm\\n * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)\\n * }\\n * and PublicKey is a SEQUENCE encapsulated in a BIT STRING\\n * RSAPublicKey ::= SEQUENCE {\\n * modulus INTEGER, -- n\\n * publicExponent INTEGER -- e\\n * }\\n * it's possible to examine the structure of the keys obtained from openssl using\\n * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/\\n * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer\\n * @private\\n */\\n JSEncryptRSAKey.prototype.parseKey = function (pem) {\\n try {\\n var modulus = 0;\\n var public_exponent = 0;\\n var reHex = /^\\\\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\\\\s*)+$/;\\n var der = reHex.test(pem) ? _lib_asn1js_hex__WEBPACK_IMPORTED_MODULE_1__.Hex.decode(pem) : _lib_asn1js_base64__WEBPACK_IMPORTED_MODULE_2__.Base64.unarmor(pem);\\n var asn1 = _lib_asn1js_asn1__WEBPACK_IMPORTED_MODULE_3__.ASN1.decode(der);\\n // Fixes a bug with OpenSSL 1.0+ private keys\\n if (asn1.sub.length === 3) {\\n asn1 = asn1.sub[2].sub[0];\\n }\\n if (asn1.sub.length === 9) {\\n // Parse the private key.\\n modulus = asn1.sub[1].getHexStringValue(); // bigint\\n this.n = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(modulus, 16);\\n public_exponent = asn1.sub[2].getHexStringValue(); // int\\n this.e = parseInt(public_exponent, 16);\\n var private_exponent = asn1.sub[3].getHexStringValue(); // bigint\\n this.d = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(private_exponent, 16);\\n var prime1 = asn1.sub[4].getHexStringValue(); // bigint\\n this.p = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(prime1, 16);\\n var prime2 = asn1.sub[5].getHexStringValue(); // bigint\\n this.q = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(prime2, 16);\\n var exponent1 = asn1.sub[6].getHexStringValue(); // bigint\\n this.dmp1 = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(exponent1, 16);\\n var exponent2 = asn1.sub[7].getHexStringValue(); // bigint\\n this.dmq1 = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(exponent2, 16);\\n var coefficient = asn1.sub[8].getHexStringValue(); // bigint\\n this.coeff = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(coefficient, 16);\\n }\\n else if (asn1.sub.length === 2) {\\n if (asn1.sub[0].sub) {\\n // Parse ASN.1 SubjectPublicKeyInfo type as defined by X.509\\n var bit_string = asn1.sub[1];\\n var sequence = bit_string.sub[0];\\n modulus = sequence.sub[0].getHexStringValue();\\n this.n = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(modulus, 16);\\n public_exponent = sequence.sub[1].getHexStringValue();\\n this.e = parseInt(public_exponent, 16);\\n }\\n else {\\n // Parse ASN.1 RSAPublicKey type as defined by PKCS #1\\n modulus = asn1.sub[0].getHexStringValue();\\n this.n = (0,_lib_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_5__.parseBigInt)(modulus, 16);\\n public_exponent = asn1.sub[1].getHexStringValue();\\n this.e = parseInt(public_exponent, 16);\\n }\\n }\\n else {\\n return false;\\n }\\n return true;\\n }\\n catch (ex) {\\n return false;\\n }\\n };\\n /**\\n * Translate rsa parameters in a hex encoded string representing the rsa key.\\n *\\n * The translation follow the ASN.1 notation :\\n * RSAPrivateKey ::= SEQUENCE {\\n * version Version,\\n * modulus INTEGER, -- n\\n * publicExponent INTEGER, -- e\\n * privateExponent INTEGER, -- d\\n * prime1 INTEGER, -- p\\n * prime2 INTEGER, -- q\\n * exponent1 INTEGER, -- d mod (p1)\\n * exponent2 INTEGER, -- d mod (q-1)\\n * coefficient INTEGER, -- (inverse of q) mod p\\n * }\\n * @returns {string} DER Encoded String representing the rsa private key\\n * @private\\n */\\n JSEncryptRSAKey.prototype.getPrivateBaseKey = function () {\\n var options = {\\n array: [\\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ int: 0 }),\\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.n }),\\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ int: this.e }),\\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.d }),\\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.p }),\\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.q }),\\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.dmp1 }),\\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.dmq1 }),\\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.coeff }),\\n ],\\n };\\n var seq = new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERSequence(options);\\n return seq.getEncodedHex();\\n };\\n /**\\n * base64 (pem) encoded version of the DER encoded representation\\n * @returns {string} pem encoded representation without header and footer\\n * @public\\n */\\n JSEncryptRSAKey.prototype.getPrivateBaseKeyB64 = function () {\\n return (0,_lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__.hex2b64)(this.getPrivateBaseKey());\\n };\\n /**\\n * Translate rsa parameters in a hex encoded string representing the rsa public key.\\n * The representation follow the ASN.1 notation :\\n * PublicKeyInfo ::= SEQUENCE {\\n * algorithm AlgorithmIdentifier,\\n * PublicKey BIT STRING\\n * }\\n * Where AlgorithmIdentifier is:\\n * AlgorithmIdentifier ::= SEQUENCE {\\n * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm\\n * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)\\n * }\\n * and PublicKey is a SEQUENCE encapsulated in a BIT STRING\\n * RSAPublicKey ::= SEQUENCE {\\n * modulus INTEGER, -- n\\n * publicExponent INTEGER -- e\\n * }\\n * @returns {string} DER Encoded String representing the rsa public key\\n * @private\\n */\\n JSEncryptRSAKey.prototype.getPublicBaseKey = function () {\\n var first_sequence = new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERSequence({\\n array: [\\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERObjectIdentifier({ oid: \\\"1.2.840.113549.1.1.1\\\" }),\\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERNull(),\\n ],\\n });\\n var second_sequence = new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERSequence({\\n array: [\\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ bigint: this.n }),\\n new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERInteger({ int: this.e }),\\n ],\\n });\\n var bit_string = new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERBitString({\\n hex: \\\"00\\\" + second_sequence.getEncodedHex(),\\n });\\n var seq = new _lib_jsrsasign_asn1_1_0__WEBPACK_IMPORTED_MODULE_6__.KJUR.asn1.DERSequence({\\n array: [first_sequence, bit_string],\\n });\\n return seq.getEncodedHex();\\n };\\n /**\\n * base64 (pem) encoded version of the DER encoded representation\\n * @returns {string} pem encoded representation without header and footer\\n * @public\\n */\\n JSEncryptRSAKey.prototype.getPublicBaseKeyB64 = function () {\\n return (0,_lib_jsbn_base64__WEBPACK_IMPORTED_MODULE_0__.hex2b64)(this.getPublicBaseKey());\\n };\\n /**\\n * wrap the string in block of width chars. The default value for rsa keys is 64\\n * characters.\\n * @param {string} str the pem encoded string without header and footer\\n * @param {Number} [width=64] - the length the string has to be wrapped at\\n * @returns {string}\\n * @private\\n */\\n JSEncryptRSAKey.wordwrap = function (str, width) {\\n width = width || 64;\\n if (!str) {\\n return str;\\n }\\n var regex = \\\"(.{1,\\\" + width + \\\"})( +|$\\\\n?)|(.{1,\\\" + width + \\\"})\\\";\\n return str.match(RegExp(regex, \\\"g\\\")).join(\\\"\\\\n\\\");\\n };\\n /**\\n * Retrieve the pem encoded private key\\n * @returns {string} the pem encoded private key with header/footer\\n * @public\\n */\\n JSEncryptRSAKey.prototype.getPrivateKey = function () {\\n var key = \\\"-----BEGIN RSA PRIVATE KEY-----\\\\n\\\";\\n key += JSEncryptRSAKey.wordwrap(this.getPrivateBaseKeyB64()) + \\\"\\\\n\\\";\\n key += \\\"-----END RSA PRIVATE KEY-----\\\";\\n return key;\\n };\\n /**\\n * Retrieve the pem encoded public key\\n * @returns {string} the pem encoded public key with header/footer\\n * @public\\n */\\n JSEncryptRSAKey.prototype.getPublicKey = function () {\\n var key = \\\"-----BEGIN PUBLIC KEY-----\\\\n\\\";\\n key += JSEncryptRSAKey.wordwrap(this.getPublicBaseKeyB64()) + \\\"\\\\n\\\";\\n key += \\\"-----END PUBLIC KEY-----\\\";\\n return key;\\n };\\n /**\\n * Check if the object contains the necessary parameters to populate the rsa modulus\\n * and public exponent parameters.\\n * @param {Object} [obj={}] - An object that may contain the two public key\\n * parameters\\n * @returns {boolean} true if the object contains both the modulus and the public exponent\\n * properties (n and e)\\n * @todo check for types of n and e. N should be a parseable bigInt object, E should\\n * be a parseable integer number\\n * @private\\n */\\n JSEncryptRSAKey.hasPublicKeyProperty = function (obj) {\\n obj = obj || {};\\n return obj.hasOwnProperty(\\\"n\\\") && obj.hasOwnProperty(\\\"e\\\");\\n };\\n /**\\n * Check if the object contains ALL the parameters of an RSA key.\\n * @param {Object} [obj={}] - An object that may contain nine rsa key\\n * parameters\\n * @returns {boolean} true if the object contains all the parameters needed\\n * @todo check for types of the parameters all the parameters but the public exponent\\n * should be parseable bigint objects, the public exponent should be a parseable integer number\\n * @private\\n */\\n JSEncryptRSAKey.hasPrivateKeyProperty = function (obj) {\\n obj = obj || {};\\n return (obj.hasOwnProperty(\\\"n\\\") &&\\n obj.hasOwnProperty(\\\"e\\\") &&\\n obj.hasOwnProperty(\\\"d\\\") &&\\n obj.hasOwnProperty(\\\"p\\\") &&\\n obj.hasOwnProperty(\\\"q\\\") &&\\n obj.hasOwnProperty(\\\"dmp1\\\") &&\\n obj.hasOwnProperty(\\\"dmq1\\\") &&\\n obj.hasOwnProperty(\\\"coeff\\\"));\\n };\\n /**\\n * Parse the properties of obj in the current rsa object. Obj should AT LEAST\\n * include the modulus and public exponent (n, e) parameters.\\n * @param {Object} obj - the object containing rsa parameters\\n * @private\\n */\\n JSEncryptRSAKey.prototype.parsePropertiesFrom = function (obj) {\\n this.n = obj.n;\\n this.e = obj.e;\\n if (obj.hasOwnProperty(\\\"d\\\")) {\\n this.d = obj.d;\\n this.p = obj.p;\\n this.q = obj.q;\\n this.dmp1 = obj.dmp1;\\n this.dmq1 = obj.dmq1;\\n this.coeff = obj.coeff;\\n }\\n };\\n return JSEncryptRSAKey;\\n}(_lib_jsbn_rsa__WEBPACK_IMPORTED_MODULE_4__.RSAKey));\\n\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/JSEncryptRSAKey.js?\");\n\n/***/ }),\n\n/***/ \"./lib/index.js\":\n/*!**********************!*\\\n !*** ./lib/index.js ***!\n \\**********************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"JSEncrypt\\\": () => (/* reexport safe */ _JSEncrypt__WEBPACK_IMPORTED_MODULE_0__.JSEncrypt),\\n/* harmony export */ \\\"default\\\": () => (__WEBPACK_DEFAULT_EXPORT__)\\n/* harmony export */ });\\n/* harmony import */ var _JSEncrypt__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./JSEncrypt */ \\\"./lib/JSEncrypt.js\\\");\\n\\n\\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_JSEncrypt__WEBPACK_IMPORTED_MODULE_0__.JSEncrypt);\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/index.js?\");\n\n/***/ }),\n\n/***/ \"./lib/lib/asn1js/asn1.js\":\n/*!********************************!*\\\n !*** ./lib/lib/asn1js/asn1.js ***!\n \\********************************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"ASN1\\\": () => (/* binding */ ASN1),\\n/* harmony export */ \\\"ASN1Tag\\\": () => (/* binding */ ASN1Tag),\\n/* harmony export */ \\\"Stream\\\": () => (/* binding */ Stream)\\n/* harmony export */ });\\n/* harmony import */ var _int10__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./int10 */ \\\"./lib/lib/asn1js/int10.js\\\");\\n// ASN.1 JavaScript decoder\\n// Copyright (c) 2008-2014 Lapo Luchini \\n// Permission to use, copy, modify, and/or distribute this software for any\\n// purpose with or without fee is hereby granted, provided that the above\\n// copyright notice and this permission notice appear in all copies.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\\n/*global oids */\\n\\nvar ellipsis = \\\"\\\\u2026\\\";\\nvar reTimeS = /^(\\\\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)?)?$/;\\nvar reTimeL = /^(\\\\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)?)?$/;\\nfunction stringCut(str, len) {\\n if (str.length > len) {\\n str = str.substring(0, len) + ellipsis;\\n }\\n return str;\\n}\\nvar Stream = /** @class */ (function () {\\n function Stream(enc, pos) {\\n this.hexDigits = \\\"0123456789ABCDEF\\\";\\n if (enc instanceof Stream) {\\n this.enc = enc.enc;\\n this.pos = enc.pos;\\n }\\n else {\\n // enc should be an array or a binary string\\n this.enc = enc;\\n this.pos = pos;\\n }\\n }\\n Stream.prototype.get = function (pos) {\\n if (pos === undefined) {\\n pos = this.pos++;\\n }\\n if (pos >= this.enc.length) {\\n throw new Error(\\\"Requesting byte offset \\\".concat(pos, \\\" on a stream of length \\\").concat(this.enc.length));\\n }\\n return (\\\"string\\\" === typeof this.enc) ? this.enc.charCodeAt(pos) : this.enc[pos];\\n };\\n Stream.prototype.hexByte = function (b) {\\n return this.hexDigits.charAt((b >> 4) & 0xF) + this.hexDigits.charAt(b & 0xF);\\n };\\n Stream.prototype.hexDump = function (start, end, raw) {\\n var s = \\\"\\\";\\n for (var i = start; i < end; ++i) {\\n s += this.hexByte(this.get(i));\\n if (raw !== true) {\\n switch (i & 0xF) {\\n case 0x7:\\n s += \\\" \\\";\\n break;\\n case 0xF:\\n s += \\\"\\\\n\\\";\\n break;\\n default:\\n s += \\\" \\\";\\n }\\n }\\n }\\n return s;\\n };\\n Stream.prototype.isASCII = function (start, end) {\\n for (var i = start; i < end; ++i) {\\n var c = this.get(i);\\n if (c < 32 || c > 176) {\\n return false;\\n }\\n }\\n return true;\\n };\\n Stream.prototype.parseStringISO = function (start, end) {\\n var s = \\\"\\\";\\n for (var i = start; i < end; ++i) {\\n s += String.fromCharCode(this.get(i));\\n }\\n return s;\\n };\\n Stream.prototype.parseStringUTF = function (start, end) {\\n var s = \\\"\\\";\\n for (var i = start; i < end;) {\\n var c = this.get(i++);\\n if (c < 128) {\\n s += String.fromCharCode(c);\\n }\\n else if ((c > 191) && (c < 224)) {\\n s += String.fromCharCode(((c & 0x1F) << 6) | (this.get(i++) & 0x3F));\\n }\\n else {\\n s += String.fromCharCode(((c & 0x0F) << 12) | ((this.get(i++) & 0x3F) << 6) | (this.get(i++) & 0x3F));\\n }\\n }\\n return s;\\n };\\n Stream.prototype.parseStringBMP = function (start, end) {\\n var str = \\\"\\\";\\n var hi;\\n var lo;\\n for (var i = start; i < end;) {\\n hi = this.get(i++);\\n lo = this.get(i++);\\n str += String.fromCharCode((hi << 8) | lo);\\n }\\n return str;\\n };\\n Stream.prototype.parseTime = function (start, end, shortYear) {\\n var s = this.parseStringISO(start, end);\\n var m = (shortYear ? reTimeS : reTimeL).exec(s);\\n if (!m) {\\n return \\\"Unrecognized time: \\\" + s;\\n }\\n if (shortYear) {\\n // to avoid querying the timer, use the fixed range [1970, 2069]\\n // it will conform with ITU X.400 [-10, +40] sliding window until 2030\\n m[1] = +m[1];\\n m[1] += (+m[1] < 70) ? 2000 : 1900;\\n }\\n s = m[1] + \\\"-\\\" + m[2] + \\\"-\\\" + m[3] + \\\" \\\" + m[4];\\n if (m[5]) {\\n s += \\\":\\\" + m[5];\\n if (m[6]) {\\n s += \\\":\\\" + m[6];\\n if (m[7]) {\\n s += \\\".\\\" + m[7];\\n }\\n }\\n }\\n if (m[8]) {\\n s += \\\" UTC\\\";\\n if (m[8] != \\\"Z\\\") {\\n s += m[8];\\n if (m[9]) {\\n s += \\\":\\\" + m[9];\\n }\\n }\\n }\\n return s;\\n };\\n Stream.prototype.parseInteger = function (start, end) {\\n var v = this.get(start);\\n var neg = (v > 127);\\n var pad = neg ? 255 : 0;\\n var len;\\n var s = \\\"\\\";\\n // skip unuseful bits (not allowed in DER)\\n while (v == pad && ++start < end) {\\n v = this.get(start);\\n }\\n len = end - start;\\n if (len === 0) {\\n return neg ? -1 : 0;\\n }\\n // show bit length of huge integers\\n if (len > 4) {\\n s = v;\\n len <<= 3;\\n while (((+s ^ pad) & 0x80) == 0) {\\n s = +s << 1;\\n --len;\\n }\\n s = \\\"(\\\" + len + \\\" bit)\\\\n\\\";\\n }\\n // decode the integer\\n if (neg) {\\n v = v - 256;\\n }\\n var n = new _int10__WEBPACK_IMPORTED_MODULE_0__.Int10(v);\\n for (var i = start + 1; i < end; ++i) {\\n n.mulAdd(256, this.get(i));\\n }\\n return s + n.toString();\\n };\\n Stream.prototype.parseBitString = function (start, end, maxLength) {\\n var unusedBit = this.get(start);\\n var lenBit = ((end - start - 1) << 3) - unusedBit;\\n var intro = \\\"(\\\" + lenBit + \\\" bit)\\\\n\\\";\\n var s = \\\"\\\";\\n for (var i = start + 1; i < end; ++i) {\\n var b = this.get(i);\\n var skip = (i == end - 1) ? unusedBit : 0;\\n for (var j = 7; j >= skip; --j) {\\n s += (b >> j) & 1 ? \\\"1\\\" : \\\"0\\\";\\n }\\n if (s.length > maxLength) {\\n return intro + stringCut(s, maxLength);\\n }\\n }\\n return intro + s;\\n };\\n Stream.prototype.parseOctetString = function (start, end, maxLength) {\\n if (this.isASCII(start, end)) {\\n return stringCut(this.parseStringISO(start, end), maxLength);\\n }\\n var len = end - start;\\n var s = \\\"(\\\" + len + \\\" byte)\\\\n\\\";\\n maxLength /= 2; // we work in bytes\\n if (len > maxLength) {\\n end = start + maxLength;\\n }\\n for (var i = start; i < end; ++i) {\\n s += this.hexByte(this.get(i));\\n }\\n if (len > maxLength) {\\n s += ellipsis;\\n }\\n return s;\\n };\\n Stream.prototype.parseOID = function (start, end, maxLength) {\\n var s = \\\"\\\";\\n var n = new _int10__WEBPACK_IMPORTED_MODULE_0__.Int10();\\n var bits = 0;\\n for (var i = start; i < end; ++i) {\\n var v = this.get(i);\\n n.mulAdd(128, v & 0x7F);\\n bits += 7;\\n if (!(v & 0x80)) { // finished\\n if (s === \\\"\\\") {\\n n = n.simplify();\\n if (n instanceof _int10__WEBPACK_IMPORTED_MODULE_0__.Int10) {\\n n.sub(80);\\n s = \\\"2.\\\" + n.toString();\\n }\\n else {\\n var m = n < 80 ? n < 40 ? 0 : 1 : 2;\\n s = m + \\\".\\\" + (n - m * 40);\\n }\\n }\\n else {\\n s += \\\".\\\" + n.toString();\\n }\\n if (s.length > maxLength) {\\n return stringCut(s, maxLength);\\n }\\n n = new _int10__WEBPACK_IMPORTED_MODULE_0__.Int10();\\n bits = 0;\\n }\\n }\\n if (bits > 0) {\\n s += \\\".incomplete\\\";\\n }\\n return s;\\n };\\n return Stream;\\n}());\\n\\nvar ASN1 = /** @class */ (function () {\\n function ASN1(stream, header, length, tag, sub) {\\n if (!(tag instanceof ASN1Tag)) {\\n throw new Error(\\\"Invalid tag value.\\\");\\n }\\n this.stream = stream;\\n this.header = header;\\n this.length = length;\\n this.tag = tag;\\n this.sub = sub;\\n }\\n ASN1.prototype.typeName = function () {\\n switch (this.tag.tagClass) {\\n case 0: // universal\\n switch (this.tag.tagNumber) {\\n case 0x00:\\n return \\\"EOC\\\";\\n case 0x01:\\n return \\\"BOOLEAN\\\";\\n case 0x02:\\n return \\\"INTEGER\\\";\\n case 0x03:\\n return \\\"BIT_STRING\\\";\\n case 0x04:\\n return \\\"OCTET_STRING\\\";\\n case 0x05:\\n return \\\"NULL\\\";\\n case 0x06:\\n return \\\"OBJECT_IDENTIFIER\\\";\\n case 0x07:\\n return \\\"ObjectDescriptor\\\";\\n case 0x08:\\n return \\\"EXTERNAL\\\";\\n case 0x09:\\n return \\\"REAL\\\";\\n case 0x0A:\\n return \\\"ENUMERATED\\\";\\n case 0x0B:\\n return \\\"EMBEDDED_PDV\\\";\\n case 0x0C:\\n return \\\"UTF8String\\\";\\n case 0x10:\\n return \\\"SEQUENCE\\\";\\n case 0x11:\\n return \\\"SET\\\";\\n case 0x12:\\n return \\\"NumericString\\\";\\n case 0x13:\\n return \\\"PrintableString\\\"; // ASCII subset\\n case 0x14:\\n return \\\"TeletexString\\\"; // aka T61String\\n case 0x15:\\n return \\\"VideotexString\\\";\\n case 0x16:\\n return \\\"IA5String\\\"; // ASCII\\n case 0x17:\\n return \\\"UTCTime\\\";\\n case 0x18:\\n return \\\"GeneralizedTime\\\";\\n case 0x19:\\n return \\\"GraphicString\\\";\\n case 0x1A:\\n return \\\"VisibleString\\\"; // ASCII subset\\n case 0x1B:\\n return \\\"GeneralString\\\";\\n case 0x1C:\\n return \\\"UniversalString\\\";\\n case 0x1E:\\n return \\\"BMPString\\\";\\n }\\n return \\\"Universal_\\\" + this.tag.tagNumber.toString();\\n case 1:\\n return \\\"Application_\\\" + this.tag.tagNumber.toString();\\n case 2:\\n return \\\"[\\\" + this.tag.tagNumber.toString() + \\\"]\\\"; // Context\\n case 3:\\n return \\\"Private_\\\" + this.tag.tagNumber.toString();\\n }\\n };\\n ASN1.prototype.content = function (maxLength) {\\n if (this.tag === undefined) {\\n return null;\\n }\\n if (maxLength === undefined) {\\n maxLength = Infinity;\\n }\\n var content = this.posContent();\\n var len = Math.abs(this.length);\\n if (!this.tag.isUniversal()) {\\n if (this.sub !== null) {\\n return \\\"(\\\" + this.sub.length + \\\" elem)\\\";\\n }\\n return this.stream.parseOctetString(content, content + len, maxLength);\\n }\\n switch (this.tag.tagNumber) {\\n case 0x01: // BOOLEAN\\n return (this.stream.get(content) === 0) ? \\\"false\\\" : \\\"true\\\";\\n case 0x02: // INTEGER\\n return this.stream.parseInteger(content, content + len);\\n case 0x03: // BIT_STRING\\n return this.sub ? \\\"(\\\" + this.sub.length + \\\" elem)\\\" :\\n this.stream.parseBitString(content, content + len, maxLength);\\n case 0x04: // OCTET_STRING\\n return this.sub ? \\\"(\\\" + this.sub.length + \\\" elem)\\\" :\\n this.stream.parseOctetString(content, content + len, maxLength);\\n // case 0x05: // NULL\\n case 0x06: // OBJECT_IDENTIFIER\\n return this.stream.parseOID(content, content + len, maxLength);\\n // case 0x07: // ObjectDescriptor\\n // case 0x08: // EXTERNAL\\n // case 0x09: // REAL\\n // case 0x0A: // ENUMERATED\\n // case 0x0B: // EMBEDDED_PDV\\n case 0x10: // SEQUENCE\\n case 0x11: // SET\\n if (this.sub !== null) {\\n return \\\"(\\\" + this.sub.length + \\\" elem)\\\";\\n }\\n else {\\n return \\\"(no elem)\\\";\\n }\\n case 0x0C: // UTF8String\\n return stringCut(this.stream.parseStringUTF(content, content + len), maxLength);\\n case 0x12: // NumericString\\n case 0x13: // PrintableString\\n case 0x14: // TeletexString\\n case 0x15: // VideotexString\\n case 0x16: // IA5String\\n // case 0x19: // GraphicString\\n case 0x1A: // VisibleString\\n // case 0x1B: // GeneralString\\n // case 0x1C: // UniversalString\\n return stringCut(this.stream.parseStringISO(content, content + len), maxLength);\\n case 0x1E: // BMPString\\n return stringCut(this.stream.parseStringBMP(content, content + len), maxLength);\\n case 0x17: // UTCTime\\n case 0x18: // GeneralizedTime\\n return this.stream.parseTime(content, content + len, (this.tag.tagNumber == 0x17));\\n }\\n return null;\\n };\\n ASN1.prototype.toString = function () {\\n return this.typeName() + \\\"@\\\" + this.stream.pos + \\\"[header:\\\" + this.header + \\\",length:\\\" + this.length + \\\",sub:\\\" + ((this.sub === null) ? \\\"null\\\" : this.sub.length) + \\\"]\\\";\\n };\\n ASN1.prototype.toPrettyString = function (indent) {\\n if (indent === undefined) {\\n indent = \\\"\\\";\\n }\\n var s = indent + this.typeName() + \\\" @\\\" + this.stream.pos;\\n if (this.length >= 0) {\\n s += \\\"+\\\";\\n }\\n s += this.length;\\n if (this.tag.tagConstructed) {\\n s += \\\" (constructed)\\\";\\n }\\n else if ((this.tag.isUniversal() && ((this.tag.tagNumber == 0x03) || (this.tag.tagNumber == 0x04))) && (this.sub !== null)) {\\n s += \\\" (encapsulates)\\\";\\n }\\n s += \\\"\\\\n\\\";\\n if (this.sub !== null) {\\n indent += \\\" \\\";\\n for (var i = 0, max = this.sub.length; i < max; ++i) {\\n s += this.sub[i].toPrettyString(indent);\\n }\\n }\\n return s;\\n };\\n ASN1.prototype.posStart = function () {\\n return this.stream.pos;\\n };\\n ASN1.prototype.posContent = function () {\\n return this.stream.pos + this.header;\\n };\\n ASN1.prototype.posEnd = function () {\\n return this.stream.pos + this.header + Math.abs(this.length);\\n };\\n ASN1.prototype.toHexString = function () {\\n return this.stream.hexDump(this.posStart(), this.posEnd(), true);\\n };\\n ASN1.decodeLength = function (stream) {\\n var buf = stream.get();\\n var len = buf & 0x7F;\\n if (len == buf) {\\n return len;\\n }\\n // no reason to use Int10, as it would be a huge buffer anyways\\n if (len > 6) {\\n throw new Error(\\\"Length over 48 bits not supported at position \\\" + (stream.pos - 1));\\n }\\n if (len === 0) {\\n return null;\\n } // undefined\\n buf = 0;\\n for (var i = 0; i < len; ++i) {\\n buf = (buf * 256) + stream.get();\\n }\\n return buf;\\n };\\n /**\\n * Retrieve the hexadecimal value (as a string) of the current ASN.1 element\\n * @returns {string}\\n * @public\\n */\\n ASN1.prototype.getHexStringValue = function () {\\n var hexString = this.toHexString();\\n var offset = this.header * 2;\\n var length = this.length * 2;\\n return hexString.substr(offset, length);\\n };\\n ASN1.decode = function (str) {\\n var stream;\\n if (!(str instanceof Stream)) {\\n stream = new Stream(str, 0);\\n }\\n else {\\n stream = str;\\n }\\n var streamStart = new Stream(stream);\\n var tag = new ASN1Tag(stream);\\n var len = ASN1.decodeLength(stream);\\n var start = stream.pos;\\n var header = start - streamStart.pos;\\n var sub = null;\\n var getSub = function () {\\n var ret = [];\\n if (len !== null) {\\n // definite length\\n var end = start + len;\\n while (stream.pos < end) {\\n ret[ret.length] = ASN1.decode(stream);\\n }\\n if (stream.pos != end) {\\n throw new Error(\\\"Content size is not correct for container starting at offset \\\" + start);\\n }\\n }\\n else {\\n // undefined length\\n try {\\n for (;;) {\\n var s = ASN1.decode(stream);\\n if (s.tag.isEOC()) {\\n break;\\n }\\n ret[ret.length] = s;\\n }\\n len = start - stream.pos; // undefined lengths are represented as negative values\\n }\\n catch (e) {\\n throw new Error(\\\"Exception while decoding undefined length content: \\\" + e);\\n }\\n }\\n return ret;\\n };\\n if (tag.tagConstructed) {\\n // must have valid content\\n sub = getSub();\\n }\\n else if (tag.isUniversal() && ((tag.tagNumber == 0x03) || (tag.tagNumber == 0x04))) {\\n // sometimes BitString and OctetString are used to encapsulate ASN.1\\n try {\\n if (tag.tagNumber == 0x03) {\\n if (stream.get() != 0) {\\n throw new Error(\\\"BIT STRINGs with unused bits cannot encapsulate.\\\");\\n }\\n }\\n sub = getSub();\\n for (var i = 0; i < sub.length; ++i) {\\n if (sub[i].tag.isEOC()) {\\n throw new Error(\\\"EOC is not supposed to be actual content.\\\");\\n }\\n }\\n }\\n catch (e) {\\n // but silently ignore when they don't\\n sub = null;\\n }\\n }\\n if (sub === null) {\\n if (len === null) {\\n throw new Error(\\\"We can't skip over an invalid tag with undefined length at offset \\\" + start);\\n }\\n stream.pos = start + Math.abs(len);\\n }\\n return new ASN1(streamStart, header, len, tag, sub);\\n };\\n return ASN1;\\n}());\\n\\nvar ASN1Tag = /** @class */ (function () {\\n function ASN1Tag(stream) {\\n var buf = stream.get();\\n this.tagClass = buf >> 6;\\n this.tagConstructed = ((buf & 0x20) !== 0);\\n this.tagNumber = buf & 0x1F;\\n if (this.tagNumber == 0x1F) { // long tag\\n var n = new _int10__WEBPACK_IMPORTED_MODULE_0__.Int10();\\n do {\\n buf = stream.get();\\n n.mulAdd(128, buf & 0x7F);\\n } while (buf & 0x80);\\n this.tagNumber = n.simplify();\\n }\\n }\\n ASN1Tag.prototype.isUniversal = function () {\\n return this.tagClass === 0x00;\\n };\\n ASN1Tag.prototype.isEOC = function () {\\n return this.tagClass === 0x00 && this.tagNumber === 0x00;\\n };\\n return ASN1Tag;\\n}());\\n\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/lib/asn1js/asn1.js?\");\n\n/***/ }),\n\n/***/ \"./lib/lib/asn1js/base64.js\":\n/*!**********************************!*\\\n !*** ./lib/lib/asn1js/base64.js ***!\n \\**********************************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"Base64\\\": () => (/* binding */ Base64)\\n/* harmony export */ });\\n// Base64 JavaScript decoder\\n// Copyright (c) 2008-2013 Lapo Luchini \\n// Permission to use, copy, modify, and/or distribute this software for any\\n// purpose with or without fee is hereby granted, provided that the above\\n// copyright notice and this permission notice appear in all copies.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\\nvar decoder;\\nvar Base64 = {\\n decode: function (a) {\\n var i;\\n if (decoder === undefined) {\\n var b64 = \\\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\\\";\\n var ignore = \\\"= \\\\f\\\\n\\\\r\\\\t\\\\u00A0\\\\u2028\\\\u2029\\\";\\n decoder = Object.create(null);\\n for (i = 0; i < 64; ++i) {\\n decoder[b64.charAt(i)] = i;\\n }\\n decoder['-'] = 62; //+\\n decoder['_'] = 63; //-\\n for (i = 0; i < ignore.length; ++i) {\\n decoder[ignore.charAt(i)] = -1;\\n }\\n }\\n var out = [];\\n var bits = 0;\\n var char_count = 0;\\n for (i = 0; i < a.length; ++i) {\\n var c = a.charAt(i);\\n if (c == \\\"=\\\") {\\n break;\\n }\\n c = decoder[c];\\n if (c == -1) {\\n continue;\\n }\\n if (c === undefined) {\\n throw new Error(\\\"Illegal character at offset \\\" + i);\\n }\\n bits |= c;\\n if (++char_count >= 4) {\\n out[out.length] = (bits >> 16);\\n out[out.length] = (bits >> 8) & 0xFF;\\n out[out.length] = bits & 0xFF;\\n bits = 0;\\n char_count = 0;\\n }\\n else {\\n bits <<= 6;\\n }\\n }\\n switch (char_count) {\\n case 1:\\n throw new Error(\\\"Base64 encoding incomplete: at least 2 bits missing\\\");\\n case 2:\\n out[out.length] = (bits >> 10);\\n break;\\n case 3:\\n out[out.length] = (bits >> 16);\\n out[out.length] = (bits >> 8) & 0xFF;\\n break;\\n }\\n return out;\\n },\\n re: /-----BEGIN [^-]+-----([A-Za-z0-9+\\\\/=\\\\s]+)-----END [^-]+-----|begin-base64[^\\\\n]+\\\\n([A-Za-z0-9+\\\\/=\\\\s]+)====/,\\n unarmor: function (a) {\\n var m = Base64.re.exec(a);\\n if (m) {\\n if (m[1]) {\\n a = m[1];\\n }\\n else if (m[2]) {\\n a = m[2];\\n }\\n else {\\n throw new Error(\\\"RegExp out of sync\\\");\\n }\\n }\\n return Base64.decode(a);\\n }\\n};\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/lib/asn1js/base64.js?\");\n\n/***/ }),\n\n/***/ \"./lib/lib/asn1js/hex.js\":\n/*!*******************************!*\\\n !*** ./lib/lib/asn1js/hex.js ***!\n \\*******************************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"Hex\\\": () => (/* binding */ Hex)\\n/* harmony export */ });\\n// Hex JavaScript decoder\\n// Copyright (c) 2008-2013 Lapo Luchini \\n// Permission to use, copy, modify, and/or distribute this software for any\\n// purpose with or without fee is hereby granted, provided that the above\\n// copyright notice and this permission notice appear in all copies.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\\nvar decoder;\\nvar Hex = {\\n decode: function (a) {\\n var i;\\n if (decoder === undefined) {\\n var hex = \\\"0123456789ABCDEF\\\";\\n var ignore = \\\" \\\\f\\\\n\\\\r\\\\t\\\\u00A0\\\\u2028\\\\u2029\\\";\\n decoder = {};\\n for (i = 0; i < 16; ++i) {\\n decoder[hex.charAt(i)] = i;\\n }\\n hex = hex.toLowerCase();\\n for (i = 10; i < 16; ++i) {\\n decoder[hex.charAt(i)] = i;\\n }\\n for (i = 0; i < ignore.length; ++i) {\\n decoder[ignore.charAt(i)] = -1;\\n }\\n }\\n var out = [];\\n var bits = 0;\\n var char_count = 0;\\n for (i = 0; i < a.length; ++i) {\\n var c = a.charAt(i);\\n if (c == \\\"=\\\") {\\n break;\\n }\\n c = decoder[c];\\n if (c == -1) {\\n continue;\\n }\\n if (c === undefined) {\\n throw new Error(\\\"Illegal character at offset \\\" + i);\\n }\\n bits |= c;\\n if (++char_count >= 2) {\\n out[out.length] = bits;\\n bits = 0;\\n char_count = 0;\\n }\\n else {\\n bits <<= 4;\\n }\\n }\\n if (char_count) {\\n throw new Error(\\\"Hex encoding incomplete: 4 bits missing\\\");\\n }\\n return out;\\n }\\n};\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/lib/asn1js/hex.js?\");\n\n/***/ }),\n\n/***/ \"./lib/lib/asn1js/int10.js\":\n/*!*********************************!*\\\n !*** ./lib/lib/asn1js/int10.js ***!\n \\*********************************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"Int10\\\": () => (/* binding */ Int10)\\n/* harmony export */ });\\n// Big integer base-10 printing library\\n// Copyright (c) 2014 Lapo Luchini \\n// Permission to use, copy, modify, and/or distribute this software for any\\n// purpose with or without fee is hereby granted, provided that the above\\n// copyright notice and this permission notice appear in all copies.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\\nvar max = 10000000000000; // biggest integer that can still fit 2^53 when multiplied by 256\\nvar Int10 = /** @class */ (function () {\\n function Int10(value) {\\n this.buf = [+value || 0];\\n }\\n Int10.prototype.mulAdd = function (m, c) {\\n // assert(m <= 256)\\n var b = this.buf;\\n var l = b.length;\\n var i;\\n var t;\\n for (i = 0; i < l; ++i) {\\n t = b[i] * m + c;\\n if (t < max) {\\n c = 0;\\n }\\n else {\\n c = 0 | (t / max);\\n t -= c * max;\\n }\\n b[i] = t;\\n }\\n if (c > 0) {\\n b[i] = c;\\n }\\n };\\n Int10.prototype.sub = function (c) {\\n // assert(m <= 256)\\n var b = this.buf;\\n var l = b.length;\\n var i;\\n var t;\\n for (i = 0; i < l; ++i) {\\n t = b[i] - c;\\n if (t < 0) {\\n t += max;\\n c = 1;\\n }\\n else {\\n c = 0;\\n }\\n b[i] = t;\\n }\\n while (b[b.length - 1] === 0) {\\n b.pop();\\n }\\n };\\n Int10.prototype.toString = function (base) {\\n if ((base || 10) != 10) {\\n throw new Error(\\\"only base 10 is supported\\\");\\n }\\n var b = this.buf;\\n var s = b[b.length - 1].toString();\\n for (var i = b.length - 2; i >= 0; --i) {\\n s += (max + b[i]).toString().substring(1);\\n }\\n return s;\\n };\\n Int10.prototype.valueOf = function () {\\n var b = this.buf;\\n var v = 0;\\n for (var i = b.length - 1; i >= 0; --i) {\\n v = v * max + b[i];\\n }\\n return v;\\n };\\n Int10.prototype.simplify = function () {\\n var b = this.buf;\\n return (b.length == 1) ? b[0] : this;\\n };\\n return Int10;\\n}());\\n\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/lib/asn1js/int10.js?\");\n\n/***/ }),\n\n/***/ \"./lib/lib/jsbn/base64.js\":\n/*!********************************!*\\\n !*** ./lib/lib/jsbn/base64.js ***!\n \\********************************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"b64toBA\\\": () => (/* binding */ b64toBA),\\n/* harmony export */ \\\"b64tohex\\\": () => (/* binding */ b64tohex),\\n/* harmony export */ \\\"hex2b64\\\": () => (/* binding */ hex2b64)\\n/* harmony export */ });\\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ \\\"./lib/lib/jsbn/util.js\\\");\\n\\nvar b64map = \\\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\\\";\\nvar b64pad = \\\"=\\\";\\nfunction hex2b64(h) {\\n var i;\\n var c;\\n var ret = \\\"\\\";\\n for (i = 0; i + 3 <= h.length; i += 3) {\\n c = parseInt(h.substring(i, i + 3), 16);\\n ret += b64map.charAt(c >> 6) + b64map.charAt(c & 63);\\n }\\n if (i + 1 == h.length) {\\n c = parseInt(h.substring(i, i + 1), 16);\\n ret += b64map.charAt(c << 2);\\n }\\n else if (i + 2 == h.length) {\\n c = parseInt(h.substring(i, i + 2), 16);\\n ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4);\\n }\\n while ((ret.length & 3) > 0) {\\n ret += b64pad;\\n }\\n return ret;\\n}\\n// convert a base64 string to hex\\nfunction b64tohex(s) {\\n var ret = \\\"\\\";\\n var i;\\n var k = 0; // b64 state, 0-3\\n var slop = 0;\\n for (i = 0; i < s.length; ++i) {\\n if (s.charAt(i) == b64pad) {\\n break;\\n }\\n var v = b64map.indexOf(s.charAt(i));\\n if (v < 0) {\\n continue;\\n }\\n if (k == 0) {\\n ret += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)(v >> 2);\\n slop = v & 3;\\n k = 1;\\n }\\n else if (k == 1) {\\n ret += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)((slop << 2) | (v >> 4));\\n slop = v & 0xf;\\n k = 2;\\n }\\n else if (k == 2) {\\n ret += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)(slop);\\n ret += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)(v >> 2);\\n slop = v & 3;\\n k = 3;\\n }\\n else {\\n ret += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)((slop << 2) | (v >> 4));\\n ret += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)(v & 0xf);\\n k = 0;\\n }\\n }\\n if (k == 1) {\\n ret += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)(slop << 2);\\n }\\n return ret;\\n}\\n// convert a base64 string to a byte/number array\\nfunction b64toBA(s) {\\n // piggyback on b64tohex for now, optimize later\\n var h = b64tohex(s);\\n var i;\\n var a = [];\\n for (i = 0; 2 * i < h.length; ++i) {\\n a[i] = parseInt(h.substring(2 * i, 2 * i + 2), 16);\\n }\\n return a;\\n}\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsbn/base64.js?\");\n\n/***/ }),\n\n/***/ \"./lib/lib/jsbn/jsbn.js\":\n/*!******************************!*\\\n !*** ./lib/lib/jsbn/jsbn.js ***!\n \\******************************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"BigInteger\\\": () => (/* binding */ BigInteger),\\n/* harmony export */ \\\"intAt\\\": () => (/* binding */ intAt),\\n/* harmony export */ \\\"nbi\\\": () => (/* binding */ nbi),\\n/* harmony export */ \\\"nbits\\\": () => (/* binding */ nbits),\\n/* harmony export */ \\\"nbv\\\": () => (/* binding */ nbv),\\n/* harmony export */ \\\"parseBigInt\\\": () => (/* binding */ parseBigInt)\\n/* harmony export */ });\\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ \\\"./lib/lib/jsbn/util.js\\\");\\n// Copyright (c) 2005 Tom Wu\\n// All Rights Reserved.\\n// See \\\"LICENSE\\\" for details.\\n// Basic JavaScript BN library - subset useful for RSA encryption.\\n\\n// Bits per digit\\nvar dbits;\\n// JavaScript engine analysis\\nvar canary = 0xdeadbeefcafe;\\nvar j_lm = ((canary & 0xffffff) == 0xefcafe);\\n//#region\\nvar lowprimes = [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];\\nvar lplim = (1 << 26) / lowprimes[lowprimes.length - 1];\\n//#endregion\\n// (public) Constructor\\nvar BigInteger = /** @class */ (function () {\\n function BigInteger(a, b, c) {\\n if (a != null) {\\n if (\\\"number\\\" == typeof a) {\\n this.fromNumber(a, b, c);\\n }\\n else if (b == null && \\\"string\\\" != typeof a) {\\n this.fromString(a, 256);\\n }\\n else {\\n this.fromString(a, b);\\n }\\n }\\n }\\n //#region PUBLIC\\n // BigInteger.prototype.toString = bnToString;\\n // (public) return string representation in given radix\\n BigInteger.prototype.toString = function (b) {\\n if (this.s < 0) {\\n return \\\"-\\\" + this.negate().toString(b);\\n }\\n var k;\\n if (b == 16) {\\n k = 4;\\n }\\n else if (b == 8) {\\n k = 3;\\n }\\n else if (b == 2) {\\n k = 1;\\n }\\n else if (b == 32) {\\n k = 5;\\n }\\n else if (b == 4) {\\n k = 2;\\n }\\n else {\\n return this.toRadix(b);\\n }\\n var km = (1 << k) - 1;\\n var d;\\n var m = false;\\n var r = \\\"\\\";\\n var i = this.t;\\n var p = this.DB - (i * this.DB) % k;\\n if (i-- > 0) {\\n if (p < this.DB && (d = this[i] >> p) > 0) {\\n m = true;\\n r = (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)(d);\\n }\\n while (i >= 0) {\\n if (p < k) {\\n d = (this[i] & ((1 << p) - 1)) << (k - p);\\n d |= this[--i] >> (p += this.DB - k);\\n }\\n else {\\n d = (this[i] >> (p -= k)) & km;\\n if (p <= 0) {\\n p += this.DB;\\n --i;\\n }\\n }\\n if (d > 0) {\\n m = true;\\n }\\n if (m) {\\n r += (0,_util__WEBPACK_IMPORTED_MODULE_0__.int2char)(d);\\n }\\n }\\n }\\n return m ? r : \\\"0\\\";\\n };\\n // BigInteger.prototype.negate = bnNegate;\\n // (public) -this\\n BigInteger.prototype.negate = function () {\\n var r = nbi();\\n BigInteger.ZERO.subTo(this, r);\\n return r;\\n };\\n // BigInteger.prototype.abs = bnAbs;\\n // (public) |this|\\n BigInteger.prototype.abs = function () {\\n return (this.s < 0) ? this.negate() : this;\\n };\\n // BigInteger.prototype.compareTo = bnCompareTo;\\n // (public) return + if this > a, - if this < a, 0 if equal\\n BigInteger.prototype.compareTo = function (a) {\\n var r = this.s - a.s;\\n if (r != 0) {\\n return r;\\n }\\n var i = this.t;\\n r = i - a.t;\\n if (r != 0) {\\n return (this.s < 0) ? -r : r;\\n }\\n while (--i >= 0) {\\n if ((r = this[i] - a[i]) != 0) {\\n return r;\\n }\\n }\\n return 0;\\n };\\n // BigInteger.prototype.bitLength = bnBitLength;\\n // (public) return the number of bits in \\\"this\\\"\\n BigInteger.prototype.bitLength = function () {\\n if (this.t <= 0) {\\n return 0;\\n }\\n return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM));\\n };\\n // BigInteger.prototype.mod = bnMod;\\n // (public) this mod a\\n BigInteger.prototype.mod = function (a) {\\n var r = nbi();\\n this.abs().divRemTo(a, null, r);\\n if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) {\\n a.subTo(r, r);\\n }\\n return r;\\n };\\n // BigInteger.prototype.modPowInt = bnModPowInt;\\n // (public) this^e % m, 0 <= e < 2^32\\n BigInteger.prototype.modPowInt = function (e, m) {\\n var z;\\n if (e < 256 || m.isEven()) {\\n z = new Classic(m);\\n }\\n else {\\n z = new Montgomery(m);\\n }\\n return this.exp(e, z);\\n };\\n // BigInteger.prototype.clone = bnClone;\\n // (public)\\n BigInteger.prototype.clone = function () {\\n var r = nbi();\\n this.copyTo(r);\\n return r;\\n };\\n // BigInteger.prototype.intValue = bnIntValue;\\n // (public) return value as integer\\n BigInteger.prototype.intValue = function () {\\n if (this.s < 0) {\\n if (this.t == 1) {\\n return this[0] - this.DV;\\n }\\n else if (this.t == 0) {\\n return -1;\\n }\\n }\\n else if (this.t == 1) {\\n return this[0];\\n }\\n else if (this.t == 0) {\\n return 0;\\n }\\n // assumes 16 < DB < 32\\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0];\\n };\\n // BigInteger.prototype.byteValue = bnByteValue;\\n // (public) return value as byte\\n BigInteger.prototype.byteValue = function () {\\n return (this.t == 0) ? this.s : (this[0] << 24) >> 24;\\n };\\n // BigInteger.prototype.shortValue = bnShortValue;\\n // (public) return value as short (assumes DB>=16)\\n BigInteger.prototype.shortValue = function () {\\n return (this.t == 0) ? this.s : (this[0] << 16) >> 16;\\n };\\n // BigInteger.prototype.signum = bnSigNum;\\n // (public) 0 if this == 0, 1 if this > 0\\n BigInteger.prototype.signum = function () {\\n if (this.s < 0) {\\n return -1;\\n }\\n else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) {\\n return 0;\\n }\\n else {\\n return 1;\\n }\\n };\\n // BigInteger.prototype.toByteArray = bnToByteArray;\\n // (public) convert to bigendian byte array\\n BigInteger.prototype.toByteArray = function () {\\n var i = this.t;\\n var r = [];\\n r[0] = this.s;\\n var p = this.DB - (i * this.DB) % 8;\\n var d;\\n var k = 0;\\n if (i-- > 0) {\\n if (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p) {\\n r[k++] = d | (this.s << (this.DB - p));\\n }\\n while (i >= 0) {\\n if (p < 8) {\\n d = (this[i] & ((1 << p) - 1)) << (8 - p);\\n d |= this[--i] >> (p += this.DB - 8);\\n }\\n else {\\n d = (this[i] >> (p -= 8)) & 0xff;\\n if (p <= 0) {\\n p += this.DB;\\n --i;\\n }\\n }\\n if ((d & 0x80) != 0) {\\n d |= -256;\\n }\\n if (k == 0 && (this.s & 0x80) != (d & 0x80)) {\\n ++k;\\n }\\n if (k > 0 || d != this.s) {\\n r[k++] = d;\\n }\\n }\\n }\\n return r;\\n };\\n // BigInteger.prototype.equals = bnEquals;\\n BigInteger.prototype.equals = function (a) {\\n return (this.compareTo(a) == 0);\\n };\\n // BigInteger.prototype.min = bnMin;\\n BigInteger.prototype.min = function (a) {\\n return (this.compareTo(a) < 0) ? this : a;\\n };\\n // BigInteger.prototype.max = bnMax;\\n BigInteger.prototype.max = function (a) {\\n return (this.compareTo(a) > 0) ? this : a;\\n };\\n // BigInteger.prototype.and = bnAnd;\\n BigInteger.prototype.and = function (a) {\\n var r = nbi();\\n this.bitwiseTo(a, _util__WEBPACK_IMPORTED_MODULE_0__.op_and, r);\\n return r;\\n };\\n // BigInteger.prototype.or = bnOr;\\n BigInteger.prototype.or = function (a) {\\n var r = nbi();\\n this.bitwiseTo(a, _util__WEBPACK_IMPORTED_MODULE_0__.op_or, r);\\n return r;\\n };\\n // BigInteger.prototype.xor = bnXor;\\n BigInteger.prototype.xor = function (a) {\\n var r = nbi();\\n this.bitwiseTo(a, _util__WEBPACK_IMPORTED_MODULE_0__.op_xor, r);\\n return r;\\n };\\n // BigInteger.prototype.andNot = bnAndNot;\\n BigInteger.prototype.andNot = function (a) {\\n var r = nbi();\\n this.bitwiseTo(a, _util__WEBPACK_IMPORTED_MODULE_0__.op_andnot, r);\\n return r;\\n };\\n // BigInteger.prototype.not = bnNot;\\n // (public) ~this\\n BigInteger.prototype.not = function () {\\n var r = nbi();\\n for (var i = 0; i < this.t; ++i) {\\n r[i] = this.DM & ~this[i];\\n }\\n r.t = this.t;\\n r.s = ~this.s;\\n return r;\\n };\\n // BigInteger.prototype.shiftLeft = bnShiftLeft;\\n // (public) this << n\\n BigInteger.prototype.shiftLeft = function (n) {\\n var r = nbi();\\n if (n < 0) {\\n this.rShiftTo(-n, r);\\n }\\n else {\\n this.lShiftTo(n, r);\\n }\\n return r;\\n };\\n // BigInteger.prototype.shiftRight = bnShiftRight;\\n // (public) this >> n\\n BigInteger.prototype.shiftRight = function (n) {\\n var r = nbi();\\n if (n < 0) {\\n this.lShiftTo(-n, r);\\n }\\n else {\\n this.rShiftTo(n, r);\\n }\\n return r;\\n };\\n // BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;\\n // (public) returns index of lowest 1-bit (or -1 if none)\\n BigInteger.prototype.getLowestSetBit = function () {\\n for (var i = 0; i < this.t; ++i) {\\n if (this[i] != 0) {\\n return i * this.DB + (0,_util__WEBPACK_IMPORTED_MODULE_0__.lbit)(this[i]);\\n }\\n }\\n if (this.s < 0) {\\n return this.t * this.DB;\\n }\\n return -1;\\n };\\n // BigInteger.prototype.bitCount = bnBitCount;\\n // (public) return number of set bits\\n BigInteger.prototype.bitCount = function () {\\n var r = 0;\\n var x = this.s & this.DM;\\n for (var i = 0; i < this.t; ++i) {\\n r += (0,_util__WEBPACK_IMPORTED_MODULE_0__.cbit)(this[i] ^ x);\\n }\\n return r;\\n };\\n // BigInteger.prototype.testBit = bnTestBit;\\n // (public) true iff nth bit is set\\n BigInteger.prototype.testBit = function (n) {\\n var j = Math.floor(n / this.DB);\\n if (j >= this.t) {\\n return (this.s != 0);\\n }\\n return ((this[j] & (1 << (n % this.DB))) != 0);\\n };\\n // BigInteger.prototype.setBit = bnSetBit;\\n // (public) this | (1< 1) {\\n var g2 = nbi();\\n z.sqrTo(g[1], g2);\\n while (n <= km) {\\n g[n] = nbi();\\n z.mulTo(g2, g[n - 2], g[n]);\\n n += 2;\\n }\\n }\\n var j = e.t - 1;\\n var w;\\n var is1 = true;\\n var r2 = nbi();\\n var t;\\n i = nbits(e[j]) - 1;\\n while (j >= 0) {\\n if (i >= k1) {\\n w = (e[j] >> (i - k1)) & km;\\n }\\n else {\\n w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i);\\n if (j > 0) {\\n w |= e[j - 1] >> (this.DB + i - k1);\\n }\\n }\\n n = k;\\n while ((w & 1) == 0) {\\n w >>= 1;\\n --n;\\n }\\n if ((i -= n) < 0) {\\n i += this.DB;\\n --j;\\n }\\n if (is1) { // ret == 1, don't bother squaring or multiplying it\\n g[w].copyTo(r);\\n is1 = false;\\n }\\n else {\\n while (n > 1) {\\n z.sqrTo(r, r2);\\n z.sqrTo(r2, r);\\n n -= 2;\\n }\\n if (n > 0) {\\n z.sqrTo(r, r2);\\n }\\n else {\\n t = r;\\n r = r2;\\n r2 = t;\\n }\\n z.mulTo(r2, g[w], r);\\n }\\n while (j >= 0 && (e[j] & (1 << i)) == 0) {\\n z.sqrTo(r, r2);\\n t = r;\\n r = r2;\\n r2 = t;\\n if (--i < 0) {\\n i = this.DB - 1;\\n --j;\\n }\\n }\\n }\\n return z.revert(r);\\n };\\n // BigInteger.prototype.modInverse = bnModInverse;\\n // (public) 1/this % m (HAC 14.61)\\n BigInteger.prototype.modInverse = function (m) {\\n var ac = m.isEven();\\n if ((this.isEven() && ac) || m.signum() == 0) {\\n return BigInteger.ZERO;\\n }\\n var u = m.clone();\\n var v = this.clone();\\n var a = nbv(1);\\n var b = nbv(0);\\n var c = nbv(0);\\n var d = nbv(1);\\n while (u.signum() != 0) {\\n while (u.isEven()) {\\n u.rShiftTo(1, u);\\n if (ac) {\\n if (!a.isEven() || !b.isEven()) {\\n a.addTo(this, a);\\n b.subTo(m, b);\\n }\\n a.rShiftTo(1, a);\\n }\\n else if (!b.isEven()) {\\n b.subTo(m, b);\\n }\\n b.rShiftTo(1, b);\\n }\\n while (v.isEven()) {\\n v.rShiftTo(1, v);\\n if (ac) {\\n if (!c.isEven() || !d.isEven()) {\\n c.addTo(this, c);\\n d.subTo(m, d);\\n }\\n c.rShiftTo(1, c);\\n }\\n else if (!d.isEven()) {\\n d.subTo(m, d);\\n }\\n d.rShiftTo(1, d);\\n }\\n if (u.compareTo(v) >= 0) {\\n u.subTo(v, u);\\n if (ac) {\\n a.subTo(c, a);\\n }\\n b.subTo(d, b);\\n }\\n else {\\n v.subTo(u, v);\\n if (ac) {\\n c.subTo(a, c);\\n }\\n d.subTo(b, d);\\n }\\n }\\n if (v.compareTo(BigInteger.ONE) != 0) {\\n return BigInteger.ZERO;\\n }\\n if (d.compareTo(m) >= 0) {\\n return d.subtract(m);\\n }\\n if (d.signum() < 0) {\\n d.addTo(m, d);\\n }\\n else {\\n return d;\\n }\\n if (d.signum() < 0) {\\n return d.add(m);\\n }\\n else {\\n return d;\\n }\\n };\\n // BigInteger.prototype.pow = bnPow;\\n // (public) this^e\\n BigInteger.prototype.pow = function (e) {\\n return this.exp(e, new NullExp());\\n };\\n // BigInteger.prototype.gcd = bnGCD;\\n // (public) gcd(this,a) (HAC 14.54)\\n BigInteger.prototype.gcd = function (a) {\\n var x = (this.s < 0) ? this.negate() : this.clone();\\n var y = (a.s < 0) ? a.negate() : a.clone();\\n if (x.compareTo(y) < 0) {\\n var t = x;\\n x = y;\\n y = t;\\n }\\n var i = x.getLowestSetBit();\\n var g = y.getLowestSetBit();\\n if (g < 0) {\\n return x;\\n }\\n if (i < g) {\\n g = i;\\n }\\n if (g > 0) {\\n x.rShiftTo(g, x);\\n y.rShiftTo(g, y);\\n }\\n while (x.signum() > 0) {\\n if ((i = x.getLowestSetBit()) > 0) {\\n x.rShiftTo(i, x);\\n }\\n if ((i = y.getLowestSetBit()) > 0) {\\n y.rShiftTo(i, y);\\n }\\n if (x.compareTo(y) >= 0) {\\n x.subTo(y, x);\\n x.rShiftTo(1, x);\\n }\\n else {\\n y.subTo(x, y);\\n y.rShiftTo(1, y);\\n }\\n }\\n if (g > 0) {\\n y.lShiftTo(g, y);\\n }\\n return y;\\n };\\n // BigInteger.prototype.isProbablePrime = bnIsProbablePrime;\\n // (public) test primality with certainty >= 1-.5^t\\n BigInteger.prototype.isProbablePrime = function (t) {\\n var i;\\n var x = this.abs();\\n if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {\\n for (i = 0; i < lowprimes.length; ++i) {\\n if (x[0] == lowprimes[i]) {\\n return true;\\n }\\n }\\n return false;\\n }\\n if (x.isEven()) {\\n return false;\\n }\\n i = 1;\\n while (i < lowprimes.length) {\\n var m = lowprimes[i];\\n var j = i + 1;\\n while (j < lowprimes.length && m < lplim) {\\n m *= lowprimes[j++];\\n }\\n m = x.modInt(m);\\n while (i < j) {\\n if (m % lowprimes[i++] == 0) {\\n return false;\\n }\\n }\\n }\\n return x.millerRabin(t);\\n };\\n //#endregion PUBLIC\\n //#region PROTECTED\\n // BigInteger.prototype.copyTo = bnpCopyTo;\\n // (protected) copy this to r\\n BigInteger.prototype.copyTo = function (r) {\\n for (var i = this.t - 1; i >= 0; --i) {\\n r[i] = this[i];\\n }\\n r.t = this.t;\\n r.s = this.s;\\n };\\n // BigInteger.prototype.fromInt = bnpFromInt;\\n // (protected) set from integer value x, -DV <= x < DV\\n BigInteger.prototype.fromInt = function (x) {\\n this.t = 1;\\n this.s = (x < 0) ? -1 : 0;\\n if (x > 0) {\\n this[0] = x;\\n }\\n else if (x < -1) {\\n this[0] = x + this.DV;\\n }\\n else {\\n this.t = 0;\\n }\\n };\\n // BigInteger.prototype.fromString = bnpFromString;\\n // (protected) set from string and radix\\n BigInteger.prototype.fromString = function (s, b) {\\n var k;\\n if (b == 16) {\\n k = 4;\\n }\\n else if (b == 8) {\\n k = 3;\\n }\\n else if (b == 256) {\\n k = 8;\\n /* byte array */\\n }\\n else if (b == 2) {\\n k = 1;\\n }\\n else if (b == 32) {\\n k = 5;\\n }\\n else if (b == 4) {\\n k = 2;\\n }\\n else {\\n this.fromRadix(s, b);\\n return;\\n }\\n this.t = 0;\\n this.s = 0;\\n var i = s.length;\\n var mi = false;\\n var sh = 0;\\n while (--i >= 0) {\\n var x = (k == 8) ? (+s[i]) & 0xff : intAt(s, i);\\n if (x < 0) {\\n if (s.charAt(i) == \\\"-\\\") {\\n mi = true;\\n }\\n continue;\\n }\\n mi = false;\\n if (sh == 0) {\\n this[this.t++] = x;\\n }\\n else if (sh + k > this.DB) {\\n this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;\\n this[this.t++] = (x >> (this.DB - sh));\\n }\\n else {\\n this[this.t - 1] |= x << sh;\\n }\\n sh += k;\\n if (sh >= this.DB) {\\n sh -= this.DB;\\n }\\n }\\n if (k == 8 && ((+s[0]) & 0x80) != 0) {\\n this.s = -1;\\n if (sh > 0) {\\n this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;\\n }\\n }\\n this.clamp();\\n if (mi) {\\n BigInteger.ZERO.subTo(this, this);\\n }\\n };\\n // BigInteger.prototype.clamp = bnpClamp;\\n // (protected) clamp off excess high words\\n BigInteger.prototype.clamp = function () {\\n var c = this.s & this.DM;\\n while (this.t > 0 && this[this.t - 1] == c) {\\n --this.t;\\n }\\n };\\n // BigInteger.prototype.dlShiftTo = bnpDLShiftTo;\\n // (protected) r = this << n*DB\\n BigInteger.prototype.dlShiftTo = function (n, r) {\\n var i;\\n for (i = this.t - 1; i >= 0; --i) {\\n r[i + n] = this[i];\\n }\\n for (i = n - 1; i >= 0; --i) {\\n r[i] = 0;\\n }\\n r.t = this.t + n;\\n r.s = this.s;\\n };\\n // BigInteger.prototype.drShiftTo = bnpDRShiftTo;\\n // (protected) r = this >> n*DB\\n BigInteger.prototype.drShiftTo = function (n, r) {\\n for (var i = n; i < this.t; ++i) {\\n r[i - n] = this[i];\\n }\\n r.t = Math.max(this.t - n, 0);\\n r.s = this.s;\\n };\\n // BigInteger.prototype.lShiftTo = bnpLShiftTo;\\n // (protected) r = this << n\\n BigInteger.prototype.lShiftTo = function (n, r) {\\n var bs = n % this.DB;\\n var cbs = this.DB - bs;\\n var bm = (1 << cbs) - 1;\\n var ds = Math.floor(n / this.DB);\\n var c = (this.s << bs) & this.DM;\\n for (var i = this.t - 1; i >= 0; --i) {\\n r[i + ds + 1] = (this[i] >> cbs) | c;\\n c = (this[i] & bm) << bs;\\n }\\n for (var i = ds - 1; i >= 0; --i) {\\n r[i] = 0;\\n }\\n r[ds] = c;\\n r.t = this.t + ds + 1;\\n r.s = this.s;\\n r.clamp();\\n };\\n // BigInteger.prototype.rShiftTo = bnpRShiftTo;\\n // (protected) r = this >> n\\n BigInteger.prototype.rShiftTo = function (n, r) {\\n r.s = this.s;\\n var ds = Math.floor(n / this.DB);\\n if (ds >= this.t) {\\n r.t = 0;\\n return;\\n }\\n var bs = n % this.DB;\\n var cbs = this.DB - bs;\\n var bm = (1 << bs) - 1;\\n r[0] = this[ds] >> bs;\\n for (var i = ds + 1; i < this.t; ++i) {\\n r[i - ds - 1] |= (this[i] & bm) << cbs;\\n r[i - ds] = this[i] >> bs;\\n }\\n if (bs > 0) {\\n r[this.t - ds - 1] |= (this.s & bm) << cbs;\\n }\\n r.t = this.t - ds;\\n r.clamp();\\n };\\n // BigInteger.prototype.subTo = bnpSubTo;\\n // (protected) r = this - a\\n BigInteger.prototype.subTo = function (a, r) {\\n var i = 0;\\n var c = 0;\\n var m = Math.min(a.t, this.t);\\n while (i < m) {\\n c += this[i] - a[i];\\n r[i++] = c & this.DM;\\n c >>= this.DB;\\n }\\n if (a.t < this.t) {\\n c -= a.s;\\n while (i < this.t) {\\n c += this[i];\\n r[i++] = c & this.DM;\\n c >>= this.DB;\\n }\\n c += this.s;\\n }\\n else {\\n c += this.s;\\n while (i < a.t) {\\n c -= a[i];\\n r[i++] = c & this.DM;\\n c >>= this.DB;\\n }\\n c -= a.s;\\n }\\n r.s = (c < 0) ? -1 : 0;\\n if (c < -1) {\\n r[i++] = this.DV + c;\\n }\\n else if (c > 0) {\\n r[i++] = c;\\n }\\n r.t = i;\\n r.clamp();\\n };\\n // BigInteger.prototype.multiplyTo = bnpMultiplyTo;\\n // (protected) r = this * a, r != this,a (HAC 14.12)\\n // \\\"this\\\" should be the larger one if appropriate.\\n BigInteger.prototype.multiplyTo = function (a, r) {\\n var x = this.abs();\\n var y = a.abs();\\n var i = x.t;\\n r.t = i + y.t;\\n while (--i >= 0) {\\n r[i] = 0;\\n }\\n for (i = 0; i < y.t; ++i) {\\n r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\\n }\\n r.s = 0;\\n r.clamp();\\n if (this.s != a.s) {\\n BigInteger.ZERO.subTo(r, r);\\n }\\n };\\n // BigInteger.prototype.squareTo = bnpSquareTo;\\n // (protected) r = this^2, r != this (HAC 14.16)\\n BigInteger.prototype.squareTo = function (r) {\\n var x = this.abs();\\n var i = r.t = 2 * x.t;\\n while (--i >= 0) {\\n r[i] = 0;\\n }\\n for (i = 0; i < x.t - 1; ++i) {\\n var c = x.am(i, x[i], r, 2 * i, 0, 1);\\n if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\\n r[i + x.t] -= x.DV;\\n r[i + x.t + 1] = 1;\\n }\\n }\\n if (r.t > 0) {\\n r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\\n }\\n r.s = 0;\\n r.clamp();\\n };\\n // BigInteger.prototype.divRemTo = bnpDivRemTo;\\n // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\\n // r != q, this != m. q or r may be null.\\n BigInteger.prototype.divRemTo = function (m, q, r) {\\n var pm = m.abs();\\n if (pm.t <= 0) {\\n return;\\n }\\n var pt = this.abs();\\n if (pt.t < pm.t) {\\n if (q != null) {\\n q.fromInt(0);\\n }\\n if (r != null) {\\n this.copyTo(r);\\n }\\n return;\\n }\\n if (r == null) {\\n r = nbi();\\n }\\n var y = nbi();\\n var ts = this.s;\\n var ms = m.s;\\n var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus\\n if (nsh > 0) {\\n pm.lShiftTo(nsh, y);\\n pt.lShiftTo(nsh, r);\\n }\\n else {\\n pm.copyTo(y);\\n pt.copyTo(r);\\n }\\n var ys = y.t;\\n var y0 = y[ys - 1];\\n if (y0 == 0) {\\n return;\\n }\\n var yt = y0 * (1 << this.F1) + ((ys > 1) ? y[ys - 2] >> this.F2 : 0);\\n var d1 = this.FV / yt;\\n var d2 = (1 << this.F1) / yt;\\n var e = 1 << this.F2;\\n var i = r.t;\\n var j = i - ys;\\n var t = (q == null) ? nbi() : q;\\n y.dlShiftTo(j, t);\\n if (r.compareTo(t) >= 0) {\\n r[r.t++] = 1;\\n r.subTo(t, r);\\n }\\n BigInteger.ONE.dlShiftTo(ys, t);\\n t.subTo(y, y); // \\\"negative\\\" y so we can replace sub with am later\\n while (y.t < ys) {\\n y[y.t++] = 0;\\n }\\n while (--j >= 0) {\\n // Estimate quotient digit\\n var qd = (r[--i] == y0) ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\\n if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out\\n y.dlShiftTo(j, t);\\n r.subTo(t, r);\\n while (r[i] < --qd) {\\n r.subTo(t, r);\\n }\\n }\\n }\\n if (q != null) {\\n r.drShiftTo(ys, q);\\n if (ts != ms) {\\n BigInteger.ZERO.subTo(q, q);\\n }\\n }\\n r.t = ys;\\n r.clamp();\\n if (nsh > 0) {\\n r.rShiftTo(nsh, r);\\n } // Denormalize remainder\\n if (ts < 0) {\\n BigInteger.ZERO.subTo(r, r);\\n }\\n };\\n // BigInteger.prototype.invDigit = bnpInvDigit;\\n // (protected) return \\\"-1/this % 2^DB\\\"; useful for Mont. reduction\\n // justification:\\n // xy == 1 (mod m)\\n // xy = 1+km\\n // xy(2-xy) = (1+km)(1-km)\\n // x[y(2-xy)] = 1-k^2m^2\\n // x[y(2-xy)] == 1 (mod m^2)\\n // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\\n // should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\\n // JS multiply \\\"overflows\\\" differently from C/C++, so care is needed here.\\n BigInteger.prototype.invDigit = function () {\\n if (this.t < 1) {\\n return 0;\\n }\\n var x = this[0];\\n if ((x & 1) == 0) {\\n return 0;\\n }\\n var y = x & 3; // y == 1/x mod 2^2\\n y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4\\n y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8\\n y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16\\n // last step - calculate inverse mod DV directly;\\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\\n y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits\\n // we really want the negative inverse, and -DV < y < DV\\n return (y > 0) ? this.DV - y : -y;\\n };\\n // BigInteger.prototype.isEven = bnpIsEven;\\n // (protected) true iff this is even\\n BigInteger.prototype.isEven = function () {\\n return ((this.t > 0) ? (this[0] & 1) : this.s) == 0;\\n };\\n // BigInteger.prototype.exp = bnpExp;\\n // (protected) this^e, e < 2^32, doing sqr and mul with \\\"r\\\" (HAC 14.79)\\n BigInteger.prototype.exp = function (e, z) {\\n if (e > 0xffffffff || e < 1) {\\n return BigInteger.ONE;\\n }\\n var r = nbi();\\n var r2 = nbi();\\n var g = z.convert(this);\\n var i = nbits(e) - 1;\\n g.copyTo(r);\\n while (--i >= 0) {\\n z.sqrTo(r, r2);\\n if ((e & (1 << i)) > 0) {\\n z.mulTo(r2, g, r);\\n }\\n else {\\n var t = r;\\n r = r2;\\n r2 = t;\\n }\\n }\\n return z.revert(r);\\n };\\n // BigInteger.prototype.chunkSize = bnpChunkSize;\\n // (protected) return x s.t. r^x < DV\\n BigInteger.prototype.chunkSize = function (r) {\\n return Math.floor(Math.LN2 * this.DB / Math.log(r));\\n };\\n // BigInteger.prototype.toRadix = bnpToRadix;\\n // (protected) convert to radix string\\n BigInteger.prototype.toRadix = function (b) {\\n if (b == null) {\\n b = 10;\\n }\\n if (this.signum() == 0 || b < 2 || b > 36) {\\n return \\\"0\\\";\\n }\\n var cs = this.chunkSize(b);\\n var a = Math.pow(b, cs);\\n var d = nbv(a);\\n var y = nbi();\\n var z = nbi();\\n var r = \\\"\\\";\\n this.divRemTo(d, y, z);\\n while (y.signum() > 0) {\\n r = (a + z.intValue()).toString(b).substr(1) + r;\\n y.divRemTo(d, y, z);\\n }\\n return z.intValue().toString(b) + r;\\n };\\n // BigInteger.prototype.fromRadix = bnpFromRadix;\\n // (protected) convert from radix string\\n BigInteger.prototype.fromRadix = function (s, b) {\\n this.fromInt(0);\\n if (b == null) {\\n b = 10;\\n }\\n var cs = this.chunkSize(b);\\n var d = Math.pow(b, cs);\\n var mi = false;\\n var j = 0;\\n var w = 0;\\n for (var i = 0; i < s.length; ++i) {\\n var x = intAt(s, i);\\n if (x < 0) {\\n if (s.charAt(i) == \\\"-\\\" && this.signum() == 0) {\\n mi = true;\\n }\\n continue;\\n }\\n w = b * w + x;\\n if (++j >= cs) {\\n this.dMultiply(d);\\n this.dAddOffset(w, 0);\\n j = 0;\\n w = 0;\\n }\\n }\\n if (j > 0) {\\n this.dMultiply(Math.pow(b, j));\\n this.dAddOffset(w, 0);\\n }\\n if (mi) {\\n BigInteger.ZERO.subTo(this, this);\\n }\\n };\\n // BigInteger.prototype.fromNumber = bnpFromNumber;\\n // (protected) alternate constructor\\n BigInteger.prototype.fromNumber = function (a, b, c) {\\n if (\\\"number\\\" == typeof b) {\\n // new BigInteger(int,int,RNG)\\n if (a < 2) {\\n this.fromInt(1);\\n }\\n else {\\n this.fromNumber(a, c);\\n if (!this.testBit(a - 1)) {\\n // force MSB set\\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), _util__WEBPACK_IMPORTED_MODULE_0__.op_or, this);\\n }\\n if (this.isEven()) {\\n this.dAddOffset(1, 0);\\n } // force odd\\n while (!this.isProbablePrime(b)) {\\n this.dAddOffset(2, 0);\\n if (this.bitLength() > a) {\\n this.subTo(BigInteger.ONE.shiftLeft(a - 1), this);\\n }\\n }\\n }\\n }\\n else {\\n // new BigInteger(int,RNG)\\n var x = [];\\n var t = a & 7;\\n x.length = (a >> 3) + 1;\\n b.nextBytes(x);\\n if (t > 0) {\\n x[0] &= ((1 << t) - 1);\\n }\\n else {\\n x[0] = 0;\\n }\\n this.fromString(x, 256);\\n }\\n };\\n // BigInteger.prototype.bitwiseTo = bnpBitwiseTo;\\n // (protected) r = this op a (bitwise)\\n BigInteger.prototype.bitwiseTo = function (a, op, r) {\\n var i;\\n var f;\\n var m = Math.min(a.t, this.t);\\n for (i = 0; i < m; ++i) {\\n r[i] = op(this[i], a[i]);\\n }\\n if (a.t < this.t) {\\n f = a.s & this.DM;\\n for (i = m; i < this.t; ++i) {\\n r[i] = op(this[i], f);\\n }\\n r.t = this.t;\\n }\\n else {\\n f = this.s & this.DM;\\n for (i = m; i < a.t; ++i) {\\n r[i] = op(f, a[i]);\\n }\\n r.t = a.t;\\n }\\n r.s = op(this.s, a.s);\\n r.clamp();\\n };\\n // BigInteger.prototype.changeBit = bnpChangeBit;\\n // (protected) this op (1<>= this.DB;\\n }\\n if (a.t < this.t) {\\n c += a.s;\\n while (i < this.t) {\\n c += this[i];\\n r[i++] = c & this.DM;\\n c >>= this.DB;\\n }\\n c += this.s;\\n }\\n else {\\n c += this.s;\\n while (i < a.t) {\\n c += a[i];\\n r[i++] = c & this.DM;\\n c >>= this.DB;\\n }\\n c += a.s;\\n }\\n r.s = (c < 0) ? -1 : 0;\\n if (c > 0) {\\n r[i++] = c;\\n }\\n else if (c < -1) {\\n r[i++] = this.DV + c;\\n }\\n r.t = i;\\n r.clamp();\\n };\\n // BigInteger.prototype.dMultiply = bnpDMultiply;\\n // (protected) this *= n, this >= 0, 1 < n < DV\\n BigInteger.prototype.dMultiply = function (n) {\\n this[this.t] = this.am(0, n - 1, this, 0, 0, this.t);\\n ++this.t;\\n this.clamp();\\n };\\n // BigInteger.prototype.dAddOffset = bnpDAddOffset;\\n // (protected) this += n << w words, this >= 0\\n BigInteger.prototype.dAddOffset = function (n, w) {\\n if (n == 0) {\\n return;\\n }\\n while (this.t <= w) {\\n this[this.t++] = 0;\\n }\\n this[w] += n;\\n while (this[w] >= this.DV) {\\n this[w] -= this.DV;\\n if (++w >= this.t) {\\n this[this.t++] = 0;\\n }\\n ++this[w];\\n }\\n };\\n // BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;\\n // (protected) r = lower n words of \\\"this * a\\\", a.t <= n\\n // \\\"this\\\" should be the larger one if appropriate.\\n BigInteger.prototype.multiplyLowerTo = function (a, n, r) {\\n var i = Math.min(this.t + a.t, n);\\n r.s = 0; // assumes a,this >= 0\\n r.t = i;\\n while (i > 0) {\\n r[--i] = 0;\\n }\\n for (var j = r.t - this.t; i < j; ++i) {\\n r[i + this.t] = this.am(0, a[i], r, i, 0, this.t);\\n }\\n for (var j = Math.min(a.t, n); i < j; ++i) {\\n this.am(0, a[i], r, i, 0, n - i);\\n }\\n r.clamp();\\n };\\n // BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;\\n // (protected) r = \\\"this * a\\\" without lower n words, n > 0\\n // \\\"this\\\" should be the larger one if appropriate.\\n BigInteger.prototype.multiplyUpperTo = function (a, n, r) {\\n --n;\\n var i = r.t = this.t + a.t - n;\\n r.s = 0; // assumes a,this >= 0\\n while (--i >= 0) {\\n r[i] = 0;\\n }\\n for (i = Math.max(n - this.t, 0); i < a.t; ++i) {\\n r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n);\\n }\\n r.clamp();\\n r.drShiftTo(1, r);\\n };\\n // BigInteger.prototype.modInt = bnpModInt;\\n // (protected) this % n, n < 2^26\\n BigInteger.prototype.modInt = function (n) {\\n if (n <= 0) {\\n return 0;\\n }\\n var d = this.DV % n;\\n var r = (this.s < 0) ? n - 1 : 0;\\n if (this.t > 0) {\\n if (d == 0) {\\n r = this[0] % n;\\n }\\n else {\\n for (var i = this.t - 1; i >= 0; --i) {\\n r = (d * r + this[i]) % n;\\n }\\n }\\n }\\n return r;\\n };\\n // BigInteger.prototype.millerRabin = bnpMillerRabin;\\n // (protected) true if probably prime (HAC 4.24, Miller-Rabin)\\n BigInteger.prototype.millerRabin = function (t) {\\n var n1 = this.subtract(BigInteger.ONE);\\n var k = n1.getLowestSetBit();\\n if (k <= 0) {\\n return false;\\n }\\n var r = n1.shiftRight(k);\\n t = (t + 1) >> 1;\\n if (t > lowprimes.length) {\\n t = lowprimes.length;\\n }\\n var a = nbi();\\n for (var i = 0; i < t; ++i) {\\n // Pick bases at random, instead of starting at 2\\n a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);\\n var y = a.modPow(r, this);\\n if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {\\n var j = 1;\\n while (j++ < k && y.compareTo(n1) != 0) {\\n y = y.modPowInt(2, this);\\n if (y.compareTo(BigInteger.ONE) == 0) {\\n return false;\\n }\\n }\\n if (y.compareTo(n1) != 0) {\\n return false;\\n }\\n }\\n }\\n return true;\\n };\\n // BigInteger.prototype.square = bnSquare;\\n // (public) this^2\\n BigInteger.prototype.square = function () {\\n var r = nbi();\\n this.squareTo(r);\\n return r;\\n };\\n //#region ASYNC\\n // Public API method\\n BigInteger.prototype.gcda = function (a, callback) {\\n var x = (this.s < 0) ? this.negate() : this.clone();\\n var y = (a.s < 0) ? a.negate() : a.clone();\\n if (x.compareTo(y) < 0) {\\n var t = x;\\n x = y;\\n y = t;\\n }\\n var i = x.getLowestSetBit();\\n var g = y.getLowestSetBit();\\n if (g < 0) {\\n callback(x);\\n return;\\n }\\n if (i < g) {\\n g = i;\\n }\\n if (g > 0) {\\n x.rShiftTo(g, x);\\n y.rShiftTo(g, y);\\n }\\n // Workhorse of the algorithm, gets called 200 - 800 times per 512 bit keygen.\\n var gcda1 = function () {\\n if ((i = x.getLowestSetBit()) > 0) {\\n x.rShiftTo(i, x);\\n }\\n if ((i = y.getLowestSetBit()) > 0) {\\n y.rShiftTo(i, y);\\n }\\n if (x.compareTo(y) >= 0) {\\n x.subTo(y, x);\\n x.rShiftTo(1, x);\\n }\\n else {\\n y.subTo(x, y);\\n y.rShiftTo(1, y);\\n }\\n if (!(x.signum() > 0)) {\\n if (g > 0) {\\n y.lShiftTo(g, y);\\n }\\n setTimeout(function () { callback(y); }, 0); // escape\\n }\\n else {\\n setTimeout(gcda1, 0);\\n }\\n };\\n setTimeout(gcda1, 10);\\n };\\n // (protected) alternate constructor\\n BigInteger.prototype.fromNumberAsync = function (a, b, c, callback) {\\n if (\\\"number\\\" == typeof b) {\\n if (a < 2) {\\n this.fromInt(1);\\n }\\n else {\\n this.fromNumber(a, c);\\n if (!this.testBit(a - 1)) {\\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), _util__WEBPACK_IMPORTED_MODULE_0__.op_or, this);\\n }\\n if (this.isEven()) {\\n this.dAddOffset(1, 0);\\n }\\n var bnp_1 = this;\\n var bnpfn1_1 = function () {\\n bnp_1.dAddOffset(2, 0);\\n if (bnp_1.bitLength() > a) {\\n bnp_1.subTo(BigInteger.ONE.shiftLeft(a - 1), bnp_1);\\n }\\n if (bnp_1.isProbablePrime(b)) {\\n setTimeout(function () { callback(); }, 0); // escape\\n }\\n else {\\n setTimeout(bnpfn1_1, 0);\\n }\\n };\\n setTimeout(bnpfn1_1, 0);\\n }\\n }\\n else {\\n var x = [];\\n var t = a & 7;\\n x.length = (a >> 3) + 1;\\n b.nextBytes(x);\\n if (t > 0) {\\n x[0] &= ((1 << t) - 1);\\n }\\n else {\\n x[0] = 0;\\n }\\n this.fromString(x, 256);\\n }\\n };\\n return BigInteger;\\n}());\\n\\n//#region REDUCERS\\n//#region NullExp\\nvar NullExp = /** @class */ (function () {\\n function NullExp() {\\n }\\n // NullExp.prototype.convert = nNop;\\n NullExp.prototype.convert = function (x) {\\n return x;\\n };\\n // NullExp.prototype.revert = nNop;\\n NullExp.prototype.revert = function (x) {\\n return x;\\n };\\n // NullExp.prototype.mulTo = nMulTo;\\n NullExp.prototype.mulTo = function (x, y, r) {\\n x.multiplyTo(y, r);\\n };\\n // NullExp.prototype.sqrTo = nSqrTo;\\n NullExp.prototype.sqrTo = function (x, r) {\\n x.squareTo(r);\\n };\\n return NullExp;\\n}());\\n// Modular reduction using \\\"classic\\\" algorithm\\nvar Classic = /** @class */ (function () {\\n function Classic(m) {\\n this.m = m;\\n }\\n // Classic.prototype.convert = cConvert;\\n Classic.prototype.convert = function (x) {\\n if (x.s < 0 || x.compareTo(this.m) >= 0) {\\n return x.mod(this.m);\\n }\\n else {\\n return x;\\n }\\n };\\n // Classic.prototype.revert = cRevert;\\n Classic.prototype.revert = function (x) {\\n return x;\\n };\\n // Classic.prototype.reduce = cReduce;\\n Classic.prototype.reduce = function (x) {\\n x.divRemTo(this.m, null, x);\\n };\\n // Classic.prototype.mulTo = cMulTo;\\n Classic.prototype.mulTo = function (x, y, r) {\\n x.multiplyTo(y, r);\\n this.reduce(r);\\n };\\n // Classic.prototype.sqrTo = cSqrTo;\\n Classic.prototype.sqrTo = function (x, r) {\\n x.squareTo(r);\\n this.reduce(r);\\n };\\n return Classic;\\n}());\\n//#endregion\\n//#region Montgomery\\n// Montgomery reduction\\nvar Montgomery = /** @class */ (function () {\\n function Montgomery(m) {\\n this.m = m;\\n this.mp = m.invDigit();\\n this.mpl = this.mp & 0x7fff;\\n this.mph = this.mp >> 15;\\n this.um = (1 << (m.DB - 15)) - 1;\\n this.mt2 = 2 * m.t;\\n }\\n // Montgomery.prototype.convert = montConvert;\\n // xR mod m\\n Montgomery.prototype.convert = function (x) {\\n var r = nbi();\\n x.abs().dlShiftTo(this.m.t, r);\\n r.divRemTo(this.m, null, r);\\n if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) {\\n this.m.subTo(r, r);\\n }\\n return r;\\n };\\n // Montgomery.prototype.revert = montRevert;\\n // x/R mod m\\n Montgomery.prototype.revert = function (x) {\\n var r = nbi();\\n x.copyTo(r);\\n this.reduce(r);\\n return r;\\n };\\n // Montgomery.prototype.reduce = montReduce;\\n // x = x/R mod m (HAC 14.32)\\n Montgomery.prototype.reduce = function (x) {\\n while (x.t <= this.mt2) {\\n // pad x so am has enough room later\\n x[x.t++] = 0;\\n }\\n for (var i = 0; i < this.m.t; ++i) {\\n // faster way of calculating u0 = x[i]*mp mod DV\\n var j = x[i] & 0x7fff;\\n var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM;\\n // use am to combine the multiply-shift-add into one call\\n j = i + this.m.t;\\n x[j] += this.m.am(0, u0, x, i, 0, this.m.t);\\n // propagate carry\\n while (x[j] >= x.DV) {\\n x[j] -= x.DV;\\n x[++j]++;\\n }\\n }\\n x.clamp();\\n x.drShiftTo(this.m.t, x);\\n if (x.compareTo(this.m) >= 0) {\\n x.subTo(this.m, x);\\n }\\n };\\n // Montgomery.prototype.mulTo = montMulTo;\\n // r = \\\"xy/R mod m\\\"; x,y != r\\n Montgomery.prototype.mulTo = function (x, y, r) {\\n x.multiplyTo(y, r);\\n this.reduce(r);\\n };\\n // Montgomery.prototype.sqrTo = montSqrTo;\\n // r = \\\"x^2/R mod m\\\"; x != r\\n Montgomery.prototype.sqrTo = function (x, r) {\\n x.squareTo(r);\\n this.reduce(r);\\n };\\n return Montgomery;\\n}());\\n//#endregion Montgomery\\n//#region Barrett\\n// Barrett modular reduction\\nvar Barrett = /** @class */ (function () {\\n function Barrett(m) {\\n this.m = m;\\n // setup Barrett\\n this.r2 = nbi();\\n this.q3 = nbi();\\n BigInteger.ONE.dlShiftTo(2 * m.t, this.r2);\\n this.mu = this.r2.divide(m);\\n }\\n // Barrett.prototype.convert = barrettConvert;\\n Barrett.prototype.convert = function (x) {\\n if (x.s < 0 || x.t > 2 * this.m.t) {\\n return x.mod(this.m);\\n }\\n else if (x.compareTo(this.m) < 0) {\\n return x;\\n }\\n else {\\n var r = nbi();\\n x.copyTo(r);\\n this.reduce(r);\\n return r;\\n }\\n };\\n // Barrett.prototype.revert = barrettRevert;\\n Barrett.prototype.revert = function (x) {\\n return x;\\n };\\n // Barrett.prototype.reduce = barrettReduce;\\n // x = x mod m (HAC 14.42)\\n Barrett.prototype.reduce = function (x) {\\n x.drShiftTo(this.m.t - 1, this.r2);\\n if (x.t > this.m.t + 1) {\\n x.t = this.m.t + 1;\\n x.clamp();\\n }\\n this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3);\\n this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);\\n while (x.compareTo(this.r2) < 0) {\\n x.dAddOffset(1, this.m.t + 1);\\n }\\n x.subTo(this.r2, x);\\n while (x.compareTo(this.m) >= 0) {\\n x.subTo(this.m, x);\\n }\\n };\\n // Barrett.prototype.mulTo = barrettMulTo;\\n // r = x*y mod m; x,y != r\\n Barrett.prototype.mulTo = function (x, y, r) {\\n x.multiplyTo(y, r);\\n this.reduce(r);\\n };\\n // Barrett.prototype.sqrTo = barrettSqrTo;\\n // r = x^2 mod m; x != r\\n Barrett.prototype.sqrTo = function (x, r) {\\n x.squareTo(r);\\n this.reduce(r);\\n };\\n return Barrett;\\n}());\\n//#endregion\\n//#endregion REDUCERS\\n// return new, unset BigInteger\\nfunction nbi() { return new BigInteger(null); }\\nfunction parseBigInt(str, r) {\\n return new BigInteger(str, r);\\n}\\n// am: Compute w_j += (x*this_i), propagate carries,\\n// c is initial carry, returns final carry.\\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\\n// We need to select the fastest one that works in this environment.\\nvar inBrowser = typeof navigator !== \\\"undefined\\\";\\nif (inBrowser && j_lm && (navigator.appName == \\\"Microsoft Internet Explorer\\\")) {\\n // am2 avoids a big mult-and-extract completely.\\n // Max digit bits should be <= 30 because we do bitwise ops\\n // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\\n BigInteger.prototype.am = function am2(i, x, w, j, c, n) {\\n var xl = x & 0x7fff;\\n var xh = x >> 15;\\n while (--n >= 0) {\\n var l = this[i] & 0x7fff;\\n var h = this[i++] >> 15;\\n var m = xh * l + h * xl;\\n l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\\n c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\\n w[j++] = l & 0x3fffffff;\\n }\\n return c;\\n };\\n dbits = 30;\\n}\\nelse if (inBrowser && j_lm && (navigator.appName != \\\"Netscape\\\")) {\\n // am1: use a single mult and divide to get the high bits,\\n // max digit bits should be 26 because\\n // max internal value = 2*dvalue^2-2*dvalue (< 2^53)\\n BigInteger.prototype.am = function am1(i, x, w, j, c, n) {\\n while (--n >= 0) {\\n var v = x * this[i++] + w[j] + c;\\n c = Math.floor(v / 0x4000000);\\n w[j++] = v & 0x3ffffff;\\n }\\n return c;\\n };\\n dbits = 26;\\n}\\nelse { // Mozilla/Netscape seems to prefer am3\\n // Alternately, set max digit bits to 28 since some\\n // browsers slow down when dealing with 32-bit numbers.\\n BigInteger.prototype.am = function am3(i, x, w, j, c, n) {\\n var xl = x & 0x3fff;\\n var xh = x >> 14;\\n while (--n >= 0) {\\n var l = this[i] & 0x3fff;\\n var h = this[i++] >> 14;\\n var m = xh * l + h * xl;\\n l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\\n c = (l >> 28) + (m >> 14) + xh * h;\\n w[j++] = l & 0xfffffff;\\n }\\n return c;\\n };\\n dbits = 28;\\n}\\nBigInteger.prototype.DB = dbits;\\nBigInteger.prototype.DM = ((1 << dbits) - 1);\\nBigInteger.prototype.DV = (1 << dbits);\\nvar BI_FP = 52;\\nBigInteger.prototype.FV = Math.pow(2, BI_FP);\\nBigInteger.prototype.F1 = BI_FP - dbits;\\nBigInteger.prototype.F2 = 2 * dbits - BI_FP;\\n// Digit conversions\\nvar BI_RC = [];\\nvar rr;\\nvar vv;\\nrr = \\\"0\\\".charCodeAt(0);\\nfor (vv = 0; vv <= 9; ++vv) {\\n BI_RC[rr++] = vv;\\n}\\nrr = \\\"a\\\".charCodeAt(0);\\nfor (vv = 10; vv < 36; ++vv) {\\n BI_RC[rr++] = vv;\\n}\\nrr = \\\"A\\\".charCodeAt(0);\\nfor (vv = 10; vv < 36; ++vv) {\\n BI_RC[rr++] = vv;\\n}\\nfunction intAt(s, i) {\\n var c = BI_RC[s.charCodeAt(i)];\\n return (c == null) ? -1 : c;\\n}\\n// return bigint initialized to value\\nfunction nbv(i) {\\n var r = nbi();\\n r.fromInt(i);\\n return r;\\n}\\n// returns bit length of the integer x\\nfunction nbits(x) {\\n var r = 1;\\n var t;\\n if ((t = x >>> 16) != 0) {\\n x = t;\\n r += 16;\\n }\\n if ((t = x >> 8) != 0) {\\n x = t;\\n r += 8;\\n }\\n if ((t = x >> 4) != 0) {\\n x = t;\\n r += 4;\\n }\\n if ((t = x >> 2) != 0) {\\n x = t;\\n r += 2;\\n }\\n if ((t = x >> 1) != 0) {\\n x = t;\\n r += 1;\\n }\\n return r;\\n}\\n// \\\"constants\\\"\\nBigInteger.ZERO = nbv(0);\\nBigInteger.ONE = nbv(1);\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsbn/jsbn.js?\");\n\n/***/ }),\n\n/***/ \"./lib/lib/jsbn/prng4.js\":\n/*!*******************************!*\\\n !*** ./lib/lib/jsbn/prng4.js ***!\n \\*******************************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"Arcfour\\\": () => (/* binding */ Arcfour),\\n/* harmony export */ \\\"prng_newstate\\\": () => (/* binding */ prng_newstate),\\n/* harmony export */ \\\"rng_psize\\\": () => (/* binding */ rng_psize)\\n/* harmony export */ });\\n// prng4.js - uses Arcfour as a PRNG\\nvar Arcfour = /** @class */ (function () {\\n function Arcfour() {\\n this.i = 0;\\n this.j = 0;\\n this.S = [];\\n }\\n // Arcfour.prototype.init = ARC4init;\\n // Initialize arcfour context from key, an array of ints, each from [0..255]\\n Arcfour.prototype.init = function (key) {\\n var i;\\n var j;\\n var t;\\n for (i = 0; i < 256; ++i) {\\n this.S[i] = i;\\n }\\n j = 0;\\n for (i = 0; i < 256; ++i) {\\n j = (j + this.S[i] + key[i % key.length]) & 255;\\n t = this.S[i];\\n this.S[i] = this.S[j];\\n this.S[j] = t;\\n }\\n this.i = 0;\\n this.j = 0;\\n };\\n // Arcfour.prototype.next = ARC4next;\\n Arcfour.prototype.next = function () {\\n var t;\\n this.i = (this.i + 1) & 255;\\n this.j = (this.j + this.S[this.i]) & 255;\\n t = this.S[this.i];\\n this.S[this.i] = this.S[this.j];\\n this.S[this.j] = t;\\n return this.S[(t + this.S[this.i]) & 255];\\n };\\n return Arcfour;\\n}());\\n\\n// Plug in your RNG constructor here\\nfunction prng_newstate() {\\n return new Arcfour();\\n}\\n// Pool size must be a multiple of 4 and greater than 32.\\n// An array of bytes the size of the pool will be passed to init()\\nvar rng_psize = 256;\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsbn/prng4.js?\");\n\n/***/ }),\n\n/***/ \"./lib/lib/jsbn/rng.js\":\n/*!*****************************!*\\\n !*** ./lib/lib/jsbn/rng.js ***!\n \\*****************************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"SecureRandom\\\": () => (/* binding */ SecureRandom)\\n/* harmony export */ });\\n/* harmony import */ var _prng4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./prng4 */ \\\"./lib/lib/jsbn/prng4.js\\\");\\n// Random number generator - requires a PRNG backend, e.g. prng4.js\\n\\nvar rng_state;\\nvar rng_pool = null;\\nvar rng_pptr;\\n// Initialize the pool with junk if needed.\\nif (rng_pool == null) {\\n rng_pool = [];\\n rng_pptr = 0;\\n var t = void 0;\\n if (typeof window !== 'undefined' && window.crypto && window.crypto.getRandomValues) {\\n // Extract entropy (2048 bits) from RNG if available\\n var z = new Uint32Array(256);\\n window.crypto.getRandomValues(z);\\n for (t = 0; t < z.length; ++t) {\\n rng_pool[rng_pptr++] = z[t] & 255;\\n }\\n }\\n // Use mouse events for entropy, if we do not have enough entropy by the time\\n // we need it, entropy will be generated by Math.random.\\n var count = 0;\\n var onMouseMoveListener_1 = function (ev) {\\n count = count || 0;\\n if (count >= 256 || rng_pptr >= _prng4__WEBPACK_IMPORTED_MODULE_0__.rng_psize) {\\n if (window.removeEventListener) {\\n window.removeEventListener(\\\"mousemove\\\", onMouseMoveListener_1, false);\\n }\\n else if (window.detachEvent) {\\n window.detachEvent(\\\"onmousemove\\\", onMouseMoveListener_1);\\n }\\n return;\\n }\\n try {\\n var mouseCoordinates = ev.x + ev.y;\\n rng_pool[rng_pptr++] = mouseCoordinates & 255;\\n count += 1;\\n }\\n catch (e) {\\n // Sometimes Firefox will deny permission to access event properties for some reason. Ignore.\\n }\\n };\\n if (typeof window !== 'undefined') {\\n if (window.addEventListener) {\\n window.addEventListener(\\\"mousemove\\\", onMouseMoveListener_1, false);\\n }\\n else if (window.attachEvent) {\\n window.attachEvent(\\\"onmousemove\\\", onMouseMoveListener_1);\\n }\\n }\\n}\\nfunction rng_get_byte() {\\n if (rng_state == null) {\\n rng_state = (0,_prng4__WEBPACK_IMPORTED_MODULE_0__.prng_newstate)();\\n // At this point, we may not have collected enough entropy. If not, fall back to Math.random\\n while (rng_pptr < _prng4__WEBPACK_IMPORTED_MODULE_0__.rng_psize) {\\n var random = Math.floor(65536 * Math.random());\\n rng_pool[rng_pptr++] = random & 255;\\n }\\n rng_state.init(rng_pool);\\n for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) {\\n rng_pool[rng_pptr] = 0;\\n }\\n rng_pptr = 0;\\n }\\n // TODO: allow reseeding after first request\\n return rng_state.next();\\n}\\nvar SecureRandom = /** @class */ (function () {\\n function SecureRandom() {\\n }\\n SecureRandom.prototype.nextBytes = function (ba) {\\n for (var i = 0; i < ba.length; ++i) {\\n ba[i] = rng_get_byte();\\n }\\n };\\n return SecureRandom;\\n}());\\n\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsbn/rng.js?\");\n\n/***/ }),\n\n/***/ \"./lib/lib/jsbn/rsa.js\":\n/*!*****************************!*\\\n !*** ./lib/lib/jsbn/rsa.js ***!\n \\*****************************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"RSAKey\\\": () => (/* binding */ RSAKey)\\n/* harmony export */ });\\n/* harmony import */ var _jsbn__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsbn */ \\\"./lib/lib/jsbn/jsbn.js\\\");\\n/* harmony import */ var _rng__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rng */ \\\"./lib/lib/jsbn/rng.js\\\");\\n// Depends on jsbn.js and rng.js\\n// Version 1.1: support utf-8 encoding in pkcs1pad2\\n// convert a (hex) string to a bignum object\\n\\n\\n// function linebrk(s,n) {\\n// var ret = \\\"\\\";\\n// var i = 0;\\n// while(i + n < s.length) {\\n// ret += s.substring(i,i+n) + \\\"\\\\n\\\";\\n// i += n;\\n// }\\n// return ret + s.substring(i,s.length);\\n// }\\n// function byte2Hex(b) {\\n// if(b < 0x10)\\n// return \\\"0\\\" + b.toString(16);\\n// else\\n// return b.toString(16);\\n// }\\nfunction pkcs1pad1(s, n) {\\n if (n < s.length + 22) {\\n console.error(\\\"Message too long for RSA\\\");\\n return null;\\n }\\n var len = n - s.length - 6;\\n var filler = \\\"\\\";\\n for (var f = 0; f < len; f += 2) {\\n filler += \\\"ff\\\";\\n }\\n var m = \\\"0001\\\" + filler + \\\"00\\\" + s;\\n return (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(m, 16);\\n}\\n// PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint\\nfunction pkcs1pad2(s, n) {\\n if (n < s.length + 11) { // TODO: fix for utf-8\\n console.error(\\\"Message too long for RSA\\\");\\n return null;\\n }\\n var ba = [];\\n var i = s.length - 1;\\n while (i >= 0 && n > 0) {\\n var c = s.charCodeAt(i--);\\n if (c < 128) { // encode using utf-8\\n ba[--n] = c;\\n }\\n else if ((c > 127) && (c < 2048)) {\\n ba[--n] = (c & 63) | 128;\\n ba[--n] = (c >> 6) | 192;\\n }\\n else {\\n ba[--n] = (c & 63) | 128;\\n ba[--n] = ((c >> 6) & 63) | 128;\\n ba[--n] = (c >> 12) | 224;\\n }\\n }\\n ba[--n] = 0;\\n var rng = new _rng__WEBPACK_IMPORTED_MODULE_1__.SecureRandom();\\n var x = [];\\n while (n > 2) { // random non-zero pad\\n x[0] = 0;\\n while (x[0] == 0) {\\n rng.nextBytes(x);\\n }\\n ba[--n] = x[0];\\n }\\n ba[--n] = 2;\\n ba[--n] = 0;\\n return new _jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(ba);\\n}\\n// \\\"empty\\\" RSA key constructor\\nvar RSAKey = /** @class */ (function () {\\n function RSAKey() {\\n this.n = null;\\n this.e = 0;\\n this.d = null;\\n this.p = null;\\n this.q = null;\\n this.dmp1 = null;\\n this.dmq1 = null;\\n this.coeff = null;\\n }\\n //#region PROTECTED\\n // protected\\n // RSAKey.prototype.doPublic = RSADoPublic;\\n // Perform raw public operation on \\\"x\\\": return x^e (mod n)\\n RSAKey.prototype.doPublic = function (x) {\\n return x.modPowInt(this.e, this.n);\\n };\\n // RSAKey.prototype.doPrivate = RSADoPrivate;\\n // Perform raw private operation on \\\"x\\\": return x^d (mod n)\\n RSAKey.prototype.doPrivate = function (x) {\\n if (this.p == null || this.q == null) {\\n return x.modPow(this.d, this.n);\\n }\\n // TODO: re-calculate any missing CRT params\\n var xp = x.mod(this.p).modPow(this.dmp1, this.p);\\n var xq = x.mod(this.q).modPow(this.dmq1, this.q);\\n while (xp.compareTo(xq) < 0) {\\n xp = xp.add(this.p);\\n }\\n return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq);\\n };\\n //#endregion PROTECTED\\n //#region PUBLIC\\n // RSAKey.prototype.setPublic = RSASetPublic;\\n // Set the public key fields N and e from hex strings\\n RSAKey.prototype.setPublic = function (N, E) {\\n if (N != null && E != null && N.length > 0 && E.length > 0) {\\n this.n = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(N, 16);\\n this.e = parseInt(E, 16);\\n }\\n else {\\n console.error(\\\"Invalid RSA public key\\\");\\n }\\n };\\n // RSAKey.prototype.encrypt = RSAEncrypt;\\n // Return the PKCS#1 RSA encryption of \\\"text\\\" as an even-length hex string\\n RSAKey.prototype.encrypt = function (text) {\\n var maxLength = (this.n.bitLength() + 7) >> 3;\\n var m = pkcs1pad2(text, maxLength);\\n if (m == null) {\\n return null;\\n }\\n var c = this.doPublic(m);\\n if (c == null) {\\n return null;\\n }\\n var h = c.toString(16);\\n var length = h.length;\\n // fix zero before result\\n for (var i = 0; i < maxLength * 2 - length; i++) {\\n h = \\\"0\\\" + h;\\n }\\n return h;\\n };\\n // RSAKey.prototype.setPrivate = RSASetPrivate;\\n // Set the private key fields N, e, and d from hex strings\\n RSAKey.prototype.setPrivate = function (N, E, D) {\\n if (N != null && E != null && N.length > 0 && E.length > 0) {\\n this.n = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(N, 16);\\n this.e = parseInt(E, 16);\\n this.d = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(D, 16);\\n }\\n else {\\n console.error(\\\"Invalid RSA private key\\\");\\n }\\n };\\n // RSAKey.prototype.setPrivateEx = RSASetPrivateEx;\\n // Set the private key fields N, e, d and CRT params from hex strings\\n RSAKey.prototype.setPrivateEx = function (N, E, D, P, Q, DP, DQ, C) {\\n if (N != null && E != null && N.length > 0 && E.length > 0) {\\n this.n = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(N, 16);\\n this.e = parseInt(E, 16);\\n this.d = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(D, 16);\\n this.p = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(P, 16);\\n this.q = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(Q, 16);\\n this.dmp1 = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(DP, 16);\\n this.dmq1 = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(DQ, 16);\\n this.coeff = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(C, 16);\\n }\\n else {\\n console.error(\\\"Invalid RSA private key\\\");\\n }\\n };\\n // RSAKey.prototype.generate = RSAGenerate;\\n // Generate a new random private key B bits long, using public expt E\\n RSAKey.prototype.generate = function (B, E) {\\n var rng = new _rng__WEBPACK_IMPORTED_MODULE_1__.SecureRandom();\\n var qs = B >> 1;\\n this.e = parseInt(E, 16);\\n var ee = new _jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(E, 16);\\n for (;;) {\\n for (;;) {\\n this.p = new _jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(B - qs, 1, rng);\\n if (this.p.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE).gcd(ee).compareTo(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) {\\n break;\\n }\\n }\\n for (;;) {\\n this.q = new _jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(qs, 1, rng);\\n if (this.q.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE).gcd(ee).compareTo(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) {\\n break;\\n }\\n }\\n if (this.p.compareTo(this.q) <= 0) {\\n var t = this.p;\\n this.p = this.q;\\n this.q = t;\\n }\\n var p1 = this.p.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE);\\n var q1 = this.q.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE);\\n var phi = p1.multiply(q1);\\n if (phi.gcd(ee).compareTo(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE) == 0) {\\n this.n = this.p.multiply(this.q);\\n this.d = ee.modInverse(phi);\\n this.dmp1 = this.d.mod(p1);\\n this.dmq1 = this.d.mod(q1);\\n this.coeff = this.q.modInverse(this.p);\\n break;\\n }\\n }\\n };\\n // RSAKey.prototype.decrypt = RSADecrypt;\\n // Return the PKCS#1 RSA decryption of \\\"ctext\\\".\\n // \\\"ctext\\\" is an even-length hex string and the output is a plain string.\\n RSAKey.prototype.decrypt = function (ctext) {\\n var c = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(ctext, 16);\\n var m = this.doPrivate(c);\\n if (m == null) {\\n return null;\\n }\\n return pkcs1unpad2(m, (this.n.bitLength() + 7) >> 3);\\n };\\n // Generate a new random private key B bits long, using public expt E\\n RSAKey.prototype.generateAsync = function (B, E, callback) {\\n var rng = new _rng__WEBPACK_IMPORTED_MODULE_1__.SecureRandom();\\n var qs = B >> 1;\\n this.e = parseInt(E, 16);\\n var ee = new _jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(E, 16);\\n var rsa = this;\\n // These functions have non-descript names because they were originally for(;;) loops.\\n // I don't know about cryptography to give them better names than loop1-4.\\n var loop1 = function () {\\n var loop4 = function () {\\n if (rsa.p.compareTo(rsa.q) <= 0) {\\n var t = rsa.p;\\n rsa.p = rsa.q;\\n rsa.q = t;\\n }\\n var p1 = rsa.p.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE);\\n var q1 = rsa.q.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE);\\n var phi = p1.multiply(q1);\\n if (phi.gcd(ee).compareTo(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE) == 0) {\\n rsa.n = rsa.p.multiply(rsa.q);\\n rsa.d = ee.modInverse(phi);\\n rsa.dmp1 = rsa.d.mod(p1);\\n rsa.dmq1 = rsa.d.mod(q1);\\n rsa.coeff = rsa.q.modInverse(rsa.p);\\n setTimeout(function () { callback(); }, 0); // escape\\n }\\n else {\\n setTimeout(loop1, 0);\\n }\\n };\\n var loop3 = function () {\\n rsa.q = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.nbi)();\\n rsa.q.fromNumberAsync(qs, 1, rng, function () {\\n rsa.q.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE).gcda(ee, function (r) {\\n if (r.compareTo(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE) == 0 && rsa.q.isProbablePrime(10)) {\\n setTimeout(loop4, 0);\\n }\\n else {\\n setTimeout(loop3, 0);\\n }\\n });\\n });\\n };\\n var loop2 = function () {\\n rsa.p = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.nbi)();\\n rsa.p.fromNumberAsync(B - qs, 1, rng, function () {\\n rsa.p.subtract(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE).gcda(ee, function (r) {\\n if (r.compareTo(_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE) == 0 && rsa.p.isProbablePrime(10)) {\\n setTimeout(loop3, 0);\\n }\\n else {\\n setTimeout(loop2, 0);\\n }\\n });\\n });\\n };\\n setTimeout(loop2, 0);\\n };\\n setTimeout(loop1, 0);\\n };\\n RSAKey.prototype.sign = function (text, digestMethod, digestName) {\\n var header = getDigestHeader(digestName);\\n var digest = header + digestMethod(text).toString();\\n var m = pkcs1pad1(digest, this.n.bitLength() / 4);\\n if (m == null) {\\n return null;\\n }\\n var c = this.doPrivate(m);\\n if (c == null) {\\n return null;\\n }\\n var h = c.toString(16);\\n if ((h.length & 1) == 0) {\\n return h;\\n }\\n else {\\n return \\\"0\\\" + h;\\n }\\n };\\n RSAKey.prototype.verify = function (text, signature, digestMethod) {\\n var c = (0,_jsbn__WEBPACK_IMPORTED_MODULE_0__.parseBigInt)(signature, 16);\\n var m = this.doPublic(c);\\n if (m == null) {\\n return null;\\n }\\n var unpadded = m.toString(16).replace(/^1f+00/, \\\"\\\");\\n var digest = removeDigestHeader(unpadded);\\n return digest == digestMethod(text).toString();\\n };\\n return RSAKey;\\n}());\\n\\n// Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext\\nfunction pkcs1unpad2(d, n) {\\n var b = d.toByteArray();\\n var i = 0;\\n while (i < b.length && b[i] == 0) {\\n ++i;\\n }\\n if (b.length - i != n - 1 || b[i] != 2) {\\n return null;\\n }\\n ++i;\\n while (b[i] != 0) {\\n if (++i >= b.length) {\\n return null;\\n }\\n }\\n var ret = \\\"\\\";\\n while (++i < b.length) {\\n var c = b[i] & 255;\\n if (c < 128) { // utf-8 decode\\n ret += String.fromCharCode(c);\\n }\\n else if ((c > 191) && (c < 224)) {\\n ret += String.fromCharCode(((c & 31) << 6) | (b[i + 1] & 63));\\n ++i;\\n }\\n else {\\n ret += String.fromCharCode(((c & 15) << 12) | ((b[i + 1] & 63) << 6) | (b[i + 2] & 63));\\n i += 2;\\n }\\n }\\n return ret;\\n}\\n// https://tools.ietf.org/html/rfc3447#page-43\\nvar DIGEST_HEADERS = {\\n md2: \\\"3020300c06082a864886f70d020205000410\\\",\\n md5: \\\"3020300c06082a864886f70d020505000410\\\",\\n sha1: \\\"3021300906052b0e03021a05000414\\\",\\n sha224: \\\"302d300d06096086480165030402040500041c\\\",\\n sha256: \\\"3031300d060960864801650304020105000420\\\",\\n sha384: \\\"3041300d060960864801650304020205000430\\\",\\n sha512: \\\"3051300d060960864801650304020305000440\\\",\\n ripemd160: \\\"3021300906052b2403020105000414\\\"\\n};\\nfunction getDigestHeader(name) {\\n return DIGEST_HEADERS[name] || \\\"\\\";\\n}\\nfunction removeDigestHeader(str) {\\n for (var name_1 in DIGEST_HEADERS) {\\n if (DIGEST_HEADERS.hasOwnProperty(name_1)) {\\n var header = DIGEST_HEADERS[name_1];\\n var len = header.length;\\n if (str.substr(0, len) == header) {\\n return str.substr(len);\\n }\\n }\\n }\\n return str;\\n}\\n// Return the PKCS#1 RSA encryption of \\\"text\\\" as a Base64-encoded string\\n// function RSAEncryptB64(text) {\\n// var h = this.encrypt(text);\\n// if(h) return hex2b64(h); else return null;\\n// }\\n// public\\n// RSAKey.prototype.encrypt_b64 = RSAEncryptB64;\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsbn/rsa.js?\");\n\n/***/ }),\n\n/***/ \"./lib/lib/jsbn/util.js\":\n/*!******************************!*\\\n !*** ./lib/lib/jsbn/util.js ***!\n \\******************************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"cbit\\\": () => (/* binding */ cbit),\\n/* harmony export */ \\\"int2char\\\": () => (/* binding */ int2char),\\n/* harmony export */ \\\"lbit\\\": () => (/* binding */ lbit),\\n/* harmony export */ \\\"op_and\\\": () => (/* binding */ op_and),\\n/* harmony export */ \\\"op_andnot\\\": () => (/* binding */ op_andnot),\\n/* harmony export */ \\\"op_or\\\": () => (/* binding */ op_or),\\n/* harmony export */ \\\"op_xor\\\": () => (/* binding */ op_xor)\\n/* harmony export */ });\\nvar BI_RM = \\\"0123456789abcdefghijklmnopqrstuvwxyz\\\";\\nfunction int2char(n) {\\n return BI_RM.charAt(n);\\n}\\n//#region BIT_OPERATIONS\\n// (public) this & a\\nfunction op_and(x, y) {\\n return x & y;\\n}\\n// (public) this | a\\nfunction op_or(x, y) {\\n return x | y;\\n}\\n// (public) this ^ a\\nfunction op_xor(x, y) {\\n return x ^ y;\\n}\\n// (public) this & ~a\\nfunction op_andnot(x, y) {\\n return x & ~y;\\n}\\n// return index of lowest 1-bit in x, x < 2^31\\nfunction lbit(x) {\\n if (x == 0) {\\n return -1;\\n }\\n var r = 0;\\n if ((x & 0xffff) == 0) {\\n x >>= 16;\\n r += 16;\\n }\\n if ((x & 0xff) == 0) {\\n x >>= 8;\\n r += 8;\\n }\\n if ((x & 0xf) == 0) {\\n x >>= 4;\\n r += 4;\\n }\\n if ((x & 3) == 0) {\\n x >>= 2;\\n r += 2;\\n }\\n if ((x & 1) == 0) {\\n ++r;\\n }\\n return r;\\n}\\n// return number of 1 bits in x\\nfunction cbit(x) {\\n var r = 0;\\n while (x != 0) {\\n x &= x - 1;\\n ++r;\\n }\\n return r;\\n}\\n//#endregion BIT_OPERATIONS\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsbn/util.js?\");\n\n/***/ }),\n\n/***/ \"./lib/lib/jsrsasign/asn1-1.0.js\":\n/*!***************************************!*\\\n !*** ./lib/lib/jsrsasign/asn1-1.0.js ***!\n \\***************************************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"KJUR\\\": () => (/* binding */ KJUR)\\n/* harmony export */ });\\n/* harmony import */ var _jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../jsbn/jsbn */ \\\"./lib/lib/jsbn/jsbn.js\\\");\\n/* harmony import */ var _yahoo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./yahoo */ \\\"./lib/lib/jsrsasign/yahoo.js\\\");\\n/* asn1-1.0.13.js (c) 2013-2017 Kenji Urushima | kjur.github.com/jsrsasign/license\\n */\\n/*\\n * asn1.js - ASN.1 DER encoder classes\\n *\\n * Copyright (c) 2013-2017 Kenji Urushima (kenji.urushima@gmail.com)\\n *\\n * This software is licensed under the terms of the MIT License.\\n * https://kjur.github.io/jsrsasign/license\\n *\\n * The above copyright and license notice shall be\\n * included in all copies or substantial portions of the Software.\\n */\\n\\n\\n/**\\n * @fileOverview\\n * @name asn1-1.0.js\\n * @author Kenji Urushima kenji.urushima@gmail.com\\n * @version asn1 1.0.13 (2017-Jun-02)\\n * @since jsrsasign 2.1\\n * @license MIT License\\n */\\n/**\\n * kjur's class library name space\\n *

\\n * This name space provides following name spaces:\\n *

    \\n *
  • {@link KJUR.asn1} - ASN.1 primitive hexadecimal encoder
  • \\n *
  • {@link KJUR.asn1.x509} - ASN.1 structure for X.509 certificate and CRL
  • \\n *
  • {@link KJUR.crypto} - Java Cryptographic Extension(JCE) style MessageDigest/Signature\\n * class and utilities
  • \\n *
\\n *

\\n * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.\\n * @name KJUR\\n * @namespace kjur's class library name space\\n */\\nvar KJUR = {};\\n/**\\n * kjur's ASN.1 class library name space\\n *

\\n * This is ITU-T X.690 ASN.1 DER encoder class library and\\n * class structure and methods is very similar to\\n * org.bouncycastle.asn1 package of\\n * well known BouncyCaslte Cryptography Library.\\n *

PROVIDING ASN.1 PRIMITIVES

\\n * Here are ASN.1 DER primitive classes.\\n *
    \\n *
  • 0x01 {@link KJUR.asn1.DERBoolean}
  • \\n *
  • 0x02 {@link KJUR.asn1.DERInteger}
  • \\n *
  • 0x03 {@link KJUR.asn1.DERBitString}
  • \\n *
  • 0x04 {@link KJUR.asn1.DEROctetString}
  • \\n *
  • 0x05 {@link KJUR.asn1.DERNull}
  • \\n *
  • 0x06 {@link KJUR.asn1.DERObjectIdentifier}
  • \\n *
  • 0x0a {@link KJUR.asn1.DEREnumerated}
  • \\n *
  • 0x0c {@link KJUR.asn1.DERUTF8String}
  • \\n *
  • 0x12 {@link KJUR.asn1.DERNumericString}
  • \\n *
  • 0x13 {@link KJUR.asn1.DERPrintableString}
  • \\n *
  • 0x14 {@link KJUR.asn1.DERTeletexString}
  • \\n *
  • 0x16 {@link KJUR.asn1.DERIA5String}
  • \\n *
  • 0x17 {@link KJUR.asn1.DERUTCTime}
  • \\n *
  • 0x18 {@link KJUR.asn1.DERGeneralizedTime}
  • \\n *
  • 0x30 {@link KJUR.asn1.DERSequence}
  • \\n *
  • 0x31 {@link KJUR.asn1.DERSet}
  • \\n *
\\n *

OTHER ASN.1 CLASSES

\\n *
    \\n *
  • {@link KJUR.asn1.ASN1Object}
  • \\n *
  • {@link KJUR.asn1.DERAbstractString}
  • \\n *
  • {@link KJUR.asn1.DERAbstractTime}
  • \\n *
  • {@link KJUR.asn1.DERAbstractStructured}
  • \\n *
  • {@link KJUR.asn1.DERTaggedObject}
  • \\n *
\\n *

SUB NAME SPACES

\\n *
    \\n *
  • {@link KJUR.asn1.cades} - CAdES long term signature format
  • \\n *
  • {@link KJUR.asn1.cms} - Cryptographic Message Syntax
  • \\n *
  • {@link KJUR.asn1.csr} - Certificate Signing Request (CSR/PKCS#10)
  • \\n *
  • {@link KJUR.asn1.tsp} - RFC 3161 Timestamping Protocol Format
  • \\n *
  • {@link KJUR.asn1.x509} - RFC 5280 X.509 certificate and CRL
  • \\n *
\\n *

\\n * NOTE: Please ignore method summary and document of this namespace.\\n * This caused by a bug of jsdoc2.\\n * @name KJUR.asn1\\n * @namespace\\n */\\nif (typeof KJUR.asn1 == \\\"undefined\\\" || !KJUR.asn1)\\n KJUR.asn1 = {};\\n/**\\n * ASN1 utilities class\\n * @name KJUR.asn1.ASN1Util\\n * @class ASN1 utilities class\\n * @since asn1 1.0.2\\n */\\nKJUR.asn1.ASN1Util = new function () {\\n this.integerToByteHex = function (i) {\\n var h = i.toString(16);\\n if ((h.length % 2) == 1)\\n h = '0' + h;\\n return h;\\n };\\n this.bigIntToMinTwosComplementsHex = function (bigIntegerValue) {\\n var h = bigIntegerValue.toString(16);\\n if (h.substr(0, 1) != '-') {\\n if (h.length % 2 == 1) {\\n h = '0' + h;\\n }\\n else {\\n if (!h.match(/^[0-7]/)) {\\n h = '00' + h;\\n }\\n }\\n }\\n else {\\n var hPos = h.substr(1);\\n var xorLen = hPos.length;\\n if (xorLen % 2 == 1) {\\n xorLen += 1;\\n }\\n else {\\n if (!h.match(/^[0-7]/)) {\\n xorLen += 2;\\n }\\n }\\n var hMask = '';\\n for (var i = 0; i < xorLen; i++) {\\n hMask += 'f';\\n }\\n var biMask = new _jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(hMask, 16);\\n var biNeg = biMask.xor(bigIntegerValue).add(_jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger.ONE);\\n h = biNeg.toString(16).replace(/^-/, '');\\n }\\n return h;\\n };\\n /**\\n * get PEM string from hexadecimal data and header string\\n * @name getPEMStringFromHex\\n * @memberOf KJUR.asn1.ASN1Util\\n * @function\\n * @param {String} dataHex hexadecimal string of PEM body\\n * @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY')\\n * @return {String} PEM formatted string of input data\\n * @description\\n * This method converts a hexadecimal string to a PEM string with\\n * a specified header. Its line break will be CRLF(\\\"\\\\r\\\\n\\\").\\n * @example\\n * var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY');\\n * // value of pem will be:\\n * -----BEGIN PRIVATE KEY-----\\n * YWFh\\n * -----END PRIVATE KEY-----\\n */\\n this.getPEMStringFromHex = function (dataHex, pemHeader) {\\n return hextopem(dataHex, pemHeader);\\n };\\n /**\\n * generate ASN1Object specifed by JSON parameters\\n * @name newObject\\n * @memberOf KJUR.asn1.ASN1Util\\n * @function\\n * @param {Array} param JSON parameter to generate ASN1Object\\n * @return {KJUR.asn1.ASN1Object} generated object\\n * @since asn1 1.0.3\\n * @description\\n * generate any ASN1Object specified by JSON param\\n * including ASN.1 primitive or structured.\\n * Generally 'param' can be described as follows:\\n *
\\n * {TYPE-OF-ASNOBJ: ASN1OBJ-PARAMETER}\\n *
\\n * 'TYPE-OF-ASN1OBJ' can be one of following symbols:\\n *
    \\n *
  • 'bool' - DERBoolean
  • \\n *
  • 'int' - DERInteger
  • \\n *
  • 'bitstr' - DERBitString
  • \\n *
  • 'octstr' - DEROctetString
  • \\n *
  • 'null' - DERNull
  • \\n *
  • 'oid' - DERObjectIdentifier
  • \\n *
  • 'enum' - DEREnumerated
  • \\n *
  • 'utf8str' - DERUTF8String
  • \\n *
  • 'numstr' - DERNumericString
  • \\n *
  • 'prnstr' - DERPrintableString
  • \\n *
  • 'telstr' - DERTeletexString
  • \\n *
  • 'ia5str' - DERIA5String
  • \\n *
  • 'utctime' - DERUTCTime
  • \\n *
  • 'gentime' - DERGeneralizedTime
  • \\n *
  • 'seq' - DERSequence
  • \\n *
  • 'set' - DERSet
  • \\n *
  • 'tag' - DERTaggedObject
  • \\n *
\\n * @example\\n * newObject({'prnstr': 'aaa'});\\n * newObject({'seq': [{'int': 3}, {'prnstr': 'aaa'}]})\\n * // ASN.1 Tagged Object\\n * newObject({'tag': {'tag': 'a1',\\n * 'explicit': true,\\n * 'obj': {'seq': [{'int': 3}, {'prnstr': 'aaa'}]}}});\\n * // more simple representation of ASN.1 Tagged Object\\n * newObject({'tag': ['a1',\\n * true,\\n * {'seq': [\\n * {'int': 3},\\n * {'prnstr': 'aaa'}]}\\n * ]});\\n */\\n this.newObject = function (param) {\\n var _KJUR = KJUR, _KJUR_asn1 = _KJUR.asn1, _DERBoolean = _KJUR_asn1.DERBoolean, _DERInteger = _KJUR_asn1.DERInteger, _DERBitString = _KJUR_asn1.DERBitString, _DEROctetString = _KJUR_asn1.DEROctetString, _DERNull = _KJUR_asn1.DERNull, _DERObjectIdentifier = _KJUR_asn1.DERObjectIdentifier, _DEREnumerated = _KJUR_asn1.DEREnumerated, _DERUTF8String = _KJUR_asn1.DERUTF8String, _DERNumericString = _KJUR_asn1.DERNumericString, _DERPrintableString = _KJUR_asn1.DERPrintableString, _DERTeletexString = _KJUR_asn1.DERTeletexString, _DERIA5String = _KJUR_asn1.DERIA5String, _DERUTCTime = _KJUR_asn1.DERUTCTime, _DERGeneralizedTime = _KJUR_asn1.DERGeneralizedTime, _DERSequence = _KJUR_asn1.DERSequence, _DERSet = _KJUR_asn1.DERSet, _DERTaggedObject = _KJUR_asn1.DERTaggedObject, _newObject = _KJUR_asn1.ASN1Util.newObject;\\n var keys = Object.keys(param);\\n if (keys.length != 1)\\n throw \\\"key of param shall be only one.\\\";\\n var key = keys[0];\\n if (\\\":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:\\\".indexOf(\\\":\\\" + key + \\\":\\\") == -1)\\n throw \\\"undefined key: \\\" + key;\\n if (key == \\\"bool\\\")\\n return new _DERBoolean(param[key]);\\n if (key == \\\"int\\\")\\n return new _DERInteger(param[key]);\\n if (key == \\\"bitstr\\\")\\n return new _DERBitString(param[key]);\\n if (key == \\\"octstr\\\")\\n return new _DEROctetString(param[key]);\\n if (key == \\\"null\\\")\\n return new _DERNull(param[key]);\\n if (key == \\\"oid\\\")\\n return new _DERObjectIdentifier(param[key]);\\n if (key == \\\"enum\\\")\\n return new _DEREnumerated(param[key]);\\n if (key == \\\"utf8str\\\")\\n return new _DERUTF8String(param[key]);\\n if (key == \\\"numstr\\\")\\n return new _DERNumericString(param[key]);\\n if (key == \\\"prnstr\\\")\\n return new _DERPrintableString(param[key]);\\n if (key == \\\"telstr\\\")\\n return new _DERTeletexString(param[key]);\\n if (key == \\\"ia5str\\\")\\n return new _DERIA5String(param[key]);\\n if (key == \\\"utctime\\\")\\n return new _DERUTCTime(param[key]);\\n if (key == \\\"gentime\\\")\\n return new _DERGeneralizedTime(param[key]);\\n if (key == \\\"seq\\\") {\\n var paramList = param[key];\\n var a = [];\\n for (var i = 0; i < paramList.length; i++) {\\n var asn1Obj = _newObject(paramList[i]);\\n a.push(asn1Obj);\\n }\\n return new _DERSequence({ 'array': a });\\n }\\n if (key == \\\"set\\\") {\\n var paramList = param[key];\\n var a = [];\\n for (var i = 0; i < paramList.length; i++) {\\n var asn1Obj = _newObject(paramList[i]);\\n a.push(asn1Obj);\\n }\\n return new _DERSet({ 'array': a });\\n }\\n if (key == \\\"tag\\\") {\\n var tagParam = param[key];\\n if (Object.prototype.toString.call(tagParam) === '[object Array]' &&\\n tagParam.length == 3) {\\n var obj = _newObject(tagParam[2]);\\n return new _DERTaggedObject({ tag: tagParam[0],\\n explicit: tagParam[1],\\n obj: obj });\\n }\\n else {\\n var newParam = {};\\n if (tagParam.explicit !== undefined)\\n newParam.explicit = tagParam.explicit;\\n if (tagParam.tag !== undefined)\\n newParam.tag = tagParam.tag;\\n if (tagParam.obj === undefined)\\n throw \\\"obj shall be specified for 'tag'.\\\";\\n newParam.obj = _newObject(tagParam.obj);\\n return new _DERTaggedObject(newParam);\\n }\\n }\\n };\\n /**\\n * get encoded hexadecimal string of ASN1Object specifed by JSON parameters\\n * @name jsonToASN1HEX\\n * @memberOf KJUR.asn1.ASN1Util\\n * @function\\n * @param {Array} param JSON parameter to generate ASN1Object\\n * @return hexadecimal string of ASN1Object\\n * @since asn1 1.0.4\\n * @description\\n * As for ASN.1 object representation of JSON object,\\n * please see {@link newObject}.\\n * @example\\n * jsonToASN1HEX({'prnstr': 'aaa'});\\n */\\n this.jsonToASN1HEX = function (param) {\\n var asn1Obj = this.newObject(param);\\n return asn1Obj.getEncodedHex();\\n };\\n};\\n/**\\n * get dot noted oid number string from hexadecimal value of OID\\n * @name oidHexToInt\\n * @memberOf KJUR.asn1.ASN1Util\\n * @function\\n * @param {String} hex hexadecimal value of object identifier\\n * @return {String} dot noted string of object identifier\\n * @since jsrsasign 4.8.3 asn1 1.0.7\\n * @description\\n * This static method converts from hexadecimal string representation of\\n * ASN.1 value of object identifier to oid number string.\\n * @example\\n * KJUR.asn1.ASN1Util.oidHexToInt('550406') → \\\"2.5.4.6\\\"\\n */\\nKJUR.asn1.ASN1Util.oidHexToInt = function (hex) {\\n var s = \\\"\\\";\\n var i01 = parseInt(hex.substr(0, 2), 16);\\n var i0 = Math.floor(i01 / 40);\\n var i1 = i01 % 40;\\n var s = i0 + \\\".\\\" + i1;\\n var binbuf = \\\"\\\";\\n for (var i = 2; i < hex.length; i += 2) {\\n var value = parseInt(hex.substr(i, 2), 16);\\n var bin = (\\\"00000000\\\" + value.toString(2)).slice(-8);\\n binbuf = binbuf + bin.substr(1, 7);\\n if (bin.substr(0, 1) == \\\"0\\\") {\\n var bi = new _jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(binbuf, 2);\\n s = s + \\\".\\\" + bi.toString(10);\\n binbuf = \\\"\\\";\\n }\\n }\\n ;\\n return s;\\n};\\n/**\\n * get hexadecimal value of object identifier from dot noted oid value\\n * @name oidIntToHex\\n * @memberOf KJUR.asn1.ASN1Util\\n * @function\\n * @param {String} oidString dot noted string of object identifier\\n * @return {String} hexadecimal value of object identifier\\n * @since jsrsasign 4.8.3 asn1 1.0.7\\n * @description\\n * This static method converts from object identifier value string.\\n * to hexadecimal string representation of it.\\n * @example\\n * KJUR.asn1.ASN1Util.oidIntToHex(\\\"2.5.4.6\\\") → \\\"550406\\\"\\n */\\nKJUR.asn1.ASN1Util.oidIntToHex = function (oidString) {\\n var itox = function (i) {\\n var h = i.toString(16);\\n if (h.length == 1)\\n h = '0' + h;\\n return h;\\n };\\n var roidtox = function (roid) {\\n var h = '';\\n var bi = new _jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(roid, 10);\\n var b = bi.toString(2);\\n var padLen = 7 - b.length % 7;\\n if (padLen == 7)\\n padLen = 0;\\n var bPad = '';\\n for (var i = 0; i < padLen; i++)\\n bPad += '0';\\n b = bPad + b;\\n for (var i = 0; i < b.length - 1; i += 7) {\\n var b8 = b.substr(i, 7);\\n if (i != b.length - 7)\\n b8 = '1' + b8;\\n h += itox(parseInt(b8, 2));\\n }\\n return h;\\n };\\n if (!oidString.match(/^[0-9.]+$/)) {\\n throw \\\"malformed oid string: \\\" + oidString;\\n }\\n var h = '';\\n var a = oidString.split('.');\\n var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);\\n h += itox(i0);\\n a.splice(0, 2);\\n for (var i = 0; i < a.length; i++) {\\n h += roidtox(a[i]);\\n }\\n return h;\\n};\\n// ********************************************************************\\n// Abstract ASN.1 Classes\\n// ********************************************************************\\n// ********************************************************************\\n/**\\n * base class for ASN.1 DER encoder object\\n * @name KJUR.asn1.ASN1Object\\n * @class base class for ASN.1 DER encoder object\\n * @property {Boolean} isModified flag whether internal data was changed\\n * @property {String} hTLV hexadecimal string of ASN.1 TLV\\n * @property {String} hT hexadecimal string of ASN.1 TLV tag(T)\\n * @property {String} hL hexadecimal string of ASN.1 TLV length(L)\\n * @property {String} hV hexadecimal string of ASN.1 TLV value(V)\\n * @description\\n */\\nKJUR.asn1.ASN1Object = function () {\\n var isModified = true;\\n var hTLV = null;\\n var hT = '00';\\n var hL = '00';\\n var hV = '';\\n /**\\n * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V)\\n * @name getLengthHexFromValue\\n * @memberOf KJUR.asn1.ASN1Object#\\n * @function\\n * @return {String} hexadecimal string of ASN.1 TLV length(L)\\n */\\n this.getLengthHexFromValue = function () {\\n if (typeof this.hV == \\\"undefined\\\" || this.hV == null) {\\n throw \\\"this.hV is null or undefined.\\\";\\n }\\n if (this.hV.length % 2 == 1) {\\n throw \\\"value hex must be even length: n=\\\" + hV.length + \\\",v=\\\" + this.hV;\\n }\\n var n = this.hV.length / 2;\\n var hN = n.toString(16);\\n if (hN.length % 2 == 1) {\\n hN = \\\"0\\\" + hN;\\n }\\n if (n < 128) {\\n return hN;\\n }\\n else {\\n var hNlen = hN.length / 2;\\n if (hNlen > 15) {\\n throw \\\"ASN.1 length too long to represent by 8x: n = \\\" + n.toString(16);\\n }\\n var head = 128 + hNlen;\\n return head.toString(16) + hN;\\n }\\n };\\n /**\\n * get hexadecimal string of ASN.1 TLV bytes\\n * @name getEncodedHex\\n * @memberOf KJUR.asn1.ASN1Object#\\n * @function\\n * @return {String} hexadecimal string of ASN.1 TLV\\n */\\n this.getEncodedHex = function () {\\n if (this.hTLV == null || this.isModified) {\\n this.hV = this.getFreshValueHex();\\n this.hL = this.getLengthHexFromValue();\\n this.hTLV = this.hT + this.hL + this.hV;\\n this.isModified = false;\\n //alert(\\\"first time: \\\" + this.hTLV);\\n }\\n return this.hTLV;\\n };\\n /**\\n * get hexadecimal string of ASN.1 TLV value(V) bytes\\n * @name getValueHex\\n * @memberOf KJUR.asn1.ASN1Object#\\n * @function\\n * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes\\n */\\n this.getValueHex = function () {\\n this.getEncodedHex();\\n return this.hV;\\n };\\n this.getFreshValueHex = function () {\\n return '';\\n };\\n};\\n// == BEGIN DERAbstractString ================================================\\n/**\\n * base class for ASN.1 DER string classes\\n * @name KJUR.asn1.DERAbstractString\\n * @class base class for ASN.1 DER string classes\\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\\n * @property {String} s internal string of value\\n * @extends KJUR.asn1.ASN1Object\\n * @description\\n *
\\n * As for argument 'params' for constructor, you can specify one of\\n * following properties:\\n *
    \\n *
  • str - specify initial ASN.1 value(V) by a string
  • \\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \\n *
\\n * NOTE: 'params' can be omitted.\\n */\\nKJUR.asn1.DERAbstractString = function (params) {\\n KJUR.asn1.DERAbstractString.superclass.constructor.call(this);\\n var s = null;\\n var hV = null;\\n /**\\n * get string value of this string object\\n * @name getString\\n * @memberOf KJUR.asn1.DERAbstractString#\\n * @function\\n * @return {String} string value of this string object\\n */\\n this.getString = function () {\\n return this.s;\\n };\\n /**\\n * set value by a string\\n * @name setString\\n * @memberOf KJUR.asn1.DERAbstractString#\\n * @function\\n * @param {String} newS value by a string to set\\n */\\n this.setString = function (newS) {\\n this.hTLV = null;\\n this.isModified = true;\\n this.s = newS;\\n this.hV = stohex(this.s);\\n };\\n /**\\n * set value by a hexadecimal string\\n * @name setStringHex\\n * @memberOf KJUR.asn1.DERAbstractString#\\n * @function\\n * @param {String} newHexString value by a hexadecimal string to set\\n */\\n this.setStringHex = function (newHexString) {\\n this.hTLV = null;\\n this.isModified = true;\\n this.s = null;\\n this.hV = newHexString;\\n };\\n this.getFreshValueHex = function () {\\n return this.hV;\\n };\\n if (typeof params != \\\"undefined\\\") {\\n if (typeof params == \\\"string\\\") {\\n this.setString(params);\\n }\\n else if (typeof params['str'] != \\\"undefined\\\") {\\n this.setString(params['str']);\\n }\\n else if (typeof params['hex'] != \\\"undefined\\\") {\\n this.setStringHex(params['hex']);\\n }\\n }\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object);\\n// == END DERAbstractString ================================================\\n// == BEGIN DERAbstractTime ==================================================\\n/**\\n * base class for ASN.1 DER Generalized/UTCTime class\\n * @name KJUR.asn1.DERAbstractTime\\n * @class base class for ASN.1 DER Generalized/UTCTime class\\n * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})\\n * @extends KJUR.asn1.ASN1Object\\n * @description\\n * @see KJUR.asn1.ASN1Object - superclass\\n */\\nKJUR.asn1.DERAbstractTime = function (params) {\\n KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);\\n var s = null;\\n var date = null;\\n // --- PRIVATE METHODS --------------------\\n this.localDateToUTC = function (d) {\\n utc = d.getTime() + (d.getTimezoneOffset() * 60000);\\n var utcDate = new Date(utc);\\n return utcDate;\\n };\\n /*\\n * format date string by Data object\\n * @name formatDate\\n * @memberOf KJUR.asn1.AbstractTime;\\n * @param {Date} dateObject\\n * @param {string} type 'utc' or 'gen'\\n * @param {boolean} withMillis flag for with millisections or not\\n * @description\\n * 'withMillis' flag is supported from asn1 1.0.6.\\n */\\n this.formatDate = function (dateObject, type, withMillis) {\\n var pad = this.zeroPadding;\\n var d = this.localDateToUTC(dateObject);\\n var year = String(d.getFullYear());\\n if (type == 'utc')\\n year = year.substr(2, 2);\\n var month = pad(String(d.getMonth() + 1), 2);\\n var day = pad(String(d.getDate()), 2);\\n var hour = pad(String(d.getHours()), 2);\\n var min = pad(String(d.getMinutes()), 2);\\n var sec = pad(String(d.getSeconds()), 2);\\n var s = year + month + day + hour + min + sec;\\n if (withMillis === true) {\\n var millis = d.getMilliseconds();\\n if (millis != 0) {\\n var sMillis = pad(String(millis), 3);\\n sMillis = sMillis.replace(/[0]+$/, \\\"\\\");\\n s = s + \\\".\\\" + sMillis;\\n }\\n }\\n return s + \\\"Z\\\";\\n };\\n this.zeroPadding = function (s, len) {\\n if (s.length >= len)\\n return s;\\n return new Array(len - s.length + 1).join('0') + s;\\n };\\n // --- PUBLIC METHODS --------------------\\n /**\\n * get string value of this string object\\n * @name getString\\n * @memberOf KJUR.asn1.DERAbstractTime#\\n * @function\\n * @return {String} string value of this time object\\n */\\n this.getString = function () {\\n return this.s;\\n };\\n /**\\n * set value by a string\\n * @name setString\\n * @memberOf KJUR.asn1.DERAbstractTime#\\n * @function\\n * @param {String} newS value by a string to set such like \\\"130430235959Z\\\"\\n */\\n this.setString = function (newS) {\\n this.hTLV = null;\\n this.isModified = true;\\n this.s = newS;\\n this.hV = stohex(newS);\\n };\\n /**\\n * set value by a Date object\\n * @name setByDateValue\\n * @memberOf KJUR.asn1.DERAbstractTime#\\n * @function\\n * @param {Integer} year year of date (ex. 2013)\\n * @param {Integer} month month of date between 1 and 12 (ex. 12)\\n * @param {Integer} day day of month\\n * @param {Integer} hour hours of date\\n * @param {Integer} min minutes of date\\n * @param {Integer} sec seconds of date\\n */\\n this.setByDateValue = function (year, month, day, hour, min, sec) {\\n var dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0));\\n this.setByDate(dateObject);\\n };\\n this.getFreshValueHex = function () {\\n return this.hV;\\n };\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object);\\n// == END DERAbstractTime ==================================================\\n// == BEGIN DERAbstractStructured ============================================\\n/**\\n * base class for ASN.1 DER structured class\\n * @name KJUR.asn1.DERAbstractStructured\\n * @class base class for ASN.1 DER structured class\\n * @property {Array} asn1Array internal array of ASN1Object\\n * @extends KJUR.asn1.ASN1Object\\n * @description\\n * @see KJUR.asn1.ASN1Object - superclass\\n */\\nKJUR.asn1.DERAbstractStructured = function (params) {\\n KJUR.asn1.DERAbstractString.superclass.constructor.call(this);\\n var asn1Array = null;\\n /**\\n * set value by array of ASN1Object\\n * @name setByASN1ObjectArray\\n * @memberOf KJUR.asn1.DERAbstractStructured#\\n * @function\\n * @param {array} asn1ObjectArray array of ASN1Object to set\\n */\\n this.setByASN1ObjectArray = function (asn1ObjectArray) {\\n this.hTLV = null;\\n this.isModified = true;\\n this.asn1Array = asn1ObjectArray;\\n };\\n /**\\n * append an ASN1Object to internal array\\n * @name appendASN1Object\\n * @memberOf KJUR.asn1.DERAbstractStructured#\\n * @function\\n * @param {ASN1Object} asn1Object to add\\n */\\n this.appendASN1Object = function (asn1Object) {\\n this.hTLV = null;\\n this.isModified = true;\\n this.asn1Array.push(asn1Object);\\n };\\n this.asn1Array = new Array();\\n if (typeof params != \\\"undefined\\\") {\\n if (typeof params['array'] != \\\"undefined\\\") {\\n this.asn1Array = params['array'];\\n }\\n }\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object);\\n// ********************************************************************\\n// ASN.1 Object Classes\\n// ********************************************************************\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER Boolean\\n * @name KJUR.asn1.DERBoolean\\n * @class class for ASN.1 DER Boolean\\n * @extends KJUR.asn1.ASN1Object\\n * @description\\n * @see KJUR.asn1.ASN1Object - superclass\\n */\\nKJUR.asn1.DERBoolean = function () {\\n KJUR.asn1.DERBoolean.superclass.constructor.call(this);\\n this.hT = \\\"01\\\";\\n this.hTLV = \\\"0101ff\\\";\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER Integer\\n * @name KJUR.asn1.DERInteger\\n * @class class for ASN.1 DER Integer\\n * @extends KJUR.asn1.ASN1Object\\n * @description\\n *
\\n * As for argument 'params' for constructor, you can specify one of\\n * following properties:\\n *
    \\n *
  • int - specify initial ASN.1 value(V) by integer value
  • \\n *
  • bigint - specify initial ASN.1 value(V) by BigInteger object
  • \\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \\n *
\\n * NOTE: 'params' can be omitted.\\n */\\nKJUR.asn1.DERInteger = function (params) {\\n KJUR.asn1.DERInteger.superclass.constructor.call(this);\\n this.hT = \\\"02\\\";\\n /**\\n * set value by Tom Wu's BigInteger object\\n * @name setByBigInteger\\n * @memberOf KJUR.asn1.DERInteger#\\n * @function\\n * @param {BigInteger} bigIntegerValue to set\\n */\\n this.setByBigInteger = function (bigIntegerValue) {\\n this.hTLV = null;\\n this.isModified = true;\\n this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);\\n };\\n /**\\n * set value by integer value\\n * @name setByInteger\\n * @memberOf KJUR.asn1.DERInteger\\n * @function\\n * @param {Integer} integer value to set\\n */\\n this.setByInteger = function (intValue) {\\n var bi = new _jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(String(intValue), 10);\\n this.setByBigInteger(bi);\\n };\\n /**\\n * set value by integer value\\n * @name setValueHex\\n * @memberOf KJUR.asn1.DERInteger#\\n * @function\\n * @param {String} hexadecimal string of integer value\\n * @description\\n *
\\n * NOTE: Value shall be represented by minimum octet length of\\n * two's complement representation.\\n * @example\\n * new KJUR.asn1.DERInteger(123);\\n * new KJUR.asn1.DERInteger({'int': 123});\\n * new KJUR.asn1.DERInteger({'hex': '1fad'});\\n */\\n this.setValueHex = function (newHexString) {\\n this.hV = newHexString;\\n };\\n this.getFreshValueHex = function () {\\n return this.hV;\\n };\\n if (typeof params != \\\"undefined\\\") {\\n if (typeof params['bigint'] != \\\"undefined\\\") {\\n this.setByBigInteger(params['bigint']);\\n }\\n else if (typeof params['int'] != \\\"undefined\\\") {\\n this.setByInteger(params['int']);\\n }\\n else if (typeof params == \\\"number\\\") {\\n this.setByInteger(params);\\n }\\n else if (typeof params['hex'] != \\\"undefined\\\") {\\n this.setValueHex(params['hex']);\\n }\\n }\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER encoded BitString primitive\\n * @name KJUR.asn1.DERBitString\\n * @class class for ASN.1 DER encoded BitString primitive\\n * @extends KJUR.asn1.ASN1Object\\n * @description\\n *
\\n * As for argument 'params' for constructor, you can specify one of\\n * following properties:\\n *
    \\n *
  • bin - specify binary string (ex. '10111')
  • \\n *
  • array - specify array of boolean (ex. [true,false,true,true])
  • \\n *
  • hex - specify hexadecimal string of ASN.1 value(V) including unused bits
  • \\n *
  • obj - specify {@link KJUR.asn1.ASN1Util.newObject}\\n * argument for \\\"BitString encapsulates\\\" structure.
  • \\n *
\\n * NOTE1: 'params' can be omitted.
\\n * NOTE2: 'obj' parameter have been supported since\\n * asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).
\\n * @example\\n * // default constructor\\n * o = new KJUR.asn1.DERBitString();\\n * // initialize with binary string\\n * o = new KJUR.asn1.DERBitString({bin: \\\"1011\\\"});\\n * // initialize with boolean array\\n * o = new KJUR.asn1.DERBitString({array: [true,false,true,true]});\\n * // initialize with hexadecimal string (04 is unused bits)\\n * o = new KJUR.asn1.DEROctetString({hex: \\\"04bac0\\\"});\\n * // initialize with ASN1Util.newObject argument for encapsulated\\n * o = new KJUR.asn1.DERBitString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}});\\n * // above generates a ASN.1 data like this:\\n * // BIT STRING, encapsulates {\\n * // SEQUENCE {\\n * // INTEGER 3\\n * // PrintableString 'aaa'\\n * // }\\n * // }\\n */\\nKJUR.asn1.DERBitString = function (params) {\\n if (params !== undefined && typeof params.obj !== \\\"undefined\\\") {\\n var o = KJUR.asn1.ASN1Util.newObject(params.obj);\\n params.hex = \\\"00\\\" + o.getEncodedHex();\\n }\\n KJUR.asn1.DERBitString.superclass.constructor.call(this);\\n this.hT = \\\"03\\\";\\n /**\\n * set ASN.1 value(V) by a hexadecimal string including unused bits\\n * @name setHexValueIncludingUnusedBits\\n * @memberOf KJUR.asn1.DERBitString#\\n * @function\\n * @param {String} newHexStringIncludingUnusedBits\\n */\\n this.setHexValueIncludingUnusedBits = function (newHexStringIncludingUnusedBits) {\\n this.hTLV = null;\\n this.isModified = true;\\n this.hV = newHexStringIncludingUnusedBits;\\n };\\n /**\\n * set ASN.1 value(V) by unused bit and hexadecimal string of value\\n * @name setUnusedBitsAndHexValue\\n * @memberOf KJUR.asn1.DERBitString#\\n * @function\\n * @param {Integer} unusedBits\\n * @param {String} hValue\\n */\\n this.setUnusedBitsAndHexValue = function (unusedBits, hValue) {\\n if (unusedBits < 0 || 7 < unusedBits) {\\n throw \\\"unused bits shall be from 0 to 7: u = \\\" + unusedBits;\\n }\\n var hUnusedBits = \\\"0\\\" + unusedBits;\\n this.hTLV = null;\\n this.isModified = true;\\n this.hV = hUnusedBits + hValue;\\n };\\n /**\\n * set ASN.1 DER BitString by binary string
\\n * @name setByBinaryString\\n * @memberOf KJUR.asn1.DERBitString#\\n * @function\\n * @param {String} binaryString binary value string (i.e. '10111')\\n * @description\\n * Its unused bits will be calculated automatically by length of\\n * 'binaryValue'.
\\n * NOTE: Trailing zeros '0' will be ignored.\\n * @example\\n * o = new KJUR.asn1.DERBitString();\\n * o.setByBooleanArray(\\\"01011\\\");\\n */\\n this.setByBinaryString = function (binaryString) {\\n binaryString = binaryString.replace(/0+$/, '');\\n var unusedBits = 8 - binaryString.length % 8;\\n if (unusedBits == 8)\\n unusedBits = 0;\\n for (var i = 0; i <= unusedBits; i++) {\\n binaryString += '0';\\n }\\n var h = '';\\n for (var i = 0; i < binaryString.length - 1; i += 8) {\\n var b = binaryString.substr(i, 8);\\n var x = parseInt(b, 2).toString(16);\\n if (x.length == 1)\\n x = '0' + x;\\n h += x;\\n }\\n this.hTLV = null;\\n this.isModified = true;\\n this.hV = '0' + unusedBits + h;\\n };\\n /**\\n * set ASN.1 TLV value(V) by an array of boolean
\\n * @name setByBooleanArray\\n * @memberOf KJUR.asn1.DERBitString#\\n * @function\\n * @param {array} booleanArray array of boolean (ex. [true, false, true])\\n * @description\\n * NOTE: Trailing falses will be ignored in the ASN.1 DER Object.\\n * @example\\n * o = new KJUR.asn1.DERBitString();\\n * o.setByBooleanArray([false, true, false, true, true]);\\n */\\n this.setByBooleanArray = function (booleanArray) {\\n var s = '';\\n for (var i = 0; i < booleanArray.length; i++) {\\n if (booleanArray[i] == true) {\\n s += '1';\\n }\\n else {\\n s += '0';\\n }\\n }\\n this.setByBinaryString(s);\\n };\\n /**\\n * generate an array of falses with specified length
\\n * @name newFalseArray\\n * @memberOf KJUR.asn1.DERBitString\\n * @function\\n * @param {Integer} nLength length of array to generate\\n * @return {array} array of boolean falses\\n * @description\\n * This static method may be useful to initialize boolean array.\\n * @example\\n * o = new KJUR.asn1.DERBitString();\\n * o.newFalseArray(3) → [false, false, false]\\n */\\n this.newFalseArray = function (nLength) {\\n var a = new Array(nLength);\\n for (var i = 0; i < nLength; i++) {\\n a[i] = false;\\n }\\n return a;\\n };\\n this.getFreshValueHex = function () {\\n return this.hV;\\n };\\n if (typeof params != \\\"undefined\\\") {\\n if (typeof params == \\\"string\\\" && params.toLowerCase().match(/^[0-9a-f]+$/)) {\\n this.setHexValueIncludingUnusedBits(params);\\n }\\n else if (typeof params['hex'] != \\\"undefined\\\") {\\n this.setHexValueIncludingUnusedBits(params['hex']);\\n }\\n else if (typeof params['bin'] != \\\"undefined\\\") {\\n this.setByBinaryString(params['bin']);\\n }\\n else if (typeof params['array'] != \\\"undefined\\\") {\\n this.setByBooleanArray(params['array']);\\n }\\n }\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER OctetString
\\n * @name KJUR.asn1.DEROctetString\\n * @class class for ASN.1 DER OctetString\\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\\n * @extends KJUR.asn1.DERAbstractString\\n * @description\\n * This class provides ASN.1 OctetString simple type.
\\n * Supported \\\"params\\\" attributes are:\\n *
    \\n *
  • str - to set a string as a value
  • \\n *
  • hex - to set a hexadecimal string as a value
  • \\n *
  • obj - to set a encapsulated ASN.1 value by JSON object\\n * which is defined in {@link KJUR.asn1.ASN1Util.newObject}
  • \\n *
\\n * NOTE: A parameter 'obj' have been supported\\n * for \\\"OCTET STRING, encapsulates\\\" structure.\\n * since asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).\\n * @see KJUR.asn1.DERAbstractString - superclass\\n * @example\\n * // default constructor\\n * o = new KJUR.asn1.DEROctetString();\\n * // initialize with string\\n * o = new KJUR.asn1.DEROctetString({str: \\\"aaa\\\"});\\n * // initialize with hexadecimal string\\n * o = new KJUR.asn1.DEROctetString({hex: \\\"616161\\\"});\\n * // initialize with ASN1Util.newObject argument\\n * o = new KJUR.asn1.DEROctetString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}});\\n * // above generates a ASN.1 data like this:\\n * // OCTET STRING, encapsulates {\\n * // SEQUENCE {\\n * // INTEGER 3\\n * // PrintableString 'aaa'\\n * // }\\n * // }\\n */\\nKJUR.asn1.DEROctetString = function (params) {\\n if (params !== undefined && typeof params.obj !== \\\"undefined\\\") {\\n var o = KJUR.asn1.ASN1Util.newObject(params.obj);\\n params.hex = o.getEncodedHex();\\n }\\n KJUR.asn1.DEROctetString.superclass.constructor.call(this, params);\\n this.hT = \\\"04\\\";\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER Null\\n * @name KJUR.asn1.DERNull\\n * @class class for ASN.1 DER Null\\n * @extends KJUR.asn1.ASN1Object\\n * @description\\n * @see KJUR.asn1.ASN1Object - superclass\\n */\\nKJUR.asn1.DERNull = function () {\\n KJUR.asn1.DERNull.superclass.constructor.call(this);\\n this.hT = \\\"05\\\";\\n this.hTLV = \\\"0500\\\";\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER ObjectIdentifier\\n * @name KJUR.asn1.DERObjectIdentifier\\n * @class class for ASN.1 DER ObjectIdentifier\\n * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'})\\n * @extends KJUR.asn1.ASN1Object\\n * @description\\n *
\\n * As for argument 'params' for constructor, you can specify one of\\n * following properties:\\n *
    \\n *
  • oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)
  • \\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \\n *
\\n * NOTE: 'params' can be omitted.\\n */\\nKJUR.asn1.DERObjectIdentifier = function (params) {\\n var itox = function (i) {\\n var h = i.toString(16);\\n if (h.length == 1)\\n h = '0' + h;\\n return h;\\n };\\n var roidtox = function (roid) {\\n var h = '';\\n var bi = new _jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(roid, 10);\\n var b = bi.toString(2);\\n var padLen = 7 - b.length % 7;\\n if (padLen == 7)\\n padLen = 0;\\n var bPad = '';\\n for (var i = 0; i < padLen; i++)\\n bPad += '0';\\n b = bPad + b;\\n for (var i = 0; i < b.length - 1; i += 7) {\\n var b8 = b.substr(i, 7);\\n if (i != b.length - 7)\\n b8 = '1' + b8;\\n h += itox(parseInt(b8, 2));\\n }\\n return h;\\n };\\n KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this);\\n this.hT = \\\"06\\\";\\n /**\\n * set value by a hexadecimal string\\n * @name setValueHex\\n * @memberOf KJUR.asn1.DERObjectIdentifier#\\n * @function\\n * @param {String} newHexString hexadecimal value of OID bytes\\n */\\n this.setValueHex = function (newHexString) {\\n this.hTLV = null;\\n this.isModified = true;\\n this.s = null;\\n this.hV = newHexString;\\n };\\n /**\\n * set value by a OID string
\\n * @name setValueOidString\\n * @memberOf KJUR.asn1.DERObjectIdentifier#\\n * @function\\n * @param {String} oidString OID string (ex. 2.5.4.13)\\n * @example\\n * o = new KJUR.asn1.DERObjectIdentifier();\\n * o.setValueOidString(\\\"2.5.4.13\\\");\\n */\\n this.setValueOidString = function (oidString) {\\n if (!oidString.match(/^[0-9.]+$/)) {\\n throw \\\"malformed oid string: \\\" + oidString;\\n }\\n var h = '';\\n var a = oidString.split('.');\\n var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);\\n h += itox(i0);\\n a.splice(0, 2);\\n for (var i = 0; i < a.length; i++) {\\n h += roidtox(a[i]);\\n }\\n this.hTLV = null;\\n this.isModified = true;\\n this.s = null;\\n this.hV = h;\\n };\\n /**\\n * set value by a OID name\\n * @name setValueName\\n * @memberOf KJUR.asn1.DERObjectIdentifier#\\n * @function\\n * @param {String} oidName OID name (ex. 'serverAuth')\\n * @since 1.0.1\\n * @description\\n * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'.\\n * Otherwise raise error.\\n * @example\\n * o = new KJUR.asn1.DERObjectIdentifier();\\n * o.setValueName(\\\"serverAuth\\\");\\n */\\n this.setValueName = function (oidName) {\\n var oid = KJUR.asn1.x509.OID.name2oid(oidName);\\n if (oid !== '') {\\n this.setValueOidString(oid);\\n }\\n else {\\n throw \\\"DERObjectIdentifier oidName undefined: \\\" + oidName;\\n }\\n };\\n this.getFreshValueHex = function () {\\n return this.hV;\\n };\\n if (params !== undefined) {\\n if (typeof params === \\\"string\\\") {\\n if (params.match(/^[0-2].[0-9.]+$/)) {\\n this.setValueOidString(params);\\n }\\n else {\\n this.setValueName(params);\\n }\\n }\\n else if (params.oid !== undefined) {\\n this.setValueOidString(params.oid);\\n }\\n else if (params.hex !== undefined) {\\n this.setValueHex(params.hex);\\n }\\n else if (params.name !== undefined) {\\n this.setValueName(params.name);\\n }\\n }\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER Enumerated\\n * @name KJUR.asn1.DEREnumerated\\n * @class class for ASN.1 DER Enumerated\\n * @extends KJUR.asn1.ASN1Object\\n * @description\\n *
\\n * As for argument 'params' for constructor, you can specify one of\\n * following properties:\\n *
    \\n *
  • int - specify initial ASN.1 value(V) by integer value
  • \\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \\n *
\\n * NOTE: 'params' can be omitted.\\n * @example\\n * new KJUR.asn1.DEREnumerated(123);\\n * new KJUR.asn1.DEREnumerated({int: 123});\\n * new KJUR.asn1.DEREnumerated({hex: '1fad'});\\n */\\nKJUR.asn1.DEREnumerated = function (params) {\\n KJUR.asn1.DEREnumerated.superclass.constructor.call(this);\\n this.hT = \\\"0a\\\";\\n /**\\n * set value by Tom Wu's BigInteger object\\n * @name setByBigInteger\\n * @memberOf KJUR.asn1.DEREnumerated#\\n * @function\\n * @param {BigInteger} bigIntegerValue to set\\n */\\n this.setByBigInteger = function (bigIntegerValue) {\\n this.hTLV = null;\\n this.isModified = true;\\n this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);\\n };\\n /**\\n * set value by integer value\\n * @name setByInteger\\n * @memberOf KJUR.asn1.DEREnumerated#\\n * @function\\n * @param {Integer} integer value to set\\n */\\n this.setByInteger = function (intValue) {\\n var bi = new _jsbn_jsbn__WEBPACK_IMPORTED_MODULE_0__.BigInteger(String(intValue), 10);\\n this.setByBigInteger(bi);\\n };\\n /**\\n * set value by integer value\\n * @name setValueHex\\n * @memberOf KJUR.asn1.DEREnumerated#\\n * @function\\n * @param {String} hexadecimal string of integer value\\n * @description\\n *
\\n * NOTE: Value shall be represented by minimum octet length of\\n * two's complement representation.\\n */\\n this.setValueHex = function (newHexString) {\\n this.hV = newHexString;\\n };\\n this.getFreshValueHex = function () {\\n return this.hV;\\n };\\n if (typeof params != \\\"undefined\\\") {\\n if (typeof params['int'] != \\\"undefined\\\") {\\n this.setByInteger(params['int']);\\n }\\n else if (typeof params == \\\"number\\\") {\\n this.setByInteger(params);\\n }\\n else if (typeof params['hex'] != \\\"undefined\\\") {\\n this.setValueHex(params['hex']);\\n }\\n }\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER UTF8String\\n * @name KJUR.asn1.DERUTF8String\\n * @class class for ASN.1 DER UTF8String\\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\\n * @extends KJUR.asn1.DERAbstractString\\n * @description\\n * @see KJUR.asn1.DERAbstractString - superclass\\n */\\nKJUR.asn1.DERUTF8String = function (params) {\\n KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params);\\n this.hT = \\\"0c\\\";\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER NumericString\\n * @name KJUR.asn1.DERNumericString\\n * @class class for ASN.1 DER NumericString\\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\\n * @extends KJUR.asn1.DERAbstractString\\n * @description\\n * @see KJUR.asn1.DERAbstractString - superclass\\n */\\nKJUR.asn1.DERNumericString = function (params) {\\n KJUR.asn1.DERNumericString.superclass.constructor.call(this, params);\\n this.hT = \\\"12\\\";\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER PrintableString\\n * @name KJUR.asn1.DERPrintableString\\n * @class class for ASN.1 DER PrintableString\\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\\n * @extends KJUR.asn1.DERAbstractString\\n * @description\\n * @see KJUR.asn1.DERAbstractString - superclass\\n */\\nKJUR.asn1.DERPrintableString = function (params) {\\n KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params);\\n this.hT = \\\"13\\\";\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER TeletexString\\n * @name KJUR.asn1.DERTeletexString\\n * @class class for ASN.1 DER TeletexString\\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\\n * @extends KJUR.asn1.DERAbstractString\\n * @description\\n * @see KJUR.asn1.DERAbstractString - superclass\\n */\\nKJUR.asn1.DERTeletexString = function (params) {\\n KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params);\\n this.hT = \\\"14\\\";\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER IA5String\\n * @name KJUR.asn1.DERIA5String\\n * @class class for ASN.1 DER IA5String\\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\\n * @extends KJUR.asn1.DERAbstractString\\n * @description\\n * @see KJUR.asn1.DERAbstractString - superclass\\n */\\nKJUR.asn1.DERIA5String = function (params) {\\n KJUR.asn1.DERIA5String.superclass.constructor.call(this, params);\\n this.hT = \\\"16\\\";\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER UTCTime\\n * @name KJUR.asn1.DERUTCTime\\n * @class class for ASN.1 DER UTCTime\\n * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})\\n * @extends KJUR.asn1.DERAbstractTime\\n * @description\\n *
\\n * As for argument 'params' for constructor, you can specify one of\\n * following properties:\\n *
    \\n *
  • str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')
  • \\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \\n *
  • date - specify Date object.
  • \\n *
\\n * NOTE: 'params' can be omitted.\\n *

EXAMPLES

\\n * @example\\n * d1 = new KJUR.asn1.DERUTCTime();\\n * d1.setString('130430125959Z');\\n *\\n * d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'});\\n * d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))});\\n * d4 = new KJUR.asn1.DERUTCTime('130430125959Z');\\n */\\nKJUR.asn1.DERUTCTime = function (params) {\\n KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params);\\n this.hT = \\\"17\\\";\\n /**\\n * set value by a Date object
\\n * @name setByDate\\n * @memberOf KJUR.asn1.DERUTCTime#\\n * @function\\n * @param {Date} dateObject Date object to set ASN.1 value(V)\\n * @example\\n * o = new KJUR.asn1.DERUTCTime();\\n * o.setByDate(new Date(\\\"2016/12/31\\\"));\\n */\\n this.setByDate = function (dateObject) {\\n this.hTLV = null;\\n this.isModified = true;\\n this.date = dateObject;\\n this.s = this.formatDate(this.date, 'utc');\\n this.hV = stohex(this.s);\\n };\\n this.getFreshValueHex = function () {\\n if (typeof this.date == \\\"undefined\\\" && typeof this.s == \\\"undefined\\\") {\\n this.date = new Date();\\n this.s = this.formatDate(this.date, 'utc');\\n this.hV = stohex(this.s);\\n }\\n return this.hV;\\n };\\n if (params !== undefined) {\\n if (params.str !== undefined) {\\n this.setString(params.str);\\n }\\n else if (typeof params == \\\"string\\\" && params.match(/^[0-9]{12}Z$/)) {\\n this.setString(params);\\n }\\n else if (params.hex !== undefined) {\\n this.setStringHex(params.hex);\\n }\\n else if (params.date !== undefined) {\\n this.setByDate(params.date);\\n }\\n }\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER GeneralizedTime\\n * @name KJUR.asn1.DERGeneralizedTime\\n * @class class for ASN.1 DER GeneralizedTime\\n * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'})\\n * @property {Boolean} withMillis flag to show milliseconds or not\\n * @extends KJUR.asn1.DERAbstractTime\\n * @description\\n *
\\n * As for argument 'params' for constructor, you can specify one of\\n * following properties:\\n *
    \\n *
  • str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')
  • \\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \\n *
  • date - specify Date object.
  • \\n *
  • millis - specify flag to show milliseconds (from 1.0.6)
  • \\n *
\\n * NOTE1: 'params' can be omitted.\\n * NOTE2: 'withMillis' property is supported from asn1 1.0.6.\\n */\\nKJUR.asn1.DERGeneralizedTime = function (params) {\\n KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params);\\n this.hT = \\\"18\\\";\\n this.withMillis = false;\\n /**\\n * set value by a Date object\\n * @name setByDate\\n * @memberOf KJUR.asn1.DERGeneralizedTime#\\n * @function\\n * @param {Date} dateObject Date object to set ASN.1 value(V)\\n * @example\\n * When you specify UTC time, use 'Date.UTC' method like this:
\\n * o1 = new DERUTCTime();\\n * o1.setByDate(date);\\n *\\n * date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59\\n */\\n this.setByDate = function (dateObject) {\\n this.hTLV = null;\\n this.isModified = true;\\n this.date = dateObject;\\n this.s = this.formatDate(this.date, 'gen', this.withMillis);\\n this.hV = stohex(this.s);\\n };\\n this.getFreshValueHex = function () {\\n if (this.date === undefined && this.s === undefined) {\\n this.date = new Date();\\n this.s = this.formatDate(this.date, 'gen', this.withMillis);\\n this.hV = stohex(this.s);\\n }\\n return this.hV;\\n };\\n if (params !== undefined) {\\n if (params.str !== undefined) {\\n this.setString(params.str);\\n }\\n else if (typeof params == \\\"string\\\" && params.match(/^[0-9]{14}Z$/)) {\\n this.setString(params);\\n }\\n else if (params.hex !== undefined) {\\n this.setStringHex(params.hex);\\n }\\n else if (params.date !== undefined) {\\n this.setByDate(params.date);\\n }\\n if (params.millis === true) {\\n this.withMillis = true;\\n }\\n }\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER Sequence\\n * @name KJUR.asn1.DERSequence\\n * @class class for ASN.1 DER Sequence\\n * @extends KJUR.asn1.DERAbstractStructured\\n * @description\\n *
\\n * As for argument 'params' for constructor, you can specify one of\\n * following properties:\\n *
    \\n *
  • array - specify array of ASN1Object to set elements of content
  • \\n *
\\n * NOTE: 'params' can be omitted.\\n */\\nKJUR.asn1.DERSequence = function (params) {\\n KJUR.asn1.DERSequence.superclass.constructor.call(this, params);\\n this.hT = \\\"30\\\";\\n this.getFreshValueHex = function () {\\n var h = '';\\n for (var i = 0; i < this.asn1Array.length; i++) {\\n var asn1Obj = this.asn1Array[i];\\n h += asn1Obj.getEncodedHex();\\n }\\n this.hV = h;\\n return this.hV;\\n };\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER Set\\n * @name KJUR.asn1.DERSet\\n * @class class for ASN.1 DER Set\\n * @extends KJUR.asn1.DERAbstractStructured\\n * @description\\n *
\\n * As for argument 'params' for constructor, you can specify one of\\n * following properties:\\n *
    \\n *
  • array - specify array of ASN1Object to set elements of content
  • \\n *
  • sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.
  • \\n *
\\n * NOTE1: 'params' can be omitted.
\\n * NOTE2: sortflag is supported since 1.0.5.\\n */\\nKJUR.asn1.DERSet = function (params) {\\n KJUR.asn1.DERSet.superclass.constructor.call(this, params);\\n this.hT = \\\"31\\\";\\n this.sortFlag = true; // item shall be sorted only in ASN.1 DER\\n this.getFreshValueHex = function () {\\n var a = new Array();\\n for (var i = 0; i < this.asn1Array.length; i++) {\\n var asn1Obj = this.asn1Array[i];\\n a.push(asn1Obj.getEncodedHex());\\n }\\n if (this.sortFlag == true)\\n a.sort();\\n this.hV = a.join('');\\n return this.hV;\\n };\\n if (typeof params != \\\"undefined\\\") {\\n if (typeof params.sortflag != \\\"undefined\\\" &&\\n params.sortflag == false)\\n this.sortFlag = false;\\n }\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured);\\n// ********************************************************************\\n/**\\n * class for ASN.1 DER TaggedObject\\n * @name KJUR.asn1.DERTaggedObject\\n * @class class for ASN.1 DER TaggedObject\\n * @extends KJUR.asn1.ASN1Object\\n * @description\\n *
\\n * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object.\\n * For example, if you find '[1]' tag in a ASN.1 dump,\\n * 'tagNoHex' will be 'a1'.\\n *
\\n * As for optional argument 'params' for constructor, you can specify *ANY* of\\n * following properties:\\n *
    \\n *
  • explicit - specify true if this is explicit tag otherwise false\\n * (default is 'true').
  • \\n *
  • tag - specify tag (default is 'a0' which means [0])
  • \\n *
  • obj - specify ASN1Object which is tagged
  • \\n *
\\n * @example\\n * d1 = new KJUR.asn1.DERUTF8String({'str':'a'});\\n * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1});\\n * hex = d2.getEncodedHex();\\n */\\nKJUR.asn1.DERTaggedObject = function (params) {\\n KJUR.asn1.DERTaggedObject.superclass.constructor.call(this);\\n this.hT = \\\"a0\\\";\\n this.hV = '';\\n this.isExplicit = true;\\n this.asn1Object = null;\\n /**\\n * set value by an ASN1Object\\n * @name setString\\n * @memberOf KJUR.asn1.DERTaggedObject#\\n * @function\\n * @param {Boolean} isExplicitFlag flag for explicit/implicit tag\\n * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag\\n * @param {ASN1Object} asn1Object ASN.1 to encapsulate\\n */\\n this.setASN1Object = function (isExplicitFlag, tagNoHex, asn1Object) {\\n this.hT = tagNoHex;\\n this.isExplicit = isExplicitFlag;\\n this.asn1Object = asn1Object;\\n if (this.isExplicit) {\\n this.hV = this.asn1Object.getEncodedHex();\\n this.hTLV = null;\\n this.isModified = true;\\n }\\n else {\\n this.hV = null;\\n this.hTLV = asn1Object.getEncodedHex();\\n this.hTLV = this.hTLV.replace(/^../, tagNoHex);\\n this.isModified = false;\\n }\\n };\\n this.getFreshValueHex = function () {\\n return this.hV;\\n };\\n if (typeof params != \\\"undefined\\\") {\\n if (typeof params['tag'] != \\\"undefined\\\") {\\n this.hT = params['tag'];\\n }\\n if (typeof params['explicit'] != \\\"undefined\\\") {\\n this.isExplicit = params['explicit'];\\n }\\n if (typeof params['obj'] != \\\"undefined\\\") {\\n this.asn1Object = params['obj'];\\n this.setASN1Object(this.isExplicit, this.hT, this.asn1Object);\\n }\\n }\\n};\\n_yahoo__WEBPACK_IMPORTED_MODULE_1__.YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsrsasign/asn1-1.0.js?\");\n\n/***/ }),\n\n/***/ \"./lib/lib/jsrsasign/yahoo.js\":\n/*!************************************!*\\\n !*** ./lib/lib/jsrsasign/yahoo.js ***!\n \\************************************/\n/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {\n\n\neval(\"__webpack_require__.r(__webpack_exports__);\\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\\n/* harmony export */ \\\"YAHOO\\\": () => (/* binding */ YAHOO)\\n/* harmony export */ });\\n/*!\\nCopyright (c) 2011, Yahoo! Inc. All rights reserved.\\nCode licensed under the BSD License:\\nhttp://developer.yahoo.com/yui/license.html\\nversion: 2.9.0\\n*/\\nvar YAHOO = {};\\nYAHOO.lang = {\\n /**\\n * Utility to set up the prototype, constructor and superclass properties to\\n * support an inheritance strategy that can chain constructors and methods.\\n * Static members will not be inherited.\\n *\\n * @method extend\\n * @static\\n * @param {Function} subc the object to modify\\n * @param {Function} superc the object to inherit\\n * @param {Object} overrides additional properties/methods to add to the\\n * subclass prototype. These will override the\\n * matching items obtained from the superclass\\n * if present.\\n */\\n extend: function (subc, superc, overrides) {\\n if (!superc || !subc) {\\n throw new Error(\\\"YAHOO.lang.extend failed, please check that \\\" +\\n \\\"all dependencies are included.\\\");\\n }\\n var F = function () { };\\n F.prototype = superc.prototype;\\n subc.prototype = new F();\\n subc.prototype.constructor = subc;\\n subc.superclass = superc.prototype;\\n if (superc.prototype.constructor == Object.prototype.constructor) {\\n superc.prototype.constructor = superc;\\n }\\n if (overrides) {\\n var i;\\n for (i in overrides) {\\n subc.prototype[i] = overrides[i];\\n }\\n /*\\n * IE will not enumerate native functions in a derived object even if the\\n * function was overridden. This is a workaround for specific functions\\n * we care about on the Object prototype.\\n * @property _IEEnumFix\\n * @param {Function} r the object to receive the augmentation\\n * @param {Function} s the object that supplies the properties to augment\\n * @static\\n * @private\\n */\\n var _IEEnumFix = function () { }, ADD = [\\\"toString\\\", \\\"valueOf\\\"];\\n try {\\n if (/MSIE/.test(navigator.userAgent)) {\\n _IEEnumFix = function (r, s) {\\n for (i = 0; i < ADD.length; i = i + 1) {\\n var fname = ADD[i], f = s[fname];\\n if (typeof f === 'function' && f != Object.prototype[fname]) {\\n r[fname] = f;\\n }\\n }\\n };\\n }\\n }\\n catch (ex) { }\\n ;\\n _IEEnumFix(subc.prototype, overrides);\\n }\\n }\\n};\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./lib/lib/jsrsasign/yahoo.js?\");\n\n/***/ }),\n\n/***/ \"./node_modules/process/browser.js\":\n/*!*****************************************!*\\\n !*** ./node_modules/process/browser.js ***!\n \\*****************************************/\n/***/ ((module) => {\n\neval(\"// shim for using process in browser\\nvar process = module.exports = {};\\n\\n// cached from whatever global is present so that test runners that stub it\\n// don't break things. But we need to wrap it in a try catch in case it is\\n// wrapped in strict mode code which doesn't define any globals. It's inside a\\n// function because try/catches deoptimize in certain engines.\\n\\nvar cachedSetTimeout;\\nvar cachedClearTimeout;\\n\\nfunction defaultSetTimout() {\\n throw new Error('setTimeout has not been defined');\\n}\\nfunction defaultClearTimeout () {\\n throw new Error('clearTimeout has not been defined');\\n}\\n(function () {\\n try {\\n if (typeof setTimeout === 'function') {\\n cachedSetTimeout = setTimeout;\\n } else {\\n cachedSetTimeout = defaultSetTimout;\\n }\\n } catch (e) {\\n cachedSetTimeout = defaultSetTimout;\\n }\\n try {\\n if (typeof clearTimeout === 'function') {\\n cachedClearTimeout = clearTimeout;\\n } else {\\n cachedClearTimeout = defaultClearTimeout;\\n }\\n } catch (e) {\\n cachedClearTimeout = defaultClearTimeout;\\n }\\n} ())\\nfunction runTimeout(fun) {\\n if (cachedSetTimeout === setTimeout) {\\n //normal enviroments in sane situations\\n return setTimeout(fun, 0);\\n }\\n // if setTimeout wasn't available but was latter defined\\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\\n cachedSetTimeout = setTimeout;\\n return setTimeout(fun, 0);\\n }\\n try {\\n // when when somebody has screwed with setTimeout but no I.E. maddness\\n return cachedSetTimeout(fun, 0);\\n } catch(e){\\n try {\\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\\n return cachedSetTimeout.call(null, fun, 0);\\n } catch(e){\\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\\n return cachedSetTimeout.call(this, fun, 0);\\n }\\n }\\n\\n\\n}\\nfunction runClearTimeout(marker) {\\n if (cachedClearTimeout === clearTimeout) {\\n //normal enviroments in sane situations\\n return clearTimeout(marker);\\n }\\n // if clearTimeout wasn't available but was latter defined\\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\\n cachedClearTimeout = clearTimeout;\\n return clearTimeout(marker);\\n }\\n try {\\n // when when somebody has screwed with setTimeout but no I.E. maddness\\n return cachedClearTimeout(marker);\\n } catch (e){\\n try {\\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\\n return cachedClearTimeout.call(null, marker);\\n } catch (e){\\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\\n return cachedClearTimeout.call(this, marker);\\n }\\n }\\n\\n\\n\\n}\\nvar queue = [];\\nvar draining = false;\\nvar currentQueue;\\nvar queueIndex = -1;\\n\\nfunction cleanUpNextTick() {\\n if (!draining || !currentQueue) {\\n return;\\n }\\n draining = false;\\n if (currentQueue.length) {\\n queue = currentQueue.concat(queue);\\n } else {\\n queueIndex = -1;\\n }\\n if (queue.length) {\\n drainQueue();\\n }\\n}\\n\\nfunction drainQueue() {\\n if (draining) {\\n return;\\n }\\n var timeout = runTimeout(cleanUpNextTick);\\n draining = true;\\n\\n var len = queue.length;\\n while(len) {\\n currentQueue = queue;\\n queue = [];\\n while (++queueIndex < len) {\\n if (currentQueue) {\\n currentQueue[queueIndex].run();\\n }\\n }\\n queueIndex = -1;\\n len = queue.length;\\n }\\n currentQueue = null;\\n draining = false;\\n runClearTimeout(timeout);\\n}\\n\\nprocess.nextTick = function (fun) {\\n var args = new Array(arguments.length - 1);\\n if (arguments.length > 1) {\\n for (var i = 1; i < arguments.length; i++) {\\n args[i - 1] = arguments[i];\\n }\\n }\\n queue.push(new Item(fun, args));\\n if (queue.length === 1 && !draining) {\\n runTimeout(drainQueue);\\n }\\n};\\n\\n// v8 likes predictible objects\\nfunction Item(fun, array) {\\n this.fun = fun;\\n this.array = array;\\n}\\nItem.prototype.run = function () {\\n this.fun.apply(null, this.array);\\n};\\nprocess.title = 'browser';\\nprocess.browser = true;\\nprocess.env = {};\\nprocess.argv = [];\\nprocess.version = ''; // empty string to avoid regexp issues\\nprocess.versions = {};\\n\\nfunction noop() {}\\n\\nprocess.on = noop;\\nprocess.addListener = noop;\\nprocess.once = noop;\\nprocess.off = noop;\\nprocess.removeListener = noop;\\nprocess.removeAllListeners = noop;\\nprocess.emit = noop;\\nprocess.prependListener = noop;\\nprocess.prependOnceListener = noop;\\n\\nprocess.listeners = function (name) { return [] }\\n\\nprocess.binding = function (name) {\\n throw new Error('process.binding is not supported');\\n};\\n\\nprocess.cwd = function () { return '/' };\\nprocess.chdir = function (dir) {\\n throw new Error('process.chdir is not supported');\\n};\\nprocess.umask = function() { return 0; };\\n\\n\\n//# sourceURL=webpack://JSEncrypt/./node_modules/process/browser.js?\");\n\n/***/ })\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/define property getters */\n/******/ \t(() => {\n/******/ \t\t// define getter functions for harmony exports\n/******/ \t\t__webpack_require__.d = (exports, definition) => {\n/******/ \t\t\tfor(var key in definition) {\n/******/ \t\t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n/******/ \t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n/******/ \t\t\t\t}\n/******/ \t\t\t}\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/hasOwnProperty shorthand */\n/******/ \t(() => {\n/******/ \t\t__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))\n/******/ \t})();\n/******/ \t\n/******/ \t/* webpack/runtime/make namespace object */\n/******/ \t(() => {\n/******/ \t\t// define __esModule on exports\n/******/ \t\t__webpack_require__.r = (exports) => {\n/******/ \t\t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t\t}\n/******/ \t\t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t\t};\n/******/ \t})();\n/******/ \t\n/************************************************************************/\n/******/ \t\n/******/ \t// startup\n/******/ \t// Load entry module and return exports\n/******/ \t// This entry module can't be inlined because the eval devtool is used.\n/******/ \tvar __webpack_exports__ = __webpack_require__(\"./lib/index.js\");\n/******/ \t__webpack_exports__ = __webpack_exports__[\"default\"];\n/******/ \t\n/******/ \treturn __webpack_exports__;\n/******/ })()\n;\n});"]} \ No newline at end of file diff --git a/miniprogram_npm/wxmp-rsa/index.js b/miniprogram_npm/wxmp-rsa/index.js new file mode 100644 index 0000000..5a114a6 --- /dev/null +++ b/miniprogram_npm/wxmp-rsa/index.js @@ -0,0 +1,5511 @@ +module.exports = (function() { +var __MODS__ = {}; +var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; }; +var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; }; +var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } }; +var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; }; +__DEFINE__(1709513243594, function(require, module, exports) { +var __TEMP__ = require('./JSEncrypt');var JSEncrypt = __TEMP__['JSEncrypt']; +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'JSEncrypt', { enumerable: true, configurable: true, get: function() { return JSEncrypt; } }); +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });exports.default = JSEncrypt; + +}, function(modId) {var map = {"./JSEncrypt":1709513243595}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243595, function(require, module, exports) { +var __TEMP__ = require('./lib/jsbn/base64');var b64tohex = __TEMP__['b64tohex'];var hex2b64 = __TEMP__['hex2b64']; +var __TEMP__ = require('./JSEncryptRSAKey');var JSEncryptRSAKey = __TEMP__['JSEncryptRSAKey']; +var __TEMP__ = require('./version.json');var version = __REQUIRE_DEFAULT__(__TEMP__); +/** + * + * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour + * possible parameters are: + * - default_key_size {number} default: 1024 the key size in bit + * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent + * - log {boolean} default: false whether log warn/error or not + * @constructor + */ +var JSEncrypt = /** @class */ (function () { + function JSEncrypt(options) { + if (options === void 0) { options = {}; } + options = options || {}; + this.default_key_size = options.default_key_size ? parseInt(options.default_key_size, 10) : 1024; + this.default_public_exponent = options.default_public_exponent || "010001"; // 65537 default openssl public exponent for rsa key type + this.log = options.log || false; + // The private and public key. + this.key = null; + } + /** + * Method to set the rsa key parameter (one method is enough to set both the public + * and the private key, since the private key contains the public key paramenters) + * Log a warning if logs are enabled + * @param {Object|string} key the pem encoded string or an object (with or without header/footer) + * @public + */ + JSEncrypt.prototype.setKey = function (key) { + if (this.log && this.key) { + console.warn("A key was already set, overriding existing."); + } + this.key = new JSEncryptRSAKey(key); + }; + /** + * Proxy method for setKey, for api compatibility + * @see setKey + * @public + */ + JSEncrypt.prototype.setPrivateKey = function (privkey) { + // Create the key. + this.setKey(privkey); + }; + /** + * Proxy method for setKey, for api compatibility + * @see setKey + * @public + */ + JSEncrypt.prototype.setPublicKey = function (pubkey) { + // Sets the public key. + this.setKey(pubkey); + }; + /** + * Proxy method for RSAKey object's decrypt, decrypt the string using the private + * components of the rsa key object. Note that if the object was not set will be created + * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor + * @param {string} str base64 encoded crypted string to decrypt + * @return {string} the decrypted string + * @public + */ + JSEncrypt.prototype.decrypt = function (str) { + // Return the decrypted string. + try { + return this.getKey().decrypt(b64tohex(str)); + } + catch (ex) { + return false; + } + }; + /** + * Proxy method for RSAKey object's encrypt, encrypt the string using the public + * components of the rsa key object. Note that if the object was not set will be created + * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor + * @param {string} str the string to encrypt + * @return {string} the encrypted string encoded in base64 + * @public + */ + JSEncrypt.prototype.encrypt = function (str) { + // Return the encrypted string. + try { + return hex2b64(this.getKey().encrypt(str)); + } + catch (ex) { + return false; + } + }; + // 超长文本加密 + JSEncrypt.prototype.encryptLong = function (str) { + try { + return hex2b64(this.getKey().encryptLong(str)); + } + catch (ex) { + return false; + } + }; + // 超长文本解密 + JSEncrypt.prototype.decryptLong = function (str) { + try { + return this.getKey().decryptLong(b64tohex(str)); + } + catch (ex) { + return false; + } + }; + /** + * Proxy method for RSAKey object's sign. + * @param {string} str the string to sign + * @param {function} digestMethod hash method + * @param {string} digestName the name of the hash algorithm + * @return {string} the signature encoded in base64 + * @public + */ + JSEncrypt.prototype.sign = function (str, digestMethod, digestName) { + // return the RSA signature of 'str' in 'hex' format. + try { + return hex2b64(this.getKey().sign(str, digestMethod, digestName)); + } + catch (ex) { + return false; + } + }; + /** + * Proxy method for RSAKey object's verify. + * @param {string} str the string to verify + * @param {string} signature the signature encoded in base64 to compare the string to + * @param {function} digestMethod hash method + * @return {boolean} whether the data and signature match + * @public + */ + JSEncrypt.prototype.verify = function (str, signature, digestMethod) { + // Return the decrypted 'digest' of the signature. + try { + return this.getKey().verify(str, b64tohex(signature), digestMethod); + } + catch (ex) { + return false; + } + }; + /** + * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object + * will be created and returned + * @param {callback} [cb] the callback to be called if we want the key to be generated + * in an async fashion + * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object + * @public + */ + JSEncrypt.prototype.getKey = function (cb) { + // Only create new if it does not exist. + if (!this.key) { + // Get a new private key. + this.key = new JSEncryptRSAKey(); + if (cb && {}.toString.call(cb) === "[object Function]") { + this.key.generateAsync(this.default_key_size, this.default_public_exponent, cb); + return; + } + // Generate the key. + this.key.generate(this.default_key_size, this.default_public_exponent); + } + return this.key; + }; + /** + * Returns the pem encoded representation of the private key + * If the key doesn't exists a new key will be created + * @returns {string} pem encoded representation of the private key WITH header and footer + * @public + */ + JSEncrypt.prototype.getPrivateKey = function () { + // Return the private representation of this key. + return this.getKey().getPrivateKey(); + }; + /** + * Returns the pem encoded representation of the private key + * If the key doesn't exists a new key will be created + * @returns {string} pem encoded representation of the private key WITHOUT header and footer + * @public + */ + JSEncrypt.prototype.getPrivateKeyB64 = function () { + // Return the private representation of this key. + return this.getKey().getPrivateBaseKeyB64(); + }; + /** + * Returns the pem encoded representation of the public key + * If the key doesn't exists a new key will be created + * @returns {string} pem encoded representation of the public key WITH header and footer + * @public + */ + JSEncrypt.prototype.getPublicKey = function () { + // Return the private representation of this key. + return this.getKey().getPublicKey(); + }; + /** + * Returns the pem encoded representation of the public key + * If the key doesn't exists a new key will be created + * @returns {string} pem encoded representation of the public key WITHOUT header and footer + * @public + */ + JSEncrypt.prototype.getPublicKeyB64 = function () { + // Return the private representation of this key. + return this.getKey().getPublicBaseKeyB64(); + }; + JSEncrypt.version = version.version; + return JSEncrypt; +}()); +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'JSEncrypt', { enumerable: true, configurable: true, get: function() { return JSEncrypt; } }); + +}, function(modId) { var map = {"./lib/jsbn/base64":1709513243596,"./JSEncryptRSAKey":1709513243598,"./version.json":1709513243609}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243596, function(require, module, exports) { +var __TEMP__ = require('./util');var int2char = __TEMP__['int2char']; +var b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +var b64pad = "="; +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function hex2b64(h) { + var i; + var c; + var ret = ""; + for (i = 0; i + 3 <= h.length; i += 3) { + c = parseInt(h.substring(i, i + 3), 16); + ret += b64map.charAt(c >> 6) + b64map.charAt(c & 63); + } + if (i + 1 == h.length) { + c = parseInt(h.substring(i, i + 1), 16); + ret += b64map.charAt(c << 2); + } + else if (i + 2 == h.length) { + c = parseInt(h.substring(i, i + 2), 16); + ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4); + } + while ((ret.length & 3) > 0) { + ret += b64pad; + } + return ret; +};exports.hex2b64 = hex2b64 +// convert a base64 string to hex +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function b64tohex(s) { + var ret = ""; + var i; + var k = 0; // b64 state, 0-3 + var slop = 0; + for (i = 0; i < s.length; ++i) { + if (s.charAt(i) == b64pad) { + break; + } + var v = b64map.indexOf(s.charAt(i)); + if (v < 0) { + continue; + } + if (k == 0) { + ret += int2char(v >> 2); + slop = v & 3; + k = 1; + } + else if (k == 1) { + ret += int2char((slop << 2) | (v >> 4)); + slop = v & 0xf; + k = 2; + } + else if (k == 2) { + ret += int2char(slop); + ret += int2char(v >> 2); + slop = v & 3; + k = 3; + } + else { + ret += int2char((slop << 2) | (v >> 4)); + ret += int2char(v & 0xf); + k = 0; + } + } + if (k == 1) { + ret += int2char(slop << 2); + } + return ret; +};exports.b64tohex = b64tohex +// convert a base64 string to a byte/number array +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function b64toBA(s) { + // piggyback on b64tohex for now, optimize later + var h = b64tohex(s); + var i; + var a = []; + for (i = 0; 2 * i < h.length; ++i) { + a[i] = parseInt(h.substring(2 * i, 2 * i + 2), 16); + } + return a; +};exports.b64toBA = b64toBA + +}, function(modId) { var map = {"./util":1709513243597}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243597, function(require, module, exports) { +var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz"; +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function int2char(n) { + return BI_RM.charAt(n); +};exports.int2char = int2char +//#region BIT_OPERATIONS +// (public) this & a +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function op_and(x, y) { + return x & y; +};exports.op_and = op_and +// (public) this | a +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function op_or(x, y) { + return x | y; +};exports.op_or = op_or +// (public) this ^ a +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function op_xor(x, y) { + return x ^ y; +};exports.op_xor = op_xor +// (public) this & ~a +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function op_andnot(x, y) { + return x & ~y; +};exports.op_andnot = op_andnot +// return index of lowest 1-bit in x, x < 2^31 +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function lbit(x) { + if (x == 0) { + return -1; + } + var r = 0; + if ((x & 0xffff) == 0) { + x >>= 16; + r += 16; + } + if ((x & 0xff) == 0) { + x >>= 8; + r += 8; + } + if ((x & 0xf) == 0) { + x >>= 4; + r += 4; + } + if ((x & 3) == 0) { + x >>= 2; + r += 2; + } + if ((x & 1) == 0) { + ++r; + } + return r; +};exports.lbit = lbit +// return number of 1 bits in x +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function cbit(x) { + var r = 0; + while (x != 0) { + x &= x - 1; + ++r; + } + return r; +};exports.cbit = cbit +//#endregion BIT_OPERATIONS + +}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243598, function(require, module, exports) { +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __TEMP__ = require('./lib/jsbn/base64');var hex2b64 = __TEMP__['hex2b64']; +var __TEMP__ = require('./lib/asn1js/hex');var Hex = __TEMP__['Hex']; +var __TEMP__ = require('./lib/asn1js/base64');var Base64 = __TEMP__['Base64']; +var __TEMP__ = require('./lib/asn1js/asn1');var ASN1 = __TEMP__['ASN1']; +var __TEMP__ = require('./lib/jsbn/rsa');var RSAKey = __TEMP__['RSAKey']; +var __TEMP__ = require('./lib/jsbn/jsbn');var parseBigInt = __TEMP__['parseBigInt']; +var __TEMP__ = require('./lib/jsrsasign/asn1-1.0');var KJUR = __TEMP__['KJUR']; +/** + * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object. + * This object is just a decorator for parsing the key parameter + * @param {string|Object} key - The key in string format, or an object containing + * the parameters needed to build a RSAKey object. + * @constructor + */ +var JSEncryptRSAKey = /** @class */ (function (_super) { + __extends(JSEncryptRSAKey, _super); + function JSEncryptRSAKey(key) { + var _this = _super.call(this) || this; + // Call the super constructor. + // RSAKey.call(this); + // If a key key was provided. + if (key) { + // If this is a string... + if (typeof key === "string") { + _this.parseKey(key); + } + else if (JSEncryptRSAKey.hasPrivateKeyProperty(key) || + JSEncryptRSAKey.hasPublicKeyProperty(key)) { + // Set the values for the key. + _this.parsePropertiesFrom(key); + } + } + return _this; + } + /** + * Method to parse a pem encoded string containing both a public or private key. + * The method will translate the pem encoded string in a der encoded string and + * will parse private key and public key parameters. This method accepts public key + * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1). + * + * @todo Check how many rsa formats use the same format of pkcs #1. + * + * The format is defined as: + * PublicKeyInfo ::= SEQUENCE { + * algorithm AlgorithmIdentifier, + * PublicKey BIT STRING + * } + * Where AlgorithmIdentifier is: + * AlgorithmIdentifier ::= SEQUENCE { + * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm + * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1) + * } + * and PublicKey is a SEQUENCE encapsulated in a BIT STRING + * RSAPublicKey ::= SEQUENCE { + * modulus INTEGER, -- n + * publicExponent INTEGER -- e + * } + * it's possible to examine the structure of the keys obtained from openssl using + * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/ + * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer + * @private + */ + JSEncryptRSAKey.prototype.parseKey = function (pem) { + try { + var modulus = 0; + var public_exponent = 0; + var reHex = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/; + var der = reHex.test(pem) ? Hex.decode(pem) : Base64.unarmor(pem); + var asn1 = ASN1.decode(der); + // Fixes a bug with OpenSSL 1.0+ private keys + if (asn1.sub.length === 3) { + asn1 = asn1.sub[2].sub[0]; + } + if (asn1.sub.length === 9) { + // Parse the private key. + modulus = asn1.sub[1].getHexStringValue(); // bigint + this.n = parseBigInt(modulus, 16); + public_exponent = asn1.sub[2].getHexStringValue(); // int + this.e = parseInt(public_exponent, 16); + var private_exponent = asn1.sub[3].getHexStringValue(); // bigint + this.d = parseBigInt(private_exponent, 16); + var prime1 = asn1.sub[4].getHexStringValue(); // bigint + this.p = parseBigInt(prime1, 16); + var prime2 = asn1.sub[5].getHexStringValue(); // bigint + this.q = parseBigInt(prime2, 16); + var exponent1 = asn1.sub[6].getHexStringValue(); // bigint + this.dmp1 = parseBigInt(exponent1, 16); + var exponent2 = asn1.sub[7].getHexStringValue(); // bigint + this.dmq1 = parseBigInt(exponent2, 16); + var coefficient = asn1.sub[8].getHexStringValue(); // bigint + this.coeff = parseBigInt(coefficient, 16); + } + else if (asn1.sub.length === 2) { + // Parse the public key. + var bit_string = asn1.sub[1]; + var sequence = bit_string.sub[0]; + modulus = sequence.sub[0].getHexStringValue(); + this.n = parseBigInt(modulus, 16); + public_exponent = sequence.sub[1].getHexStringValue(); + this.e = parseInt(public_exponent, 16); + } + else { + return false; + } + return true; + } + catch (ex) { + return false; + } + }; + /** + * Translate rsa parameters in a hex encoded string representing the rsa key. + * + * The translation follow the ASN.1 notation : + * RSAPrivateKey ::= SEQUENCE { + * version Version, + * modulus INTEGER, -- n + * publicExponent INTEGER, -- e + * privateExponent INTEGER, -- d + * prime1 INTEGER, -- p + * prime2 INTEGER, -- q + * exponent1 INTEGER, -- d mod (p1) + * exponent2 INTEGER, -- d mod (q-1) + * coefficient INTEGER, -- (inverse of q) mod p + * } + * @returns {string} DER Encoded String representing the rsa private key + * @private + */ + JSEncryptRSAKey.prototype.getPrivateBaseKey = function () { + var options = { + array: [ + new KJUR.asn1.DERInteger({ int: 0 }), + new KJUR.asn1.DERInteger({ bigint: this.n }), + new KJUR.asn1.DERInteger({ int: this.e }), + new KJUR.asn1.DERInteger({ bigint: this.d }), + new KJUR.asn1.DERInteger({ bigint: this.p }), + new KJUR.asn1.DERInteger({ bigint: this.q }), + new KJUR.asn1.DERInteger({ bigint: this.dmp1 }), + new KJUR.asn1.DERInteger({ bigint: this.dmq1 }), + new KJUR.asn1.DERInteger({ bigint: this.coeff }) + ] + }; + var seq = new KJUR.asn1.DERSequence(options); + return seq.getEncodedHex(); + }; + /** + * base64 (pem) encoded version of the DER encoded representation + * @returns {string} pem encoded representation without header and footer + * @public + */ + JSEncryptRSAKey.prototype.getPrivateBaseKeyB64 = function () { + return hex2b64(this.getPrivateBaseKey()); + }; + /** + * Translate rsa parameters in a hex encoded string representing the rsa public key. + * The representation follow the ASN.1 notation : + * PublicKeyInfo ::= SEQUENCE { + * algorithm AlgorithmIdentifier, + * PublicKey BIT STRING + * } + * Where AlgorithmIdentifier is: + * AlgorithmIdentifier ::= SEQUENCE { + * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm + * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1) + * } + * and PublicKey is a SEQUENCE encapsulated in a BIT STRING + * RSAPublicKey ::= SEQUENCE { + * modulus INTEGER, -- n + * publicExponent INTEGER -- e + * } + * @returns {string} DER Encoded String representing the rsa public key + * @private + */ + JSEncryptRSAKey.prototype.getPublicBaseKey = function () { + var first_sequence = new KJUR.asn1.DERSequence({ + array: [ + new KJUR.asn1.DERObjectIdentifier({ oid: "1.2.840.113549.1.1.1" }), + new KJUR.asn1.DERNull() + ] + }); + var second_sequence = new KJUR.asn1.DERSequence({ + array: [ + new KJUR.asn1.DERInteger({ bigint: this.n }), + new KJUR.asn1.DERInteger({ int: this.e }) + ] + }); + var bit_string = new KJUR.asn1.DERBitString({ + hex: "00" + second_sequence.getEncodedHex() + }); + var seq = new KJUR.asn1.DERSequence({ + array: [ + first_sequence, + bit_string + ] + }); + return seq.getEncodedHex(); + }; + /** + * base64 (pem) encoded version of the DER encoded representation + * @returns {string} pem encoded representation without header and footer + * @public + */ + JSEncryptRSAKey.prototype.getPublicBaseKeyB64 = function () { + return hex2b64(this.getPublicBaseKey()); + }; + /** + * wrap the string in block of width chars. The default value for rsa keys is 64 + * characters. + * @param {string} str the pem encoded string without header and footer + * @param {Number} [width=64] - the length the string has to be wrapped at + * @returns {string} + * @private + */ + JSEncryptRSAKey.wordwrap = function (str, width) { + width = width || 64; + if (!str) { + return str; + } + var regex = "(.{1," + width + "})( +|$\n?)|(.{1," + width + "})"; + return str.match(RegExp(regex, "g")).join("\n"); + }; + /** + * Retrieve the pem encoded private key + * @returns {string} the pem encoded private key with header/footer + * @public + */ + JSEncryptRSAKey.prototype.getPrivateKey = function () { + var key = "-----BEGIN RSA PRIVATE KEY-----\n"; + key += JSEncryptRSAKey.wordwrap(this.getPrivateBaseKeyB64()) + "\n"; + key += "-----END RSA PRIVATE KEY-----"; + return key; + }; + /** + * Retrieve the pem encoded public key + * @returns {string} the pem encoded public key with header/footer + * @public + */ + JSEncryptRSAKey.prototype.getPublicKey = function () { + var key = "-----BEGIN PUBLIC KEY-----\n"; + key += JSEncryptRSAKey.wordwrap(this.getPublicBaseKeyB64()) + "\n"; + key += "-----END PUBLIC KEY-----"; + return key; + }; + /** + * Check if the object contains the necessary parameters to populate the rsa modulus + * and public exponent parameters. + * @param {Object} [obj={}] - An object that may contain the two public key + * parameters + * @returns {boolean} true if the object contains both the modulus and the public exponent + * properties (n and e) + * @todo check for types of n and e. N should be a parseable bigInt object, E should + * be a parseable integer number + * @private + */ + JSEncryptRSAKey.hasPublicKeyProperty = function (obj) { + obj = obj || {}; + return (obj.hasOwnProperty("n") && + obj.hasOwnProperty("e")); + }; + /** + * Check if the object contains ALL the parameters of an RSA key. + * @param {Object} [obj={}] - An object that may contain nine rsa key + * parameters + * @returns {boolean} true if the object contains all the parameters needed + * @todo check for types of the parameters all the parameters but the public exponent + * should be parseable bigint objects, the public exponent should be a parseable integer number + * @private + */ + JSEncryptRSAKey.hasPrivateKeyProperty = function (obj) { + obj = obj || {}; + return (obj.hasOwnProperty("n") && + obj.hasOwnProperty("e") && + obj.hasOwnProperty("d") && + obj.hasOwnProperty("p") && + obj.hasOwnProperty("q") && + obj.hasOwnProperty("dmp1") && + obj.hasOwnProperty("dmq1") && + obj.hasOwnProperty("coeff")); + }; + /** + * Parse the properties of obj in the current rsa object. Obj should AT LEAST + * include the modulus and public exponent (n, e) parameters. + * @param {Object} obj - the object containing rsa parameters + * @private + */ + JSEncryptRSAKey.prototype.parsePropertiesFrom = function (obj) { + this.n = obj.n; + this.e = obj.e; + if (obj.hasOwnProperty("d")) { + this.d = obj.d; + this.p = obj.p; + this.q = obj.q; + this.dmp1 = obj.dmp1; + this.dmq1 = obj.dmq1; + this.coeff = obj.coeff; + } + }; + return JSEncryptRSAKey; +}(RSAKey)); +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'JSEncryptRSAKey', { enumerable: true, configurable: true, get: function() { return JSEncryptRSAKey; } }); + +}, function(modId) { var map = {"./lib/jsbn/base64":1709513243596,"./lib/asn1js/hex":1709513243599,"./lib/asn1js/base64":1709513243600,"./lib/asn1js/asn1":1709513243601,"./lib/jsbn/rsa":1709513243603,"./lib/jsbn/jsbn":1709513243604,"./lib/jsrsasign/asn1-1.0":1709513243607}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243599, function(require, module, exports) { +// Hex JavaScript decoder +// Copyright (c) 2008-2013 Lapo Luchini +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */ +var decoder; +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });var Hex = exports.Hex = { + decode: function (a) { + var i; + if (decoder === undefined) { + var hex = "0123456789ABCDEF"; + var ignore = " \f\n\r\t\u00A0\u2028\u2029"; + decoder = {}; + for (i = 0; i < 16; ++i) { + decoder[hex.charAt(i)] = i; + } + hex = hex.toLowerCase(); + for (i = 10; i < 16; ++i) { + decoder[hex.charAt(i)] = i; + } + for (i = 0; i < ignore.length; ++i) { + decoder[ignore.charAt(i)] = -1; + } + } + var out = []; + var bits = 0; + var char_count = 0; + for (i = 0; i < a.length; ++i) { + var c = a.charAt(i); + if (c == "=") { + break; + } + c = decoder[c]; + if (c == -1) { + continue; + } + if (c === undefined) { + throw new Error("Illegal character at offset " + i); + } + bits |= c; + if (++char_count >= 2) { + out[out.length] = bits; + bits = 0; + char_count = 0; + } + else { + bits <<= 4; + } + } + if (char_count) { + throw new Error("Hex encoding incomplete: 4 bits missing"); + } + return out; + } +}; + +}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243600, function(require, module, exports) { +// Base64 JavaScript decoder +// Copyright (c) 2008-2013 Lapo Luchini +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */ +var decoder; +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });var Base64 = exports.Base64 = { + decode: function (a) { + var i; + if (decoder === undefined) { + var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var ignore = "= \f\n\r\t\u00A0\u2028\u2029"; + decoder = Object.create(null); + for (i = 0; i < 64; ++i) { + decoder[b64.charAt(i)] = i; + } + decoder['-'] = 62; //+ + decoder['_'] = 63; //- + for (i = 0; i < ignore.length; ++i) { + decoder[ignore.charAt(i)] = -1; + } + } + var out = []; + var bits = 0; + var char_count = 0; + for (i = 0; i < a.length; ++i) { + var c = a.charAt(i); + if (c == "=") { + break; + } + c = decoder[c]; + if (c == -1) { + continue; + } + if (c === undefined) { + throw new Error("Illegal character at offset " + i); + } + bits |= c; + if (++char_count >= 4) { + out[out.length] = (bits >> 16); + out[out.length] = (bits >> 8) & 0xFF; + out[out.length] = bits & 0xFF; + bits = 0; + char_count = 0; + } + else { + bits <<= 6; + } + } + switch (char_count) { + case 1: + throw new Error("Base64 encoding incomplete: at least 2 bits missing"); + case 2: + out[out.length] = (bits >> 10); + break; + case 3: + out[out.length] = (bits >> 16); + out[out.length] = (bits >> 8) & 0xFF; + break; + } + return out; + }, + re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/, + unarmor: function (a) { + var m = Base64.re.exec(a); + if (m) { + if (m[1]) { + a = m[1]; + } + else if (m[2]) { + a = m[2]; + } + else { + throw new Error("RegExp out of sync"); + } + } + return Base64.decode(a); + } +}; + +}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243601, function(require, module, exports) { +// ASN.1 JavaScript decoder +// Copyright (c) 2008-2014 Lapo Luchini +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */ +/*global oids */ +var __TEMP__ = require('./int10');var Int10 = __TEMP__['Int10']; +var ellipsis = "\u2026"; +var reTimeS = /^(\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)?)?$/; +var reTimeL = /^(\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)?)?$/; +function stringCut(str, len) { + if (str.length > len) { + str = str.substring(0, len) + ellipsis; + } + return str; +} +var Stream = /** @class */ (function () { + function Stream(enc, pos) { + this.hexDigits = "0123456789ABCDEF"; + if (enc instanceof Stream) { + this.enc = enc.enc; + this.pos = enc.pos; + } + else { + // enc should be an array or a binary string + this.enc = enc; + this.pos = pos; + } + } + Stream.prototype.get = function (pos) { + if (pos === undefined) { + pos = this.pos++; + } + if (pos >= this.enc.length) { + throw new Error("Requesting byte offset " + pos + " on a stream of length " + this.enc.length); + } + return ("string" === typeof this.enc) ? this.enc.charCodeAt(pos) : this.enc[pos]; + }; + Stream.prototype.hexByte = function (b) { + return this.hexDigits.charAt((b >> 4) & 0xF) + this.hexDigits.charAt(b & 0xF); + }; + Stream.prototype.hexDump = function (start, end, raw) { + var s = ""; + for (var i = start; i < end; ++i) { + s += this.hexByte(this.get(i)); + if (raw !== true) { + switch (i & 0xF) { + case 0x7: + s += " "; + break; + case 0xF: + s += "\n"; + break; + default: + s += " "; + } + } + } + return s; + }; + Stream.prototype.isASCII = function (start, end) { + for (var i = start; i < end; ++i) { + var c = this.get(i); + if (c < 32 || c > 176) { + return false; + } + } + return true; + }; + Stream.prototype.parseStringISO = function (start, end) { + var s = ""; + for (var i = start; i < end; ++i) { + s += String.fromCharCode(this.get(i)); + } + return s; + }; + Stream.prototype.parseStringUTF = function (start, end) { + var s = ""; + for (var i = start; i < end;) { + var c = this.get(i++); + if (c < 128) { + s += String.fromCharCode(c); + } + else if ((c > 191) && (c < 224)) { + s += String.fromCharCode(((c & 0x1F) << 6) | (this.get(i++) & 0x3F)); + } + else { + s += String.fromCharCode(((c & 0x0F) << 12) | ((this.get(i++) & 0x3F) << 6) | (this.get(i++) & 0x3F)); + } + } + return s; + }; + Stream.prototype.parseStringBMP = function (start, end) { + var str = ""; + var hi; + var lo; + for (var i = start; i < end;) { + hi = this.get(i++); + lo = this.get(i++); + str += String.fromCharCode((hi << 8) | lo); + } + return str; + }; + Stream.prototype.parseTime = function (start, end, shortYear) { + var s = this.parseStringISO(start, end); + var m = (shortYear ? reTimeS : reTimeL).exec(s); + if (!m) { + return "Unrecognized time: " + s; + } + if (shortYear) { + // to avoid querying the timer, use the fixed range [1970, 2069] + // it will conform with ITU X.400 [-10, +40] sliding window until 2030 + m[1] = +m[1]; + m[1] += (+m[1] < 70) ? 2000 : 1900; + } + s = m[1] + "-" + m[2] + "-" + m[3] + " " + m[4]; + if (m[5]) { + s += ":" + m[5]; + if (m[6]) { + s += ":" + m[6]; + if (m[7]) { + s += "." + m[7]; + } + } + } + if (m[8]) { + s += " UTC"; + if (m[8] != "Z") { + s += m[8]; + if (m[9]) { + s += ":" + m[9]; + } + } + } + return s; + }; + Stream.prototype.parseInteger = function (start, end) { + var v = this.get(start); + var neg = (v > 127); + var pad = neg ? 255 : 0; + var len; + var s = ""; + // skip unuseful bits (not allowed in DER) + while (v == pad && ++start < end) { + v = this.get(start); + } + len = end - start; + if (len === 0) { + return neg ? -1 : 0; + } + // show bit length of huge integers + if (len > 4) { + s = v; + len <<= 3; + while (((+s ^ pad) & 0x80) == 0) { + s = +s << 1; + --len; + } + s = "(" + len + " bit)\n"; + } + // decode the integer + if (neg) { + v = v - 256; + } + var n = new Int10(v); + for (var i = start + 1; i < end; ++i) { + n.mulAdd(256, this.get(i)); + } + return s + n.toString(); + }; + Stream.prototype.parseBitString = function (start, end, maxLength) { + var unusedBit = this.get(start); + var lenBit = ((end - start - 1) << 3) - unusedBit; + var intro = "(" + lenBit + " bit)\n"; + var s = ""; + for (var i = start + 1; i < end; ++i) { + var b = this.get(i); + var skip = (i == end - 1) ? unusedBit : 0; + for (var j = 7; j >= skip; --j) { + s += (b >> j) & 1 ? "1" : "0"; + } + if (s.length > maxLength) { + return intro + stringCut(s, maxLength); + } + } + return intro + s; + }; + Stream.prototype.parseOctetString = function (start, end, maxLength) { + if (this.isASCII(start, end)) { + return stringCut(this.parseStringISO(start, end), maxLength); + } + var len = end - start; + var s = "(" + len + " byte)\n"; + maxLength /= 2; // we work in bytes + if (len > maxLength) { + end = start + maxLength; + } + for (var i = start; i < end; ++i) { + s += this.hexByte(this.get(i)); + } + if (len > maxLength) { + s += ellipsis; + } + return s; + }; + Stream.prototype.parseOID = function (start, end, maxLength) { + var s = ""; + var n = new Int10(); + var bits = 0; + for (var i = start; i < end; ++i) { + var v = this.get(i); + n.mulAdd(128, v & 0x7F); + bits += 7; + if (!(v & 0x80)) { // finished + if (s === "") { + n = n.simplify(); + if (n instanceof Int10) { + n.sub(80); + s = "2." + n.toString(); + } + else { + var m = n < 80 ? n < 40 ? 0 : 1 : 2; + s = m + "." + (n - m * 40); + } + } + else { + s += "." + n.toString(); + } + if (s.length > maxLength) { + return stringCut(s, maxLength); + } + n = new Int10(); + bits = 0; + } + } + if (bits > 0) { + s += ".incomplete"; + } + return s; + }; + return Stream; +}()); +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'Stream', { enumerable: true, configurable: true, get: function() { return Stream; } }); +var ASN1 = /** @class */ (function () { + function ASN1(stream, header, length, tag, sub) { + if (!(tag instanceof ASN1Tag)) { + throw new Error("Invalid tag value."); + } + this.stream = stream; + this.header = header; + this.length = length; + this.tag = tag; + this.sub = sub; + } + ASN1.prototype.typeName = function () { + switch (this.tag.tagClass) { + case 0: // universal + switch (this.tag.tagNumber) { + case 0x00: + return "EOC"; + case 0x01: + return "BOOLEAN"; + case 0x02: + return "INTEGER"; + case 0x03: + return "BIT_STRING"; + case 0x04: + return "OCTET_STRING"; + case 0x05: + return "NULL"; + case 0x06: + return "OBJECT_IDENTIFIER"; + case 0x07: + return "ObjectDescriptor"; + case 0x08: + return "EXTERNAL"; + case 0x09: + return "REAL"; + case 0x0A: + return "ENUMERATED"; + case 0x0B: + return "EMBEDDED_PDV"; + case 0x0C: + return "UTF8String"; + case 0x10: + return "SEQUENCE"; + case 0x11: + return "SET"; + case 0x12: + return "NumericString"; + case 0x13: + return "PrintableString"; // ASCII subset + case 0x14: + return "TeletexString"; // aka T61String + case 0x15: + return "VideotexString"; + case 0x16: + return "IA5String"; // ASCII + case 0x17: + return "UTCTime"; + case 0x18: + return "GeneralizedTime"; + case 0x19: + return "GraphicString"; + case 0x1A: + return "VisibleString"; // ASCII subset + case 0x1B: + return "GeneralString"; + case 0x1C: + return "UniversalString"; + case 0x1E: + return "BMPString"; + } + return "Universal_" + this.tag.tagNumber.toString(); + case 1: + return "Application_" + this.tag.tagNumber.toString(); + case 2: + return "[" + this.tag.tagNumber.toString() + "]"; // Context + case 3: + return "Private_" + this.tag.tagNumber.toString(); + } + }; + ASN1.prototype.content = function (maxLength) { + if (this.tag === undefined) { + return null; + } + if (maxLength === undefined) { + maxLength = Infinity; + } + var content = this.posContent(); + var len = Math.abs(this.length); + if (!this.tag.isUniversal()) { + if (this.sub !== null) { + return "(" + this.sub.length + " elem)"; + } + return this.stream.parseOctetString(content, content + len, maxLength); + } + switch (this.tag.tagNumber) { + case 0x01: // BOOLEAN + return (this.stream.get(content) === 0) ? "false" : "true"; + case 0x02: // INTEGER + return this.stream.parseInteger(content, content + len); + case 0x03: // BIT_STRING + return this.sub ? "(" + this.sub.length + " elem)" : + this.stream.parseBitString(content, content + len, maxLength); + case 0x04: // OCTET_STRING + return this.sub ? "(" + this.sub.length + " elem)" : + this.stream.parseOctetString(content, content + len, maxLength); + // case 0x05: // NULL + case 0x06: // OBJECT_IDENTIFIER + return this.stream.parseOID(content, content + len, maxLength); + // case 0x07: // ObjectDescriptor + // case 0x08: // EXTERNAL + // case 0x09: // REAL + // case 0x0A: // ENUMERATED + // case 0x0B: // EMBEDDED_PDV + case 0x10: // SEQUENCE + case 0x11: // SET + if (this.sub !== null) { + return "(" + this.sub.length + " elem)"; + } + else { + return "(no elem)"; + } + case 0x0C: // UTF8String + return stringCut(this.stream.parseStringUTF(content, content + len), maxLength); + case 0x12: // NumericString + case 0x13: // PrintableString + case 0x14: // TeletexString + case 0x15: // VideotexString + case 0x16: // IA5String + // case 0x19: // GraphicString + case 0x1A: // VisibleString + // case 0x1B: // GeneralString + // case 0x1C: // UniversalString + return stringCut(this.stream.parseStringISO(content, content + len), maxLength); + case 0x1E: // BMPString + return stringCut(this.stream.parseStringBMP(content, content + len), maxLength); + case 0x17: // UTCTime + case 0x18: // GeneralizedTime + return this.stream.parseTime(content, content + len, (this.tag.tagNumber == 0x17)); + } + return null; + }; + ASN1.prototype.toString = function () { + return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + ((this.sub === null) ? "null" : this.sub.length) + "]"; + }; + ASN1.prototype.toPrettyString = function (indent) { + if (indent === undefined) { + indent = ""; + } + var s = indent + this.typeName() + " @" + this.stream.pos; + if (this.length >= 0) { + s += "+"; + } + s += this.length; + if (this.tag.tagConstructed) { + s += " (constructed)"; + } + else if ((this.tag.isUniversal() && ((this.tag.tagNumber == 0x03) || (this.tag.tagNumber == 0x04))) && (this.sub !== null)) { + s += " (encapsulates)"; + } + s += "\n"; + if (this.sub !== null) { + indent += " "; + for (var i = 0, max = this.sub.length; i < max; ++i) { + s += this.sub[i].toPrettyString(indent); + } + } + return s; + }; + ASN1.prototype.posStart = function () { + return this.stream.pos; + }; + ASN1.prototype.posContent = function () { + return this.stream.pos + this.header; + }; + ASN1.prototype.posEnd = function () { + return this.stream.pos + this.header + Math.abs(this.length); + }; + ASN1.prototype.toHexString = function () { + return this.stream.hexDump(this.posStart(), this.posEnd(), true); + }; + ASN1.decodeLength = function (stream) { + var buf = stream.get(); + var len = buf & 0x7F; + if (len == buf) { + return len; + } + // no reason to use Int10, as it would be a huge buffer anyways + if (len > 6) { + throw new Error("Length over 48 bits not supported at position " + (stream.pos - 1)); + } + if (len === 0) { + return null; + } // undefined + buf = 0; + for (var i = 0; i < len; ++i) { + buf = (buf * 256) + stream.get(); + } + return buf; + }; + /** + * Retrieve the hexadecimal value (as a string) of the current ASN.1 element + * @returns {string} + * @public + */ + ASN1.prototype.getHexStringValue = function () { + var hexString = this.toHexString(); + var offset = this.header * 2; + var length = this.length * 2; + return hexString.substr(offset, length); + }; + ASN1.decode = function (str) { + var stream; + if (!(str instanceof Stream)) { + stream = new Stream(str, 0); + } + else { + stream = str; + } + var streamStart = new Stream(stream); + var tag = new ASN1Tag(stream); + var len = ASN1.decodeLength(stream); + var start = stream.pos; + var header = start - streamStart.pos; + var sub = null; + var getSub = function () { + var ret = []; + if (len !== null) { + // definite length + var end = start + len; + while (stream.pos < end) { + ret[ret.length] = ASN1.decode(stream); + } + if (stream.pos != end) { + throw new Error("Content size is not correct for container starting at offset " + start); + } + } + else { + // undefined length + try { + for (;;) { + var s = ASN1.decode(stream); + if (s.tag.isEOC()) { + break; + } + ret[ret.length] = s; + } + len = start - stream.pos; // undefined lengths are represented as negative values + } + catch (e) { + throw new Error("Exception while decoding undefined length content: " + e); + } + } + return ret; + }; + if (tag.tagConstructed) { + // must have valid content + sub = getSub(); + } + else if (tag.isUniversal() && ((tag.tagNumber == 0x03) || (tag.tagNumber == 0x04))) { + // sometimes BitString and OctetString are used to encapsulate ASN.1 + try { + if (tag.tagNumber == 0x03) { + if (stream.get() != 0) { + throw new Error("BIT STRINGs with unused bits cannot encapsulate."); + } + } + sub = getSub(); + for (var i = 0; i < sub.length; ++i) { + if (sub[i].tag.isEOC()) { + throw new Error("EOC is not supposed to be actual content."); + } + } + } + catch (e) { + // but silently ignore when they don't + sub = null; + } + } + if (sub === null) { + if (len === null) { + throw new Error("We can't skip over an invalid tag with undefined length at offset " + start); + } + stream.pos = start + Math.abs(len); + } + return new ASN1(streamStart, header, len, tag, sub); + }; + return ASN1; +}()); +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'ASN1', { enumerable: true, configurable: true, get: function() { return ASN1; } }); +var ASN1Tag = /** @class */ (function () { + function ASN1Tag(stream) { + var buf = stream.get(); + this.tagClass = buf >> 6; + this.tagConstructed = ((buf & 0x20) !== 0); + this.tagNumber = buf & 0x1F; + if (this.tagNumber == 0x1F) { // long tag + var n = new Int10(); + do { + buf = stream.get(); + n.mulAdd(128, buf & 0x7F); + } while (buf & 0x80); + this.tagNumber = n.simplify(); + } + } + ASN1Tag.prototype.isUniversal = function () { + return this.tagClass === 0x00; + }; + ASN1Tag.prototype.isEOC = function () { + return this.tagClass === 0x00 && this.tagNumber === 0x00; + }; + return ASN1Tag; +}()); +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'ASN1Tag', { enumerable: true, configurable: true, get: function() { return ASN1Tag; } }); + +}, function(modId) { var map = {"./int10":1709513243602}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243602, function(require, module, exports) { +// Big integer base-10 printing library +// Copyright (c) 2014 Lapo Luchini +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */ +var max = 10000000000000; // biggest integer that can still fit 2^53 when multiplied by 256 +var Int10 = /** @class */ (function () { + function Int10(value) { + this.buf = [+value || 0]; + } + Int10.prototype.mulAdd = function (m, c) { + // assert(m <= 256) + var b = this.buf; + var l = b.length; + var i; + var t; + for (i = 0; i < l; ++i) { + t = b[i] * m + c; + if (t < max) { + c = 0; + } + else { + c = 0 | (t / max); + t -= c * max; + } + b[i] = t; + } + if (c > 0) { + b[i] = c; + } + }; + Int10.prototype.sub = function (c) { + // assert(m <= 256) + var b = this.buf; + var l = b.length; + var i; + var t; + for (i = 0; i < l; ++i) { + t = b[i] - c; + if (t < 0) { + t += max; + c = 1; + } + else { + c = 0; + } + b[i] = t; + } + while (b[b.length - 1] === 0) { + b.pop(); + } + }; + Int10.prototype.toString = function (base) { + if ((base || 10) != 10) { + throw new Error("only base 10 is supported"); + } + var b = this.buf; + var s = b[b.length - 1].toString(); + for (var i = b.length - 2; i >= 0; --i) { + s += (max + b[i]).toString().substring(1); + } + return s; + }; + Int10.prototype.valueOf = function () { + var b = this.buf; + var v = 0; + for (var i = b.length - 1; i >= 0; --i) { + v = v * max + b[i]; + } + return v; + }; + Int10.prototype.simplify = function () { + var b = this.buf; + return (b.length == 1) ? b[0] : this; + }; + return Int10; +}()); +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'Int10', { enumerable: true, configurable: true, get: function() { return Int10; } }); + +}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243603, function(require, module, exports) { +// Depends on jsbn.js and rng.js +// Version 1.1: support utf-8 encoding in pkcs1pad2 +// convert a (hex) string to a bignum object +var __TEMP__ = require('./jsbn');var BigInteger = __TEMP__['BigInteger'];var nbi = __TEMP__['nbi'];var parseBigInt = __TEMP__['parseBigInt']; +var __TEMP__ = require('./rng');var SecureRandom = __TEMP__['SecureRandom']; +// function linebrk(s,n) { +// var ret = ""; +// var i = 0; +// while(i + n < s.length) { +// ret += s.substring(i,i+n) + "\n"; +// i += n; +// } +// return ret + s.substring(i,s.length); +// } +// function byte2Hex(b) { +// if(b < 0x10) +// return "0" + b.toString(16); +// else +// return b.toString(16); +// } +function pkcs1pad1(s, n) { + if (n < s.length + 22) { + console.error("Message too long for RSA"); + return null; + } + var len = n - s.length - 6; + var filler = ""; + for (var f = 0; f < len; f += 2) { + filler += "ff"; + } + var m = "0001" + filler + "00" + s; + return parseBigInt(m, 16); +} +// PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint +function pkcs1pad2(s, n) { + if (n < s.length + 11) { // TODO: fix for utf-8 + console.error("Message too long for RSA"); + return null; + } + var ba = []; + var i = s.length - 1; + while (i >= 0 && n > 0) { + var c = s.charCodeAt(i--); + if (c < 128) { // encode using utf-8 + ba[--n] = c; + } + else if ((c > 127) && (c < 2048)) { + ba[--n] = (c & 63) | 128; + ba[--n] = (c >> 6) | 192; + } + else { + ba[--n] = (c & 63) | 128; + ba[--n] = ((c >> 6) & 63) | 128; + ba[--n] = (c >> 12) | 224; + } + } + ba[--n] = 0; + var rng = new SecureRandom(); + var x = []; + while (n > 2) { // random non-zero pad + x[0] = 0; + while (x[0] == 0) { + rng.nextBytes(x); + } + ba[--n] = x[0]; + } + ba[--n] = 2; + ba[--n] = 0; + return new BigInteger(ba); +} +// "empty" RSA key constructor +var RSAKey = /** @class */ (function () { + function RSAKey() { + this.n = null; + this.e = 0; + this.d = null; + this.p = null; + this.q = null; + this.dmp1 = null; + this.dmq1 = null; + this.coeff = null; + } + //#region PROTECTED + // protected + // RSAKey.prototype.doPublic = RSADoPublic; + // Perform raw public operation on "x": return x^e (mod n) + RSAKey.prototype.doPublic = function (x) { + return x.modPowInt(this.e, this.n); + }; + // RSAKey.prototype.doPrivate = RSADoPrivate; + // Perform raw private operation on "x": return x^d (mod n) + RSAKey.prototype.doPrivate = function (x) { + if (this.p == null || this.q == null) { + return x.modPow(this.d, this.n); + } + // TODO: re-calculate any missing CRT params + var xp = x.mod(this.p).modPow(this.dmp1, this.p); + var xq = x.mod(this.q).modPow(this.dmq1, this.q); + while (xp.compareTo(xq) < 0) { + xp = xp.add(this.p); + } + return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq); + }; + //#endregion PROTECTED + //#region PUBLIC + // RSAKey.prototype.setPublic = RSASetPublic; + // Set the public key fields N and e from hex strings + RSAKey.prototype.setPublic = function (N, E) { + if (N != null && E != null && N.length > 0 && E.length > 0) { + this.n = parseBigInt(N, 16); + this.e = parseInt(E, 16); + } + else { + console.error("Invalid RSA public key"); + } + }; + // RSAKey.prototype.encrypt = RSAEncrypt; + // Return the PKCS#1 RSA encryption of "text" as an even-length hex string + RSAKey.prototype.encrypt = function (text) { + var maxLength = (this.n.bitLength() + 7) >> 3; + var m = pkcs1pad2(text, maxLength); + if (m == null) { + return null; + } + var c = this.doPublic(m); + if (c == null) { + return null; + } + var h = c.toString(16); + var length = h.length; + // fix zero before result + for (var i = 0; i < maxLength * 2 - length; i++) { + h = "0" + h; + } + return h; + }; + // RSAKey.prototype.setPrivate = RSASetPrivate; + // Set the private key fields N, e, and d from hex strings + RSAKey.prototype.setPrivate = function (N, E, D) { + if (N != null && E != null && N.length > 0 && E.length > 0) { + this.n = parseBigInt(N, 16); + this.e = parseInt(E, 16); + this.d = parseBigInt(D, 16); + } + else { + console.error("Invalid RSA private key"); + } + }; + // RSAKey.prototype.setPrivateEx = RSASetPrivateEx; + // Set the private key fields N, e, d and CRT params from hex strings + RSAKey.prototype.setPrivateEx = function (N, E, D, P, Q, DP, DQ, C) { + if (N != null && E != null && N.length > 0 && E.length > 0) { + this.n = parseBigInt(N, 16); + this.e = parseInt(E, 16); + this.d = parseBigInt(D, 16); + this.p = parseBigInt(P, 16); + this.q = parseBigInt(Q, 16); + this.dmp1 = parseBigInt(DP, 16); + this.dmq1 = parseBigInt(DQ, 16); + this.coeff = parseBigInt(C, 16); + } + else { + console.error("Invalid RSA private key"); + } + }; + // RSAKey.prototype.generate = RSAGenerate; + // Generate a new random private key B bits long, using public expt E + RSAKey.prototype.generate = function (B, E) { + var rng = new SecureRandom(); + var qs = B >> 1; + this.e = parseInt(E, 16); + var ee = new BigInteger(E, 16); + for (;;) { + for (;;) { + this.p = new BigInteger(B - qs, 1, rng); + if (this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) { + break; + } + } + for (;;) { + this.q = new BigInteger(qs, 1, rng); + if (this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) { + break; + } + } + if (this.p.compareTo(this.q) <= 0) { + var t = this.p; + this.p = this.q; + this.q = t; + } + var p1 = this.p.subtract(BigInteger.ONE); + var q1 = this.q.subtract(BigInteger.ONE); + var phi = p1.multiply(q1); + if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) { + this.n = this.p.multiply(this.q); + this.d = ee.modInverse(phi); + this.dmp1 = this.d.mod(p1); + this.dmq1 = this.d.mod(q1); + this.coeff = this.q.modInverse(this.p); + break; + } + } + }; + // RSAKey.prototype.decrypt = RSADecrypt; + // Return the PKCS#1 RSA decryption of "ctext". + // "ctext" is an even-length hex string and the output is a plain string. + RSAKey.prototype.decrypt = function (ctext) { + var c = parseBigInt(ctext, 16); + var m = this.doPrivate(c); + if (m == null) { + return null; + } + return pkcs1unpad2(m, (this.n.bitLength() + 7) >> 3); + }; + // Generate a new random private key B bits long, using public expt E + RSAKey.prototype.generateAsync = function (B, E, callback) { + var rng = new SecureRandom(); + var qs = B >> 1; + this.e = parseInt(E, 16); + var ee = new BigInteger(E, 16); + var rsa = this; + // These functions have non-descript names because they were originally for(;;) loops. + // I don't know about cryptography to give them better names than loop1-4. + var loop1 = function () { + var loop4 = function () { + if (rsa.p.compareTo(rsa.q) <= 0) { + var t = rsa.p; + rsa.p = rsa.q; + rsa.q = t; + } + var p1 = rsa.p.subtract(BigInteger.ONE); + var q1 = rsa.q.subtract(BigInteger.ONE); + var phi = p1.multiply(q1); + if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) { + rsa.n = rsa.p.multiply(rsa.q); + rsa.d = ee.modInverse(phi); + rsa.dmp1 = rsa.d.mod(p1); + rsa.dmq1 = rsa.d.mod(q1); + rsa.coeff = rsa.q.modInverse(rsa.p); + setTimeout(function () { callback(); }, 0); // escape + } + else { + setTimeout(loop1, 0); + } + }; + var loop3 = function () { + rsa.q = nbi(); + rsa.q.fromNumberAsync(qs, 1, rng, function () { + rsa.q.subtract(BigInteger.ONE).gcda(ee, function (r) { + if (r.compareTo(BigInteger.ONE) == 0 && rsa.q.isProbablePrime(10)) { + setTimeout(loop4, 0); + } + else { + setTimeout(loop3, 0); + } + }); + }); + }; + var loop2 = function () { + rsa.p = nbi(); + rsa.p.fromNumberAsync(B - qs, 1, rng, function () { + rsa.p.subtract(BigInteger.ONE).gcda(ee, function (r) { + if (r.compareTo(BigInteger.ONE) == 0 && rsa.p.isProbablePrime(10)) { + setTimeout(loop3, 0); + } + else { + setTimeout(loop2, 0); + } + }); + }); + }; + setTimeout(loop2, 0); + }; + setTimeout(loop1, 0); + }; + RSAKey.prototype.sign = function (text, digestMethod, digestName) { + var header = getDigestHeader(digestName); + var digest = header + digestMethod(text).toString(); + var m = pkcs1pad1(digest, this.n.bitLength() / 4); + if (m == null) { + return null; + } + var c = this.doPrivate(m); + if (c == null) { + return null; + } + var h = c.toString(16); + if ((h.length & 1) == 0) { + return h; + } + else { + return "0" + h; + } + }; + RSAKey.prototype.verify = function (text, signature, digestMethod) { + var c = parseBigInt(signature, 16); + var m = this.doPublic(c); + if (m == null) { + return null; + } + var unpadded = m.toString(16).replace(/^1f+00/, ""); + var digest = removeDigestHeader(unpadded); + return digest == digestMethod(text).toString(); + }; + RSAKey.prototype.encryptLong = function (text) { + var _this = this; + var res = ''; + var maxLen = ((this.n.bitLength() + 7) >> 3) - 11; + var textArr = this.setSplitChn(text, maxLen); + textArr.forEach(function (v) { + res += _this.encrypt(v); + }); + return res; + }; + RSAKey.prototype.decryptLong = function (ctext) { + var res = ''; + var maxLen = (this.n.bitLength() + 7) >> 3; + var splitMaxLen = maxLen * 2; + if (ctext.length > splitMaxLen) { + var ctextArr = ctext.match(new RegExp('.{1,' + splitMaxLen + '}', 'g')) || []; + var mArr = []; + for (var i = 0; i < ctextArr.length; i++) { + var c = parseBigInt(ctextArr[i], 16); + var m = this.doPrivate(c); + if (m == null) { + return null; + } + mArr.push(m); + } + res = pkcs1unpad2Long(mArr, maxLen); + } + else { + res = this.decrypt(ctext); + } + return res; + }; + RSAKey.prototype.setSplitChn = function (str, maxLen, res) { + if (res === void 0) { res = []; } + var arr = str.split(''); + var len = 0; + for (var i = 0; i < arr.length; i++) { + var charCode = arr[i].charCodeAt(0); + if (charCode <= 0x007f) { + len += 1; + } + else if (charCode <= 0x07ff) { + len += 2; + } + else if (charCode <= 0xffff) { + len += 3; + } + else { + len += 4; + } + if (len > maxLen) { + var currentStr = str.substring(0, i); + res.push(currentStr); + return this.setSplitChn(str.substring(i), maxLen, res); + } + } + res.push(str); + return res; + }; + return RSAKey; +}()); +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'RSAKey', { enumerable: true, configurable: true, get: function() { return RSAKey; } }); +// Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext +function pkcs1unpad2(d, n) { + var b = d.toByteArray(); + var i = 0; + while (i < b.length && b[i] == 0) { + ++i; + } + if (b.length - i != n - 1 || b[i] != 2) { + return null; + } + ++i; + while (b[i] != 0) { + if (++i >= b.length) { + return null; + } + } + var ret = ""; + while (++i < b.length) { + var c = b[i] & 255; + if (c < 128) { // utf-8 decode + ret += String.fromCharCode(c); + } + else if ((c > 191) && (c < 224)) { + ret += String.fromCharCode(((c & 31) << 6) | (b[i + 1] & 63)); + ++i; + } + else { + ret += String.fromCharCode(((c & 15) << 12) | ((b[i + 1] & 63) << 6) | (b[i + 2] & 63)); + i += 2; + } + } + return ret; +} +function pkcs1unpad2Long(dArr, n) { + var bArr = []; + for (var j = 0; j < dArr.length; j++) { + var d = dArr[j]; + var b_1 = d.toByteArray(); + var i_1 = 0; + while (i_1 < b_1.length && b_1[i_1] == 0) { + ++i_1; + } + if (b_1.length - i_1 != n - 1 || b_1[i_1] != 2) { + return null; + } + ++i_1; + while (b_1[i_1] != 0) { + if (++i_1 >= b_1.length) { + return null; + } + } + bArr = bArr.concat(b_1.slice(i_1 + 1)); + } + var b = bArr; + var i = -1; + var ret = ""; + while (++i < b.length) { + var c = b[i] & 255; + if (c < 128) { // utf-8 decode + ret += String.fromCharCode(c); + } + else if ((c > 191) && (c < 224)) { + ret += String.fromCharCode(((c & 31) << 6) | (b[i + 1] & 63)); + ++i; + } + else { + ret += String.fromCharCode(((c & 15) << 12) | ((b[i + 1] & 63) << 6) | (b[i + 2] & 63)); + i += 2; + } + } + return ret; +} +// https://tools.ietf.org/html/rfc3447#page-43 +var DIGEST_HEADERS = { + md2: "3020300c06082a864886f70d020205000410", + md5: "3020300c06082a864886f70d020505000410", + sha1: "3021300906052b0e03021a05000414", + sha224: "302d300d06096086480165030402040500041c", + sha256: "3031300d060960864801650304020105000420", + sha384: "3041300d060960864801650304020205000430", + sha512: "3051300d060960864801650304020305000440", + ripemd160: "3021300906052b2403020105000414" +}; +function getDigestHeader(name) { + return DIGEST_HEADERS[name] || ""; +} +function removeDigestHeader(str) { + for (var name_1 in DIGEST_HEADERS) { + if (DIGEST_HEADERS.hasOwnProperty(name_1)) { + var header = DIGEST_HEADERS[name_1]; + var len = header.length; + if (str.substr(0, len) == header) { + return str.substr(len); + } + } + } + return str; +} +// Return the PKCS#1 RSA encryption of "text" as a Base64-encoded string +// function RSAEncryptB64(text) { +// var h = this.encrypt(text); +// if(h) return hex2b64(h); else return null; +// } +// public +// RSAKey.prototype.encrypt_b64 = RSAEncryptB64; + +}, function(modId) { var map = {"./jsbn":1709513243604,"./rng":1709513243605}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243604, function(require, module, exports) { +// Copyright (c) 2005 Tom Wu +// All Rights Reserved. +// See "LICENSE" for details. +// Basic JavaScript BN library - subset useful for RSA encryption. +var __TEMP__ = require('./util');var cbit = __TEMP__['cbit'];var int2char = __TEMP__['int2char'];var lbit = __TEMP__['lbit'];var op_and = __TEMP__['op_and'];var op_andnot = __TEMP__['op_andnot'];var op_or = __TEMP__['op_or'];var op_xor = __TEMP__['op_xor']; +// Bits per digit +var dbits; +// JavaScript engine analysis +var canary = 0xdeadbeefcafe; +var j_lm = ((canary & 0xffffff) == 0xefcafe); +//#region +var lowprimes = [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]; +var lplim = (1 << 26) / lowprimes[lowprimes.length - 1]; +//#endregion +// (public) Constructor +var BigInteger = /** @class */ (function () { + function BigInteger(a, b, c) { + if (a != null) { + if ("number" == typeof a) { + this.fromNumber(a, b, c); + } + else if (b == null && "string" != typeof a) { + this.fromString(a, 256); + } + else { + this.fromString(a, b); + } + } + } + //#region PUBLIC + // BigInteger.prototype.toString = bnToString; + // (public) return string representation in given radix + BigInteger.prototype.toString = function (b) { + if (this.s < 0) { + return "-" + this.negate().toString(b); + } + var k; + if (b == 16) { + k = 4; + } + else if (b == 8) { + k = 3; + } + else if (b == 2) { + k = 1; + } + else if (b == 32) { + k = 5; + } + else if (b == 4) { + k = 2; + } + else { + return this.toRadix(b); + } + var km = (1 << k) - 1; + var d; + var m = false; + var r = ""; + var i = this.t; + var p = this.DB - (i * this.DB) % k; + if (i-- > 0) { + if (p < this.DB && (d = this[i] >> p) > 0) { + m = true; + r = int2char(d); + } + while (i >= 0) { + if (p < k) { + d = (this[i] & ((1 << p) - 1)) << (k - p); + d |= this[--i] >> (p += this.DB - k); + } + else { + d = (this[i] >> (p -= k)) & km; + if (p <= 0) { + p += this.DB; + --i; + } + } + if (d > 0) { + m = true; + } + if (m) { + r += int2char(d); + } + } + } + return m ? r : "0"; + }; + // BigInteger.prototype.negate = bnNegate; + // (public) -this + BigInteger.prototype.negate = function () { + var r = nbi(); + BigInteger.ZERO.subTo(this, r); + return r; + }; + // BigInteger.prototype.abs = bnAbs; + // (public) |this| + BigInteger.prototype.abs = function () { + return (this.s < 0) ? this.negate() : this; + }; + // BigInteger.prototype.compareTo = bnCompareTo; + // (public) return + if this > a, - if this < a, 0 if equal + BigInteger.prototype.compareTo = function (a) { + var r = this.s - a.s; + if (r != 0) { + return r; + } + var i = this.t; + r = i - a.t; + if (r != 0) { + return (this.s < 0) ? -r : r; + } + while (--i >= 0) { + if ((r = this[i] - a[i]) != 0) { + return r; + } + } + return 0; + }; + // BigInteger.prototype.bitLength = bnBitLength; + // (public) return the number of bits in "this" + BigInteger.prototype.bitLength = function () { + if (this.t <= 0) { + return 0; + } + return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM)); + }; + // BigInteger.prototype.mod = bnMod; + // (public) this mod a + BigInteger.prototype.mod = function (a) { + var r = nbi(); + this.abs().divRemTo(a, null, r); + if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) { + a.subTo(r, r); + } + return r; + }; + // BigInteger.prototype.modPowInt = bnModPowInt; + // (public) this^e % m, 0 <= e < 2^32 + BigInteger.prototype.modPowInt = function (e, m) { + var z; + if (e < 256 || m.isEven()) { + z = new Classic(m); + } + else { + z = new Montgomery(m); + } + return this.exp(e, z); + }; + // BigInteger.prototype.clone = bnClone; + // (public) + BigInteger.prototype.clone = function () { + var r = nbi(); + this.copyTo(r); + return r; + }; + // BigInteger.prototype.intValue = bnIntValue; + // (public) return value as integer + BigInteger.prototype.intValue = function () { + if (this.s < 0) { + if (this.t == 1) { + return this[0] - this.DV; + } + else if (this.t == 0) { + return -1; + } + } + else if (this.t == 1) { + return this[0]; + } + else if (this.t == 0) { + return 0; + } + // assumes 16 < DB < 32 + return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]; + }; + // BigInteger.prototype.byteValue = bnByteValue; + // (public) return value as byte + BigInteger.prototype.byteValue = function () { + return (this.t == 0) ? this.s : (this[0] << 24) >> 24; + }; + // BigInteger.prototype.shortValue = bnShortValue; + // (public) return value as short (assumes DB>=16) + BigInteger.prototype.shortValue = function () { + return (this.t == 0) ? this.s : (this[0] << 16) >> 16; + }; + // BigInteger.prototype.signum = bnSigNum; + // (public) 0 if this == 0, 1 if this > 0 + BigInteger.prototype.signum = function () { + if (this.s < 0) { + return -1; + } + else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) { + return 0; + } + else { + return 1; + } + }; + // BigInteger.prototype.toByteArray = bnToByteArray; + // (public) convert to bigendian byte array + BigInteger.prototype.toByteArray = function () { + var i = this.t; + var r = []; + r[0] = this.s; + var p = this.DB - (i * this.DB) % 8; + var d; + var k = 0; + if (i-- > 0) { + if (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p) { + r[k++] = d | (this.s << (this.DB - p)); + } + while (i >= 0) { + if (p < 8) { + d = (this[i] & ((1 << p) - 1)) << (8 - p); + d |= this[--i] >> (p += this.DB - 8); + } + else { + d = (this[i] >> (p -= 8)) & 0xff; + if (p <= 0) { + p += this.DB; + --i; + } + } + if ((d & 0x80) != 0) { + d |= -256; + } + if (k == 0 && (this.s & 0x80) != (d & 0x80)) { + ++k; + } + if (k > 0 || d != this.s) { + r[k++] = d; + } + } + } + return r; + }; + // BigInteger.prototype.equals = bnEquals; + BigInteger.prototype.equals = function (a) { + return (this.compareTo(a) == 0); + }; + // BigInteger.prototype.min = bnMin; + BigInteger.prototype.min = function (a) { + return (this.compareTo(a) < 0) ? this : a; + }; + // BigInteger.prototype.max = bnMax; + BigInteger.prototype.max = function (a) { + return (this.compareTo(a) > 0) ? this : a; + }; + // BigInteger.prototype.and = bnAnd; + BigInteger.prototype.and = function (a) { + var r = nbi(); + this.bitwiseTo(a, op_and, r); + return r; + }; + // BigInteger.prototype.or = bnOr; + BigInteger.prototype.or = function (a) { + var r = nbi(); + this.bitwiseTo(a, op_or, r); + return r; + }; + // BigInteger.prototype.xor = bnXor; + BigInteger.prototype.xor = function (a) { + var r = nbi(); + this.bitwiseTo(a, op_xor, r); + return r; + }; + // BigInteger.prototype.andNot = bnAndNot; + BigInteger.prototype.andNot = function (a) { + var r = nbi(); + this.bitwiseTo(a, op_andnot, r); + return r; + }; + // BigInteger.prototype.not = bnNot; + // (public) ~this + BigInteger.prototype.not = function () { + var r = nbi(); + for (var i = 0; i < this.t; ++i) { + r[i] = this.DM & ~this[i]; + } + r.t = this.t; + r.s = ~this.s; + return r; + }; + // BigInteger.prototype.shiftLeft = bnShiftLeft; + // (public) this << n + BigInteger.prototype.shiftLeft = function (n) { + var r = nbi(); + if (n < 0) { + this.rShiftTo(-n, r); + } + else { + this.lShiftTo(n, r); + } + return r; + }; + // BigInteger.prototype.shiftRight = bnShiftRight; + // (public) this >> n + BigInteger.prototype.shiftRight = function (n) { + var r = nbi(); + if (n < 0) { + this.lShiftTo(-n, r); + } + else { + this.rShiftTo(n, r); + } + return r; + }; + // BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; + // (public) returns index of lowest 1-bit (or -1 if none) + BigInteger.prototype.getLowestSetBit = function () { + for (var i = 0; i < this.t; ++i) { + if (this[i] != 0) { + return i * this.DB + lbit(this[i]); + } + } + if (this.s < 0) { + return this.t * this.DB; + } + return -1; + }; + // BigInteger.prototype.bitCount = bnBitCount; + // (public) return number of set bits + BigInteger.prototype.bitCount = function () { + var r = 0; + var x = this.s & this.DM; + for (var i = 0; i < this.t; ++i) { + r += cbit(this[i] ^ x); + } + return r; + }; + // BigInteger.prototype.testBit = bnTestBit; + // (public) true iff nth bit is set + BigInteger.prototype.testBit = function (n) { + var j = Math.floor(n / this.DB); + if (j >= this.t) { + return (this.s != 0); + } + return ((this[j] & (1 << (n % this.DB))) != 0); + }; + // BigInteger.prototype.setBit = bnSetBit; + // (public) this | (1< 1) { + var g2 = nbi(); + z.sqrTo(g[1], g2); + while (n <= km) { + g[n] = nbi(); + z.mulTo(g2, g[n - 2], g[n]); + n += 2; + } + } + var j = e.t - 1; + var w; + var is1 = true; + var r2 = nbi(); + var t; + i = nbits(e[j]) - 1; + while (j >= 0) { + if (i >= k1) { + w = (e[j] >> (i - k1)) & km; + } + else { + w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i); + if (j > 0) { + w |= e[j - 1] >> (this.DB + i - k1); + } + } + n = k; + while ((w & 1) == 0) { + w >>= 1; + --n; + } + if ((i -= n) < 0) { + i += this.DB; + --j; + } + if (is1) { // ret == 1, don't bother squaring or multiplying it + g[w].copyTo(r); + is1 = false; + } + else { + while (n > 1) { + z.sqrTo(r, r2); + z.sqrTo(r2, r); + n -= 2; + } + if (n > 0) { + z.sqrTo(r, r2); + } + else { + t = r; + r = r2; + r2 = t; + } + z.mulTo(r2, g[w], r); + } + while (j >= 0 && (e[j] & (1 << i)) == 0) { + z.sqrTo(r, r2); + t = r; + r = r2; + r2 = t; + if (--i < 0) { + i = this.DB - 1; + --j; + } + } + } + return z.revert(r); + }; + // BigInteger.prototype.modInverse = bnModInverse; + // (public) 1/this % m (HAC 14.61) + BigInteger.prototype.modInverse = function (m) { + var ac = m.isEven(); + if ((this.isEven() && ac) || m.signum() == 0) { + return BigInteger.ZERO; + } + var u = m.clone(); + var v = this.clone(); + var a = nbv(1); + var b = nbv(0); + var c = nbv(0); + var d = nbv(1); + while (u.signum() != 0) { + while (u.isEven()) { + u.rShiftTo(1, u); + if (ac) { + if (!a.isEven() || !b.isEven()) { + a.addTo(this, a); + b.subTo(m, b); + } + a.rShiftTo(1, a); + } + else if (!b.isEven()) { + b.subTo(m, b); + } + b.rShiftTo(1, b); + } + while (v.isEven()) { + v.rShiftTo(1, v); + if (ac) { + if (!c.isEven() || !d.isEven()) { + c.addTo(this, c); + d.subTo(m, d); + } + c.rShiftTo(1, c); + } + else if (!d.isEven()) { + d.subTo(m, d); + } + d.rShiftTo(1, d); + } + if (u.compareTo(v) >= 0) { + u.subTo(v, u); + if (ac) { + a.subTo(c, a); + } + b.subTo(d, b); + } + else { + v.subTo(u, v); + if (ac) { + c.subTo(a, c); + } + d.subTo(b, d); + } + } + if (v.compareTo(BigInteger.ONE) != 0) { + return BigInteger.ZERO; + } + if (d.compareTo(m) >= 0) { + return d.subtract(m); + } + if (d.signum() < 0) { + d.addTo(m, d); + } + else { + return d; + } + if (d.signum() < 0) { + return d.add(m); + } + else { + return d; + } + }; + // BigInteger.prototype.pow = bnPow; + // (public) this^e + BigInteger.prototype.pow = function (e) { + return this.exp(e, new NullExp()); + }; + // BigInteger.prototype.gcd = bnGCD; + // (public) gcd(this,a) (HAC 14.54) + BigInteger.prototype.gcd = function (a) { + var x = (this.s < 0) ? this.negate() : this.clone(); + var y = (a.s < 0) ? a.negate() : a.clone(); + if (x.compareTo(y) < 0) { + var t = x; + x = y; + y = t; + } + var i = x.getLowestSetBit(); + var g = y.getLowestSetBit(); + if (g < 0) { + return x; + } + if (i < g) { + g = i; + } + if (g > 0) { + x.rShiftTo(g, x); + y.rShiftTo(g, y); + } + while (x.signum() > 0) { + if ((i = x.getLowestSetBit()) > 0) { + x.rShiftTo(i, x); + } + if ((i = y.getLowestSetBit()) > 0) { + y.rShiftTo(i, y); + } + if (x.compareTo(y) >= 0) { + x.subTo(y, x); + x.rShiftTo(1, x); + } + else { + y.subTo(x, y); + y.rShiftTo(1, y); + } + } + if (g > 0) { + y.lShiftTo(g, y); + } + return y; + }; + // BigInteger.prototype.isProbablePrime = bnIsProbablePrime; + // (public) test primality with certainty >= 1-.5^t + BigInteger.prototype.isProbablePrime = function (t) { + var i; + var x = this.abs(); + if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) { + for (i = 0; i < lowprimes.length; ++i) { + if (x[0] == lowprimes[i]) { + return true; + } + } + return false; + } + if (x.isEven()) { + return false; + } + i = 1; + while (i < lowprimes.length) { + var m = lowprimes[i]; + var j = i + 1; + while (j < lowprimes.length && m < lplim) { + m *= lowprimes[j++]; + } + m = x.modInt(m); + while (i < j) { + if (m % lowprimes[i++] == 0) { + return false; + } + } + } + return x.millerRabin(t); + }; + //#endregion PUBLIC + //#region PROTECTED + // BigInteger.prototype.copyTo = bnpCopyTo; + // (protected) copy this to r + BigInteger.prototype.copyTo = function (r) { + for (var i = this.t - 1; i >= 0; --i) { + r[i] = this[i]; + } + r.t = this.t; + r.s = this.s; + }; + // BigInteger.prototype.fromInt = bnpFromInt; + // (protected) set from integer value x, -DV <= x < DV + BigInteger.prototype.fromInt = function (x) { + this.t = 1; + this.s = (x < 0) ? -1 : 0; + if (x > 0) { + this[0] = x; + } + else if (x < -1) { + this[0] = x + this.DV; + } + else { + this.t = 0; + } + }; + // BigInteger.prototype.fromString = bnpFromString; + // (protected) set from string and radix + BigInteger.prototype.fromString = function (s, b) { + var k; + if (b == 16) { + k = 4; + } + else if (b == 8) { + k = 3; + } + else if (b == 256) { + k = 8; + /* byte array */ + } + else if (b == 2) { + k = 1; + } + else if (b == 32) { + k = 5; + } + else if (b == 4) { + k = 2; + } + else { + this.fromRadix(s, b); + return; + } + this.t = 0; + this.s = 0; + var i = s.length; + var mi = false; + var sh = 0; + while (--i >= 0) { + var x = (k == 8) ? (+s[i]) & 0xff : intAt(s, i); + if (x < 0) { + if (s.charAt(i) == "-") { + mi = true; + } + continue; + } + mi = false; + if (sh == 0) { + this[this.t++] = x; + } + else if (sh + k > this.DB) { + this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh; + this[this.t++] = (x >> (this.DB - sh)); + } + else { + this[this.t - 1] |= x << sh; + } + sh += k; + if (sh >= this.DB) { + sh -= this.DB; + } + } + if (k == 8 && ((+s[0]) & 0x80) != 0) { + this.s = -1; + if (sh > 0) { + this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh; + } + } + this.clamp(); + if (mi) { + BigInteger.ZERO.subTo(this, this); + } + }; + // BigInteger.prototype.clamp = bnpClamp; + // (protected) clamp off excess high words + BigInteger.prototype.clamp = function () { + var c = this.s & this.DM; + while (this.t > 0 && this[this.t - 1] == c) { + --this.t; + } + }; + // BigInteger.prototype.dlShiftTo = bnpDLShiftTo; + // (protected) r = this << n*DB + BigInteger.prototype.dlShiftTo = function (n, r) { + var i; + for (i = this.t - 1; i >= 0; --i) { + r[i + n] = this[i]; + } + for (i = n - 1; i >= 0; --i) { + r[i] = 0; + } + r.t = this.t + n; + r.s = this.s; + }; + // BigInteger.prototype.drShiftTo = bnpDRShiftTo; + // (protected) r = this >> n*DB + BigInteger.prototype.drShiftTo = function (n, r) { + for (var i = n; i < this.t; ++i) { + r[i - n] = this[i]; + } + r.t = Math.max(this.t - n, 0); + r.s = this.s; + }; + // BigInteger.prototype.lShiftTo = bnpLShiftTo; + // (protected) r = this << n + BigInteger.prototype.lShiftTo = function (n, r) { + var bs = n % this.DB; + var cbs = this.DB - bs; + var bm = (1 << cbs) - 1; + var ds = Math.floor(n / this.DB); + var c = (this.s << bs) & this.DM; + for (var i = this.t - 1; i >= 0; --i) { + r[i + ds + 1] = (this[i] >> cbs) | c; + c = (this[i] & bm) << bs; + } + for (var i = ds - 1; i >= 0; --i) { + r[i] = 0; + } + r[ds] = c; + r.t = this.t + ds + 1; + r.s = this.s; + r.clamp(); + }; + // BigInteger.prototype.rShiftTo = bnpRShiftTo; + // (protected) r = this >> n + BigInteger.prototype.rShiftTo = function (n, r) { + r.s = this.s; + var ds = Math.floor(n / this.DB); + if (ds >= this.t) { + r.t = 0; + return; + } + var bs = n % this.DB; + var cbs = this.DB - bs; + var bm = (1 << bs) - 1; + r[0] = this[ds] >> bs; + for (var i = ds + 1; i < this.t; ++i) { + r[i - ds - 1] |= (this[i] & bm) << cbs; + r[i - ds] = this[i] >> bs; + } + if (bs > 0) { + r[this.t - ds - 1] |= (this.s & bm) << cbs; + } + r.t = this.t - ds; + r.clamp(); + }; + // BigInteger.prototype.subTo = bnpSubTo; + // (protected) r = this - a + BigInteger.prototype.subTo = function (a, r) { + var i = 0; + var c = 0; + var m = Math.min(a.t, this.t); + while (i < m) { + c += this[i] - a[i]; + r[i++] = c & this.DM; + c >>= this.DB; + } + if (a.t < this.t) { + c -= a.s; + while (i < this.t) { + c += this[i]; + r[i++] = c & this.DM; + c >>= this.DB; + } + c += this.s; + } + else { + c += this.s; + while (i < a.t) { + c -= a[i]; + r[i++] = c & this.DM; + c >>= this.DB; + } + c -= a.s; + } + r.s = (c < 0) ? -1 : 0; + if (c < -1) { + r[i++] = this.DV + c; + } + else if (c > 0) { + r[i++] = c; + } + r.t = i; + r.clamp(); + }; + // BigInteger.prototype.multiplyTo = bnpMultiplyTo; + // (protected) r = this * a, r != this,a (HAC 14.12) + // "this" should be the larger one if appropriate. + BigInteger.prototype.multiplyTo = function (a, r) { + var x = this.abs(); + var y = a.abs(); + var i = x.t; + r.t = i + y.t; + while (--i >= 0) { + r[i] = 0; + } + for (i = 0; i < y.t; ++i) { + r[i + x.t] = x.am(0, y[i], r, i, 0, x.t); + } + r.s = 0; + r.clamp(); + if (this.s != a.s) { + BigInteger.ZERO.subTo(r, r); + } + }; + // BigInteger.prototype.squareTo = bnpSquareTo; + // (protected) r = this^2, r != this (HAC 14.16) + BigInteger.prototype.squareTo = function (r) { + var x = this.abs(); + var i = r.t = 2 * x.t; + while (--i >= 0) { + r[i] = 0; + } + for (i = 0; i < x.t - 1; ++i) { + var c = x.am(i, x[i], r, 2 * i, 0, 1); + if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) { + r[i + x.t] -= x.DV; + r[i + x.t + 1] = 1; + } + } + if (r.t > 0) { + r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1); + } + r.s = 0; + r.clamp(); + }; + // BigInteger.prototype.divRemTo = bnpDivRemTo; + // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) + // r != q, this != m. q or r may be null. + BigInteger.prototype.divRemTo = function (m, q, r) { + var pm = m.abs(); + if (pm.t <= 0) { + return; + } + var pt = this.abs(); + if (pt.t < pm.t) { + if (q != null) { + q.fromInt(0); + } + if (r != null) { + this.copyTo(r); + } + return; + } + if (r == null) { + r = nbi(); + } + var y = nbi(); + var ts = this.s; + var ms = m.s; + var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus + if (nsh > 0) { + pm.lShiftTo(nsh, y); + pt.lShiftTo(nsh, r); + } + else { + pm.copyTo(y); + pt.copyTo(r); + } + var ys = y.t; + var y0 = y[ys - 1]; + if (y0 == 0) { + return; + } + var yt = y0 * (1 << this.F1) + ((ys > 1) ? y[ys - 2] >> this.F2 : 0); + var d1 = this.FV / yt; + var d2 = (1 << this.F1) / yt; + var e = 1 << this.F2; + var i = r.t; + var j = i - ys; + var t = (q == null) ? nbi() : q; + y.dlShiftTo(j, t); + if (r.compareTo(t) >= 0) { + r[r.t++] = 1; + r.subTo(t, r); + } + BigInteger.ONE.dlShiftTo(ys, t); + t.subTo(y, y); // "negative" y so we can replace sub with am later + while (y.t < ys) { + y[y.t++] = 0; + } + while (--j >= 0) { + // Estimate quotient digit + var qd = (r[--i] == y0) ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2); + if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out + y.dlShiftTo(j, t); + r.subTo(t, r); + while (r[i] < --qd) { + r.subTo(t, r); + } + } + } + if (q != null) { + r.drShiftTo(ys, q); + if (ts != ms) { + BigInteger.ZERO.subTo(q, q); + } + } + r.t = ys; + r.clamp(); + if (nsh > 0) { + r.rShiftTo(nsh, r); + } // Denormalize remainder + if (ts < 0) { + BigInteger.ZERO.subTo(r, r); + } + }; + // BigInteger.prototype.invDigit = bnpInvDigit; + // (protected) return "-1/this % 2^DB"; useful for Mont. reduction + // justification: + // xy == 1 (mod m) + // xy = 1+km + // xy(2-xy) = (1+km)(1-km) + // x[y(2-xy)] = 1-k^2m^2 + // x[y(2-xy)] == 1 (mod m^2) + // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 + // should reduce x and y(2-xy) by m^2 at each step to keep size bounded. + // JS multiply "overflows" differently from C/C++, so care is needed here. + BigInteger.prototype.invDigit = function () { + if (this.t < 1) { + return 0; + } + var x = this[0]; + if ((x & 1) == 0) { + return 0; + } + var y = x & 3; // y == 1/x mod 2^2 + y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4 + y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8 + y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16 + // last step - calculate inverse mod DV directly; + // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints + y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits + // we really want the negative inverse, and -DV < y < DV + return (y > 0) ? this.DV - y : -y; + }; + // BigInteger.prototype.isEven = bnpIsEven; + // (protected) true iff this is even + BigInteger.prototype.isEven = function () { + return ((this.t > 0) ? (this[0] & 1) : this.s) == 0; + }; + // BigInteger.prototype.exp = bnpExp; + // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) + BigInteger.prototype.exp = function (e, z) { + if (e > 0xffffffff || e < 1) { + return BigInteger.ONE; + } + var r = nbi(); + var r2 = nbi(); + var g = z.convert(this); + var i = nbits(e) - 1; + g.copyTo(r); + while (--i >= 0) { + z.sqrTo(r, r2); + if ((e & (1 << i)) > 0) { + z.mulTo(r2, g, r); + } + else { + var t = r; + r = r2; + r2 = t; + } + } + return z.revert(r); + }; + // BigInteger.prototype.chunkSize = bnpChunkSize; + // (protected) return x s.t. r^x < DV + BigInteger.prototype.chunkSize = function (r) { + return Math.floor(Math.LN2 * this.DB / Math.log(r)); + }; + // BigInteger.prototype.toRadix = bnpToRadix; + // (protected) convert to radix string + BigInteger.prototype.toRadix = function (b) { + if (b == null) { + b = 10; + } + if (this.signum() == 0 || b < 2 || b > 36) { + return "0"; + } + var cs = this.chunkSize(b); + var a = Math.pow(b, cs); + var d = nbv(a); + var y = nbi(); + var z = nbi(); + var r = ""; + this.divRemTo(d, y, z); + while (y.signum() > 0) { + r = (a + z.intValue()).toString(b).substr(1) + r; + y.divRemTo(d, y, z); + } + return z.intValue().toString(b) + r; + }; + // BigInteger.prototype.fromRadix = bnpFromRadix; + // (protected) convert from radix string + BigInteger.prototype.fromRadix = function (s, b) { + this.fromInt(0); + if (b == null) { + b = 10; + } + var cs = this.chunkSize(b); + var d = Math.pow(b, cs); + var mi = false; + var j = 0; + var w = 0; + for (var i = 0; i < s.length; ++i) { + var x = intAt(s, i); + if (x < 0) { + if (s.charAt(i) == "-" && this.signum() == 0) { + mi = true; + } + continue; + } + w = b * w + x; + if (++j >= cs) { + this.dMultiply(d); + this.dAddOffset(w, 0); + j = 0; + w = 0; + } + } + if (j > 0) { + this.dMultiply(Math.pow(b, j)); + this.dAddOffset(w, 0); + } + if (mi) { + BigInteger.ZERO.subTo(this, this); + } + }; + // BigInteger.prototype.fromNumber = bnpFromNumber; + // (protected) alternate constructor + BigInteger.prototype.fromNumber = function (a, b, c) { + if ("number" == typeof b) { + // new BigInteger(int,int,RNG) + if (a < 2) { + this.fromInt(1); + } + else { + this.fromNumber(a, c); + if (!this.testBit(a - 1)) { + // force MSB set + this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this); + } + if (this.isEven()) { + this.dAddOffset(1, 0); + } // force odd + while (!this.isProbablePrime(b)) { + this.dAddOffset(2, 0); + if (this.bitLength() > a) { + this.subTo(BigInteger.ONE.shiftLeft(a - 1), this); + } + } + } + } + else { + // new BigInteger(int,RNG) + var x = []; + var t = a & 7; + x.length = (a >> 3) + 1; + b.nextBytes(x); + if (t > 0) { + x[0] &= ((1 << t) - 1); + } + else { + x[0] = 0; + } + this.fromString(x, 256); + } + }; + // BigInteger.prototype.bitwiseTo = bnpBitwiseTo; + // (protected) r = this op a (bitwise) + BigInteger.prototype.bitwiseTo = function (a, op, r) { + var i; + var f; + var m = Math.min(a.t, this.t); + for (i = 0; i < m; ++i) { + r[i] = op(this[i], a[i]); + } + if (a.t < this.t) { + f = a.s & this.DM; + for (i = m; i < this.t; ++i) { + r[i] = op(this[i], f); + } + r.t = this.t; + } + else { + f = this.s & this.DM; + for (i = m; i < a.t; ++i) { + r[i] = op(f, a[i]); + } + r.t = a.t; + } + r.s = op(this.s, a.s); + r.clamp(); + }; + // BigInteger.prototype.changeBit = bnpChangeBit; + // (protected) this op (1<>= this.DB; + } + if (a.t < this.t) { + c += a.s; + while (i < this.t) { + c += this[i]; + r[i++] = c & this.DM; + c >>= this.DB; + } + c += this.s; + } + else { + c += this.s; + while (i < a.t) { + c += a[i]; + r[i++] = c & this.DM; + c >>= this.DB; + } + c += a.s; + } + r.s = (c < 0) ? -1 : 0; + if (c > 0) { + r[i++] = c; + } + else if (c < -1) { + r[i++] = this.DV + c; + } + r.t = i; + r.clamp(); + }; + // BigInteger.prototype.dMultiply = bnpDMultiply; + // (protected) this *= n, this >= 0, 1 < n < DV + BigInteger.prototype.dMultiply = function (n) { + this[this.t] = this.am(0, n - 1, this, 0, 0, this.t); + ++this.t; + this.clamp(); + }; + // BigInteger.prototype.dAddOffset = bnpDAddOffset; + // (protected) this += n << w words, this >= 0 + BigInteger.prototype.dAddOffset = function (n, w) { + if (n == 0) { + return; + } + while (this.t <= w) { + this[this.t++] = 0; + } + this[w] += n; + while (this[w] >= this.DV) { + this[w] -= this.DV; + if (++w >= this.t) { + this[this.t++] = 0; + } + ++this[w]; + } + }; + // BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; + // (protected) r = lower n words of "this * a", a.t <= n + // "this" should be the larger one if appropriate. + BigInteger.prototype.multiplyLowerTo = function (a, n, r) { + var i = Math.min(this.t + a.t, n); + r.s = 0; // assumes a,this >= 0 + r.t = i; + while (i > 0) { + r[--i] = 0; + } + for (var j = r.t - this.t; i < j; ++i) { + r[i + this.t] = this.am(0, a[i], r, i, 0, this.t); + } + for (var j = Math.min(a.t, n); i < j; ++i) { + this.am(0, a[i], r, i, 0, n - i); + } + r.clamp(); + }; + // BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; + // (protected) r = "this * a" without lower n words, n > 0 + // "this" should be the larger one if appropriate. + BigInteger.prototype.multiplyUpperTo = function (a, n, r) { + --n; + var i = r.t = this.t + a.t - n; + r.s = 0; // assumes a,this >= 0 + while (--i >= 0) { + r[i] = 0; + } + for (i = Math.max(n - this.t, 0); i < a.t; ++i) { + r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n); + } + r.clamp(); + r.drShiftTo(1, r); + }; + // BigInteger.prototype.modInt = bnpModInt; + // (protected) this % n, n < 2^26 + BigInteger.prototype.modInt = function (n) { + if (n <= 0) { + return 0; + } + var d = this.DV % n; + var r = (this.s < 0) ? n - 1 : 0; + if (this.t > 0) { + if (d == 0) { + r = this[0] % n; + } + else { + for (var i = this.t - 1; i >= 0; --i) { + r = (d * r + this[i]) % n; + } + } + } + return r; + }; + // BigInteger.prototype.millerRabin = bnpMillerRabin; + // (protected) true if probably prime (HAC 4.24, Miller-Rabin) + BigInteger.prototype.millerRabin = function (t) { + var n1 = this.subtract(BigInteger.ONE); + var k = n1.getLowestSetBit(); + if (k <= 0) { + return false; + } + var r = n1.shiftRight(k); + t = (t + 1) >> 1; + if (t > lowprimes.length) { + t = lowprimes.length; + } + var a = nbi(); + for (var i = 0; i < t; ++i) { + // Pick bases at random, instead of starting at 2 + a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]); + var y = a.modPow(r, this); + if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { + var j = 1; + while (j++ < k && y.compareTo(n1) != 0) { + y = y.modPowInt(2, this); + if (y.compareTo(BigInteger.ONE) == 0) { + return false; + } + } + if (y.compareTo(n1) != 0) { + return false; + } + } + } + return true; + }; + // BigInteger.prototype.square = bnSquare; + // (public) this^2 + BigInteger.prototype.square = function () { + var r = nbi(); + this.squareTo(r); + return r; + }; + //#region ASYNC + // Public API method + BigInteger.prototype.gcda = function (a, callback) { + var x = (this.s < 0) ? this.negate() : this.clone(); + var y = (a.s < 0) ? a.negate() : a.clone(); + if (x.compareTo(y) < 0) { + var t = x; + x = y; + y = t; + } + var i = x.getLowestSetBit(); + var g = y.getLowestSetBit(); + if (g < 0) { + callback(x); + return; + } + if (i < g) { + g = i; + } + if (g > 0) { + x.rShiftTo(g, x); + y.rShiftTo(g, y); + } + // Workhorse of the algorithm, gets called 200 - 800 times per 512 bit keygen. + var gcda1 = function () { + if ((i = x.getLowestSetBit()) > 0) { + x.rShiftTo(i, x); + } + if ((i = y.getLowestSetBit()) > 0) { + y.rShiftTo(i, y); + } + if (x.compareTo(y) >= 0) { + x.subTo(y, x); + x.rShiftTo(1, x); + } + else { + y.subTo(x, y); + y.rShiftTo(1, y); + } + if (!(x.signum() > 0)) { + if (g > 0) { + y.lShiftTo(g, y); + } + setTimeout(function () { callback(y); }, 0); // escape + } + else { + setTimeout(gcda1, 0); + } + }; + setTimeout(gcda1, 10); + }; + // (protected) alternate constructor + BigInteger.prototype.fromNumberAsync = function (a, b, c, callback) { + if ("number" == typeof b) { + if (a < 2) { + this.fromInt(1); + } + else { + this.fromNumber(a, c); + if (!this.testBit(a - 1)) { + this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this); + } + if (this.isEven()) { + this.dAddOffset(1, 0); + } + var bnp_1 = this; + var bnpfn1_1 = function () { + bnp_1.dAddOffset(2, 0); + if (bnp_1.bitLength() > a) { + bnp_1.subTo(BigInteger.ONE.shiftLeft(a - 1), bnp_1); + } + if (bnp_1.isProbablePrime(b)) { + setTimeout(function () { callback(); }, 0); // escape + } + else { + setTimeout(bnpfn1_1, 0); + } + }; + setTimeout(bnpfn1_1, 0); + } + } + else { + var x = []; + var t = a & 7; + x.length = (a >> 3) + 1; + b.nextBytes(x); + if (t > 0) { + x[0] &= ((1 << t) - 1); + } + else { + x[0] = 0; + } + this.fromString(x, 256); + } + }; + return BigInteger; +}()); +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'BigInteger', { enumerable: true, configurable: true, get: function() { return BigInteger; } }); +//#region REDUCERS +//#region NullExp +var NullExp = /** @class */ (function () { + function NullExp() { + } + // NullExp.prototype.convert = nNop; + NullExp.prototype.convert = function (x) { + return x; + }; + // NullExp.prototype.revert = nNop; + NullExp.prototype.revert = function (x) { + return x; + }; + // NullExp.prototype.mulTo = nMulTo; + NullExp.prototype.mulTo = function (x, y, r) { + x.multiplyTo(y, r); + }; + // NullExp.prototype.sqrTo = nSqrTo; + NullExp.prototype.sqrTo = function (x, r) { + x.squareTo(r); + }; + return NullExp; +}()); +// Modular reduction using "classic" algorithm +var Classic = /** @class */ (function () { + function Classic(m) { + this.m = m; + } + // Classic.prototype.convert = cConvert; + Classic.prototype.convert = function (x) { + if (x.s < 0 || x.compareTo(this.m) >= 0) { + return x.mod(this.m); + } + else { + return x; + } + }; + // Classic.prototype.revert = cRevert; + Classic.prototype.revert = function (x) { + return x; + }; + // Classic.prototype.reduce = cReduce; + Classic.prototype.reduce = function (x) { + x.divRemTo(this.m, null, x); + }; + // Classic.prototype.mulTo = cMulTo; + Classic.prototype.mulTo = function (x, y, r) { + x.multiplyTo(y, r); + this.reduce(r); + }; + // Classic.prototype.sqrTo = cSqrTo; + Classic.prototype.sqrTo = function (x, r) { + x.squareTo(r); + this.reduce(r); + }; + return Classic; +}()); +//#endregion +//#region Montgomery +// Montgomery reduction +var Montgomery = /** @class */ (function () { + function Montgomery(m) { + this.m = m; + this.mp = m.invDigit(); + this.mpl = this.mp & 0x7fff; + this.mph = this.mp >> 15; + this.um = (1 << (m.DB - 15)) - 1; + this.mt2 = 2 * m.t; + } + // Montgomery.prototype.convert = montConvert; + // xR mod m + Montgomery.prototype.convert = function (x) { + var r = nbi(); + x.abs().dlShiftTo(this.m.t, r); + r.divRemTo(this.m, null, r); + if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) { + this.m.subTo(r, r); + } + return r; + }; + // Montgomery.prototype.revert = montRevert; + // x/R mod m + Montgomery.prototype.revert = function (x) { + var r = nbi(); + x.copyTo(r); + this.reduce(r); + return r; + }; + // Montgomery.prototype.reduce = montReduce; + // x = x/R mod m (HAC 14.32) + Montgomery.prototype.reduce = function (x) { + while (x.t <= this.mt2) { + // pad x so am has enough room later + x[x.t++] = 0; + } + for (var i = 0; i < this.m.t; ++i) { + // faster way of calculating u0 = x[i]*mp mod DV + var j = x[i] & 0x7fff; + var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM; + // use am to combine the multiply-shift-add into one call + j = i + this.m.t; + x[j] += this.m.am(0, u0, x, i, 0, this.m.t); + // propagate carry + while (x[j] >= x.DV) { + x[j] -= x.DV; + x[++j]++; + } + } + x.clamp(); + x.drShiftTo(this.m.t, x); + if (x.compareTo(this.m) >= 0) { + x.subTo(this.m, x); + } + }; + // Montgomery.prototype.mulTo = montMulTo; + // r = "xy/R mod m"; x,y != r + Montgomery.prototype.mulTo = function (x, y, r) { + x.multiplyTo(y, r); + this.reduce(r); + }; + // Montgomery.prototype.sqrTo = montSqrTo; + // r = "x^2/R mod m"; x != r + Montgomery.prototype.sqrTo = function (x, r) { + x.squareTo(r); + this.reduce(r); + }; + return Montgomery; +}()); +//#endregion Montgomery +//#region Barrett +// Barrett modular reduction +var Barrett = /** @class */ (function () { + function Barrett(m) { + this.m = m; + // setup Barrett + this.r2 = nbi(); + this.q3 = nbi(); + BigInteger.ONE.dlShiftTo(2 * m.t, this.r2); + this.mu = this.r2.divide(m); + } + // Barrett.prototype.convert = barrettConvert; + Barrett.prototype.convert = function (x) { + if (x.s < 0 || x.t > 2 * this.m.t) { + return x.mod(this.m); + } + else if (x.compareTo(this.m) < 0) { + return x; + } + else { + var r = nbi(); + x.copyTo(r); + this.reduce(r); + return r; + } + }; + // Barrett.prototype.revert = barrettRevert; + Barrett.prototype.revert = function (x) { + return x; + }; + // Barrett.prototype.reduce = barrettReduce; + // x = x mod m (HAC 14.42) + Barrett.prototype.reduce = function (x) { + x.drShiftTo(this.m.t - 1, this.r2); + if (x.t > this.m.t + 1) { + x.t = this.m.t + 1; + x.clamp(); + } + this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3); + this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); + while (x.compareTo(this.r2) < 0) { + x.dAddOffset(1, this.m.t + 1); + } + x.subTo(this.r2, x); + while (x.compareTo(this.m) >= 0) { + x.subTo(this.m, x); + } + }; + // Barrett.prototype.mulTo = barrettMulTo; + // r = x*y mod m; x,y != r + Barrett.prototype.mulTo = function (x, y, r) { + x.multiplyTo(y, r); + this.reduce(r); + }; + // Barrett.prototype.sqrTo = barrettSqrTo; + // r = x^2 mod m; x != r + Barrett.prototype.sqrTo = function (x, r) { + x.squareTo(r); + this.reduce(r); + }; + return Barrett; +}()); +//#endregion +//#endregion REDUCERS +// return new, unset BigInteger +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function nbi() { return new BigInteger(null); };exports.nbi = nbi +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function parseBigInt(str, r) { + return new BigInteger(str, r); +};exports.parseBigInt = parseBigInt +// am: Compute w_j += (x*this_i), propagate carries, +// c is initial carry, returns final carry. +// c < 3*dvalue, x < 2*dvalue, this_i < dvalue +// We need to select the fastest one that works in this environment. +var inBrowser = typeof navigator !== "undefined"; +if (inBrowser && j_lm && (navigator.appName == "Microsoft Internet Explorer")) { + // am2 avoids a big mult-and-extract completely. + // Max digit bits should be <= 30 because we do bitwise ops + // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) + BigInteger.prototype.am = function am2(i, x, w, j, c, n) { + var xl = x & 0x7fff; + var xh = x >> 15; + while (--n >= 0) { + var l = this[i] & 0x7fff; + var h = this[i++] >> 15; + var m = xh * l + h * xl; + l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff); + c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30); + w[j++] = l & 0x3fffffff; + } + return c; + }; + dbits = 30; +} +else if (inBrowser && j_lm && (navigator.appName != "Netscape")) { + // am1: use a single mult and divide to get the high bits, + // max digit bits should be 26 because + // max internal value = 2*dvalue^2-2*dvalue (< 2^53) + BigInteger.prototype.am = function am1(i, x, w, j, c, n) { + while (--n >= 0) { + var v = x * this[i++] + w[j] + c; + c = Math.floor(v / 0x4000000); + w[j++] = v & 0x3ffffff; + } + return c; + }; + dbits = 26; +} +else { // Mozilla/Netscape seems to prefer am3 + // Alternately, set max digit bits to 28 since some + // browsers slow down when dealing with 32-bit numbers. + BigInteger.prototype.am = function am3(i, x, w, j, c, n) { + var xl = x & 0x3fff; + var xh = x >> 14; + while (--n >= 0) { + var l = this[i] & 0x3fff; + var h = this[i++] >> 14; + var m = xh * l + h * xl; + l = xl * l + ((m & 0x3fff) << 14) + w[j] + c; + c = (l >> 28) + (m >> 14) + xh * h; + w[j++] = l & 0xfffffff; + } + return c; + }; + dbits = 28; +} +BigInteger.prototype.DB = dbits; +BigInteger.prototype.DM = ((1 << dbits) - 1); +BigInteger.prototype.DV = (1 << dbits); +var BI_FP = 52; +BigInteger.prototype.FV = Math.pow(2, BI_FP); +BigInteger.prototype.F1 = BI_FP - dbits; +BigInteger.prototype.F2 = 2 * dbits - BI_FP; +// Digit conversions +var BI_RC = []; +var rr; +var vv; +rr = "0".charCodeAt(0); +for (vv = 0; vv <= 9; ++vv) { + BI_RC[rr++] = vv; +} +rr = "a".charCodeAt(0); +for (vv = 10; vv < 36; ++vv) { + BI_RC[rr++] = vv; +} +rr = "A".charCodeAt(0); +for (vv = 10; vv < 36; ++vv) { + BI_RC[rr++] = vv; +} +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function intAt(s, i) { + var c = BI_RC[s.charCodeAt(i)]; + return (c == null) ? -1 : c; +};exports.intAt = intAt +// return bigint initialized to value +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function nbv(i) { + var r = nbi(); + r.fromInt(i); + return r; +};exports.nbv = nbv +// returns bit length of the integer x +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function nbits(x) { + var r = 1; + var t; + if ((t = x >>> 16) != 0) { + x = t; + r += 16; + } + if ((t = x >> 8) != 0) { + x = t; + r += 8; + } + if ((t = x >> 4) != 0) { + x = t; + r += 4; + } + if ((t = x >> 2) != 0) { + x = t; + r += 2; + } + if ((t = x >> 1) != 0) { + x = t; + r += 1; + } + return r; +};exports.nbits = nbits +// "constants" +BigInteger.ZERO = nbv(0); +BigInteger.ONE = nbv(1); + +}, function(modId) { var map = {"./util":1709513243597}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243605, function(require, module, exports) { +// Random number generator - requires a PRNG backend, e.g. prng4.js +var __TEMP__ = require('./prng4');var prng_newstate = __TEMP__['prng_newstate'];var rng_psize = __TEMP__['rng_psize']; +var rng_state; +var rng_pool = null; +var rng_pptr; +// Initialize the pool with junk if needed. +if (rng_pool == null) { + rng_pool = []; + rng_pptr = 0; + var t = void 0; + // Use mouse events for entropy, if we do not have enough entropy by the time + // we need it, entropy will be generated by Math.random. + var count = 0; + var onMouseMoveListener = function (ev) { + count = count || 0; + if (count >= 256 || rng_pptr >= rng_psize) { + return; + } + try { + var mouseCoordinates = ev.x + ev.y; + rng_pool[rng_pptr++] = mouseCoordinates & 255; + count += 1; + } + catch (e) { + // Sometimes Firefox will deny permission to access event properties for some reason. Ignore. + } + }; +} +function rng_get_byte() { + if (rng_state == null) { + rng_state = prng_newstate(); + // At this point, we may not have collected enough entropy. If not, fall back to Math.random + while (rng_pptr < rng_psize) { + var random = Math.floor(65536 * Math.random()); + rng_pool[rng_pptr++] = random & 255; + } + rng_state.init(rng_pool); + for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) { + rng_pool[rng_pptr] = 0; + } + rng_pptr = 0; + } + // TODO: allow reseeding after first request + return rng_state.next(); +} +var SecureRandom = /** @class */ (function () { + function SecureRandom() { + } + SecureRandom.prototype.nextBytes = function (ba) { + for (var i = 0; i < ba.length; ++i) { + ba[i] = rng_get_byte(); + } + }; + return SecureRandom; +}()); +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'SecureRandom', { enumerable: true, configurable: true, get: function() { return SecureRandom; } }); + +}, function(modId) { var map = {"./prng4":1709513243606}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243606, function(require, module, exports) { +// prng4.js - uses Arcfour as a PRNG +var Arcfour = /** @class */ (function () { + function Arcfour() { + this.i = 0; + this.j = 0; + this.S = []; + } + // Arcfour.prototype.init = ARC4init; + // Initialize arcfour context from key, an array of ints, each from [0..255] + Arcfour.prototype.init = function (key) { + var i; + var j; + var t; + for (i = 0; i < 256; ++i) { + this.S[i] = i; + } + j = 0; + for (i = 0; i < 256; ++i) { + j = (j + this.S[i] + key[i % key.length]) & 255; + t = this.S[i]; + this.S[i] = this.S[j]; + this.S[j] = t; + } + this.i = 0; + this.j = 0; + }; + // Arcfour.prototype.next = ARC4next; + Arcfour.prototype.next = function () { + var t; + this.i = (this.i + 1) & 255; + this.j = (this.j + this.S[this.i]) & 255; + t = this.S[this.i]; + this.S[this.i] = this.S[this.j]; + this.S[this.j] = t; + return this.S[(t + this.S[this.i]) & 255]; + }; + return Arcfour; +}()); +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'Arcfour', { enumerable: true, configurable: true, get: function() { return Arcfour; } }); +// Plug in your RNG constructor here +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });function prng_newstate() { + return new Arcfour(); +};exports.prng_newstate = prng_newstate +// Pool size must be a multiple of 4 and greater than 32. +// An array of bytes the size of the pool will be passed to init() +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });var rng_psize = exports.rng_psize = 256; + +}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243607, function(require, module, exports) { +/* asn1-1.0.13.js (c) 2013-2017 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +/* + * asn1.js - ASN.1 DER encoder classes + * + * Copyright (c) 2013-2017 Kenji Urushima (kenji.urushima@gmail.com) + * + * This software is licensed under the terms of the MIT License. + * https://kjur.github.io/jsrsasign/license + * + * The above copyright and license notice shall be + * included in all copies or substantial portions of the Software. + */ +var __TEMP__ = require('../jsbn/jsbn');var BigInteger = __TEMP__['BigInteger']; +var __TEMP__ = require('./yahoo');var YAHOO = __TEMP__['YAHOO']; +/** + * @fileOverview + * @name asn1-1.0.js + * @author Kenji Urushima kenji.urushima@gmail.com + * @version asn1 1.0.13 (2017-Jun-02) + * @since jsrsasign 2.1 + * @license MIT License + */ +/** + * kjur's class library name space + *

+ * This name space provides following name spaces: + *

    + *
  • {@link KJUR.asn1} - ASN.1 primitive hexadecimal encoder
  • + *
  • {@link KJUR.asn1.x509} - ASN.1 structure for X.509 certificate and CRL
  • + *
  • {@link KJUR.crypto} - Java Cryptographic Extension(JCE) style MessageDigest/Signature + * class and utilities
  • + *
+ *

+ * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2. + * @name KJUR + * @namespace kjur's class library name space + */ +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });var KJUR = exports.KJUR = {}; +/** + * kjur's ASN.1 class library name space + *

+ * This is ITU-T X.690 ASN.1 DER encoder class library and + * class structure and methods is very similar to + * org.bouncycastle.asn1 package of + * well known BouncyCaslte Cryptography Library. + *

PROVIDING ASN.1 PRIMITIVES

+ * Here are ASN.1 DER primitive classes. + *
    + *
  • 0x01 {@link KJUR.asn1.DERBoolean}
  • + *
  • 0x02 {@link KJUR.asn1.DERInteger}
  • + *
  • 0x03 {@link KJUR.asn1.DERBitString}
  • + *
  • 0x04 {@link KJUR.asn1.DEROctetString}
  • + *
  • 0x05 {@link KJUR.asn1.DERNull}
  • + *
  • 0x06 {@link KJUR.asn1.DERObjectIdentifier}
  • + *
  • 0x0a {@link KJUR.asn1.DEREnumerated}
  • + *
  • 0x0c {@link KJUR.asn1.DERUTF8String}
  • + *
  • 0x12 {@link KJUR.asn1.DERNumericString}
  • + *
  • 0x13 {@link KJUR.asn1.DERPrintableString}
  • + *
  • 0x14 {@link KJUR.asn1.DERTeletexString}
  • + *
  • 0x16 {@link KJUR.asn1.DERIA5String}
  • + *
  • 0x17 {@link KJUR.asn1.DERUTCTime}
  • + *
  • 0x18 {@link KJUR.asn1.DERGeneralizedTime}
  • + *
  • 0x30 {@link KJUR.asn1.DERSequence}
  • + *
  • 0x31 {@link KJUR.asn1.DERSet}
  • + *
+ *

OTHER ASN.1 CLASSES

+ *
    + *
  • {@link KJUR.asn1.ASN1Object}
  • + *
  • {@link KJUR.asn1.DERAbstractString}
  • + *
  • {@link KJUR.asn1.DERAbstractTime}
  • + *
  • {@link KJUR.asn1.DERAbstractStructured}
  • + *
  • {@link KJUR.asn1.DERTaggedObject}
  • + *
+ *

SUB NAME SPACES

+ *
    + *
  • {@link KJUR.asn1.cades} - CAdES long term signature format
  • + *
  • {@link KJUR.asn1.cms} - Cryptographic Message Syntax
  • + *
  • {@link KJUR.asn1.csr} - Certificate Signing Request (CSR/PKCS#10)
  • + *
  • {@link KJUR.asn1.tsp} - RFC 3161 Timestamping Protocol Format
  • + *
  • {@link KJUR.asn1.x509} - RFC 5280 X.509 certificate and CRL
  • + *
+ *

+ * NOTE: Please ignore method summary and document of this namespace. + * This caused by a bug of jsdoc2. + * @name KJUR.asn1 + * @namespace + */ +if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) + KJUR.asn1 = {}; +/** + * ASN1 utilities class + * @name KJUR.asn1.ASN1Util + * @class ASN1 utilities class + * @since asn1 1.0.2 + */ +KJUR.asn1.ASN1Util = new function () { + this.integerToByteHex = function (i) { + var h = i.toString(16); + if ((h.length % 2) == 1) + h = '0' + h; + return h; + }; + this.bigIntToMinTwosComplementsHex = function (bigIntegerValue) { + var h = bigIntegerValue.toString(16); + if (h.substr(0, 1) != '-') { + if (h.length % 2 == 1) { + h = '0' + h; + } + else { + if (!h.match(/^[0-7]/)) { + h = '00' + h; + } + } + } + else { + var hPos = h.substr(1); + var xorLen = hPos.length; + if (xorLen % 2 == 1) { + xorLen += 1; + } + else { + if (!h.match(/^[0-7]/)) { + xorLen += 2; + } + } + var hMask = ''; + for (var i = 0; i < xorLen; i++) { + hMask += 'f'; + } + var biMask = new BigInteger(hMask, 16); + var biNeg = biMask.xor(bigIntegerValue).add(BigInteger.ONE); + h = biNeg.toString(16).replace(/^-/, ''); + } + return h; + }; + /** + * get PEM string from hexadecimal data and header string + * @name getPEMStringFromHex + * @memberOf KJUR.asn1.ASN1Util + * @function + * @param {String} dataHex hexadecimal string of PEM body + * @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY') + * @return {String} PEM formatted string of input data + * @description + * This method converts a hexadecimal string to a PEM string with + * a specified header. Its line break will be CRLF("\r\n"). + * @example + * var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY'); + * // value of pem will be: + * -----BEGIN PRIVATE KEY----- + * YWFh + * -----END PRIVATE KEY----- + */ + this.getPEMStringFromHex = function (dataHex, pemHeader) { + return hextopem(dataHex, pemHeader); + }; + /** + * generate ASN1Object specifed by JSON parameters + * @name newObject + * @memberOf KJUR.asn1.ASN1Util + * @function + * @param {Array} param JSON parameter to generate ASN1Object + * @return {KJUR.asn1.ASN1Object} generated object + * @since asn1 1.0.3 + * @description + * generate any ASN1Object specified by JSON param + * including ASN.1 primitive or structured. + * Generally 'param' can be described as follows: + *
+ * {TYPE-OF-ASNOBJ: ASN1OBJ-PARAMETER} + *
+ * 'TYPE-OF-ASN1OBJ' can be one of following symbols: + *
    + *
  • 'bool' - DERBoolean
  • + *
  • 'int' - DERInteger
  • + *
  • 'bitstr' - DERBitString
  • + *
  • 'octstr' - DEROctetString
  • + *
  • 'null' - DERNull
  • + *
  • 'oid' - DERObjectIdentifier
  • + *
  • 'enum' - DEREnumerated
  • + *
  • 'utf8str' - DERUTF8String
  • + *
  • 'numstr' - DERNumericString
  • + *
  • 'prnstr' - DERPrintableString
  • + *
  • 'telstr' - DERTeletexString
  • + *
  • 'ia5str' - DERIA5String
  • + *
  • 'utctime' - DERUTCTime
  • + *
  • 'gentime' - DERGeneralizedTime
  • + *
  • 'seq' - DERSequence
  • + *
  • 'set' - DERSet
  • + *
  • 'tag' - DERTaggedObject
  • + *
+ * @example + * newObject({'prnstr': 'aaa'}); + * newObject({'seq': [{'int': 3}, {'prnstr': 'aaa'}]}) + * // ASN.1 Tagged Object + * newObject({'tag': {'tag': 'a1', + * 'explicit': true, + * 'obj': {'seq': [{'int': 3}, {'prnstr': 'aaa'}]}}}); + * // more simple representation of ASN.1 Tagged Object + * newObject({'tag': ['a1', + * true, + * {'seq': [ + * {'int': 3}, + * {'prnstr': 'aaa'}]} + * ]}); + */ + this.newObject = function (param) { + var _KJUR = KJUR, _KJUR_asn1 = _KJUR.asn1, _DERBoolean = _KJUR_asn1.DERBoolean, _DERInteger = _KJUR_asn1.DERInteger, _DERBitString = _KJUR_asn1.DERBitString, _DEROctetString = _KJUR_asn1.DEROctetString, _DERNull = _KJUR_asn1.DERNull, _DERObjectIdentifier = _KJUR_asn1.DERObjectIdentifier, _DEREnumerated = _KJUR_asn1.DEREnumerated, _DERUTF8String = _KJUR_asn1.DERUTF8String, _DERNumericString = _KJUR_asn1.DERNumericString, _DERPrintableString = _KJUR_asn1.DERPrintableString, _DERTeletexString = _KJUR_asn1.DERTeletexString, _DERIA5String = _KJUR_asn1.DERIA5String, _DERUTCTime = _KJUR_asn1.DERUTCTime, _DERGeneralizedTime = _KJUR_asn1.DERGeneralizedTime, _DERSequence = _KJUR_asn1.DERSequence, _DERSet = _KJUR_asn1.DERSet, _DERTaggedObject = _KJUR_asn1.DERTaggedObject, _newObject = _KJUR_asn1.ASN1Util.newObject; + var keys = Object.keys(param); + if (keys.length != 1) + throw "key of param shall be only one."; + var key = keys[0]; + if (":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + key + ":") == -1) + throw "undefined key: " + key; + if (key == "bool") + return new _DERBoolean(param[key]); + if (key == "int") + return new _DERInteger(param[key]); + if (key == "bitstr") + return new _DERBitString(param[key]); + if (key == "octstr") + return new _DEROctetString(param[key]); + if (key == "null") + return new _DERNull(param[key]); + if (key == "oid") + return new _DERObjectIdentifier(param[key]); + if (key == "enum") + return new _DEREnumerated(param[key]); + if (key == "utf8str") + return new _DERUTF8String(param[key]); + if (key == "numstr") + return new _DERNumericString(param[key]); + if (key == "prnstr") + return new _DERPrintableString(param[key]); + if (key == "telstr") + return new _DERTeletexString(param[key]); + if (key == "ia5str") + return new _DERIA5String(param[key]); + if (key == "utctime") + return new _DERUTCTime(param[key]); + if (key == "gentime") + return new _DERGeneralizedTime(param[key]); + if (key == "seq") { + var paramList = param[key]; + var a = []; + for (var i = 0; i < paramList.length; i++) { + var asn1Obj = _newObject(paramList[i]); + a.push(asn1Obj); + } + return new _DERSequence({ 'array': a }); + } + if (key == "set") { + var paramList = param[key]; + var a = []; + for (var i = 0; i < paramList.length; i++) { + var asn1Obj = _newObject(paramList[i]); + a.push(asn1Obj); + } + return new _DERSet({ 'array': a }); + } + if (key == "tag") { + var tagParam = param[key]; + if (Object.prototype.toString.call(tagParam) === '[object Array]' && + tagParam.length == 3) { + var obj = _newObject(tagParam[2]); + return new _DERTaggedObject({ tag: tagParam[0], + explicit: tagParam[1], + obj: obj }); + } + else { + var newParam = {}; + if (tagParam.explicit !== undefined) + newParam.explicit = tagParam.explicit; + if (tagParam.tag !== undefined) + newParam.tag = tagParam.tag; + if (tagParam.obj === undefined) + throw "obj shall be specified for 'tag'."; + newParam.obj = _newObject(tagParam.obj); + return new _DERTaggedObject(newParam); + } + } + }; + /** + * get encoded hexadecimal string of ASN1Object specifed by JSON parameters + * @name jsonToASN1HEX + * @memberOf KJUR.asn1.ASN1Util + * @function + * @param {Array} param JSON parameter to generate ASN1Object + * @return hexadecimal string of ASN1Object + * @since asn1 1.0.4 + * @description + * As for ASN.1 object representation of JSON object, + * please see {@link newObject}. + * @example + * jsonToASN1HEX({'prnstr': 'aaa'}); + */ + this.jsonToASN1HEX = function (param) { + var asn1Obj = this.newObject(param); + return asn1Obj.getEncodedHex(); + }; +}; +/** + * get dot noted oid number string from hexadecimal value of OID + * @name oidHexToInt + * @memberOf KJUR.asn1.ASN1Util + * @function + * @param {String} hex hexadecimal value of object identifier + * @return {String} dot noted string of object identifier + * @since jsrsasign 4.8.3 asn1 1.0.7 + * @description + * This static method converts from hexadecimal string representation of + * ASN.1 value of object identifier to oid number string. + * @example + * KJUR.asn1.ASN1Util.oidHexToInt('550406') → "2.5.4.6" + */ +KJUR.asn1.ASN1Util.oidHexToInt = function (hex) { + var s = ""; + var i01 = parseInt(hex.substr(0, 2), 16); + var i0 = Math.floor(i01 / 40); + var i1 = i01 % 40; + var s = i0 + "." + i1; + var binbuf = ""; + for (var i = 2; i < hex.length; i += 2) { + var value = parseInt(hex.substr(i, 2), 16); + var bin = ("00000000" + value.toString(2)).slice(-8); + binbuf = binbuf + bin.substr(1, 7); + if (bin.substr(0, 1) == "0") { + var bi = new BigInteger(binbuf, 2); + s = s + "." + bi.toString(10); + binbuf = ""; + } + } + ; + return s; +}; +/** + * get hexadecimal value of object identifier from dot noted oid value + * @name oidIntToHex + * @memberOf KJUR.asn1.ASN1Util + * @function + * @param {String} oidString dot noted string of object identifier + * @return {String} hexadecimal value of object identifier + * @since jsrsasign 4.8.3 asn1 1.0.7 + * @description + * This static method converts from object identifier value string. + * to hexadecimal string representation of it. + * @example + * KJUR.asn1.ASN1Util.oidIntToHex("2.5.4.6") → "550406" + */ +KJUR.asn1.ASN1Util.oidIntToHex = function (oidString) { + var itox = function (i) { + var h = i.toString(16); + if (h.length == 1) + h = '0' + h; + return h; + }; + var roidtox = function (roid) { + var h = ''; + var bi = new BigInteger(roid, 10); + var b = bi.toString(2); + var padLen = 7 - b.length % 7; + if (padLen == 7) + padLen = 0; + var bPad = ''; + for (var i = 0; i < padLen; i++) + bPad += '0'; + b = bPad + b; + for (var i = 0; i < b.length - 1; i += 7) { + var b8 = b.substr(i, 7); + if (i != b.length - 7) + b8 = '1' + b8; + h += itox(parseInt(b8, 2)); + } + return h; + }; + if (!oidString.match(/^[0-9.]+$/)) { + throw "malformed oid string: " + oidString; + } + var h = ''; + var a = oidString.split('.'); + var i0 = parseInt(a[0]) * 40 + parseInt(a[1]); + h += itox(i0); + a.splice(0, 2); + for (var i = 0; i < a.length; i++) { + h += roidtox(a[i]); + } + return h; +}; +// ******************************************************************** +// Abstract ASN.1 Classes +// ******************************************************************** +// ******************************************************************** +/** + * base class for ASN.1 DER encoder object + * @name KJUR.asn1.ASN1Object + * @class base class for ASN.1 DER encoder object + * @property {Boolean} isModified flag whether internal data was changed + * @property {String} hTLV hexadecimal string of ASN.1 TLV + * @property {String} hT hexadecimal string of ASN.1 TLV tag(T) + * @property {String} hL hexadecimal string of ASN.1 TLV length(L) + * @property {String} hV hexadecimal string of ASN.1 TLV value(V) + * @description + */ +KJUR.asn1.ASN1Object = function () { + var isModified = true; + var hTLV = null; + var hT = '00'; + var hL = '00'; + var hV = ''; + /** + * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V) + * @name getLengthHexFromValue + * @memberOf KJUR.asn1.ASN1Object# + * @function + * @return {String} hexadecimal string of ASN.1 TLV length(L) + */ + this.getLengthHexFromValue = function () { + if (typeof this.hV == "undefined" || this.hV == null) { + throw "this.hV is null or undefined."; + } + if (this.hV.length % 2 == 1) { + throw "value hex must be even length: n=" + hV.length + ",v=" + this.hV; + } + var n = this.hV.length / 2; + var hN = n.toString(16); + if (hN.length % 2 == 1) { + hN = "0" + hN; + } + if (n < 128) { + return hN; + } + else { + var hNlen = hN.length / 2; + if (hNlen > 15) { + throw "ASN.1 length too long to represent by 8x: n = " + n.toString(16); + } + var head = 128 + hNlen; + return head.toString(16) + hN; + } + }; + /** + * get hexadecimal string of ASN.1 TLV bytes + * @name getEncodedHex + * @memberOf KJUR.asn1.ASN1Object# + * @function + * @return {String} hexadecimal string of ASN.1 TLV + */ + this.getEncodedHex = function () { + if (this.hTLV == null || this.isModified) { + this.hV = this.getFreshValueHex(); + this.hL = this.getLengthHexFromValue(); + this.hTLV = this.hT + this.hL + this.hV; + this.isModified = false; + //alert("first time: " + this.hTLV); + } + return this.hTLV; + }; + /** + * get hexadecimal string of ASN.1 TLV value(V) bytes + * @name getValueHex + * @memberOf KJUR.asn1.ASN1Object# + * @function + * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes + */ + this.getValueHex = function () { + this.getEncodedHex(); + return this.hV; + }; + this.getFreshValueHex = function () { + return ''; + }; +}; +// == BEGIN DERAbstractString ================================================ +/** + * base class for ASN.1 DER string classes + * @name KJUR.asn1.DERAbstractString + * @class base class for ASN.1 DER string classes + * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) + * @property {String} s internal string of value + * @extends KJUR.asn1.ASN1Object + * @description + *
+ * As for argument 'params' for constructor, you can specify one of + * following properties: + *
    + *
  • str - specify initial ASN.1 value(V) by a string
  • + *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • + *
+ * NOTE: 'params' can be omitted. + */ +KJUR.asn1.DERAbstractString = function (params) { + KJUR.asn1.DERAbstractString.superclass.constructor.call(this); + var s = null; + var hV = null; + /** + * get string value of this string object + * @name getString + * @memberOf KJUR.asn1.DERAbstractString# + * @function + * @return {String} string value of this string object + */ + this.getString = function () { + return this.s; + }; + /** + * set value by a string + * @name setString + * @memberOf KJUR.asn1.DERAbstractString# + * @function + * @param {String} newS value by a string to set + */ + this.setString = function (newS) { + this.hTLV = null; + this.isModified = true; + this.s = newS; + this.hV = stohex(this.s); + }; + /** + * set value by a hexadecimal string + * @name setStringHex + * @memberOf KJUR.asn1.DERAbstractString# + * @function + * @param {String} newHexString value by a hexadecimal string to set + */ + this.setStringHex = function (newHexString) { + this.hTLV = null; + this.isModified = true; + this.s = null; + this.hV = newHexString; + }; + this.getFreshValueHex = function () { + return this.hV; + }; + if (typeof params != "undefined") { + if (typeof params == "string") { + this.setString(params); + } + else if (typeof params['str'] != "undefined") { + this.setString(params['str']); + } + else if (typeof params['hex'] != "undefined") { + this.setStringHex(params['hex']); + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object); +// == END DERAbstractString ================================================ +// == BEGIN DERAbstractTime ================================================== +/** + * base class for ASN.1 DER Generalized/UTCTime class + * @name KJUR.asn1.DERAbstractTime + * @class base class for ASN.1 DER Generalized/UTCTime class + * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'}) + * @extends KJUR.asn1.ASN1Object + * @description + * @see KJUR.asn1.ASN1Object - superclass + */ +KJUR.asn1.DERAbstractTime = function (params) { + KJUR.asn1.DERAbstractTime.superclass.constructor.call(this); + var s = null; + var date = null; + // --- PRIVATE METHODS -------------------- + this.localDateToUTC = function (d) { + utc = d.getTime() + (d.getTimezoneOffset() * 60000); + var utcDate = new Date(utc); + return utcDate; + }; + /* + * format date string by Data object + * @name formatDate + * @memberOf KJUR.asn1.AbstractTime; + * @param {Date} dateObject + * @param {string} type 'utc' or 'gen' + * @param {boolean} withMillis flag for with millisections or not + * @description + * 'withMillis' flag is supported from asn1 1.0.6. + */ + this.formatDate = function (dateObject, type, withMillis) { + var pad = this.zeroPadding; + var d = this.localDateToUTC(dateObject); + var year = String(d.getFullYear()); + if (type == 'utc') + year = year.substr(2, 2); + var month = pad(String(d.getMonth() + 1), 2); + var day = pad(String(d.getDate()), 2); + var hour = pad(String(d.getHours()), 2); + var min = pad(String(d.getMinutes()), 2); + var sec = pad(String(d.getSeconds()), 2); + var s = year + month + day + hour + min + sec; + if (withMillis === true) { + var millis = d.getMilliseconds(); + if (millis != 0) { + var sMillis = pad(String(millis), 3); + sMillis = sMillis.replace(/[0]+$/, ""); + s = s + "." + sMillis; + } + } + return s + "Z"; + }; + this.zeroPadding = function (s, len) { + if (s.length >= len) + return s; + return new Array(len - s.length + 1).join('0') + s; + }; + // --- PUBLIC METHODS -------------------- + /** + * get string value of this string object + * @name getString + * @memberOf KJUR.asn1.DERAbstractTime# + * @function + * @return {String} string value of this time object + */ + this.getString = function () { + return this.s; + }; + /** + * set value by a string + * @name setString + * @memberOf KJUR.asn1.DERAbstractTime# + * @function + * @param {String} newS value by a string to set such like "130430235959Z" + */ + this.setString = function (newS) { + this.hTLV = null; + this.isModified = true; + this.s = newS; + this.hV = stohex(newS); + }; + /** + * set value by a Date object + * @name setByDateValue + * @memberOf KJUR.asn1.DERAbstractTime# + * @function + * @param {Integer} year year of date (ex. 2013) + * @param {Integer} month month of date between 1 and 12 (ex. 12) + * @param {Integer} day day of month + * @param {Integer} hour hours of date + * @param {Integer} min minutes of date + * @param {Integer} sec seconds of date + */ + this.setByDateValue = function (year, month, day, hour, min, sec) { + var dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0)); + this.setByDate(dateObject); + }; + this.getFreshValueHex = function () { + return this.hV; + }; +}; +YAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object); +// == END DERAbstractTime ================================================== +// == BEGIN DERAbstractStructured ============================================ +/** + * base class for ASN.1 DER structured class + * @name KJUR.asn1.DERAbstractStructured + * @class base class for ASN.1 DER structured class + * @property {Array} asn1Array internal array of ASN1Object + * @extends KJUR.asn1.ASN1Object + * @description + * @see KJUR.asn1.ASN1Object - superclass + */ +KJUR.asn1.DERAbstractStructured = function (params) { + KJUR.asn1.DERAbstractString.superclass.constructor.call(this); + var asn1Array = null; + /** + * set value by array of ASN1Object + * @name setByASN1ObjectArray + * @memberOf KJUR.asn1.DERAbstractStructured# + * @function + * @param {array} asn1ObjectArray array of ASN1Object to set + */ + this.setByASN1ObjectArray = function (asn1ObjectArray) { + this.hTLV = null; + this.isModified = true; + this.asn1Array = asn1ObjectArray; + }; + /** + * append an ASN1Object to internal array + * @name appendASN1Object + * @memberOf KJUR.asn1.DERAbstractStructured# + * @function + * @param {ASN1Object} asn1Object to add + */ + this.appendASN1Object = function (asn1Object) { + this.hTLV = null; + this.isModified = true; + this.asn1Array.push(asn1Object); + }; + this.asn1Array = new Array(); + if (typeof params != "undefined") { + if (typeof params['array'] != "undefined") { + this.asn1Array = params['array']; + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object); +// ******************************************************************** +// ASN.1 Object Classes +// ******************************************************************** +// ******************************************************************** +/** + * class for ASN.1 DER Boolean + * @name KJUR.asn1.DERBoolean + * @class class for ASN.1 DER Boolean + * @extends KJUR.asn1.ASN1Object + * @description + * @see KJUR.asn1.ASN1Object - superclass + */ +KJUR.asn1.DERBoolean = function () { + KJUR.asn1.DERBoolean.superclass.constructor.call(this); + this.hT = "01"; + this.hTLV = "0101ff"; +}; +YAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object); +// ******************************************************************** +/** + * class for ASN.1 DER Integer + * @name KJUR.asn1.DERInteger + * @class class for ASN.1 DER Integer + * @extends KJUR.asn1.ASN1Object + * @description + *
+ * As for argument 'params' for constructor, you can specify one of + * following properties: + *
    + *
  • int - specify initial ASN.1 value(V) by integer value
  • + *
  • bigint - specify initial ASN.1 value(V) by BigInteger object
  • + *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • + *
+ * NOTE: 'params' can be omitted. + */ +KJUR.asn1.DERInteger = function (params) { + KJUR.asn1.DERInteger.superclass.constructor.call(this); + this.hT = "02"; + /** + * set value by Tom Wu's BigInteger object + * @name setByBigInteger + * @memberOf KJUR.asn1.DERInteger# + * @function + * @param {BigInteger} bigIntegerValue to set + */ + this.setByBigInteger = function (bigIntegerValue) { + this.hTLV = null; + this.isModified = true; + this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue); + }; + /** + * set value by integer value + * @name setByInteger + * @memberOf KJUR.asn1.DERInteger + * @function + * @param {Integer} integer value to set + */ + this.setByInteger = function (intValue) { + var bi = new BigInteger(String(intValue), 10); + this.setByBigInteger(bi); + }; + /** + * set value by integer value + * @name setValueHex + * @memberOf KJUR.asn1.DERInteger# + * @function + * @param {String} hexadecimal string of integer value + * @description + *
+ * NOTE: Value shall be represented by minimum octet length of + * two's complement representation. + * @example + * new KJUR.asn1.DERInteger(123); + * new KJUR.asn1.DERInteger({'int': 123}); + * new KJUR.asn1.DERInteger({'hex': '1fad'}); + */ + this.setValueHex = function (newHexString) { + this.hV = newHexString; + }; + this.getFreshValueHex = function () { + return this.hV; + }; + if (typeof params != "undefined") { + if (typeof params['bigint'] != "undefined") { + this.setByBigInteger(params['bigint']); + } + else if (typeof params['int'] != "undefined") { + this.setByInteger(params['int']); + } + else if (typeof params == "number") { + this.setByInteger(params); + } + else if (typeof params['hex'] != "undefined") { + this.setValueHex(params['hex']); + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object); +// ******************************************************************** +/** + * class for ASN.1 DER encoded BitString primitive + * @name KJUR.asn1.DERBitString + * @class class for ASN.1 DER encoded BitString primitive + * @extends KJUR.asn1.ASN1Object + * @description + *
+ * As for argument 'params' for constructor, you can specify one of + * following properties: + *
    + *
  • bin - specify binary string (ex. '10111')
  • + *
  • array - specify array of boolean (ex. [true,false,true,true])
  • + *
  • hex - specify hexadecimal string of ASN.1 value(V) including unused bits
  • + *
  • obj - specify {@link KJUR.asn1.ASN1Util.newObject} + * argument for "BitString encapsulates" structure.
  • + *
+ * NOTE1: 'params' can be omitted.
+ * NOTE2: 'obj' parameter have been supported since + * asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).
+ * @example + * // default constructor + * o = new KJUR.asn1.DERBitString(); + * // initialize with binary string + * o = new KJUR.asn1.DERBitString({bin: "1011"}); + * // initialize with boolean array + * o = new KJUR.asn1.DERBitString({array: [true,false,true,true]}); + * // initialize with hexadecimal string (04 is unused bits) + * o = new KJUR.asn1.DEROctetString({hex: "04bac0"}); + * // initialize with ASN1Util.newObject argument for encapsulated + * o = new KJUR.asn1.DERBitString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}}); + * // above generates a ASN.1 data like this: + * // BIT STRING, encapsulates { + * // SEQUENCE { + * // INTEGER 3 + * // PrintableString 'aaa' + * // } + * // } + */ +KJUR.asn1.DERBitString = function (params) { + if (params !== undefined && typeof params.obj !== "undefined") { + var o = KJUR.asn1.ASN1Util.newObject(params.obj); + params.hex = "00" + o.getEncodedHex(); + } + KJUR.asn1.DERBitString.superclass.constructor.call(this); + this.hT = "03"; + /** + * set ASN.1 value(V) by a hexadecimal string including unused bits + * @name setHexValueIncludingUnusedBits + * @memberOf KJUR.asn1.DERBitString# + * @function + * @param {String} newHexStringIncludingUnusedBits + */ + this.setHexValueIncludingUnusedBits = function (newHexStringIncludingUnusedBits) { + this.hTLV = null; + this.isModified = true; + this.hV = newHexStringIncludingUnusedBits; + }; + /** + * set ASN.1 value(V) by unused bit and hexadecimal string of value + * @name setUnusedBitsAndHexValue + * @memberOf KJUR.asn1.DERBitString# + * @function + * @param {Integer} unusedBits + * @param {String} hValue + */ + this.setUnusedBitsAndHexValue = function (unusedBits, hValue) { + if (unusedBits < 0 || 7 < unusedBits) { + throw "unused bits shall be from 0 to 7: u = " + unusedBits; + } + var hUnusedBits = "0" + unusedBits; + this.hTLV = null; + this.isModified = true; + this.hV = hUnusedBits + hValue; + }; + /** + * set ASN.1 DER BitString by binary string
+ * @name setByBinaryString + * @memberOf KJUR.asn1.DERBitString# + * @function + * @param {String} binaryString binary value string (i.e. '10111') + * @description + * Its unused bits will be calculated automatically by length of + * 'binaryValue'.
+ * NOTE: Trailing zeros '0' will be ignored. + * @example + * o = new KJUR.asn1.DERBitString(); + * o.setByBooleanArray("01011"); + */ + this.setByBinaryString = function (binaryString) { + binaryString = binaryString.replace(/0+$/, ''); + var unusedBits = 8 - binaryString.length % 8; + if (unusedBits == 8) + unusedBits = 0; + for (var i = 0; i <= unusedBits; i++) { + binaryString += '0'; + } + var h = ''; + for (var i = 0; i < binaryString.length - 1; i += 8) { + var b = binaryString.substr(i, 8); + var x = parseInt(b, 2).toString(16); + if (x.length == 1) + x = '0' + x; + h += x; + } + this.hTLV = null; + this.isModified = true; + this.hV = '0' + unusedBits + h; + }; + /** + * set ASN.1 TLV value(V) by an array of boolean
+ * @name setByBooleanArray + * @memberOf KJUR.asn1.DERBitString# + * @function + * @param {array} booleanArray array of boolean (ex. [true, false, true]) + * @description + * NOTE: Trailing falses will be ignored in the ASN.1 DER Object. + * @example + * o = new KJUR.asn1.DERBitString(); + * o.setByBooleanArray([false, true, false, true, true]); + */ + this.setByBooleanArray = function (booleanArray) { + var s = ''; + for (var i = 0; i < booleanArray.length; i++) { + if (booleanArray[i] == true) { + s += '1'; + } + else { + s += '0'; + } + } + this.setByBinaryString(s); + }; + /** + * generate an array of falses with specified length
+ * @name newFalseArray + * @memberOf KJUR.asn1.DERBitString + * @function + * @param {Integer} nLength length of array to generate + * @return {array} array of boolean falses + * @description + * This static method may be useful to initialize boolean array. + * @example + * o = new KJUR.asn1.DERBitString(); + * o.newFalseArray(3) → [false, false, false] + */ + this.newFalseArray = function (nLength) { + var a = new Array(nLength); + for (var i = 0; i < nLength; i++) { + a[i] = false; + } + return a; + }; + this.getFreshValueHex = function () { + return this.hV; + }; + if (typeof params != "undefined") { + if (typeof params == "string" && params.toLowerCase().match(/^[0-9a-f]+$/)) { + this.setHexValueIncludingUnusedBits(params); + } + else if (typeof params['hex'] != "undefined") { + this.setHexValueIncludingUnusedBits(params['hex']); + } + else if (typeof params['bin'] != "undefined") { + this.setByBinaryString(params['bin']); + } + else if (typeof params['array'] != "undefined") { + this.setByBooleanArray(params['array']); + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object); +// ******************************************************************** +/** + * class for ASN.1 DER OctetString
+ * @name KJUR.asn1.DEROctetString + * @class class for ASN.1 DER OctetString + * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) + * @extends KJUR.asn1.DERAbstractString + * @description + * This class provides ASN.1 OctetString simple type.
+ * Supported "params" attributes are: + *
    + *
  • str - to set a string as a value
  • + *
  • hex - to set a hexadecimal string as a value
  • + *
  • obj - to set a encapsulated ASN.1 value by JSON object + * which is defined in {@link KJUR.asn1.ASN1Util.newObject}
  • + *
+ * NOTE: A parameter 'obj' have been supported + * for "OCTET STRING, encapsulates" structure. + * since asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25). + * @see KJUR.asn1.DERAbstractString - superclass + * @example + * // default constructor + * o = new KJUR.asn1.DEROctetString(); + * // initialize with string + * o = new KJUR.asn1.DEROctetString({str: "aaa"}); + * // initialize with hexadecimal string + * o = new KJUR.asn1.DEROctetString({hex: "616161"}); + * // initialize with ASN1Util.newObject argument + * o = new KJUR.asn1.DEROctetString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}}); + * // above generates a ASN.1 data like this: + * // OCTET STRING, encapsulates { + * // SEQUENCE { + * // INTEGER 3 + * // PrintableString 'aaa' + * // } + * // } + */ +KJUR.asn1.DEROctetString = function (params) { + if (params !== undefined && typeof params.obj !== "undefined") { + var o = KJUR.asn1.ASN1Util.newObject(params.obj); + params.hex = o.getEncodedHex(); + } + KJUR.asn1.DEROctetString.superclass.constructor.call(this, params); + this.hT = "04"; +}; +YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString); +// ******************************************************************** +/** + * class for ASN.1 DER Null + * @name KJUR.asn1.DERNull + * @class class for ASN.1 DER Null + * @extends KJUR.asn1.ASN1Object + * @description + * @see KJUR.asn1.ASN1Object - superclass + */ +KJUR.asn1.DERNull = function () { + KJUR.asn1.DERNull.superclass.constructor.call(this); + this.hT = "05"; + this.hTLV = "0500"; +}; +YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object); +// ******************************************************************** +/** + * class for ASN.1 DER ObjectIdentifier + * @name KJUR.asn1.DERObjectIdentifier + * @class class for ASN.1 DER ObjectIdentifier + * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'}) + * @extends KJUR.asn1.ASN1Object + * @description + *
+ * As for argument 'params' for constructor, you can specify one of + * following properties: + *
    + *
  • oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)
  • + *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • + *
+ * NOTE: 'params' can be omitted. + */ +KJUR.asn1.DERObjectIdentifier = function (params) { + var itox = function (i) { + var h = i.toString(16); + if (h.length == 1) + h = '0' + h; + return h; + }; + var roidtox = function (roid) { + var h = ''; + var bi = new BigInteger(roid, 10); + var b = bi.toString(2); + var padLen = 7 - b.length % 7; + if (padLen == 7) + padLen = 0; + var bPad = ''; + for (var i = 0; i < padLen; i++) + bPad += '0'; + b = bPad + b; + for (var i = 0; i < b.length - 1; i += 7) { + var b8 = b.substr(i, 7); + if (i != b.length - 7) + b8 = '1' + b8; + h += itox(parseInt(b8, 2)); + } + return h; + }; + KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this); + this.hT = "06"; + /** + * set value by a hexadecimal string + * @name setValueHex + * @memberOf KJUR.asn1.DERObjectIdentifier# + * @function + * @param {String} newHexString hexadecimal value of OID bytes + */ + this.setValueHex = function (newHexString) { + this.hTLV = null; + this.isModified = true; + this.s = null; + this.hV = newHexString; + }; + /** + * set value by a OID string
+ * @name setValueOidString + * @memberOf KJUR.asn1.DERObjectIdentifier# + * @function + * @param {String} oidString OID string (ex. 2.5.4.13) + * @example + * o = new KJUR.asn1.DERObjectIdentifier(); + * o.setValueOidString("2.5.4.13"); + */ + this.setValueOidString = function (oidString) { + if (!oidString.match(/^[0-9.]+$/)) { + throw "malformed oid string: " + oidString; + } + var h = ''; + var a = oidString.split('.'); + var i0 = parseInt(a[0]) * 40 + parseInt(a[1]); + h += itox(i0); + a.splice(0, 2); + for (var i = 0; i < a.length; i++) { + h += roidtox(a[i]); + } + this.hTLV = null; + this.isModified = true; + this.s = null; + this.hV = h; + }; + /** + * set value by a OID name + * @name setValueName + * @memberOf KJUR.asn1.DERObjectIdentifier# + * @function + * @param {String} oidName OID name (ex. 'serverAuth') + * @since 1.0.1 + * @description + * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'. + * Otherwise raise error. + * @example + * o = new KJUR.asn1.DERObjectIdentifier(); + * o.setValueName("serverAuth"); + */ + this.setValueName = function (oidName) { + var oid = KJUR.asn1.x509.OID.name2oid(oidName); + if (oid !== '') { + this.setValueOidString(oid); + } + else { + throw "DERObjectIdentifier oidName undefined: " + oidName; + } + }; + this.getFreshValueHex = function () { + return this.hV; + }; + if (params !== undefined) { + if (typeof params === "string") { + if (params.match(/^[0-2].[0-9.]+$/)) { + this.setValueOidString(params); + } + else { + this.setValueName(params); + } + } + else if (params.oid !== undefined) { + this.setValueOidString(params.oid); + } + else if (params.hex !== undefined) { + this.setValueHex(params.hex); + } + else if (params.name !== undefined) { + this.setValueName(params.name); + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object); +// ******************************************************************** +/** + * class for ASN.1 DER Enumerated + * @name KJUR.asn1.DEREnumerated + * @class class for ASN.1 DER Enumerated + * @extends KJUR.asn1.ASN1Object + * @description + *
+ * As for argument 'params' for constructor, you can specify one of + * following properties: + *
    + *
  • int - specify initial ASN.1 value(V) by integer value
  • + *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • + *
+ * NOTE: 'params' can be omitted. + * @example + * new KJUR.asn1.DEREnumerated(123); + * new KJUR.asn1.DEREnumerated({int: 123}); + * new KJUR.asn1.DEREnumerated({hex: '1fad'}); + */ +KJUR.asn1.DEREnumerated = function (params) { + KJUR.asn1.DEREnumerated.superclass.constructor.call(this); + this.hT = "0a"; + /** + * set value by Tom Wu's BigInteger object + * @name setByBigInteger + * @memberOf KJUR.asn1.DEREnumerated# + * @function + * @param {BigInteger} bigIntegerValue to set + */ + this.setByBigInteger = function (bigIntegerValue) { + this.hTLV = null; + this.isModified = true; + this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue); + }; + /** + * set value by integer value + * @name setByInteger + * @memberOf KJUR.asn1.DEREnumerated# + * @function + * @param {Integer} integer value to set + */ + this.setByInteger = function (intValue) { + var bi = new BigInteger(String(intValue), 10); + this.setByBigInteger(bi); + }; + /** + * set value by integer value + * @name setValueHex + * @memberOf KJUR.asn1.DEREnumerated# + * @function + * @param {String} hexadecimal string of integer value + * @description + *
+ * NOTE: Value shall be represented by minimum octet length of + * two's complement representation. + */ + this.setValueHex = function (newHexString) { + this.hV = newHexString; + }; + this.getFreshValueHex = function () { + return this.hV; + }; + if (typeof params != "undefined") { + if (typeof params['int'] != "undefined") { + this.setByInteger(params['int']); + } + else if (typeof params == "number") { + this.setByInteger(params); + } + else if (typeof params['hex'] != "undefined") { + this.setValueHex(params['hex']); + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object); +// ******************************************************************** +/** + * class for ASN.1 DER UTF8String + * @name KJUR.asn1.DERUTF8String + * @class class for ASN.1 DER UTF8String + * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) + * @extends KJUR.asn1.DERAbstractString + * @description + * @see KJUR.asn1.DERAbstractString - superclass + */ +KJUR.asn1.DERUTF8String = function (params) { + KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params); + this.hT = "0c"; +}; +YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString); +// ******************************************************************** +/** + * class for ASN.1 DER NumericString + * @name KJUR.asn1.DERNumericString + * @class class for ASN.1 DER NumericString + * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) + * @extends KJUR.asn1.DERAbstractString + * @description + * @see KJUR.asn1.DERAbstractString - superclass + */ +KJUR.asn1.DERNumericString = function (params) { + KJUR.asn1.DERNumericString.superclass.constructor.call(this, params); + this.hT = "12"; +}; +YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString); +// ******************************************************************** +/** + * class for ASN.1 DER PrintableString + * @name KJUR.asn1.DERPrintableString + * @class class for ASN.1 DER PrintableString + * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) + * @extends KJUR.asn1.DERAbstractString + * @description + * @see KJUR.asn1.DERAbstractString - superclass + */ +KJUR.asn1.DERPrintableString = function (params) { + KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params); + this.hT = "13"; +}; +YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString); +// ******************************************************************** +/** + * class for ASN.1 DER TeletexString + * @name KJUR.asn1.DERTeletexString + * @class class for ASN.1 DER TeletexString + * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) + * @extends KJUR.asn1.DERAbstractString + * @description + * @see KJUR.asn1.DERAbstractString - superclass + */ +KJUR.asn1.DERTeletexString = function (params) { + KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params); + this.hT = "14"; +}; +YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString); +// ******************************************************************** +/** + * class for ASN.1 DER IA5String + * @name KJUR.asn1.DERIA5String + * @class class for ASN.1 DER IA5String + * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) + * @extends KJUR.asn1.DERAbstractString + * @description + * @see KJUR.asn1.DERAbstractString - superclass + */ +KJUR.asn1.DERIA5String = function (params) { + KJUR.asn1.DERIA5String.superclass.constructor.call(this, params); + this.hT = "16"; +}; +YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString); +// ******************************************************************** +/** + * class for ASN.1 DER UTCTime + * @name KJUR.asn1.DERUTCTime + * @class class for ASN.1 DER UTCTime + * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'}) + * @extends KJUR.asn1.DERAbstractTime + * @description + *
+ * As for argument 'params' for constructor, you can specify one of + * following properties: + *
    + *
  • str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')
  • + *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • + *
  • date - specify Date object.
  • + *
+ * NOTE: 'params' can be omitted. + *

EXAMPLES

+ * @example + * d1 = new KJUR.asn1.DERUTCTime(); + * d1.setString('130430125959Z'); + * + * d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'}); + * d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))}); + * d4 = new KJUR.asn1.DERUTCTime('130430125959Z'); + */ +KJUR.asn1.DERUTCTime = function (params) { + KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params); + this.hT = "17"; + /** + * set value by a Date object
+ * @name setByDate + * @memberOf KJUR.asn1.DERUTCTime# + * @function + * @param {Date} dateObject Date object to set ASN.1 value(V) + * @example + * o = new KJUR.asn1.DERUTCTime(); + * o.setByDate(new Date("2016/12/31")); + */ + this.setByDate = function (dateObject) { + this.hTLV = null; + this.isModified = true; + this.date = dateObject; + this.s = this.formatDate(this.date, 'utc'); + this.hV = stohex(this.s); + }; + this.getFreshValueHex = function () { + if (typeof this.date == "undefined" && typeof this.s == "undefined") { + this.date = new Date(); + this.s = this.formatDate(this.date, 'utc'); + this.hV = stohex(this.s); + } + return this.hV; + }; + if (params !== undefined) { + if (params.str !== undefined) { + this.setString(params.str); + } + else if (typeof params == "string" && params.match(/^[0-9]{12}Z$/)) { + this.setString(params); + } + else if (params.hex !== undefined) { + this.setStringHex(params.hex); + } + else if (params.date !== undefined) { + this.setByDate(params.date); + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime); +// ******************************************************************** +/** + * class for ASN.1 DER GeneralizedTime + * @name KJUR.asn1.DERGeneralizedTime + * @class class for ASN.1 DER GeneralizedTime + * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'}) + * @property {Boolean} withMillis flag to show milliseconds or not + * @extends KJUR.asn1.DERAbstractTime + * @description + *
+ * As for argument 'params' for constructor, you can specify one of + * following properties: + *
    + *
  • str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')
  • + *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • + *
  • date - specify Date object.
  • + *
  • millis - specify flag to show milliseconds (from 1.0.6)
  • + *
+ * NOTE1: 'params' can be omitted. + * NOTE2: 'withMillis' property is supported from asn1 1.0.6. + */ +KJUR.asn1.DERGeneralizedTime = function (params) { + KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params); + this.hT = "18"; + this.withMillis = false; + /** + * set value by a Date object + * @name setByDate + * @memberOf KJUR.asn1.DERGeneralizedTime# + * @function + * @param {Date} dateObject Date object to set ASN.1 value(V) + * @example + * When you specify UTC time, use 'Date.UTC' method like this:
+ * o1 = new DERUTCTime(); + * o1.setByDate(date); + * + * date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59 + */ + this.setByDate = function (dateObject) { + this.hTLV = null; + this.isModified = true; + this.date = dateObject; + this.s = this.formatDate(this.date, 'gen', this.withMillis); + this.hV = stohex(this.s); + }; + this.getFreshValueHex = function () { + if (this.date === undefined && this.s === undefined) { + this.date = new Date(); + this.s = this.formatDate(this.date, 'gen', this.withMillis); + this.hV = stohex(this.s); + } + return this.hV; + }; + if (params !== undefined) { + if (params.str !== undefined) { + this.setString(params.str); + } + else if (typeof params == "string" && params.match(/^[0-9]{14}Z$/)) { + this.setString(params); + } + else if (params.hex !== undefined) { + this.setStringHex(params.hex); + } + else if (params.date !== undefined) { + this.setByDate(params.date); + } + if (params.millis === true) { + this.withMillis = true; + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime); +// ******************************************************************** +/** + * class for ASN.1 DER Sequence + * @name KJUR.asn1.DERSequence + * @class class for ASN.1 DER Sequence + * @extends KJUR.asn1.DERAbstractStructured + * @description + *
+ * As for argument 'params' for constructor, you can specify one of + * following properties: + *
    + *
  • array - specify array of ASN1Object to set elements of content
  • + *
+ * NOTE: 'params' can be omitted. + */ +KJUR.asn1.DERSequence = function (params) { + KJUR.asn1.DERSequence.superclass.constructor.call(this, params); + this.hT = "30"; + this.getFreshValueHex = function () { + var h = ''; + for (var i = 0; i < this.asn1Array.length; i++) { + var asn1Obj = this.asn1Array[i]; + h += asn1Obj.getEncodedHex(); + } + this.hV = h; + return this.hV; + }; +}; +YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured); +// ******************************************************************** +/** + * class for ASN.1 DER Set + * @name KJUR.asn1.DERSet + * @class class for ASN.1 DER Set + * @extends KJUR.asn1.DERAbstractStructured + * @description + *
+ * As for argument 'params' for constructor, you can specify one of + * following properties: + *
    + *
  • array - specify array of ASN1Object to set elements of content
  • + *
  • sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.
  • + *
+ * NOTE1: 'params' can be omitted.
+ * NOTE2: sortflag is supported since 1.0.5. + */ +KJUR.asn1.DERSet = function (params) { + KJUR.asn1.DERSet.superclass.constructor.call(this, params); + this.hT = "31"; + this.sortFlag = true; // item shall be sorted only in ASN.1 DER + this.getFreshValueHex = function () { + var a = new Array(); + for (var i = 0; i < this.asn1Array.length; i++) { + var asn1Obj = this.asn1Array[i]; + a.push(asn1Obj.getEncodedHex()); + } + if (this.sortFlag == true) + a.sort(); + this.hV = a.join(''); + return this.hV; + }; + if (typeof params != "undefined") { + if (typeof params.sortflag != "undefined" && + params.sortflag == false) + this.sortFlag = false; + } +}; +YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured); +// ******************************************************************** +/** + * class for ASN.1 DER TaggedObject + * @name KJUR.asn1.DERTaggedObject + * @class class for ASN.1 DER TaggedObject + * @extends KJUR.asn1.ASN1Object + * @description + *
+ * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object. + * For example, if you find '[1]' tag in a ASN.1 dump, + * 'tagNoHex' will be 'a1'. + *
+ * As for optional argument 'params' for constructor, you can specify *ANY* of + * following properties: + *
    + *
  • explicit - specify true if this is explicit tag otherwise false + * (default is 'true').
  • + *
  • tag - specify tag (default is 'a0' which means [0])
  • + *
  • obj - specify ASN1Object which is tagged
  • + *
+ * @example + * d1 = new KJUR.asn1.DERUTF8String({'str':'a'}); + * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1}); + * hex = d2.getEncodedHex(); + */ +KJUR.asn1.DERTaggedObject = function (params) { + KJUR.asn1.DERTaggedObject.superclass.constructor.call(this); + this.hT = "a0"; + this.hV = ''; + this.isExplicit = true; + this.asn1Object = null; + /** + * set value by an ASN1Object + * @name setString + * @memberOf KJUR.asn1.DERTaggedObject# + * @function + * @param {Boolean} isExplicitFlag flag for explicit/implicit tag + * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag + * @param {ASN1Object} asn1Object ASN.1 to encapsulate + */ + this.setASN1Object = function (isExplicitFlag, tagNoHex, asn1Object) { + this.hT = tagNoHex; + this.isExplicit = isExplicitFlag; + this.asn1Object = asn1Object; + if (this.isExplicit) { + this.hV = this.asn1Object.getEncodedHex(); + this.hTLV = null; + this.isModified = true; + } + else { + this.hV = null; + this.hTLV = asn1Object.getEncodedHex(); + this.hTLV = this.hTLV.replace(/^../, tagNoHex); + this.isModified = false; + } + }; + this.getFreshValueHex = function () { + return this.hV; + }; + if (typeof params != "undefined") { + if (typeof params['tag'] != "undefined") { + this.hT = params['tag']; + } + if (typeof params['explicit'] != "undefined") { + this.isExplicit = params['explicit']; + } + if (typeof params['obj'] != "undefined") { + this.asn1Object = params['obj']; + this.setASN1Object(this.isExplicit, this.hT, this.asn1Object); + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object); + +}, function(modId) { var map = {"../jsbn/jsbn":1709513243604,"./yahoo":1709513243608}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243608, function(require, module, exports) { +/*! +Copyright (c) 2011, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.com/yui/license.html +version: 2.9.0 +*/ +if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });var YAHOO = exports.YAHOO = {}; +YAHOO.lang = { + /** + * Utility to set up the prototype, constructor and superclass properties to + * support an inheritance strategy that can chain constructors and methods. + * Static members will not be inherited. + * + * @method extend + * @static + * @param {Function} subc the object to modify + * @param {Function} superc the object to inherit + * @param {Object} overrides additional properties/methods to add to the + * subclass prototype. These will override the + * matching items obtained from the superclass + * if present. + */ + extend: function (subc, superc, overrides) { + if (!superc || !subc) { + throw new Error("YAHOO.lang.extend failed, please check that " + + "all dependencies are included."); + } + var F = function () { }; + F.prototype = superc.prototype; + subc.prototype = new F(); + subc.prototype.constructor = subc; + subc.superclass = superc.prototype; + if (superc.prototype.constructor == Object.prototype.constructor) { + superc.prototype.constructor = superc; + } + if (overrides) { + var i; + for (i in overrides) { + subc.prototype[i] = overrides[i]; + } + /* + * IE will not enumerate native functions in a derived object even if the + * function was overridden. This is a workaround for specific functions + * we care about on the Object prototype. + * @property _IEEnumFix + * @param {Function} r the object to receive the augmentation + * @param {Function} s the object that supplies the properties to augment + * @static + * @private + */ + var _IEEnumFix = function () { }, ADD = ["toString", "valueOf"]; + try { + if (/MSIE/.test(navigator.userAgent)) { + _IEEnumFix = function (r, s) { + for (i = 0; i < ADD.length; i = i + 1) { + var fname = ADD[i], f = s[fname]; + if (typeof f === 'function' && f != Object.prototype[fname]) { + r[fname] = f; + } + } + }; + } + } + catch (ex) { } + ; + _IEEnumFix(subc.prototype, overrides); + } + } +}; + +}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) +__DEFINE__(1709513243609, function(require, module, exports) { +module.exports = { + "version": "3.2.1" +} + +}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); }) +return __REQUIRE__(1709513243594); +})() +//miniprogram-npm-outsideDeps=[] +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/miniprogram_npm/wxmp-rsa/index.js.map b/miniprogram_npm/wxmp-rsa/index.js.map new file mode 100644 index 0000000..2357654 --- /dev/null +++ b/miniprogram_npm/wxmp-rsa/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.js","JSEncrypt.js","lib/jsbn/base64.js","lib/jsbn/util.js","JSEncryptRSAKey.js","lib/asn1js/hex.js","lib/asn1js/base64.js","lib/asn1js/asn1.js","lib/asn1js/int10.js","lib/jsbn/rsa.js","lib/jsbn/jsbn.js","lib/jsbn/rng.js","lib/jsbn/prng4.js","lib/jsrsasign/asn1-1.0.js","lib/jsrsasign/yahoo.js","version.json"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;ACFA,ADGA;ACFA;AACA;AACA,ACHA;ADIA,ACHA;ADIA,ACHA;ADIA,ACHA,ACHA;AFOA,ACHA,ACHA;AFOA,ACHA,ACHA;AFOA,AGTA,AFMA,ACHA;AFOA,AGTA,AFMA,ACHA;AFOA,AGTA,AFMA,ACHA;AFOA,AGTA,ACHA,AHSA,ACHA;AFOA,AGTA,ACHA,AHSA,ACHA;AFOA,AGTA,ACHA,AHSA,ACHA;AFOA,AGTA,AENA,ADGA,AHSA,ACHA;AFOA,AGTA,AENA,ADGA,AHSA,ACHA;AFOA,AGTA,AENA,ADGA,AHSA,ACHA;AFOA,AGTA,AGTA,ADGA,ADGA,AHSA,ACHA;AFOA,AGTA,AGTA,ADGA,ADGA,AHSA,ACHA;AFOA,AGTA,AGTA,ADGA,ADGA,AHSA,ACHA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,ACHA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,ACHA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,ACHA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AOrBA,ANkBA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AOrBA,ANkBA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AOrBA,ANkBA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,ADGA,ANkBA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,ADGA,ANkBA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,ADGA,ANkBA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,ACHA,AFMA,ANkBA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,ACHA,AFMA,ANkBA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,ACHA,AFMA,ANkBA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA;AFOA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA;AZqCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA;AZqCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA;AZqCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA,ACHA;Ad2CA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA,ACHA;Ad2CA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA,ACHA;Ad2CA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA,ACHA;Ad2CA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,ANkBA,AU9BA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,ADGA,AGTA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,ANkBA,AQxBA,AENA,ADGA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ACHA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ACHA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ACHA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ACHA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ACHA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ACHA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ACHA,AFMA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ADGA,AENA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ACHA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ACHA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ACHA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ACHA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,ACHA,AENA,ADGA,AIZA,ACHA;AbwCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AZqCA,AGTA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;AT4BA,AGTA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,ADGA,AIZA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;ANmBA,AGTA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA,AGTA;AHUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["var __TEMP__ = require('./JSEncrypt');var JSEncrypt = __TEMP__['JSEncrypt'];\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'JSEncrypt', { enumerable: true, configurable: true, get: function() { return JSEncrypt; } });\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });exports.default = JSEncrypt;\r\n","var __TEMP__ = require('./lib/jsbn/base64');var b64tohex = __TEMP__['b64tohex'];var hex2b64 = __TEMP__['hex2b64'];\r\nvar __TEMP__ = require('./JSEncryptRSAKey');var JSEncryptRSAKey = __TEMP__['JSEncryptRSAKey'];\r\nvar __TEMP__ = require('./version.json');var version = __REQUIRE_DEFAULT__(__TEMP__);\r\n/**\r\n *\r\n * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour\r\n * possible parameters are:\r\n * - default_key_size {number} default: 1024 the key size in bit\r\n * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent\r\n * - log {boolean} default: false whether log warn/error or not\r\n * @constructor\r\n */\r\nvar JSEncrypt = /** @class */ (function () {\r\n function JSEncrypt(options) {\r\n if (options === void 0) { options = {}; }\r\n options = options || {};\r\n this.default_key_size = options.default_key_size ? parseInt(options.default_key_size, 10) : 1024;\r\n this.default_public_exponent = options.default_public_exponent || \"010001\"; // 65537 default openssl public exponent for rsa key type\r\n this.log = options.log || false;\r\n // The private and public key.\r\n this.key = null;\r\n }\r\n /**\r\n * Method to set the rsa key parameter (one method is enough to set both the public\r\n * and the private key, since the private key contains the public key paramenters)\r\n * Log a warning if logs are enabled\r\n * @param {Object|string} key the pem encoded string or an object (with or without header/footer)\r\n * @public\r\n */\r\n JSEncrypt.prototype.setKey = function (key) {\r\n if (this.log && this.key) {\r\n console.warn(\"A key was already set, overriding existing.\");\r\n }\r\n this.key = new JSEncryptRSAKey(key);\r\n };\r\n /**\r\n * Proxy method for setKey, for api compatibility\r\n * @see setKey\r\n * @public\r\n */\r\n JSEncrypt.prototype.setPrivateKey = function (privkey) {\r\n // Create the key.\r\n this.setKey(privkey);\r\n };\r\n /**\r\n * Proxy method for setKey, for api compatibility\r\n * @see setKey\r\n * @public\r\n */\r\n JSEncrypt.prototype.setPublicKey = function (pubkey) {\r\n // Sets the public key.\r\n this.setKey(pubkey);\r\n };\r\n /**\r\n * Proxy method for RSAKey object's decrypt, decrypt the string using the private\r\n * components of the rsa key object. Note that if the object was not set will be created\r\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\r\n * @param {string} str base64 encoded crypted string to decrypt\r\n * @return {string} the decrypted string\r\n * @public\r\n */\r\n JSEncrypt.prototype.decrypt = function (str) {\r\n // Return the decrypted string.\r\n try {\r\n return this.getKey().decrypt(b64tohex(str));\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Proxy method for RSAKey object's encrypt, encrypt the string using the public\r\n * components of the rsa key object. Note that if the object was not set will be created\r\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\r\n * @param {string} str the string to encrypt\r\n * @return {string} the encrypted string encoded in base64\r\n * @public\r\n */\r\n JSEncrypt.prototype.encrypt = function (str) {\r\n // Return the encrypted string.\r\n try {\r\n return hex2b64(this.getKey().encrypt(str));\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n };\r\n // 超长文本加密\r\n JSEncrypt.prototype.encryptLong = function (str) {\r\n try {\r\n return hex2b64(this.getKey().encryptLong(str));\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n };\r\n // 超长文本解密\r\n JSEncrypt.prototype.decryptLong = function (str) {\r\n try {\r\n return this.getKey().decryptLong(b64tohex(str));\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Proxy method for RSAKey object's sign.\r\n * @param {string} str the string to sign\r\n * @param {function} digestMethod hash method\r\n * @param {string} digestName the name of the hash algorithm\r\n * @return {string} the signature encoded in base64\r\n * @public\r\n */\r\n JSEncrypt.prototype.sign = function (str, digestMethod, digestName) {\r\n // return the RSA signature of 'str' in 'hex' format.\r\n try {\r\n return hex2b64(this.getKey().sign(str, digestMethod, digestName));\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Proxy method for RSAKey object's verify.\r\n * @param {string} str the string to verify\r\n * @param {string} signature the signature encoded in base64 to compare the string to\r\n * @param {function} digestMethod hash method\r\n * @return {boolean} whether the data and signature match\r\n * @public\r\n */\r\n JSEncrypt.prototype.verify = function (str, signature, digestMethod) {\r\n // Return the decrypted 'digest' of the signature.\r\n try {\r\n return this.getKey().verify(str, b64tohex(signature), digestMethod);\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object\r\n * will be created and returned\r\n * @param {callback} [cb] the callback to be called if we want the key to be generated\r\n * in an async fashion\r\n * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object\r\n * @public\r\n */\r\n JSEncrypt.prototype.getKey = function (cb) {\r\n // Only create new if it does not exist.\r\n if (!this.key) {\r\n // Get a new private key.\r\n this.key = new JSEncryptRSAKey();\r\n if (cb && {}.toString.call(cb) === \"[object Function]\") {\r\n this.key.generateAsync(this.default_key_size, this.default_public_exponent, cb);\r\n return;\r\n }\r\n // Generate the key.\r\n this.key.generate(this.default_key_size, this.default_public_exponent);\r\n }\r\n return this.key;\r\n };\r\n /**\r\n * Returns the pem encoded representation of the private key\r\n * If the key doesn't exists a new key will be created\r\n * @returns {string} pem encoded representation of the private key WITH header and footer\r\n * @public\r\n */\r\n JSEncrypt.prototype.getPrivateKey = function () {\r\n // Return the private representation of this key.\r\n return this.getKey().getPrivateKey();\r\n };\r\n /**\r\n * Returns the pem encoded representation of the private key\r\n * If the key doesn't exists a new key will be created\r\n * @returns {string} pem encoded representation of the private key WITHOUT header and footer\r\n * @public\r\n */\r\n JSEncrypt.prototype.getPrivateKeyB64 = function () {\r\n // Return the private representation of this key.\r\n return this.getKey().getPrivateBaseKeyB64();\r\n };\r\n /**\r\n * Returns the pem encoded representation of the public key\r\n * If the key doesn't exists a new key will be created\r\n * @returns {string} pem encoded representation of the public key WITH header and footer\r\n * @public\r\n */\r\n JSEncrypt.prototype.getPublicKey = function () {\r\n // Return the private representation of this key.\r\n return this.getKey().getPublicKey();\r\n };\r\n /**\r\n * Returns the pem encoded representation of the public key\r\n * If the key doesn't exists a new key will be created\r\n * @returns {string} pem encoded representation of the public key WITHOUT header and footer\r\n * @public\r\n */\r\n JSEncrypt.prototype.getPublicKeyB64 = function () {\r\n // Return the private representation of this key.\r\n return this.getKey().getPublicBaseKeyB64();\r\n };\r\n JSEncrypt.version = version.version;\r\n return JSEncrypt;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'JSEncrypt', { enumerable: true, configurable: true, get: function() { return JSEncrypt; } });\r\n","var __TEMP__ = require('./util');var int2char = __TEMP__['int2char'];\r\nvar b64map = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\r\nvar b64pad = \"=\";\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function hex2b64(h) {\r\n var i;\r\n var c;\r\n var ret = \"\";\r\n for (i = 0; i + 3 <= h.length; i += 3) {\r\n c = parseInt(h.substring(i, i + 3), 16);\r\n ret += b64map.charAt(c >> 6) + b64map.charAt(c & 63);\r\n }\r\n if (i + 1 == h.length) {\r\n c = parseInt(h.substring(i, i + 1), 16);\r\n ret += b64map.charAt(c << 2);\r\n }\r\n else if (i + 2 == h.length) {\r\n c = parseInt(h.substring(i, i + 2), 16);\r\n ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4);\r\n }\r\n while ((ret.length & 3) > 0) {\r\n ret += b64pad;\r\n }\r\n return ret;\r\n};exports.hex2b64 = hex2b64\r\n// convert a base64 string to hex\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function b64tohex(s) {\r\n var ret = \"\";\r\n var i;\r\n var k = 0; // b64 state, 0-3\r\n var slop = 0;\r\n for (i = 0; i < s.length; ++i) {\r\n if (s.charAt(i) == b64pad) {\r\n break;\r\n }\r\n var v = b64map.indexOf(s.charAt(i));\r\n if (v < 0) {\r\n continue;\r\n }\r\n if (k == 0) {\r\n ret += int2char(v >> 2);\r\n slop = v & 3;\r\n k = 1;\r\n }\r\n else if (k == 1) {\r\n ret += int2char((slop << 2) | (v >> 4));\r\n slop = v & 0xf;\r\n k = 2;\r\n }\r\n else if (k == 2) {\r\n ret += int2char(slop);\r\n ret += int2char(v >> 2);\r\n slop = v & 3;\r\n k = 3;\r\n }\r\n else {\r\n ret += int2char((slop << 2) | (v >> 4));\r\n ret += int2char(v & 0xf);\r\n k = 0;\r\n }\r\n }\r\n if (k == 1) {\r\n ret += int2char(slop << 2);\r\n }\r\n return ret;\r\n};exports.b64tohex = b64tohex\r\n// convert a base64 string to a byte/number array\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function b64toBA(s) {\r\n // piggyback on b64tohex for now, optimize later\r\n var h = b64tohex(s);\r\n var i;\r\n var a = [];\r\n for (i = 0; 2 * i < h.length; ++i) {\r\n a[i] = parseInt(h.substring(2 * i, 2 * i + 2), 16);\r\n }\r\n return a;\r\n};exports.b64toBA = b64toBA\r\n","var BI_RM = \"0123456789abcdefghijklmnopqrstuvwxyz\";\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function int2char(n) {\r\n return BI_RM.charAt(n);\r\n};exports.int2char = int2char\r\n//#region BIT_OPERATIONS\r\n// (public) this & a\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function op_and(x, y) {\r\n return x & y;\r\n};exports.op_and = op_and\r\n// (public) this | a\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function op_or(x, y) {\r\n return x | y;\r\n};exports.op_or = op_or\r\n// (public) this ^ a\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function op_xor(x, y) {\r\n return x ^ y;\r\n};exports.op_xor = op_xor\r\n// (public) this & ~a\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function op_andnot(x, y) {\r\n return x & ~y;\r\n};exports.op_andnot = op_andnot\r\n// return index of lowest 1-bit in x, x < 2^31\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function lbit(x) {\r\n if (x == 0) {\r\n return -1;\r\n }\r\n var r = 0;\r\n if ((x & 0xffff) == 0) {\r\n x >>= 16;\r\n r += 16;\r\n }\r\n if ((x & 0xff) == 0) {\r\n x >>= 8;\r\n r += 8;\r\n }\r\n if ((x & 0xf) == 0) {\r\n x >>= 4;\r\n r += 4;\r\n }\r\n if ((x & 3) == 0) {\r\n x >>= 2;\r\n r += 2;\r\n }\r\n if ((x & 1) == 0) {\r\n ++r;\r\n }\r\n return r;\r\n};exports.lbit = lbit\r\n// return number of 1 bits in x\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function cbit(x) {\r\n var r = 0;\r\n while (x != 0) {\r\n x &= x - 1;\r\n ++r;\r\n }\r\n return r;\r\n};exports.cbit = cbit\r\n//#endregion BIT_OPERATIONS\r\n","var __extends = (this && this.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\nvar __TEMP__ = require('./lib/jsbn/base64');var hex2b64 = __TEMP__['hex2b64'];\r\nvar __TEMP__ = require('./lib/asn1js/hex');var Hex = __TEMP__['Hex'];\r\nvar __TEMP__ = require('./lib/asn1js/base64');var Base64 = __TEMP__['Base64'];\r\nvar __TEMP__ = require('./lib/asn1js/asn1');var ASN1 = __TEMP__['ASN1'];\r\nvar __TEMP__ = require('./lib/jsbn/rsa');var RSAKey = __TEMP__['RSAKey'];\r\nvar __TEMP__ = require('./lib/jsbn/jsbn');var parseBigInt = __TEMP__['parseBigInt'];\r\nvar __TEMP__ = require('./lib/jsrsasign/asn1-1.0');var KJUR = __TEMP__['KJUR'];\r\n/**\r\n * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object.\r\n * This object is just a decorator for parsing the key parameter\r\n * @param {string|Object} key - The key in string format, or an object containing\r\n * the parameters needed to build a RSAKey object.\r\n * @constructor\r\n */\r\nvar JSEncryptRSAKey = /** @class */ (function (_super) {\r\n __extends(JSEncryptRSAKey, _super);\r\n function JSEncryptRSAKey(key) {\r\n var _this = _super.call(this) || this;\r\n // Call the super constructor.\r\n // RSAKey.call(this);\r\n // If a key key was provided.\r\n if (key) {\r\n // If this is a string...\r\n if (typeof key === \"string\") {\r\n _this.parseKey(key);\r\n }\r\n else if (JSEncryptRSAKey.hasPrivateKeyProperty(key) ||\r\n JSEncryptRSAKey.hasPublicKeyProperty(key)) {\r\n // Set the values for the key.\r\n _this.parsePropertiesFrom(key);\r\n }\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Method to parse a pem encoded string containing both a public or private key.\r\n * The method will translate the pem encoded string in a der encoded string and\r\n * will parse private key and public key parameters. This method accepts public key\r\n * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1).\r\n *\r\n * @todo Check how many rsa formats use the same format of pkcs #1.\r\n *\r\n * The format is defined as:\r\n * PublicKeyInfo ::= SEQUENCE {\r\n * algorithm AlgorithmIdentifier,\r\n * PublicKey BIT STRING\r\n * }\r\n * Where AlgorithmIdentifier is:\r\n * AlgorithmIdentifier ::= SEQUENCE {\r\n * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm\r\n * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)\r\n * }\r\n * and PublicKey is a SEQUENCE encapsulated in a BIT STRING\r\n * RSAPublicKey ::= SEQUENCE {\r\n * modulus INTEGER, -- n\r\n * publicExponent INTEGER -- e\r\n * }\r\n * it's possible to examine the structure of the keys obtained from openssl using\r\n * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/\r\n * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer\r\n * @private\r\n */\r\n JSEncryptRSAKey.prototype.parseKey = function (pem) {\r\n try {\r\n var modulus = 0;\r\n var public_exponent = 0;\r\n var reHex = /^\\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\\s*)+$/;\r\n var der = reHex.test(pem) ? Hex.decode(pem) : Base64.unarmor(pem);\r\n var asn1 = ASN1.decode(der);\r\n // Fixes a bug with OpenSSL 1.0+ private keys\r\n if (asn1.sub.length === 3) {\r\n asn1 = asn1.sub[2].sub[0];\r\n }\r\n if (asn1.sub.length === 9) {\r\n // Parse the private key.\r\n modulus = asn1.sub[1].getHexStringValue(); // bigint\r\n this.n = parseBigInt(modulus, 16);\r\n public_exponent = asn1.sub[2].getHexStringValue(); // int\r\n this.e = parseInt(public_exponent, 16);\r\n var private_exponent = asn1.sub[3].getHexStringValue(); // bigint\r\n this.d = parseBigInt(private_exponent, 16);\r\n var prime1 = asn1.sub[4].getHexStringValue(); // bigint\r\n this.p = parseBigInt(prime1, 16);\r\n var prime2 = asn1.sub[5].getHexStringValue(); // bigint\r\n this.q = parseBigInt(prime2, 16);\r\n var exponent1 = asn1.sub[6].getHexStringValue(); // bigint\r\n this.dmp1 = parseBigInt(exponent1, 16);\r\n var exponent2 = asn1.sub[7].getHexStringValue(); // bigint\r\n this.dmq1 = parseBigInt(exponent2, 16);\r\n var coefficient = asn1.sub[8].getHexStringValue(); // bigint\r\n this.coeff = parseBigInt(coefficient, 16);\r\n }\r\n else if (asn1.sub.length === 2) {\r\n // Parse the public key.\r\n var bit_string = asn1.sub[1];\r\n var sequence = bit_string.sub[0];\r\n modulus = sequence.sub[0].getHexStringValue();\r\n this.n = parseBigInt(modulus, 16);\r\n public_exponent = sequence.sub[1].getHexStringValue();\r\n this.e = parseInt(public_exponent, 16);\r\n }\r\n else {\r\n return false;\r\n }\r\n return true;\r\n }\r\n catch (ex) {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Translate rsa parameters in a hex encoded string representing the rsa key.\r\n *\r\n * The translation follow the ASN.1 notation :\r\n * RSAPrivateKey ::= SEQUENCE {\r\n * version Version,\r\n * modulus INTEGER, -- n\r\n * publicExponent INTEGER, -- e\r\n * privateExponent INTEGER, -- d\r\n * prime1 INTEGER, -- p\r\n * prime2 INTEGER, -- q\r\n * exponent1 INTEGER, -- d mod (p1)\r\n * exponent2 INTEGER, -- d mod (q-1)\r\n * coefficient INTEGER, -- (inverse of q) mod p\r\n * }\r\n * @returns {string} DER Encoded String representing the rsa private key\r\n * @private\r\n */\r\n JSEncryptRSAKey.prototype.getPrivateBaseKey = function () {\r\n var options = {\r\n array: [\r\n new KJUR.asn1.DERInteger({ int: 0 }),\r\n new KJUR.asn1.DERInteger({ bigint: this.n }),\r\n new KJUR.asn1.DERInteger({ int: this.e }),\r\n new KJUR.asn1.DERInteger({ bigint: this.d }),\r\n new KJUR.asn1.DERInteger({ bigint: this.p }),\r\n new KJUR.asn1.DERInteger({ bigint: this.q }),\r\n new KJUR.asn1.DERInteger({ bigint: this.dmp1 }),\r\n new KJUR.asn1.DERInteger({ bigint: this.dmq1 }),\r\n new KJUR.asn1.DERInteger({ bigint: this.coeff })\r\n ]\r\n };\r\n var seq = new KJUR.asn1.DERSequence(options);\r\n return seq.getEncodedHex();\r\n };\r\n /**\r\n * base64 (pem) encoded version of the DER encoded representation\r\n * @returns {string} pem encoded representation without header and footer\r\n * @public\r\n */\r\n JSEncryptRSAKey.prototype.getPrivateBaseKeyB64 = function () {\r\n return hex2b64(this.getPrivateBaseKey());\r\n };\r\n /**\r\n * Translate rsa parameters in a hex encoded string representing the rsa public key.\r\n * The representation follow the ASN.1 notation :\r\n * PublicKeyInfo ::= SEQUENCE {\r\n * algorithm AlgorithmIdentifier,\r\n * PublicKey BIT STRING\r\n * }\r\n * Where AlgorithmIdentifier is:\r\n * AlgorithmIdentifier ::= SEQUENCE {\r\n * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm\r\n * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)\r\n * }\r\n * and PublicKey is a SEQUENCE encapsulated in a BIT STRING\r\n * RSAPublicKey ::= SEQUENCE {\r\n * modulus INTEGER, -- n\r\n * publicExponent INTEGER -- e\r\n * }\r\n * @returns {string} DER Encoded String representing the rsa public key\r\n * @private\r\n */\r\n JSEncryptRSAKey.prototype.getPublicBaseKey = function () {\r\n var first_sequence = new KJUR.asn1.DERSequence({\r\n array: [\r\n new KJUR.asn1.DERObjectIdentifier({ oid: \"1.2.840.113549.1.1.1\" }),\r\n new KJUR.asn1.DERNull()\r\n ]\r\n });\r\n var second_sequence = new KJUR.asn1.DERSequence({\r\n array: [\r\n new KJUR.asn1.DERInteger({ bigint: this.n }),\r\n new KJUR.asn1.DERInteger({ int: this.e })\r\n ]\r\n });\r\n var bit_string = new KJUR.asn1.DERBitString({\r\n hex: \"00\" + second_sequence.getEncodedHex()\r\n });\r\n var seq = new KJUR.asn1.DERSequence({\r\n array: [\r\n first_sequence,\r\n bit_string\r\n ]\r\n });\r\n return seq.getEncodedHex();\r\n };\r\n /**\r\n * base64 (pem) encoded version of the DER encoded representation\r\n * @returns {string} pem encoded representation without header and footer\r\n * @public\r\n */\r\n JSEncryptRSAKey.prototype.getPublicBaseKeyB64 = function () {\r\n return hex2b64(this.getPublicBaseKey());\r\n };\r\n /**\r\n * wrap the string in block of width chars. The default value for rsa keys is 64\r\n * characters.\r\n * @param {string} str the pem encoded string without header and footer\r\n * @param {Number} [width=64] - the length the string has to be wrapped at\r\n * @returns {string}\r\n * @private\r\n */\r\n JSEncryptRSAKey.wordwrap = function (str, width) {\r\n width = width || 64;\r\n if (!str) {\r\n return str;\r\n }\r\n var regex = \"(.{1,\" + width + \"})( +|$\\n?)|(.{1,\" + width + \"})\";\r\n return str.match(RegExp(regex, \"g\")).join(\"\\n\");\r\n };\r\n /**\r\n * Retrieve the pem encoded private key\r\n * @returns {string} the pem encoded private key with header/footer\r\n * @public\r\n */\r\n JSEncryptRSAKey.prototype.getPrivateKey = function () {\r\n var key = \"-----BEGIN RSA PRIVATE KEY-----\\n\";\r\n key += JSEncryptRSAKey.wordwrap(this.getPrivateBaseKeyB64()) + \"\\n\";\r\n key += \"-----END RSA PRIVATE KEY-----\";\r\n return key;\r\n };\r\n /**\r\n * Retrieve the pem encoded public key\r\n * @returns {string} the pem encoded public key with header/footer\r\n * @public\r\n */\r\n JSEncryptRSAKey.prototype.getPublicKey = function () {\r\n var key = \"-----BEGIN PUBLIC KEY-----\\n\";\r\n key += JSEncryptRSAKey.wordwrap(this.getPublicBaseKeyB64()) + \"\\n\";\r\n key += \"-----END PUBLIC KEY-----\";\r\n return key;\r\n };\r\n /**\r\n * Check if the object contains the necessary parameters to populate the rsa modulus\r\n * and public exponent parameters.\r\n * @param {Object} [obj={}] - An object that may contain the two public key\r\n * parameters\r\n * @returns {boolean} true if the object contains both the modulus and the public exponent\r\n * properties (n and e)\r\n * @todo check for types of n and e. N should be a parseable bigInt object, E should\r\n * be a parseable integer number\r\n * @private\r\n */\r\n JSEncryptRSAKey.hasPublicKeyProperty = function (obj) {\r\n obj = obj || {};\r\n return (obj.hasOwnProperty(\"n\") &&\r\n obj.hasOwnProperty(\"e\"));\r\n };\r\n /**\r\n * Check if the object contains ALL the parameters of an RSA key.\r\n * @param {Object} [obj={}] - An object that may contain nine rsa key\r\n * parameters\r\n * @returns {boolean} true if the object contains all the parameters needed\r\n * @todo check for types of the parameters all the parameters but the public exponent\r\n * should be parseable bigint objects, the public exponent should be a parseable integer number\r\n * @private\r\n */\r\n JSEncryptRSAKey.hasPrivateKeyProperty = function (obj) {\r\n obj = obj || {};\r\n return (obj.hasOwnProperty(\"n\") &&\r\n obj.hasOwnProperty(\"e\") &&\r\n obj.hasOwnProperty(\"d\") &&\r\n obj.hasOwnProperty(\"p\") &&\r\n obj.hasOwnProperty(\"q\") &&\r\n obj.hasOwnProperty(\"dmp1\") &&\r\n obj.hasOwnProperty(\"dmq1\") &&\r\n obj.hasOwnProperty(\"coeff\"));\r\n };\r\n /**\r\n * Parse the properties of obj in the current rsa object. Obj should AT LEAST\r\n * include the modulus and public exponent (n, e) parameters.\r\n * @param {Object} obj - the object containing rsa parameters\r\n * @private\r\n */\r\n JSEncryptRSAKey.prototype.parsePropertiesFrom = function (obj) {\r\n this.n = obj.n;\r\n this.e = obj.e;\r\n if (obj.hasOwnProperty(\"d\")) {\r\n this.d = obj.d;\r\n this.p = obj.p;\r\n this.q = obj.q;\r\n this.dmp1 = obj.dmp1;\r\n this.dmq1 = obj.dmq1;\r\n this.coeff = obj.coeff;\r\n }\r\n };\r\n return JSEncryptRSAKey;\r\n}(RSAKey));\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'JSEncryptRSAKey', { enumerable: true, configurable: true, get: function() { return JSEncryptRSAKey; } });\r\n","// Hex JavaScript decoder\r\n// Copyright (c) 2008-2013 Lapo Luchini \r\n// Permission to use, copy, modify, and/or distribute this software for any\r\n// purpose with or without fee is hereby granted, provided that the above\r\n// copyright notice and this permission notice appear in all copies.\r\n//\r\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\r\nvar decoder;\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var Hex = exports.Hex = {\r\n decode: function (a) {\r\n var i;\r\n if (decoder === undefined) {\r\n var hex = \"0123456789ABCDEF\";\r\n var ignore = \" \\f\\n\\r\\t\\u00A0\\u2028\\u2029\";\r\n decoder = {};\r\n for (i = 0; i < 16; ++i) {\r\n decoder[hex.charAt(i)] = i;\r\n }\r\n hex = hex.toLowerCase();\r\n for (i = 10; i < 16; ++i) {\r\n decoder[hex.charAt(i)] = i;\r\n }\r\n for (i = 0; i < ignore.length; ++i) {\r\n decoder[ignore.charAt(i)] = -1;\r\n }\r\n }\r\n var out = [];\r\n var bits = 0;\r\n var char_count = 0;\r\n for (i = 0; i < a.length; ++i) {\r\n var c = a.charAt(i);\r\n if (c == \"=\") {\r\n break;\r\n }\r\n c = decoder[c];\r\n if (c == -1) {\r\n continue;\r\n }\r\n if (c === undefined) {\r\n throw new Error(\"Illegal character at offset \" + i);\r\n }\r\n bits |= c;\r\n if (++char_count >= 2) {\r\n out[out.length] = bits;\r\n bits = 0;\r\n char_count = 0;\r\n }\r\n else {\r\n bits <<= 4;\r\n }\r\n }\r\n if (char_count) {\r\n throw new Error(\"Hex encoding incomplete: 4 bits missing\");\r\n }\r\n return out;\r\n }\r\n};\r\n","// Base64 JavaScript decoder\r\n// Copyright (c) 2008-2013 Lapo Luchini \r\n// Permission to use, copy, modify, and/or distribute this software for any\r\n// purpose with or without fee is hereby granted, provided that the above\r\n// copyright notice and this permission notice appear in all copies.\r\n//\r\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\r\nvar decoder;\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var Base64 = exports.Base64 = {\r\n decode: function (a) {\r\n var i;\r\n if (decoder === undefined) {\r\n var b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\r\n var ignore = \"= \\f\\n\\r\\t\\u00A0\\u2028\\u2029\";\r\n decoder = Object.create(null);\r\n for (i = 0; i < 64; ++i) {\r\n decoder[b64.charAt(i)] = i;\r\n }\r\n decoder['-'] = 62; //+\r\n decoder['_'] = 63; //-\r\n for (i = 0; i < ignore.length; ++i) {\r\n decoder[ignore.charAt(i)] = -1;\r\n }\r\n }\r\n var out = [];\r\n var bits = 0;\r\n var char_count = 0;\r\n for (i = 0; i < a.length; ++i) {\r\n var c = a.charAt(i);\r\n if (c == \"=\") {\r\n break;\r\n }\r\n c = decoder[c];\r\n if (c == -1) {\r\n continue;\r\n }\r\n if (c === undefined) {\r\n throw new Error(\"Illegal character at offset \" + i);\r\n }\r\n bits |= c;\r\n if (++char_count >= 4) {\r\n out[out.length] = (bits >> 16);\r\n out[out.length] = (bits >> 8) & 0xFF;\r\n out[out.length] = bits & 0xFF;\r\n bits = 0;\r\n char_count = 0;\r\n }\r\n else {\r\n bits <<= 6;\r\n }\r\n }\r\n switch (char_count) {\r\n case 1:\r\n throw new Error(\"Base64 encoding incomplete: at least 2 bits missing\");\r\n case 2:\r\n out[out.length] = (bits >> 10);\r\n break;\r\n case 3:\r\n out[out.length] = (bits >> 16);\r\n out[out.length] = (bits >> 8) & 0xFF;\r\n break;\r\n }\r\n return out;\r\n },\r\n re: /-----BEGIN [^-]+-----([A-Za-z0-9+\\/=\\s]+)-----END [^-]+-----|begin-base64[^\\n]+\\n([A-Za-z0-9+\\/=\\s]+)====/,\r\n unarmor: function (a) {\r\n var m = Base64.re.exec(a);\r\n if (m) {\r\n if (m[1]) {\r\n a = m[1];\r\n }\r\n else if (m[2]) {\r\n a = m[2];\r\n }\r\n else {\r\n throw new Error(\"RegExp out of sync\");\r\n }\r\n }\r\n return Base64.decode(a);\r\n }\r\n};\r\n","// ASN.1 JavaScript decoder\r\n// Copyright (c) 2008-2014 Lapo Luchini \r\n// Permission to use, copy, modify, and/or distribute this software for any\r\n// purpose with or without fee is hereby granted, provided that the above\r\n// copyright notice and this permission notice appear in all copies.\r\n//\r\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\r\n/*global oids */\r\nvar __TEMP__ = require('./int10');var Int10 = __TEMP__['Int10'];\r\nvar ellipsis = \"\\u2026\";\r\nvar reTimeS = /^(\\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)?)?$/;\r\nvar reTimeL = /^(\\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)?)?$/;\r\nfunction stringCut(str, len) {\r\n if (str.length > len) {\r\n str = str.substring(0, len) + ellipsis;\r\n }\r\n return str;\r\n}\r\nvar Stream = /** @class */ (function () {\r\n function Stream(enc, pos) {\r\n this.hexDigits = \"0123456789ABCDEF\";\r\n if (enc instanceof Stream) {\r\n this.enc = enc.enc;\r\n this.pos = enc.pos;\r\n }\r\n else {\r\n // enc should be an array or a binary string\r\n this.enc = enc;\r\n this.pos = pos;\r\n }\r\n }\r\n Stream.prototype.get = function (pos) {\r\n if (pos === undefined) {\r\n pos = this.pos++;\r\n }\r\n if (pos >= this.enc.length) {\r\n throw new Error(\"Requesting byte offset \" + pos + \" on a stream of length \" + this.enc.length);\r\n }\r\n return (\"string\" === typeof this.enc) ? this.enc.charCodeAt(pos) : this.enc[pos];\r\n };\r\n Stream.prototype.hexByte = function (b) {\r\n return this.hexDigits.charAt((b >> 4) & 0xF) + this.hexDigits.charAt(b & 0xF);\r\n };\r\n Stream.prototype.hexDump = function (start, end, raw) {\r\n var s = \"\";\r\n for (var i = start; i < end; ++i) {\r\n s += this.hexByte(this.get(i));\r\n if (raw !== true) {\r\n switch (i & 0xF) {\r\n case 0x7:\r\n s += \" \";\r\n break;\r\n case 0xF:\r\n s += \"\\n\";\r\n break;\r\n default:\r\n s += \" \";\r\n }\r\n }\r\n }\r\n return s;\r\n };\r\n Stream.prototype.isASCII = function (start, end) {\r\n for (var i = start; i < end; ++i) {\r\n var c = this.get(i);\r\n if (c < 32 || c > 176) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n Stream.prototype.parseStringISO = function (start, end) {\r\n var s = \"\";\r\n for (var i = start; i < end; ++i) {\r\n s += String.fromCharCode(this.get(i));\r\n }\r\n return s;\r\n };\r\n Stream.prototype.parseStringUTF = function (start, end) {\r\n var s = \"\";\r\n for (var i = start; i < end;) {\r\n var c = this.get(i++);\r\n if (c < 128) {\r\n s += String.fromCharCode(c);\r\n }\r\n else if ((c > 191) && (c < 224)) {\r\n s += String.fromCharCode(((c & 0x1F) << 6) | (this.get(i++) & 0x3F));\r\n }\r\n else {\r\n s += String.fromCharCode(((c & 0x0F) << 12) | ((this.get(i++) & 0x3F) << 6) | (this.get(i++) & 0x3F));\r\n }\r\n }\r\n return s;\r\n };\r\n Stream.prototype.parseStringBMP = function (start, end) {\r\n var str = \"\";\r\n var hi;\r\n var lo;\r\n for (var i = start; i < end;) {\r\n hi = this.get(i++);\r\n lo = this.get(i++);\r\n str += String.fromCharCode((hi << 8) | lo);\r\n }\r\n return str;\r\n };\r\n Stream.prototype.parseTime = function (start, end, shortYear) {\r\n var s = this.parseStringISO(start, end);\r\n var m = (shortYear ? reTimeS : reTimeL).exec(s);\r\n if (!m) {\r\n return \"Unrecognized time: \" + s;\r\n }\r\n if (shortYear) {\r\n // to avoid querying the timer, use the fixed range [1970, 2069]\r\n // it will conform with ITU X.400 [-10, +40] sliding window until 2030\r\n m[1] = +m[1];\r\n m[1] += (+m[1] < 70) ? 2000 : 1900;\r\n }\r\n s = m[1] + \"-\" + m[2] + \"-\" + m[3] + \" \" + m[4];\r\n if (m[5]) {\r\n s += \":\" + m[5];\r\n if (m[6]) {\r\n s += \":\" + m[6];\r\n if (m[7]) {\r\n s += \".\" + m[7];\r\n }\r\n }\r\n }\r\n if (m[8]) {\r\n s += \" UTC\";\r\n if (m[8] != \"Z\") {\r\n s += m[8];\r\n if (m[9]) {\r\n s += \":\" + m[9];\r\n }\r\n }\r\n }\r\n return s;\r\n };\r\n Stream.prototype.parseInteger = function (start, end) {\r\n var v = this.get(start);\r\n var neg = (v > 127);\r\n var pad = neg ? 255 : 0;\r\n var len;\r\n var s = \"\";\r\n // skip unuseful bits (not allowed in DER)\r\n while (v == pad && ++start < end) {\r\n v = this.get(start);\r\n }\r\n len = end - start;\r\n if (len === 0) {\r\n return neg ? -1 : 0;\r\n }\r\n // show bit length of huge integers\r\n if (len > 4) {\r\n s = v;\r\n len <<= 3;\r\n while (((+s ^ pad) & 0x80) == 0) {\r\n s = +s << 1;\r\n --len;\r\n }\r\n s = \"(\" + len + \" bit)\\n\";\r\n }\r\n // decode the integer\r\n if (neg) {\r\n v = v - 256;\r\n }\r\n var n = new Int10(v);\r\n for (var i = start + 1; i < end; ++i) {\r\n n.mulAdd(256, this.get(i));\r\n }\r\n return s + n.toString();\r\n };\r\n Stream.prototype.parseBitString = function (start, end, maxLength) {\r\n var unusedBit = this.get(start);\r\n var lenBit = ((end - start - 1) << 3) - unusedBit;\r\n var intro = \"(\" + lenBit + \" bit)\\n\";\r\n var s = \"\";\r\n for (var i = start + 1; i < end; ++i) {\r\n var b = this.get(i);\r\n var skip = (i == end - 1) ? unusedBit : 0;\r\n for (var j = 7; j >= skip; --j) {\r\n s += (b >> j) & 1 ? \"1\" : \"0\";\r\n }\r\n if (s.length > maxLength) {\r\n return intro + stringCut(s, maxLength);\r\n }\r\n }\r\n return intro + s;\r\n };\r\n Stream.prototype.parseOctetString = function (start, end, maxLength) {\r\n if (this.isASCII(start, end)) {\r\n return stringCut(this.parseStringISO(start, end), maxLength);\r\n }\r\n var len = end - start;\r\n var s = \"(\" + len + \" byte)\\n\";\r\n maxLength /= 2; // we work in bytes\r\n if (len > maxLength) {\r\n end = start + maxLength;\r\n }\r\n for (var i = start; i < end; ++i) {\r\n s += this.hexByte(this.get(i));\r\n }\r\n if (len > maxLength) {\r\n s += ellipsis;\r\n }\r\n return s;\r\n };\r\n Stream.prototype.parseOID = function (start, end, maxLength) {\r\n var s = \"\";\r\n var n = new Int10();\r\n var bits = 0;\r\n for (var i = start; i < end; ++i) {\r\n var v = this.get(i);\r\n n.mulAdd(128, v & 0x7F);\r\n bits += 7;\r\n if (!(v & 0x80)) { // finished\r\n if (s === \"\") {\r\n n = n.simplify();\r\n if (n instanceof Int10) {\r\n n.sub(80);\r\n s = \"2.\" + n.toString();\r\n }\r\n else {\r\n var m = n < 80 ? n < 40 ? 0 : 1 : 2;\r\n s = m + \".\" + (n - m * 40);\r\n }\r\n }\r\n else {\r\n s += \".\" + n.toString();\r\n }\r\n if (s.length > maxLength) {\r\n return stringCut(s, maxLength);\r\n }\r\n n = new Int10();\r\n bits = 0;\r\n }\r\n }\r\n if (bits > 0) {\r\n s += \".incomplete\";\r\n }\r\n return s;\r\n };\r\n return Stream;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'Stream', { enumerable: true, configurable: true, get: function() { return Stream; } });\r\nvar ASN1 = /** @class */ (function () {\r\n function ASN1(stream, header, length, tag, sub) {\r\n if (!(tag instanceof ASN1Tag)) {\r\n throw new Error(\"Invalid tag value.\");\r\n }\r\n this.stream = stream;\r\n this.header = header;\r\n this.length = length;\r\n this.tag = tag;\r\n this.sub = sub;\r\n }\r\n ASN1.prototype.typeName = function () {\r\n switch (this.tag.tagClass) {\r\n case 0: // universal\r\n switch (this.tag.tagNumber) {\r\n case 0x00:\r\n return \"EOC\";\r\n case 0x01:\r\n return \"BOOLEAN\";\r\n case 0x02:\r\n return \"INTEGER\";\r\n case 0x03:\r\n return \"BIT_STRING\";\r\n case 0x04:\r\n return \"OCTET_STRING\";\r\n case 0x05:\r\n return \"NULL\";\r\n case 0x06:\r\n return \"OBJECT_IDENTIFIER\";\r\n case 0x07:\r\n return \"ObjectDescriptor\";\r\n case 0x08:\r\n return \"EXTERNAL\";\r\n case 0x09:\r\n return \"REAL\";\r\n case 0x0A:\r\n return \"ENUMERATED\";\r\n case 0x0B:\r\n return \"EMBEDDED_PDV\";\r\n case 0x0C:\r\n return \"UTF8String\";\r\n case 0x10:\r\n return \"SEQUENCE\";\r\n case 0x11:\r\n return \"SET\";\r\n case 0x12:\r\n return \"NumericString\";\r\n case 0x13:\r\n return \"PrintableString\"; // ASCII subset\r\n case 0x14:\r\n return \"TeletexString\"; // aka T61String\r\n case 0x15:\r\n return \"VideotexString\";\r\n case 0x16:\r\n return \"IA5String\"; // ASCII\r\n case 0x17:\r\n return \"UTCTime\";\r\n case 0x18:\r\n return \"GeneralizedTime\";\r\n case 0x19:\r\n return \"GraphicString\";\r\n case 0x1A:\r\n return \"VisibleString\"; // ASCII subset\r\n case 0x1B:\r\n return \"GeneralString\";\r\n case 0x1C:\r\n return \"UniversalString\";\r\n case 0x1E:\r\n return \"BMPString\";\r\n }\r\n return \"Universal_\" + this.tag.tagNumber.toString();\r\n case 1:\r\n return \"Application_\" + this.tag.tagNumber.toString();\r\n case 2:\r\n return \"[\" + this.tag.tagNumber.toString() + \"]\"; // Context\r\n case 3:\r\n return \"Private_\" + this.tag.tagNumber.toString();\r\n }\r\n };\r\n ASN1.prototype.content = function (maxLength) {\r\n if (this.tag === undefined) {\r\n return null;\r\n }\r\n if (maxLength === undefined) {\r\n maxLength = Infinity;\r\n }\r\n var content = this.posContent();\r\n var len = Math.abs(this.length);\r\n if (!this.tag.isUniversal()) {\r\n if (this.sub !== null) {\r\n return \"(\" + this.sub.length + \" elem)\";\r\n }\r\n return this.stream.parseOctetString(content, content + len, maxLength);\r\n }\r\n switch (this.tag.tagNumber) {\r\n case 0x01: // BOOLEAN\r\n return (this.stream.get(content) === 0) ? \"false\" : \"true\";\r\n case 0x02: // INTEGER\r\n return this.stream.parseInteger(content, content + len);\r\n case 0x03: // BIT_STRING\r\n return this.sub ? \"(\" + this.sub.length + \" elem)\" :\r\n this.stream.parseBitString(content, content + len, maxLength);\r\n case 0x04: // OCTET_STRING\r\n return this.sub ? \"(\" + this.sub.length + \" elem)\" :\r\n this.stream.parseOctetString(content, content + len, maxLength);\r\n // case 0x05: // NULL\r\n case 0x06: // OBJECT_IDENTIFIER\r\n return this.stream.parseOID(content, content + len, maxLength);\r\n // case 0x07: // ObjectDescriptor\r\n // case 0x08: // EXTERNAL\r\n // case 0x09: // REAL\r\n // case 0x0A: // ENUMERATED\r\n // case 0x0B: // EMBEDDED_PDV\r\n case 0x10: // SEQUENCE\r\n case 0x11: // SET\r\n if (this.sub !== null) {\r\n return \"(\" + this.sub.length + \" elem)\";\r\n }\r\n else {\r\n return \"(no elem)\";\r\n }\r\n case 0x0C: // UTF8String\r\n return stringCut(this.stream.parseStringUTF(content, content + len), maxLength);\r\n case 0x12: // NumericString\r\n case 0x13: // PrintableString\r\n case 0x14: // TeletexString\r\n case 0x15: // VideotexString\r\n case 0x16: // IA5String\r\n // case 0x19: // GraphicString\r\n case 0x1A: // VisibleString\r\n // case 0x1B: // GeneralString\r\n // case 0x1C: // UniversalString\r\n return stringCut(this.stream.parseStringISO(content, content + len), maxLength);\r\n case 0x1E: // BMPString\r\n return stringCut(this.stream.parseStringBMP(content, content + len), maxLength);\r\n case 0x17: // UTCTime\r\n case 0x18: // GeneralizedTime\r\n return this.stream.parseTime(content, content + len, (this.tag.tagNumber == 0x17));\r\n }\r\n return null;\r\n };\r\n ASN1.prototype.toString = function () {\r\n return this.typeName() + \"@\" + this.stream.pos + \"[header:\" + this.header + \",length:\" + this.length + \",sub:\" + ((this.sub === null) ? \"null\" : this.sub.length) + \"]\";\r\n };\r\n ASN1.prototype.toPrettyString = function (indent) {\r\n if (indent === undefined) {\r\n indent = \"\";\r\n }\r\n var s = indent + this.typeName() + \" @\" + this.stream.pos;\r\n if (this.length >= 0) {\r\n s += \"+\";\r\n }\r\n s += this.length;\r\n if (this.tag.tagConstructed) {\r\n s += \" (constructed)\";\r\n }\r\n else if ((this.tag.isUniversal() && ((this.tag.tagNumber == 0x03) || (this.tag.tagNumber == 0x04))) && (this.sub !== null)) {\r\n s += \" (encapsulates)\";\r\n }\r\n s += \"\\n\";\r\n if (this.sub !== null) {\r\n indent += \" \";\r\n for (var i = 0, max = this.sub.length; i < max; ++i) {\r\n s += this.sub[i].toPrettyString(indent);\r\n }\r\n }\r\n return s;\r\n };\r\n ASN1.prototype.posStart = function () {\r\n return this.stream.pos;\r\n };\r\n ASN1.prototype.posContent = function () {\r\n return this.stream.pos + this.header;\r\n };\r\n ASN1.prototype.posEnd = function () {\r\n return this.stream.pos + this.header + Math.abs(this.length);\r\n };\r\n ASN1.prototype.toHexString = function () {\r\n return this.stream.hexDump(this.posStart(), this.posEnd(), true);\r\n };\r\n ASN1.decodeLength = function (stream) {\r\n var buf = stream.get();\r\n var len = buf & 0x7F;\r\n if (len == buf) {\r\n return len;\r\n }\r\n // no reason to use Int10, as it would be a huge buffer anyways\r\n if (len > 6) {\r\n throw new Error(\"Length over 48 bits not supported at position \" + (stream.pos - 1));\r\n }\r\n if (len === 0) {\r\n return null;\r\n } // undefined\r\n buf = 0;\r\n for (var i = 0; i < len; ++i) {\r\n buf = (buf * 256) + stream.get();\r\n }\r\n return buf;\r\n };\r\n /**\r\n * Retrieve the hexadecimal value (as a string) of the current ASN.1 element\r\n * @returns {string}\r\n * @public\r\n */\r\n ASN1.prototype.getHexStringValue = function () {\r\n var hexString = this.toHexString();\r\n var offset = this.header * 2;\r\n var length = this.length * 2;\r\n return hexString.substr(offset, length);\r\n };\r\n ASN1.decode = function (str) {\r\n var stream;\r\n if (!(str instanceof Stream)) {\r\n stream = new Stream(str, 0);\r\n }\r\n else {\r\n stream = str;\r\n }\r\n var streamStart = new Stream(stream);\r\n var tag = new ASN1Tag(stream);\r\n var len = ASN1.decodeLength(stream);\r\n var start = stream.pos;\r\n var header = start - streamStart.pos;\r\n var sub = null;\r\n var getSub = function () {\r\n var ret = [];\r\n if (len !== null) {\r\n // definite length\r\n var end = start + len;\r\n while (stream.pos < end) {\r\n ret[ret.length] = ASN1.decode(stream);\r\n }\r\n if (stream.pos != end) {\r\n throw new Error(\"Content size is not correct for container starting at offset \" + start);\r\n }\r\n }\r\n else {\r\n // undefined length\r\n try {\r\n for (;;) {\r\n var s = ASN1.decode(stream);\r\n if (s.tag.isEOC()) {\r\n break;\r\n }\r\n ret[ret.length] = s;\r\n }\r\n len = start - stream.pos; // undefined lengths are represented as negative values\r\n }\r\n catch (e) {\r\n throw new Error(\"Exception while decoding undefined length content: \" + e);\r\n }\r\n }\r\n return ret;\r\n };\r\n if (tag.tagConstructed) {\r\n // must have valid content\r\n sub = getSub();\r\n }\r\n else if (tag.isUniversal() && ((tag.tagNumber == 0x03) || (tag.tagNumber == 0x04))) {\r\n // sometimes BitString and OctetString are used to encapsulate ASN.1\r\n try {\r\n if (tag.tagNumber == 0x03) {\r\n if (stream.get() != 0) {\r\n throw new Error(\"BIT STRINGs with unused bits cannot encapsulate.\");\r\n }\r\n }\r\n sub = getSub();\r\n for (var i = 0; i < sub.length; ++i) {\r\n if (sub[i].tag.isEOC()) {\r\n throw new Error(\"EOC is not supposed to be actual content.\");\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // but silently ignore when they don't\r\n sub = null;\r\n }\r\n }\r\n if (sub === null) {\r\n if (len === null) {\r\n throw new Error(\"We can't skip over an invalid tag with undefined length at offset \" + start);\r\n }\r\n stream.pos = start + Math.abs(len);\r\n }\r\n return new ASN1(streamStart, header, len, tag, sub);\r\n };\r\n return ASN1;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'ASN1', { enumerable: true, configurable: true, get: function() { return ASN1; } });\r\nvar ASN1Tag = /** @class */ (function () {\r\n function ASN1Tag(stream) {\r\n var buf = stream.get();\r\n this.tagClass = buf >> 6;\r\n this.tagConstructed = ((buf & 0x20) !== 0);\r\n this.tagNumber = buf & 0x1F;\r\n if (this.tagNumber == 0x1F) { // long tag\r\n var n = new Int10();\r\n do {\r\n buf = stream.get();\r\n n.mulAdd(128, buf & 0x7F);\r\n } while (buf & 0x80);\r\n this.tagNumber = n.simplify();\r\n }\r\n }\r\n ASN1Tag.prototype.isUniversal = function () {\r\n return this.tagClass === 0x00;\r\n };\r\n ASN1Tag.prototype.isEOC = function () {\r\n return this.tagClass === 0x00 && this.tagNumber === 0x00;\r\n };\r\n return ASN1Tag;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'ASN1Tag', { enumerable: true, configurable: true, get: function() { return ASN1Tag; } });\r\n","// Big integer base-10 printing library\r\n// Copyright (c) 2014 Lapo Luchini \r\n// Permission to use, copy, modify, and/or distribute this software for any\r\n// purpose with or without fee is hereby granted, provided that the above\r\n// copyright notice and this permission notice appear in all copies.\r\n//\r\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\r\nvar max = 10000000000000; // biggest integer that can still fit 2^53 when multiplied by 256\r\nvar Int10 = /** @class */ (function () {\r\n function Int10(value) {\r\n this.buf = [+value || 0];\r\n }\r\n Int10.prototype.mulAdd = function (m, c) {\r\n // assert(m <= 256)\r\n var b = this.buf;\r\n var l = b.length;\r\n var i;\r\n var t;\r\n for (i = 0; i < l; ++i) {\r\n t = b[i] * m + c;\r\n if (t < max) {\r\n c = 0;\r\n }\r\n else {\r\n c = 0 | (t / max);\r\n t -= c * max;\r\n }\r\n b[i] = t;\r\n }\r\n if (c > 0) {\r\n b[i] = c;\r\n }\r\n };\r\n Int10.prototype.sub = function (c) {\r\n // assert(m <= 256)\r\n var b = this.buf;\r\n var l = b.length;\r\n var i;\r\n var t;\r\n for (i = 0; i < l; ++i) {\r\n t = b[i] - c;\r\n if (t < 0) {\r\n t += max;\r\n c = 1;\r\n }\r\n else {\r\n c = 0;\r\n }\r\n b[i] = t;\r\n }\r\n while (b[b.length - 1] === 0) {\r\n b.pop();\r\n }\r\n };\r\n Int10.prototype.toString = function (base) {\r\n if ((base || 10) != 10) {\r\n throw new Error(\"only base 10 is supported\");\r\n }\r\n var b = this.buf;\r\n var s = b[b.length - 1].toString();\r\n for (var i = b.length - 2; i >= 0; --i) {\r\n s += (max + b[i]).toString().substring(1);\r\n }\r\n return s;\r\n };\r\n Int10.prototype.valueOf = function () {\r\n var b = this.buf;\r\n var v = 0;\r\n for (var i = b.length - 1; i >= 0; --i) {\r\n v = v * max + b[i];\r\n }\r\n return v;\r\n };\r\n Int10.prototype.simplify = function () {\r\n var b = this.buf;\r\n return (b.length == 1) ? b[0] : this;\r\n };\r\n return Int10;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'Int10', { enumerable: true, configurable: true, get: function() { return Int10; } });\r\n","// Depends on jsbn.js and rng.js\r\n// Version 1.1: support utf-8 encoding in pkcs1pad2\r\n// convert a (hex) string to a bignum object\r\nvar __TEMP__ = require('./jsbn');var BigInteger = __TEMP__['BigInteger'];var nbi = __TEMP__['nbi'];var parseBigInt = __TEMP__['parseBigInt'];\r\nvar __TEMP__ = require('./rng');var SecureRandom = __TEMP__['SecureRandom'];\r\n// function linebrk(s,n) {\r\n// var ret = \"\";\r\n// var i = 0;\r\n// while(i + n < s.length) {\r\n// ret += s.substring(i,i+n) + \"\\n\";\r\n// i += n;\r\n// }\r\n// return ret + s.substring(i,s.length);\r\n// }\r\n// function byte2Hex(b) {\r\n// if(b < 0x10)\r\n// return \"0\" + b.toString(16);\r\n// else\r\n// return b.toString(16);\r\n// }\r\nfunction pkcs1pad1(s, n) {\r\n if (n < s.length + 22) {\r\n console.error(\"Message too long for RSA\");\r\n return null;\r\n }\r\n var len = n - s.length - 6;\r\n var filler = \"\";\r\n for (var f = 0; f < len; f += 2) {\r\n filler += \"ff\";\r\n }\r\n var m = \"0001\" + filler + \"00\" + s;\r\n return parseBigInt(m, 16);\r\n}\r\n// PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint\r\nfunction pkcs1pad2(s, n) {\r\n if (n < s.length + 11) { // TODO: fix for utf-8\r\n console.error(\"Message too long for RSA\");\r\n return null;\r\n }\r\n var ba = [];\r\n var i = s.length - 1;\r\n while (i >= 0 && n > 0) {\r\n var c = s.charCodeAt(i--);\r\n if (c < 128) { // encode using utf-8\r\n ba[--n] = c;\r\n }\r\n else if ((c > 127) && (c < 2048)) {\r\n ba[--n] = (c & 63) | 128;\r\n ba[--n] = (c >> 6) | 192;\r\n }\r\n else {\r\n ba[--n] = (c & 63) | 128;\r\n ba[--n] = ((c >> 6) & 63) | 128;\r\n ba[--n] = (c >> 12) | 224;\r\n }\r\n }\r\n ba[--n] = 0;\r\n var rng = new SecureRandom();\r\n var x = [];\r\n while (n > 2) { // random non-zero pad\r\n x[0] = 0;\r\n while (x[0] == 0) {\r\n rng.nextBytes(x);\r\n }\r\n ba[--n] = x[0];\r\n }\r\n ba[--n] = 2;\r\n ba[--n] = 0;\r\n return new BigInteger(ba);\r\n}\r\n// \"empty\" RSA key constructor\r\nvar RSAKey = /** @class */ (function () {\r\n function RSAKey() {\r\n this.n = null;\r\n this.e = 0;\r\n this.d = null;\r\n this.p = null;\r\n this.q = null;\r\n this.dmp1 = null;\r\n this.dmq1 = null;\r\n this.coeff = null;\r\n }\r\n //#region PROTECTED\r\n // protected\r\n // RSAKey.prototype.doPublic = RSADoPublic;\r\n // Perform raw public operation on \"x\": return x^e (mod n)\r\n RSAKey.prototype.doPublic = function (x) {\r\n return x.modPowInt(this.e, this.n);\r\n };\r\n // RSAKey.prototype.doPrivate = RSADoPrivate;\r\n // Perform raw private operation on \"x\": return x^d (mod n)\r\n RSAKey.prototype.doPrivate = function (x) {\r\n if (this.p == null || this.q == null) {\r\n return x.modPow(this.d, this.n);\r\n }\r\n // TODO: re-calculate any missing CRT params\r\n var xp = x.mod(this.p).modPow(this.dmp1, this.p);\r\n var xq = x.mod(this.q).modPow(this.dmq1, this.q);\r\n while (xp.compareTo(xq) < 0) {\r\n xp = xp.add(this.p);\r\n }\r\n return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq);\r\n };\r\n //#endregion PROTECTED\r\n //#region PUBLIC\r\n // RSAKey.prototype.setPublic = RSASetPublic;\r\n // Set the public key fields N and e from hex strings\r\n RSAKey.prototype.setPublic = function (N, E) {\r\n if (N != null && E != null && N.length > 0 && E.length > 0) {\r\n this.n = parseBigInt(N, 16);\r\n this.e = parseInt(E, 16);\r\n }\r\n else {\r\n console.error(\"Invalid RSA public key\");\r\n }\r\n };\r\n // RSAKey.prototype.encrypt = RSAEncrypt;\r\n // Return the PKCS#1 RSA encryption of \"text\" as an even-length hex string\r\n RSAKey.prototype.encrypt = function (text) {\r\n var maxLength = (this.n.bitLength() + 7) >> 3;\r\n var m = pkcs1pad2(text, maxLength);\r\n if (m == null) {\r\n return null;\r\n }\r\n var c = this.doPublic(m);\r\n if (c == null) {\r\n return null;\r\n }\r\n var h = c.toString(16);\r\n var length = h.length;\r\n // fix zero before result\r\n for (var i = 0; i < maxLength * 2 - length; i++) {\r\n h = \"0\" + h;\r\n }\r\n return h;\r\n };\r\n // RSAKey.prototype.setPrivate = RSASetPrivate;\r\n // Set the private key fields N, e, and d from hex strings\r\n RSAKey.prototype.setPrivate = function (N, E, D) {\r\n if (N != null && E != null && N.length > 0 && E.length > 0) {\r\n this.n = parseBigInt(N, 16);\r\n this.e = parseInt(E, 16);\r\n this.d = parseBigInt(D, 16);\r\n }\r\n else {\r\n console.error(\"Invalid RSA private key\");\r\n }\r\n };\r\n // RSAKey.prototype.setPrivateEx = RSASetPrivateEx;\r\n // Set the private key fields N, e, d and CRT params from hex strings\r\n RSAKey.prototype.setPrivateEx = function (N, E, D, P, Q, DP, DQ, C) {\r\n if (N != null && E != null && N.length > 0 && E.length > 0) {\r\n this.n = parseBigInt(N, 16);\r\n this.e = parseInt(E, 16);\r\n this.d = parseBigInt(D, 16);\r\n this.p = parseBigInt(P, 16);\r\n this.q = parseBigInt(Q, 16);\r\n this.dmp1 = parseBigInt(DP, 16);\r\n this.dmq1 = parseBigInt(DQ, 16);\r\n this.coeff = parseBigInt(C, 16);\r\n }\r\n else {\r\n console.error(\"Invalid RSA private key\");\r\n }\r\n };\r\n // RSAKey.prototype.generate = RSAGenerate;\r\n // Generate a new random private key B bits long, using public expt E\r\n RSAKey.prototype.generate = function (B, E) {\r\n var rng = new SecureRandom();\r\n var qs = B >> 1;\r\n this.e = parseInt(E, 16);\r\n var ee = new BigInteger(E, 16);\r\n for (;;) {\r\n for (;;) {\r\n this.p = new BigInteger(B - qs, 1, rng);\r\n if (this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) {\r\n break;\r\n }\r\n }\r\n for (;;) {\r\n this.q = new BigInteger(qs, 1, rng);\r\n if (this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) {\r\n break;\r\n }\r\n }\r\n if (this.p.compareTo(this.q) <= 0) {\r\n var t = this.p;\r\n this.p = this.q;\r\n this.q = t;\r\n }\r\n var p1 = this.p.subtract(BigInteger.ONE);\r\n var q1 = this.q.subtract(BigInteger.ONE);\r\n var phi = p1.multiply(q1);\r\n if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) {\r\n this.n = this.p.multiply(this.q);\r\n this.d = ee.modInverse(phi);\r\n this.dmp1 = this.d.mod(p1);\r\n this.dmq1 = this.d.mod(q1);\r\n this.coeff = this.q.modInverse(this.p);\r\n break;\r\n }\r\n }\r\n };\r\n // RSAKey.prototype.decrypt = RSADecrypt;\r\n // Return the PKCS#1 RSA decryption of \"ctext\".\r\n // \"ctext\" is an even-length hex string and the output is a plain string.\r\n RSAKey.prototype.decrypt = function (ctext) {\r\n var c = parseBigInt(ctext, 16);\r\n var m = this.doPrivate(c);\r\n if (m == null) {\r\n return null;\r\n }\r\n return pkcs1unpad2(m, (this.n.bitLength() + 7) >> 3);\r\n };\r\n // Generate a new random private key B bits long, using public expt E\r\n RSAKey.prototype.generateAsync = function (B, E, callback) {\r\n var rng = new SecureRandom();\r\n var qs = B >> 1;\r\n this.e = parseInt(E, 16);\r\n var ee = new BigInteger(E, 16);\r\n var rsa = this;\r\n // These functions have non-descript names because they were originally for(;;) loops.\r\n // I don't know about cryptography to give them better names than loop1-4.\r\n var loop1 = function () {\r\n var loop4 = function () {\r\n if (rsa.p.compareTo(rsa.q) <= 0) {\r\n var t = rsa.p;\r\n rsa.p = rsa.q;\r\n rsa.q = t;\r\n }\r\n var p1 = rsa.p.subtract(BigInteger.ONE);\r\n var q1 = rsa.q.subtract(BigInteger.ONE);\r\n var phi = p1.multiply(q1);\r\n if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) {\r\n rsa.n = rsa.p.multiply(rsa.q);\r\n rsa.d = ee.modInverse(phi);\r\n rsa.dmp1 = rsa.d.mod(p1);\r\n rsa.dmq1 = rsa.d.mod(q1);\r\n rsa.coeff = rsa.q.modInverse(rsa.p);\r\n setTimeout(function () { callback(); }, 0); // escape\r\n }\r\n else {\r\n setTimeout(loop1, 0);\r\n }\r\n };\r\n var loop3 = function () {\r\n rsa.q = nbi();\r\n rsa.q.fromNumberAsync(qs, 1, rng, function () {\r\n rsa.q.subtract(BigInteger.ONE).gcda(ee, function (r) {\r\n if (r.compareTo(BigInteger.ONE) == 0 && rsa.q.isProbablePrime(10)) {\r\n setTimeout(loop4, 0);\r\n }\r\n else {\r\n setTimeout(loop3, 0);\r\n }\r\n });\r\n });\r\n };\r\n var loop2 = function () {\r\n rsa.p = nbi();\r\n rsa.p.fromNumberAsync(B - qs, 1, rng, function () {\r\n rsa.p.subtract(BigInteger.ONE).gcda(ee, function (r) {\r\n if (r.compareTo(BigInteger.ONE) == 0 && rsa.p.isProbablePrime(10)) {\r\n setTimeout(loop3, 0);\r\n }\r\n else {\r\n setTimeout(loop2, 0);\r\n }\r\n });\r\n });\r\n };\r\n setTimeout(loop2, 0);\r\n };\r\n setTimeout(loop1, 0);\r\n };\r\n RSAKey.prototype.sign = function (text, digestMethod, digestName) {\r\n var header = getDigestHeader(digestName);\r\n var digest = header + digestMethod(text).toString();\r\n var m = pkcs1pad1(digest, this.n.bitLength() / 4);\r\n if (m == null) {\r\n return null;\r\n }\r\n var c = this.doPrivate(m);\r\n if (c == null) {\r\n return null;\r\n }\r\n var h = c.toString(16);\r\n if ((h.length & 1) == 0) {\r\n return h;\r\n }\r\n else {\r\n return \"0\" + h;\r\n }\r\n };\r\n RSAKey.prototype.verify = function (text, signature, digestMethod) {\r\n var c = parseBigInt(signature, 16);\r\n var m = this.doPublic(c);\r\n if (m == null) {\r\n return null;\r\n }\r\n var unpadded = m.toString(16).replace(/^1f+00/, \"\");\r\n var digest = removeDigestHeader(unpadded);\r\n return digest == digestMethod(text).toString();\r\n };\r\n RSAKey.prototype.encryptLong = function (text) {\r\n var _this = this;\r\n var res = '';\r\n var maxLen = ((this.n.bitLength() + 7) >> 3) - 11;\r\n var textArr = this.setSplitChn(text, maxLen);\r\n textArr.forEach(function (v) {\r\n res += _this.encrypt(v);\r\n });\r\n return res;\r\n };\r\n RSAKey.prototype.decryptLong = function (ctext) {\r\n var res = '';\r\n var maxLen = (this.n.bitLength() + 7) >> 3;\r\n var splitMaxLen = maxLen * 2;\r\n if (ctext.length > splitMaxLen) {\r\n var ctextArr = ctext.match(new RegExp('.{1,' + splitMaxLen + '}', 'g')) || [];\r\n var mArr = [];\r\n for (var i = 0; i < ctextArr.length; i++) {\r\n var c = parseBigInt(ctextArr[i], 16);\r\n var m = this.doPrivate(c);\r\n if (m == null) {\r\n return null;\r\n }\r\n mArr.push(m);\r\n }\r\n res = pkcs1unpad2Long(mArr, maxLen);\r\n }\r\n else {\r\n res = this.decrypt(ctext);\r\n }\r\n return res;\r\n };\r\n RSAKey.prototype.setSplitChn = function (str, maxLen, res) {\r\n if (res === void 0) { res = []; }\r\n var arr = str.split('');\r\n var len = 0;\r\n for (var i = 0; i < arr.length; i++) {\r\n var charCode = arr[i].charCodeAt(0);\r\n if (charCode <= 0x007f) {\r\n len += 1;\r\n }\r\n else if (charCode <= 0x07ff) {\r\n len += 2;\r\n }\r\n else if (charCode <= 0xffff) {\r\n len += 3;\r\n }\r\n else {\r\n len += 4;\r\n }\r\n if (len > maxLen) {\r\n var currentStr = str.substring(0, i);\r\n res.push(currentStr);\r\n return this.setSplitChn(str.substring(i), maxLen, res);\r\n }\r\n }\r\n res.push(str);\r\n return res;\r\n };\r\n return RSAKey;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'RSAKey', { enumerable: true, configurable: true, get: function() { return RSAKey; } });\r\n// Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext\r\nfunction pkcs1unpad2(d, n) {\r\n var b = d.toByteArray();\r\n var i = 0;\r\n while (i < b.length && b[i] == 0) {\r\n ++i;\r\n }\r\n if (b.length - i != n - 1 || b[i] != 2) {\r\n return null;\r\n }\r\n ++i;\r\n while (b[i] != 0) {\r\n if (++i >= b.length) {\r\n return null;\r\n }\r\n }\r\n var ret = \"\";\r\n while (++i < b.length) {\r\n var c = b[i] & 255;\r\n if (c < 128) { // utf-8 decode\r\n ret += String.fromCharCode(c);\r\n }\r\n else if ((c > 191) && (c < 224)) {\r\n ret += String.fromCharCode(((c & 31) << 6) | (b[i + 1] & 63));\r\n ++i;\r\n }\r\n else {\r\n ret += String.fromCharCode(((c & 15) << 12) | ((b[i + 1] & 63) << 6) | (b[i + 2] & 63));\r\n i += 2;\r\n }\r\n }\r\n return ret;\r\n}\r\nfunction pkcs1unpad2Long(dArr, n) {\r\n var bArr = [];\r\n for (var j = 0; j < dArr.length; j++) {\r\n var d = dArr[j];\r\n var b_1 = d.toByteArray();\r\n var i_1 = 0;\r\n while (i_1 < b_1.length && b_1[i_1] == 0) {\r\n ++i_1;\r\n }\r\n if (b_1.length - i_1 != n - 1 || b_1[i_1] != 2) {\r\n return null;\r\n }\r\n ++i_1;\r\n while (b_1[i_1] != 0) {\r\n if (++i_1 >= b_1.length) {\r\n return null;\r\n }\r\n }\r\n bArr = bArr.concat(b_1.slice(i_1 + 1));\r\n }\r\n var b = bArr;\r\n var i = -1;\r\n var ret = \"\";\r\n while (++i < b.length) {\r\n var c = b[i] & 255;\r\n if (c < 128) { // utf-8 decode\r\n ret += String.fromCharCode(c);\r\n }\r\n else if ((c > 191) && (c < 224)) {\r\n ret += String.fromCharCode(((c & 31) << 6) | (b[i + 1] & 63));\r\n ++i;\r\n }\r\n else {\r\n ret += String.fromCharCode(((c & 15) << 12) | ((b[i + 1] & 63) << 6) | (b[i + 2] & 63));\r\n i += 2;\r\n }\r\n }\r\n return ret;\r\n}\r\n// https://tools.ietf.org/html/rfc3447#page-43\r\nvar DIGEST_HEADERS = {\r\n md2: \"3020300c06082a864886f70d020205000410\",\r\n md5: \"3020300c06082a864886f70d020505000410\",\r\n sha1: \"3021300906052b0e03021a05000414\",\r\n sha224: \"302d300d06096086480165030402040500041c\",\r\n sha256: \"3031300d060960864801650304020105000420\",\r\n sha384: \"3041300d060960864801650304020205000430\",\r\n sha512: \"3051300d060960864801650304020305000440\",\r\n ripemd160: \"3021300906052b2403020105000414\"\r\n};\r\nfunction getDigestHeader(name) {\r\n return DIGEST_HEADERS[name] || \"\";\r\n}\r\nfunction removeDigestHeader(str) {\r\n for (var name_1 in DIGEST_HEADERS) {\r\n if (DIGEST_HEADERS.hasOwnProperty(name_1)) {\r\n var header = DIGEST_HEADERS[name_1];\r\n var len = header.length;\r\n if (str.substr(0, len) == header) {\r\n return str.substr(len);\r\n }\r\n }\r\n }\r\n return str;\r\n}\r\n// Return the PKCS#1 RSA encryption of \"text\" as a Base64-encoded string\r\n// function RSAEncryptB64(text) {\r\n// var h = this.encrypt(text);\r\n// if(h) return hex2b64(h); else return null;\r\n// }\r\n// public\r\n// RSAKey.prototype.encrypt_b64 = RSAEncryptB64;\r\n","// Copyright (c) 2005 Tom Wu\r\n// All Rights Reserved.\r\n// See \"LICENSE\" for details.\r\n// Basic JavaScript BN library - subset useful for RSA encryption.\r\nvar __TEMP__ = require('./util');var cbit = __TEMP__['cbit'];var int2char = __TEMP__['int2char'];var lbit = __TEMP__['lbit'];var op_and = __TEMP__['op_and'];var op_andnot = __TEMP__['op_andnot'];var op_or = __TEMP__['op_or'];var op_xor = __TEMP__['op_xor'];\r\n// Bits per digit\r\nvar dbits;\r\n// JavaScript engine analysis\r\nvar canary = 0xdeadbeefcafe;\r\nvar j_lm = ((canary & 0xffffff) == 0xefcafe);\r\n//#region\r\nvar lowprimes = [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\nvar lplim = (1 << 26) / lowprimes[lowprimes.length - 1];\r\n//#endregion\r\n// (public) Constructor\r\nvar BigInteger = /** @class */ (function () {\r\n function BigInteger(a, b, c) {\r\n if (a != null) {\r\n if (\"number\" == typeof a) {\r\n this.fromNumber(a, b, c);\r\n }\r\n else if (b == null && \"string\" != typeof a) {\r\n this.fromString(a, 256);\r\n }\r\n else {\r\n this.fromString(a, b);\r\n }\r\n }\r\n }\r\n //#region PUBLIC\r\n // BigInteger.prototype.toString = bnToString;\r\n // (public) return string representation in given radix\r\n BigInteger.prototype.toString = function (b) {\r\n if (this.s < 0) {\r\n return \"-\" + this.negate().toString(b);\r\n }\r\n var k;\r\n if (b == 16) {\r\n k = 4;\r\n }\r\n else if (b == 8) {\r\n k = 3;\r\n }\r\n else if (b == 2) {\r\n k = 1;\r\n }\r\n else if (b == 32) {\r\n k = 5;\r\n }\r\n else if (b == 4) {\r\n k = 2;\r\n }\r\n else {\r\n return this.toRadix(b);\r\n }\r\n var km = (1 << k) - 1;\r\n var d;\r\n var m = false;\r\n var r = \"\";\r\n var i = this.t;\r\n var p = this.DB - (i * this.DB) % k;\r\n if (i-- > 0) {\r\n if (p < this.DB && (d = this[i] >> p) > 0) {\r\n m = true;\r\n r = int2char(d);\r\n }\r\n while (i >= 0) {\r\n if (p < k) {\r\n d = (this[i] & ((1 << p) - 1)) << (k - p);\r\n d |= this[--i] >> (p += this.DB - k);\r\n }\r\n else {\r\n d = (this[i] >> (p -= k)) & km;\r\n if (p <= 0) {\r\n p += this.DB;\r\n --i;\r\n }\r\n }\r\n if (d > 0) {\r\n m = true;\r\n }\r\n if (m) {\r\n r += int2char(d);\r\n }\r\n }\r\n }\r\n return m ? r : \"0\";\r\n };\r\n // BigInteger.prototype.negate = bnNegate;\r\n // (public) -this\r\n BigInteger.prototype.negate = function () {\r\n var r = nbi();\r\n BigInteger.ZERO.subTo(this, r);\r\n return r;\r\n };\r\n // BigInteger.prototype.abs = bnAbs;\r\n // (public) |this|\r\n BigInteger.prototype.abs = function () {\r\n return (this.s < 0) ? this.negate() : this;\r\n };\r\n // BigInteger.prototype.compareTo = bnCompareTo;\r\n // (public) return + if this > a, - if this < a, 0 if equal\r\n BigInteger.prototype.compareTo = function (a) {\r\n var r = this.s - a.s;\r\n if (r != 0) {\r\n return r;\r\n }\r\n var i = this.t;\r\n r = i - a.t;\r\n if (r != 0) {\r\n return (this.s < 0) ? -r : r;\r\n }\r\n while (--i >= 0) {\r\n if ((r = this[i] - a[i]) != 0) {\r\n return r;\r\n }\r\n }\r\n return 0;\r\n };\r\n // BigInteger.prototype.bitLength = bnBitLength;\r\n // (public) return the number of bits in \"this\"\r\n BigInteger.prototype.bitLength = function () {\r\n if (this.t <= 0) {\r\n return 0;\r\n }\r\n return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM));\r\n };\r\n // BigInteger.prototype.mod = bnMod;\r\n // (public) this mod a\r\n BigInteger.prototype.mod = function (a) {\r\n var r = nbi();\r\n this.abs().divRemTo(a, null, r);\r\n if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) {\r\n a.subTo(r, r);\r\n }\r\n return r;\r\n };\r\n // BigInteger.prototype.modPowInt = bnModPowInt;\r\n // (public) this^e % m, 0 <= e < 2^32\r\n BigInteger.prototype.modPowInt = function (e, m) {\r\n var z;\r\n if (e < 256 || m.isEven()) {\r\n z = new Classic(m);\r\n }\r\n else {\r\n z = new Montgomery(m);\r\n }\r\n return this.exp(e, z);\r\n };\r\n // BigInteger.prototype.clone = bnClone;\r\n // (public)\r\n BigInteger.prototype.clone = function () {\r\n var r = nbi();\r\n this.copyTo(r);\r\n return r;\r\n };\r\n // BigInteger.prototype.intValue = bnIntValue;\r\n // (public) return value as integer\r\n BigInteger.prototype.intValue = function () {\r\n if (this.s < 0) {\r\n if (this.t == 1) {\r\n return this[0] - this.DV;\r\n }\r\n else if (this.t == 0) {\r\n return -1;\r\n }\r\n }\r\n else if (this.t == 1) {\r\n return this[0];\r\n }\r\n else if (this.t == 0) {\r\n return 0;\r\n }\r\n // assumes 16 < DB < 32\r\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0];\r\n };\r\n // BigInteger.prototype.byteValue = bnByteValue;\r\n // (public) return value as byte\r\n BigInteger.prototype.byteValue = function () {\r\n return (this.t == 0) ? this.s : (this[0] << 24) >> 24;\r\n };\r\n // BigInteger.prototype.shortValue = bnShortValue;\r\n // (public) return value as short (assumes DB>=16)\r\n BigInteger.prototype.shortValue = function () {\r\n return (this.t == 0) ? this.s : (this[0] << 16) >> 16;\r\n };\r\n // BigInteger.prototype.signum = bnSigNum;\r\n // (public) 0 if this == 0, 1 if this > 0\r\n BigInteger.prototype.signum = function () {\r\n if (this.s < 0) {\r\n return -1;\r\n }\r\n else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) {\r\n return 0;\r\n }\r\n else {\r\n return 1;\r\n }\r\n };\r\n // BigInteger.prototype.toByteArray = bnToByteArray;\r\n // (public) convert to bigendian byte array\r\n BigInteger.prototype.toByteArray = function () {\r\n var i = this.t;\r\n var r = [];\r\n r[0] = this.s;\r\n var p = this.DB - (i * this.DB) % 8;\r\n var d;\r\n var k = 0;\r\n if (i-- > 0) {\r\n if (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p) {\r\n r[k++] = d | (this.s << (this.DB - p));\r\n }\r\n while (i >= 0) {\r\n if (p < 8) {\r\n d = (this[i] & ((1 << p) - 1)) << (8 - p);\r\n d |= this[--i] >> (p += this.DB - 8);\r\n }\r\n else {\r\n d = (this[i] >> (p -= 8)) & 0xff;\r\n if (p <= 0) {\r\n p += this.DB;\r\n --i;\r\n }\r\n }\r\n if ((d & 0x80) != 0) {\r\n d |= -256;\r\n }\r\n if (k == 0 && (this.s & 0x80) != (d & 0x80)) {\r\n ++k;\r\n }\r\n if (k > 0 || d != this.s) {\r\n r[k++] = d;\r\n }\r\n }\r\n }\r\n return r;\r\n };\r\n // BigInteger.prototype.equals = bnEquals;\r\n BigInteger.prototype.equals = function (a) {\r\n return (this.compareTo(a) == 0);\r\n };\r\n // BigInteger.prototype.min = bnMin;\r\n BigInteger.prototype.min = function (a) {\r\n return (this.compareTo(a) < 0) ? this : a;\r\n };\r\n // BigInteger.prototype.max = bnMax;\r\n BigInteger.prototype.max = function (a) {\r\n return (this.compareTo(a) > 0) ? this : a;\r\n };\r\n // BigInteger.prototype.and = bnAnd;\r\n BigInteger.prototype.and = function (a) {\r\n var r = nbi();\r\n this.bitwiseTo(a, op_and, r);\r\n return r;\r\n };\r\n // BigInteger.prototype.or = bnOr;\r\n BigInteger.prototype.or = function (a) {\r\n var r = nbi();\r\n this.bitwiseTo(a, op_or, r);\r\n return r;\r\n };\r\n // BigInteger.prototype.xor = bnXor;\r\n BigInteger.prototype.xor = function (a) {\r\n var r = nbi();\r\n this.bitwiseTo(a, op_xor, r);\r\n return r;\r\n };\r\n // BigInteger.prototype.andNot = bnAndNot;\r\n BigInteger.prototype.andNot = function (a) {\r\n var r = nbi();\r\n this.bitwiseTo(a, op_andnot, r);\r\n return r;\r\n };\r\n // BigInteger.prototype.not = bnNot;\r\n // (public) ~this\r\n BigInteger.prototype.not = function () {\r\n var r = nbi();\r\n for (var i = 0; i < this.t; ++i) {\r\n r[i] = this.DM & ~this[i];\r\n }\r\n r.t = this.t;\r\n r.s = ~this.s;\r\n return r;\r\n };\r\n // BigInteger.prototype.shiftLeft = bnShiftLeft;\r\n // (public) this << n\r\n BigInteger.prototype.shiftLeft = function (n) {\r\n var r = nbi();\r\n if (n < 0) {\r\n this.rShiftTo(-n, r);\r\n }\r\n else {\r\n this.lShiftTo(n, r);\r\n }\r\n return r;\r\n };\r\n // BigInteger.prototype.shiftRight = bnShiftRight;\r\n // (public) this >> n\r\n BigInteger.prototype.shiftRight = function (n) {\r\n var r = nbi();\r\n if (n < 0) {\r\n this.lShiftTo(-n, r);\r\n }\r\n else {\r\n this.rShiftTo(n, r);\r\n }\r\n return r;\r\n };\r\n // BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;\r\n // (public) returns index of lowest 1-bit (or -1 if none)\r\n BigInteger.prototype.getLowestSetBit = function () {\r\n for (var i = 0; i < this.t; ++i) {\r\n if (this[i] != 0) {\r\n return i * this.DB + lbit(this[i]);\r\n }\r\n }\r\n if (this.s < 0) {\r\n return this.t * this.DB;\r\n }\r\n return -1;\r\n };\r\n // BigInteger.prototype.bitCount = bnBitCount;\r\n // (public) return number of set bits\r\n BigInteger.prototype.bitCount = function () {\r\n var r = 0;\r\n var x = this.s & this.DM;\r\n for (var i = 0; i < this.t; ++i) {\r\n r += cbit(this[i] ^ x);\r\n }\r\n return r;\r\n };\r\n // BigInteger.prototype.testBit = bnTestBit;\r\n // (public) true iff nth bit is set\r\n BigInteger.prototype.testBit = function (n) {\r\n var j = Math.floor(n / this.DB);\r\n if (j >= this.t) {\r\n return (this.s != 0);\r\n }\r\n return ((this[j] & (1 << (n % this.DB))) != 0);\r\n };\r\n // BigInteger.prototype.setBit = bnSetBit;\r\n // (public) this | (1< 1) {\r\n var g2 = nbi();\r\n z.sqrTo(g[1], g2);\r\n while (n <= km) {\r\n g[n] = nbi();\r\n z.mulTo(g2, g[n - 2], g[n]);\r\n n += 2;\r\n }\r\n }\r\n var j = e.t - 1;\r\n var w;\r\n var is1 = true;\r\n var r2 = nbi();\r\n var t;\r\n i = nbits(e[j]) - 1;\r\n while (j >= 0) {\r\n if (i >= k1) {\r\n w = (e[j] >> (i - k1)) & km;\r\n }\r\n else {\r\n w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i);\r\n if (j > 0) {\r\n w |= e[j - 1] >> (this.DB + i - k1);\r\n }\r\n }\r\n n = k;\r\n while ((w & 1) == 0) {\r\n w >>= 1;\r\n --n;\r\n }\r\n if ((i -= n) < 0) {\r\n i += this.DB;\r\n --j;\r\n }\r\n if (is1) { // ret == 1, don't bother squaring or multiplying it\r\n g[w].copyTo(r);\r\n is1 = false;\r\n }\r\n else {\r\n while (n > 1) {\r\n z.sqrTo(r, r2);\r\n z.sqrTo(r2, r);\r\n n -= 2;\r\n }\r\n if (n > 0) {\r\n z.sqrTo(r, r2);\r\n }\r\n else {\r\n t = r;\r\n r = r2;\r\n r2 = t;\r\n }\r\n z.mulTo(r2, g[w], r);\r\n }\r\n while (j >= 0 && (e[j] & (1 << i)) == 0) {\r\n z.sqrTo(r, r2);\r\n t = r;\r\n r = r2;\r\n r2 = t;\r\n if (--i < 0) {\r\n i = this.DB - 1;\r\n --j;\r\n }\r\n }\r\n }\r\n return z.revert(r);\r\n };\r\n // BigInteger.prototype.modInverse = bnModInverse;\r\n // (public) 1/this % m (HAC 14.61)\r\n BigInteger.prototype.modInverse = function (m) {\r\n var ac = m.isEven();\r\n if ((this.isEven() && ac) || m.signum() == 0) {\r\n return BigInteger.ZERO;\r\n }\r\n var u = m.clone();\r\n var v = this.clone();\r\n var a = nbv(1);\r\n var b = nbv(0);\r\n var c = nbv(0);\r\n var d = nbv(1);\r\n while (u.signum() != 0) {\r\n while (u.isEven()) {\r\n u.rShiftTo(1, u);\r\n if (ac) {\r\n if (!a.isEven() || !b.isEven()) {\r\n a.addTo(this, a);\r\n b.subTo(m, b);\r\n }\r\n a.rShiftTo(1, a);\r\n }\r\n else if (!b.isEven()) {\r\n b.subTo(m, b);\r\n }\r\n b.rShiftTo(1, b);\r\n }\r\n while (v.isEven()) {\r\n v.rShiftTo(1, v);\r\n if (ac) {\r\n if (!c.isEven() || !d.isEven()) {\r\n c.addTo(this, c);\r\n d.subTo(m, d);\r\n }\r\n c.rShiftTo(1, c);\r\n }\r\n else if (!d.isEven()) {\r\n d.subTo(m, d);\r\n }\r\n d.rShiftTo(1, d);\r\n }\r\n if (u.compareTo(v) >= 0) {\r\n u.subTo(v, u);\r\n if (ac) {\r\n a.subTo(c, a);\r\n }\r\n b.subTo(d, b);\r\n }\r\n else {\r\n v.subTo(u, v);\r\n if (ac) {\r\n c.subTo(a, c);\r\n }\r\n d.subTo(b, d);\r\n }\r\n }\r\n if (v.compareTo(BigInteger.ONE) != 0) {\r\n return BigInteger.ZERO;\r\n }\r\n if (d.compareTo(m) >= 0) {\r\n return d.subtract(m);\r\n }\r\n if (d.signum() < 0) {\r\n d.addTo(m, d);\r\n }\r\n else {\r\n return d;\r\n }\r\n if (d.signum() < 0) {\r\n return d.add(m);\r\n }\r\n else {\r\n return d;\r\n }\r\n };\r\n // BigInteger.prototype.pow = bnPow;\r\n // (public) this^e\r\n BigInteger.prototype.pow = function (e) {\r\n return this.exp(e, new NullExp());\r\n };\r\n // BigInteger.prototype.gcd = bnGCD;\r\n // (public) gcd(this,a) (HAC 14.54)\r\n BigInteger.prototype.gcd = function (a) {\r\n var x = (this.s < 0) ? this.negate() : this.clone();\r\n var y = (a.s < 0) ? a.negate() : a.clone();\r\n if (x.compareTo(y) < 0) {\r\n var t = x;\r\n x = y;\r\n y = t;\r\n }\r\n var i = x.getLowestSetBit();\r\n var g = y.getLowestSetBit();\r\n if (g < 0) {\r\n return x;\r\n }\r\n if (i < g) {\r\n g = i;\r\n }\r\n if (g > 0) {\r\n x.rShiftTo(g, x);\r\n y.rShiftTo(g, y);\r\n }\r\n while (x.signum() > 0) {\r\n if ((i = x.getLowestSetBit()) > 0) {\r\n x.rShiftTo(i, x);\r\n }\r\n if ((i = y.getLowestSetBit()) > 0) {\r\n y.rShiftTo(i, y);\r\n }\r\n if (x.compareTo(y) >= 0) {\r\n x.subTo(y, x);\r\n x.rShiftTo(1, x);\r\n }\r\n else {\r\n y.subTo(x, y);\r\n y.rShiftTo(1, y);\r\n }\r\n }\r\n if (g > 0) {\r\n y.lShiftTo(g, y);\r\n }\r\n return y;\r\n };\r\n // BigInteger.prototype.isProbablePrime = bnIsProbablePrime;\r\n // (public) test primality with certainty >= 1-.5^t\r\n BigInteger.prototype.isProbablePrime = function (t) {\r\n var i;\r\n var x = this.abs();\r\n if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {\r\n for (i = 0; i < lowprimes.length; ++i) {\r\n if (x[0] == lowprimes[i]) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n if (x.isEven()) {\r\n return false;\r\n }\r\n i = 1;\r\n while (i < lowprimes.length) {\r\n var m = lowprimes[i];\r\n var j = i + 1;\r\n while (j < lowprimes.length && m < lplim) {\r\n m *= lowprimes[j++];\r\n }\r\n m = x.modInt(m);\r\n while (i < j) {\r\n if (m % lowprimes[i++] == 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n return x.millerRabin(t);\r\n };\r\n //#endregion PUBLIC\r\n //#region PROTECTED\r\n // BigInteger.prototype.copyTo = bnpCopyTo;\r\n // (protected) copy this to r\r\n BigInteger.prototype.copyTo = function (r) {\r\n for (var i = this.t - 1; i >= 0; --i) {\r\n r[i] = this[i];\r\n }\r\n r.t = this.t;\r\n r.s = this.s;\r\n };\r\n // BigInteger.prototype.fromInt = bnpFromInt;\r\n // (protected) set from integer value x, -DV <= x < DV\r\n BigInteger.prototype.fromInt = function (x) {\r\n this.t = 1;\r\n this.s = (x < 0) ? -1 : 0;\r\n if (x > 0) {\r\n this[0] = x;\r\n }\r\n else if (x < -1) {\r\n this[0] = x + this.DV;\r\n }\r\n else {\r\n this.t = 0;\r\n }\r\n };\r\n // BigInteger.prototype.fromString = bnpFromString;\r\n // (protected) set from string and radix\r\n BigInteger.prototype.fromString = function (s, b) {\r\n var k;\r\n if (b == 16) {\r\n k = 4;\r\n }\r\n else if (b == 8) {\r\n k = 3;\r\n }\r\n else if (b == 256) {\r\n k = 8;\r\n /* byte array */\r\n }\r\n else if (b == 2) {\r\n k = 1;\r\n }\r\n else if (b == 32) {\r\n k = 5;\r\n }\r\n else if (b == 4) {\r\n k = 2;\r\n }\r\n else {\r\n this.fromRadix(s, b);\r\n return;\r\n }\r\n this.t = 0;\r\n this.s = 0;\r\n var i = s.length;\r\n var mi = false;\r\n var sh = 0;\r\n while (--i >= 0) {\r\n var x = (k == 8) ? (+s[i]) & 0xff : intAt(s, i);\r\n if (x < 0) {\r\n if (s.charAt(i) == \"-\") {\r\n mi = true;\r\n }\r\n continue;\r\n }\r\n mi = false;\r\n if (sh == 0) {\r\n this[this.t++] = x;\r\n }\r\n else if (sh + k > this.DB) {\r\n this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;\r\n this[this.t++] = (x >> (this.DB - sh));\r\n }\r\n else {\r\n this[this.t - 1] |= x << sh;\r\n }\r\n sh += k;\r\n if (sh >= this.DB) {\r\n sh -= this.DB;\r\n }\r\n }\r\n if (k == 8 && ((+s[0]) & 0x80) != 0) {\r\n this.s = -1;\r\n if (sh > 0) {\r\n this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;\r\n }\r\n }\r\n this.clamp();\r\n if (mi) {\r\n BigInteger.ZERO.subTo(this, this);\r\n }\r\n };\r\n // BigInteger.prototype.clamp = bnpClamp;\r\n // (protected) clamp off excess high words\r\n BigInteger.prototype.clamp = function () {\r\n var c = this.s & this.DM;\r\n while (this.t > 0 && this[this.t - 1] == c) {\r\n --this.t;\r\n }\r\n };\r\n // BigInteger.prototype.dlShiftTo = bnpDLShiftTo;\r\n // (protected) r = this << n*DB\r\n BigInteger.prototype.dlShiftTo = function (n, r) {\r\n var i;\r\n for (i = this.t - 1; i >= 0; --i) {\r\n r[i + n] = this[i];\r\n }\r\n for (i = n - 1; i >= 0; --i) {\r\n r[i] = 0;\r\n }\r\n r.t = this.t + n;\r\n r.s = this.s;\r\n };\r\n // BigInteger.prototype.drShiftTo = bnpDRShiftTo;\r\n // (protected) r = this >> n*DB\r\n BigInteger.prototype.drShiftTo = function (n, r) {\r\n for (var i = n; i < this.t; ++i) {\r\n r[i - n] = this[i];\r\n }\r\n r.t = Math.max(this.t - n, 0);\r\n r.s = this.s;\r\n };\r\n // BigInteger.prototype.lShiftTo = bnpLShiftTo;\r\n // (protected) r = this << n\r\n BigInteger.prototype.lShiftTo = function (n, r) {\r\n var bs = n % this.DB;\r\n var cbs = this.DB - bs;\r\n var bm = (1 << cbs) - 1;\r\n var ds = Math.floor(n / this.DB);\r\n var c = (this.s << bs) & this.DM;\r\n for (var i = this.t - 1; i >= 0; --i) {\r\n r[i + ds + 1] = (this[i] >> cbs) | c;\r\n c = (this[i] & bm) << bs;\r\n }\r\n for (var i = ds - 1; i >= 0; --i) {\r\n r[i] = 0;\r\n }\r\n r[ds] = c;\r\n r.t = this.t + ds + 1;\r\n r.s = this.s;\r\n r.clamp();\r\n };\r\n // BigInteger.prototype.rShiftTo = bnpRShiftTo;\r\n // (protected) r = this >> n\r\n BigInteger.prototype.rShiftTo = function (n, r) {\r\n r.s = this.s;\r\n var ds = Math.floor(n / this.DB);\r\n if (ds >= this.t) {\r\n r.t = 0;\r\n return;\r\n }\r\n var bs = n % this.DB;\r\n var cbs = this.DB - bs;\r\n var bm = (1 << bs) - 1;\r\n r[0] = this[ds] >> bs;\r\n for (var i = ds + 1; i < this.t; ++i) {\r\n r[i - ds - 1] |= (this[i] & bm) << cbs;\r\n r[i - ds] = this[i] >> bs;\r\n }\r\n if (bs > 0) {\r\n r[this.t - ds - 1] |= (this.s & bm) << cbs;\r\n }\r\n r.t = this.t - ds;\r\n r.clamp();\r\n };\r\n // BigInteger.prototype.subTo = bnpSubTo;\r\n // (protected) r = this - a\r\n BigInteger.prototype.subTo = function (a, r) {\r\n var i = 0;\r\n var c = 0;\r\n var m = Math.min(a.t, this.t);\r\n while (i < m) {\r\n c += this[i] - a[i];\r\n r[i++] = c & this.DM;\r\n c >>= this.DB;\r\n }\r\n if (a.t < this.t) {\r\n c -= a.s;\r\n while (i < this.t) {\r\n c += this[i];\r\n r[i++] = c & this.DM;\r\n c >>= this.DB;\r\n }\r\n c += this.s;\r\n }\r\n else {\r\n c += this.s;\r\n while (i < a.t) {\r\n c -= a[i];\r\n r[i++] = c & this.DM;\r\n c >>= this.DB;\r\n }\r\n c -= a.s;\r\n }\r\n r.s = (c < 0) ? -1 : 0;\r\n if (c < -1) {\r\n r[i++] = this.DV + c;\r\n }\r\n else if (c > 0) {\r\n r[i++] = c;\r\n }\r\n r.t = i;\r\n r.clamp();\r\n };\r\n // BigInteger.prototype.multiplyTo = bnpMultiplyTo;\r\n // (protected) r = this * a, r != this,a (HAC 14.12)\r\n // \"this\" should be the larger one if appropriate.\r\n BigInteger.prototype.multiplyTo = function (a, r) {\r\n var x = this.abs();\r\n var y = a.abs();\r\n var i = x.t;\r\n r.t = i + y.t;\r\n while (--i >= 0) {\r\n r[i] = 0;\r\n }\r\n for (i = 0; i < y.t; ++i) {\r\n r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\r\n }\r\n r.s = 0;\r\n r.clamp();\r\n if (this.s != a.s) {\r\n BigInteger.ZERO.subTo(r, r);\r\n }\r\n };\r\n // BigInteger.prototype.squareTo = bnpSquareTo;\r\n // (protected) r = this^2, r != this (HAC 14.16)\r\n BigInteger.prototype.squareTo = function (r) {\r\n var x = this.abs();\r\n var i = r.t = 2 * x.t;\r\n while (--i >= 0) {\r\n r[i] = 0;\r\n }\r\n for (i = 0; i < x.t - 1; ++i) {\r\n var c = x.am(i, x[i], r, 2 * i, 0, 1);\r\n if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\r\n r[i + x.t] -= x.DV;\r\n r[i + x.t + 1] = 1;\r\n }\r\n }\r\n if (r.t > 0) {\r\n r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\r\n }\r\n r.s = 0;\r\n r.clamp();\r\n };\r\n // BigInteger.prototype.divRemTo = bnpDivRemTo;\r\n // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\r\n // r != q, this != m. q or r may be null.\r\n BigInteger.prototype.divRemTo = function (m, q, r) {\r\n var pm = m.abs();\r\n if (pm.t <= 0) {\r\n return;\r\n }\r\n var pt = this.abs();\r\n if (pt.t < pm.t) {\r\n if (q != null) {\r\n q.fromInt(0);\r\n }\r\n if (r != null) {\r\n this.copyTo(r);\r\n }\r\n return;\r\n }\r\n if (r == null) {\r\n r = nbi();\r\n }\r\n var y = nbi();\r\n var ts = this.s;\r\n var ms = m.s;\r\n var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus\r\n if (nsh > 0) {\r\n pm.lShiftTo(nsh, y);\r\n pt.lShiftTo(nsh, r);\r\n }\r\n else {\r\n pm.copyTo(y);\r\n pt.copyTo(r);\r\n }\r\n var ys = y.t;\r\n var y0 = y[ys - 1];\r\n if (y0 == 0) {\r\n return;\r\n }\r\n var yt = y0 * (1 << this.F1) + ((ys > 1) ? y[ys - 2] >> this.F2 : 0);\r\n var d1 = this.FV / yt;\r\n var d2 = (1 << this.F1) / yt;\r\n var e = 1 << this.F2;\r\n var i = r.t;\r\n var j = i - ys;\r\n var t = (q == null) ? nbi() : q;\r\n y.dlShiftTo(j, t);\r\n if (r.compareTo(t) >= 0) {\r\n r[r.t++] = 1;\r\n r.subTo(t, r);\r\n }\r\n BigInteger.ONE.dlShiftTo(ys, t);\r\n t.subTo(y, y); // \"negative\" y so we can replace sub with am later\r\n while (y.t < ys) {\r\n y[y.t++] = 0;\r\n }\r\n while (--j >= 0) {\r\n // Estimate quotient digit\r\n var qd = (r[--i] == y0) ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\r\n if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out\r\n y.dlShiftTo(j, t);\r\n r.subTo(t, r);\r\n while (r[i] < --qd) {\r\n r.subTo(t, r);\r\n }\r\n }\r\n }\r\n if (q != null) {\r\n r.drShiftTo(ys, q);\r\n if (ts != ms) {\r\n BigInteger.ZERO.subTo(q, q);\r\n }\r\n }\r\n r.t = ys;\r\n r.clamp();\r\n if (nsh > 0) {\r\n r.rShiftTo(nsh, r);\r\n } // Denormalize remainder\r\n if (ts < 0) {\r\n BigInteger.ZERO.subTo(r, r);\r\n }\r\n };\r\n // BigInteger.prototype.invDigit = bnpInvDigit;\r\n // (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\r\n // justification:\r\n // xy == 1 (mod m)\r\n // xy = 1+km\r\n // xy(2-xy) = (1+km)(1-km)\r\n // x[y(2-xy)] = 1-k^2m^2\r\n // x[y(2-xy)] == 1 (mod m^2)\r\n // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\r\n // should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\r\n // JS multiply \"overflows\" differently from C/C++, so care is needed here.\r\n BigInteger.prototype.invDigit = function () {\r\n if (this.t < 1) {\r\n return 0;\r\n }\r\n var x = this[0];\r\n if ((x & 1) == 0) {\r\n return 0;\r\n }\r\n var y = x & 3; // y == 1/x mod 2^2\r\n y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4\r\n y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8\r\n y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16\r\n // last step - calculate inverse mod DV directly;\r\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\r\n y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits\r\n // we really want the negative inverse, and -DV < y < DV\r\n return (y > 0) ? this.DV - y : -y;\r\n };\r\n // BigInteger.prototype.isEven = bnpIsEven;\r\n // (protected) true iff this is even\r\n BigInteger.prototype.isEven = function () {\r\n return ((this.t > 0) ? (this[0] & 1) : this.s) == 0;\r\n };\r\n // BigInteger.prototype.exp = bnpExp;\r\n // (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\r\n BigInteger.prototype.exp = function (e, z) {\r\n if (e > 0xffffffff || e < 1) {\r\n return BigInteger.ONE;\r\n }\r\n var r = nbi();\r\n var r2 = nbi();\r\n var g = z.convert(this);\r\n var i = nbits(e) - 1;\r\n g.copyTo(r);\r\n while (--i >= 0) {\r\n z.sqrTo(r, r2);\r\n if ((e & (1 << i)) > 0) {\r\n z.mulTo(r2, g, r);\r\n }\r\n else {\r\n var t = r;\r\n r = r2;\r\n r2 = t;\r\n }\r\n }\r\n return z.revert(r);\r\n };\r\n // BigInteger.prototype.chunkSize = bnpChunkSize;\r\n // (protected) return x s.t. r^x < DV\r\n BigInteger.prototype.chunkSize = function (r) {\r\n return Math.floor(Math.LN2 * this.DB / Math.log(r));\r\n };\r\n // BigInteger.prototype.toRadix = bnpToRadix;\r\n // (protected) convert to radix string\r\n BigInteger.prototype.toRadix = function (b) {\r\n if (b == null) {\r\n b = 10;\r\n }\r\n if (this.signum() == 0 || b < 2 || b > 36) {\r\n return \"0\";\r\n }\r\n var cs = this.chunkSize(b);\r\n var a = Math.pow(b, cs);\r\n var d = nbv(a);\r\n var y = nbi();\r\n var z = nbi();\r\n var r = \"\";\r\n this.divRemTo(d, y, z);\r\n while (y.signum() > 0) {\r\n r = (a + z.intValue()).toString(b).substr(1) + r;\r\n y.divRemTo(d, y, z);\r\n }\r\n return z.intValue().toString(b) + r;\r\n };\r\n // BigInteger.prototype.fromRadix = bnpFromRadix;\r\n // (protected) convert from radix string\r\n BigInteger.prototype.fromRadix = function (s, b) {\r\n this.fromInt(0);\r\n if (b == null) {\r\n b = 10;\r\n }\r\n var cs = this.chunkSize(b);\r\n var d = Math.pow(b, cs);\r\n var mi = false;\r\n var j = 0;\r\n var w = 0;\r\n for (var i = 0; i < s.length; ++i) {\r\n var x = intAt(s, i);\r\n if (x < 0) {\r\n if (s.charAt(i) == \"-\" && this.signum() == 0) {\r\n mi = true;\r\n }\r\n continue;\r\n }\r\n w = b * w + x;\r\n if (++j >= cs) {\r\n this.dMultiply(d);\r\n this.dAddOffset(w, 0);\r\n j = 0;\r\n w = 0;\r\n }\r\n }\r\n if (j > 0) {\r\n this.dMultiply(Math.pow(b, j));\r\n this.dAddOffset(w, 0);\r\n }\r\n if (mi) {\r\n BigInteger.ZERO.subTo(this, this);\r\n }\r\n };\r\n // BigInteger.prototype.fromNumber = bnpFromNumber;\r\n // (protected) alternate constructor\r\n BigInteger.prototype.fromNumber = function (a, b, c) {\r\n if (\"number\" == typeof b) {\r\n // new BigInteger(int,int,RNG)\r\n if (a < 2) {\r\n this.fromInt(1);\r\n }\r\n else {\r\n this.fromNumber(a, c);\r\n if (!this.testBit(a - 1)) {\r\n // force MSB set\r\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this);\r\n }\r\n if (this.isEven()) {\r\n this.dAddOffset(1, 0);\r\n } // force odd\r\n while (!this.isProbablePrime(b)) {\r\n this.dAddOffset(2, 0);\r\n if (this.bitLength() > a) {\r\n this.subTo(BigInteger.ONE.shiftLeft(a - 1), this);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n // new BigInteger(int,RNG)\r\n var x = [];\r\n var t = a & 7;\r\n x.length = (a >> 3) + 1;\r\n b.nextBytes(x);\r\n if (t > 0) {\r\n x[0] &= ((1 << t) - 1);\r\n }\r\n else {\r\n x[0] = 0;\r\n }\r\n this.fromString(x, 256);\r\n }\r\n };\r\n // BigInteger.prototype.bitwiseTo = bnpBitwiseTo;\r\n // (protected) r = this op a (bitwise)\r\n BigInteger.prototype.bitwiseTo = function (a, op, r) {\r\n var i;\r\n var f;\r\n var m = Math.min(a.t, this.t);\r\n for (i = 0; i < m; ++i) {\r\n r[i] = op(this[i], a[i]);\r\n }\r\n if (a.t < this.t) {\r\n f = a.s & this.DM;\r\n for (i = m; i < this.t; ++i) {\r\n r[i] = op(this[i], f);\r\n }\r\n r.t = this.t;\r\n }\r\n else {\r\n f = this.s & this.DM;\r\n for (i = m; i < a.t; ++i) {\r\n r[i] = op(f, a[i]);\r\n }\r\n r.t = a.t;\r\n }\r\n r.s = op(this.s, a.s);\r\n r.clamp();\r\n };\r\n // BigInteger.prototype.changeBit = bnpChangeBit;\r\n // (protected) this op (1<>= this.DB;\r\n }\r\n if (a.t < this.t) {\r\n c += a.s;\r\n while (i < this.t) {\r\n c += this[i];\r\n r[i++] = c & this.DM;\r\n c >>= this.DB;\r\n }\r\n c += this.s;\r\n }\r\n else {\r\n c += this.s;\r\n while (i < a.t) {\r\n c += a[i];\r\n r[i++] = c & this.DM;\r\n c >>= this.DB;\r\n }\r\n c += a.s;\r\n }\r\n r.s = (c < 0) ? -1 : 0;\r\n if (c > 0) {\r\n r[i++] = c;\r\n }\r\n else if (c < -1) {\r\n r[i++] = this.DV + c;\r\n }\r\n r.t = i;\r\n r.clamp();\r\n };\r\n // BigInteger.prototype.dMultiply = bnpDMultiply;\r\n // (protected) this *= n, this >= 0, 1 < n < DV\r\n BigInteger.prototype.dMultiply = function (n) {\r\n this[this.t] = this.am(0, n - 1, this, 0, 0, this.t);\r\n ++this.t;\r\n this.clamp();\r\n };\r\n // BigInteger.prototype.dAddOffset = bnpDAddOffset;\r\n // (protected) this += n << w words, this >= 0\r\n BigInteger.prototype.dAddOffset = function (n, w) {\r\n if (n == 0) {\r\n return;\r\n }\r\n while (this.t <= w) {\r\n this[this.t++] = 0;\r\n }\r\n this[w] += n;\r\n while (this[w] >= this.DV) {\r\n this[w] -= this.DV;\r\n if (++w >= this.t) {\r\n this[this.t++] = 0;\r\n }\r\n ++this[w];\r\n }\r\n };\r\n // BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;\r\n // (protected) r = lower n words of \"this * a\", a.t <= n\r\n // \"this\" should be the larger one if appropriate.\r\n BigInteger.prototype.multiplyLowerTo = function (a, n, r) {\r\n var i = Math.min(this.t + a.t, n);\r\n r.s = 0; // assumes a,this >= 0\r\n r.t = i;\r\n while (i > 0) {\r\n r[--i] = 0;\r\n }\r\n for (var j = r.t - this.t; i < j; ++i) {\r\n r[i + this.t] = this.am(0, a[i], r, i, 0, this.t);\r\n }\r\n for (var j = Math.min(a.t, n); i < j; ++i) {\r\n this.am(0, a[i], r, i, 0, n - i);\r\n }\r\n r.clamp();\r\n };\r\n // BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;\r\n // (protected) r = \"this * a\" without lower n words, n > 0\r\n // \"this\" should be the larger one if appropriate.\r\n BigInteger.prototype.multiplyUpperTo = function (a, n, r) {\r\n --n;\r\n var i = r.t = this.t + a.t - n;\r\n r.s = 0; // assumes a,this >= 0\r\n while (--i >= 0) {\r\n r[i] = 0;\r\n }\r\n for (i = Math.max(n - this.t, 0); i < a.t; ++i) {\r\n r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n);\r\n }\r\n r.clamp();\r\n r.drShiftTo(1, r);\r\n };\r\n // BigInteger.prototype.modInt = bnpModInt;\r\n // (protected) this % n, n < 2^26\r\n BigInteger.prototype.modInt = function (n) {\r\n if (n <= 0) {\r\n return 0;\r\n }\r\n var d = this.DV % n;\r\n var r = (this.s < 0) ? n - 1 : 0;\r\n if (this.t > 0) {\r\n if (d == 0) {\r\n r = this[0] % n;\r\n }\r\n else {\r\n for (var i = this.t - 1; i >= 0; --i) {\r\n r = (d * r + this[i]) % n;\r\n }\r\n }\r\n }\r\n return r;\r\n };\r\n // BigInteger.prototype.millerRabin = bnpMillerRabin;\r\n // (protected) true if probably prime (HAC 4.24, Miller-Rabin)\r\n BigInteger.prototype.millerRabin = function (t) {\r\n var n1 = this.subtract(BigInteger.ONE);\r\n var k = n1.getLowestSetBit();\r\n if (k <= 0) {\r\n return false;\r\n }\r\n var r = n1.shiftRight(k);\r\n t = (t + 1) >> 1;\r\n if (t > lowprimes.length) {\r\n t = lowprimes.length;\r\n }\r\n var a = nbi();\r\n for (var i = 0; i < t; ++i) {\r\n // Pick bases at random, instead of starting at 2\r\n a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);\r\n var y = a.modPow(r, this);\r\n if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {\r\n var j = 1;\r\n while (j++ < k && y.compareTo(n1) != 0) {\r\n y = y.modPowInt(2, this);\r\n if (y.compareTo(BigInteger.ONE) == 0) {\r\n return false;\r\n }\r\n }\r\n if (y.compareTo(n1) != 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n // BigInteger.prototype.square = bnSquare;\r\n // (public) this^2\r\n BigInteger.prototype.square = function () {\r\n var r = nbi();\r\n this.squareTo(r);\r\n return r;\r\n };\r\n //#region ASYNC\r\n // Public API method\r\n BigInteger.prototype.gcda = function (a, callback) {\r\n var x = (this.s < 0) ? this.negate() : this.clone();\r\n var y = (a.s < 0) ? a.negate() : a.clone();\r\n if (x.compareTo(y) < 0) {\r\n var t = x;\r\n x = y;\r\n y = t;\r\n }\r\n var i = x.getLowestSetBit();\r\n var g = y.getLowestSetBit();\r\n if (g < 0) {\r\n callback(x);\r\n return;\r\n }\r\n if (i < g) {\r\n g = i;\r\n }\r\n if (g > 0) {\r\n x.rShiftTo(g, x);\r\n y.rShiftTo(g, y);\r\n }\r\n // Workhorse of the algorithm, gets called 200 - 800 times per 512 bit keygen.\r\n var gcda1 = function () {\r\n if ((i = x.getLowestSetBit()) > 0) {\r\n x.rShiftTo(i, x);\r\n }\r\n if ((i = y.getLowestSetBit()) > 0) {\r\n y.rShiftTo(i, y);\r\n }\r\n if (x.compareTo(y) >= 0) {\r\n x.subTo(y, x);\r\n x.rShiftTo(1, x);\r\n }\r\n else {\r\n y.subTo(x, y);\r\n y.rShiftTo(1, y);\r\n }\r\n if (!(x.signum() > 0)) {\r\n if (g > 0) {\r\n y.lShiftTo(g, y);\r\n }\r\n setTimeout(function () { callback(y); }, 0); // escape\r\n }\r\n else {\r\n setTimeout(gcda1, 0);\r\n }\r\n };\r\n setTimeout(gcda1, 10);\r\n };\r\n // (protected) alternate constructor\r\n BigInteger.prototype.fromNumberAsync = function (a, b, c, callback) {\r\n if (\"number\" == typeof b) {\r\n if (a < 2) {\r\n this.fromInt(1);\r\n }\r\n else {\r\n this.fromNumber(a, c);\r\n if (!this.testBit(a - 1)) {\r\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this);\r\n }\r\n if (this.isEven()) {\r\n this.dAddOffset(1, 0);\r\n }\r\n var bnp_1 = this;\r\n var bnpfn1_1 = function () {\r\n bnp_1.dAddOffset(2, 0);\r\n if (bnp_1.bitLength() > a) {\r\n bnp_1.subTo(BigInteger.ONE.shiftLeft(a - 1), bnp_1);\r\n }\r\n if (bnp_1.isProbablePrime(b)) {\r\n setTimeout(function () { callback(); }, 0); // escape\r\n }\r\n else {\r\n setTimeout(bnpfn1_1, 0);\r\n }\r\n };\r\n setTimeout(bnpfn1_1, 0);\r\n }\r\n }\r\n else {\r\n var x = [];\r\n var t = a & 7;\r\n x.length = (a >> 3) + 1;\r\n b.nextBytes(x);\r\n if (t > 0) {\r\n x[0] &= ((1 << t) - 1);\r\n }\r\n else {\r\n x[0] = 0;\r\n }\r\n this.fromString(x, 256);\r\n }\r\n };\r\n return BigInteger;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'BigInteger', { enumerable: true, configurable: true, get: function() { return BigInteger; } });\r\n//#region REDUCERS\r\n//#region NullExp\r\nvar NullExp = /** @class */ (function () {\r\n function NullExp() {\r\n }\r\n // NullExp.prototype.convert = nNop;\r\n NullExp.prototype.convert = function (x) {\r\n return x;\r\n };\r\n // NullExp.prototype.revert = nNop;\r\n NullExp.prototype.revert = function (x) {\r\n return x;\r\n };\r\n // NullExp.prototype.mulTo = nMulTo;\r\n NullExp.prototype.mulTo = function (x, y, r) {\r\n x.multiplyTo(y, r);\r\n };\r\n // NullExp.prototype.sqrTo = nSqrTo;\r\n NullExp.prototype.sqrTo = function (x, r) {\r\n x.squareTo(r);\r\n };\r\n return NullExp;\r\n}());\r\n// Modular reduction using \"classic\" algorithm\r\nvar Classic = /** @class */ (function () {\r\n function Classic(m) {\r\n this.m = m;\r\n }\r\n // Classic.prototype.convert = cConvert;\r\n Classic.prototype.convert = function (x) {\r\n if (x.s < 0 || x.compareTo(this.m) >= 0) {\r\n return x.mod(this.m);\r\n }\r\n else {\r\n return x;\r\n }\r\n };\r\n // Classic.prototype.revert = cRevert;\r\n Classic.prototype.revert = function (x) {\r\n return x;\r\n };\r\n // Classic.prototype.reduce = cReduce;\r\n Classic.prototype.reduce = function (x) {\r\n x.divRemTo(this.m, null, x);\r\n };\r\n // Classic.prototype.mulTo = cMulTo;\r\n Classic.prototype.mulTo = function (x, y, r) {\r\n x.multiplyTo(y, r);\r\n this.reduce(r);\r\n };\r\n // Classic.prototype.sqrTo = cSqrTo;\r\n Classic.prototype.sqrTo = function (x, r) {\r\n x.squareTo(r);\r\n this.reduce(r);\r\n };\r\n return Classic;\r\n}());\r\n//#endregion\r\n//#region Montgomery\r\n// Montgomery reduction\r\nvar Montgomery = /** @class */ (function () {\r\n function Montgomery(m) {\r\n this.m = m;\r\n this.mp = m.invDigit();\r\n this.mpl = this.mp & 0x7fff;\r\n this.mph = this.mp >> 15;\r\n this.um = (1 << (m.DB - 15)) - 1;\r\n this.mt2 = 2 * m.t;\r\n }\r\n // Montgomery.prototype.convert = montConvert;\r\n // xR mod m\r\n Montgomery.prototype.convert = function (x) {\r\n var r = nbi();\r\n x.abs().dlShiftTo(this.m.t, r);\r\n r.divRemTo(this.m, null, r);\r\n if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) {\r\n this.m.subTo(r, r);\r\n }\r\n return r;\r\n };\r\n // Montgomery.prototype.revert = montRevert;\r\n // x/R mod m\r\n Montgomery.prototype.revert = function (x) {\r\n var r = nbi();\r\n x.copyTo(r);\r\n this.reduce(r);\r\n return r;\r\n };\r\n // Montgomery.prototype.reduce = montReduce;\r\n // x = x/R mod m (HAC 14.32)\r\n Montgomery.prototype.reduce = function (x) {\r\n while (x.t <= this.mt2) {\r\n // pad x so am has enough room later\r\n x[x.t++] = 0;\r\n }\r\n for (var i = 0; i < this.m.t; ++i) {\r\n // faster way of calculating u0 = x[i]*mp mod DV\r\n var j = x[i] & 0x7fff;\r\n var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM;\r\n // use am to combine the multiply-shift-add into one call\r\n j = i + this.m.t;\r\n x[j] += this.m.am(0, u0, x, i, 0, this.m.t);\r\n // propagate carry\r\n while (x[j] >= x.DV) {\r\n x[j] -= x.DV;\r\n x[++j]++;\r\n }\r\n }\r\n x.clamp();\r\n x.drShiftTo(this.m.t, x);\r\n if (x.compareTo(this.m) >= 0) {\r\n x.subTo(this.m, x);\r\n }\r\n };\r\n // Montgomery.prototype.mulTo = montMulTo;\r\n // r = \"xy/R mod m\"; x,y != r\r\n Montgomery.prototype.mulTo = function (x, y, r) {\r\n x.multiplyTo(y, r);\r\n this.reduce(r);\r\n };\r\n // Montgomery.prototype.sqrTo = montSqrTo;\r\n // r = \"x^2/R mod m\"; x != r\r\n Montgomery.prototype.sqrTo = function (x, r) {\r\n x.squareTo(r);\r\n this.reduce(r);\r\n };\r\n return Montgomery;\r\n}());\r\n//#endregion Montgomery\r\n//#region Barrett\r\n// Barrett modular reduction\r\nvar Barrett = /** @class */ (function () {\r\n function Barrett(m) {\r\n this.m = m;\r\n // setup Barrett\r\n this.r2 = nbi();\r\n this.q3 = nbi();\r\n BigInteger.ONE.dlShiftTo(2 * m.t, this.r2);\r\n this.mu = this.r2.divide(m);\r\n }\r\n // Barrett.prototype.convert = barrettConvert;\r\n Barrett.prototype.convert = function (x) {\r\n if (x.s < 0 || x.t > 2 * this.m.t) {\r\n return x.mod(this.m);\r\n }\r\n else if (x.compareTo(this.m) < 0) {\r\n return x;\r\n }\r\n else {\r\n var r = nbi();\r\n x.copyTo(r);\r\n this.reduce(r);\r\n return r;\r\n }\r\n };\r\n // Barrett.prototype.revert = barrettRevert;\r\n Barrett.prototype.revert = function (x) {\r\n return x;\r\n };\r\n // Barrett.prototype.reduce = barrettReduce;\r\n // x = x mod m (HAC 14.42)\r\n Barrett.prototype.reduce = function (x) {\r\n x.drShiftTo(this.m.t - 1, this.r2);\r\n if (x.t > this.m.t + 1) {\r\n x.t = this.m.t + 1;\r\n x.clamp();\r\n }\r\n this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3);\r\n this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);\r\n while (x.compareTo(this.r2) < 0) {\r\n x.dAddOffset(1, this.m.t + 1);\r\n }\r\n x.subTo(this.r2, x);\r\n while (x.compareTo(this.m) >= 0) {\r\n x.subTo(this.m, x);\r\n }\r\n };\r\n // Barrett.prototype.mulTo = barrettMulTo;\r\n // r = x*y mod m; x,y != r\r\n Barrett.prototype.mulTo = function (x, y, r) {\r\n x.multiplyTo(y, r);\r\n this.reduce(r);\r\n };\r\n // Barrett.prototype.sqrTo = barrettSqrTo;\r\n // r = x^2 mod m; x != r\r\n Barrett.prototype.sqrTo = function (x, r) {\r\n x.squareTo(r);\r\n this.reduce(r);\r\n };\r\n return Barrett;\r\n}());\r\n//#endregion\r\n//#endregion REDUCERS\r\n// return new, unset BigInteger\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function nbi() { return new BigInteger(null); };exports.nbi = nbi\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function parseBigInt(str, r) {\r\n return new BigInteger(str, r);\r\n};exports.parseBigInt = parseBigInt\r\n// am: Compute w_j += (x*this_i), propagate carries,\r\n// c is initial carry, returns final carry.\r\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\r\n// We need to select the fastest one that works in this environment.\r\nvar inBrowser = typeof navigator !== \"undefined\";\r\nif (inBrowser && j_lm && (navigator.appName == \"Microsoft Internet Explorer\")) {\r\n // am2 avoids a big mult-and-extract completely.\r\n // Max digit bits should be <= 30 because we do bitwise ops\r\n // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\r\n BigInteger.prototype.am = function am2(i, x, w, j, c, n) {\r\n var xl = x & 0x7fff;\r\n var xh = x >> 15;\r\n while (--n >= 0) {\r\n var l = this[i] & 0x7fff;\r\n var h = this[i++] >> 15;\r\n var m = xh * l + h * xl;\r\n l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\r\n c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\r\n w[j++] = l & 0x3fffffff;\r\n }\r\n return c;\r\n };\r\n dbits = 30;\r\n}\r\nelse if (inBrowser && j_lm && (navigator.appName != \"Netscape\")) {\r\n // am1: use a single mult and divide to get the high bits,\r\n // max digit bits should be 26 because\r\n // max internal value = 2*dvalue^2-2*dvalue (< 2^53)\r\n BigInteger.prototype.am = function am1(i, x, w, j, c, n) {\r\n while (--n >= 0) {\r\n var v = x * this[i++] + w[j] + c;\r\n c = Math.floor(v / 0x4000000);\r\n w[j++] = v & 0x3ffffff;\r\n }\r\n return c;\r\n };\r\n dbits = 26;\r\n}\r\nelse { // Mozilla/Netscape seems to prefer am3\r\n // Alternately, set max digit bits to 28 since some\r\n // browsers slow down when dealing with 32-bit numbers.\r\n BigInteger.prototype.am = function am3(i, x, w, j, c, n) {\r\n var xl = x & 0x3fff;\r\n var xh = x >> 14;\r\n while (--n >= 0) {\r\n var l = this[i] & 0x3fff;\r\n var h = this[i++] >> 14;\r\n var m = xh * l + h * xl;\r\n l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\r\n c = (l >> 28) + (m >> 14) + xh * h;\r\n w[j++] = l & 0xfffffff;\r\n }\r\n return c;\r\n };\r\n dbits = 28;\r\n}\r\nBigInteger.prototype.DB = dbits;\r\nBigInteger.prototype.DM = ((1 << dbits) - 1);\r\nBigInteger.prototype.DV = (1 << dbits);\r\nvar BI_FP = 52;\r\nBigInteger.prototype.FV = Math.pow(2, BI_FP);\r\nBigInteger.prototype.F1 = BI_FP - dbits;\r\nBigInteger.prototype.F2 = 2 * dbits - BI_FP;\r\n// Digit conversions\r\nvar BI_RC = [];\r\nvar rr;\r\nvar vv;\r\nrr = \"0\".charCodeAt(0);\r\nfor (vv = 0; vv <= 9; ++vv) {\r\n BI_RC[rr++] = vv;\r\n}\r\nrr = \"a\".charCodeAt(0);\r\nfor (vv = 10; vv < 36; ++vv) {\r\n BI_RC[rr++] = vv;\r\n}\r\nrr = \"A\".charCodeAt(0);\r\nfor (vv = 10; vv < 36; ++vv) {\r\n BI_RC[rr++] = vv;\r\n}\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function intAt(s, i) {\r\n var c = BI_RC[s.charCodeAt(i)];\r\n return (c == null) ? -1 : c;\r\n};exports.intAt = intAt\r\n// return bigint initialized to value\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function nbv(i) {\r\n var r = nbi();\r\n r.fromInt(i);\r\n return r;\r\n};exports.nbv = nbv\r\n// returns bit length of the integer x\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function nbits(x) {\r\n var r = 1;\r\n var t;\r\n if ((t = x >>> 16) != 0) {\r\n x = t;\r\n r += 16;\r\n }\r\n if ((t = x >> 8) != 0) {\r\n x = t;\r\n r += 8;\r\n }\r\n if ((t = x >> 4) != 0) {\r\n x = t;\r\n r += 4;\r\n }\r\n if ((t = x >> 2) != 0) {\r\n x = t;\r\n r += 2;\r\n }\r\n if ((t = x >> 1) != 0) {\r\n x = t;\r\n r += 1;\r\n }\r\n return r;\r\n};exports.nbits = nbits\r\n// \"constants\"\r\nBigInteger.ZERO = nbv(0);\r\nBigInteger.ONE = nbv(1);\r\n","// Random number generator - requires a PRNG backend, e.g. prng4.js\r\nvar __TEMP__ = require('./prng4');var prng_newstate = __TEMP__['prng_newstate'];var rng_psize = __TEMP__['rng_psize'];\r\nvar rng_state;\r\nvar rng_pool = null;\r\nvar rng_pptr;\r\n// Initialize the pool with junk if needed.\r\nif (rng_pool == null) {\r\n rng_pool = [];\r\n rng_pptr = 0;\r\n var t = void 0;\r\n // Use mouse events for entropy, if we do not have enough entropy by the time\r\n // we need it, entropy will be generated by Math.random.\r\n var count = 0;\r\n var onMouseMoveListener = function (ev) {\r\n count = count || 0;\r\n if (count >= 256 || rng_pptr >= rng_psize) {\r\n return;\r\n }\r\n try {\r\n var mouseCoordinates = ev.x + ev.y;\r\n rng_pool[rng_pptr++] = mouseCoordinates & 255;\r\n count += 1;\r\n }\r\n catch (e) {\r\n // Sometimes Firefox will deny permission to access event properties for some reason. Ignore.\r\n }\r\n };\r\n}\r\nfunction rng_get_byte() {\r\n if (rng_state == null) {\r\n rng_state = prng_newstate();\r\n // At this point, we may not have collected enough entropy. If not, fall back to Math.random\r\n while (rng_pptr < rng_psize) {\r\n var random = Math.floor(65536 * Math.random());\r\n rng_pool[rng_pptr++] = random & 255;\r\n }\r\n rng_state.init(rng_pool);\r\n for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) {\r\n rng_pool[rng_pptr] = 0;\r\n }\r\n rng_pptr = 0;\r\n }\r\n // TODO: allow reseeding after first request\r\n return rng_state.next();\r\n}\r\nvar SecureRandom = /** @class */ (function () {\r\n function SecureRandom() {\r\n }\r\n SecureRandom.prototype.nextBytes = function (ba) {\r\n for (var i = 0; i < ba.length; ++i) {\r\n ba[i] = rng_get_byte();\r\n }\r\n };\r\n return SecureRandom;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'SecureRandom', { enumerable: true, configurable: true, get: function() { return SecureRandom; } });\r\n","// prng4.js - uses Arcfour as a PRNG\r\nvar Arcfour = /** @class */ (function () {\r\n function Arcfour() {\r\n this.i = 0;\r\n this.j = 0;\r\n this.S = [];\r\n }\r\n // Arcfour.prototype.init = ARC4init;\r\n // Initialize arcfour context from key, an array of ints, each from [0..255]\r\n Arcfour.prototype.init = function (key) {\r\n var i;\r\n var j;\r\n var t;\r\n for (i = 0; i < 256; ++i) {\r\n this.S[i] = i;\r\n }\r\n j = 0;\r\n for (i = 0; i < 256; ++i) {\r\n j = (j + this.S[i] + key[i % key.length]) & 255;\r\n t = this.S[i];\r\n this.S[i] = this.S[j];\r\n this.S[j] = t;\r\n }\r\n this.i = 0;\r\n this.j = 0;\r\n };\r\n // Arcfour.prototype.next = ARC4next;\r\n Arcfour.prototype.next = function () {\r\n var t;\r\n this.i = (this.i + 1) & 255;\r\n this.j = (this.j + this.S[this.i]) & 255;\r\n t = this.S[this.i];\r\n this.S[this.i] = this.S[this.j];\r\n this.S[this.j] = t;\r\n return this.S[(t + this.S[this.i]) & 255];\r\n };\r\n return Arcfour;\r\n}());\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });Object.defineProperty(exports, 'Arcfour', { enumerable: true, configurable: true, get: function() { return Arcfour; } });\r\n// Plug in your RNG constructor here\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });function prng_newstate() {\r\n return new Arcfour();\r\n};exports.prng_newstate = prng_newstate\r\n// Pool size must be a multiple of 4 and greater than 32.\r\n// An array of bytes the size of the pool will be passed to init()\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var rng_psize = exports.rng_psize = 256;\r\n","/* asn1-1.0.13.js (c) 2013-2017 Kenji Urushima | kjur.github.com/jsrsasign/license\r\n */\r\n/*\r\n * asn1.js - ASN.1 DER encoder classes\r\n *\r\n * Copyright (c) 2013-2017 Kenji Urushima (kenji.urushima@gmail.com)\r\n *\r\n * This software is licensed under the terms of the MIT License.\r\n * https://kjur.github.io/jsrsasign/license\r\n *\r\n * The above copyright and license notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n */\r\nvar __TEMP__ = require('../jsbn/jsbn');var BigInteger = __TEMP__['BigInteger'];\r\nvar __TEMP__ = require('./yahoo');var YAHOO = __TEMP__['YAHOO'];\r\n/**\r\n * @fileOverview\r\n * @name asn1-1.0.js\r\n * @author Kenji Urushima kenji.urushima@gmail.com\r\n * @version asn1 1.0.13 (2017-Jun-02)\r\n * @since jsrsasign 2.1\r\n * @license MIT License\r\n */\r\n/**\r\n * kjur's class library name space\r\n *

\r\n * This name space provides following name spaces:\r\n *

    \r\n *
  • {@link KJUR.asn1} - ASN.1 primitive hexadecimal encoder
  • \r\n *
  • {@link KJUR.asn1.x509} - ASN.1 structure for X.509 certificate and CRL
  • \r\n *
  • {@link KJUR.crypto} - Java Cryptographic Extension(JCE) style MessageDigest/Signature\r\n * class and utilities
  • \r\n *
\r\n *

\r\n * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.\r\n * @name KJUR\r\n * @namespace kjur's class library name space\r\n */\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var KJUR = exports.KJUR = {};\r\n/**\r\n * kjur's ASN.1 class library name space\r\n *

\r\n * This is ITU-T X.690 ASN.1 DER encoder class library and\r\n * class structure and methods is very similar to\r\n * org.bouncycastle.asn1 package of\r\n * well known BouncyCaslte Cryptography Library.\r\n *

PROVIDING ASN.1 PRIMITIVES

\r\n * Here are ASN.1 DER primitive classes.\r\n *
    \r\n *
  • 0x01 {@link KJUR.asn1.DERBoolean}
  • \r\n *
  • 0x02 {@link KJUR.asn1.DERInteger}
  • \r\n *
  • 0x03 {@link KJUR.asn1.DERBitString}
  • \r\n *
  • 0x04 {@link KJUR.asn1.DEROctetString}
  • \r\n *
  • 0x05 {@link KJUR.asn1.DERNull}
  • \r\n *
  • 0x06 {@link KJUR.asn1.DERObjectIdentifier}
  • \r\n *
  • 0x0a {@link KJUR.asn1.DEREnumerated}
  • \r\n *
  • 0x0c {@link KJUR.asn1.DERUTF8String}
  • \r\n *
  • 0x12 {@link KJUR.asn1.DERNumericString}
  • \r\n *
  • 0x13 {@link KJUR.asn1.DERPrintableString}
  • \r\n *
  • 0x14 {@link KJUR.asn1.DERTeletexString}
  • \r\n *
  • 0x16 {@link KJUR.asn1.DERIA5String}
  • \r\n *
  • 0x17 {@link KJUR.asn1.DERUTCTime}
  • \r\n *
  • 0x18 {@link KJUR.asn1.DERGeneralizedTime}
  • \r\n *
  • 0x30 {@link KJUR.asn1.DERSequence}
  • \r\n *
  • 0x31 {@link KJUR.asn1.DERSet}
  • \r\n *
\r\n *

OTHER ASN.1 CLASSES

\r\n *
    \r\n *
  • {@link KJUR.asn1.ASN1Object}
  • \r\n *
  • {@link KJUR.asn1.DERAbstractString}
  • \r\n *
  • {@link KJUR.asn1.DERAbstractTime}
  • \r\n *
  • {@link KJUR.asn1.DERAbstractStructured}
  • \r\n *
  • {@link KJUR.asn1.DERTaggedObject}
  • \r\n *
\r\n *

SUB NAME SPACES

\r\n *
    \r\n *
  • {@link KJUR.asn1.cades} - CAdES long term signature format
  • \r\n *
  • {@link KJUR.asn1.cms} - Cryptographic Message Syntax
  • \r\n *
  • {@link KJUR.asn1.csr} - Certificate Signing Request (CSR/PKCS#10)
  • \r\n *
  • {@link KJUR.asn1.tsp} - RFC 3161 Timestamping Protocol Format
  • \r\n *
  • {@link KJUR.asn1.x509} - RFC 5280 X.509 certificate and CRL
  • \r\n *
\r\n *

\r\n * NOTE: Please ignore method summary and document of this namespace.\r\n * This caused by a bug of jsdoc2.\r\n * @name KJUR.asn1\r\n * @namespace\r\n */\r\nif (typeof KJUR.asn1 == \"undefined\" || !KJUR.asn1)\r\n KJUR.asn1 = {};\r\n/**\r\n * ASN1 utilities class\r\n * @name KJUR.asn1.ASN1Util\r\n * @class ASN1 utilities class\r\n * @since asn1 1.0.2\r\n */\r\nKJUR.asn1.ASN1Util = new function () {\r\n this.integerToByteHex = function (i) {\r\n var h = i.toString(16);\r\n if ((h.length % 2) == 1)\r\n h = '0' + h;\r\n return h;\r\n };\r\n this.bigIntToMinTwosComplementsHex = function (bigIntegerValue) {\r\n var h = bigIntegerValue.toString(16);\r\n if (h.substr(0, 1) != '-') {\r\n if (h.length % 2 == 1) {\r\n h = '0' + h;\r\n }\r\n else {\r\n if (!h.match(/^[0-7]/)) {\r\n h = '00' + h;\r\n }\r\n }\r\n }\r\n else {\r\n var hPos = h.substr(1);\r\n var xorLen = hPos.length;\r\n if (xorLen % 2 == 1) {\r\n xorLen += 1;\r\n }\r\n else {\r\n if (!h.match(/^[0-7]/)) {\r\n xorLen += 2;\r\n }\r\n }\r\n var hMask = '';\r\n for (var i = 0; i < xorLen; i++) {\r\n hMask += 'f';\r\n }\r\n var biMask = new BigInteger(hMask, 16);\r\n var biNeg = biMask.xor(bigIntegerValue).add(BigInteger.ONE);\r\n h = biNeg.toString(16).replace(/^-/, '');\r\n }\r\n return h;\r\n };\r\n /**\r\n * get PEM string from hexadecimal data and header string\r\n * @name getPEMStringFromHex\r\n * @memberOf KJUR.asn1.ASN1Util\r\n * @function\r\n * @param {String} dataHex hexadecimal string of PEM body\r\n * @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY')\r\n * @return {String} PEM formatted string of input data\r\n * @description\r\n * This method converts a hexadecimal string to a PEM string with\r\n * a specified header. Its line break will be CRLF(\"\\r\\n\").\r\n * @example\r\n * var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY');\r\n * // value of pem will be:\r\n * -----BEGIN PRIVATE KEY-----\r\n * YWFh\r\n * -----END PRIVATE KEY-----\r\n */\r\n this.getPEMStringFromHex = function (dataHex, pemHeader) {\r\n return hextopem(dataHex, pemHeader);\r\n };\r\n /**\r\n * generate ASN1Object specifed by JSON parameters\r\n * @name newObject\r\n * @memberOf KJUR.asn1.ASN1Util\r\n * @function\r\n * @param {Array} param JSON parameter to generate ASN1Object\r\n * @return {KJUR.asn1.ASN1Object} generated object\r\n * @since asn1 1.0.3\r\n * @description\r\n * generate any ASN1Object specified by JSON param\r\n * including ASN.1 primitive or structured.\r\n * Generally 'param' can be described as follows:\r\n *
\r\n * {TYPE-OF-ASNOBJ: ASN1OBJ-PARAMETER}\r\n *
\r\n * 'TYPE-OF-ASN1OBJ' can be one of following symbols:\r\n *
    \r\n *
  • 'bool' - DERBoolean
  • \r\n *
  • 'int' - DERInteger
  • \r\n *
  • 'bitstr' - DERBitString
  • \r\n *
  • 'octstr' - DEROctetString
  • \r\n *
  • 'null' - DERNull
  • \r\n *
  • 'oid' - DERObjectIdentifier
  • \r\n *
  • 'enum' - DEREnumerated
  • \r\n *
  • 'utf8str' - DERUTF8String
  • \r\n *
  • 'numstr' - DERNumericString
  • \r\n *
  • 'prnstr' - DERPrintableString
  • \r\n *
  • 'telstr' - DERTeletexString
  • \r\n *
  • 'ia5str' - DERIA5String
  • \r\n *
  • 'utctime' - DERUTCTime
  • \r\n *
  • 'gentime' - DERGeneralizedTime
  • \r\n *
  • 'seq' - DERSequence
  • \r\n *
  • 'set' - DERSet
  • \r\n *
  • 'tag' - DERTaggedObject
  • \r\n *
\r\n * @example\r\n * newObject({'prnstr': 'aaa'});\r\n * newObject({'seq': [{'int': 3}, {'prnstr': 'aaa'}]})\r\n * // ASN.1 Tagged Object\r\n * newObject({'tag': {'tag': 'a1',\r\n * 'explicit': true,\r\n * 'obj': {'seq': [{'int': 3}, {'prnstr': 'aaa'}]}}});\r\n * // more simple representation of ASN.1 Tagged Object\r\n * newObject({'tag': ['a1',\r\n * true,\r\n * {'seq': [\r\n * {'int': 3},\r\n * {'prnstr': 'aaa'}]}\r\n * ]});\r\n */\r\n this.newObject = function (param) {\r\n var _KJUR = KJUR, _KJUR_asn1 = _KJUR.asn1, _DERBoolean = _KJUR_asn1.DERBoolean, _DERInteger = _KJUR_asn1.DERInteger, _DERBitString = _KJUR_asn1.DERBitString, _DEROctetString = _KJUR_asn1.DEROctetString, _DERNull = _KJUR_asn1.DERNull, _DERObjectIdentifier = _KJUR_asn1.DERObjectIdentifier, _DEREnumerated = _KJUR_asn1.DEREnumerated, _DERUTF8String = _KJUR_asn1.DERUTF8String, _DERNumericString = _KJUR_asn1.DERNumericString, _DERPrintableString = _KJUR_asn1.DERPrintableString, _DERTeletexString = _KJUR_asn1.DERTeletexString, _DERIA5String = _KJUR_asn1.DERIA5String, _DERUTCTime = _KJUR_asn1.DERUTCTime, _DERGeneralizedTime = _KJUR_asn1.DERGeneralizedTime, _DERSequence = _KJUR_asn1.DERSequence, _DERSet = _KJUR_asn1.DERSet, _DERTaggedObject = _KJUR_asn1.DERTaggedObject, _newObject = _KJUR_asn1.ASN1Util.newObject;\r\n var keys = Object.keys(param);\r\n if (keys.length != 1)\r\n throw \"key of param shall be only one.\";\r\n var key = keys[0];\r\n if (\":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:\".indexOf(\":\" + key + \":\") == -1)\r\n throw \"undefined key: \" + key;\r\n if (key == \"bool\")\r\n return new _DERBoolean(param[key]);\r\n if (key == \"int\")\r\n return new _DERInteger(param[key]);\r\n if (key == \"bitstr\")\r\n return new _DERBitString(param[key]);\r\n if (key == \"octstr\")\r\n return new _DEROctetString(param[key]);\r\n if (key == \"null\")\r\n return new _DERNull(param[key]);\r\n if (key == \"oid\")\r\n return new _DERObjectIdentifier(param[key]);\r\n if (key == \"enum\")\r\n return new _DEREnumerated(param[key]);\r\n if (key == \"utf8str\")\r\n return new _DERUTF8String(param[key]);\r\n if (key == \"numstr\")\r\n return new _DERNumericString(param[key]);\r\n if (key == \"prnstr\")\r\n return new _DERPrintableString(param[key]);\r\n if (key == \"telstr\")\r\n return new _DERTeletexString(param[key]);\r\n if (key == \"ia5str\")\r\n return new _DERIA5String(param[key]);\r\n if (key == \"utctime\")\r\n return new _DERUTCTime(param[key]);\r\n if (key == \"gentime\")\r\n return new _DERGeneralizedTime(param[key]);\r\n if (key == \"seq\") {\r\n var paramList = param[key];\r\n var a = [];\r\n for (var i = 0; i < paramList.length; i++) {\r\n var asn1Obj = _newObject(paramList[i]);\r\n a.push(asn1Obj);\r\n }\r\n return new _DERSequence({ 'array': a });\r\n }\r\n if (key == \"set\") {\r\n var paramList = param[key];\r\n var a = [];\r\n for (var i = 0; i < paramList.length; i++) {\r\n var asn1Obj = _newObject(paramList[i]);\r\n a.push(asn1Obj);\r\n }\r\n return new _DERSet({ 'array': a });\r\n }\r\n if (key == \"tag\") {\r\n var tagParam = param[key];\r\n if (Object.prototype.toString.call(tagParam) === '[object Array]' &&\r\n tagParam.length == 3) {\r\n var obj = _newObject(tagParam[2]);\r\n return new _DERTaggedObject({ tag: tagParam[0],\r\n explicit: tagParam[1],\r\n obj: obj });\r\n }\r\n else {\r\n var newParam = {};\r\n if (tagParam.explicit !== undefined)\r\n newParam.explicit = tagParam.explicit;\r\n if (tagParam.tag !== undefined)\r\n newParam.tag = tagParam.tag;\r\n if (tagParam.obj === undefined)\r\n throw \"obj shall be specified for 'tag'.\";\r\n newParam.obj = _newObject(tagParam.obj);\r\n return new _DERTaggedObject(newParam);\r\n }\r\n }\r\n };\r\n /**\r\n * get encoded hexadecimal string of ASN1Object specifed by JSON parameters\r\n * @name jsonToASN1HEX\r\n * @memberOf KJUR.asn1.ASN1Util\r\n * @function\r\n * @param {Array} param JSON parameter to generate ASN1Object\r\n * @return hexadecimal string of ASN1Object\r\n * @since asn1 1.0.4\r\n * @description\r\n * As for ASN.1 object representation of JSON object,\r\n * please see {@link newObject}.\r\n * @example\r\n * jsonToASN1HEX({'prnstr': 'aaa'});\r\n */\r\n this.jsonToASN1HEX = function (param) {\r\n var asn1Obj = this.newObject(param);\r\n return asn1Obj.getEncodedHex();\r\n };\r\n};\r\n/**\r\n * get dot noted oid number string from hexadecimal value of OID\r\n * @name oidHexToInt\r\n * @memberOf KJUR.asn1.ASN1Util\r\n * @function\r\n * @param {String} hex hexadecimal value of object identifier\r\n * @return {String} dot noted string of object identifier\r\n * @since jsrsasign 4.8.3 asn1 1.0.7\r\n * @description\r\n * This static method converts from hexadecimal string representation of\r\n * ASN.1 value of object identifier to oid number string.\r\n * @example\r\n * KJUR.asn1.ASN1Util.oidHexToInt('550406') → \"2.5.4.6\"\r\n */\r\nKJUR.asn1.ASN1Util.oidHexToInt = function (hex) {\r\n var s = \"\";\r\n var i01 = parseInt(hex.substr(0, 2), 16);\r\n var i0 = Math.floor(i01 / 40);\r\n var i1 = i01 % 40;\r\n var s = i0 + \".\" + i1;\r\n var binbuf = \"\";\r\n for (var i = 2; i < hex.length; i += 2) {\r\n var value = parseInt(hex.substr(i, 2), 16);\r\n var bin = (\"00000000\" + value.toString(2)).slice(-8);\r\n binbuf = binbuf + bin.substr(1, 7);\r\n if (bin.substr(0, 1) == \"0\") {\r\n var bi = new BigInteger(binbuf, 2);\r\n s = s + \".\" + bi.toString(10);\r\n binbuf = \"\";\r\n }\r\n }\r\n ;\r\n return s;\r\n};\r\n/**\r\n * get hexadecimal value of object identifier from dot noted oid value\r\n * @name oidIntToHex\r\n * @memberOf KJUR.asn1.ASN1Util\r\n * @function\r\n * @param {String} oidString dot noted string of object identifier\r\n * @return {String} hexadecimal value of object identifier\r\n * @since jsrsasign 4.8.3 asn1 1.0.7\r\n * @description\r\n * This static method converts from object identifier value string.\r\n * to hexadecimal string representation of it.\r\n * @example\r\n * KJUR.asn1.ASN1Util.oidIntToHex(\"2.5.4.6\") → \"550406\"\r\n */\r\nKJUR.asn1.ASN1Util.oidIntToHex = function (oidString) {\r\n var itox = function (i) {\r\n var h = i.toString(16);\r\n if (h.length == 1)\r\n h = '0' + h;\r\n return h;\r\n };\r\n var roidtox = function (roid) {\r\n var h = '';\r\n var bi = new BigInteger(roid, 10);\r\n var b = bi.toString(2);\r\n var padLen = 7 - b.length % 7;\r\n if (padLen == 7)\r\n padLen = 0;\r\n var bPad = '';\r\n for (var i = 0; i < padLen; i++)\r\n bPad += '0';\r\n b = bPad + b;\r\n for (var i = 0; i < b.length - 1; i += 7) {\r\n var b8 = b.substr(i, 7);\r\n if (i != b.length - 7)\r\n b8 = '1' + b8;\r\n h += itox(parseInt(b8, 2));\r\n }\r\n return h;\r\n };\r\n if (!oidString.match(/^[0-9.]+$/)) {\r\n throw \"malformed oid string: \" + oidString;\r\n }\r\n var h = '';\r\n var a = oidString.split('.');\r\n var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);\r\n h += itox(i0);\r\n a.splice(0, 2);\r\n for (var i = 0; i < a.length; i++) {\r\n h += roidtox(a[i]);\r\n }\r\n return h;\r\n};\r\n// ********************************************************************\r\n// Abstract ASN.1 Classes\r\n// ********************************************************************\r\n// ********************************************************************\r\n/**\r\n * base class for ASN.1 DER encoder object\r\n * @name KJUR.asn1.ASN1Object\r\n * @class base class for ASN.1 DER encoder object\r\n * @property {Boolean} isModified flag whether internal data was changed\r\n * @property {String} hTLV hexadecimal string of ASN.1 TLV\r\n * @property {String} hT hexadecimal string of ASN.1 TLV tag(T)\r\n * @property {String} hL hexadecimal string of ASN.1 TLV length(L)\r\n * @property {String} hV hexadecimal string of ASN.1 TLV value(V)\r\n * @description\r\n */\r\nKJUR.asn1.ASN1Object = function () {\r\n var isModified = true;\r\n var hTLV = null;\r\n var hT = '00';\r\n var hL = '00';\r\n var hV = '';\r\n /**\r\n * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V)\r\n * @name getLengthHexFromValue\r\n * @memberOf KJUR.asn1.ASN1Object#\r\n * @function\r\n * @return {String} hexadecimal string of ASN.1 TLV length(L)\r\n */\r\n this.getLengthHexFromValue = function () {\r\n if (typeof this.hV == \"undefined\" || this.hV == null) {\r\n throw \"this.hV is null or undefined.\";\r\n }\r\n if (this.hV.length % 2 == 1) {\r\n throw \"value hex must be even length: n=\" + hV.length + \",v=\" + this.hV;\r\n }\r\n var n = this.hV.length / 2;\r\n var hN = n.toString(16);\r\n if (hN.length % 2 == 1) {\r\n hN = \"0\" + hN;\r\n }\r\n if (n < 128) {\r\n return hN;\r\n }\r\n else {\r\n var hNlen = hN.length / 2;\r\n if (hNlen > 15) {\r\n throw \"ASN.1 length too long to represent by 8x: n = \" + n.toString(16);\r\n }\r\n var head = 128 + hNlen;\r\n return head.toString(16) + hN;\r\n }\r\n };\r\n /**\r\n * get hexadecimal string of ASN.1 TLV bytes\r\n * @name getEncodedHex\r\n * @memberOf KJUR.asn1.ASN1Object#\r\n * @function\r\n * @return {String} hexadecimal string of ASN.1 TLV\r\n */\r\n this.getEncodedHex = function () {\r\n if (this.hTLV == null || this.isModified) {\r\n this.hV = this.getFreshValueHex();\r\n this.hL = this.getLengthHexFromValue();\r\n this.hTLV = this.hT + this.hL + this.hV;\r\n this.isModified = false;\r\n //alert(\"first time: \" + this.hTLV);\r\n }\r\n return this.hTLV;\r\n };\r\n /**\r\n * get hexadecimal string of ASN.1 TLV value(V) bytes\r\n * @name getValueHex\r\n * @memberOf KJUR.asn1.ASN1Object#\r\n * @function\r\n * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes\r\n */\r\n this.getValueHex = function () {\r\n this.getEncodedHex();\r\n return this.hV;\r\n };\r\n this.getFreshValueHex = function () {\r\n return '';\r\n };\r\n};\r\n// == BEGIN DERAbstractString ================================================\r\n/**\r\n * base class for ASN.1 DER string classes\r\n * @name KJUR.asn1.DERAbstractString\r\n * @class base class for ASN.1 DER string classes\r\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\r\n * @property {String} s internal string of value\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • str - specify initial ASN.1 value(V) by a string
  • \r\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \r\n *
\r\n * NOTE: 'params' can be omitted.\r\n */\r\nKJUR.asn1.DERAbstractString = function (params) {\r\n KJUR.asn1.DERAbstractString.superclass.constructor.call(this);\r\n var s = null;\r\n var hV = null;\r\n /**\r\n * get string value of this string object\r\n * @name getString\r\n * @memberOf KJUR.asn1.DERAbstractString#\r\n * @function\r\n * @return {String} string value of this string object\r\n */\r\n this.getString = function () {\r\n return this.s;\r\n };\r\n /**\r\n * set value by a string\r\n * @name setString\r\n * @memberOf KJUR.asn1.DERAbstractString#\r\n * @function\r\n * @param {String} newS value by a string to set\r\n */\r\n this.setString = function (newS) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.s = newS;\r\n this.hV = stohex(this.s);\r\n };\r\n /**\r\n * set value by a hexadecimal string\r\n * @name setStringHex\r\n * @memberOf KJUR.asn1.DERAbstractString#\r\n * @function\r\n * @param {String} newHexString value by a hexadecimal string to set\r\n */\r\n this.setStringHex = function (newHexString) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.s = null;\r\n this.hV = newHexString;\r\n };\r\n this.getFreshValueHex = function () {\r\n return this.hV;\r\n };\r\n if (typeof params != \"undefined\") {\r\n if (typeof params == \"string\") {\r\n this.setString(params);\r\n }\r\n else if (typeof params['str'] != \"undefined\") {\r\n this.setString(params['str']);\r\n }\r\n else if (typeof params['hex'] != \"undefined\") {\r\n this.setStringHex(params['hex']);\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object);\r\n// == END DERAbstractString ================================================\r\n// == BEGIN DERAbstractTime ==================================================\r\n/**\r\n * base class for ASN.1 DER Generalized/UTCTime class\r\n * @name KJUR.asn1.DERAbstractTime\r\n * @class base class for ASN.1 DER Generalized/UTCTime class\r\n * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n * @see KJUR.asn1.ASN1Object - superclass\r\n */\r\nKJUR.asn1.DERAbstractTime = function (params) {\r\n KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);\r\n var s = null;\r\n var date = null;\r\n // --- PRIVATE METHODS --------------------\r\n this.localDateToUTC = function (d) {\r\n utc = d.getTime() + (d.getTimezoneOffset() * 60000);\r\n var utcDate = new Date(utc);\r\n return utcDate;\r\n };\r\n /*\r\n * format date string by Data object\r\n * @name formatDate\r\n * @memberOf KJUR.asn1.AbstractTime;\r\n * @param {Date} dateObject\r\n * @param {string} type 'utc' or 'gen'\r\n * @param {boolean} withMillis flag for with millisections or not\r\n * @description\r\n * 'withMillis' flag is supported from asn1 1.0.6.\r\n */\r\n this.formatDate = function (dateObject, type, withMillis) {\r\n var pad = this.zeroPadding;\r\n var d = this.localDateToUTC(dateObject);\r\n var year = String(d.getFullYear());\r\n if (type == 'utc')\r\n year = year.substr(2, 2);\r\n var month = pad(String(d.getMonth() + 1), 2);\r\n var day = pad(String(d.getDate()), 2);\r\n var hour = pad(String(d.getHours()), 2);\r\n var min = pad(String(d.getMinutes()), 2);\r\n var sec = pad(String(d.getSeconds()), 2);\r\n var s = year + month + day + hour + min + sec;\r\n if (withMillis === true) {\r\n var millis = d.getMilliseconds();\r\n if (millis != 0) {\r\n var sMillis = pad(String(millis), 3);\r\n sMillis = sMillis.replace(/[0]+$/, \"\");\r\n s = s + \".\" + sMillis;\r\n }\r\n }\r\n return s + \"Z\";\r\n };\r\n this.zeroPadding = function (s, len) {\r\n if (s.length >= len)\r\n return s;\r\n return new Array(len - s.length + 1).join('0') + s;\r\n };\r\n // --- PUBLIC METHODS --------------------\r\n /**\r\n * get string value of this string object\r\n * @name getString\r\n * @memberOf KJUR.asn1.DERAbstractTime#\r\n * @function\r\n * @return {String} string value of this time object\r\n */\r\n this.getString = function () {\r\n return this.s;\r\n };\r\n /**\r\n * set value by a string\r\n * @name setString\r\n * @memberOf KJUR.asn1.DERAbstractTime#\r\n * @function\r\n * @param {String} newS value by a string to set such like \"130430235959Z\"\r\n */\r\n this.setString = function (newS) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.s = newS;\r\n this.hV = stohex(newS);\r\n };\r\n /**\r\n * set value by a Date object\r\n * @name setByDateValue\r\n * @memberOf KJUR.asn1.DERAbstractTime#\r\n * @function\r\n * @param {Integer} year year of date (ex. 2013)\r\n * @param {Integer} month month of date between 1 and 12 (ex. 12)\r\n * @param {Integer} day day of month\r\n * @param {Integer} hour hours of date\r\n * @param {Integer} min minutes of date\r\n * @param {Integer} sec seconds of date\r\n */\r\n this.setByDateValue = function (year, month, day, hour, min, sec) {\r\n var dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0));\r\n this.setByDate(dateObject);\r\n };\r\n this.getFreshValueHex = function () {\r\n return this.hV;\r\n };\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object);\r\n// == END DERAbstractTime ==================================================\r\n// == BEGIN DERAbstractStructured ============================================\r\n/**\r\n * base class for ASN.1 DER structured class\r\n * @name KJUR.asn1.DERAbstractStructured\r\n * @class base class for ASN.1 DER structured class\r\n * @property {Array} asn1Array internal array of ASN1Object\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n * @see KJUR.asn1.ASN1Object - superclass\r\n */\r\nKJUR.asn1.DERAbstractStructured = function (params) {\r\n KJUR.asn1.DERAbstractString.superclass.constructor.call(this);\r\n var asn1Array = null;\r\n /**\r\n * set value by array of ASN1Object\r\n * @name setByASN1ObjectArray\r\n * @memberOf KJUR.asn1.DERAbstractStructured#\r\n * @function\r\n * @param {array} asn1ObjectArray array of ASN1Object to set\r\n */\r\n this.setByASN1ObjectArray = function (asn1ObjectArray) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.asn1Array = asn1ObjectArray;\r\n };\r\n /**\r\n * append an ASN1Object to internal array\r\n * @name appendASN1Object\r\n * @memberOf KJUR.asn1.DERAbstractStructured#\r\n * @function\r\n * @param {ASN1Object} asn1Object to add\r\n */\r\n this.appendASN1Object = function (asn1Object) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.asn1Array.push(asn1Object);\r\n };\r\n this.asn1Array = new Array();\r\n if (typeof params != \"undefined\") {\r\n if (typeof params['array'] != \"undefined\") {\r\n this.asn1Array = params['array'];\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object);\r\n// ********************************************************************\r\n// ASN.1 Object Classes\r\n// ********************************************************************\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER Boolean\r\n * @name KJUR.asn1.DERBoolean\r\n * @class class for ASN.1 DER Boolean\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n * @see KJUR.asn1.ASN1Object - superclass\r\n */\r\nKJUR.asn1.DERBoolean = function () {\r\n KJUR.asn1.DERBoolean.superclass.constructor.call(this);\r\n this.hT = \"01\";\r\n this.hTLV = \"0101ff\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER Integer\r\n * @name KJUR.asn1.DERInteger\r\n * @class class for ASN.1 DER Integer\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • int - specify initial ASN.1 value(V) by integer value
  • \r\n *
  • bigint - specify initial ASN.1 value(V) by BigInteger object
  • \r\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \r\n *
\r\n * NOTE: 'params' can be omitted.\r\n */\r\nKJUR.asn1.DERInteger = function (params) {\r\n KJUR.asn1.DERInteger.superclass.constructor.call(this);\r\n this.hT = \"02\";\r\n /**\r\n * set value by Tom Wu's BigInteger object\r\n * @name setByBigInteger\r\n * @memberOf KJUR.asn1.DERInteger#\r\n * @function\r\n * @param {BigInteger} bigIntegerValue to set\r\n */\r\n this.setByBigInteger = function (bigIntegerValue) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);\r\n };\r\n /**\r\n * set value by integer value\r\n * @name setByInteger\r\n * @memberOf KJUR.asn1.DERInteger\r\n * @function\r\n * @param {Integer} integer value to set\r\n */\r\n this.setByInteger = function (intValue) {\r\n var bi = new BigInteger(String(intValue), 10);\r\n this.setByBigInteger(bi);\r\n };\r\n /**\r\n * set value by integer value\r\n * @name setValueHex\r\n * @memberOf KJUR.asn1.DERInteger#\r\n * @function\r\n * @param {String} hexadecimal string of integer value\r\n * @description\r\n *
\r\n * NOTE: Value shall be represented by minimum octet length of\r\n * two's complement representation.\r\n * @example\r\n * new KJUR.asn1.DERInteger(123);\r\n * new KJUR.asn1.DERInteger({'int': 123});\r\n * new KJUR.asn1.DERInteger({'hex': '1fad'});\r\n */\r\n this.setValueHex = function (newHexString) {\r\n this.hV = newHexString;\r\n };\r\n this.getFreshValueHex = function () {\r\n return this.hV;\r\n };\r\n if (typeof params != \"undefined\") {\r\n if (typeof params['bigint'] != \"undefined\") {\r\n this.setByBigInteger(params['bigint']);\r\n }\r\n else if (typeof params['int'] != \"undefined\") {\r\n this.setByInteger(params['int']);\r\n }\r\n else if (typeof params == \"number\") {\r\n this.setByInteger(params);\r\n }\r\n else if (typeof params['hex'] != \"undefined\") {\r\n this.setValueHex(params['hex']);\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER encoded BitString primitive\r\n * @name KJUR.asn1.DERBitString\r\n * @class class for ASN.1 DER encoded BitString primitive\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • bin - specify binary string (ex. '10111')
  • \r\n *
  • array - specify array of boolean (ex. [true,false,true,true])
  • \r\n *
  • hex - specify hexadecimal string of ASN.1 value(V) including unused bits
  • \r\n *
  • obj - specify {@link KJUR.asn1.ASN1Util.newObject}\r\n * argument for \"BitString encapsulates\" structure.
  • \r\n *
\r\n * NOTE1: 'params' can be omitted.
\r\n * NOTE2: 'obj' parameter have been supported since\r\n * asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).
\r\n * @example\r\n * // default constructor\r\n * o = new KJUR.asn1.DERBitString();\r\n * // initialize with binary string\r\n * o = new KJUR.asn1.DERBitString({bin: \"1011\"});\r\n * // initialize with boolean array\r\n * o = new KJUR.asn1.DERBitString({array: [true,false,true,true]});\r\n * // initialize with hexadecimal string (04 is unused bits)\r\n * o = new KJUR.asn1.DEROctetString({hex: \"04bac0\"});\r\n * // initialize with ASN1Util.newObject argument for encapsulated\r\n * o = new KJUR.asn1.DERBitString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}});\r\n * // above generates a ASN.1 data like this:\r\n * // BIT STRING, encapsulates {\r\n * // SEQUENCE {\r\n * // INTEGER 3\r\n * // PrintableString 'aaa'\r\n * // }\r\n * // }\r\n */\r\nKJUR.asn1.DERBitString = function (params) {\r\n if (params !== undefined && typeof params.obj !== \"undefined\") {\r\n var o = KJUR.asn1.ASN1Util.newObject(params.obj);\r\n params.hex = \"00\" + o.getEncodedHex();\r\n }\r\n KJUR.asn1.DERBitString.superclass.constructor.call(this);\r\n this.hT = \"03\";\r\n /**\r\n * set ASN.1 value(V) by a hexadecimal string including unused bits\r\n * @name setHexValueIncludingUnusedBits\r\n * @memberOf KJUR.asn1.DERBitString#\r\n * @function\r\n * @param {String} newHexStringIncludingUnusedBits\r\n */\r\n this.setHexValueIncludingUnusedBits = function (newHexStringIncludingUnusedBits) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.hV = newHexStringIncludingUnusedBits;\r\n };\r\n /**\r\n * set ASN.1 value(V) by unused bit and hexadecimal string of value\r\n * @name setUnusedBitsAndHexValue\r\n * @memberOf KJUR.asn1.DERBitString#\r\n * @function\r\n * @param {Integer} unusedBits\r\n * @param {String} hValue\r\n */\r\n this.setUnusedBitsAndHexValue = function (unusedBits, hValue) {\r\n if (unusedBits < 0 || 7 < unusedBits) {\r\n throw \"unused bits shall be from 0 to 7: u = \" + unusedBits;\r\n }\r\n var hUnusedBits = \"0\" + unusedBits;\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.hV = hUnusedBits + hValue;\r\n };\r\n /**\r\n * set ASN.1 DER BitString by binary string
\r\n * @name setByBinaryString\r\n * @memberOf KJUR.asn1.DERBitString#\r\n * @function\r\n * @param {String} binaryString binary value string (i.e. '10111')\r\n * @description\r\n * Its unused bits will be calculated automatically by length of\r\n * 'binaryValue'.
\r\n * NOTE: Trailing zeros '0' will be ignored.\r\n * @example\r\n * o = new KJUR.asn1.DERBitString();\r\n * o.setByBooleanArray(\"01011\");\r\n */\r\n this.setByBinaryString = function (binaryString) {\r\n binaryString = binaryString.replace(/0+$/, '');\r\n var unusedBits = 8 - binaryString.length % 8;\r\n if (unusedBits == 8)\r\n unusedBits = 0;\r\n for (var i = 0; i <= unusedBits; i++) {\r\n binaryString += '0';\r\n }\r\n var h = '';\r\n for (var i = 0; i < binaryString.length - 1; i += 8) {\r\n var b = binaryString.substr(i, 8);\r\n var x = parseInt(b, 2).toString(16);\r\n if (x.length == 1)\r\n x = '0' + x;\r\n h += x;\r\n }\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.hV = '0' + unusedBits + h;\r\n };\r\n /**\r\n * set ASN.1 TLV value(V) by an array of boolean
\r\n * @name setByBooleanArray\r\n * @memberOf KJUR.asn1.DERBitString#\r\n * @function\r\n * @param {array} booleanArray array of boolean (ex. [true, false, true])\r\n * @description\r\n * NOTE: Trailing falses will be ignored in the ASN.1 DER Object.\r\n * @example\r\n * o = new KJUR.asn1.DERBitString();\r\n * o.setByBooleanArray([false, true, false, true, true]);\r\n */\r\n this.setByBooleanArray = function (booleanArray) {\r\n var s = '';\r\n for (var i = 0; i < booleanArray.length; i++) {\r\n if (booleanArray[i] == true) {\r\n s += '1';\r\n }\r\n else {\r\n s += '0';\r\n }\r\n }\r\n this.setByBinaryString(s);\r\n };\r\n /**\r\n * generate an array of falses with specified length
\r\n * @name newFalseArray\r\n * @memberOf KJUR.asn1.DERBitString\r\n * @function\r\n * @param {Integer} nLength length of array to generate\r\n * @return {array} array of boolean falses\r\n * @description\r\n * This static method may be useful to initialize boolean array.\r\n * @example\r\n * o = new KJUR.asn1.DERBitString();\r\n * o.newFalseArray(3) → [false, false, false]\r\n */\r\n this.newFalseArray = function (nLength) {\r\n var a = new Array(nLength);\r\n for (var i = 0; i < nLength; i++) {\r\n a[i] = false;\r\n }\r\n return a;\r\n };\r\n this.getFreshValueHex = function () {\r\n return this.hV;\r\n };\r\n if (typeof params != \"undefined\") {\r\n if (typeof params == \"string\" && params.toLowerCase().match(/^[0-9a-f]+$/)) {\r\n this.setHexValueIncludingUnusedBits(params);\r\n }\r\n else if (typeof params['hex'] != \"undefined\") {\r\n this.setHexValueIncludingUnusedBits(params['hex']);\r\n }\r\n else if (typeof params['bin'] != \"undefined\") {\r\n this.setByBinaryString(params['bin']);\r\n }\r\n else if (typeof params['array'] != \"undefined\") {\r\n this.setByBooleanArray(params['array']);\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER OctetString
\r\n * @name KJUR.asn1.DEROctetString\r\n * @class class for ASN.1 DER OctetString\r\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\r\n * @extends KJUR.asn1.DERAbstractString\r\n * @description\r\n * This class provides ASN.1 OctetString simple type.
\r\n * Supported \"params\" attributes are:\r\n *
    \r\n *
  • str - to set a string as a value
  • \r\n *
  • hex - to set a hexadecimal string as a value
  • \r\n *
  • obj - to set a encapsulated ASN.1 value by JSON object\r\n * which is defined in {@link KJUR.asn1.ASN1Util.newObject}
  • \r\n *
\r\n * NOTE: A parameter 'obj' have been supported\r\n * for \"OCTET STRING, encapsulates\" structure.\r\n * since asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).\r\n * @see KJUR.asn1.DERAbstractString - superclass\r\n * @example\r\n * // default constructor\r\n * o = new KJUR.asn1.DEROctetString();\r\n * // initialize with string\r\n * o = new KJUR.asn1.DEROctetString({str: \"aaa\"});\r\n * // initialize with hexadecimal string\r\n * o = new KJUR.asn1.DEROctetString({hex: \"616161\"});\r\n * // initialize with ASN1Util.newObject argument\r\n * o = new KJUR.asn1.DEROctetString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}});\r\n * // above generates a ASN.1 data like this:\r\n * // OCTET STRING, encapsulates {\r\n * // SEQUENCE {\r\n * // INTEGER 3\r\n * // PrintableString 'aaa'\r\n * // }\r\n * // }\r\n */\r\nKJUR.asn1.DEROctetString = function (params) {\r\n if (params !== undefined && typeof params.obj !== \"undefined\") {\r\n var o = KJUR.asn1.ASN1Util.newObject(params.obj);\r\n params.hex = o.getEncodedHex();\r\n }\r\n KJUR.asn1.DEROctetString.superclass.constructor.call(this, params);\r\n this.hT = \"04\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER Null\r\n * @name KJUR.asn1.DERNull\r\n * @class class for ASN.1 DER Null\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n * @see KJUR.asn1.ASN1Object - superclass\r\n */\r\nKJUR.asn1.DERNull = function () {\r\n KJUR.asn1.DERNull.superclass.constructor.call(this);\r\n this.hT = \"05\";\r\n this.hTLV = \"0500\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER ObjectIdentifier\r\n * @name KJUR.asn1.DERObjectIdentifier\r\n * @class class for ASN.1 DER ObjectIdentifier\r\n * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'})\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)
  • \r\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \r\n *
\r\n * NOTE: 'params' can be omitted.\r\n */\r\nKJUR.asn1.DERObjectIdentifier = function (params) {\r\n var itox = function (i) {\r\n var h = i.toString(16);\r\n if (h.length == 1)\r\n h = '0' + h;\r\n return h;\r\n };\r\n var roidtox = function (roid) {\r\n var h = '';\r\n var bi = new BigInteger(roid, 10);\r\n var b = bi.toString(2);\r\n var padLen = 7 - b.length % 7;\r\n if (padLen == 7)\r\n padLen = 0;\r\n var bPad = '';\r\n for (var i = 0; i < padLen; i++)\r\n bPad += '0';\r\n b = bPad + b;\r\n for (var i = 0; i < b.length - 1; i += 7) {\r\n var b8 = b.substr(i, 7);\r\n if (i != b.length - 7)\r\n b8 = '1' + b8;\r\n h += itox(parseInt(b8, 2));\r\n }\r\n return h;\r\n };\r\n KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this);\r\n this.hT = \"06\";\r\n /**\r\n * set value by a hexadecimal string\r\n * @name setValueHex\r\n * @memberOf KJUR.asn1.DERObjectIdentifier#\r\n * @function\r\n * @param {String} newHexString hexadecimal value of OID bytes\r\n */\r\n this.setValueHex = function (newHexString) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.s = null;\r\n this.hV = newHexString;\r\n };\r\n /**\r\n * set value by a OID string
\r\n * @name setValueOidString\r\n * @memberOf KJUR.asn1.DERObjectIdentifier#\r\n * @function\r\n * @param {String} oidString OID string (ex. 2.5.4.13)\r\n * @example\r\n * o = new KJUR.asn1.DERObjectIdentifier();\r\n * o.setValueOidString(\"2.5.4.13\");\r\n */\r\n this.setValueOidString = function (oidString) {\r\n if (!oidString.match(/^[0-9.]+$/)) {\r\n throw \"malformed oid string: \" + oidString;\r\n }\r\n var h = '';\r\n var a = oidString.split('.');\r\n var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);\r\n h += itox(i0);\r\n a.splice(0, 2);\r\n for (var i = 0; i < a.length; i++) {\r\n h += roidtox(a[i]);\r\n }\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.s = null;\r\n this.hV = h;\r\n };\r\n /**\r\n * set value by a OID name\r\n * @name setValueName\r\n * @memberOf KJUR.asn1.DERObjectIdentifier#\r\n * @function\r\n * @param {String} oidName OID name (ex. 'serverAuth')\r\n * @since 1.0.1\r\n * @description\r\n * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'.\r\n * Otherwise raise error.\r\n * @example\r\n * o = new KJUR.asn1.DERObjectIdentifier();\r\n * o.setValueName(\"serverAuth\");\r\n */\r\n this.setValueName = function (oidName) {\r\n var oid = KJUR.asn1.x509.OID.name2oid(oidName);\r\n if (oid !== '') {\r\n this.setValueOidString(oid);\r\n }\r\n else {\r\n throw \"DERObjectIdentifier oidName undefined: \" + oidName;\r\n }\r\n };\r\n this.getFreshValueHex = function () {\r\n return this.hV;\r\n };\r\n if (params !== undefined) {\r\n if (typeof params === \"string\") {\r\n if (params.match(/^[0-2].[0-9.]+$/)) {\r\n this.setValueOidString(params);\r\n }\r\n else {\r\n this.setValueName(params);\r\n }\r\n }\r\n else if (params.oid !== undefined) {\r\n this.setValueOidString(params.oid);\r\n }\r\n else if (params.hex !== undefined) {\r\n this.setValueHex(params.hex);\r\n }\r\n else if (params.name !== undefined) {\r\n this.setValueName(params.name);\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER Enumerated\r\n * @name KJUR.asn1.DEREnumerated\r\n * @class class for ASN.1 DER Enumerated\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • int - specify initial ASN.1 value(V) by integer value
  • \r\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \r\n *
\r\n * NOTE: 'params' can be omitted.\r\n * @example\r\n * new KJUR.asn1.DEREnumerated(123);\r\n * new KJUR.asn1.DEREnumerated({int: 123});\r\n * new KJUR.asn1.DEREnumerated({hex: '1fad'});\r\n */\r\nKJUR.asn1.DEREnumerated = function (params) {\r\n KJUR.asn1.DEREnumerated.superclass.constructor.call(this);\r\n this.hT = \"0a\";\r\n /**\r\n * set value by Tom Wu's BigInteger object\r\n * @name setByBigInteger\r\n * @memberOf KJUR.asn1.DEREnumerated#\r\n * @function\r\n * @param {BigInteger} bigIntegerValue to set\r\n */\r\n this.setByBigInteger = function (bigIntegerValue) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);\r\n };\r\n /**\r\n * set value by integer value\r\n * @name setByInteger\r\n * @memberOf KJUR.asn1.DEREnumerated#\r\n * @function\r\n * @param {Integer} integer value to set\r\n */\r\n this.setByInteger = function (intValue) {\r\n var bi = new BigInteger(String(intValue), 10);\r\n this.setByBigInteger(bi);\r\n };\r\n /**\r\n * set value by integer value\r\n * @name setValueHex\r\n * @memberOf KJUR.asn1.DEREnumerated#\r\n * @function\r\n * @param {String} hexadecimal string of integer value\r\n * @description\r\n *
\r\n * NOTE: Value shall be represented by minimum octet length of\r\n * two's complement representation.\r\n */\r\n this.setValueHex = function (newHexString) {\r\n this.hV = newHexString;\r\n };\r\n this.getFreshValueHex = function () {\r\n return this.hV;\r\n };\r\n if (typeof params != \"undefined\") {\r\n if (typeof params['int'] != \"undefined\") {\r\n this.setByInteger(params['int']);\r\n }\r\n else if (typeof params == \"number\") {\r\n this.setByInteger(params);\r\n }\r\n else if (typeof params['hex'] != \"undefined\") {\r\n this.setValueHex(params['hex']);\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER UTF8String\r\n * @name KJUR.asn1.DERUTF8String\r\n * @class class for ASN.1 DER UTF8String\r\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\r\n * @extends KJUR.asn1.DERAbstractString\r\n * @description\r\n * @see KJUR.asn1.DERAbstractString - superclass\r\n */\r\nKJUR.asn1.DERUTF8String = function (params) {\r\n KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params);\r\n this.hT = \"0c\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER NumericString\r\n * @name KJUR.asn1.DERNumericString\r\n * @class class for ASN.1 DER NumericString\r\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\r\n * @extends KJUR.asn1.DERAbstractString\r\n * @description\r\n * @see KJUR.asn1.DERAbstractString - superclass\r\n */\r\nKJUR.asn1.DERNumericString = function (params) {\r\n KJUR.asn1.DERNumericString.superclass.constructor.call(this, params);\r\n this.hT = \"12\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER PrintableString\r\n * @name KJUR.asn1.DERPrintableString\r\n * @class class for ASN.1 DER PrintableString\r\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\r\n * @extends KJUR.asn1.DERAbstractString\r\n * @description\r\n * @see KJUR.asn1.DERAbstractString - superclass\r\n */\r\nKJUR.asn1.DERPrintableString = function (params) {\r\n KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params);\r\n this.hT = \"13\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER TeletexString\r\n * @name KJUR.asn1.DERTeletexString\r\n * @class class for ASN.1 DER TeletexString\r\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\r\n * @extends KJUR.asn1.DERAbstractString\r\n * @description\r\n * @see KJUR.asn1.DERAbstractString - superclass\r\n */\r\nKJUR.asn1.DERTeletexString = function (params) {\r\n KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params);\r\n this.hT = \"14\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER IA5String\r\n * @name KJUR.asn1.DERIA5String\r\n * @class class for ASN.1 DER IA5String\r\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\r\n * @extends KJUR.asn1.DERAbstractString\r\n * @description\r\n * @see KJUR.asn1.DERAbstractString - superclass\r\n */\r\nKJUR.asn1.DERIA5String = function (params) {\r\n KJUR.asn1.DERIA5String.superclass.constructor.call(this, params);\r\n this.hT = \"16\";\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER UTCTime\r\n * @name KJUR.asn1.DERUTCTime\r\n * @class class for ASN.1 DER UTCTime\r\n * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})\r\n * @extends KJUR.asn1.DERAbstractTime\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')
  • \r\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \r\n *
  • date - specify Date object.
  • \r\n *
\r\n * NOTE: 'params' can be omitted.\r\n *

EXAMPLES

\r\n * @example\r\n * d1 = new KJUR.asn1.DERUTCTime();\r\n * d1.setString('130430125959Z');\r\n *\r\n * d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'});\r\n * d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))});\r\n * d4 = new KJUR.asn1.DERUTCTime('130430125959Z');\r\n */\r\nKJUR.asn1.DERUTCTime = function (params) {\r\n KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params);\r\n this.hT = \"17\";\r\n /**\r\n * set value by a Date object
\r\n * @name setByDate\r\n * @memberOf KJUR.asn1.DERUTCTime#\r\n * @function\r\n * @param {Date} dateObject Date object to set ASN.1 value(V)\r\n * @example\r\n * o = new KJUR.asn1.DERUTCTime();\r\n * o.setByDate(new Date(\"2016/12/31\"));\r\n */\r\n this.setByDate = function (dateObject) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.date = dateObject;\r\n this.s = this.formatDate(this.date, 'utc');\r\n this.hV = stohex(this.s);\r\n };\r\n this.getFreshValueHex = function () {\r\n if (typeof this.date == \"undefined\" && typeof this.s == \"undefined\") {\r\n this.date = new Date();\r\n this.s = this.formatDate(this.date, 'utc');\r\n this.hV = stohex(this.s);\r\n }\r\n return this.hV;\r\n };\r\n if (params !== undefined) {\r\n if (params.str !== undefined) {\r\n this.setString(params.str);\r\n }\r\n else if (typeof params == \"string\" && params.match(/^[0-9]{12}Z$/)) {\r\n this.setString(params);\r\n }\r\n else if (params.hex !== undefined) {\r\n this.setStringHex(params.hex);\r\n }\r\n else if (params.date !== undefined) {\r\n this.setByDate(params.date);\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER GeneralizedTime\r\n * @name KJUR.asn1.DERGeneralizedTime\r\n * @class class for ASN.1 DER GeneralizedTime\r\n * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'})\r\n * @property {Boolean} withMillis flag to show milliseconds or not\r\n * @extends KJUR.asn1.DERAbstractTime\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')
  • \r\n *
  • hex - specify initial ASN.1 value(V) by a hexadecimal string
  • \r\n *
  • date - specify Date object.
  • \r\n *
  • millis - specify flag to show milliseconds (from 1.0.6)
  • \r\n *
\r\n * NOTE1: 'params' can be omitted.\r\n * NOTE2: 'withMillis' property is supported from asn1 1.0.6.\r\n */\r\nKJUR.asn1.DERGeneralizedTime = function (params) {\r\n KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params);\r\n this.hT = \"18\";\r\n this.withMillis = false;\r\n /**\r\n * set value by a Date object\r\n * @name setByDate\r\n * @memberOf KJUR.asn1.DERGeneralizedTime#\r\n * @function\r\n * @param {Date} dateObject Date object to set ASN.1 value(V)\r\n * @example\r\n * When you specify UTC time, use 'Date.UTC' method like this:
\r\n * o1 = new DERUTCTime();\r\n * o1.setByDate(date);\r\n *\r\n * date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59\r\n */\r\n this.setByDate = function (dateObject) {\r\n this.hTLV = null;\r\n this.isModified = true;\r\n this.date = dateObject;\r\n this.s = this.formatDate(this.date, 'gen', this.withMillis);\r\n this.hV = stohex(this.s);\r\n };\r\n this.getFreshValueHex = function () {\r\n if (this.date === undefined && this.s === undefined) {\r\n this.date = new Date();\r\n this.s = this.formatDate(this.date, 'gen', this.withMillis);\r\n this.hV = stohex(this.s);\r\n }\r\n return this.hV;\r\n };\r\n if (params !== undefined) {\r\n if (params.str !== undefined) {\r\n this.setString(params.str);\r\n }\r\n else if (typeof params == \"string\" && params.match(/^[0-9]{14}Z$/)) {\r\n this.setString(params);\r\n }\r\n else if (params.hex !== undefined) {\r\n this.setStringHex(params.hex);\r\n }\r\n else if (params.date !== undefined) {\r\n this.setByDate(params.date);\r\n }\r\n if (params.millis === true) {\r\n this.withMillis = true;\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER Sequence\r\n * @name KJUR.asn1.DERSequence\r\n * @class class for ASN.1 DER Sequence\r\n * @extends KJUR.asn1.DERAbstractStructured\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • array - specify array of ASN1Object to set elements of content
  • \r\n *
\r\n * NOTE: 'params' can be omitted.\r\n */\r\nKJUR.asn1.DERSequence = function (params) {\r\n KJUR.asn1.DERSequence.superclass.constructor.call(this, params);\r\n this.hT = \"30\";\r\n this.getFreshValueHex = function () {\r\n var h = '';\r\n for (var i = 0; i < this.asn1Array.length; i++) {\r\n var asn1Obj = this.asn1Array[i];\r\n h += asn1Obj.getEncodedHex();\r\n }\r\n this.hV = h;\r\n return this.hV;\r\n };\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER Set\r\n * @name KJUR.asn1.DERSet\r\n * @class class for ASN.1 DER Set\r\n * @extends KJUR.asn1.DERAbstractStructured\r\n * @description\r\n *
\r\n * As for argument 'params' for constructor, you can specify one of\r\n * following properties:\r\n *
    \r\n *
  • array - specify array of ASN1Object to set elements of content
  • \r\n *
  • sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.
  • \r\n *
\r\n * NOTE1: 'params' can be omitted.
\r\n * NOTE2: sortflag is supported since 1.0.5.\r\n */\r\nKJUR.asn1.DERSet = function (params) {\r\n KJUR.asn1.DERSet.superclass.constructor.call(this, params);\r\n this.hT = \"31\";\r\n this.sortFlag = true; // item shall be sorted only in ASN.1 DER\r\n this.getFreshValueHex = function () {\r\n var a = new Array();\r\n for (var i = 0; i < this.asn1Array.length; i++) {\r\n var asn1Obj = this.asn1Array[i];\r\n a.push(asn1Obj.getEncodedHex());\r\n }\r\n if (this.sortFlag == true)\r\n a.sort();\r\n this.hV = a.join('');\r\n return this.hV;\r\n };\r\n if (typeof params != \"undefined\") {\r\n if (typeof params.sortflag != \"undefined\" &&\r\n params.sortflag == false)\r\n this.sortFlag = false;\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured);\r\n// ********************************************************************\r\n/**\r\n * class for ASN.1 DER TaggedObject\r\n * @name KJUR.asn1.DERTaggedObject\r\n * @class class for ASN.1 DER TaggedObject\r\n * @extends KJUR.asn1.ASN1Object\r\n * @description\r\n *
\r\n * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object.\r\n * For example, if you find '[1]' tag in a ASN.1 dump,\r\n * 'tagNoHex' will be 'a1'.\r\n *
\r\n * As for optional argument 'params' for constructor, you can specify *ANY* of\r\n * following properties:\r\n *
    \r\n *
  • explicit - specify true if this is explicit tag otherwise false\r\n * (default is 'true').
  • \r\n *
  • tag - specify tag (default is 'a0' which means [0])
  • \r\n *
  • obj - specify ASN1Object which is tagged
  • \r\n *
\r\n * @example\r\n * d1 = new KJUR.asn1.DERUTF8String({'str':'a'});\r\n * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1});\r\n * hex = d2.getEncodedHex();\r\n */\r\nKJUR.asn1.DERTaggedObject = function (params) {\r\n KJUR.asn1.DERTaggedObject.superclass.constructor.call(this);\r\n this.hT = \"a0\";\r\n this.hV = '';\r\n this.isExplicit = true;\r\n this.asn1Object = null;\r\n /**\r\n * set value by an ASN1Object\r\n * @name setString\r\n * @memberOf KJUR.asn1.DERTaggedObject#\r\n * @function\r\n * @param {Boolean} isExplicitFlag flag for explicit/implicit tag\r\n * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag\r\n * @param {ASN1Object} asn1Object ASN.1 to encapsulate\r\n */\r\n this.setASN1Object = function (isExplicitFlag, tagNoHex, asn1Object) {\r\n this.hT = tagNoHex;\r\n this.isExplicit = isExplicitFlag;\r\n this.asn1Object = asn1Object;\r\n if (this.isExplicit) {\r\n this.hV = this.asn1Object.getEncodedHex();\r\n this.hTLV = null;\r\n this.isModified = true;\r\n }\r\n else {\r\n this.hV = null;\r\n this.hTLV = asn1Object.getEncodedHex();\r\n this.hTLV = this.hTLV.replace(/^../, tagNoHex);\r\n this.isModified = false;\r\n }\r\n };\r\n this.getFreshValueHex = function () {\r\n return this.hV;\r\n };\r\n if (typeof params != \"undefined\") {\r\n if (typeof params['tag'] != \"undefined\") {\r\n this.hT = params['tag'];\r\n }\r\n if (typeof params['explicit'] != \"undefined\") {\r\n this.isExplicit = params['explicit'];\r\n }\r\n if (typeof params['obj'] != \"undefined\") {\r\n this.asn1Object = params['obj'];\r\n this.setASN1Object(this.isExplicit, this.hT, this.asn1Object);\r\n }\r\n }\r\n};\r\nYAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);\r\n","/*!\r\nCopyright (c) 2011, Yahoo! Inc. All rights reserved.\r\nCode licensed under the BSD License:\r\nhttp://developer.yahoo.com/yui/license.html\r\nversion: 2.9.0\r\n*/\r\nif (!exports.__esModule) Object.defineProperty(exports, \"__esModule\", { value: true });var YAHOO = exports.YAHOO = {};\r\nYAHOO.lang = {\r\n /**\r\n * Utility to set up the prototype, constructor and superclass properties to\r\n * support an inheritance strategy that can chain constructors and methods.\r\n * Static members will not be inherited.\r\n *\r\n * @method extend\r\n * @static\r\n * @param {Function} subc the object to modify\r\n * @param {Function} superc the object to inherit\r\n * @param {Object} overrides additional properties/methods to add to the\r\n * subclass prototype. These will override the\r\n * matching items obtained from the superclass\r\n * if present.\r\n */\r\n extend: function (subc, superc, overrides) {\r\n if (!superc || !subc) {\r\n throw new Error(\"YAHOO.lang.extend failed, please check that \" +\r\n \"all dependencies are included.\");\r\n }\r\n var F = function () { };\r\n F.prototype = superc.prototype;\r\n subc.prototype = new F();\r\n subc.prototype.constructor = subc;\r\n subc.superclass = superc.prototype;\r\n if (superc.prototype.constructor == Object.prototype.constructor) {\r\n superc.prototype.constructor = superc;\r\n }\r\n if (overrides) {\r\n var i;\r\n for (i in overrides) {\r\n subc.prototype[i] = overrides[i];\r\n }\r\n /*\r\n * IE will not enumerate native functions in a derived object even if the\r\n * function was overridden. This is a workaround for specific functions\r\n * we care about on the Object prototype.\r\n * @property _IEEnumFix\r\n * @param {Function} r the object to receive the augmentation\r\n * @param {Function} s the object that supplies the properties to augment\r\n * @static\r\n * @private\r\n */\r\n var _IEEnumFix = function () { }, ADD = [\"toString\", \"valueOf\"];\r\n try {\r\n if (/MSIE/.test(navigator.userAgent)) {\r\n _IEEnumFix = function (r, s) {\r\n for (i = 0; i < ADD.length; i = i + 1) {\r\n var fname = ADD[i], f = s[fname];\r\n if (typeof f === 'function' && f != Object.prototype[fname]) {\r\n r[fname] = f;\r\n }\r\n }\r\n };\r\n }\r\n }\r\n catch (ex) { }\r\n ;\r\n _IEEnumFix(subc.prototype, overrides);\r\n }\r\n }\r\n};\r\n","module.exports = {\r\n \"version\": \"3.2.1\"\r\n}\r\n"]} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index e10d518..3d24ae6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,16 @@ "version": "1.10.2", "resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.10.2.tgz", "integrity": "sha512-caqA0xQxM4lMRncFsRPPVMDdEzUBCJ4xdFXuKReXpEU3qwnVIP/WIjVDIi7mWyS7xqz8C9WfSW5JL4PrlSq31w==" + }, + "jsencrypt": { + "version": "3.3.2", + "resolved": "https://registry.npmmirror.com/jsencrypt/-/jsencrypt-3.3.2.tgz", + "integrity": "sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A==" + }, + "wxmp-rsa": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/wxmp-rsa/-/wxmp-rsa-2.1.0.tgz", + "integrity": "sha512-VbWMJ+vf8t7G93sjkqjCn5yGy/Si3M8uD6OFebqjJWJ1R0WCyle7X6SNia7WWG6Qe1F2/OWxhbcSGA6ebUBwIA==" } } } diff --git a/package.json b/package.json index b41f495..9e09b41 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,8 @@ "author": "", "license": "ISC", "dependencies": { - "@vant/weapp": "^1.10.2" + "@vant/weapp": "^1.10.2", + "jsencrypt": "^3.3.2", + "wxmp-rsa": "^2.1.0" } } diff --git a/pages/apply/approval/approval.wxml b/pages/apply/approval/approval.wxml index f3dd484..6a16545 100644 --- a/pages/apply/approval/approval.wxml +++ b/pages/apply/approval/approval.wxml @@ -97,13 +97,16 @@ - - + + + {{item.name}} + + - 禁用 + 禁用 diff --git a/pages/apply/approval/approval.wxss b/pages/apply/approval/approval.wxss index 5d3624c..315197c 100644 --- a/pages/apply/approval/approval.wxss +++ b/pages/apply/approval/approval.wxss @@ -211,7 +211,7 @@ text{display: block;} width: 65px; text-align: center; height: 100%; - background: #F6F6F6; + background-color: rgb(255,0,0,0.2); align-items: center; display: flex; justify-content: center; @@ -262,4 +262,8 @@ text{display: block;} .bottomBtn view text{ display: block; margin-top: 5px; - } \ No newline at end of file + } + +.van-cell-text{ + padding: 8px; +} \ No newline at end of file diff --git a/pages/apply/index.js b/pages/apply/index.js index c81cb51..c7cb736 100644 --- a/pages/apply/index.js +++ b/pages/apply/index.js @@ -33,7 +33,7 @@ swichPaymentApply:function(e){ // }) // } wx.navigateTo({ - url: '/pages/apply/paymentTemplate/add/add', + url: '/pages/apply/paymentTemplate/addNew/addNew', }) }, openBox:function(){ @@ -152,45 +152,54 @@ swichPaymentApply:function(e){ setTimeout(function(){ UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData,{ success: (res) => { - for (let i = 0; i < res.rows.length; i++) { - if(res.rows[i].bankAccountNumber==null){continue;} - res.rows[i].bankAccountNumber = res.rows[i].bankAccountNumber.replace(/(\d{4})(?=\d)/g, "$1 "); - res.rows[i].balance = Number(res.rows[i].balance).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => { - return $1 + ","; }).replace(/\.$/, ""); - res.rows[i].bankTypeText = UTIL.getTransform(res.rows[i].bankType,that.data.bankTypeOptions); + if(res.rows){ + for (let i = 0; i < res.rows.length; i++) { + if(res.rows[i].bankAccountNumber==null){continue;} + res.rows[i].bankAccountNumber = res.rows[i].bankAccountNumber.replace(/(\d{4})(?=\d)/g, "$1 "); + res.rows[i].balance = Number(res.rows[i].balance).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => { + return $1 + ","; }).replace(/\.$/, ""); + res.rows[i].bankTypeText = UTIL.getTransform(res.rows[i].bankType,that.data.bankTypeOptions); + } + console.log(res.rows) + that.setData({ + accountList:res.rows + }) + wx.hideLoading(); + }else{ + wx.hideLoading(); } - console.log(res.rows) - that.setData({ - accountList:res.rows - }) - wx.hideLoading(); + } }) },1000) UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData2,{ success: (res) => { - for (let i = 0; i < res.rows.length; i++) { - // if(res.rows[i].bankAccountNumber==null){continue;} - // res.rows[i].bankAccountNumber = res.rows[i].bankAccountNumber.replace(/(\d{4})(?=\d)/g, "$1 "); - res.rows[i].balance = Number(res.rows[i].balance).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => { - return $1 + ","; }).replace(/\.$/, "");; - console.log(res.rows[i].balance) + if(res.rows){ + for (let i = 0; i < res.rows.length; i++) { + // if(res.rows[i].bankAccountNumber==null){continue;} + // res.rows[i].bankAccountNumber = res.rows[i].bankAccountNumber.replace(/(\d{4})(?=\d)/g, "$1 "); + res.rows[i].balance = Number(res.rows[i].balance).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => { + return $1 + ","; }).replace(/\.$/, "");; + console.log(res.rows[i].balance) + } + that.setData({ + accountListXJ:res.rows + }) } - that.setData({ - accountListXJ:res.rows - }) } }) UTIL.httpRequest(API.URL_GET_SELECTLIST, sendData3,{ success: (res) => { - for (let i = 0; i < res.rows.length; i++) { - res.rows[i].payeeAccount = res.rows[i].payeeAccount.replace(/(\d{4})(?=\d)/g, "$1 "); - res.rows[i].payeePaymentLines = Number(res.rows[i].payeePaymentLines).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => { - return $1 + ","; }).replace(/\.$/, ""); + if(res.rows){ + for (let i = 0; i < res.rows.length; i++) { + res.rows[i].payeeAccount = res.rows[i].payeeAccount.replace(/(\d{4})(?=\d)/g, "$1 "); + res.rows[i].payeePaymentLines = Number(res.rows[i].payeePaymentLines).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => { + return $1 + ","; }).replace(/\.$/, ""); + } + that.setData({ + accountListGWK:res.rows + }) } - that.setData({ - accountListGWK:res.rows - }) } }) }, diff --git a/pages/apply/index.wxml b/pages/apply/index.wxml index b640a76..32ca231 100644 --- a/pages/apply/index.wxml +++ b/pages/apply/index.wxml @@ -17,9 +17,9 @@ {{item.bankUseType == 1 ?'基本户':'一般户'}} - + - + {{item.accountName}} @@ -57,7 +57,7 @@ 添加现金账户 --> - + @@ -78,13 +78,14 @@ 持有人:{{item.payee}} + - 支付模板 + 下一步 @@ -92,12 +93,12 @@ - + {{item.templateName}}默认 - - + + diff --git a/pages/apply/index.wxss b/pages/apply/index.wxss index 2f7a819..190b3fc 100644 --- a/pages/apply/index.wxss +++ b/pages/apply/index.wxss @@ -60,6 +60,22 @@ background:url('https://www.nongshen.net/static/wechat/bg_RCB.png') no-repeat center; background-size: 105% 105%; } +.EMS{ + background:url('https://www.nongshen.net/static/wechat/bg_EMS.png') no-repeat center; + background-size: 105% 105%; +} +.BOC{ + background:url('https://www.nongshen.net/static/wechat/bank_BOC.png') no-repeat center; + background-size: 105% 105%; +} +.ZYB{ + background:url('https://www.nongshen.net/static/wechat/bank_ZYB.png') no-repeat center; + background-size: 105% 105%; +} +.bank_other{ + background:url('https://www.nongshen.net/static/wechat/bank_other.png') no-repeat center; + background-size: 105% 105%; +} .gwk{ background:url('https://www.nongshen.net/static/wechat/bg_GWK.png') no-repeat center; background-size: 105% 105%; @@ -142,6 +158,7 @@ margin-top: 30px; margin-bottom: 30px; display: flex; + justify-content: center; } .bottom view { @@ -161,7 +178,7 @@ border: 1px solid transparent; padding: 8px 0px; background-image: linear-gradient(to right, #2C8E68, #5CAE77); - margin-left: 6%; + /* margin-left: 6%; */ color: #fff; } @@ -176,4 +193,8 @@ .van-action-sheet__header { background: #f2f2f2; color: #2C8E68; +} + +.van-cell-text{ + padding: 8px; } \ No newline at end of file diff --git a/pages/apply/paymentTemplate/add/add.js b/pages/apply/paymentTemplate/add/add.js index ab3883c..efe26b0 100644 --- a/pages/apply/paymentTemplate/add/add.js +++ b/pages/apply/paymentTemplate/add/add.js @@ -1234,6 +1234,7 @@ Page({ UTIL.httpRequest(API.URL_GET_SAVE, that.data.form, { success: (res) => { if (res.code == API.SUCCESS_CODE) { + console.log(res.data.transfers.length); for (let j = 0; j < res.data.transfers.length; j++) { if(that.data.form.transfers[j].capitalExpenditureType == 2){ that.data.form.transfers[j].projectForm.ynType = res.data.transfers[j].transferType=='1'||res.data.transfers[j].transferType=='2'||res.data.transfers[j].transferType=='4'?'1':'2'; @@ -1242,124 +1243,176 @@ Page({ // 工程项目提交 UTIL.httpRequest(API.URL_GET_ADDPROJECTTO , that.data.form.transfers[j].projectForm, { success: (res) => { - } }) } if(that.data.form.transfers[j].capitalExpenditureType == 4){ - that.data.form.transfers[j].contractionForm.transferId = res.data.transfers[j].id; that.data.form.transfers[j].contractionForm.id = ''; that.data.form.transfers[j].contractionForm.method = 'POST'; - // 关联合同提交 UTIL.httpRequest(API.URL_GET_GETRELATIONADD , that.data.form.transfers[j].contractionForm, { success: (res) => { - } }) } - - // if(that.data.form.transfers[j].transferType == '12'){ - - // console.log(that.data.form.transfers[j].cashForm); - // that.data.form.transfers[j].cashForm.cashId = res.data.transfers[j].id; - // that.data.form.transfers[j].cashForm.method = 'POST'; - // if(that.data.form.transfers[j].cashierType == 'edit'){ - // // 收票方信息增加 - // UTIL.httpRequest(API.URL_GET_GETCASHDETAILEDIT , that.data.form.transfers[j].cashForm, { - // success: (res) => { - - // } - // }) - // }else{ - // // 收票方信息修改 - // UTIL.httpRequest(API.URL_GET_GETCASHDETAILADD , that.data.form.transfers[j].cashForm, { - // success: (res) => { - - // } - // }) - // } - // } - if(that.data.form.transfers[j].fileForm == undefined){continue;} - console.log(that.data.form.transfers[j].fileForm); - for (let i = 0; i < that.data.form.transfers[j].fileForm.length; i++) { - that.data.form.transfers[j].fileForm[i].tableId = res.data.transfers[j].id - const element = that.data.form.transfers[j].fileForm[i]; - wx.uploadFile({ - url: wx.getStorageSync('dressCode')+API.URL_GET_UPLOAD, - filePath: element.file, - name: 'file', - header: { - "Content-Type": "multipart/form-data",//记得设置 - "chartset":"utf-8", - 'Authorization':'Bearer '+getApp().globalData.userInfo.token - }, - formData:element, - success (response){ - console.log(res); - }, - fail(res){ - console.log(res) - } - }) - } - } - if(e.currentTarget.dataset.type == 0){ - wx.navigateTo({ - url: '/pages/apply/approval/approval?id='+res.data.approvalItemTemplate.id+'&deptId='+res.data.approvalItemTemplate.deptId+'&form='+JSON.stringify(res.data)+'&type='+that.data.formType+'&applyOptions='+JSON.stringify(that.data.templateModel), - }) - } - if(e.currentTarget.dataset.type == 2){ - wx.showToast({ - title: '保存成功', - icon: 'success', - duration: 2000, - }) - } - if(e.currentTarget.dataset.type == 1){ - console.log("aaa"); - wx.showToast({ - title: '保存成功', - icon: 'success', - duration: 2000, - complete(){ - setTimeout(function(){ - that.back(); - },2000) + // if(that.data.form.transfers[j].fileForm == undefined){continue;} + + that.data.form.transfers[j].id = res.data.transfers[j].id + console.log(that.data.form.transfers[j]) + that.upDownFile(that.data.form.transfers[j]).then(response=>{ + wx.hideLoading(); + console.log(e.currentTarget.dataset.type); + if(e.currentTarget.dataset.type == 0){ + wx.navigateTo({ + url: '/pages/apply/approval/approval?id='+res.data.approvalItemTemplate.id+'&deptId='+res.data.approvalItemTemplate.deptId+'&form='+JSON.stringify(res.data)+'&type='+that.data.formType+'&applyOptions='+JSON.stringify(that.data.templateModel), + }) } - }) - } - if(e.currentTarget.dataset.type == 3){ - UTIL.httpRequest(API.URL_GET_TOREVIEWSUBMIT+res.data.approvalItemTemplate.id , {method:'POST'}, { - success: (res2) => { - if (res2.code == API.SUCCESS_CODE) { - wx.showToast({ - title: '操作成功', - icon: 'success', - duration: 2000, - complete(){ - setTimeout(function(){ - that.back(); - },2000) + if(e.currentTarget.dataset.type == 2){ + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000, + }) + } + if(e.currentTarget.dataset.type == 1){ + console.log("aaa"); + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + } + if(e.currentTarget.dataset.type == 3){ + UTIL.httpRequest(API.URL_GET_TOREVIEWSUBMIT+res.data.approvalItemTemplate.id , {method:'POST'}, { + success: (res2) => { + if (res2.code == API.SUCCESS_CODE) { + wx.showToast({ + title: '操作成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + }else{ + wx.showToast({ + title: '操作失败', + icon: 'error', + duration: 2000 + }) } - }) - }else{ - wx.showToast({ - title: '操作失败', - icon: 'error', - duration: 2000 - }) - } + } + }) + } + }).catch((err) => { + console.log(err); + wx.hideLoading(); + if(e.currentTarget.dataset.type == 0){ + wx.navigateTo({ + url: '/pages/apply/approval/approval?id='+res.data.approvalItemTemplate.id+'&deptId='+res.data.approvalItemTemplate.deptId+'&form='+JSON.stringify(res.data)+'&type='+that.data.formType+'&applyOptions='+JSON.stringify(that.data.templateModel), + }) + } + if(e.currentTarget.dataset.type == 2){ + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000, + }) + } + if(e.currentTarget.dataset.type == 1){ + console.log("aaa"); + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + } + if(e.currentTarget.dataset.type == 3){ + UTIL.httpRequest(API.URL_GET_TOREVIEWSUBMIT+res.data.approvalItemTemplate.id , {method:'POST'}, { + success: (res2) => { + if (res2.code == API.SUCCESS_CODE) { + wx.showToast({ + title: '操作成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + }else{ + wx.showToast({ + title: '操作失败', + icon: 'error', + duration: 2000 + }) + } + } + }) } }) - } } } }) }, + + upDownFile(op){ + var that = this; + console.log(op) + wx.showLoading({ + title: '正在上传附件', + mask:true + }) + return new Promise((resolve, reject) => { + if(op.fileForm.length > 0){ + for (let i = 0; i < op.fileForm.length; i++) { + op.fileForm[i].tableId = op.id + const element = op.fileForm[i]; + console.log(element); + wx.uploadFile({ + url: wx.getStorageSync('dressCode')+API.URL_GET_UPLOAD, + filePath: element.file, + name: 'file', + header: { + "Content-Type": "multipart/form-data",//记得设置 + "chartset":"utf-8", + 'Authorization':'Bearer '+getApp().globalData.userInfo.token + }, + formData:element, + success (response){ + if(op.fileForm.length == (i+1)){ + resolve(); + } + }, + fail(res){ + console.log(res) + reject(); + } + }) + } + }else{ + reject(); + } + }); + + }, + bindKeyInput(even){ console.log(even); this.setData({ @@ -1688,6 +1741,15 @@ Page({ that.setData({ form:that.data.form, }) + + + UTIL.httpRequest(API.URL_GET_TRANSFERREMOVE+e.currentTarget.dataset.id , {method:'GET'}, { + success: (res) => { + + } + }) + + }, disabledNone(e){ console.log("b"); diff --git a/pages/apply/paymentTemplate/add/add.wxml b/pages/apply/paymentTemplate/add/add.wxml index 7e9f5c5..d669afd 100644 --- a/pages/apply/paymentTemplate/add/add.wxml +++ b/pages/apply/paymentTemplate/add/add.wxml @@ -64,7 +64,7 @@ - + diff --git a/pages/apply/paymentTemplate/add/upLoad/upLoad.js b/pages/apply/paymentTemplate/add/upLoad/upLoad.js index c268a3e..b152350 100644 --- a/pages/apply/paymentTemplate/add/upLoad/upLoad.js +++ b/pages/apply/paymentTemplate/add/upLoad/upLoad.js @@ -25,7 +25,7 @@ Page({ onLoad(options) { console.log(options); //所属银行 - UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, { + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type_all', {method:'GET'}, { success: (res) => { this.setData({ bankTypeOptions:res.data @@ -43,7 +43,8 @@ Page({ this.setData({ bankType:options.bankType, index:options.index, - totalAmount:options.totalAmount + totalAmount:options.totalAmount, + isPeers:options.isPeers }) if(options.bankType != '1'){ this.setData({ @@ -100,7 +101,8 @@ Page({ 'Authorization':'Bearer '+getApp().globalData.userInfo.token }, formData:{ - bankType:'2', + // bankType:'2', + bankType:that.data.bankType, accountType:that.data.bankAccountType, isPeers:that.data.isPeers }, @@ -144,12 +146,14 @@ Page({ return; } let moneyCount = 0; + console.log(that.data.payeeList); for(let i = 0 ; i < that.data.payeeList.length ; i++){ that.data.payeeList[i].bankTypeText = UTIL.getTransform(that.data.payeeList[i].bankType,that.data.bankTypeOptions); that.data.payeeList[i].transferStatusText = UTIL.getTransform(that.data.payeeList[i].transferStatus,that.data.transferStatusOptions); moneyCount += parseFloat(that.data.payeeList[i].incomeAmount); } console.log(that.data.totalAmount); + console.log(that.data.payeeList); let totalAmount = parseFloat(that.data.totalAmount)+parseFloat(moneyCount); console.log(totalAmount); @@ -161,10 +165,10 @@ Page({ prevPage = pages[pages.length - 2]; //获取上一个页面,将其赋值 if (prevPage) { prevPage.setData({ - ["form.transfers["+that.data.index+"].payeeList"]: that.data.payeeList,//将想要传的信息赋值给上一个页面data中的值 - ["form.transfers["+that.data.index+"].expenditureAmount"]: moneyCount.toFixed(2), + ["form.payeeList"]: that.data.payeeList,//将想要传的信息赋值给上一个页面data中的值 + ["form.expenditureAmount"]: moneyCount.toFixed(2), ["form.approvalItemTemplate.totalAmount"]:totalAmount.toFixed(2), - ["form.transfers["+that.data.index+"].amountReadonly"]:true + ["form.amountReadonly"]:true }) that.back() } @@ -197,7 +201,7 @@ Page({ UTIL.httpRequest(API.URL_GET_DOWNFILE, {method:'GET'}, { success: (res) => { console.log(res); - let url = ' https://dazu.nongshen.net/api/common/download?fileName='+res.msg+'&delete=true' + let url = wx.getStorageSync('dressCode')+'/common/download?fileName='+res.msg+'&delete=true' wx.setClipboardData({ data: url, success (res) { diff --git a/pages/apply/paymentTemplate/add/upLoad/upLoad.wxml b/pages/apply/paymentTemplate/add/upLoad/upLoad.wxml index 2739bbc..9ba3ca2 100644 --- a/pages/apply/paymentTemplate/add/upLoad/upLoad.wxml +++ b/pages/apply/paymentTemplate/add/upLoad/upLoad.wxml @@ -33,13 +33,14 @@ - - + + diff --git a/pages/apply/paymentTemplate/addNew/addNew.js b/pages/apply/paymentTemplate/addNew/addNew.js new file mode 100644 index 0000000..88c244f --- /dev/null +++ b/pages/apply/paymentTemplate/addNew/addNew.js @@ -0,0 +1,2362 @@ +// pages/apply/paymentTemplate/add/add.js +import * as UTIL from '../../../../utils/util.js'; +import * as API from '../../../../utils/API.js'; +let EVN_CONFIG = require('../../../../env/env'); + +const app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + isIPX: app.globalData.isIPX, + radio:'1', + active:0, + projectText:'', + balance:0, + capitalExpenditureTypeOptions:[], + transferTypeOptions:[], + projectOptions:[], + projectFundTypeOptions:[], + contractionOptions:[], + accountOptions:[], + moneyorderOptions:[], + topInputTirme:false, + // form:{ + // approvalMode:'1', + // payeeList:[{}], + + // approvalItemTemplate:{ + // approvalItems:'',//审批事项 + // submitCompany:'',//提交单位 + // submitDate:'',//提交日期 + // submitter:'',//提交人 + // telephone:'',//联系方式 + // totalAmount:"0.00",//合计金额 + // templateName:'',//模板名称 选择保存模板的时候添加 + // dataType:'',//数据类型 + // }, + // transfers:[{//事项信息集合以下是List对象信息 + // num:"一", + // amountReadonly:false, + // expenditureAmountTirme:false, + // remarkTirme:false, + // showCapitalExpenditureType:false, + // showApplyDate:false, + // showTransferType:false, + // showProject:false, + // showProjectFundType:false, + // showAccount:false, + // showDialog:false, + // showContraction:false, + // showMoneyOrder:false, + // cashForm:{ + // payee:'', + // phone:'', + // unit:'', + // leader:'', + // remark:'', + // }, + // SJimage:[], + // FPimage:[], + // QTimage:[], + // activeName:0, + // showTitle:true, + // collapseDis:false, + // capitalExpenditureType:'1',//资金支出类别 + // capitalExpenditureTypeText:'结算类',//资金支出类别(展示用) + // succeedAmount:'',//成功支付金额 + // payer:'',//付款方 + // paymentPattern:'1', + // payerAccount:'',//付款方账户 + // bankType:'',//所属银行 + // bankTypeText:'',//所属银行(展示用) + // isPeers:'N',//是否同行 + // operatorCode:'',//操作员代码 + // enterpriseCode:'',//企业编码 + // expenditureAmount:'',//支出总金额 + // applyDate:'',//申请时间 + // transferStatus:'',//转账状态 + // auditStatus:'0',//审批状态 + // paymentState:'',//支付状态 + // approvalMode:'1',//审批模式 + // paymentTime:'',//支付时间 + // bankPriority:'',//银行处理优先级 + // clientPriority:'',//客户处理优先级 + // transferType:'1',//付款方式 + // transferTypeText:'垫付报销:电子支付',//付款方式(展示用) + // requiredTransferTime:'',//要求转账时间 + // remark:'',//付款事由 + // startTime:'',//开票日期 + // endTime:'',//到期日期 + // orderType:'',//汇票类型 + // bankAccountType:'2',//账户类别1 公户2私户 + // villageAccountType:'',//账户分类 + // payeeList:[{//收款方账户集合 + // payeeId:'0',//收款方id + // payee:'',//收款方 + // bankDeposit:'',//开户行 + // incomeAmount:'',//收入金额 + // bankType:'',//所属银行0其他银行1中国银行2农商行(山东省)3农业银行4建设银行5工商银行 + // payeeAccount:'',//收款账户 + // }], + // projectForm:{ + // projectId:'', + // projectName:'', + // projectContractor:'', + // projectAmount:'', + // projectBillNum:'', + // projectFundType:'', + // outId:'', + // ynType:'1', + // }, + // contractionForm:{ + // contractionId:'', + // name:'', + // code:'', + // totalAmount:'', + // }, + // moneyOrderForm:{ + // orderNum:'', + // orderType:'', + // orderAmount:'', + // billPayUnit:'', + // billReceiveUnit:'', + // startTime:'', + // endTime:'', + // orderStatus:'', + // remark:'', + // } + // }], + // }, + form:{ + approvalItemTemplate:{ + approvalItems:'',//审批事项 + submitCompany:'',//提交单位 + submitDate:'',//提交日期 + submitter:'',//提交人 + telephone:'',//联系方式 + totalAmount:"0.00",//合计金额 + templateName:'',//模板名称 选择保存模板的时候添加 + dataType:'',//数据类型 + }, + num:"一", + amountReadonly:false, + expenditureAmountTirme:false, + remarkTirme:false, + showCapitalExpenditureType:false, + showApplyDate:false, + showTransferType:false, + showProject:false, + showProjectFundType:false, + showAccount:false, + showDialog:false, + showContraction:false, + showMoneyOrder:false, + cashForm:{ + payee:'', + phone:'', + unit:'', + leader:'', + remark:'', + }, + SJimage:[], + FPimage:[], + QTimage:[], + activeName:0, + showTitle:true, + collapseDis:false, + capitalExpenditureType:'1',//资金支出类别 + capitalExpenditureTypeText:'结算类',//资金支出类别(展示用) + approvalTemplateId:'1',//资金支出类别 + approvalTemplateName:'',//资金支出类别(展示用) + succeedAmount:'',//成功支付金额 + payer:'',//付款方 + paymentPattern:'1', + payerAccount:'',//付款方账户 + bankType:'',//所属银行 + bankTypeText:'',//所属银行(展示用) + isPeers:'N',//是否同行 + operatorCode:'',//操作员代码 + enterpriseCode:'',//企业编码 + expenditureAmount:'',//支出总金额 + applyDate:'',//申请时间 + transferStatus:'',//转账状态 + auditStatus:'0',//审批状态 + paymentState:'1',//支付状态 + approvalMode:'1',//审批模式 + paymentTime:'',//支付时间 + bankPriority:'',//银行处理优先级 + clientPriority:'',//客户处理优先级 + transferType:'1',//付款方式 + transferTypeText:'银行转账',//付款方式(展示用) + requiredTransferTime:'',//要求转账时间 + remark:'',//付款事由 + startTime:'',//开票日期 + endTime:'',//到期日期 + orderType:'',//汇票类型 + bankAccountType:'2',//账户类别1 公户2私户 + villageAccountType:'',//账户分类 + payeeList:[{//收款方账户集合 + payeeId:'0',//收款方id + payee:'',//收款方 + bankDeposit:'',//开户行 + incomeAmount:'',//收入金额 + bankType:'',//所属银行0其他银行1中国银行2农商行(山东省)3农业银行4建设银行5工商银行 + payeeAccount:'',//收款账户 + }], + projectForm:{ + projectId:'', + projectName:'', + projectContractor:'', + projectAmount:'', + projectBillNum:'', + projectFundType:'', + outId:'', + ynType:'1', + }, + contractionForm:{ + contractionId:'', + name:'', + code:'', + totalAmount:'', + }, + moneyOrderForm:{ + orderNum:'', + orderType:'', + orderAmount:'', + billPayUnit:'', + billReceiveUnit:'', + startTime:'', + endTime:'', + orderStatus:'', + remark:'', + } + }, + transferTypeOption:[ + { + dictLabel:'银行转账', + dictValue:'1' + }, + { + dictLabel:'信用卡转账', + dictValue:'2' + } + ], + accountForm:{}, + fileForm:[], + isUpdate:false, + SJimage: [], + FPimage: [], + QTimage: [], + imgcount:0, + activeNames: 0, + applyDate:'', + autosize: { maxHeight: 500, minHeight: 50 }, + showFile:false, + showCapitalExpenditureType:false, + showSteps:false, + activeStepsNames: 0, + }, + + showS(){ + this.setData({ + showSteps:!this.data.showSteps, + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + var that = this; + //所属银行 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, { + success: (res) => { + this.setData({ + bankTypeOptions:res.data + }); + } + }) + // 资金支出类别字典查询 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'capital_expenditure_type', {method:'GET'}, { + success: (res) => { + that.setData({ + capitalExpenditureTypeOptions:res.data, + }) + } + }) + // 汇票列表查询 + UTIL.httpRequest(API.URL_GET_GETMONEYORDERLIST, {method:'GET'}, { + success: (res) => { + that.setData({ + moneyOrderOptions:res.rows, + }) + } + }) + // 付款方式类型字典查询 (2.0) + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'yn_pay_type', {method:'GET'}, { + success: (res) => { + that.setData({ + transferTypeOptions:res.data, + }) + } + }) + // 项目工程列表 + UTIL.httpRequest(API.URL_GET_GETPROJECTLIST , {method:'GET'}, { + success: (res) => { + that.setData({ + projectOptions:res.rows, + }) + } + }) + // 工程款类型字典查询 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'project_fund_type', {method:'GET'}, { + success: (res) => { + that.setData({ + projectFundTypeOptions:res.data, + }) + } + }) + // 获取合同信息列表 + UTIL.httpRequest(API.URL_GET_CONTRACTIONLIST , {method:'GET',contractionStatus:1}, { + success: (res) => { + that.setData({ + contractionOptions:res.rows, + }) + } + }) + let templateQueryParams = { + // 分页 + method:'GET', + pageNum: 1, + pageSize: 999, + orderByColumn:'defaultValue', + isAsc: "desc", + type:'1' + }; + // 审批流程列表 + UTIL.httpRequest(API.URL_GET_TEMPLATELIST , templateQueryParams, { + success: (res) => { + that.setData({ + approvalTemplateNameOptions:res.rows, + ["form.approvalTemplateId"]:res.rows[0].id, + ["form.approvalTemplateName"]:res.rows[0].name, + }) + + // 审批模板 + UTIL.httpRequest(API.URL_GET_selectApprovalByTemplateId+res.rows[0].id , {method:'GET'}, { + success: (rres) => { + that.setData({ + steps:rres.approvalDetails + }) + } + }) + } + }) + if(options.id && options.type != 'template'){ + UTIL.showLoadingHaveMask(); + var perames = { + pageNum:1, + pageSize:999, + accountType:'102', + method:'POST' + } + // 付款方列表 + UTIL.httpRequest(API.URL_GET_SELECTACCOUNTLIST , perames, { + success: (res) => { + console.log(res); + that.setData({ + accountOptions:res.rows, + + }) + } + }) + setTimeout(function(){ + UTIL.httpRequest(API.URL_GET_APPROVALITEMS+options.id, {method:'GET'}, { + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + + + // 审批模板 + UTIL.httpRequest(API.URL_GET_selectApprovalByTemplateId+res.data.approvalTemplateId, {method:'GET'}, { + success: (rres) => { + that.setData({ + steps:rres.approvalDetails + }) + } + }) + + res.data.capitalExpenditureTypeText = UTIL.getTransform(res.data.capitalExpenditureType,that.data.capitalExpenditureTypeOptions); + res.data.transferTypeText = UTIL.getTransform(res.data.transferType,that.data.transferTypeOption); + + if(res.data.capitalExpenditureType == 2){ + let prames = { + outId:res.data.id, + ynType: res.data.transferType=='1'||res.data.transferType=='2'||res.data.transferType=='4'?'1':'2' + } + // 工程项目查询 + UTIL.httpRequest(API.URL_GET_GETPROJECTTO , prames, { + success: (res) => { + res.data.projectFundTypeText = UTIL.getTransform(res.data.projectFundType,that.data.projectFundTypeOptions); + that.setData({ + ["form.projectForm"]:res.data, + }) + } + }) + } + + if(res.data.capitalExpenditureType == 4){ + let prames = { + transferId:res.data.id, + } + // 关联合同查询 + UTIL.httpRequest(API.URL_GET_GETSELECTINFOBYOUTID , prames, { + success: (res) => { + that.setData({ + ["form.contractionForm"]:res.data, + }) + } + }) + } + that.setData({ + ["form.fileNum"]:0, + }) + UTIL.httpRequest( + API.URL_GET_FINDLIST, + { + method:'GET', + tableName:'t_yinnong_transfer', + tableId:res.data.id, + fileType:1 + }, + { + success: (res) => { + + let list = []; + + res.data.forEach((item2,index2)=>{ + + let fileForm = res.data.fileForm?res.data.fileForm:[]; + fileForm.push({ + file: wx.getStorageSync('dressCode')+item2.fileUrl, + fileType:'1', + bizPath:'transfer', + tableName:'t_yinnong_transfer', + tableId:'' + }) + list.push({ + tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl, + id:item2.id + }) + that.setData({ + ["form.fileNum"]:that.data.form.fileNum+1, + ["form.SJimage"]:list, + ["form.fileForm"]:fileForm, + }); + + }) + + } + }) + //发票 + UTIL.httpRequest( + API.URL_GET_FINDLIST, + { + method:'GET', + tableName:'t_yinnong_transfer', + tableId:res.data.id, + fileType:2 + }, + { + success: (res) => { + let list = []; + res.data.forEach((item2,index2)=>{ + let fileForm = res.data.fileForm?res.data.fileForm:[]; + fileForm.push({ + file: wx.getStorageSync('dressCode')+item2.fileUrl, + fileType:'2', + bizPath:'transfer', + tableName:'t_yinnong_transfer', + tableId:res.data.id + }) + list.push({ + tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl, + id:item2.id + }) + that.setData({ + ["form.fileNum"]:that.data.form.fileNum+1, + ["form.FPimage"]:list, + ["form.fileForm"]:fileForm + }); + }) + } + }) + //其他 + UTIL.httpRequest( + API.URL_GET_FINDLIST, + { + method:'GET', + tableName:'t_yinnong_transfer', + tableId:res.data.id, + fileType:3 + }, + { + success: (res) => { + let list = []; + res.data.forEach((item2,index2)=>{ + let fileForm = res.data.fileForm?res.data.fileForm:[]; + fileForm.push({ + file: wx.getStorageSync('dressCode')+item2.fileUrl, + fileType:'3', + bizPath:'transfer', + tableName:'t_yinnong_transfer', + tableId:res.data.id + }) + list.push({ + tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl, + id:item2.id + }) + that.setData({ + ["form.fileNum"]:that.data.form.fileNum+1, + ["form.QTimage"]:list, + ["form.fileForm"]:fileForm + }); + }) + } + }) + + let query = { + method:'GET', + // accountType:res.data.accountType, + // status:"0", + // orderByColumn: "id", + // isAsc: "desc", + } + UTIL.httpRequest(API.URL_GET_TRANSFERINFOS+options.id, query, { + success: (response) => { + if (res.code == API.SUCCESS_CODE) { + for(let i = 0 ; i < response.rows.length ; i++){ + response.rows[i].bankTypeText = UTIL.getTransform(response.rows[i].bankType,that.data.bankTypeOptions); + } + that.setData({ + ["form.payeeList"]:response.rows + }) + } + } + }) + + that.setData({ + form:res.data, + isUpdate:true, + showFile:true, + activeNames:null, + }) + UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, { + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + that.setData({ + ["form.approvalItemTemplate.submitCompany"]:res.user.bookName, + ["form.approvalItemTemplate.submitDate"]:UTIL.js_date_time(new Date()), + ["form.approvalItemTemplate.submitter"]:res.user.nickName, + ["form.approvalItemTemplate.telephone"]:res.user.phonenumber, + }) + + } + } + }) + UTIL.hideLoadingHaveMask(); + } + } + }) + },1000) + }else{ + //村账户查询参数 + var perames = { + pageNum:1, + pageSize:999, + accountType:'102', + method:'post', + } + // 付款方列表 + UTIL.httpRequest(API.URL_GET_SELECTACCOUNTLIST , perames, { + success: (res) => { + console.log(res); + that.setData({ + accountOptions:res.rows, + ["form.applyDate"]: UTIL.formatDate(new Date()), + applyDate: UTIL.formatDate(new Date()), + }) + } + }) + UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, { + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + that.setData({ + ["form.approvalItemTemplate.submitCompany"]:res.user.bookName, + ["form.approvalItemTemplate.submitDate"]:UTIL.js_date_time(new Date()), + ["form.approvalItemTemplate.submitter"]:res.user.nickName, + ["form.approvalItemTemplate.telephone"]:res.user.phonenumber, + }) + + } + } + }) + } + + }, + onChangeBox(event) { + console.log(event); + this.setData({ + activeNames: event.detail, + }); + }, + onChangePayee(event) { + console.log(event); + this.setData({ + ["form.activeName"]:event.detail + }); + }, + onClosePayee(event){ + console.log("aaa"); + this.setData({ + ["form.activeName"]:'' + }); + }, + onChangeSteps(event) { + console.log(event); + this.setData({ + activeStepsNames:event.detail + }); + }, + onCloseSteps(event){ + console.log("aaa"); + this.setData({ + activeStepsNames:'' + }); + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + openBox(even){ + console.log(even.currentTarget.dataset.name); + this.setData({ + [even.currentTarget.dataset.name]:true + }) + }, + closeBox(even){ + console.log(even); + this.setData({ + [even.currentTarget.dataset.name]:false + }) + }, + onConfirm(event) { + this.setData({ + [event.currentTarget.dataset.name]: false, + [event.currentTarget.dataset.value]: UTIL.formatDate(event.detail), + }); + }, + onConfirmPick(event) { + console.log(event); + this.setData({ + [event.currentTarget.dataset.name]: false, + [event.currentTarget.dataset.value]: event.detail.value.dictValue, + [event.currentTarget.dataset.value+'Text']: event.detail.value.dictLabel, + }); + }, + onConfirmPickApproval(event) { + console.log(event); + var that = this; + this.setData({ + showApprovalTemplateName: false, + ["form.approvalTemplateName"]: event.detail.value.name, + ["form.approvalTemplateId"]: event.detail.value.id, + }); + // 审批模板 + UTIL.httpRequest(API.URL_GET_selectApprovalByTemplateId+event.detail.value.id , {method:'GET'}, { + success: (rres) => { + that.setData({ + steps:rres.approvalDetails + }) + } + }) + }, + onConfirmAccount(event) { + console.log(event); + var that = this; + // 所属银行字典查询 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, { + success: (res) => { + this.setData({ + [event.currentTarget.dataset.name]: false, + [event.currentTarget.dataset.value+'.payer']: event.detail.value.accountName, + [event.currentTarget.dataset.value+'.cashierId']: event.detail.value.id, + [event.currentTarget.dataset.value+'.bankAccountNumber']: event.detail.value.bankAccountNumber, + [event.currentTarget.dataset.value+'.bankTypeText']: UTIL.getTransform(event.detail.value.bankType,that.data.bankTypeOptions), + [event.currentTarget.dataset.value+'.bankType']: event.detail.value.bankType, + [event.currentTarget.dataset.value+'.payerAccount']:event.detail.value.bankAccountNumber, + [event.currentTarget.dataset.value+'.balance']:event.detail.value.balance, + [event.currentTarget.dataset.value+'.isPeers']:"N", + [event.currentTarget.dataset.value+'.payeeList'] : [{//收款方账户集合 + payeeId:'0',//收款方id + payee:'',//收款方 + bankDeposit:'',//开户行 + incomeAmount:'',//收入金额 + bankType:'',//所属银行0其他银行1中国银行2农商行(山东省)3农业银行4建设银行5工商银行 + payeeAccount:'',//收款账户 + }] + }); + } + }) + }, + onConfirmaTransfer(event) { + console.log(event); + var that = this; + let perames = {}; + this.setData({ + [event.currentTarget.dataset.value+'.payer']: '', + [event.currentTarget.dataset.value+'.payerAccount']: '', + [event.currentTarget.dataset.value+'.bankTypeText']: '', + [event.currentTarget.dataset.value+'.bankType']: '', + [event.currentTarget.dataset.value+'.bankAccountType']: '2', + [event.currentTarget.dataset.value+'.isPeers']: '', + [event.currentTarget.dataset.value+'.paymentPattern']: event.detail.value.dictValue, + [event.currentTarget.dataset.value+'.amountReadonly']:false, + [event.currentTarget.dataset.value+'.payeeList']:[{//收款方账户集合 + payeeId:'0',//收款方id + payee:'',//收款方 + bankDeposit:'',//开户行 + incomeAmount:'',//收入金额 + bankType:'',//所属银行0其他银行1中国银行2农商行(山东省)3农业银行4建设银行5工商银行 + payeeAccount:'',//收款账户 + }], + balance:0, + }); + console.log(event.detail.value.dictValue); + + if(event.detail.value.dictValue == 1 || event.detail.value.dictValue == 2 || event.detail.value.dictValue == 4 || event.detail.value.dictValue == 6 || event.detail.value.dictValue == 7 ){event.detail.value.dictValue = 1 ;} + else if(event.detail.value.dictValue == 3){event.detail.value.dictValue = 2 ;} + else if(event.detail.value.dictValue == 5){event.detail.value.dictValue = 12 ;} + else if(event.detail.value.dictValue == 8){event.detail.value.dictValue = 11 ;} + + if(event.detail.value.dictValue == 1){//村账户查询参数 + perames = { + pageNum:1, + pageSize:999, + accountType:'102', + method:'post', +   params: { +         "townAccountType":"0" +     } + } + // 付款方列表 + UTIL.httpRequest(API.URL_GET_SELECTACCOUNTLIST , perames, { + success: (res) => { + that.setData({ + accountOptions:res.rows, + }) + } + }) + } + if(event.detail.value.dictValue == 2 || event.detail.value.dictValue == 10){//公务卡和现金提现查询参数 + perames = { + pageNum:1, + pageSize:999, + accountType:'102', + method:'GET', + villageAccountType:'' + } + // 付款方列表 + UTIL.httpRequest(API.URL_GET_ACCOUNTLIST , perames, { + success: (res) => { + that.setData({ + accountOptions:res.rows, + }) + } + }) + } + if(event.detail.value.dictValue == 11){//现金使用查询参数 + perames = { + pageNum:1, + pageSize:999, + accountType:'101', + method:'GET' + } + // 付款方列表 + UTIL.httpRequest(API.URL_GET_ACCOUNTLIST , perames, { + success: (res) => { + that.setData({ + accountOptions:res.rows + }) + } + }) + } + if(event.detail.value.dictValue == 4){//代管账户查询参数 + perames = { + pageNum:1, + pageSize:999, + accountType:'102', + method:'GET', + villageAccountType:'1' + } + // 付款方列表 + UTIL.httpRequest(API.URL_GET_ACCOUNTLIST , perames, { + success: (res) => { + that.setData({ + accountOptions:res.rows, + }) + } + }) + } + if(event.detail.value.dictValue == 12){//汇票支出查询参数 + perames = { + pageNum:1, + pageSize:999, + } + // 付款方列表 + UTIL.httpRequest(API.URL_GET_MONEYORDERLIST , perames, { + success: (res) => { + that.setData({ + moneyorderOptions:res.rows, + [event.currentTarget.dataset.value+'.amountReadonly']:true + }) + } + }) + } + this.setData({ + [event.currentTarget.dataset.name]: false, + [event.currentTarget.dataset.value+'.transferType']: event.detail.value.dictValue, + [event.currentTarget.dataset.value+'.transferTypeText']: event.detail.value.dictLabel, + }); + }, + onConfirmProject(event) { + console.log(event); + this.setData({ + [event.currentTarget.dataset.name]: false, + [event.currentTarget.dataset.value+'.projectName']: event.detail.value.projectName, + [event.currentTarget.dataset.value+'.projectId']: event.detail.value.id, + [event.currentTarget.dataset.value+'.projectContractor']: event.detail.value.projectContractor, + [event.currentTarget.dataset.value+'.projectAmount']: event.detail.value.projectAmount, + }); + }, + onConfirmContraction(event) { + console.log(event); + this.setData({ + [event.currentTarget.dataset.name]: false, + [event.currentTarget.dataset.value+".name"]: event.detail.value.name, + [event.currentTarget.dataset.value+'.code']: event.detail.value.code, + [event.currentTarget.dataset.value+'.totalAmount']: event.detail.value.totalAmount, + [event.currentTarget.dataset.value+'.contractionId']: event.detail.value.id, + }); + }, + onConfirmMoneyOrder(event) { + console.log(event); + var that = this ; + this.setData({ + [event.currentTarget.dataset.name]: false, + [event.currentTarget.dataset.value+'.moneyOrderForm']: event.detail.value, + [event.currentTarget.dataset.value+'.expenditureAmount']: event.detail.value.orderAmount, + [event.currentTarget.dataset.value+".payeeList[0].incomeAmount"]: event.detail.value.orderAmount, + [event.currentTarget.dataset.value+'.payer']:event.detail.value.billPayUnit, + [event.currentTarget.dataset.value+'.payerAccount'] : event.detail.value.orderNum, + [event.currentTarget.dataset.value+'.cashierId'] : event.detail.value.id, + [event.currentTarget.dataset.value+'.startTime'] : event.detail.value.startTime, + [event.currentTarget.dataset.value+'.endTime'] : event.detail.value.endTime, + [event.currentTarget.dataset.value+'.orderType'] : event.detail.value.orderType + }); + + var moneyCount = 0 ; + for (let i = 0; i < that.data.form.transfers.length; i++) { + const element = that.data.form.transfers[i]; + for (let j = 0; j < element.payeeList.length; j++) { + const element2 = element.payeeList[j]; + var allCount = 0 ; + moneyCount = parseFloat(moneyCount)+parseFloat(element2.incomeAmount); + // allCount = parseFloat(allCount)+parseFloat(element2.incomeAmount); + // this.setData({ + // ["form.transfers["+i+"].expenditureAmount"]:allCount, + // }) + } + } + console.log(moneyCount.toFixed(2)); + this.setData({ + ["form.approvalItemTemplate.totalAmount"]:moneyCount.toFixed(2), + }) + }, + goPayeeList(event){ + console.log(event) + if(event.currentTarget.dataset.payer == null || event.currentTarget.dataset.payer == ''){ + UTIL.showToastNoneIcon('请先选择付款方!'); + return; + } + if(this.data.form.payeeList.length>10){ + return; + } + if(event.currentTarget.dataset.accounttype == null ){ + event.currentTarget.dataset.accounttype = '' + } + // '/pages/payee/index?isPeers='+event.currentTarget.dataset.ispeers+'&bankType='+event.currentTarget.dataset.banktype+'&accountType='+event.currentTarget.dataset.accounttype+'&transferType='+event.currentTarget.dataset.transfertype + '&index='+event.currentTarget.dataset.index+'&money='+this.data.form.transfers + wx.navigateTo({ + url: '/pages/payee/index?transferType='+event.currentTarget.dataset.transfertype+'&money='+this.data.form.expenditureAmount + '&index='+event.currentTarget.dataset.index + '&isPeers='+this.data.form.isPeers+'&bankType='+event.currentTarget.dataset.banktype, + }) + }, + goPayee(event){ + wx.navigateTo({ + url: '/pages/pay/payee/payee?options='+JSON.stringify(event.currentTarget.dataset.option) + }) + }, + onChange(event){ + console.log(event); + this.setData({ + [event.currentTarget.dataset.value]: event.detail, + }) + }, + onChangeZZFY(event){ + console.log(event); + this.setData({ + [event.currentTarget.dataset.value]: event.detail, + }) + }, + onChangeHnzz(event){ + console.log(event); + this.setData({ + [event.currentTarget.dataset.value]: event.detail, + ["form.payeeList"]: [{//收款方账户集合 + payeeId:'0',//收款方id + payee:'',//收款方 + bankDeposit:'',//开户行 + incomeAmount:'',//收入金额 + bankType:'',//所属银行0其他银行1中国银行2农商行(山东省)3农业银行4建设银行5工商银行 + payeeAccount:'',//收款账户 + }], + }) + }, + onChangeTime(event){ + console.log(event); + this.setData({ + applyDate: event.detail, + }) + }, + onConfirmTime(event){ + this.setData({ + [event.currentTarget.dataset.name]: false, + applyDate: UTIL.formatDate(event.detail), + }); + this.setData({ + ["form.applyDate"]:UTIL.formatDate(event.detail), + }) + }, + onChangeMoneyOut(event){ + console.log(event); + var that = this; + if( !(event.detail.value > -1)){ + this.setData({ + ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:'', + }) + return; + } + + if( event.detail.value.indexOf('.')>0 && event.detail.value.toString().split(".")[1].length>2){ + this.setData({ + ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:event.detail.value.toString().split(".")[0] + '.' + event.detail.value.toString().split(".")[1].substr(0,2), + }) + return; + } + + this.setData({ + // ["form.transfers["+event.currentTarget.dataset.index+"].payeeList["+event.currentTarget.dataset.childrenindex+"].incomeAmount"]: event.detail, + ["form.transfers["+event.currentTarget.dataset.index+"].payeeList[0].incomeAmount"]: event.detail.value, + ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:event.detail.value, + // ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:event.detail, + }) + if(event.detail.value == ''){ + that.data.form.transfers[event.currentTarget.dataset.index].payeeList[0].incomeAmount = parseFloat(0).toFixed(2); + that.data.form.transfers[event.currentTarget.dataset.index].expenditureAmount = parseFloat(0).toFixed(2); + } + var moneyCount = 0 ; + for (let i = 0; i < that.data.form.transfers.length; i++) { + + const element = that.data.form.transfers[i]; + for (let j = 0; j < element.payeeList.length; j++) { + const element2 = element.payeeList[j]; + console.log(element2.incomeAmount); + var allCount = 0 ; + moneyCount = parseFloat(moneyCount) + parseFloat(element2.incomeAmount); + + // allCount = parseFloat(allCount)+parseFloat(element2.incomeAmount); + // this.setData({ + // ["form.transfers["+i+"].expenditureAmount"]:allCount, + // }) + } + } + + this.setData({ + ["form.approvalItemTemplate.totalAmount"]:moneyCount.toFixed(2), + }) + }, + onChangeMoney(event){ + console.log(event); + var that = this; + if( !(event.detail > -1)){ + this.setData({ + ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:'', + }) + return; + } + + if( event.detail.indexOf('.')>0 && event.detail.toString().split(".")[1].length>2){ + this.setData({ + ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:event.detail.toString().split(".")[0] + '.' + event.detail.toString().split(".")[1].substr(0,2), + }) + return; + } + + this.setData({ + // ["form.transfers["+event.currentTarget.dataset.index+"].payeeList["+event.currentTarget.dataset.childrenindex+"].incomeAmount"]: event.detail, + ["form.transfers["+event.currentTarget.dataset.index+"].payeeList[0].incomeAmount"]: event.detail, + ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:event.detail, + // ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:event.detail, + }) + if(event.detail == ''){ + that.data.form.transfers[event.currentTarget.dataset.index].payeeList[0].incomeAmount = parseFloat(0).toFixed(2); + that.data.form.transfers[event.currentTarget.dataset.index].expenditureAmount = parseFloat(0).toFixed(2); + } + console.log(that.data.form); + var moneyCount = 0 ; + for (let i = 0; i < that.data.form.transfers.length; i++) { + const element = that.data.form.transfers[i]; + for (let j = 0; j < element.payeeList.length; j++) { + const element2 = element.payeeList[j]; + var allCount = 0 ; + moneyCount = parseFloat(moneyCount)+parseFloat(element2.incomeAmount); + // allCount = parseFloat(allCount)+parseFloat(element2.incomeAmount); + // this.setData({ + // ["form.transfers["+i+"].expenditureAmount"]:allCount, + // }) + } + } + this.setData({ + ["form.approvalItemTemplate.totalAmount"]:moneyCount.toFixed(2), + }) + }, + back:function(){ + wx.navigateBack({ + delta: 1 + }) + }, + goSubmitMB(){ + this.setData({ + showDialog:true + }) + }, + onClose(){ + this.setData({ + showDialog:false + }) + }, + bindNameInput(even){ + this.setData({ + ["form.approvalItemTemplate.templateName"]:even.detail.value + }) + }, + goSubmit(e){ + var that = this; + console.log(that.data.form); + var list = that.data.form; + // approvalItems = list.approvalItemTemplate.approvalItems; + // if(approvalItems == ''){ + // UTIL.showToastNoneIcon('请填写审批事项名称!'); + // that.setData({ + // topInputTirme:true + // }) + // return; + // } + + if(list.applyDate == ''){ + UTIL.showToastNoneIcon('请选择申请时间!'); + return; + } + if(list.remark == ''){ + UTIL.showToastNoneIcon('请填写转账附言!'); + return; + } + if(list.explainSituation == ''){ + UTIL.showToastNoneIcon('请填写说明情况!'); + return; + } + if(list.expenditureAmount == ''){ + UTIL.showToastNoneIcon('请检查收款方收款金额!'); + return; + } + console.log(parseFloat(list.expenditureAmount).toFixed(2)) + console.log(parseFloat(list.payerAccount).toFixed(2)) + console.log(list.transferType); + if((parseFloat(list.expenditureAmount).toFixed(2) - parseFloat(list.payerAccount).toFixed(2) >0) && list.transferType == 11){ + UTIL.showToastNoneIcon('支出金额不能超过付款账户余额!'); + return; + } + if(list.payer == ''&&list.transferType != 12){ + UTIL.showToastNoneIcon('请选择付款方!'); + return; + } + if(list.payeeList[0].payee == ''&&list.transferType!=12){ + UTIL.showToastNoneIcon('请选择收款方!'); + return; + } + if((list.payeeList[0].incomeAmount == '' || list.payeeList[0].incomeAmount == undefined)&&list.transferType!=12){ + UTIL.showToastNoneIcon('请填写收款方的收入金额!'); + return; + } + + if(list.transferType == '12'){ + list.transfers[i].payer = list.transfers[i].moneyOrderForm.billPayUnit; + list.transfers[i].payerAccount = list.transfers[i].moneyOrderForm.orderNum; + list.transfers[i].cashierId = list.transfers[i].moneyOrderForm.id; + list.transfers[i].startTime = list.transfers[i].moneyOrderForm.startTime; + list.transfers[i].endTime = list.transfers[i].moneyOrderForm.endTime; + list.transfers[i].orderType = list.transfers[i].moneyOrderForm.orderType; + } + + if(e.currentTarget.dataset.type == 1){ + if(that.data.form.approvalItemTemplate.templateName == ''){ + UTIL.showToastNoneIcon('请输入模板名称!'); + return; + } + } + if(e.currentTarget.dataset.type == 3){ + for (let i = 0; i < that.data.form.transfers.length; i++) { + that.data.form.transfers[i].approvalMode = '2'; + } + that.data.form.approvalItemTemplate.dataType = e.currentTarget.dataset.type + } + that.data.form.method = 'POST'; + that.data.form.approvalItemTemplate.dataType = e.currentTarget.dataset.type; + + console.log(that.data.form); + UTIL.httpRequest(API.URL_GET_SAVE, that.data.form, { + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + console.log(res.data.transfers.length); + for (let j = 0; j < res.data.transfers.length; j++) { + if(that.data.form.transfers[j].capitalExpenditureType == 2){ + that.data.form.transfers[j].projectForm.ynType = res.data.transfers[j].transferType=='1'||res.data.transfers[j].transferType=='2'||res.data.transfers[j].transferType=='4'?'1':'2'; + that.data.form.transfers[j].projectForm.outId = res.data.transfers[j].id; + that.data.form.transfers[j].projectForm.method = 'POST'; + // 工程项目提交 + UTIL.httpRequest(API.URL_GET_ADDPROJECTTO , that.data.form.transfers[j].projectForm, { + success: (res) => { + } + }) + } + if(that.data.form.transfers[j].capitalExpenditureType == 4){ + that.data.form.transfers[j].contractionForm.transferId = res.data.transfers[j].id; + that.data.form.transfers[j].contractionForm.id = ''; + that.data.form.transfers[j].contractionForm.method = 'POST'; + // 关联合同提交 + UTIL.httpRequest(API.URL_GET_GETRELATIONADD , that.data.form.transfers[j].contractionForm, { + success: (res) => { + } + }) + } + + // if(that.data.form.transfers[j].fileForm == undefined){continue;} + + that.data.form.transfers[j].id = res.data.transfers[j].id + console.log(that.data.form.transfers[j]) + that.upDownFile(that.data.form.transfers[j]).then(response=>{ + wx.hideLoading(); + console.log(e.currentTarget.dataset.type); + if(e.currentTarget.dataset.type == 0){ + wx.navigateTo({ + url: '/pages/apply/approval/approval?id='+res.data.approvalItemTemplate.id+'&deptId='+res.data.approvalItemTemplate.deptId+'&form='+JSON.stringify(res.data)+'&type='+that.data.formType+'&applyOptions='+JSON.stringify(that.data.templateModel), + }) + } + if(e.currentTarget.dataset.type == 2){ + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000, + }) + } + if(e.currentTarget.dataset.type == 1){ + console.log("aaa"); + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + } + if(e.currentTarget.dataset.type == 3){ + UTIL.httpRequest(API.URL_GET_TOREVIEWSUBMIT+res.data.approvalItemTemplate.id , {method:'POST'}, { + success: (res2) => { + if (res2.code == API.SUCCESS_CODE) { + wx.showToast({ + title: '操作成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + }else{ + wx.showToast({ + title: '操作失败', + icon: 'error', + duration: 2000 + }) + } + } + }) + } + }).catch((err) => { + console.log(err); + wx.hideLoading(); + if(e.currentTarget.dataset.type == 0){ + wx.navigateTo({ + url: '/pages/apply/approval/approval?id='+res.data.approvalItemTemplate.id+'&deptId='+res.data.approvalItemTemplate.deptId+'&form='+JSON.stringify(res.data)+'&type='+that.data.formType+'&applyOptions='+JSON.stringify(that.data.templateModel), + }) + } + if(e.currentTarget.dataset.type == 2){ + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000, + }) + } + if(e.currentTarget.dataset.type == 1){ + console.log("aaa"); + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + } + if(e.currentTarget.dataset.type == 3){ + UTIL.httpRequest(API.URL_GET_TOREVIEWSUBMIT+res.data.approvalItemTemplate.id , {method:'POST'}, { + success: (res2) => { + if (res2.code == API.SUCCESS_CODE) { + wx.showToast({ + title: '操作成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + }else{ + wx.showToast({ + title: '操作失败', + icon: 'error', + duration: 2000 + }) + } + } + }) + } + }) + } + } + } + }) + }, + + goSubmitNew(e){ + var that = this; + console.log(that.data.form); + var list = that.data.form; + + if(list.applyDate == ''){ + UTIL.showToastNoneIcon('请选择申请时间!'); + return; + } + if(list.remark == ''){ + UTIL.showToastNoneIcon('请填写转账附言!'); + return; + } + var p = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]") + if (p.test(list.remark)) { + UTIL.showToastNoneIcon('‘转账附言’存在非法字符,请尽量简洁并减少标点符号的使用,详情可在‘说明情况’中描述。'); + return; + } + // if(list.explainSituation == ''){ + // UTIL.showToastNoneIcon('请填写说明情况!'); + // return; + // } + if(list.expenditureAmount == ''){ + UTIL.showToastNoneIcon('请检查收款方收款金额!'); + return; + } + if((parseFloat(list.expenditureAmount).toFixed(2) - parseFloat(list.payerAccount).toFixed(2) >0) && list.transferType == 11){ + UTIL.showToastNoneIcon('支出金额不能超过付款账户余额!'); + return; + } + if(list.payer == ''&&list.transferType != 12){ + UTIL.showToastNoneIcon('请选择付款方!'); + return; + } + if(list.payeeList[0].payee == ''&&list.transferType!=12){ + UTIL.showToastNoneIcon('请选择收款方!'); + return; + } + for(let i = 0 ; i < list.payeeList.length ; i++){ + if(list.payeeList[i].payee == ''){ + UTIL.showToastNoneIcon('请选择收款方!'); + return; + } + console.log(list.transferType); + if((list.payeeList[i].incomeAmount == '' || list.payeeList[i].incomeAmount == undefined)){ + UTIL.showToastNoneIcon('请填写收款方的收入金额!'); + return; + } + console.log(isNaN(parseFloat(list.payeeList[i].incomeAmount))); + console.log(!isFinite(list.payeeList[i].incomeAmount)); + if(isNaN(parseFloat(list.payeeList[i].incomeAmount)) || !isFinite(list.payeeList[i].incomeAmount)){ + UTIL.showToastNoneIcon('请填写正确的收款方收入金额!'); + return; + } + } + if(list.capitalExpenditureType == 2){ + if(list.projectForm.projectName==""||list.projectForm.projectName==null){ + UTIL.showToastNoneIcon('请选择项目名称!'); + return; + } + if(list.projectForm.projectBillNum==""||list.projectForm.projectBillNum==null){ + UTIL.showToastNoneIcon('请输入工程发票号!'); + return; + } + } + + if(list.capitalExpenditureType==4){ + if(list.contractionForm.name==""||list.contractionForm.name==null){ + UTIL.showToastNoneIcon('请选择合同名称!'); + return; + } + if(list.contractionForm.code==""||list.contractionForm.code==null){ + UTIL.showToastNoneIcon('请输入合同编码!'); + return; + } + if(list.contractionForm.totalAmount==""||list.contractionForm.totalAmount==null){ + UTIL.showToastNoneIcon('请输入合同价款!'); + return; + } + } + + if(list.transferType == '12'){ + list.transfers[i].payer = list.transfers[i].moneyOrderForm.billPayUnit; + list.transfers[i].payerAccount = list.transfers[i].moneyOrderForm.orderNum; + list.transfers[i].cashierId = list.transfers[i].moneyOrderForm.id; + list.transfers[i].startTime = list.transfers[i].moneyOrderForm.startTime; + list.transfers[i].endTime = list.transfers[i].moneyOrderForm.endTime; + list.transfers[i].orderType = list.transfers[i].moneyOrderForm.orderType; + } + that.data.form.method = 'POST'; + + console.log(that.data.form); + UTIL.httpRequest(API.URL_GET_TRANSFERADD, that.data.form, { + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + if(that.data.form.capitalExpenditureType == 2){ + that.data.form.projectForm.ynType = res.data.transferType=='1'||res.data.transferType=='2'||res.data.transferType=='4'?'1':'2'; + that.data.form.projectForm.outId = res.data.id; + that.data.form.projectForm.method = 'POST'; + // 工程项目提交 + UTIL.httpRequest(API.URL_GET_ADDPROJECTTO , that.data.form.projectForm, { + success: (res) => { + } + }) + } + if(that.data.form.capitalExpenditureType == 4){ + that.data.form.contractionForm.transferId = res.data.id; + that.data.form.contractionForm.id = ''; + that.data.form.contractionForm.method = 'POST'; + // 关联合同提交 + UTIL.httpRequest(API.URL_GET_GETRELATIONADD , that.data.form.contractionForm, { + success: (res) => { + } + }) + } + + // if(that.data.form.fileForm == undefined){continue;} + + that.data.form.id = res.data.id + that.setData({ + showFile:true + }) + // console.log(that.data.form) + } + } + }) + }, + + upLoadNew(){ + var that = this; + that.upDownFile(that.data.form).then(response=>{ + wx.hideLoading(); + console.log(e.currentTarget.dataset.type); + if(e.currentTarget.dataset.type == 0){ + wx.navigateTo({ + url: '/pages/apply/approval/approval?id='+res.data.approvalItemTemplate.id+'&deptId='+res.data.approvalItemTemplate.deptId+'&form='+JSON.stringify(res.data)+'&type='+that.data.formType+'&applyOptions='+JSON.stringify(that.data.templateModel), + }) + } + if(e.currentTarget.dataset.type == 2){ + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000, + }) + } + if(e.currentTarget.dataset.type == 1){ + console.log("aaa"); + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + } + if(e.currentTarget.dataset.type == 3){ + UTIL.httpRequest(API.URL_GET_TOREVIEWSUBMIT+res.data.approvalItemTemplate.id , {method:'POST'}, { + success: (res2) => { + if (res2.code == API.SUCCESS_CODE) { + wx.showToast({ + title: '操作成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + }else{ + wx.showToast({ + title: '操作失败', + icon: 'error', + duration: 2000 + }) + } + } + }) + } + }).catch((err) => { + console.log(err); + wx.hideLoading(); + if(e.currentTarget.dataset.type == 0){ + wx.navigateTo({ + url: '/pages/apply/approval/approval?id='+res.data.approvalItemTemplate.id+'&deptId='+res.data.approvalItemTemplate.deptId+'&form='+JSON.stringify(res.data)+'&type='+that.data.formType+'&applyOptions='+JSON.stringify(that.data.templateModel), + }) + } + if(e.currentTarget.dataset.type == 2){ + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000, + }) + } + if(e.currentTarget.dataset.type == 1){ + console.log("aaa"); + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + } + if(e.currentTarget.dataset.type == 3){ + UTIL.httpRequest(API.URL_GET_TOREVIEWSUBMIT+res.data.approvalItemTemplate.id , {method:'POST'}, { + success: (res2) => { + if (res2.code == API.SUCCESS_CODE) { + wx.showToast({ + title: '操作成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + }else{ + wx.showToast({ + title: '操作失败', + icon: 'error', + duration: 2000 + }) + } + } + }) + } + }) + }, + + upDownFile(op){ + var that = this; + console.log(op) + wx.showLoading({ + title: '正在上传附件', + mask:true + }) + return new Promise((resolve, reject) => { + if(op.fileForm.length > 0){ + for (let i = 0; i < op.fileForm.length; i++) { + op.fileForm[i].tableId = op.id + const element = op.fileForm[i]; + console.log(element); + wx.uploadFile({ + url: wx.getStorageSync('dressCode')+API.URL_GET_UPLOAD, + filePath: element.file, + name: 'file', + header: { + "Content-Type": "multipart/form-data",//记得设置 + "chartset":"utf-8", + 'Authorization':'Bearer '+getApp().globalData.userInfo.token + }, + formData:element, + success (response){ + if(op.fileForm.length == (i+1)){ + resolve(); + } + }, + fail(res){ + console.log(res) + reject(); + } + }) + } + }else{ + reject(); + } + }); + + }, + + goCustomSubmit(){ + var that = this; + UTIL.httpRequest(API.URL_GET_TRANSFERCUSTOMSUBMIT+this.data.form.id, {method : 'POST'}, { + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + wx.showToast({ + title: '提交成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + } + } + }) + }, + goCustomSubmit2(){ + var that = this; + wx.showLoading({ + title: '正在提交', + mask:true + }) + that.goKeepNew(); + setTimeout(() => { + UTIL.httpRequest(API.URL_GET_TRANSFERCUSTOMSUBMIT+this.data.form.id, {method : 'POST'}, { + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + wx.hideLoading(); + wx.showToast({ + title: '提交成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + } + } + }) + }, 1000); + + }, + + bindKeyInput(even){ + console.log(even); + this.setData({ + ["form.approvalItemTemplate.approvalItems"]: even.detail, + }) + }, + errorPd(e){ + console.log(e); + this.setData({ + [e.currentTarget.dataset.formname+"Tirme"]:e.detail.value == '' ? true:false + }) + }, + errorJE(e){ + console.log(e); + this.setData({ + [e.currentTarget.dataset.formname+"Tirme"]:e.detail.value == '' ? true:false + }) + }, + errorYY(e){ + console.log(e); + this.setData({ + [e.currentTarget.dataset.formname+"Tirme"]:e.detail.value == '' ? true:false + }) + }, + SJtakephoto(e){ + var that = this; + let fileForm = []; + wx.chooseMedia({ + mediaType: ['image'], + sourceType: ['album', 'camera'], + camera: 'back', + count: 1, + success(res) { + console.log(res); + res.tempFiles.forEach(item => { + fileForm.push({ + file: item.tempFilePath, + fileType:'1', + bizPath:'transfer', + tableName:'t_yinnong_transfer', + tableId:that.data.form.id + }) + }) + console.log(fileForm); + let tem = that.data.form.SJimage?that.data.form.SJimage:[]; + res.tempFiles.forEach(r=>{ + tem.push({ + tempFilePath:r.tempFilePath + }) + }) + console.log(tem); + that.setData({ + ["form.SJimage"]:tem, + ["form.fileForm"]:fileForm, + }) + let SJlength = that.data.form.SJimage == undefined ? 0:that.data.form.SJimage.length; + let FPlength = that.data.form.FPimage == undefined ? 0:that.data.form.FPimage.length; + let QTlength = that.data.form.QTimage == undefined ? 0:that.data.form.QTimage.length; + let fileNum = parseInt( SJlength ) + parseInt( FPlength ) + parseInt( QTlength ) ; + that.setData({ + ["form.fileNum"]:fileNum, + }) + + const element = fileForm[0]; + wx.uploadFile({ + url: wx.getStorageSync('dressCode')+API.URL_GET_UPLOAD, + filePath: res.tempFiles[0].tempFilePath, + name: 'file', + header: { + "Content-Type": "multipart/form-data",//记得设置 + "chartset":"utf-8", + 'Authorization':'Bearer '+getApp().globalData.userInfo.token + }, + formData:element, + success (response){ + wx.showToast({ + title: '上传成功', + icon: 'success', + duration: 2000, + }) + }, + fail(res){ + console.log(res) + } + }) + + },fail(err){ + console.log(err); + } + }) + }, + FPtakephoto(e){ + var that = this; + let fileForm = []; + console.log(fileForm); + wx.chooseMedia({ + mediaType: ['image'], + sourceType: ['album', 'camera'], + camera: 'back', + count: 1, + success(res) { + console.log(res); + res.tempFiles.forEach(item => { + fileForm.push({ + file: item.tempFilePath, + fileType:'2', + bizPath:'transfer', + tableName:'t_yinnong_transfer', + tableId:that.data.form.id + }) + }) + + let tem = that.data.form.FPimage?that.data.form.FPimage:[]; + + res.tempFiles.forEach(r=>{ + tem.push({ + tempFilePath:r.tempFilePath + }) + }) + + console.log(tem); + that.setData({ + ["form.FPimage"]:tem, + ["form.fileForm"]:fileForm + }) + let SJlength = that.data.form.SJimage == undefined ? 0:that.data.form.SJimage.length; + let FPlength = that.data.form.FPimage == undefined ? 0:that.data.form.FPimage.length; + let QTlength = that.data.form.QTimage == undefined ? 0:that.data.form.QTimage.length; + let fileNum = parseInt( SJlength ) + parseInt( FPlength ) + parseInt( QTlength ) ; + that.setData({ + ["form.fileNum"]:fileNum, + }) + + const element = fileForm[0]; + console.log(element); + wx.uploadFile({ + url: wx.getStorageSync('dressCode')+API.URL_GET_UPLOAD, + filePath: res.tempFiles[0].tempFilePath, + name: 'file', + header: { + "Content-Type": "multipart/form-data",//记得设置 + "chartset":"utf-8", + 'Authorization':'Bearer '+getApp().globalData.userInfo.token + }, + formData:element, + success (response){ + wx.showToast({ + title: '上传成功', + icon: 'success', + duration: 2000, + }) + }, + fail(res){ + console.log(res) + } + }) + },fail(err){ + console.log(err); + } + }) + }, + QTtakephoto(e){ + var that = this; + let fileForm = []; + wx.chooseMedia({ + mediaType: ['image'], + sourceType: ['album', 'camera'], + camera: 'back', + count: 1, + success(res) { + console.log(res); + res.tempFiles.forEach(item => { + fileForm.push({ + file: item.tempFilePath, + fileType:'3', + bizPath:'transfer', + tableName:'t_yinnong_transfer', + tableId:that.data.form.id + }) + }) + console.log(fileForm); + let tem = that.data.form.QTimage?that.data.form.QTimage:[]; + + res.tempFiles.forEach(r=>{ + tem.push({ + tempFilePath:r.tempFilePath + }) + }) + that.setData({ + ["form.QTimage"]:tem, + ["form.fileForm"]:fileForm + }) + let SJlength = that.data.form.SJimage == undefined ? 0:that.data.form.SJimage.length; + let FPlength = that.data.form.FPimage == undefined ? 0:that.data.form.FPimage.length; + let QTlength = that.data.form.QTimage == undefined ? 0:that.data.form.QTimage.length; + let fileNum = parseInt( SJlength ) + parseInt( FPlength ) + parseInt( QTlength ) ; + that.setData({ + ["form.fileNum"]:fileNum, + }) + + const element = fileForm[0]; + wx.uploadFile({ + url: wx.getStorageSync('dressCode')+API.URL_GET_UPLOAD, + filePath: res.tempFiles[0].tempFilePath, + name: 'file', + header: { + "Content-Type": "multipart/form-data",//记得设置 + "chartset":"utf-8", + 'Authorization':'Bearer '+getApp().globalData.userInfo.token + }, + formData:element, + success (response){ + wx.showToast({ + title: '上传成功', + icon: 'success', + duration: 2000, + }) + }, + fail(res){ + console.log(res) + } + }) + + },fail(err){ + console.log(err); + } + }) + }, + addList(){ + var that = this; + let transList = this.data.form.transfers; + console.log(this.data.form); + for (let i = 0; i < transList.length; i++) { + const element = transList[i]; + if(element.applyDate == '' || element.remark == '' || element.expenditureAmount == '' || element.payer == '' || element.payeeList[0].payee == '' || element.payeeList[0].incomeAmount == '' || element.payeeList[0].incomeAmount == undefined){ + UTIL.showToastNoneIcon('事项'+UTIL.convertToChinaNum(i+1)+'的信息填写不完整,检查后重试!'); + return; + } + } + transList.push({ + num:UTIL.convertToChinaNum(transList.length+1), + expenditureAmountTirme:false, + remarkTirme:false, + showCapitalExpenditureType:false, + showApplyDate:false, + showTransferType:false, + showProject:false, + showProjectFundType:false, + showAccount:false, + showDialog:false, + showContraction:false, + SJimage:[], + FPimage:[], + QTimage:[], + activeName:0, + cashForm:{ + payee:'', + phone:'', + unit:'', + leader:'', + remark:'', + }, + showTitle:true, + capitalExpenditureType:'1',//资金支出类别 + capitalExpenditureTypeText:'结算类',//资金支出类别(展示用) + succeedAmount:'',//成功支付金额 + payer:'',//付款方 + payerAccount:'',//付款方账户 + bankType:'',//所属银行 + bankTypeText:'',//所属银行(展示用) + isPeers:'N',//是否同行 + operatorCode:'',//操作员代码 + enterpriseCode:'',//企业编码 + expenditureAmount:'',//支出总金额 + applyDate:that.data.applyDate,//申请时间 + transferStatus:'',//转账状态 + auditStatus:'0',//审批状态 + paymentState:'',//支付状态 + approvalMode:'1',//审批模式 + paymentTime:'',//支付时间 + bankPriority:'',//银行处理优先级 + clientPriority:'',//客户处理优先级 + paymentPattern:'1', + transferType:'1',//付款方式 + transferTypeText:'垫付报销:电子支付',//付款方式(展示用) + requiredTransferTime:'',//要求转账时间 + remark:'',//付款事由 + startTime:'',//开票日期 + endTime:'',//到期日期 + orderType:'',//汇票类型 + bankAccountType:'2',//账户类别1 公户2私户 + villageAccountType:'',//账户分类 + payeeList:[{//收款方账户集合 + payeeId:'0',//收款方id + payee:'',//收款方 + bankDeposit:'',//开户行 + incomeAmount:'0.00',//收入金额 + bankType:'',//所属银行0其他银行1中国银行2农商行(山东省)3农业银行4建设银行5工商银行 + payeeAccount:'',//收款账户 + }], + projectForm:{ + projectId:'', + projectName:'', + projectContractor:'', + projectAmount:'', + projectBillNum:'', + projectFundType:'', + outId:'', + ynType:'1', + }, + contractionForm:{ + contractionId:'', + name:'', + code:'', + totalAmount:'', + }, + }); + //村账户查询参数 + var perames = { + pageNum:1, + pageSize:999, + accountType:'102', + method:'post', +   params: { +         "townAccountType":"0" +     } + } + // 付款方列表 + UTIL.httpRequest(API.URL_GET_SELECTACCOUNTLIST , perames, { + success: (res) => { + that.setData({ + accountOptions:res.rows, + ["form.transfers[0].applyDate"]: UTIL.formatDate(new Date()), + applyDate: UTIL.formatDate(new Date()), + }) + } + }) + this.setData({ + ["form.transfers"] : transList, + activeNames:transList.length-1 + }) + for (let i = 0; i < this.data.form.transfers.length; i++) { + const element = this.data.form.transfers[i]; + this.setData({ + ["form.transfers["+i+"].showTitle"] : false, + }) + } + this.setData({ + ["form.transfers["+(transList.length-1)+"].showTitle"] : true, + }) + console.log(this.data.form); + }, + openPreview(e){ + let array = []; + console.log(e); + e.currentTarget.dataset.option.forEach(item=>{ + array.push(item.tempFilePath) + }) + console.log(array); + wx.previewImage({ + urls: array, + showmenu:true, + current:array[e.currentTarget.dataset.index] + }) + }, + goKeep(){ + var that = this; + let pages = getCurrentPages(); + let currentPage = null; //当前页面 + let prevPage = null; //上一个页面 + currentPage = pages[pages.length - 1]; //获取当前页面,将其赋值 + prevPage = pages[pages.length - 2]; //获取上一个页面,将其赋值 + console.log(that.data.form); + if (prevPage) { + prevPage.setData({ + form : that.data.form,//将想要传的信息赋值给上一个页面data中的值 + }) + that.back() + } + }, + goKeepNew(e){ + var that = this; + console.log(that.data.form); + var list = that.data.form; + + if(list.applyDate == ''){ + UTIL.showToastNoneIcon('请选择申请时间!'); + return; + } + if(list.remark == ''){ + UTIL.showToastNoneIcon('请填写转账附言!'); + return; + } + var p = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]") + if (p.test(list.remark)) { + UTIL.showToastNoneIcon('‘转账附言’存在非法字符,请尽量简洁并减少标点符号的使用,详情可在‘说明情况’中描述。'); + return; + } + // if(list.explainSituation == ''){ + // UTIL.showToastNoneIcon('请填写说明情况!'); + // return; + // } + if(list.expenditureAmount == ''){ + UTIL.showToastNoneIcon('请检查收款方收款金额!'); + return; + } + if((parseFloat(list.expenditureAmount).toFixed(2) - parseFloat(list.payerAccount).toFixed(2) >0) && list.transferType == 11){ + UTIL.showToastNoneIcon('支出金额不能超过付款账户余额!'); + return; + } + if(list.payer == ''&&list.transferType != 12){ + UTIL.showToastNoneIcon('请选择付款方!'); + return; + } + for(let i = 0 ; i < list.payeeList.length ; i++){ + if(list.payeeList[i].payee == ''){ + UTIL.showToastNoneIcon('请选择收款方!'); + return; + } + console.log(list.transferType); + if((list.payeeList[i].incomeAmount == '' || list.payeeList[i].incomeAmount == undefined)){ + UTIL.showToastNoneIcon('请填写收款方的收入金额!'); + return; + } + console.log(isNaN(parseFloat(list.payeeList[i].incomeAmount))); + console.log(!isFinite(list.payeeList[i].incomeAmount)); + if(isNaN(parseFloat(list.payeeList[i].incomeAmount)) || !isFinite(list.payeeList[i].incomeAmount)){ + UTIL.showToastNoneIcon('请填写正确的收款方收入金额!'); + return; + } + } + + if(list.capitalExpenditureType == 2){ + if(list.projectForm.projectName==""||list.projectForm.projectName==null){ + UTIL.showToastNoneIcon('请选择项目名称!'); + return; + } + if(list.projectForm.projectBillNum==""||list.projectForm.projectBillNum==null){ + UTIL.showToastNoneIcon('请输入工程发票号!'); + return; + } + } + + if(list.capitalExpenditureType==4){ + if(list.contractionForm.name==""||list.contractionForm.name==null){ + UTIL.showToastNoneIcon('请选择合同名称!'); + return; + } + if(list.contractionForm.code==""||list.contractionForm.code==null){ + UTIL.showToastNoneIcon('请输入合同编码!'); + return; + } + if(list.contractionForm.totalAmount==""||list.contractionForm.totalAmount==null){ + UTIL.showToastNoneIcon('请输入合同价款!'); + return; + } + } + + if(list.transferType == '12'){ + list.transfers[i].payer = list.transfers[i].moneyOrderForm.billPayUnit; + list.transfers[i].payerAccount = list.transfers[i].moneyOrderForm.orderNum; + list.transfers[i].cashierId = list.transfers[i].moneyOrderForm.id; + list.transfers[i].startTime = list.transfers[i].moneyOrderForm.startTime; + list.transfers[i].endTime = list.transfers[i].moneyOrderForm.endTime; + list.transfers[i].orderType = list.transfers[i].moneyOrderForm.orderType; + } + + + that.data.form.method = 'POST'; + + console.log(that.data.form); + UTIL.httpRequest(API.URL_GET_TRANSFEREDIT, that.data.form, { + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + if(that.data.form.capitalExpenditureType == 2){ + that.data.form.projectForm.ynType = that.data.form.transferType=='1'||that.data.form.transferType=='2'||that.data.form.transferType=='4'?'1':'2'; + that.data.form.projectForm.outId = that.data.form.id; + that.data.form.projectForm.method = 'POST'; + // 工程项目提交 + UTIL.httpRequest(API.URL_GET_ADDPROJECTTO , that.data.form.projectForm, { + success: (res) => { + } + }) + } + if(that.data.form.capitalExpenditureType == 4){ + that.data.form.contractionForm.transferId = that.data.form.id; + that.data.form.contractionForm.id = ''; + that.data.form.contractionForm.method = 'POST'; + // 关联合同提交 + UTIL.httpRequest(API.URL_GET_GETRELATIONADD , that.data.form.contractionForm, { + success: (res) => { + } + }) + } + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + + } + } + }) + }, + deleteTransfers(e){ + var that = this ; + console.log(e.currentTarget.dataset.index); + // that.data.form.collapseDis = true; + that.setData({ + ["form.collapseDis"]:true + }) + if(that.data.form.transfers.length<2){ + UTIL.showToastNoneIcon('最少保留一条事项'); + return; + } + + that.data.form.transfers[e.currentTarget.dataset.index].expenditureAmount = that.data.form.transfers[e.currentTarget.dataset.index].expenditureAmount == '' ? '0' : that.data.form.transfers[e.currentTarget.dataset.index].expenditureAmount; + that.data.form.approvalItemTemplate.totalAmount = parseFloat(parseFloat(that.data.form.approvalItemTemplate.totalAmount)- parseFloat(that.data.form.transfers[e.currentTarget.dataset.index].expenditureAmount)).toFixed(2); + that.data.form.transfers.splice(e.currentTarget.dataset.index,1); + + for (let i = 0; i < that.data.form.transfers.length; i++) { + that.data.form.transfers[i].num = UTIL.convertToChinaNum(i+1) + } + console.log(that.data.form); + that.setData({ + form:that.data.form, + }) + + + UTIL.httpRequest(API.URL_GET_TRANSFERREMOVE+e.currentTarget.dataset.id , {method:'GET'}, { + success: (res) => { + + } + }) + + + }, + disabledNone(e){ + console.log("b"); + var that = this ; + that.setData({ + ["form.transfers["+e.currentTarget.dataset.index+"].collapseDis"]:true + }) + }, + disabledBlock(e){ + console.log("a"); + var that = this ; + that.setData({ + ["form.transfers["+e.currentTarget.dataset.index+"].collapseDis"]:false + }) + }, + onOpen(e){ + var that = this ; + console.log(that.data.activeNames); + console.log(e); + for (let i = 0; i < this.data.form.transfers.length; i++) { + const element = this.data.form.transfers[i]; + this.setData({ + ["form.transfers["+i+"].showTitle"] : false, + }) + } + that.setData({ + ["form.transfers["+e.detail+"].showTitle"]:true + }) + }, + onCloseSecond(e){ + var that = this ; + console.log(e); + that.setData({ + ["form.transfers["+e.detail+"].showTitle"]:false + }) + }, + deleteimg(e){ + let options = e.currentTarget.dataset.options; + console.log(options); + let file = this.data.form.fileForm; + for (let i = 0; i < file.length; i++) { + const element = file[i]; + if(element.file == options[e.currentTarget.dataset.index].tempFilePath){ + file.splice(i,1); + } + } + options.splice(e.currentTarget.dataset.index,1); + let length = this.data.form.fileNum - 1; + this.setData({ + [e.currentTarget.dataset.name]:options, + ["form.fileNum"]:length, + ["form.fileForm"]:file, + }) + UTIL.httpRequest(API.URL_GET_GETFILEREMOVE+e.currentTarget.dataset.id , {method:'GET'}, { + success: (res) => { + wx.showToast({ + title: '删除成功!', + icon: 'success', + duration: 2000, + }) + } + }) + }, + uploadFile(e){ + var that = this; + if(e.currentTarget.dataset.payer == null || e.currentTarget.dataset.payer == ''){ + UTIL.showToastNoneIcon('请先选择付款方!'); + return; + } + console.log(e); + + let moneyParents = e.currentTarget.dataset.totalamount == ''?'0.00':e.currentTarget.dataset.totalamount; + let moneyChildren = e.currentTarget.dataset.expenditureamount == ''?'0.00':e.currentTarget.dataset.expenditureamount + + let totalAmount = parseFloat(moneyParents) - parseFloat(moneyChildren); + console.log(moneyParents); + console.log(moneyChildren); + wx.navigateTo({ + url: '../add/upLoad/upLoad?bankType='+e.currentTarget.dataset.banktype+'&index='+e.currentTarget.dataset.index+'&totalAmount='+totalAmount+'&isPeers='+e.currentTarget.dataset.ispeers + }) + return; + wx.chooseMessageFile({ + count: 1, + type: 'file', + success (res) { + console.log(res); + // tempFilePath可以作为 img 标签的 src 属性显示图片 + const tempFilePaths = res.tempFiles + wx.uploadFile({ + url: API.URL_GET_UPLOADFILE, + filePath: tempFilePaths[0].path, + name: 'file', + header: { + "Content-Type": "multipart/form-data",//记得设置 + "chartset":"utf-8", + 'Authorization':'Bearer '+getApp().globalData.userInfo.token + }, + formData:{ + bankType:'2', + accountType:'1', + isPeers:'Y' + }, + success (response){ + console.log(response); + let list = JSON.parse(response.data); + console.log(list); + that.setData({ + ['form.transfers[0].payeeList']:list.rows + }) + }, + fail(res){ + } + }) + } + }) + }, + downLoad(){ + wx.downloadFile({ + url: API.URL_GET_DOWNFILE, //仅为示例,并非真实的资源 + success (res) { + console.log(res); + // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容 + if (res.statusCode === 200) { + var fs = wx.getFileSystemManager(); + fs.saveFile({ + tempFilePath:res.tempFilePath, + success:function(response){ + console.log(response); + } + }) + // wx.saveFile({ + // tempFilePath: res.tempFilePath, + // success:function(response){ + // console.log(response); + // } + // }) + + // wx.playVoice({ + // filePath: res.tempFilePath + // }) + } + } + }) + }, + addPayee(){ + console.log(this.data.form.payeeList); + for(let i = 0 ; i < this.data.form.payeeList.length ; i++ ){ + if(!this.data.form.payeeList[i].payee && !this.data.form.payeeList[i].payeeAccount && !this.data.form.payeeList[i].bankDeposit && !this.data.form.payeeList[i].bankTypeText){ + UTIL.showToastNoneIcon('请勿添加多个空付款人'); + return; + } + if(!this.data.form.payeeList[i].incomeAmount || this.data.form.payeeList[i].incomeAmount == "" || this.data.form.payeeList[i].incomeAmount == undefined || this.data.form.payeeList[i].incomeAmount == null){ + UTIL.showToastNoneIcon('请完善收入金额'); + return; + } + } + + this.data.form.payeeList.push({}); + this.setData({ + ["form.payeeList"]:this.data.form.payeeList, + }) + }, + onChangePayeeMoney(event){ + console.log(event); + this.setData({ + [event.currentTarget.dataset.value]: event.detail, + }) + let moneyCount = parseFloat(0); + for(let i = 0 ; i < this.data.form.payeeList.length ; i++){ + moneyCount += parseFloat(this.data.form.payeeList[i].incomeAmount==""?0:this.data.form.payeeList[i].incomeAmount) + } + this.setData({ + ["form.expenditureAmount"]: moneyCount.toFixed(2), + }) + }, + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/apply/paymentTemplate/addNew/addNew.json b/pages/apply/paymentTemplate/addNew/addNew.json new file mode 100644 index 0000000..fad0550 --- /dev/null +++ b/pages/apply/paymentTemplate/addNew/addNew.json @@ -0,0 +1,22 @@ +{ + "navigationStyle": "custom", + "usingComponents": { + "van-row": "@vant/weapp/row/index", + "van-col": "@vant/weapp/col/index", + "van-cell": "@vant/weapp/cell/index", + "van-cell-group": "@vant/weapp/cell-group/index", + "van-tag": "@vant/weapp/tag/index", + "van-icon": "@vant/weapp/icon/index", + "van-steps": "@vant/weapp/steps/index", + "van-button": "@vant/weapp/button/index", + "van-radio": "@vant/weapp/radio/index", + "van-radio-group": "@vant/weapp/radio-group/index", + "van-field": "@vant/weapp/field/index", + "van-popup": "@vant/weapp/popup/index", + "van-picker": "@vant/weapp/picker/index", + "van-calendar": "@vant/weapp/calendar/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-collapse": "@vant/weapp/collapse/index", + "van-collapse-item": "@vant/weapp/collapse-item/index" + } +} \ No newline at end of file diff --git a/pages/apply/paymentTemplate/addNew/addNew.wxml b/pages/apply/paymentTemplate/addNew/addNew.wxml new file mode 100644 index 0000000..82777e6 --- /dev/null +++ b/pages/apply/paymentTemplate/addNew/addNew.wxml @@ -0,0 +1,437 @@ + + + + 支出申请 + + + + + + + 基础信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + 审批流程 + + + + + + + + + + {{showSteps?'点击关闭审批模板':'点击查看审批模板'}} + + 审批模板 + + + {{index+1}} + + + + + + + + + + + + + + + + + + {{ item.name }} + {{ item.name }} + {{ item.name }} + + + + + + {{ item.nickName }} + ({{item.feeLimit}}元) + + + {{ item.approvalLevel == 1 ? '组级审批' : item.approvalLevel == 2 ? '村级审批' : item.approvalLevel == 3 ? '镇级审批' : item.approvalLevel == 4 ? '区县审批' : '' }} + + + + + + + + + + + + + 关联项目 + + + + + + + + + + + + + + + + + + + + + 关联合同 + + + + + + + + + + + + + + + 付款方信息 + + + + + + + + + 付款方选择 + + + + + + + + + + + + + + + + + + + + + + + 收款方信息 + + + 批量上传 + + + + + + + + + + + + + + + + + + + 收款方选择 + + + + + + + + + + + + + + + {{ form.payeeList[childrenIndex].payee }}收款方 + + + ¥{{ form.payeeList[childrenIndex].incomeAmount }} + + + + + + + + + + + 查看更多 + + + + + + + + 上传附件 + 总数 {{form.fileNum?form.fileNum:0}}张 + + + + + + 收据可拍照 + + + + + + + + + + + + + + 发票可拍照 + + + + + + + + + + + + + + + 其他可拍照 + + + + + + + + + + + + + + + + + + + + + + 保存 + 返回 + 提交 + + + + + 保存 + 提交 + + + + + + \ No newline at end of file diff --git a/pages/apply/paymentTemplate/addNew/addNew.wxss b/pages/apply/paymentTemplate/addNew/addNew.wxss new file mode 100644 index 0000000..7b80138 --- /dev/null +++ b/pages/apply/paymentTemplate/addNew/addNew.wxss @@ -0,0 +1,538 @@ +/* pages/apply/paymentTemplate/addNew/addNew.wxss *//* pages/apply/paymentTemplate/add/add.wxss */ +text{display: block;} +.top{ + height: 64px; + width: 100%; + position: fixed; + z-index: 999; + top:0px; +} +.top text{ + position: relative; + top: 30px; + margin-right: 30px; + display: block; + color: #eee; + text-align: center; + width: 100%; + font-size: 16px; +} +.input_tittop input{ + border: 1px solid #DCDCDC; + padding: 0px 10px; + height: 32px; + line-height: 32px; + border-radius: 5px; + width: 100%; +} +.error input{ + border: 1px solid red!important; +} +.bgPage{ + width: 140%; + position:absolute; + transform: translate(-15%, -50%); + height: 300px; + z-index: -1; +} +.center{ + padding-bottom: 15px; + background: #f2f2f2; +} +.main-title{ + background-image: linear-gradient(to right, #2C8E68 , #B3DB62); + color: #ffffff; + font-size: 18px; + padding: 10px 0; + text-align: center; + position: relative; +} +.main-box{ + background: #ffffff; + padding: 20px; + width: 94%; + margin: 0 auto; + border-radius: 10px; + box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.16); +} +.main-box block{ + float: right; +} +.title{ + padding: 10px calc(3% + 20px); +} +.topBox .van-cell{ + padding: 0!important; + margin-bottom: 15px; +} +.topBox .van-cell .van-cell__title, .topBox .van-cell .van-cell__value , .topBox .van-cell .van-field__label{ + font-size: 15px; + color: #444444; +} +.topBox .van-cell .van-cell__title{ + margin-right: 0!important; + max-width: 76px!important; + min-width: 76px!important; +} + +.top-box{ + /* margin-top: 20px; + margin-bottom: 28px; */ +} +.top-box text{ + margin-bottom: 15px; +} +.top-box text:last-child{ + margin-bottom: 0px; +} +.box-title{ + color: #2C8E68; + text-align: center; + font-size: 16px; +} +.center-box .main-box{ + margin-bottom: 15px; +} +.xm van-cell:first-child .van-cell{ + border-bottom: 1px solid #cccccc; + margin: 0; + padding-bottom: 15px!important; + margin-bottom: 15px; +} +.table-box van-field van-cell .van-cell{ + margin-bottom: 15px; +} +.table-box van-field:last-child van-cell .van-cell{ + margin-bottom: 0px; +} +.table-box view text icon{ + display: inline-block; + font-size: 14px; + border: 1px solid red; + color: red; +} +.table-box .van-cell{ + padding: 0!important; +} +@font-face { + font-family: 'my-icon'; + src: url('../../../image/icon/fj_icon.png') format('truetype'); +} +.my-icon { + font-family: 'my-icon'; +} + +.my-icon-extra::before { + content: '\e626'; +} +.fj-box text{ + color: #666666; + text-align: left; +} +.fj-li{ + /* margin-top: 20px; */ + /* flex-wrap: wrap; */ +} +.fj-tt{ + display: flex; + align-items: center; + width: 100%; + padding: 10px 0px; + border-bottom: 1px solid #DCDCDC; + margin-bottom: 10px; + color: #999999; +} +.fj-li .img_li{ + width: 100%; + height: 18.5vw; +} + +.fj-li .img_add{ + overflow: hidden; +} + +.bottomBtn{ + display: flex; + width: 94%; + margin: 0 auto; + justify-content:space-between; + margin-top: 30px; +} +.bottomBtn view{ + display: flex; + width: 100%; + background-color: #ffffff; + border-radius: 5px; + box-shadow: 0px 5px 9px #DCDCDC; + padding: 10px 0px; + text-align: center; + align-items:center; + justify-content:center; + font-size: 14px; + color: #2C8E68; +} +.bottomBtn view image{ + width: 18px; + height: 18px; + margin-right: 5px; +} + + +.bottom{ + width: 84%; + margin: 0 auto; + text-align: center; + margin-top: 50px; + margin-bottom: 50px; + display: flex; + justify-content: space-between; + z-index: 999999; +} + +.bottom view { + width: 47%; + margin: 0 auto; + border-radius: 30px; + display: inline-block; +} + +.bottom .btn1{ + border: 1px solid #2C8E68; + padding: 8px 0px; + color: #2C8E68; +} + +.bottom .btn2{ + border: 1px solid transparent; + padding: 8px 0px; + background-image: linear-gradient(to right, #2C8E68, #5CAE77); + color: #fff; +} +.bottom .btn3{ + border: 1px solid transparent; + padding: 8px 0px; + background-image: linear-gradient(to right, #2C8E68, #5CAE77); + color: #fff; + width: 100%; +} +.steps-box{ + padding: 0; + margin-top: 15px; +} +.steps-box .van-row{ + padding: 0 20px; +} + +.steps-box view{ + margin-bottom: 0; +} + +.steps-box .van-col{ + position: relative; + height: 70px; + } + .steps-box .van-col--21{ + padding: 12PX 0; + padding-left: 10px; + } + .steps-box .van-row:nth-child(2n){ + background: rgba(29,111,233,0.1); + } + .steps-box .van-cell{ + background: transparent; + padding: 0 10Px; + } + .steps-box .bq{ + display: inline-block; + padding: 0PX 10PX; + line-height: 0.64rem; + border-radius: 5PX; + } + .steps-box .index{ + background: linear-gradient(to bottom right, #5cae77, #7cdb9b); + color: #ffffff; + text-align: center; + width: 20PX; + height: 20PX; + line-height: 20PX; + border-radius: 50%; + position: absolute; + left: 0; + top: 50%; + transform: translate(0,-50%); + } + .steps-box .indexCenter{ + top: 0!important; + } + .steps-box .van-row:first-child .van-col:first-child .indexBorder{ + top: calc(50% - 5px); + } + .steps-box .indexBorder{ + width: 10PX; + position: absolute; + right: 0; + top: 0; + height: 100%; + + } + .steps-box .indexBorder .yq{ + height: 10PX; + width: 10PX; + background: #C9C9C9; + border-radius: 50%; + } + .steps-box .indexBorder .ss{ + height: calc(50% - 5PX); + width: 1PX; + background: #C9C9C9; + position: relative; + left: 4PX; + } + .steps-box .indexBorder .ssT{ + height: calc(50% - 5PX); + width: 1PX; + background: #C9C9C9; + position: relative; + left: 4PX; + } + .agree{ + background-color: rgba(92, 174, 119, 0.1); + color:#5CAE77 ; + width: 80%; + text-align: center; + float: right; + } + .in{ + background-color: rgba(245, 163, 39, 0.1); + color:#F5A327 ; + width: 80%; + text-align: center; + float: right; + } + .disagree{ + background-color: rgba(233, 0, 0, 0.1); + color:#E90000 ; + width: 80%; + text-align: center; + float: right; + } + .steps-box .van-cell__title{ + flex: 0.7; + } + .steps-box .van-cell__value{ + flex: 0.3; + } + .steps-tit{ + font-size: 16px; + text-align: center; + background-image: linear-gradient(to bottom right, #5cae77, #7cdb9b); + color: #ffffff; + padding: 20px 0; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + } + .bottom{ + width: 84%; + margin: 0 auto; + text-align: center; + margin-top: 30px; + margin-bottom: 80px; + } + + .bottom button { + width: 47%; + margin: 0 auto; + border-radius: 30px; + display: inline-block; + } + + .bottom .btnAgree{ + border: 1px solid transparent; + background-image: linear-gradient(to right, #2C8E68, #5CAE77); + margin-left: 6%; + } + + .input_tit{ + border: 1px solid #DCDCDC; + padding: 0px 10px; + height: 32px; + line-height: 32px; + border-radius: 5px; + margin-bottom: 15px; + } + .img_box{ + position: relative; + width: 100%; + display: flex; + flex-wrap: wrap; + } + .img_box .img_list{ + width: 23%; + margin-right: 2%; + position: relative; + } + .img_box .img_list .van-icon{ + font-size: 20px; + position: absolute; + top: 0; + right: 0; + transform: translate(50%,-50%); + } + .img_box .img_list:nth-child(n+5){ + margin-top: 15px; + } + .van-cell--required:before { + left: -8px!important; + } + .input_money{ + padding: 0px 10px; + height: 32px; + line-height: 32px; + color: #E90000; + font-size: 26px; + display: inline-block; + width: 70%; + text-align: center; + } + + .money_box{ + font-size: 26px; + border-bottom:1px solid #DCDCDC; + width: 70%; + margin: 0 auto; + margin-bottom: 15px; + color: #E90000; + display: flex; + align-items: center; + justify-content: center; + } + + .btnBox{ + text-align: center; + position: relative; + height: 26px; + } + .down{ + width: 30px; + height: 26px; + margin: 0 auto; + } + + .update{ + width: 26px; + height: 26px; + position: absolute; + right: 41px; + } + .delete{ + width: 26px; + height: 26px; + position: absolute; + right: 0; + } + + .van-collapse-item { + background: transparent; + margin: 0 auto; + width: 100%; + margin: 0 auto; + margin-top: 15px; + } + .van-collapse-item__content{ + padding: 0!important; + } + + .van-collapse .van-cell{ + padding: 0; + background: transparent; + } + .main-box .van-cell{ + padding: 0; + background: transparent; + } + + .van-collapse .tit_box .title{ + text-align: center; + font-size: 18px; + } + .van-collapse .main-box{ + /* padding: 0; + box-shadow: none; */ + } + .van-collapse .tit_box{ + width: 94%; + background: #ffffff; + margin: 0 auto; + border-radius: 10px; + box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.16); + padding: 20px; + } + .van-collapse .tit_box .top-box .van-cell{ + margin-bottom: 15px; + } + + .van-field__label { + color: var(--field-label-color,#646566); + } + .van-field__control { + color: var(--field-label-color,#646566)!important; + } + .payee_box{ + display: flex; + justify-content: space-between; + align-items: center; + } + .payee_box view{ + display: flex; + justify-content: space-between; + align-items: center; + padding: 10px calc(3% + 20px); + } + .payee_box view text{ + margin-left: 5px; + color: #2C8E68; + } + .payee_box .add{ + justify-content: center; + background-color: #2C8E68; + color: #fff; + font-weight: bold; + padding: 0px; + margin: 0 calc(3% + 20px); + width: 20px; + height: 20px; + border-radius: 20px; + line-height: 1; + } + + .file_box{ + display: flex; + justify-content: space-between; + align-items: center; + } + .file_box .add{ + margin: 0 calc(3% + 20px); + } + .aaa{ + color: red; + } + .payeeList { + padding: 10px 20px!important; + } +.payeeList .van-collapse-item { + margin-top: 0; +} +.payeeList .van-collapse .van-cell { + padding: 10px 0!important; + +} +.payeeList van-field van-cell .van-cell{ + margin-bottom: 0; +} +.payeeList .van-cell__value { + color: #E90000; +} +.payeeList .van-cell__title{ + flex-shrink: 0; + max-width: inherit; +} \ No newline at end of file diff --git a/pages/contract/contract.js b/pages/contract/contract.js index 162c734..a91c3c4 100644 --- a/pages/contract/contract.js +++ b/pages/contract/contract.js @@ -382,7 +382,7 @@ Page({ let fileForm={ file: event.detail, fileType:event.currentTarget.dataset.idx, - tableName: "t_contraction_info", //上传表 + tableName: "t_contraction_fill", //上传表 bizPath: "contraction", //上传目录 tableId:_this.data.itemId } diff --git a/pages/drawee/drawee.js b/pages/drawee/drawee.js index 71d7c79..fe58aac 100644 --- a/pages/drawee/drawee.js +++ b/pages/drawee/drawee.js @@ -358,6 +358,7 @@ Page({ setTimeout(function(){ UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData,{ success: (res) => { + if(res.rows){ for (let i = 0; i < res.rows.length; i++) { if(res.rows[i].bankAccountNumber==null){continue;} res.rows[i].bankAccountNumber = res.rows[i].bankAccountNumber.replace(/(\d{4})(?=\d)/g, "$1 "); @@ -370,19 +371,27 @@ Page({ accountList:res.rows }) wx.hideLoading(); + }else{ + wx.hideLoading(); + } } }) UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData2,{ success: (res) => { - for (let i = 0; i < res.rows.length; i++) { - res.rows[i].balance = Number(res.rows[i].balance).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => { - return $1 + ","; }).replace(/\.$/, ""); + + if(res.rows){ + for (let i = 0; i < res.rows.length; i++) { + res.rows[i].balance = Number(res.rows[i].balance).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => { + return $1 + ","; }).replace(/\.$/, ""); + } + console.log(res.rows) + that.setData({ + accountListXJ:res.rows + }) } - console.log(res.rows) - that.setData({ - accountListXJ:res.rows - }) + + } }) diff --git a/pages/drawee/drawee.wxml b/pages/drawee/drawee.wxml index 03a293c..35438f7 100644 --- a/pages/drawee/drawee.wxml +++ b/pages/drawee/drawee.wxml @@ -19,9 +19,9 @@ {{item.bankUseType == 1 ?'基本户':'一般户'}} - + - + {{item.accountName}} diff --git a/pages/drawee/drawee.wxss b/pages/drawee/drawee.wxss index b6f061d..8408c77 100644 --- a/pages/drawee/drawee.wxss +++ b/pages/drawee/drawee.wxss @@ -62,6 +62,22 @@ background:url('https://www.nongshen.net/static/wechat/bg_RCB.png') no-repeat center; background-size: 105% 105%; } +.EMS{ + background:url('https://www.nongshen.net/static/wechat/bg_EMS.png') no-repeat center; + background-size: 105% 105%; +} +.BOC{ + background:url('https://www.nongshen.net/static/wechat/bank_BOC.png') no-repeat center; + background-size: 105% 105%; +} +.ZYB{ + background:url('https://www.nongshen.net/static/wechat/bank_ZYB.png') no-repeat center; + background-size: 105% 105%; +} +.bank_other{ + background:url('https://www.nongshen.net/static/wechat/bank_other.png') no-repeat center; + background-size: 105% 105%; +} .gwk{ background:url('https://www.nongshen.net/static/wechat/bg_GWK.png') no-repeat center; background-size: 105% 105%; diff --git a/pages/fixedAssets/fixedAssets.wxml b/pages/fixedAssets/fixedAssets.wxml index 3287277..f8ab42b 100644 --- a/pages/fixedAssets/fixedAssets.wxml +++ b/pages/fixedAssets/fixedAssets.wxml @@ -16,7 +16,7 @@ 填报 - + @@ -48,15 +48,15 @@ - + + @@ -80,14 +80,14 @@ 附件 - + diff --git a/pages/fixedAssets/fixedAssets.wxss b/pages/fixedAssets/fixedAssets.wxss index 718c68b..2897406 100644 --- a/pages/fixedAssets/fixedAssets.wxss +++ b/pages/fixedAssets/fixedAssets.wxss @@ -64,7 +64,7 @@ text{display: block;} color: #31936c; } .deleteBox{ - width: 220px; + width: 100px; text-align: center; height: 100%; background: #F6F6F6; diff --git a/pages/handle/expenditureAuditNew/expenditureAuditNew.js b/pages/handle/expenditureAuditNew/expenditureAuditNew.js new file mode 100644 index 0000000..2ddf1f5 --- /dev/null +++ b/pages/handle/expenditureAuditNew/expenditureAuditNew.js @@ -0,0 +1,573 @@ +// pages/handle/expenditureAudit/expenditureAudit.js +import * as UTIL from '../../../utils/util.js'; +import * as API from '../../../utils/API.js'; +let EVN_CONFIG = require('../../../env/env'); + +const app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + isIPX: app.globalData.isIPX, + active:0, + spsxOptions:[], + paymentPatternOptions:[], + nickName:'', + comment:'', + activeNames: 0, + transferTypeOption:[ + { + dictLabel:'银行转账', + dictValue:'1' + }, + { + dictLabel:'信用卡转账', + dictValue:'2' + } + ], + showSteps:false, + activeStepsNames:'' + }, + showS(){ + this.setData({ + showSteps:!this.data.showSteps, + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var that = this; + that.setData({ + taskId:options.taskId, + pageType:options.type + }) + wx.showLoading({ + title: '正在加载模板', + mask:true + }) + //所属银行 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, { + success: (res) => { + this.setData({ + bankTypeOptions:res.data + }); + } + }) + // 资金支出类别字典查询 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'capital_expenditure_type', {method:'GET'}, { + success: (res) => { + that.setData({ + capitalExpenditureTypeOptions:res.data, + }) + } + }) + // 汇票列表查询 + UTIL.httpRequest(API.URL_GET_GETMONEYORDERLIST, {method:'GET'}, { + success: (res) => { + that.setData({ + moneyOrderOptions:res.rows, + }) + } + }) + // 付款方式类型字典查询 (2.0) + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'yn_pay_type', {method:'GET'}, { + success: (res) => { + that.setData({ + transferTypeOptions:res.data, + }) + } + }) + // 项目工程列表 + UTIL.httpRequest(API.URL_GET_GETPROJECTLIST , {method:'GET'}, { + success: (res) => { + that.setData({ + projectOptions:res.rows, + }) + } + }) + // 工程款类型字典查询 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'project_fund_type', {method:'GET'}, { + success: (res) => { + that.setData({ + projectFundTypeOptions:res.data, + }) + } + }) + // 获取合同信息列表 + UTIL.httpRequest(API.URL_GET_CONTRACTIONLIST , {method:'GET',contractionStatus:1}, { + success: (res) => { + that.setData({ + contractionOptions:res.rows, + }) + } + }) + let templateQueryParams = { + // 分页 + method:'GET', + pageNum: 1, + pageSize: 999, + type:'1' + }; + // 审批流程列表 + UTIL.httpRequest(API.URL_GET_TEMPLATELIST , templateQueryParams, { + success: (res) => { + that.setData({ + approvalTemplateNameOptions:res.rows, + ["form.approvalTemplateId"]:res.rows[0].id, + ["form.approvalTemplateName"]:res.rows[0].name, + }) + + } + }) + + UTIL.showLoadingHaveMask(); + var perames = { + pageNum:1, + pageSize:999, + accountType:'102', + method:'POST' + } + // 付款方列表 + UTIL.httpRequest(API.URL_GET_SELECTACCOUNTLIST , perames, { + success: (res) => { + console.log(res); + that.setData({ + accountOptions:res.rows, + + }) + } + }) + setTimeout(function(){ + UTIL.httpRequest(API.URL_GET_APPROVALITEMS+options.id, {method:'GET'}, { + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + + // 审批模板 + UTIL.httpRequest(API.URL_GET_selectApprovalByTemplateId+res.data.approvalTemplateId, {method:'GET'}, { + success: (rres) => { + that.setData({ + steps:rres.approvalDetails + }) + } + }) + + res.data.capitalExpenditureTypeText = UTIL.getTransform(res.data.capitalExpenditureType,that.data.capitalExpenditureTypeOptions); + + res.data.transferTypeText = UTIL.getTransform(res.data.transferType,that.data.transferTypeOption); + + if(res.data.capitalExpenditureType == 2){ + let prames = { + outId:res.data.id, + ynType: res.data.transferType=='1'||res.data.transferType=='2'||res.data.transferType=='4'?'1':'2' + } + // 工程项目查询 + UTIL.httpRequest(API.URL_GET_GETPROJECTTO , prames, { + success: (res) => { + res.data.projectFundTypeText = UTIL.getTransform(res.data.projectFundType,that.data.projectFundTypeOptions); + that.setData({ + ["form.projectForm"]:res.data, + }) + } + }) + } + + if(res.data.capitalExpenditureType == 4){ + let prames = { + transferId:res.data.id, + } + // 关联合同查询 + UTIL.httpRequest(API.URL_GET_GETSELECTINFOBYOUTID , prames, { + success: (res) => { + that.setData({ + ["form.contractionForm"]:res.data, + }) + } + }) + } + + that.setData({ + ["form.fileNum"]:0, + }) + UTIL.httpRequest( + API.URL_GET_FINDLIST, + { + method:'GET', + tableName:'t_yinnong_transfer', + tableId:res.data.id, + fileType:1 + }, + { + success: (res) => { + + let list = []; + + res.data.forEach((item2,index2)=>{ + + let fileForm = res.data.fileForm?res.data.fileForm:[]; + fileForm.push({ + file: wx.getStorageSync('dressCode')+item2.fileUrl, + fileType:'1', + bizPath:'transfer', + tableName:'t_yinnong_transfer', + tableId:'' + }) + list.push({ + tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl, + id:item2.id + }) + that.setData({ + ["form.fileNum"]:that.data.form.fileNum+1, + ["form.SJimage"]:list, + ["form.fileForm"]:fileForm + }); + + }) + + } + }) + //发票 + UTIL.httpRequest( + API.URL_GET_FINDLIST, + { + method:'GET', + tableName:'t_yinnong_transfer', + tableId:res.data.id, + fileType:2 + }, + { + success: (res) => { + let list = []; + res.data.forEach((item2,index2)=>{ + let fileForm = res.data.fileForm?res.data.fileForm:[]; + fileForm.push({ + file: wx.getStorageSync('dressCode')+item2.fileUrl, + fileType:'2', + bizPath:'transfer', + tableName:'t_yinnong_transfer', + tableId:res.data.id + }) + list.push({ + tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl, + id:item2.id + }) + that.setData({ + ["form.fileNum"]:that.data.form.fileNum+1, + ["form.FPimage"]:list, + ["form.fileForm"]:fileForm + }); + }) + } + }) + //其他 + UTIL.httpRequest( + API.URL_GET_FINDLIST, + { + method:'GET', + tableName:'t_yinnong_transfer', + tableId:res.data.id, + fileType:3 + }, + { + success: (res) => { + let list = []; + res.data.forEach((item2,index2)=>{ + let fileForm = res.data.fileForm?res.data.fileForm:[]; + fileForm.push({ + file: wx.getStorageSync('dressCode')+item2.fileUrl, + fileType:'3', + bizPath:'transfer', + tableName:'t_yinnong_transfer', + tableId:res.data.id + }) + list.push({ + tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl, + id:item2.id + }) + that.setData({ + ["form.fileNum"]:that.data.form.fileNum+1, + ["form.QTimage"]:list, + ["form.fileForm"]:fileForm + }); + }) + } + }) + + let query = { + method:'GET', + // accountType:res.data.accountType, + // status:"0", + // orderByColumn: "id", + // isAsc: "desc", + } + UTIL.httpRequest(API.URL_GET_TRANSFERINFOS+options.id, query, { + success: (response) => { + if (res.code == API.SUCCESS_CODE) { + for(let i = 0 ; i < response.rows.length ; i++){ + response.rows[i].bankTypeText = UTIL.getTransform(response.rows[i].bankType,that.data.bankTypeOptions); + } + that.setData({ + ["form.payeeList"]:response.rows + }) + } + } + }) + + that.setData({ + form:res.data, + isUpdate:true, + showFile:true, + activeNames:null + }) + UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, { + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + that.setData({ + ["form.approvalItemTemplate.submitCompany"]:res.user.bookName, + ["form.approvalItemTemplate.submitDate"]:UTIL.js_date_time(new Date()), + ["form.approvalItemTemplate.submitter"]:res.user.nickName, + ["form.approvalItemTemplate.telephone"]:res.user.phonenumber, + }) + + } + } + }) + + // 查询审批事项流转进度 + UTIL.httpRequest(API.URL_GET_GETPROCESS+options.id , {method:'GET'}, { + success: (res) => { + console.log(res); + for (let i = 0; i < res.data.processSchedule.审批事项.length; i++) { + const element = res.data.processSchedule.审批事项[i]; + if (element.electronicSignature!=null) { + element.electronicSignature = wx.getStorageSync('dressCode')+element.electronicSignature; + } + } + if(res.data.processSchedule != null){ + that.setData({spsxOptions:res.data.processSchedule.审批事项}) + } + that.setData({instanceId:res.data.instanceId}) + + if(options.business == 'xj'){ + console.log(that.data.instanceId) + // 查询现金审批事项流转进度 + UTIL.httpRequest(API.URL_GET_REVIEWPROCESS+that.data.instanceId , {method:'GET'}, { + success: (res) => { + console.log(res); + if(res.data.processSchedule.审批事项){ + that.setData({spsxOptions:res.data.processSchedule.审批事项}) + } + that.setData({instanceId:res.data.instanceId}) + } + }) + } + } + }) + UTIL.hideLoadingHaveMask(); + } + } + }) + },1000) + + + + + + + }, + onChangePayee(event) { + console.log(event); + this.setData({ + ["form.transfers["+event.currentTarget.dataset.index+"].activeName"]:event.detail + }); + }, + onClosePayee(event){ + console.log("aaa"); + this.setData({ + ["form.transfers["+event.currentTarget.dataset.index+"].activeName"]:'' + }); + console.log(this.data.form.transfers[event.currentTarget.dataset.index]); + }, + goDis(){ + var that = this ; + console.log() + let data = { + taskId:that.data.taskId, + instanceId:that.data.instanceId, + variables:JSON.stringify({ + comment:that.data.comment == '' ? '驳回':that.data.comment, + pass:false, + }), + method:'POST' + }; + UTIL.httpRequest(API.URL_GET_PROCESSCOMPLETE , data, { + success: (res) => { + console.log(res); + if (res.code == API.SUCCESS_CODE) { + wx.showToast({ + title: '审批成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + }else{ + wx.showToast({ + title: '操作失败', + icon: 'error', + duration: 2000 + }) + } + + } + }) + }, + goAgree(){ + var that = this ; + let data = { + taskId:that.data.taskId, + instanceId:that.data.instanceId, + variables:JSON.stringify({ + "comment":that.data.comment == '' ? '同意':that.data.comment, + "pass":true, + }), + method:'POST' + }; + UTIL.httpRequest(API.URL_GET_PROCESSCOMPLETE ,data, { + success: (res) => { + console.log(res); + if (res.code == API.SUCCESS_CODE) { + wx.showToast({ + title: '审批成功', + icon: 'success', + duration: 2000, + complete(){ + setTimeout(function(){ + that.back(); + },2000) + } + }) + }else{ + wx.showToast({ + title: '操作失败', + icon: 'error', + duration: 2000 + }) + } + } + }) + }, + commentInput(e){ + console.log(e); + var that = this; + that.setData({ + comment:e.detail.value + }) + }, + onChangeBox(event) { + console.log(event); + this.setData({ + activeNames: event.detail, + }); + }, + onCloseSecond(e){ + var that = this ; + console.log(e); + that.setData({ + ["form.showTitle"]:false + }) + }, + onChangeSteps(event) { + console.log(event); + this.setData({ + activeStepsNames:event.detail + }); + }, + onCloseSteps(event){ + console.log("aaa"); + this.setData({ + activeStepsNames:'' + }); + }, + onOpen(e){ + var that = this ; + that.setData({ + ["form.showTitle"]:true + }) + }, + openPreview(e){ + let array = []; + console.log(e); + e.currentTarget.dataset.option.forEach(item=>{ + array.push(item.tempFilePath) + }) + console.log(array); + wx.previewImage({ + urls: array, + showmenu:true, + current:array[e.currentTarget.dataset.index] + }) + }, + goPayee(event){ + wx.navigateTo({ + url: '/pages/pay/payee/payee?options='+JSON.stringify(event.currentTarget.dataset.option) + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + back:function(){ + wx.navigateBack({ + delta: 1 + }) + }, + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/handle/expenditureAuditNew/expenditureAuditNew.json b/pages/handle/expenditureAuditNew/expenditureAuditNew.json new file mode 100644 index 0000000..b5ebcea --- /dev/null +++ b/pages/handle/expenditureAuditNew/expenditureAuditNew.json @@ -0,0 +1,23 @@ +{ + "navigationStyle": "custom", + "usingComponents": { + "van-row": "@vant/weapp/row/index", + "van-col": "@vant/weapp/col/index", + "van-cell": "@vant/weapp/cell/index", + "van-cell-group": "@vant/weapp/cell-group/index", + "van-tag": "@vant/weapp/tag/index", + "van-icon": "@vant/weapp/icon/index", + "van-steps": "@vant/weapp/steps/index", + "van-button": "@vant/weapp/button/index", + "van-radio": "@vant/weapp/radio/index", + "van-radio-group": "@vant/weapp/radio-group/index", + "van-field": "@vant/weapp/field/index", + "van-popup": "@vant/weapp/popup/index", + "van-picker": "@vant/weapp/picker/index", + "van-calendar": "@vant/weapp/calendar/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-collapse": "@vant/weapp/collapse/index", + "van-collapse-item": "@vant/weapp/collapse-item/index", + "van-empty": "@vant/weapp/empty/index" + } +} \ No newline at end of file diff --git a/pages/handle/expenditureAuditNew/expenditureAuditNew.wxml b/pages/handle/expenditureAuditNew/expenditureAuditNew.wxml new file mode 100644 index 0000000..3c0b728 --- /dev/null +++ b/pages/handle/expenditureAuditNew/expenditureAuditNew.wxml @@ -0,0 +1,515 @@ + + + + 支出申请审批 + + + + + + + + + + {{ form.transferTypeText }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 基础信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{showSteps?'点击关闭审批模板':'点击查看审批模板'}} + + + 审批模板 + + + {{index+1}} + + + + + + + + + + + + + + + + + + {{ item.name }} + {{ item.name }} + {{ item.name }} + {{ item.approvalLevel == 1 ? '组级审批' : item.approvalLevel == 2 ? '村级审批' : item.approvalLevel == 3 ? '镇级审批' : item.approvalLevel == 4 ? '区县审批' : '' }} + + + + + + {{ item.nickName }} + ({{item.feeLimit}}元) + + + + + + + + + + + + + + 关联项目 + + + + + + + + + + + + + + + + + + + + + 关联合同 + + + + + + + + + + + + + + + 付款方信息 + + + + + + + + + 付款方选择 + + + + + + + + + + + + + + + + + + + + + + + + + + 收款方信息 + + + + + + + + + + + + + + + + + 收款方 + + + + + + + + + + + + + + + {{ form.payeeList[childrenIndex].payee }}收款方 + + + ¥{{ form.payeeList[childrenIndex].incomeAmount }} + + + + + + + + + + + 查看更多 + + + + + + + + + + + + + + 上传附件 + 总数 {{form.fileNum?form.fileNum:0}}张 + + + + + + 收据可拍照 + + + + + + + + + + + + + + 发票可拍照 + + + + + + + + + + + + + + 其他可拍照 + + + + + + + + + + + + + + + +审批流程 + + + + + + {{index+1}} + + + + + + + + + + + + + + + + + + + + {{item.assigneeName}} + + {{item.deptLabel}} + + 同意 + 审核中 + 驳回 + + + + + {{ item.comment }} + + {{ sub.times(item.time) }} + + + + + + + + + + + + + + + + + + var times = function(time){ + console.log(time) + return time.substring(0,10); + } + module.exports.times = times; + \ No newline at end of file diff --git a/pages/handle/expenditureAuditNew/expenditureAuditNew.wxss b/pages/handle/expenditureAuditNew/expenditureAuditNew.wxss new file mode 100644 index 0000000..8a29f21 --- /dev/null +++ b/pages/handle/expenditureAuditNew/expenditureAuditNew.wxss @@ -0,0 +1,734 @@ +/* pages/apply/paymentTemplate/addNew/addNew.wxss *//* pages/apply/paymentTemplate/add/add.wxss */ +text{display: block;} +.top{ + height: 64px; + width: 100%; + position: fixed; + z-index: 999; + top:0px; +} +.top text{ + position: relative; + top: 30px; + margin-right: 30px; + display: block; + color: #eee; + text-align: center; + width: 100%; + font-size: 16px; +} +.input_tittop input{ + border: 1px solid #DCDCDC; + padding: 0px 10px; + height: 32px; + line-height: 32px; + border-radius: 5px; + width: 100%; +} +.error input{ + border: 1px solid red!important; +} +.bgPage{ + width: 140%; + position:absolute; + transform: translate(-15%, -50%); + height: 300px; + z-index: -1; +} +.center{ + padding-bottom: 15px; + background: #f2f2f2; +} +.main-title{ + background-image: linear-gradient(to right, #2C8E68 , #B3DB62); + color: #ffffff; + font-size: 18px; + padding: 10px 0; + text-align: center; + position: relative; +} +.main-box{ + background: #ffffff; + padding: 20px; + width: 94%; + margin: 0 auto; + border-radius: 10px; + box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.16); +} +.main-box block{ + float: right; +} +.title{ + padding: 10px calc(3% + 20px); +} +.topBox .van-cell{ + padding: 0!important; + margin-bottom: 15px; +} +.topBox .van-cell .van-cell__title, .topBox .van-cell .van-cell__value , .topBox .van-cell .van-field__label{ + font-size: 15px; + color: #444444; +} +.topBox .van-cell .van-cell__title{ + margin-right: 0!important; + max-width: 76px!important; + min-width: 76px!important; +} + +.top-box{ + /* margin-top: 20px; + margin-bottom: 28px; */ + position:relative; +} +.top-box text{ + margin-bottom: 15px; +} +.top-box text:last-child{ + margin-bottom: 0px; +} +.box-title{ + color: #2C8E68; + text-align: center; + font-size: 16px; +} +.center-box .main-box{ + margin-bottom: 15px; +} +.xm van-cell:first-child .van-cell{ + border-bottom: 1px solid #cccccc; + margin: 0; + padding-bottom: 15px!important; + margin-bottom: 15px; +} +.table-box van-field van-cell .van-cell{ + margin-bottom: 15px; +} +.table-box van-field:last-child van-cell .van-cell{ + margin-bottom: 0px; +} +.table-box view text icon{ + display: inline-block; + font-size: 14px; + border: 1px solid red; + color: red; +} +.table-box .van-cell{ + padding: 0!important; +} +@font-face { + font-family: 'my-icon'; + src: url('../../../image/icon/fj_icon.png') format('truetype'); +} +.my-icon { + font-family: 'my-icon'; +} + +.my-icon-extra::before { + content: '\e626'; +} +.fj-box text{ + color: #666666; + text-align: left; +} +.fj-li{ + /* margin-top: 20px; */ + /* flex-wrap: wrap; */ +} +.fj-tt{ + display: flex; + align-items: center; + width: 100%; + padding: 10px 0px; + border-bottom: 1px solid #DCDCDC; + margin-bottom: 10px; + color: #999999; +} +.fj-li .img_li{ + width: 100%; + height: 18.5vw; +} + +.fj-li .img_add{ + overflow: hidden; +} + +.bottomBtn{ + display: flex; + width: 94%; + margin: 0 auto; + justify-content:space-between; + margin-top: 30px; +} +.bottomBtn view{ + display: flex; + width: 100%; + background-color: #ffffff; + border-radius: 5px; + box-shadow: 0px 5px 9px #DCDCDC; + padding: 10px 0px; + text-align: center; + align-items:center; + justify-content:center; + font-size: 14px; + color: #2C8E68; +} +.bottomBtn view image{ + width: 18px; + height: 18px; + margin-right: 5px; +} + + +.bottom{ + width: 84%; + margin: 0 auto; + text-align: center; + margin-top: 50px; + margin-bottom: 50px; + display: flex; + justify-content: space-between; + z-index: 999999; +} + +.bottom view { + width: 47%; + margin: 0 auto; + border-radius: 30px; + display: inline-block; +} + +.bottom .btn1{ + border: 1px solid #2C8E68; + padding: 8px 0px; + color: #2C8E68; +} + +.bottom .btn2{ + border: 1px solid transparent; + padding: 8px 0px; + background-image: linear-gradient(to right, #2C8E68, #5CAE77); + color: #fff; +} +.bottom .btn3{ + border: 1px solid transparent; + padding: 8px 0px; + background-image: linear-gradient(to right, #2C8E68, #5CAE77); + color: #fff; + width: 100%; +} +.steps-box{ + padding: 0; + margin-top: 15px; +} +.steps-box .van-row{ + padding: 0 20px; +} + +.steps-box view{ + margin-bottom: 0; +} + +.steps-box .van-col{ + position: relative; + height: 70px; + } + .steps-box .van-col--21{ + padding: 12PX 0; + padding-left: 10px; + } + .steps-box .van-row:nth-child(2n){ + background: rgba(29,111,233,0.1); + } + .steps-box .van-cell{ + background: transparent; + padding: 0 10Px; + } + .steps-box .bq{ + display: inline-block; + padding: 0PX 10PX; + line-height: 0.64rem; + border-radius: 5PX; + } + .steps-box .index{ + background: #1D6FE9; + color: #ffffff; + text-align: center; + width: 20PX; + height: 20PX; + line-height: 20PX; + border-radius: 50%; + position: absolute; + left: 0; + top: 50%; + transform: translate(0,-50%); + } + .steps-box .indexCenter{ + top: 0!important; + } + .steps-box .van-row:first-child .van-col:first-child .indexBorder{ + top: calc(50% - 5px); + } + .steps-box .indexBorder{ + width: 10PX; + position: absolute; + right: 0; + top: 0; + height: 100%; + + } + .steps-box .indexBorder .yq{ + height: 10PX; + width: 10PX; + background: #C9C9C9; + border-radius: 50%; + } + .steps-box .indexBorder .ss{ + height: calc(50% - 5PX); + width: 1PX; + background: #C9C9C9; + position: relative; + left: 4PX; + } + .steps-box .indexBorder .ssT{ + height: calc(50% - 5PX); + width: 1PX; + background: #C9C9C9; + position: relative; + left: 4PX; + } + .agree{ + background-color: rgba(92, 174, 119, 0.1); + color:#5CAE77 ; + width: 80%; + text-align: center; + float: right; + } + .in{ + background-color: rgba(245, 163, 39, 0.1); + color:#F5A327 ; + width: 80%; + text-align: center; + float: right; + } + .disagree{ + background-color: rgba(233, 0, 0, 0.1); + color:#E90000 ; + width: 80%; + text-align: center; + float: right; + } + .steps-box .van-cell__title{ + flex: 0.7; + } + .steps-box .van-cell__value{ + flex: 0.3; + } + .steps-tit{ + font-size: 16px; + text-align: center; + background-image: linear-gradient(to bottom right, #5cae77, #7cdb9b); + color: #ffffff; + padding: 20px 0; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + } + .bottom{ + width: 84%; + margin: 0 auto; + text-align: center; + margin-top: 30px; + margin-bottom: 80px; + } + + .bottom button { + width: 47%; + margin: 0 auto; + border-radius: 30px; + display: inline-block; + } + + .bottom .btnAgree{ + border: 1px solid transparent; + background-image: linear-gradient(to right, #2C8E68, #5CAE77); + margin-left: 6%; + } + + .input_tit{ + border: 1px solid #DCDCDC; + padding: 0px 10px; + height: 32px; + line-height: 32px; + border-radius: 5px; + margin-bottom: 15px; + } + .img_box{ + position: relative; + width: 100%; + display: flex; + flex-wrap: wrap; + } + .img_box .img_list{ + width: 23%; + margin-right: 2%; + position: relative; + } + .img_box .img_list .van-icon{ + font-size: 20px; + position: absolute; + top: 0; + right: 0; + transform: translate(50%,-50%); + } + .img_box .img_list:nth-child(n+5){ + margin-top: 15px; + } + .van-cell--required:before { + left: -8px!important; + } + .input_money{ + padding: 0px 10px; + height: 32px; + line-height: 32px; + color: #E90000; + font-size: 26px; + display: inline-block; + width: 70%; + text-align: center; + } + + .money_box{ + font-size: 26px; + border-bottom:1px solid #DCDCDC; + width: 70%; + margin: 0 auto; + margin-bottom: 15px; + color: #E90000; + display: flex; + align-items: center; + justify-content: center; + } + + .btnBox{ + text-align: center; + height: 26px; + position: absolute; + bottom: -15px; + left: calc(50% - 15px); + } + .down{ + width: 30px; + height: 26px; + margin: 0 auto; + } + + .update{ + width: 26px; + height: 26px; + position: absolute; + right: 41px; + } + .delete{ + width: 26px; + height: 26px; + position: absolute; + right: 0; + } + + .van-collapse-item { + background: transparent; + margin: 0 auto; + width: 100%; + margin: 0 auto; + margin-top: 15px; + } + .van-collapse-item__content{ + padding: 0!important; + } + + .van-collapse .van-cell{ + padding: 0; + background: transparent; + } + .main-box .van-cell{ + padding: 0; + background: transparent; + } + + .van-collapse .tit_box .title{ + text-align: center; + font-size: 18px; + } + .van-collapse .main-box{ + /* padding: 0; + box-shadow: none; */ + } + .van-collapse .tit_box{ + width: 94%; + background: #ffffff; + margin: 0 auto; + border-radius: 10px; + box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.16); + padding: 20px; + } + .van-collapse .tit_box .top-box .van-cell{ + margin-bottom: 10px; + } + + .van-field__label { + color: var(--field-label-color,#646566); + } + .van-field__control { + color: var(--field-label-color,#646566)!important; + } + .payee_box{ + display: flex; + justify-content: space-between; + align-items: center; + } + .payee_box view{ + display: flex; + justify-content: space-between; + align-items: center; + padding: 10px calc(3% + 20px); + } + .payee_box view text{ + margin-left: 5px; + color: #2C8E68; + } + .payee_box .add{ + justify-content: center; + background-color: #2C8E68; + color: #fff; + font-weight: bold; + padding: 0px; + margin: 0 calc(3% + 20px); + width: 20px; + height: 20px; + border-radius: 20px; + line-height: 1; + } + + .file_box{ + display: flex; + justify-content: space-between; + align-items: center; + } + .file_box .add{ + margin: 0 calc(3% + 20px); + } + .aaa{ + color: red; + } + .payeeList { + padding: 10px 20px!important; + } +.payeeList .van-collapse-item { + margin-top: 0; +} +.payeeList .van-collapse .van-cell { + padding: 10px 0!important; + +} +.payeeList van-field van-cell .van-cell{ + margin-bottom: 0; +} +.payeeList .van-cell__value { + color: #E90000; +} +.payeeList .van-cell__title{ + flex-shrink: 0; + max-width: inherit; +} + +.steps-box{ + padding: 0; +} +.steps-box .van-row{ + padding: 0 20px; +} + +.steps-box view{ + margin-bottom: 0; +} + +.steps-box .van-col{ + position: relative; + /* height: 90px; */ + } + .steps-box .van-col--21{ + padding: 12PX 0; + padding-left: 10px; + } + .steps-box .van-row:nth-child(2n){ + background: rgba(29,111,233,0.1); + } + .steps-box .van-cell{ + background: transparent; + padding: 0 10Px; + } + .steps-box .bq{ + display: inline-block; + padding: 0PX 10PX; + line-height: 0.64rem; + border-radius: 5PX; + } + .steps-box .index{ + background-image: linear-gradient(to bottom right, #5cae77, #7cdb9b); + color: #ffffff; + text-align: center; + width: 20PX; + height: 20PX; + line-height: 20PX; + border-radius: 50%; + position: absolute; + left: 0; + top: 50%; + transform: translate(0,-50%); + } + .steps-box .active{ + background: #2C8E68; + } + + .steps-box .indexCenter{ + top: 0!important; + } + .steps-box .van-row:first-child .van-col:first-child .indexBorder{ + top: calc(50% - 5px); + } + .steps-box .indexBorder{ + width: 10PX; + position: absolute; + right: 0; + top: 0; + height: 100%; + + } + .steps-box .indexBorder .yq{ + height: 10PX; + width: 10PX; + background: #C9C9C9; + border-radius: 50%; + } + .steps-box .indexBorder .ss{ + height: calc(50% - 5PX); + width: 1PX; + background: #C9C9C9; + position: relative; + left: 4PX; + } + .steps-box .indexBorder .ssT{ + height: calc(50% - 5PX); + width: 1PX; + background: #C9C9C9; + position: relative; + left: 4PX; + } + .agree{ + background-color: rgba(92, 174, 119, 0.1); + color:#5CAE77 ; + width: 80%; + text-align: center; + float: right; + } + .in{ + background-color: rgba(245, 163, 39, 0.1); + color:#F5A327 ; + width: 80%; + text-align: center; + float: right; + } + .disagree{ + background-color: rgba(233, 0, 0, 0.1); + color:#E90000 ; + width: 80%; + text-align: center; + float: right; + } + .steps-box .van-cell__title{ + flex: 0.7; + } + .steps-box .van-cell__value{ + flex: 0.3; + } + .steps-tit{ + font-size: 16px; + text-align: center; + background-color: #2C8E68; + color: #ffffff; + padding: 20px 0; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + } + .bottom{ + width: 84%; + margin: 0 auto; + text-align: center; + margin-top: 30px; + margin-bottom: 80px; + } + + .bottom button { + width: 47%; + margin: 0 auto; + border-radius: 30px; + display: inline-block; + } + + .bottom .btnAgree{ + border: 1px solid transparent; + background-image: linear-gradient(to right, #2C8E68, #5CAE77); + margin-left: 6%; + } + + .input_tit{ + border: 1px solid #DCDCDC; + padding: 0px 10px; + height: 32px; + line-height: 32px; + border-radius: 5px; + margin-bottom: 15px; + } + .img_box{ + position: relative; + width: 100%; + } + .cellTit{ + display: flex; + justify-content: space-between; + } + .cellTit text{ + width: 50%; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + word-break: break-all; + overflow: hidden; + } + + .payeeList { + padding: 10px 20px!important; + } +.payeeList .van-collapse-item { + margin-top: 0; +} +.payeeList .van-collapse .van-cell { + padding: 10px 0!important; + +} +.payeeList van-field van-cell .van-cell{ + margin-bottom: 0; +} +.payeeList .van-cell__value { + color: #E90000; +} +.payeeList .van-cell__title{ + flex-shrink: 0; + max-width: inherit; +} + +.van-empty { + padding: 0!important; +} +.van-empty__bottom { + margin: 0!important; +} \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 834c5a6..2beed4d 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -50,7 +50,8 @@ Page({ ], showList:false, showListText:'更多', - num:1 + num:1, + active:1 }, onLoad: function (options) { //获取滚动条高度 @@ -137,23 +138,25 @@ Page({ method:"GET", // taskName:'相关人员审批' } + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'activity_business_type', {method:'GET'}, { + success: (res) => { + } + }) UTIL.httpRequest(API.URL_GET_TASKLIST,data, { success: (res) => { if (res.code == API.SUCCESS_CODE) { let list = []; - if(res.rows!=null&&res.rows!=""){ for(let i = 0;i < res.total;i++){ - if (res.rows[i].formData.activityBusinessType == '20' || res.rows[i].formData.activityBusinessType=='30' || res.rows[i].formData.activityBusinessType == '35') { - let d = this.dictTranslate(this.data.transferType,res.rows[i].formData.transferType) - res.rows[i].formData.transferType = d - res.rows[i].formData.totalAmount = Number(res.rows[i].formData.totalAmount).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => { - return $1 + ","; }).replace(/\.$/, "") - list.push(res.rows[i]) + if(res.rows[i].formData){ + if (res.rows[i].formData.activityBusinessType == '16' || res.rows[i].formData.activityBusinessType=='36') { + res.rows[i].formData.expenditureAmount = Number(res.rows[i].formData.expenditureAmount).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => { + return $1 + ","; }).replace(/\.$/, "") + list.push(res.rows[i]) + } } - } this.setData({todoList:list,todoNum:list.length}) - } + } }, fail: (res) => { console.log(res); @@ -176,18 +179,18 @@ Page({ success: (res) => { if (res.code == API.SUCCESS_CODE) { let list = []; - if(res.rows!=null&&res.rows!=""){ for(let i = 0;i { - return $1 + ","; }).replace(/\.$/, "") - list.push(res.rows[i]) + if(res.rows[i].formData){ + if (res.rows[i].formData.activityBusinessType == '16' || res.rows[i].formData.activityBusinessType=='36') { + let d = this.dictTranslate(this.data.transferType,res.rows[i].formData.transferType) + res.rows[i].formData.transferType = d + res.rows[i].formData.expenditureAmount = Number(res.rows[i].formData.expenditureAmount).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => { + return $1 + ","; }).replace(/\.$/, "") + list.push(res.rows[i]) + } } - } + } this.setData({doneList:list,doneNum:list.length}) - } } }, fail: (res) => { console.log(res); @@ -214,7 +217,7 @@ Page({ for(let i = 0;i { return $1 + ","; }).replace(/\.$/, "") - } + } this.setData({yfqList:res.rows}) } }, fail: (res) => { @@ -227,20 +230,20 @@ Page({ let data = { // pageNum:1, // pageSize:10, - transferType:"1", - auditStatus:"3", - method:"GET" + transferType:"", + params:{ + "auditStatusXiaochengxu":"2" + }, + method:"POST", } UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, { success: (res) => { console.log(res); if (res.code == API.SUCCESS_CODE) { - let a = this.data.yfqNum+res.total - this.setData({yfqNum:a}) - let b = this.data.yfqList - let c = res.rows.concat(b) + this.setData({yfqNum:res.total}) + let c = res.rows for(let i = 0;i< c.length;i++){ - c[i].totalAmount = Number(c[i].totalAmount).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => { + c[i].totalAmount = Number(c[i].totalAmount).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => { return $1 + ","; }).replace(/\.$/, "") } this.setData({yfqList:c}) @@ -256,10 +259,11 @@ Page({ let data = { // pageNum:1, // pageSize:10, - transferType:"1", - status:"0", - method:"GET", - submitter:this.data.userInfoObj.nickName + transferType:"", + method:"POST", + params:{ + "auditStatusXiaochengxu":"1" + }, } UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, { success: (res) => { @@ -349,8 +353,8 @@ Page({ this.getTransferList2(); //查询已发起 - this.getTransferList(); - // this.getTransferList1(); + // this.getTransferList(); + this.getTransferList1(); } } }) @@ -382,10 +386,14 @@ Page({ if (res.code == API.SUCCESS_CODE) { this.setData({bookList:res.rows}) if(this.data.bookName==""&&res.total>0){ - let loginBookId = res.rows.filter(function (e) { return e.id == that.data.userInfoObj.loginBookId; })[0].bookName; - console.log(res.rows); - this.setData({bookName:loginBookId}) - this.setData({bookId:res.rows[0].id}) + let loginBookId = res.rows.filter(function (e) { return e.id == that.data.userInfoObj.loginBookId; }); + if(loginBookId.length > 0){ + loginBookId =loginBookId[0].bookName + this.setData({bookName:loginBookId}) + this.setData({bookId:res.rows[0].id}) + }else{ + this.setData({bookName:"选择账套"}) + } }else if(this.data.bookName==""&&res.total==0){ this.setData({bookName:"无可用账套"}) } @@ -454,6 +462,7 @@ Page({ value: [provinceNum, cityNum, areaNum] }) } + console.log(this.data.value); }, preventTouchmove() {}, @@ -470,21 +479,26 @@ Page({ }, // 提交时由序号获取省市区id getRegionId(type) { + console.log(this.data.provinces); + console.log(this.data.regionValue); let value = this.data.regionValue - let provinceId = this.data.provinces[value[0]].id - let townId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id - let areaId = '' - if (this.data.provinces[value[0]].children[value[1]].children[value[2]].id) { - areaId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id - } else { - areaId = 0 - } - if (type === 'provinceId') { + let provinceId = this.data.provinces[value[0]].id return provinceId } else if (type === 'townId') { + let townId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id return townId } else { + let areaId = '' + if (this.data.provinces[value[0]].children[value[1]].children) { + areaId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id + } else if(this.data.provinces[value[0]].children){ + areaId = this.data.provinces[value[0]].children[value[1]].id + } else if(this.data.provinces[value[0]]){ + areaId = this.data.provinces[value[0]].id + } else { + areaId = 0 + } return areaId } }, @@ -516,6 +530,8 @@ Page({ } catch (error) { console.log('adress select something error') } + + console.log(this.getRegionId('areas')); this.setData({ region: region, lastCitys: this.data.citys, @@ -534,16 +550,23 @@ Page({ success: (res) => { setTimeout(()=>{ _this.reset() - _this.onLoad() + _this.onShow() },1000) } }) }) + + // this.data.userInfoObj.loginDeptId = this.getRegionId('areas'); + // this.getBookList(); + } }, godetail:function(e){ + // wx.navigateTo({ + // url: '/pages/apply/paymentTemplate/add/add?id='+e.currentTarget.dataset.id, + // }) wx.navigateTo({ - url: '/pages/apply/paymentTemplate/add/add?id='+e.currentTarget.dataset.id, + url: '/pages/apply/paymentTemplate/addNew/addNew?id='+e.currentTarget.dataset.id, }) }, goMajorDetail:function(e){ @@ -553,7 +576,7 @@ Page({ }, gosee:function(e){ wx.navigateTo({ - url: '/pages/handle/expenditureAudit/expenditureAudit?id='+e.currentTarget.dataset.id+'&taskId='+e.currentTarget.dataset.taskid+'&type='+e.currentTarget.dataset.type+'&business='+e.currentTarget.dataset.business, + url: '/pages/handle/expenditureAuditNew/expenditureAuditNew?id='+e.currentTarget.dataset.id+'&taskId='+e.currentTarget.dataset.taskid+'&type='+e.currentTarget.dataset.type+'&business='+e.currentTarget.dataset.business, }) }, goUpdate(e){ @@ -588,7 +611,7 @@ Page({ content: '确认删除?', success (res) { if (res.confirm) { - UTIL.httpRequest(API.URL_GET_REMOVEAPPROVAL + e.currentTarget.dataset.id, {method:'GET'},{ + UTIL.httpRequest(API.URL_GET_REMOVETRANFERL + e.currentTarget.dataset.id, {method:'GET'},{ success: (res) => { if (res.code == API.SUCCESS_CODE) { that.data.yzdList.splice(e.currentTarget.dataset.index, 1); @@ -620,5 +643,51 @@ Page({ tmplIds: ['_Npje859RvKIf5AcqaikWYGXJpOcigMTzyB3HjJ1L9I'], success (res) { } }) - } + }, + rollback(e){ + var that = this; + let prames = { + id : e.currentTarget.dataset.id, + auditStatus : '0', + applyUserId : '', + applyUserName : '', + applyTime : '', + instanceId : '', + processKey : '', + method:'POST' + } + wx.showModal({ + title: '提示', + content: '确认撤回?', + success (res) { + if (res.confirm) { + UTIL.httpRequest(API.URL_GET_UPDATETYINNONGTRANSFERFOSTATUS, prames ,{ + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + wx.showToast({ + title: '撤回成功!', + icon: 'success', + duration: 2000 + }) + that.setData({ + yfqList:[], + yzdList:[] + }) + that.getTransferList2() + that.getTransferList1() + }else{ + wx.showToast({ + title: res.msg, + icon: 'error', + duration: 2000 + }) + } + } + }) + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + }, }) \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml index de9ed1f..9b0a065 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -172,16 +172,18 @@ - {{item.formData.activityBusinessType == '20' ? item.formData.eventName:item.formData.approvalItems}} + + {{item.formData.remark}} + {{item.formData.applyTime}} - {{item.formData.activityBusinessType=='35'?'现金转账':item.formData.activityBusinessType=='30'?'银行转账':'重大事项'}} + {{item.formData.transferType=='2'?'信用卡转账':item.formData.transferType=='1'?'银行转账':'其他'}} - {{item.formData.totalAmount}} + {{item.formData.expenditureAmount}} @@ -189,53 +191,85 @@ - {{item.formData.activityBusinessType == '20' ? item.formData.eventName:item.formData.approvalItems}} + + {{item.formData.remark}} + {{item.formData.applyTime}} - {{item.formData.activityBusinessType=='35'?'现金转账':item.formData.activityBusinessType=='30'?'银行转账':'重大事项'}} + {{item.formData.transferType=='2'?'信用卡转账':item.formData.transferType=='1'?'银行转账':'其他'}} - {{item.formData.totalAmount}} + {{item.formData.expenditureAmount}} - - + - {{item.submitDate}} + {{item.applyDate}} - {{item.formData.activityBusinessType=='35'?'现金转账':'银行转账'}} + {{item.transferType=='2'?'信用卡转账':item.transferType=='1'?'银行转账':'其他'}} - {{item.totalAmount}} + {{item.expenditureAmount}} - + --> + + + + + + {{item.remark}} + {{item.auditStatus == '1'?'审核中':item.auditStatus == '2'?'已拒绝':item.auditStatus == '3'?'已通过':''}} + + + + {{item.applyDate}} + + + + + {{item.transferType=='2'?'信用卡转账':item.transferType=='1'?'银行转账':'其他'}} + + {{item.expenditureAmount}} + + + + + + + 撤回 + + + + - {{item.approvalItems}} + + {{item.remark}} + {{item.auditStatus == '1'?'审核中':item.auditStatus == '2'?'已拒绝':item.auditStatus == '3'?'已通过':'草稿'}} + - {{item.submitDate}} + {{item.applyDate}} - {{item.formData.activityBusinessType=='35'?'现金转账':'银行转账'}} + {{item.transferType=='2'?'信用卡转账':item.transferType=='1'?'银行转账':'其他'}} - {{item.totalAmount}} + {{item.expenditureAmount}} diff --git a/pages/index/index.wxss b/pages/index/index.wxss index a7ace9e..8fe4ee3 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -247,19 +247,20 @@ width: 390rpx; font-size: 34rpx; margin-right: 30rpx; + display: flex; + align-items: center; + justify-content: space-between; +} +.workflow .process_intro .name .name_tit{ + width: 290rpx; + flex: 1; + overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; word-break: break-all; overflow: hidden; } -.workflow .process_intro .name .name_tit{ - width: 290rpx; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - float: left; -} .workflow .process_intro .state{ width: 93rpx; height: 42rpx; @@ -416,6 +417,15 @@ border-radius: 5px; font-size: 12px; } +.caogao{ + background-color: rgba(133, 133, 133, 1); + color:#ffffff ; + text-align: center; + float: right; + padding: 2px 5px; + border-radius: 5px; + font-size: 12px; +} .deleteBox{ width: 65px; text-align: center; diff --git a/pages/noLoginIndex.js b/pages/noLoginIndex.js new file mode 100644 index 0000000..97e6325 --- /dev/null +++ b/pages/noLoginIndex.js @@ -0,0 +1,103 @@ +// pages/noLoginIndex.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + showList:false, + showListText:'更多', + num:1 + }, + + openView(){ + var that = this; + let num = that.data.num; + console.log((num%2)); + if( (num%2) > 0 ){ + num++; + that.setData({ + showList:true, + showListText:'收起', + num:num + }) + }else{ + num++; + that.setData({ + showList:false, + showListText:'更多', + num:num + }) + } + }, + goLogin(){ + wx.showModal({ + title: '提示', + content: '登录后可使用全部功能,是否前往登录?', + success (res) { + if (res.confirm) { + wx.navigateTo({ + url: 'user/login/login', + }) + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/noLoginIndex.json b/pages/noLoginIndex.json new file mode 100644 index 0000000..86c858f --- /dev/null +++ b/pages/noLoginIndex.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "van-notice-bar": "@vant/weapp/notice-bar/index" + } +} \ No newline at end of file diff --git a/pages/noLoginIndex.wxml b/pages/noLoginIndex.wxml new file mode 100644 index 0000000..a6b4f9c --- /dev/null +++ b/pages/noLoginIndex.wxml @@ -0,0 +1,135 @@ + + + + + + + + + + 支出申请 + + + + + + 收入登记 + + + + + + 记账申请 + + + + + + 支付管理 + + + + + + + + + + + + + + +常用功能 + + + + + + 合同信息 + + + + 固定资产 + + + + 资源资产 + + + + 工程项目 + + + + + + + 财务公开 + + + + + 开户行 + + + + 收款方 + + + + 村账户 + + + + 银行汇票 + + + + 重大事项 + + + + + 交易明细 + + + + 转账对账 + + + + 收支统计 + + + + 票据签收 + + + + + + {{showListText}} + + + + + + 待办 + 已办 + 已提交 + 草稿箱 + + \ No newline at end of file diff --git a/pages/noLoginIndex.wxss b/pages/noLoginIndex.wxss new file mode 100644 index 0000000..bfe7486 --- /dev/null +++ b/pages/noLoginIndex.wxss @@ -0,0 +1,126 @@ +/* pages/noLoginIndex.wxss */ +page{ + background-color: #ffffff!important; + height: 100vh; +} +.navList_main{ + width: 685rpx; + height: 228rpx; + margin:0 auto; + display: flex; + border-top: 1px solid rgba(0,0,0,.1); +} +.navList_main .tab_item{ + flex: 1; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.navList_main .tab_item .icon{ + width: 130rpx; + height: 130rpx; + margin-bottom: 12rpx; +} +.navList_main .tab_item .icon_img{ + width: 130rpx; + height: 130rpx; +} +.navList_main .tab_item .desc{ + font-size: 26rpx; +} + +.page-section{ + width: 100%; +} +.page-section:last-child{ + margin-bottom: 0; +} +.page-section-spacing{ + box-sizing: border-box; +} +swiper{ + display: block; + height: 144px!important; +} + +.child_function{ + margin: 15px 20rpx 0; + display: flex; + flex-wrap: wrap; + align-content:space-between; +} +.child_function .flex_block{ + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + width: 20%; +} +.child_function .flex_block:nth-child(n+6){ + margin-top: 25rpx; +} +.child_function .flex_block .image{ + width: 76rpx; + height: 70rpx; + margin-bottom: 20rpx; +} +.child_function .flex_block .attribute{ + width: 76rpx; + height: 70rpx; +} + +.child_function .flex_block .desc{ + font-size: 26rpx; +} + +.work_plan{ + padding: 40rpx 32.5rpx 30rpx; + display: flex; + justify-content: space-between; +} + +.work_plan .menu_item{ + height: 60rpx; + width: 140rpx; + background-color: #fff; + box-shadow: 0rpx 4rpx 9rpx rgba(0,0,0,.2); + border-radius: 60rpx; + line-height: 60rpx; + text-align: center; + font-size: 28rpx; + position: relative; +} +.work_plan .menu_item.active{ + background-color: #5bae78; + color: #fff; +} +.work_plan .menu_item .remind{ + height: 30rpx; + background: #e90101; + color: #fff; + font-size: 26rpx; + position: absolute; + line-height: 30rpx; + padding:0 10rpx; + border-radius: 50px; + top: -10rpx; + right: -10rpx; +} + +.work_plan .more{ + flex: 1; + text-align: center; + line-height: 60rpx; + font-size: 36rpx; + color: #31936c; +} + +.title{ + font-size: 18px; + padding: 0 32.5rpx; + margin-top: 10px; + display: block; + font-weight: bold; +} \ No newline at end of file diff --git a/pages/payee/index.js b/pages/payee/index.js index d4170ce..b4bf0a9 100644 --- a/pages/payee/index.js +++ b/pages/payee/index.js @@ -21,59 +21,60 @@ Page({ console.log(options) // 可优化:数据请求放到 onload中 新增后在子页面修改父页面数据 var that = this; - UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type_all', {method:'GET'}, { - success: (res) => { - that.setData({ - bankTypeOptions:res.data, - }) - } - }) that.setData({ - // isPeers:options.isPeers,//是否同行 - // bankType:options.bankType,//所属银行 + isPeers:options.isPeers,//是否同行 + bankType:options.bankType,//所属银行 // accountType:options.accountType,//账户类型 payeeType:options.transferType,//申请转帐类型 money:options.money,//申请转帐类型 index:options.index }) - // 获取收款账号列表 - let prames = { - pageNum:1, - pageSize:999, - orderByColumn:'id', - isAsc:'desc', - // isPeers:that.data.isPeers,//是否同行 - // bankType:that.data.bankType,//所属银行 - // accountType:that.data.accountType,//账户类型 - // payeeType:that.data.payeeType,//申请转帐类型 - status:'0', - method:'GET' - } - UTIL.httpRequest(API.URL_GET_SELECTLIST , prames, { - success: (res) => { - let array = res.rows ; - var payeeType = that.data.payeeType; - var list = []; - array.map(res=>{ - // .replace(/^(.{6})(?:\d+)(.{4})$/,"\$1****\$2") - res.payeeAccountText = res.payeeAccount; - res.bankTypeText = (that.data.bankTypeOptions.filter(function (e) { return e.dictValue == res.bankType; }))[0].dictLabel; - if(payeeType == 2 && array.length>0){ - if(res.payeeType == 4 || res.payeeType == 3 ){ - list.push(res) + // 获取收款账号列表 + let prames = { + pageNum:1, + pageSize:999, + orderByColumn:'id', + isAsc:'desc', + isPeers:that.data.isPeers,//是否同行 + bankType:that.data.bankType,//所属银行 + // accountType:that.data.accountType,//账户类型 + // payeeType:that.data.payeeType,//申请转帐类型 + status:'0', + method:'GET' + } + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type_all', {method:'GET'}, { + success: (res) => { + that.setData({ + bankTypeOptions:res.data, + }) + UTIL.httpRequest(API.URL_GET_SELECTLIST , prames, { + success: (res2) => { + let array = res2.rows ; + var payeeType = that.data.payeeType; + var list = []; + array.map(res3=>{ + // .replace(/^(.{6})(?:\d+)(.{4})$/,"\$1****\$2") + res3.payeeAccountText = res3.payeeAccount; + res3.bankTypeText = (res.data.filter(function (e) { return e.dictValue == res3.bankType; }))[0].dictLabel; + if(payeeType == 2 && array.length>0){ + if(res3.payeeType == 4 || res3.payeeType == 3 ){ + list.push(res3) + } } - } - if(payeeType == 1 && array.length>0){ - if(res.payeeType == 1){ - list.push(res) + if(payeeType == 1 && array.length>0){ + if(res3.payeeType == 1){ + list.push(res3) + } } - } - }) - that.setData({ - list:list, - }) - } - }) + }) + that.setData({ + list:list, + }) + } + }) + } + }) + }, goAdd(){ wx.navigateTo({ @@ -170,7 +171,7 @@ Page({ return; } let array = that.data.list.filter(function (e) { return e.id == that.data.result; }); - array[0].incomeAmount = that.data.money; + // array[0].incomeAmount = that.data.money; console.log(array); let pages = getCurrentPages(); let currentPage = null; //当前页面 @@ -178,9 +179,15 @@ Page({ currentPage = pages[pages.length - 1]; //获取当前页面,将其赋值 prevPage = pages[pages.length - 2]; //获取上一个页面,将其赋值 if (prevPage) { - prevPage.setData({ - ["form.transfers["+that.data.index+"].payeeList[0]"]: array[0],//将想要传的信息赋值给上一个页面data中的值 - ["form.transfers["+that.data.index+"].accountType"]:array[0].accountType + for(let i = 0 ; i < prevPage.data.form.payeeList.length ; i++){ + if(prevPage.data.form.payeeList[i].payeeAccount == array[0].payeeAccount){ + UTIL.showToastNoneIcon('当前收款方已选!'); + return; + } + } + prevPage.setData({ + ["form.payeeList["+that.data.index+"]"]: array[0],//将想要传的信息赋值给上一个页面data中的值 + ["form.accountType"]:array[0].accountType }) that.back() } diff --git a/pages/payee/index.wxml b/pages/payee/index.wxml index 77f76a5..e93e146 100644 --- a/pages/payee/index.wxml +++ b/pages/payee/index.wxml @@ -27,7 +27,7 @@ use-label-slot > - + {{item.payee}} diff --git a/pages/payee/list/list.wxml b/pages/payee/list/list.wxml index 32033a0..32411d7 100644 --- a/pages/payee/list/list.wxml +++ b/pages/payee/list/list.wxml @@ -30,6 +30,7 @@ + diff --git a/pages/paymentManager/paymentManager.js b/pages/paymentManager/paymentManager.js index 218e387..beb2223 100644 --- a/pages/paymentManager/paymentManager.js +++ b/pages/paymentManager/paymentManager.js @@ -191,7 +191,7 @@ Page({ }, toPayDetail(e){ wx.navigateTo({ - url: '/pages/pay/detail?id='+e.currentTarget.dataset.id+'&&ids='+e.currentTarget.dataset.ids, + url: '/pages/handle/expenditureAuditNew/expenditureAuditNew?id='+e.currentTarget.dataset.ids+'&&ids='+e.currentTarget.dataset.ids+'&&type=see', }) }, scrap(e){ diff --git a/pages/paymentManager/paymentManager.wxml b/pages/paymentManager/paymentManager.wxml index 0f6bb79..7cd0ab0 100644 --- a/pages/paymentManager/paymentManager.wxml +++ b/pages/paymentManager/paymentManager.wxml @@ -24,7 +24,7 @@ - + {{item.remark}} @@ -44,9 +44,9 @@ - + - + {{item.expenditureAmount}} diff --git a/pages/paymentManager/paymentManager.wxss b/pages/paymentManager/paymentManager.wxss index 19d09da..9beb8e5 100644 --- a/pages/paymentManager/paymentManager.wxss +++ b/pages/paymentManager/paymentManager.wxss @@ -122,6 +122,7 @@ text{display: block;} } .tit_box{ display: flex; + align-items: center; } .detail_box{ margin-top: 14px; @@ -177,7 +178,6 @@ text{display: block;} .li .tit{ font-size: 16px; color: #444444; - line-height: 14px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; diff --git a/pages/paymentManager/toPay/toPay.js b/pages/paymentManager/toPay/toPay.js index cdd87e4..1f255a5 100644 --- a/pages/paymentManager/toPay/toPay.js +++ b/pages/paymentManager/toPay/toPay.js @@ -152,15 +152,27 @@ Page({ } UTIL.httpRequest(API.URL_GET_PAY,params,{ success: (res) => { - wx.showModal({ - title: "", - showCancel: false, - content: "支付成功,请等待银行进行处理,稍后可通过查询结果按钮查询银行处理结果。", - confirmText: '确定', - success: function (e) { - _this.back() - } - }) + if (res.code == API.SUCCESS_CODE) { + wx.showModal({ + title: "", + showCancel: false, + content: "支付成功,请等待银行进行处理,稍后可通过查询结果按钮查询银行处理结果。", + confirmText: '确定', + success: function (e) { + _this.back() + } + }) + }else{ + wx.showModal({ + title: "", + showCancel: false, + content: res.msg, + confirmText: '确定', + success: function (e) { + _this.back() + } + }) + } }, fail:(res) => { UTIL.showToastNoneIcon(res) diff --git a/pages/phoneLogin.js b/pages/phoneLogin.js new file mode 100644 index 0000000..3a7c18a --- /dev/null +++ b/pages/phoneLogin.js @@ -0,0 +1,184 @@ +// pages/phoneLogin.js +import * as UTIL from '../utils/util.js'; +import * as jsencrypt from '../utils/jsencrypt.js'; +import * as API from '../utils/API.js'; +let EVN_CONFIG = require('../env/env'); + +const app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + isIPX: app.globalData.isIPX, + formData:{ + username:'', + password:'', + code:'', + }, + codeUrl:'' + }, + back:function(){ + wx.navigateBack({ + delta: 1 + }) + }, + onChange(event){ + this.setData({ + [event.currentTarget.dataset.value]: event.detail, + }) + }, + onSubmit(){ + var that = this; + if (this.data.formData.rememberMe) { + wx.setStorageSync("username", this.data.formData.username, { expires: 30 }); + wx.setStorageSync('key', data)("password", encrypt(this.data.formData.password), { expires: 30 }); + wx.setStorageSync("rememberMe", this.data.formData.rememberMe, { expires: 30 }); + } else { + wx.removeStorage("username"); + wx.removeStorage("password"); + wx.removeStorage("rememberMe"); + } + //账号密码登录 + if (this.data.formData.username == "") { + UTIL.showToastNoneIcon('账号不能为空') + return false; + } else if (this.data.formData.password == "") { + UTIL.showToastNoneIcon('密码不能为空') + return false; + } else if (!this.data.formData.code) { + UTIL.showToastNoneIcon('图片验证码不能为空') + return false; + } + let form = { + username:this.data.formData.username, + password:this.data.formData.password, + code:this.data.formData.code, + uuid:this.data.formData.uuid, + } + form.username = jsencrypt.encrypt(this.data.formData.username); + form.password = jsencrypt.encrypt(this.data.formData.password); + + console.log(jsencrypt.encrypt(this.data.formData.username)) + console.log(jsencrypt.encrypt(this.data.formData.password)) + console.log(jsencrypt.decrypt(form.username)) + console.log(jsencrypt.decrypt(form.password)) +// return; + wx.showLoading({ + title: '正在登录', + mask:true + }) + UTIL.httpRequestNoneDetal(API.URL_GET_LOGIN,form, "POST", { + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + wx.hideLoading(); + wx.setStorageSync('token', res.token); + getApp().globalData.userInfo.token = res.token; + wx.reLaunch({ + url: '/pages/index/index', + }) + }else{ + wx.hideLoading(); + UTIL.showToastNoneIcon(res.msg) + that.getCode(); + } + } + }) + + // UTIL.httpRequestNoneDetal(API.URL_GET_GETPHONELOGIN+this.data.form.phone,{}, "GET", { + // success: (res) => { + // if (res.code == API.SUCCESS_CODE) { + // wx.setStorageSync('token', res.token); + // getApp().globalData.userInfo.token = res.token; + // wx.reLaunch({ + // url: '/pages/index/index', + // }) + // }else{ + // UTIL.showToastNoneIcon(res.msg) + // } + // } + // }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + getCode(){ + var that = this; + UTIL.httpRequestNoneDetal(API.URL_GET_GETCODE,{}, "GET", { + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + that.setData({ + ["formData.uuid"]:res.uuid, + codeUrl:"data:image/gif;base64," + res.img + }) + }else{ + UTIL.showToastNoneIcon(res.msg) + } + } + }) + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + var that = this; + UTIL.httpRequestNoneDetal(API.URL_GET_GETCODE,{}, "GET", { + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + that.setData({ + ["formData.uuid"]:res.uuid, + codeUrl:"data:image/gif;base64," + res.img + }) + }else{ + UTIL.showToastNoneIcon(res.msg) + } + } + }) + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/phoneLogin.json b/pages/phoneLogin.json new file mode 100644 index 0000000..e52dace --- /dev/null +++ b/pages/phoneLogin.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "van-field": "@vant/weapp/field/index" + } +} \ No newline at end of file diff --git a/pages/phoneLogin.wxml b/pages/phoneLogin.wxml new file mode 100644 index 0000000..c93b4fd --- /dev/null +++ b/pages/phoneLogin.wxml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/phoneLogin.wxss b/pages/phoneLogin.wxss new file mode 100644 index 0000000..f44551d --- /dev/null +++ b/pages/phoneLogin.wxss @@ -0,0 +1,98 @@ +/* pages/phoneLogin.wxss */ +.bottom{ + width: 100%; + margin: 0 auto; + text-align: center; + margin-top: 30px; + margin-bottom: 30px; + display: flex; +} + +.bottom view { + width: 47%; + margin: 0 auto; + border-radius: 30px; + display: inline-block; +} + +.bottom .btn2{ + border: 1px solid transparent; + padding: 8px 0px; + background-image: linear-gradient(to right, #2C8E68, #5CAE77); + color: #fff; +} + +.container{ + width: 100vw; + height: 100vh; +} +.container .header{ + padding-top: 25.24vh; + height: 36.94vh; +} + +.container .header .principal{ + height: 6.15vh; + line-height: 6.15vh; + margin-bottom: 0.61vh; + text-align: center; + font-size: 4.92vh; + color: #2c7339; +} + +.container .header .instructions{ + font-size: 2.46vh; + height: 4.92vh; + line-height: 4.92vh; + text-align: center; + color: #2c7339; +} +.container .quick-login{ + position: fixed; + width: 80%; + left: 10%; + background-color: #fff; + border-radius: 10px; + overflow: hidden; + box-shadow: 10px 10px 10px rgba(0, 0, 0, 0.1); + padding: 30px 20px 0; +} +.van-field__body { + /* border-bottom: 1px solid #dddddd; */ +} +.container .quick-login .key-login{ + width: 89vw; + height: 5.17vh; + background:#ffffff; + margin:0 auto; + border-radius: 5.17vh; + text-align: center; + line-height: 5.17vh; + font-size: 2.21vh; + color: #2c7339; + box-shadow: 8rpx 6rpx 20rpx rgba(0,0,0,.3); + padding: 0; +} + +.container .quick-login .authorization{ + margin-top: 5vh; + display: flex; + justify-content: center; /* 相对父元素水平居中 */ + align-items: center; /* 子元素相对父元素垂直居中 */ + color: #fff; +} + +.container .quick-login .authorization .changeSize{ + transform: scale(0.7,0.7); +} +.container .quick-login .authorization .changeSize .wx-checkbox-input { + border-radius: 1vh; +} +.container .quick-login .authorization text{ + margin-left: -.5vw; +} +scroll-view text{ + display: block; + line-height: 24px; + text-indent: 2rem; +} \ No newline at end of file diff --git a/pages/resources/resources.wxml b/pages/resources/resources.wxml index 6a10b5f..81ca2cc 100644 --- a/pages/resources/resources.wxml +++ b/pages/resources/resources.wxml @@ -39,7 +39,7 @@ /> - + @@ -51,17 +51,17 @@ {{item.resourceSortText}} {{item.code}} - {{item.totalArea}}㎡ + {{item.totalArea}}亩 - + diff --git a/pages/resources/resources.wxss b/pages/resources/resources.wxss index 8b0f4d6..49cccae 100644 --- a/pages/resources/resources.wxss +++ b/pages/resources/resources.wxss @@ -129,6 +129,12 @@ van-search { display: flex; align-items: center; color: #2C8E68; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + word-break: break-all; + overflow: hidden; + width: 20%; /* font-size: 16px; */ } .li .wtj{ @@ -164,8 +170,8 @@ van-search { -webkit-line-clamp: 1; word-break: break-all; overflow: hidden; - width: 50%; font-size: 16px; + flex: 1; } .li .fj_name{ font-size: 14px; @@ -179,10 +185,11 @@ van-search { margin-left: auto; } .li .money{ - font-size: 18px; + font-size: 16px; color: #E90000; text-align: right; margin-left: auto; + flex-shrink: 0; } .van-checkbox__label { /* display: flex; diff --git a/pages/user/login/login.js b/pages/user/login/login.js index c5c2f65..807cc49 100644 --- a/pages/user/login/login.js +++ b/pages/user/login/login.js @@ -7,9 +7,10 @@ Page({ data: { isIPhoneX:false, isIPX: APP.globalData.isIPX, - privacyCheck:true, //用户协议 + privacyCheck:false, //用户协议 showDialog:false, - nowDress:'' + nowDress:'', + showPhoneBtn:false }, onShow: function (options) { // this.setData({ @@ -29,8 +30,8 @@ Page({ //获取code UTIL.getCOdeFromWX({ complate: (code) => { - // //获取openId - console.log('aaaa'); + //获取openId + console.log('aaaa'); that.getOpenIdFromFW(code); } }); @@ -57,17 +58,31 @@ Page({ console.log(res); if (res.code == API.SUCCESS_CODE) { // UTIL.showToastNoneIcon("openId:" + res._data.openid); - wx.setStorageSync('token', res.token); - wx.setStorageSync('openId', res.data.openId); - wx.setStorageSync('sessionKey', res.data.sessionKey); - getApp().globalData.userInfo.token = res.token; + if(res.token){ + wx.setStorageSync('token', res.token); + wx.setStorageSync('openId', res.data.openId); + wx.setStorageSync('sessionKey', res.data.sessionKey); + getApp().globalData.userInfo.token = res.token; + }else{ + this.setData({showPhoneBtn:true}) + } } else { //未获取到openId - wx.setStorageSync('openId', res.data.openId); - wx.setStorageSync('sessionKey', res.data.sessionKey); + // wx.setStorageSync('openId', res.data.openId); + // wx.setStorageSync('sessionKey', res.data.sessionKey); + this.setData({showPhoneBtn:true}) } } }) + }, + goIndex(){ + if(this.data.privacyCheck == false){ + APP.showToast("请阅读并同意【服务须知】!"); + return; + } + wx.reLaunch({ + url: '/pages/index/index', + }) }, //自动登录 automaticLogin(){ @@ -125,18 +140,18 @@ Page({ //微信一键登录授权 getPhoneNumber: function(res) { let that = this; - console.log(res); let { detail } = res; if (!detail.encryptedData) { //允许授权 - APP.showToast("未获取到手机号码,注册失败!"); + APP.showToast("未获取到手机号码,登录失败!"); return; }else if(this.data.privacyCheck == false){ - APP.showToast("请阅读并同意用户协议和隐私政策!"); + APP.showToast("请阅读并同意【服务须知】!"); return; } + console.log(detail) let sendData = { sessionKey:STORAGE.getSessionKey(), iv:detail.iv, @@ -189,6 +204,7 @@ Page({ UTIL.httpRequestNoneDetal(API.URL_POST_USERBAND, sendData,"POST",{ success: (res) => { if (res.code == API.SUCCESS_CODE) { + wx.setStorageSync('token', res.token); wx.reLaunch({ // url: '/pages/user/region/region', url: '/pages/index/index', @@ -211,6 +227,11 @@ Page({ this.setData({ privacyCheck:true }) + }, + goPhoneLogin(){ + wx.navigateTo({ + url: '/pages/phoneLogin', + }) } }) \ No newline at end of file diff --git a/pages/user/login/login.wxml b/pages/user/login/login.wxml index ca0edd4..5ecc150 100644 --- a/pages/user/login/login.wxml +++ b/pages/user/login/login.wxml @@ -13,22 +13,24 @@ - 为使用农燊云微信小程序服务(以下简称“本服务”或“小程序服务”),您应当阅读并遵守《农燊云微信小程序用户协议》,请务必审慎阅读、充分理解各条款内容,特别是免除或限制责任的相应条款,以及开通或使用某项服务的单独协议,并选择接受或不接受。 - 除非您已阅读并接受本条款所有条款,否则您无权使用农燊云微信小程序服务。您对本服务的登录、查看、发布信息等行为即视为已阅读并同意本条款的约束。 - 如果您未满18周岁,请在法定监护人的陪同下阅读本您协议,并特别注意未成年人使用条款。 - 一、协议的范围 - 1.1本条款是用户(以下简称“您”)与农燊云之间关于用户使用小程序服务所订立的协议。“用户”是指注册、登录、使用微信小程序的个人或组织;“其他用户”是指包括其他微信小程序用户、微信公众账号用户和微信用户等除您本人外与小程序服务相关的用户。 - 1.2本服务是指农燊云根据本协议向您提供的服务,包括协助您交接和管理租赁车辆等。我们会不断丰富您使用本服务的终端、形式等,如您已注册使用一种形式的服务,则可以以同一账号使用其他服务,本协议自动适用于您对所有版本的软件和服务的使用。 - 1.3提供本服务的微信小程序的所有权和全部的使用权均归农燊云所有,您开通后仅授权使用部分功能,具体以产品展示的为准。 - 1.4小程序属于微信公众账号,在不与本协议冲突的情况下,您应遵守《微信公众平台服务协议》、《腾讯微信软件许可及服务协议》等关于微信公众账号的其他相关规定。 - 1.5本协议内容包括本协议正文及所有我们已经发布或将来可能发布的隐私权政策、各项政策、规则、声明、通知、警示、提示、说明(以下统称为“用户规则”)。前述用户规则为本协议不可分割的补充部分,与本协议具有同等法律效力。如您使用农燊云产品及服务,视为您同意上述补充部分。 - - 二、小程序注册与审核 - - 2.1账号注册 - 2.1.1您在使用本服务前需要先进行注册和认证。您确认,在您开始注册使用农燊云产品及服务前,您应当是具备完全民事权利能力和与所从事的民事行为相适应的行为能力的自然人、法人或其他组织。若您不具备前述主体资格,请勿使用服务,否则您及您的监护人应承担因此而导致的一切后果,且我们有权注销(永久冻结)您的账户,并向您及您的监护人索偿。 - 2.1.2当您按照注册页面提示填写信息、阅读并同意本协议且完成全部注册程序后,您可获得农燊云平台账户并成为产品用户,即有权使用农燊云平台并获得相应服务。农燊云平台只允许每位用户使用一个主账户,但您可以在授权范围内获得多个子账号。 - 2.1.3该账户是您通过农燊云平台寻求并获得服务的唯一有效身份证明,请您妥善保管账号和密码。为使您更好地使用农燊云平台的各项服务,保障您的账户安全,本小程序主体可要求您按本协议、用户规则及我国法律规定完成实名认证。 - 2.1.4为维护小程序的健康运营,您应当准确完整地提供您的最新信息(包括您的名称及电子邮件地址、联系电话、联系地址等)。并且您承诺,在使用本服务的过程中提交和发布的信息均是真实、合法的,因不实信息导致农燊云或者第三方合法权益受损的,由您独立承担全部责任。 - 2.2账号安全 - 2.2.1在您成功注册后,我们将根据您的身份要素识别您的身份和授权登录。“身份要素”包括但不限于您的账户名称、密码、短信校验码、手机号码、身份证件号码及人脸信息、眼纹信息。您同意基于不同的终端以及您的使用习惯,我们可能采取不同的验证措施识别您的身份。 - 2.2.2如您发现账号遭他人非法使用,应立即通知本小程序主体。因黑客行为或您自身保管疏忽导致账号、密码遭他人非法使用所发生的一切责任,均应由您本人承担,本小程序主体不承担任何责任。 - 2.2.3您注册成功后,农燊云将给予您一个帐号,并由您自行设置相应密码,任何该账户项下的预订及支付等行为均视为您本人的操作。您应对您账户项下的所有行为结果(包括但不限于授权、绑定、结算)负责。 - - 三、服务及规范 - - 3.1服务内容 - 3.1.1本服务内容包含【支持通讯录、车辆调度、车辆管理、账单管理、业务信息推荐及】等技术功能,这些功能服务可能根据用户需求的变化,随着因服务版本不同、或服务提供方的单方判断而被优化或修改,或因定期、不定期的维护而暂缓提供。 - 3.1.2农燊云有权自行决定对服务或服务任何部分及其相关功能、应用软件进行变更、升级、修改、转移,并有权决定以适当的方式进行公示或通知。 - 3.2服务费用 - 3.2.1农燊云平台向您提供的服务目前是免费的。我们保留日后就程序及/或服务向您收费的权利。如果我们决定收取此类费用,我们会采取合理途径并以足够合理的期限提前通过法定程序并以本协议约定的方式通知您,确保您有充分选择的权利。 - 3.2.2您在使用小程序的过程中与第三方发生的费用结算,农燊云仅为您使用微信小程序服务提供技术支持,本协议的签署不代表农燊云成为您在汽车租赁过程中的参与者。农燊云不对基于服务而产生的任何行为担保、许可或向任何第三人承担共同责任。 - 3.3服务使用规则 - 3.3.1您在本服务中或通过本服务所传送、发布的任何内容并不反映或代表,也不得被视为反映或代表农燊云的观点、立场或政策,农燊云对此不承担任何责任。 - 3.3.2您不得利用农燊云账号或本服务进行如下行为:\n(1)提交、发布虚假信息,或盗用他人头像或资料,冒充、利用他人名义的;\n(2)强制、诱导其他您关注、点击链接页面或分享信息的;\n(3)虚构事实、隐瞒真相以误导、欺骗他人的;\n(4)利用技术手段批量建立虚假账号的;\n(5)利用平台账号或本服务从事任何违法犯罪活动的;\n(6)制作、发布与以上行为相关的方法、工具,或对此类方法、工具进行运营或传播,无论这些行为是否为商业目的;\n(7)其他违反法律法规规定、侵犯其他您合法权益、干扰农燊云正常运营或农燊云未明示授权的行为。 - 3.3.3农燊云有权查阅您的注册、交易数据及交易行为,如发现可能存在违反法律法规、本协议或相关规则的情形或其他任何问题,农燊云有权直接做出其认为合理的处理,包括但不限于通知修改、删除相关信息,停止被协议项下的服务内容等。前述约定不代表农燊云应对您的行为承担任何连带责任,您应对此产生的法律责任独立负责。 - - 四、法律责任 - - 4.1用户责任 - 4.1.1您应遵守《微信公众平台服务协议》中关于“法律责任”的约定,除非该等约定与本协议存在冲突。 - 4.1.2如果我们发现或收到他人举报或投诉您违反本协议约定的,我们有权不经通知随时对相关内容,包括但不限于对您的资料、聊天记录进行审查、删除,并视情节轻重对违规账号处以包括但不限于警告、账号封禁、设备封禁、功能封禁的处罚,且通知您处理结果。 - 4.1.3您理解并同意,因您违反相关法律法规或本协议约定引发的任何后果,均由您独立承担责任、赔偿损失,与我们无关。如侵害到农燊云或他人权益的,您须自行承担全部责任和赔偿一切损失。 - 4.2平台责任本小程序主体保证并承诺,本小程序主体系合法成立的法人,依据本协议约定向您提供相关网络服务,并会参考您提出的建议不断改善我们的服务,努力提高您的使用满意度。 - 4.3责任限制 - 4.3.1本服务仅为您与第三方之间的汽车租赁行为而提供协助,农燊云并非其中的参与者,对汽车租赁过程中产生的一切纠纷不承担任何责任。 - 4.3.2您理解并确认,我们需要定期或不定期地对农燊云平台或相关的设备进行检修或者维护,且互联网连接能力受到全球网路稳定性、技术状态、使用者所在地与使用的网路、电力供应、政府管制、计算机病毒、黑客攻击等既存不确定性的限制,如因此类情况而造成服务在合理时间内的中断,我们无需为此承担任何责任,但会事先进行通告。 - 4.3.3您理解并同意,在使用本服务的过程中,可能会遇到不可抗力等风险因素,使本服务发生中断。不可抗力是指不能预见、不能克服并不能避免且对一方或双方造成重大影响的客观事件,包括但不限于自然灾害如洪水、地震、瘟疫流行和风暴等以及社会事件如战争、动乱、政府行为等。出现上述情况时,农燊云将努力在第一时间与相关单位配合,及时进行修复,但是由此给您造成的损失农燊云在法律允许的范围内免责。 - 4.3.4农燊云不保证为向您提供便利而设置的外部链接的准确性和完整性。同时,对于该等外部链接指向的不由农燊云实际控制的任何网页上的内容,农燊云不承担任何责任。 - 4.4知识产权声明 - 4.4.1农燊云在本服务中提供的内容(包括但不限于网页、文字、图片、音频、视频、图表等)的知识产权归农燊云所有,您在使用本服务中所产生的内容的知识产权归您或相关权利人所有。 - 4.4.2除另有特别声明外,农燊云提供本服务时所依托软件的著作权、专利权、代码技术及其他知识产权均归农燊云所有。 - - 五、隐私政策 - - 5.1保护用户隐私是的农燊云一项基本政策,农燊云保证不对外公开或向第三方提供您的注册资料及您在使用网络服务时存储在农燊云的非公开内容,但下列情况除外:\n(1)事先获得用户的明确授权;\n(2)根据有关的法律法规要求;\n(3)按照相关政府主管部门的要求;\n(4)为维护社会公众的利益;\n(5)为维护农燊云的合法权益。 - 5.2当农燊云与第三方合作向用户提供相关的网络服务,在此情况下,如该第三方允诺严格承担与农燊云同等的保护用户隐私的责任,则视为您授权农燊云将包含个人注册资料在内的相关信息仅提供给该等第三方。 - - 六、协议解除和终止 - - 6.1如有下列情形的,我们有权单方面解除本协议,终止向您提供服务:\n(1)您为了非法目的而使用本服务的;\n(2)您使用本服务损害农燊云或其他第三方合法权益的;\n(3)您违反法律法规或本协议约定或违反与腾讯的其他约定的;\n(4)根据法律规定平台用户应提交真实信息,而您提供的资料不真实、或未能提供合理证明以证明其真实性的; - 6.2您同意,除上述所述情形外,农燊云有权根据风险及自身业务运营情况需要,随时终止向您提供本服务及接口的部分及全部,因此导致您无法使用服务或服务受到限制的,农燊云不构成违约,亦不承担任何法律责任。 - 6.3您停用该服务,或农燊云终止向您提供本协议项下的服务后,农燊云不再为您保留原账户中与之相关的任何信息。 - 6.4您使用本服务即视为您已阅读并同意受本协议的约束。农燊云小程序主体有权在必要时修改本协议。您可以在相关服务页面查阅最新版本的协议。本协议变更后,如果您继续使用微信小程序服务,即视为您已接受修改后的协议。如果您不接受修改后的协议,应当停止使用小程序服务。 - - 七、违约责任如 - - 如您因为使用本服务给农燊云造成损失的或者给第三方造成损失的,该损失(包括为维权而产生的合理支出)由您来承担。 - - 八、法律管辖 - - 8.1如双方就本协议内容或其执行发生任何争议,双方应友好协商解决;协商不成时,任何一方均可向农燊云所在地的人民法院提起诉讼。 - 8.2本协议的成立、生效、履行、解释及纠纷解决,适用中华人民共和国大陆地区法律(不包括冲突法)8.3本协议条款无论因何种原因部分无效或不可执行,其余条款仍有效,对双方都具有约束力。 + 关于”农燊云e三资+“的小程序服务(以下简称“本服务”)的说明: + 1.本服务是已线下签约客户的内部办公移动端工具,不统一对外开放! + 2.本服务不设用户注册功能,不采集用户信息! + 3.”微信一键登录“是通过该微信手机号验证系统后台用户中心是否存在此用户,存在则授权登录令牌! \ No newline at end of file diff --git a/pages/user/login/login.wxss b/pages/user/login/login.wxss index 59c4a2c..e89aa70 100644 --- a/pages/user/login/login.wxss +++ b/pages/user/login/login.wxss @@ -33,7 +33,7 @@ width: 89vw; height: 5.17vh; background:#ffffff; - margin:0 auto; + margin:1vh auto 0; border-radius: 5.17vh; text-align: center; line-height: 5.17vh; diff --git a/pages/user/region/region.js b/pages/user/region/region.js index 08f2e03..40dda0a 100644 --- a/pages/user/region/region.js +++ b/pages/user/region/region.js @@ -34,6 +34,7 @@ Page({ console.log(app.globalData.setInfo.latitude); }, goChangeUrl(e){ + // https://192.168.0.112:8080/api e.currentTarget.dataset.url const url = e.currentTarget.dataset.url; const name = e.currentTarget.dataset.name; const parentname = e.currentTarget.dataset.parentname; diff --git a/project.config.json b/project.config.json index d116a1a..9b91e68 100644 --- a/project.config.json +++ b/project.config.json @@ -46,14 +46,15 @@ "useCompilerPlugins": false, "ignoreUploadUnusedFiles": true, "minifyWXML": true, - "useStaticServer": true + "useStaticServer": true, + "condition": false }, "editorSetting": { "tabIndent": "insertSpaces", "tabSize": 2 }, "condition": {}, - "appid": "wxaace54cc2cf8924b", + "appid": "wx42bfbc1eab7aacce", "compileType": "miniprogram", "libVersion": "2.23.2" } \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json index 5ba520e..b77f4f0 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -1,10 +1,24 @@ { "setting": { - "compileHotReLoad": true + "compileHotReLoad": false }, "condition": { "miniprogram": { "list": [ + { + "name": "pages/user/login/login", + "pathName": "pages/user/login/login", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/apply/paymentTemplate/addNew/addNew", + "pathName": "pages/apply/paymentTemplate/addNew/addNew", + "query": "", + "launchMode": "default", + "scene": null + }, { "name": "pages/show/show", "pathName": "pages/index/index", @@ -199,11 +213,18 @@ "query": "id=15", "launchMode": "default", "scene": null + }, + { + "name": "", + "pathName": "pages/index/index", + "query": "", + "launchMode": "default", + "scene": null } ] } }, "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", - "projectname": "WXMB", + "projectname": "nsgk_yebz", "libVersion": "2.25.0" } \ No newline at end of file diff --git a/utils/API.js b/utils/API.js index 353eed1..a94e24c 100644 --- a/utils/API.js +++ b/utils/API.js @@ -19,11 +19,11 @@ const MSG_INVALID_USER_TOKEN='登陆信息失效,请重新登陆'; /****************接口地址start****************/ //获取openId -const URL_GET_OPENID=`/wechat/codeLogin`; +const URL_GET_OPENID=`/wechat/loginData`; // 获取手机号解密接口 const URL_POST_DECRYPTEDWXDATA = `/wechat/decryptedWXData`; // 微信绑定手机号 -const URL_POST_USERBAND = `/register/wechat/band`; +const URL_POST_USERBAND = `/wechat/phoneLogin`; //获取用户信息 const URL_GET_GETINFO = `/getInfo`; //获取待办 @@ -31,7 +31,9 @@ const URL_GET_TASKLIST = `/activiti/process/taskList`; //获取已办 const URL_GET_TASKDONELIST = `/activiti/process/taskDoneList`; //获取已发起、已制单 -const URL_GET_TRANSFERLIST = `/yinnong/approvalItems/list`; +// const URL_GET_TRANSFERLIST = `/yinnong/approvalItems/list`; +//获取已发起、已制单 +const URL_GET_TRANSFERLIST = `/yinnong/transfer/transferList`; // 修改密码 const URL_POST_UPDATEPWD = `/system/user/profile/updatePwd`; // 上传图片 @@ -69,6 +71,8 @@ const URL_GET_PAYEESELECTLIST = `/yinnong/payee/list`; const URL_GET_SELECTACCOUNTLIST = `/cashier/account/accountList`; //查询审批流模板列表 const URL_GET_TEMPLATELIST = `/service/template/list`; +//查询审批流模板列表 +const URL_GET_selectApprovalByTemplateId = `/service/templateDetail/selectApprovalByTemplateId/`; //查询审批流模板列表 const URL_GET_TEMPLATEDETAIL = `/yinnong/approvalProcess/getApprovalProcessByItemId/`; @@ -116,13 +120,23 @@ const URL_GET_USERAPPRO = `/yinnong/approvalItems/getUserApprovalItems`; const URL_GET_FINDLIST = `/system/attachment/find`; //查看附件列表 -const URL_GET_APPROVALITEMS = `/yinnong/approvalItems/getApprovalItem/`; +// const URL_GET_APPROVALITEMS = `/yinnong/approvalItems/getApprovalItem/`; + +//查看附件列表 +const URL_GET_APPROVALITEMS = `/yinnong/transfer/get/`; + +//查看附件列表 +const URL_GET_PAYEESELECTLISTNEW = `/yinnong/payee/selectlist`; //通过审批事项id删除审批模板 const URL_GET_REMOVEAPPROVAL = `/yinnong/approvalItems/remove/`; +//通过审批事项id删除审批模板 +const URL_GET_REMOVETRANFERL = `/yinnong/transfer/remove/`; +//通过审批事项id删除审批模板 +const URL_GET_UPDATETYINNONGTRANSFERFOSTATUS = `/yinnong/transfer/updateTYinnongTransferFoStatus`; //查询审批事项流转进度 -const URL_GET_GETPROCESS = `/yinnong/approvalItems/getProcessSchedule/`; +const URL_GET_GETPROCESS = `/yinnong/transfer/getProcessSchedule/`; //查询审批事项流转进度 const URL_GET_GETPROCESSHISTORY = `/activiti/process/listHistory/`; @@ -548,6 +562,27 @@ const URL_GET_GETPERMANENTFILLEDIT = `/asset/permanentFill/edit/`; //固定资产填报删除 const URL_GET_GETPERMANENTFILLREMOVE = `/asset/permanentFill/remove/`; +//手机号登录 +const URL_GET_GETPHONELOGIN = `/register/phone/`; + +//事项删除 +const URL_GET_TRANSFERREMOVE = `/yinnong/transfer/remove/`; + +//新增银行转账 +const URL_GET_TRANSFERADD = `/yinnong/transfer/add`; + +//提交审批 +const URL_GET_TRANSFERCUSTOMSUBMIT = `/yinnong/transfer/customSubmit/`; + +//修改银行转账 +const URL_GET_TRANSFEREDIT = `/yinnong/transfer/edit`; + +//获取验证码 +const URL_GET_GETCODE = `/gkyzm`; + +//账号密码登录 +const URL_GET_LOGIN = `/login`; + @@ -750,5 +785,16 @@ export { URL_GET_GETPERMANENTFILLADD, URL_GET_GETPERMANENTFILLGET, URL_GET_GETPERMANENTFILLEDIT, - URL_GET_GETPERMANENTFILLREMOVE + URL_GET_GETPERMANENTFILLREMOVE, + URL_GET_GETPHONELOGIN, + URL_GET_TRANSFERREMOVE, + URL_GET_TRANSFERADD, + URL_GET_TRANSFERCUSTOMSUBMIT, + URL_GET_PAYEESELECTLISTNEW, + URL_GET_TRANSFEREDIT, + URL_GET_REMOVETRANFERL, + URL_GET_selectApprovalByTemplateId, + URL_GET_UPDATETYINNONGTRANSFERFOSTATUS, + URL_GET_GETCODE, + URL_GET_LOGIN } \ No newline at end of file diff --git a/utils/jsencrypt.js b/utils/jsencrypt.js new file mode 100644 index 0000000..1373715 --- /dev/null +++ b/utils/jsencrypt.js @@ -0,0 +1,31 @@ +// import JSEncrypt from 'jsencrypt/bin/jsencrypt.min' +import WxmpRsa from 'wxmp-rsa' +// const rsa = new WxmpRsa() +// 密钥对生成 http://web.chacuo.net/netrsakeypair + +const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdH\n' + + 'nzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==' + +const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY\n' + + '7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKN\n' + + 'PuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gA\n' + + 'kM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWow\n' + + 'cSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99Ecv\n' + + 'DQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthh\n' + + 'YhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3\n' + + 'UP8iWi1Qw0Y=' + +// 加密 +export function encrypt(txt) { + const encryptor = new WxmpRsa() + encryptor.setPublicKey(publicKey) // 设置公钥 + return encryptor.encrypt(txt) // 对数据进行加密 +} + +// 解密 +export function decrypt(txt) { + const encryptor = new WxmpRsa() + encryptor.setPrivateKey(privateKey) // 设置私钥 + return encryptor.decrypt(txt) // 对数据进行解密 +} + diff --git a/utils/util.js b/utils/util.js index 811af9f..5e4b4d7 100644 --- a/utils/util.js +++ b/utils/util.js @@ -114,15 +114,15 @@ function httpRequest(url, data, { wx.showNavigationBarLoading(); let finalData = {}; Object.assign(finalData, data); - - finalData.token = getApp().globalData.userInfo.token; + // wx.getStorageSync('dressCode') + finalData.token = wx.getStorageSync('token'); wx.request({ url:wx.getStorageSync('dressCode')+url, data: finalData, method:data.method, timeout: 60000, header: { - 'Authorization':'Bearer '+getApp().globalData.userInfo.token + 'Authorization':'Bearer '+wx.getStorageSync('token') }, success: function (response) { if (response.data && response.data._code == API.INVALID_USER_TOKEN_CODE) {